Skip to content

Commit 3d0cef6

Browse files
sdsrssclaude
andcommitted
feat(mcp): ast_search hint + acronym expansion + call graph rollup (v0.11.4)
Integration-test pass against Claude Code surfaced three friction points that forced a second round-trip or missed relevant nodes. All three fixed. Additive — no schema change, no re-index. 1. ast_search generic fallback (tools.rs:1773-1826 + helpers.rs:82-102): zero-result queries with returns=Vec<T> now return {hint, suggested_query} pointing at the stripped inner type (Vec<Relation> → Relation, 7 matches). 2. FTS acronym expansion (search/acronyms.rs + queries.rs:1650-1666): RRF/BM25/FTS/AST/LSP/MCP/RPC/SQL/ORM/CTE/JWT/TTL/DAG/RBAC/CRUD/CORS expanded to full-form terms alongside original. Benchmark on "RRF fusion BM25": weighted_rrf_fusion rank 3 (previously absent top-5). 3. semantic_search acronym-heavy FTS bias (tools.rs:87-101): queries entirely of short UC tokens (≤3 tokens, ≤5 chars, [A-Z0-9]) run with fts_weight=2.0, vec_weight=0.8 to let FTS5 token-exact match dominate where embeddings struggle. 4. get_call_graph rollup (tools.rs:426-519): dense graphs group by (file, direction), emit {count, names[], node_ids[], min/max_depth} sorted by count desc. Contract Δ: mode "compressed_call_graph" → "rollup_call_graph". Measured on ensure_indexed: 86 flat → 2 caller + 5 callee rollups. node_ids preserved for get_ast_node drill-down. Tests: 230 lib + 44 integration + 8 new unit (strip_outer_generic ×4, expand_acronym ×4) — all green. cargo clippy -D warnings clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent af58f71 commit 3d0cef6

File tree

16 files changed

+345
-25
lines changed

16 files changed

+345
-25
lines changed

