Architectural Upgrade 2026-03-30: Modular Emacs, org-gtd v4.0, and PSF Phase 1
This commit is contained in:
72
system/skills/org-skill-chat.org
Normal file
72
system/skills/org-skill-chat.org
Normal file
@@ -0,0 +1,72 @@
|
||||
#+TITLE: SKILL: Chat Agent (Conversational Interface)
|
||||
#+ID: skill-chat-agent
|
||||
#+STARTUP: content
|
||||
|
||||
* Overview
|
||||
The **Chat Agent** provides a dedicated conversational interface for direct human-to-agent communication. It operates within a specialized Emacs buffer (`*org-agent-chat*`), allowing for fluid dialogue that leverages the agent's full persona and cognitive context.
|
||||
|
||||
* The Conversational Mandate
|
||||
1. **Direct Interaction:** The Chat skill is the primary handler for messages originating from the chat sensor.
|
||||
2. **Persona Alignment:** Responses must strictly adhere to the persona defined in the Identity Agent.
|
||||
3. **Contextual Awareness:** The agent should reference the current chat history to maintain continuity.
|
||||
4. **Structural Output:** All responses must be formatted as valid Org-mode subtrees.
|
||||
|
||||
* Symbolic Implementation (The Logic)
|
||||
The implementation focuses on identifying chat events and ensuring that the resulting dialogue is correctly integrated into the Emacs environment.
|
||||
|
||||
** Architectural Intent: Event Perception
|
||||
This trigger specifically monitors for `:chat-message` events, distinguishing conversational input from general system events or file changes.
|
||||
|
||||
#+begin_src lisp
|
||||
(defun trigger-skill-chat (context)
|
||||
(let* ((payload (getf context :payload))
|
||||
(sensor (getf payload :sensor)))
|
||||
(eq sensor :chat-message)))
|
||||
#+end_src
|
||||
|
||||
** Architectural Intent: Neuro-Cognitive Dialogue
|
||||
The neural layer generates the conversational response. It dynamically retrieves the agent's persona to ensure high-fidelity character alignment.
|
||||
|
||||
#+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
|
||||
|
||||
** Architectural Intent: Symbolic Verification
|
||||
Ensures that the neural output is correctly structured for the Emacs actuator, preventing malformed UI updates.
|
||||
|
||||
#+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
|
||||
Reference in New Issue
Block a user