You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: sync playbook, CLI help, CLAUDE.md, README with this session's changes
- playbook (`server-instructions.ts`): `codegraph_biomarkers` "pending"
state after `index --force`; `dead_code verdict:'all'` returns every
judged candidate; `tests_for` files-mode + showing-first-N cap;
`affected` rejects unindexed explicit paths; `session` CLI-mirror line.
- CLI help (`codegraph.ts`): `coverage --mode` description now lists
`refresh` (the rest of the new CLI surface — `session`, the new
`at-range`/`tests-for`/`affected`/`dead-code` flags — already carried
accurate help text).
- CLAUDE.md: CLI Usage section gains the new flags + a `codegraph_session`
family block; MCP-tools table notes the biomarkers-pending state and
the `affected` unindexed-path rejection.
- README.md: `affected` options table gains the `--files` alias row.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
# Agent-bridge summaries — codegraph_summaries family
158
168
codegraph summaries pending # pull a batch
@@ -183,11 +193,11 @@ Use these tools **directly in the main session** for fast code exploration (repl
183
193
|`codegraph_node`| Get details + source code for a symbol. Pass `symbols: [a, b, c]` for up to 20 at once. Set `includeCallers` / `includeCallees` / `includeBiomarkers` / `includeTests` to fold those answers in. A `kind:'file'` node also renders that file's LLM prose summary when cached. |
184
194
|`codegraph_at_range`| Find symbols whose line range overlaps a file:start-end span. R*Tree-backed, O(log n), smallest-enclosing first. Use for line-range PR review or diff-hunk overlay. Pass `ranges: [{file, startLine, endLine}, …]` to query up to 100 hunks in one call. |
185
195
|`codegraph_find by:content`| Regex content search across indexed files with enclosing-symbol attribution. Empty results surface two hints: (a) when `pathFilter` starts with the project-root basename (e.g. `codegraph/src/...`) and dropping it would have matched, a "drop the prefix?" nudge; (b) when the query contains numeric character classes, a "regex may span a template-literal interpolation; try matching one side" tip. Replaces the pre-merge `codegraph_grep`. |
186
-
|`codegraph_biomarkers`| Static-analysis findings + Code Health score per symbol or project-wide. 17 biomarker types (large/complex/nested method, complex_conditional, brain_method composite, long_parameter_list, magic_number, hardcoded_url, recently_grew, stale_doc, unused_export, god_class, feature_envy [ATFD/LAA], illegal_import [opt-in architectural layering rules], secrets_handling, low_coverage, duplicate_code [code clones — Type-1 exact + Type-2 near + Type-3 partial + Type-4 semantic; the Type-3 partial tier runs a high-overlap (≥0.95) band by default, with a wider FP-prone band opt-in via `duplicateCodePartialClones`]). Auto-refreshed on indexAll/sync. |
196
+
|`codegraph_biomarkers`| Static-analysis findings + Code Health score per symbol or project-wide. 17 biomarker types (large/complex/nested method, complex_conditional, brain_method composite, long_parameter_list, magic_number, hardcoded_url, recently_grew, stale_doc, unused_export, god_class, feature_envy [ATFD/LAA], illegal_import [opt-in architectural layering rules], secrets_handling, low_coverage, duplicate_code [code clones — Type-1 exact + Type-2 near + Type-3 partial + Type-4 semantic; the Type-3 partial tier runs a high-overlap (≥0.95) band by default, with a wider FP-prone band opt-in via `duplicateCodePartialClones`]). Auto-refreshed on indexAll/sync. In the window right after a full `index --force` (cache cleared, post-hook pass pending) it returns an explicit "biomarkers pending" state instead of a false "0 findings / clean". |
187
197
|`codegraph_history`| Symbol-level co-change — "last N times this changed, what else changed?" |
188
198
|`codegraph_review mode='risk'`| Composed triage: top biomarkers + hotspots + coverage gaps + dead-code. Merged into `codegraph_review` 2026-05-14; the standalone `codegraph_risk_review` tool was retired. |
189
199
|`codegraph_digest`| Composite "land in a new repo" overview: hotspots + biomarkers + entry points + recent churn |
190
-
|`codegraph_affected`| Given changed source files, return the test files that transitively depend on them. Reactive post-edit workflow: "which tests should I re-run?". `files` is optional — when omitted, the changed set is derived from `git diff HEAD` (a clean tree returns a friendly "no uncommitted changes" message). |
200
+
|`codegraph_affected`| Given changed source files, return the test files that transitively depend on them. Reactive post-edit workflow: "which tests should I re-run?". `files` is optional — when omitted, the changed set is derived from `git diff HEAD` (a clean tree returns a friendly "no uncommitted changes" message). Explicitly-passed paths absent from the index are rejected with an error + non-zero exit. CLI mirror `codegraph affected` accepts both positional files and a `--files` alias. |
191
201
|`codegraph_sql`| Read-only ad-hoc SQL escape hatch over the codegraph SQLite backend. Use when curated tools don't fit a novel query. Pass `schema: true` first to learn the table layout; combine with `tables: ['nodes', 'edges']` (case-insensitive name filter) and `compact: true` (one-line column lists) to dump just the layout you need without the full 60+ CREATE TABLE blocks. |
192
202
|`codegraph_discover`| Find every `.codegraph/` directory under a parent path. Useful for monorepos. |
193
203
|`codegraph_local_chat`| Delegate bulk-prose subtasks (file summaries, draft prose, paraphrase verification) to the user's configured local LLM — saves Anthropic-token cost. NOT for hard reasoning or user-visible verbatim output. |
Copy file name to clipboardExpand all lines: src/mcp/server-instructions.ts
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -45,11 +45,11 @@ about a second through the file watcher.
45
45
- **Migration note:** \`since\` UIDs minted by the pre-merge \`codegraph_callers\` / \`codegraph_callees\` won't resolve under \`codegraph_graph\` — first call after upgrade falls back to a full result with the standard "call id is no longer cached" warning.
46
46
- **"Show me this symbol's source / signature / docstring."** → \`codegraph_node\` (pass \`symbols: [a, b, c]\` for up to 20 in one call; pass \`code: true\` to include the actual source body; flip \`includeCallers\` / \`includeCallees\` / \`includeBiomarkers\` / \`includeTests\` to fold those tools' answers into the same response — collapses 3-5 round-trips into one for "tell me everything about X". A \`kind:'file'\` node also renders that file's LLM prose summary when one is cached.)
47
47
- **"Which symbols overlap this line range / diff hunk?"** → \`codegraph_at_range({file, startLine, endLine})\` for one hunk; \`codegraph_at_range({ranges: [...]})\` for up to 100 pre-parsed hunks; or \`codegraph_at_range({diff: '<unified diff>'})\` to feed raw \`git diff\` output and let the server parse hunks itself. R*Tree-backed, O(log n), smallest-enclosing first. Pass \`compact: true\` to emit pipe-delimited rows (\`name|kind|path:line|end:N|sig:...\`) instead of the markdown table; add \`fields: ['name', 'kind']\` to restrict columns — saves 50-70% of output tokens on multi-hunk diff overlays. In \`diff:\` mode, a hunk that overlaps no symbol exactly (a tight signature-edit hunk whose context window doesn't reach the definition line) gets one conservative ±8-line retry; rows resolved that way are labelled \`(near hunk — exact overlap was empty)\`.
48
-
- **"Is this function risky to change? Is it complex / nested / large?"** → \`codegraph_biomarkers\` — structured answer instead of reading 200 lines of source. Slice with \`minMetric\` / \`maxMetric\` for "show me only findings at threshold floor" or "only findings above the warning band". Batched form: \`mode: 'symbol', symbols: [...]\` for up to 20 symbols in one call.
48
+
- **"Is this function risky to change? Is it complex / nested / large?"** → \`codegraph_biomarkers\` — structured answer instead of reading 200 lines of source. Slice with \`minMetric\` / \`maxMetric\` for "show me only findings at threshold floor" or "only findings above the warning band". Batched form: \`mode: 'symbol', symbols: [...]\` for up to 20 symbols in one call. In the window right after a full \`index --force\` (biomarker cache cleared, post-hook pass not yet run) the tool returns an explicit "biomarkers pending" state rather than a misleading "0 findings / clean" — retry once the post-sync pass completes.
49
49
- **"Is this function tested? What's covered?"** → \`codegraph_coverage\`. **Onboarding shortcut: \`mode: 'refresh'\`** auto-discovers an lcov report under conventional paths (\`coverage/lcov.info\`, etc.) — no \`reportPath\` needed. For an explicit path use \`mode: 'load', reportPath: 'coverage/lcov.info'\` (project-relative). When \`node_coverage\` is loaded, the \`low_coverage\` biomarker auto-fires on high-centrality undertested symbols — surfaces under \`codegraph_biomarkers\`, \`codegraph_digest\`, and \`codegraph_review({mode: 'risk'})\`.
50
-
- **"What code might be dead / unreachable?"** → \`codegraph_dead_code\` — default \`via: 'auto'\` is graph + LLM judge; \`via: 'rule'\` is graph orphan-finder (no LLM); \`via: 'llm'\` is explicit LLM-judge. Legacy \`mode: 'static' | 'judge'\` still accepted as alias.
51
-
- **"Which tests cover this symbol?"** → \`codegraph_tests_for\` (graph-derived test discovery)
52
-
- **"I just edited these files — which tests should I re-run?"** → \`codegraph_affected({files?})\` (reactive post-edit workflow — omit \`files\` to derive the changed set from \`git diff HEAD\`; a clean tree returns a friendly "no uncommitted changes" message). The rendered row list is capped (with a "showing first N of M" footer); when the dependency traversal passes through a public-API barrel (\`index.ts\` / \`index.mjs\` / …) the blast radius is most of the suite, so the result appends a hint to narrow with \`codegraph_tests_for\` for symbol-level test discovery.
50
+
- **"What code might be dead / unreachable?"** → \`codegraph_dead_code\` — default \`via: 'auto'\` is graph + LLM judge; \`via: 'rule'\` is graph orphan-finder (no LLM); \`via: 'llm'\` is explicit LLM-judge. Legacy \`mode: 'static' | 'judge'\` still accepted as alias. \`verdict: 'all'\` (via=llm) returns every judged candidate regardless of verdict — the catch-all for "show me the full judge output".
51
+
- **"Which tests cover this symbol?"** → \`codegraph_tests_for\` (graph-derived test discovery — pass \`files: [...]\` for files-mode test discovery against a changed file set; files-mode output is capped with a "showing first N" footer)
52
+
- **"I just edited these files — which tests should I re-run?"** → \`codegraph_affected({files?})\` (reactive post-edit workflow — omit \`files\` to derive the changed set from \`git diff HEAD\`; a clean tree returns a friendly "no uncommitted changes" message). Explicitly-passed paths that aren't in the index are rejected with an error + non-zero exit. The rendered row list is capped (with a "showing first N of M" footer); when the dependency traversal passes through a public-API barrel (\`index.ts\` / \`index.mjs\` / …) the blast radius is most of the suite, so the result appends a hint to narrow with \`codegraph_tests_for\` for symbol-level test discovery.
53
53
- **"What's in directory X?"** → \`codegraph_files\` (modes: tree / flat / grouped / summary; \`flat\` folds in the per-file LLM summary on listings ≤80 files)
54
54
- **"Survey an unfamiliar topic / pattern / module."** → \`codegraph_explore\` (heavier; best when budget allows)
55
55
- **"Where do I start?" (new repo)** → \`codegraph_digest\` (composite onboarding overview) or \`codegraph_entry_points\` (five buckets: routes / cli / mcp_tools / cli_files / public_exports — \`mcp_tools\` is sorted alphabetically by canonical \`codegraph_X\` name; \`public_exports\` lists exports with no incoming \`calls\`/\`references\`/type-usage edges; pass \`bucket: 'public_exports', limit: 200\` to page into one section's long tail).
@@ -157,7 +157,7 @@ For low-stakes bulk-prose subtasks (file/function summarization, draft prose, pa
157
157
158
158
## Cross-call agent state (multi-step investigations)
159
159
160
-
\`codegraph_session({action})\` lets you create / resume sessions and save / replay tool macros across calls in the same MCP server. \`codegraph_note({action})\` leaves persistent annotations on symbols (kind: note / question / followup / bookmark). Most useful for long investigations or agent-to-future-agent handoffs.
160
+
\`codegraph_session({action})\` lets you create / resume sessions and save / replay tool macros across calls in the same MCP server. \`codegraph_note({action})\` leaves persistent annotations on symbols (kind: note / question / followup / bookmark). Most useful for long investigations or agent-to-future-agent handoffs. CLI mirror: \`codegraph session <create|resume|list|macro_save|macro_run|macro_list|macro_delete>\`.
0 commit comments