CodeStory Grounding
CodeStory keeps a local repository map and broad-search index so agents can
reach useful evidence without rediscovering the same code every turn.
The target is always the repository being grounded. Pass its exact absolute
root as project on every CodeStory call. Never rely on a global active
workspace.
Direct Tool Loop
Call the tool that matches the task. Do not call status first.
Using this skill does not require an MCP call when the requested work is fully
local to an already named evidence surface—for example, inspecting or editing
the content of assets/desk.svg. Inspect that surface directly. Naming a path
does not make the evidence surface complete when the task asks about ownership,
dependencies, runtime behavior, architecture, change impact, or another claim
whose evidence extends beyond the file. For those tasks, select the narrowest
CodeStory tool that can add evidence; do not call broad ground as a pre-edit
ceremony.
- Resolve the target repository root.
- Call the intended tool with
project=<absolute-root>.
- If the result says
state=preparing or state=updating and includes
retry_after_ms, wait for that delay and retry the same tool with the same
arguments. The delay tracks observed preparation progress, so honor the
reported value instead of a fixed poll interval. Do not poll status or ask
the user to set up CodeStory.
- Preserve cited anchors in source claims. Read focused source only for the
remaining evidence gaps.
CodeStory prepares its local repository map and shared per-user retrieval server
automatically. status and
the project-bound codestory://status{?project} resource are optional
diagnostics for a failed or unexpectedly slow request, not prerequisites for
normal grounding.
If CodeStory tools are hidden and deferred discovery is available,
search only for the intended tool, for example codestory mcp packet, then call
it directly. If the plugin MCP is unavailable, use ordinary source inspection
and report the visibility gap. Do not substitute CLI diagnostics for a live
plugin result unless the user explicitly asks.
Task Router
| Situation |
Route |
| Repository orientation |
ground; use files for language mix or coverage gaps. |
| Exact named file, path, or static asset with file-local evidence |
Inspect it directly. When adding it to a packet, use an exact_path tagged probe; do not run broad grounding merely to rediscover the path. If the task asks about relationships, ownership, or impact, use the corresponding narrow tool. |
| Find a symbol |
symbol, then definition or snippet. |
| Follow a call path |
callers, callees, trace, or trail. Use neighbors, shortest_path, or query_subgraph only for a named node. |
| Review change impact |
affected with explicit Git-changed paths (or changed_paths / change_records). Never omit the path source. |
| One graph node |
get_node, definition, references, or symbols. |
| Broad structural question |
packet; stop on Supported, NotEstablished, or Unavailable. For DrillOnce, call packet again once with the exact original question, parent_packet_id, and the listed option_ids. Use search or context only for a user-named exact target, not as packet recovery. |
Evidence Rules
- Treat CodeStory output as evidence, not omniscience.
- An irrelevant CodeStory call adds no evidence. Skipping one for a complete,
file-local surface is a valid use of this router; do not report that as
plugin unavailability.
- Local repository-map output is navigation evidence. Broad packet/search
output is stronger only when the response reports full retrieval readiness.
- When
packet reports supported, not_established, or unavailable, stop.
For supported, answer from the compiled support units. For
not_established, answer every claim those units directly establish, then
name the material links or claims that remain unproven; do not turn a partial
chain into a complete one. For unavailable, report the typed preparation
reason. Do not search to recover.
- When
packet reports drill_once, call packet once more with the exact
original question, parent_packet_id, and the listed option_ids (and the
pinned generation ids when present). Then answer. Do not start a free-form
search / context / trail / snippet loop from packet.
affected is planning evidence, not a guarantee that every runtime effect was
found.
- Tagged probes select exact or additional evidence work. They do not choose
route order or replace the packet disposition.
- Do not paste empty grounding output as context. If a repository truly has no
supported files, fall back to ordinary inspection or resolve the intended
root when it is ambiguous.
Failure Handling
preparing: retry the same tool after its delay.
updating: the last complete repository map remains usable; retry the same
tool when current publication evidence is required.
working_locally: use local navigation while broad search prepares.
unavailable: use ordinary source inspection and report that CodeStory was
unavailable for this task.
Maintainer commands such as doctor, ready, and retrieval status are debug
transcript tools. They do not prove that the installed plugin is live in the
agent host.
setup.ps1 and setup.sh under this skill are build-from-source paths for
contributors, not normal installation steps.
References
- Generated MCP syntax is the agent
argument source of truth. Do not send CLI flags as MCP fields.
- status contract
- repository map
- files
- affected
- packet
- search
- context
- symbols
- trails
- snippets
Maintainer CLI --help lives in generated CLI syntax
and is not an MCP calling convention.
1---2name: codestory-grounding3description: Use when an agent should ground a local repository with CodeStory before making source claims, planning edits, choosing tests, reviewing changes, or using broad retrieval evidence through the CodeStory plugin MCP.4---56# CodeStory Grounding78CodeStory keeps a local repository map and broad-search index so agents can9reach useful evidence without rediscovering the same code every turn.1011The target is always the repository being grounded. Pass its exact absolute12root as `project` on every CodeStory call. Never rely on a global active13workspace.1415## Direct Tool Loop1617Call the tool that matches the task. Do not call `status` first.1819Using this skill does not require an MCP call when the requested work is fully20local to an already named evidence surface—for example, inspecting or editing21the content of `assets/desk.svg`. Inspect that surface directly. Naming a path22does not make the evidence surface complete when the task asks about ownership,23dependencies, runtime behavior, architecture, change impact, or another claim24whose evidence extends beyond the file. For those tasks, select the narrowest25CodeStory tool that can add evidence; do not call broad `ground` as a pre-edit26ceremony.27281. Resolve the target repository root.292. Call the intended tool with `project=<absolute-root>`.303. If the result says `state=preparing` or `state=updating` and includes31 `retry_after_ms`, wait for that delay and retry the same tool with the same32 arguments. The delay tracks observed preparation progress, so honor the33 reported value instead of a fixed poll interval. Do not poll status or ask34 the user to set up CodeStory.354. Preserve cited anchors in source claims. Read focused source only for the36 remaining evidence gaps.3738CodeStory prepares its local repository map and shared per-user retrieval server39automatically. `status` and40the project-bound `codestory://status{?project}` resource are optional41diagnostics for a failed or unexpectedly slow request, not prerequisites for42normal grounding.4344If CodeStory tools are hidden and deferred discovery is available,45search only for the intended tool, for example `codestory mcp packet`, then call46it directly. If the plugin MCP is unavailable, use ordinary source inspection47and report the visibility gap. Do not substitute CLI diagnostics for a live48plugin result unless the user explicitly asks.4950## Task Router5152| Situation | Route |53| --- | --- |54| Repository orientation | `ground`; use `files` for language mix or coverage gaps. |55| Exact named file, path, or static asset with file-local evidence | Inspect it directly. When adding it to a packet, use an `exact_path` tagged probe; do not run broad grounding merely to rediscover the path. If the task asks about relationships, ownership, or impact, use the corresponding narrow tool. |56| Find a symbol | `symbol`, then `definition` or `snippet`. |57| Follow a call path | `callers`, `callees`, `trace`, or `trail`. Use `neighbors`, `shortest_path`, or `query_subgraph` only for a named node. |58| Review change impact | `affected` with explicit Git-changed `paths` (or `changed_paths` / `change_records`). Never omit the path source. |59| One graph node | `get_node`, `definition`, `references`, or `symbols`. |60| Broad structural question | `packet`; stop on Supported, NotEstablished, or Unavailable. For DrillOnce, call `packet` again once with the exact original `question`, `parent_packet_id`, and the listed `option_ids`. Use `search` or `context` only for a user-named exact target, not as packet recovery. |6162## Evidence Rules6364- Treat CodeStory output as evidence, not omniscience.65- An irrelevant CodeStory call adds no evidence. Skipping one for a complete,66 file-local surface is a valid use of this router; do not report that as67 plugin unavailability.68- Local repository-map output is navigation evidence. Broad packet/search69 output is stronger only when the response reports full retrieval readiness.70- When `packet` reports `supported`, `not_established`, or `unavailable`, stop.71 For `supported`, answer from the compiled support units. For72 `not_established`, answer every claim those units directly establish, then73 name the material links or claims that remain unproven; do not turn a partial74 chain into a complete one. For `unavailable`, report the typed preparation75 reason. Do not search to recover.76- When `packet` reports `drill_once`, call `packet` once more with the exact77 original `question`, `parent_packet_id`, and the listed `option_ids` (and the78 pinned generation ids when present). Then answer. Do not start a free-form79 `search` / `context` / `trail` / `snippet` loop from packet.80- `affected` is planning evidence, not a guarantee that every runtime effect was81 found.82- Tagged probes select exact or additional evidence work. They do not choose83 route order or replace the packet disposition.84- Do not paste empty grounding output as context. If a repository truly has no85 supported files, fall back to ordinary inspection or resolve the intended86 root when it is ambiguous.8788## Failure Handling8990- `preparing`: retry the same tool after its delay.91- `updating`: the last complete repository map remains usable; retry the same92 tool when current publication evidence is required.93- `working_locally`: use local navigation while broad search prepares.94- `unavailable`: use ordinary source inspection and report that CodeStory was95 unavailable for this task.9697Maintainer commands such as `doctor`, `ready`, and retrieval status are debug98transcript tools. They do not prove that the installed plugin is live in the99agent host.100101`setup.ps1` and `setup.sh` under this skill are build-from-source paths for102contributors, not normal installation steps.103104## References105106- [Generated MCP syntax](references/generated-mcp-syntax.md) is the agent107 argument source of truth. Do not send CLI flags as MCP fields.108- [status contract](references/status-contract.md)109- [repository map](references/ground.md)110- [files](references/files.md)111- [affected](references/affected.md)112- [packet](references/packet.md)113- [search](references/search.md)114- [context](references/context.md)115- [symbols](references/symbol.md)116- [trails](references/trail.md)117- [snippets](references/snippet.md)118119Maintainer CLI `--help` lives in [generated CLI syntax](references/generated-cli-syntax.md)120and is not an MCP calling convention.