Repo-aware token budget controller for coding-agent runs
Engineering teams using coding agents need a cost gate before long-horizon runs, with a hard stop on repeated file viewing and editing. The evidence is no longer limited to vague complaints about expensive agents. On SWE-bench Verified in OpenHands, agentic coding used about 3500× more tokens than single-round code reasoning and about 1200× more than multi-turn code chat, with runs on the same task differing by up to 30×. The paper ties the worst failures to redundant search behavior, especially repeated file access and edits, and it shows that models are poor at forecasting their own token bill before they start.
A practical build is a repo-aware budget controller that watches action traces in real time and cuts the run into smaller scopes when the agent starts thrashing. The control point is simple: count file opens, revisits, edit reversions, and context growth, then require either a narrower subtask or human approval once those counters cross a threshold. Teams already paying for autonomous bug fixing or feature work would care first, because they absorb the cost of failed trajectories and usually do not get a reliable estimate upfront.
A cheap test is to replay past agent traces and measure how often an early stop after repeated file churn would have reduced token spend without hurting pass rate. If the controller mostly catches failures and late-stage wandering, it is worth shipping as a default guard in coding-agent products.