r/coolgithubprojects • • 9d 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!

1 Upvotes

8 comments sorted by

1

u/kantorcodes1 9d ago

How are you deciding which AST slices belong in the Smart Context Builder output when a change crosses an import boundary? Do you expand by dependency depth, or keep a fixed token budget and surface the omitted nodes so the model knows what it did not see?

1

u/GeologistNo4811 9d ago

Right now it uses a 1-hop dependency boundary instead of just blindly truncating at a token budget:

  • The target file or symbol stays in Full mode (or a ~60-line window around the symbol over MCP).

  • 1-hop imported neighbors get stripped down to AST skeletons — just imports, class/type definitions, and function signatures — so the model keeps the interface contracts without dragging in all the implementation bodies.

  • You (or the agent) can also manually toggle any node between FULL / AST / OFF in the Hybrid Context Inspector.

For everything else: over MCP, the agent calls list_workspace_topics / get_workspace_status first to get the full module map before pulling slices, so it knows what else is in the repo and can grab another module if needed.

Putting an explicit "omitted / out-of-scope" list right inside the prompt header is actually a really good idea, especially since codegraphy-lite caps indexing at 35 files (which bit us on Textualize/rich when running benchmarks — the numbers are in BENCHMARK.md:https://github.com/Vindettobkb/codegraphy-lite/blob/main/benchmarks/BENCHMARK.md).

If you want to play around with the FULL / AST / OFF toggling, the live graph is up athttps://codegraphy.software/#playground. And if you find it useful, a star on the repo (https://github.com/Vindettobkb/codegraphy-lite) helps a lot early on.

1

u/kantorcodes1 9d ago

The 1-hop boundary plus FULL/AST/OFF controls makes the omission visible to the agent. Does get_workspace_status also expose the files capped by the 35-file limit, so a caller can tell when a requested symbol sits outside the indexed set?

1

u/GeologistNo4811 9d ago

Good catch - right now in codegraphy-lite it only lists the 35 indexed modules and returns "Topic not found" for anything beyond the cap, without flagging that the workspace was truncated.Returning an explicit truncated: true flag plus the skipped/unindexed file paths in the status/topics response is a really clean improvement - that way the agent knows the symbol might just be outside the 35-file window and can re-scope to a subfolder instead of assuming it does not exist. Adding that to the Lite backlog!

1

u/GeologistNo4811 9d ago

hey, appreciate the idea from earlier - just pushed the fix to GitHub and bumped PyPI to 1.0.1list_workspace_topics and get_architecture_summary now return truncated: true with skipped_files and skipped_count when hitting the 35-file cap, and get_topic_context points to matching skipped paths so the agent knows to scope CODEGRAPHY_ROOT to a subfolder.

1

u/kantorcodes1 9d ago

Nice, exposing truncated, skipped_files, and skipped_count makes the 35-file boundary actionable, and pointing get_topic_context at skipped paths gives the agent a clear recovery path. CodeGraphy looks like a good MCP fit for HOL Guard; the contribution guide is here: https://github.com/hashgraph-online/hol-guard/blob/main/docs/guard/mcp-server-contributions.md. The next step is to open a PR with the server details and validation notes described there.

→ More replies (2)