codecompass-mcp 2.6.1__tar.gz → 2.7.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. {codecompass_mcp-2.6.1 → codecompass_mcp-2.7.0}/PKG-INFO +29 -48
  2. {codecompass_mcp-2.6.1 → codecompass_mcp-2.7.0}/README.md +28 -47
  3. {codecompass_mcp-2.6.1 → codecompass_mcp-2.7.0}/codecompass_mcp.egg-info/PKG-INFO +29 -48
  4. {codecompass_mcp-2.6.1 → codecompass_mcp-2.7.0}/codecompass_mcp.egg-info/SOURCES.txt +1 -0
  5. {codecompass_mcp-2.6.1 → codecompass_mcp-2.7.0}/graph/code_graph_client.py +245 -27
  6. {codecompass_mcp-2.6.1 → codecompass_mcp-2.7.0}/graph/code_query_cli.py +75 -7
  7. {codecompass_mcp-2.6.1 → codecompass_mcp-2.7.0}/ingestion/code_parser.py +452 -40
  8. {codecompass_mcp-2.6.1 → codecompass_mcp-2.7.0}/main.py +25 -26
  9. {codecompass_mcp-2.6.1 → codecompass_mcp-2.7.0}/mcp_server.py +66 -5
  10. {codecompass_mcp-2.6.1 → codecompass_mcp-2.7.0}/models/code_types.py +17 -0
  11. {codecompass_mcp-2.6.1 → codecompass_mcp-2.7.0}/pyproject.toml +1 -1
  12. codecompass_mcp-2.7.0/tests/test_accuracy_fixes.py +383 -0
  13. {codecompass_mcp-2.6.1 → codecompass_mcp-2.7.0}/tests/test_mcp_server.py +13 -4
  14. {codecompass_mcp-2.6.1 → codecompass_mcp-2.7.0}/LICENSE +0 -0
  15. {codecompass_mcp-2.6.1 → codecompass_mcp-2.7.0}/codecompass_mcp.egg-info/dependency_links.txt +0 -0
  16. {codecompass_mcp-2.6.1 → codecompass_mcp-2.7.0}/codecompass_mcp.egg-info/entry_points.txt +0 -0
  17. {codecompass_mcp-2.6.1 → codecompass_mcp-2.7.0}/codecompass_mcp.egg-info/requires.txt +0 -0
  18. {codecompass_mcp-2.6.1 → codecompass_mcp-2.7.0}/codecompass_mcp.egg-info/top_level.txt +0 -0
  19. {codecompass_mcp-2.6.1 → codecompass_mcp-2.7.0}/config.py +0 -0
  20. {codecompass_mcp-2.6.1 → codecompass_mcp-2.7.0}/graph/__init__.py +0 -0
  21. {codecompass_mcp-2.6.1 → codecompass_mcp-2.7.0}/graph/cli.py +0 -0
  22. {codecompass_mcp-2.6.1 → codecompass_mcp-2.7.0}/graph/setup.py +0 -0
  23. {codecompass_mcp-2.6.1 → codecompass_mcp-2.7.0}/ingestion/__init__.py +0 -0
  24. {codecompass_mcp-2.6.1 → codecompass_mcp-2.7.0}/ingestion/chunker.py +0 -0
  25. {codecompass_mcp-2.6.1 → codecompass_mcp-2.7.0}/ingestion/code_normalizer.py +0 -0
  26. {codecompass_mcp-2.6.1 → codecompass_mcp-2.7.0}/ingestion/description_enricher.py +0 -0
  27. {codecompass_mcp-2.6.1 → codecompass_mcp-2.7.0}/ingestion/entity_resolver.py +0 -0
  28. {codecompass_mcp-2.6.1 → codecompass_mcp-2.7.0}/ingestion/file_watcher.py +0 -0
  29. {codecompass_mcp-2.6.1 → codecompass_mcp-2.7.0}/ingestion/graph_writer.py +0 -0
  30. {codecompass_mcp-2.6.1 → codecompass_mcp-2.7.0}/ingestion/hierarchy_builder.py +0 -0
  31. {codecompass_mcp-2.6.1 → codecompass_mcp-2.7.0}/ingestion/reader_agent.py +0 -0
  32. {codecompass_mcp-2.6.1 → codecompass_mcp-2.7.0}/ingestion/source_context.py +0 -0
  33. {codecompass_mcp-2.6.1 → codecompass_mcp-2.7.0}/models/__init__.py +0 -0
  34. {codecompass_mcp-2.6.1 → codecompass_mcp-2.7.0}/models/types.py +0 -0
  35. {codecompass_mcp-2.6.1 → codecompass_mcp-2.7.0}/setup.cfg +0 -0
  36. {codecompass_mcp-2.6.1 → codecompass_mcp-2.7.0}/tests/test_batch_impact.py +0 -0
  37. {codecompass_mcp-2.6.1 → codecompass_mcp-2.7.0}/tests/test_blast_radius.py +0 -0
  38. {codecompass_mcp-2.6.1 → codecompass_mcp-2.7.0}/tests/test_code_parser.py +0 -0
  39. {codecompass_mcp-2.6.1 → codecompass_mcp-2.7.0}/tests/test_description_enricher.py +0 -0
  40. {codecompass_mcp-2.6.1 → codecompass_mcp-2.7.0}/tests/test_ingestion.py +0 -0
  41. {codecompass_mcp-2.6.1 → codecompass_mcp-2.7.0}/tests/test_lit_css_parser.py +0 -0
  42. {codecompass_mcp-2.6.1 → codecompass_mcp-2.7.0}/tests/test_php_parser.py +0 -0
  43. {codecompass_mcp-2.6.1 → codecompass_mcp-2.7.0}/utils/__init__.py +0 -0
  44. {codecompass_mcp-2.6.1 → codecompass_mcp-2.7.0}/utils/formatting.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codecompass-mcp
