#+TITLE - Skill Creator (Reproductive System) #+AUTHOR - org-agent #+SKILL_NAME - skill-creator This skill allows the agent to autonomously generate new Org-Native skills. It implements the "Self-Editing OS" philosophy by using the Lisp compiler as a safety gate. * Trigger Triggers only when delegated to by the Router. #+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 * Neuro Prompt System 1 is tasked with drafting a complete Org-Native skill file. #+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 * Symbolic Verification & Acquisition System 2 acts as the Gatekeeper. It extracts Lisp blocks, validates syntax, and handles acquisition. #+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