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
@@ -1,101 +1,167 @@
1
1
  # 📦 Muse Memory Product Scope & Capabilities
2
2
 
3
- > **Binary Names**: `memory` (primary), `musememory` (alias), `npx musememory` (zero-install)
4
- > **MCP Protocol**: MCP 2024-11-05 (stdio transport)
3
+ > **Binary Names**: `memory` (primary), `musememory` (alias), `npx musememory` (zero-install)
4
+ > **MCP Protocol**: MCP `2024-11-05`, `2025-06-18` (stdio transport)
5
5
  > **Runtime**: Bun / TypeScript (Node-compatible bundle)
6
+ > **Authoritative counts**: [`claims.json`](../../claims.json) — generated from `src/` by `scripts/generate-claims.ts`.
7
+ > **Authoritative tool list**: [`docs/mcp-tool-matrix.json`](../../docs/mcp-tool-matrix.json) — generated, never hand-typed.
8
+ > **Full tool + flag reference**: [`docs/cli-reference.md`](../../docs/cli-reference.md) — generated.
9
+ > **Agent contract**: [`docs/agent-reference.md`](../../docs/agent-reference.md).
10
+
11
+ > ⚠️ **Do not hand-type tool or command names in this file.** Every tool name
12
+ > below is asserted against the live registry by
13
+ > `test/marketing_claims.test.ts`; a name that does not exist fails the build.
6
14
 
7
15
  ---
8
16
 
9
17
  ## 🎯 Executive Overview
10
18
 
11
- Muse Memory is a zero-daemon, file-backed cognitive memory engine designed to give AI agents (Claude Code, Cursor, Antigravity, Windsurf, Codex, Gemini CLI, Hermes, OpenCode, OpenClaw, etc.) persistent, self-organizing memory across sessions without external database daemons or cloud servers.
19
+ Muse Memory is a zero-daemon, file-backed cognitive memory engine that gives AI agents
20
+ (Claude Code, Cursor, Antigravity, Windsurf, Codex, Gemini CLI, Hermes, OpenCode,
21
+ OpenClaw, and the rest of the detected registry) persistent, self-organizing memory
22
+ across sessions — without an external database daemon, an account, or a cloud service.
23
+
24
+ - **MCP tools registered**: `claims.json → mcpTools`
25
+ - **Task profiles**: `claims.json → mcpProfiles` (`core`, `coding`, `debugging`, `review`, `architecture`, `maintenance`, `full`)
26
+ - **Coding agents auto-wired**: `claims.json → agentPlatforms`
27
+ - **External memory formats importable**: `claims.json → migratorProviders`
28
+ - **Credential rule families**: `claims.json → credentialRuleFamilies`
29
+ - **Background daemons**: `claims.json → backgroundDaemons`
12
30
 
13
31
  ---
14
32
 
15
- ## 🔌 Comprehensive MCP Tool Matrix
33
+ ## 🔌 Flagship Orchestration & Intelligence Tools
16
34
 
17
- ### 🎯 Flagship Orchestration & Intelligence Tools
18
35
  | MCP Tool | Execution Phase | Agent Purpose |
19
36
  | :--- | :--- | :--- |
