Turning Interaction History into Execution State: A Runtime Layer for Long-Horizon Coding Agents
A long-running coding agent's trajectory is hundreds of actions and observations, and nothing in that record says which of them still describe the repository as it currently stands — so before every step the model has to infer, from raw scrollback, whether the file it read forty turns ago has changed since. When that inference slips it edits stale content or re-runs work whose result was still good: the two baselines here re-read the same unchanged snippet 1,875 and 5,840 times across one benchmark run. Ledger is a deterministic layer that keeps a running record of what has been observed, modified and attempted, appends a compact state view to the prompt, and intercepts each proposed command so an inspection whose answer has not changed returns the earlier result instead of running again. It adds no language-model calls and wraps an otherwise unmodified agent, and across all 500 tasks of a real-bug benchmark it lifted first-try success from 56.2% to 64.2% on one model and 75.8% to 81.0% on another while cutting total cost by 28.9% and 31.8%.