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
- Indie dev vibe-codes a native iOS RSS app with 183 curated AI sources, awaiting TestFlight — vista8 · 2026-11-30
- AI Slides: Why Text-Layer Separation and Native PPTX Both Fall Short, and When to Pick Which — dotey · 2026-11-30
- Taku OS: open-source Android build embeds AI agents at the OS level — RevolutionStandard56 · 2026-11-30
- Bathys: 9B/27B deep search agents trained with verifiable question synthesis hit strong BrowseComp results — Bathys · 2026-11-30
- Open-source MCP server lets you annotate PDFs and send feedback straight to your research agent session — RegularCycle1971 · 2026-11-30
- Dev: having AI "surface implicit state machines" is incompatible with writing performant code — zack_overflow · 2026-11-30