smart-claude-memory-mcp 2.1.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 (104) hide show
  1. package/.claude-plugin/plugin.json +38 -0
  2. package/CHANGELOG.md +52 -0
  3. package/LICENSE +21 -0
  4. package/README.md +790 -0
  5. package/dist/chunker.js +33 -0
  6. package/dist/chunker.js.map +1 -0
  7. package/dist/config.js +23 -0
  8. package/dist/config.js.map +1 -0
  9. package/dist/curriculum/daemon.js +190 -0
  10. package/dist/curriculum/daemon.js.map +1 -0
  11. package/dist/curriculum/scanner.js +237 -0
  12. package/dist/curriculum/scanner.js.map +1 -0
  13. package/dist/index.js +429 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/lib/migrations.js +128 -0
  16. package/dist/lib/migrations.js.map +1 -0
  17. package/dist/ollama.js +59 -0
  18. package/dist/ollama.js.map +1 -0
  19. package/dist/project-detect.js +102 -0
  20. package/dist/project-detect.js.map +1 -0
  21. package/dist/project.js +26 -0
  22. package/dist/project.js.map +1 -0
  23. package/dist/sleep/daemon.js +215 -0
  24. package/dist/sleep/daemon.js.map +1 -0
  25. package/dist/sleep/miner.js +285 -0
  26. package/dist/sleep/miner.js.map +1 -0
  27. package/dist/supabase.js +405 -0
  28. package/dist/supabase.js.map +1 -0
  29. package/dist/telemetry/emit.js +19 -0
  30. package/dist/telemetry/emit.js.map +1 -0
  31. package/dist/telemetry/pruner.js +141 -0
  32. package/dist/telemetry/pruner.js.map +1 -0
  33. package/dist/telemetry/types.js +2 -0
  34. package/dist/telemetry/types.js.map +1 -0
  35. package/dist/tools/backlog.js +599 -0
  36. package/dist/tools/backlog.js.map +1 -0
  37. package/dist/tools/batch-freeze-patterns.js +243 -0
  38. package/dist/tools/batch-freeze-patterns.js.map +1 -0
  39. package/dist/tools/bloat-audit.js +101 -0
  40. package/dist/tools/bloat-audit.js.map +1 -0
  41. package/dist/tools/checkpoint.js +259 -0
  42. package/dist/tools/checkpoint.js.map +1 -0
  43. package/dist/tools/compact.js +60 -0
  44. package/dist/tools/compact.js.map +1 -0
  45. package/dist/tools/conflict.js +102 -0
  46. package/dist/tools/conflict.js.map +1 -0
  47. package/dist/tools/curriculum.js +225 -0
  48. package/dist/tools/curriculum.js.map +1 -0
  49. package/dist/tools/frozen-cache.js +106 -0
  50. package/dist/tools/frozen-cache.js.map +1 -0
  51. package/dist/tools/health.js +368 -0
  52. package/dist/tools/health.js.map +1 -0
  53. package/dist/tools/hygiene.js +309 -0
  54. package/dist/tools/hygiene.js.map +1 -0
  55. package/dist/tools/image.js +107 -0
  56. package/dist/tools/image.js.map +1 -0
  57. package/dist/tools/list-global-patterns.js +101 -0
  58. package/dist/tools/list-global-patterns.js.map +1 -0
  59. package/dist/tools/orchestrator.js +113 -0
  60. package/dist/tools/orchestrator.js.map +1 -0
  61. package/dist/tools/policy.js +90 -0
  62. package/dist/tools/policy.js.map +1 -0
  63. package/dist/tools/refactor.js +220 -0
  64. package/dist/tools/refactor.js.map +1 -0
  65. package/dist/tools/save.js +42 -0
  66. package/dist/tools/save.js.map +1 -0
  67. package/dist/tools/search.js +189 -0
  68. package/dist/tools/search.js.map +1 -0
  69. package/dist/tools/setup.js +868 -0
  70. package/dist/tools/setup.js.map +1 -0
  71. package/dist/tools/shared-schemas.js +24 -0
  72. package/dist/tools/shared-schemas.js.map +1 -0
  73. package/dist/tools/skills.js +174 -0
  74. package/dist/tools/skills.js.map +1 -0
  75. package/dist/tools/sleep.js +239 -0
  76. package/dist/tools/sleep.js.map +1 -0
  77. package/dist/tools/sovereign-constitution.js +319 -0
  78. package/dist/tools/sovereign-constitution.js.map +1 -0
  79. package/dist/tools/summarize.js +55 -0
  80. package/dist/tools/summarize.js.map +1 -0
  81. package/dist/tools/sync.js +255 -0
  82. package/dist/tools/sync.js.map +1 -0
  83. package/dist/tools/system_dashboard.js +181 -0
  84. package/dist/tools/system_dashboard.js.map +1 -0
  85. package/dist/tools/update-rule.js +15 -0
  86. package/dist/tools/update-rule.js.map +1 -0
  87. package/dist/tools/verification.js +333 -0
  88. package/dist/tools/verification.js.map +1 -0
  89. package/dist/trajectory/daemon.js +270 -0
  90. package/dist/trajectory/daemon.js.map +1 -0
  91. package/dist/trajectory/stripper.js +124 -0
  92. package/dist/trajectory/stripper.js.map +1 -0
  93. package/dist/trajectory/summarizer.js +77 -0
  94. package/dist/trajectory/summarizer.js.map +1 -0
  95. package/dist/transactions/checkpoint.js +272 -0
  96. package/dist/transactions/checkpoint.js.map +1 -0
  97. package/dist/verification-gate.js +43 -0
  98. package/dist/verification-gate.js.map +1 -0
  99. package/dist/version.js +16 -0
  100. package/dist/version.js.map +1 -0
  101. package/hooks/README.md +54 -0
  102. package/hooks/md-policy.py +497 -0
  103. package/marketplace.json +13 -0
  104. package/package.json +66 -0
