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

@@ -45,7 +45,7 @@ Interfaces for conversational event handling and UI integration. Source of truth
* Phase D: Build (Implementation)
** Event Perception
#+begin_src lisp :tangle projects/org-skill-chat/src/chat-logic.lisp
#+begin_src lisp :tangle ../projects/org-skill-chat/src/chat-logic.lisp
(defun trigger-skill-chat (context)
(let* ((payload (getf context :payload))
(sensor (getf payload :sensor)))
@@ -53,12 +53,42 @@ Interfaces for conversational event handling and UI integration. Source of truth
#+end_src
** Symbolic Verification
#+begin_src lisp :tangle projects/org-skill-chat/src/chat-logic.lisp
#+begin_src lisp :tangle ../projects/org-skill-chat/src/chat-logic.lisp
(defun verify-skill-chat (proposed-action context)
(if (and (eq (getf proposed-action :target) :emacs)
(if (and (listp proposed-action)
(eq (getf proposed-action :target) :emacs)
(eq (getf (getf proposed-action :payload) :action) :insert-at-end))
proposed-action
'(:target :emacs :action :message :text "Chat failed to format response.")))
'(:type :REQUEST :target :emacs :payload (:action :insert-at-end :buffer "*org-agent-chat*" :text "\n\n*System Error:* Chat agent failed to format response as a valid Lisp action."))))
#+end_src
** Neural Response Generation
The Chat skill acts as the conversational UI. Because the ~org-agent~ kernel evaluates LLM output via ~read-from-string~ (expecting a valid s-expression) and the chat verifier strictly expects an Emacs ~:insert-at-end~ actuation, we must explicitly mandate that the LLM wraps its conversational output in a Common Lisp property list.
#+begin_src lisp :tangle ../projects/org-skill-chat/src/chat-logic.lisp
(defun neuro-skill-chat (context)
"Generates a conversational response using the PSF Identity persona,
mandating an s-expression return format."
(let* ((payload (getf context :payload))
(text (getf payload :text))
(user (or (uiop:getenv "MEMEX_USER") "User"))
(assistant (or (uiop:getenv "MEMEX_ASSISTANT") "Passepartout")))
(ask-neuro text :system-prompt (format nil "IDENTITY: You are ~a, the sovereign assistant to ~a.
MANDATE: Speak ONLY in Org-mode subtrees. No double asterisks.
INTERFACE: You are a pure actuator function. Your output MUST be exactly one Common Lisp property list.
STRICT RULES:
1. Do NOT output any conversational text.
2. DO NOT say 'Okay', 'I will do that', or 'I am inserting'.
3. DO NOT wrap the output in quotes or markdown blocks.
4. Your entire response must parse as a valid Common Lisp list.
EXAMPLE OF A BAD RESPONSE:
Okay, here is your answer:
(:type :request ...)
EXAMPLE OF A GOOD RESPONSE:
(:type :request :target :emacs :payload (:action :insert-at-end :buffer \"*org-agent-chat*\" :text \"* <Your Org-mode Response Here>\"))" assistant user))))
#+end_src
* Registration