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
@@ -6,14 +6,376 @@
6
6
  - **R14: Cross-Agent Knowledge Sync & P2P Gossip Protocol**: Sealed SyncPackets, vector clock causal tracking, filesystem shared pool drop-directory synchronization, contradiction tagging.
7
7
  - **R15: Full Web Observability Studio**: Embedded visual web dashboard (`memory studio`) featuring 5-pillar health scorecards, ADR drift inspection, autonomous "Why" reasoner, and live mesh visualization.
8
8
  - **R16: Multi-Repo & Monorepo Cross-Project Mesh**: Monorepo auto-discovery (pnpm, npm, bun, lerna), cross-project memory resolution with origin provenance, cross-package contract integrity auditing.
9
+ - **GAP-1 (2026-09-30): Write-Time Citation Verification** — hallucinated citations rejected at write; shipped in `src/anchors/verify-write.ts` + MCP `memory_anchor_create` gate. From the 2026-09 memory-mechanisms deep research (`.agents/context/deep-research-memory-mechanisms-2026-09.md` §14–15).
10
+ - **GAP-2 (2026-09-30): Claude Code Lifecycle Hook Pack** — SessionStart/PostToolUse/Stop hooks, hands-free capture & injection; `memory hooks install` / `memory connect --with-hooks`. Same research §14 (GAP-2).
11
+ - **GAP-3 (2026-09-30): Recall-Time Freshness Gate** — drifted/orphaned-anchor memories withheld from `muse_context` by default with explicit notices; `include_drifted` opt-in. Same research §14 (GAP-3). Remaining roadmap below.
12
+ - **R17: Deep Research & Architectural Audit (2026-10-14)**: Walrus Memory competitive teardown, SOTA memory-systems scan (Mem0 v3, Zep/Graphiti, Letta MemFS, Supermemory, Cognee, LangMem, A-MEM, HippoRAG, vendor-native), and a read-only source audit of the engine (30.8k LOC / 113 files) that surfaced 10 ranked defects, 4 advertised-but-dead features, 1 security path, 1 data-loss path. Deliverable: `.agents/research/research-brief-walrus-memory-architecture.md`.
9
13
 
10
14
  ---
11
15
 
