musememory 3.0.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.
@@ -16,19 +16,19 @@ While the test suite demonstrates clean execution (649/649 green) and 21 major a
16
16
  ### 🚨 Critical Vulnerabilities & Code Gaps Discovered
17
17
 
18
18
  1. **Silent SQLite Initialization Crash & Fallback to Flat-Files (GAP-01)**:
19
- - **Location**: [`src/sqlite.ts:169-171`](file:///home/harsh/Projects/github/musememory/src/sqlite.ts#L169-L171) & [`src/store.ts:173-177`](file:///home/harsh/Projects/github/musememory/src/store.ts#L173-L177)
19
+ - **Location**: [`src/sqlite.ts:169-171`](../../src/sqlite.ts#L169-L171) & [`src/store.ts:173-177`](../../src/store.ts#L173-L177)
20
20
  - **Defect**: `initSchema` attempts `CREATE INDEX IF NOT EXISTS idx_memories_mem_path ON memories(mem_path)` unconditionally on existing tables. On stores created prior to v1, `memories` lacks `mem_path`. SQLite throws `SQLiteError: no such column: mem_path`.
21
21
  - **Impact**: `openStore` catches this error, swallows it, leaves `store.db` as `undefined`, and silently degrades to flat-file storage. Crucially, `runMigrations` in `src/migrate.ts` never executes for these stores.
22
22
  - **Remediation**: Guard index creation by inspecting existing columns via `PRAGMA table_info(memories)` or delegate index creation to `src/migrate.ts` migration `v1`.
23
23
 
24
24
  2. **Stored-Command Validation Failure on Legacy Memories (GAP-02)**:
25
- - **Location**: [`.memory/memories/m_1791995990650_...yaml`](file:///home/harsh/Projects/github/musememory/.memory/memories/m_1791995990650_avoidneverre-invokebinsh-cformemorytest_commandexecutionb4.yaml#L36) & [`src/schema.ts`](file:///home/harsh/Projects/github/musememory/src/schema.ts)
25
+ - **Location**: `.memory/memories/m_1791995990650_avoidneverre-invokebinsh-cformemorytest_commandexecutionb4.yaml` (a local store file, not in the repository) & [`src/schema.ts`](../../src/schema.ts)
26
26
  - **Defect**: Pre-`T-001` memory entries contain legacy `test_command` values (e.g. `grep -n 'bin/sh' src/verify.ts`). Following `T-001`'s template gating, `memory validate` and `memory doctor` exit with code 1 (`/test_command is not an executable command`).
27
27
  - **Impact**: Breaks automated health checks and CLI compliance.
28
28
  - **Remediation**: Add a stored-command doctor sweep/migration to sanitize non-template test commands.
29
29
 
30
30
  3. **Terminal Hang on Interactive Stdin in Test Suite & Hooks (GAP-03)**:
31
- - **Location**: [`src/hooks/pack.ts:220-227`](file:///home/harsh/Projects/github/musememory/src/hooks/pack.ts#L220-L227)
31
+ - **Location**: [`src/hooks/pack.ts:220-227`](../../src/hooks/pack.ts#L220-L227)
32
32
  - **Defect**: `readStdinJson()` synchronously calls `readFileSync(0, "utf8")` without verifying whether stdin is a TTY.
33
33
  - **Impact**: When running in an interactive terminal or non-piped runner, `test/hooks.test.ts` blocks indefinitely waiting for EOF on fd 0.
34
34
  - **Remediation**: Guard with `if (process.stdin.isTTY) return {};` before attempting synchronous reads on fd 0.
@@ -1,12 +1,68 @@
1
1
  # 📍 Current Shipped State & Active Invariants
2
2
 
3
- > **Version**: `v3.0.0`
4
- > **Status**: Major Release (Failure Attribution, Negative Memory Mining, HOT.md Working Set Compounding & LangMem Logarithmic Frequency Ranking)
3
+ > **Version**: `v3.0.1`
4
+ > **Status**: Patch Release — correctness fixes from the cross-file invariant audit, machine-verified published claims, and the website redesign.
5
+
6
+ ---
7
+
8
+ ## 🔬 Latest Session — Audit, Documentation & Website Redesign (2026-10-21)
9
+
10
+ A cross-file invariant audit, a documentation audit, and a full website
11
+ redesign landed together. Everything below is verified by the test suite.
12
+
13
+ ### Code fixes (all regression-tested)
14
+
15
+ - **Prompt-injection bypass closed (BLOCKER)**: `setCurrent()` in `src/governor.ts` now sanitises injected context blocks before writing `CURRENT.md`, and the session-handoff discovery line in `src/mcp.ts` is sanitised too. Previously only the *stored memory* was sanitised (by `propose()`), so a `memory_capture(type="constraint")` could persist an injection that was replayed into every later prompt. Fixes T-110's stated scope. Cover: `test/audit_blocker_regressions.test.ts`.
16
+ - **Store could fail its own schema (BLOCKER)**: `schema.json` had `additionalProperties: false` but omitted `stale_embedder`, a flag the embedder writes onto entries. Every entry that failed embedding was reported corrupt by `memory validate`, `memory doctor` and `memory verify --strict`.
17
+ - **Bi-temporal queries served the wrong snapshot (BLOCKER)**: the L1 context cache key omitted `as_of` (and the include/type/tag flags), so a "what did we believe in Q1?" query could be answered from a 30-second-old current-state cache entry.
18
+ - **Tiered context dropped `as_of` (BLOCKER)**: `get_context(tier=1, as_of=...)` returned the current state while the untiered path returned the historical one. Both branches now forward `as_of` and `depth`.
19
+ - **Access counter never accumulated (BLOCKER)**: `readEntry()` re-inserted the YAML mirror over the SQLite row, resetting `access_count` to its baseline on every read. The counter fed the access-frequency ranking axis, the LangMem frequency axis and the retention half-life — all were permanently starved. The database row is now authoritative for the counter.
20
+ - **Tier token budget was declared but never enforced**: `resolveTierBudget()` was exported and documented but never called, so Tier 0 emitted 327 tokens against a 200-token budget. The budget now bounds the rendered output and reports what it dropped.
21
+ - **MCP server advertised version `1.6.0`** while the package was at `3.0.0`. The version now comes from `package.json` (`src/version.ts`).
22
+ - **Undiscoverable tools**: `memory_recall`, `memory_get_constraints` and `memory_set_constraints` were callable but absent from `ListTools`. All three are now registered.
23
+ - **Undeclared destructive flags**: `memory_delete` honoured undocumented `apply`/`force` aliases that silently disabled the dry-run default. Only the declared `dry_run` and `confirm` can now disable it.
24
+ - **Snapshot restore had no path containment**: `restoreSnapshotRing()` now resolves strictly inside `.memory/snapshots/`.
25
+ - **`"checkpoint" as any`**: the audit operation is now a declared member of the `AuditOperation` union.
26
+ - **Corroboration predicate de-duplicated**: the 13-line "is this source synthetic" predicate existed in two files. The predicate is now shared (`src/quality/corroboration.ts`); the two *bars* it feeds stay deliberately different and are documented as such.
27
+ - **Title/tag limits declared but not used**: `MAX_TITLE_LENGTH` and `MAX_TAGS` existed while the enforced values were magic numbers. The store and harvester now use the constants, and the draft-title limit is declared as `MAX_DRAFT_TITLE_LENGTH`.
28
+
29
+ ### Published-claim integrity (new)
30
+
31
+ `scripts/generate-claims.ts` derives every countable claim from `src/` and
32
+ writes `claims.json`; `scripts/generate-cli-reference.ts` writes
33
+ `docs/cli-reference.md` and `docs/mcp-tool-matrix.json`. The website imports
34
+ `claims.json` instead of hard-coding figures.
35
+
36
+ This exists because the site advertised **80+ coding agents** (real: 52),
37
+ **45+ credential shapes** (real: 8 rule families) and **69 tools across 6
38
+ profiles** (real: 115 across 7), while the README was already honest at 52.
39
+ `test/marketing_claims.test.ts` now fails the build on any drift, on any
40
+ stale figure in the published prose, and on any agent-facing document that
41
+ names a tool which does not exist.
42
+
43
+ ### Documentation
44
+
45
+ - `docs/agent-reference.md` — new: the agent contract (install, layout, mandatory session protocol, trust gates, failure semantics).
46
+ - `docs/cli-reference.md` — new: generated CLI + MCP reference.
47
+ - `docs/roadmap.md` — new: the sprint board, moved out of the README.
48
+ - `README.md` — restructured: 60-second start, "How it works", "Where your memory lives", a documentation map that separates human docs from agent docs, and a 54KB → 39KB reduction.
49
+ - `.agents/context/product.md` — rewritten against the live registry; it previously named six tools that do not exist.
50
+ - `.agents/standards/frontend-astro.md` — rewritten to match this repo's actual stack (static output, plain CSS, no SSR adapter, no Tailwind, no Motion.dev).
51
+
52
+ ### Website
53
+
54
+ - Redesigned `apps/website`: shared `Nav`/`Footer`/`Logo` components (the 404 page previously had no navigation at all), a real mobile menu (the nav links were hidden below 860px with no replacement), full SEO head (canonical, OG, Twitter, icons, manifest, skip link), a new "Your memory is a folder" section, and a capability grid that replaces eight long editorial bands.
55
+ - New brand system: a redesigned monogram (the previous mark read as a zigzag, not an "M"), favicon, Apple touch icon, PWA icons, OG card, Twitter card, README banner — all generated deterministically with resvg from the fonts already vendored in the repo.
56
+ - New agent-readable layer: `llms.txt` and `llms-full.txt`, generated from the built HTML.
57
+ - Fixed two real defects the audits caught: a `scrollable-region-focusable` axe failure on `/docs`, and a reveal runtime that stranded any `.reveal` taller than the viewport (the observer used a ratio threshold).
5
58
 
6
59
  ---
7
60
 
8
61
  ## ⏭️ Next Up (Post-Wave 22 Focus)
62
+ - **Production-Grade Showcase Demo**: Re-record high-fidelity terminal demo video/GIF reflecting v3.0.0 capabilities (failure attribution, HOT.md compounding, memory branch/checkout, MCP context recall) to replace removed legacy demo.
9
63
  - **Wave 23**: Review next backlog items from `.agents/context/ticket-plan.md` (e.g. Hebbian co-activation retrieval expansion, query-seeded PPR restart set, retrieval weight auto-tuner, and contradiction engine calibration).
64
+ - **Consolidate the remaining duplicated tables** (deferred from this session as behaviour-changing; full detail with exact locations in [`docs/roadmap.md`](../../docs/roadmap.md) → *Engineering debt*): the three divergent per-type TTL tables in `src/retention.ts`, the eight separate token estimators, the divergent limit-clamping ceilings across retrieval paths, and the remaining zero-caller exports.
65
+ - **Remove the legacy `web/` directory** — done in this session. It was a second, hand-written copy of the site that `apps/website/` superseded; keeping it was the same "second copy that gets forgotten" failure mode this session fixed everywhere else.
10
66
 
11
67
  ---
12
68
 
@@ -4,7 +4,7 @@
4
4
  **Depth**: Deep (Local scan, ecosystem signals, frontier literature, competitive analysis, architectural specification)
5
5
  **Date**: 2026-09-06
6
6
  **Operating Identity**: Muse (Chief Agency Orchestrator)
7
- **Primary Repository**: [`musememory`](file:///home/harsh/Projects/github/musememory)
7
+ **Primary Repository**: [`musememory`](../../)
8
8
 
9
9
  ---
10
10
 
@@ -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,14 +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 |
17
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 |
18
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 |
19
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 |
20
- | [`deep-research-memory-improvement-2026-10.md`](./deep-research-memory-improvement-2026-10.md) | Deep research brief: 9 new memory systems (Memoir, ai-memory, GAM, Engram, etc.), updated gap scorecard (4 new versioned-memory gaps), scored adaptation shortlist (A15–A22), and R23–R26 production-readiness roadmap | Designing R23–R26 milestones, versioned memory features, and monetization positioning |
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 |
21
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.
@@ -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.
@@ -15,6 +15,14 @@
15
15
 
16
16
  ## 🚀 Active Roadmap & Future Horizons (Agentic Cognitive OS Evolution)
17
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
+
18
26
  ### 1. **R17: Tri-Cognitive Memory Architecture (Procedural Playbooks & Episodic Horizons)**
19
27
  - **Procedural Playbook Engine (`ProceduralMemory`)**:
20
28
  - Capture executable tool-calling workflows, pre-conditions, step trajectories, verification assertions, and rollback recipes distilled from successful agent sessions.
@@ -3,7 +3,7 @@
3
3
  **Depth**: deep
4
4
  **Date**: 2026-08-22
5
5
  **Target Repository**: `harshsinghmp/musememory`
6
- **Primary Deliverable**: Interactive Dashboard at [`musemeory-comparison.html`](file:///home/harsh/Projects/musememory/musemeory-comparison.html) & Autonomous First-Install Migrator
6
+ **Primary Deliverable**: Interactive Dashboard at [`docs/research/musememory-comparison.html`](../../docs/research/musememory-comparison.html) & Autonomous First-Install Migrator
7
7
 
8
8
  ---
9
9
 
@@ -0,0 +1,42 @@
1
+ # 📚 Standards Index
2
+
3
+ > **Reading order**: the root [`AGENTS.md`](../../AGENTS.md) is the router. It
4
+ > links the standards that apply to this repository. Everything else in this
5
+ > folder is retained but **not routed** — see "Unrouted standards" below.
6
+ >
7
+ > Load a standard on demand, not up front. Each one states what it governs and
8
+ > when to open it.
9
+
10
+ ## Routored from `AGENTS.md`
11
+
12
+ | Standard | Governs |
13
+ | :--- | :--- |
14
+ | [`execution-kernel.md`](./execution-kernel.md) | Judgment laws, refactoring discipline, code-complete standards, byte-capping. |
15
+ | [`security-vibeguard.md`](./security-vibeguard.md) | Secret isolation, the Destructive Command Gate, untrusted tool output. |
16
+ | [`system-design.md`](./system-design.md) | Domain modelling, resilience, migration rehearsal, schemas. |
17
+ | [`workflows.md`](./workflows.md) | Scaled tiers, the 5-phase pipeline, PR-per-feature and the post-merge sequence. |
18
+ | [`git-workflow.md`](./git-workflow.md) | Branch lifecycle, commit standards, SemVer. |
19
+ | [`dox-hierarchy.md`](./dox-hierarchy.md) | Reading order, child document shape, the closeout checklist, the pruning loop. |
20
+ | [`council-roles.md`](./council-roles.md) | Muse / Sol / Jasper / Crew / Nexus responsibilities and subagent dispatch policy. |
21
+ | [`memory-context.md`](./memory-context.md) | Context hygiene, the `.memory` store lifecycle, durable proposals. |
22
+ | [`frontend-astro.md`](./frontend-astro.md) | The `apps/website` stack: the `/musememory` base-path rule, generated assets, the a11y and visual gates. |
23
+
24
+ The brand and accessibility standards live in [`../brand/`](../brand/) and are
25
+ routed from the same place: `design.md`, `bem-conventions.md`, `a11y.md` and
26
+ `screenshots/README.md`.
27
+
28
+ ## Unrouted standards (retained, not applicable)
29
+
30
+ These files are kept for the day the stack changes. They are **not** linked
31
+ from `AGENTS.md` because following them today would lead an agent to build
32
+ something this repository does not have.
33
+
34
+ | Standard | Why it is not routed |
35
+ | :--- | :--- |
36
+ | [`frontend-nextjs.md`](./frontend-nextjs.md) | The site is Astro with static output. There is no Next.js, no React Server Components, and no SSR adapter in this repository. |
37
+ | [`backend-workers-hono.md`](./backend-workers-hono.md) | Hono is not a dependency. The engine is a Bun/TypeScript CLI and an MCP stdio server; there is no HTTP worker tier. |
38
+ | [`tech-stacks.md`](./tech-stacks.md) | A general catalogue of stacks rather than a standard. Useful when choosing a new dependency, not when implementing in this one. |
39
+
40
+ If a future change adopts one of these stacks, re-link the file from
41
+ `AGENTS.md` **and** rewrite it against the real codebase before it is used —
42
+ most generic standards assume a different layout than this repository has.