20
- | `muse_context` | **Flagship Orchestration** | Unified context fusion: single-call query combining search, active file, symbol, error messages, and task intent under strict knapsack token budgets. |
21
- | `muse_health` | **Quality Gate** | 5-Pillar Project Health Gate: single-call audit of store integrity, code anchors, doc/code alignment, anti-pattern sentry, and technical debt with A-F grading and PASS/WARN/FAIL status. |
22
- | `muse_why` | **Cognition / "Why" Reasoner** | Traces code evolution backwards through past bug fixes, ADRs, trade-offs, and invariants to explain *why* code is designed the way it is before refactoring. |
23
- | `muse_bug_clusters` | **Fragility Hotspots** | Clusters recurring bugs into 5 root-cause categories with subsystem fragility scoring. |
24
- | `muse_tech_debt` | **Technical Debt Registry** | Scans code and memory for TODO/FIXME markers, unsafe `as any` casts, and drifted anchors with remediation advice. |
25
- | `muse_memory_for_code`| **Code-to-Memory** | Queries all memories, ADRs, constraints, and bugs associated with a code file and symbol. |
26
- | `muse_code_for_memory`| **Memory-to-Code** | Resolves all native code anchors and affected source files for a given memory entry. |
27
- | `memory_adr_record` | **Architecture Decisions**| Records first-class ADRs with drivers, decision, consequences, options considered, and native code anchors. |
28
- | `memory_adr_list` | **ADR Discovery** | Lists architecture decision records filtered by status (`proposed`, `accepted`, `superseded`, `rejected`). |
29
- | `memory_drift_audit` | **Drift Detection** | Bi-directional documentation $\longleftrightarrow$ code drift engine across 6 alignment states. |
30
- | `memory_capture_negative` | **Negative Sentry** | Records failed approaches, anti-patterns, and reproduction commands to prevent repeating mistakes. |
31
- | `memory_promote_scope` | **Scoped Promotion** | Promotes memory along 3-tier ladder (`local` $\rightarrow$ `project` $\rightarrow$ `global`) with 5× repeated success policy and universal generalization. |
32
- | `memory_archive` / `rehydrate` | **Archival Lifecycle** | Evaluates and manages `active` $\rightarrow$ `cold` $\rightarrow$ `dormant` $\rightarrow$ `archived` lifecycle with query rehydration. |
33
- | `anchor_create` / `verify` / `audit` | **Code Identity** | Creates, verifies, and audits line-independent structural code anchors. |
34
- | `muse_sync_broadcast` / `ingest` | **P2P Gossip Mesh** | Broadcasts and ingests portable sealed SyncPackets with deduplication and contradiction flagging. |
35
- | `muse_sync_status` / `pool` | **Sync Coordination** | Tracks peer vector clocks and synchronizes memories bidirectionally via shared drop-directory pool. |
36
- | `muse_mesh_status` | **Monorepo Topology** | Discovers monorepo workspaces and multi-repo sibling groups with package dependencies and stores. |
37
- | `muse_mesh_query` | **Cross-Project Query** | Queries memories across the entire workspace mesh with origin package provenance tags. |
38
- | `muse_mesh_audit` | **Contract Verification** | Audits cross-package dependency contracts, entrypoint exports, and cross-repo code anchors. |
39
- | `muse_mesh_link` | **Mesh Linking** | Explicitly links or unlinks external repository paths into the workspace mesh registry. |
40
-
41
- ### 🛠️ Core Memory & Lifecycle Tools
37
+ | `muse_context` | **Flagship Orchestration** | Unified context fusion: single-call query combining search, active file, symbol, error messages and task intent under strict knapsack token budgets. |
38
+ | `muse_health` | **Quality Gate** | 5-Pillar Project Health Gate: store integrity, code anchors, doc/code alignment, anti-pattern sentry and technical debt, with A-F grading and PASS/WARN/FAIL status. |
39
+ | `muse_why` | **Cognition / "Why" Reasoner** | Traces code evolution backwards through past bug fixes, ADRs, trade-offs and invariants before a refactor. |
40
+ | `muse_bug_clusters` | **Fragility Hotspots** | Clusters recurring bugs into root-cause categories with subsystem fragility scoring. |
41
+ | `muse_tech_debt` | **Technical Debt Registry** | Scans code and memory for TODO/FIXME markers, unsafe `as any` casts and drifted anchors. |
42
+ | `muse_code_impact` | **Blast Radius** | Synthesises code callers, governing ADRs, negative warnings and a risk score for a file. |
43
+ | `muse_pr_context` | **Change Context** | Generates a memory-grounded PR description from a git diff. |
44
+ | `muse_memory_for_code` | **Code-to-Memory** | Queries all memories, ADRs, constraints and bugs associated with a code file and symbol. |
45
+ | `muse_code_for_memory` | **Memory-to-Code** | Resolves all native code anchors and affected source files for a given memory entry. |
46
+ | `muse_reconcile_anchors` | **Anchor Repair** | Prunes dead references and refreshes structural hashes across the store. |
47
+ | `muse_profile_list` | **Tool Management** | Lists the task-focused profiles and the tools each one exposes. |
48
+ | `memory_adr_record` / `memory_adr_list` | **Architecture Decisions** | Records and lists living ADRs with drivers, consequences, options considered and native code anchors. |
49
+ | `memory_drift_audit` | **Drift Detection** | Bi-directional documentation ↔ code drift engine across 6 alignment states. |
50
+ | `memory_negative_capture` | **Negative Sentry** | Records failed approaches, anti-patterns and reproduction commands so they are not repeated. |
51
+ | `memory_promote` | **Scoped Promotion** | Promotes memory along the `local` → `project` → `global` ladder with a 5× repeated-success policy. |
52
+ | `memory_archive` / `memory_rehydrate` | **Archival Lifecycle** | Manages `active` → `cold` → `dormant` → `archived` with query rehydration. |
53
+ | `memory_anchor_create` / `memory_anchor_verify` / `memory_anchor_audit` | **Code Identity** | Creates, verifies and audits line-independent structural code anchors. |
54
+ | `muse_sync_broadcast` / `muse_sync_ingest` | **P2P Gossip Mesh** | Broadcasts and ingests sealed `SyncPacket`s with deduplication and contradiction flagging. |
55
+ | `muse_sync_status` / `muse_sync_pool` | **Sync Coordination** | Tracks peer vector clocks and synchronises memories through the shared drop-directory pool. |
56
+ | `muse_mesh_status` | **Monorepo Topology** | Discovers monorepo workspaces and multi-repo sibling groups. |
57
+ | `muse_mesh_query` | **Cross-Project Query** | Queries memories across the workspace mesh with origin-package provenance tags. |
58
+ | `muse_mesh_audit` | **Contract Verification** | Audits cross-package dependency contracts, entrypoint exports and cross-repo anchors. |
59
+ | `muse_mesh_link` | **Mesh Linking** | Links or unlinks external repository paths in the workspace mesh registry. |
60
+
61
+ ## 🛠️ Core Memory & Lifecycle Tools
62
+
42
63
  | MCP Tool | Execution Phase | Agent Purpose |
