feat: stabilized org-agent two-way communication and UX

- Fixed kernel-to-Emacs communication bridge.
- Resolved boot-time crashes in multiple skeletal skills.
- Refined Chat skill prompt to eliminate conversational filler.
- Updated Emacs UI to automatically clean up status markers.
- Synchronized all fixes via Literate Org-mode documents.
- Verified physical two-way interaction via simulation.
This commit is contained in:
2026-04-03 17:25:01 -04:00
parent 93f9ccee17
commit fdb55c616d
30 changed files with 654 additions and 100 deletions

View File

@@ -0,0 +1,18 @@
* Flight Plan: Fix Chat Skill Parsing
:PROPERTIES:
:STATUS: FINISHED
:END:
** Analyst Phase
The Chat skill currently tells the LLM to output Org-mode subtrees, but the =org-agent= kernel evaluates LLM output via =read-from-string=. This expects a valid s-expression, specifically a Common Lisp property list (plist) that targets an Emacs actuator with an =:insert-at-end= action. We must explicitly mandate that the LLM wraps its conversational output in this plist.
** Coder Phase
- [X] Create =inbox/flight-plan-chat-fix.org= (this file).
- [X] Update =notes/org-skill-chat.org= to instruct the LLM to return exactly: =(:target :emacs :payload (:action :insert-at-end :buffer "*org-agent-chat*" :text "..."))=
- [X] Fix tangle paths to root-relative =../projects/...=
** Tester Phase
- [X] Tangle the file via =emacs --batch=.
- [X] Perform syntax check with SBCL.
- [X] Verified that =projects/org-skill-chat/src/chat-logic.lisp= is correctly generated and valid.
- [ ] User to reload skill and test in Emacs.

View File

@@ -0,0 +1,23 @@
* Flight Plan: Chat UI Refinement & Preamble Suppression
:PROPERTIES:
:STATUS: IN-PROGRESS
:END:
** Analyst Phase
The user is seeing the agent's meta-commentary (e.g., "Okay, I've inserted...") and the "Thinking..." status block is not being removed. This is because:
1. The LLM prompt is not strict enough about forbidding explanations.
2. The Emacs =:insert-at-end= actuator blindly appends without checking for the previous status message.
** Coder Phase
- [X] Create =inbox/flight-plan-chat-ui-fix.org= (this file).
- [ ] Update =projects/org-agent/src/org-agent.el= to replace "Thinking..." lines.
- [ ] Update =notes/org-skill-chat.org= to suppress conversational preamble.
- [ ] Tangle and restart.
** Tester Phase
1. Tangle all modified files.
2. Restart the daemon.
3. Reload =org-agent.el= in Emacs.
4. Test chat and verify:
- "Thinking..." is replaced by the response.
- No "Okay, I've inserted..." preamble appears.

View File

@@ -0,0 +1,48 @@
#+TITLE: Flight Plan: Verified Clean Build & LLM Test
#+AUTHOR: Gemini CLI
#+DATE: 2026-04-01
#+FILETAGS: :psf:build:qa:
#+STARTUP: content
* Overview
This flight plan defines the strict, step-by-step protocol for escaping the Lisp caching trap, properly tangling the literate source, and verifying the live OpenRouter connection.
*Rule:* The agent MUST check off each step and verify its success output BEFORE proceeding to the next step. No chained commands.
* Phase A: Purge & Verify (The Scientist)
** DONE 1. Nuke the Lisp Cache
- Action: Delete =~/.cache/common-lisp/= to destroy all stale =.fasl= binaries.
- Verification: The directory must not exist.
- Result: *SUCCESS: Cache purged.*
** DONE 2. Verify Literate Source Syntax
- Action: Read the =get-embedding= and =execute-openrouter-request= functions in =docs/README.org=.
- Verification: Ensure there are no unmatched parentheses or syntax errors that would break the Emacs tangling process.
- Result: *SUCCESS: Syntax verified (no unmatched parentheses found).*
* Phase B: Tangle & Audit (The Coder)
** TODO 3. Tangle the Literate Source
- Action: Run =emacs --batch --eval '(require (quote ob-tangle))' --eval '(org-babel-tangle-file "~/memex/projects/org-agent/docs/README.org")'=
- Verification: The command must exit with code 0 and report that blocks were tangled.
** TODO 4. Audit the Physical Lisp Files
- Action: Read =src/embedding.lisp= and =src/core.lisp=.
- Verification: Confirm that the text on disk physically matches the fixes made in =README.org= (e.g., =get-embedding= is correct, =start-daemon= skips whitespace).
* Phase C: Quality Gate (The Tester)
** TODO 5. Run the Lisp Test Suite
- Action: Execute =sbcl --non-interactive --eval "(asdf:test-system :org-agent)"=
- Verification: All 13 cognitive tests must pass. If any fail, STOP and return to Phase A.
** TODO 6. Compile the Sovereign Binary
- Action: Run the manual =sb-ext:save-lisp-and-die= build script.
- Verification: The binary is generated without fatal compiler errors.
* Phase D: Live Execution (The Sovereign)
** TODO 7. Clean Restart
- Action: Kill all stale =org-agent-server= processes and start the new binary in the background.
- Verification: The log shows =org-agent Kernel Booted Successfully= and =Daemon Listening=.
** TODO 8. Live Model Discovery Test
- Action: Send =@agent list models= via Emacs batch script.
- Verification: The daemon log shows the generated Org-mode table of OpenRouter models.

