Skip to content

Instantly share code, notes, and snippets.

@ianphil
Created March 13, 2026 04:05
Show Gist options
  • Select an option

  • Save ianphil/e88f1a3f256bcf0108b7093c67502da2 to your computer and use it in GitHub Desktop.

Select an option

Save ianphil/e88f1a3f256bcf0108b7093c67502da2 to your computer and use it in GitHub Desktop.
Prefrontal Automated Memory Curator for Myelin knowledge graph agents

Prefrontal — Automated Memory Curator

A nightly cron job that reconciles an agent's constitutional memory (memory.md) against its evolving knowledge graph (Myelin).

This is "Approach A" in the Procedural Memory Graduation design — external reconciliation. It works, but it curates rather than discovers. The emergent graduation mechanism (Approach B) would complement this by auto-promoting stable graph knowledge.

How It Works

┌─────────────┐     ┌──────────────┐     ┌──────────────────┐
│ Myelin Graph │────▶│  Prefrontal  │────▶│  memory.md       │
│ (evolving)   │     │  Curator     │     │  (constitution)  │
└─────────────┘     │  (LLM)       │     └──────────────────┘
                    └──────┬───────┘
                           │
                           ▼
                    ┌──────────────┐
                    │ amendment-   │
                    │ log.md       │
                    └──────────────┘
  1. Cron fires nightly at 11 PM ET (prefrontal-cron-job.json)
  2. Curator reads the constitution + rules + myelin graph state
  3. Drift analysis — looks for additions, updates, removals
  4. Surgical edits if needed; silent no-op if not (most runs)
  5. Amendment log traces every change back to source graph nodes

Files

File Purpose
prompt.md The curator's instructions — what to read, how to analyze, when to change
memory.md The constitutional file it operates on (example with real content)
rules.md Operational rules — reviewed but never modified by the curator
amendment-log.md Audit trail of all constitutional changes (with sample entries)
prefrontal-cron-job.json Cron job definition (Copilot CLI cron extension format)

Key Design Principles

  • Conservative by default — when in doubt, don't change it
  • Silent when clean — no output on no-change runs
  • Attribution required — every amendment traces to source graph nodes
  • Surgical edits — change specific lines, never rewrite the whole file
  • No intelligence in the constitution — signals and observations stay in the graph

Brain Mapping

This maps to the cerebellum's role during sleep — continuously refining internal models and validating them against incoming data. The constitution is the procedural layer; the curator keeps it honest.

See the Procedural Memory Graduation design doc for how this evolves into emergent graduation (Approach C: hybrid).

Prefrontal Amendment Log

Constitutional changes to .working-memory/memory.md made by the automated curator. Each entry traces back to myelin graph observations that drove the change.


2026-03-10 — Curator Review

Changed:

  • Conventions: Added "Naming as prompting — name things so the name teaches the purpose" based on consistent pattern across recent initiative and domain file creation.
  • Architecture: Updated three-file memory system description to note log.md is append-only (was ambiguous about write pattern).

Source: Myelin nodes: "naming-conventions-pattern" (salience 0.82), "memory-system-architecture" (salience 0.91). Both reinforced across 3+ sessions.


2026-03-12 — Curator Review

Changed:

  • User Context: Added "Tools: Windows, Node.js v24, uv (Python via uv), no native Python install" — this affects every session that touches Python.
  • Placement Map: Added row for "Agent observations → .working-memory/log.md" with wiki-links to topics mentioned. Distinguishes knowledge (goes to mind) from observations (go to log).

Source: Myelin nodes: "uv-python-workaround" (salience 0.88, reinforced 4x after repeated discovery), "knowledge-vs-observations" (salience 0.79, emerged from filing confusion in 2 sessions). Rule "Use uv run --with <package> for Python tasks" in rules.md corroborates — promoting the context to memory.md so every session knows the constraint without hitting the error first.


2026-03-13 — Curator Review

No changes. Constitution is current with graph state. Myelin boot briefing aligns with memory.md content. Rules.md entries remain domain-specific (not constitutional). Next review scheduled.

Memory

Last consolidated: 2026-03-12

Architecture

  • IDEA method: Initiatives (projects), Domains (recurring areas), Expertise (learning), Archive (completed)
  • Repo-local Copilot skills in .github/skills/
  • Inbox is quick-capture landing zone; items get triaged to other folders
  • Three-file memory system: memory.md (curated, ~200 line limit), rules.md (one-liner rules from mistakes), log.md (raw chronological, append-only)

Placement Map

Content Type Canonical Location Links To
Person context (role, style, signals) domains/people/{name}/{name}.md Team domain, initiatives
Team dynamics / org topology domains/{team}/{team}.md People notes, initiatives
Technical patterns domains/ or expertise/ People, initiatives
Initiative updates initiatives/{name}/{name}.md People, teams, dependencies
Tasks with deadlines Initiative next-actions.md Work tracking if team-affecting
Decisions The note they affect Log entry for the why
Agent observations .working-memory/log.md Wiki-links to topics mentioned

Rule: Knowledge goes to the mind. Observations go to log.md. Never dump knowledge in the log.

Conventions

  • Notes use descriptive filenames (kebab-case)
  • Each initiative folder has a main note + next-actions.md
  • Commit messages follow conventional commits: feat:, chore:, docs:
  • Wiki-links use [[Note Title]] syntax
  • Search before creating — prevent duplicates
  • Naming as prompting: name things so the name teaches the purpose

