feat(arch): implement 'Code as Thought' architecture and formalize PSF Consensus Loop
This commit is contained in:
@@ -1 +0,0 @@
|
||||
../system/skills/org-skill-creator.org
|
||||
92
notes/org-skill-creator.org
Normal file
92
notes/org-skill-creator.org
Normal file
@@ -0,0 +1,92 @@
|
||||
#+TITLE: SKILL: Skill Creator Agent (Universal Literate Note)
|
||||
#+ID: skill-creator
|
||||
#+STARTUP: content
|
||||
#+FILETAGS: :creator:reproductive:meta-cognitive:psf:
|
||||
|
||||
* Overview
|
||||
The **Skill Creator Agent** is the "Reproductive System" of the Lisp Machine. It enables autonomous generation of new Org-Native skills, facilitating a "Self-Editing OS" philosophy through neural drafting and symbolic validation.
|
||||
|
||||
* Phase A: Demand (PRD)
|
||||
:PROPERTIES:
|
||||
:STATUS: FROZEN
|
||||
:END:
|
||||
|
||||
** 1. Purpose
|
||||
Define the interfaces for autonomous skill generation and syntax validation.
|
||||
|
||||
** 2. User Needs
|
||||
- **Autonomy:** Draft complete skill files from natural language requirements.
|
||||
- **Safety First:** Mandatory symbolic syntax validation of generated code.
|
||||
- **Hierarchical Negotiation:** Automatic priority assignment based on existing brain structure.
|
||||
|
||||
** 3. Success Criteria
|
||||
*** TODO Skill Draft Generation
|
||||
*** TODO Lisp Syntax Validation Gate
|
||||
*** TODO Skill Registration Verification
|
||||
|
||||
* Phase B: Blueprint (PROTOCOL)
|
||||
:PROPERTIES:
|
||||
:STATUS: SIGNED
|
||||
:END:
|
||||
|
||||
** 1. Architectural Intent
|
||||
Interfaces for skill inception and verification. Source of truth is the current cognitive hierarchy.
|
||||
|
||||
** 2. Semantic Interfaces
|
||||
#+begin_src lisp
|
||||
(defun trigger-skill-creator (context)
|
||||
"Triggers on :delegation :target-skill :skill-creator.")
|
||||
|
||||
(defun creator-extract-lisp-blocks (content)
|
||||
"Parses Org content to isolate code blocks.")
|
||||
|
||||
(defun verify-skill-creator (proposed-action context)
|
||||
"Symbolic gatekeeper validating syntax before deployment.")
|
||||
#+end_src
|
||||
|
||||
* Phase D: Build (Implementation)
|
||||
|
||||
** Trigger Perception
|
||||
#+begin_src lisp :tangle projects/org-skill-creator/src/creator-logic.lisp
|
||||
(defun trigger-skill-creator (context)
|
||||
(let ((type (getf context :type))
|
||||
(payload (getf context :payload)))
|
||||
(and (eq type :EVENT)
|
||||
(eq (getf payload :sensor) :delegation)
|
||||
(eq (getf payload :target-skill) :skill-creator))))
|
||||
#+end_src
|
||||
|
||||
** Symbolic Gatekeeping
|
||||
#+begin_src lisp :tangle projects/org-skill-creator/src/creator-logic.lisp
|
||||
(defun creator-extract-lisp-blocks (content)
|
||||
(let ((results nil)
|
||||
(lines (uiop:split-string content :separator '(#\Newline)))
|
||||
(in-block nil)
|
||||
(current-block ""))
|
||||
(dolist (line lines)
|
||||
(cond
|
||||
((cl-ppcre:scan "^#\\+begin_src lisp" (string-downcase line)) (setf in-block t))
|
||||
((cl-ppcre:scan "^#\\+end_src" (string-downcase line))
|
||||
(setf in-block nil)
|
||||
(push current-block results)
|
||||
(setf current-block ""))
|
||||
(in-block (setf current-block (concatenate 'string current-block line (string #\Newline))))))
|
||||
(nreverse results)))
|
||||
|
||||
(defun verify-skill-creator (proposed-action context)
|
||||
(let* ((payload (getf proposed-action :payload))
|
||||
(lisp-blocks (creator-extract-lisp-blocks (getf payload :content))))
|
||||
(dolist (block lisp-blocks)
|
||||
(multiple-value-bind (valid err) (org-agent:validate-lisp-syntax block)
|
||||
(unless valid (return-from verify-skill-creator `(:target :emacs :action :message :text ,err)))))
|
||||
proposed-action))
|
||||
#+end_src
|
||||
|
||||
* Registration
|
||||
#+begin_src lisp
|
||||
(defskill :skill-creator
|
||||
:priority 70
|
||||
:trigger #'trigger-skill-creator
|
||||
:neuro #'neuro-skill-creator
|
||||
:symbolic #'verify-skill-creator)
|
||||
#+end_src
|
||||
Reference in New Issue
Block a user