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
- BELL: Open-Source Stack Combines Browserbase, Eve, iMessage and Stripe Link for Personal Agents — jeff_weinstein · 2026-10-27
- Two engineers rebuilt a FedEx supplier's billing core in 3.5 months vs an estimated 7-8 — alex_verem · 2026-10-27
- GPT-6.1 Terra gains ~20 points on Terminal-Bench 4.0, rivalling GPT-6.1 Sol — ArtificialAnlys · 2026-10-27
- GPT-6.1 Terra scores 48 on AA Coding Agent Index at one-third the cost of GPT-5.6 Terra — ArtificialAnlys · 2026-10-27
- Shift-1 router cuts coding agent spend up to 55% while keeping SWE-bench accuracy — ypatil125 · 2026-10-27
- Non-coder vibe-codes a Godot JRPG with Claude Code in two weeks, music and art synced — ADHDavid · 2026-10-27