#+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'." (org-agent:ask-neuro (format nil "Explain why this failure occurred and propose a specific experiment to prove it: ~a" failure-log) :system-prompt "You are a PSF Senior Debugging Scientist. Use formal logic and the scientific method.")) (defun scientist-run-experiment (hypothesis) "Designs a minimal test case based on a hypothesis." ;; Delegates to TDD Runner to create and run the experiment. (org-agent:spawn-task (format nil "Create a minimal failing test for: ~a" hypothesis))) #+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