r/devtools • • 21d ago

I built a local-first AST code graph + 11-tool MCP server that cuts LLM context bloat by ~83% (open-source core)

https://codegraphy.software

I got tired of dumping huge files into Claude/Cursor, hitting context limits early, and watching the model hallucinate edits across files it didn't actually understand.

So I built CodeGraphy:

- Parses your repo locally with Tree-sitter AST (100% offline, zero cloud indexing)

- Builds an interactive dependency graph and detects circular imports (Tarjan SCC)

- Compresses context by ~82.8% using Smart Context Builder before sending to an LLM

- Exposes 11 STDIO MCP tools directly to Claude Desktop, Cursor, and Windsurf

Open-source CLI/MCP core is on PyPI right now:

`pip install codegraphy-lite`

Would love brutal feedback on what breaks on your repos!

6 Upvotes

2 comments sorted by

1

u/Previous-Growth-9919 21d ago

the token reduction is interesting, but i'd want to see tokens per successfully completed task, not just fewer tokens in the prompt. A small held-out set of real repo issues, run against full-file context, CodeGraphy context, and a simple search baseline with the same model and budget, would make the comparison easier to interpret. I'd score whether tests pass and whether the patch fixes the issue, not only whether it compiles. A few failure cases where a dependency edge was missed would also make it clearer when the graph helps. That'd make the compression figure much easier to judge.

1

u/GeologistNo4811 21d ago

Fair point - the ~83% figure strictly measures AST payload compression (preserving signatures, imports, and call-graph neighbors while stripping irrelevant bodies), not an end-to-end SWE-bench pass rate yet.

To be completely transparent about failure cases: static AST analysis can miss dynamic dispatch (e.g. `importlib`, reflection, or string-based DI/routing). That's actually why CodeGraphy exposes 11 MCP tools instead of just a static prompt dump - if an edge isn't in the graph, the agent can still fall back to symbol search or targeted file reads on demand.

Running a reproducible held-out set of real GitHub issues (full-file vs. ripgrep baseline vs. CodeGraphy MCP, scored by actual test pass rate) is a great idea - I'll add that benchmark and failure-case breakdown to the repo next. Thanks for the solid feedback!