▲ 3 r/AI_Agents
I tested AST-backed context graphs for coding agents; here is what changed
I have been experimenting with a local-first context service for coding agents that builds a repo graph from AST/LSP-style facts instead of making the agent start with broad file search.
The useful pattern so far:
- index files, symbols, imports, calls, definitions, containment, and dependency edges
- let the agent query the relevant subgraph first
- expand to raw files, search, or LSP only when evidence is weak
- measure not only token count, but also whether the retrieved context would increase hallucination risk
In one benchmark pass, graph context used about 90% fewer input tokens than broad snippets while keeping the answer grounded enough for the tested tasks. The important caveat is that graph-first cannot mean graph-only. If retrieval is too narrow, the agent has to fall back to source reads and validation.
I'm curious how others are handling this for coding agents: do you prefer LSP-first retrieval, embedding/RAG retrieval, graph retrieval, or a hybrid?
u/Remarkable-One9371 — 14 hours ago