ctx: an open-source Rust code graph agents can query to save context budget (MCP support)
arcandor · reddit · 2026-08-27
A developer open-sourced ctx (MIT, single Rust binary) that turns a source tree into a queryable code graph, letting coding agents ask where things are instead of grepping and reading files to fill up the context window. The author says he designed the architecture and heuristics while Claude wrote the implementation.
Key queries:
- ctx callers finds callers of a symbol; ctx trace --reverse traces execution paths
- ctx path finds the shortest path between symbols; ctx context --max-tokens 4000 pulls everything needed to edit a target
- ctx changed --api --since main shows what breaks on API changes; ctx parity checks Python/Rust port consistency
Built on Tree-sitter with a unified graph across Rust/Python/TS/Markdown—no language servers, embeddings, or index warm-up; builds in 100ms deterministically against current source. Reports 96.2% internal call-graph recall on its own codebase. Falls back to a unique-name heuristic for unevaluated-expression receivers. MCP support included; install via cargo install code-context or brew.
More from coding & agent
- Guiding AI to think outside the box improved translation speed by 42% — dotey · 2026-08-27
- Cursor Agent Ran 48 Hours Building a 3D Campus: More Detail, but Nearly Every Building Is Wrong — tristanbob · 2026-08-27
- Apodex 1.1 Report: Achieving Sustained, Verifiable Progress via Environment & Agentic Scaling — HeyAmit_ · 2026-08-27
- Review: GLM-5.3-Flash is annoying but brilliant for Agentic Coding — wbulot · 2026-08-27
- List features nearly 16 coding agents; how many does the world need? — thisiskp_ · 2026-08-27
- dhh Celebrates: GitHub Agents May Soon Stop Asking You to Drag Screenshots Manually — DanWahlin · 2026-08-27