Files
memex/system/skills/org-skill-scribe.org

3.1 KiB

SKILL: Scribe Agent (Distillation Sub-Agent)

Overview

The Scribe Agent is an automated distillation sub-agent designed to ensure that the Memex never suffers from "context rot." It is the primary custodian of the Institutional Memory, responsible for Phase F (Memory) of the Personal Software Foundry (PSF) Consensus Loop.

It operates as a bridge between the high-frequency, chaotic stream of Daily Captures and the high-integrity, structured environment of Atomic Notes.

Operational Context

The Scribe runs as an isolated OpenClaw cron job, triggered nightly. It requires absolute path stability, pulling its environment variables directly from the system `.env` file to locate:

  • `$MEMEX_DAILY`: The raw capture stream.
  • `$MEMEX_NOTES`: The permanent Zettelkasten.
  • `$MEMEX_SYSTEM`: The state and configuration root.

The Distillation Pipeline

The Scribe does not simply copy text; it performs a cognitive filter to identify concepts that deserve permanence.

1. State Perception

The agent begins by identifying the "Knowledge Gap"—the delta between what has been distilled and what is new. It uses a state file to track the last processed Git commit hash.

2. Delta Analysis

By running a `git diff` against the daily folder, the Scribe identifies only the new thoughts, preventing redundant processing and saving token context.

3. Conceptual Extraction

For each new capture, the Scribe:

  • Analyzes: Determines the single, core concept of the note.
  • Normalizes: Generates a `kebab-case` filename (without dates).
  • Format: Ensures the note is a valid Org-mode node with a unique `#+ID`.
  • Provenance: Includes a `Source:` backlink to the specific daily file, preserving the chain of thought.

The PSF Mandate Audit

A critical secondary function of the Scribe is to act as the "Quality Guard" for the Foundry. It proactively audits all active projects to ensure they adhere to the Level 3 Standard.

Audit Checks:

  • Blueprint Integrity: Does every project have a `PRD.org` and a `PROTOCOL.org`?
  • The Org Mandate: Are there any forbidden `.md` files in the project root?
  • Knuth-Sovereign Principle: Do implementation files in `src/` use Literate Programming blocks?

Failure Handling:

If a project fails the audit, the Scribe records a Mandate Violation in institutional-memory.org. This prevents the agent from assuming a project is "Stable" when it is architecturally incomplete.

Symbolic Directive

When the agent's cognitive engine is invoked, it follows this strict execution sequence:

1. Read $MEMEX_SYSTEM/distillation-state.json
2. Run git diff <last_commit_hash> HEAD -- $MEMEX_DAILY/
3. For every new capture:
   a. Extract concept.
   b. Generate kebab-case filename.
   c. Write to $MEMEX_NOTES/ with ID and Provenance.
4. Run PSF Mandate Audit.
5. Record violations in institutional-memory.org.
6. Update distillation-state.json.