#+TITLE: SKILL: Chat Agent (Universal Literate Note) #+ID: skill-chat #+STARTUP: content #+FILETAGS: :chat:conversational:ui:psf: * Overview The **Chat Agent** provides a dedicated conversational interface within Emacs (`*org-agent-chat*`). It enables fluid dialogue while maintaining strict persona alignment and contextual awareness. * Phase A: Demand (PRD) :PROPERTIES: :STATUS: FROZEN :END: ** 1. Purpose Define the interfaces for direct human-to-agent conversational interaction. ** 2. User Needs - **Direct Interaction:** Specialized handler for `:chat-message` events. - **Persona Alignment:** Consistency with the Identity Agent's definitions. - **Contextual Awareness:** Reference to chat history for dialogue continuity. - **Structural Output:** Responses formatted as valid Org-mode subtrees. ** 3. Success Criteria *** TODO Chat Event Triggering *** TODO Persona-Driven Response Generation *** TODO Emacs Buffer Insertion Verification * Phase B: Blueprint (PROTOCOL) :PROPERTIES: :STATUS: SIGNED :END: ** 1. Architectural Intent Interfaces for conversational event handling and UI integration. Source of truth is the dynamic chat buffer and the Identity skill. ** 2. Semantic Interfaces #+begin_src lisp (defun trigger-skill-chat (context) "Triggers on :sensor :chat-message.") (defun verify-skill-chat (proposed-action context) "Ensures response is targeted to the correct Emacs buffer.") #+end_src * Phase D: Build (Implementation) ** Event Perception #+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))) (eq sensor :chat-message))) #+end_src ** Symbolic Verification #+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) (eq (getf (getf proposed-action :payload) :action) :insert-at-end)) proposed-action '(:target :emacs :action :message :text "Chat failed to format response."))) #+end_src * Registration #+begin_src lisp (defskill :skill-chat :priority 100 :trigger #'trigger-skill-chat :neuro #'neuro-skill-chat :symbolic #'verify-skill-chat) #+end_src