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

2.8 KiB

SKILL: Scribe Agent (Universal Literate Note)

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)

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)

1. Architectural Intent

Interfaces for state-aware knowledge extraction and structural auditing.

2. Semantic Interfaces

(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.")

Phase D: Build (Implementation)

State Perception

(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)))

Concept Distillation

(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))

Registration

(defskill :skill-scribe
  :priority 90
  :trigger #'trigger-skill-scribe
  :neuro #'neuro-skill-scribe
  :symbolic #'scribe-scan-for-knowledge-gaps)