60 lines
1.9 KiB
Org Mode
60 lines
1.9 KiB
Org Mode
#+TITLE: Agent Chat Skill
|
|
#+AUTHOR: org-agent
|
|
#+SKILL_NAME: skill-chat
|
|
|
|
This skill provides a conversational interface within Emacs via the `*org-agent-chat*` buffer.
|
|
|
|
* Trigger
|
|
Triggers on direct chat messages from Emacs.
|
|
|
|
#+begin_src lisp
|
|
(defun trigger-skill-chat (context)
|
|
(let* ((payload (getf context :payload))
|
|
(sensor (getf payload :sensor)))
|
|
(eq sensor :chat-message)))
|
|
#+end_src
|
|
|
|
* Neuro Prompt
|
|
System 1 acts as a conversational partner, using the agent's identity and persona.
|
|
|
|
#+begin_src lisp
|
|
(defun neuro-skill-chat (context)
|
|
(let* ((payload (getf context :payload))
|
|
(text (getf payload :text))
|
|
(identity-pkg (find-package :org-agent.skills.skill-agent-identity))
|
|
(persona-fn (when identity-pkg (find-symbol "GET-AGENT-PERSONA" identity-pkg)))
|
|
(persona (if (and persona-fn (fboundp persona-fn))
|
|
(funcall persona-fn)
|
|
"You are a helpful Lisp agent.")))
|
|
(format nil "
|
|
~a
|
|
|
|
The user is talking to you in a dedicated chat buffer.
|
|
CHAT HISTORY / CURRENT BUFFER -
|
|
---
|
|
~a
|
|
---
|
|
|
|
Provide a helpful, conversational response in Org-mode format.
|
|
Return a Lisp plist - (:target :emacs :action :insert-at-end :buffer \"*org-agent-chat*\" :text \"\\n** Agent\\n<your response>\\n\")
|
|
" persona text)))
|
|
#+end_src
|
|
|
|
* Symbolic Verification
|
|
#+begin_src lisp
|
|
(defun verify-skill-chat (proposed-action context)
|
|
"Ensure the chat response is properly targeted."
|
|
(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 skill failed to format response correctly.")))
|
|
#+end_src
|
|
|
|
* Registration
|
|
#+begin_src lisp
|
|
(defskill :skill-chat
|
|
:priority 100 ; Chat is high-priority direct interaction
|
|
:trigger #'trigger-skill-chat
|
|
:neuro #'neuro-skill-chat
|
|
:symbolic #'verify-skill-chat)
|
|
#+end_src |