devsmind-mcp 2.0.4 → 2.1.1

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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Abialidr
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Abialidr
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -77,109 +77,175 @@ DevsMind supports two deployment topologies depending on your team's workflow:
77
77
 
78
78
  ## ⚡ Quick Start
79
79
 
80
- ### 1. Install DevsMind
81
- Install the CLI and MCP server globally via npm:
82
80
  ```bash
81
+ # 1. Install
83
82
  npm install -g devsmind-mcp
84
- ```
85
83
 
86
- ### 2. Initialize the Brain & Local Env
87
- Navigate to your project folder (or workspace root) and run:
88
- ```bash
84
+ # 2. Initialize the brain (interactive setup)
89
85
  devsmind init
86
+
87
+ # 3. Get the AI workspace rule and paste it into your IDE's rules
88
+ devsmind rule
89
+
90
+ # 4. Start the MCP server
91
+ # Run this from the folder that contains .devmind (or pass --path <devmind_path>),
92
+ # so it opens the right brain and syncs brain.db from the graph/ + history/ JSONs on startup.
93
+ devsmind start
90
94
  ```
91
- This will guide you through interactive setup questions:
92
- * **For new installations:** It prompts you for details (Project Name, Architecture, Frameworks, Naming Conventions, and Repo Paths) and automatically generates `.devmind/config.json` (committed), `.devmind/.env` (gitignored), and an empty `.devmind/brain.db`.
93
- * **For resuming/joining developers:** If `.devmind/config.json` already exists (e.g., pulled from Git), running `devsmind init` will detect it. It will **not** overwrite the shared team configuration; instead, it will only prompt you for missing local details (your name/email and local machine paths for your repositories) and generate/update your local `.devmind/.env` automatically.
94
95
 
