fastrmemory 0.3.0 → 0.4.0

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 (67) hide show
  1. package/.claude-plugin/marketplace.json +14 -14
  2. package/.claude-plugin/plugin.json +18 -18
  3. package/.cursor/mcp.json +3 -1
  4. package/.cursor/skills/fastr-compress/SKILL.md +33 -33
  5. package/.cursor/skills/fastr-curate/SKILL.md +62 -62
  6. package/.cursor/skills/fastr-dag/SKILL.md +47 -47
  7. package/.cursor/skills/fastr-doctor/SKILL.md +39 -39
  8. package/.cursor/skills/fastr-memory/SKILL.md +51 -51
  9. package/.cursor/skills/fastr-plan-estimate/SKILL.md +45 -45
  10. package/.cursor/skills/fastr-session-commit/SKILL.md +49 -49
  11. package/.cursor/skills/fastr-setup/SKILL.md +45 -45
  12. package/.cursor/skills/fastr-trap-log/SKILL.md +39 -39
  13. package/.cursor/skills/fastr-vision/SKILL.md +35 -35
  14. package/.cursor/skills/skills.json +65 -65
  15. package/README.md +642 -729
  16. package/bin/fastr-guard.mjs +61 -0
  17. package/dist/bin/fastr.js +68 -10
  18. package/dist/bin/fastr.js.map +1 -1
  19. package/dist/src/bench/benchmark.js +13 -13
  20. package/dist/src/bench/harness.js +17 -17
  21. package/dist/src/bench/public-harness.js +5 -5
  22. package/dist/src/branch/manager.js +31 -31
  23. package/dist/src/ci/guardian.js +9 -9
  24. package/dist/src/db/doctor.js +25 -25
  25. package/dist/src/db/hygiene.js +23 -23
  26. package/dist/src/db/repository.js +283 -283
  27. package/dist/src/db/schema.js +268 -268
  28. package/dist/src/db/spool.js +4 -4
  29. package/dist/src/export/obsidian.js +15 -15
  30. package/dist/src/import/local.js +4 -4
  31. package/dist/src/installer/mcp-init.d.ts +65 -0
  32. package/dist/src/installer/mcp-init.d.ts.map +1 -0
  33. package/dist/src/installer/mcp-init.js +293 -0
  34. package/dist/src/installer/mcp-init.js.map +1 -0
  35. package/dist/src/installer/setup.d.ts +2 -0
  36. package/dist/src/installer/setup.d.ts.map +1 -1
  37. package/dist/src/installer/setup.js +24 -18
  38. package/dist/src/installer/setup.js.map +1 -1
  39. package/dist/src/mcp/server.js +25 -25
  40. package/dist/src/mirror/markdown-pages.js +22 -22
  41. package/dist/src/search/backfill.js +6 -6
  42. package/dist/src/search/hybrid-rrf.js +60 -60
  43. package/dist/src/ui/server.js +1259 -1259
  44. package/dist/src/vision/assets.js +6 -6
  45. package/dist-ui/assets/ActionsPage-B3quzFNF.js +11 -11
  46. package/dist-ui/assets/GraphPage-DetiATmC.js +1 -1
  47. package/dist-ui/assets/ObservatoryPage-QIGMwENf.js +16 -16
  48. package/dist-ui/assets/TreemapPage-C7uLZd37.js +2 -2
  49. package/dist-ui/assets/index-BJnPINTu.css +1 -1
  50. package/dist-ui/assets/index-DWAH--Fu.js +329 -329
  51. package/dist-ui/assets/maximize-2-BebkGbZA.js +6 -6
  52. package/dist-ui/build-manifest.json +95 -95
  53. package/dist-ui/index.html +26 -26
  54. package/llms-install.md +77 -69
  55. package/package.json +108 -107
  56. package/server.json +28 -28
  57. package/skills/fastr-compress/SKILL.md +33 -33
  58. package/skills/fastr-curate/SKILL.md +62 -62
  59. package/skills/fastr-dag/SKILL.md +47 -47
  60. package/skills/fastr-doctor/SKILL.md +39 -39
  61. package/skills/fastr-memory/SKILL.md +51 -51
  62. package/skills/fastr-plan-estimate/SKILL.md +45 -45
  63. package/skills/fastr-session-commit/SKILL.md +49 -49
  64. package/skills/fastr-setup/SKILL.md +45 -45
  65. package/skills/fastr-trap-log/SKILL.md +39 -39
  66. package/skills/fastr-vision/SKILL.md +35 -35
  67. package/skills/skills.json +65 -65
