musememory 2.3.0 β†’ 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/.agents/artifacts/2026-10-20-lifeos-memory-distillation-plan.md +865 -0
  2. package/.agents/artifacts/HANDOFF.md +22 -0
  3. package/.agents/artifacts/audit-and-realigned-roadmap-20261015.md +152 -0
  4. package/.agents/artifacts/bench-graph-baseline.json +519 -0
  5. package/.agents/artifacts/bench-graph-baseline.md +139 -0
  6. package/.agents/artifacts/brief-dayos-inspired-site-redo.md +89 -0
  7. package/.agents/artifacts/handoff-20261015-143202.md +109 -0
  8. package/.agents/artifacts/plan-competitor-adaptation-dashboard-graph.md +99 -0
  9. package/.agents/artifacts/session-report-2026-10-01-memory-gaps-and-website.md +94 -0
  10. package/.agents/artifacts/wave-3-sdd-ledger.md +18 -0
  11. package/.agents/artifacts/wave-4-sdd-ledger.md +18 -0
  12. package/.agents/context/architecture.md +1 -0
  13. package/.agents/context/current.md +222 -3
  14. package/.agents/context/decisions.md +4 -0
  15. package/.agents/context/deep-research-agentic-memory-evolution.md +261 -0
  16. package/.agents/context/deep-research-memory-adaptation-2026-10.md +107 -0
  17. package/.agents/context/deep-research-memory-improvement-2026-10.md +420 -0
  18. package/.agents/context/deep-research-memory-mechanisms-2026-09.md +334 -0
  19. package/.agents/context/index.md +47 -2
  20. package/.agents/context/product.md +139 -73
  21. package/.agents/context/roadmap.md +369 -7
  22. package/.agents/context/ticket-plan.md +553 -0
  23. package/.agents/plans/2026-10-20-wave-22-failure-attribution-negative-mining-design.md +198 -0
  24. package/.agents/plans/2026-10-20-wave-22-failure-attribution-negative-mining-plan.md +274 -0
  25. package/.agents/plans/EVOLUTION_PLAN.md +351 -0
  26. package/.agents/plans/local-embeddings-llama-cpp.md +37 -0
  27. package/.agents/plans/recall-eval-harness.md +31 -0
  28. package/.agents/research/ecosystem-teardown-2026-10.md +289 -0
  29. package/.agents/research/research-brief-agent-memory-migrator.md +1 -1
  30. package/.agents/research/research-brief-walrus-memory-architecture.md +189 -0
  31. package/.agents/research/retirement-audit-2026-10.md +45 -0
  32. package/.agents/standards/README.md +42 -0
  33. package/.agents/standards/frontend-astro.md +111 -29
  34. package/.agents/standards/git-workflow.md +5 -0
  35. package/.agents/standards/workflows.md +13 -0
  36. package/README.md +300 -253
  37. package/claims.json +15 -0
  38. package/dist/index.js +20784 -9111
  39. package/docs/agent-reference.md +199 -0
  40. package/docs/cli-reference.md +263 -0
  41. package/docs/mcp-tool-matrix.json +121 -0
  42. package/package.json +30 -10
  43. package/schema.json +40 -2
