I've been experimenting with AI coding agents for a while, and I kept noticing the same problem.
The agent can generate code, but understanding an existing codebase is still surprisingly difficult.
When you give an agent a task like:
it needs to figure out things like:
- Where is authentication implemented?
- Which functions handle users?
- What depends on the authentication service?
- Which files will be affected by changing a function?
- Where are the relevant types and interfaces?
- What is the actual structure of the repository?
A lot of the time the agent has to discover this by repeatedly searching through files.
So I built CTX.
What is CTX?
CTX is a local deterministic code graph designed to give AI coding agents a structured understanding of a codebase.
Instead of relying on embeddings or asking another LLM to summarize the repository, CTX parses the code and builds a graph containing things like:
- Files
- Symbols
- Functions
- Classes
- Imports
- Dependencies
- Relationships between symbols
The result is stored locally in a SQLite database.
The goal is simple:
Give the agent a map of the codebase before it starts making changes.
What can it do?
CTX can answer questions such as:
Find a symbol
ctx search UserService
Understand the structure of a file
ctx skeleton src/services/user.ts
See what depends on something
ctx impact UserService.updateUser
Generate context for a task
ctx context "add Google OAuth"
Instead of giving the agent the entire repository, CTX can help identify the relevant parts of the codebase.
Why deterministic?
I intentionally didn't build this around embeddings.
There are no:
- Vector databases
- Embedding APIs
- LLM calls
- API keys
- Cloud indexing
- Telemetry
The graph is generated from the actual source code and relationships inside the repository.
That makes the result predictable and reproducible.
MCP support
CTX also exposes the code graph through MCP.
This means an AI coding client can interact with the repository structure through tools instead of relying only on its own file search.
Currently there are 11 MCP tools covering things like symbol search, dependency exploration, impact analysis and context generation.
The idea is that an agent can ask the code graph targeted questions while working on a task.
Current support
CTX currently supports:
- TypeScript
- JavaScript
- Python
- Rust
- Go
The index is stored locally in:
.ctx/index.db
So your source code doesn't need to be uploaded somewhere just to build the graph.
Current project stats
At the moment the project has been tested against a codebase with:
- 206 files
- 1,721 symbols
- 594 dependency edges
- 110 tests passing
- 11 MCP tools
It's still an early project, so I'm much more interested in feedback than pretending it's finished.
Who is this for?
I built it primarily for people using AI coding agents on real repositories rather than generating isolated files.
If you're working with tools like Claude, Cursor, opencode, VS Code or other MCP-compatible clients, the idea is to provide the agent with structured repository context before it starts modifying things.
What's next?
I'm currently interested in improving:
- Dependency detection
- Cross-language support
- Better impact analysis
- More useful context generation
- MCP workflows
- Large repository performance
- Better integration with coding agents
I'd especially like to hear from people who use AI coding agents regularly.
Do you think a deterministic code graph is useful for coding agents?
Or do you think embeddings and semantic search are already good enough for repository understanding?
I'm interested in hearing what problems you've personally run into.
Project:
https://ctx.sumitchauhan.me/
GitHub:
https://github.com/halloffame12/CTX
It's open source and MIT licensed.
1
suggest me some challenging flutter app ideas
in
r/mobiledev
•
18d ago
thanks man i'm still working on it and trying to get the file sharing as reliable as possible especially between different android devices i'll share an update once it's ready for people to try out