arXiv(opens in a new tab)cs.AIOct 2026Cited by 2 papers on PaperVantage

Manuscript Offprint

arXiv:2610.02826

Scaling Trajectories for Complex Tasks through Recursive Self-Rewrite

Zongxia Li, Yucheng Shi, Zhongzhi Li, Junyao Yang, Ruhan Wang, Chengsong Huang, Fuxiao Liu, Haitao Mi, Jordan Boyd-Graber, LeoweiLiang

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

Zongxia Li †1,2^{\dagger 1,2}, Yucheng Shi †1^{\dagger 1}, Zhongzhi Li †1,3^{\dagger 1,3}, Junyao Yang 1,4^{1,4}, Ruhan Wang 1,5^{1,5}, Chengsong Huang 6^{6}, Fuxiao Liu 2^{2}, Haitao Mi 1^{1}, Jordan Boyd-Graber 7^{7}, LeoweiLiang 1^{1}

1^{1}Tencent HY LLM Frontier 2^{2}University of Maryland, College Park 3^{3}University of Georgia 4^{4}National University of Singapore 5^{5}Indiana University

6^{6}Washington University in St. Louis 7^{7}Nanyang Technological University

†^{\dagger} Core contribution.

zli12321@terpmail.umd.edu, zhongzhili@global.tencent.com

Successful trajectories on difficult tasks are valuable supervision for model improvement. Different harnesses enable the same model to solve these tasks in different ways. Their successful trajectories provide useful experience for self-improvement, but they also contain controller interventions and workflow conventions that may be unavailable under a general harness. We propose RECURSIVE SELF-REWRITE (RSR), a framework that converts these experiences into reusable model capabilities through recursive trajectory self-rewrite. We use a single base model, Qwen-3.8-27B to discover successful solutions under diverse harnesses and rewrite them for learning under a general harness. RSR contains a planner that extracts useful procedures into runbooks, a critic that screens for verifier and solution leakage, and rejects candidates and recursively regenerate using critique feedback, and an executor that follows the qualified runbooks to solve each task in a fresh sandbox under a general harness. We show that using three harnesses expands the range of task domains that Qwen-3.8-27B can solve and yields more valuable successful trajectories; with RSR, we further reconstruct these into a larger set of high-quality trajectories. We collect experience from approximately 3K self-curated terminal tasks. Across 3K tasks, the union of the three harnesses solves 759 tasks, which is 34.3% more than the strongest individual harness in the recorded pool. We further use RSR to rewrite successful source trajectories, expanding the training set from 2,001 to 11,094 high-quality trajectories for finetuning Qwen-3.8-27B. Training it on these rewritten trajectories outperforms both the base model and direct trajectory SFT: pass@3 increases from 57.0% to 74.2% on Terminal-Bench 2, from 1.5% to 9.1% on Terminal-Bench 4, from 39.0% to 63.0% on our self-curated Terminal-Bench Hard, and from 3.0% to 6.0% on our Software Terminal-Bench. On Long-Horizon Terminal-Bench, process reward rises from 0.21 to 0.29.

https://huggingface.co/IntelligenceLab/RSR-27B

Success experiences

one model, diverse harnesses

Recursive Planning

planner and critic loop until the runbook is clean or N iterations

Re-learn experience

solved again alone, general harness, fresh sandbox

Figure

different harnesses solve different tasks

draft 1 × → draft 2 × → draft 3 ✓ accepted

passing attempts are kept as new success experiences

one success becomes many, up to K×MK \times M

Recursive planning turns successful experience into new practice. Diverse harnesses discover source successes. Planner-critic feedback refines runbooks within a retry budget; each screened runbook guides fresh executions under a general harness. Rewritten trajectories are verified and filtered before training. Commands and draft numbers are schematic examples.

Date: October 5, 2026

1 Introduction

Human progress advances by turning experience into knowledge that others can reuse and by discovering new solutions. Researchers approach problems with different tools, methods, and prior knowledge, producing successes, failures, and practical lessons. These lessons are organized into papers and textbooks so that later generations can learn from them without repeating the entire discovery process. We argue that AI agents can undergo a similar process through self-improvement, turning successful experience into reusable capability.

