chore: workspace synchronization (sync inbox.org and staged deletions)
This commit is contained in:
@@ -4,24 +4,35 @@
|
||||
(eq sensor :chat-message)))
|
||||
|
||||
(defun verify-skill-chat (proposed-action context)
|
||||
(if (and (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.")))
|
||||
(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))))))
|
||||
|
||||
(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 "You are ~a, the sovereign assistant to ~a.
|
||||
Follow the PSF Org Mandate: speak in Org-mode subtrees.
|
||||
Never use double asterisks for bold; use single asterisks.
|
||||
(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'.
|
||||
|
||||
CRITICAL INSTRUCTION:
|
||||
You are communicating directly with a Common Lisp microkernel. You MUST return your response as a single, valid Common Lisp property list (plist). Do NOT return any markdown formatting, backticks, or plain text outside the plist.
|
||||
|
||||
Your response MUST exactly match this structure:
|
||||
(:target :emacs :payload (:action :insert-at-end :buffer \"*org-agent-chat*\" :text \"<your org-mode response here>\"))" 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 (...))")))
|
||||
|
||||
Reference in New Issue
Block a user