#+TITLE: SKILL: The Scientist Agent (Universal Literate Note) #+ID: skill-scientist #+STARTUP: content #+FILETAGS: :debugging:science:logic:tdd:psf: #+DEPENDS_ON: skill-tdd-runner skill-scribe-rca * Overview The *Scientist Agent* provides a formal, hypothesis-driven approach to debugging. Instead of "trial and error," it formulates symbolic theories about why a failure occurred, designs experiments (test cases), and updates the system's *Institutional Memory* upon discovery. * Phase A: Demand (PRD) :PROPERTIES: :STATUS: FROZEN :END: ** 1. Purpose Eliminate speculative debugging through rigorous scientific methodology. ** 2. User Needs - *Hypothesis Formulation:* Neural generation of potential failure causes. - *Experimental Design:* Autonomous creation of minimal failing test cases. - *Theory Verification:* Execution of tests via the TDD Runner. - *Knowledge Update:* Permanent update to `RCA.org` to prevent regression. * 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...") (org-agent:inject-stimulus `(:type :EVENT :payload (:sensor :repair-request :hypothesis ,hypothesis :failure-log ,failure-log))))) #+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)) #+end_src