package/README.md CHANGED
@@ -1,729 +1,642 @@
1
- <div align="center">
2
-
3
- # ⚡ FastrMemory
4
-
5
- ### High-Performance Cognitive Agent Memory Engine
6
- **Zero Daemon • Native Node 22+ `node:sqlite` • Bi-Temporal Git Sync • Triple-Stream RRF • Official MCP v2**
7
-
8
- [![CI](https://github.com/atifjubaer/fastrmemory/actions/workflows/ci.yml/badge.svg)](https://github.com/atifjubaer/fastrmemory/actions)
9
- [![npm](https://img.shields.io/npm/v/@atifjubaer/fastrmemory?style=flat-square&logo=npm&label=npm)](https://www.npmjs.com/package/@atifjubaer/fastrmemory)
10
- [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg?style=flat-square)](LICENSE)
11
- [![Node](https://img.shields.io/badge/Node-%3E%3D22.16.0-339933?style=flat-square&logo=node.js&logoColor=white)](https://nodejs.org)
12
- [![Protocol](https://img.shields.io/badge/Protocol-MCP%20v2-7C3AED?style=flat-square)](https://modelcontextprotocol.io)
13
- [![Tests](https://img.shields.io/badge/Tests-276%20Passed-brightgreen?style=flat-square)](tests/)
14
- [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](CONTRIBUTING.md)
15
- [![Architecture](https://img.shields.io/badge/Architecture-Zero--Daemon%20WAL-orange?style=flat-square)](#-architecture)
16
-
17
- > **Status (2026-10-23):** The published release is `@atifjubaer/fastrmemory@0.2.1`; `npm view @atifjubaer/fastrmemory version` returns `0.2.1`. The unreleased **0.3.0** branch renames the canonical package to unscoped **`fastrmemory`** and pins generated MCP/hook configs to `fastrmemory@0.3.0`; do not publish from this branch until the release gate passes. The latest GitHub release is **v0.2.1**. This README tracks **0.3.0**, so features marked **0.3.0** are not in the v0.2.1 package. Install `@0.2.1` for the current release; use the **v0.2.1 GitHub Release tarball** as a byte-verified fallback. The exact release surface is in [CHANGELOG.md](CHANGELOG.md); the release post is [docs/blog/2026-10-21-fastrmemory-0.2.1.md](docs/blog/2026-10-21-fastrmemory-0.2.1.md). The headline benchmark uses **240 deterministic synthetic cases with a 20% holdout**, not SWE-bench or LongMemEval. Public LongMemEval, LoCoMo, and self-repository retrieval-only results plus pinned external baselines are in [BENCHMARKS.md](BENCHMARKS.md); no QA-leaderboard parity is claimed. Performance, packaging, and retrieval claims are tracked in [CLAIMS.md](CLAIMS.md); every README section is mapped to claim IDs in the README claim trace at the end of that ledger. Methodology, caveats, and raw JSON are in [BENCHMARKS.md](BENCHMARKS.md).
18
-
19
- <p align="center">
20
- <a href="#-overview">Overview</a> &bull;
21
- <a href="#-design-principles">Design Principles</a> &bull;
22
- <a href="#-retrieval-benchmark-240-synthetic-cases">Benchmarks</a> &bull;
23
- <a href="#-local-web-dashboard">Web UI</a> &bull;
24
- <a href="#-works-with-mcp--and-http-compatible-agents">Supported Agents</a> &bull;
25
- <a href="#-quick-start">Quick Start</a> &bull;
26
- <a href="#-mcp-server-tools--resources">MCP Tools</a> &bull;
27
- <a href="#-architecture">Architecture</a> &bull;
28
- <a href="ROADMAP.md">Roadmap</a> &bull;
29
- <a href="MIGRATION.md">Migration</a> &bull;
30
- <a href="SECURITY.md">Security</a> &bull;
31
- <a href="SCORECARD.md">Scorecard</a> &bull;
32
- <a href="#-contributing">Contributing</a>
33
- </p>
34
-
35
- </div>
36
-
37
- ---
38
-
39
- ## Launch Status at a Glance
40
-
41
- | Claim | Current result | Evidence |
42
- |---|---|---|
43
- | Install path | Published `@atifjubaer/fastrmemory@0.2.1`; the 0.3.0 branch package is unscoped `fastrmemory` (unreleased) | `npm view @atifjubaer/fastrmemory version` -> `0.2.1`; `node -p "require('./package.json').name + ' ' + require('./package.json').version"` -> `fastrmemory 0.3.0` |
44
- | Synthetic retrieval | Holdout `95.8%` Hit@1, `100%` Hit@5, MRR `0.969` | `npx tsx scripts/eval-bench.ts --split all --embeddings minilm --out bench/results/minilm.json` |
45
- | Test suite | `276` tests across `51` files on the `0.3.0` branch; v0.2.1 is `235` / `43` | `npm test` |
46
- | Crash safety | 10/10 runs, 0 lost, 0 duplicate ids/titles | `npm run test:crash`; `bench/results/crash-test.json` |
47
- | Public retrieval (0.3.0 branch) | LongMemEval `+10.4pp` / `+11.0pp` Hit@5; LoCoMo `+4.4pp` / `+2.3pp` (target missed) | [docs/EXTERNAL_BASELINE.md](docs/EXTERNAL_BASELINE.md) |
48
- | Release score | Provisional `9.4 / 10`; `9.2` target met; Retrieval remains Partial | [SCORECARD.md](SCORECARD.md) |
49
-
50
- The synthetic table is not SWE-bench or LongMemEval. Public numbers are retrieval-only and are not QA-leaderboard results. Full provenance is in [CLAIMS.md](CLAIMS.md).
51
-
52
- ---
53
-
54
- ## 💡 Overview
55
-
56
- AI coding agents (Claude Code, Cursor, Windsurf, Codex, Antigravity) degrade on long-running codebases when project memory is lossy or operationally heavy. Common designs make one of three trade-offs:
57
- - **Decay and merge** old episodes to keep the store small, which can lose exact file paths, stack traces, and edge cases.
58
- - **Run a daemon or external database**, which adds ports, containers, and setup failure modes.
59
- - **Dump a static context file**, which grows without bound and is not queryable.
60
-
61
- **FastrMemory** keeps a verbatim event log, bi-temporal memory history, and a replayable Git mirror in a **single in-process TypeScript engine** (3 runtime dependencies; local embeddings and the daemon are optional):
62
-
63
- <table>
64
- <tr>
65
- <td width="33%" align="center">
66
-
67
- ### ⚡ Zero Daemon Overhead
68
- Pure Node 22+ built-in `node:sqlite` in WAL mode. On the 240-case suite, engine-level recall is **0.95 ms p50 / 1.60 ms p95** with hash embeddings and **3.30 ms p50 / 5.11 ms p95** with MiniLM on the train split (CLI startup measured separately). The default CLI/MCP path has no background daemon and no open port; `daemon start` is optional. Native on Windows, macOS, and Linux (the current CI matrix uses Intel macOS; Apple Silicon is not covered); CI matrix status is reported in [Actions](https://github.com/atifjubaer/fastrmemory/actions).
69
-
70
- </td>
71
- <td width="33%" align="center">
72
-
73
- ### 🔀 Bi-Temporal Git Sync
74
- Never deletes facts during consolidation (there is no destructive sleep step). Replaces half-life decay with `valid_from` / `valid_to` timestamps and auto-mirrors human-readable `.fastr/pages/*.md` files into Git.
75
-
76
- </td>
77
- <td width="33%" align="center">
78
-
79
- ### 🎯 Triple-Stream RRF ($k=20$)
80
- Fuses FTS5 BM25 + optional local embeddings + file-graph links. Error traps receive a **conditional 2.0x boost** only for trap-intent or file-scoped queries, with per-ID outcome feedback (+0.2 / -0.5). Three consecutive bad outcomes move a memory to dormant; confidence tiers are `high`, `medium`, `low`, `dormant`, and `superseded`.
81
-
82
- </td>
83
- </tr>
84
- </table>
85
-
86
- ---
87
-
88
- ## 🧭 Design Principles
89
-
90
- | Principle | Implementation |
91
- | :--- | :--- |
92
- | **Lossless by default** | Raw events, bi-temporal `valid_from` / `valid_to`, and supersession chains are retained. Nothing is destroyed by consolidation. |
93
- | **Zero daemon by default** | One Node 22+ process uses built-in `node:sqlite` in WAL mode. The default CLI/MCP path opens no ports or background services; `daemon start` is optional. |
94
- | **Replayable** | Git-diffable Markdown mirrors plus snapshots and rollback keep history inspectable. |
95
- | **Measured, not asserted** | Public claims are tied to committed benchmark JSON with a 20% holdout; simulated baselines are labeled as simulations. |
96
-
97
- ---
98
-
99
- ---
100
-
101
- ## 🤖 Works With MCP- and HTTP-Compatible Agents
102
-
103
- FastrMemory exposes one stdio MCP server and optional local HTTP services (dashboard and daemon). **Native installers wire Claude Code (MCP config plus lifecycle hooks), Cursor (MCP config plus skills), and, on 0.3.0, Gemini CLI, GitHub Copilot CLI, and OpenCode V2** (`fastrmemory hook install`); `fastrmemory setup` also writes MCP configs for Antigravity, Claude Desktop, and Windsurf. Every other client connects through its own MCP configuration or the REST API. Integration depth varies by client - only the native installers are covered by tests in this repository.
104
-
105
- Clients commonly used with FastrMemory include Codex CLI, Gemini CLI, OpenCode, GitHub Copilot CLI, Antigravity, Claude Desktop, Cline, Continue, Roo Code, Goose, Zed, Warp, and Aider. Listing a client does **not** imply a tested native integration.
106
-
107
- ---
108
-
109
- ## 🚀 Quick Start
110
-
111
- ### ⚡ Run Without a Global Install
112
-
113
- The 0.3.0 branch package is unscoped `fastrmemory`. It is not on the registry until the 0.3.0 release gate passes; the published 0.2.1 package remains available under its scoped name.
114
-
115
- ```bash
116
- # 0.3.0 command (after release):
117
- npx -y fastrmemory@0.3.0 setup
118
-
119
- # Published 0.2.1 release:
120
- npx -y @atifjubaer/fastrmemory@0.2.1 setup
121
-
122
- # Or launch the local Web UI:
123
- npx -y fastrmemory@0.3.0 ui
124
- ```
125
-
126
- The GitHub source path remains available for development only: `npx github:atifjubaer/fastrmemory setup`. Do not use it in generated MCP or hook configs; those must pin the npm package version.
127
-
128
- ---
129
-
130
- ### Install from npm
131
-
132
- ```bash
133
- # 0.3.0 branch (after release):
134
- npm install -g fastrmemory@0.3.0
135
-
136
- # Current published release:
137
- npm install -g @atifjubaer/fastrmemory@0.2.1
138
- fastr --version
139
- ```
140
-
141
- For a one-shot run without a global install:
142
-
143
- ```bash
144
- npx -y fastrmemory@0.3.0 --version
145
- ```
146
-
147
- The 0.2.1 package is public. The first `npm view` after the 2026-10-22 publish returned E404 for about two minutes during registry propagation; use the exact `0.2.1` version for reproducibility. The 0.3.0 package is unreleased; do not treat the `fastrmemory` install command as available until the release gate passes.
148
-
149
- ### Install the v0.2.1 GitHub Release Tarball
150
-
151
- ```bash
152
- # Local project install from the release asset (verified with the 0.2.1 tarball):
153
- npm install https://github.com/atifjubaer/fastrmemory/releases/download/v0.2.1/atifjubaer-fastrmemory-0.2.1.tgz
154
- npx fastr --version
155
- ```
156
-
157
- For a global CLI:
158
-
159
- ```bash
160
- npm install -g https://github.com/atifjubaer/fastrmemory/releases/download/v0.2.1/atifjubaer-fastrmemory-0.2.1.tgz
161
- fastr --version
162
- ```
163
-
164
- Or install the current default branch for development (not the frozen release tag):
165
-
166
- ```bash
167
- npm install -g git+https://github.com/atifjubaer/fastrmemory.git
168
- ```
169
-
170
- > Both `fastrmemory` and `fastr` (short alias) are executable after installation. The 0.3.0 branch renames the package to `fastrmemory`; the bin names stay the same. The GitHub asset is the byte-verified fallback for the v0.2.1 release and is not byte-identical to the registry tarball. The release tarball SHA-256 is recorded in [CLAIMS.md](CLAIMS.md).
171
-
172
- ### 2. Verify Database Health
173
-
174
- ```bash
175
- fastrmemory status
176
- ```
177
-
178
- Output:
179
- ```text
180
- === FastrMemory Health (my-project) ===
181
- - Project ID: proj_1cce2a654e3a
182
- - Active Memories: 2
183
- - Staging Memories: 0
184
- - Superseded History: 0
185
- - Ingested Events: 0
186
- - Pending Spool: Clear (0)
187
- - Database File: .fastr/fastr.db
188
- ```
189
-
190
- ### 3. Record & Recall a Memory
191
-
192
- ```bash
193
- # Record an error trap linked to an exact file:
194
- fastrmemory remember "Never Use Date.now() Milliseconds for JWT Expiration" \
195
- -c "JWT exp claims expect integer seconds. Always use Math.floor(Date.now() / 1000)." \
196
- -m auth -k error_trap -f "src/auth/jwt.ts" --verified
197
-
198
- # Recall with conditional 2.0x trap boost & file-graph matching:
199
- fastrmemory recall "JWT expiration" -f "src/auth/jwt.ts"
200
- ```
201
-
202
- Output:
203
- ```text
204
- === Recalled Memories (1 results, ~46 tokens) ===
205
-
206
- [mem_009e4a7d] [TRAP] [verified] Never Use Date.now() Milliseconds for JWT Expiration (Score: 0.08)
207
- JWT exp claims expect integer seconds. Always use Math.floor(Date.now() / 1000).
208
- ```
209
-
210
- Open contradictions are marked on both sides of the recall result instead of being silently mixed into context (**0.3.0**):
211
-
212
- ```bash
213
- # Inspect unresolved contradictions:
214
- fastrmemory conflict list
215
-
216
- # Keep the rule that matches the project and supersede the loser:
217
- fastrmemory conflict resolve 1 --keep mem_009e4a7d --forget --reason "Seconds are the project standard"
218
- ```
219
-
220
- #### Import Existing Local Rules (**0.3.0**)
221
-
222
- Bring `AGENTS.md`, `CLAUDE.md`, or `.cursor/rules/*.mdc` content into memory without hand-copying every section. Level 2+ headings become memories; bullet lists and paragraphs are fallbacks. Re-importing the same file skips exact duplicates.
223
-
224
- ```bash
225
- # Preview the parsed sections without writing:
226
- fastrmemory import AGENTS.md --from agents-md --module rules --dry-run
227
-
228
- # Import as staging memories for review, or verify them immediately:
229
- fastrmemory import AGENTS.md --from agents-md --module rules
230
- fastrmemory import AGENTS.md --from agents-md --module rules --verified
231
-
232
- # JSONL snapshots use the same entry point:
233
- fastrmemory import snapshot.jsonl --from jsonl
234
- ```
235
-
236
- ### 4. Cognitive Git Blame & Memory-Aware Commit
237
-
238
- ```bash
239
- # Cognitive Git Blame linking lines directly to commit, author, and governing error traps (conditional 2.0x boost):
240
- fastrmemory blame src/auth/jwt.ts:42
241
-
242
- # Pre-commit error trap validation & conventional commit synthesis:
243
- fastrmemory commit
244
- ```
245
-
246
- ### 5. Git Snapshots, Branches, Rollback & Background Daemon (branches are **0.3.0**)
247
-
248
- ```bash
249
- # Point-in-time memory snapshot (Git for Agent Memory):
250
- fastrmemory snapshot create "pre-refactor-checkpoint"
251
- fastrmemory snapshot list
252
- fastrmemory snapshot rollback "pre-refactor-checkpoint"
253
-
254
- # 0.3.0: Portable backup with a sidecar provenance manifest:
255
- fastrmemory backup backups/pre-upgrade.jsonl
256
- fastrmemory backup --verify backups/pre-upgrade.jsonl
257
- fastrmemory backup --restore backups/pre-upgrade.jsonl --dry-run
258
-
259
- # Immutable memory branch and one-way merge with a conflict report:
260
- fastrmemory branch create feature/auth
261
- fastrmemory branch list
262
- fastrmemory merge feature/auth
263
- fastrmemory merge feature/auth --force --strategy branch
264
-
265
- # Hybrid Background Daemon (Optional HTTP/SSE service for cross-process tools):
266
- fastrmemory daemon start
267
- fastrmemory daemon status
268
- fastrmemory daemon stop
269
-
270
- # Auto-wire MCP configs, lifecycle hooks, and Planetary Skills into Claude Code, Cursor,
271
- # Gemini CLI, GitHub Copilot CLI, and OpenCode; setup also wires Antigravity, Claude Desktop, and Windsurf:
272
- fastrmemory hook install
273
- fastrmemory setup
274
-
275
- # Mine past Git bug fixes directly into staging error traps:
276
- fastrmemory learn -n 30 --days 90
277
- ```
278
-
279
- Branches are immutable snapshot pointers. `merge` is one-way into the current active set: branch-only memories are added, target-only memories are preserved, and same-identity changes are reported as conflicts. Conflicts block writes by default; `--force` applies non-conflicting additions, and `--force --strategy branch` supersedes the target while keeping old rows in history. Branch checkout or a mutable branch working tree is not implemented.
280
-
281
- `backup` writes the portable JSONL snapshot plus `<file>.manifest.json` with the file SHA-256, content hash, record counts, tool version, environment, and source integrity. `--restore` verifies both hashes before importing; `--dry-run` reports counts without writing. The backup scope is memories, raw events, file links, and conflicts, not a physical SQLite/WAL copy. See [MIGRATION.md](MIGRATION.md) for the full backup and rollback path.
282
-
283
- ### 6. Token Compression, Database Doctor & Vision Search
284
-
285
- ```bash
286
- # Compress markdown docs & LLM prompt context to reduce token usage:
287
- fastrmemory compress docs/architecture.md --dry-run
288
-
289
- # Run deep health check across SQLite, FTS5 indices, file links, and task DAGs:
290
- fastrmemory diagnose
291
-
292
- # Auto-repair FTS5 indices, orphaned file links, and WAL fragmentation:
293
- fastrmemory heal
294
-
295
- # 0.3.0: Report orphaned records, duplicate active memories, and stale rows:
296
- fastrmemory hygiene
297
- fastrmemory hygiene --stale-days 30 --json --fail-on-issues
298
-
299
- # Tag a UI screenshot or architecture diagram with OCR & 384-dim vector indexing:
300
- fastrmemory vision tag screenshots/modal-error.png --desc "Modal error 401 alert" --ocr "HTTP 401"
301
-
302
- # Semantic search across tagged screenshots and visual diagrams:
303
- fastrmemory vision search "modal error 401"
304
-
305
- # Pre-merge CI/CD gate checking PR diffs against active error traps:
306
- fastrmemory guard --strict
307
- ```
308
-
309
- `fastrmemory hygiene` reports orphaned file links, conflict rows, and feedback rows; duplicate active memories by normalized title or exact content; and stale unpinned active memories (default 90 days since the last recall or creation). `npm run check:hygiene` runs the same inspector against a deterministic fixture inside `check:ci`; it does not mutate a project database. Use `--fail-on-issues` when a script should exit nonzero on findings.
310
-
311
- ---
312
-
313
- ## 🔌 One-Click Agent MCP Configuration
314
-
315
- Add this JSON block to your agent's MCP settings to enable autonomous memory:
316
-
317
- ### Claude Code (`~/.claude.json`)
318
- ```json
319
- {
320
- "mcpServers": {
321
- "fastrmemory": {
322
- "command": "fastrmemory",
323
- "args": ["mcp"]
324
- }
325
- }
326
- }
327
- ```
328
-
329
- ### Cursor (`.cursor/mcp.json`)
330
- ```json
331
- {
332
- "mcpServers": {
333
- "fastrmemory": {
334
- "command": "fastrmemory",
335
- "args": ["mcp"]
336
- }
337
- }
338
- }
339
- ```
340
-
341
- ### Gemini CLI (`.gemini/settings.json`, 0.3.0)
342
- ```json
343
- {
344
- "mcpServers": {
345
- "fastrmemory": {
346
- "command": "fastrmemory",
347
- "args": ["mcp"]
348
- }
349
- }
350
- }
351
- ```
352
-
353
- `fastrmemory hook install` also merges `SessionStart`, `BeforeTool` (`write_file|replace`), `PreCompress`, and `SessionEnd` hooks into the same project settings file. Gemini CLI requires strict JSON on hook stdout, so the generated commands pass `--format gemini`. Google is transitioning users from Gemini CLI to Antigravity CLI; this integration targets the still-documented `.gemini/settings.json` contract.
354
-
355
- ### GitHub Copilot CLI (`.github/mcp.json`, 0.3.0)
356
- ```json
357
- {
358
- "mcpServers": {
359
- "fastrmemory": {
360
- "type": "local",
361
- "command": "fastrmemory",
362
- "args": ["mcp"]
363
- }
364
- }
365
- }
366
- ```
367
-
368
- `fastrmemory hook install` also merges `.github/hooks/fastrmemory.json` with `sessionStart`, `preToolUse` (`edit|create|str_replace_editor|apply_patch`), `preCompact`, and `sessionEnd` hooks. Copilot has no model-facing advisory field for `preToolUse`, so an active trap returns `permissionDecision: "ask"` with the warning; autopilot/non-interactive mode treats `ask` as deny. The shared `AGENTS.md` written by the installer supplies repository instructions.
369
-
370
- ### OpenCode V2 (`opencode.json`, 0.3.0)
371
- ```json
372
- {
373
- "mcp": {
374
- "servers": {
375
- "fastrmemory": {
376
- "type": "local",
377
- "command": ["fastrmemory", "mcp"]
378
- }
379
- }
380
- }
381
- }
382
- ```
383
-
384
- `fastrmemory hook install` also writes `.opencode/plugins/fastrmemory/index.ts`, which injects the session-start handoff and critical rules into model context and captures a snapshot before compaction. Existing `opencode.json(c)` settings are preserved; JSONC configs are left untouched and reported for manual wiring.
385
-
386
- ---
387
-
388
- ## 🛠️ MCP Server: Tools & Resources
389
-
390
- Built using the official **v2 `@modelcontextprotocol/server`** SDK. The tool list below describes the **0.3.0** branch; the v0.2.1 release has 4 resources.
391
-
392
- ### 41 MCP Tools
393
-
394
- The default **full profile** exposes all 41 tools. For a smaller schema, start the **core profile** with `fastrmemory mcp --profile core` or `FASTR_MCP_PROFILE=core`; it exposes the 12-tool daily loop: `fastr_recall`, `fastr_remember`, `fastr_handoff`, `fastr_trap_recall`, `fastr_trap_log`, `fastr_status`, `fastr_get`, `fastr_timeline`, `fastr_diff`, `fastr_replay`, `fastr_compress`, and `fastr_diagnose`. Resources and prompts are the same in both profiles.
395
-
396
- #### Cognitive Retrieval & Memory Core
397
- 1. `fastr_recall`: Triple-stream hybrid search (BM25 + Vector + Spreading Activation Graph) with progressive L0–L3 token budgeting and air-gapped offline vector fallback.
398
- 2. `fastr_get`: Retrieves complete memory details (including status, timestamps, reward scores, and full content) by memory ID.
399
- 3. `fastr_list`: Lists memories with bounded filtering by module, kind, status, limit, and offset.
400
- 4. `fastr_drill`: Resolves `source_event_ids` to retrieve untruncated verbatim stack traces, diffs, and tool outputs from `raw_events`.
401
- 5. `fastr_file_history`: Returns active rules, `[TRAP]` warnings, and past supersessions for a specific file path.
402
- 6. `fastr_remember`: Records new rules, decisions, or traps. Automatically extracts NER entities, scrubs secrets, and re-renders Markdown mirrors. Supports `scope: 'project' | 'global'`.
403
- 7. `fastr_pin`: Pins critical rules so they are permanently preserved and prioritized in L0 assembly without time decay.
404
- 8. `fastr_forget`: Tombstones and deactivates an outdated memory cleanly with audit logging.
405
- 9. `fastr_supersede`: Retires an outdated rule (`valid_to = now`), records the rationale, and inserts a replacement verified rule.
406
- 10. `fastr_feedback`: Updates `reward_score` and the confidence tier on one memory ID (+0.2 good, -0.5 bad). Three consecutive bad outcomes make it dormant; never penalizes innocent memories.
407
- 11. `fastr_handoff`: Saves or retrieves cross-agent session milestones and promotes staging memories to verified.
408
- 12. `fastr_status`: Returns active/staging counts, spool health, and embedding coverage %.
409
- 13. `fastr_graph_query`: Explores 1-hop and 2-hop structural file-link dependencies, entity links, and connected error traps.
410
- 14. `fastr_timeline`: Chronological audit trail of memory events, newly verified rules, error traps, and historical supersessions.
411
-
412
- #### Versioning & Error Traps
413
- 15. `fastr_snapshot`: Creates named point-in-time memory snapshots for branch tracking and experiment safety.
414
- 16. `fastr_rollback`: Instant Git-like rollback to any previous memory snapshot.
415
- 17. `fastr_trap_log`: One-line rapid logging of error traps and bug solutions with a conditional 2.0x recall boost.
416
- 18. `fastr_trap_recall`: Targeted lookup of high-priority error traps protecting specific target files before editing.
417
-
418
- #### Proactive Contradiction Detection & Resolution
419
- 19. `fastr_conflicts`: Proactive contradiction detection using Jaccard token overlap (minimum 0.35) and 50-word opposing-polarity analysis.
420
- 20. `fastr_resolve`: Resolves contradictions by keeping preferred rule and superseding or weakening the loser.
421
-
422
- #### Kahneman Planning Fallacy & Base-Rate Calibrator
423
- 21. `fastr_predict`: Records effort/time/risk predictions and closes predictions with actual empirical outcomes.
424
- 22. `fastr_predict_baserate`: Computes historical reference-class statistics (Mean, Median p50 ratio, MAE) to debias agent estimates.
425
-
426
- #### Multi-Agent Action DAG & Frontier
427
- 23. `fastr_action_create`: Creates structured work item actions with prerequisite (`requires`) and conflict (`conflicts_with`) constraints.
428
- 24. `fastr_action_update`: Updates task lifecycle (`pending`, `active`, `done`, `blocked`), assignments, and memory crystallization.
429
- 25. `fastr_frontier`: Computes unblocked, ready-to-execute frontier actions with satisfied dependencies.
430
- 26. `fastr_next`: Atomically claims and returns the highest-priority frontier action for autonomous worker agents.
431
-
432
- #### Bounded Working Memory & Obsidian Vault Export
433
- 27. `fastr_slot_get`: Retrieves bounded working memory slot (e.g. `current_goal`, `user_preferences`, `active_hypothesis`).
434
- 28. `fastr_slot_set`: Updates working memory slot with hard character ceiling enforcement to prevent context bloat.
435
- 29. `fastr_slot_list`: Lists all working memory slots and active character usage.
436
- 30. `fastr_obsidian_export`: Exports all memories, entities, and relationships into an Obsidian-compatible markdown vault with YAML frontmatter, `[[wikilinks]]`, and `MOC.md`.
437
-
438
- #### Multi-Repository Federation & Context Assembly
439
- 31. `fastr_federate`: Manages cross-repository organization-wide shared rules and error traps via SQLite native `ATTACH DATABASE` (`~/.fastr/global.db`).
440
- 32. `fastr_assemble`: Dynamically formats and packs high-density structured prompt context (`<fastr_context>`) with token budgeting.
441
- 33. `fastr_risk_predict`: Computes historical failure probability and active trap hazard score for target codebase files.
442
- 34. `fastr_verify_provenance`: Cryptographically verifies SHA-256 provenance hashes for recorded agent attribution.
443
-
444
- #### Token Compression & Autonomous Doctor
445
- 35. `fastr_compress`: Compresses markdown files or prompt context while strictly preserving headings, URLs, and code blocks with `.original.md` backup.
446
- 36. `fastr_diagnose`: Deep health audit of SQLite B-Tree integrity, FTS5 BM25 search indices, orphaned file links, and task DAGs.
447
- 37. `fastr_heal`: Automatic repair of database indices, dangling edges, and WAL page reclamation.
448
-
449
- #### Memory Replay & Diff
450
- 38. `fastr_replay`: Reconstructs memory state at a timestamp and returns the active snapshot for audit or recovery.
451
- 39. `fastr_diff`: Compares two snapshots and reports added, superseded, and removed memories.
452
-
453
- #### Multimodal Visual Memory
454
- 40. `fastr_vision_tag`: Tags screenshots, UI diagrams, and wireframes with OCR and semantic descriptions with 384-dim embeddings.
455
- 41. `fastr_vision_search`: Hybrid vector and keyword search across stored visual assets for multimodal coding agents.
456
-
457
- ### 2 MCP Prompt Templates
458
-
459
- - `pre-edit-check`: Given file paths, instructs the agent to check traps and relevant rules before editing.
460
- - `session-wrap-up`: End-of-session checklist for logging traps, superseding stale rules, scoring memories, and saving a handoff.
461
-
462
- ### 5 MCP Resources (0.3.0; v0.2.1 has 4)
463
-
464
- - `fastr://project/overview`: L0 project summary containing active counts and storage location.
465
- - `fastr://project/traps`: All active `[TRAP]` warnings for immediate bug avoidance.
466
- - `fastr://session/handoff`: Latest cross-agent handoff milestone.
467
- - `fastr://memory/{id}` (resource template): Full JSON for a single memory, including linked files and its validity window.
468
- - `fastr://memory/{id}/envelope` (resource template): Metadata, cryptographic provenance, file/graph links, and open/resolved conflict state for one memory.
469
-
470
- ---
471
-
472
- ## 📄 Two-Zone Git-Diffable Mirror
473
-
474
- Every write to the local SQLite database automatically synchronizes human-readable markdown files in `.fastr/pages/<module>.md`. This allows developers to review AI memories directly in GitHub Pull Requests:
475
-
476
- ```markdown
477
- # Module: auth
478
-
479
- > Auto-generated by FastrMemory. Active rules are at the top; superseded history is preserved below for Git diffs.
480
-
481
- ---
482
-
483
- ## Compiled Truth (Active Rules & Traps)
484
-
485
- ### [mem_009e4a7d] [TRAP] Never Use Date.now() Milliseconds for JWT Expiration
486
- - **Kind**: `error_trap`
487
- - **Status**: `verified` (Reward Score: 1)
488
- - **Linked Files**: `src/auth/jwt.ts`
489
- - **Active Since**: `2026-10-18T21:46:20Z`
490
-
491
- JWT exp claims expect integer seconds. Always use Math.floor(Date.now() / 1000).
492
-
493
- ---
494
-
495
- ## Append-Only Timeline (History & Superseded)
496
-
497
- ### [EXPIRED 2026-10-18T20:00:00Z -> 2026-10-18T21:46:20Z] [mem_abc123] Token Signing
498
- - **Superseded By**: `[mem_009e4a7d]`
499
- - **Reason**: Standardized on integer seconds
500
- - **Historical Status**: `superseded`
501
-
502
- > Old implementation used milliseconds which failed expiration validation.
503
- ```
504
-
505
- ---
506
-
507
- ## 🧠 Planetary Agent Skills Suite
508
-
509
- FastrMemory ships 10 Agent Skills (in `skills/`, mirrored to `.cursor/skills/`) that tell agents *when* to use each memory tool. Install them as a Claude Code plugin (`.claude-plugin/`) or copy them with `fastrmemory setup`:
510
-
511
- - [fastr-memory](skills/fastr-memory/SKILL.md): At the start of a task and before editing files: `fastr_trap_recall`, then `fastr_recall` / `fastr_assemble`.
512
- - [fastr-trap-log](skills/fastr-trap-log/SKILL.md): The moment a failure is diagnosed: record it with `fastr_trap_log`.
513
- - [fastr-session-commit](skills/fastr-session-commit/SKILL.md): When a task is done and tests pass: supersede, rate memories, and `fastr_handoff` with `verifyStaging`.
514
- - [fastr-curate](skills/fastr-curate/SKILL.md): When storing durable lessons or fixing contradictions: dedupe, remember, supersede, resolve conflicts, snapshot/rollback.
515
- - [fastr-setup](skills/fastr-setup/SKILL.md): When FastrMemory is not wired into Claude Code: `fastrmemory hook install`, `claude mcp add`, verify with `fastrmemory status`.
516
- - [fastr-plan-estimate](skills/fastr-plan-estimate/SKILL.md): When estimating effort or risk: base rates, file risk, and closing predictions.
517
- - [fastr-dag](skills/fastr-dag/SKILL.md): When work has dependent steps or several agents share a backlog.
518
- - [fastr-doctor](skills/fastr-doctor/SKILL.md): When recall misses memories or the database looks unhealthy: diagnose, then heal.
519
- - [fastr-compress](skills/fastr-compress/SKILL.md): When a doc or context block exceeds its token budget.
520
- - [fastr-vision](skills/fastr-vision/SKILL.md): When screenshots or diagrams should be remembered or searched.
521
-
522
- Run `npm run check:skills` to validate every tool call in the skills against `src/mcp/server.ts`.
523
-
524
- ---
525
-
526
- ## 🏗️ Architecture
527
-
528
- ```mermaid
529
- flowchart TD
530
- subgraph Ingestion["1. Lossless Ingestion & Spool"]
531
- Agent["AI Coding Agent\n(Claude Code, Cursor, Antigravity)"] --> Scrubber["Secret Scrubber\n(API Keys, Bearer, PEM)"]
532
- Scrubber --> Spool{"SQLite Busy?"}
533
- Spool -- Yes --> SpoolFile[".fastr/spool/pending.jsonl\n(async fallback)"]
534
- Spool -- No --> DB
535
- end
536
-
537
- subgraph Storage["2. Bi-Temporal Storage & Git Mirror"]
538
- DB[("Node 22 node:sqlite (WAL)\nraw_events | memories\nfile_links | handoffs")]
539
- DB --> Mirror["Markdown Mirror Engine"]
540
- Mirror --> Pages[".fastr/pages/<module>.md\nTop: ## Compiled Truth\nBottom: ## Append-Only Timeline"]
541
- end
542
-
543
- subgraph Search["3. Triple-Stream Hybrid Retrieval"]
544
- Query["Recall / File Query"] --> FTS["Stream A: FTS5 BM25\n(Sub-millisecond)"]
545
- Query --> Vec["Stream B: Xenova Vectors\n(all-MiniLM-L6-v2)"]
546
- Query --> Graph["Stream C: file_links Graph\n(1-2 Hop Structural Match)"]
547
- FTS & Vec & Graph --> RRF["RRF Fusion (k=20)\n+ Conditional 2.0x Error Trap Multiplier\n+ 1.25x Verified Multiplier"]
548
- RRF --> Budget["Progressive Token Packer\nL0 (150t) | L1 (500t) | L2 (1500t) | L3 (4000t)"]
549
- end
550
-
551
- subgraph Protocol["4. Official MCP Protocol"]
552
- Budget --> MCPServer["Official MCP v2 Server\n(@modelcontextprotocol/server)"]
553
- MCPServer --> Tools["41 tools • 2 prompts • 5 resources"]
554
- Tools --> Agent
555
- end
556
- ```
557
-
558
- ---
559
-
560
- ## 🧪 Testing & Verification
561
-
562
- Run the comprehensive unit test suite:
563
-
564
- ```bash
565
- npm test
566
- ```
567
-
568
- All **276 tests pass** across **51 test files** on the 0.3.0 branch (the v0.2.1 release has **235 tests / 43 files**) covering database schema, WAL locking, offline spooling, bi-temporal supersession, secret scrubbing, two-zone rendering, automated benchmarks, snapshots/rollback, branch merge conflict reports, replay/diff, memory envelopes, confidence tiers and 3-bad dormancy, memory hygiene checks, Memory CI, conflict-aware recall, portable backup manifests and verified restore, local rule import, OpenCode V2, Gemini CLI, and Copilot CLI wiring, git-learner, cognitive blame, commit synthesis, hybrid background daemon, token compression, self-healing doctor, multimodal vision, web dashboard server, pre-merge trap guardian, UI loopback security boundaries, and atomic installer configuration safety.
569
-
570
- **CI performance gates:** `check:query-plans`, `check:recall-latency`, and `check:install-size` run inside `check:ci`. CI executes them on the canonical Ubuntu/Node 24 job; other matrix jobs set `FASTR_PERF_GATE=0` because timing is runner-sensitive, while functional tests still run on every matrix entry.
571
-
572
- **Crash-safety evidence:** `npm run test:crash` kills the writer at randomized points across 10 runs, then reopens the WAL database. The committed report at [`bench/results/crash-test.json`](bench/results/crash-test.json) records **10,718 acknowledged writes**, **10,727 committed rows**, **0 lost**, **0 duplicate ids/titles**, and `PRAGMA integrity_check = ok`; methodology is in [`docs/audit/2026-10-21-crash-test.md`](docs/audit/2026-10-21-crash-test.md). `npm run check:crash` validates the report during `check:ci`. This is a process-crash test (`taskkill /F`), not a power-loss test; SQLite runs with `synchronous=NORMAL` in WAL mode.
573
-
574
- ---
575
-
576
- ## Retrieval Benchmark (240 synthetic cases)
577
-
578
- Generated from [`bench/results/minilm.json`](bench/results/minilm.json) on **2026-10-20** at benchmark commit `562f461`. The corpus is deterministic: 120 memories and 240 queries, split into **192 train / 48 holdout (20%)**. The holdout was fixed before tuning and is reported separately. Reproduce with:
579
-
580
- ```bash
581
- npx tsx scripts/eval-bench.ts --split all --embeddings minilm --out bench/results/minilm.json
582
- npx tsx scripts/eval-bench.ts --split all --embeddings hash --out bench/results/hash.json
583
- ```
584
-
585
- | Configuration | Split | Cases | Hit@1 | Hit@3 | Hit@5 | MRR | nDCG@10 | Context tokens | p50 |
586
- | :--- | :--- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
587
- | FastrMemory + MiniLM | Train | 192 | 96.4% | 99.0% | 100% | 0.976 | 0.982 | 208 | 3.30 ms |
588
- | FastrMemory + MiniLM | **Holdout** | 48 | **95.8%** | **97.9%** | **100%** | **0.969** | **0.977** | 209 | 3.41 ms |
589
- | FastrMemory BM25-only | Train | 192 | 79.7% | 90.6% | 100% | 0.868 | 0.900 | 203 | 0.48 ms |
590
- | FastrMemory BM25-only | Holdout | 48 | 77.1% | 77.1% | 93.8% | 0.804 | 0.835 | 204 | 0.60 ms |
591
- | Static dump - simulated baseline | Train | 192 | 2.1% | 6.3% | 8.3% | 0.055 | 0.081 | 3652 | 0.00 ms |
592
- | Static dump - simulated baseline | Holdout | 48 | 0.0% | 0.0% | 8.3% | 0.025 | 0.056 | 3652 | 0.00 ms |
593
-
594
- > **Caveats:** this is a deterministic synthetic corpus, not SWE-bench or LongMemEval. The static-dump row is a simulation implemented in this repository, not an external project. Separate public retrieval-only external baselines are documented in [docs/EXTERNAL_BASELINE.md](docs/EXTERNAL_BASELINE.md); the synthetic table does not measure them. Context tokens are the compact prompt text under a 250-token budget; the ranked result objects retain full memory content. Methodology, per-category breakdowns, ablations, and confidence intervals are in [BENCHMARKS.md](BENCHMARKS.md) and [docs/benchmark-report.md](docs/benchmark-report.md).
595
-
596
- ## 🖥️ Local Web Dashboard v2 & 3D Brain Observatory
597
-
598
- Visualize active rules, error traps, timeline audits, and interactive 3D memory constellations directly in your browser from bundled UI assets (no external service or database):
599
-
600
- ```bash
601
- fastrmemory ui
602
- ```
603
-
604
- - **Live URL**: `http://localhost:4242`
605
- - **Dashboard v2 Architecture**: Built with **shadcn/ui**, **Tailwind CSS v4**, and **TanStack Query**, with SSE updates plus version polling for cross-process writes.
606
- - **12 Focused Route Workspaces (0.3.0 adds `/replay`)**:
607
- - `/`: Real-time system vitals, active trap alerts, recent memory feed, and quick-action shortcuts.
608
- - `/memories`: Search, filter, and inspect memories with the slide-out **Memory Detail Sheet**, status toggles, pin, and 1-click forget.
609
- - `/traps`: Dedicated **Error Trap Quarantine** displaying governing files, conditional boost conditions, and verified mitigation lessons.
610
- - `/conflicts`: Proactive bi-temporal contradiction detection with side-by-side **Word Diff** and 1-click resolution (`Keep A`, `Keep B`, `Keep Both`).
611
- - `/actions`: Real-time interactive **Action DAG Canvas** tracking task dependencies, worker assignments, and glowing unblocked frontier aura.
612
- - `/graph`: Interactive file and entity relationship graph with 1-hop/2-hop inspection and memory drill-down.
613
- - `/observatory`: High-performance **Three.js 3D Constellation Galaxy** with a smooth lerp camera, celestial star dust, glowing amber trap halos, and memory inspect modals.
614
- - `/treemap`: Interactive high-DPI squarified treemap visualising memory strength bands and module density.
615
- - `/search`: **Search Lab** evaluating triple-stream RRF retrieval with latency waterfall breakdown (BM25 vs Vector vs Graph).
616
- - `/replay` (**0.3.0**): **Replay & Diff** workspace reconstructing the active set at two timestamps with snapshot metrics and added/superseded/changed/conflict review.
617
- - `/health`: Autonomous SQLite self-healing Doctor with 1-click integrity diagnosis, FTS5 rebuild, and vacuum.
618
- - `/settings`: Live database path, project configuration, and export controls.
619
- - **Memory CI**: The PR diff workflow and comment lifecycle are documented in [docs/MEMORY_CI.md](docs/MEMORY_CI.md).
620
- - **Dual Theme Support**: Light, dark, and system-preference modes.
621
- - **Default Zero-Daemon Path**: The dashboard is served by the in-process Node.js HTTP server and embedded SQLite WAL mode; `fastrmemory daemon start` is an optional local REST/SSE service.
622
-
623
- ---
624
-
625
- ## 🧩 Native VS Code & Cursor Extension
626
-
627
- Package and install the native FastrMemory Guardian extension for **VS Code** and **Cursor**:
628
-
629
- ```bash
630
- # Compile and package extension
631
- npm run build:extension
632
- npx @vscode/vsce package --no-dependencies
633
-
634
- # Install into Cursor or VS Code
635
- cursor --install-extension fastrmemory-vscode-0.1.0.vsix
636
- ```
637
-
638
- - **⚡ Status Bar Pill**: Displays active trap count in the status bar (`⚡ 3 Traps Active` or `⚡ 1 Trap on File`). Clicking opens an interactive QuickPick listing all active traps.
639
- - **Amber Underlines**: Trapped files are underlined in amber with full hover mitigation instructions and conditional 2.0x boost conditions.
640
- - **Problems Tab Integration**: Active error traps populate the IDE Problems panel as non-blocking warning diagnostics.
641
- - **Zero Daemons**: Reads directly from `.fastr/fastr.db` via `node:sqlite`.
642
-
643
- ---
644
-
645
- ## 🤝 Contributing & Pull Request Roadmap
646
-
647
- We warmly welcome contributions from the open-source community! Whether you are adding a new AI coding agent hook, integrating local embedding backends, or crafting 3D visualizations, your pull requests are valued and reviewed promptly.
648
-
649
- ### 🏆 Contributor Wall of Fame
650
-
651
- Special thanks to **[@the-arizul](https://github.com/the-arizul)** for architecting PRs #1 through #11:
652
- - **PR #1**: Loopback security boundaries, DNS rebinding lockdown, and `dist-ui` package resolution.
653
- - **PR #2**: Safe atomic JSON config merges, nested Claude Code hook schemas, and sandboxed installer tests.
654
- - **PR #3**: Hardened GitHub Actions fork PR comment safety.
655
- - **PR #4**: Core SQLite B-tree heal, BUSY spool fallback, ATTACH injection prevention, and atomic claim/supersede.
656
- - **PR #5**: Git security hardening (zero shell interpolation, confined paths, and high-entropy secret scrubbing).
657
- - **PR #6**: Triple-stream RRF recall ranking calibration, zero irrelevant results, and Unicode query normalization.
658
- - **PR #7**: MCP server hardening (`isError` handling, bounded inputs, parameter annotations, prompts, and new tools: `fastr_get`, `fastr_list`, `fastr_pin`, `fastr_forget`).
659
- - **PR #8**: Skills suite consolidation, plugin manifest, and CI validation runner.
660
- - **PR #9**: VS Code extension headless activation fallback and staging trap decorations.
661
- - **PR #10**: Isolated benchmark database harnesses and calibrated baselines.
662
- - **PR #11**: Planetary Dashboard v2 overhaul with shadcn/ui, Tailwind CSS v4, and live cross-process sync.
663
-
664
- ---
665
-
666
- ### 🗺️ Open Contribution Roadmap
667
-
668
- | Domain / Focus Area | What Needs Building | Difficulty | Reference Location | Target PR Scope |
669
- | :--- | :--- | :--- | :--- | :--- |
670
- | **Agent Hook Installers** | Auto-wire hooks & skills for Windsurf, Roo Code, Continue, and Warp | `good first issue` | [src/installer/setup.ts](src/installer/setup.ts) | `feat(installer)` |
671
- | **Local Embedding Providers** | Optional on-device backends (Ollama, llama.cpp, WebGPU) with air-gapped fallback | Intermediate | [src/search/embeddings.ts](src/search/embeddings.ts) | `feat(embeddings)` |
672
- | **IDE Extensions** | JetBrains (IntelliJ / WebStorm) and Neovim Lua plugin with status bar pill & trap underlines | Advanced | [extensions/vscode/](extensions/vscode/) | `feat(ide)` |
673
- | **Benchmark Runners** | SWE-bench and additional public QA scenario runners; LongMemEval and LoCoMo retrieval harnesses already exist | `good first issue` | [src/bench/benchmark.ts](src/bench/benchmark.ts) | `feat(bench)` |
674
- | **UI Visualizations** | Custom Three.js shaders, Treemap color palettes, and SVG/PNG graph exports | Intermediate | [ui/src/components/](ui/src/components/) | `feat(ui)` |
675
-
676
- ---
677
-
678
- ### 🚀 Pull Request Workflow
679
-
680
- 1. **Fork & Clone Repository**:
681
- ```bash
682
- git clone https://github.com/<your-username>/fastrmemory.git
683
- cd fastrmemory
684
- ```
685
-
686
- 2. **Install Dependencies & Verify Test Suite (276 Tests Passing)**:
687
- ```bash
688
- npm install
689
- npm test
690
- ```
691
-
692
- 3. **Create a Feature Branch**:
693
- ```bash
694
- git checkout -b feat/add-windsurf-hooks
695
- # or for bug fixes:
696
- git checkout -b fix/sqlite-busy-retry
697
- ```
698
-
699
- 4. **Implement Changes & Verify All Packages Compile**:
700
- ```bash
701
- # Compiles backend, React UI, and VS Code extension
702
- npm run build:all
703
- npm test
704
- ```
705
-
706
- 5. **Commit with DCO Sign-off (`-s`) & Open Pull Request**:
707
- ```bash
708
- git commit -s -m "feat(installer): add windsurf auto-hook integration"
709
- git push origin feat/add-windsurf-hooks
710
- ```
711
-
712
- ---
713
-
714
- ### 📋 Pull Request Quality Checklist
715
-
716
- Before submitting your PR, verify:
717
- - [ ] **Strict TypeScript**: `npm run build:all` passes without type errors.
718
- - [ ] **Zero External Daemons**: Engine runs in-process via Node.js WAL SQLite.
719
- - [ ] **100% Test Green**: `npm test` passes all 276 unit tests across 51 files.
720
- - [ ] **DCO Sign-off**: All commits signed off using `git commit -s` ([Developer Certificate of Origin](https://developercertificate.org/)).
721
- - [ ] **Pre-Merge Trap Guardian**: Run `fastrmemory guard --strict` to verify no active error traps are violated.
722
-
723
- See [CONTRIBUTING.md](CONTRIBUTING.md) for full architectural guidelines, secret scrubbing rules, and local development environment setup.
724
-
725
- ---
726
-
727
- ## 📄 License
728
-
729
- Apache License 2.0. Built by **Fastrsoft**. Free for personal and commercial use.
1
+ <div align="center">
2
+
3
+ # ⚡ FastrMemory
4
+
5
+ ### High-Performance Cognitive Agent Memory Engine
6
+ **Zero Daemon • Native Node 22+ `node:sqlite` • Bi-Temporal Git Sync • Triple-Stream RRF • Official MCP v2**
7
+
8
+ [![CI](https://github.com/atifjubaer/fastrmemory/actions/workflows/ci.yml/badge.svg)](https://github.com/atifjubaer/fastrmemory/actions)
9
+ [![npm](https://img.shields.io/npm/v/fastrmemory?style=flat-square&logo=npm&label=npm)](https://www.npmjs.com/package/fastrmemory)
10
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg?style=flat-square)](LICENSE)
11
+ [![Node](https://img.shields.io/badge/Node-%3E%3D22.16.0-339933?style=flat-square&logo=node.js&logoColor=white)](https://nodejs.org)
12
+ [![Protocol](https://img.shields.io/badge/Protocol-MCP%20v2-7C3AED?style=flat-square)](https://modelcontextprotocol.io)
13
+ [![Tests](https://img.shields.io/badge/Tests-293%20Passed-brightgreen?style=flat-square)](tests/)
14
+ [![MCP Setup](https://img.shields.io/badge/MCP%20Setup-fastr%20mcp%20init-7C3AED?style=flat-square)](#-one-click-agent-mcp-configuration)
15
+ [![Architecture](https://img.shields.io/badge/Architecture-Zero--Daemon%20WAL-orange?style=flat-square)](#-architecture)
16
+
17
+ > **Status (2026-10-23):** **`fastrmemory@0.3.1` is published and is `latest`; `0.4.0` is prepared on `main` and is not tagged or published.** Evidence for 0.3.1: `npm view fastrmemory version` -> `0.3.1`; `npm view fastrmemory dist-tags --json` -> `{"latest":"0.3.1"}`; tag `v0.3.1` (`3a3cac6`); published 2026-10-22 23:02 UTC via GitHub Actions OIDC with npm provenance; GitHub Release tarball SHA-256 `747f61791dcb7c5694f3cf5cc8705152892a5b16cb33bec51a356fc22112a7b8`; `npm install -g fastrmemory@0.3.1` + `fastr --version` -> `0.3.1`. Caveat: Node.js >=22.16.0; the npm README for 0.3.1 was rendered at the release tag and still labels 0.3.1 the release target; this post-release docs commit is not part of that render; `0.3.0` remains published historical. This release replaces the stale `0.3.0` npm README, fixes Windows MCP commands, pins user-scoped clients to the project root, and adds the Node runtime guard. The old scoped npm entries (`@atifjubaer/fastrmemory` and `fastrmemory@0.0.0-stage`) were removed on 2026-10-23; the GitHub `v0.2.1` tag and release remain as history. This README tracks current `main`; published release evidence remains **0.3.1**. Use the exact `0.3.1` version for reproducibility. `0.4.0` adds `fastr mcp init` and LF checkout enforcement; those changes are not in the published `0.3.1` tarball. Until `0.4.0` is published, `npx fastrmemory@latest mcp init` still resolves to `0.3.1` and does not include the command; use the source-checkout path in the MCP setup section. CI run `39879595191` at `098100e` (the 0.4.0 preparation commit) passed all six matrix jobs on 2026-10-23, including Windows Node `22.x` and `24.x`. The release post for 0.2.1 remains at [docs/blog/2026-10-21-fastrmemory-0.2.1.md](docs/blog/2026-10-21-fastrmemory-0.2.1.md). The exact release surface is in [CHANGELOG.md](CHANGELOG.md). The headline benchmark uses **240 deterministic synthetic cases with a 20% holdout**, not SWE-bench or LongMemEval. Public LongMemEval, LoCoMo, and self-repository retrieval-only results plus pinned external baselines are in [BENCHMARKS.md](BENCHMARKS.md); no QA-leaderboard parity is claimed. Performance, packaging, and retrieval claims are tracked in [CLAIMS.md](CLAIMS.md); every README section is mapped to claim IDs in the README claim trace at the end of that ledger. Methodology, caveats, and raw JSON are in [BENCHMARKS.md](BENCHMARKS.md).
18
+
19
+ <p align="center">
20
+ <a href="#-overview">Overview</a> &bull;
21
+ <a href="#-design-principles">Design Principles</a> &bull;
22
+ <a href="#-retrieval-benchmark-240-synthetic-cases">Benchmarks</a> &bull;
23
+ <a href="#-local-web-dashboard">Web UI</a> &bull;
24
+ <a href="#-works-with-mcp--and-http-compatible-agents">Supported Agents</a> &bull;
25
+ <a href="#-quick-start">Quick Start</a> &bull;
26
+ <a href="#-one-click-agent-mcp-configuration">MCP Setup</a> &bull;
27
+ <a href="#-mcp-server-tools--resources">MCP Tools</a> &bull;
28
+ <a href="#-architecture">Architecture</a> &bull;
29
+ <a href="MIGRATION.md">Migration</a> &bull;
30
+ <a href="SECURITY.md">Security</a> &bull;
31
+ <a href="SCORECARD.md">Scorecard</a>
32
+ </p>
33
+
34
+ </div>
35
+
36
+ ---
37
+
38
+ ## Launch Status at a Glance
39
+
40
+ | Claim | Current result | Evidence |
41
+ |---|---|---|
42
+ | Install path | Published `fastrmemory@0.3.1`; `0.4.0` prepared on `main`, not published | `npm view fastrmemory version` -> `0.3.1`; `npm view fastrmemory dist-tags --json` -> `{"latest":"0.3.1"}`; `npm install -g fastrmemory@0.3.1`; `fastr --version` -> `0.3.1`; GitHub Release tarball SHA-256 `747f6179...`; old scoped npm entries removed |
43
+ | Synthetic retrieval | Holdout `95.8%` Hit@1, `100%` Hit@5, MRR `0.969` | `npx tsx scripts/eval-bench.ts --split all --embeddings minilm --out bench/results/minilm.json` |
44
+ | Test suite | `293` tests across `53` files on current HEAD; published `0.3.1` is `282` / `52`; v0.2.1 is `235` / `43` | `npm test` |
45
+ | MCP setup (0.4.0 prepared) | `fastr mcp init` merges portable configs for 9 JSON clients and prints a Codex TOML snippet | `npm test -- tests/mcp-init.test.ts` -> `11 passed`; `fastr mcp init --client claude --dry-run` |
46
+ | Crash safety | 10/10 runs, 0 lost, 0 duplicate ids/titles | `npm run test:crash`; `bench/results/crash-test.json` |
47
+ | Public retrieval (0.3.0) | LongMemEval `+10.4pp` / `+11.0pp` Hit@5; LoCoMo `+4.4pp` / `+2.3pp` (target missed) | [docs/EXTERNAL_BASELINE.md](docs/EXTERNAL_BASELINE.md) |
48
+ | Release score | Provisional `9.4 / 10`; `9.2` target met; Retrieval remains Partial | [SCORECARD.md](SCORECARD.md) |
49
+
50
+ The synthetic table is not SWE-bench or LongMemEval. Public numbers are retrieval-only and are not QA-leaderboard results. Full provenance is in [CLAIMS.md](CLAIMS.md).
51
+
52
+ ---
53
+
54
+ ## 💡 Overview
55
+
56
+ AI coding agents (Claude Code, Cursor, Windsurf, Codex, Antigravity) degrade on long-running codebases when project memory is lossy or operationally heavy. Common designs make one of three trade-offs:
57
+ - **Decay and merge** old episodes to keep the store small, which can lose exact file paths, stack traces, and edge cases.
58
+ - **Run a daemon or external database**, which adds ports, containers, and setup failure modes.
59
+ - **Dump a static context file**, which grows without bound and is not queryable.
60
+
61
+ **FastrMemory** keeps a verbatim event log, bi-temporal memory history, and a replayable Git mirror in a **single in-process TypeScript engine** (3 runtime dependencies; local embeddings and the daemon are optional):
62
+
63
+ <table>
64
+ <tr>
65
+ <td width="33%" align="center">
66
+
67
+ ### ⚡ Zero Daemon Overhead
68
+ Pure Node 22+ built-in `node:sqlite` in WAL mode. On the 240-case suite, engine-level recall is **0.95 ms p50 / 1.60 ms p95** with hash embeddings and **3.30 ms p50 / 5.11 ms p95** with MiniLM on the train split (CLI startup measured separately). The default CLI/MCP path has no background daemon and no open port; `daemon start` is optional. Native on Windows, macOS, and Linux (the current CI matrix uses Intel macOS; Apple Silicon is not covered); CI matrix status is reported in [Actions](https://github.com/atifjubaer/fastrmemory/actions).
69
+
70
+ </td>
71
+ <td width="33%" align="center">
72
+
73
+ ### 🔀 Bi-Temporal Git Sync
74
+ Never deletes facts during consolidation (there is no destructive sleep step). Replaces half-life decay with `valid_from` / `valid_to` timestamps and auto-mirrors human-readable `.fastr/pages/*.md` files into Git.
75
+
76
+ </td>
77
+ <td width="33%" align="center">
78
+
79
+ ### 🎯 Triple-Stream RRF ($k=20$)
80
+ Fuses FTS5 BM25 + optional local embeddings + file-graph links. Error traps receive a **conditional 2.0x boost** only for trap-intent or file-scoped queries, with per-ID outcome feedback (+0.2 / -0.5). Three consecutive bad outcomes move a memory to dormant; confidence tiers are `high`, `medium`, `low`, `dormant`, and `superseded`.
81
+
82
+ </td>
83
+ </tr>
84
+ </table>
85
+
86
+ ---
87
+
88
+ ## 🧭 Design Principles
89
+
90
+ | Principle | Implementation |
91
+ | :--- | :--- |
92
+ | **Lossless by default** | Raw events, bi-temporal `valid_from` / `valid_to`, and supersession chains are retained. Nothing is destroyed by consolidation. |
93
+ | **Zero daemon by default** | One Node 22+ process uses built-in `node:sqlite` in WAL mode. The default CLI/MCP path opens no ports or background services; `daemon start` is optional. |
94
+ | **Replayable** | Git-diffable Markdown mirrors plus snapshots and rollback keep history inspectable. |
95
+ | **Measured, not asserted** | Public claims are tied to committed benchmark JSON with a 20% holdout; simulated baselines are labeled as simulations. |
96
+
97
+ ---
98
+
99
+ ---
100
+
101
+ ## 🤖 Works With MCP- and HTTP-Compatible Agents
102
+
103
+ FastrMemory exposes one stdio MCP server and optional local HTTP services (dashboard and daemon). **Native installers wire Claude Code (MCP config plus lifecycle hooks), Cursor (MCP config plus skills), and, since 0.3.0, Gemini CLI, GitHub Copilot CLI, and OpenCode V2** (`fastrmemory hook install`); `fastrmemory setup` also writes MCP configs for Antigravity, Claude Desktop, and Windsurf. Every other client connects through its own MCP configuration or the REST API. Integration depth varies by client - only the native installers are covered by tests in this repository.
104
+
105
+ Clients commonly used with FastrMemory include Codex CLI, Gemini CLI, OpenCode, GitHub Copilot CLI, Antigravity, Claude Desktop, Cline, Continue, Roo Code, Goose, Zed, Warp, and Aider. Listing a client does **not** imply a tested native integration.
106
+
107
+ ---
108
+
109
+ ## 🚀 Quick Start
110
+
111
+ ### ⚡ Run Without a Global Install
112
+
113
+ The canonical package target is unscoped `fastrmemory@0.3.1`. `0.4.0` is prepared on `main` but is not published; keep using `0.3.1` for installs until the release workflow completes. The old scoped npm entries were removed on 2026-10-23.
114
+
115
+ ```bash
116
+ # Canonical one-shot (pins the exact release):
117
+ npx -y fastrmemory@0.3.1 setup
118
+
119
+ # Or launch the local Web UI:
120
+ npx -y fastrmemory@0.3.1 ui
121
+ ```
122
+
123
+ The GitHub source path remains available for development only: `npx github:atifjubaer/fastrmemory setup`. For a reproducible source install, pin the tag: `npx github:atifjubaer/fastrmemory#v0.3.1 setup`. The current `main` contains the unpublished `0.4.0` source. Do not use either GitHub form in generated MCP or hook configs; those must use the npm package. The default `latest` channel tracks new releases, and `--channel pinned` records the exact version for reproducibility.
124
+
125
+ ---
126
+
127
+ ### Install from npm
128
+
129
+ ```bash
130
+ # Canonical install (latest is 0.3.1):
131
+ npm install -g fastrmemory
132
+ fastr --version
133
+
134
+ # Exact release:
135
+ npm install -g fastrmemory@0.3.1
136
+ ```
137
+
138
+ For a one-shot run without a global install:
139
+
140
+ ```bash
141
+ npx -y fastrmemory@0.3.1 --version
142
+ ```
143
+
144
+ `0.3.1` is built from tag `v0.3.1` by `.github/workflows/release.yml`, which runs the full gate, publishes with npm provenance, and attaches the same tarball to the GitHub Release. Verify the registry result with `npm view fastrmemory@0.3.1 version` and `npm view fastrmemory dist-tags --json`; a first E404 for a few minutes is registry propagation, not a failed publish. The old scoped npm entries remain removed. Do not republish `0.3.0`. `0.4.0` is prepared on `main`; no tag `v0.4.0` and no npm publication exist as of 2026-10-23.
145
+
146
+ ### One-Command MCP Setup
147
+
148
+ `fastr mcp init` is the shadcn-style setup path. It is config-only: it merges the `fastrmemory` MCP entry into an existing client config, preserves unrelated keys, writes a one-time `.fastr.bak` backup, and is idempotent. It does not install lifecycle hooks, skills, or the OpenCode plugin; use `fastr hook install` for those.
149
+
150
+ ```bash
151
+ # Claude Code (project-scoped .mcp.json)
152
+ npx -y fastrmemory@latest mcp init --client claude
153
+
154
+ # Cursor
155
+ npx -y fastrmemory@latest mcp init --client cursor
156
+
157
+ # VS Code (.vscode/mcp.json)
158
+ npx -y fastrmemory@latest mcp init --client vscode
159
+
160
+ # OpenCode (opencode.json)
161
+ npx -y fastrmemory@latest mcp init --client opencode
162
+
163
+ # Gemini CLI and GitHub Copilot CLI
164
+ npx -y fastrmemory@latest mcp init --client gemini,copilot
165
+
166
+ # Every project-scoped client at once
167
+ npx -y fastrmemory@latest mcp init --client all --scope project
168
+ ```
169
+
170
+ The same command through the other package runners:
171
+
172
+ ```bash
173
+ pnpm dlx fastrmemory@latest mcp init --client claude
174
+ yarn dlx fastrmemory@latest mcp init --client claude
175
+ bunx fastrmemory@latest mcp init --client claude
176
+ ```
177
+
178
+ The default `--channel latest` writes `fastrmemory@latest`, so a client restart picks up the newest npm release. Use `--channel pinned` for a reproducible config containing the exact version that ran the command; on current `main` that writes `fastrmemory@0.4.0`, which is not installable from npm until the release publishes. `--runner pnpm|yarn|bunx` changes the generated runner, `--profile core` selects the 12-tool surface, `--dry-run` prints targets without writing, and `--scope user` writes user-level configs with an explicit `--project /absolute/path` so the server always opens the intended database. Codex prints a `[mcp_servers.fastrmemory]` TOML block for `~/.codex/config.toml` instead of rewriting a user-owned TOML file.
179
+
180
+ > `mcp init` is prepared in `0.4.0` on `main`; `0.4.0` is not tagged or published as of 2026-10-23, and `npx fastrmemory@latest mcp init` still resolves to published `0.3.1`. Until `0.4.0` publishes, run the same commands from a source checkout (`npx --yes github:atifjubaer/fastrmemory#main mcp init ...`) or after `npm run build:core` with `node bin/fastr-guard.mjs mcp init ...`.
181
+
182
+ ### Install from GitHub
183
+
184
+ For a one-shot source run, pin the release tag:
185
+
186
+ ```bash
187
+ npx --yes github:atifjubaer/fastrmemory#v0.3.1 --version
188
+ npx --yes github:atifjubaer/fastrmemory#v0.3.1 setup
189
+ ```
190
+
191
+ For a global CLI without npm's Git resolver, download the release tarball:
192
+
193
+ ```bash
194
+ curl -L -o fastrmemory-0.3.1.tgz \
195
+ https://github.com/atifjubaer/fastrmemory/releases/download/v0.3.1/fastrmemory-0.3.1.tgz
196
+ npm install -g ./fastrmemory-0.3.1.tgz
197
+ fastr --version
198
+ ```
199
+
200
+ On Windows, download the same URL with `Invoke-WebRequest` or a browser, then run `npm install -g .\fastrmemory-0.3.1.tgz`. For a local project install, use `npm install --no-save ./fastrmemory-0.3.1.tgz` instead of the global flag.
201
+
202
+ > Git installs build from source and are slower than the npm tarball; for a global CLI, prefer the npm package or the release tarball above. `npm install -g git+https://...` is not recommended with npm 11 because the `prepare` build does not receive dev dependencies. Both `fastrmemory` and `fastr` (short alias) are executable after installation. The canonical package is unscoped `fastrmemory@0.3.1`; the old scoped npm entries are gone. Use npm for generated MCP and hook configs so installs stay reproducible.
203
+
204
+ ### 2. Verify Database Health
205
+
206
+ ```bash
207
+ fastrmemory status
208
+ ```
209
+
210
+ Output:
211
+ ```text
212
+ === FastrMemory Health (my-project) ===
213
+ - Project ID: proj_1cce2a654e3a
214
+ - Active Memories: 2
215
+ - Staging Memories: 0
216
+ - Superseded History: 0
217
+ - Ingested Events: 0
218
+ - Pending Spool: Clear (0)
219
+ - Database File: .fastr/fastr.db
220
+ ```
221
+
222
+ ### 3. Record & Recall a Memory
223
+
224
+ ```bash
225
+ # Record an error trap linked to an exact file:
226
+ fastrmemory remember "Never Use Date.now() Milliseconds for JWT Expiration" \
227
+ -c "JWT exp claims expect integer seconds. Always use Math.floor(Date.now() / 1000)." \
228
+ -m auth -k error_trap -f "src/auth/jwt.ts" --verified
229
+
230
+ # Recall with conditional 2.0x trap boost & file-graph matching:
231
+ fastrmemory recall "JWT expiration" -f "src/auth/jwt.ts"
232
+ ```
233
+
234
+ Output:
235
+ ```text
236
+ === Recalled Memories (1 results, ~46 tokens) ===
237
+
238
+ [mem_009e4a7d] [TRAP] [verified] Never Use Date.now() Milliseconds for JWT Expiration (Score: 0.08)
239
+ JWT exp claims expect integer seconds. Always use Math.floor(Date.now() / 1000).
240
+ ```
241
+
242
+ Open contradictions are marked on both sides of the recall result instead of being silently mixed into context (**0.3.0**):
243
+
244
+ ```bash
245
+ # Inspect unresolved contradictions:
246
+ fastrmemory conflict list
247
+
248
+ # Keep the rule that matches the project and supersede the loser:
249
+ fastrmemory conflict resolve 1 --keep mem_009e4a7d --forget --reason "Seconds are the project standard"
250
+ ```
251
+
252
+ #### Import Existing Local Rules (**0.3.0**)
253
+
254
+ Bring `AGENTS.md`, `CLAUDE.md`, or `.cursor/rules/*.mdc` content into memory without hand-copying every section. Level 2+ headings become memories; bullet lists and paragraphs are fallbacks. Re-importing the same file skips exact duplicates.
255
+
256
+ ```bash
257
+ # Preview the parsed sections without writing:
258
+ fastrmemory import AGENTS.md --from agents-md --module rules --dry-run
259
+
260
+ # Import as staging memories for review, or verify them immediately:
261
+ fastrmemory import AGENTS.md --from agents-md --module rules
262
+ fastrmemory import AGENTS.md --from agents-md --module rules --verified
263
+
264
+ # JSONL snapshots use the same entry point:
265
+ fastrmemory import snapshot.jsonl --from jsonl
266
+ ```
267
+
268
+ ### 4. Cognitive Git Blame & Memory-Aware Commit
269
+
270
+ ```bash
271
+ # Cognitive Git Blame linking lines directly to commit, author, and governing error traps (conditional 2.0x boost):
272
+ fastrmemory blame src/auth/jwt.ts:42
273
+
274
+ # Pre-commit error trap validation & conventional commit synthesis:
275
+ fastrmemory commit
276
+ ```
277
+
278
+ ### 5. Git Snapshots, Branches, Rollback & Background Daemon (branches are **0.3.0**)
279
+
280
+ ```bash
281
+ # Point-in-time memory snapshot (Git for Agent Memory):
282
+ fastrmemory snapshot create "pre-refactor-checkpoint"
283
+ fastrmemory snapshot list
284
+ fastrmemory snapshot rollback "pre-refactor-checkpoint"
285
+
286
+ # 0.3.0: Portable backup with a sidecar provenance manifest:
287
+ fastrmemory backup backups/pre-upgrade.jsonl
288
+ fastrmemory backup --verify backups/pre-upgrade.jsonl
289
+ fastrmemory backup --restore backups/pre-upgrade.jsonl --dry-run
290
+
291
+ # Immutable memory branch and one-way merge with a conflict report:
292
+ fastrmemory branch create feature/auth
293
+ fastrmemory branch list
294
+ fastrmemory merge feature/auth
295
+ fastrmemory merge feature/auth --force --strategy branch
296
+
297
+ # Hybrid Background Daemon (Optional HTTP/SSE service for cross-process tools):
298
+ fastrmemory daemon start
299
+ fastrmemory daemon status
300
+ fastrmemory daemon stop
301
+
302
+ # Auto-wire MCP configs, lifecycle hooks, and Planetary Skills into Claude Code, Cursor,
303
+ # Gemini CLI, GitHub Copilot CLI, and OpenCode; setup also wires Antigravity, Claude Desktop, and Windsurf:
304
+ fastrmemory hook install
305
+ fastrmemory setup
306
+
307
+ # Mine past Git bug fixes directly into staging error traps:
308
+ fastrmemory learn -n 30 --days 90
309
+ ```
310
+
311
+ Branches are immutable snapshot pointers. `merge` is one-way into the current active set: branch-only memories are added, target-only memories are preserved, and same-identity changes are reported as conflicts. Conflicts block writes by default; `--force` applies non-conflicting additions, and `--force --strategy branch` supersedes the target while keeping old rows in history. Branch checkout or a mutable branch working tree is not implemented.
312
+
313
+ `backup` writes the portable JSONL snapshot plus `<file>.manifest.json` with the file SHA-256, content hash, record counts, tool version, environment, and source integrity. `--restore` verifies both hashes before importing; `--dry-run` reports counts without writing. The backup scope is memories, raw events, file links, and conflicts, not a physical SQLite/WAL copy. See [MIGRATION.md](MIGRATION.md) for the full backup and rollback path.
314
+
315
+ ### 6. Token Compression, Database Doctor & Vision Search
316
+
317
+ ```bash
318
+ # Compress markdown docs & LLM prompt context to reduce token usage:
319
+ fastrmemory compress docs/architecture.md --dry-run
320
+
321
+ # Run deep health check across SQLite, FTS5 indices, file links, and task DAGs:
322
+ fastrmemory diagnose
323
+
324
+ # Auto-repair FTS5 indices, orphaned file links, and WAL fragmentation:
325
+ fastrmemory heal
326
+
327
+ # 0.3.0: Report orphaned records, duplicate active memories, and stale rows:
328
+ fastrmemory hygiene
329
+ fastrmemory hygiene --stale-days 30 --json --fail-on-issues
330
+
331
+ # Tag a UI screenshot or architecture diagram with OCR & 384-dim vector indexing:
332
+ fastrmemory vision tag screenshots/modal-error.png --desc "Modal error 401 alert" --ocr "HTTP 401"
333
+
334
+ # Semantic search across tagged screenshots and visual diagrams:
335
+ fastrmemory vision search "modal error 401"
336
+
337
+ # Pre-merge CI/CD gate checking PR diffs against active error traps:
338
+ fastrmemory guard --strict
339
+ ```
340
+
341
+ `fastrmemory hygiene` reports orphaned file links, conflict rows, and feedback rows; duplicate active memories by normalized title or exact content; and stale unpinned active memories (default 90 days since the last recall or creation). `npm run check:hygiene` runs the same inspector against a deterministic fixture inside `check:ci`; it does not mutate a project database. Use `--fail-on-issues` when a script should exit nonzero on findings.
342
+
343
+ ---
344
+
345
+ ## 🔌 One-Click Agent MCP Configuration
346
+
347
+ `fastr mcp init` is the one-command path for MCP-only wiring. It writes the platform-correct runner (`npx`, `pnpm dlx`, `yarn dlx`, or `bunx`; `cmd /c ...` on native Windows), preserves unrelated config keys, and is idempotent. `fastr setup` remains the full installer for `.fastr/`, `AGENTS.md`, skills, and lifecycle hooks; `fastr hook install` remains the hook-only path.
348
+
349
+ `fastr hook install` merges lifecycle hooks for Claude Code, Cursor, Gemini CLI, GitHub Copilot CLI, and OpenCode, and writes the OpenCode context/compaction plugin. Gemini CLI requires strict JSON on hook stdout; Copilot returns `permissionDecision: "ask"` for an active trap because it has no model-facing advisory field for `preToolUse`.
350
+
351
+ | Client | Project config | User config | JSON key |
352
+ | :--- | :--- | :--- | :--- |
353
+ | Claude Code | `.mcp.json` | `~/.claude.json` | `mcpServers` |
354
+ | Cursor | `.cursor/mcp.json` | `~/.cursor/mcp.json` | `mcpServers` |
355
+ | VS Code | `.vscode/mcp.json` | VS Code `User/mcp.json` | `servers` |
356
+ | OpenCode | `opencode.json` | project only | `mcp.servers` |
357
+ | Gemini CLI | `.gemini/settings.json` | `~/.gemini/settings.json` | `mcpServers` |
358
+ | GitHub Copilot CLI | `.github/mcp.json` | project only | `mcpServers` |
359
+ | Windsurf | user only | `~/.codeium/windsurf/mcp_config.json` | `mcpServers` |
360
+ | Antigravity | user only | `~/.gemini/antigravity/mcp_config.json` | `mcpServers` |
361
+ | Claude Desktop | user only | platform-specific | `mcpServers` |
362
+ | Codex | user only | `~/.codex/config.toml` | printed TOML |
363
+
364
+ Example POSIX project config generated by `fastr mcp init --client cursor` (Windows uses `cmd /c npx ...`):
365
+
366
+ ```json
367
+ {
368
+ "mcpServers": {
369
+ "fastrmemory": {
370
+ "command": "npx",
371
+ "args": ["-y", "fastrmemory@latest", "mcp"]
372
+ }
373
+ }
374
+ }
375
+ ```
376
+
377
+ VS Code uses `servers` instead of `mcpServers`; OpenCode uses `mcp.servers` with a command array and `"type": "local"`. Existing `opencode.json(c)` settings are preserved, but a JSONC config is reported for manual wiring rather than rewritten. Codex is always printed as a `[mcp_servers.fastrmemory]` TOML block because rewriting a user-owned TOML file safely requires a dedicated parser.
378
+
379
+ For user-scoped clients, the generated entry includes `--project /absolute/path/to/repo`; this prevents the client's launch directory from selecting the wrong database. `fastr setup` also writes the absolute `node` path and is the recommended path when the client cannot launch package-runner shims. On native Windows, `fastr mcp init` automatically emits `"command": "cmd"` with `"/c"` and the runner, so manual `npx.cmd` fixes are not needed.
380
+
381
+ ---
382
+
383
+ ## 🛠️ MCP Server: Tools & Resources
384
+
385
+ Built using the official **v2 `@modelcontextprotocol/server`** SDK. The tool list below describes **0.4.0** (prepared; unchanged from 0.3.1); the v0.2.1 release has 4 resources.
386
+
387
+ ### 41 MCP Tools
388
+
389
+ The default **full profile** exposes all 41 tools. For a smaller schema, start the **core profile** with `fastrmemory mcp --profile core` or `FASTR_MCP_PROFILE=core`; it exposes the 12-tool daily loop: `fastr_recall`, `fastr_remember`, `fastr_handoff`, `fastr_trap_recall`, `fastr_trap_log`, `fastr_status`, `fastr_get`, `fastr_timeline`, `fastr_diff`, `fastr_replay`, `fastr_compress`, and `fastr_diagnose`. Resources and prompts are the same in both profiles. Pass `--project /absolute/path/to/repo` when the host starts the server outside the repository, so memory is written to the intended `.fastr/fastr.db`.
390
+
391
+ #### Cognitive Retrieval & Memory Core
392
+ 1. `fastr_recall`: Triple-stream hybrid search (BM25 + Vector + Spreading Activation Graph) with progressive L0–L3 token budgeting and air-gapped offline vector fallback.
393
+ 2. `fastr_get`: Retrieves complete memory details (including status, timestamps, reward scores, and full content) by memory ID.
394
+ 3. `fastr_list`: Lists memories with bounded filtering by module, kind, status, limit, and offset.
395
+ 4. `fastr_drill`: Resolves `source_event_ids` to retrieve untruncated verbatim stack traces, diffs, and tool outputs from `raw_events`.
396
+ 5. `fastr_file_history`: Returns active rules, `[TRAP]` warnings, and past supersessions for a specific file path.
397
+ 6. `fastr_remember`: Records new rules, decisions, or traps. Automatically extracts NER entities, scrubs secrets, and re-renders Markdown mirrors. Supports `scope: 'project' | 'global'`.
398
+ 7. `fastr_pin`: Pins critical rules so they are permanently preserved and prioritized in L0 assembly without time decay.
399
+ 8. `fastr_forget`: Tombstones and deactivates an outdated memory cleanly with audit logging.
400
+ 9. `fastr_supersede`: Retires an outdated rule (`valid_to = now`), records the rationale, and inserts a replacement verified rule.
401
+ 10. `fastr_feedback`: Updates `reward_score` and the confidence tier on one memory ID (+0.2 good, -0.5 bad). Three consecutive bad outcomes make it dormant; never penalizes innocent memories.
402
+ 11. `fastr_handoff`: Saves or retrieves cross-agent session milestones and promotes staging memories to verified.
403
+ 12. `fastr_status`: Returns active/staging counts, spool health, and embedding coverage %.
404
+ 13. `fastr_graph_query`: Explores 1-hop and 2-hop structural file-link dependencies, entity links, and connected error traps.
405
+ 14. `fastr_timeline`: Chronological audit trail of memory events, newly verified rules, error traps, and historical supersessions.
406
+
407
+ #### Versioning & Error Traps
408
+ 15. `fastr_snapshot`: Creates named point-in-time memory snapshots for branch tracking and experiment safety.
409
+ 16. `fastr_rollback`: Instant Git-like rollback to any previous memory snapshot.
410
+ 17. `fastr_trap_log`: One-line rapid logging of error traps and bug solutions with a conditional 2.0x recall boost.
411
+ 18. `fastr_trap_recall`: Targeted lookup of high-priority error traps protecting specific target files before editing.
412
+
413
+ #### Proactive Contradiction Detection & Resolution
414
+ 19. `fastr_conflicts`: Proactive contradiction detection using Jaccard token overlap (minimum 0.35) and 50-word opposing-polarity analysis.
415
+ 20. `fastr_resolve`: Resolves contradictions by keeping preferred rule and superseding or weakening the loser.
416
+
417
+ #### Kahneman Planning Fallacy & Base-Rate Calibrator
418
+ 21. `fastr_predict`: Records effort/time/risk predictions and closes predictions with actual empirical outcomes.
419
+ 22. `fastr_predict_baserate`: Computes historical reference-class statistics (Mean, Median p50 ratio, MAE) to debias agent estimates.
420
+
421
+ #### Multi-Agent Action DAG & Frontier
422
+ 23. `fastr_action_create`: Creates structured work item actions with prerequisite (`requires`) and conflict (`conflicts_with`) constraints.
423
+ 24. `fastr_action_update`: Updates task lifecycle (`pending`, `active`, `done`, `blocked`), assignments, and memory crystallization.
424
+ 25. `fastr_frontier`: Computes unblocked, ready-to-execute frontier actions with satisfied dependencies.
425
+ 26. `fastr_next`: Atomically claims and returns the highest-priority frontier action for autonomous worker agents.
426
+
427
+ #### Bounded Working Memory & Obsidian Vault Export
428
+ 27. `fastr_slot_get`: Retrieves bounded working memory slot (e.g. `current_goal`, `user_preferences`, `active_hypothesis`).
429
+ 28. `fastr_slot_set`: Updates working memory slot with hard character ceiling enforcement to prevent context bloat.
430
+ 29. `fastr_slot_list`: Lists all working memory slots and active character usage.
431
+ 30. `fastr_obsidian_export`: Exports all memories, entities, and relationships into an Obsidian-compatible markdown vault with YAML frontmatter, `[[wikilinks]]`, and `MOC.md`.
432
+
433
+ #### Multi-Repository Federation & Context Assembly
434
+ 31. `fastr_federate`: Manages cross-repository organization-wide shared rules and error traps via SQLite native `ATTACH DATABASE` (`~/.fastr/global.db`).
435
+ 32. `fastr_assemble`: Dynamically formats and packs high-density structured prompt context (`<fastr_context>`) with token budgeting.
436
+ 33. `fastr_risk_predict`: Computes historical failure probability and active trap hazard score for target codebase files.
437
+ 34. `fastr_verify_provenance`: Cryptographically verifies SHA-256 provenance hashes for recorded agent attribution.
438
+
439
+ #### Token Compression & Autonomous Doctor
440
+ 35. `fastr_compress`: Compresses markdown files or prompt context while strictly preserving headings, URLs, and code blocks with `.original.md` backup.
441
+ 36. `fastr_diagnose`: Deep health audit of SQLite B-Tree integrity, FTS5 BM25 search indices, orphaned file links, and task DAGs.
442
+ 37. `fastr_heal`: Automatic repair of database indices, dangling edges, and WAL page reclamation.
443
+
444
+ #### Memory Replay & Diff
445
+ 38. `fastr_replay`: Reconstructs memory state at a timestamp and returns the active snapshot for audit or recovery.
446
+ 39. `fastr_diff`: Compares two snapshots and reports added, superseded, and removed memories.
447
+
448
+ #### Multimodal Visual Memory
449
+ 40. `fastr_vision_tag`: Tags screenshots, UI diagrams, and wireframes with OCR and semantic descriptions with 384-dim embeddings.
450
+ 41. `fastr_vision_search`: Hybrid vector and keyword search across stored visual assets for multimodal coding agents.
451
+
452
+ ### 2 MCP Prompt Templates
453
+
454
+ - `pre-edit-check`: Given file paths, instructs the agent to check traps and relevant rules before editing.
455
+ - `session-wrap-up`: End-of-session checklist for logging traps, superseding stale rules, scoring memories, and saving a handoff.
456
+
457
+ ### 5 MCP Resources (0.3.0; v0.2.1 has 4)
458
+
459
+ - `fastr://project/overview`: L0 project summary containing active counts and storage location.
460
+ - `fastr://project/traps`: All active `[TRAP]` warnings for immediate bug avoidance.
461
+ - `fastr://session/handoff`: Latest cross-agent handoff milestone.
462
+ - `fastr://memory/{id}` (resource template): Full JSON for a single memory, including linked files and its validity window.
463
+ - `fastr://memory/{id}/envelope` (resource template): Metadata, cryptographic provenance, file/graph links, and open/resolved conflict state for one memory.
464
+
465
+ ---
466
+
467
+ ## 📄 Two-Zone Git-Diffable Mirror
468
+
469
+ Every write to the local SQLite database automatically synchronizes human-readable markdown files in `.fastr/pages/<module>.md`. This allows developers to review AI memories directly in GitHub Pull Requests:
470
+
471
+ ```markdown
472
+ # Module: auth
473
+
474
+ > Auto-generated by FastrMemory. Active rules are at the top; superseded history is preserved below for Git diffs.
475
+
476
+ ---
477
+
478
+ ## Compiled Truth (Active Rules & Traps)
479
+
480
+ ### [mem_009e4a7d] [TRAP] Never Use Date.now() Milliseconds for JWT Expiration
481
+ - **Kind**: `error_trap`
482
+ - **Status**: `verified` (Reward Score: 1)
483
+ - **Linked Files**: `src/auth/jwt.ts`
484
+ - **Active Since**: `2026-10-18T21:46:20Z`
485
+
486
+ JWT exp claims expect integer seconds. Always use Math.floor(Date.now() / 1000).
487
+
488
+ ---
489
+
490
+ ## Append-Only Timeline (History & Superseded)
491
+
492
+ ### [EXPIRED 2026-10-18T20:00:00Z -> 2026-10-18T21:46:20Z] [mem_abc123] Token Signing
493
+ - **Superseded By**: `[mem_009e4a7d]`
494
+ - **Reason**: Standardized on integer seconds
495
+ - **Historical Status**: `superseded`
496
+
497
+ > Old implementation used milliseconds which failed expiration validation.
498
+ ```
499
+
500
+ ---
501
+
502
+ ## 🧠 Planetary Agent Skills Suite
503
+
504
+ FastrMemory ships 10 Agent Skills (in `skills/`, mirrored to `.cursor/skills/`) that tell agents *when* to use each memory tool. Install them as a Claude Code plugin (`.claude-plugin/`) or copy them with `fastrmemory setup`:
505
+
506
+ - [fastr-memory](skills/fastr-memory/SKILL.md): At the start of a task and before editing files: `fastr_trap_recall`, then `fastr_recall` / `fastr_assemble`.
507
+ - [fastr-trap-log](skills/fastr-trap-log/SKILL.md): The moment a failure is diagnosed: record it with `fastr_trap_log`.
508
+ - [fastr-session-commit](skills/fastr-session-commit/SKILL.md): When a task is done and tests pass: supersede, rate memories, and `fastr_handoff` with `verifyStaging`.
509
+ - [fastr-curate](skills/fastr-curate/SKILL.md): When storing durable lessons or fixing contradictions: dedupe, remember, supersede, resolve conflicts, snapshot/rollback.
510
+ - [fastr-setup](skills/fastr-setup/SKILL.md): When FastrMemory is not wired into Claude Code: `fastrmemory hook install`, `claude mcp add`, verify with `fastrmemory status`.
511
+ - [fastr-plan-estimate](skills/fastr-plan-estimate/SKILL.md): When estimating effort or risk: base rates, file risk, and closing predictions.
512
+ - [fastr-dag](skills/fastr-dag/SKILL.md): When work has dependent steps or several agents share a backlog.
513
+ - [fastr-doctor](skills/fastr-doctor/SKILL.md): When recall misses memories or the database looks unhealthy: diagnose, then heal.
514
+ - [fastr-compress](skills/fastr-compress/SKILL.md): When a doc or context block exceeds its token budget.
515
+ - [fastr-vision](skills/fastr-vision/SKILL.md): When screenshots or diagrams should be remembered or searched.
516
+
517
+ Run `npm run check:skills` to validate every tool call in the skills against `src/mcp/server.ts`.
518
+
519
+ ---
520
+
521
+ ## 🏗️ Architecture
522
+
523
+ ```mermaid
524
+ flowchart TD
525
+ subgraph Ingestion["1. Lossless Ingestion & Spool"]
526
+ Agent["AI Coding Agent\n(Claude Code, Cursor, Antigravity)"] --> Scrubber["Secret Scrubber\n(API Keys, Bearer, PEM)"]
527
+ Scrubber --> Spool{"SQLite Busy?"}
528
+ Spool -- Yes --> SpoolFile[".fastr/spool/pending.jsonl\n(async fallback)"]
529
+ Spool -- No --> DB
530
+ end
531
+
532
+ subgraph Storage["2. Bi-Temporal Storage & Git Mirror"]
533
+ DB[("Node 22 node:sqlite (WAL)\nraw_events | memories\nfile_links | handoffs")]
534
+ DB --> Mirror["Markdown Mirror Engine"]
535
+ Mirror --> Pages[".fastr/pages/<module>.md\nTop: ## Compiled Truth\nBottom: ## Append-Only Timeline"]
536
+ end
537
+
538
+ subgraph Search["3. Triple-Stream Hybrid Retrieval"]
539
+ Query["Recall / File Query"] --> FTS["Stream A: FTS5 BM25\n(Sub-millisecond)"]
540
+ Query --> Vec["Stream B: Xenova Vectors\n(all-MiniLM-L6-v2)"]
541
+ Query --> Graph["Stream C: file_links Graph\n(1-2 Hop Structural Match)"]
542
+ FTS & Vec & Graph --> RRF["RRF Fusion (k=20)\n+ Conditional 2.0x Error Trap Multiplier\n+ 1.25x Verified Multiplier"]
543
+ RRF --> Budget["Progressive Token Packer\nL0 (150t) | L1 (500t) | L2 (1500t) | L3 (4000t)"]
544
+ end
545
+
546
+ subgraph Protocol["4. Official MCP Protocol"]
547
+ Budget --> MCPServer["Official MCP v2 Server\n(@modelcontextprotocol/server)"]
548
+ MCPServer --> Tools["41 tools • 2 prompts • 5 resources"]
549
+ Tools --> Agent
550
+ end
551
+ ```
552
+
553
+ ---
554
+
555
+ ## 🧪 Testing & Verification
556
+
557
+ Run the comprehensive unit test suite:
558
+
559
+ ```bash
560
+ npm test
561
+ ```
562
+
563
+ All **293 tests pass** across **53 test files** on current HEAD (`0.4.0` prepared); published `0.3.1` has **282 tests / 52 files**, and v0.2.1 has **235 tests / 43 files**. Coverage includes database schema, WAL locking, offline spooling, bi-temporal supersession, secret scrubbing, two-zone rendering, automated benchmarks, snapshots/rollback, branch merge conflict reports, replay/diff, memory envelopes, confidence tiers and 3-bad dormancy, memory hygiene checks, Memory CI, conflict-aware recall, portable backup manifests and verified restore, local rule import, OpenCode V2, Gemini CLI, and Copilot CLI wiring, git-learner, cognitive blame, commit synthesis, hybrid background daemon, token compression, self-healing doctor, multimodal vision, web dashboard server, pre-merge trap guardian, UI loopback security boundaries, atomic installer configuration safety, and shadcn-style `mcp init` client config merges.
564
+
565
+ **CI performance gates:** `check:query-plans`, `check:recall-latency`, and `check:install-size` run inside `check:ci`. CI executes them on the canonical Ubuntu/Node 24 job; other matrix jobs set `FASTR_PERF_GATE=0` because timing is runner-sensitive, while functional tests still run on every matrix entry.
566
+
567
+ **Crash-safety evidence:** `npm run test:crash` kills the writer at randomized points across 10 runs, then reopens the WAL database. The committed report at [`bench/results/crash-test.json`](bench/results/crash-test.json) records **10,718 acknowledged writes**, **10,727 committed rows**, **0 lost**, **0 duplicate ids/titles**, and `PRAGMA integrity_check = ok`; methodology is in [`docs/audit/2026-10-21-crash-test.md`](docs/audit/2026-10-21-crash-test.md). `npm run check:crash` validates the report during `check:ci`. This is a process-crash test (`taskkill /F`), not a power-loss test; SQLite runs with `synchronous=NORMAL` in WAL mode.
568
+
569
+ ---
570
+
571
+ ## Retrieval Benchmark (240 synthetic cases)
572
+
573
+ Generated from [`bench/results/minilm.json`](bench/results/minilm.json) on **2026-10-20** at benchmark commit `562f461`. The corpus is deterministic: 120 memories and 240 queries, split into **192 train / 48 holdout (20%)**. The holdout was fixed before tuning and is reported separately. Reproduce with:
574
+
575
+ ```bash
576
+ npx tsx scripts/eval-bench.ts --split all --embeddings minilm --out bench/results/minilm.json
577
+ npx tsx scripts/eval-bench.ts --split all --embeddings hash --out bench/results/hash.json
578
+ ```
579
+
580
+ | Configuration | Split | Cases | Hit@1 | Hit@3 | Hit@5 | MRR | nDCG@10 | Context tokens | p50 |
581
+ | :--- | :--- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
582
+ | FastrMemory + MiniLM | Train | 192 | 96.4% | 99.0% | 100% | 0.976 | 0.982 | 208 | 3.30 ms |
583
+ | FastrMemory + MiniLM | **Holdout** | 48 | **95.8%** | **97.9%** | **100%** | **0.969** | **0.977** | 209 | 3.41 ms |
584
+ | FastrMemory BM25-only | Train | 192 | 79.7% | 90.6% | 100% | 0.868 | 0.900 | 203 | 0.48 ms |
585
+ | FastrMemory BM25-only | Holdout | 48 | 77.1% | 77.1% | 93.8% | 0.804 | 0.835 | 204 | 0.60 ms |
586
+ | Static dump - simulated baseline | Train | 192 | 2.1% | 6.3% | 8.3% | 0.055 | 0.081 | 3652 | 0.00 ms |
587
+ | Static dump - simulated baseline | Holdout | 48 | 0.0% | 0.0% | 8.3% | 0.025 | 0.056 | 3652 | 0.00 ms |
588
+
589
+ > **Caveats:** this is a deterministic synthetic corpus, not SWE-bench or LongMemEval. The static-dump row is a simulation implemented in this repository, not an external project. Separate public retrieval-only external baselines are documented in [docs/EXTERNAL_BASELINE.md](docs/EXTERNAL_BASELINE.md); the synthetic table does not measure them. Context tokens are the compact prompt text under a 250-token budget; the ranked result objects retain full memory content. Methodology, per-category breakdowns, ablations, and confidence intervals are in [BENCHMARKS.md](BENCHMARKS.md) and [docs/benchmark-report.md](docs/benchmark-report.md).
590
+
591
+ ## 🖥️ Local Web Dashboard v2 & 3D Brain Observatory
592
+
593
+ Visualize active rules, error traps, timeline audits, and interactive 3D memory constellations directly in your browser from bundled UI assets (no external service or database):
594
+
595
+ ```bash
596
+ fastrmemory ui
597
+ ```
598
+
599
+ - **Live URL**: `http://localhost:4242`
600
+ - **Dashboard v2 Architecture**: Built with **shadcn/ui**, **Tailwind CSS v4**, and **TanStack Query**, with SSE updates plus version polling for cross-process writes.
601
+ - **12 Focused Route Workspaces (0.3.0 adds `/replay`)**:
602
+ - `/`: Real-time system vitals, active trap alerts, recent memory feed, and quick-action shortcuts.
603
+ - `/memories`: Search, filter, and inspect memories with the slide-out **Memory Detail Sheet**, status toggles, pin, and 1-click forget.
604
+ - `/traps`: Dedicated **Error Trap Quarantine** displaying governing files, conditional boost conditions, and verified mitigation lessons.
605
+ - `/conflicts`: Proactive bi-temporal contradiction detection with side-by-side **Word Diff** and 1-click resolution (`Keep A`, `Keep B`, `Keep Both`).
606
+ - `/actions`: Real-time interactive **Action DAG Canvas** tracking task dependencies, worker assignments, and glowing unblocked frontier aura.
607
+ - `/graph`: Interactive file and entity relationship graph with 1-hop/2-hop inspection and memory drill-down.
608
+ - `/observatory`: High-performance **Three.js 3D Constellation Galaxy** with a smooth lerp camera, celestial star dust, glowing amber trap halos, and memory inspect modals.
609
+ - `/treemap`: Interactive high-DPI squarified treemap visualising memory strength bands and module density.
610
+ - `/search`: **Search Lab** evaluating triple-stream RRF retrieval with latency waterfall breakdown (BM25 vs Vector vs Graph).
611
+ - `/replay` (**0.3.0**): **Replay & Diff** workspace reconstructing the active set at two timestamps with snapshot metrics and added/superseded/changed/conflict review.
612
+ - `/health`: Autonomous SQLite self-healing Doctor with 1-click integrity diagnosis, FTS5 rebuild, and vacuum.
613
+ - `/settings`: Live database path, project configuration, and export controls.
614
+ - **Memory CI**: The PR diff workflow and comment lifecycle are documented in [docs/MEMORY_CI.md](docs/MEMORY_CI.md).
615
+ - **Dual Theme Support**: Light, dark, and system-preference modes.
616
+ - **Default Zero-Daemon Path**: The dashboard is served by the in-process Node.js HTTP server and embedded SQLite WAL mode; `fastrmemory daemon start` is an optional local REST/SSE service.
617
+
618
+ ---
619
+
620
+ ## 🧩 Native VS Code & Cursor Extension
621
+
622
+ Package and install the native FastrMemory Guardian extension for **VS Code** and **Cursor**:
623
+
624
+ ```bash
625
+ # Compile and package extension
626
+ npm run build:extension
627
+ npx @vscode/vsce package --no-dependencies
628
+
629
+ # Install into Cursor or VS Code
630
+ cursor --install-extension fastrmemory-vscode-0.1.0.vsix
631
+ ```
632
+
633
+ - **⚡ Status Bar Pill**: Displays active trap count in the status bar (`⚡ 3 Traps Active` or `⚡ 1 Trap on File`). Clicking opens an interactive QuickPick listing all active traps.
634
+ - **Amber Underlines**: Trapped files are underlined in amber with full hover mitigation instructions and conditional 2.0x boost conditions.
635
+ - **Problems Tab Integration**: Active error traps populate the IDE Problems panel as non-blocking warning diagnostics.
636
+ - **Zero Daemons**: Reads directly from `.fastr/fastr.db` via `node:sqlite`.
637
+
638
+ ---
639
+
640
+ ## 📄 License
641
+
642
+ Apache License 2.0. Built by **Fastrsoft**. Free for personal and commercial use.