Reframe
LITERAL: "$ARGUMENTS"
Definitions
- LITERAL — what the user typed
- INTENT — what they mean, given SESSION_CONTEXT
- SESSION_CONTEXT — recent work; held by you, not by the index
- BRIDGE — your job: LITERAL + SESSION_CONTEXT → INTENT → query
Rules
- Search INTENT, not LITERAL.
- Context disambiguates → NARROW.
- Context insufficient → BROAD. Vague beats confidently-wrong-narrow.
Transforms (LITERAL → INTENT)
- VAGUE → specify ("that parsing thing" → "language parser implementation")
- QUESTION → keywords ("how does parsing work?" → "parsing implementation process")
- CONVERSATIONAL → technical ("stuff that handles languages" → "language handler processor")
- BROAD → contextualize ("errors" → "error handling exception management")
- CONTEXTUAL → reconstruct ("the logging" → "prompt eval logging", when SESSION_CONTEXT = prompt eval work)
OptimizedQuery: {written against INTENT}
Loop
Definitions
SEARCH — codanna mcp semantic_search_with_context query:"<q>" limit:5
INSPECT — read source at a LOCATION (Read tool or sed -n 'A,Bp' file)
TRAVERSE — codanna retrieve describe <name|symbol_id:N> on a RELATIONSHIP
REFINE — return to SEARCH with a new OptimizedQuery
RESULT — one hit from SEARCH; carries SCORE, signature, doc, LOCATION, RELATIONSHIPS
SCORE — relevance ∈ [0,1]; focus on SCORE > 0.6
LOCATION — file_path:start_line-end_line
RELATIONSHIPS — calls, called_by, implements, defines
Default flow
- SEARCH(OptimizedQuery)
- For each RESULT with SCORE > 0.6:
- INSPECT if signature/doc is insufficient
- TRAVERSE 1–2 RELATIONSHIPS that look load-bearing
- Picture incomplete → REFINE with what you learned
- INTENT answered → stop
INSPECT mechanics
LOCATION src/io/exit_code.rs:108-120 →
- Read tool:
file_path=<env.cwd>/src/io/exit_code.rs, offset=108, limit=13
- limit formula:
end_line - start_line + 1
- sed (Unix only):
sed -n '108,120p' src/io/exit_code.rs
TRAVERSE heuristics
- RELATIONSHIPS appearing across multiple RESULTs are load-bearing — follow first
- 1–2 per RESULT is usually enough
- Prefer
symbol_id:N over name when shown — avoids ambiguity
Mode
This skill is EXPLORE, not ACT.
- EXPLORE: build understanding, surface patterns, identify integration points
- ACT: modify code, refactor, implement
INTENT answered → present findings → await user direction.
Do not transition to ACT inside this skill.
Graph
EXPLORE-legal: derives a read-only view, does not modify source.
When TRAVERSE reveals dense, multi-directional RELATIONSHIPS, visualize. All
pages share the design tokens with the sibling graph skill: dark by default,
light/dark toggle top-right, --light opens light.
# codanna >= 0.14 (has `codanna dump`): one index read, then the neighborhood in memory
node ${CLAUDE_SKILL_DIR}/visualize-dump.js <symbol_id:ID | name> [depth]
# older binaries: one `retrieve describe` per node (3D force view only)
node ${CLAUDE_SKILL_DIR}/visualize-graph.js <symbol_id:ID> [depth]
- Default view: a 2D layered call DAG -- callers above, callees below, labels at
rest, deterministic; hover a name to light incoming (accent) / outgoing (red)
edges; dashed edges are cycle edges; click a node to open its file
--3d keeps the 3D force view (the 5-second gestalt of a tangled
neighbourhood; --layout force|td|lr|radialout implies it); --all renders
the whole index and is always 3D (--bake / --no-bake control the
server-side pinned layout, on by default above 2000 nodes)
- Flags: depth default 2 (positional),
--cap N per-level cap (default 5, 0 =
none), --from graph.jsonl reuses a saved dump, --binary PATH, --no-open,
--relation calls|defines|uses|implements|extends filters --all,
--self-contained inlines the 3D vendor libs (the DAG page always is)
- Output:
.codanna/visualizations/graph-{name}-{timestamp}.html
Structure and flow over the same dump:
# structure: collapsible left-to-right tree (drill-down); --radial for the poster IMAGE
node ${CLAUDE_SKILL_DIR}/visualize-tree.js [--root crate::indexing] [--depth N] [--kinds Function,Method,...] [--radial]
# dependencies on the structure: hierarchical edge bundling (Calls by default)
node ${CLAUDE_SKILL_DIR}/visualize-bundle.js [--root crate::indexing] [--depth N] [--relation calls|uses|implements|extends]
- Pick by question: "what depends on this symbol / what breaks if I change it"
->
visualize-dump.js (call DAG); "how is this module organized / let me
explore" -> visualize-tree.js (expand/collapse like a file explorer -- the
NAVIGATION surface for structure); "which modules call which, inside one
scope, on a printable page" -> visualize-bundle.js --depth N (arcs
aggregate to collapsed leaves, width ~ log count; hover: callers blue,
callees red)
--radial is a POSTER, not a navigation surface: one all-at-once image of a
scope's containment shape for docs, slides, and side-by-side scope
comparison. Without an explicit --depth it auto-collapses deep levels into
counted ancestors (<= ~1200 rendered leaves). Never reach for it when the
user wants to explore -- that is the collapsible tree's job
- Every 2D view opens the same detail panel on click (signature, kind chips,
file:span, relation groups with go-navigation where the view supports it);
opening the source is the explicit Open-file action inside the panel, never
the click itself -- file:// opens in the browser, not the editor
- "what is the shape of the WHOLE codebase -- module shares, hubs, which
modules talk, history over time" -> the sibling
graph skill
(node ${CLAUDE_SKILL_DIR}/../graph/graph.mjs): the disc is the living
whole-map these views zoom into. The division: the disc owns
whole-codebase RELATIONSHIP shape (edge webs, hubs, git-date timeline);
x-ray owns scoped CONTAINMENT structure and single-symbol neighbourhoods.
When both could answer, prefer the disc for whole-codebase questions and
x-ray for scoped ones -- never render both for one question
--depth collapses deeper levels into counted labels; --root scopes to a
module prefix (edges crossing the root are dropped and counted); symbols
without a module path hang off their file path; Field/Variable/Parameter out
by default (--kinds to include)
- Shared pieces:
graph/dump.js (dump reader), graph/hierarchy.js (tree
builder + symbol-to-leaf map), the renderers under graph/, and
graph/theme.js + graph/tokens.mjs (design tokens; node >= 22.12)
Suggest when
- RESULT has 3+ RELATIONSHIPS in multiple directions
- User asks about connections, dependencies, or topology
- TRAVERSE across RESULTs reveals a tangled web
Skip when
- 0-2 RELATIONSHIPS (TRAVERSE is sufficient)
- User asks about implementation, not structure
Budget
Approximate per-operation cost:
- SEARCH — ~500 tokens
- TRAVERSE — ~300 tokens
- INSPECT — ~100–500 tokens (depends on range)
Prefer fewer high-value operations over many cheap ones. Three SEARCHes with deliberate REFINE beats ten with drift.
Filters
Add lang:rust (or lang:python, lang:typescript, …) to SEARCH to narrow by language in multi-language projects.
1---2name: x-ray3description: Deep codebase exploration using semantic search and relationship mapping. Use when you need to understand the current codebase.4---56## Reframe78LITERAL: "$ARGUMENTS"910### Definitions11- LITERAL — what the user typed12- INTENT — what they mean, given SESSION_CONTEXT13- SESSION_CONTEXT — recent work; held by you, not by the index14- BRIDGE — your job: LITERAL + SESSION_CONTEXT → INTENT → query1516### Rules17- Search INTENT, not LITERAL.18- Context disambiguates → NARROW.19- Context insufficient → BROAD. Vague beats confidently-wrong-narrow.2021### Transforms (LITERAL → INTENT)22- VAGUE → specify ("that parsing thing" → "language parser implementation")23- QUESTION → keywords ("how does parsing work?" → "parsing implementation process")24- CONVERSATIONAL → technical ("stuff that handles languages" → "language handler processor")25- BROAD → contextualize ("errors" → "error handling exception management")26- CONTEXTUAL → reconstruct ("the logging" → "prompt eval logging", when SESSION_CONTEXT = prompt eval work)2728OptimizedQuery: _{written against INTENT}_2930---3132## Loop3334### Definitions35- SEARCH — `codanna mcp semantic_search_with_context query:"<q>" limit:5`36- INSPECT — read source at a LOCATION (Read tool or `sed -n 'A,Bp' file`)37- TRAVERSE — `codanna retrieve describe <name|symbol_id:N>` on a RELATIONSHIP38- REFINE — return to SEARCH with a new OptimizedQuery3940- RESULT — one hit from SEARCH; carries SCORE, signature, doc, LOCATION, RELATIONSHIPS41- SCORE — relevance ∈ [0,1]; focus on SCORE > 0.642- LOCATION — `file_path:start_line-end_line`43- RELATIONSHIPS — calls, called_by, implements, defines4445### Default flow461. SEARCH(OptimizedQuery)472. For each RESULT with SCORE > 0.6:48 - INSPECT if signature/doc is insufficient49 - TRAVERSE 1–2 RELATIONSHIPS that look load-bearing503. Picture incomplete → REFINE with what you learned514. INTENT answered → stop5253### INSPECT mechanics54LOCATION `src/io/exit_code.rs:108-120` →55- Read tool: `file_path=<env.cwd>/src/io/exit_code.rs, offset=108, limit=13`56- limit formula: `end_line - start_line + 1`57- sed (Unix only): `sed -n '108,120p' src/io/exit_code.rs`5859### TRAVERSE heuristics60- RELATIONSHIPS appearing across multiple RESULTs are load-bearing — follow first61- 1–2 per RESULT is usually enough62- Prefer `symbol_id:N` over name when shown — avoids ambiguity6364---6566## Mode6768This skill is EXPLORE, not ACT.69- EXPLORE: build understanding, surface patterns, identify integration points70- ACT: modify code, refactor, implement7172INTENT answered → present findings → await user direction.73Do not transition to ACT inside this skill.7475---7677## Graph7879EXPLORE-legal: derives a read-only view, does not modify source.8081When TRAVERSE reveals dense, multi-directional RELATIONSHIPS, visualize. All82pages share the design tokens with the sibling `graph` skill: dark by default,83light/dark toggle top-right, `--light` opens light.8485```bash86# codanna >= 0.14 (has `codanna dump`): one index read, then the neighborhood in memory87node ${CLAUDE_SKILL_DIR}/visualize-dump.js <symbol_id:ID | name> [depth]88# older binaries: one `retrieve describe` per node (3D force view only)89node ${CLAUDE_SKILL_DIR}/visualize-graph.js <symbol_id:ID> [depth]90```9192- Default view: a 2D layered call DAG -- callers above, callees below, labels at93 rest, deterministic; hover a name to light incoming (accent) / outgoing (red)94 edges; dashed edges are cycle edges; click a node to open its file95- `--3d` keeps the 3D force view (the 5-second gestalt of a tangled96 neighbourhood; `--layout force|td|lr|radialout` implies it); `--all` renders97 the whole index and is always 3D (`--bake` / `--no-bake` control the98 server-side pinned layout, on by default above 2000 nodes)99- Flags: depth default 2 (positional), `--cap N` per-level cap (default 5, 0 =100 none), `--from graph.jsonl` reuses a saved dump, `--binary PATH`, `--no-open`,101 `--relation calls|defines|uses|implements|extends` filters `--all`,102 `--self-contained` inlines the 3D vendor libs (the DAG page always is)103- Output: `.codanna/visualizations/graph-{name}-{timestamp}.html`104105Structure and flow over the same dump:106107```bash108# structure: collapsible left-to-right tree (drill-down); --radial for the poster IMAGE109node ${CLAUDE_SKILL_DIR}/visualize-tree.js [--root crate::indexing] [--depth N] [--kinds Function,Method,...] [--radial]110# dependencies on the structure: hierarchical edge bundling (Calls by default)111node ${CLAUDE_SKILL_DIR}/visualize-bundle.js [--root crate::indexing] [--depth N] [--relation calls|uses|implements|extends]112```113114- Pick by question: "what depends on this symbol / what breaks if I change it"115 -> `visualize-dump.js` (call DAG); "how is this module organized / let me116 explore" -> `visualize-tree.js` (expand/collapse like a file explorer -- the117 NAVIGATION surface for structure); "which modules call which, inside one118 scope, on a printable page" -> `visualize-bundle.js --depth N` (arcs119 aggregate to collapsed leaves, width ~ log count; hover: callers blue,120 callees red)121- `--radial` is a POSTER, not a navigation surface: one all-at-once image of a122 scope's containment shape for docs, slides, and side-by-side scope123 comparison. Without an explicit `--depth` it auto-collapses deep levels into124 counted ancestors (<= ~1200 rendered leaves). Never reach for it when the125 user wants to explore -- that is the collapsible tree's job126- Every 2D view opens the same detail panel on click (signature, kind chips,127 file:span, relation groups with go-navigation where the view supports it);128 opening the source is the explicit Open-file action inside the panel, never129 the click itself -- file:// opens in the browser, not the editor130- "what is the shape of the WHOLE codebase -- module shares, hubs, which131 modules talk, history over time" -> the sibling `graph` skill132 (`node ${CLAUDE_SKILL_DIR}/../graph/graph.mjs`): the disc is the living133 whole-map these views zoom into. The division: the disc owns134 whole-codebase RELATIONSHIP shape (edge webs, hubs, git-date timeline);135 x-ray owns scoped CONTAINMENT structure and single-symbol neighbourhoods.136 When both could answer, prefer the disc for whole-codebase questions and137 x-ray for scoped ones -- never render both for one question138- `--depth` collapses deeper levels into counted labels; `--root` scopes to a139 module prefix (edges crossing the root are dropped and counted); symbols140 without a module path hang off their file path; Field/Variable/Parameter out141 by default (`--kinds` to include)142- Shared pieces: `graph/dump.js` (dump reader), `graph/hierarchy.js` (tree143 builder + symbol-to-leaf map), the renderers under `graph/`, and144 `graph/theme.js` + `graph/tokens.mjs` (design tokens; node >= 22.12)145146### Suggest when147- RESULT has 3+ RELATIONSHIPS in multiple directions148- User asks about connections, dependencies, or topology149- TRAVERSE across RESULTs reveals a tangled web150151### Skip when152- 0-2 RELATIONSHIPS (TRAVERSE is sufficient)153- User asks about implementation, not structure154155---156157## Budget158159Approximate per-operation cost:160- SEARCH — ~500 tokens161- TRAVERSE — ~300 tokens162- INSPECT — ~100–500 tokens (depends on range)163164Prefer fewer high-value operations over many cheap ones. Three SEARCHes with deliberate REFINE beats ten with drift.165166---167168## Filters169170Add `lang:rust` (or `lang:python`, `lang:typescript`, …) to SEARCH to narrow by language in multi-language projects.