Files
passepartout/org/system-self-improve.org
Amr Gharbeia 95d1ea3fed feat: add DeepSeek and NVIDIA NIM providers
- 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
2026-05-02 22:25:24 -04:00

2.1 KiB

SKILL: Self Edit (org-skill-self-edit.org)

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

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

Skill Registration

(defskill :passepartout-system-self-improve
  :priority 100
  :trigger (lambda (ctx) (declare (ignore ctx)) nil))

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

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

Skill Registration

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