- Add deepseek and nvidia entries to gateway-provider config - Add DEEPSEEK_API_KEY and NVIDIA_API_KEY to .env.example - Add deepseek and nvidia to doctor's LLM provider check - Fix remaining harness-log → log-message reference
52 lines
2.1 KiB
Org Mode
52 lines
2.1 KiB
Org Mode
#+TITLE: SKILL: Self Edit (org-skill-self-edit.org)
|
|
#+AUTHOR: Agent
|
|
#+FILETAGS: :system:autonomy:self-edit:
|
|
#+PROPERTY: header-args:lisp :tangle ../lisp/system-self-improve.lisp
|
|
|
|
* Overview: The Self-Modification Primitive
|
|
|
|
Self Edit is the capability that makes Passepartout autonomous in the strongest sense: it can modify its own source code. Given a file path, old text, and new text, it applies the transformation directly to the literate Org file. Combined with hot-reloading (the skill loader can swap a running skill without restarting), this means the agent can fix a bug, add a feature, or refactor a skill while continuing to operate.
|
|
|
|
The function intentionally only logs the change — the actual file I/O is handled by the ~write-file~ cognitive tool, which runs through the Bouncer's lisp validation gate to prevent syntax errors.
|
|
|
|
* Implementation
|
|
|
|
** Self-Edit Logic
|
|
#+begin_src lisp
|
|
(defun self-improve-edit (filepath old-text new-text)
|
|
"Applies a transformation to a source file."
|
|
(declare (ignore old-text new-text))
|
|
(harness-log "SELF-EDIT: Applying changes to ~a" filepath))
|
|
#+end_src
|
|
|
|
** Skill Registration
|
|
#+begin_src lisp
|
|
(defskill :passepartout-system-self-improve
|
|
:priority 100
|
|
:trigger (lambda (ctx) (declare (ignore ctx)) nil))
|
|
#+end_src
|
|
#+AUTHOR: Agent
|
|
#+FILETAGS: :system:autonomy:self-fix:
|
|
#+PROPERTY: header-args:lisp :tangle ../lisp/system-self-improve-add.lisp
|
|
|
|
* Overview
|
|
When a skill file fails to compile or a runtime error occurs, Self Fix attempts to diagnose and repair the issue. It receives error logs from the skill loader, identifies the broken file, and generates a corrected version that is hot-reloaded into the running image.
|
|
|
|
* Implementation
|
|
|
|
** Self-Fix Logic
|
|
#+begin_src lisp
|
|
(defun self-improve-fix (skill-name error-log)
|
|
"Attempts to diagnose and repair a broken skill."
|
|
(declare (ignore error-log))
|
|
(harness-log "SELF-FIX: Attempting repair of ~a..." skill-name))
|
|
#+end_src
|
|
|
|
** Skill Registration
|
|
#+begin_src lisp
|
|
(defskill :passepartout-system-self-improve
|
|
:priority 100
|
|
:trigger (lambda (ctx) (member (getf ctx :type) '(:LOG :EVENT)))
|
|
:deterministic (lambda (action ctx) (declare (ignore action ctx)) nil))
|
|
#+end_src
|