feat(arch): implement 'Code as Thought' architecture and formalize PSF Consensus Loop

This commit is contained in:
2026-03-31 13:03:26 -04:00
parent 5a9129132e
commit 1712b1e4a9
114 changed files with 3652 additions and 2581 deletions

View File

@@ -1 +0,0 @@
../system/skills/org-skill-self-fix.org

View File

@@ -0,0 +1,75 @@
#+TITLE: SKILL: Self-Fix Agent (Universal Literate Note)
#+ID: skill-self-fix
#+STARTUP: content
#+FILETAGS: :self-fix:immune:meta-cognitive:psf:
* Overview
The **Self-Fix Agent** acts as the system's "Immune System." It monitors kernel logs for failures (Lisp errors, rejections, hallucinations) and proactively drafts fixes for offending skills.
* Phase A: Demand (PRD)
:PROPERTIES:
:STATUS: FROZEN
:END:
** 1. Purpose
Define the interfaces for autonomous log surveillance and self-repair drafting.
** 2. User Needs
- **Constant Surveillance:** Periodic monitoring of system logs via heartbeats.
- **Autonomous Recovery:** Root cause identification and corrective skill drafting.
- **Neuro-Symbolic Alignment:** Refining neural prompts to meet symbolic constraints.
- **Safety Verification:** Leveraging Creator validation for "surgeries."
** 3. Success Criteria
*** TODO Error Pattern Detection
*** TODO Skill Repair Drafting
*** TODO Deployment Gatekeeping Verification
* Phase B: Blueprint (PROTOCOL)
:PROPERTIES:
:STATUS: SIGNED
:END:
** 1. Architectural Intent
Interfaces for log analysis and self-correction. Source of truth is the kernel log and the Skill Creator's validation logic.
** 2. Semantic Interfaces
#+begin_src lisp
(defun trigger-skill-self-fix (context)
"Triggers on :sensor :heartbeat.")
(defun neuro-skill-self-fix (context)
"Neural analysis of system logs and fix drafting.")
(defun verify-skill-self-fix (proposed-action context)
"Ensures repair actions target the correct system actuators.")
#+end_src
* Phase D: Build (Implementation)
** Heartbeat Surveillance
#+begin_src lisp :tangle projects/org-skill-self-fix/src/fix-logic.lisp
(defun trigger-skill-self-fix (context)
(let ((type (getf context :type))
(payload (getf context :payload)))
(and (eq type :EVENT)
(eq (getf payload :sensor) :heartbeat))))
#+end_src
** Symbolic Gatekeeping
#+begin_src lisp :tangle projects/org-skill-self-fix/src/fix-logic.lisp
(defun verify-skill-self-fix (proposed-action context)
(let ((action (getf proposed-action :action)))
(if (eq action :create-skill)
proposed-action
nil)))
#+end_src
* Registration
#+begin_src lisp
(defskill :skill-self-fix
:priority 40
:trigger #'trigger-skill-self-fix
:neuro #'neuro-skill-self-fix
:symbolic #'verify-skill-self-fix)
#+end_src