PSF: Stabilizing workspace after crash. Valid kernel/skill fixes.

This commit is contained in:
2026-04-04 20:27:39 -04:00
parent 65a14784d3
commit 7ac10d1f95
47 changed files with 25388 additions and 3235 deletions

View File

@@ -24,23 +24,33 @@ Eliminate speculative debugging through rigorous scientific methodology.
* Phase D: Build (Implementation)
** Scientific Loop
#+begin_src lisp :tangle projects/org-skill-scientist/src/scientist-logic.lisp
(defun scientist-formulate-hypothesis (failure-log)
"Analyzes an error and proposes a 'Theory of Failure'.
Then triggers the Self-Fix agent."
(let ((hypothesis (org-agent:ask-neuro
(format nil "Explain why this failure occurred and propose a surgical fix: ~a" failure-log)
:system-prompt "You are a PSF Senior Debugging Scientist. Use formal logic and propose a fix in Lisp.")))
(kernel-log "SCIENTIST - Hypothesis formulated. Triggering SELF-FIX...")
#+begin_src lisp :tangle ../projects/org-skill-scientist/src/scientist-logic.lisp
(defun scientist-hypothesis (context)
"Neural stage: Formulates a hypothesis about a failure based on logs."
(let* ((payload (getf context :payload))
(failure-log (getf payload :text))
(project (getf payload :project)))
(org-agent:ask-neuro
(format nil "Project ~a failed with log: ~a. Formulate a 'Theory of Failure' and suggest a surgical fix." project failure-log)
:system-prompt "You are a PSF Senior Debugging Scientist. Return a Lisp plist: (:target :scientist :action :propose :hypothesis \"...\" :failure-log \"...\")")))
(defun scientist-propose-fix (action context)
"Symbolic stage: Triggers the Self-Fix agent with the formulated hypothesis."
(declare (ignore context))
(let* ((payload (getf action :payload))
(hypothesis (getf payload :hypothesis))
(failure-log (getf payload :failure-log)))
(org-agent:kernel-log "SCIENTIST - Hypothesis formulated. Triggering SELF-FIX...")
(org-agent:inject-stimulus
`(:type :EVENT :payload (:sensor :repair-request :hypothesis ,hypothesis :failure-log ,failure-log)))))
`(:type :EVENT :payload (:sensor :repair-request :hypothesis ,hypothesis :failure-log ,failure-log)))
(format nil "SUCCESS - Scientist proposed fix for failure.")))
#+end_src
* Registration
#+begin_src lisp
(defskill :skill-scientist
:priority 90
:trigger (lambda (context) (search "ERROR" (getf (getf context :payload) :text)))
:neuro #'scientist-formulate-hypothesis
:symbolic (lambda (action context) action))
:trigger (lambda (context) (eq (getf (getf context :payload) :sensor) :test-failure))
:neuro #'scientist-hypothesis
:symbolic #'scientist-propose-fix)
#+end_src