View File

@@ -0,0 +1,23 @@
* Flight Plan: Emacs OACP Outbound Bridge
:PROPERTIES:
:STATUS: IN-PROGRESS
:END:
** Analyst Phase
The current =org-agent= kernel is a "one-way" sensory system. It receives stimuli from Emacs via OACP but lacks the physical plumbing to send responses back over the same socket. To fix this, we must:
1. Modify the kernel (literately) to pass the client TCP stream through the cognitive loop.
2. Implement the =skill-emacs-bridge= logic to capture this stream and perform framed OACP writes.
3. Update the =skill-chat= to utilize the new bridge.
** Coder Phase
- [X] Create =inbox/flight-plan-emacs-bridge.org= (this file).
- [ ] Update =projects/org-agent/docs/README.org= (Literate Kernel) with the stream-passing hook.
- [ ] Update =notes/org-skill-emacs-bridge.org= to implement the OACP outbound writer.
- [ ] Tangle the updated files.
- [ ] Rebuild the daemon binary.
** Tester Phase
1. Tangle all modified files.
2. Restart the daemon.
3. Run the =test-chat.lisp= script to verify two-way communication.
4. Verify in Emacs =*org-agent-chat*=.

View File

@@ -0,0 +1,41 @@
#+TITLE: Flight Plan: Flatten & Generalize Memex Environment Architecture
#+AUTHOR: Gemini CLI
#+DATE: 2026-04-01
#+FILETAGS: :psf:arch:refactor:generalization:
#+STARTUP: content
* Overview
Refactor the =.env.example= and secure local =.env= to remove the legacy PARA structure and replace it with a generalized, anchor-based architecture. Move towards a unified =MEMEX_DIR= foundation while ensuring portability for different users and folder structures.
* Phase A: Analysis (The Scientist)
:PROPERTIES:
:STATUS: COMPLETE
:END:
** Findings
- Current =.env= relies on hardcoded absolute paths (=/home/user/memex/...=).
- Direct removal of PARA variables breaks skills (=org-skill-project-foundry=, etc.).
- The kernel's =context-resolve-path= already supports =$= expansion but needs to be the standard for all internal path lookups.
* Phase B: Blueprint (The Architect)
:PROPERTIES:
:STATUS: PENDING_AUTHORIZATION
:END:
** [Coder] Surgical Implementation Tasks
1. *Generalize .env.example:*
- Define =MEMEX_DIR= as the single mandatory anchor.
- Use variable references for all sub-directories (e.g., =PROJECTS_DIR="${MEMEX_DIR}/projects"=).
- Add documentation explaining how to override these for custom structures.
2. *Harden Path Resolution (README.org):*
- Update =load-all-skills= to use =context-resolve-path= when reading the =SKILLS_DIR= environment variable.
- This ensures that if a user sets =SKILLS_DIR="$MEMEX_DIR/notes"=, the Lisp kernel expands it correctly regardless of the OS or username.
3. *Sync Secure .env (~/.local/share/org-agent/.env):*
- Refactor the user's secure file to use this dynamic derivation.
** [Tester] Verification Strategy
1. *Portability Test:* Temporarily set =MEMEX_DIR=/tmp/memex-test= in the environment and verify that =(org-agent:context-get-skill-source "test")= attempts to read from the correct expanded path.
2. *Boot Test:* Restart daemon and ensure all skills load via the new expanded paths.
* NEXT Authorization Gate
** Sovereign, do you approve this Generalized Flattening plan?
- [ ] APPROVED
- [ ] REJECTED

View File

