feat(arch): implement 'Code as Thought' architecture and formalize PSF Consensus Loop

This commit is contained in:
2026-03-31 13:03:26 -04:00
parent 5a9129132e
commit 1712b1e4a9
114 changed files with 3652 additions and 2581 deletions

View File

@@ -1 +0,0 @@
../system/skills/org-skill-chat.org

71
notes/org-skill-chat.org Normal file
View File

@@ -0,0 +1,71 @@
#+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