95
- ### 3. Get and Inject the AI Workspace Rule
96
- Instead of writing a custom prompt from scratch, DevsMind generates a fully customized Workspace Rule containing your project's unique configuration details.
96
+ That's the whole loop. For what each step actually does under the hood — `init`'s full prompt flow, every `index`/`reindex` flag, provider setup, benchmarks, and the other CLI commands — see the sections below.
97
+
98
+ ---
99
+
100
+ ## 📇 Command Reference: `index` & `reindex`
101
+
102
+ Both commands extract code entities ("nodes") via an LLM and resolve connections between them ("edges") via local AST analysis. **`index` is for the first full pass over a codebase; `reindex` is for keeping an already-indexed graph in sync afterward.** They share most flags.
103
+
104
+ > You can also index via in-chat agent tools (`index_start`/`index_checkpoint`/`index_continue`/`index_complete`) instead of the CLI — but that burns your IDE chat's own token budget for every file, which gets expensive fast on anything beyond a small repo. The CLI (`--run`) does the same extraction in the background for free (aside from your own LLM API key usage) and is the recommended path for a full/initial index.
105
+ >
106
+ > Neither of these is *required* upfront — see [Growing the graph outside of `index`/`reindex`](#growing-the-graph-outside-of-indexreindex) below for the zero-setup "grow-as-you-go" mode. But until the graph actually covers your codebase (via one of these commands, or enough organic grow-as-you-go usage), it's mostly not useful to your AI agent yet — there's nothing to look up.
107
+
108
+ ### `devsmind index --run`
109
+
110
+ Full/initial indexing. Must be run with `--run`, otherwise it just prints instructions for in-chat indexing instead.
97
111
 
98
- Run the following command in your terminal:
99
112
  ```bash
100
- devsmind rule
113
+ devsmind index --run --provider gemini --model gemini-2.5-flash --key YOUR_API_KEY --chunk-size 1500
101
114
  ```
102
- Or specify an explicit path:
115
+
116
+ | Flag | Description |
117
+ |---|---|
118
+ | `-p, --path <devmind_path>` | Path to `.devmind` (default: `.devmind` in cwd) |
119
+ | `--run` | **Required** to actually start indexing |
120
+ | `--provider <provider>` | `gemini` (default) \| `vertex` \| `ollama` |
121
+ | `--model <name>` | Model id (default per provider — see [Providers & Performance](#providers--performance) below) |
122
+ | `--key <api_key>` | API key or service account JSON path (overrides `GEMINI_API_KEY` / `GOOGLE_APPLICATION_CREDENTIALS`) |
123
+ | `--url <url>` | Ollama server endpoint (default `http://localhost:11434`) |
124
+ | `--chunk-size <lines>` | Max lines per chunk sent to the LLM (default: off — whole file in one call) |
125
+ | `--chunk-overlap <lines>` | Overlap lines between chunks, only used with `--chunk-size` (default `50`) |
126
+ | `--rpm <number>` | Max LLM requests per minute, paced proactively (default: **unthrottled** — fires back-to-back, relies on 429 retry/backoff) |
127
+ | `--from-scratch` | Wipes ALL nodes, connections, history, and `graph/`/`history/` folders, then reindexes from zero. Prompts for confirmation unless `--yes` is passed |
128
+ | `--nodes-only` | Only run Phase 1 (node extraction). No connections touched |
129
+ | `--edges-only` | Only run Phase 2 (connection resolution). Wipes and rebuilds connections across all current nodes. Requires nodes to already exist |
130
+ | `--repos <names>` | Comma-separated repo names to restrict the run to (standalone mode only) |
131
+ | `--yes` | Skip the confirmation prompt for `--from-scratch` |
132
+ | `--local-edges` | *Deprecated, no-op.* Connections are always resolved locally via AST now |
133
+
134
+ **Valid / invalid combinations** (enforced in code, not just convention):
135
+ * ❌ `--nodes-only` + `--edges-only` together — mutually exclusive, omit both for a full run.
136
+ * ❌ `--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.
137
+ * ❌ `--repos` + `--from-scratch` together — `--from-scratch` wipes the entire graph, so per-repo scoping doesn't apply.
138
+ * ✅ `--repos` composes fine with `--nodes-only` or `--edges-only` (e.g. rebuild edges for just one repo).
139
+
103
140
  ```bash
104
- devsmind rule --path C:\work\my-project\.devmind
141
+ devsmind index --run --provider ollama --model qwen2.5-coder
142
+ devsmind index --run --provider gemini --key YOUR_KEY --nodes-only
143
+ devsmind index --run --edges-only --repos harrir-web,harrir-web-admin
144
+ devsmind index --run --provider gemini --key YOUR_KEY --from-scratch --yes
105
145
  ```
106
- This prints a tailored system instruction prompt. Copy and append it to your IDE's workspace rules (e.g., `.cursorrules`, Claude Project instructions, or Antigravity system settings) so your AI agent knows how to read, check, and update the brain during sessions.
107
146
 
108
- ### 4. Start the Server
109
- Start the MCP server on your machine:
147
+ ### `devsmind reindex`
148
+
149
+ Syncs the graph with code changes since the last run. No `--run` flag needed — it always executes.
150
+
110
151
  ```bash
111
- devsmind start
152
+ devsmind reindex --provider gemini --key YOUR_API_KEY
112
153
  ```
113
- By default, this launches an HTTP MCP server listening on port **`4513`**.
114
154
 
115
- Configure your AI IDE to connect to:
116
- `http://localhost:4513/mcp`
155
+ | Flag | Description |
156
+ |---|---|
157
+ | `-p, --path <devmind_path>` | Path to `.devmind` (default: `.devmind` in cwd) |
158
+ | `--provider <provider>` | `gemini` (default) \| `vertex` \| `ollama` |
159
+ | `--model <name>` | Model id |
160
+ | `--key <api_key>` | API key / service account path |
161
+ | `--url <url>` | Ollama endpoint |
162
+ | `--chunk-size <lines>` / `--chunk-overlap <lines>` | Same as `index` — bump `--chunk-size` (e.g. `3000`) if large files are timing out |
163
+ | `--rpm <number>` | Same as `index` — unthrottled by default |
164
+ | `--fill-gaps` | Gap-fill mode — see below |
165
+ | `--local-edges` | *Deprecated, no-op* |
166
+
167
+ There is no `--from-scratch` / `--nodes-only` / `--edges-only` / `--repos` on `reindex` — those are `index`-only.
168
+
169
+ **Two selection modes:**
170
+
171
+ * **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.
172
+ * **`--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.
117
173
 
118
- For IDEs requiring stdio execution, start the server in stdio mode:
119
174
  ```bash
120
- devsmind start --stdio
175
+ devsmind reindex --provider vertex --model gemini-2.5-flash --key sa.json --fill-gaps --rpm 60 --chunk-size 3000
121
176
  ```
122
177
 
123
- ---
178
+ ### Providers & Performance
124
179
 
125
- ## 🗺️ Indexing Modes: Setting Up the Brain
180
+ Applies to both `index` and `reindex` same `--provider`/`--model`/`--rpm`/`--chunk-size` flags, same Phase 1 (LLM) vs Phase 2 (local AST) split.
126
181
 
127
- You have two options to index your codebase:
182
+ **Supported providers (`--provider`):**
128
183
 
129
- ### Mode 1: Grow-As-You-Go (Zero Upfront Friction)
130
- No upfront setup required. Just start writing code.
131
- 1. When your AI touches a function, it verifies if a node exists in `brain.db`.
132
- 2. If absent, it creates it, connects its local import dependencies, and writes the first history snapshot.
133
- 3. The graph grows organically around the files you actively modify.
134
- * *Ideal for:* Small/medium codebases, solo developer hacks, or immediate experimentation.
184
+ | Provider | Auth | Notes |
185
+ |---|---|---|
186
+ | `gemini` (default) | `--key` or `GEMINI_API_KEY` env var | Default model: `gemini-2.0-flash` |
187
+ | `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` |
188
+ | `ollama` | None local server | Default model: `qwen2.5-coder`. Default endpoint `http://localhost:11434`, override with `--url` |
135
189
 
136
- ### Mode 2: Upfront Full Index (High Reliability)
137
- Index the entire workspace upfront so the AI knows every type, schema, and API contract from day one.
190
+ **Performance flags:**
191
+ * `--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.
192
+ * `--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.
193
+ * `--rpm <number>`: opt-in throttling. Leave unset unless you're hitting a known provider quota.
138
194
 
139
- You have two ways to run the upfront index:
195
+ **Benchmarks** *(approximate from informal internal testing, not a rigorous accuracy-scoring methodology; your results will vary by repo, prompt, and quota)*:
140
196
 
141
- #### Option A: Background CLI Indexing (Recommended Faster & Free)
142
- Run the indexer directly in your local terminal using a background LLM provider. This runs in the background and uses **zero tokens** in your active IDE chat session.
197
+ | Model | Repo size | Time | Approx. graph accuracy |
198
+ |---|---|---|---|
199
+ | `qwen2.5-coder:30b` (Ollama, local) | ~1,080 files | ~15 hours | ~50% |
200
+ | `gemini-2.5-flash` (cloud) | same repo | ~5 hours | ~90% |
143
201
 
144
- **Example Command:**
145
- ```bash
146
- devsmind index --run --provider gemini --model gemini-2.5-flash --key YOUR_API_KEY
147
- ```
202
+ 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.
148
203
 
149
- **Supported Providers (`--provider`):**
150
- * `gemini` (Default. Free tier rate-limits to stay within 15 RPM).
151
- * `vertex` (Google Cloud Vertex AI).
152
- * `ollama` (For local offline models, e.g. `--model qwen2.5-coder`).
204
+ ---
153
205
 
154
- #### Option B: In-Chat Agent Indexing
155
- Tell your AI assistant inside your IDE chat:
156
- 1. *"Call devsmind.index_start with devmind_path = <path>"*
157
- 2. *"Then read every file it returns and call add_node + add_connection for each entity."*
158
- 3. *"Checkpoint every 10 files. Call index_complete when done."*
206
+ ## 🆕 `devsmind init` In Depth
159
207
 
160
- * **No External Scripts**: When indexing in-chat, the AI agent must perform the indexing natively using the MCP tools. It must **never** write or run custom external scripts (like Python or custom scripts), as this bypasses the tracking scratchpad and prevents proper resumption in new chat sessions if context limits are reached.
208
+ `devsmind init` behaves differently depending on whether a `.devmind/config.json` already exists in the target directory.
161
209
 
162
- ---
210
+ ### First-time setup (no existing config)
163
211
 
164
- ### 📋 Rules & Maintenance (Applies to both CLI and In-Chat Indexing)
212
+ 1. **Project name + mode.** Prompts for a project name, then a choice between:
213
+ * **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.
214
+ * **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).
215
+ 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.
216
+ 3. **Exclusions, per repo.** For each repo you get:
217
+ * An offer to auto-import the repo's own `.gitignore` patterns.
218
+ * An offer to add common non-code config files (lockfiles, `tsconfig.json`, eslint/prettier configs, etc.) if present.
219
+ * An interactive file browser to manually toggle folders/files in or out of indexing scope.
220
+ 4. **Developer info.** Name and email, pre-filled from `git config user.name` / `user.email` if available. Always written to `.env` (never committed).
221
+ 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.
222
+ 6. **Session timeout** (default 60 minutes) and optional **environment URLs** (dev/staging/prod) and **free-text notes** for the AI.
223
+ 7. **Files written:**
224
+ * `.devmind/config.json` — project name, mode, repos, ignored paths, tech stack, environments, notes. **Committed to Git.**
225
+ * `.devmind/.env` — developer name/email + (standalone mode) each repo's local absolute path. **Gitignored.**
226
+ * `.devmind/.gitignore` — auto-created to exclude `.env`, `brain.db`, `brain.db-wal`, `brain.db-shm`, `index_scratchpad.json`.
227
+ * `.devmind/graph/` and `.devmind/history/` — created with `.gitkeep` so Git tracks the (initially empty) directories.
228
+ * `.devmind/brain.db` — empty SQLite cache, initialized immediately.
165
229
 
166
- Regardless of whether you choose Option A (CLI) or Option B (In-Chat), the following rules and database maintenance procedures remain identical:
230
+ ### Re-running `init` (config already exists)
167
231
 
168
- > 💡 **Model-Dependent Indexing**: The speed and quality of indexing depend on the selected AI model. A smarter, more capable model (e.g., Gemini 2.0 Pro, Claude 3.5 Sonnet) will take slightly longer to parse complex syntax and relationships but yields a much more accurate and comprehensive code graph.
169
- >
170
- > 🧹 **Pruning & Maintenance**: During active development, DevsMind dynamically handles deprecations and renames if function signatures match. For manual cleanup and auditing, you have access to specialized tools:
171
- > * `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).
172
- > * `get_orphaned_nodes`: Finds disconnected code nodes that have no incoming or outgoing connections to identify dead code or stale records.
173
- >
174
- > ⚠️ **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.
175
- > * Spurious or missing nodes are **deprecated** (keeping their code history and reasoning intact, but removing active connections in the graph).
176
- > * An interactive terminal tool is provided to let users review, inspect, and prune nodes:
177
- > ```bash
178
- > devsmind prune
179
- > ```
180
- > This utility allows you to view node stats, inspect current code, page through chronological change history, and permanently delete individual nodes or clear all nodes/history as desired.
232
+ This is the **joining-developer / repair flow** it never overwrites the shared `config.json`:
233
+
234
+ 1. Checks `.env` for developer name/email; prompts only if missing.
235
+ 2. **Embedded mode:** verifies the repo's relative path still resolves and reports any that don't (rare embedded paths are just `.`).
236
+ 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.
237
+ 4. Rewrites `.env`, ensures `.gitignore` exists, and re-initializes `brain.db` if needed.
238
+
239
+ This is exactly what a new team member runs after `git clone`-ing a project that already has `.devmind/config.json` committed see [Joining a Project](#joining-a-project) below.
240
+
241
+ ---
242
+
243
+ ## 🖥️ Other CLI Commands
181
244
 
182
- * *Ideal for:* Production systems and team collaboration, preventing bugs where AI modifies variables used in undocumented parts of the system.
245
+ * **`devsmind rule [--path <devmind_path>]`** prints a ready-to-paste AI workspace rule, pre-filled with this project's specific configuration, so you don't have to hand-write a system prompt. Paste the output into `.cursorrules`, Claude Project instructions, Antigravity system settings, etc.
246
+ * **`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.
247
+ * **`devsmind view [-p, --path <devmind_path>] [-P, --port <number>]`** — opens the interactive D3.js graph visualizer in your browser (see [below](#-interactive-graph-visualizer)).
248
+ * **`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.
183
249
 
184
250
  ---
185
251
 
@@ -232,6 +298,23 @@ CREATE TABLE history (
232
298
  >
233
299
  > 💾 **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`.
234
300
 
301
+ ### Growing the graph outside of `index`/`reindex`
302
+
303
+ 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:
304
+ 1. When your AI touches a function, it checks whether a node already exists for it in `brain.db`.
305
+ 2. If absent, it creates the node, connects its local import dependencies, and writes the first history snapshot.
306
+ 3. The graph grows around whatever files you actively modify.
307
+
308
+ 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.
309
+
310
+ > 🧹 **Pruning & Maintenance**: DevsMind dynamically handles deprecations and renames if function signatures match. For manual cleanup and auditing:
311
+ > * `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).
312
+ > * `get_orphaned_nodes`: Finds disconnected code nodes that have no incoming or outgoing connections to identify dead code or stale records.
313
+ >
314
+ > ⚠️ **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.
315
+ > * Spurious or missing nodes are **deprecated** (keeping their code history and reasoning intact, but removing active connections in the graph).
316
+ > * Use `devsmind prune` (see [Other CLI Commands](#-other-cli-commands)) for interactive manual review and permanent deletion.
317
+
235
318
  ---
236
319
 
237
320
  ## 🔌 MCP Tool Reference
@@ -259,12 +342,14 @@ DevsMind tools are designed with **layered granularity**. The AI only pulls the
259
342
  * `index_complete`: Marks the codebase indexing session as fully completed.
260
343
 
261
344
  ### ✍️ Category 4: Writes & Mutations
262
- * `add_node`: Registers a new structure (function, class, endpoint, schema, variable, etc.) in the graph.
263
- * `add_connection`: Links two structures together as a dependency relationship (`source` uses/calls `target`).
264
- * `update_history`: Registers a code snapshot and writes history logs (respects the 1h session boundary rule).
345
+ * `stage_change`: Buffers one touched entity (node id + code snapshot + reasoning) to disk **without** writing to the graph yet. Call once per file you changed during a task — you do *not* reason about connections here.
346
+ * `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.
347
+ * `update_history`: Single-node convenience creates the node, writes the history snapshot (respects the 1h session boundary rule), **and** resolves that node's outgoing connections. Equivalent to one `stage_change` + `commit_changes`.
265
348
  * `rename_node`: Re-keys a node identifier and updates all associated records (connections and history) seamlessly.
266
349
  * `deprecate_node`: Marks a code node as deprecated, removing its connection mappings while retaining its coding snapshots and reasoning logs in the database.
267
350
 
351
+ > The former `add_node` / `add_connection` tools are removed — nodes and edges are now created automatically by `stage_change` + `commit_changes` (or `update_history`), so the AI never hand-manages edges.
352
+
268
353
  ### 🧹 Category 5: Optimization & Maintenance
269
354
  * `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.
270
355
  * `search_nodes`: Full-text search (FTS5) index for node names, identifiers, and reasoning logs.
@@ -311,7 +396,27 @@ The new developer's AI agent now possesses the full architectural context and de
311
396
 
312
397
  ## Changelog
313
398
 
314
- ### Version 2.0.4 (Current Release)
399
+ ### Version 2.1.1 (Current Release)
400
+ * **`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.
401
+ * **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.
402
+ * **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.
403
+ * **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.
404
+ * **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.
405
+ * **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.**
406
+
407
+ ### Version 2.1.0
408
+ * **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.
409
+ * **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`.
410
+ * **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).
411
+ * **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).
412
+ * **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.
413
+ * **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.
414
+
415
+ ### Version 2.0.5
416
+ * **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.
417
+ * **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.
418
+
419
+ ### Version 2.0.4
315
420
  * **Disk-Based History Adaptation & SQL Search Optimization**:
316
421
  * 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.
317
422
  * Fixed `getRecentChanges` and `getAllHistory` to populate reasoning/code from disk-based history files.
package/dist/cli/index.js CHANGED
@@ -83,17 +83,43 @@ program
83
83
  .option('--model <name>', 'Model identifier (default: "gemini-2.0-flash", "gemini-1.5-flash", or "qwen2.5-coder")')
84
84
  .option('--key <api_key>', 'API Key or Service Account file path (overrides GEMINI_API_KEY / GOOGLE_APPLICATION_CREDENTIALS)')
85
85
  .option('--url <url>', 'Ollama server endpoint (default: "http://localhost:11434")')
86
+ .option('--chunk-size <lines>', 'Max lines per chunk sent to the LLM (default: off — whole file in one call). Set this for very large files or smaller-context models.')
87
+ .option('--chunk-overlap <lines>', 'Overlap lines between chunks, only used when --chunk-size is set (default: 50)')
88
+ .option('--local-edges', '[Deprecated] Connections are always resolved locally via AST now — this flag is a no-op, kept for backward compatibility.')
89
+ .option('--from-scratch', 'Wipe ALL nodes, connections, history, and graph/history folders, then reindex from zero. Asks for confirmation unless --yes is passed.')
90
+ .option('--nodes-only', 'Only run Phase 1 (node/code extraction). No connections are built or touched.')
91
+ .option('--edges-only', 'Only run Phase 2 (connection resolution). Wipes existing connections and rebuilds them fresh across all current nodes. Requires nodes to already exist.')
92
+ .option('--repos <names>', 'Comma-separated repo names to restrict this run to (standalone mode only). Composes with --nodes-only / --edges-only, or full. Not allowed with --from-scratch.')
93
+ .option('--rpm <number>', 'Max LLM requests per minute, paced proactively to avoid 429s (default: unthrottled — fires as fast as possible)')
94
+ .option('--yes', 'Skip the confirmation prompt for --from-scratch')
86
95
  .action(async (opts) => {
87
96
  const devmindPath = opts.path ?? '.devmind';
88
97
  const resolved = require('path').resolve(devmindPath);
89
98
  if (opts.run) {
99
+ if (opts.nodesOnly && opts.edgesOnly) {
100
+ console.error('❌ Error: --nodes-only and --edges-only cannot be used together. Omit both to run the full index.');
101
+ process.exit(1);
102
+ }
103
+ if (opts.fromScratch && opts.edgesOnly) {
104
+ console.error('❌ Error: --from-scratch and --edges-only cannot be used together — --from-scratch wipes nodes, so there would be nothing to build edges from. Use --from-scratch alone, or --from-scratch --nodes-only, then --edges-only separately.');
105
+ process.exit(1);
106
+ }
90
107
  try {
91
108
  await (0, runner_1.runBackgroundIndexing)({
92
109
  devmindPath,
93
110
  provider: opts.provider,
94
111
  model: opts.model,
95
112
  key: opts.key,
96
- url: opts.url
113
+ url: opts.url,
114
+ chunkSize: opts.chunkSize ? parseInt(opts.chunkSize, 10) : undefined,
115
+ chunkOverlap: opts.chunkOverlap ? parseInt(opts.chunkOverlap, 10) : undefined,
116
+ localEdges: !!opts.localEdges,
117
+ fromScratch: !!opts.fromScratch,
118
+ nodesOnly: !!opts.nodesOnly,
119
+ edgesOnly: !!opts.edgesOnly,
120
+ repos: opts.repos ? opts.repos.split(',').map(s => s.trim()).filter(Boolean) : undefined,
121
+ rpm: opts.rpm ? parseInt(opts.rpm, 10) : undefined,
122
+ yes: !!opts.yes
97
123
  });
98
124
  }
99
125
  catch (err) {
@@ -106,12 +132,18 @@ program
106
132
  console.log(` Brain : ${resolved}`);
107
133
  console.log(`\n📋 To index your codebase, tell your AI assistant:\n`);
108
134
  console.log(` "Call devsmind.index_start with devmind_path = ${resolved}"`);
109
- console.log(` "Then read every file it returns and call add_node + add_connection for each entity."`);
135
+ console.log(` "Then read every file it returns and call stage_change for each entity, then commit_changes."`);
110
136
  console.log(` "Checkpoint every 10 files. Call index_complete when done."`);
111
137
  console.log(` "NEVER use or write external scripts (like Python) to index files."\n`);
112
138
  console.log(` Or run it locally in the background using:\n`);
113
139
  console.log(` devsmind index --run --provider gemini --key YOUR_GEMINI_KEY`);
114
- console.log(` devsmind index --run --provider ollama --model qwen2.5-coder\n`);
140
+ console.log(` devsmind index --run --provider gemini --model gemini-2.5-flash --key YOUR_GEMINI_KEY --chunk-size 1500 --chunk-overlap 100`);
141
+ console.log(` devsmind index --run --provider ollama --model qwen2.5-coder`);
142
+ console.log(` devsmind index --run --provider gemini --key YOUR_GEMINI_KEY --nodes-only`);
143
+ console.log(` devsmind index --run --edges-only`);
144
+ console.log(` devsmind index --run --provider gemini --key YOUR_GEMINI_KEY --from-scratch`);
145
+ console.log(` devsmind index --run --edges-only --repos harrir-web,harrir-web-admin`);
146
+ console.log(` devsmind index --run --provider gemini --key YOUR_GEMINI_KEY --repos harrir-mini-app\n`);
115
147
  }
116
148
  });
117
149
  program
@@ -122,6 +154,11 @@ program
122
154
  .option('--model <name>', 'Model identifier (default: "gemini-2.0-flash", "gemini-1.5-flash", or "qwen2.5-coder")')
123
155
  .option('--key <api_key>', 'API Key or Service Account file path (overrides GEMINI_API_KEY / GOOGLE_APPLICATION_CREDENTIALS)')
124
156
  .option('--url <url>', 'Ollama server endpoint (default: "http://localhost:11434")')
157
+ .option('--chunk-size <lines>', 'Max lines per chunk sent to the LLM (default: off — whole file in one call). Set this for very large files or smaller-context models.')
158
+ .option('--chunk-overlap <lines>', 'Overlap lines between chunks, only used when --chunk-size is set (default: 50)')
159
+ .option('--local-edges', '[Deprecated] Connections are always resolved locally via AST now — this flag is a no-op, kept for backward compatibility.')
160
+ .option('--rpm <number>', 'Max LLM requests per minute, paced proactively to avoid 429s (default: unthrottled — fires as fast as possible)')
161
+ .option('--fill-gaps', 'Instead of the normal mtime-based diff, back-fill only files that currently have zero graph nodes (never indexed, or dropped by a prior crashed run). Per-file failures are skipped (not fatal) and edges are rebuilt across the whole graph afterward. Safe to re-run repeatedly until no gaps remain.')
125
162
  .action(async (opts) => {
126
163
  const devmindPath = opts.path ?? '.devmind';
127
164
  try {
@@ -130,7 +167,12 @@ program
130
167
  provider: opts.provider,
131
168
  model: opts.model,
132
169
  key: opts.key,
133
- url: opts.url
170
+ url: opts.url,
171
+ chunkSize: opts.chunkSize ? parseInt(opts.chunkSize, 10) : undefined,
172
+ chunkOverlap: opts.chunkOverlap ? parseInt(opts.chunkOverlap, 10) : undefined,
173
+ localEdges: !!opts.localEdges,
174
+ rpm: opts.rpm ? parseInt(opts.rpm, 10) : undefined,
175
+ fillGaps: !!opts.fillGaps
134
176
  });
135
177
  }
136
178
  catch (err) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";;;AAEA,yCAAoC;AACpC,iCAAoC;AACpC,iCAAoC;AACpC,iCAAoC;AACpC,mCAAsC;AACtC,qCAA0E;AAC1E,0CAAmF;AAEnF,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,UAAU,CAAC;KAChB,WAAW,CAAC,8BAA8B,CAAC;KAC3C,OAAO,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;AAErC,OAAO;KACJ,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,4DAA4D,CAAC;KACzE,MAAM,CAAC,KAAK,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C,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS;YAClD,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ;SAC1B,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,wBAAyB,GAAa,CAAC,OAAO,EAAE,CAAC,CAAC;QAChE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,OAAO;KACJ,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,wEAAwE,CAAC;KACrF,MAAM,CAAC,2BAA2B,EAAE,oEAAoE,CAAC;KACzG,MAAM,CAAC,KAAK,EAAE,IAAuB,EAAE,EAAE;IACxC,IAAI,CAAC;QACH,MAAM,IAAA,mBAAW,EAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,qBAAsB,GAAa,CAAC,OAAO,EAAE,CAAC,CAAC;QAC7D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
package/dist/cli/init.js CHANGED
@@ -775,7 +775,8 @@ async function handleNewInit(cwd) {
775
775
  'brain.db',
776
776
  'brain.db-wal',
777
777
  'brain.db-shm',
778
- 'index_scratchpad.json'
778
+ 'index_scratchpad.json',
779
+ 'history_scratchpad.json'
779
780
  ].join('\n') + '\n';
780
781
  fs.writeFileSync(gitignorePath, ignoreContent, 'utf-8');
781
782
  console.log(`💾 Created/Updated ${gitignorePath}`);