3
- Version: 2.6.1
3
+ Version: 2.7.0
4
4
  Summary: Structural code context for AI coding agents — a local code knowledge graph for blast radius, impact, deps, dead code, and flow tracing
5
5
  Author: CodeCompass contributors
6
6
  License: MIT
@@ -70,26 +70,8 @@ command, instead of opening a dozen files to follow the thread:
70
70
  ![Flow trace of ingest_code](docs/flow-example.svg)
71
71
 
72
72
  The `json` flow format hands each node its real signature, docstring, and source
73
- snippet, plus the numbered call order. An agent reads that and narrates the
74
- flow in plain language for example, the diagram above becomes:
75
-
76
- > **How `ingest_code` works** (narrated by an agent from `--flow ... --format json`)
77
- >
78
- > 1. **`init_project`** — sets up the `.codecompass/` directory and registers the
79
- > project's `AGENTS.md` rules before anything is parsed.
80
- > 2. **`get_client`** — opens the local NetworkX graph that everything will be
81
- > written into.
82
- > 3. **`build_hierarchy`** — walks the repo and writes the Project → Folder → File
83
- > skeleton nodes.
84
- > 4. **`parse_directory`** — recursively parses every supported file, extracting
85
- > functions, classes, imports, and call relationships.
86
- > 5. **`normalize_triples`** — (optional) runs the Haiku pass to canonicalize
87
- > entity names.
88
- > 6. **`write_code_triples_batch`** — persists all extracted relationships into the
89
- > graph, then reports the node count and refreshes `AGENTS.md`.
90
- >
91
- > Net effect: a repo goes from raw files to a queryable dependency graph in one
92
- > pass, with the graph saved locally as JSON.
73
+ snippet, plus the numbered call order, so an agent can narrate the whole data
74
+ flow from that single query instead of opening a dozen files.
93
75
 
94
76
  ---
95
77
 
@@ -183,7 +165,9 @@ That's it. Two commands:
183
165
  - Writes a `## Code graph` section into the project's `AGENTS.md` with mandatory rules for agents:
184
166
  - Run `--blast-radius` before editing any file
185
167
  - Run `--impact` before calling unfamiliar symbols
