Files
memex/notes/org-skill-scribe.org

80 lines
2.8 KiB
Org Mode

#+TITLE: SKILL: Scribe Agent (Universal Literate Note)
#+ID: skill-scribe
#+STARTUP: content
#+FILETAGS: :scribe:distillation:psf:audit:
* Overview
The **Scribe Agent** is the primary custodian of the Institutional Memory. It distills ephemeral daily thoughts into atomic notes and audits foundry projects for compliance with PSF standards.
* Phase A: Demand (PRD)
:PROPERTIES:
:STATUS: FROZEN
:END:
** 1. Purpose
Define automated distillation and auditing behaviors for the PSF.
** 2. User Needs
- **Knowledge Distillation:** Extract evergreen concepts from raw dailies.
- **Incremental Processing:** Efficient Git-based delta tracking.
- **PSF Mandate Audit:** High-integrity check for PRD/PROTOCOL artifacts.
- **Autonomous Execution:** Cron-compatible, environment-driven logic.
** 3. Success Criteria
*** TODO Distillation Accuracy
*** TODO Audit Trigger Verification
*** TODO State Persistence (Lisp alist)
* Phase B: Blueprint (PROTOCOL)
:PROPERTIES:
:STATUS: SIGNED
:END:
** 1. Architectural Intent
Interfaces for state-aware knowledge extraction and structural auditing.
** 2. Semantic Interfaces
#+begin_src lisp
(defun scribe-scan-for-knowledge-gaps ()
"Identifies new daily captures via git diff.")
(defun scribe-distill-concept (daily-path concept-meta)
"Transforms raw data into a permanent node.")
(defun scribe-audit-foundry-mandate (project-name)
"Checks for mandatory PSF artifacts.")
#+end_src
* Phase D: Build (Implementation)
** State Perception
#+begin_src lisp :tangle projects/org-skill-scribe/src/scribe-engine.lisp
(defun scribe-scan-for-knowledge-gaps ()
(let* ((state-file (or (uiop:getenv "SCRIBE_STATE") "scribe-state.lisp"))
(state (if (uiop:file-exists-p state-file) (with-open-file (in state-file) (read in)) '((:last-commit . "HEAD~1"))))
(last-hash (cdr (assoc :last-commit state))))
(uiop:run-program (list "git" "diff" "--name-only" last-hash "HEAD" "--" (or (uiop:getenv "MEMEX_DAILY") "daily/")) :output :lines)))
#+end_src
** Concept Distillation
#+begin_src lisp :tangle projects/org-skill-scribe/src/scribe-engine.lisp
(defun scribe-distill-concept (daily-path concept-meta)
(let* ((title (getf concept-meta :title))
(content (getf concept-meta :content))
(source (getf concept-meta :source))
(filename (format nil "~a.org" (cl-ppcre:regex-replace-all " " (string-downcase title) "-")))
(target-path (format nil "~a/~a" (or (uiop:getenv "MEMEX_NOTES") "notes") filename)))
(with-open-file (out target-path :direction :output :if-exists :supersede)
(format out "#+TITLE: ~a~%#+ID: ~a~%~%Source: [[file:~a]]~%~%~a" title (org-id-new) source content))
target-path))
#+end_src
* Registration
#+begin_src lisp
(defskill :skill-scribe
:priority 90
:trigger #'trigger-skill-scribe
:neuro #'neuro-skill-scribe
:symbolic #'scribe-scan-for-knowledge-gaps)
#+end_src