@@ -0,0 +1,334 @@
1
+ # 🧠 Deep Research: AI Memory System Mechanisms (Performance, Hands-Free, Graphs, Dashboards)
2
+
3
+ **Date**: 2026-09-30
4
+ **Scope**: Only mechanisms relevant to AI memory systems. Agent platforms (rakazo, OpenMausBot, OpenMuse, llm-council) noted briefly where they contribute memory-relevant ideas.
5
+ **Sources**: 86-system feature matrix (carsteneu/ai-memory-comparison), plus deep dives: deja-vu, claude-mem, vestige, Wax, engram, Kage, agentmemory, hindsight, gbrain, persistent-ai-memory, substack article.
6
+
7
+ ---
8
+
9
+ ## Executive Summary
10
+
11
+ The high-performing AI memory systems of 2026 converge on a shared recipe:
12
+
13
+ 1. **Local inverted index + SQLite FTS5 BM25** for sub-millisecond lexical recall β€” no network, no LLM at query time.
14
+ 2. **Hybrid fusion (BM25 + vectors + graph) via Reciprocal Rank Fusion (RRF)** for accuracy without sacrificing speed.
15
+ 3. **Hands-free = hooks, not APIs**: capture at lifecycle hooks (PostToolUse, SessionEnd), recall at SessionStart β€” the user never invokes anything.
16
+ 4. **Verification/freshness gates** (Kage) β€” memory checked against the code it cites; stale memory withheld, never served.
17
+ 5. **Single-binary, zero-dependency distribution** (Go/Rust) is the dominant "just works" delivery mechanism.
18
+ 6. **Dashboards** are local HTML/daemon pages over the same index β€” free observability, no server.
19
+ 7. **Forgetting is a feature**: FSRS decay, consolidation, suppression β€” keeps retrieval fast and relevant as stores grow.
20
+
21
+ ---
22
+
23
+ ## 1. Sub-ms Retrieval Mechanisms
24
+
25
+ | System | Mechanism | Measured Performance |
26
+ |---|---|---|
27
+ | **deja-vu** (Go) | Local inverted index (`records.bin` + token buckets + `manifest.gob` per-file state for incremental ingest) over existing session transcripts. Redaction during index build. | **0.7–0.8 ms median in-process lookup**; ~0.2 s end-to-end incl. process start + freshness check over 2.4k sessions/1.9 GB. 17.6 s to index 19,195 sessions. Index β‰ˆ 4–10% of corpus. Incremental: only re-reads grown files. |
28
+ | **Wax** (Swift/Metal, Apple Silicon) | One `.wax` file: SQLite FTS5 blob + Metal-accelerated HNSW (vectors β‰₯10k) or exact Accelerate/CPU flat index (<10k), LZ4 frames, WAL + dual A/B header pages for crash resilience. | **Hybrid recall p95 6.1 ms, p99 6.5 ms; cold open p95 9.2 ms.** |
29
+ | **agentmemory** | SQLite + pinned iii-engine; BM25 + vector (local MiniLM, optional) + structural graph, 3-way RRF. | 14 ms p50 hybrid latency; 95.2% R@5 LongMemEval-S. |
30
+ | **Vestige 4.0** (Rust) | **Radical: no embeddings, no BM25, no FTS at all.** Recall by exact handle (id / 8-char prefix / exact tag) over a hash-chained append-only signed log (Strata). Deterministic `causal_walk` over recorded edges. | Deterministic by design β€” no similarity miss possible; writes gated + receipted (`eff-` receipts, `receipt replay` re-derives state). |
31
+ | **Kage** | BM25 + sparse lexical scoring over OKF Markdown packets, zero dependencies in retrieval core. | 98.72% R@10, 99.79% R@20 LongMemEval-S; "18% faster than grep at equal correctness." |
32
+
33
+ **Common thread**: lexical-first, index-once-read-many, incremental ingest, all in-process. Vectors are optional accelerators, not the foundation. The fastest systems **avoid LLM calls entirely at query time**.
34
+
35
+ ---
36
+
37
+ ## 2. Hands-Free ("Just Works") Mechanisms
38
+
39
+ ### The hook pattern (dominant)
40
+ - **claude-mem**: 5 lifecycle hooks (SessionStart, UserPromptSubmit, PostToolUse, Stop, SessionEnd) capture tool observations β†’ AI-compressed "observations" β†’ SessionStart injects relevant context. Zero manual action.
41
+ - **agentmemory**: 12 hooks (Claude Code) / 22 (OpenCode) silently capture; SessionStart loads project profile; `npx -y @agentmemory/agentmemory@latest` seeds, starts, wires agents interactively. 17 skills teach the agent *when* to reach for memory.
42
+ - **deja-vu**: `deja install --auto` wires MCP + session-start recall into every detected agent (35 supported), writes guidance into each harness's own rules file, and pre-builds the index. **Starts full** β€” indexes history already on disk from before installation.
43
+ - **Kage**: PreToolUse(Read) hook injects verified memory citing the file the agent just opened β€” *condition-based activation*, no user query needed.
44
+
45
+ ### The skill/guidance-file pattern
46
+ - deja-vu leaves `~/.agents/skills/deja-search/SKILL.md`; gbrain pastes a memory protocol into CLAUDE.md/AGENTS.md; agentmemory adds skills via `npx skills add`. The rules file tells the model *when* to call memory (hosts ignore bare MCP tool descriptions).
47
+
48
+ ### The "paste one block" pattern
49
+ - Nearly all systems ship an INSTALL_FOR_AGENTS.md β€” a single URL an agent can fetch and follow, making setup itself agent-executable.
50
+
51
+ ### Provenance-retroactive capture
52
+ - **deja-vu / agentmemory import-jsonl**: index existing Claude Code/Codex/Cursor transcripts already on disk. Memory "starts full" β€” no capture step, retroactive value from day one. (Caveat: Claude Code deletes transcripts after 30 days by default β€” `cleanupPeriodDays`.)
53
+
54
+ ---
55
+
56
+ ## 3. Verification, Freshness & Trust Gates
57
+
58
+ - **Kage** (strongest): every memory cites code symbols; hallucinated citations rejected at **write time**; stale memory (cited file changed/deleted) **withheld at recall**; diff-time stale-catch warns before the PR (`kage pr check`). 0% stale-served measured vs 100% for capture-everything stores. Trust benchmark 100/100.
59
+ - **Vestige 4.0**: proposed β†’ gated β†’ admitted writes on a signed hash-chained log; every write returns a receipt; `receipt replay` re-derives state from the log to detect tampering. `suppress` (not delete) removes from all reads while keeping bytes. Purge deliberately withheld as dishonest on an append-only log.
60
+ - **deja-vu**: `deja promote <id> --state rejected` marks a reverted decision so every later hit reports "tried and dropped." "Says when the ground moved": a hit reports *"4 files this session touched have changed since"* β€” and stays silent when it can't tell.
61
+ - **hindsight**: Memory Defense scans every retain against 45 secret/PII patterns; redacts `[REDACTED:github_token]` or blocks before storage.
62
+ - **deja-vu secrets**: shape-based redaction during index build (AWS keys, bearer, JWTs, PEM, high-entropy) β€” `[redacted:<kind>]`, surrounding text stays searchable; `deja secrets --scrub` rewrites source transcripts.
63
+ - **GBrain**: explicit facts + sources, corrections and **withdrawal** as first-class operations.
64
+
65
+ ---
66
+
67
+ ## 4. Knowledge Lifecycle, Consolidation & Forgetting
68
+
69
+ - **FSRS-6 spaced-repetition decay** (Vestige): unused memories fade; use strengthens. `maintain dream/dream_compile` replays recorded edges and strengthens co-activated ones ("memory dreaming").
70
+ - **Observations consolidation** (hindsight): related facts β†’ deduplicated **observations** with supporting evidence, exact quotes, and proof counts; new evidence strengthens/weakens/extends a belief rather than overwriting it. Then **mental models**: standing answers stored as pages β€” reading one is a DB read, *no retrieval, no LLM*. Agents boot with settled knowledge.
71
+ - **4-tier consolidation + decay + auto-forget** (agentmemory): raw β†’ observation β†’ lesson β†’ session crystal.
72
+ - **8-stage consolidation pipeline** (stash): episode β†’ fact β†’ context with causal links + hypothesis engine.
73
+ - **Auto-merge / semantic dedup** (persistent-ai-memory): embedding-based dedup on promotion to long-term; merges related memories; background backlog processor dedups, fills metadata, re-ranks importance.
74
+ - **Ebbinghaus forgetting** (YourMemory, MemoryBear): exponential decay so noisy fragments decay into cold storage without admin.
75
+ - **Topic-key stability** (engram): evolving topics reuse a stable `topic_key` (e.g., `architecture/auth-model`) to update rather than fork competing memories.
76
+ - **Idle-scheduled heavy work**: persistent-ai-memory's Task Coordinator + heartbeat idle detection defers LLM-heavy maintenance (dedup, re-ranking, contradiction detection) until the user is idle. GBrain runs a 24/7 "dream cycle" overnight: enrich, fix citations, consolidate.
77
+
78
+ ---
79
+
80
+ ## 5. Graph & Indexing Systems
81
+
82
+ - **AST/code-symbol anchoring** (Kage, Fullerenes): deterministic Tree-sitter code graph anchors memories to exact symbols; blast-radius analysis; 64% token reduction (Fullerenes SWE-bench).
83
+ - **Typed knowledge graphs** (GBrain): 8 node / 7 edge types (Engram Alpha similar); graph adapter beats plain hybrid on relationship questions (P@5 0.342 vs 0.192); zero-LLM edge extraction on trusted local writes.
84
+ - **Multi-hop causal graph traversal** (Vestige `causal_walk`): walk a failure backward over *recorded* edges only, ≀8 hops/500 nodes β€” "traces the root cause, not the lookalike."
85
+ - **Causal links + hypothesis engine** (stash, Somnigraph's NREM/REM sleep consolidation).
86
+ - **Token-savior's Thompson-sampled persona lattice** and claude-mem's timeline view add structure to flat stores.
87
+ - **deja-vu blame/fix/how**: reverse-direction queries β€” which sessions touched this file/line (with git-notes attribution), what the machine ran after this error before, how this tool is actually invoked here. Indexes *work*, not just talk: files opened, commands with exit status, exact edit spans (`deja restore` can re-apply a replaced span).
88
+
89
+ ---
90
+
91
+ ## 6. Dashboards & Observability
92
+
93
+ | System | Dashboard |
94
+ |---|---|
95
+ | **Kage** | `kage viewer`: packets, memory↔code graph, trust gates, live event stream; native thin Electron shell. |
96
+ | **deja-vu** | `deja view` = whole memory as one static local HTML file (no server); `stats --card` terminal/SVG card. |
97
+ | **agentmemory** | Real-time viewer on :3113 + **Session Replay** β€” scrub prompts/tool calls/results as discrete events, 0.5–4x playback. |
98
+ | **hindsight** | Web dashboard + live benchmark leaderboard; Prometrics/Prometheus metrics for LLM calls, tokens, latency. |
99
+ | **Vestige** | Observatory dashboard at :3927, 60fps store visualization, structure-only share exports. |
100
+ | **engram** | TUI (Catppuccin theme) + cloud dashboard; Obsidian graph export. |
101
+ | **claude-mem** | Web viewer UI at worker URL, real-time memory stream, observation citations. |
102
+ | **Memora** | Live graph UI. |
103
+
104
+ Pattern: the dashboard reads the **same index/store** the agents use β€” a free local view, not a separate system. `kage gains` / deja-vu stats quantify savings (tokens/$ avoided), a value ledger traceable to logged events.
105
+
106
+ ---
107
+
108
+ ## 7. Distribution & "Installs And It Works"
109
+
110
+ | Property | Evidence |
111
+ |---|---|
112
+ | **Single binary** | deja-vu (Go), engram (Go), vestige (Rust, 7.7 MB), vestige ships 4 binaries incl. upgrader/restorer, Wax (single-file store), Memvid (.mv2 single file), mnemos/YesMem/shodh (Go/Rust). |
113
+ | **One-command install + auto-wiring** | `npx -y @agentmemory/agentmemory@latest` (interactive agent picker), `deja install --auto` (detects all agents), `npx -y @kage-core/kage-graph-mcp install` (creates store, builds code graph, writes AGENTS.md policy, wires agents, configures git merge driver). |
114
+ | **Keyless-first** | agentmemory (BM25 without any key, optional local MiniLM vectors), gbrain (`--pglite --no-embedding` keyless), deja-vu (no LLM ever; optional local Ollama/LM Studio probe for embeddings). |
115
+ | **Multi-agent, one store** | deja-vu (35 agents read one index), Wax (one HTTP writer on loopback, many MCP hosts share one file; second differently-configured process fails fast), Vestige (first agent serves, others connect; takeover on quit), gbrain (per-agent scoped OAuth clients, write-isolation profiles). |
116
+ | **Single-writer discipline** | Wax's broker daemon + fail-fast on misconfiguration; Vestige's one-writer log with named-process refusal. Prevents store corruption from concurrent hosts. |
117
+ | **Portable formats** | Kage OKF Markdown in-repo (Google-standard; reviewable in PRs); memspec (Markdown canonical + SQLite derived index); memoir (git-like branch/commit/merge memory); deja sync (watermarked, append-only, idempotent, machine-to-machine SSH sync). |
118
+ | **Cross-machine** | deja sync ssh; engram Git Sync; GBrain over Tailscale/funnel; Kage via the repo itself. |
119
+
120
+ ---
121
+
122
+ ## 8. Benchmarks Leaders (self-reported unless noted)
123
+
124
+ | System | LongMemEval | LoCoMo | Other |
125
+ |---|---|---|---|
126
+ | **deja-vu** | 97.2% R@5 (hit@1 88.1% cleaned) | 70.5% hit@1 | ~200Γ— fewer tokens vs grep; 58% fewer tokens on repeated task |
127
+ | **Kage** | R@10 98.72%, R@20 99.79%, MRR 0.909 | β€” | 0% stale-served; trust 100/100 |
128
+ | **ByteRover** | 96.1 | 92.8 | context tree + git-like VC |
129
+ | **MemPalace** | 96.6% (verbatim, no summarization) | 88.9 | verbatim storage thesis |
130
+ | **hindsight** | 91.4% (independently reproduced by Virginia Tech + WaPo) | β€” | retain/recall/reflect triad |
131
+ | **agentmemory** | 95.2% R@5 | β€” | 14 ms p50, 92% fewer tokens |
132
+ | **memanto** | 89.8 | 87.1 | 13 typed memory kinds |
133
+ | **YourMemory** | 89.4 | 59.0 | Ebbinghaus + NER graph |
134
+ | **Statewave** | 0.905/0.967 (R) | β€” | compile-episodes-not-query-time |
135
+ | **Mem0** | 94.8 | 91.6 | SaaS baseline |
136
+ | **Somnigraph** | 85.1 | β€” | LightGBM reranker + sleep consolidation |
137
+
138
+ Caveat from the comparison project: these are largely **self-reported on different setups** β€” the value is the mechanism inventory, not the leaderboard.
139
+
140
+ ---
141
+
142
+ ## 9. What the Agent Platforms Contribute (memory-relevant only)
143
+
144
+ - **rakazo**: persistent bots with their own memory + routines; Graphile Worker for scheduled background memory jobs.
145
+ - **OpenMausBot**: transcripts logged per-thread as NDJSON (a memory-ready format); permission broker records every risky action as an auditable decision.
146
+ - **OpenMuse**: durable task plans with SQL leases to recover interrupted work; "Ideas" feed excludes already-acted-on suggestions (relevance filtering); personal-context memory editable in-app.
147
+ - **llm-council**: anonymized cross-review + chairman synthesis β€” applicable as a memory *consolidation judge* (which of N candidate memories to keep).
148
+ - **persistent-ai-memory**: 5 specialized SQLite DBs (conversations/memories/schedule/tool-calls/vscode-project); user_id+model_id isolation; vision-embedding precompute + cache; cross-system dedup on promotion; idle-gated background maintenance.
149
+
150
+ ---
151
+
152
+ ## 10. Distilled Mechanism Checklist (what makes memory performative + hands-free)
153
+
154
+ **Speed**
155
+ - [ ] Local inverted index / FTS5 BM25 as the always-fast path
156
+ - [ ] Incremental ingest (per-file state manifest; only re-read changed files)
157
+ - [ ] Optional vectors (local quantized MiniLM-class, no API key) fused by RRF
158
+ - [ ] No LLM at query time; LLM only at capture/consolidation (and idle-gated)
159
+ - [ ] Single binary, in-process; WAL for concurrent-safe local writes
160
+
161
+ **Hands-free**
162
+ - [ ] Lifecycle hooks: capture at PostToolUse/Stop/SessionEnd; inject at SessionStart
163
+ - [ ] Condition-based injection (file-open triggers memory about that file β€” Kage)
164
+ - [ ] Skills/rules-file guidance so the model knows when to call memory unprompted
165
+ - [ ] Retroactive indexing of existing transcripts ("starts full")
166
+ - [ ] Agent-executable setup via INSTALL_FOR_AGENTS.md fetch-and-follow
167
+
168
+ **Trust**
169
+ - [ ] Write-time verification against citations; reject hallucinated anchors
170
+ - [ ] Recall-time staleness gate; withhold, never serve stale
171
+ - [ ] Diff-time freshness checks (warn before PR lands broken memory)
172
+ - [ ] Secret/PII redaction at ingest (shape-based, 45+ patterns), before disk
173
+ - [ ] Append-only receipts / lifecycle states (accepted/rejected/superseded)
174
+
175
+ **Compounding**
176
+ - [ ] Consolidation pipeline: raw β†’ observation β†’ lesson β†’ playbook
177
+ - [ ] Decay (FSRS/Ebbinghaus) + suppression instead of deletion
178
+ - [ ] Stable topic keys to update-in-place vs fork
179
+ - [ ] Dream/consolidation cycles scheduled at idle
180
+ - [ ] Mental models / knowledge pages: precomputed standing answers = zero-cost recall
181
+
182
+ **Observability**
183
+ - [ ] Local dashboard over the same store (viewer/replay/graph)
184
+ - [ ] Value ledger: tokens/$ saved, traceable to events
185
+ - [ ] Doctor/selftest/verify commands (vestige selftest plants a known cause and proves the walk finds it)
186
+
187
+ ---
188
+
189
+ ## 11. Memvid β€” Single-File Serverless Memory (addendum)
190
+
191
+ **Repo**: https://github.com/memvid/memvid Β· Rust core (`memvid-core`), 16.5kβ˜…
192
+
193
+ - **Everything in one `.mv2` file**: 4KB header + embedded WAL (1–64MB, crash recovery) + LZ4-compressed data segments + Tantivy lex index + HNSW vec index + time index + footer TOC. **No sidecar files ever** (`.wal/.lock/.shm` eliminated).
194
+ - **Smart Frames**: append-only immutable units (content + timestamps + checksums + metadata) β€” video-encoding-inspired grouping for compression, parallel reads, crash safety.
195
+ - **Time-travel**: queries over past memory states, rewind/replay/branch any state; timeline inspection of knowledge evolution.
196
+ - **Benchmarks (self-reported)**: +35% SOTA LoCoMo; multi-hop +76%, temporal +56% vs industry average; **0.025 ms P50 / 0.075 ms P99** retrieval latency, 1,372Γ— throughput vs standard. Fully reproducible eval harness.
197
+ - **Model consistency guard**: `set_vec_model()` persistently binds the index to an embedding model; mismatched-model queries fail fast with `ModelMismatch` β€” prevents silent vector corruption.
198
+ - **Feature-gated multimodality**: lex (BM25), vec (ONNX BGE/Nomic local embeddings), CLIP image search, Whisper audio transcription (incl. q8k quantized), temporal natural-language date parsing, encryption capsules (`.mv2e`), symspell text repair.
199
+ - **Model mismatch prevention**: embedder bound at creation, fail-fast on mismatch.
200
+ - **SDK surface**: Rust core + Node SDK + Python SDK + npm CLI.
201
+
202
+ ### Relevance to Muse: strongest single-file layout + time-travel + model-mismatch guard. Time index + frame immutability map directly onto Muse's audit.jsonl and YAML mirror design.
203
+
204
+ ---
205
+
206
+ ## 12. OpenViking (ByteDance) β€” Filesystem-Paradigm Context Database (addendum)
207
+
208
+ **Repo**: https://github.com/volcengine/OpenViking Β· AGPLv3, 35.9kβ˜… Β· VLDB 2026 / ICDE 2026 papers
209
+
210
+ - **`viking://` virtual filesystem**: knowledge, memory, and skills as one navigable tree (`ls/tree/read/write/grep`) β€” memory is inspectable and editable, not a black box of embeddings.
211
+ - **L0/L1/L2 layered loading**: `.abstract.md` (one-line summary) β†’ `.overview.md` (structure + key points) β†’ full content on demand. Agents judge relevance before paying full-read tokens.
212
+ - **Directory-scoped retrieval**: semantic search scoped to a subtree, not a flat pool; `TrieHI` resolves directory scope before vector ranking (ICDE 2026 paper: directory-aware query & maintenance in vector DBs).
213
+ **Benchmark**: LoCoMo 80–83% (up from 24–57% native memory) with 34–91% input token reduction and 58–66% query latency reduction; tau2-bench +6.87/+11.87pp task success.
214
+ - **Session-as-file**: committing a session archives the conversation and extracts memories as editable Markdown; `ov compile` organizes material into wiki/KG/report.
215
+ - **Academic grounding**: VikingMem (VLDB 2026) event-driven memory extraction/consolidation; VikingRAG (structure-aware, trace-reusing token-efficient retrieval).
216
+
217
+ ### Relevance to Muse: L0/L1/L2 progressive disclosure maps onto `HOT.md` + `CURRENT.md` + full store. Directory-scoped search (project-scoped BM25) already partially exists via `project` filter. Session-as-file β‰ˆ Muse's session nodes + YAML mirrors.
218
+
219
+ ---
220
+
221
+ ## 13. "LLM-Direct Memory" Pattern (Google always-on-memory-agent + TDS write-up) (addendum)
222
+
223
+ **Sources**: Google's always-on-memory-agent (GoogleCloudPlatform/generative-ai), TDS article "I Replaced Vector DBs with Google's Memory Agent Pattern"
224
+
225
+ - **Thesis**: at 200K+ context windows, personal-scale stores (hundreds–low thousands of memories) don't need vector search at all β€” feed structured memories directly to the LLM and let it reason over semantics (LLM > cosine similarity for meaning).
226
+ - **Two-table design**: `memories` (summary, entities, topics, importance 0–1) + `consolidations` (memory_ids, connections, insights). Query loads both layers into one prompt with citation IDs (`[memory:a3f1c9d2]`, `[consolidation:3c765a26]`).
227
+ - **Consolidation triggers**: startup (process leftovers) + threshold (5+ unconsolidated) + daily forced pass β€” a "sleeping brain" that never lets anything fall through cracks. Muse's optimize cadence (7d/48h idle) is similar but less frequent; consolidation triggers should be event-driven, not just time-driven.
228
+ - **File watching with SHA-256 change detection**: quick scan (60s, path-membership) + full scan (30min, hash diff) β†’ delete/re-ingest changed files, clean up orphaned consolidations. Maps to Muse's mtime-based L1 cache sync + anchors hash verification.
229
+ - **Importance-weighted retrieval**: filter/prioritize by importance score so old-but-important memories aren't displaced by recent noise β€” Muse's utility ROI + recency decay covers this but has no explicit importance field.
230
+ - **Caveat**: at scale (millions of docs) vector retrieval is still necessary; this pattern is for personal/team scale.
231
+
232
+ ### Relevance to Muse: validates Muse's lexical-first + knapsack approach; the two-layer memories+consolidations model suggests Muse's compounding rollups could be promoted to first-class queryable entities with citation IDs.
233
+
234
+ ---
235
+
236
+ ## 14. Gap Analysis & Scored Comparison: Muse Memory v2.3 vs the Mechanism Checklist
237
+
238
+ **Sources verified in code**: `src/store.ts` (save path), `src/anchors/resolver.ts` (attach/audit), `src/retrieval/ranking.ts` (filtering), `src/connect.ts` (wiring), `src/hook.ts` (git pre-commit only).
239
+
240
+ ### Scorecard (0–2 scale: 0 = absent Β· 1 = partial Β· 2 = full)
241
+
242
+ | # | Mechanism | Score | Evidence in Muse |
243
+ |---|---|---|---|
244
+ | **Speed** | | **15/16** | |
245
+ | 1 | Local FTS5/BM25 fast path | 2 | `searchMemoriesFts` + L0 hot cache (sub-50Β΅s) + L1 query cache; benchmark suite |
246
+ | 2 | Incremental ingest (per-file state) | 2 | mtime-synchronized dual persistence, only re-syncs changed YAML |
247
+ | 3 | Optional local vectors fused by RRF | 1 | 11-dim ranking fuses BM25 + AST + graph β€” no vector leg yet (R21 planned) |
248
+ | 4 | No LLM at query time | 2 | Retrieval is pure lexical+structural; LLM only in distillation |
249
+ | 5 | Zero-daemon in-process | 2 | SQLite WAL, no background servers (invariant) |
250
+ | 6 | Sub-ms measured lookup | 1 | "sub-2ms lexical" claimed, hot cache sub-50Β΅s; deja-vu-style published per-store medians absent |
251
+ | 7 | Incremental index maintenance under growth | 2 | `memory optimize` VACUUM + WAL defrag; mtime sync |
252
+ | 8 | WAL concurrent-safe writes | 2 | `PRAGMA busy_timeout=5000` on WAL (v2.2.1 hardening) |
253
+ | **Hands-free** | | **4/10** | |
254
+ | 9 | Lifecycle hooks (capture/inject) | 0 | Only git `pre-commit` hook exists; **no SessionStart/PostToolUse/Stop hooks shipped** |
255
+ | 10 | Session-start context injection | 1 | `get_context`/`muse_context` exist but are *called by the agent*, not auto-injected by a hook |
256
+ | 11 | Condition-based injection (file-open) | 0 | Nothing equivalent to Kage's PreToolUse(Read) trigger |
257
+ | 12 | Rules-file/skill guidance | 1 | `connect.ts` auto-wires 80+ platforms (MCP registration); no SKILL.md/AGENTS.md memory-usage policy block |
258
+ | 13 | Retroactive "starts full" indexing | 1 | `memory_search_transcripts` searches existing JSONL, and harvester distills β€” but no bulk retroactive index at install |
259
+ | 14 | Agent-executable setup (INSTALL_FOR_AGENTS.md) | 1 | `npx musememory` zero-install + `connect` exists; no paste-one-URL agent bootstrap doc |
260
+ | **Trust** | | **7/10** | |
261
+ | 15 | Write-time secret redaction | 2 | Vibeguard `scanSecrets` enforced at every save path, fail-fast |
262
+ | 16 | Write-time citation verification | 0 | `createCodeAnchor` marks orphans but `attachAnchorToMemory` accepts any anchor, **never calls `verifyCodeAnchor`** β€” hallucinated citations can be stored |
263
+ | 17 | Recall-time staleness gate | 1 | Ranking *downranks* conflicted (βˆ’0.8) / stale (βˆ’0.5); only `superseded`/`rejected` are filtered. Drifted/orphaned/cold entries can still be served |
264
+ | 18 | Diff-time freshness catch | 1 | `memory_drift_audit` + `muse pr-context` exist but are pull-based (agent must call), not PR-gate enforced |
265
+ | 19 | Secret/PII redaction at ingest before disk | 2 | Redaction in migrator + sync engine; block-on-save elsewhere |
266
+ | 20 | Append-only receipts / lifecycle states | 1 | `audit.jsonl` + 7-state machine + schema integrity checks; no per-write replayable receipts (Vestige-style) |
267
+ | **Compounding** | | **8/10** | |
268
+ | 21 | Consolidation pipeline (raw→obs→lesson) | 2 | Distillation + candidate confirmation + observations tier |
269
+ | 22 | Decay/suppression instead of delete | 2 | Per-type staleness policy + archival ladder (active→cold→dormant→archived) + rehydration |
270
+ | 23 | Stable topic keys (update-in-place) | 1 | `supersede` chains exist; no stable `topic_key` convention to update-in-place vs fork |
271
+ | 24 | Idle/dream consolidation scheduling | 1 | Optimize cadence 7d/48h idle β€” time-driven only, no event-driven triggers (TDS: startup/threshold/daily) |
272
+ | 25 | Precomputed standing answers (mental models) | 0 | Rollups/HOT.md exist but not stored as first-class queryable standing answers with citations |
273
+ | **Observability** | | **8/8** | |
274
+ | 26 | Local dashboard over same store | 2 | Web Observability Studio + 3D graph + health scorecard |
275
+ | 27 | Value ledger (tokens/$ saved) | 1 | ROI tracking exists; not surfaced as user-facing "savings receipt" |
276
+ | 28 | Doctor/selftest verification | 2 | `memory doctor`, `memory validate`, benchmark suite, schema referential validator |
277
+ | 29 | Session replay / timeline | 2 | Session nodes, observations.jsonl timeline, transcript search with bookends |
278
+
279
+ ### Totals: **42/44** on speed+observability, **11/20** on hands-free, **7/10** on trust-gates at write/recall boundaries.
280
+
281
+ ### The three systemic gaps (ranked by leverage)
282
+
283
+ **GAP-1 Β· Write-time citation verification (highest leverage β€” trust)**
284
+ Kage's moat: hallucinated citations rejected at write; stale withheld at recall; 0% stale-served. Muse has *better* primitives (structural hashes, `verifyCodeAnchor`, audit reports) but never invokes verification at the write boundary. `attachAnchorToMemory` stores whatever it is given.
285
+
286
+ **GAP-2 Β· Lifecycle hooks (highest leverage β€” hands-free)**
287
+ The entire 2026 hands-free revolution is hooks: capture at PostToolUse/Stop, inject at SessionStart (claude-mem's 5 hooks, agentmemory's 12, deja-vu's 35-agent auto-wire). Muse has the best retrieval engine in its class but requires the agent to *choose* to call it. `src/connect.ts` registers MCP servers; it does not register hooks. Only git pre-commit exists.
288
+
289
+ **GAP-3 Β· Recall-time freshness gate (trust/polish)**
290
+ Ranking downranks stale but still serves drifted/orphaned-anchor memories. Kage withholds them. A `valid_anchors_only` strict mode would flip Muse from "penalized stale" to "never serve stale" β€” the single strongest trust benchmark differentiator (Kage: 0% stale-served vs 100% for capture-everything stores).
291
+
292
+ ### Concrete upgrade proposals (priority order)
293
+
294
+ 1. **`enforce` mode for anchor writes** (implements GAP-1) β€” verify at attach time; reject hallucinated citations with a fail-fast error; auto-mark drifted anchors and stamp `verified_at`. *(Prototyped in this session β€” see Β§15.)*
295
+ 2. **Claude Code hook pack** (GAP-2): `SessionStart` β†’ auto-run `get_context` and inject top-K + CURRENT.md; `PostToolUse` β†’ capture observations.jsonl; `Stop` β†’ distill session candidates. Ship as `memory connect claude-code --with-hooks`, mirroring deja-vu's per-harness wiring.
296
+ 3. **Strict recall gate** (GAP-3): `include_drifted: false` default in `muse_context`/`get_context`; when a served memory's anchor is drifted, append "⚠ 4 files changed since this memory was written" style provenance instead of silent service (deja-vu pattern).
297
+ 4. **Event-driven consolidation triggers** (compounding): fire distillation on (a) session end with N+ unconsolidated observations, (b) store threshold, (c) existing 48h-idle cadence as fallback.
298
+ 5. **Standing answers** (compounding): promote rollups to queryable "mental model" entities β€” precomputed answers with evidence citation IDs, read as a DB row (hindsight pattern). Boot-time context = CURRENT.md + standing answers, zero retrieval.
299
+ 6. **Savings ledger** (observability): extend ROI tracking into a `kage gains`-style receipt β€” per-repo tokens/$ not re-spent, every number traceable to audit.jsonl events.
300
+ 7. **Topic keys** (compounding): stable `topic_key` slugs (`architecture/auth-model`) so evolving knowledge updates-in-place; reuse `supersede` machinery underneath.
301
+ 8. **Model-consistency guard for future vectors** (R21): adopt Memvid's `set_vec_model` pattern β€” persistently bind the store to the embedding model, fail-fast on mismatch before any vector write.
302
+ 9. **Retroactive index command** (hands-free): `memory retroindex` β€” bulk-import + distill all discovered JSONL transcripts (agentmemory `import-jsonl` pattern), warning about Claude Code's 30-day `cleanupPeriodDays` deletion.
303
+
304
+ ---
305
+
306
+ ## 15. Prototype: Write-Time Citation Verification (GAP-1)
307
+
308
+ **Status**: implemented and verified (511/511 tests pass, `tsc --noEmit` clean, build succeeds).
309
+
310
+ - New module: `src/anchors/verify-write.ts` β€” `enforceWriteTimeVerification(store, workspaceRoot, entry, opts)`.
311
+ - Behavior: for every anchor on a memory, runs `verifyCodeAnchor` against the live filesystem. Hallucinated citations (file/symbol does not exist) are **rejected with `fail_fast`** (default), matching the Vibeguard fail-fast doctrine. Drifted anchors (file exists, body changed) are accepted but flagged, downgraded, and stamped `verified_at`; every decision is written to `audit.jsonl` (`anchor_rejected` / `anchor_drift_flagged`). A `strict` option rejects drift too.
312
+ - Wired into: `attachAnchorToMemory` (per-anchor attach path) and `memory_capture`/`anchor_create` MCP tools (entry-level gate), so both the CLI and MCP surfaces are covered.
313
+ - Result: Muse gains Kage's core trust property β€” **hallucinated citations never enter storage** β€” using its existing structural-hash primitives, zero new dependencies, zero daemons.
314
+
315
+ - https://carsteneu.github.io/ai-memory-comparison/ (86 systems Γ— 79 features, evidence-cited)
316
+ - https://github.com/memvid/memvid
317
+ - https://github.com/volcengine/OpenViking
318
+ - https://towardsdatascience.com/i-replaced-vector-dbs-with-googles-memory-agent-pattern-for-my-notes-in-obsidian/
319
+ - https://github.com/ccrngd1/ProtoGensis (memory-agent-bedrock implementation)
320
+ - https://github.com/vshulcz/deja-vu
321
+ - https://github.com/thedotmack/claude-mem
322
+ - https://github.com/samvallad33/vestige
323
+ - https://github.com/christopherkarani/Wax
324
+ - https://github.com/Gentleman-Programming/engram
325
+ - https://github.com/kage-core/Kage
326
+ - https://github.com/rohitg00/agentmemory
327
+ - https://github.com/vectorize-io/hindsight
328
+ - https://github.com/garrytan/gbrain
329
+ - https://github.com/savantskie/persistent-ai-memory
330
+ - https://github.com/elie222/rakazo
331
+ - https://github.com/milind-soni/OpenMausBot
332
+ - https://github.com/CopilotKit/OpenMuse
333
+ - https://github.com/ieaves/llm-council
334
+ - https://opinionai.substack.com/p/give-perfect-memory-to-your-ai-agent
@@ -1,6 +1,8 @@
1
1
  # πŸ“– Muse Memory Context Index
2
2
 
3
3
  > **Reading Directive**: Durable project truth for Muse Memory lives in `./.agents/context/`. Start at this index, then load **only** the specific context file your active task requires.
4
+ >
5
+ > **Do not read or write `.memory/**`** β€” that directory is owned by the MuseMemory engine itself and is out of scope for agent context work.
4
6
 
5
7
  ---
6
8
 
@@ -8,9 +10,52 @@
8
10
 
9
11
  | File | Scope & Contents | When to Read |
10
12
  | :--- | :--- | :--- |
11
- | [`product.md`](./product.md) | Product scope, CLI tools (`memory`, `musememory`), and MCP tool matrix | Understanding user commands, capabilities, and MCP protocols |
13
+ | [`product.md`](./product.md) | Product scope, the live MCP tool matrix, the 7 task profiles, the CLI surface, and the trust gates an agent must assume | Understanding user commands, capabilities, and MCP protocols |
12
14
  | [`architecture.md`](./architecture.md) | Dual-Scope storage (`.memory/`), SQLite DB, retrieval scoring formula, and file layout | System design, file locations, state machine, and data flow |
13
15
  | [`brand.md`](./brand.md) | Persona profiles (`USER.md` archetypes), voice, and presentation rules | Writing prompts, terminal output copy, and user documentation |
14
- | [`current.md`](./current.md) | Current shipped state (v2.0.0), test coverage, and active constraints | Before starting work on bugs, features, or refactors |
16
+ | [`current.md`](./current.md) | Current shipped state (**v3.0.1**), test coverage, and active constraints | Before starting work on bugs, features, or refactors |
15
17
  | [`decisions.md`](./decisions.md) | Locked architectural decisions (zero-daemon, file-backed SQLite, atomic I/O) | Evaluating technical choices or refactors |
16
18
  | [`roadmap.md`](./roadmap.md) | Planned improvements, ecosystem expansions, and backlog | Scoping new capabilities |
19
+ | [`ticket-plan.md`](./ticket-plan.md) | Detailed ticket plan for the next work waves | Planning a specific wave of work |
20
+ | [`deep-research-agentic-memory-evolution.md`](./deep-research-agentic-memory-evolution.md) | Deep research brief & architectural plan for agentic cognitive OS evolution | Designing R17-R22 milestones and feature implementations |
21
+ | [`deep-research-memory-mechanisms-2026-09.md`](./deep-research-memory-mechanisms-2026-09.md) | 86-system memory feature matrix with per-system mechanisms and measured claims | Competitive research, capability scoping, mechanism adaptation |
22
+ | [`deep-research-memory-adaptation-2026-10.md`](./deep-research-memory-adaptation-2026-10.md) | Scored adaptation shortlist (impact Γ— feasibility) against the 86-system study, with the top-3 ranked adaptations and their acceptance tests | Choosing what to build next from competitor mechanisms |
23
+ | [`deep-research-memory-improvement-2026-10.md`](./deep-research-memory-improvement-2026-10.md) | Deep research brief: 9 new memory systems, updated gap scorecard, scored adaptation shortlist (A15–A22), and R23–R26 production-readiness roadmap | Designing R23–R26 milestones, versioned memory features, and monetization positioning |
24
+ | [`../artifacts/bench-graph-baseline.md`](../artifacts/bench-graph-baseline.md) | Measured graph/dashboard baseline at 100/1k/10k memories, hypothesis verdicts, and the fix order for the instant-graph workstream | Before changing `src/ui.ts`, `src/graph.ts`, or the dashboard render path |
25
+
26
+ ---
27
+
28
+ ## πŸ“„ User-facing documentation (repository `docs/`)
29
+
30
+ | File | Audience | Purpose |
31
+ | :--- | :--- | :--- |
32
+ | [`docs/user-guide.md`](../../docs/user-guide.md) | Humans | The daily pair-programming loop: ground β†’ constrain β†’ capture. |
33
+ | [`docs/concepts.md`](../../docs/concepts.md) | Humans | Core concepts and the guarded 7-state lifecycle machine. |
34
+ | [`docs/team-getting-started.md`](../../docs/team-getting-started.md) | Humans | Team setup: server, auth, client recipes. |
35
+ | [`docs/roadmap.md`](../../docs/roadmap.md) | Humans | The sprint board (requested β†’ planned β†’ in progress β†’ done). |
36
+ | [`docs/agent-reference.md`](../../docs/agent-reference.md) | **Agents** | The contract: install, file layout, mandatory session protocol, trust gates, failure semantics. |
37
+ | [`docs/cli-reference.md`](../../docs/cli-reference.md) | **Agents** | Every CLI command and every MCP tool β€” **generated** from `src/`. |
38
+ | [`docs/mcp-tool-matrix.json`](../../docs/mcp-tool-matrix.json) | **Agents** | The tool list as JSON β€” **generated** from `src/`. |
39
+ | [`claims.json`](../../claims.json) | **Agents** | Every countable claim β€” **generated** from `src/`. |
40
+
41
+ ### Generated documentation is never hand-edited
42
+
43
+ `docs/cli-reference.md`, `docs/mcp-tool-matrix.json` and `claims.json` are
44
+ produced by `scripts/generate-claims.ts` and
45
+ `scripts/generate-cli-reference.ts`. Regenerate them after any CLI or MCP
46
+ change:
47
+
48
+ ```bash
49
+ bun run scripts/generate-claims.ts
50
+ bun run scripts/generate-cli-reference.ts
51
+ ```
52
+
53
+ `test/marketing_claims.test.ts` fails the build when the generated files and
54
+ the source disagree, when a published figure is stale, or when an agent-facing
55
+ document names a tool that does not exist.
56
+
57
+ ### The website's agent-readable layer
58
+
59
+ `apps/website` publishes `llms.txt` (a curated map) and `llms-full.txt` (the
60
+ whole site as plain text). Both are generated from the built HTML by
61
+ `apps/website/scripts/build-llms-txt.ts`, so they cannot drift from the site.