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: 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: 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
@@ -11,7 +11,7 @@ Any time you need to understand structure in an indexed Java codebase: locating
Then use real JSON shapes (see below). If the call fails or returns nothing useful, use the **Recovery playbook** — do not thrash.
@@ -175,6 +175,10 @@ Prefer **`resolve` -> `describe(id=...)`** over **`describe(fqn=...)`** when an
175
175
| Who implements interface T? | type symbol id |`neighbors(ids, "in", ["IMPLEMENTS"])`|
176
176
| Where is T injected | type symbol id |`neighbors(ids, "in", ["INJECTS"])`|
177
177
| Impact / "what breaks if I change X"? | no magic tool | loop `neighbors``in` with `CALLS`, `INJECTS`, ... until bounded |
178
+
| "What happens when route R is called?" |`find(kind="route")` then `trace(route_id, "out", ["EXPOSES","CALLS"], max_depth=4)`|`describe` on key nodes |
179
+
| "Impact of changing method M" |`resolve` / `find` then `trace(id, "in", ["CALLS","OVERRIDES"], max_depth=3)`|`describe` on callers |
180
+
| "Trace from X to database" |`trace(id, "out", ["CALLS"], max_depth=4, prune_roles=["DTO","EXCEPTION"])`|`neighbors` for pruned detail |
181
+
| "What calls this across services?" |`trace(id, "out", ["CALLS","HTTP_CALLS","ASYNC_CALLS"], max_depth=5)`|`trace` on downstream route_id if needed |
178
182
179
183
**Rules of thumb:**
180
184
@@ -210,6 +214,19 @@ Returns **edges** with `attrs` (`confidence`, `strategy`, `match`, ... on cross-
210
214
211
215
**`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.
227
+
- 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).
228
+
- After `trace`, use `neighbors` or `describe` on specific nodes for detail the trace pruned or collapsed.
0 commit comments