codebase-memory
Structural graph tools for live codebase navigation — trace call paths, detect change blast radius, find dead code, query architecture. Use before reading files. 120x fewer tokens than file exploratio
SKILL.md.claude/skills/codebase-memory/SKILL.md
GitHubCodebase Memory — Structural Graph
Zero-file-read structural analysis. Always try these tools BEFORE reading files for structural questions.
Quick Decision Matrix
| Question | Tool |
|---|---|
What calls foo()? |
trace_path(function_name="foo", direction="inbound") |
What does foo() call? |
trace_path(function_name="foo", direction="outbound") |
| Full call chain | trace_path(direction="both", depth=3) |
| Impact of my change | detect_changes(base_branch="main") |
| Architecture overview | get_architecture |
| Find by name/pattern | search_graph(name_pattern="Auth.*") |
| Find by label | search_graph(label="Class") |
| Dead code | search_graph(max_degree=0, label="Function") |
| Custom query | query_graph(query="MATCH (n:Function)-[:CALLS]->(m) RETURN n.name, m.name LIMIT 20") |
| Execution flows | list_flows → get_affected_flows |
| ADR management | manage_adr(mode="get") |
Workflow — First Use
index_repository(repo_path=".")— first run only (~6s for 500 files)list_projects— verify indexedget_architecture— architecture map
Workflow — Before Reviewing Changes
detect_changes(base_branch="main")→ risk score + blast radiusget_affected_flows→ which execution paths breaktrace_pathon highest-risk functions
Workflow — Exploration
get_architecture→ community map, entry pointssearch_graph(name_pattern="<keyword>")→ find relevant nodestrace_path→ traverse from found nodesget_code_snippet(qualified_name="<name>")→ source with context
Known Gotchas
search_graph(relationship="HTTP_CALLS")filters by degree — usequery_graphfor actual edge inspectionquery_graphhas a 200-row cap — usesearch_graphwith degree filters for countstrace_pathrequires exact qualified names — usesearch_graph(name_pattern=...)firstdirection="outbound"misses cross-service callers — usedirection="both"- Results default to 10 per page — check
has_moreand paginate withoffset
Re-indexing
Graph auto-updates via background git polling (5–60s adaptive). For immediate refresh:
index_repository(repo_path=".", mode="fast")