/codesage-tools:codesage-retrievalfrom codesage-tools
Routes semantic and structural code queries through CodeSage for definitions, references, dependencies, impact analysis, risk, test selection, and stack traces.
Ships in codesage-tools. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub iliaal/codesage --plugin codesage-toolsUse indexed retrieval when .codesage/index.db exists and codesage status succeeds in the repository under work. Otherwise use rg; onboard only when authorized. help works in any existing absolute directory. edit_check works in a Git repository without an index.
Pass the absolute repository root as project on every project-scoped MCP call. Keep repositories separate. The operator tool daemon_stats has daemon scope and no project argument. Reuse the global MCP registration; do not create duplicate project registrations. After upgrading, refresh the plugin and start a new host session if newly advertised tools are unavailable.
Use CodeSage for behavior discovery and code-graph questions. Use find_symbol for definitions and find_references for structural uses. Use rg for literal occurrences, including configuration keys, test names, error messages, documentation, and generated files. Identifier spelling does not choose the tool: every occurrence of TIMEOUT needs literal search; its definition needs a symbol query. Prefer the smallest query that answers the question.
Entity tools take target, or targets for file sets. trace_call_path takes from and to. Accepted forms depend on the tool: sym:, file:, dir:, chunk:, and feat_ handles, indexed paths, path:line, qualified or bare names, route:METHOD path, and cmd:name. Use help to check a tool's allowed forms. Prefer returned handles and candidate choices. A handle identifies the intended entity, but name-based union tools can still return uses or similarity seeds shared by several definitions. Do not supply disagreeing legacy and current argument spellings. Retired tool names (assess_risk_batch, assess_risk_diff, list_features, find_feature, export_context, feature_bundle, session_start, session_end) still dispatch for one release but are not advertised; call assess_risk, features, bundle, and session instead.
Inspect index.structural, index.dirty_paths, and completeness before acting on structural facts. Structural MCP queries can overlay changes to already indexed files with limits of 50 files and 2 MiB of source, and a cooperative 500 ms preparation budget. A successful overlay reports index.structural: "overlay"; changed definitions and source are current within that measured scope. The overlay does not discover newly untracked files. A bound or failure falls back to indexed facts with index.structural: "dirty" and index.overlay.reason; index.overlay.checked_all: false means even the dirty-file scan is incomplete. Follow the recovery command codesage index when the overlay cannot cover the required scope.
An overlay does not refresh embeddings, historical observations, or feature membership. Read index.semantic, index.history, and index.features independently. bundle can return current source for a feature while its selected feature membership remains indexed. Historical co-change observations survive uncommitted source edits because they describe indexed commits; new commits and renames need codesage git-index when current history is required. Risk combines those historical observations with structural evidence.
session with action start and end compares current structural state, including a successful bounded overlay; inspect their freshness disclosures before trusting the comparison. edit_check deliberately compares against pinned Git HEAD and reports working-file divergence. An overlay never changes that contract. A bounded zero or unknown freshness is not proof of freshness.
counts_floor: true means found evidence is a lower bound; zero means no modelled evidence was found, not proof of absence. Follow both the outer completeness and preserved completeness.prior limitations. found: false means no matching target or path was found in the reported scope; inspect candidates, freshness, and recovery before broadening the claim.
Search confidence measures separation in one ranked page, not correctness or a probability that code exists. The legacy coupling confidence and reverse_confidence fields mean historical conditional co-change fractions; prefer p_cochange and p_reverse. Risk scores are composite signals, not calibrated failure probabilities. An unscored field is unknown, not zero risk.
For patch risk, test selection, and rehearsal, inspect git status --short --untracked-files=all, the staged diff, and the unstaged diff. Include all staged, unstaged, and relevant untracked files in the intended patch, deleted paths, and both sides of renames. Inspect unrelated work before excluding it. For a branch review, also inspect the merge-base diff. Bare git diff --name-only misses staged and untracked files.
Use the same explicit repository-relative path array for assess_risk with aggregate: true, recommend_tests, and review_rehearsal. Put the most important files first for recommend_tests: inputs share a bounded walk budget in request order. Read unwalked_files, partial_files, and unmodelled; the suggested subset never replaces required repository suites.
For CLI fallbacks, run from the target repository with individually quoted arguments. Preserve Git's NUL-delimited output if automating collection. Never turn paths into shell source, pipe newline-separated filenames, or use unquoted command substitution. Do not invoke file-set commands with an empty array. In Bash, after constructing the actual files array:
codesage risk-diff -- "${files[@]}"
codesage tests-for -- "${files[@]}"
codesage rehearse -- "${files[@]}"
Start with one focused structural query. help and edit_check need no index or model. Indexed definitions, references, dependencies, entity cards, and exact-target bundles need no embedding inference, but graph walks, snapshots, and risk can still consume bounded work. search and text-target bundle require embeddings and may load models or run a reranker. Prefer bundle with a feat_ target when the mapped slice already supplies the required scope.
Read cost.ms and cost.bytes on actual responses. Ask help for price_list to see measured daemon-lifetime latency histograms and sample counts. Those measurements span projects and outcomes; they are observations, not predictions. Missing telemetry reads unknown. Response budget_tokens uses an approximate byte conversion, not a tokenizer measurement. Larger response budgets cannot repair a capped graph walk.
Ask help with tool and optionally field for input/output semantics, with code for an error, or with intent for an ordered investigation recipe. The intents are review, fix_bug, rename, add_feature, before_commit, and debug_failure. Use tool: "daemon" to discover operator tools and commands. Recipes supply explicit bindings and stopping conditions; they are plans, not automation or new authority.
When MCP is unavailable, use codesage --help and the relevant command's --help from the target repository. If daemon startup is the suspected failure, codesage mcp --direct exercises the single-process stdio path; do not register it as a second persistent server. Plugin review workflows remain /codesage-review, /codesage-triage, /codesage-revalidate, and /codesage-report. Read the selected command's workflow before use; a missing finding never proves a fix.
| Tool | Use and boundary |
|---|---|
mcp__codesage__help | Explain tool or field semantics, recovery, investigation recipes, and measured daemon latency. Use when arguments or evidence need interpretation; use describe for facts about code. Requires an absolute existing project directory, without an index or model. Select tool=daemon for operator tools. |
mcp__codesage__describe | Inspect one indexed file, symbol, feature, or directory: facts, dependencies, tests, risk, and follow-up calls. Use project_overview for project orientation or bundle for source. Ambiguous targets return candidates; unavailable sections disclose recovery. |
mcp__codesage__project_overview | Orient once at session start: languages, freshness, features, entrypoints, risk, boundaries, and test conventions. Uses structural facts and indexed history without model inference. Use describe for one entity; use search to locate behavior. Inspect freshness and overlay evidence before relying on results. |
mcp__codesage__review_rehearsal | Review an explicit patch file set before committing: ranked objections about risk, tests, cycles, boundaries, and scope, with evidence and suggested checks. Use assess_risk for risk alone. Inspect each objection against the actual patch; this read-only analysis does not run tests. |
mcp__codesage__edit_check | Check a complete replacement declaration against pinned Git HEAD before writing. Reports signature changes, proven incompatible callers where supported, and explicit unknowns. Requires Git, without an index. Use find_references for broader caller discovery. Does not compile, write source, or establish safety. |
mcp__codesage__find_symbol | Locate indexed definitions by name or target, with source locations, kinds, and author rationale. Use find_references for uses of a symbol; use search when its name is unknown. Inspect ambiguous matches before choosing a definition. |
mcp__codesage__find_references | Find indexed calls, imports, and other references to a symbol. Results are name-based evidence and may combine same-named definitions; missing rows do not prove absence. Use find_symbol for definitions or impact_analysis for transitive dependents. |
mcp__codesage__find_similar | Find structurally similar functions or methods before applying a fix across copies. Matches AST shape, ignoring identifiers and literals; same-named definitions share the seed set. Use search for semantic similarity or find_symbol for exact definitions. Test files are excluded. |
mcp__codesage__list_dependencies | List a file's immediate imports and importers. Use for direct file dependencies; use find_references for symbol uses or impact_analysis for transitive dependents. Results describe indexed relationships, not an exhaustive runtime dependency graph. |
mcp__codesage__search | Locate code by behavior or intent using embeddings and optional reranking. Use find_symbol for known definitions or find_references for known uses. Path filtering has approximate recall. Ranking confidence describes score separation, not correctness or proof of absence. |
mcp__codesage__trace_call_path | Trace a forward call chain between two symbols through resolved indexed edges. Use impact_analysis for reverse dependents or from_trace for an observed stack trace. Missing paths do not prove absence; bounded searches may omit paths or shorter alternatives. |
mcp__codesage__from_trace | Map a pasted stack trace or sanitizer report to indexed source locations. Frames disclose resolved, ambiguous, or unresolved matches. Use trace_call_path to investigate graph paths between symbols; use find_references for callers. Paste the original trace without rewriting it. |
mcp__codesage__impact_analysis | Find transitive callers and importers affected by changing a symbol or file. Walks reverse indexed references. Use list_dependencies for immediate file imports or find_references for individual uses. Missing dependents do not prove absence; inspect completeness before treating the result as exhaustive. |
mcp__codesage__bundle | Bundle source and definitions for a feature, symbol, file, directory, or free-form question, optionally with callers and callees. Exact entities resolve before model inference; text uses semantic search. Use describe for a compact fact card. Inspect found and completeness; resolve ambiguity with returned handles. |
mcp__codesage__find_coupling | Find files that historically change with one file, ranked by decayed co-change evidence. Use recommend_tests for patch test selection or assess_risk for a combined risk score. Missing history is unmeasured; recurring pairs offer stronger evidence than one-off changes. |
mcp__codesage__assess_risk | Assess change risk for one or more files from history and structural signals. Each target gets its own score; aggregate: true adds patch rollups, hotspots, test gaps, unscored files, and touched import cycles. Missing history leaves a partial score, not evidence of safety. Touched cycles may predate the patch. |
mcp__codesage__recommend_tests | Recommend tests for changed files using naming conventions, co-change history, and bounded graph reachability. Put priority inputs first because they share a walk budget. Use assess_risk for patch risk. These recommendations are a lower bound, not permission to skip required suites. |
mcp__codesage__session | Save structural state before authorized edits (action start), then compare against it (action end): cycles, risk changes, added or removed files. Use a distinct session_id for concurrent sessions; reusing one replaces its baseline. Inspect index.structural for overlay or dirty fallback. Use review_rehearsal for patch objections without a baseline. |
mcp__codesage__features | Discover mapped behavior slices, filtered by kind, language, tag, or changes since a ref; with target, only slices containing that file as entrypoint, owned code, context, or test. Each feature groups entrypoints, owned files, context, tests, and trust boundaries. An empty target result means no mapped feature claims the file. Use bundle to read a slice. |
No matching evidence was found in the indexed scope; this does not prove absence.
Counts are lower bounds from modelled or name-based edges. Zero means none found, not none exist.
An analysis or walk stopped at a time, depth, or work cap.
Existing rows or payload content were omitted from the delivered response.
Some inputs, index coverage, or retrieval stages were unavailable.
At least one requested parameter was adjusted to an allowed value.
Evidence needed to compute a score or section was unavailable; absence of a score is not low risk.
The response's index or referenced files may differ from the current working tree or HEAD.
The shared help catalog is the authored source for this generated skill, tool descriptions, detailed tool semantics, error recovery, and recipes. MCP help embeds the same catalog and obtains field schemas from the live registrations. Edit the catalog and run python3 plugins/codesage-tools/bin/render-guidance.py --write from the source checkout; --check detects drift. Recover until the requested claim is supported, or report the specific remaining unknown.
Other plugins' skills for the same job