Files
memex/notes/org-skill-scribe.org
Amr Gharbeia fdb55c616d feat: stabilized org-agent two-way communication and UX
- Fixed kernel-to-Emacs communication bridge.
- Resolved boot-time crashes in multiple skeletal skills.
- Refined Chat skill prompt to eliminate conversational filler.
- Updated Emacs UI to automatically clean up status markers.
- Synchronized all fixes via Literate Org-mode documents.
- Verified physical two-way interaction via simulation.
2026-04-03 17:25:01 -04:00

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

Sensory Logic

(defun trigger-skill-scribe (context)
  "Triggers on delegation to :scribe or :distill."
  (let ((payload (getf context :payload)))
    (and (eq (getf context :type) :EVENT)
         (eq (getf payload :sensor) :delegation)
         (member (getf payload :target-skill) '(:scribe :distill)))))

(defun neuro-skill-scribe (context)
  "Neural stage for concept distillation."
  (declare (ignore context))
  nil)

Registration

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