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
* update docs for trace tool (PR-TRACE-4)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* update skills/ for six-tool trace surface
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
variables, full `.java-codebase-rag.yml` reference, **graph layer**
@@ -56,7 +56,7 @@ when needed.
56
56
-`docs/CODEBASE_REQUIREMENTS.md` — Java-repo assumptions and per-file map of
57
57
what to edit when a target tree doesn't match defaults.
58
58
-`tests/README.md` — testing philosophy.
59
-
-**`skills/explore-codebase/`** — user-facing skill shipped to java-codebase-rag consumers. Single self-contained operating manual for the 5-tool MCP. Developer workflow skills live in **`.agents/skills/`**, not here.
59
+
-**`skills/explore-codebase/`** — user-facing skill shipped to java-codebase-rag consumers. Single self-contained operating manual for the 6-tool MCP. Developer workflow skills live in **`.agents/skills/`**, not here.
60
60
-**`agents/java-codebase-rag-explorer.md`** — user-facing Claude Code subagent shipped to consumers. Contains the same MCP guide content as `docs/AGENT-GUIDE.md` (the single source of truth).
61
61
-**`propose/`** — design proposes. **In-flight** proposes live in
62
62
**`propose/active/`**. **`propose/completed/`** — landed work and rationale.
@@ -81,6 +81,7 @@ when needed.
81
81
|`java_ontology.py`| Source of truth for `VALID_ROLES`, `VALID_CAPABILITIES`, `VALID_CLIENT_KINDS`, `VALID_HTTP_CALL_STRATEGIES`, `VALID_ASYNC_CALL_STRATEGIES`, `VALID_HTTP_CALL_MATCHES`. |
82
82
|`chunk_heuristics.py`| Query-time chunk hints (no AST / no re-index). |
Copy file name to clipboardExpand all lines: README.md
+6-5Lines changed: 6 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
A graph-native code intelligence layer for Java microservice estates, exposed to LLM agents via the **Model Context Protocol (MCP)**.
4
4
5
-
The system extracts a deterministic property graph from Java source (tree-sitter), stores it in **Kuzu** (graph) alongside a **LanceDB** vector index (chunks), and exposes a deliberately small MCP surface — **five tools**: `search`, `find`, `describe`, `neighbors`, `resolve` — that collapse onto three primitive agent operations: **locate**, **inspect**, **walk**.
5
+
The system extracts a deterministic property graph from Java source (tree-sitter), stores it in **Kuzu** (graph) alongside a **LanceDB** vector index (chunks), and exposes a deliberately small MCP surface — **six tools**: `search`, `find`, `describe`, `neighbors`, `resolve`, `trace` — that collapse onto three primitive agent operations: **locate**, **inspect**, **walk**.
6
6
7
7
> **What this MCP is:** a **GPS for code navigation**, not a reasoning engine.
If vector hits come back and graph expansion adds neighbor symbols, the install works end-to-end. Wire it into your agent next — the five MCP tools (`search`, `find`, `describe`, `neighbors`, `resolve`) are reachable over stdio.
81
+
If vector hits come back and graph expansion adds neighbor symbols, the install works end-to-end. Wire it into your agent next — the six MCP tools (`search`, `find`, `describe`, `neighbors`, `resolve`, `trace`) are reachable over stdio.
82
82
83
83
---
84
84
@@ -118,15 +118,15 @@ See [`mcp.json.example`](./mcp.json.example) for the same shape in `.mcp.json` (
118
118
119
119
Pick **one** of two options (not both — they cover the same navigation intents):
120
120
121
-
1.**[`docs/AGENT-GUIDE.md`](./docs/AGENT-GUIDE.md)** (recommended for most) — standalone MCP operating manual. Copy-paste the `BEGIN`/`END` block into your project's `QWEN.md`, `CLAUDE.md`, or `AGENTS.md`. Contains: five-tool reference, `NodeFilter` / edge taxonomy, ontology glossary, recovery playbook, and navigation patterns. Self-contained — no external file dependencies.
121
+
1.**[`docs/AGENT-GUIDE.md`](./docs/AGENT-GUIDE.md)** (recommended for most) — standalone MCP operating manual. Copy-paste the `BEGIN`/`END` block into your project's `QWEN.md`, `CLAUDE.md`, or `AGENTS.md`. Contains: six-tool reference, `NodeFilter` / edge taxonomy, ontology glossary, recovery playbook, and navigation patterns. Self-contained — no external file dependencies.
122
122
123
123
2.**[`/explore-codebase`](./skills/explore-codebase/SKILL.md)** (for hosts with skill discovery) — single self-contained skill with the complete operating manual. If your MCP host supports skill discovery (Claude Code, Qwen Code, Cursor), load `/explore-codebase` to get the full tool reference, edge taxonomy, decision tree, and recovery playbook in one shot.
124
124
125
125
Also: **[`docs/MANUAL-VERIFICATION-CHECKLIST.md`](./docs/MANUAL-VERIFICATION-CHECKLIST.md)** — 7-phase agent-driven verification you run after indexing your real project.
|`neighbors`| Graph walk, one hop. |`ids`, `direction`, `edge_types`|
138
+
|`trace`| Multi-hop BFS traversal with pruning. |`ids`, `direction`, `edge_types`|
138
139
139
140
Full schemas, `NodeFilter` / `EdgeFilter` semantics, and the hints contract live in [`docs/AGENT-GUIDE.md`](./docs/AGENT-GUIDE.md). Edge types and traversal directions are listed in [`docs/EDGE-NAVIGATION.md`](./docs/EDGE-NAVIGATION.md).
140
141
141
142
### Three-layer architecture
142
143
143
-
Layer 1 (storage) → Layer 2 (5 MCP tools) → Layer 3 (skill). The [`/explore-codebase`](./skills/explore-codebase/SKILL.md) skill provides the full operating manual for Layer 2. See the [architecture diagram in `skills/README.md`](./skills/README.md#three-layer-architecture).
144
+
Layer 1 (storage) → Layer 2 (6 MCP tools) → Layer 3 (skill). The [`/explore-codebase`](./skills/explore-codebase/SKILL.md) skill provides the full operating manual for Layer 2. See the [architecture diagram in `skills/README.md`](./skills/README.md#three-layer-architecture).
Copy file name to clipboardExpand all lines: docs/AGENT-GUIDE.md
+21-10Lines changed: 21 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,22 +1,22 @@
1
1
# Agent Guide — `java-codebase-rag` MCP
2
2
3
-
Copy the block between `<!-- BEGIN` and `<!-- END` into your project's `AGENTS.md`, `CLAUDE.md`, or equivalent. It is self-contained: five MCP tools, shared `NodeFilter`, edge taxonomy, tool-selection rules, and recovery moves.
3
+
Copy the block between `<!-- BEGIN` and `<!-- END` into your project's `AGENTS.md`, `CLAUDE.md`, or equivalent. It is self-contained: six MCP tools, shared `NodeFilter`, edge taxonomy, tool-selection rules, and recovery moves.
**Indexed content:** Java production sources plus SQL and YAML (use `search``table`: `java`, `sql`, `yaml`, or `all`).
16
16
17
17
**Ontology: 16** — if results look structurally wrong or empty across tools, the index may be missing, stale, or built with a different `ontology_version`; you cannot re-index via MCP — ask the operator to rebuild.
18
18
19
-
**Responses:** On success, `search`, `find`, `describe`, `neighbors`, and `resolve` may include two top-level fields: `hints_structured` (≤5 suggested next-tool calls) and `advisories` (≤5 pure informational strings). Each `hints_structured` entry has `tool`, `args`, `actionable`, `label`, and `reason`. `actionable=true` means you can call the tool directly with `args`; `actionable=false` means partial/advisory — fill missing values or use as guidance. `reason` explains why the hint was emitted. `advisories` carry context education (fuzzy strategy warnings, role collision explanations, etc.) with no tool call suggestion. For `search`/`find`, echoed `limit`/`offset`. Hints are advisory; ignore them when `success` is false.
19
+
**Responses:** On success, `search`, `find`, `describe`, `neighbors`, `resolve`, and `trace` may include two top-level fields: `hints_structured` (≤5 suggested next-tool calls) and `advisories` (≤5 pure informational strings). Each `hints_structured` entry has `tool`, `args`, `actionable`, `label`, and `reason`. `actionable=true` means you can call the tool directly with `args`; `actionable=false` means partial/advisory — fill missing values or use as guidance. `reason` explains why the hint was emitted. `advisories` carry context education (fuzzy strategy warnings, role collision explanations, etc.) with no tool call suggestion. For `search`/`find`, echoed `limit`/`offset`. Hints are advisory; ignore them when `success` is false.
20
20
21
21
**Use this MCP when** you need whole-codebase structure: callers/callees, route handlers, HTTP/async seams, clients/producers, or fuzzy entry points for a concept.
22
22
@@ -35,15 +35,15 @@ When MCP disagrees with the open file, **the file wins**; treat the mismatch as
35
35
36
36
1.**Locate** — `resolve` for identifier-shaped strings; `search` for natural language or code fragments; `find` for structured `NodeFilter` discovery.
37
37
2.**Inspect** — `describe(id)` for the full record and `edge_summary` (per-label `in`/`out` counts).
38
-
3.**Walk** — `neighbors` in a loop with explicit **`direction`** and **`edge_types`**. Multi-hop traces are **your** reasoning, not a separate tool.
38
+
3.**Walk** — `neighbors` in a loop with explicit **`direction`** and **`edge_types`**, or `trace` for multi-hop BFS with server-side pruning in one call.
Then use real JSON shapes (see below). If the call fails or returns nothing useful, use the **Recovery playbook** — do not thrash.
@@ -178,7 +178,7 @@ Prefer **`resolve` → `describe(id=…)`** over **`describe(fqn=…)`** when an
178
178
| Handler for route | route id |`neighbors(ids, "in", ["EXPOSES"])`|
179
179
| Who implements interface T? | type symbol id |`neighbors(ids, "in", ["IMPLEMENTS"])`|
180
180
| Who injects type T? | type symbol id |`neighbors(ids, "in", ["INJECTS"])`|
181
-
| Impact / "what breaks if I change X"? |no magic tool |loop `neighbors``in` with `CALLS`, `INJECTS`, … until bounded|
181
+
| Impact / "what breaks if I change X"? |`trace` or `neighbors` loop |`trace(id, "in", ["CALLS","OVERRIDES"], max_depth=3)` or loop `neighbors``in` with `CALLS`, `INJECTS`|
182
182
183
183
**Rules of thumb:**
184
184
@@ -188,6 +188,14 @@ Prefer **`resolve` → `describe(id=…)`** over **`describe(fqn=…)`** when an
188
188
189
189
### Tool reference
190
190
191
+
#### `trace`
192
+
193
+
Multi-hop BFS traversal with server-side pruning. Returns structured paths, a node dict, and traversal stats. Use when the question implies a path or chain (3+ hops), needs to cross a service boundary, or a `neighbors` loop has exceeded 2 hops without converging. Args: `ids` (string or array), **`direction`**, **`edge_types`** (stored labels only — no composed dot-keys), `max_depth` (1–5, default 3), `max_paths` (default 20), `max_nodes_discovered` (100–2000, default 500), `filter` (hard gate `NodeFilter`), `edge_filter` (CALLS edge attribute filtering), `prune_roles` (soft gate — edges recorded, frontier stops), `fan_out_cap` (per-node edge limit, default 5), `collapse_trivial` (collapse wrapper chains, default true), `include_unresolved` (interleave unresolved call sites).
194
+
195
+
Returns `TraceOutput` with `nodes` (dict of `NodeRef`), `edges` (list of `TraceEdge` with `hop`, `parent_edge_id`, `collapsed`, `cross_service_boundary`), `paths` (ranked root-to-leaf), and `stats` (budget, pruning counts). Cross-service edges (`HTTP_CALLS`, `ASYNC_CALLS`) are boundary signals — BFS stops at the service boundary and includes the downstream node for the agent to continue with a separate `trace` call.
196
+
197
+
**`trace` vs `neighbors`:** Use `neighbors` for single-hop adjacency (full unfiltered result). Use `trace` for multi-hop path questions, impact analysis, or when `neighbors` returns high fan-out (>8 CALLS edges).
Copy file name to clipboardExpand all lines: propose/completed/TRACE-TOOL-PROPOSE.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# TRACE-TOOL -- Multi-hop navigation shortcut
2
2
3
-
**Status**: active (experimental)
3
+
**Status**: completed (merged to `experimental` as PR-TRACE-1a through PR-TRACE-4)
4
4
**Target branch**: `experimental` — not `master`. `trace` is an experiment; it ships on a dedicated branch and is not merged to `master` until validated in production.
Copy file name to clipboardExpand all lines: skills/README.md
+2-2Lines changed: 2 additions & 2 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
# skills/ — RAG navigation skill for the java-codebase-rag MCP
2
2
3
-
One self-contained skill for navigating indexed Java codebases via the 5-tool MCP (`search` / `find` / `describe` / `neighbors` / `resolve`). Skills are agent-side prompt scaffolding — they are **not** a second MCP API and **not** CLI subcommands.
3
+
One self-contained skill for navigating indexed Java codebases via the 6-tool MCP (`search` / `find` / `describe` / `neighbors` / `resolve` / `trace`). Skills are agent-side prompt scaffolding — they are **not** a second MCP API and **not** CLI subcommands.
4
4
5
5
## Layout
6
6
@@ -14,7 +14,7 @@ skills/
14
14
15
15
The comprehensive operating manual. Includes:
16
16
17
-
-**Five-tool reference** — `search`, `find`, `describe`, `neighbors`, `resolve` with full argument shapes
17
+
-**Six-tool reference** — `search`, `find`, `describe`, `neighbors`, `resolve`, `trace` with full argument shapes
18
18
-**Node kinds** — Symbol, Route, Client, Producer
19
19
-**Edge taxonomy** — stored edges, composed dot-keys, direction semantics
20
20
-**NodeFilter reference** — all filter keys by node kind, strict frame rules
0 commit comments