I use AI coding assistants like Claude Code and Cursor every day. They are helpful, but I kept noticing one habit. When I ask a simple question, such as "What will break if I change this function?", the assistant searches the whole project for the function name, opens many files, and reads them from top to bottom. That takes a long time and fills up its memory with text it does not need.
In this article I will explain a better way, using a simple idea called a call graph. I will also share a small tool I built, and I will be honest about where it works well and where it does not.
Disclosure: I am the author of the tool mentioned here.
What is a call graph?
A call graph is a map of which parts of your code use which other parts.
Imagine a small online shop. The function checkout calls charge_card, and charge_card calls send_receipt. A call graph writes this down as a set of connections.
Once you have this map, a question like "What uses charge_card?" has a direct answer. Nobody has to search through files to find it.
Why plain text search falls short
Most assistants find things by searching for words. This works until the same word shows up in many places.
Say you have two functions named save. One saves a user. The other saves an order. A text search for save shows both, plus every comment and test that mentions the word. The assistant must read them all and guess which one you meant.
A token is a small piece of text that an AI reads. The assistant has a limited number of them in its memory, so every unneeded file it reads leaves less room for the work that matters.
What I built
I tried an existing tool called CodeGraphContext, which builds this kind of map. The idea worked well. What slowed me down was the setup: it needed a separate database and a Python environment, and each question took over a second. So I wrote a lighter version in Go and called it GoGraphCtx.
Here is how it works from start to finish.
MCP stands for Model Context Protocol. It is a standard way for an assistant to talk to outside tools. Once the tool is connected, the assistant can ask it things directly.
The tool is one small program with no separate database. It keeps the map in memory, saves a copy to disk, and updates only the changed parts when you save a file. It supports Go, Python, TypeScript, JavaScript, Rust, and Java.
Answering "What will break?"
This is the question I care about most. The tool answers it by following connections backward. If you change charge_card, it finds what calls charge_card, then what calls those, and so on.
Everything above your change is something that might be affected. The assistant gets this short list instead of reading the whole project.
Being honest about what it does not know
Sometimes a tool cannot tell which function a line of code will call. This happens often in languages like Python and JavaScript, where the target can be decided while the program runs.
Many tools guess here and present the guess as a fact. I did not want that. In my tool, each connection has a confidence level.
When the tool cannot be sure, it says so in a field called unresolved_hints. I think a tool that says "I don't know" is more useful than one that quietly guesses wrong.
Keeping answers short
Each answer is trimmed to fit a budget, set to 4,000 tokens by default. The tool can also return only the lines of one function instead of the whole file. This keeps the assistant's memory free for real work.
What the numbers look like
I measured these on my own test setup, using a sample project with 83 Python files that is built like Flask. Please treat them as a rough guide, not a final result.
- Time to build the map: about 84 milliseconds, compared with about 3.8 seconds for CodeGraphContext
- Time to answer a question: about 1.2 milliseconds at the slow end, compared with about 1.3 seconds
- Memory used: about 48 MB, compared with about 178 MB
- Text sent to the assistant for a symbol lookup: about 13,000 tokens, compared with about 59,000 for ripgrep, a popular search tool
- Update after editing a file: about 11.5 milliseconds
For accuracy, I checked the connections on Flask against a trusted Python tool called Jedi. About 98% of the tool's connections were correct, compared with about 69% for CodeGraphContext in the same test. This is one project in one language, and I may not have set up the other tool in the best way, so please do not read it as a general result.
Where it works less well
Results depend a lot on the language. On real open-source projects, the share of calls the tool could trace was:
- Rust (bytes library): about 92%
- TypeScript (zod): about 90%
- Go (cobra): about 70%
- JavaScript (express): about 49%
JavaScript is the weakest, because so much of it is decided while the program runs. Code like that will always have more calls marked as unresolved. The tool is also young (version 0.2.0), so rough edges are likely.
Try it
If you already use a graph database and like your current setup, you may not need to switch. If you want something with no setup that tells you what it could not work out, it may be worth a few minutes.
The code, install steps, and benchmark notes are here: https://github.com/roshankumar0036singh/gographctx
I would like to hear about bugs and about projects where it does poorly. Those reports help the most.




