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
- Musk amplifies dev's verdict: Grok Bot easier to use than Codex and Claude — elonmusk · 2026-10-15
- Blob0 launches: a macOS file-manager-style desktop client for S3 and Cloudflare R2 — yihui_indie · 2026-10-15
- The 6-Layer AI Engineer Skill Stack for 2026: Vectors to Multi-Agent Ops — mdancho84 · 2026-10-15
- Building a Mechanical Engineering Agent Workflow in ChatGPT: 30-Node Canvas Shows Promise — burhop · 2026-10-15
- Open-source Harness Engineering course hits 19k stars, shows $9 vs $200 gap between failing and working agent setups — thisguyknowsai · 2026-10-15
- A 6-person team shipped healthcare prior-auth AI agents in 3 months — here's the playbook — alex_verem · 2026-10-15