43
64
  | :--- | :--- | :--- |
44
- | `get_context` | **Session Start / Init** | Fast token-budgeted prompt context injection: retrieves `USER.md`, active `CURRENT.md` constraints, and top-$K$ scored memories. |
45
- | `memory_capture` | **Learning / Task End** | Capture new durable facts, verified architectural decisions, operational rules, or bug resolutions directly into memory. |
46
- | `memory_propose` | **Speculative Learning** | Propose a candidate memory requiring confirmation before permanent indexing. |
47
- | `memory_confirm` | **Validation Phase** | Promote a `candidate` or `disputed` memory to `confirmed` status. |
48
- | `memory_supersede` | **Refactoring / Updates** | Formally link an obsolete memory to a newer confirmed memory so agents never hallucinate deprecated patterns. |
49
- | `memory_search` | **Targeted Lookups** | Query the SQLite store and YAML mirrors using multi-factor similarity matching and tags. |
50
- | `memory_conflicts` | **Conflict Audit** | Lists conflicting memories detected by the semantic contradiction engine. |
51
- | `memory_resolve_conflict` | **Conflict Resolution**| Resolves contradictions via `supersede`, `historical`, `reject`, or `keep_both`. |
52
- | `memory_roi` | **Utility & ROI** | Computes memory reuse metrics, application success rates, and regression penalties. |
53
- | `memory_search_transcripts` | **Historical Archaeology** | Full-text dialogue search across past JSONL conversation transcripts with conversation bookends. |
54
- | `memory_audit` | **Compliance Check** | Inspect the append-only operational ledger (`.memory/audit.jsonl`). |
55
- | `profile_list` / `switch` | **Tool Management** | Lists and activates task-focused MCP profiles to eliminate agent tool bloat. |
65
+ | `get_context` | **Session Start / Init** | Token-budgeted prompt context injection: `USER.md`, active `CURRENT.md` constraints and top-$K$ scored memories. **Call this on the first turn of every session.** |
66
+ | `muse_context` | **Task Start** | Task-shaped fused context (constraints + ranked memories + negative lessons + code anchors). |
67
+ | `memory_capture` | **Learning / Task End** | Persist a durable fact, decision, rule or fix. Secret-scanned and citation-verified. |
68
+ | `memory_confirm` | **Validation Phase** | Promote a `candidate` or `disputed` memory to `confirmed`. |
69
+ | `memory_supersede` | **Refactoring / Updates** | Link an obsolete memory to a newer confirmed one so deprecated patterns are never served. |
70
+ | `search` | **Targeted Lookups** | Ranked search over the store with a score breakdown and filters. |
71
+ | `memory_recall` | **Targeted Lookups** | Recall active and confirmed memories with verification levels and related graph links. |
72
+ | `memory_current` / `memory_get_constraints` / `memory_set_constraints` | **Constraints** | Read, append and manage the active working constraints in `CURRENT.md`. |
73
+ | `memory_resolve_conflict` | **Conflict Resolution** | Resolves contradictions via `supersede`, `historical`, `reject` or `keep_both`. |
74
+ | `memory_roi` | **Utility & ROI** | Computes reuse metrics, application success rates and regression penalties. |
75
+ | `memory_search_transcripts` | **Historical Archaeology** | Full-text dialogue search across past JSONL transcripts with conversation bookends. |
76
+ | `memory_audit` | **Compliance Check** | Inspects the append-only operational ledger (`.memory/audit.jsonl`). |
77
+ | `memory_verify` / `memory_verify_strict` | **Integrity Gate** | Runs an entry's template-gated verification command, or the full strict integrity gate. |
56
78
 