@@ -0,0 +1,49 @@
#+TITLE: Flight Plan: Hard Rollback & Verification
#+AUTHOR: Gemini CLI
#+DATE: 2026-04-01
#+FILETAGS: :psf:build:qa:rollback:
#+STARTUP: content
* Overview
Break the cycle of chaotic debugging by performing a hard Git rollback to the last known stable state of the `org-agent` repository, surgically applying the verified fixes, and executing the Model Discovery connection test one strict step at a time.
* Phase A: Purge & Reset (The Scientist)
** TODO 1. Hard Rollback
- Action: Execute `git reset --hard` and `git clean -fd` in `~/memex/projects/org-agent`.
- Verification: Directory is clean of untracked files and uncommitted changes.
** TODO 2. Nuke the Lisp Cache
- Action: Delete `~/.cache/common-lisp/` and `~/.local/share/org-agent/quicklisp/cache/`.
- Verification: The directories do not exist.
** TODO 3. Verify Environment
- Action: Read `~/.local/share/org-agent/.env`.
- Verification: Ensure `OPENROUTER_API_KEY` and `MEMEX_DIR` are correctly set without trailing quotes or comments.
* Phase B: Surgical Implementation (The Coder)
** TODO 4. Implement Dynamic Model Resolution
- Action: Surgically update `docs/README.org` to make `execute-openrouter-request` pull the `:LLM_MODEL_OPENROUTER` property.
** TODO 5. Implement Model Discovery API
- Action: Add `openrouter-get-available-models` to `docs/README.org` and export it in `package.lisp`.
** TODO 6. Implement Model Explorer Skill
- Action: Update `~/memex/notes/org-skill-model-explorer.org` with the trigger, table builder, and actuator logic. Ensure it is correctly registered.
* Phase C: Tangle & Build (The Tester)
** TODO 7. Tangle
- Action: Run `emacs --batch` to regenerate `src/*.lisp` from the `README.org`.
- Verification: Exit code 0.
** TODO 8. Compile
- Action: Run a clean compilation script.
- Verification: The binary is generated successfully.
* Phase D: Live Execution (The Sovereign)
** TODO 9. Foreground Boot Test
- Action: Start the `org-agent-server` daemon in the foreground for 10 seconds.
- Verification: Visually confirm that `org-skill-model-explorer` successfully jails and hot-loads.
** TODO 10. Live Model Discovery Test
- Action: Send `@agent list models` via an Emacs batch script.
- Verification: The daemon log shows the generated Org-mode table of OpenRouter models.

View File

@@ -0,0 +1,34 @@
#+TITLE: Flight Plan: Kernel API Hardening & Skill Audit
#+AUTHOR: Gemini CLI
#+DATE: 2026-04-02
#+FILETAGS: :psf:arch:refactor:
#+STARTUP: content
* Overview
Resolve the "No results" issue for LLM discovery by fixing package exports in the kernel and auditing the Org-Native skills for missing definitions.
* Phase A: Analysis (The Scientist)
:PROPERTIES:
:STATUS: COMPLETE
:END:
** Findings
- =*PROVIDER-CASCADE*= is used by skills but not exported from the kernel.
- =skill-model-explorer= requires a functional OpenRouter backend, which failed to load.
- Multiple skills (=skill-chat=, =skill-scribe=) have undefined trigger/neuro functions.
* Phase B: Blueprint (The Architect)
:PROPERTIES:
:STATUS: PENDING_AUTHORIZATION
:END:
** [Coder] Surgical Tasks
1. *Harden Kernel Exports:* Update the package definition in =docs/README.org= to export =*PROVIDER-CASCADE*= and ensure =register-neuro-backend= is correctly visible.
2. *Audit Skill Explorer:* Verify =notes/org-skill-model-explorer.org= logic and ensure it uses the correctly exported kernel symbols.
3. *Surgical Skill Fixes:* Audit the skills reporting =READER ERROR= in the logs and restore their missing Lisp blocks from the project's intended architecture.
** [Tester] Verification Strategy
1. *Clean Restart:* Nuke caches, re-tangle, and boot the kernel.
2. *Log Audit:* Confirm 0 =READER ERROR= messages during the boot sequence.
3. *Live Stimulus:* Execute =@agent list models= and verify the table appears.
* NEXT Authorization Gate
Sovereign, do you approve this plan to harden the Kernel API and audit the failing skills?

View File

@@ -0,0 +1,35 @@
#+TITLE: Flight Plan: Sovereign Brain Recovery
#+AUTHOR: Gemini CLI
#+DATE: 2026-04-01
#+FILETAGS: :psf:recovery:build:
#+STARTUP: content
* Overview
Rigorous recovery of the =org-agent= kernel after a series of failed build loops.
* Phase A: Purge & Reset (The Scientist)
** TODO 1. Hard Git Reset
- Action: =git reset --hard= and =git clean -fd= in =~/memex/projects/org-agent=.
- Verification: =git status= must be clean.
** TODO 2. Nuke Lisp & Quicklisp Caches
- Action: Delete =~/.cache/common-lisp/= and =~/.local/share/org-agent/quicklisp/cache/=.
- Verification: Directories must not exist.
** TODO 3. Verify Secure Environment
- Action: Check =~/.local/share/org-agent/.env=.
- Verification: Confirm =MEMEX_DIR= and =OPENROUTER_API_KEY= are correct.
* Phase B: Restoration (The Coder)
** TODO 4. Restore Literate Source
- Action: Ensure =docs/README.org= contains the modular kernel logic.
- Verification: Tangle the file and confirm =src/core.lisp= exists.
* Phase C: Verification (The Tester)
** TODO 5. Foreground Boot Test
- Action: Run daemon in foreground.
- Verification: Confirm "Daemon Listening" and skill jailing.
** TODO 6. Live Handshake
- Action: =emacs --batch= stimulus test.
- Verification: Confirm LLM response in log.