186
- - Re-ingest after creating or deleting files
168
+ - Re-ingest after any code change
169
+ - Installs the Claude Code `PreToolUse` guardrail into `.claude/` (see
170
+ [Hard enforcement](#hard-enforcement-for-claude-code--pi-optional) below)
187
171
 
188
172
  Any AI agent that reads `AGENTS.md` (Claude Code, OpenCode, Cursor, etc.) will follow these rules automatically.
189
173
 
@@ -197,32 +181,21 @@ actually blocked instead of just discouraged, both Claude Code and
197
181
  [pi](https://pi.dev) support hard tool-call enforcement via hooks/extensions.
198
182
 
199
183
  The block only covers what codecompass unambiguously replaces — searching or
200
- reading code content (`grep`, `rg`, `cat`, the `Grep` tool). `ls`/`find` are
201
- left alone; they have legitimate non-code uses (checking build output,
202
- confirming a generated file exists, listing fixtures) that the graph doesn't
203
- cover. Guide that judgment call with a decision-rule note in your agent
204
- instructions rather than blocking it — see the `AGENTS.md` this tool
205
- generates for the exact wording.
184
+ reading code content (`Grep`/`Glob` tools, `cat`/`grep`/`rg`/`sed`/`awk`/`head`/`tail`/`less`
185
+ inside `Bash`). `ls`/`find` are left alone; they have legitimate non-code uses
186
+ (checking build output, confirming a generated file exists, listing fixtures)
187
+ that the graph doesn't cover.
206
188
 
207
189
  ### Claude Code
208
190
 
209
- Add a `PreToolUse` hook in `.claude/settings.json`:
210
-
211
- ```json
212
- {
213
- "hooks": {
214
- "PreToolUse": [
215
- { "matcher": "Bash", "hooks": [{ "type": "command", "command": "python3 .claude/hooks/block-file-search.py" }] },
216
- { "matcher": "Grep", "hooks": [{ "type": "command", "command": "python3 .claude/hooks/block-file-search.py" }] }
217
- ]
218
- }
219
- }
220
- ```
221
-
222
- `.claude/hooks/block-file-search.py` reads the tool call from stdin, blocks
223
- `Grep` and `cat`/`grep`/`rg` inside `Bash` (exit code `2`, with the reason
224
- printed to stderr so Claude sees it and redirects to codecompass), and
225
- allows everything else.
191
+ `codecompass init` installs this automatically — no manual setup needed. It
192
+ writes `.claude/hooks/block-file-search.py` and merges the required
193
+ `PreToolUse` matchers (`Bash`, `Grep`, `Glob`) into `.claude/settings.json`,
194
+ without clobbering any hooks you've already configured. The hook reads the
195
+ tool call from stdin, blocks matches (exit code `2`, with the reason printed
196
+ to stderr so Claude sees it and redirects to codecompass), and allows
197
+ everything else. Start a new Claude Code session in the repo and accept the
198
+ trust prompt hooks execute shell commands, so Claude Code asks first.
226
199
 
227
200
  ### Pi
228
201
 
@@ -298,14 +271,20 @@ Every format numbers each call by source line so call order is explicit. By defa
298
271
  | Command | Purpose |
299
272
  |---|---|
300
273
  | `codecompass init [path]` | Create `.codecompass/` and register in `AGENTS.md` |
301
- | `codecompass ingest-code [path]` | Parse source files and build/rebuild the graph |
274
+ | `codecompass ingest-code [path] [--normalize] [--dump-triples <out.json>] [--describe]` | Parse source files and build/rebuild the graph |
275
+ | `codecompass describe [path] [--batch-size N] [--force] [--apply]` | Stage entity descriptions for an agent swarm to fill in, then merge results back into the graph |
302
276
  | `codecompass query <flags> [path]` | Query the graph (blast-radius, impact, deps, flow, tree, etc.) |
303
277
  | `codecompass watch [path]` | Live re-index on file changes |
304
278
  | `codecompass load-triples <file> <path>` | Load pre-processed triples from JSON |
279
+ | `codecompass mcp [path]` | Run the MCP server, defaulting to the given repo |
305
280
  | `codecompass setup` | Copy instructions to `~/.config/opencode/codecompass/` |
306
281
 
307
282
  All commands default to `.` (current directory) when path is omitted.
308
283
 
284
+ `--describe` (on `ingest-code`) and the standalone `describe` command are
285
+ **user-triggered only** — expensive, and not something an agent should run
286
+ automatically after a routine edit or re-ingest.
287
+
309
288
  ---
310
289
 
311
290
  ## MCP server
@@ -400,13 +379,15 @@ codecompass/
400
379
  │ ├── code_parser.py tree-sitter entity + relationship extraction
401
380
  │ ├── hierarchy_builder.py Project → Folder → File skeleton
402
381
  │ ├── file_watcher.py incremental re-index on file changes
403
- └── code_normalizer.py optional entity name normalization (Haiku)
382
+ ├── code_normalizer.py optional entity name normalization (Haiku)
383
+ │ └── description_enricher.py agent-swarm description staging/apply (describe)
404
384
  ├── models/
405
385
  │ └── code_types.py CodeTriple, FileNode, FolderNode
406
386
  ├── opencode/
407
387
  │ └── instructions.md agent instructions for opencode integration
408
388
  ├── config.py env var config with fallback defaults
409
- └── main.py CLI dispatch: init / ingest-code / query / watch
389
+ ├── main.py CLI dispatch: init / ingest-code / describe / query / watch / mcp
390
+ └── mcp_server.py FastMCP server exposing the same queries as tools
410
391
  ```
411
392
 
412
393
  Inside each indexed project:
@@ -32,26 +32,8 @@ command, instead of opening a dozen files to follow the thread:
32
32
  ![Flow trace of ingest_code](docs/flow-example.svg)
33
33
 
34
34
  The `json` flow format hands each node its real signature, docstring, and source
35
- snippet, plus the numbered call order. An agent reads that and narrates the
36
- flow in plain language for example, the diagram above becomes:
37
-
38
- > **How `ingest_code` works** (narrated by an agent from `--flow ... --format json`)
39
- >
40
- > 1. **`init_project`** — sets up the `.codecompass/` directory and registers the
41
- > project's `AGENTS.md` rules before anything is parsed.
42
- > 2. **`get_client`** — opens the local NetworkX graph that everything will be
43
- > written into.
44
- > 3. **`build_hierarchy`** — walks the repo and writes the Project → Folder → File
45
- > skeleton nodes.
46
- > 4. **`parse_directory`** — recursively parses every supported file, extracting
47
- > functions, classes, imports, and call relationships.
48
- > 5. **`normalize_triples`** — (optional) runs the Haiku pass to canonicalize
49
- > entity names.
50
- > 6. **`write_code_triples_batch`** — persists all extracted relationships into the
51
- > graph, then reports the node count and refreshes `AGENTS.md`.
52
- >
53
- > Net effect: a repo goes from raw files to a queryable dependency graph in one
54
- > pass, with the graph saved locally as JSON.
35
+ snippet, plus the numbered call order, so an agent can narrate the whole data
36
+ flow from that single query instead of opening a dozen files.
55
37
 
56
38
  ---
57
39
 
@@ -145,7 +127,9 @@ That's it. Two commands:
145
127
  - Writes a `## Code graph` section into the project's `AGENTS.md` with mandatory rules for agents:
146
128
  - Run `--blast-radius` before editing any file
147
129
  - Run `--impact` before calling unfamiliar symbols
148
- - Re-ingest after creating or deleting files
130
+ - Re-ingest after any code change
131
+ - Installs the Claude Code `PreToolUse` guardrail into `.claude/` (see
132
+ [Hard enforcement](#hard-enforcement-for-claude-code--pi-optional) below)
149
133
 
150
134
  Any AI agent that reads `AGENTS.md` (Claude Code, OpenCode, Cursor, etc.) will follow these rules automatically.
151
135
 
@@ -159,32 +143,21 @@ actually blocked instead of just discouraged, both Claude Code and
159
143
  [pi](https://pi.dev) support hard tool-call enforcement via hooks/extensions.
160
144
 
161
145
  The block only covers what codecompass unambiguously replaces — searching or
162
- reading code content (`grep`, `rg`, `cat`, the `Grep` tool). `ls`/`find` are
163
- left alone; they have legitimate non-code uses (checking build output,
164
- confirming a generated file exists, listing fixtures) that the graph doesn't
165
- cover. Guide that judgment call with a decision-rule note in your agent
166
- instructions rather than blocking it — see the `AGENTS.md` this tool
167
- generates for the exact wording.
146
+ reading code content (`Grep`/`Glob` tools, `cat`/`grep`/`rg`/`sed`/`awk`/`head`/`tail`/`less`
147
+ inside `Bash`). `ls`/`find` are left alone; they have legitimate non-code uses
148
+ (checking build output, confirming a generated file exists, listing fixtures)
149
+ that the graph doesn't cover.
168
150
 
169
151
  ### Claude Code
170
152
 
171
- Add a `PreToolUse` hook in `.claude/settings.json`:
172
-
173
- ```json
174
- {
175
- "hooks": {
176
- "PreToolUse": [
177
- { "matcher": "Bash", "hooks": [{ "type": "command", "command": "python3 .claude/hooks/block-file-search.py" }] },
178
- { "matcher": "Grep", "hooks": [{ "type": "command", "command": "python3 .claude/hooks/block-file-search.py" }] }
179
- ]
180
- }
181
- }
182
- ```
183
-
184
- `.claude/hooks/block-file-search.py` reads the tool call from stdin, blocks
185
- `Grep` and `cat`/`grep`/`rg` inside `Bash` (exit code `2`, with the reason
186
- printed to stderr so Claude sees it and redirects to codecompass), and
187
- allows everything else.
153
+ `codecompass init` installs this automatically — no manual setup needed. It
154
+ writes `.claude/hooks/block-file-search.py` and merges the required
155
+ `PreToolUse` matchers (`Bash`, `Grep`, `Glob`) into `.claude/settings.json`,
156
+ without clobbering any hooks you've already configured. The hook reads the
157
+ tool call from stdin, blocks matches (exit code `2`, with the reason printed
158
+ to stderr so Claude sees it and redirects to codecompass), and allows
159
+ everything else. Start a new Claude Code session in the repo and accept the
160
+ trust prompt hooks execute shell commands, so Claude Code asks first.
188
161
 
189
162
  ### Pi
190
163
 
@@ -260,14 +233,20 @@ Every format numbers each call by source line so call order is explicit. By defa
260
233
  | Command | Purpose |
261
234
  |---|---|
262
235
  | `codecompass init [path]` | Create `.codecompass/` and register in `AGENTS.md` |
263
- | `codecompass ingest-code [path]` | Parse source files and build/rebuild the graph |
236
+ | `codecompass ingest-code [path] [--normalize] [--dump-triples <out.json>] [--describe]` | Parse source files and build/rebuild the graph |
237
+ | `codecompass describe [path] [--batch-size N] [--force] [--apply]` | Stage entity descriptions for an agent swarm to fill in, then merge results back into the graph |
264
238
  | `codecompass query <flags> [path]` | Query the graph (blast-radius, impact, deps, flow, tree, etc.) |
265
239
  | `codecompass watch [path]` | Live re-index on file changes |
266
240
  | `codecompass load-triples <file> <path>` | Load pre-processed triples from JSON |
241
+ | `codecompass mcp [path]` | Run the MCP server, defaulting to the given repo |
267
242
  | `codecompass setup` | Copy instructions to `~/.config/opencode/codecompass/` |
268
243
 
269
244
  All commands default to `.` (current directory) when path is omitted.
270
245
 
246
+ `--describe` (on `ingest-code`) and the standalone `describe` command are
247
+ **user-triggered only** — expensive, and not something an agent should run
248
+ automatically after a routine edit or re-ingest.
249
+
271
250
  ---
272
251
 
273
252
  ## MCP server
@@ -362,13 +341,15 @@ codecompass/
362
341
  │ ├── code_parser.py tree-sitter entity + relationship extraction
363
342
  │ ├── hierarchy_builder.py Project → Folder → File skeleton
364
343
  │ ├── file_watcher.py incremental re-index on file changes
365
- └── code_normalizer.py optional entity name normalization (Haiku)
344
+ ├── code_normalizer.py optional entity name normalization (Haiku)
345
+ │ └── description_enricher.py agent-swarm description staging/apply (describe)
366
346
  ├── models/
367
347
  │ └── code_types.py CodeTriple, FileNode, FolderNode
368
348
  ├── opencode/
369
349
  │ └── instructions.md agent instructions for opencode integration
370
350
  ├── config.py env var config with fallback defaults
371
- └── main.py CLI dispatch: init / ingest-code / query / watch
351
+ ├── main.py CLI dispatch: init / ingest-code / describe / query / watch / mcp
352
+ └── mcp_server.py FastMCP server exposing the same queries as tools
372
353
  ```
373
354
 
374
355
  Inside each indexed project:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codecompass-mcp
3
- Version: 2.6.1
3
+ Version: 2.7.0
4
4
  Summary: Structural code context for AI coding agents — a local code knowledge graph for blast radius, impact, deps, dead code, and flow tracing
5
5
  Author: CodeCompass contributors
6
6
  License: MIT
@@ -70,26 +70,8 @@ command, instead of opening a dozen files to follow the thread:
70
70
  ![Flow trace of ingest_code](docs/flow-example.svg)
71
71
 
72
72
  The `json` flow format hands each node its real signature, docstring, and source
73
- snippet, plus the numbered call order. An agent reads that and narrates the
74
- flow in plain language for example, the diagram above becomes:
75
-
76
- > **How `ingest_code` works** (narrated by an agent from `--flow ... --format json`)
77
- >
78
- > 1. **`init_project`** — sets up the `.codecompass/` directory and registers the
79
- > project's `AGENTS.md` rules before anything is parsed.
80
- > 2. **`get_client`** — opens the local NetworkX graph that everything will be
81
- > written into.
82
- > 3. **`build_hierarchy`** — walks the repo and writes the Project → Folder → File
83
- > skeleton nodes.
84
- > 4. **`parse_directory`** — recursively parses every supported file, extracting
85
- > functions, classes, imports, and call relationships.
86
- > 5. **`normalize_triples`** — (optional) runs the Haiku pass to canonicalize
87
- > entity names.
88
- > 6. **`write_code_triples_batch`** — persists all extracted relationships into the
89
- > graph, then reports the node count and refreshes `AGENTS.md`.
90
- >
91
- > Net effect: a repo goes from raw files to a queryable dependency graph in one
92
- > pass, with the graph saved locally as JSON.
73
+ snippet, plus the numbered call order, so an agent can narrate the whole data
74
+ flow from that single query instead of opening a dozen files.
93
75
 
94
76
  ---
95
77
 
@@ -183,7 +165,9 @@ That's it. Two commands:
183
165
  - Writes a `## Code graph` section into the project's `AGENTS.md` with mandatory rules for agents:
184
166
  - Run `--blast-radius` before editing any file
185
167
  - Run `--impact` before calling unfamiliar symbols
186
- - Re-ingest after creating or deleting files
168
+ - Re-ingest after any code change
169
+ - Installs the Claude Code `PreToolUse` guardrail into `.claude/` (see
170
+ [Hard enforcement](#hard-enforcement-for-claude-code--pi-optional) below)
187
171
 
188
172
  Any AI agent that reads `AGENTS.md` (Claude Code, OpenCode, Cursor, etc.) will follow these rules automatically.
189
173
 
@@ -197,32 +181,21 @@ actually blocked instead of just discouraged, both Claude Code and
197
181
  [pi](https://pi.dev) support hard tool-call enforcement via hooks/extensions.
198
182
 
199
183
  The block only covers what codecompass unambiguously replaces — searching or
200
- reading code content (`grep`, `rg`, `cat`, the `Grep` tool). `ls`/`find` are
201
- left alone; they have legitimate non-code uses (checking build output,
202
- confirming a generated file exists, listing fixtures) that the graph doesn't
203
- cover. Guide that judgment call with a decision-rule note in your agent
204
- instructions rather than blocking it — see the `AGENTS.md` this tool
205
- generates for the exact wording.
184
+ reading code content (`Grep`/`Glob` tools, `cat`/`grep`/`rg`/`sed`/`awk`/`head`/`tail`/`less`
185
+ inside `Bash`). `ls`/`find` are left alone; they have legitimate non-code uses
186
+ (checking build output, confirming a generated file exists, listing fixtures)
187
+ that the graph doesn't cover.
206
188
 
207
189
  ### Claude Code
208
190
 
209
- Add a `PreToolUse` hook in `.claude/settings.json`:
210
-
211
- ```json
212
- {
213
- "hooks": {
214
- "PreToolUse": [
215
- { "matcher": "Bash", "hooks": [{ "type": "command", "command": "python3 .claude/hooks/block-file-search.py" }] },
216
- { "matcher": "Grep", "hooks": [{ "type": "command", "command": "python3 .claude/hooks/block-file-search.py" }] }
217
- ]
218
- }
219
- }
220
- ```
221
-
222
- `.claude/hooks/block-file-search.py` reads the tool call from stdin, blocks
223
- `Grep` and `cat`/`grep`/`rg` inside `Bash` (exit code `2`, with the reason
224
- printed to stderr so Claude sees it and redirects to codecompass), and
225
- allows everything else.
191
+ `codecompass init` installs this automatically — no manual setup needed. It
192
+ writes `.claude/hooks/block-file-search.py` and merges the required
193
+ `PreToolUse` matchers (`Bash`, `Grep`, `Glob`) into `.claude/settings.json`,
194
+ without clobbering any hooks you've already configured. The hook reads the
195
+ tool call from stdin, blocks matches (exit code `2`, with the reason printed
196
+ to stderr so Claude sees it and redirects to codecompass), and allows
197
+ everything else. Start a new Claude Code session in the repo and accept the
198
+ trust prompt hooks execute shell commands, so Claude Code asks first.
226
199
 
227
200
  ### Pi
228
201
 
@@ -298,14 +271,20 @@ Every format numbers each call by source line so call order is explicit. By defa
298
271
  | Command | Purpose |
299
272
  |---|---|
300
273
  | `codecompass init [path]` | Create `.codecompass/` and register in `AGENTS.md` |
301
- | `codecompass ingest-code [path]` | Parse source files and build/rebuild the graph |
274
+ | `codecompass ingest-code [path] [--normalize] [--dump-triples <out.json>] [--describe]` | Parse source files and build/rebuild the graph |
275
+ | `codecompass describe [path] [--batch-size N] [--force] [--apply]` | Stage entity descriptions for an agent swarm to fill in, then merge results back into the graph |
302
276
  | `codecompass query <flags> [path]` | Query the graph (blast-radius, impact, deps, flow, tree, etc.) |
303
277
  | `codecompass watch [path]` | Live re-index on file changes |
304
278
  | `codecompass load-triples <file> <path>` | Load pre-processed triples from JSON |
279
+ | `codecompass mcp [path]` | Run the MCP server, defaulting to the given repo |
305
280
  | `codecompass setup` | Copy instructions to `~/.config/opencode/codecompass/` |
306
281
 
307
282
  All commands default to `.` (current directory) when path is omitted.
308
283
 
284
+ `--describe` (on `ingest-code`) and the standalone `describe` command are
285
+ **user-triggered only** — expensive, and not something an agent should run
286
+ automatically after a routine edit or re-ingest.
287
+
309
288
  ---
310
289
 
311
290
  ## MCP server
@@ -400,13 +379,15 @@ codecompass/
400
379
  │ ├── code_parser.py tree-sitter entity + relationship extraction
401
380
  │ ├── hierarchy_builder.py Project → Folder → File skeleton
402
381
  │ ├── file_watcher.py incremental re-index on file changes
403
- └── code_normalizer.py optional entity name normalization (Haiku)
382
+ ├── code_normalizer.py optional entity name normalization (Haiku)
383
+ │ └── description_enricher.py agent-swarm description staging/apply (describe)
404
384
  ├── models/
405
385
  │ └── code_types.py CodeTriple, FileNode, FolderNode
406
386
  ├── opencode/
407
387
  │ └── instructions.md agent instructions for opencode integration
408
388
  ├── config.py env var config with fallback defaults
409
- └── main.py CLI dispatch: init / ingest-code / query / watch
389
+ ├── main.py CLI dispatch: init / ingest-code / describe / query / watch / mcp
390
+ └── mcp_server.py FastMCP server exposing the same queries as tools
410
391
  ```
411
392
 
412
393
  Inside each indexed project:
@@ -29,6 +29,7 @@ ingestion/source_context.py
29
29
  models/__init__.py
30
30
  models/code_types.py
31
31
  models/types.py
32
+ tests/test_accuracy_fixes.py
32
33
  tests/test_batch_impact.py
33
34
  tests/test_blast_radius.py
34
35
  tests/test_code_parser.py