PSF: Stabilizing workspace after crash. Valid kernel/skill fixes.
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
#+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.
|
||||
The *Scribe Agent* is the primary custodian of the Institutional Memory. It distills ephemeral daily thoughts into atomic notes, enriches the knowledge graph via Karpathy-style synthesis, and audits foundry projects.
|
||||
|
||||
* Phase A: Demand (PRD)
|
||||
:PROPERTIES:
|
||||
@@ -12,18 +12,23 @@ The *Scribe Agent* is the primary custodian of the Institutional Memory. It dist
|
||||
:END:
|
||||
|
||||
** 1. Purpose
|
||||
Define automated distillation and auditing behaviors for the PSF.
|
||||
Define automated distillation, enrichment, and auditing behaviors.
|
||||
|
||||
** 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.
|
||||
- *Knowledge Distillation:* Weekly scan of ~daily/~ files to extract evergreen concepts.
|
||||
- *Privacy Mandate:* NEVER process subtrees with the ~!personal~ tag. (LLM exclusion).
|
||||
- *Content Enrichment (Karpathy Method):*
|
||||
1. Cross-linking to existing notes.
|
||||
2. Merging redundant concepts.
|
||||
3. Splitting bloated notes.
|
||||
4. Deciding on further self-learning (deep or adjacent).
|
||||
5. Generating project ideas from insights.
|
||||
- *Archive Preservation:* Never delete originals from ~daily/~.
|
||||
|
||||
** 3. Success Criteria
|
||||
*** TODO Distillation Accuracy
|
||||
*** TODO Audit Trigger Verification
|
||||
*** TODO State Persistence (Lisp alist)
|
||||
*** TODO Successful distillation of a week's worth of dailies.
|
||||
*** TODO Automated link suggestion between new and old notes.
|
||||
*** TODO Project idea generation verified by user.
|
||||
|
||||
* Phase B: Blueprint (PROTOCOL)
|
||||
:PROPERTIES:
|
||||
@@ -31,64 +36,65 @@ Define automated distillation and auditing behaviors for the PSF.
|
||||
:END:
|
||||
|
||||
** 1. Architectural Intent
|
||||
Interfaces for state-aware knowledge extraction and structural auditing.
|
||||
Uses a weekly heartbeat trigger. Employs a "Compiler" approach: System 1 (Neuro) generates synthesis proposals, System 2 (Symbolic) verifies file-system safety and tag constraints.
|
||||
|
||||
** 2. Semantic Interfaces
|
||||
#+begin_src lisp
|
||||
(defun scribe-scan-for-knowledge-gaps ()
|
||||
"Identifies new daily captures via git diff.")
|
||||
(defun scribe-distill-weekly ()
|
||||
"Main entry point for weekly knowledge synthesis.")
|
||||
|
||||
(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.")
|
||||
(defun scribe-enrich-concept (note-id)
|
||||
"Triggers neural analysis for linking and project ideas.")
|
||||
#+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
|
||||
|
||||
** Sensory Logic
|
||||
** Git-based Change Detection
|
||||
#+begin_src lisp :tangle ../projects/org-skill-scribe/src/scribe-engine.lisp
|
||||
(defun scribe-get-changed-dailies ()
|
||||
"Returns list of daily files modified in the last 7 days via git."
|
||||
(uiop:run-program (list "git" "log" "--since='1 week ago'" "--name-only" "--pretty=format:" "--" "daily/") :output :lines))
|
||||
#+end_src
|
||||
|
||||
** Pre-Filtering (The Privacy Wall)
|
||||
#+begin_src lisp :tangle ../projects/org-skill-scribe/src/scribe-engine.lisp
|
||||
(defun scribe-filter-personal (org-ast-node)
|
||||
"Recursively strips out any headline or content tagged with !personal.
|
||||
This runs strictly in System 2 BEFORE any data is passed to System 1."
|
||||
(let ((tags (getf (org-agent:org-object-attributes org-ast-node) :TAGS)))
|
||||
(when (not (member "!personal" tags :test #'string=))
|
||||
org-ast-node)))
|
||||
#+end_src
|
||||
|
||||
** Karpathy-Style Synthesis
|
||||
#+begin_src lisp :tangle ../projects/org-skill-scribe/src/scribe-engine.lisp
|
||||
(defun neuro-skill-scribe-enrich (context)
|
||||
"Neural stage for high-entropy knowledge synthesis.
|
||||
Assumes 'context' has already passed through scribe-filter-personal."
|
||||
(let* ((content (getf context :content))
|
||||
(existing-notes "")) ; Skeletal: would call atomic-notes-scan
|
||||
(ask-neuro content :system-prompt
|
||||
(format nil "You are the PSF Scribe. Your goal is to ENRICH this concept.
|
||||
RULES:
|
||||
1. CROSS-LINK: Suggest links to existing notes.
|
||||
2. MERGE/SPLIT: Identify if this should be combined with another or broken down.
|
||||
3. SELF-LEARNING: Suggest a 'Path to Mastery' (deeper or adjacent).
|
||||
4. PROJECTS: Suggest a PSF-style project based on this.
|
||||
5. NO FILLER: Return a Lisp plist."))))
|
||||
|
||||
(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)
|
||||
#+end_src
|
||||
|
||||
* Registration
|
||||
#+begin_src lisp
|
||||
(defskill :skill-scribe
|
||||
:priority 90
|
||||
:priority 60
|
||||
:trigger #'trigger-skill-scribe
|
||||
:neuro #'neuro-skill-scribe
|
||||
:symbolic #'scribe-scan-for-knowledge-gaps)
|
||||
:neuro #'neuro-skill-scribe-enrich
|
||||
:symbolic #'scribe-get-changed-dailies)
|
||||
#+end_src
|
||||
|
||||
Reference in New Issue
Block a user