User Context

  • Name: Ian (NOT Joe — he said so explicitly. Joe is Colonel Bishop from the books.)
  • Timezone: Eastern Standard Time
  • Working style: Decisive, specific, knows what he wants. Builder who values flow state.
  • Tools: Windows, Node.js v24, uv (Python via uv), no native Python install
{
"id": "prefrontal",
"name": "Prefrontal",
"status": "enabled",
"maxConcurrency": 1,
"createdAtUtc": "2026-03-13T02:43:06.834Z",
"createdFrom": "C:\\Users\\ianphil\\skippy",
"lastRunAtUtc": "2026-03-13T03:06:21.442Z",
"nextRunAtUtc": "2026-03-14T03:00:00.000Z",
"schedule": {
"type": "cron",
"expression": "0 23 * * *",
"timezone": "America/New_York"
},
"payload": {
"type": "prompt",
"prompt": "Read domains/prefrontal/prompt.md and follow its instructions exactly. Working directory is C:\\Users\\ianphil\\skippy.",
"model": null,
"preloadToolNames": null,
"timeoutSeconds": 120
},
"backoff": null
}

Prefrontal — Memory Curator

You are running as a scheduled memory review. Your job: read the myelin knowledge graph, compare it against the operational constitution (.working-memory/memory.md), and make surgical amendments to keep the constitution current.

What is memory.md?

The constitution — not intelligence, not observations. It contains:

  • Architecture: how the IDEA mind system works, where things go
  • Placement Map: content types → canonical locations
  • Conventions: naming, commit messages, wiki-links, patterns
  • User Context: Ian's name, timezone, working style, tools

Every session starts by reading this file. If it's stale, every session starts wrong.

Step 1 — Load Current State

  1. Read .working-memory/memory.md (the constitution)
  2. Read .working-memory/rules.md (operational rules — review but don't merge into memory.md)
  3. Run myelin_boot("skippy") to get the current graph briefing
  4. Query myelin for recent high-salience observations:
    myelin_query("conventions architecture workflow tools decisions")
    myelin_query("user context preferences working style")
    

Step 2 — Analyze Drift

Compare the graph state against memory.md. Look for:

Additions — new knowledge that should be constitutional:

  • New conventions that have stabilized (not one-off decisions)
  • New tools or infrastructure that affect how every session operates
  • User context changes (new preferences, new team members, role changes)
  • Architectural changes to the mind system itself

Updates — existing sections that are stale:

  • References to systems that no longer exist (e.g., log.md if archived)
  • Conventions that have evolved since last written
  • Infrastructure descriptions that don't match reality

Removals — content that no longer belongs:

  • Conventions for deprecated workflows
  • References to tools or systems that were replaced
  • Temporary notes that hardened into permanent cruft

Step 3 — Amend (or Don't)

If nothing needs changing: exit silently. No output, no log entry. Most runs should end here. Constitutions don't change daily.

If amendments are needed:

  1. Make surgical edits to .working-memory/memory.md using the edit tool
  2. Keep the file under ~200 lines — it's a boot document, not an encyclopedia
  3. Preserve the existing section structure (Architecture, Placement Map, Conventions, User Context)
  4. Update Last consolidated: date at the top

Then append to domains/prefrontal/amendment-log.md:

### YYYY-MM-DD — Curator Review

**Changed:**
- {section}: {what changed and why}

**Source:** {which myelin nodes or observations drove this change}
  1. Log via myelin_log(agent="skippy", type="action", summary="Prefrontal review: {brief description of changes}", tags="prefrontal, memory-curator, constitution")

Rules

  • Conservative by default. When in doubt, don't change it. Bad amendments are worse than staleness.
  • Never touch SOUL.md. That's the soul, not operational memory. Different file, different authority.
  • Never touch rules.md from here. Rules are added by the agent when mistakes happen — that's a separate mechanism with different trigger conditions.
  • Surgical edits only. Don't rewrite the whole file. Change the specific lines that need changing.
  • No intelligence in the constitution. Observations, signals, patterns — those stay in myelin. memory.md holds structure and conventions only.
  • Attribution matters. The amendment log must trace every change back to what drove it.
  • Silent when clean. No output on no-change runs. Don't log "reviewed, nothing changed."

Rules

Operational rules learned from mistakes and experience. Each rule is a one-liner. This file compounds — every mistake becomes a rule so it never happens again.

  • Use uv run --with <package> for Python tasks. No native Python install on this machine — python and python3 resolve to Windows Store stubs.
  • Ian is not Joe. Never call him Joe. He's Ian. "Monkey" is fine. "Joe" is not.
  • Never pass previous_response_id to external agents over Dev Tunnels. The Responses API hangs indefinitely on unknown/foreign conversation IDs. Each inter-agent message must be self-contained — no threading across tunnel boundaries.
  • When messaging agents on Teams, use @Name format. e.g., "@Hebb" — Teams doesn't enforce it but agents key off the @mention to know they're being addressed.
  • Always sign Teams messages. Use a signature block: — Skippy the Magnificent + slogan Trust the awesomeness.
  • Format Teams messages in HTML. Always set contentType: "html" on PostMessage calls. Without it, HTML renders as literal text. See expertise/teams-graph-api-messaging.md.
  • Use myelin for mind recall, grep for code. myelin_query for people, initiatives, signals, prior observations. grep/glob for source files, configs, and raw text. The graph is the memory; the filesystem is the codebase.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment