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
add trace hints and skill integration (PR-TRACE-3) (#248)
* add trace hints and skill integration (PR-TRACE-3)
- Extend generate_hints with output_kind="trace" and four hint templates
(budget hit, pruned drilldown, cross-service boundary, high fanout trace)
- Add trace recommendation to neighbors/describe high-fanout hints
- Update SKILL.md preamble, decision tree, and tool reference with trace
- Add "trace" to StructuredHint.tool Literal in mcp_v2.py
- Add 5 new tests (4 hint unit tests + 1 integration test)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* address PR-TRACE-3 review feedback
- Extract _high_fanout_trace_hint() helper (review point 1)
- Use user's prune_roles in budget-hit hint if supplied (point 2)
- Include from_id in cross-service hint reason (point 3)
- Split stats guard so cross-service hints work without stats (point 4)
- Add clarifying comment for fan_out_cap=0 in integration test (point 5)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: skills/explore-codebase/SKILL.md
+22-5Lines changed: 22 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
name: explore-codebase
3
-
description: "MUST BE USED PROACTIVELY. Complete operating manual for the java-codebase-rag MCP tools (search, find, describe, neighbors, resolve). Use this skill whenever you need to explore a Java codebase — locate symbols, trace call chains, find routes, walk cross-service boundaries, or answer any \"where is X\", \"who calls Y\", \"what does Z depend on\" question. Self-contained: includes edge taxonomy, NodeFilter reference, decision tree, argument shapes, recovery playbook, and navigation patterns. No external files needed."
3
+
description: "MUST BE USED PROACTIVELY. Complete operating manual for the java-codebase-rag MCP tools (search, find, describe, neighbors, trace, resolve). Use this skill whenever you need to explore a Java codebase — locate symbols, trace call chains, find routes, walk cross-service boundaries, or answer any \"where is X\", \"who calls Y\", \"what does Z depend on\" question. Self-contained: includes edge taxonomy, NodeFilter reference, decision tree, argument shapes, recovery playbook, and navigation patterns. No external files needed."
4
4
---
5
5
6
6
# /explore-codebase — Codebase navigation via the java-codebase-rag MCP
@@ -36,15 +36,15 @@ When MCP disagrees with the open file, **the file wins**; treat the mismatch as
36
36
37
37
1.**Locate** — `resolve` for identifier-shaped strings; `search` for natural language or code fragments; `find` for structured `NodeFilter` discovery.
38
38
2.**Inspect** — `describe(id)` for the full record and `edge_summary` (per-label `in`/`out` counts).
39
-
3.**Walk** — `neighbors`in a loop with explicit **`direction`** and **`edge_types`**. Multi-hop traces are **your** reasoning, not a separate tool.
39
+
3.**Walk** — `neighbors`for single-hop adjacency; `trace` for multi-hop BFS with pruning (fan-out control, role-based pruning, cross-service boundaries).
Then use real JSON shapes (see below). If the call fails or returns nothing useful, use the **Recovery playbook** — do not thrash.
@@ -178,8 +178,12 @@ Prefer **`resolve` → `describe(id=…)`** over **`describe(fqn=…)`** when an
178
178
| Who hits this route? | route id |`neighbors(ids, "in", ["HTTP_CALLS","ASYNC_CALLS","EXPOSES"])`|
179
179
| Handler for route | route id |`neighbors(ids, "in", ["EXPOSES"])`|
180
180
| Who implements interface T? | type symbol id |`neighbors(ids, "in", ["IMPLEMENTS"])`|
181
-
|Who injects type T?| type symbol id |`neighbors(ids, "in", ["INJECTS"])`|
181
+
|Where is T injected| type symbol id |`neighbors(ids, "in", ["INJECTS"])`|
182
182
| Impact / "what breaks if I change X"? | no magic tool | loop `neighbors``in` with `CALLS`, `INJECTS`, … until bounded |
183
+
| "What happens when route R is called?" |`find(kind="route")` then `trace(route_id, "out", ["EXPOSES","CALLS"], max_depth=4)`|`describe` on key nodes |
184
+
| "Impact of changing method M" |`resolve` / `find` then `trace(id, "in", ["CALLS","OVERRIDES"], max_depth=3)`|`describe` on callers |
185
+
| "Trace from X to database" |`trace(id, "out", ["CALLS"], max_depth=4, prune_roles=["DTO","EXCEPTION"])`|`neighbors` for pruned detail |
186
+
| "What calls this across services?" |`trace(id, "out", ["CALLS","HTTP_CALLS","ASYNC_CALLS"], max_depth=5)`|`trace` on downstream route_id if needed |
183
187
184
188
**Rules of thumb:**
185
189
@@ -223,6 +227,19 @@ Returns **edges** with `attrs` (`confidence`, `strategy`, `match`, … on cross-
223
227
224
228
**`CALLS` edges:** source-ordered (`call_site_line`, `call_site_byte`). `attrs.resolved=false` means the callee is external (JDK/Spring) — not a missing symbol. **`include_unresolved=True`** (CALLS + `direction=out` only) interleaves unresolved call sites with resolved `CALLS` (`row_kind` discriminator); **mutually exclusive with `edge_filter`**. **`dedup_calls=True`** collapses identical `(origin, callee)` pairs to one row with `call_site_lines`. Optional **`edge_filter`** projects before pagination: `min_confidence`; `include_strategies` / `exclude_strategies` (mutually exclusive); `callee_declaring_role`, `callee_declaring_roles`, `exclude_callee_declaring_roles` (`["OTHER"]` also drops known-external rows). **Note:**`filter.role` filters the neighbor node, not the callee's declaring type — use `edge_filter.callee_declaring_role` for callee stereotype filtering.
- Use `neighbors` for single-hop adjacency where you want the full unfiltered result.
240
+
- Use `trace` for multi-hop path questions (3+ hops), impact analysis, cross-service boundary discovery, or when `neighbors` returns high fan-out (>8 CALLS edges).
241
+
- After `trace`, use `neighbors` or `describe` on specific nodes for detail the trace pruned or collapsed.
0 commit comments