| name | codebase-memory |
| description | How and when to query the repo's knowledge graph — find symbols, trace call chains, compute blast radius, map architecture. Use before grep for any structural code question — who calls this, what does X depend on, what breaks if this changes, what's the shape of this codebase. |
Codebase memory
The bundled codebase-memory MCP holds a graph of this repo's code: functions, classes, routes, and the edges between them. For structural questions it answers in one call what grep approximates in ten — reach for the graph first, grep for raw text (strings, configs, comments) only.
docs/agents/codebase-memory.md says whether this repo is indexed. Not indexed → run index_repository first (or fall back to grep if the user declined indexing at setup).
The queries, by question
| Question | Call |
|---|
| Where is this function/class/route? | search_graph (name_pattern / label / qn_pattern) |
| Who calls X? What does X call? | trace_path (mode=calls) |
| How does data flow through here? | trace_path (mode=data_flow, cross_service for seams) |
| Exact source of a symbol | get_code_snippet (qualified_name — precise ranges) |
| What breaks if I change X? | trace_path on X's callers + query_graph for dependents — the blast radius |
| What's the shape of this codebase? | get_architecture (aspects) |
| Anything relational the above can't say | query_graph (Cypher) |
| Text that isn't a symbol | search_code (graph-augmented grep) |
Per role
- Architect — explore before designing:
get_architecture for the map, trace_path to see how the affected flow actually runs today.
- Engineer — impact before editing: blast radius of every symbol you're about to change; know the callers before changing the callee.
- Reviewer — the evidence pack's blast-radius section comes from here; it's what lets Correctness hunt bugs the diff doesn't show.
Staying fresh
The graph reflects the last index. After a large refactor or a long-running branch, detect_changes; rebuild with index_repository when drift is real. A symbol the graph can't find that plainly exists in the tree = stale index — reindex rather than distrusting the graph wholesale.