Architectural Upgrade 2026-03-30: Modular Emacs, org-gtd v4.0, and PSF Phase 1
This commit is contained in:
113
system/skills/org-skill-creator.org
Normal file
113
system/skills/org-skill-creator.org
Normal file
@@ -0,0 +1,113 @@
|
||||
#+TITLE: SKILL: Skill Creator Agent (Reproductive System)
|
||||
#+ID: skill-creator-agent
|
||||
#+STARTUP: content
|
||||
|
||||
* Overview
|
||||
The **Skill Creator Agent** is the "Reproductive System" of the Neurosymbolic Lisp Machine. It enables the agent to autonomously generate new Org-Native skills, facilitating a "Self-Editing OS" philosophy where the system can evolve its own capabilities through a combination of neural drafting and symbolic validation.
|
||||
|
||||
* The Reproductive Mandate
|
||||
1. **Autonomy:** The agent must be able to draft complete skill files based on high-level user requirements or delegated tasks.
|
||||
2. **Safety First:** All generated code must pass symbolic syntax validation before being committed to the system.
|
||||
3. **Hierarchical Negotiation:** New skills must be assigned appropriate priorities to avoid disrupting existing core functionalities (e.g., Normalization must always stay higher than creative skills).
|
||||
|
||||
* Symbolic Implementation (The Logic)
|
||||
The implementation combines introspective neural prompts with rigorous Lisp syntax checking to ensure system stability.
|
||||
|
||||
** Architectural Intent: Delegation Trigger
|
||||
This skill is triggered when the Router identifies a gap in capabilities and delegates a "Create Skill" task to this agent.
|
||||
|
||||
#+begin_src 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
|
||||
|
||||
** Architectural Intent: Neuro-Cognitive Drafting
|
||||
The neural layer is provided with the current cognitive hierarchy, allowing it to "negotiate" priorities and design a skill that fits seamlessly into the existing system.
|
||||
|
||||
#+begin_src lisp
|
||||
(defun neuro-skill-creator (context)
|
||||
"Generate a System 1 prompt for drafting a new skill, using self-awareness of existing hierarchy."
|
||||
(let ((query (getf (getf context :payload) :query))
|
||||
;; Introspection - See what else the brain can do
|
||||
(existing-skills (org-agent:context-list-all-skills)))
|
||||
(format nil "
|
||||
You are the Skill Creator for a Neurosymbolic Lisp Machine.
|
||||
The user wants to teach the agent a new capability - '~a'
|
||||
|
||||
CURRENT COGNITIVE HIERARCHY (Active Skills):
|
||||
~a
|
||||
|
||||
Draft a COMPLETE Org-Native Skill file (.org).
|
||||
|
||||
INSTRUCTIONS:
|
||||
1. Assign a :priority integer. Negotiate this based on the existing hierarchy.
|
||||
- Safety/Normalization should always be highest (100+).
|
||||
- Logic/GTD should be medium (50-80).
|
||||
- New creative capabilities should typically be lower (20-40).
|
||||
|
||||
Structure:
|
||||
- Title and Skill Name headers
|
||||
- * Trigger block (Lisp)
|
||||
- * Neuro Prompt block (Lisp)
|
||||
- * Symbolic Verification block (Lisp)
|
||||
- * Registration block (Lisp using defskill)
|
||||
|
||||
Return a Lisp plist - (:target :system :action :create-skill :filename \"skill-name.org\" :content \"file content\")
|
||||
" query existing-skills)))
|
||||
#+end_src
|
||||
|
||||
** Architectural Intent: Symbolic Gatekeeping
|
||||
System 2 acts as the ultimate authority, extracting Lisp blocks from the neural draft and validating their syntax using the system compiler before allowing any files to be written.
|
||||
|
||||
#+begin_src lisp
|
||||
(defun creator-extract-lisp-blocks (content)
|
||||
"Extract Lisp source blocks from Org text."
|
||||
(let ((results nil)
|
||||
(lines (uiop:split-string content :separator '(#\Newline)))
|
||||
(in-block nil)
|
||||
(current-block ""))
|
||||
(dolist (line lines)
|
||||
(let ((clean (string-trim '(#\Space #\Tab #\Return) line)))
|
||||
(cond
|
||||
((uiop:string-prefix-p "#+begin_src lisp" (string-downcase clean))
|
||||
(setf in-block t))
|
||||
((uiop:string-prefix-p "#+end_src" (string-downcase clean))
|
||||
(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)
|
||||
"Validates new code syntax before delegating to the :system actuator."
|
||||
(let* ((payload (getf proposed-action :payload))
|
||||
(filename (getf payload :filename))
|
||||
(content (getf payload :content))
|
||||
(lisp-blocks (creator-extract-lisp-blocks content)))
|
||||
|
||||
(kernel-log "KERNEL [Creator] Validating ~a~%" filename)
|
||||
|
||||
(dolist (block lisp-blocks)
|
||||
(multiple-value-bind (valid err) (org-agent:validate-lisp-syntax block)
|
||||
(unless valid
|
||||
(kernel-log "KERNEL [Creator] REJECTED ~a~%" err)
|
||||
(return-from verify-skill-creator
|
||||
`(:target :emacs :action :message :text ,(format nil "Syntax error - ~a" err))))))
|
||||
|
||||
;; If syntax is valid, we return the proposed-action which targets :system.
|
||||
;; The core's execute-system-action will handle the file write and reload.
|
||||
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