57
79
  ---
58
80
 
59
81
  ## ⚙️ Task-Focused MCP Profiles
60
82
 
61
- Muse Memory prevents agent context bloat by providing 6 pre-configured tool profiles:
62
-
63
- - **`core`** (Minimal): `get_context`, `memory_search`, `memory_capture`, `memory_current`, `profile_list`, `profile_switch`.
64
- - **`coding`**: Core tools + `muse_context`, `muse_why`, `muse_code_for_memory`, `muse_memory_for_code`, `anchor_*`.
65
- - **`debugging`**: Core tools + `muse_why`, `muse_bug_clusters`, `memory_capture_negative`, `memory_verify`.
66
- - **`review`**: Core tools + `muse_health`, `muse_tech_debt`, `memory_drift_audit`, `anchor_audit`.
67
- - **`architecture`**: Core tools + `muse_context`, `muse_health`, `memory_adr_*`, `memory_drift_audit`, `muse_why`.
68
- - **`maintenance`**: Core tools + `muse_health`, `memory_promote_scope`, `memory_archive`, `memory_archive_sweep`, `memory_lifecycle_stats`.
69
- - **`full`**: Unrestricted exposure of all 61 MCP tools.
83
+ Seven profiles keep the tool surface small. The authoritative mapping is
84
+ `PROFILE_TOOL_DEFINITIONS` in `src/orchestrator/profiles.ts`; call
85
+ `muse_profile_list` for the live list. Select a profile with the
86
+ `MUSE_MCP_PROFILE` environment variable.
87
+
88
+ | Profile | Purpose |
89
+ | :--- | :--- |
90
+ | `core` | Minimal footprint: context injection and rapid capture. |
91
+ | `coding` | Active development, code anchors, contextual fusion. |
92
+ | `debugging` | Bug diagnosis, error resolution, observations, negative lessons. |
93
+ | `review` | Code review, architectural audit, conflict verification. |
94
+ | `architecture` | System design, promotions, entity wiki, tree indexing, mesh. |
95
+ | `maintenance` | Repository health, deduplication, archival lifecycle, mesh. |
96
+ | `full` | The complete registry — every registered tool. |
70
97
 
71
98
  ---
72
99
 
73
100
  ## 💻 CLI Command Surface
74
101
 
