Goal
Build a compact map of an unfamiliar code area so implementation starts with the right boundaries, dependencies, and validation path.
When to use
- The user asks to understand a subsystem, route, package, workflow, or architecture boundary.
- A change looks risky because callers, data flow, or ownership are unclear.
- An agent needs context before editing but should avoid broad file dumping.
When not to use
- The user needs a direct code fix and the relevant files are already known.
- The task is a full repo audit; use
repo-health-audit. - The user wants an ADR; use
adr-writerafter the decision is clear.
Inputs to inspect
- Repo tree, package files, routing files, tests, ADRs, domain docs, and validation docs.
- Existing code search results for entry points, callers, imports, and tests.
- CodeGraph or ast-grep outputs when available, but do not require them.
Workflow
- Define the target area and the question the map must answer.
- Identify entry points, exported APIs, routes, commands, jobs, or event handlers.
- Trace likely callers, callees, imports, data models, and side effects.
- Locate tests, fixtures, validation commands, docs, and relevant ADRs.
- Produce a compact map with likely edit surfaces and risk points.
- Recommend next implementation or investigation steps.
Safety rules
- Do not read broad files just to fill space; prefer targeted search and source ranges.
- Do not treat naming similarity as proof of ownership.
- Do not propose edits until the map identifies the likely affected surface.
- Do not claim complete coverage when only a subset was inspected.
References
No bundled references. If codegraph-ast-grep is available and the repo is indexed, it can help with symbol lookup and structural search. Local ADRs and domain docs should be inspected when relevant.
Scripts
No bundled scripts.
Output format
Return:
- Target question
- Entry points
- Main data or call flow
- Ownership boundaries
- Tests and validation
- Relevant docs or ADRs
- Likely edit surfaces
- Risks and unknowns
Completion criteria
- The map is specific enough to guide implementation.
- Relevant tests and validation are identified.
- Unknowns are explicit.
- The next step is clear.
Failure modes
- If the target area is too broad, ask for a narrower subsystem or user workflow.
- If code search is inconclusive, list the searched terms and fallback path.
- If docs and code disagree, prioritize code behavior and note the docs drift.