Ali Ömer Keser

[ Home | Blog | Projects | Contact | GitHub | RSS ]


I cut a Claude Code session's cost by 34% with a symbol graph


Most of what a coding agent pays for isn't thinking. It's reading. Ask Claude Code where a bug is and it opens file after file, and every one of those files goes back into the context on every turn after. On a real codebase that adds up fast.

I built keeba to cut that down. It compiles your repository into a symbol graph (every function, type and call edge) and serves it to the agent over an MCP server. Instead of reading a 100 KiB file to find one function, the agent asks find_def or find_callers and gets back a few kilobytes of exactly the code it needs.

The A/B run

I ran the same bug-investigation prompt twice in Claude Code (Opus 4.7, xhigh effort) on a private Go codebase: once with keeba's MCP server wired in, once with MCP disabled. Both runs found the same two bugs, citing the same file and line.

With keebaWithoutChange
Cost$1.45$2.19−34%
Cache reads693k tokens1.10M tokens−37%
Cache writes135k tokens210k tokens−36%
Output10.3k tokens12.4k tokenssimilar
API time2m 47s3m 38sfaster
Wall time5m 25s4m 16sslower
Bugs found22same

Cache reads are the lever. Every turn re-reads the conversation so far, so a file pulled in early is paid for again and again. Smaller evidence early means a cheaper session all the way through.

What the number doesn't say

  • It's one prompt. Treat 34% as an order of magnitude, not a promise. Tracing impact ("what depends on this?") and onboarding questions gain the most. Writing new code from scratch barely moves.
  • Wall time went up. The agent made more, smaller tool calls. API time and cost both went down, but you wait slightly longer.
  • The agent needs a nudge. Even with keeba registered, Claude falls back to its habit of reading and grepping files unless it's told to use the graph. keeba can add that guidance to your CLAUDE.md for you.

How far the tools go

On go-ethereum (1,405 Go files) keeba indexes 20,065 symbols and 138,431 call edges in about 8 seconds. Across nine queries its tools returned 41.7 KiB where reading the files would have pulled 29.7 MiB. That's a measure of the tools, not of session cost, but it shows why the session gets cheaper.

Try it on your repo

go install github.com/aomerk/keeba/cmd/keeba@latest
cd ~/your-repo
keeba compile .
keeba bench --hook-prompts $(pwd)

The real test is the one I ran: the same prompt in two terminals, then /cost in each. If your number is very different from mine, I'd like to hear about it. keeba is Go and MIT licensed, and issues and pull requests are welcome on GitHub.