71 lines
3.0 KiB
Org Mode
71 lines
3.0 KiB
Org Mode
#+TITLE: SKILL: Scribe-RCA Agent (Consensus Phase F Extension)
|
|
#+ID: skill-scribe-rca-agent
|
|
#+STARTUP: content
|
|
#+FILETAGS: :scribe:rca:learning:institutional-memory:
|
|
|
|
* Overview
|
|
The **Scribe-RCA Agent** is a specialized extension of the Scribe role within the [[file:../notes/personal-software-foundry.org][Personal Software Foundry (PSF)]]. Its purpose is to close the "Learning Loop" by automatically extracting **Root Cause Analysis (RCA)** entries from failed tasks or session logs.
|
|
|
|
By populating the [[file:../notes/institutional-memory.org][Institutional Memory]], the Scribe-RCA ensures that the agent never repeats the same technical mistake twice.
|
|
|
|
* The RCA Mandate
|
|
1. **Perception:** The Scribe must scan `$MEMEX_SYSTEM/logs/` and `*Messages*` for fatal Lisp or System errors.
|
|
2. **Diagnosis:** It must analyze the stack trace and the context of the failure to identify the *Root Cause*.
|
|
3. **Distillation:** It MUST generate a high-signal entry for the memory ledger, including:
|
|
- **Symptom:** What the user/agent saw.
|
|
- **Root Cause:** Why it actually happened.
|
|
- **Prevention:** The specific heuristic or code-change required to prevent recurrence.
|
|
|
|
* Symbolic Implementation (The Logic)
|
|
The following Lisp logic defines how the agent appends new learnings to the institutional memory.
|
|
|
|
#+begin_src lisp
|
|
(defun scribe-rca-append (symptom cause prevention)
|
|
"Appends a new RCA entry to the institutional-memory.org file."
|
|
(let* ((memex-dir (org-agent::get-env "MEMEX_DIR" "/app/"))
|
|
(memory-file (format nil "~anotes/institutional-memory.org" memex-dir))
|
|
(timestamp (format-time-string "[%Y-%m-%d %a]")))
|
|
|
|
(kernel-log "SCRIBE-RCA - Recording new learning: ~a" cause)
|
|
|
|
(with-open-file (out memory-file :direction :output :if-exists :append)
|
|
(format out "~%** ~a ~a~%- **Symptom:** ~a~%- **Root Cause:** ~a~%- **Prevention:** ~a~%"
|
|
timestamp cause symptom cause prevention))
|
|
|
|
(format nil "SUCCESS - Scribe-RCA updated Institutional Memory with: ~a" cause)))
|
|
#+end_src
|
|
|
|
* Neuro-Cognitive Prompt (The 'Think' Loop)
|
|
When an error is detected, the neuro-layer is invoked with the log data to perform the analysis.
|
|
|
|
#+begin_src lisp
|
|
(defun neuro-skill-scribe-rca (context)
|
|
(let* ((payload (getf context :payload))
|
|
(error-log (getf payload :error-log)))
|
|
(format nil "
|
|
You are the PSF Scribe-RCA Agent.
|
|
A failure has occurred in the system.
|
|
|
|
ERROR LOG:
|
|
---
|
|
~a
|
|
---
|
|
|
|
Your task: Perform a Root Cause Analysis.
|
|
1. Identify the 'Symptom' (The visible error).
|
|
2. Identify the 'Root Cause' (The underlying technical reason).
|
|
3. Define a 'Prevention' heuristic (How to avoid this forever).
|
|
|
|
Return a Lisp plist: (:target :scribe :action :rca-append :symptom \"...\" :cause \"...\" :prevention \"...\")
|
|
" error-log)))
|
|
#+end_src
|
|
|
|
* Registration
|
|
#+begin_src lisp
|
|
(defskill :skill-scribe-rca
|
|
:priority 90
|
|
:trigger #'trigger-skill-scribe-rca
|
|
:neuro #'neuro-skill-scribe-rca
|
|
:symbolic #'scribe-rca-append)
|
|
#+end_src
|