102
+ Only the commands an agent actually calls. The full matrix — every command,
103
+ every flag, generated from `src/cli.ts` — is in
104
+ [`docs/cli-reference.md`](../../docs/cli-reference.md).
105
+
75
106
  ```bash
76
- # Health & Observability (5-Pillar Quality Gate)
77
- memory health [--json] [--global]
78
-
79
- # Retrieval & Context
80
- memory context [--query "..."] [--budget 2000] [--tier 0|1|2]
81
- memory search "<query>" [--tags arch,auth]
82
- memory recall "<id>"
83
-
84
- # Knowledge Lifecycle
85
- memory capture --title "..." --type architecture --content "..."
86
- memory propose --title "..." --content "..."
87
- memory confirm <id>
88
- memory supersede <old-id> <new-id>
89
- memory stale <id>
90
- memory audit [--limit 20]
91
-
92
- # Personas & Constraints
93
- memory persona [developer|designer|marketer|casual]
94
- memory current --add "Must use Bun v1.2"
95
-
96
- # Diagnostics, Server & Optimization
97
- memory optimize [--dry-run] [--force] [--project core]
98
- memory doctor
99
- memory validate --dry-run
100
- memory mcp [--profile coding|review|architecture|core|full]
107
+ # Session start
108
+ memory context [query] --token-budget 2000 # fused context for the prompt
109
+ memory search "<query>" --limit 10 # ranked search with score breakdown
110
+
111
+ # Capture and lifecycle
112
+ memory capture "<text>" --project <name> # persist a memory
113
+ memory confirm <id> # candidate -> confirmed
114
+ memory supersede <old_id> --with <new_id> # replace, keeping lineage
115
+ memory current get # read active constraints
116
+ memory current set "<text>" --project <name> # append a constraint
117
+ memory link <id> --related <id1,id2> # bidirectional relation
118
+
119
+ # Governance
120
+ memory audit [--operation OP] [--limit N] # query the audit ledger
121
+ memory validate [--dry-run] # schema + referential integrity
122
+ memory verify <id> --strict # integrity gate
123
+ memory doctor # ecosystem health diagnostic
124
+ memory health [--json] # 5-pillar health gate
101
125
  ```
126
+
127
+ ### Commands that do **not** exist
128
+
129
+ These appear in older notes and are wrong — calling them fails:
130
+
131
+ | Wrong | Correct |
132
+ | :--- | :--- |
133
+ | `memory persona <archetype>` | `memory user init <archetype>` |
134
+ | `memory current --add "..."` | `memory current set "..."` |
135
+ | `memory recall "<id>"` | `memory recall "<query>"` — ID lookup is `memory checkout <id>` |
136
+ | `memory stale <id>` | `memory stale [--days N]` — it **lists** stale entries |
137
+ | `memory mcp --profile coding` | Set `MUSE_MCP_PROFILE=coding` in the environment |
138
+ | `memory health --global` | `memory health --json` only — no `--global` flag |
139
+
140
+ ---
141
+
142
+ ## 🔒 Trust Gates (behaviour an agent must assume)
143
+
144
+ | Gate | When | Behaviour |
145
+ | :--- | :--- | :--- |
146
+ | Secret scan (Vibeguard) | every write | The write is **refused**; the rule name is reported, never the value. |
147
+ | Citation verification | every write with an anchor | **Refused** under the default `fail_fast` policy when the cited file/symbol does not exist; drift is flagged and stamped. |
148
+ | Freshness gate | every recall | Memories whose anchors drifted are **withheld** and reported (`withheld_memories` + `freshness_notice`), never silently served. `include_drifted: true` returns them with a `⚠ FRESHNESS` warning. |
149
+ | Ingest sanitisation | import / harvest | Injected `<memory-context>` blocks and base64 payloads are stripped before the text is stored — including into `CURRENT.md`. |
150
+ | Template-gated execution | `memory verify` | Only `bun test <relative test file>`, `bunx tsc --noEmit` and `node --check <relative path>` may run. There is no shell-execution tool. |
151
+
152
+ ---
153
+
154
+ ## 📁 Storage Layout
155
+
156
+ | Path | Scope | Contents |
157
+ | :--- | :--- | :--- |
158
+ | `.memory/memory.db` | project | SQLite (WAL + FTS5): memories, anchors, graph edges, FTS index. |
159
+ | `.memory/memories/*.yaml` | project | One human-readable YAML file per memory — the secondary mirror. |
160
+ | `.memory/CURRENT.md` | project | Active working constraints and session handoffs. |
161
+ | `.memory/USER.md` | project | Persona and working preferences. |
162
+ | `.memory/observations.jsonl` | project | Append-only event log the harvester mines. |
163
+ | `.memory/audit.jsonl` | project | Tamper-evident write ledger. |
164
+ | `.memory/sync_pool/` | project | Zero-daemon shared gossip pool. |
165
+ | `~/.memory/` | global | The same layout; project scope wins on conflict. |
166
+
167
+ Everything is a plain file. There is no server, no port and no service to keep alive.