arXiv:2610.12269cs.SEOct 2026

Manuscript Offprint

arXiv:2610.12269

Cadence: Strategic Guidance for Coding Agents

Minxing Wang, He Ye, Earl T. Barr, Yintong Huo

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

MINXING WANG, Singapore Management University, Singapore

HE YE, University College London, United Kingdom

EARL T. BARR, University College London, United Kingdom

YINTONG HUO, Singapore Management University, Singapore

Runtime monitors are increasingly used to improve the reliability of LLM-based coding agents by inspecting execution trajectories and delivering corrective guidance upon detecting misbehavior. However, their effectiveness remains limited by static guidance triggering schemes. Existing monitors rely either on fixed inspection intervals, missing timely guidance during severe misbehaviors while incurring unnecessary overhead during healthy execution, or on rigid heuristic rules, failing to detect complex reasoning errors. To address these limitations, we propose Cadence, a dynamic monitoring framework that adaptively schedules inspections and delivers guidance according to the agent's real-time execution health. Cadence consists of two core modules: a two-tier intervention module and an inspection scheduler. The intervention module delivers advisory-level guidance for normal executions and minor lapses, while providing replacement-level guidance for severe misbehaviors. Driven by the intervention level, the scheduler adjusts the inspection frequency by tightening supervision after replacement-level guidance and relaxing it after advisory-level guidance. Evaluated on 300 SWE-bench Lite tasks across two distinct agents, mini-swe-agent and Moatless, Cadence achieves the highest resolve rate among all evaluated monitors. Specifically, Cadence outperforms vanilla agents by 25.33% (+76 resolved tasks) on mini-swe-agent and 15.67% (+47 resolved tasks) on Moatless, while maintaining competitive token efficiency compared to state-of-the-art baselines.

Additional Key Words and Phrases: Coding Agents, Runtime Monitoring, Large Language Models, Self-Adaptive Scheduling

1 Introduction

LLM-based coding agents have been widely applied to automate software maintenance tasks, such as bug fixing and new feature implementation [1, 29, 34, 35, 41]. Despite their promise, agents still fail in complex coding tasks, especially long-horizon ones [3, 7, 9, 25, 40].

To improve coding agents, existing work examines step-by-step agent trajectories and provides guidance to prevent error actions. This work can be divided into two categories based on the stage of guidance: offline learning and online monitoring. Offline learning relies on historical execution records to post-train the agent's backbone model [24, 33, 36, 38], or to construct a memory bank as a domain knowledge base [2, 12, 42]. However, these offline methods cannot intervene during test-time execution once an agent deviates. In contrast, runtime monitors inspect the agent's intermediate execution trace on-the-fly and inject guidance to correct misbehavior [20, 22]. Recent studies show that early mistakes propagate into cascading failures, making dynamic intervention essential to catch errors before they become unrecoverable [14, 25, 39].

Runtime monitoring approaches deploy a dedicated monitor to supervise the execution trajectory of a coding agent. By inspecting ongoing execution steps, the monitor identifies misbehaviors (i.e., error steps), and injects corrective guidance into the coding agent's context. A central challenge is deciding when the monitor should deliver this guidance. Existing approaches fall into two categories: 1) periodic guidance, which inspects progress at fixed step intervals, then prompts corrective instructions into the context [22]; and 2) rule-based guidance, which triggers on predefined heuristic

Authors' Contact Information: Minxing Wang, Singapore Management University, Singapore, mx.wang.2026@phdcs.smu.edu.sg; He Ye, University College London, United Kingdom, he.ye@ucl.ac.uk; Earl T. Barr, University College London, United Kingdom, e.barr@ucl.ac.uk; Yintong Huo, Singapore Management University, Singapore, ythuo@smu.edu.sg.

Minxing Wang, He Ye, Earl T. Barr, and Yintong Huo

rules to catch specific error patterns. When patterns appear, the monitor intervenes with operational guidance tailored to the matching failure [20].

Our preliminary study shows that neither of these static trigger mechanisms delivers guidance properly. Rule-based guidance overlooks reasoning errors, which manifest in natural language and follow no fixed misbehavior patterns. Periodic guidance, in contrast, oscillates between overguidance and under-guidance. When the coding agent only encounters minor lapses, frequent interventions add unnecessary overhead (over-guidance). Conversely, when the coding agent enters severe failure actions (e.g., repeating an invalid patch), sparse guidance fails to correct the misbehavior before it compounds irreversibly (under-guidance).

To address this, we argue that monitors must move beyond rigid schedules and simple rules and instead provide strategic guidance: an LLM-based monitoring policy that decides both when to inspect and how to intervene based on the agent's runtime execution health. Rather than treating inspection and intervention as separate decisions, strategic guidance unifies them, dynamically tuning the inspection frequency while delivering context-aware interventions tailored to the agent's evolving health status.

Guided by this principle, we propose Cadence, a holistic runtime monitoring framework for coding agents that synergizes adaptive inspection scheduling with a two-tier intervention mechanism. The first module is a two-tier intervention module, which evaluates agent's recent execution health and applies an intervention at the appropriate level: advisory or replacement. When the coding agent stays on track or exhibits minor lapses, an advisory-level intervention provides lightweight guidance while allowing the current step to proceed. When severe misbehaviors occur, a replacement-level intervention discards the erroneous step and prompts the agent to regenerate an alternative action. The second module is an inspection scheduler, which dynamically adjusts the inspection frequency based on the first module's output. Using the resulting intervention level as a direct signal of execution health, it extends the inspection interval upon an advisory intervention to reduce monitoring overhead, but resets the interval to a base value upon a replacement intervention to enforce close oversight. Together, these modules allow Cadence to adaptively balance intervention effectiveness while limiting unnecessary monitoring burden.

We instantiate Cadence for autonomous bug-fixing agents, though its strategic guidance mechanism generalizes to broader coding tasks because it does not rely on task-specific heuristics. We comprehensively evaluate Cadence on SWE-bench Lite [16] across different scaffolds and backbones. Our results show that Cadence consistently outperforms existing runtime monitors, improving the task resolve rate by 25.33% (+76 resolved tasks) over the unmonitored baselines in mini-swe-agent, and 15.67% (+47 tasks) in Moatless. Furthermore, Cadence demonstrates competitive token efficiency against existing monitors, reducing average total tokens per task to 0.48M on Moatless and 1.03M on mini-swe-agent, compared with 0.51M and 1.47M for state-of-the-art monitor.

To sum up, the main contributions of this paper are threefold:

  • We conduct a preliminary study on existing runtime monitors and find that rule-based guidance misses reasoning errors that follow no fixed pattern, while periodic guidance oscillates between over-guidance and under-guidance.

  • To the best of our knowledge, we propose Cadence, the first runtime monitor that strategically inspects and guides coding agents, by combining a two-tier intervention module and an inspection scheduler to adjust inspection frequency according to the agent's execution health.

  • We comprehensively evaluate Cadence on SWE-bench Lite, showing that Cadence improves resolve rates by up to 25.33% over vanilla coding agents while achieving up to 29.93% token savings compared with state-of-the-art monitors.

Figure

Fig. 1. Task resolve rate across different inspection intervals k for tasks resolved (n = 145) and unresolved (n = 155) by the vanilla agent. Note that the two subplots use different y-axis scales.

References (13)