.claude-plugin/marketplace.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
},
66
"metadata": {
77
"description": "AST knowledge graph plugin for Claude Code — semantic search, call graph, HTTP tracing, impact analysis",
8-
"version": "0.11.3"
8+
"version": "0.11.4"
99
},
1010
"plugins": [
1111
{
1212
"name": "code-graph-mcp",
1313
"source": "./claude-plugin",
1414
"description": "AST knowledge graph for intelligent code navigation — auto-indexes your codebase and provides semantic search, call graph traversal, HTTP route tracing, and impact analysis via MCP tools",
15-
"version": "0.11.3",
15+
"version": "0.11.4",
1616
"author": {
1717
"name": "sdsrs"
1818
},

CHANGELOG.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,63 @@
11
# Changelog
22

3+
## v0.11.4 — Integration-friction fixes: ast_search hint + acronym expansion + call graph rollup
4+
5+
Integration-test pass against Claude Code found three specific friction points
6+
where tool responses forced a second round-trip or missed relevant nodes.
7+
All three fixed. Additive — no schema change, no re-index.
8+
9+
### Fixes
10+
11+
1. **`ast_search` generic-fallback hint.** When `returns="Vec<Relation>"` yields
12+
zero hits because the codebase uses `Vec<ParsedRelation>`, the response now
13+
carries `hint` + `suggested_query` instead of a bare `count: 0`. Example:
14+
`{ "count": 0, "hint": "No match for returns='Vec<Relation>'. Substring
15+
'Relation' has 7 matches — try that.", "suggested_query": {"returns":
16+
"Relation", "type": "fn"} }`. Strip rule: innermost `<…>` wins; multi-param
17+
types take the last comma-separated param. See
18+
`src/mcp/server/helpers.rs::strip_outer_generic`.
19+
20+
2. **Acronym query expansion.** `fts5_search` preprocessing now expands
21+
common CS/IR/DB acronyms into full-form terms alongside the original:
22+
`RRF``RRF` + `reciprocal` + `rank` + `fusion`; same for `BM25`, `FTS`,
23+
`AST`, `LSP`, `MCP`, `RPC`, `SQL`, `ORM`, `CTE`, `JWT`, `TTL`, `DAG`,
24+
`RBAC`, `CRUD`, `CORS`. Benchmark before/after on query `"RRF fusion BM25"`:
25+
`weighted_rrf_fusion` now appears at rank 3 (previously absent from top-5).
26+
New static dict in `src/search/acronyms.rs`; expansions deduped via the
27+
existing BTreeSet pass.
28+
29+
3. **`semantic_code_search` acronym-heavy FTS bias.** Queries that are entirely
30+
short uppercase tokens (≤3 tokens, each ≤5 chars, all `[A-Z0-9]`) now run
31+
with `fts_weight=2.0, vec_weight=0.8` instead of the default `1.0/1.2`.
32+
Rationale: embeddings handle letter-exact acronyms poorly while FTS5's
33+
token-exact match is reliable; shift the weight toward the precise channel.
34+
35+
4. **`get_call_graph` file-level rollup replaces `compressed_call_graph`.**
36+
When the flat node list exceeds `COMPRESSION_TOKEN_THRESHOLD` (previously
37+
this mode dumped the raw list anyway), group by `(file_path, direction)`
38+
and emit `{file, count, names[], node_ids[], min_depth, max_depth}` sorted
39+
by count desc. New mode string `"rollup_call_graph"`. Measured on
40+
`ensure_indexed` (86 nodes): previously 86 flat entries → now 2 caller
41+
rollups + 5 callee rollups, preserving `node_ids` for `get_ast_node`
42+
drill-down. Contract Δ: consumers matching on
43+
`mode == "compressed_call_graph"` must update to `"rollup_call_graph"`.
44+
45+
### Tests
46+
47+
- `strip_outer_generic` unit tests (4/4) cover `Vec<T>`, nested generics,
48+
multi-param (`Result<T, E>`), and no-bracket cases.
49+
- `acronyms::expand_acronym` unit tests (4/4) cover case-insensitivity,
50+
unknown tokens, `BM25` numeric acronym, and an FTS-length-filter guardrail.
51+
- 230 lib tests + 44 integration tests all green.
52+
53+
### Internal
54+
55+
New module `src/search/acronyms.rs`. `strip_outer_generic` in
56+
`src/mcp/server/helpers.rs`. All other edits localized to `tool_ast_search`,
57+
`tool_semantic_search`, and `format_call_graph_response` in
58+
`src/mcp/server/tools.rs`, plus one flat_map augmentation in
59+
`storage::queries::fts5_search_impl`.
60+
361
## v0.11.3 — Doc: "hidden but callable" clarified (Claude Code vs. raw MCP)
462

563
User-facing: no behavior change; corrects a misleading claim in the adopted

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "code-graph-mcp"
3-
version = "0.11.3"
3+
version = "0.11.4"
44
edition = "2021"
55

66
[features]

claude-plugin/.claude-plugin/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"author": {
55
"name": "sdsrs"
66
},
7-
"version": "0.11.3",
7+
"version": "0.11.4",
88
"keywords": [
99
"code-graph",
1010
"ast",

npm/darwin-arm64/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sdsrs/code-graph-darwin-arm64",
3-
"version": "0.11.3",
3+
"version": "0.11.4",
44
"description": "code-graph-mcp binary for macOS ARM64",
55
"license": "MIT",
66
"repository": {

npm/darwin-x64/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sdsrs/code-graph-darwin-x64",
3-
"version": "0.11.3",
3+
"version": "0.11.4",
44
"description": "code-graph-mcp binary for macOS x64",
55
"license": "MIT",
66
"repository": {

npm/linux-arm64/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sdsrs/code-graph-linux-arm64",
3-
"version": "0.11.3",
3+
"version": "0.11.4",
44
"description": "code-graph-mcp binary for Linux ARM64",
55
"license": "MIT",
66
"repository": {

npm/linux-x64/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sdsrs/code-graph-linux-x64",
3-
"version": "0.11.3",
3+
"version": "0.11.4",
44
"description": "code-graph-mcp binary for Linux x64",
55
"license": "MIT",
66
"repository": {

npm/win32-x64/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sdsrs/code-graph-win32-x64",
3-
"version": "0.11.3",
3+
"version": "0.11.4",
44
"description": "code-graph-mcp binary for Windows x64",
55
"license": "MIT",
66
"repository": {

0 commit comments

Comments
 (0)