devsmind-mcp 2.2.2 β 2.3.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.
- package/README.md +234 -606
- package/dist/cli/analyze.d.ts +13 -0
- package/dist/cli/analyze.js +143 -0
- package/dist/cli/analyze.js.map +1 -0
- package/dist/cli/index.js +62 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/integrations/memory.js +7 -2
- package/dist/cli/integrations/memory.js.map +1 -1
- package/dist/cli/integrations/prompt.d.ts +2 -0
- package/dist/cli/integrations/prompt.js +21 -7
- package/dist/cli/integrations/prompt.js.map +1 -1
- package/dist/cli/rule.js +35 -54
- package/dist/cli/rule.js.map +1 -1
- package/dist/cli/sync.d.ts +7 -0
- package/dist/cli/sync.js +40 -7
- package/dist/cli/sync.js.map +1 -1
- package/dist/cli/workflow.d.ts +8 -0
- package/dist/cli/workflow.js +156 -0
- package/dist/cli/workflow.js.map +1 -0
- package/dist/db/analyze.d.ts +67 -0
- package/dist/db/analyze.js +163 -0
- package/dist/db/analyze.js.map +1 -0
- package/dist/db/database.d.ts +151 -2
- package/dist/db/database.js +682 -62
- package/dist/db/database.js.map +1 -1
- package/dist/db/schema.d.ts +28 -1
- package/dist/db/schema.js +34 -0
- package/dist/db/schema.js.map +1 -1
- package/dist/db/staging.d.ts +4 -0
- package/dist/db/staging.js +16 -2
- package/dist/db/staging.js.map +1 -1
- package/dist/db/workflow-import.d.ts +22 -0
- package/dist/db/workflow-import.js +116 -0
- package/dist/db/workflow-import.js.map +1 -0
- package/dist/mcp/server.d.ts +1 -1
- package/dist/mcp/server.js +369 -11
- package/dist/mcp/server.js.map +1 -1
- package/dist/utils/config.d.ts +2 -0
- package/dist/utils/config.js +11 -0
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/git.d.ts +14 -0
- package/dist/utils/git.js +43 -0
- package/dist/utils/git.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,606 +1,234 @@
|
|
|
1
|
-
# π§ DevsMind β Team AI Brain
|
|
2
|
-
|
|
3
|
-
[](https://www.npmjs.com/package/devsmind-mcp)
|
|
4
|
-
[](https://github.com/Abialidr/devsmind/blob/main/LICENSE)
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
β
|
|
16
|
-
β
|
|
17
|
-
β
|
|
18
|
-
β
|
|
19
|
-
β
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
brain
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
#
|
|
100
|
-
#
|
|
101
|
-
devsmind
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
#
|
|
110
|
-
#
|
|
111
|
-
#
|
|
112
|
-
#
|
|
113
|
-
devsmind
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
devsmind
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
devsmind
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
devsmind
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
### `devsmind index --run`
|
|
236
|
-
|
|
237
|
-
Full/initial indexing. Must be run with `--run`, otherwise it just prints instructions for in-chat indexing instead.
|
|
238
|
-
|
|
239
|
-
```bash
|
|
240
|
-
devsmind index --run --provider gemini --model gemini-2.5-flash --key YOUR_API_KEY --chunk-size 1500
|
|
241
|
-
```
|
|
242
|
-
|
|
243
|
-
| Flag | Description |
|
|
244
|
-
|---|---|
|
|
245
|
-
| `-p, --path <devmind_path>` | Path to `.devmind` (default: `.devmind` in cwd) |
|
|
246
|
-
| `--run` | **Required** to actually start indexing |
|
|
247
|
-
| `--provider <provider>` | `gemini` (default) \| `vertex` \| `ollama` |
|
|
248
|
-
| `--model <name>` | Model id (default per provider β see [Providers & Performance](#providers--performance) below) |
|
|
249
|
-
| `--key <api_key>` | API key or service account JSON path (overrides `GEMINI_API_KEY` / `GOOGLE_APPLICATION_CREDENTIALS`) |
|
|
250
|
-
| `--url <url>` | Ollama server endpoint (default `http://localhost:11434`) |
|
|
251
|
-
| `--chunk-size <lines>` | Max lines per chunk sent to the LLM (default: off β whole file in one call) |
|
|
252
|
-
| `--chunk-overlap <lines>` | Overlap lines between chunks, only used with `--chunk-size` (default `50`) |
|
|
253
|
-
| `--rpm <number>` | Max LLM requests per minute, paced proactively (default: **unthrottled** β fires back-to-back, relies on 429 retry/backoff) |
|
|
254
|
-
| `--from-scratch` | Wipes ALL nodes, connections, history, and `graph/`/`history/` folders, then reindexes from zero. Prompts for confirmation unless `--yes` is passed |
|
|
255
|
-
| `--nodes-only` | Only run Phase 1 (node extraction). No connections touched |
|
|
256
|
-
| `--edges-only` | Only run Phase 2 (connection resolution). Wipes and rebuilds connections across all current nodes. Requires nodes to already exist |
|
|
257
|
-
| `--repos <names>` | Comma-separated repo names to restrict the run to (standalone mode only) |
|
|
258
|
-
| `--yes` | Skip the confirmation prompt for `--from-scratch` |
|
|
259
|
-
| `--local-edges` | *Deprecated, no-op.* Connections are always resolved locally via AST now |
|
|
260
|
-
|
|
261
|
-
**Valid / invalid combinations** (enforced in code, not just convention):
|
|
262
|
-
* β `--nodes-only` + `--edges-only` together β mutually exclusive, omit both for a full run.
|
|
263
|
-
* β `--from-scratch` + `--edges-only` together β nothing to build edges from after a full wipe. Use `--from-scratch --nodes-only`, then `--edges-only` as a separate follow-up run.
|
|
264
|
-
* β `--repos` + `--from-scratch` together β `--from-scratch` wipes the entire graph, so per-repo scoping doesn't apply.
|
|
265
|
-
* β
`--repos` composes fine with `--nodes-only` or `--edges-only` (e.g. rebuild edges for just one repo).
|
|
266
|
-
|
|
267
|
-
```bash
|
|
268
|
-
devsmind index --run --provider ollama --model qwen2.5-coder
|
|
269
|
-
devsmind index --run --provider gemini --key YOUR_KEY --nodes-only
|
|
270
|
-
devsmind index --run --edges-only --repos harrir-web,harrir-web-admin
|
|
271
|
-
devsmind index --run --provider gemini --key YOUR_KEY --from-scratch --yes
|
|
272
|
-
```
|
|
273
|
-
|
|
274
|
-
### `devsmind reindex`
|
|
275
|
-
|
|
276
|
-
Syncs the graph with code changes since the last run. No `--run` flag needed β it always executes.
|
|
277
|
-
|
|
278
|
-
```bash
|
|
279
|
-
devsmind reindex --provider gemini --key YOUR_API_KEY
|
|
280
|
-
```
|
|
281
|
-
|
|
282
|
-
| Flag | Description |
|
|
283
|
-
|---|---|
|
|
284
|
-
| `-p, --path <devmind_path>` | Path to `.devmind` (default: `.devmind` in cwd) |
|
|
285
|
-
| `--provider <provider>` | `gemini` (default) \| `vertex` \| `ollama` |
|
|
286
|
-
| `--model <name>` | Model id |
|
|
287
|
-
| `--key <api_key>` | API key / service account path |
|
|
288
|
-
| `--url <url>` | Ollama endpoint |
|
|
289
|
-
| `--chunk-size <lines>` / `--chunk-overlap <lines>` | Same as `index` β bump `--chunk-size` (e.g. `3000`) if large files are timing out |
|
|
290
|
-
| `--rpm <number>` | Same as `index` β unthrottled by default |
|
|
291
|
-
| `--fill-gaps` | Gap-fill mode β see below |
|
|
292
|
-
| `--local-edges` | *Deprecated, no-op* |
|
|
293
|
-
|
|
294
|
-
There is no `--from-scratch` / `--nodes-only` / `--edges-only` / `--repos` on `reindex` β those are `index`-only.
|
|
295
|
-
|
|
296
|
-
**Two selection modes:**
|
|
297
|
-
|
|
298
|
-
* **Default (no flags beyond provider/key):** diffs file modification times against the graph's `last_reindex_at` cursor. Only files touched since the last successful reindex get reprocessed. Fast, but a file whose extraction fails partway through is *not* retried automatically on the next run once the cursor moves past it.
|
|
299
|
-
* **`--fill-gaps`:** ignores mtimes entirely. Instead it finds every indexable file that currently has **zero nodes** in the graph (never indexed, or dropped by a prior crashed run) and backfills just those. Per-file failures are logged and skipped rather than aborting the whole run β safe to re-run repeatedly until the gap list is empty. After backfilling, it rebuilds connections across the *entire* active graph (not just the new nodes) via local AST resolution β no LLM cost β so edges pointing *into* the newly-added nodes from already-indexed files get picked up too. History and existing nodes are never touched by this rebuild.
|
|
300
|
-
|
|
301
|
-
```bash
|
|
302
|
-
devsmind reindex --provider vertex --model gemini-2.5-flash --key sa.json --fill-gaps --rpm 60 --chunk-size 3000
|
|
303
|
-
```
|
|
304
|
-
|
|
305
|
-
### Providers & Performance
|
|
306
|
-
|
|
307
|
-
Applies to both `index` and `reindex` β same `--provider`/`--model`/`--rpm`/`--chunk-size` flags, same Phase 1 (LLM) vs Phase 2 (local AST) split.
|
|
308
|
-
|
|
309
|
-
**Supported providers (`--provider`):**
|
|
310
|
-
|
|
311
|
-
| Provider | Auth | Notes |
|
|
312
|
-
|---|---|---|
|
|
313
|
-
| `gemini` (default) | `--key` or `GEMINI_API_KEY` env var | Default model: `gemini-2.0-flash` |
|
|
314
|
-
| `vertex` | `--key` (service account JSON path or inline JSON, or a raw `ya29.` bearer token) or `GOOGLE_APPLICATION_CREDENTIALS` / `VERTEX_API_KEY` / `GEMINI_API_KEY`. Needs `GCP_PROJECT_ID` (or a project id embedded in the service account JSON) | Default model: `gemini-1.5-flash` |
|
|
315
|
-
| `ollama` | None β local server | Default model: `qwen2.5-coder`. Default endpoint `http://localhost:11434`, override with `--url` |
|
|
316
|
-
|
|
317
|
-
**Performance flags:**
|
|
318
|
-
* `--local-edges` *(always on, flag is a no-op)*: connection resolution (Phase 2) runs entirely locally via the TypeScript/JavaScript AST parser (with a regex fallback for Python, Go, Java, etc.) β instant, offline, free, deterministic. Only Phase 1 (node extraction) calls the LLM.
|
|
319
|
-
* `--chunk-size <lines>`: for large-context models, scale this up (e.g. `1500`β`3000`) to process big files in one or two chunks instead of timing out or getting truncated on a single whole-file call.
|
|
320
|
-
* `--rpm <number>`: opt-in throttling. Leave unset unless you're hitting a known provider quota.
|
|
321
|
-
|
|
322
|
-
**Benchmarks** *(approximate β from informal internal testing, not a rigorous accuracy-scoring methodology; your results will vary by repo, prompt, and quota)*:
|
|
323
|
-
|
|
324
|
-
| Model | Repo size | Time | Approx. graph accuracy |
|
|
325
|
-
|---|---|---|---|
|
|
326
|
-
| `qwen2.5-coder:30b` (Ollama, local) | ~1,080 files | ~15 hours | ~50% |
|
|
327
|
-
| `gemini-2.5-flash` (cloud) | same repo | ~5 hours | ~90% |
|
|
328
|
-
|
|
329
|
-
Takeaway: local models avoid API cost and keep code on-machine, but for anything beyond small/medium repos a cloud flash-tier model is dramatically faster and more accurate for Phase 1 extraction. Phase 2 (edges) is local/free either way.
|
|
330
|
-
|
|
331
|
-
---
|
|
332
|
-
|
|
333
|
-
## π `devsmind init` In Depth
|
|
334
|
-
|
|
335
|
-
`devsmind init` behaves differently depending on whether a `.devmind/config.json` already exists in the target directory.
|
|
336
|
-
|
|
337
|
-
### First-time setup (no existing config)
|
|
338
|
-
|
|
339
|
-
1. **Project name + mode.** Prompts for a project name, then a choice between:
|
|
340
|
-
* **Embedded** β the brain lives inside the project's own repo at `<repo>/.devmind`. Repo paths are stored as a relative path (`.`), so cloning the repo anywhere just works β no machine-specific config needed.
|
|
341
|
-
* **Standalone** β the brain lives in its own separate folder (you're prompted for a folder name and parent directory), and can reference *multiple* independent Git repos. Each repo's absolute local path is stored per-developer in `.env` (since paths differ machine to machine).
|
|
342
|
-
2. **Repo configuration.** Embedded mode configures exclusions once for the single repo. Standalone mode loops, letting you add as many repos as you want, each with its own name, local path, and exclusions.
|
|
343
|
-
3. **Exclusions, per repo.** For each repo you get:
|
|
344
|
-
* An offer to auto-import the repo's own `.gitignore` patterns.
|
|
345
|
-
* An offer to add common non-code config files (lockfiles, `tsconfig.json`, eslint/prettier configs, etc.) if present.
|
|
346
|
-
* An interactive file browser to manually toggle folders/files in or out of indexing scope.
|
|
347
|
-
4. **Developer info.** Name and email, pre-filled from `git config user.name` / `user.email` if available. Always written to `.env` (never committed).
|
|
348
|
-
5. **Tech stack auto-detection.** Scans each repo path for `tsconfig.json`, `go.mod`, `pom.xml`, `Cargo.toml`, `requirements.txt`/`pyproject.toml`, and `package.json` dependencies (detects nestjs, express, nextjs, react, vue, fastify, angular, svelte, hono, koa, prisma, typeorm, mongoose). You confirm or manually correct the result.
|
|
349
|
-
6. **Session timeout** (default 60 minutes) and optional **environment URLs** (dev/staging/prod) and **free-text notes** for the AI.
|
|
350
|
-
7. **Files written:**
|
|
351
|
-
* `.devmind/config.json` β project name, mode, repos, ignored paths, tech stack, environments, notes. **Committed to Git.**
|
|
352
|
-
* `.devmind/.env` β developer name/email + (standalone mode) each repo's local absolute path. **Gitignored.**
|
|
353
|
-
* `.devmind/.gitignore` β auto-created to exclude `.env`, `brain.db`, `brain.db-wal`, `brain.db-shm`, `index_scratchpad.json`.
|
|
354
|
-
* `.devmind/graph/` and `.devmind/history/` β created with `.gitkeep` so Git tracks the (initially empty) directories.
|
|
355
|
-
* `.devmind/brain.db` β empty SQLite cache, initialized immediately.
|
|
356
|
-
|
|
357
|
-
### Re-running `init` (config already exists)
|
|
358
|
-
|
|
359
|
-
This is the **joining-developer / repair flow** β it never overwrites the shared `config.json`:
|
|
360
|
-
|
|
361
|
-
1. Checks `.env` for developer name/email; prompts only if missing.
|
|
362
|
-
2. **Embedded mode:** verifies the repo's relative path still resolves and reports any that don't (rare β embedded paths are just `.`).
|
|
363
|
-
3. **Standalone mode:** checks every repo's `path_key` in `.env` against the filesystem. Any repo with a missing or now-invalid local path gets prompted for a corrected absolute path; everything else in `.env` (including unrelated keys) is preserved as-is.
|
|
364
|
-
4. Rewrites `.env`, ensures `.gitignore` exists, and re-initializes `brain.db` if needed.
|
|
365
|
-
|
|
366
|
-
This is exactly what a new team member runs after `git clone`-ing a project that already has `.devmind/config.json` committed β see [Quick Start B) Joining / resuming an existing brain](#-quick-start) above.
|
|
367
|
-
|
|
368
|
-
---
|
|
369
|
-
|
|
370
|
-
## π₯οΈ Other CLI Commands
|
|
371
|
-
|
|
372
|
-
* **`devsmind start [--stdio] [-p, --port <number>]`** β starts the MCP server. Default: HTTP on port `4513`, reachable at `http://localhost:4513/mcp`. Pass `--stdio` for IDEs that manage the server process directly instead of connecting over HTTP.
|
|
373
|
-
* **`devsmind view [-p, --path <devmind_path>] [-P, --port <number>]`** β opens the interactive D3.js graph visualizer in your browser (see [below](#-interactive-graph-visualizer)).
|
|
374
|
-
* **`devsmind prune [-p, --path <devmind_path>]`** β interactive terminal tool to review node stats, inspect current code, page through chronological change history, and permanently delete individual nodes or clear all nodes/history.
|
|
375
|
-
|
|
376
|
-
---
|
|
377
|
-
|
|
378
|
-
## ποΈ Database Schema: `.devmind/brain.db`
|
|
379
|
-
|
|
380
|
-
The local SQLite database (`brain.db`) acts as a metadata cache. The full database schema consists of three tables:
|
|
381
|
-
|
|
382
|
-
### 1. `nodes` (Code Entities)
|
|
383
|
-
Contains structural identifiers.
|
|
384
|
-
```sql
|
|
385
|
-
CREATE TABLE nodes (
|
|
386
|
-
id TEXT PRIMARY KEY, -- e.g., "CartService.applyPromoCode"
|
|
387
|
-
type TEXT NOT NULL, -- Taxonomy type (e.g., nest_controller, route_handler)
|
|
388
|
-
name TEXT NOT NULL, -- Friendly display name
|
|
389
|
-
file_path TEXT NOT NULL, -- Source file path
|
|
390
|
-
signature TEXT, -- Param types & return value signature
|
|
391
|
-
deprecated INTEGER DEFAULT 0, -- 1 if the node has been deprecated/removed
|
|
392
|
-
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
|
393
|
-
);
|
|
394
|
-
```
|
|
395
|
-
|
|
396
|
-
### 2. `node_connections` (Architecture Relationships)
|
|
397
|
-
Directional mapping (Many-to-Many). Represents **uses/calls** interactions.
|
|
398
|
-
```sql
|
|
399
|
-
CREATE TABLE node_connections (
|
|
400
|
-
source_node_id TEXT, -- The node doing the calling
|
|
401
|
-
target_node_id TEXT, -- The node being called
|
|
402
|
-
PRIMARY KEY (source_node_id, target_node_id),
|
|
403
|
-
FOREIGN KEY (source_node_id) REFERENCES nodes (id) ON DELETE CASCADE,
|
|
404
|
-
FOREIGN KEY (target_node_id) REFERENCES nodes (id) ON DELETE CASCADE
|
|
405
|
-
);
|
|
406
|
-
-- Direction: source_node USES target_node
|
|
407
|
-
```
|
|
408
|
-
|
|
409
|
-
### 3. `history` (AI Change Logs)
|
|
410
|
-
Holds metadata references to version histories.
|
|
411
|
-
```sql
|
|
412
|
-
CREATE TABLE history (
|
|
413
|
-
id TEXT PRIMARY KEY, -- UUID of the history block
|
|
414
|
-
node_id TEXT NOT NULL, -- Associated node
|
|
415
|
-
session_id TEXT NOT NULL, -- Session key
|
|
416
|
-
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
|
417
|
-
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
|
418
|
-
code_snapshot TEXT NOT NULL, -- Always empty string (stored in history/[id].json)
|
|
419
|
-
reasoning TEXT NOT NULL, -- Always empty string (stored in history/[id].json)
|
|
420
|
-
FOREIGN KEY (node_id) REFERENCES nodes (id) ON DELETE CASCADE
|
|
421
|
-
);
|
|
422
|
-
```
|
|
423
|
-
> β±οΈ **Session Boundary Rule**: If the AI updates a function, it checks the last history log. If `updated_at` is less than **1 hour ago**, it updates the snapshot and reasoning in-place (same session). If older than 1 hour, it inserts a new history record (new session).
|
|
424
|
-
>
|
|
425
|
-
> πΎ **JSON Storage Note**: In version 2.0.0, the actual code snapshots and AI change reasonings are stored in `.devmind/history/[id].json` to resolve Git merge conflicts, while the SQLite database holds empty strings for `code_snapshot` and `reasoning`.
|
|
426
|
-
|
|
427
|
-
### Growing the graph outside of `index`/`reindex`
|
|
428
|
-
|
|
429
|
-
You don't have to run the CLI indexer at all β the graph also grows organically as your AI agent works, via the MCP write tools below:
|
|
430
|
-
1. When your AI touches a function, it checks whether a node already exists for it in `brain.db`.
|
|
431
|
-
2. If absent, it creates the node, connects its local import dependencies, and writes the first history snapshot.
|
|
432
|
-
3. The graph grows around whatever files you actively modify.
|
|
433
|
-
|
|
434
|
-
This "grow-as-you-go" path needs zero upfront setup and is a reasonable default for small/medium codebases; `index`/`reindex` are for getting full upfront coverage on a whole workspace, including files your AI hasn't touched yet.
|
|
435
|
-
|
|
436
|
-
> π§Ή **Pruning & Maintenance**: DevsMind dynamically handles deprecations and renames if function signatures match. For manual cleanup and auditing:
|
|
437
|
-
> * `recheck_graph`: Scans code files, marks language primitives, built-ins, or nodes associated with deleted files as deprecated (removing their connections in the graph, but keeping their entries in the database).
|
|
438
|
-
> * `get_orphaned_nodes`: Finds disconnected code nodes that have no incoming or outgoing connections to identify dead code or stale records.
|
|
439
|
-
>
|
|
440
|
-
> β οΈ **Preservation Over Deletion**: The AI agent will never delete historical context by itself; it preserves all evolution records. The `delete_node` MCP tool is removed.
|
|
441
|
-
> * Spurious or missing nodes are **deprecated** (keeping their code history and reasoning intact, but removing active connections in the graph).
|
|
442
|
-
> * Use `devsmind prune` (see [Other CLI Commands](#-other-cli-commands)) for interactive manual review and permanent deletion.
|
|
443
|
-
|
|
444
|
-
---
|
|
445
|
-
|
|
446
|
-
## π MCP Tool Reference
|
|
447
|
-
|
|
448
|
-
DevsMind tools are designed with **layered granularity**. The AI only pulls the depth of data it needs, keeping token overhead minimal.
|
|
449
|
-
|
|
450
|
-
DevsMind exposes **21 tools** to the AI agent, grouped below by what they're for.
|
|
451
|
-
|
|
452
|
-
### π Category 1: Discovery & Search
|
|
453
|
-
* `get_node_summary`: Returns node type, location, connections count, history counts, and last update. (~50 tokens)
|
|
454
|
-
* `list_nodes`: List all nodes matching optional type and file path filters. Useful to discover all entities in a component, package, or directory.
|
|
455
|
-
* `search_nodes`: The one search tool to call β searches node names/identifiers/reasoning first (cheap, SQL-only) and, if nothing matches, **automatically falls back to a full regex/string code-content search** (matches grouped by node ID, file path, and matching lines) in the same call. Each result is tagged `matched_via: "identifier"` or `matched_via: "code"`. Preferred over a raw grep of the filesystem, and over calling any search tool twice.
|
|
456
|
-
* `get_node_graph`: Recursively retrieves connected nodes and relationships up to a specified depth (default: 6). With `direction:"out"` + `include_code:true`, pulls an entire call flow β the starting node plus everything it transitively calls, each with live source β in a single call. `direction:"in"` finds every caller (impact analysis before a change).
|
|
457
|
-
* `get_orphaned_nodes`: Identifies disconnected code nodes in the graph that have no incoming or outgoing connections.
|
|
458
|
-
* `get_visualizer_url`: Returns local browser URLs for opening the interactive 2D and 3D graph visualizers.
|
|
459
|
-
|
|
460
|
-
### π Category 2: Code & History
|
|
461
|
-
* `get_node_code`: Returns a node's **current** source code, parsed live from its file on disk β token-efficient, since it returns only that function/class/route rather than the whole file. Flags drift explicitly: `snapshot_outdated: true` means the graph has fallen behind disk (re-stage it), and `source: "cached"` means the symbol couldn't be located in its file at all (renamed/moved/deleted) and a possibly-stale cached snapshot was returned instead.
|
|
462
|
-
* `get_node_history`: Retrieves all history records, code snapshots, and change reasoning logs for a node.
|
|
463
|
-
* `get_recent_changes`: Lists nodes modified across the project in the last N hours (default: 24h), with optional downstream impact analysis.
|
|
464
|
-
* `get_developer_activity`: Pulls logs and changes authored by a specific team member.
|
|
465
|
-
* `get_changes_by_requirement`: Finds all changes linked to a particular ticket or task ID (e.g. `JIRA-402`).
|
|
466
|
-
* `search_decisions`: Performs a text search specifically across the architectural/implementation rationale logs.
|
|
467
|
-
|
|
468
|
-
### βοΈ Category 3: Code Indexing
|
|
469
|
-
* `index_start`: Scans all configured repos, counts files, creates a scratchpad, and starts the codebase indexing session.
|
|
470
|
-
* `index_checkpoint`: Saves current indexing progress to the scratchpad to survive context limits (called every ~10 files).
|
|
471
|
-
* `index_continue`: Reads the scratchpad and returns exactly where indexing left off to resume after a context reset.
|
|
472
|
-
* `index_complete`: Marks the codebase indexing session as fully completed.
|
|
473
|
-
|
|
474
|
-
### βοΈ Category 4: Writes & Mutations
|
|
475
|
-
* `stage_change`: Buffers one touched entity (node id + code snapshot + reasoning) to disk **without** writing to the graph yet. Call once per file/entity you changed during a task β you do *not* reason about connections here.
|
|
476
|
-
* `commit_changes`: Flushes the whole staged buffer in one pass β creates/updates every node, writes every history snapshot, then resolves all connections between them (and into the existing graph) via local AST, auto-creating any referenced-but-missing target nodes. Because all nodes exist before edges are resolved, calls between the changed files link correctly regardless of staging order. **Must be called exactly once** after staging, or nothing is written to the graph.
|
|
477
|
-
* `rename_node`: Re-keys a node identifier and updates all associated records (connections and history) seamlessly.
|
|
478
|
-
* `deprecate_node`: Marks a code node as deprecated, removing its connection mappings while retaining its coding snapshots and reasoning logs in the database.
|
|
479
|
-
|
|
480
|
-
> The former `add_node` / `add_connection` tools are removed β nodes and edges are now created automatically by `stage_change` + `commit_changes`, so the AI never hand-manages edges. `update_history` (the old single-node write) and `search_code` (now folded into `search_nodes`'s automatic fallback) still work if called directly for backward compatibility, but neither is advertised to the AI anymore.
|
|
481
|
-
|
|
482
|
-
### π§Ή Category 5: Optimization & Maintenance
|
|
483
|
-
* `recheck_graph`: Scans the graph to verify file existence and deprecates language primitives, builtins, and nodes associated with missing/deleted files, retaining nodes with active histories.
|
|
484
|
-
|
|
485
|
-
---
|
|
486
|
-
|
|
487
|
-
## π¨ Interactive Graph Visualizer
|
|
488
|
-
|
|
489
|
-
Explore your code graph visually! Start the web app by running:
|
|
490
|
-
```bash
|
|
491
|
-
devsmind view
|
|
492
|
-
```
|
|
493
|
-
* **2D Visualizer**: D3.js force-directed canvas. Click nodes to see relationships, double-click to center, and inspect details.
|
|
494
|
-
* **3D Visualizer**: ThreeJS/WebGL-powered cosmic node landscape. Fly through your architecture, rotating and zooming to trace complex microservice links.
|
|
495
|
-
|
|
496
|
-
To query the visualizer URL programmatically from your agent, call `get_visualizer_url`.
|
|
497
|
-
|
|
498
|
-
---
|
|
499
|
-
|
|
500
|
-
## π₯ Git Collaboration Workflow
|
|
501
|
-
|
|
502
|
-
By placing `.devmind/config.json` and `.devmind/brain.db` in Git, you share the codebase's brain with the entire team.
|
|
503
|
-
|
|
504
|
-
```
|
|
505
|
-
Developer A Developer B
|
|
506
|
-
βββββββββββββββββββ βββββββββββββββββββ
|
|
507
|
-
Adds expired-coupon validation Pulls latest code
|
|
508
|
-
AI updates applyPromoCode history AI inspects applyPromoCode
|
|
509
|
-
`git commit -am "add validator"` Instantly sees validation logic,
|
|
510
|
-
`git push` ββββββββΊ [Shared Remote Git] βββββββββΊ why it was added, and ticket ID!
|
|
511
|
-
```
|
|
512
|
-
|
|
513
|
-
---
|
|
514
|
-
|
|
515
|
-
## Changelog
|
|
516
|
-
|
|
517
|
-
### Version 2.2.2 (Current Release)
|
|
518
|
-
* **`devsmind memory` β Seed Each Tool's Own Persistent Memory/Skills Store**: The rule file and the MCP `instructions` field both get the workflow contract in front of an agent, but neither IS the tool's own memory β several IDEs/CLIs have a separate, agent-managed store (Claude Code's "Auto Memory," Antigravity's "Skills" / `/learn`, Cursor's "Memories," and others, each under genuinely different names, not one shared convention) that the agent writes a lesson to once and reads back automatically forever after, no re-pasting required. A dedicated research pass β not just checking for features branded "memory," but actually verifying whether each tool reads back a file it didn't create, or only trusts content from its own internal mechanism β found only 2 of 8 tools safe to write into: **Antigravity** (IDE + CLI), confirmed by a firsthand test that a manually-placed `SKILL.md` is discovered the same as an agent-created one, and **Claude Code**, which writes a `devsmind.md` topic file plus a one-line pointer appended into `MEMORY.md` (topic files only load "on demand," so the pointer is what makes it actually get found). Everywhere else β Codex CLI, Qwen's background auto-memory tier, Windsurf, Cursor, Kiro, VS Code Copilot β `devsmind memory` prints the tool's own name for the feature and the specific evidence for why writing to it isn't safe (e.g. quoting Codex's own docs: *"these files are treated as generated state... don't rely on editing them by hand"*), instead of a silent no-op that looks like it worked and didn't. Reuses the same `DEVSMIND_INSTRUCTIONS` content as the MCP `instructions` field β one source of truth, not a third hand-maintained copy.
|
|
519
|
-
|
|
520
|
-
### Version 2.2.1
|
|
521
|
-
* **`search_nodes` Now Falls Back to Code Content β `search_code` Folded In**: `search_nodes` only ever matched a node's name, id, or reasoning text, so a query like "alipay" returned nothing whenever "Alipay" only appeared inside the code body rather than the function name β the agent had to burn a second turn calling `search_code` to actually find it. `search_nodes` now tries the cheap identifier match first and, if that's empty, automatically runs the same code-content search `search_code` used to do, tagging each result `matched_via: "identifier"` or `matched_via: "code"`. `search_code` is no longer advertised as a separate tool β its logic lives inside `search_nodes` now β but its handler is kept for direct/legacy calls, so any existing workspace rule that still names it explicitly keeps working unchanged. **Re-run `devsmind rule` to pick up the updated guidance** (not required β old rules still function, just with one avoidable extra turn on a cold miss).
|
|
522
|
-
* **MCP `instructions` Field β a Server-Controlled Source of Truth**: The workflow contract (search before grep, read code through the graph, stage + commit after every change) previously lived only in whatever the user pasted from `devsmind rule` β a copy that could go stale the moment the rule template changed, or simply never get pasted at all. The server now also sends this contract via the MCP protocol's own `instructions` field at connection time, so every client gets the current, correct version automatically, with zero setup and no dependency on a rule file existing or being current. This doesn't replace `devsmind rule` (which still carries the per-project config β `DEVMIND_PATH`, tech stack, repos β that a stateless server has no other way to know), but it does mean the cross-cutting behavioral rules are no longer solely dependent on it.
|
|
523
|
-
* **The Rule Now Explains *Why*, Not Just *What***: The generated rule previously listed tool triggers without motivation. It now opens with why DevsMind is different from a normal opt-in tool β it's the team's shared graph, not a personal scratchpad, and unrecorded reasoning (the *why* behind a change, not just the diff) is unrecoverable once the turn ends β and explains the specific gap `get_node_graph` (dependency impact git can't show) and `get_node_history` (the *why* behind a change, which `git blame` can't show) each fill. The same core contract is now in the MCP `instructions` field above, so an agent gets it twice: once explained in the rule, once enforced at every connection.
|
|
524
|
-
* **Consequence Framing Extended to Every Read/Write Tool's Own Description, and to Every Critical Rule**: The "why this matters" framing above previously lived only in the rule's new intro section. It's now threaded through `stage_change`, `commit_changes`, `get_node_code`, `get_node_graph`, `get_node_history`, and `search_nodes`'s own MCP descriptions (the one part of the contract that's resent on *every single tool call*, not just read once at session start) β each explains what's lost or missed if it's skipped, not just what it does. The rule's "MANDATORY" and "Critical Rules" sections got the same treatment: each item now states its consequence (a stranded staged change no one else will ever see, a dependency you didn't check before breaking a signature, a decision you silently undid) instead of a bare imperative.
|
|
525
|
-
* **Fixed: `stage_change` Had No File-Type Guardrail β Non-Code Files Could Bloat the Graph**: The consequence-framing changes above made the agent take recording changes more seriously β including, in practice, staging files DevsMind was never meant to track (CSS, JSON, markdown, other non-code assets), since `stage_change` accepted any `file_path` with zero validation. It now rejects any file whose extension isn't one of the indexable source-code types (`.ts`, `.py`, `.go`, `.vue`, etc. β the same allowlist `devsmind index` already scans by) with a clear `isError` response explaining why and listing the supported extensions, instead of silently accepting it and letting a dead-end, caller-less node into the graph. The rejection is enforced in code, not just described in the rule β reusing the lesson from the tools above, prose alone doesn't reliably stop a determined agent. `devsmind rule` and the MCP `instructions` field both now state this scope up front too.
|
|
526
|
-
|
|
527
|
-
### Version 2.2.0
|
|
528
|
-
* **`devsmind mcp` β Guided, Per-Tool MCP Setup**: Adding DevsMind to an IDE was previously undocumented and manual β every tool uses a different config file, location, key, and transport, and you were left to figure yours out. The new `devsmind mcp` command asks what you're working in (Cursor, VS Code/Copilot, Windsurf, Kiro, Google Antigravity, Claude Code, OpenAI Codex CLI, Qwen Code CLI, plus the Antigravity CLI) and then either **prints the exact snippet to paste** (manual mode) or **creates/merges the correct config file for you** (automatic mode) β with a preview and confirmation, and merging into any existing servers rather than overwriting them. It picks the best-fit transport per tool (stdio for CLI tools; stdio or HTTP for IDEs) and emits each tool's specific shape: the right top-level key (`mcpServers` vs VS Code's `servers` vs Codex's TOML `[mcp_servers.*]`) and the right remote-endpoint key (`url` vs Windsurf/Antigravity's `serverUrl` vs Qwen's `httpUrl`). Automatic mode includes a `cd`-style folder navigator so you can place project- or global-scoped configs anywhere on disk.
|
|
529
|
-
* **`devsmind sync` β Force a Graph β `brain.db` Load On Demand**: The disk-to-DB sync (`syncFromDisk()`, which loads the committed `graph/**` + `history/*.json` into the local SQLite cache) only runs once per process, in the DB constructor. Under `--stdio` β how VS Code and most CLI tools run the server β the editor spawns the process itself and never hits the HTTP routes that would otherwise trigger a fresh sync, so after a `git pull` your teammates' graph changes never reached your local brain without restarting the whole editor. `devsmind sync` applies them explicitly and reports what changed (node / connection / history counts with deltas). Run it after pulling.
|
|
530
|
-
* **`devsmind rule` β Now Places the Rule For You, Per Tool**: Previously `rule` only dumped the workspace rule to stdout with a generic "paste this somewhere" tip. It now runs the same guided per-tool flow: pick your tool, then either see the exact native rules-file path (manual) or have the rule **written into that file for you** (automatic) β `.cursor/rules/devsmind.mdc` (with the required frontmatter), `CLAUDE.md`, `AGENTS.md`, `QWEN.md`, `.github/copilot-instructions.md`, and so on. Shared files get a delimited DevsMind block that updates in place on re-run instead of duplicating. Piped/redirected output and the new `--print` flag still emit the plain rule, so `devsmind rule --print > rule.md` and existing scripts keep working.
|
|
531
|
-
* **Interactive Folder Navigator for Paths**: Everywhere the CLI asks for a directory β `devsmind init`'s brain location and repository paths, and the automatic-write location in `devsmind mcp` / `devsmind rule` β you now get a `cd`-style browser: step into subfolders, go up, or type/paste a path directly (handy for another drive or a far-away folder, with `~` expansion). No more hand-typing and re-typing absolute paths; only existing directories can be confirmed.
|
|
532
|
-
|
|
533
|
-
### Version 2.1.1
|
|
534
|
-
* **`get_node_code` Now Reads Live Source From Disk**: Previously this tool served the last *cached* code snapshot from `.devmind/history/`, never touching the source file. If anyone edited code outside the agent's `stage_change` flow β a `git pull`, a manual edit, a teammate's commit β the agent was handed confidently-wrong code with no warning. It now parses the node's current source straight from its file via the local AST (deterministic, no LLM, no file read into context), and only falls back to the cached snapshot when the symbol genuinely can't be located on disk. Measured against a real 7,300-node production brain, **87% of sampled nodes were serving stale code** under the old behavior.
|
|
535
|
-
* **Silent Staleness Is Now Reported**: Because the live source and the stored snapshot are both in hand, comparing them is free. `get_node_code` now returns `snapshot_outdated: true` when the graph has drifted from disk, and `source: "cached"` when a symbol could not be found in its file at all (renamed, moved, deleted, or a non-TS/JS file) β so the agent can re-record the node instead of silently trusting a stale answer. Historical snapshots from `get_node_history` are unchanged and still frozen, which is the point of them.
|
|
536
|
-
* **Whole Call Flows in a Single Call (`get_node_graph` + `include_code`)**: Tracing a request through ~10 functions previously meant a `get_node_code` round trip per function β roughly 21 chat turns, each re-sending the conversation and generating fresh output tokens. `get_node_graph` now accepts `direction` (`"out"` = callees / a call flow, `"in"` = callers / impact analysis, `"both"` = the surrounding neighborhood, the unchanged default) and `include_code: true`, which attaches each node's live source. One call now returns the entry point plus everything it transitively calls, with code β collapsing that trace to ~2 turns.
|
|
537
|
-
* **Bounded, Non-Silent Truncation**: `include_code` spends a character budget (`code_char_budget`, default 60,000) in breadth-first order, so the nodes nearest the starting point keep their code. Anything dropped still comes back with full metadata, and the response carries `code_chars`, `code_truncated`, and `nodes_without_code` β the agent is told exactly what it did *not* receive rather than being left to assume it saw everything.
|
|
538
|
-
* **Fixed: `get_node_graph` Returned a Lone Root for Unqualified Node IDs**: The traversal seeded its queue with the raw `node_id` argument while `node_connections` is keyed by the fully-qualified ID. Passing a bare symbol name (e.g. `PaymentController`) resolved the root node but then matched zero edges, silently returning a single disconnected node. It now canonicalizes the root before traversing.
|
|
539
|
-
* **Workspace Rule Updated (re-run `devsmind rule`)**: The generated agent rule still taught the old snapshot-first model and had no knowledge of `include_code`, which would have left the flow-tracing win unused. It now directs agents to read code through `get_node_code` instead of the filesystem, to trace flows with a single `direction:"out"` + `include_code:true` call rather than chaining per-function lookups, and to fix drift when `snapshot_outdated` is reported. **Existing users must re-run `devsmind rule` and re-paste it into their IDE to pick this up.**
|
|
540
|
-
|
|
541
|
-
### Version 2.1.0
|
|
542
|
-
* **Staged Batch Writes (`stage_change` + `commit_changes`)**: Replaced the per-entity `add_node` / `add_connection` tools with a stage-then-commit flow. As an AI agent works a task across many files, it calls `stage_change` once per touched entity (passing only code + reasoning β no manual edge reasoning), buffered to disk so it survives a context reset. A single `commit_changes` then creates every node, writes every history snapshot, and resolves all connections at once via the local AST resolver. Because all nodes exist before any edge is resolved, calls between the changed files link correctly regardless of order β eliminating the forward-reference gap that previously required a separate Phase 2. Missing target nodes are auto-created from the AST. `update_history` remains as a single-node one-shot (it now also resolves that node's edges). `add_node` / `add_connection` are removed.
|
|
543
|
-
* **Durable Deprecation & Deletion**: Deprecations, prunes, and hard-deletes now persist to the on-disk graph JSONs (and clean up caller files / history JSONs), so they survive a server restart and propagate to teammates via git instead of resurrecting from disk on the next `devsmind start`.
|
|
544
|
-
* **Deterministic AST Edge Resolver & Missing-Node Auto-Fill**: Connection resolution now checks references in both directions per node β not just "who calls into this node" but also "what does this node itself call out to" β and when it finds a reference to something that was never extracted in Phase 1 (an import used but never turned into a node), it deterministically creates that node straight from the AST and immediately re-resolves connections for it and its callers. No LLM call needed, so it's free and runs on every edge-resolution pass automatically. Across ~15 rounds of iterative `--edges-only` testing against real repos, fixing what each round surfaced, this and related resolver fixes raised connection/edge accuracy from **~45% to ~90%** (per internal testing).
|
|
545
|
-
* **Node Extraction Accuracy Fixes**: A series of fixes to extraction and taxonomy handling in the indexer raised node-extraction accuracy from **~58% to ~92%** across the same testing rounds (per internal testing).
|
|
546
|
-
* **Opt-in Request Throttling (`--rpm`)**: Added `--rpm <number>` to both `index` and `reindex`. Previously, `gemini`/`vertex` runs silently applied a hardcoded default pace (60/30 requests-per-minute); now requests fire back-to-back by default (relying on 429 retry/backoff) and throttling is only applied if you explicitly ask for it β meant for known, verified provider quotas.
|
|
547
|
-
* **Gap-Fill Reindexing (`--fill-gaps`)**: Added `--fill-gaps` to `reindex`. Instead of the normal mtime-based diff, it finds every indexable file with zero graph nodes (never indexed, or dropped by a prior crashed run) and backfills just those. Per-file extraction failures are logged and skipped instead of aborting the whole run, and connections are rebuilt across the entire graph afterward (local AST resolution, no LLM cost) so edges into the newly-added nodes are captured. Safe to run repeatedly β each run only touches what's still actually missing.
|
|
548
|
-
|
|
549
|
-
### Version 2.0.5
|
|
550
|
-
* **Local Connection Resolution (`--local-edges`)**: Added local compiler AST connection resolution for TypeScript and JavaScript files, and regex identifier mapping for other languages (Python, Go, Java, etc.). This offloads Phase 2 connection resolution entirely from LLM APIs to the local machine, making edge connection generation instant, offline, and free of API costs.
|
|
551
|
-
* **Configurable Indexer Chunk Size (`--chunk-size` and `--chunk-overlap`)**: Exposed chunk size and overlap controls as CLI flags. Users of large-context models (like Gemini 2.5 Flash) can scale chunk sizes to process files in a single pass, accelerating Phase 1 node extraction.
|
|
552
|
-
|
|
553
|
-
### Version 2.0.4
|
|
554
|
-
* **Disk-Based History Adaptation & SQL Search Optimization**:
|
|
555
|
-
* Restored SQL-based text filtering (e.g. `getDeveloperActivity`, `getChangesByRequirement`, `searchDecisions`, and `searchNodes`) by storing the small `reasoning` text directly in the SQLite `history` table while maintaining the large `code_snapshot` exclusively on disk.
|
|
556
|
-
* Fixed `getRecentChanges` and `getAllHistory` to populate reasoning/code from disk-based history files.
|
|
557
|
-
* Fixed the `get_node_code` MCP tool to return `null` if the snapshot is empty/whitespace, enabling proper caching behavior for agents.
|
|
558
|
-
|
|
559
|
-
### Version 2.0.2
|
|
560
|
-
* **Fully Portable Node IDs & History Metadata**: Resolved the issue where Node IDs and history JSON metadata retained absolute path prefixes or relative dots (`../../`). All Node IDs and history file paths now utilize the environment-independent `{repo_name}/relativePath` format globally, ensuring seamless database synchronization and collaboration across different developers, OS drives, and machine paths.
|
|
561
|
-
|
|
562
|
-
### Version 2.0.1
|
|
563
|
-
* **Automatic .gitignore Generation Fix**: Updated the `devsmind init` command to automatically create or update `.devmind/.gitignore` to ignore the local database cache (`brain.db`, `brain.db-wal`, `brain.db-shm`) and CLI index tracker (`index_scratchpad.json`) by default.
|
|
564
|
-
|
|
565
|
-
### Version 2.0.0 (Breaking Release)
|
|
566
|
-
* **Git-Friendly Distributed JSON Storage**: Solved Git binary merge conflicts by moving all massive code snapshots and reasoning logs to `.devmind/history/[id].json` and graph structures to `.devmind/graph/[repo_name]/[path].json`. This replaces the monolithic `brain.db` database storage completely.
|
|
567
|
-
* **Metadata-Only SQLite Cache**: Compacted the local SQLite database (`brain.db`) to store only structural metadata. Wiped all heavy text blobs, and added `brain.db` to `.gitignore`.
|
|
568
|
-
* **Auto-Sync & Reconstruction**: Added startup auto-sync. The database constructor automatically reconstructs your entire local SQLite database from the disk JSONs in less than 2 seconds on startup.
|
|
569
|
-
* **Env-Mapped Repo-Relative Paths**: Resolved cross-drive crashes and folder escape issues on Windows. Replaced relative dot paths in JSONs with clean repo placeholders (`{repo_name}/relativePath`) which are resolved dynamically using absolute paths configured in your local `.env` file.
|
|
570
|
-
* **Safe Import Transaction Toggles**: Disables foreign key checks during bulk syncing (`syncFromDisk()`) and edge connections (`addConnection()`) to prevent race conditions during out-of-order indexing.
|
|
571
|
-
|
|
572
|
-
### Version 1.2.2
|
|
573
|
-
* **Node.js v24 LTS & npm Dependency Conflict Resolution**: Fixed native compilation conflicts (like `better-sqlite3` and `node-gyp` errors) that crashed on Node v24, ensuring DevsMind builds and installs out-of-the-box on both Node v22 and Node v24 environments.
|
|
574
|
-
* **Robust LLM JSON Parsing**: Added extraction/repair utilities for the indexer's LLM responses, so malformed or fenced JSON (trailing commas, markdown code fences, truncated output) is recovered instead of aborting the extraction step.
|
|
575
|
-
* **Duplicate Node Location Support**: Fixed indexing failures when two distinct code entities legitimately shared the same declared location (e.g. overloaded members), instead of one silently clobbering the other.
|
|
576
|
-
|
|
577
|
-
### Version 1.2.1
|
|
578
|
-
* **Vertex AI Gemini Provider**: Added `--provider vertex` as an alternative to the direct Gemini API for `index`/`reindex`, authenticating via a Google Cloud service account instead of a raw API key β the option teams already using GCP IAM and billing need instead of managing a separate Gemini key.
|
|
579
|
-
* **Fixed: 3 Bugs in the Interactive Configuration Browser**: The tree-based folder browser introduced in 1.2.0 could let navigation escape above the repo root, didn't visually show that a folder was excluded *because* its parent was excluded (only directly-excluded entries were marked), and mishandled the `.gitignore`-import confirmation step. All three fixed.
|
|
580
|
-
* **Cursor Position Preserved in the File Browser**: Toggling a file or folder's include/exclude state used to reset the browser's cursor to the top of the list, making it tedious to toggle several entries in a row in a large tree. The cursor position is now retained across toggles.
|
|
581
|
-
|
|
582
|
-
### Version 1.2.0
|
|
583
|
-
* **Interactive Tree-Based Configuration Browser for `devsmind init`**: Replaced manually typing comma-separated ignore patterns with a navigable folder tree β browse into subdirectories, toggle files/folders to include or exclude them (with inherited-exclusion status shown for anything under an excluded parent), and optionally seed exclusions from the repo's `.gitignore` or a common-preset list (lockfiles, build configs, etc.) before fine-tuning by hand.
|
|
584
|
-
|
|
585
|
-
### Version 1.1.1
|
|
586
|
-
* **Fixed: Foreign Key Constraint Failures in `addConnection`**: Creating a connection could fail outright if the target node hadn't been inserted yet (an ordering issue during indexing), instead of being handled gracefully. Connection writes are now resilient to out-of-order node creation.
|
|
587
|
-
|
|
588
|
-
### Version 1.1.0
|
|
589
|
-
* **Native Background Index Runner (`devsmind index --run`)**: Indexing could previously only be driven in-chat via MCP tools, burning the IDE agent's own token budget per file. This release moved the Gemini and Ollama LLM integrations directly into the CLI runner, so a full first-pass index can run in the background from the terminal instead β the predecessor to today's `index`/`reindex` commands.
|
|
590
|
-
* **Compressed History Snapshots**: History code snapshots are now transparently zlib-compressed on write and decompressed on read, substantially shrinking `brain.db`'s on-disk size as a project's change history grows.
|
|
591
|
-
* **SQLite `VACUUM` on Index Completion & Graph Recheck**: Reclaims space freed by deletions/compaction automatically at the end of an index run and during `recheck_graph`, instead of the database file only ever growing.
|
|
592
|
-
|
|
593
|
-
### Version 1.0.1
|
|
594
|
-
* **MCP Server & Rule Generator Scaffolding**: Wired the initial `devsmind rule` generator, a versioned SQLite database schema, and the first MCP server tool surface together as a coherent baseline for the releases that followed.
|
|
595
|
-
|
|
596
|
-
### Version 1.0.0 (Initial Release)
|
|
597
|
-
* **Core MCP Toolset**: Shipped the first working tool surface β including `deprecate_node` and `get_node_code` (with a stale-snapshot refresh protocol referenced from the workspace rule) β plus the `devsmind prune` command, replacing an earlier `get_project_context` / `delete_node` pairing with the deprecate-first model DevsMind still uses today.
|
|
598
|
-
* **Workspace Rule Tuning**: Slimmed the generated rule to roughly 400 tokens by cutting redundant inline tool-argument JSON, then reorganized the remaining guidance into an "Available Tools" table with a one-line use-case per tool for faster agent lookup.
|
|
599
|
-
* **Cross-Platform Path Fixes**: Fixed `DEVMIND_PATH` printing with backslashes on Windows (which broke downstream parsing) in favor of forward slashes, added a descriptive error when `getDatabase` can't find the target directory, and added `resolveDevmindPath` auto-detection so tools still work if the calling agent forgot to pass `devmind_path` explicitly.
|
|
600
|
-
* **Initial Documentation**: First pass of the README β workspace topologies, the full MCP tool list, `devsmind init` re-initialization behavior, a simplified quick start, and the `delete_node`-to-`deprecate_node` policy β plus an internal roadmap doc for planned "next core" features.
|
|
601
|
-
|
|
602
|
-
---
|
|
603
|
-
|
|
604
|
-
## π License
|
|
605
|
-
|
|
606
|
-
DevsMind is released under the [MIT License](LICENSE).
|
|
1
|
+
# π§ DevsMind β Team AI Brain
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/devsmind-mcp)
|
|
4
|
+
[](https://github.com/Abialidr/devsmind/blob/main/LICENSE)
|
|
5
|
+
|
|
6
|
+
> **The evolutionary collective memory layer for your AI coding agents. Shared across your entire team.**
|
|
7
|
+
|
|
8
|
+
AI agents (like Cursor, Cline, Copilot, or Antigravity) lose all context between sessions. Teams repeat the same conversations, new developers ask questions answered months ago, and the same bug gets fixed twice because nobody remembered the first fix.
|
|
9
|
+
|
|
10
|
+
Git tells you **WHAT** changed. **DevsMind tells your AI agent WHY it changed, WHO decided it, WHAT requirement it served, and WHAT broke before.**
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
ββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
14
|
+
β DevsMind MCP Server β
|
|
15
|
+
β (installed once globally on machine) β
|
|
16
|
+
β β
|
|
17
|
+
β Stateless. Holds no data. β
|
|
18
|
+
β Receives devmind_path on every call. β
|
|
19
|
+
β Opens .devmind/brain.db at that path. β
|
|
20
|
+
ββββββββββββββββββββββββ¬ββββββββββββββββββββββββ
|
|
21
|
+
β devmind_path on every call
|
|
22
|
+
βββββββββββββββββββ΄ββββββββββββββββββ
|
|
23
|
+
βΌ βΌ
|
|
24
|
+
c:\work\my-project\.devmind\ c:\work\other-project\.devmind\
|
|
25
|
+
brain.db brain.db
|
|
26
|
+
(Project A team brain) (Project B team brain)
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
> π Looking for the exhaustive version (every flag, every schema field)? See [detailExplanation.md](detailExplanation.md). This file is the fast path.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## How it works
|
|
34
|
+
|
|
35
|
+
Run `devsmind init` once per project β creates `.devmind/`. Commit it. Every teammate's agent reads and writes the same graph.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## π οΈ Architecture: The `.devmind/` Directory
|
|
40
|
+
|
|
41
|
+
Running `devsmind init` creates a `.devmind/` directory in your workspace. This folder contains the configuration, distributed graph database, and local cache:
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
.devmind/
|
|
45
|
+
βββ config.json β Project metadata & repository mapping (Committed to Git)
|
|
46
|
+
βββ .env β Local developer machine paths (Gitignored)
|
|
47
|
+
βββ brain.db β Metadata-only SQLite cache database (Gitignored)
|
|
48
|
+
βββ history/ β Distributed change logs & code snapshots as JSON (Committed to Git)
|
|
49
|
+
β βββ [id].json
|
|
50
|
+
βββ graph/ β Distributed graph structure JSON files (Committed to Git)
|
|
51
|
+
βββ [repo_name]/
|
|
52
|
+
βββ [path].json
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Flexibility: Where should the brain live?
|
|
56
|
+
|
|
57
|
+
DevsMind supports two deployment topologies depending on your team's workflow:
|
|
58
|
+
|
|
59
|
+
* **Option A: Inside the workspace/project root directory (Shared with team)**
|
|
60
|
+
```
|
|
61
|
+
c:\work\my-project\
|
|
62
|
+
βββ .devmind\ β Config and distributed JSON database live here
|
|
63
|
+
βββ backend-service\
|
|
64
|
+
βββ frontend-web\
|
|
65
|
+
```
|
|
66
|
+
* **Option B: Standalone folder (Fully separated)**
|
|
67
|
+
```
|
|
68
|
+
c:\Users\username\brains\my-project\
|
|
69
|
+
βββ .devmind\ β Brain is kept separate from code folders
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## π Why teams use it
|
|
75
|
+
|
|
76
|
+
| Feature | What it means |
|
|
77
|
+
|---|---|
|
|
78
|
+
| **Function-level history** | Every function/class has a change log β not just diffs, but *why* |
|
|
79
|
+
| **Workflow context vault** | Persistent, git-shared timeline for multi-day features β solves "context death": an agent resuming days later picks up the full decision history instead of starting from zero |
|
|
80
|
+
| **AI-written context** | Your agent records why/goal/decision/ticket as it works |
|
|
81
|
+
| **Token-cheap lookups** | Agent reads one function via the graph instead of a whole file β up to ~70% fewer tokens |
|
|
82
|
+
| **One server, many projects** | Install once globally; each call passes its own project path |
|
|
83
|
+
| **Git-native sharing** | The graph is JSON + SQLite cache, committed like code |
|
|
84
|
+
| **Visual explorer** | `devsmind view` opens a 2D/3D graph of your architecture |
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## β‘ Quick Start
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
npm install -g devsmind-mcp
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Starting a brand-new brain
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
devsmind init # 1. Create .devmind/ β interactive: project name, repos, tech stack
|
|
98
|
+
devsmind mcp # 2. Connect your IDE/CLI to the MCP server
|
|
99
|
+
devsmind rule # 3. Paste the workspace rule β this is what teaches your agent to actually use it
|
|
100
|
+
devsmind start # 4. Start the server (skip if your IDE launches it via stdio)
|
|
101
|
+
devsmind index --run --provider gemini --key YOUR_KEY # 5. (optional) index the codebase now
|
|
102
|
+
git add .devmind && git commit -m "Add DevsMind brain" # 6. share it
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Joining a brain a teammate already created
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
git pull # 1. .devmind/ is already in the repo
|
|
109
|
+
devsmind init # 2. sets up YOUR machine only (dev identity, local paths) β doesn't touch the shared graph
|
|
110
|
+
devsmind mcp # 3. connect your IDE/CLI
|
|
111
|
+
devsmind rule # 4. paste the workspace rule
|
|
112
|
+
devsmind sync # 5. load teammates' committed changes into your local cache
|
|
113
|
+
devsmind start # 6. start the server (skip if stdio)
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
> **Already set up, just upgrading?**
|
|
117
|
+
> ```bash
|
|
118
|
+
> npm install -g devsmind-mcp@latest
|
|
119
|
+
> devsmind rule # re-paste β the generated rule content changes between releases
|
|
120
|
+
> ```
|
|
121
|
+
> Check the [Changelog](CHANGELOG.md) after upgrading β some releases need this re-run, some don't.
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## π The three setup commands, and why there are three
|
|
126
|
+
|
|
127
|
+
| Command | Answers | Skip it and⦠|
|
|
128
|
+
|---|---|---|
|
|
129
|
+
| `devsmind mcp` | Can your agent *reach* the tools at all? | DevsMind tools don't exist from the agent's point of view |
|
|
130
|
+
| `devsmind rule` | Does your agent *know* to use them? | Agent defaults back to grep/raw file reads out of habit |
|
|
131
|
+
| `devsmind memory` *(optional)* | Does that behavior *persist* without re-pasting? | Only matters for a handful of tools with their own agent-writable memory store |
|
|
132
|
+
|
|
133
|
+
`mcp` and `rule` are both guided: pick your tool (Cursor, VS Code, Claude Code, Codex, Windsurf, Kiro, Antigravity, Qwen Code, β¦), then either copy a printed snippet or let DevsMind write/merge the config file for you.
|
|
134
|
+
|
|
135
|
+
**`devsmind memory`** only writes where it's actually confirmed safe:
|
|
136
|
+
|
|
137
|
+
| Tool | Seeded automatically? |
|
|
138
|
+
|---|---|
|
|
139
|
+
| Claude Code (Auto Memory) | β
|
|
|
140
|
+
| Google Antigravity (Skills / `/learn`) | β
|
|
|
141
|
+
| Qwen Code CLI | Already covered by `devsmind rule` |
|
|
142
|
+
| Codex CLI, Cursor, Windsurf, Kiro, VS Code Copilot | β β prints why + what to do instead |
|
|
143
|
+
|
|
144
|
+
> β οΈ **`devsmind rule` / `devsmind memory` are not a guarantee, they're a nudge.** Pasting the rule doesn't make an agent use DevsMind every turn for the rest of time β on long sessions, agents drift back to their default habits (grep, raw file reads) and quietly stop calling `search_nodes`/`stage_change`/`commit_changes` as context fills up. When you notice that happening, just tell it directly: *"use the DevsMind graph, then stage and commit this."* It's a cheap thing to say and usually the highest-leverage sentence you can add β DevsMind's whole value is the code context + the *why* behind it, which plain grep never gives you.
|
|
145
|
+
>
|
|
146
|
+
> **And this part doesn't have a workaround:** if the agent never calls `commit_changes`, that history is gone for good. `devsmind reindex` / `devsmind analyze --fix` can repair the *code graph* (nodes, edges, stale entries) after the fact, but neither one can reconstruct the reasoning, decisions, or workflow steps that were only ever going to be written by the agent, in that turn. Skipped commits don't just leave a gap you can backfill later β they silently defeat the entire point of DevsMind.
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## π Indexing your codebase: `index` vs `reindex`
|
|
151
|
+
|
|
152
|
+
Both extract code entities via an LLM, then resolve connections locally (free, no LLM). You don't strictly need either β the graph also grows "as you go" from your agent's own edits β but until something has indexed the codebase, there's little for the agent to look up yet.
|
|
153
|
+
|
|
154
|
+
| | `index --run` | `reindex` |
|
|
155
|
+
|---|---|---|
|
|
156
|
+
| Use for | First full pass | Keeping an already-indexed graph in sync |
|
|
157
|
+
| Flag required | `--run` | none β always executes |
|
|
158
|
+
| Selection | Whole repo (or `--nodes-only` / `--edges-only` / `--repos`) | Diffs mtimes since last run, or `--fill-gaps` to backfill zero-node files |
|
|
159
|
+
| Destructive option | `--from-scratch` wipes everything first | β |
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
devsmind index --run --provider gemini --key YOUR_KEY
|
|
163
|
+
devsmind reindex --provider gemini --key YOUR_KEY --fill-gaps
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
**Common flags** (both commands): `--provider gemini|vertex|ollama` Β· `--model <name>` Β· `--key <api_key>` Β· `--chunk-size <lines>` Β· `--rpm <number>` (unthrottled by default).
|
|
167
|
+
|
|
168
|
+
**Providers:**
|
|
169
|
+
|
|
170
|
+
| Provider | Auth | Notes |
|
|
171
|
+
|---|---|---|
|
|
172
|
+
| `gemini` (default) | `--key` or `GEMINI_API_KEY` | fastest, most accurate in testing |
|
|
173
|
+
| `vertex` | service account JSON or bearer token | for teams already on GCP |
|
|
174
|
+
| `ollama` | none β local server | free, private, slower and less accurate |
|
|
175
|
+
|
|
176
|
+
Rough benchmark (~1,080-file repo, informal): local Ollama model took ~15h at ~50% accuracy; `gemini-2.5-flash` took ~5h at ~90%. Local avoids API cost; cloud is faster and more accurate for extraction. Edge resolution is local/free either way.
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## π₯οΈ Other commands (cheat sheet)
|
|
181
|
+
|
|
182
|
+
| Command | What it does |
|
|
183
|
+
|---|---|
|
|
184
|
+
| `devsmind start [--stdio] [-p <port>]` | Run the MCP server |
|
|
185
|
+
| `devsmind sync [--analyze] [--fix]` | Pull committed graph changes into your local cache |
|
|
186
|
+
| `devsmind view` | Open the interactive 2D/3D graph visualizer |
|
|
187
|
+
| `devsmind analyze [--fix]` | Zero-AI local health check (god entities, cycles, orphans, dangling edges, dupes, stale attributionβ¦) β `--fix` auto-applies only the safe/reversible fixes |
|
|
188
|
+
| `devsmind prune` | Interactive review + permanent delete of nodes/history |
|
|
189
|
+
| `devsmind workflow` | Interactive view of multi-day feature workflows |
|
|
190
|
+
| `devsmind workflow-import <path>` | Import existing flow docs as resumable workflows |
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## π MCP tools, grouped by purpose
|
|
195
|
+
|
|
196
|
+
DevsMind exposes ~31 tools to the agent. The ones you'll see referenced most:
|
|
197
|
+
|
|
198
|
+
| Group | Tools |
|
|
199
|
+
|---|---|
|
|
200
|
+
| **Search/discovery** | `search_nodes`, `list_nodes`, `get_node_graph`, `get_orphaned_nodes` |
|
|
201
|
+
| **Read code/history** | `get_node_code`, `get_node_history`, `get_recent_changes`, `search_decisions` |
|
|
202
|
+
| **Write (the important pair)** | `stage_change` (buffer one node), `commit_changes` (flush the buffer, resolve edges) |
|
|
203
|
+
| **Maintenance** | `recheck_graph`, `analyze_graph` |
|
|
204
|
+
| **Multi-day workflows** | `workflow_create`, `workflow_add_step`, `workflow_pause/resume`, `workflow_get_context`, `workflow_search` |
|
|
205
|
+
|
|
206
|
+
Full descriptions and token-cost notes: see [detailExplanation.md Β§ MCP Tool Reference](detailExplanation.md#-mcp-tool-reference).
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## ποΈ Storage model, briefly
|
|
211
|
+
|
|
212
|
+
```
|
|
213
|
+
.devmind/
|
|
214
|
+
config.json β project + repo config (committed)
|
|
215
|
+
.env β your machine's local paths (gitignored)
|
|
216
|
+
brain.db β SQLite metadata cache (gitignored, rebuilt from JSON on start)
|
|
217
|
+
history/ β code snapshots + reasoning (committed, one JSON per entry)
|
|
218
|
+
graph/ β node/connection structure (committed, one JSON per file)
|
|
219
|
+
workflows/ β multi-day feature timelines (committed)
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
The JSON files are the source of truth (git-mergeable); `brain.db` is a disposable local cache rebuilt from them on startup. Full 7-table schema: see [detailExplanation.md Β§ Database Schema](detailExplanation.md#-database-schema-devmindbraindb).
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## Changelog
|
|
227
|
+
|
|
228
|
+
See [CHANGELOG.md](CHANGELOG.md) for what shipped in each release.
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## π License
|
|
233
|
+
|
|
234
|
+
MIT β see [LICENSE](LICENSE).
|