musememory 3.0.0 → 3.0.2

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.
@@ -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.
@@ -1,50 +1,132 @@
1
1
  # 🚀 Astro Frontend Engineering Standards
2
2
 
3
- > **Runtime Target**: Astro v7.2.x · Bun / Node pinned runtime · TypeScript Strict · `@astrojs/cloudflare`
3
+ > **Runtime Target**: Astro v7.3.x · Bun / Node runtime · TypeScript Strict
4
+ > **Applies to**: `apps/website/` — the Muse Memory marketing and documentation site.
4
5
 
5
6
  ---
6
7
 
7
- ## 1. Architectural Conventions
8
+ ## 1. Project Shape (verified against this repo)
8
9
 
9
- ### Static-First & Island Hydration
10
- - **Static by Default**: All `.astro` components render to static HTML at build time or server edge.
11
- - **Selective Hydration**: Hydrate client islands with `client:*` directives ONLY when user interaction requires it:
12
- - `client:load` — Critical above-the-fold interactive components (e.g., global navigation toggle, hero configurator).
13
- - `client:idle` — Lower-priority interactive widgets (e.g., search modal, newsletter popup).
14
- - `client:visible` — Below-the-fold components (e.g., heavy testimonials carousel, interactive calculator).
15
- - `client:media` — Components conditional on media queries.
10
+ | Fact | Value | Source of truth |
11
+ | :--- | :--- | :--- |
12
+ | Framework | Astro `^7.3.5` | `apps/website/package.json` |
13
+ | Output | `static` (no SSR adapter) | `apps/website/astro.config.mjs` |
14
+ | Base path | `/musememory` (GitHub Pages) | `apps/website/astro.config.mjs` |
15
+ | Site origin | `https://harshsinghmp.github.io` | `apps/website/astro.config.mjs` |
16
+ | Styling | Plain CSS with design tokens (no Tailwind, no UnoCSS) | `apps/website/src/styles/global.css` |
17
+ | Motion | CSS keyframes + one inlined `IntersectionObserver` script | `apps/website/src/scripts/motion.ts` |
18
+ | Tests | `bun test` (axe-core + Playwright audits) | `apps/website/scripts/audit-*.ts` |
16
19
 
17
- ### Content Collections & Validation
18
- - Content collections live strictly in `src/content/`.
19
- - Every collection must define a strict **Zod schema** in `src/content/config.ts`.
20
- - Validate all incoming parameters, frontmatter, and external data at the collection boundary.
20
+ > The generic Astro standard assumes `@astrojs/cloudflare`, Tailwind v4 and
21
+ > Motion.dev. **This project does not use them.** Do not introduce an SSR
22
+ > adapter, a utility CSS framework, or a JS animation runtime to solve a
23
+ > problem the current stack already solves.
21
24
 
22
25
  ---
23
26
 
24
- ## 2. Styling & Motion Standards
27
+ ## 2. Architectural Conventions
25
28
 
26
- - **Styling**: UnoCSS v66.x or Tailwind CSS v4 utility classes inline. Extract to a dedicated component or BEM class when a utility pattern is repeated 3+ times.
27
- - **Design Tokens**: Consume design tokens from `./.agents/brand/tokens/` or CSS variables. Never introduce arbitrary raw hex codes or ad-hoc pixel values.
28
- - **Animations**: Use **Motion.dev** (Framer Motion v12+). All animations must respect `@media (prefers-reduced-motion: reduce)`.
29
+ ### Static by default
30
+ Every page renders to static HTML at build time. There is no client framework
31
+ and no hydration directive (`client:load` and friends are not used — the site
32
+ ships zero framework JS). Interactive behaviour is progressive enhancement:
33
+ the navigation menu is a `<details>` element, the FAQ is `<details>`, the
34
+ reveal animation is CSS plus one observer.
35
+
36
+ ### The base path is not optional
37
+ The site is served from `/musememory/`. **Every** internal URL must be built
38
+ from `import.meta.env.BASE_URL` or it will resolve on the domain root and
39
+ 404. A root-absolute `/favicon.svg` is a bug, not a style choice.
40
+
41
+ ```astro
42
+ <a href={`${import.meta.env.BASE_URL}/docs`}>Docs</a>
43
+ ```
44
+
45
+ ### Shared components, not copied markup
46
+ Navigation, footer and the logo live in `src/components/`. They were
47
+ copy-pasted per page and had already drifted (the 404 page had no nav at
48
+ all). If a page needs a nav variant, add a prop — do not fork the component.
49
+
50
+ ### The published numbers are generated
51
+ `claims.json` (repository root) holds every countable claim, generated from
52
+ `src/` by `scripts/generate-claims.ts`. The site imports it:
53
+
54
+ ```astro
55
+ import claims from "../../../../claims.json";
56
+ ```
57
+
58
+ Never hand-type a count, a tool total or a test count into a page. A test
59
+ (`test/marketing_claims.test.ts`) fails the build if the prose and the code
60
+ disagree.
61
+
62
+ ### Content collections
63
+ `src/content/` does not exist in this project. If it is ever introduced, every
64
+ collection must define a strict schema and validate at the collection
65
+ boundary.
29
66
 