12
- ## 🚀 Active Roadmap & Future Horizons
16
+ ## 🚀 Active Roadmap & Future Horizons (Agentic Cognitive OS Evolution)
17
+
18
+ ### 0. **DX & Project Showcase Assets (Pending Triage)**
19
+ - **Production-Grade Showcase Demo Video & GIF**:
20
+ - Re-record high-fidelity terminal demo video (`showreel.mp4`) and GIF (`muse-memory-demo.gif`) reflecting v3.0.0 capabilities.
21
+ - Showcase real workflows: failure attribution with decaying strikes, negative fix-pair mining, HOT.md candidate compounding, `memory branch` / `checkout`, and MCP context recall.
22
+ - Replace legacy inaccurate SVG render with an authentic, crisp terminal capture.
23
+
24
+ ---
25
+
26
+ ### 1. **R17: Tri-Cognitive Memory Architecture (Procedural Playbooks & Episodic Horizons)**
27
+ - **Procedural Playbook Engine (`ProceduralMemory`)**:
28
+ - Capture executable tool-calling workflows, pre-conditions, step trajectories, verification assertions, and rollback recipes distilled from successful agent sessions.
29
+ - Tool additions: `muse_playbook_recall`, `muse_playbook_record`, `memory playbook --run <id>`.
30
+ - **Episodic Causal Narrative Horizon**:
31
+ - Transform flat observation streams into structured episodic sequences: `Goal ➔ Hypothesis ➔ Action Trajectory ➔ Verification ➔ Retrospective Insight`.
32
+ - Enables agents to query historical causal chains ("Have we attempted this fix before, and what was the failure cascade?").
33
+ - **Bi-Temporal Validity Windows (Zep / Graphiti Temporal Pattern)**:
34
+ - Dual timestamps: transaction assertion time (`asserted_at`) and valid world time (`valid_from` / `valid_until`).
35
+ - Prevents historical regressions during git blame/code reviews of legacy branches without clobbering modern rules.
36
+ - **Ebbinghaus Utility-Reinforced Cognitive Forgetting Curve**:
37
+ - Automated half-life decay for unverified candidate notes; exponential reinforcement for memories with verified green test runs and high reuse ROI.
38
+
39
+ ---
40
+
41
+ ### 2. **R18: AST Associative Callgraph Retrieval & Speculative Pre-Flight Recall**
42
+ - **Recursive SQLite CTE Associative Expansion (Zero-Daemon HippoRAG Pattern)**:
43
+ - 2-hop associative graph traversal using in-process SQLite recursive CTEs (`WITH RECURSIVE call_tree AS (...)`).
44
+ - Queries touching an entrypoint symbol automatically pull governing ADRs, test requirements, and negative anti-patterns anchored to downstream callees.
45
+ - **Speculative Pre-Flight Context Push**:
46
+ - Git/editor hooks that pre-calculate the optimal token-budgeted memory knapsack upon file opening or branch switching (`feat/*`), eliminating agent context-query latency.
47
+ - **Cross-File Symbol Blast-Radius Risk Scoring**:
48
+ - Correlates AST identifiers with route handlers, exported interfaces, and test files to provide instant pre-flight risk ratings for proposed changes.
49
+
50
+ ---
51
+
52
+ ### 3. **R19: Git-Branchable Memories & Multi-Tenant Agency Enclaves**
53
+ - **Git-Aware Branchable Memory Overlays (`memory branch`)**:
54
+ - Branch-isolated working memory overlays that mirror git branch lifecycles (`feature/*`, `fix/*`).
55
+ - Automated `memory branch-merge` command with interactive semantic contradiction resolution when merging feature branches into `main`.
56
+ - **Agency Multi-Tenant Enclaves (`scope: client`)**:
57
+ - Cryptographically isolated client memory vaults tailored for multi-client agency delivery (Sol, Jasper, Crew, Nexus).
58
+ - Enforces zero cross-client knowledge contamination while allowing global engineering invariants (`scope: global`) to propagate safely.
59
+ - **Zero-Knowledge Memory Attestation**:
60
+ - Cryptographic SHA-256 signing of SyncPackets with tamper-evident audit chains for verifiable client handoffs.
61
+
62
+ ---
63
+
64
+ ### 4. **R20: Test-Driven Memory Reinforcement & Autonomous Regression Sentry**
65
+ - **Automated CI / Test Harness Integration Loop**:
66
+ - Binds memory utility ROI directly to test outcomes (`bun test`, `vitest`, `jest`, `cargo test`).
67
+ - Passing tests increment memory confidence and `successful_applications`; failing tests trigger automated dispute and regression tracking.
68
+ - **Negative Anti-Pattern Regression Sentry**:
69
+ - Proactive watchdog matching test failure signatures and stack traces against known `BUG_PRONE_PATTERN` and `DO_NOT_USE` entries, generating immediate remediation playbooks.
70
+ - **Flaky Test & Environment Drift Detector**:
71
+ - Correlates test intermittency with past dependency upgrades, node runtime versions, and environmental invariants.
72
+
73
+ ---
74
+
75
+ ### 5. **R21: Local Vector Embeddings & Hybrid Search Fusion (engine: llama.cpp)**
76
+ - **Local embedding engine — llama.cpp server (default)**:
77
+ - `llama-server` with a small GGUF embedding model (e.g. bge-small / nomic-embed-text), CPU-only, started on demand — no background service.
78
+ - One OpenAI-compatible `/v1/embeddings` adapter (zero npm deps, bun `fetch`): llama.cpp, Ollama, hosted providers, and a future Hermes embedding facade are the same code path behind a URL.
79
+ - Embedding pipeline fingerprint (`model|dims|endpoint`) stored with the vector index; mismatch refuses reuse and requires `memory embed reindex` (qdrant-memory `init` pattern).
80
+ - Vectors as float32 BLOBs in SQLite; brute-force cosine at current store scale — no ANN index until measured otherwise.
81
+ - **Unblocks A12** (dense vectors, deferred in the October research): the re-evaluation condition — "zero-cost, zero-API-key local embedding" — is now met. Embeddings stay **opt-in / off by default**; the keyless lexical path remains the default.
82
+ - **Reciprocal Rank Fusion (RRF) Hybrid Engine**:
83
+ - Mathematical fusion blending SQLite FTS5 BM25 lexical ranking, AST symbol proximity, and dense semantic vector similarity into a unified top-$K$ candidate set.
84
+
85
+ ---
86
+
87
+ ### 6. **R22: Agent Development Environment (ADE) & Meta-Cognitive Self-Reflection MCP**
88
+ - **Agent Self-Reflection MCP Tooling (`muse_reflect`)**:
89
+ - End-of-session reflective pass allowing agents to critique their own trajectory, extract reusable lessons, and update `CURRENT.md` checkpoints.
90
+ - **Counterfactual Decision Reasoner (`muse_counterfactual`)**:
91
+ - Records why alternative options were discarded during architecture reviews, preventing future agents from re-proposing rejected paths.
92
+ - **Autonomous Memory Consolidation & Synthesis (A-Mem Evolution Pattern)**:
93
+ - Zero-daemon background consolidation that synthesizes related micro-memories into coherent macro-concepts and updates inter-memory links.
94
+
95
+ ## 🧬 R23–R26: Production-Readiness & Versioned Memory Milestones
96
+
97
+ ### 7. **R23: Versioned Memory + Access-Weighted Retention**
98
+ - **`Memory Versioning` (Git-branchable memory)**:
99
+ - `mem_path` field: human-readable dotted-path addressing (e.g., `auth.session.jwt-expiry`).
100
+ - `memory branch <name>`, `memory checkout <branch>`, `memory blame <id>` CLI verbs.
101
+ - Branch-isolated `.memory/` + `~/.memory/<branch>` scope snapshots with `CURRENT_MD_SCOPE` switching.
102
+ - Backwards-compatible: UUID `id` still works alongside `mem_path`.
103
+ - **`Access-Weighted Retention` (A15)**:
104
+ - `last_accessed_at` and `access_count` columns added to SQLite; backfilled from existing `utility_roi`.
105
+ - `staleness_policy` gains `half_life_days` field; decay curve: `0.5 ^ (days_since_last_use / half_life_days)`.
106
+ - Memories used ≥2× in a session get +50% longevity extension.
107
+ - Default half-lives: `fix` = 60d, `adr` = 365d, `anti_pattern` = permanent, `observation` = 7d.
108
+ - **Acceptance criteria**:
109
+ - `last_accessed_at` updated on every successful `muse_context` / `get_context` recall.
110
+ - `memory branch`/`checkout`/`blame` verbs work in non-git folders (single main branch).
111
+ - Existing tests in `test/staleness.test.ts` continue to pass; new `test/retention.test.ts` and `test/branch.test.ts` cover the new behaviour.
112
+
113
+ ---
114
+
115
+ ### 8. **R24: Agent Plugin Registry**
116
+ - **`memory plugin install <agent>`**:
117
+ - Thin plugin installers for 20+ agents (Claude Code, Cursor, Codex, Gemini CLI, OpenCode, Hermes, OpenClaw, VS Code, Cline, Windsurf, Zed).
118
+ - Extends MCP registration to plugin registration; each plugin calls `muse_context` at session start + `create_observation` at stop.
119
+ - **`memory plugin init`**:
120
+ - Scaffold for agent plugin developers (`.mcp.json` + hooks + skills template).
121
+ - **Acceptance criteria**:
122
+ - `memory plugin list` shows supported agents.
123
+ - `memory plugin install claude-code` produces a working hook setup.
124
+ - Documentation at `/docs/plugins`.
125
+
126
+ ---
127
+
128
+ ### 9. **R25: Progressive Disclosure + Scoped Retrieval**
129
+ - **Progressive disclosure**:
130
+ - `muse_context --include-abstract`: returns a one-line abstract per candidate plus a drill-down handle.
131
+ - Agent scans cheaply, expands only winners.
132
+ - **Scoped retrieval**:
133
+ - `muse_context --scope <subtree>`: RRF-fuse BM25 + graph walk within the subtree.
134
+ - `/api/graph` route fix (bench-graph baseline F1–F7): returns only fields the canvas needs.
135
+ - **Acceptance criteria**:
136
+ - `--include-abstract` reduces token usage on large stores by ~20%.
137
+ - `--scope` sub-linear scaling at 10k memories.
138
+ - `/api/graph` eliminates F1–F7 failures from bench-graph baseline.
139
+
140
+ ---
141
+
142
+ ### 🔟 **R26: Pro Plugin + Monetization Stack**
143
+ - **Pro Plugin (One-time purchase)**:
144
+ - `memory dream`: overnight synthesis of related micro-memories into macro-concepts (opt-in, zero-LLM by default; local LLM optional).
145
+ - Obsidian/Optimaze graph export.
146
+ - Distributed via Gumroad/Polar at $49 one-time.
147
+ - **Team SaaS (Subscription)**:
148
+ - Shared memory vault, cross-agent handoffs, per-user attribution.
149
+ - `memory branch` workspace command for team isolation.
150
+ - Team audit log with git-blame.
151
+ - $9/user/mo (Stripe).
152
+ - **Enterprise SaaS (Quote)**:
153
+ - SSO (SAML/OIDC), air-gapped deployment, compliance export (SOC 2, GDPR).
154
+ - $29/user/mo.
155
+ - **Solo (Free, forever)**:
156
+ - All current features, local-first, zero-LLM. $0.
157
+ - **Other production-readiness items**:
158
+ - Self-hostable Plausible analytics (no GA, local-first).
159
+ - Pricing page at `/pricing`.
160
+ - `memory benchmark --median` publishing per-store medians.
161
+
162
+ ---
163
+
164
+ ## 📊 Current Status (as of v2.3.0)
165
+
166
+ | Area | Status | Next Milestone |
167
+ |---|---|---|
168
+ | **Speed & Observability** | ✅ Shipped (sub-2ms, <50µs hot cache, 527 tests) | R25 (--include-abstract, --scope) |
169
+ | **Hands-free hooks** | ✅ 3/6 events shipped (GAP-2) | R24 (full plugin registry) |
170
+ | **Trust gates** | ✅ Write-time verify + recall-time freshness gate (GAP-1, GAP-3) | R23 (extend to multi-repo) |
171
+ | **Version control** | ⚠️ No branch-aware memory | R23 (memory branch/checkout/blame) |
172
+ | **Compounding** | ✅ 7-state lifecycle + archival ladder | R23 (access-weighted retention, half-life decay) |
173
+ | **Team/SaaS** | ⚠️ Not yet built | R26 (pricing page, Plausible, SaaS prototype) |
174
+
175
+ ---
176
+
177
+ ### 11. **R27: Recall Quality Eval Harness (LoCoMo-style, CI-gated)**
178
+ - **Golden recall fixture**: labeled queries plus same-topic distractors covering the five LongMemEval-V2 abilities (static state recall, dynamic state tracking, workflow knowledge, environment gotchas, premise awareness). Muse already covers 3–4 of the 5; the fixture proves it.
179
+ - **CI gate**: `bun test` fails below a recall@5 threshold; p50 latency reported beside it. Current benchmarks measure speed only — recall quality is unmeasured.
180
+ - Reuses `src/benchmark/` and existing test infrastructure. Prerequisite for judging R21 and every future retrieval change.
181
+
182
+ ### 12. **R28: Memory Poisoning Trust Tiers (OWASP ASI06)**
183
+ - **`trust: trusted | candidate | untrusted`** set by ingest source: known agent transcripts are candidates; web or external content is untrusted.
184
+ - `muse_context` filters untrusted by default and reports `withheld_memories` — mirrors the GAP-3 freshness gate pattern.
185
+ - Reuses `src/provenance.ts` and `src/orchestrator/freshness.ts`.
186
+
187
+ ### 13. **R29: I/O Budget & NVMe Telemetry**
188
+ - **`memory io`**: bytes-written/day from `/proc/self/io` with an alert threshold — makes SSD wear visible instead of theoretical.
189
+ - YAML dual-write mirror becomes async-batched or opt-out (it currently doubles every write's amplification).
190
+ - Rotation caps for `audit.jsonl` / `observations.jsonl` via existing `src/retention.ts`; `wal_autocheckpoint` tuning note.
191
+
192
+ ### 14. **R30: Tombstones & Scoped Deletion (extends A7 suppress)**
193
+ - **Content-hash tombstones on delete**: replayed events cannot resurrect deleted memories (qdrant-memory fence pattern; A7's suppress state already hides the bytes).
194
+ - `memory delete-all --scope <user|client> --confirm` with a fail-closed `recovery_required` state on interruption (agency client-data deletion).
195
+
196
+ ### 15. **R31: Multi-Writer Merge (extends R19 + sync mesh)**
197
+ - Concurrent writers on one shared store: observations merge append-only; memory-level conflicts are flagged, never clobbered (existing contradiction invariant).
198
+ - Reuses `src/sync/` vector clocks and the contradiction engine. Single-writer remains the default; merge mode is opt-in. No distributed locks.
199
+
200
+ ### 16. **R32: Studio Recall-Debug (extends R15 + A22)**
201
+ - Surface `ranking.ts` per-factor score breakdowns in the Observability Studio: *why* was this memory retrieved.
202
+ - Eval-harness (R27) results panel. Small diffs on `src/ui.ts`.
203
+
204
+
205
+ ---
206
+
207
+ # 🗂️ 2026-10-14 Research Track (competitive + engine audits)
208
+
209
+ > Sections below were produced by the October research/audit program. They reference the **243-ticket implementation plan** in `.agents/context/ticket-plan.md` (IDs `T-###`) and the external-review artifact `.agents/plans/EVOLUTION_PLAN.md`. Product milestones R17-R32 above remain the spec-level roadmap; this track is the audit-backed execution plan derived from it plus ecosystem research.
210
+
211
+ ## 🧬 R17b: Ecosystem Teardown Upgrades (2026-10-14)
212
+
213
+ 69-URL principal-supplied competitor scan (Hermes plugin ecosystem + major OSS memory systems) + Hermes platform teardown + DB/transport research. Full evidence: `.agents/research/ecosystem-teardown-2026-10.md` (competition list + 50-item consolidated implementation catalog + explicit rejections). Decided waves:
214
+
215
+ - **P0 additions (v2.4.0, 22 items)**: idempotency keys + content-hash dedup; write outbox with stale-lock recovery; `on_pre_compress` fact extraction; wake gate (`wakeAgent:false`) for background passes; overnight loss guard; memory-pressure alerts; honest dual-measure token accounting; refuse-incomplete digest contract; circuit breaker around store calls; `atexit` bounded joins; read-path re-validation; safe FTS query construction; limit clamping; stale-read tags.
216
+ - **P1 additions (v2.5.0, 18 items)**: consolidated abstention gates; decay/forgetting engine (decay_score + veracity tiers + trust-tier half-life + stamped expiry + pin policy); bitemporal `valid_to_exact`/`as_of` discipline; conflicts-table-never-delete + federation handshake; veracity trust table + evidence-age stamping; TOON/manifest context packing + omission markers + reserved slots; linked_memory_ids + supersede-not-delete + prefer_observations dedup; provenance tables + hash-chained audit + index-time redaction; write gates (scoreRetain + corroboration-gated promotion + two-tier flush); recall hygiene (re-injection + echo suppression + seen-chunk TTL); ranking upgrades (soft-OR fusion + discrimination rerank + watermark staleness + intent bias); L0/L1 abstracts + resident INDEX; why_retrieved + usage telemetry + config-honesty audit; constitution contract; failure-visibility signals; embeddings (R21) + eval harness (R27); fix-pair mining.
217
+ - **P2 additions**: server mode (Streamable HTTP + per-tenant DB files + SyncPool-over-HTOP + git YAML distribution + Litestream backups); dashboard rehaul (recall-debug, lineage graph, eval panel, control tower, mesh view); always-on memory cadence; Hermes MemoryProvider adapter (qdrant branch becomes opt-in vector adapter); federation handshake; observer/observed team semantics; memory forking; gated graph retrieval; funded pools; marketplace.
218
+ - **Hard rejects**: daemon-backed stores, SaaS memory backends, AGPL/BSL/PolyForm code copies, multilingual stemming, auto-delete, full-file injection.
219
+
220
+ Engine verdict: Muse Memory's zero-daemon SQLite+FTS5+YAML+MCP architecture is the majority position of the field and ahead of the Hermes plugin long tail; the gap is shipping the convergent mechanisms (above), not architecture change.
221
+
222
+ ### R17b Full Item List (source of truth: `.agents/research/ecosystem-teardown-2026-10.md` §10)
223
+
224
+ **P0 — reliability (v2.4.0)**
225
+ 1. Query-cache self-destruction fix (`store.ts:281`)
226
+ 2. Memoized file verification + precomputed token sets in ranking hot path
227
+ 3. `openStore` dirty-gate for wiki recompile
228
+ 4. Bounded FTS preflight; single-transaction writes; FTS↔row parity repair
229
+ 5. `/bin/sh -c` removal in `memory verify`
230
+ 6. Wire or delete 4 dead features (`dedup`, `recordRetrievals`, `maybeAutoOptimize`, `touchActivity`)
231
+ 7. Tombstones + `memory_restore` + audit-replay restore
232
+ 8. `Math.max` spread crash + IDF caching + redundant list() fixes
233
+ 9. Idempotency keys + content-hash dedup on capture
234
+ 10. Write outbox with stale-lock recovery
235
+ 11. `on_pre_compress` fact extraction
236
+ 12. Wake gate (`wakeAgent:false`) for background passes
237
+ 13. Overnight loss guard
238
+ 14. Memory-pressure alerts
239
+ 15. Honest dual-measure token accounting
240
+ 16. Refuse-incomplete digest contract
241
+ 17. Circuit breaker around store calls
242
+ 18. `atexit` bounded joins + generation-counter prefetch invalidation
243
+ 19. Read-path re-validation for injection markup/credentials
244
+ 20. Safe FTS query construction + compound-token expansion
245
+ 21. Clamp model-supplied limits; dry-run-by-default destructive ops
246
+ 22. Stale-read provenance tags
247
+
248
+ **P1 — memory quality (v2.5.0)**
249
+ 23. Consolidated abstention gates (IDF relevance, dual thresholds, no_confident_match)
250
+ 24. Decay/forgetting engine (decay_score, veracity tiers, trust-tier half-life, stamped expiry)
251
+ 25. Bitemporal `valid_to_exact`/`as_of` discipline
252
+ 26. Conflicts-table-never-delete + federation handshake
253
+ 27. Veracity trust table + evidence-age stamping
254
+ 28. TOON/manifest context packing + omission markers + reserved slots
255
+ 29. linked_memory_ids + supersede-not-delete + prefer_observations dedup
256
+ 30. Provenance tables + hash-chained audit + index-time redaction
257
+ 31. Write gates (scoreRetain, corroboration-gated promotion, two-tier flush)
258
+ 32. Recall hygiene (re-injection, echo suppression, seen-chunk TTL)
259
+ 33. Ranking upgrades (soft-OR fusion, discrimination rerun, watermark staleness, intent bias)
260
+ 34. L0/L1 abstracts + resident INDEX route-map
261
+ 35. why_retrieved + usage telemetry + config-honesty audit
262
+ 36. Constitution contract
263
+ 37. Failure-visibility signals (degraded notes, ground-moved, loosening ladder)
264
+ 38. Embeddings per R21 spec branch (SQLite BLOB brute-force, FTS5 floor)
265
+ 39. Eval harness per R27 spec branch (recall-gate grading)
266
+ 40. Fix-pair mining from transcripts
267
+
268
+ **P2 — team, server, UI**
269
+ 41. Server mode (Streamable HTTP, per-tenant DB files, SyncPool-over-HTTP, git YAML distribution, Litestream backups)
270
+ 42. Dashboard rehaul (recall-debug, lineage graph, eval panel, control tower, mesh view)
271
+ 43. Always-on memory cadence (event-triggered consolidation, dual-trigger maintenance, wake gates)
272
+ 44. Hermes MemoryProvider adapter (qdrant branch → opt-in vector adapter)
273
+ 45. Federation handshake for mesh mode
274
+ 46. Observer/observed team semantics
275
+ 47. Memory forking/branching
276
+ 48. Gated graph retrieval (behind the P1 eval harness)
277
+ 49. Funded/shared memory pools (spec only)
278
+ 50. Memory marketplace (spec only)
279
+
280
+ **Hard rejects:** daemon-backed stores, SaaS memory backends, AGPL/BSL/PolyForm code copies, multilingual stemming, auto-delete, full-file injection.
281
+
282
+ ---
283
+
284
+ ## 🧹 R18: Retirement & Hygiene Audit (2026-10-14)
285
+
286
+ Full evidence: `.agents/research/retirement-audit-2026-10.md` (two-lane audit, reconciled). Verdict summary — almost nothing is dead; the work is drift plus two security defects.
287
+
288
+ **Do first (security, outranks all features):**
289
+ 1. Fix `verify.ts:23` `/bin/sh -c` on memory-supplied `test_command` — RCE-class, reachable via `memory_verify`/`memory_verify_strict`.
290
+ 2. Fix studio UI XSS (`ui.ts:1510`, `ui.ts:1557` unescaped interpolation) + gate `/api/optimize`.
291
+
292
+ **Free drift fixes (no runtime risk):**
293
+ 3. Remove 7 phantom names from `orchestrator/profiles.ts`.
294
+ 4. Retire `connect.ts:9-50` allowlist (auto-approves 3 phantom tools, omits 61 real).
295
+ 5. RETIRE: `maybeAutoOptimize` (0 callers), unreachable LSP tier (`lsp.ts:16`), 4 unused registry methods, 3 dead governor exports.
296
+
297
+ **Deprecations (visible externally, docs-level breakage only):**
298
+ 6. Deprecate 20 of 24 migrator providers (only 4 adapters exist; delete detectors before adapters).
299
+ 7. Freeze 20 dormant agent platforms; fix README "80+" → 52 claim; fix `daemon.ts` README (SSE, not WebSocket).
300
+ 8. Flip YAML mirror read precedence to DB-first (`store.ts:174-202`, ~6 lines); keep the mirror.
301
+
302
+ **Hygiene:**
303
+ 9. Real dispatch tests (or documented-untested status) for 12 circular + 20 full-profile-only tools.
304
+ 10. Deprecate `recall` as a third retrieval path (alias only).
305
+
306
+ **Decisions deferred:** MCP profile default change to `core` (~5k tokens/session saved, but visible behavior change — belongs with the R17b P2 tool-packaging work); YAML full-delete (rejected, largest blast radius).
307
+
308
+ ---
309
+
310
+ ## 🏛️ v9: Realigned In-Line Feature Waves (2026-10-15)
311
+
312
+ Full senior developer and security audit: `.agents/artifacts/audit-and-realigned-roadmap-20261015.md`.
313
+ Exploded ticket plan: `.agents/context/ticket-plan.md` (269 tracked tickets, 21 landed on `dev`, 248 active).
314
+
315
+ ### The In-Line Feature Waves
316
+ 1. **Wave 0: Pre-Flight Integrity & Baseline Fixes (Immediate P0)**
317
+ - `T-402`: `initSchema` column-order fix (prevents silent SQLite degradation on legacy stores)
318
+ - `T-403`: Stored-command doctor sweep (sanitizes legacy non-template `test_command`s)
319
+ - `T-404`: Stdin TTY decoupling in `src/hooks/pack.ts` (prevents terminal hangs)
320
+ - `T-401`: Bunfig surface hardening (`bunfig.toml` timeout & runner isolation)
321
+ - `T-370`: Documentation truth pass (52 platforms, 107 tools, version sync)
322
+
323
+ 2. **Wave 1: Storage Engine, Outbox & Concurrency (In-Line Storage P0)**
324
+ - `T-041`: Outbox state machine (`pending` → `processing` → `sent` / `held` / `failed`) via migration `v3`
325
+ - `T-042`: Stale lock recovery sweep (300s) on store open
326
+ - `T-044`: Append-only fsync JSONL event log + single-writer flock
327
+ - `T-038`: `idempotency_key` column + UNIQUE constraint on capture
328
+ - `T-040`: Normalized `content_hash` + dedup on propose
329
+ - `T-056`: `atexit` bounded join for async write queue workers
330
+ - `T-055`: Circuit breaker around store paths (5 failures → 120s cooldown)
331
+
332
+ 3. **Wave 2: Write Admission, Trust & Anti-Poisoning (In-Line Trust P0/P1)**
333
+ - `T-104`: `scoreRetain` 0.3 write gate (refuses junk writes with low informational density)
334
+ - `T-105`: Corroboration-gated promotion (≥2 independent days, non-synthetic sources)
335
+ - `T-105b`: Syntax-only promotion rule (AST syntax & invariant verification gate)
336
+ - `T-075`: Ingest trust tiers (`trusted` | `candidate` | `untrusted`) by source type
337
+ - `T-058`: Read-path re-validation (injection markup & credentials excluded from recall)
338
+ - `T-103`: Index-time credential redaction keeping text searchable without secret leakage
339
+ - `T-391`: Citation validation against live registry at write time
340
+
341
+ 4. **Wave 3: Retrieval Optimization, Ranking & Token Economics (In-Line Retrieval P1)**
342
+ - `T-035`: Replace `Math.max(...arr)` spread crash with iterative max
343
+ - `T-036`: In-memory IDF caching across queries
344
+ - `T-037`: Drop redundant full-list scan in `hybridSearch`
345
+ - `T-060`: Safe FTS5 query token escaping
346
+ - `T-061`: Compound-token expansion (camelCase / snake_case splitting)
347
+ - `T-070`: IDF-weighted relevance gate before FTS5
348
+ - `T-114`: Soft-OR evidence fusion formula `P = 1 - (1 - pv)(1 - pl)`
349
+ - `T-115`: Low-discrimination conditional rerank
350
+ - `T-117`: Watermark staleness tracking from `last_memory_seen_at`
351
+ - `T-126`: Deterministic `why_retrieved` reason tokens
352
+
353
+ 5. **Wave 4: Compaction, Ephemeral Observations & Distillation (In-Line Cognition P1)**
354
+ - `T-045`: `on_pre_compress` fact extraction hook in compaction engine
355
+ - `T-046`: Persisted digest-dedup set for extracted facts
356
+ - `T-305`: Distillation body cap (prevents raw logs from bloating memory content)
357
+ - `T-306`: Observation log atomic rotation and size cap in `observations.jsonl`
358
+ - `T-053`: Honest dual-measure token accounting
359
+ - `T-054`: Refuse-incomplete digest contract in `get_context`
360
+
361
+ 6. **Wave 5: Security Hardening & UI Protection (In-Line Security P1)**
362
+ - `T-002` / `T-003`: UI XSS escaping for `p.title`, `p.slug`, `r.entry_id`, `r.actor` interpolation
363
+ - `T-004`: UI optimizer gate (`POST /api/optimize` dry-run default + localhost token check)
364
+ - `T-388`: Hook `SessionStart` `<muse-memory>` block escaping
365
+ - `T-389`: `recordObservation` metadata JSON credential scanning
366
+ - `T-399`: Memory routine step allowlist + re-entrancy recursion guard
367
+ - `T-400`: UI read route projection allowlist
368
+ - `T-380`: Unit test suite for `escapeHtml`
369
+
370
+ 7. **Wave 6: Semantic Embeddings & Eval Harness (In-Line Evals P2)**
371
+ - `T-381`: Embeddings spike (validate local llama-cpp embedding generation E2E)
372
+ - `T-071` / `T-136`–`T-139`: Local embeddings engine + brute-force SQLite BLOB cosine similarity
373
+ - `T-140`–`T-143`: Recall evaluation harness (frozen corpus, precision/recall scoring, p50 latency)
374
+
375
+ 8. **Wave 7: Team Slice (On-Demand / Opt-In P2)**
376
+ - `T-150`: MCP Streamable HTTP transport
377
+ - `T-151`: Transport security headers
378
+ - `T-386`: Bearer-token authentication + per-peer allowlist
379
+ - `T-153`: Multi-DB topology (shared team store + personal DBs)
380
+ - `T-387`: Client configuration recipes & shared+personal scoping governance
13
381
 
14
- 1. **Distributed Agentic Swarm Telemetry**:
15
- - Aggregate multi-agent task traces and memory application telemetry across distributed agency clusters.
16
- 2. **Autonomous Semantic Refactoring Engine**:
17
- - Proactive codebase refactoring recommendations driven by historical bug friction clusters and ADR drift patterns.
18
- 3. **Enterprise Role-Based Access & Secret Boundary Enclaves**:
19
- - Cryptographic memory encryption and tenant-isolated compartmentalization for multi-client agency delivery.