Manuscript Offprint

arXiv:2610.10426

CoTrace: Data Recipes for Training Terminal Agents with Harness-Model Co-Evolution

Jixuan Chen, Jiaxin Zhang, Qinyuan Ye, Yada Pruksachatkun, Haoxiang Zhang, Jingming Zhuo, Yifan Zhang, Yutong Dai, Juntao Tan, Xiangyu Peng, Silvio Savarese, Zeyuan Chen, Lianhui Qin, Chien-Sheng Wu

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

ABSTRACT

Terminal-agent capability depends jointly on model weights and the runtime harness that formats prompts, binds tools, and handles error recovery. Existing harness-model co-evolution approaches improve both components, yet often treat trajectories produced during harness search as an undifferentiated replay buffer. This practice overlooks that a trajectory's value for model training depends on the harness under which it was generated. To systematically analyze this interface, we establish an alternating co-evolution framework that decouples harness search and policy training through component-wise promotion decisions. Within this framework, we introduce CoTrace, a harness-aware data recipe that explicitly governs trajectory routing, provenance matching, and curriculum refresh. Under CoTrace, recurring execution failures guide harness synthesis, while policy training is strictly conditioned on verified rollouts matched to the adopted runtime for supervised fine-tuning (SFT) or fresh online interactions for reinforcement learning (RL). On the Tmax promotion split, CoTrace advances Qwen3.5-9B from 78 to 88 solved tasks under supervised fine-tuning while an online reinforcement variant reaches 90. Specifically, a compact harness-matched corpus produces steady model gains at substantially lower compute than much larger corpora pooled across sibling harnesses. Furthermore, evaluations on Terminal-Bench 2.1 and SWE-bench Lite show that out-of-distribution transfer depends fundamentally on harness compatibility, where maintaining consistency between training and evaluation runtimes prevents procedural execution breakdowns observed under foreign scaffolds.

1 INTRODUCTION

Recent advances have substantially improved autonomous coding and terminal agents across complex interactive environments (Jimenez et al., 2024; Merrill et al., 2026; Ivison et al., 2026). These agents combine two inseparable components: a language model that acts as the action-selection policy and a runtime harness that formats prompts, binds tools, manages context, and recovers from execution errors (Yang et al., 2024; Wang et al., 2024c; Chen et al., 2026b). Prior research has largely optimized either component in isolation, improving agent performance through verifier-grounded policy post-training under a fixed runtime (Ivison et al., 2026; Pan et al., 2024; Wei et al., 2025) or through automated harness search with frozen model weights (Lin et al., 2026; Chen et al., 2026b; Zhang et al., 2026; Lee et al., 2026). Although recent systems interleave harness adaptation with policy training (Chen et al., 2026c; Luo et al., 2026; Chen et al., 2026a), they leave the shared data interface between the two optimizers largely implicit. Because each update changes the conditions under which subsequent trajectories are collected, alternating the two processes without an explicit data recipe creates subtle failure modes. This motivates our central question: how should execution data flow between the policy and the harness during co-evolution?

An execution trajectory has different value for the harness and the policy. Execution failures can expose missing recovery logic and thereby guide harness mutation, but they are poor targets for policy imitation. Conversely, successful executions may rely on processors specific to candidate harnesses that are later rejected; training on those trajectories can therefore mismatch the policy's

Data recipes

Figure

Figure 1: Overview of CoTrace and the shared data interface in model–harness co-evolution. Bottom: the closed loop. A task agent with the adopted harness H∗H^{*} and policy weights θ\theta solves executable terminal tasks and fills a shared history of trajectories; harness evolution reads that history to edit prompts, processors and tools and selects the next H∗H^{*}, while model training updates θ\theta before the subsequent round of search. Top: the data recipes that turn the history into model-training data, from the baseline supervised fine-tuning (SFT) recipes that pool every successful search trajectory (all-evolve) or successes across sibling candidate harnesses (mixed siblings), to CoTrace-SFT, which keeps only trajectories whose provenance matches H∗H^{*} and tops them up with fresh rollouts under H∗H^{*}, and CoTrace-RL, which learns online by reinforcement learning (RL) from rewards on frontier tasks rolled out under H∗H^{*}.

data with the deployed runtime (Tajwar et al., 2024). As the agent improves, successful rollouts also concentrate increasingly on solved tasks with diminishing learning value, while unresolved failures define a moving frontier of harder problems. Pooling all search trajectories can thus disconnect the two optimizers: in one of our experiments, harness updates add nine solved tasks, while the promotion procedure rejects every model update trained on pooled candidate successes.

We introduce CoTrace, a harness-aware data recipe that explicitly governs how execution experience is filtered, matched, and refreshed across model–harness co-evolution. Operating over an alternating search and training pipeline, CoTrace coordinates data flow through three targeted mechanisms. Route directs clustered execution failures to harness synthesis while restricting policy supervision to verified successes strictly matched to the adopted runtime, supplemented with fresh rollouts under that same harness. Ratchet attributes every accepted gain to one component by evaluating candidate harnesses under fixed weights and candidate policies under the adopted harness on a frozen promotion split. Refresh drives curriculum progression by retiring tasks only after they are both solved and incorporated into the training corpus, continuously redirecting exploration toward residual frontier tasks. On the 102-task Tmax split (Ivison et al., 2026), our default supervised recipe advances Qwen3.5-9B from 78 to 88 solved tasks across alternating updates, while an online reinforcement variant reaches a peak of 90.

We evaluate these data recipes through targeted control experiments and cross-harness evaluations to determine when search experience translates into model learning. Tracking component-wise promotion decisions and data-routing strategies reveals that raw trajectory volume alone cannot guarantee policy improvement, whereas runtime compatibility proves decisive. While pooling 149–308 successful trajectories per iteration from exploratory sibling harnesses yields zero accepted model updates, our harness-matched recipe utilizes merely 30–50 trajectories to deliver consistent gains, achieving superior performance at the lowest per-iteration training cost of 47 GPU-hours. Cross-harness evaluations further demonstrate that learned capabilities remain tightly coupled to the runtime environment, consistently improving performance under the data-generating harness while degrading under mismatched alternatives. Crucially, external evaluations on Terminal-Bench 2.1 and SWE-bench Lite show that out-of-distribution (OOD) transfer is fundamentally governed by the co-evolved model–harness pair rather than the policy in isolation, where deploying the learned checkpoint within its co-evolved runtime dramatically suppresses early execution faults and no-patch failures, effectively unlocking the policy’s underlying problem-solving capability across foreign domains without task-specific tuning.

In summary, our primary contributions are:

• An inspectable co-evolution framework that records harness and model updates separately, with trajectory provenance and component-wise promotion decisions.

• A harness-aware data recipe, combining failure routing, runtime-matched supervised trajectories, fresh generation, and curriculum refresh, evaluated against pooled search trajectories.

• An analysis of transfer across runtimes showing where checkpoint-only gains fail to carry over and where runtime changes alter execution outcomes on external benchmarks.

References (61)