package/README.md ADDED
@@ -0,0 +1,790 @@
1
+ <div align="center">
2
+
3
+ # Smart Claude Memory
4
+
5
+ ![Smart Claude Memory v2.1.0 Master Schematic](docs/assets/schematic.png)
6
+
7
+ *Master schematic — the definitive visual reference for the Smart Claude Memory v2.1.0 production baseline.*
8
+
9
+ **Hybrid cloud-local memory for Claude — semantic retrieval instead of context bloat.**
10
+
11
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.6-3178c6?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
12
+ [![Node](https://img.shields.io/badge/node-%E2%89%A520-43853d?logo=node.js&logoColor=white)](https://nodejs.org/)
13
+ [![MCP](https://img.shields.io/badge/MCP-1.29+-6e56cf)](https://modelcontextprotocol.io/)
14
+ [![pgvector](https://img.shields.io/badge/pgvector-HNSW-336791?logo=postgresql&logoColor=white)](https://github.com/pgvector/pgvector)
15
+ [![Ollama](https://img.shields.io/badge/Ollama-local%20embeddings-000)](https://ollama.com/)
16
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue)](#license)
17
+ [![Version](https://img.shields.io/badge/version-2.1.0-green)](#)
18
+ [![Developer](https://img.shields.io/badge/developer-NABILNET.AI-6e56cf?logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0id2hpdGUiPjxwYXRoIGQ9Ik0xMiAyTDIgNy4xN0wxMiAxMi4zM0wyMiA3LjE3WiIvPjwvc3ZnPg==)](https://nabilnet.ai)
19
+
20
+ **Developed by [NABILNET.AI](https://nabilnet.ai)**
21
+
22
+ </div>
23
+
24
+ ---
25
+
26
+ ## The problem
27
+
28
+ Claude sessions load `memory.md`, `rules.md`, `cloud.md`, and a dozen other context files at startup. Every token you spend on "what does this project do" is a token you can't spend on the actual task. At scale, you end up burning budget re-reading the same notes hundreds of times per week.
29
+
30
+ ## What this does
31
+
32
+ `smart-claude-memory` is a **Model Context Protocol server** that replaces "read every .md at startup" with "search them on demand." It chunks your markdown notes, embeds them with a local Ollama model, stores them in Supabase (pgvector), and exposes **twenty-three tools** to Claude spanning memory, vision, backlog, hygiene, orchestration, and system health. The elevator pitch:
33
+
34
+ | Tool | Purpose |
35
+ |---|---|
36
+ | `sync_local_memory` | Scan folders → **MD5 hash-gate** → chunk → embed → **bulk upsert**. Skips unchanged files. |
37
+ | `search_memory` | Semantic search + intent routing (archive / backlog / semantic) |
38
+ | `manage_backlog` | Per-project task handover with persistent archive |
39
+
40
+ See the [Toolbox](#toolbox) for the complete surface and [ARCHITECTURE.md](ARCHITECTURE.md) for the request-flow diagram.
41
+
42
+ Memory is strictly **per-project**: when you're in project A, Claude cannot see project B's notes. See [Multi-project isolation](#multi-project-isolation).
43
+
44
+ ---
45
+
46
+ ## System Architecture
47
+
48
+ The system operates under the Sovereign Orchestrator pattern with Autonomous Self-Healing. The diagrams below are mirrored from [ARCHITECTURE.md](ARCHITECTURE.md), which remains the canonical source of truth.
49
+
50
+ **Two independent planes by design:**
51
+
52
+ - **Local plane — Ollama.** Every byte of your notes is embedded on your own machine. Content never leaves your device in plaintext for vectorization. No per-token API fees, no third-party seeing your prompts.
53
+ - **Cloud plane — Supabase.** Durable storage, indexable across devices, cheap. Only the vectors + the source text live here — and only the text you explicitly choose to sync.
54
+
55
+ You get the privacy posture of local inference with the durability and cross-machine access of a managed Postgres.
56
+
57
+ ### Delegation Flow
58
+
59
+ ```mermaid
60
+ flowchart TD
61
+ subgraph ORC["Orchestrator (Main Session) — strategic context only"]
62
+ U[User request]
63
+ D[delegate_task]
64
+ S[sync_artefacts]
65
+ R[Report 2-para synthesis to user]
66
+ end
67
+
68
+ subgraph WRK["Background Worker (Isolated context)"]
69
+ E[Edits / Bash / Research]
70
+ G[refactor_guard gate]
71
+ H{Gate OK?}
72
+ HL[Self-Healing Loop]
73
+ RB[refactor_guard rollback]
74
+ SY[Emit 2-para synthesis]
75
+ end
76
+
77
+ U --> D
78
+ D -->|canonical worker prompt| E
79
+ E --> G
80
+ G --> H
81
+ H -->|pass| SY
82
+ H -->|fail| HL
83
+ HL -->|healed| G
84
+ HL -->|exhausted| RB
85
+ RB --> SY
86
+ SY -->|only synthesis returns| S
87
+ S --> R
88
+ ```
89
+
90
+ ### Autonomous Self-Healing Loop
91
+
92
+ ```mermaid
93
+ flowchart LR
94
+ G1[refactor_guard gate] -->|pass| DONE([Emit synthesis])
95
+ G1 -->|fail| AR[analyze_regression<br/>file + backups_to_compare]
96
+ AR --> CP[closest_prior backup<br/>smallest edit distance]
97
+ CP --> LF[Minimal local fix<br/>preserves feature intent]
98
+ LF --> G2[refactor_guard gate]
99
+ G2 -->|pass| DONE
100
+ G2 -->|fail and attempts lt max| NEXT[Change hypothesis]
101
+ NEXT --> AR
102
+ G2 -->|attempts equal max| RBK[refactor_guard rollback]
103
+ RBK --> DONE
104
+ ```
105
+
106
+ ### Multi-Stack Compiler Map
107
+
108
+ ```mermaid
109
+ flowchart TB
110
+ P[Project root] --> D{Detect stack}
111
+ D -->|package.json + tsconfig.json| TS[tsc --noEmit]
112
+ D -->|package.json only| NODE[npm run build / lint]
113
+ D -->|pubspec.yaml| FL[flutter analyze / dart analyze]
114
+ D -->|Cargo.toml| RS[cargo check]
115
+ D -->|pyproject.toml| PY[mypy / ruff]
116
+ D -->|go.mod| GO[go vet / go build]
117
+ TS --> OUT[Exit code + summarized output]
118
+ NODE --> OUT
119
+ FL --> OUT
120
+ RS --> OUT
121
+ PY --> OUT
122
+ GO --> OUT
123
+ ```
124
+
125
+ > See [ARCHITECTURE.md](ARCHITECTURE.md) for the full prose + §4 auto-generated file-tree + §5 version history.
126
+
127
+ ---
128
+
129
+ ## Multi-project isolation
130
+
131
+ Every chunk is tagged with a `project_id`. The MCP server auto-derives it from the **slugified basename of the current working directory** at startup:
132
+
133
+ ```
134
+ C:\Users\you\repos\acme-api → project_id = "acme-api"
135
+ ~/code/side-projects/note-taker → project_id = "note-taker"
136
+ ```
137
+
138
+ The SQL function `match_memory_chunks` enforces the filter **at the database layer** — not just in application code:
139
+
140
+ ```sql
141
+ where m.project_id = p_project_id
142
+ ```
143
+
144
+ Concretely: when you `cd` into `acme-api/` and launch Claude, calls to `search_memory` **cannot** return rows tagged `note-taker`. This is verified by [scripts/e2e-isolation-test.ts](scripts/e2e-isolation-test.ts), which seeds both projects with the same file name and proves zero cross-talk.
145
+
146
+ Need to reach into another project on purpose? Pass `project_id` explicitly:
147
+
148
+ ```
149
+ search_memory({ query: "auth flow", project_id: "acme-api" })
150
+ ```
151
+
152
+ ---
153
+
154
+ ## Toolbox
155
+
156
+ | Tool | Category | Summary |
157
+ |---|---|---|
158
+ | `sync_local_memory` | Memory | Hash-gated incremental sync of `.md` files; bulk upsert in 100-chunk batches; `force` re-embed; `auto_purge` with dry-run + verify-before-delete |
159
+ | `search_memory` | Memory | Intent routing — `archive` > `backlog` > `semantic`. Optional `metadata_filter` (e.g. `{ "type": "DECISION" }`) narrows via the GIN index before vector similarity. **Dual-scope by default (v2.0.0-rc1):** searches across the current project AND the reserved `'GLOBAL'` vault; pass `include_global: false` to restrict to the current project. Archive tasks never leak into vector results unless requested. |
160
+ | `list_global_patterns` | Memory | Browse-only enumeration of the reserved `'GLOBAL'` Knowledge Vault. Pure SQL — zero embedding cost. Filter by JSONB containment (same `metadata_filter` shape as `search_memory`). Pagination: `offset` + `limit` (default 10, max 50), sorted by `created_at DESC`. Tiered output: default returns a `content_preview` (≤120 chars); pass `include_content: true` for the full content. Distinct from `search_memory({ include_global: true })` — that's "find by meaning" (semantic), this is "enumerate by attribute" (deterministic). |
161
+ | `save_memory` | Memory | Save a typed memory chunk — embed via Ollama, upsert with `metadata.type` from the Sovereign Taxonomy (`DECISION` / `PATTERN` / `ERROR` / `LOG`). v2 canonical write path. **v2.0.0-rc1:** set `metadata.is_global: true` to route the row to the reserved `project_id: 'GLOBAL'` vault for cross-project visibility. **Sovereign Vetting:** when `is_global: true`, you MUST also supply `metadata.global_rationale` and the memory must pass the Cross-Project Test (Rule 10). |
162
+ | `summarize_memory_file` | Memory | LLM-driven compression of `CLAUDE.md` / `MEMORY.md` toward a token target (default 3000) |
163
+ | `manage_backlog` | Backlog | `add` / `list` / `update` / `prune_done` (archives) / `archive_list` / `session_end` with Progress Report + resume prompt |
164
+ | `index_image` | Vision | Moondream caption → `nomic-embed-text` embed → upsert. Auto-converts WebP/GIF/BMP via ffmpeg. |
165
+ | `check_code_hygiene` | Guardian | 750-line rule with auto-generated file exclusions; N-split refactor plan for oversized files |
166
+ | `check_rule_conflicts` | Guardian | Opt-in LLM-based intent conflict detection between a proposed change and retrieved rules |
167
+ | `raise_verification_gate` | Guardian | Arm the Hard Stop flag after a risky edit |
168
+ | `confirm_verification` | Guardian | Clear or reassert the Hard Stop gate — Claude must call this after manual verification |
169
+ | `check_system_health` | Ops | Supabase reachability (memory_chunks count) + Ollama reachability + required-model presence (moondream, nomic-embed-text) + background keep-alive state |
170
+ | `init_project` | Ops | Readiness report for a workspace: required env vars, md-policy.py hook, MCP registration in settings, compiled dist. Also runs a **smart-scout pass** over `.claude/rules/*.md` and emits a `recommendations.hydrate_policies` block with batch-hydration candidates when any are found (key omitted entirely otherwise). Returns `ready` / `partial` / `not_ready` with fix instructions per check. |
171
+ | `batch_freeze_patterns` | Guardian | Bulk-hydrate the frozen-pattern cache from globs or a `## Frozen Patterns` markdown section in a rule file. Strict line-by-line extraction, atomic writes, dedup with first-writer-wins, optional `dry_run`. |
172
+ | `list_frozen` | Guardian | List all frozen pattern entries for the current project (returns `pattern`, `source`, `added_at`). Use before touching any structural-looking file. |
173
+ | `freeze_file` | Guardian | Add a path or pattern to the frozen-pattern cache so future `Write` (full replacement) on matching files is hard-blocked by the hook. |
174
+ | `unfreeze_file` | Guardian | Remove a path or pattern from the frozen-pattern cache. |
175
+ | `sweep_legacy_backups` | Ops | Move stray `backup-*` / `*.bak` artefacts into a timestamped quarantine folder. Defaults to `dry_run`; HIGH-confidence files only unless `aggressive: true`. |
176
+ | `refactor_guard` | Guardian | Single source of compile truth — auto-detects stack and runs the native gate (`tsc --noEmit`, `flutter analyze`, `cargo check`, …). Also exposes `rollback` for last-resort recovery. |
177
+ | `analyze_regression` | Guardian | Diffs the current file against recent backups and surfaces the `closest_prior` snapshot to guide the minimal local fix during the self-healing loop. |
178
+ | `delegate_task` | Orchestrator | Emit a canonical worker sub-agent prompt — the worker does the edit → `refactor_guard` gate → up to 3 self-heal attempts → returns only a 2-paragraph synthesis. Backbone of the Sovereign Orchestrator pattern. |
179
+ | `sync_artefacts` | Orchestrator | Refresh `README.md` Recent Progress + the marker-bounded Mermaid block in `ARCHITECTURE.md` + `project_file_architecture.md` after a worker reports success. Doc-only subset of `manage_backlog({ action: "session_end" })`. |
180
+
181
+ **Companion hook:** [hooks/md-policy.py](hooks/md-policy.py) enforces Zero-Local-MD allowlist, 750-line ceiling, frozen-feature patterns, and the Manual Test Gate from the Claude Code `PreToolUse` layer. Without it the Guardian tools are advisory; with it they are binding.
182
+
183
+ ---
184
+
185
+ ## Living Documentation
186
+
187
+ `manage_backlog({ action: "session_end" })` writes **two** artefacts into the project on every call, in parallel, so the repo self-documents without manual effort:
188
+
189
+ ### 1. README progress log → `README.md`
190
+
191
+ 1. Archives completed tasks (atomic PL/pgSQL transaction into `archive_backlog`).
192
+ 2. Pulls the last 5 archived rows via `listArchive`.
193
+ 3. Replaces the `### 🚀 Recent Progress
194
+
195
+ * [DONE] Idempotency: make migrations 001–018 strictly re-runnable (archived at 2026-05-14).
196
+ * [DONE] Tech-debt: relocate 006_smoke/006_verify out of scripts/, drop loadMigrationFiles denylist (archived at 2026-05-14).
197
+ * [DONE] [OBS-EPIC] Telemetry retention policy (rolling window for daemon_telemetry) (archived at 2026-05-14).
198
+ * [DONE] [OBS-EPIC] Aggregate per-chunk token counters in compactor state for richer telemetry (archived at 2026-05-14).
199
+ * [DONE] [FOUNDATION-FIX] Explicit service_role grants for May 30 Supabase compliance (archived at 2026-05-13).
200
+ ### 🚀 Recent Progress
201
+
202
+ * [DONE] Fix login form validation (archived at 2026-04-24).
203
+ * [DONE] Add cache invalidation hook (archived at 2026-04-23).
204
+ ...
205
+ ```
206
+
207
+ ### 2. Architecture map → `project_file_architecture.md`
208
+
209
+ 1. Walks the project tree (cwd), ignoring `node_modules`, `.git`, `dist`, `build`, `backups`, and friends.
210
+ 2. Caps depth at 3 and children per folder at 25; overflows show as `… (N more)`.
211
+ 3. Renders a Mermaid `flowchart TD` — GitHub renders it natively in the doc.
212
+ 4. Replaces only the `mermaid` fenced block; any human prose in the file is left intact. Creates the file with a professional header on first run.
213
+
214
+ ### Safety rails (shared)
215
+
216
+ - If the MCP server's `cwd` slug doesn't match the `session_end` `project_id`, **both syncs are skipped** with an explicit warning — neither artefact is written into the wrong repo.
217
+ - Failures surface as `warning` fields in `readme_sync` / `architecture_sync`; the archive + resume-prompt logic always completes.
218
+ - Hook allowlist includes `README.md`; `project_file_architecture.md` is not on it — make sure your Zero-Local-MD allowlist covers it too (`CLAUDE_MD_POLICY_ALLOW_ROOT_MD="CLAUDE.md,MEMORY.md,README.md,project_file_architecture.md"`).
219
+
220
+ Net effect: every session leaves a timestamped handover note and a current file-tree diagram in the repo.
221
+
222
+ ---
223
+
224
+ ## Incremental sync (v0.3.0)
225
+
226
+ For corpora with thousands of files, re-embedding on every call is wasteful. `sync_local_memory` now runs a **hash-gated** pipeline:
227
+
228
+ 1. Snapshot `Map<file_origin, file_hash>` for the current `project_id` in one paginated SELECT.
229
+ 2. For each local file, compute MD5 **before** chunking or embedding.
230
+ 3. If the hash matches the DB, skip — zero Ollama calls, zero writes.
231
+ 4. If it differs (or is new), chunk + embed and buffer the rows.
232
+ 5. Flush in batches of 100 chunks per upsert to minimize round-trips.
233
+ 6. If a file is gone locally but still in the DB, it's reported in `orphan_files` (not auto-pruned).
234
+
235
+ Measured on this repo's own README (28 chunks, single file):
236
+
237
+ | Run | Behavior | Time | Ollama calls |
238
+ |---|---|---|---|
239
+ | Cold sync | Embed + upsert | **~3.7 s** | 28 |
240
+ | Unchanged rerun | All skip | **~0.3 s** | **0** |
241
+ | One file modified | Skip N−1, re-embed 1 | proportional to the delta | 1 file's worth |
242
+
243
+ ### Output shape
244
+
245
+ ```json
246
+ {
247
+ "project_id": "acme-api",
248
+ "force": false,
249
+ "scanned": 812,
250
+ "skipped": 806,
251
+ "added": 3,
252
+ "updated": 3,
253
+ "orphans": 1,
254
+ "orphan_files": ["/abs/path/legacy.md"],
255
+ "chunks_upserted": 47,
256
+ "chunks_deleted": 21,
257
+ "ms": 1840
258
+ }
259
+ ```
260
+
261
+ ### Force re-embed
262
+
263
+ Pass `force: true` to bypass the skip gate. Pre-existing files are still correctly classified as `updated` (not `added`) and their stale chunks are purged before re-insert — critical when a file shrinks.
264
+
265
+ ```
266
+ sync_local_memory({ force: true })
267
+ ```
268
+
269
+ Verified by [scripts/e2e-incremental-test.ts](scripts/e2e-incremental-test.ts), which walks five phases: cold, rerun, modify+add+delete, force, and row-shape integrity.
270
+
271
+ ---
272
+
273
+ ## Install (3 steps, ~5 minutes)
274
+
275
+ ### 1. Install the plugin from the marketplace
276
+
277
+ In Claude Code, open the plugin marketplace and install **smart-claude-memory** (or, while the marketplace listing is being prepared, clone this repo and `claude plugin add <path>` it locally). The plugin manifest at `.claude-plugin/plugin.json` auto-wires both the MCP server and the `md-policy.py` PreToolUse hook. **No `~/.claude.json` or `~/.claude/settings.json` edits required.**
278
+
279
+ ### 2. Create an empty Supabase project + Ollama models
280
+
281
+ - Create a free Supabase project at [supabase.com](https://supabase.com).
282
+ - Install [Ollama](https://ollama.com/) and pull the two required models:
283
+
284
+ ```bash
285
+ ollama pull moondream
286
+ ollama pull nomic-embed-text
287
+ ```
288
+
289
+ ### 3. Set 3 env vars in your project's `.env`
290
+
291
+ ```env
292
+ SUPABASE_URL=https://<your-project-ref>.supabase.co
293
+ SUPABASE_SECRET_KEY=<service-role-key>
294
+ SUPABASE_POOLER_URL=postgres://postgres:<password>@<pooler-host>:6543/postgres
295
+ ```
296
+
297
+ Then call `init_project()` from Claude Code. The plugin **auto-applies all 18 schema migrations** to your empty DB on the first call, verifies your Ollama models are pulled, and reports `overall: pending → healthy` within a few minutes. Zero manual `npm run schema`, zero hand-edited settings.
298
+
299
+ ### Optional env vars
300
+
301
+ | Name | Default | Purpose |
302
+ |---|---|---|
303
+ | `OLLAMA_HOST` | `http://localhost:11434` | Ollama endpoint |
304
+ | `OLLAMA_EMBED_MODEL` | `nomic-embed-text` | Embedding model |
305
+ | `EMBED_DIM` | `768` | Embedding vector dimension |
306
+ | `MEMORY_ROOTS` | (empty) | Semicolon-separated folders to sync |
307
+
308
+ > **Why a pooler URL?** Supabase's `db.<ref>.supabase.co` endpoint is **IPv6-only** on projects created after early 2024. If your network doesn't route public IPv6 (most home/office Windows boxes don't), direct connects fail with `ENETUNREACH`. The **transaction pooler** at `aws-1-<region>.pooler.supabase.com:6543` is IPv4-reachable and is what the auto-migration loop uses.
309
+
310
+ ### First-run index your notes
311
+
312
+ From a Claude Code session inside the project whose notes you want to offload:
313
+
314
+ ```
315
+ sync_local_memory()
316
+ ```
317
+
318
+ Then free up context by archiving the originals:
319
+
320
+ ```bash
321
+ npm run backup # dry run
322
+ npx tsx scripts/backup-and-remove.ts --confirm-delete # zip + delete
323
+ ```
324
+
325
+ ---
326
+
327
+ ## ⚡ The Golden Startup Prompt
328
+
329
+ To ensure a seamless, context-efficient, and secure session in any project using this plugin, copy and paste the following prompt as your very first interaction with the agent.
330
+
331
+ ```text
332
+ SYSTEM INITIALIZATION:
333
+ I am using the `smart-claude-memory` plugin. Follow these standards:
334
+ 1. **Check Readiness:** Run `init_project` to verify the workspace and health.
335
+ 2. **Sync State:** Run `sync_local_memory()` to ensure the vector database is up to date with my local notes.
336
+ 3. **Operate via Tools:** From now on, do NOT read large `.md` files directly. Use `search_memory()` for context retrieval and respect the `md-policy.py` hook for all writes.
337
+ 4. **Typed Retrieval (v2):** When saving memories use `save_memory` with `metadata.type` from the Sovereign Taxonomy — `DECISION` (architectural choices + rationale), `PATTERN` (code standards + Rule 5–8 enforcement), `ERROR` (bug post-mortems + fixes), or `LOG` (general session progress). When retrieving, narrow `search_memory` with `metadata_filter` (e.g. `{ "type": "DECISION" }`) so the GIN index pre-filters before vector similarity. After updates, run `sync_artefacts` to keep cloud + local aligned.
338
+ 5. **MANDATORY DELEGATION:** Any read-heavy investigation touching > 3 files OR resulting in > 100 lines of raw output (Grep / Read / Logcat) MUST be delegated via `delegate_task` to a worker. Never flood the main context. Request only the 2-paragraph synthesis.
339
+ 6. **Initial Sync (Core 3 Audit):** `init_project` (Rule 1) returns a `core3` block reporting on `CLAUDE.md`, `README.md`, and `ARCHITECTURE.md` — the project's three architectural sources of truth. If any is missing, or if `core3.in_sync` is `false`, immediately `delegate_task` a Core-3 audit BEFORE any other work. Request a 2-paragraph synthesis with the proposed reconciliation. The Architecture Guard treats these three files as load-bearing; nothing else proceeds until they agree.
340
+ 7. **Modular Diagramming:** Mermaid diagrams in `ARCHITECTURE.md` and `README.md` MUST be split into small per-section blocks — one block per `##` subsystem, ≤ ~40 nodes each. GitHub silently fails to render oversized Mermaid graphs; a single monolithic flowchart will appear blank in the rendered view. Never emit one mega-graph. When `manage_backlog({ action: "session_end" })` regenerates the diagram, it produces one block per logical section, not one giant tree.
341
+ 8. **Session-End Lock & Handoff:** Before ending the session, call `manage_backlog({ action: "session_end" })` to flush the backlog, regenerate the per-section Mermaid diagrams, and run `sync_artefacts` to push state to the cloud. The response includes a `next_session_command_markdown` field — **POST THAT MARKDOWN BLOCK VERBATIM as your final message to chat.** It is a copy-paste-ready boot command (`init_project` + `search_memory` for the Active Backlog + pointer to `docs/NEXT-SESSION-PROMPT.md`) that the user pastes into the next session. This locks a coherent baseline so the next session opens with the Core 3, the diagrams, and the cloud memory all aligned.
342
+ 9. **Universal Patterns → GLOBAL (v2.0.0-rc1):** Any pattern, lesson-learned, or architectural decision deemed **universal** — applicable across projects, not just this one — MUST be saved with `metadata.is_global: true`. The row is stored under the reserved `project_id: 'GLOBAL'` and surfaces in dual-scope search across every project. Use this to **immunize future projects against known errors** (a bug fixed once never has to be re-discovered). Inverse: do NOT promote project-local context to GLOBAL — the vault loses signal if it becomes a dumping ground.
343
+ 10. **Sovereign Vetting:** The GLOBAL vault is a high-signal environment. Every global save must pass the **Cross-Project Test**: *if the current project were deleted tomorrow, would this memory still be a gold-standard reference for others?* If no, keep it local. When `metadata.is_global: true`, you **MUST** also include `metadata.global_rationale` — a one- or two-sentence justification of why this memory is a universal truth (not project-specific). Saves that fail the Cross-Project Test pollute the vault and are forbidden. The agent is its own auditor: only Arch-Patterns that apply to ALL projects (universal architectural decisions, multi-project bug fixes) qualify.
344
+ ```
345
+
346
+ ---
347
+
348
+ ## How `project_id` is derived
349
+
350
+ [src/project.ts](src/project.ts):
351
+
352
+ ```ts
353
+ export function detectProjectId(cwd = process.cwd()): string {
354
+ return slugify(basename(cwd) || "default");
355
+ }
356
+ ```
357
+
358
+ Captured once at MCP server startup. Claude Code launches an MCP subprocess per session with `cwd` set to the workspace root, so `basename(cwd)` is a stable project identifier for the lifetime of that session.
359
+
360
+ Collisions are possible if two unrelated projects share a folder name (`utils/`, `backend/`, etc.). To harden, override explicitly:
361
+
362
+ ```
363
+ sync_local_memory({ project_id: "acme-backend-prod" })
364
+ ```
365
+
366
+ ---
367
+
368
+ ## Database schema
369
+
370
+ ```sql
371
+ create table memory_chunks (
372
+ id bigserial primary key,
373
+ content text not null,
374
+ embedding vector(768) not null,
375
+ file_origin text not null,
376
+ chunk_index int not null default 0,
377
+ content_hash text not null, -- MD5 of the chunk text
378
+ file_hash text, -- MD5 of the whole file at last sync (v0.3.0)
379
+ metadata jsonb not null default '{}'::jsonb,
380
+ project_id text not null default 'default',
381
+ updated_at timestamptz not null default now(),
382
+ unique (project_id, file_origin, chunk_index)
383
+ );
384
+
385
+ create index on memory_chunks using hnsw (embedding vector_cosine_ops);
386
+ create index on memory_chunks (project_id);
387
+ create index on memory_chunks (project_id, file_origin); -- powers the hash-gate lookup
388
+ ```
389
+
390
+ The current 6-arg RPC `match_memory_chunks(query_embedding, p_project_id, match_count, min_similarity, p_metadata_filter, p_include_global)` (introduced by migration 008 and patched in 009 to use the planner-friendly IN-form `WHERE m.project_id IN (p_project_id, CASE WHEN p_include_global THEN 'GLOBAL' END)`) enforces tenancy + the typed-metadata filter + the optional `'GLOBAL'` fan-out, all in SQL — before pgvector ranks the candidate set. The legacy 4-arg form from migration 001 is superseded but left intact in the file for historical reference. All chunks from the same file share one `file_hash`, so the incremental-sync skip check is a single `SELECT file_origin, file_hash WHERE project_id = ?`. Full schema + RPC definitions in [scripts/001_schema.sql](scripts/001_schema.sql), [scripts/002_multi_project.sql](scripts/002_multi_project.sql), [scripts/003_file_hash.sql](scripts/003_file_hash.sql), [scripts/007_metadata_typed_retrieval.sql](scripts/007_metadata_typed_retrieval.sql), [scripts/008_global_scope.sql](scripts/008_global_scope.sql), and [scripts/009_fix_rpc_dual_scope.sql](scripts/009_fix_rpc_dual_scope.sql).
391
+
392
+ ---
393
+
394
+ ## Project layout
395
+
396
+ ```
397
+ src/
398
+ ├── index.ts MCP server entry — registers all 22 tools
399
+ ├── config.ts Env loader (absolute .env path resolution)
400
+ ├── project.ts project_id detection + slugification
401
+ ├── project-detect.ts Multi-stack project root detection
402
+ ├── ollama.ts POST /api/embed client
403
+ ├── supabase.ts Table + RPC wrappers + frozen-pattern cache
404
+ ├── chunker.ts Markdown-aware splitter
405
+ ├── verification-gate.ts Hard-stop verification flag (PreToolUse blocker)
406
+ ├── version.ts Version SSOT — re-exports from package.json
407
+ └── tools/
408
+ ├── backlog.ts manage_backlog (add / list / update / prune_done / archive_list / session_end)
409
+ ├── batch-freeze-patterns.ts batch_freeze_patterns (bulk-hydrate from globs or rule file)
410
+ ├── conflict.ts check_rule_conflicts
411
+ ├── frozen-cache.ts Shared loader for the frozen-pattern cache (atomic writes, dedup)
412
+ ├── health.ts check_system_health (Supabase + Ollama + keep-alive + orchestrator)
413
+ ├── hygiene.ts check_code_hygiene (750-line ceiling, N-split refactor plans)
414
+ ├── image.ts index_image (Moondream caption → embed → upsert)
415
+ ├── orchestrator.ts delegate_task + sync_artefacts (Sovereign Orchestrator pattern)
416
+ ├── policy.ts list_frozen / freeze_file / unfreeze_file / sweep_legacy_backups
417
+ ├── refactor.ts refactor_guard (compile gate) + analyze_regression (backup diff)
418
+ ├── save.ts save_memory (typed write path with Sovereign Vetting)
419
+ ├── search.ts search_memory (intent routing + dual-scope semantic)
420
+ ├── setup.ts init_project (readiness checks + smart-scout)
421
+ ├── sovereign-constitution.ts CLAUDE.md Sovereign-binding template + helper
422
+ ├── summarize.ts summarize_memory_file
423
+ ├── sync.ts sync_local_memory (hash-gated incremental)
424
+ └── verification.ts raise_verification_gate / confirm_verification
425
+
426
+ scripts/
427
+ ├── 001_schema.sql base table + HNSW index + base RPCs
428
+ ├── 002_multi_project.sql project_id + per-project isolation
429
+ ├── 003_file_hash.sql file_hash column for incremental sync
430
+ ├── 004_backlog_frozen.sql cloud_backlog + frozen_patterns tables
431
+ ├── 005_archive_backlog.sql archive_backlog history table
432
+ ├── 006_security_hardening.sql RLS deny-all + service-role-only access
433
+ ├── 007_metadata_typed_retrieval.sql GIN(jsonb_path_ops) + typed-filter match RPC
434
+ ├── 008_global_scope.sql 'GLOBAL' project_id + 6-arg dual-scope match RPC
435
+ ├── 009_fix_rpc_dual_scope.sql IN-form WHERE planner fix (v2.0.0-rc1 hotfix)
436
+ ├── apply-schema.ts `npm run schema` runner
437
+ ├── backup-and-remove.ts archive + delete .md files in MEMORY_ROOTS
438
+ ├── e2e-test.ts end-to-end smoke
439
+ ├── e2e-isolation-test.ts multi-project isolation gate
440
+ ├── e2e-incremental-test.ts hash-gate / force / orphans
441
+ ├── purge-samia-rules.ts one-off scrub (legacy)
442
+ ├── smoke-008.ts smoke for 008 dual-scope
443
+ ├── verify-007.ts verifier for 007 typed retrieval
444
+ └── verify-008.ts verifier for 008 dual-scope
445
+ ```
446
+
447
+ ---
448
+
449
+ ## npm scripts
450
+
451
+ | Command | Purpose |
452
+ |---|---|
453
+ | `npm run build` | Compile TypeScript → `dist/` |
454
+ | `npm run dev` | Run the server via `tsx` (no build step) |
455
+ | `npm run start` | Run the compiled server |
456
+ | `npm run schema` | Apply `001_schema.sql` (or pass `-- <file>` for another) |
457
+ | `npm run backup` | Dry-run backup of all `.md` in `MEMORY_ROOTS` |
458
+
459
+ ---
460
+
461
+ ## Design decisions worth knowing
462
+
463
+ - **Embedding model is load-bearing.** `EMBED_DIM` must match the model's output. Swapping `nomic-embed-text` (768) for `mxbai-embed-large` (1024) means dropping and rebuilding the `embedding` column. Don't mix dimensions.
464
+ - **Service-role key, no RLS.** The MCP server runs locally with no user context; it uses `sb_secret_*` which bypasses RLS. If you expose this server to untrusted callers, add RLS plus a `user_id` column.
465
+ - **Chunking is heading-aware, not token-aware.** Sections split on `##` / `###`; long sections slide-window at `CHUNK_SIZE` with `CHUNK_OVERLAP`. Good enough for most prose; swap in a tokenizer-driven chunker if you're indexing code.
466
+ - **Sync is incremental by default.** Unchanged files are skipped via `file_hash` comparison; no embedding calls, no writes. Pass `force: true` to re-embed everything. Chunks are flushed in 100-row batches to minimize Supabase round-trips.
467
+ - **Orphans are reported, not pruned.** Files removed from disk stay in the DB and show up in `orphan_files`. A dedicated `prune_memory` tool is deferred to a later release so deletions are never silent.
468
+ - **Version is a single source of truth.** [src/version.ts](src/version.ts) reads `version` from `package.json` via `createRequire(import.meta.url)` and re-exports it. The MCP server registration in [src/index.ts](src/index.ts), the `check_system_health` orchestrator block, and the `delegate_task` response envelope all import that one constant — no hard-coded literals anywhere. Bumping `package.json` propagates through the next build with zero drift between `npm view` and what the tool surface reports.
469
+ - **Policy hydration is bulk + idempotent.** [src/tools/batch-freeze-patterns.ts](src/tools/batch-freeze-patterns.ts) accepts globs or a markdown rule file, scans only the section under an exact `## Frozen Patterns` heading, strips backticks/list markers, and writes through the shared loader at [src/tools/frozen-cache.ts](src/tools/frozen-cache.ts). Cache entries are now `{ pattern, source, added_at }` objects (legacy strings are lazily migrated on read), all writes go through `<file>.tmp` + `rename`, and dedup is first-writer-wins on trimmed pattern equality — so re-running against the same rule file is a no-op. The `source` field is what powers smart-scout suppression.
470
+
471
+ ---
472
+
473
+ ## Security
474
+
475
+ - `.env` is git-ignored. Never commit it.
476
+ - Rotate `SUPABASE_SECRET_KEY` and your database password anytime they touch a log, a terminal history, or a chat transcript.
477
+ - The backup script writes unencrypted `.zip` files to `backups/` (also git-ignored). If your notes are sensitive, encrypt the archive before uploading anywhere.
478
+
479
+ ---
480
+
481
+ ## License
482
+
483
+ MIT. See [LICENSE](LICENSE).
484
+
485
+ ---
486
+
487
+ ## Developer
488
+
489
+ Built and maintained by **[NABILNET.AI](https://nabilnet.ai)**.
490
+
491
+ For inquiries, integrations, or sovereign-grade Claude Code tooling, visit [nabilnet.ai](https://nabilnet.ai).
492
+
493
+ ### 🗺️ File Architecture
494
+
495
+ _Auto-synced at 2026-05-16T08:08:32.952Z for `smart-claude-memory`._
496
+
497
+ ```mermaid
498
+ flowchart TD
499
+ n0["Claude-Memory/"]
500
+ n1[".claude/"]
501
+ n0 --> n1
502
+ n2["docs/"]
503
+ n0 --> n2
504
+ n3["assets/"]
505
+ n2 --> n3
506
+ n4["schematic.png"]
507
+ n3 --> n4
508
+ n5["scm-memory/"]
509
+ n2 --> n5
510
+ n6["legacy_claude.md"]
511
+ n5 --> n6
512
+ n7["legacy_memory.md"]
513
+ n5 --> n7
514
+ n8["session-reports/"]
515
+ n2 --> n8
516
+ n9["SESSION-10-REPORT.md"]
517
+ n8 --> n9
518
+ n10["SESSION-11-REPORT.md"]
519
+ n8 --> n10
520
+ n11["SESSION-12-REPORT.md"]
521
+ n8 --> n11
522
+ n12["SESSION-13-REPORT.md"]
523
+ n8 --> n12
524
+ n13["SESSION-14-REPORT.md"]
525
+ n8 --> n13
526
+ n14["SESSION-15-REPORT.md"]
527
+ n8 --> n14
528
+ n15["SESSION-16-REPORT.md"]
529
+ n8 --> n15
530
+ n16["SESSION-17-REPORT.md"]
531
+ n8 --> n16
532
+ n17["SESSION-18-REPORT.md"]
533
+ n8 --> n17
534
+ n18["SESSION-19-REPORT.md"]
535
+ n8 --> n18
536
+ n19["SESSION-20-REPORT.md"]
537
+ n8 --> n19
538
+ n20["SESSION-21-REPORT.md"]
539
+ n8 --> n20
540
+ n21["SESSION-22-REPORT.md"]
541
+ n8 --> n21
542
+ n22["SESSION-23-REPORT.md"]
543
+ n8 --> n22
544
+ n23["SESSION-24-REPORT.md"]
545
+ n8 --> n23
546
+ n24["SESSION-25-REPORT.md"]
547
+ n8 --> n24
548
+ n25["SESSION-26-REPORT.md"]
549
+ n8 --> n25
550
+ n26["superpowers/"]
551
+ n2 --> n26
552
+ n27["plans/"]
553
+ n26 --> n27
554
+ n28["2026-05-12-observability-telemetry.md"]
555
+ n27 --> n28
556
+ n29["2026-05-14-marketplace-packaging.md"]
557
+ n27 --> n29
558
+ n30["2026-05-15-v2.1.0-global-vault-ux.md"]
559
+ n27 --> n30
560
+ n31["specs/"]
561
+ n26 --> n31
562
+ n32["2026-05-13-telemetry-retention-design.md"]
563
+ n31 --> n32
564
+ n33["2026-05-14-marketplace-packaging-design.md"]
565
+ n31 --> n33
566
+ n34["IDE-INTEGRATION.md"]
567
+ n2 --> n34
568
+ n35["NEXT-SESSION-PROMPT.md"]
569
+ n2 --> n35
570
+ n36["hooks/"]
571
+ n0 --> n36
572
+ n37["md-policy.py"]
573
+ n36 --> n37
574
+ n38["README.md"]
575
+ n36 --> n38
576
+ n39["images/"]
577
+ n0 --> n39
578
+ n40["GPT SMC v2.0-rc1.png"]
579
+ n39 --> n40
580
+ n41["scripts/"]
581
+ n0 --> n41
582
+ n42["001_schema.sql"]
583
+ n41 --> n42
584
+ n43["002_multi_project.sql"]
585
+ n41 --> n43
586
+ n44["003_file_hash.sql"]
587
+ n41 --> n44
588
+ n45["004_backlog_frozen.sql"]
589
+ n41 --> n45
590
+ n46["005_archive_backlog.sql"]
591
+ n41 --> n46
592
+ n47["006_security_hardening.sql"]
593
+ n41 --> n47
594
+ n48["007_metadata_typed_retrieval.sql"]
595
+ n41 --> n48
596
+ n49["008_global_scope.sql"]
597
+ n41 --> n49
598
+ n50["009_fix_rpc_dual_scope.sql"]
599
+ n41 --> n50
600
+ n51["010_agent_skills.sql"]
601
+ n41 --> n51
602
+ n52["011_trajectory_compaction.sql"]
603
+ n41 --> n52
604
+ n53["012_sleep_learning.sql"]
605
+ n41 --> n53
606
+ n54["013_archive_backlog_chunk_link.sql"]
607
+ n41 --> n54
608
+ n55["014_workflow_checkpoints.sql"]
609
+ n41 --> n55
610
+ n56["015_curriculum_tasks.sql"]
611
+ n41 --> n56
612
+ n57["016_daemon_telemetry.sql"]
613
+ n41 --> n57
614
+ n58["017_explicit_service_role_grants.sql"]
615
+ n41 --> n58
616
+ n59["018_telemetry_retention.sql"]
617
+ n41 --> n59
618
+ n60["apply-schema.ts"]
619
+ n41 --> n60
620
+ n61["backfill-ledger.ts"]
621
+ n41 --> n61
622
+ n62["backup-and-remove.ts"]
623
+ n41 --> n62
624
+ n63["e2e-incremental-test.ts"]
625
+ n41 --> n63
626
+ n64["e2e-isolation-test.ts"]
627
+ n41 --> n64
628
+ n65["e2e-test.ts"]
629
+ n41 --> n65
630
+ n66["lint-boundaries.ts"]
631
+ n41 --> n66
632
+ n67["… (19 more)"]
633
+ n41 --> n67
634
+ n68["src/"]
635
+ n0 --> n68
636
+ n69["curriculum/"]
637
+ n68 --> n69
638
+ n70["daemon.ts"]
639
+ n69 --> n70
640
+ n71["scanner.ts"]
641
+ n69 --> n71
642
+ n72["lib/"]
643
+ n68 --> n72
644
+ n73["migrations.ts"]
645
+ n72 --> n73
646
+ n74["sleep/"]
647
+ n68 --> n74
648
+ n75["daemon.ts"]
649
+ n74 --> n75
650
+ n76["miner.ts"]
651
+ n74 --> n76
652
+ n77["telemetry/"]
653
+ n68 --> n77
654
+ n78["emit.ts"]
655
+ n77 --> n78
656
+ n79["pruner.ts"]
657
+ n77 --> n79
658
+ n80["types.ts"]
659
+ n77 --> n80
660
+ n81["tools/"]
661
+ n68 --> n81
662
+ n82["backlog.ts"]
663
+ n81 --> n82
664
+ n83["batch-freeze-patterns.ts"]
665
+ n81 --> n83
666
+ n84["bloat-audit.ts"]
667
+ n81 --> n84
668
+ n85["checkpoint.ts"]
669
+ n81 --> n85
670
+ n86["compact.ts"]
671
+ n81 --> n86
672
+ n87["conflict.ts"]
673
+ n81 --> n87
674
+ n88["curriculum.ts"]
675
+ n81 --> n88
676
+ n89["frozen-cache.ts"]
677
+ n81 --> n89
678
+ n90["health.ts"]
679
+ n81 --> n90
680
+ n91["hygiene.ts"]
681
+ n81 --> n91
682
+ n92["image.ts"]
683
+ n81 --> n92
684
+ n93["list-global-patterns.ts"]
685
+ n81 --> n93
686
+ n94["orchestrator.ts"]
687
+ n81 --> n94
688
+ n95["policy.ts"]
689
+ n81 --> n95
690
+ n96["refactor.ts"]
691
+ n81 --> n96
692
+ n97["save.ts"]
693
+ n81 --> n97
694
+ n98["search.ts"]
695
+ n81 --> n98
696
+ n99["setup.ts"]
697
+ n81 --> n99
698
+ n100["shared-schemas.ts"]
699
+ n81 --> n100
700
+ n101["skills.ts"]
701
+ n81 --> n101
702
+ n102["sleep.ts"]
703
+ n81 --> n102
704
+ n103["sovereign-constitution.ts"]
705
+ n81 --> n103
706
+ n104["summarize.ts"]
707
+ n81 --> n104
708
+ n105["sync.ts"]
709
+ n81 --> n105
710
+ n106["system_dashboard.ts"]
711
+ n81 --> n106
712
+ n107["… (1 more)"]
713
+ n81 --> n107
714
+ n108["trajectory/"]
715
+ n68 --> n108
716
+ n109["daemon.ts"]
717
+ n108 --> n109
718
+ n110["stripper.ts"]
719
+ n108 --> n110
720
+ n111["summarizer.ts"]
721
+ n108 --> n111
722
+ n112["transactions/"]
723
+ n68 --> n112
724
+ n113["checkpoint.ts"]
725
+ n112 --> n113
726
+ n114["chunker.ts"]
727
+ n68 --> n114
728
+ n115["config.ts"]
729
+ n68 --> n115
730
+ n116["index.ts"]
731
+ n68 --> n116
732
+ n117["ollama.ts"]
733
+ n68 --> n117
734
+ n118["project-detect.ts"]
735
+ n68 --> n118
736
+ n119["project.ts"]
737
+ n68 --> n119
738
+ n120["supabase.ts"]
739
+ n68 --> n120
740
+ n121["verification-gate.ts"]
741
+ n68 --> n121
742
+ n122["version.ts"]
743
+ n68 --> n122
744
+ n123["tests/"]
745
+ n0 --> n123
746
+ n124["sql_fixtures/"]
747
+ n123 --> n124
748
+ n125["006_smoke.sql"]
749
+ n124 --> n125
750
+ n126["006_verify.sql"]
751
+ n124 --> n126
752
+ n127["capabilities.test.ts"]
753
+ n123 --> n127
754
+ n128["health.test.ts"]
755
+ n123 --> n128
756
+ n129["list-global-patterns.test.ts"]
757
+ n123 --> n129
758
+ n130["migrations.test.ts"]
759
+ n123 --> n130
760
+ n131["trajectory-daemon.test.ts"]
761
+ n123 --> n131
762
+ n132["trajectory-stripper.test.ts"]
763
+ n123 --> n132
764
+ n133["trajectory-summarizer.test.ts"]
765
+ n123 --> n133
766
+ n134[".env.example"]
767
+ n0 --> n134
768
+ n135[".gitignore"]
769
+ n0 --> n135
770
+ n136["ARCHITECTURE.md"]
771
+ n0 --> n136
772
+ n137["CHANGELOG.md"]
773
+ n0 --> n137
774
+ n138["CLAUDE.md"]
775
+ n0 --> n138
776
+ n139["LICENSE"]
777
+ n0 --> n139
778
+ n140["marketplace.json"]
779
+ n0 --> n140
780
+ n141["package-lock.json"]
781
+ n0 --> n141
782
+ n142["package.json"]
783
+ n0 --> n142
784
+ n143["project_file_architecture.md"]
785
+ n0 --> n143
786
+ n144["README.md"]
787
+ n0 --> n144
788
+ n145["tsconfig.json"]
789
+ n0 --> n145
790
+ ```