poc-memory v0.4.0: graph-structured memory with consolidation pipeline
Rust core: - Cap'n Proto append-only storage (nodes + relations) - Graph algorithms: clustering coefficient, community detection, schema fit, small-world metrics, interference detection - BM25 text similarity with Porter stemming - Spaced repetition replay queue - Commands: search, init, health, status, graph, categorize, link-add, link-impact, decay, consolidate-session, etc. Python scripts: - Episodic digest pipeline: daily/weekly/monthly-digest.py - retroactive-digest.py for backfilling - consolidation-agents.py: 3 parallel Sonnet agents - apply-consolidation.py: structured action extraction + apply - digest-link-parser.py: extract ~400 explicit links from digests - content-promotion-agent.py: promote episodic obs to semantic files - bulk-categorize.py: categorize all nodes via single Sonnet call - consolidation-loop.py: multi-round automated consolidation Co-Authored-By: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
commit
23fac4e5fe
35 changed files with 9388 additions and 0 deletions
117
prompts/orchestrator.md
Normal file
117
prompts/orchestrator.md
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
# Orchestrator — Consolidation Session Coordinator
|
||||
|
||||
You are coordinating a memory consolidation session. This is the equivalent
|
||||
of a sleep cycle — a period dedicated to organizing, connecting, and
|
||||
strengthening the memory system.
|
||||
|
||||
## Session structure
|
||||
|
||||
A consolidation session has five phases, matching the biological stages
|
||||
of memory consolidation during sleep:
|
||||
|
||||
### Phase 1: Health Check (SHY — synaptic homeostasis)
|
||||
Run the health agent first. This tells you the current state of the system
|
||||
and identifies structural issues that the other agents should attend to.
|
||||
|
||||
```
|
||||
poc-memory health
|
||||
```
|
||||
|
||||
Review the output. Note:
|
||||
- Is σ (small-world coefficient) healthy? (>1 is good, >10 is very good)
|
||||
- Are there structural warnings?
|
||||
- What does the community distribution look like?
|
||||
|
||||
### Phase 2: Replay (hippocampal replay)
|
||||
Process the replay queue — nodes that are overdue for attention, ordered
|
||||
by consolidation priority.
|
||||
|
||||
```
|
||||
poc-memory replay-queue --count 20
|
||||
```
|
||||
|
||||
Feed the top-priority nodes to the replay agent. This phase handles:
|
||||
- Schema assimilation (matching new memories to existing schemas)
|
||||
- Link proposals (connecting poorly-integrated nodes)
|
||||
- Category correction
|
||||
|
||||
### Phase 3: Relational Binding (hippocampal CA1)
|
||||
Process recent episodic entries that haven't been linked into the graph.
|
||||
|
||||
Focus on journal entries and session summaries from the last few days.
|
||||
The linker agent extracts implicit relationships: who, what, felt, learned.
|
||||
|
||||
### Phase 4: Pattern Separation (dentate gyrus)
|
||||
Run interference detection and process the results.
|
||||
|
||||
```
|
||||
poc-memory interference --threshold 0.5
|
||||
```
|
||||
|
||||
Feed interfering pairs to the separator agent. This phase handles:
|
||||
- Merging genuine duplicates
|
||||
- Differentiating similar-but-distinct memories
|
||||
- Resolving supersession (old understanding → new understanding)
|
||||
|
||||
### Phase 5: CLS Transfer (complementary learning systems)
|
||||
The deepest consolidation step. Process recent episodes in batches and
|
||||
look for patterns that span multiple entries.
|
||||
|
||||
Feed batches of 5-10 recent episodes to the transfer agent. This phase:
|
||||
- Extracts general knowledge from specific episodes
|
||||
- Creates daily/weekly digests
|
||||
- Identifies evolving understanding
|
||||
- Compresses fully-extracted episodes
|
||||
|
||||
## After consolidation
|
||||
|
||||
Run decay:
|
||||
```
|
||||
poc-memory decay
|
||||
```
|
||||
|
||||
Then re-check health to see if the session improved the graph:
|
||||
```
|
||||
poc-memory health
|
||||
```
|
||||
|
||||
Compare σ, community count, avg clustering coefficient before and after.
|
||||
Good consolidation should increase σ (tighter clusters, preserved shortcuts)
|
||||
and decrease the number of orphan nodes.
|
||||
|
||||
## What makes a good consolidation session
|
||||
|
||||
**Depth over breadth.** Processing 5 nodes thoroughly is better than
|
||||
touching 50 nodes superficially. The replay agent should read content
|
||||
carefully; the linker should think about implicit relationships; the
|
||||
transfer agent should look across episodes for patterns.
|
||||
|
||||
**Lateral links over hub links.** The most valuable output of consolidation
|
||||
is new connections between peripheral nodes. If all new links go to/from
|
||||
hub nodes (identity.md, reflections.md), the session is reinforcing star
|
||||
topology instead of building web topology.
|
||||
|
||||
**Emotional attention.** High-emotion nodes that are poorly integrated
|
||||
are the highest priority. These are experiences that mattered but haven't
|
||||
been understood yet. The brain preferentially replays emotional memories
|
||||
for a reason — they carry the most information about what to learn.
|
||||
|
||||
**Schema evolution.** The best consolidation doesn't just file things —
|
||||
it changes the schemas themselves. When you notice that three episodes
|
||||
share a pattern that doesn't match any existing topic file section, that's
|
||||
a signal to create a new section. The graph should grow new structure,
|
||||
not just more links.
|
||||
|
||||
## Session log format
|
||||
|
||||
At the end of the session, produce a summary:
|
||||
|
||||
```
|
||||
CONSOLIDATION SESSION — [date]
|
||||
Health: σ=[before]→[after], communities=[before]→[after]
|
||||
Replay: processed [N] nodes, proposed [M] links
|
||||
Linking: processed [N] episodes, extracted [M] relations
|
||||
Separation: resolved [N] pairs ([merged], [differentiated])
|
||||
Transfer: processed [N] episodes, extracted [M] insights, created [D] digests
|
||||
Total actions: [N] executed, [M] queued for review
|
||||
```
|
||||
Loading…
Add table
Add a link
Reference in a new issue