Files
memex/notes/org-skill-creator.org

102 lines
3.6 KiB
Org Mode

#+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))))
(defun discover-and-implement-skill (topic)
"Ars Contexta: Dynamic Skill Discovery.
1. Researches a TOPIC using the web skill.
2. Summarizes the API or methodology.
3. Drafts a new Org-Native skill in the notes/ directory."
(kernel-log "NEURO [Discovery] - Attempting to learn skill for '~a'..." topic)
;; This triggers a 'Foundry' sub-task with the researched context
(org-agent:spawn-task (format nil "Research the API for ~a and create a new PSF skill." topic)))
#+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