codebase-index
A local code map for AI coding agents: find the right file, trace how it connects, predict what a change breaks.
Works with Claude Code, Codex CLI, OpenCode and any MCP client. Runs on your machine. Sends nothing anywhere.
Try it ·
Why ·
Find / Trace / Predict ·
Agents ·
Evidence ·
Contribute
Real output on pallets/flask. Reproduce it with examples/demo.
Try it in 60 seconds
pip install codebase-index
cd your-project
codebase-index index # a few seconds for ~250 files
codebase-index search "where is the session cookie signed"
codebase-index impact SessionInterface --direction up # what depends on it
codebase-index init # wire it into Claude Code / Codex / OpenCode
That is the whole setup. The index is a SQLite file under .claude/cache/, the
skill tells your agent to query it before reading files, and codebase-index doctor
tells you if anything is off.
Why this exists
Claude Code and Codex can already read files. The problem is deciding which files.
On a repository with a few hundred files an agent that greps for keywords opens the
wrong file more often than the right one, then reads whole files to compensate. That
costs tokens, time, and, worst of all, wrong answers delivered with confidence.
codebase-index gives the agent a ranked, evidence-bearing answer to three questions
before it opens anything:
| Question | What comes back |
|---|
| Find | Where is X implemented? | Ranked file:line ranges, a reason for each rank, and a bounded read plan |
| Trace | What calls this? How does A reach B? | Definitions vs references, shortest dependency paths, each edge tagged extracted / inferred / ambiguous |
| Predict | What breaks if I change this? What does my diff touch? | Upstream and downstream dependents by distance, with graph-coverage honesty |
Every answer carries its own uncertainty: index freshness, result confidence, and
whether the graph is partial for a language. The agent can tell "nothing references
this" from "the graph doesn't know", which grep never can.
How it differs from what you already have
- grep / ripgrep: exact text, no ranking, no notion of definition vs call, no
dependency graph. Use it when you know the string. Use this when you know the
question.
- Repo-map style context (Aider and friends): a signature listing pushed into
every prompt. Good orientation, query-agnostic, and it must fit in the budget.
This is a queryable index instead: per-question ranking, line ranges, graph
traversal, and a stable JSON/MCP contract any agent can call.
- Cloud code search / IDE indexing: powerful, but your code leaves the machine
or you adopt an IDE. This is a small Python package on SQLite and Tree-sitter:
no server, no account, no telemetry.
The comparison guide says when each of those is the better choice.
Find / Trace / Predict
All examples below are real output on Flask at commit d318b683; see
examples/demo/EXPECTED_OUTPUT.md for the full transcript.
Find the implementation, not a keyword hit: