Skip to content

Commit a90b307

Browse files
sdsrssclaude
andcommitted
feat(plugin): scenario-keyed MEMORY.md index via auto-adopt (v0.12.0)
INDEX_LINE in adopt.js grows from 3 lines to 9 — adds a scenario→tool table (改 X 影响面 / 谁调用 X / 看 X 源码 / Y 模块长啥样 / 概念查询). Existing adopted projects refresh once on next SessionStart via needsRefresh(); new projects get it from first adopt. Closes the always-loaded context gap: Claude Code knew the 7+5 tool names but not the natural-language triggers, so sessions silently slid to Grep/Read when a code-graph tool would be more precise. See CHANGELOG.md for migration + opt-out details. Verification: adopt.test.js 37/37 pass; cargo +1.95.0 clippy --no-default-features and --all-targets clean with -D warnings; routing_bench 19/20 unchanged (release does not touch ToolRegistry). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent d6f1dc0 commit a90b307

File tree

12 files changed

+60
-16
lines changed

12 files changed

+60
-16
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.6"
8+
"version": "0.12.0"
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.6",
15+
"version": "0.12.0",
1616
"author": {
1717
"name": "sdsrs"
1818
},

CHANGELOG.md

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

3+
## v0.12.0 — Scenario-keyed MEMORY.md index (auto-adopt template refresh)
4+
5+
Auto-adopt (`claude-plugin/scripts/adopt.js`) now seeds MEMORY.md's sentinel
6+
block with a 5-row scenario→tool table in addition to the existing tool-name
7+
list. The always-loaded context gap this closes: Claude Code knew the 7+5 tool
8+
names but not the natural-language triggers ("who calls X?", "改 X 影响面")
9+
that should route to them, so sessions silently slid to `Grep` / `Read` when a
10+
code-graph tool would be more precise. The scenario phrases now live in the
11+
200-line-capped MEMORY.md itself, not a second-hop `plugin_code_graph_mcp.md`.
12+
13+
### What changes
14+
15+
Sentinel `<!-- code-graph-mcp:begin v1 -->...<!-- code-graph-mcp:end -->` grows
16+
from 3 lines to 9. Added block (nested under the existing index entry):
17+
18+
- 场景速查(优先于 Grep):
19+
- 改 X 影响面 → `get_ast_node symbol=X include_impact=true`(或 CLI `code-graph-mcp impact X`)
20+
- 谁调用 X / X 被谁用 → `get_call_graph X` 或 `find_references X`
21+
- 看 X 源码 / 签名 → `get_ast_node symbol=X`
22+
- Y 模块长啥样 → `module_overview` 或 CLI `code-graph-mcp overview Y/`
23+
- 概念查询(不知精确名)→ `semantic_code_search "Z"`;字面匹配用 Grep
24+
25+
### Migration — existing adopted projects
26+
27+
`needsRefresh()` detects INDEX_LINE drift automatically; the sentinel block
28+
rewrites once on next SessionStart. No user action required.
29+
30+
### Opt-out
31+
32+
- Lock current MEMORY.md block against this refresh: `CODE_GRAPH_NO_TEMPLATE_REFRESH=1` (shipped in v0.11.0)
33+
- Disable auto-adopt entirely for new projects: `CODE_GRAPH_NO_AUTO_ADOPT=1` (shipped in v0.9.0)
34+
- Downgrade: reinstall `0.11.6` to restore the 3-line INDEX_LINE
35+
36+
### Verification
37+
38+
- `adopt.test.js`: 37/37 green — tests reference the `INDEX_LINE` constant, so the content extension is transparent.
39+
- `routing_bench`: 19/20 = 95.0% on `anthropic/claude-sonnet-4.5` via OpenRouter — unchanged from v0.11.6. This release doesn't touch `ToolRegistry` descriptions, which is what the bench measures; the adopted MEMORY.md lives outside the oracle's prompt.
40+
341
## v0.11.6 — Tool-description tightening (+5% routing P@1) + OpenRouter backend
442

543
First run of the routing-recall benchmark landed v0.11.4 at **P@1 = 18/20 = 90.0%**

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.6"
3+
version = "0.12.0"
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.6",
7+
"version": "0.12.0",
88
"keywords": [
99
"code-graph",
1010
"ast",

claude-plugin/scripts/adopt.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ const INDEX_LINE = [
1313
'- [code-graph-mcp](plugin_code_graph_mcp.md) — v0.10.0 起 tools/list 默认 7 核心 + 5 隐藏可调(省启动 token)',
1414
' - 核心 7(默认暴露):`get_call_graph`/`module_overview`/`semantic_code_search`/`ast_search`/`find_references`/`get_ast_node`/`project_map`',
1515
' - 进阶 5(隐藏按名可调):`impact_analysis`/`trace_http_chain`/`dependency_graph`/`find_similar_code`/`find_dead_code`',
16+
' - 场景速查(优先于 Grep):',
17+
' - 改 X 影响面 → `get_ast_node symbol=X include_impact=true`(或 CLI `code-graph-mcp impact X`)',
18+
' - 谁调用 X / X 被谁用 → `get_call_graph X` 或 `find_references X`',
19+
' - 看 X 源码 / 签名 → `get_ast_node symbol=X`',
20+
' - Y 模块长啥样 → `module_overview` 或 CLI `code-graph-mcp overview Y/`',
21+
' - 概念查询(不知精确名)→ `semantic_code_search "Z"`;字面匹配用 Grep',
1622
].join('\n');
1723
const TEMPLATE_PATH = path.resolve(__dirname, '..', 'templates', 'plugin_code_graph_mcp.md');
1824
const TARGET_NAME = 'plugin_code_graph_mcp.md';

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.6",
3+
"version": "0.12.0",
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.6",
3+
"version": "0.12.0",
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.6",
3+
"version": "0.12.0",
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.6",
3+
"version": "0.12.0",
44
"description": "code-graph-mcp binary for Linux x64",
55
"license": "MIT",
66
"repository": {

0 commit comments

Comments
 (0)