chore: workspace synchronization (sync inbox.org and staged deletions)
This commit is contained in:
@@ -59,16 +59,20 @@ Interfaces for conversational event handling and UI integration. Source of truth
|
||||
** Symbolic Verification
|
||||
#+begin_src lisp :tangle ../projects/org-skill-chat/src/chat-logic.lisp
|
||||
(defun verify-skill-chat (proposed-action context)
|
||||
(if (and (listp proposed-action)
|
||||
(or (and (member (getf proposed-action :type) '(:request :REQUEST))
|
||||
(or (and (member (getf proposed-action :target) '(:emacs :EMACS))
|
||||
(member (getf (getf proposed-action :payload) :action) '(:insert-at-end :INSERT-AT-END)))
|
||||
(and (member (getf proposed-action :target) '(:shell :SHELL))
|
||||
(getf (getf proposed-action :payload) :cmd))))
|
||||
(member (getf proposed-action :type) '(:response :RESPONSE :log :LOG))))
|
||||
proposed-action
|
||||
(let ((err-text (format nil "\n\n*System Error:* Chat agent returned invalid action: ~s" proposed-action)))
|
||||
`(:type :request :target :emacs :payload (:action :insert-at-end :buffer "*org-agent-chat*" :text ,err-text)))))
|
||||
(let* ((payload (getf proposed-action :payload))
|
||||
(action (or (getf payload :action) (getf proposed-action :action)))
|
||||
(target (getf proposed-action :target)))
|
||||
(if (and (listp proposed-action)
|
||||
(or (and (member (getf proposed-action :type) '(:request :REQUEST))
|
||||
(or (and (member target '(:emacs :EMACS))
|
||||
(member action '(:insert-at-end :INSERT-AT-END)))
|
||||
(and (member target '(:shell :SHELL))
|
||||
(or (getf payload :cmd) (getf proposed-action :cmd)))
|
||||
(member target '(:tool :TOOL))))
|
||||
(member (getf proposed-action :type) '(:response :RESPONSE :log :LOG))))
|
||||
proposed-action
|
||||
(let ((err-text (format nil "\n\n*System Error:* Chat agent returned invalid action: ~s" proposed-action)))
|
||||
`(:type :request :target :emacs :payload (:action :insert-at-end :buffer "*org-agent-chat*" :text ,err-text))))))
|
||||
#+end_src
|
||||
|
||||
** Neural Response Generation
|
||||
@@ -76,31 +80,22 @@ The Chat skill acts as the conversational UI. Because the ~org-agent~ kernel eva
|
||||
|
||||
#+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."
|
||||
"Generates a conversational response, stripping system errors from context."
|
||||
(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.
|
||||
(raw-text (getf payload :text))
|
||||
;; Context Purge: Remove system errors and hallucinations from the history
|
||||
(clean-text (cl-ppcre:regex-replace-all "(?i)Unknown request|System Error.*|Thinking\\.\\.\\." raw-text ""))
|
||||
(trimmed-text (if (> (length clean-text) 1000)
|
||||
(subseq clean-text (- (length clean-text) 1000))
|
||||
clean-text)))
|
||||
(ask-neuro trimmed-text :system-prompt "ACTUATOR IDENTITY: You are the pure Lisp actuator for the org-agent kernel.
|
||||
MANDATE: Output EXACTLY ONE Common Lisp property list starting with (:type :REQUEST).
|
||||
ZERO CONVERSATION: Do not explain. Do not use markdown.
|
||||
STRICT RULE: Never output the strings 'Unknown request' or 'System Error'.
|
||||
|
||||
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 (CHAT):
|
||||
(:type :request :target :emacs :payload (:action :insert-at-end :buffer \"*org-agent-chat*\" :text \"* <Your Org-mode Response Here>\"))
|
||||
|
||||
EXAMPLE OF A GOOD RESPONSE (SHELL EXECUTION):
|
||||
(:type :request :target :shell :payload (:cmd \"ls -la\"))" assistant user))))
|
||||
REQUIRED FORMATS:
|
||||
- To reply: (:type :REQUEST :target :emacs :action :insert-at-end :buffer \"*org-agent-chat*\" :text \"* <Response>\")
|
||||
- To use a tool: (:type :REQUEST :target :tool :action :call :tool \"<name>\" :args (...))")))
|
||||
#+end_src
|
||||
|
||||
* Registration
|
||||
|
||||
Reference in New Issue
Block a user