sdl-mcp 0.10.6 → 0.10.7

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 (41) hide show
  1. package/README.md +207 -78
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/agent/context-engine.d.ts.map +1 -1
  4. package/dist/agent/context-engine.js +35 -7
  5. package/dist/agent/context-engine.js.map +1 -1
  6. package/dist/agent/context-seeding.d.ts.map +1 -1
  7. package/dist/agent/context-seeding.js +57 -39
  8. package/dist/agent/context-seeding.js.map +1 -1
  9. package/dist/agent/types.d.ts +9 -0
  10. package/dist/agent/types.d.ts.map +1 -1
  11. package/dist/cli/index.js +7 -0
  12. package/dist/cli/index.js.map +1 -1
  13. package/dist/config/types.d.ts +2 -0
  14. package/dist/config/types.d.ts.map +1 -1
  15. package/dist/config/types.js +6 -0
  16. package/dist/config/types.js.map +1 -1
  17. package/dist/indexer/metrics-updater.d.ts.map +1 -1
  18. package/dist/indexer/metrics-updater.js +17 -12
  19. package/dist/indexer/metrics-updater.js.map +1 -1
  20. package/dist/indexer/model-downloader.d.ts.map +1 -1
  21. package/dist/indexer/model-downloader.js +38 -5
  22. package/dist/indexer/model-downloader.js.map +1 -1
  23. package/dist/indexer/model-registry.d.ts +10 -0
  24. package/dist/indexer/model-registry.d.ts.map +1 -1
  25. package/dist/indexer/model-registry.js +19 -3
  26. package/dist/indexer/model-registry.js.map +1 -1
  27. package/dist/main.js +8 -1
  28. package/dist/main.js.map +1 -1
  29. package/dist/mcp/context-response-projection.d.ts.map +1 -1
  30. package/dist/mcp/context-response-projection.js +1 -0
  31. package/dist/mcp/context-response-projection.js.map +1 -1
  32. package/dist/mcp/tools.d.ts +8 -0
  33. package/dist/mcp/tools.d.ts.map +1 -1
  34. package/dist/mcp/tools.js +17 -0
  35. package/dist/mcp/tools.js.map +1 -1
  36. package/dist/retrieval/orchestrator.d.ts.map +1 -1
  37. package/dist/retrieval/orchestrator.js +88 -12
  38. package/dist/retrieval/orchestrator.js.map +1 -1
  39. package/package.json +5 -4
  40. package/scripts/postinstall-models.mjs +197 -0
  41. package/scripts/postinstall.mjs +44 -0
package/README.md CHANGED
@@ -38,20 +38,31 @@ SDL-MCP fixes this. It indexes your codebase into a searchable **symbol graph**
38
38
  ## How it works — in 30 seconds
39
39
 
40
40
  ```mermaid
41
+ %%{init: {"theme":"base","themeVariables":{"background":"#ffffff","primaryColor":"#E7F8F2","primaryBorderColor":"#0F766E","primaryTextColor":"#102A43","secondaryColor":"#E8F1FF","secondaryBorderColor":"#2563EB","secondaryTextColor":"#102A43","tertiaryColor":"#FFF4D6","tertiaryBorderColor":"#B45309","tertiaryTextColor":"#102A43","lineColor":"#0F766E","textColor":"#102A43","fontFamily":"Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, sans-serif"},"flowchart":{"curve":"basis","htmlLabels":true}}}%%
41
42
  flowchart TD
42
43
  Codebase["Your Codebase"]
43
44
  Indexer["Indexer<br/>12 languages<br/>Rust native or Tree-sitter fallback"]
44
45
  Graph["LadybugDB graph<br/>symbols, edges, metrics, versions"]
45
- MCP["38 unique MCP tool surfaces<br/>flat, gateway, and code-mode"]
46
+ MCP["Current MCP surfaces<br/>33 flat, 6 gateway, 4 Code Mode"]
46
47
  CLI["13 CLI commands"]
47
48
  HTTP["HTTP API and graph UI"]
48
49
  Agent["AI coding agent<br/>Claude Code, Claude Desktop, Cursor, Windsurf, Codex, Gemini"]
49
50
 
50
- Codebase --> Indexer --> Graph
51
- Graph --> MCP
52
- Graph --> CLI
53
- Graph --> HTTP
54
- MCP --> Agent
51
+ Codebase e1@--> Indexer
52
+ Indexer e2@--> Graph
53
+ Graph e3@--> MCP
54
+ Graph e4@--> CLI
55
+ Graph e5@--> HTTP
56
+ MCP e6@--> Agent
57
+
58
+ classDef source fill:#E7F8F2,stroke:#0F766E,stroke-width:2px,color:#102A43;
59
+ classDef process fill:#E8F1FF,stroke:#2563EB,stroke-width:2px,color:#102A43;
60
+ classDef decision fill:#FFF4D6,stroke:#B45309,stroke-width:2px,color:#102A43;
61
+ classDef storage fill:#F2E8FF,stroke:#7C3AED,stroke-width:2px,color:#102A43;
62
+ classDef output fill:#FFE8EF,stroke:#BE123C,stroke-width:2px,color:#102A43;
63
+ classDef muted fill:#F8FAFC,stroke:#64748B,stroke-width:1px,color:#102A43;
64
+ classDef animate stroke:#0F766E,stroke-width:2px,stroke-dasharray:10\,5,stroke-dashoffset:900,animation:dash 22s linear infinite;
65
+ class e1,e2,e3,e4,e5,e6 animate;
55
66
  ```
56
67
 
57
68
  1. **Index once** — SDL-MCP parses every symbol in your repo and stores it as a compact metadata record (a "Symbol Card") in a graph database
@@ -64,10 +75,22 @@ flowchart TD
64
75
 
65
76
  <br/>
66
77
 
