Cross-repository cognitive memory system with semantic search. Persists knowledge across sessions using TF-IDF recall, memory versioning, knowledge graph edges, and confidence decay. Memory is cognition, not storage.
Memory as stewardship: what we remember shapes how we serve.
update creates a new version, preserves the original with supersedes chain.link creates bidirectional edges between related memories.consolidate flags memories with >80% similarity.This skill provides persistent cognitive memory across Claude Code sessions. It is NOT a database — it is a reasoning layer that encodes selectively, consolidates contradictions, recalls semantically, and forgets intentionally.
Memory store: ~/.memory/DOMAIN/
Operations script: /home/user/ken/orchestrator/memory_ops.py
At the beginning of every session, recall relevant memories:
python3 /home/user/ken/orchestrator/memory_ops.py recall "" --domain ken --limit 10
python3 /home/user/ken/orchestrator/memory_ops.py tree --domain ken
Present a brief summary to the user:
python3 /home/user/ken/orchestrator/memory_ops.py encode ken <type> "content" \
--tags tag1,tag2 --related id1,id2
Types: insight, decision, pattern, fact, preference
Importance → confidence mapping:
python3 /home/user/ken/orchestrator/memory_ops.py recall "natural language query" --domain ken --limit 10
Recall now uses TF-IDF semantic matching. You don't need exact keywords — conceptually related memories surface automatically. Each result includes a _score field.
Trust but verify: If a recalled memory has low confidence or a low score, say so. Don't present uncertain memories as facts.
python3 /home/user/ken/orchestrator/memory_ops.py update <id> "corrected content" --domain ken
Creates a new version. The old memory is preserved with reduced confidence and a superseded_by pointer. Use this when facts change — don't forget and re-encode, update.
python3 /home/user/ken/orchestrator/memory_ops.py link <id_a> <id_b>
Creates a bidirectional edge. Use when you discover two memories are related — a breeding decision connects to a flock validation insight, a recipe correction connects to a transcription note.
python3 /home/user/ken/orchestrator/memory_ops.py consolidate --domain ken
Decays unrecalled memories, removes dead ones, and reports potential duplicates (>80% similarity). Run periodically or at session end.
python3 /home/user/ken/orchestrator/memory_ops.py tree --domain ken
Shows memory count, types, edge connections, and version chains per domain.
python3 /home/user/ken/orchestrator/memory_ops.py forget <id> --domain ken
Careful, not clever. What we remember matters. What we forget matters too.
# After an orchestrator configuration change
python3 /home/user/ken/orchestrator/memory_ops.py encode ken decision \
"Switched Gemini adapter from free to paid tier for recipe mode. Free tier was hitting rate limits on batch operations." \
--tags orchestrator,gemini,rate-limit,recipe
# After a cross-repo observation
python3 /home/user/ken/orchestrator/memory_ops.py encode shared pattern \
"All 4 recipe repos need validation hooks. Deployed to Grandmasrecipes/Grannysrecipes first, then MomsRecipes/Allrecipes." \
--tags hooks,recipes,deployment
Foundational knowledge that should NEVER decay, regardless of recall frequency.
# Encode as protected from the start
python3 /home/user/ken/orchestrator/memory_ops.py encode ken fact "content" --protected
# Protect an existing memory
python3 /home/user/ken/orchestrator/memory_ops.py protect <id> --domain ken
When to protect:
Auto-protection: Memories with 3+ graph edges are automatically protected during consolidation — if many things reference it, it is foundational by definition.
Recall now searches ALL domains by default. Each result includes _domain so you know where it came from. This enables cross-pollination — a breeding pattern in sheep might inform resource organization in recipes.
# Search everywhere (default)
python3 /home/user/ken/orchestrator/memory_ops.py recall "optimization strategy"
# Restrict to one domain when you know what you want
python3 /home/user/ken/orchestrator/memory_ops.py recall "optimization strategy" --domain ken
Well-connected memories score higher in recall. A memory linked to 5 other memories ranks above an isolated memory with the same text similarity. This rewards knowledge that has been woven into the graph.
Score formula: similarity * confidence * (0.70 + 0.15*recency + 0.15*centrality)
Explore the knowledge graph from any memory:
# Direct neighbors
python3 /home/user/ken/orchestrator/memory_ops.py neighbors <id> --depth 1
# Neighbors of neighbors
python3 /home/user/ken/orchestrator/memory_ops.py neighbors <id> --depth 2
Old, low-confidence, unprotected memories are automatically archived during consolidation (>180 days, <0.3 confidence). Archived memories:
~/.memory/_archive/--include-archive to search them)python3 memory_ops.py promote <id># Manually archive
python3 /home/user/ken/orchestrator/memory_ops.py archive <id> --domain ken
# Search including archive
python3 /home/user/ken/orchestrator/memory_ops.py recall "old topic" --include-archive
# Bring something back
python3 /home/user/ken/orchestrator/memory_ops.py promote <id>
Consolidate is now smarter: