Files
org-agent-contrib/org-skill-scientist.org

68 lines
2.8 KiB
Org Mode

:PROPERTIES:
:ID: 95a555e5-bf95-4128-9224-7341c52c40b6
:CREATED: [2026-03-31 Tue 20:28]
:EDITED: [2026-04-07 Tue 13:42]
:END:
#+TITLE: SKILL: The Scientist Agent (Universal Literate Note)
#+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-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)))
(opencortex: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)))
(opencortex:kernel-log "SCIENTIST - Hypothesis formulated. Triggering SELF-FIX...")
(opencortex:inject-stimulus
`(: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) (eq (getf (getf context :payload) :sensor) :test-failure))
:neuro #'scientist-hypothesis
:symbolic #'scientist-propose-fix)
#+end_src
* Phase B: Blueprint (PROTOCOL)
:PROPERTIES:
:STATUS: SIGNED
:END:
** 1. Architectural IntentnEstablish core functional interfaces for this skill.\n\n** 2. Semantic Interfaces\n(defun trigger-skill-org-skill-scientist (context))\n(defun neuro-skill-org-skill-scientist (context))