78
+ ## Prerequisites
79
+
80
+ - **Node.js 24+** is required ([download](https://nodejs.org/)). SDL-MCP uses Node.js features not available in earlier versions. Run `node -v` to check.
81
+
82
+ > **Peer dependency warnings during install?** The tree-sitter grammar packages may produce `ERESOLVE` warnings about peer dependencies. These are harmless — the install succeeds and everything works correctly. Add `--legacy-peer-deps` to suppress them: `npm install -g sdl-mcp --legacy-peer-deps`
83
+
84
+ <br/>
85
+
86
+ ---
87
+
88
+ <br/>
89
+
67
90
  ## Quick Start
68
91
 
69
92
  ```bash
70
- # Install
93
+ # Install (requires Node.js 24+)
71
94
  npm install -g sdl-mcp
72
95
 
73
96
  # Initialize, auto-detect languages, index your repo, and run health checks
@@ -77,7 +100,7 @@ sdl-mcp init -y --auto-index
77
100
  sdl-mcp serve --stdio
78
101
  ```
79
102
 
80
- Point your MCP client at the server and the agent gains access to all SDL-MCP tools. That's it.
103
+ Point your MCP client at the server and the agent gains access to SDL-MCP's current configured surface. By default that is exclusive Code Mode; set `codeMode.exclusive: false` when you want Code Mode plus the regular flat or gateway tools in one session.
81
104
 
82
105
  > **npx users:** Replace `sdl-mcp` with `npx --yes sdl-mcp@latest` in all commands above.
83
106
 
@@ -94,13 +117,25 @@ Point your MCP client at the server and the agent gains access to all SDL-MCP to
94
117
  The core innovation. Named after the adjustable aperture that controls light flow in optics, the Iris Gate Ladder lets agents dial their context "aperture" from a pinhole to wide-open.
95
118
 
96
119
  ```mermaid
120
+ %%{init: {"theme":"base","themeVariables":{"background":"#ffffff","primaryColor":"#E7F8F2","primaryBorderColor":"#0F766E","primaryTextColor":"#102A43","secondaryColor":"#E8F1FF","secondaryBorderColor":"#2563EB","secondaryTextColor":"#102A43","tertiaryColor":"#FFF4D6","tertiaryBorderColor":"#B45309","tertiaryTextColor":"#102A43","lineColor":"#0F766E","textColor":"#102A43","fontFamily":"Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, sans-serif"},"flowchart":{"curve":"basis","htmlLabels":true}}}%%
97
121
  flowchart TB
98
122
  R1["~100 tokens<br/>Rung 1: Symbol Card<br/>Name, signature, summary, dependencies, metrics"]
99
123
  R2["~300 tokens<br/>Rung 2: Skeleton IR<br/>Signatures and control flow with bodies elided"]
100
124
  R3["~600 tokens<br/>Rung 3: Hot-Path Excerpt<br/>Identifier-focused lines with context"]
101
125
  R4["~2,000 tokens<br/>Rung 4: Raw Code Window<br/>Policy-gated full source"]
102
126
 
103
- R1 --> R2 --> R3 --> R4
127
+ R1 e1@--> R2
128
+ R2 e2@--> R3
129
+ R3 e3@--> R4
130
+
131
+ classDef source fill:#E7F8F2,stroke:#0F766E,stroke-width:2px,color:#102A43;
132
+ classDef process fill:#E8F1FF,stroke:#2563EB,stroke-width:2px,color:#102A43;
133
+ classDef decision fill:#FFF4D6,stroke:#B45309,stroke-width:2px,color:#102A43;
134
+ classDef storage fill:#F2E8FF,stroke:#7C3AED,stroke-width:2px,color:#102A43;
135
+ classDef output fill:#FFE8EF,stroke:#BE123C,stroke-width:2px,color:#102A43;
136
+ classDef muted fill:#F8FAFC,stroke:#64748B,stroke-width:1px,color:#102A43;
137
+ classDef animate stroke:#0F766E,stroke-width:2px,stroke-dasharray:10\,5,stroke-dashoffset:900,animation:dash 22s linear infinite;
138
+ class e1,e2,e3 animate;
104
139
  ```
105
140
 
106
141
  > **Most questions are answered at Rungs 1-2** without ever reading raw code. That's where the token savings come from.
@@ -133,6 +168,7 @@ flowchart TB
133
168
  Every function, class, interface, type, and variable becomes a **Symbol Card**: a compact metadata record (~100 tokens) containing everything an agent needs to _understand_ a symbol without reading its code.
134
169
 
135
170
  ```mermaid
171
+ %%{init: {"theme":"base","themeVariables":{"background":"#ffffff","primaryColor":"#E7F8F2","primaryBorderColor":"#0F766E","primaryTextColor":"#102A43","secondaryColor":"#E8F1FF","secondaryBorderColor":"#2563EB","secondaryTextColor":"#102A43","tertiaryColor":"#FFF4D6","tertiaryBorderColor":"#B45309","tertiaryTextColor":"#102A43","lineColor":"#0F766E","textColor":"#102A43","fontFamily":"Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, sans-serif"},"flowchart":{"curve":"basis","htmlLabels":true}}}%%
136
172
  flowchart TB
137
173
  Card["Symbol Card: validateToken"]
138
174
  Kind["Kind: function (exported)"]
@@ -146,7 +182,25 @@ flowchart TB
146
182
  Context["Context: auth-module, request-pipeline, auth.test.ts"]
147
183
  ETag["ETag: a7f3c2..."]
148
184
 
149
- Card --> Kind --> File --> Signature --> Summary --> Invariants --> SideEffects --> Deps --> Metrics --> Context --> ETag
185
+ Card e1@--> Kind
186
+ Kind e2@--> File
187
+ File e3@--> Signature
188
+ Signature e4@--> Summary
189
+ Summary e5@--> Invariants
190
+ Invariants e6@--> SideEffects
191
+ SideEffects e7@--> Deps
192
+ Deps e8@--> Metrics
193
+ Metrics e9@--> Context
194
+ Context e10@--> ETag
195
+
196
+ classDef source fill:#E7F8F2,stroke:#0F766E,stroke-width:2px,color:#102A43;
197
+ classDef process fill:#E8F1FF,stroke:#2563EB,stroke-width:2px,color:#102A43;
198
+ classDef decision fill:#FFF4D6,stroke:#B45309,stroke-width:2px,color:#102A43;
199
+ classDef storage fill:#F2E8FF,stroke:#7C3AED,stroke-width:2px,color:#102A43;
200
+ classDef output fill:#FFE8EF,stroke:#BE123C,stroke-width:2px,color:#102A43;
201
+ classDef muted fill:#F8FAFC,stroke:#64748B,stroke-width:1px,color:#102A43;
202
+ classDef animate stroke:#0F766E,stroke-width:2px,stroke-dasharray:10\,5,stroke-dashoffset:900,animation:dash 22s linear infinite;
203
+ class e1,e2,e3,e4,e5,e6,e7,e8,e9,e10 animate;
150
204
  ```
151
205
 
152
206
  Cards include **confidence-scored call resolution** (the pass-2 resolver traces imports, aliases, barrel re-exports, and tagged templates to produce accurate dependency edges), **community detection** (cluster membership), and **call-chain tracing** (process participation with entry/intermediate/exit roles).
@@ -168,15 +222,25 @@ Cards include **confidence-scored call resolution** (the pass-2 resolver traces
168
222
  Instead of reading files in the same directory, SDL-MCP follows the _dependency graph_. Starting from symbols relevant to your task, it traverses weighted edges (call: 1.0, config: 0.8, import: 0.6), scores each symbol by relevance, and returns the N most important within a token budget.
169
223
 
170
224
  ```mermaid
225
+ %%{init: {"theme":"base","themeVariables":{"background":"#ffffff","primaryColor":"#E7F8F2","primaryBorderColor":"#0F766E","primaryTextColor":"#102A43","secondaryColor":"#E8F1FF","secondaryBorderColor":"#2563EB","secondaryTextColor":"#102A43","tertiaryColor":"#FFF4D6","tertiaryBorderColor":"#B45309","tertiaryTextColor":"#102A43","lineColor":"#0F766E","textColor":"#102A43","fontFamily":"Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, sans-serif"},"flowchart":{"curve":"basis","htmlLabels":true}}}%%
171
226
  flowchart TD
172
- Task["Task: Fix the auth middleware"] --> Slice["sdl.slice.build"]
173
- Slice --> Auth["authenticate"]
174
- Slice --> Validate["validateToken"]
175
- Slice --> Config["JwtConfig"]
176
- Auth --> Hash["hashPassword"]
177
- Validate --> User["getUserById"]
178
- Config --> Env["envLoader"]
179
- Env -. frontier outside budget .-> Frontier["spillover frontier"]
227
+ Task["Task: Fix the auth middleware"] e1@--> Slice["sdl.slice.build"]
228
+ Slice e2@--> Auth["authenticate"]
229
+ Slice e3@--> Validate["validateToken"]
230
+ Slice e4@--> Config["JwtConfig"]
231
+ Auth e5@--> Hash["hashPassword"]
232
+ Validate e6@--> User["getUserById"]
233
+ Config e7@--> Env["envLoader"]
234
+ Env e8@-. frontier outside budget .-> Frontier["spillover frontier"]
235
+
236
+ classDef source fill:#E7F8F2,stroke:#0F766E,stroke-width:2px,color:#102A43;
237
+ classDef process fill:#E8F1FF,stroke:#2563EB,stroke-width:2px,color:#102A43;
238
+ classDef decision fill:#FFF4D6,stroke:#B45309,stroke-width:2px,color:#102A43;
239
+ classDef storage fill:#F2E8FF,stroke:#7C3AED,stroke-width:2px,color:#102A43;
240
+ classDef output fill:#FFE8EF,stroke:#BE123C,stroke-width:2px,color:#102A43;
241
+ classDef muted fill:#F8FAFC,stroke:#64748B,stroke-width:1px,color:#102A43;
242
+ classDef animate stroke:#0F766E,stroke-width:2px,stroke-dasharray:10\,5,stroke-dashoffset:900,animation:dash 22s linear infinite;
243
+ class e1,e2,e3,e4,e5,e6,e7,e8 animate;
180
244
  ```
181
245
 
182
246
  Slices have handles, leases, refresh (delta-only updates), and spillover (paged overflow). You can also skip the symbol search entirely — pass a `taskText` string and SDL-MCP auto-discovers the relevant entry symbols.
@@ -197,6 +261,7 @@ Slices have handles, leases, refresh (delta-only updates), and spillover (paged
197
261
  `git diff` tells you what lines changed. SDL-MCP tells you what that change _means_ and who's affected.
198
262
 
199
263
  ```mermaid
264
+ %%{init: {"theme":"base","themeVariables":{"background":"#ffffff","primaryColor":"#E7F8F2","primaryBorderColor":"#0F766E","primaryTextColor":"#102A43","secondaryColor":"#E8F1FF","secondaryBorderColor":"#2563EB","secondaryTextColor":"#102A43","tertiaryColor":"#FFF4D6","tertiaryBorderColor":"#B45309","tertiaryTextColor":"#102A43","lineColor":"#0F766E","textColor":"#102A43","fontFamily":"Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, sans-serif"},"flowchart":{"curve":"basis","htmlLabels":true}}}%%
200
265
  flowchart TD
201
266
  Change["Modified validateToken() signature"]
202
267
  Sig["signatureDiff<br/>added options?: object"]
@@ -208,16 +273,25 @@ flowchart TD
208
273
  A3["AuthMiddleware<br/>distance 2"]
209
274
  A4["auth.test.ts<br/>re-run recommended"]
210
275
 
211
- Change --> Sig
212
- Change --> Inv
213
- Change --> Fx
214
- Sig --> Blast
215
- Inv --> Blast
216
- Fx --> Blast
217
- Blast --> A1
218
- Blast --> A2
219
- Blast --> A3
220
- Blast --> A4
276
+ Change e1@--> Sig
277
+ Change e2@--> Inv
278
+ Change e3@--> Fx
279
+ Sig e4@--> Blast
280
+ Inv e5@--> Blast
281
+ Fx e6@--> Blast
282
+ Blast e7@--> A1
283
+ Blast e8@--> A2
284
+ Blast e9@--> A3
285
+ Blast e10@--> A4
286
+
287
+ classDef source fill:#E7F8F2,stroke:#0F766E,stroke-width:2px,color:#102A43;
288
+ classDef process fill:#E8F1FF,stroke:#2563EB,stroke-width:2px,color:#102A43;
289
+ classDef decision fill:#FFF4D6,stroke:#B45309,stroke-width:2px,color:#102A43;
290
+ classDef storage fill:#F2E8FF,stroke:#7C3AED,stroke-width:2px,color:#102A43;
291
+ classDef output fill:#FFE8EF,stroke:#BE123C,stroke-width:2px,color:#102A43;
292
+ classDef muted fill:#F8FAFC,stroke:#64748B,stroke-width:1px,color:#102A43;
293
+ classDef animate stroke:#0F766E,stroke-width:2px,stroke-dasharray:10\,5,stroke-dashoffset:900,animation:dash 22s linear infinite;
294
+ class e1,e2,e3,e4,e5,e6,e7,e8,e9,e10 animate;
221
295
  ```
222
296
 
223
297
  **PR risk analysis** (`sdl.pr.risk.analyze`) wraps this into a scored assessment with findings, evidence, and test recommendations. **Fan-in trend analysis** detects "amplifier" symbols whose growing dependency count means changes ripple further over time.
@@ -238,12 +312,22 @@ flowchart TD
238
312
  SDL-MCP doesn't wait for you to save. As you type in your editor, buffer updates are pushed to an in-memory overlay store, parsed in the background, and merged with the durable database. Search, cards, and slices reflect your _current_ code, not your last save.
239
313
 
240
314
  ```mermaid
315
+ %%{init: {"theme":"base","themeVariables":{"background":"#ffffff","primaryColor":"#E7F8F2","primaryBorderColor":"#0F766E","primaryTextColor":"#102A43","secondaryColor":"#E8F1FF","secondaryBorderColor":"#2563EB","secondaryTextColor":"#102A43","tertiaryColor":"#FFF4D6","tertiaryBorderColor":"#B45309","tertiaryTextColor":"#102A43","lineColor":"#0F766E","textColor":"#102A43","fontFamily":"Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, sans-serif"},"flowchart":{"curve":"basis","htmlLabels":true}}}%%
241
316
  flowchart LR
242
- Editor["Editor keystrokes"] --> Push["sdl.buffer.push"]
243
- Push --> Overlay["Overlay store"]
244
- Overlay --> Reads["Merged reads<br/>search, cards, slices"]
245
- Overlay --> Persist["save / idle checkpoint"]
246
- Persist --> DB["LadybugDB durable graph"]
317
+ Editor["Editor keystrokes"] e1@--> Push["sdl.buffer.push"]
318
+ Push e2@--> Overlay["Overlay store"]
319
+ Overlay e3@--> Reads["Merged reads<br/>search, cards, slices"]
320
+ Overlay e4@--> Persist["save / idle checkpoint"]
321
+ Persist e5@--> DB["LadybugDB durable graph"]
322
+
323
+ classDef source fill:#E7F8F2,stroke:#0F766E,stroke-width:2px,color:#102A43;
324
+ classDef process fill:#E8F1FF,stroke:#2563EB,stroke-width:2px,color:#102A43;
325
+ classDef decision fill:#FFF4D6,stroke:#B45309,stroke-width:2px,color:#102A43;
326
+ classDef storage fill:#F2E8FF,stroke:#7C3AED,stroke-width:2px,color:#102A43;
327
+ classDef output fill:#FFE8EF,stroke:#BE123C,stroke-width:2px,color:#102A43;
328
+ classDef muted fill:#F8FAFC,stroke:#64748B,stroke-width:1px,color:#102A43;
329
+ classDef animate stroke:#0F766E,stroke-width:2px,stroke-dasharray:10\,5,stroke-dashoffset:900,animation:dash 22s linear infinite;
330
+ class e1,e2,e3,e4,e5 animate;
247
331
  ```
248
332
 
249
333
  **Why it matters:**
@@ -285,7 +369,7 @@ The sandboxed runtime execution tool (`sdl.runtime.execute`) has its own governa
285
369
 
286
370
  The feedback loop (`sdl.agent.feedback`) records which symbols were useful and which were missing, improving future slice quality.
287
371
 
288
- generates portable, token-bounded context briefings in markdown, JSON, or clipboard format for use outside MCP environments.
372
+ For portable exports such as tickets and PR descriptions, use the CLI `sdl-mcp summary` command. It generates token-bounded context briefings in markdown, JSON, or clipboard format for use outside MCP environments.
289
373
 
290
374
  **Why it matters:**
291
375
 
@@ -317,15 +401,25 @@ Run tests, linters, and scripts through SDL-MCP's governance layer instead of un
317
401
  Agents forget everything between sessions. SDL-MCP fixes this with an **opt-in graph-backed memory system** that lets agents store decisions, bugfix context, and task notes linked directly to the symbols and files they relate to. Memory is **disabled by default** and must be explicitly enabled in the configuration. When enabled, memories are stored both in the graph database (for fast querying) and as checked-in markdown files (for version control and team sharing).
318
402
 
319
403
  ```mermaid
404
+ %%{init: {"theme":"base","themeVariables":{"background":"#ffffff","primaryColor":"#E7F8F2","primaryBorderColor":"#0F766E","primaryTextColor":"#102A43","secondaryColor":"#E8F1FF","secondaryBorderColor":"#2563EB","secondaryTextColor":"#102A43","tertiaryColor":"#FFF4D6","tertiaryBorderColor":"#B45309","tertiaryTextColor":"#102A43","lineColor":"#0F766E","textColor":"#102A43","fontFamily":"Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, sans-serif"},"flowchart":{"curve":"basis","htmlLabels":true}}}%%
320
405
  flowchart LR
321
- Session1["Agent session 1<br/>records bugfix memory"] --> Store["sdl.memory.store"]
322
- Store --> Graph["LadybugDB memory node"]
323
- Store --> Files[".sdl-memory/bugfixes/<id>.md"]
324
- Graph --> Link1["MEMORY_OF -> authenticate()"]
325
- Graph --> Link2["HAS_MEMORY -> repo"]
326
- Session2["Agent session 2"] --> Surface["sdl.memory.surface"]
327
- Surface --> Graph
328
- Graph --> Recall["Relevant memory surfaced<br/>race condition fix in authenticate()"]
406
+ Session1["Agent session 1<br/>records bugfix memory"] e1@--> Store["sdl.memory.store"]
407
+ Store e2@--> Graph["LadybugDB memory node"]
408
+ Store e3@--> Files[".sdl-memory/bugfixes/<id>.md"]
409
+ Graph e4@--> Link1["MEMORY_OF -> authenticate()"]
410
+ Graph e5@--> Link2["HAS_MEMORY -> repo"]
411
+ Session2["Agent session 2"] e6@--> Surface["sdl.memory.surface"]
412
+ Surface e7@--> Graph
413
+ Graph e8@--> Recall["Relevant memory surfaced<br/>race condition fix in authenticate()"]
414
+
415
+ classDef source fill:#E7F8F2,stroke:#0F766E,stroke-width:2px,color:#102A43;
416
+ classDef process fill:#E8F1FF,stroke:#2563EB,stroke-width:2px,color:#102A43;
417
+ classDef decision fill:#FFF4D6,stroke:#B45309,stroke-width:2px,color:#102A43;
418
+ classDef storage fill:#F2E8FF,stroke:#7C3AED,stroke-width:2px,color:#102A43;
419
+ classDef output fill:#FFE8EF,stroke:#BE123C,stroke-width:2px,color:#102A43;
420
+ classDef muted fill:#F8FAFC,stroke:#64748B,stroke-width:1px,color:#102A43;
421
+ classDef animate stroke:#0F766E,stroke-width:2px,stroke-dasharray:10\,5,stroke-dashoffset:900,animation:dash 22s linear infinite;
422
+ class e1,e2,e3,e4,e5,e6,e7,e8 animate;
329
423
  ```
330
424
 
331
425
  When enabled, memories are **automatically surfaced** inside graph slices — when an agent builds a slice touching symbols with linked memories, those memories appear alongside the cards. During re-indexing, memories linked to changed symbols are **flagged as stale**, prompting agents to review and update them. Four MCP tools (`store`, `query`, `remove`, `surface`) provide full CRUD plus intelligent ranking by confidence, recency, and symbol overlap. Memory tools are only available when memory is enabled in the configuration.
@@ -344,15 +438,25 @@ When enabled, memories are **automatically surfaced** inside graph slices — wh
344
438
 
345
439
  ### SCIP Integration — Compiler-Grade Cross-References
346
440
 
347
- Tree-sitter gives SDL-MCP fast, syntax-level symbol extraction across 11 languages. SCIP (Source Code Intelligence Protocol) supplements this with **compiler-grade cross-references** from tools like scip-typescript, scip-go, and rust-analyzer. Generate a `.scip` index file, point SDL-MCP at it, and heuristic edges are upgraded to exact compiler-verified edges, external dependency symbols become first-class graph nodes, and new `implements` edges reveal interface/trait relationships that syntax analysis cannot discover.
441
+ Tree-sitter gives SDL-MCP fast, syntax-level symbol extraction across the supported TypeScript/JavaScript, Python, Go, Java, C#, C/C++, PHP, Rust, Kotlin, and Shell surface. SCIP (Source Code Intelligence Protocol) supplements this with **compiler-grade cross-references** from tools like scip-typescript, scip-go, and rust-analyzer. Generate a `.scip` index file, point SDL-MCP at it, and heuristic edges are upgraded to exact compiler-verified edges, external dependency symbols become first-class graph nodes, and new `implements` edges reveal interface/trait relationships that syntax analysis cannot discover.
348
442
 
349
443
  ```mermaid
444
+ %%{init: {"theme":"base","themeVariables":{"background":"#ffffff","primaryColor":"#E7F8F2","primaryBorderColor":"#0F766E","primaryTextColor":"#102A43","secondaryColor":"#E8F1FF","secondaryBorderColor":"#2563EB","secondaryTextColor":"#102A43","tertiaryColor":"#FFF4D6","tertiaryBorderColor":"#B45309","tertiaryTextColor":"#102A43","lineColor":"#0F766E","textColor":"#102A43","fontFamily":"Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, sans-serif"},"flowchart":{"curve":"basis","htmlLabels":true}}}%%
350
445
  flowchart LR
351
- Compiler["Compiler / Type Checker"] --> SCIP[".scip index file"]
352
- SCIP --> Ingest["sdl.scip.ingest"]
353
- Ingest --> Upgrade["Heuristic edges → exact edges"]
354
- Ingest --> External["External dependency nodes"]
355
- Ingest --> Implements["implements edges"]
446
+ Compiler["Compiler / Type Checker"] e1@--> SCIP[".scip index file"]
447
+ SCIP e2@--> Ingest["sdl.scip.ingest"]
448
+ Ingest e3@--> Upgrade["Heuristic edges → exact edges"]
449
+ Ingest e4@--> External["External dependency nodes"]
450
+ Ingest e5@--> Implements["implements edges"]
451
+
452
+ classDef source fill:#E7F8F2,stroke:#0F766E,stroke-width:2px,color:#102A43;
453
+ classDef process fill:#E8F1FF,stroke:#2563EB,stroke-width:2px,color:#102A43;
454
+ classDef decision fill:#FFF4D6,stroke:#B45309,stroke-width:2px,color:#102A43;
455
+ classDef storage fill:#F2E8FF,stroke:#7C3AED,stroke-width:2px,color:#102A43;
456
+ classDef output fill:#FFE8EF,stroke:#BE123C,stroke-width:2px,color:#102A43;
457
+ classDef muted fill:#F8FAFC,stroke:#64748B,stroke-width:1px,color:#102A43;
458
+ classDef animate stroke:#0F766E,stroke-width:2px,stroke-dasharray:10\,5,stroke-dashoffset:900,animation:dash 22s linear infinite;
459
+ class e1,e2,e3,e4,e5 animate;
356
460
  ```
357
461
 
358
462
  **Why it matters:**
@@ -369,7 +473,7 @@ flowchart LR
369
473
 
370
474
  ### CLI Tool Access — No MCP Server Required
371
475
 
372
- Access all 32 flat SDL action tools directly from the command line with `sdl-mcp tool`. No MCP server, transport, or SDK is required.
476
+ Access 30 SDL-MCP action aliases directly from the command line with `sdl-mcp tool`. No MCP server, transport, or SDK is required.
373
477
 
374
478
  ```bash
375
479
  # Search for symbols
@@ -386,7 +490,7 @@ Features include typed argument coercion (string, number, boolean, string[], jso
386
490
 
387
491
  **Why it matters:**
388
492
 
389
- - All MCP tool actions accessible from **any terminal** — no server, transport, or SDK required
493
+ - 30 direct action aliases accessible from **any terminal** — no server, transport, or SDK required
390
494
  - Same code paths and Zod validation as the MCP server — identical behavior
391
495
  - Four output formats (json, json-compact, pretty, table) for scripting and CI pipelines
392
496
  - Auto-resolves repoId from cwd, supports stdin JSON piping and per-action `--help`
@@ -395,24 +499,34 @@ Features include typed argument coercion (string, number, boolean, string[], jso
395
499
 
396
500
  ---
397
501
 
398
- ### Tool Gateway — 81% Token Reduction
502
+ ### Tool Gateway — Compact Tool Registration
399
503
 
400
- The tool gateway consolidates the 32 flat SDL action tools into **4 namespace-scoped tools** (`sdl.query`, `sdl.code`, `sdl.repo`, `sdl.agent`), reducing `tools/list` overhead from the full flat schema surface to a compact gateway surface.
504
+ The tool gateway projects the 30 gateway-routable SDL actions into **4 namespace-scoped tools** (`sdl.query`, `sdl.code`, `sdl.repo`, `sdl.agent`), reducing `tools/list` overhead from the full flat schema surface to a compact gateway surface.
401
505
 
402
506
  ```mermaid
507
+ %%{init: {"theme":"base","themeVariables":{"background":"#ffffff","primaryColor":"#E7F8F2","primaryBorderColor":"#0F766E","primaryTextColor":"#102A43","secondaryColor":"#E8F1FF","secondaryBorderColor":"#2563EB","secondaryTextColor":"#102A43","tertiaryColor":"#FFF4D6","tertiaryBorderColor":"#B45309","tertiaryTextColor":"#102A43","lineColor":"#0F766E","textColor":"#102A43","fontFamily":"Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, sans-serif"},"flowchart":{"curve":"basis","htmlLabels":true}}}%%
403
508
  flowchart LR
404
- Before["Flat mode<br/>32 flat action tools<br/>plus universal discovery/info"] --> After["Gateway mode<br/>4 namespace tools<br/>plus universal discovery/info"]
405
- After --> Savings["Smaller tools/list payload<br/>lower agent startup overhead"]
509
+ Before["Flat mode<br/>33 tools<br/>2 universal + 31 flat"] e1@--> After["Gateway mode<br/>6 tools<br/>2 universal + 4 gateway"]
510
+ After e2@--> Savings["Smaller tools/list payload<br/>lower agent startup overhead"]
511
+
512
+ classDef source fill:#E7F8F2,stroke:#0F766E,stroke-width:2px,color:#102A43;
513
+ classDef process fill:#E8F1FF,stroke:#2563EB,stroke-width:2px,color:#102A43;
514
+ classDef decision fill:#FFF4D6,stroke:#B45309,stroke-width:2px,color:#102A43;
515
+ classDef storage fill:#F2E8FF,stroke:#7C3AED,stroke-width:2px,color:#102A43;
516
+ classDef output fill:#FFE8EF,stroke:#BE123C,stroke-width:2px,color:#102A43;
517
+ classDef muted fill:#F8FAFC,stroke:#64748B,stroke-width:1px,color:#102A43;
518
+ classDef animate stroke:#0F766E,stroke-width:2px,stroke-dasharray:10\,5,stroke-dashoffset:900,animation:dash 22s linear infinite;
519
+ class e1,e2 animate;
406
520
  ```
407
521
 
408
- Each gateway tool accepts an `action` discriminator field (e.g., `{ action: "symbol.search", repoId: "x", query: "auth" }`) and routes to the same handlers with double Zod validation. Thin wire schemas in `tools/list` keep the registration compact while full validation happens server-side. Legacy flat tool names are optionally emitted alongside for backward compatibility.
522
+ Each gateway tool accepts an `action` discriminator field (e.g., `{ action: "symbol.search", repoId: "x", query: "auth" }`) and routes to the same handlers with double Zod validation. Thin wire schemas in `tools/list` keep the registration compact while full validation happens server-side. The flat-only `sdl.file.write` action remains outside gateway mode today.
409
523
 
410
524
  **Why it matters:**
411
525
 
412
526
  - Large reduction in `tools/list` overhead for gateway-first agents
413
- - 32 flat action tools consolidated into 4 namespace-scoped tools for simpler agent selection
527
+ - 30 gateway-routable actions consolidated into 4 namespace-scoped tools for simpler agent selection
414
528
  - Fewer tool choices means faster and more accurate tool dispatch by the agent
415
- - Backward-compatible: legacy flat tool names optionally emitted alongside
529
+ - Choose Code Mode for task-shaped retrieval first; opt out of exclusive Code Mode when you also need regular flat or gateway tools
416
530
 
417
531
  [Tool Gateway Deep Dive →](./docs/feature-deep-dives/tool-gateway.md)
418
532
 
@@ -422,7 +536,16 @@ Each gateway tool accepts an `action` discriminator field (e.g., `{ action: "sym
422
536
 
423
537
  <br/>
424
538
 
425
- ## All 38 Unique Tool Surfaces at a Glance
539
+ ## Current Tool Surface at a Glance
540
+
541
+ | Mode | Tool count | Composition |
542
+ | :--- | :--------- | :---------- |
543
+ | Flat | `33` | `2` universal + `31` flat tools |
544
+ | Gateway | `6` | `2` universal + `4` gateway tools |
545
+ | Gateway + legacy | `37` | `2` universal + `4` gateway + `31` flat tools |
546
+ | Code Mode exclusive | `4` | `sdl.action.search`, `sdl.context`, `sdl.manual`, `sdl.workflow` |
547
+
548
+ The generated source of truth is [`docs/generated/tool-inventory.md`](./docs/generated/tool-inventory.md).
426
549
 
427
550
  <table>
428
551
  <tr><th>Category</th><th>Tool</th><th>One-Line Description</th></tr>
@@ -437,10 +560,9 @@ Each gateway tool accepts an `action` discriminator field (e.g., `{ action: "sym
437
560
  <tr><td><code>sdl.buffer.checkpoint</code></td><td>Force-write pending buffers to the durable database</td></tr>
438
561
  <tr><td><code>sdl.buffer.status</code></td><td>Live indexing diagnostics and queue depth</td></tr>
439
562
 
440
- <tr><td rowspan="3"><strong>Symbols</strong></td>
563
+ <tr><td rowspan="2"><strong>Symbols</strong></td>
441
564
  <td><code>sdl.symbol.search</code></td><td>Search symbols by name (with optional semantic reranking)</td></tr>
442
- <tr><td><code>sdl.symbol.getCard</code></td><td>Get a symbol card with ETag-based conditional support</td></tr>
443
- <tr><td><code>sdl.symbol.getCard</code></td><td>Batch-fetch up to 100 cards in one round trip</td></tr>
565
+ <tr><td><code>sdl.symbol.getCard</code></td><td>Get one card or batch-fetch up to 100 cards with ETag-based conditional support</td></tr>
444
566
 
445
567
  <tr><td rowspan="3"><strong>Slices</strong></td>
446
568
  <td><code>sdl.slice.build</code></td><td>Build a task-scoped dependency subgraph</td></tr>
@@ -462,12 +584,8 @@ Each gateway tool accepts an `action` discriminator field (e.g., `{ action: "sym
462
584
  <tr><td><strong>Risk</strong></td>
463
585
  <td><code>sdl.pr.risk.analyze</code></td><td>Scored PR risk with findings and test recommendations</td></tr>
464
586
 
465
- <tr><td><strong>Context</strong></td>
466
- <td><code></code></td><td>Token-bounded portable briefing (markdown/JSON/clipboard) with conditional ETag fetch support</td></tr>
467
-
468
- <tr><td rowspan="3"><strong>Agent</strong></td>
469
- <td><code>sdl.context</code></td><td>Task-shaped context retrieval with budget-controlled rung planning and conditional ETag fetch support</td></tr>
470
- <tr><td><code>sdl.agent.feedback</code></td><td>Record which symbols were useful or missing</td></tr>
587
+ <tr><td rowspan="2"><strong>Agent</strong></td>
588
+ <td><code>sdl.agent.feedback</code></td><td>Record which symbols were useful or missing</td></tr>
471
589
  <tr><td><code>sdl.agent.feedback.query</code></td><td>Query aggregated feedback statistics</td></tr>
472
590
 
473
591
  <tr><td rowspan="2"><strong>Runtime</strong></td>
@@ -488,8 +606,9 @@ Each gateway tool accepts an `action` discriminator field (e.g., `{ action: "sym
488
606
  <tr><td><strong>SCIP</strong></td>
489
607
  <td><code>sdl.scip.ingest</code></td><td>Ingest a pre-built SCIP index for compiler-grade cross-references (with dry-run support)</td></tr>
490
608
 
491
- <tr><td><strong>File</strong></td>
609
+ <tr><td rowspan="2"><strong>File</strong></td>
492
610
  <td><code>sdl.file.read</code></td><td>Read non-indexed files (configs, docs, templates) with line-range, search, or JSON-path modes</td></tr>
611
+ <tr><td><code>sdl.file.write</code></td><td>Policy-aware write helper for non-indexed files and templates</td></tr>
493
612
 
494
613
  <tr><td rowspan="3"><strong>Meta</strong></td>
495
614
  <td><code>sdl.info</code></td><td>Runtime diagnostics — version, Node.js, platform, database, config paths</td></tr>
@@ -513,7 +632,7 @@ Each gateway tool accepts an `action` discriminator field (e.g., `{ action: "sym
513
632
  | `sdl-mcp doctor` | Validate runtime, config, DB, grammars, repo access |
514
633
  | `sdl-mcp index` | Index repositories (with optional `--watch` mode) |
515
634
  | `sdl-mcp serve` | Start MCP server (`--stdio` or `--http`) |
516
- | `sdl-mcp tool` | Access all 35 MCP tool actions directly ([docs](./docs/feature-deep-dives/cli-tool-access.md)) |
635
+ | `sdl-mcp tool` | Access 30 direct action aliases ([docs](./docs/feature-deep-dives/cli-tool-access.md)) |
517
636
  | `sdl-mcp info` | Runtime diagnostics — version, Node.js, platform, database, config |
518
637
  | `sdl-mcp summary` | Generate copy/paste context summaries from the CLI |
519
638
  | `sdl-mcp health` | Compute composite health score with badge/JSON output |
@@ -575,6 +694,7 @@ A **VSCode extension** (`sdl-mcp-vscode/`) provides live buffer integration for
575
694
  ## System Architecture
576
695
 
577
696
  ```mermaid
697
+ %%{init: {"theme":"base","themeVariables":{"background":"#ffffff","primaryColor":"#E7F8F2","primaryBorderColor":"#0F766E","primaryTextColor":"#102A43","secondaryColor":"#E8F1FF","secondaryBorderColor":"#2563EB","secondaryTextColor":"#102A43","tertiaryColor":"#FFF4D6","tertiaryBorderColor":"#B45309","tertiaryTextColor":"#102A43","lineColor":"#0F766E","textColor":"#102A43","fontFamily":"Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, sans-serif"},"flowchart":{"curve":"basis","htmlLabels":true}}}%%
578
698
  flowchart TD
579
699
  Clients["MCP clients<br/>Claude Code, Claude Desktop, Cursor, Windsurf, Codex, Gemini"]
580
700
  Gateway["Tool gateway<br/>sdl.query, sdl.code, sdl.repo, sdl.agent"]
@@ -583,12 +703,21 @@ flowchart TD
583
703
  Graph["LadybugDB graph<br/>symbols, edges, files, versions, memories"]
584
704
  Indexer["Indexer pipeline<br/>Rust native or Tree-sitter fallback<br/>pass 1, pass 2, semantic enrichment"]
585
705
 
586
- Clients --> Gateway
587
- Clients --> Flat
588
- Gateway --> Policy
589
- Flat --> Policy
590
- Policy --> Graph
591
- Indexer --> Graph
706
+ Clients e1@--> Gateway
707
+ Clients e2@--> Flat
708
+ Gateway e3@--> Policy
709
+ Flat e4@--> Policy
710
+ Policy e5@--> Graph
711
+ Indexer e6@--> Graph
712
+
713
+ classDef source fill:#E7F8F2,stroke:#0F766E,stroke-width:2px,color:#102A43;
714
+ classDef process fill:#E8F1FF,stroke:#2563EB,stroke-width:2px,color:#102A43;
715
+ classDef decision fill:#FFF4D6,stroke:#B45309,stroke-width:2px,color:#102A43;
716
+ classDef storage fill:#F2E8FF,stroke:#7C3AED,stroke-width:2px,color:#102A43;
717
+ classDef output fill:#FFE8EF,stroke:#BE123C,stroke-width:2px,color:#102A43;
718
+ classDef muted fill:#F8FAFC,stroke:#64748B,stroke-width:1px,color:#102A43;
719
+ classDef animate stroke:#0F766E,stroke-width:2px,stroke-dasharray:10\,5,stroke-dashoffset:900,animation:dash 22s linear infinite;
720
+ class e1,e2,e3,e4,e5,e6 animate;
592
721
  ```
593
722
 
594
723
  [Full Architecture Documentation →](./docs/architecture.md)
@@ -604,7 +733,7 @@ flowchart TD
604
733
  | Document | Description |
605
734
  | :---------------------------------------------------------------- | :------------------------------------------------------------------------------ |
606
735
  | [Getting Started](./docs/getting-started.md) | Installation, 5-minute setup, MCP client config |
607
- | [MCP Tools Reference](./docs/mcp-tools-detailed.md) | Detailed docs for all 37 unique tool surfaces (parameters, responses, examples) |
736
+ | [MCP Tools Reference](./docs/mcp-tools-detailed.md) | Detailed docs for the current flat, gateway, and Code Mode surfaces |
608
737
  | [CLI Reference](./docs/cli-reference.md) | All CLI commands and options |
609
738
  | [Configuration Reference](./docs/configuration-reference.md) | Every config option with defaults and guidance |
610
739
  | [Agent Workflows](./docs/agent-workflows.md) | Workflow instructions for CLAUDE.md / AGENTS.md |
@@ -625,8 +754,8 @@ flowchart TD
625
754
  | [Context Modes](./docs/feature-deep-dives/context-modes.md) | Precise vs broad retrieval, adaptive symbol ranking, benchmark trade-offs |
626
755
  | [Indexing & Languages](./docs/feature-deep-dives/indexing-languages.md) | Rust/TS engines, two-pass architecture, 12-language support |
627
756
  | [Runtime Execution](./docs/feature-deep-dives/runtime-execution.md) | Sandboxed subprocess execution with governance |
628
- | [CLI Tool Access](./docs/feature-deep-dives/cli-tool-access.md) | Direct CLI access to all tool actions, output formats, stdin piping, scripting |
629
- | [Tool Gateway](./docs/feature-deep-dives/tool-gateway.md) | 35→4 tool consolidation, token reduction, thin schemas, migration guide |
757
+ | [CLI Tool Access](./docs/feature-deep-dives/cli-tool-access.md) | Direct CLI access to 30 action aliases, output formats, stdin piping, scripting |
758
+ | [Tool Gateway](./docs/feature-deep-dives/tool-gateway.md) | 30 gateway-routable actions, 4 namespace tools, thin schemas, migration guide |
630
759
  | [Semantic Engine](./docs/feature-deep-dives/semantic-engine.md) | Pass-2 call resolution, embedding search, LLM summaries, confidence scoring |
631
760
  | [Semantic Embeddings Setup](./docs/feature-deep-dives/semantic-embeddings-setup.md) | Dependencies, model installation, provider configuration, tier-by-tier setup |
632
761
  | [Code Mode](./docs/feature-deep-dives/code-mode.md) | `sdl.context`, `sdl.workflow`, action discovery, manual reference, one-call workflows |