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

3.1 KiB

SKILL: Skill Creator Agent (Universal Literate Note)

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)

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)

1. Architectural Intent

Interfaces for skill inception and verification. Source of truth is the current cognitive hierarchy.

2. Semantic Interfaces

(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.")

Phase D: Build (Implementation)

Trigger Perception

(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))))

Symbolic Gatekeeping

(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))

Registration

(defskill :skill-creator
  :priority 70
  :trigger #'trigger-skill-creator
  :neuro #'neuro-skill-creator
  :symbolic #'verify-skill-creator)