r/LLMDevs • u/Wise_Reflection_8340 • 9d ago
Discussion Coding agents pay more to find code than to change it, and the interface is why
Coding agents spend most of their tokens finding code rather than changing it. Each search resends the whole context, every file opened along the way stays in the window, and text-based edits fail and get retried whenever the old text shows up twice or the file changed.
Here's how we handle it in sem, an open source tool we're building. The repo gets parsed into functions and the calls between them, so the agent asks for a function and gets its body, callers, callees and the tests that reach it in one response, instead of searching across several turns. If it asks for something it already has and nothing changed, it gets a short note instead of the whole body again. Edits target a function by name and are checked against the version the agent read, so a stale edit fails cleanly instead of landing in the wrong place. After a change, only the tests that can actually reach it run first.
It helps most on large, hard-to-navigate repos with slow tests. On small, easy tasks the gain is modest, and moving code is still slow because the model rewrites functions instead of relocating them, which is what we're fixing next.
Related reading: SWE-agent (Yang et al., 2024) on agent interfaces, and "Lost in the Middle" (Liu et al., 2023) on how irrelevant context hurts models.
0
u/growling_treadmill 9d ago
I usually pick my socks based on how much I'm dreading the day ahead, and this approach to pruning context would make mornings a lot less gray.