π€ AI Summary
This work addresses the challenge that long-horizon code agents often misjudge the true state of a codebase due to reliance on lengthy, implicit interaction histories, leading to redundant or outdated actions. To resolve this, the authors propose Ledgerβa non-intrusive, deterministic runtime layer that explicitly captures execution state, including observed, modified, and attempted changes. Ledger integrates this state into agent decision-making via an *inform* pathway, which injects concise state summaries prior to action selection, and a *govern* pathway that intercepts redundant operations before execution and reuses valid prior results. Notably, this approach requires no additional language model invocations. Evaluated on SWE-bench Verified, Ledger significantly boosts performance: GPT-5 mini achieves a Pass@1 of 64.2% (up from 56.2%), while MiniMax M2.5 reaches 81.0%, all while reducing total computational cost by 28.9%β31.8%.
π Abstract
Long-horizon coding agents accumulate hundreds of actions and observations in their trajectories, yet nothing in this record indicates which observations still describe the repository as it currently stands. Before every decision, the model must implicitly infer the execution status from raw history, and when this inference falls short, the agent acts on outdated file contents or re-executes work whose results are still valid. We propose Ledger, a deterministic runtime layer that distills an agent's completed interactions into an explicit execution state: what has been observed, what has been modified, and what has been attempted. Ledger keeps this state in an online execution ledger and applies it at two boundaries of every step. Before the model acts, an inform path appends a compact runtime state view to the prompt; before a proposed command runs, a govern path checks it against the ledger, returning still-valid earlier results in place of re-execution and flagging likely-redundant repetition. The layer adds no language-model calls and wraps an otherwise unmodified agent. Across all 500 SWE-bench Verified instances, Ledger raises Pass@1 from 56.2% to 64.2% with GPT-5 mini and from 75.8% to 81.0% with MiniMax M2.5, while cutting total cost by 28.9% and 31.8%. Attached to OpenAI Codex, it adds 3.4 percentage points of Pass@1 at 24.4% lower cost. Ablations attribute most of the resolution gain to govern and most of the efficiency gain to inform, with their combination performing best. What long-horizon agents lack, we conclude, is not a shorter view of their history but an explicit account of their own execution state.