Cut 90% of Tokens for Coding Agents with AST Context Graphs
Remarkable-One9371 · reddit · 2026-07-05
The author experimented with a local-first coding agent context service that builds a code repository graph based on AST/LSP-style facts: indexing files, symbols, imports, calls, definitions, containment relationships, and dependency edges. This allows the agent to query relevant subgraphs first, falling back to raw files, search, or LSP only when evidence is insufficient.
In benchmarks, graph context reduced input tokens by about 90% compared to broad snippets, while answers remained solid. The author emphasizes that "graph-first" does not mean "graph-only"; when retrieval is too narrow, the agent still needs to fall back to reading and verifying source code. They also welcome discussions on the trade-offs between LSP-first, embeddings/RAG, graph retrieval, or hybrid approaches.
More from coding & agent
- Warp's six non-engineering teams all run on Linear and Claude Code — mon__lim · 2026-09-11
- Is inference latency becoming the biggest bottleneck for production AI agents? — Euphoric_Sea632 · 2026-09-11
- Anthropic researcher: 99% of engineers now run swarms of 300+ self-improving agents — AlishaOutridge · 2026-09-11
- Gergely Orosz: Shipping 10x PRs With AI Agents, Sites Fill With Small Regressions — ducha_aiki · 2026-09-11
- Same Echo Maze prompt, three frontier models: all passed visually but shipped the same hidden bug — eyishazyer · 2026-09-11
- Astra storyboards plus Minimax H3 per-shot generation boost video success rates — Hailuo_AI · 2026-09-11