30
67
  ---
31
68
 
32
- ## 3. Testing & Code Quality
69
+ ## 3. Styling & Motion Standards
33
70
 
34
- - **Testing**: Vitest for unit and component tests; Playwright for end-to-end user journeys. Tests live adjacent to source files (`*.test.ts`).
35
- - **No Network in Tests**: Never run unit tests that make real outbound network requests. Mock at the `fetch` boundary.
36
- - **Type Strictness**: No `any` or forced casts (`as unknown as Type`). Fix the root interface.
37
- - **Clean Logging**: Never commit `console.log`. Use structured logging or logger utilities.
71
+ - **Tokens only**: consume the CSS custom properties in `global.css` or the
72
+ JSON in `./.agents/brand/tokens/`. Never introduce an arbitrary hex code.
73
+ - **Text colour is restricted**: only `--text`, `--text-dim` and `--text-faint`
74
+ may carry text. The depth palette (`--plasma`, `--indigo`, `--edge-*`) is
75
+ decorative and has no contrast obligation. Every text token is audited
76
+ against WCAG 2.2 AA by `scripts/audit-a11y.ts`.
77
+ - **Class naming**: BEM per `./.agents/brand/bem-conventions.md`.
78
+ - **Animations** must respect `@media (prefers-reduced-motion: reduce)`.
79
+ - **The reveal contract**: an element that is on screen must be visible. The
80
+ `IntersectionObserver` uses `threshold: 0` and `rootMargin: "0px"` so the
81
+ trigger boundary is exactly the viewport. A ratio threshold silently
82
+ strands any `.reveal` taller than the viewport.
83
+ - **`transform` is owned by one rule**: `.reveal` and `.tilt` both write
84
+ `transform`, so they must be composed in a single declaration. Never split
85
+ them across two selectors.
38
86
 
39
87
  ---
40
88
 
41
- ## 4. Standard Commands
89
+ ## 4. Testing & Code Quality
42
90
 
91
+ - **Accessibility gate**: `bun run --cwd apps/website scripts/audit-a11y.ts`
92
+ — axe-core on every page (zero critical/serious) plus a computed-contrast
93
+ check of every token pair.
94
+ - **Visual gate**: `bun run --cwd apps/website scripts/audit-visual.ts` —
95
+ 375 / 768 / 1280 viewports on every page: horizontal overflow, console
96
+ errors, the reveal runtime, and the nav CTA.
97
+ - **No network in tests**: mock at the `fetch` boundary.
98
+ - **Type strictness**: no `any` and no `as unknown as T`. Fix the interface.
99
+ - **No `console.log`** in committed code.
100
+
101
+ ### Assets are generated, never hand-edited
43
102
  ```bash
44
- bun install # Install dependencies
45
- bun dev # Local dev server
46
- bun build # Production build (@astrojs/cloudflare)
47
- bun test # Run Vitest suite
48
- bun lint --fix # Run linter with autofix
49
- bun typecheck # Run tsc --noEmit
103
+ bun run --cwd apps/website brand # favicon, OG card, twitter card, banner
104
+ bun run --cwd apps/website build # astro build + llms.txt / llms-full.txt
105
+ ```
106
+ Brand PNGs are rasterised from SVG with resvg using the fonts already vendored
107
+ in `showreel-hf/assets/fonts`, so the output is deterministic and needs no
108
+ browser download. `llms.txt` and `llms-full.txt` are generated from the built
109
+ HTML, so the agent-readable layer cannot drift from the site.
110
+
111
+ ---
112
+
113
+ ## 5. Standard Commands
114
+
115
+ ```bash
116
+ # From the repository root
117
+ bun run site:dev # astro dev
118
+ bun run site:build # astro build + llms.txt / llms-full.txt
119
+ bun run site:preview # preview the built site
120
+
121
+ # From apps/website
122
+ bun run dev # astro dev
123
+ bun run build # astro build && build-llms-txt.ts
124
+ bun run brand # regenerate brand assets
125
+ bun run llms # regenerate the agent-readable text layer
126
+
127
+ # Quality gates
128
+ bun run --cwd apps/website scripts/audit-a11y.ts
129
+ bun run --cwd apps/website scripts/audit-visual.ts
130
+ bun test # the whole repository suite
131
+ bunx tsc --noEmit # type check
50
132
  ```