ADR-AI-004 — Code Navigation with a Local Knowledge Graph
Status: Accepted Date: 2026-11-29 Authors: Engineering Team
Context
Answering “where is X handled and what depends on it” across 24+ microservices, two UIs and several infrastructure repositories by searching and reading files sends a lot of raw text into the context window. Putting more structure into CLAUDE.md files makes every turn more expensive (see ADR-AI-002). graphify builds a graph of files, symbols and their relationships, with communities and “god nodes”, and answers query, path and explain with a small subgraph.
Decision Drivers (FRs & NFRs)
- BRD-AI-001 BR-1.7 — efficient sessions.
- BR-1.3 — the index must not capture secrets.
- SR-AI-001 SR-F-12, SR-NF-04.
Decision — How does the assistant find code across projects?
Option 1 — Search and read files (grep, glob, read)
Pros:
- Always current, no index to maintain.
Cons:
- Broad searches return large outputs, and each turn re-sends them.
- Relationships across services have to be rebuilt by reading.
Option 2 — Richer CLAUDE.md maps
Pros:
- Curated and readable by people too.
Cons:
- Always loaded, so every turn pays for it. Drifts from the code.
Option 3 — Local graphify graph, queried first, with hooks that steer broad searches (CHOSEN)
Pros:
graphify query/path/explainreturns a scoped subgraph, usually far smaller than raw search output or the fullGRAPH_REPORT.md.graphify update .refreshes the graph from the AST with no API cost.graphify hook-guardPreToolUsehooks remind the assistant to use the graph before a broadBash/Grepsearch orRead/Glob.graphify-out/is gitignored and built per clone, and.graphifyignorekeepsdocs/, build output and secret files out of the index.
Cons:
- The graph goes stale if
graphify update .is not run after changes. - One more tool to install, and its generated output must be kept out of commits and published docs.
Final Decision
The workspace keeps a local graphify graph and the workspace CLAUDE.md tells the assistant to query it first. Plain search was kept as the fallback, not the default. Richer CLAUDE.md maps were rejected for always-on cost. The cost accepted is keeping the graph updated and the ignore file complete.