A model’s capabilities depend not only on the model itself, but also on the harness through which it acts. A harness determines how the model receives observations, invokes tools, tracks progress, verifies intermediate results, recovers from failure, and decides when to stop [36]. A growing body of work shows that improved harnesses can substantially increase terminal-task performance without updating model parameters [8, 9, 14]. In some settings, stronger harnesses even enable weaker models to match or surpass stronger models, as demonstrated on terminal benchmarks and game-playing tasks [16, 26]. Different harnesses encourage different behaviors and are often effective for different task domains [4, 32, 36]. For example, coding-oriented harnesses such as Codex [22] and Claude Code [1] are designed for coding tasks, goal-driven loops promote long-horizon exploration through repeated continuation [2], and StateM structures execution around explicit states and validated transitions [26]. As a result, different harnesses can solve complementary subsets of tasks, and access to multiple harnesses expands the set of tasks a model can solve (Section 3.3). When a model solves additional tasks under different harnesses, the resulting successful trajectories reveal behaviors and strategies that would not emerge under a single general-purpose harness, which these trajectories provide supervision for improving the model itself.

However, naively training on trajectories collected from different harnesses can introduce substantial distribution mismatch. Each trajectory reflects the joint behavior of the model and its source harness, including controller interventions, task-specific prompts, workflow logic, and stopping rules. Simply pooling these trajectories can mix harness-specific conventions rather than isolate the underlying problem-solving behaviors that made the solutions successful [30]. As a result, a model trained on such data may rely on external control patterns that will be unavailable under a general harness at inference time. Effective self-improvement requires preserving useful planning, verification, recovery, and continuation behaviors while rewriting them into trajectories that are compatible with the general harness the model will ultimately use.

We propose RECURSIVE SELF-REWRITE, a framework for self-improvement through multi-harness trajectory rewriting into a general harness, as shown in the opening illustration. RECURSIVE SELF-REWRITE first uses distinct harnesses to collect more diverse successful solutions across complementary parts of the task distribution. It then rewrites each solution using the same base model in three roles: a planner reconstructs the solution as a runbook that captures the key steps, checks, and recovery strategies: a critic removes verifier leakage and solution leakage, and an executor then follows the accepted runbook to solve the task again in a fresh sandbox under the general Terminus 2 harness [5]. We generate multiple runbooks and executions for each source solution and retain only passing trajectories through rejection sampling. The entire pipeline uses a single base model, Qwen-3.8-27B [27] end-to-end.

We use an internal RST pipeline [11] to automatically curate ~3K difficult terminal tasks, which spans 50+ domains including e.g., Science, Software, Hardware, Data. We use Terminus 2, StateM [26], and Recursive Self-Reflect Terminus (RSRT) as discovery harnesses to collect approximately 2K successful trajectories covering 759 unique tasks. These harnesses solve complementary subsets of tasks and broadens the range of successful experiences available for solving tasks. We then apply RECURSIVE SELF-REWRITE with multiple executions per passing trajectory and generate approximately ~10K verified trajectories for supervised finetuning. Our results show that training on the rewritten trajectories improves Qwen-3.8-27B over Direct SFT by 20.8, 4.1, 4.6, 7.0, and 3.0 percentage points in pass@3 on Terminal-Bench 2 (TB2), Terminal-Bench 3 (TB3), Terminal-Bench 4 (TB4), Terminal-Bench Hard (TBH), and our Software Terminal Bench 100 (SWR 100), respectively. Mean per-run pass rates also improve on all five benchmarks, while process reward on Long-Horizon Terminal Bench (LHTB) increases from 0.25 to 0.29. RECURSIVE SELF-REWRITE show that different harnesses are not only useful as inference-time controllers, but also as tools for discovering experiences through which a model

Figure

Figure 1 Turning multi-harness successes into learning experiences with Recursive Self-Rewrite. Different discovery harnesses enable the same model to solve more difficult tasks. RECURSIVE SELF-REWRITE rewrites these harness-assisted solutions into demonstrations under a general harness, allowing the model to learn from successful experiences that a single harness alone would not produce.

can improve its own general-purpose policy.

References (34)