Source-linked AI summary

Terminal-Universe: Turning Agent Trajectories into Scalable Terminal Environments

Jie Wu, Zhenru Zhang, Beichen Zhang, Xuwu Wang, Yuhui Su, Mouxiang Chen, Peng Wang, Zhihai Wang, Que Shen, Hao Zhou, An Yang, Fei Huang, Yujiu Yang, Dayiheng Liu

arXiv:2609.04148v1cs.AIcs.CL

TL;DR

Terminal-based agents generate many trajectories, but realistic executable environments remain scarce and are more reusable for post-training. Terminal-Universe reconstructs environments from trajectory operations, re-queries them into verified tasks across workspaces and rounds, and improves benchmark performance after fine-tuning.

  • Problem

    Realistic, executable environments are scarce, whereas trajectories are fixed demonstrations that cannot support repeated solving or independent verification.

  • Method

    Terminal-Universe replays trajectory file operations, uses agentic completion to restore missing workspace context, and synthesizes verified tasks for original intent, individual workspaces, dependent workspaces, and multi-round sessions.

  • Results

    37.3k task-sufficient environments are produced, and Qwen3.5-27B fine-tuning improves Terminal-Bench 2.1 by 11.9 points and EvoCode-Bench v2 MT@4 by 13.8 points.

  • Takeaways & Limitations

    Recorded terminal-agent trajectories can be repurposed as reusable execution environments and training data for both single-round and multi-round terminal-agent tasks.

  • Takeaways & Limitations

    Standard Ubuntu 24.04 containers reduce fidelity for specialized dependencies or complex compilation, and coverage is bounded by source-trajectory distributions.

Abstract

from arXiv · show

As terminal-based code agents become prevalent, agent trajectories have accumulated at scale, while realistic, executable environments remain scarce. However, environments are what agent post-training actually requires: each can be re-queried into many verifiable tasks and provides execution feedback, whereas a trajectory is a single frozen demonstration. Rather than generating environments from scratch, we observe that the tool-execution history in existing trajectories exposes the structure and contents of the environments in which they ran, making it possible to reconstruct those environments from the trajectories themselves. Thus, we introduce Terminal-Universe, a framework which turns each trajectory into a reusable environment and explores it for synthesizing new tasks and continued interactions. Specifically, Terminal-Universe replays the file operations recorded in a trajectory to restore each file before the agent modified it, yielding a partial workspace; a completion agent then supplies the missing files and dependencies. On this recovered workspace, we both reconstruct the original intent task and synthesize entirely new ones. Besides, we also scale the tasks along two complementary axes: breadth and depth. For breadth, we mine directional dependency relations between related environments and synthesize cross-workspace queries spanning multiple codebases, as developers routinely do in real-world development. For depth, we extend the initial single-turn query into a multi-round session that captures iterative user feedback and requirement refinement via a user agent. Applied to public terminal agent trajectories, Terminal-Universe produces 37.3k task-sufficient environments. Supervised fine-tuning of Qwen3.5-27B on this corpus improves single-round performance on Terminal-Bench 2.1 by 11.9 points and multi-round performance on EvoCode-Bench v2 MT@4 by 13.8 points.

1 Introduction

Terminal-Universe treats recorded terminal-agent trajectories as recoverable, reusable environments rather than fixed demonstrations. It reconstructs workspaces, re-queries them into verified tasks, and improves downstream terminal-agent performance.

  • Motivation: Realistic, executable environments are scarce, while trajectories are fixed records whose code changes cannot be independently verified or re-queried.Environments support repeated solving, testing, and harder tasks on the same workspace, making them more useful for post-training.
  • Environment reconstruction: Terminal-Universe reconstructs reusable environments from trajectory tool calls instead of requiring the original repository or generating environments from scratch.Read, Write, and Edit operations expose workspace contents and changes that can be replayed.
  • Environment reconstruction: Deterministic replay restores pre-edit file states, after which an agentic completion stage supplies missing files and dependencies without leaking the solution.Replay produces a partial workspace; completion makes the recovered task executable.
  • Empirical validation: 37.3k task-sufficient environments are produced, while Qwen3.5-27B fine-tuning improves Terminal-Bench 2.1 by 11.9 points and EvoCode-Bench v2 MT@4 by 13.8 points.Ablations also report that re-solving in reconstructed environments far outperforms imitating raw trajectories.
  • Re-querying: The framework combines original-intent recovery with Single-WS, Cross-WS, and Multi-Round task synthesis across within-workspace, cross-workspace, and iterative-query settings.Every generated task is paired with an agent-authored verifier, and only passing trajectories are retained.

2 Related Work

Prior environment-scaling methods recover repository states, perturb working workspaces, or generate task-environment pairs from specifications. Terminal-Universe instead builds environments from trajectories while adding both cross-workspace breadth and multi-round depth.

  • Environment scaling: Repository-based methods form repair tasks by rolling real repositories back to states before historical fixes and reusing associated tests.Their task range is bounded by available repositories and historical bugs.
  • Environment scaling: Perturbation methods inject bugs or failures into functioning repositories or CLI workspaces and ask agents to repair them.This route remains constrained by the kinds of failures that can be injected.
  • Task synthesis: Task-conditioned synthesis jointly generates tasks and environments from categories, compositional axes, skill taxonomies, or skill graphs.These methods offer coverage control but may produce small, tidy workspaces whose realism depends on generation.
  • Task synthesis: Environment-grounded methods derive tasks from working code, project context, documentation, real issues, or shared realizations of instructions, solutions, and verifiers.RST recursively expands verified seeds by lengthening solutions and realigning tasks, verifiers, and environments.
  • Terminal-Universe: Terminal-Universe differs by constructing environments from recorded trajectories and scaling tasks along both breadth through Cross-WS synthesis and depth through Multi-Round queries.This positioning is stated explicitly in the comparison with representative methods.

3 Terminal-Universe

Terminal-Universe reconstructs executable workspaces from trajectories, filters them for task sufficiency, and re-queries them through intent recovery, within-workspace, cross-workspace, and multi-round mechanisms.

  • Environment Reconstruction: Trajectory recovery is lossy because unaccessed files, implicit dependencies, and external network resources leave no direct trace.The framework addresses this with deterministic replay, agentic completion, and sufficiency filtering.
  • Environment Reconstruction: Deterministic replay processes chronological read, write, and edit operations to recover earliest and latest observed file states, producing a partial initial workspace.Only paths exposed by the trajectory can be reconstructed directly.
  • Environment Reconstruction: Agentic completion creates missing files, completes partial files, and restores dependencies needed to make the recovered task solvable without implementing it.The resulting completed workspace is denoted bE.
  • Environment Reconstruction: Environment filtering retains only completed workspaces whose source, configuration, data, and structure provide enough context for a capable agent to perform the recovered task.An agentic judge makes the sufficient-or-insufficient decision using read-only shell and file tools.
  • Re-querying: The four re-querying mechanisms recover original tasks, synthesize novel Single-WS tasks, connect dependent workspaces through Cross-WS, and extend queries through Multi-Round sessions.Cross-WS expands breadth; Multi-Round expands depth.
  • Single-workspace synthesis: Single-WS generation inspects each workspace, creates five grounded and verifiable candidates, and randomly selects one valid candidate for rollout and verification.The constraints include groundedness, structural diversity, and verifiability.
  • Cross-workspace synthesis: Cross-WS synthesis profiles workspaces, mines directional dependency edges, and pairs a writable target with a read-only reference whose capability fills a target gap.The solver must navigate and adapt the reference implementation rather than receiving its internal details.
  • Multi-round continuation: Multi-Round continuation preserves the workspace while a user agent tracks evolving requirements, generates round-level tests, and issues extensions, revisions, or conflicts.The 3,079 retained records average 4.51 rounds, and 69.6% include a failure subsequently repaired.

4 Data Construction at Scale

Terminal-Universe scales reconstruction from diverse terminal trajectories into task-sufficient environments, enriching replayed workspaces and filtering them for downstream synthesis. The resulting corpus supports multiple task variants and spans diverse languages and domains.

  • 68,263 reconstructed environments are produced from diverse terminal-style CLI and software-engineering trajectories after retaining viable seeds and filtering Terminal-Bench-derived sources.Viable seeds contain at least 5 files and 100 lines at the end of execution; source breakdowns and selection statistics are reported separately.
  • 4.2 Reconstruction Statistics: Agentic completion increases mean workspace size from 2.9 to 22.4 files after replay withholds solution files generated during the original rollout.Completion expands contextual breadth even for SWE seeds originating from richer repository states.
  • 4.2 Reconstruction Statistics: 37,273 fully sufficient environments remain after contamination filtering, repository-level deduplication, and task-grounded sufficiency assessment.The assessment covers 38,294 terminal environments and 1,900 SWE repositories using one representative reconstruction per repository.
  • 4.2 Reconstruction Statistics: The reconstructed terminal pool is diverse: Python is the primary language in 84.7% of workspaces, while data processing, DevOps, and security exceed 80% of technical domains collectively.C++ and C are also represented among the primary languages.
  • 4.3 SFT Corpus Composition: Verifier-filtered synthesis yields 31,977 SFT demonstrations across Single-WS, Cross-WS, and Multi-Round variants, totaling approximately 1.42B training tokens.The records comprise 25,386 Single-WS, 3,512 Cross-WS, and 3,079 Multi-Round trajectories.

5 Experiments

Experiments fine-tune Qwen3.5-27B on Terminal-Universe data and evaluate it under single-round and multi-round terminal-agent settings. The full mixture improves both Terminal-Bench and EvoCode-Bench performance over the base model.

  • 5 Experiments: Qwen3.5-27B fine-tuning uses two SFT epochs, a 7 × 10−6 constant learning rate, global batch size 256, and 256k-token sequences.A 13-gram contamination check excludes Terminal-Bench-derived source datasets from all four re-querying variants.
  • 5 Experiments: The single-round evaluation uses Terminal-Bench 2.0 and 2.1 with Claude Code and Terminus2 under long-context, high-turn, and bounded wall-clock configurations.Reported scores are mean pass rates over six independent runs.
  • 5 Experiments: The multi-round evaluation uses EvoCode-Bench v2, containing 26 coding tasks and 227 rounds with persistent workspaces, sessions, and cumulative verifiers.Each task contains 5–15 requests per task, and evaluation allows up to 10 hours per stateful task.
  • 5.2 Main Results: 58.1% on Terminal-Bench 2.1 (+11.9 over base) is reached by the Full Mixture under Terminus2-XML.The same model reaches 52.8% on Terminal-Bench 2.0 (+11.2 over base) under the same setup.
  • 5.2 Main Results: MT@4 rises from 6.3 to 20.1 on EvoCode-Bench v2, while Case score rises from 67.8 to 76.1 after Full Mixture training.These results evaluate persistent tasks with cumulative requirements.

6 Analysis and Ablation Studies

The ablations show that reconstructing and re-solving tasks, completing partial workspaces, filtering verifier-failed data, and expanding task breadth and depth each affect training value. Across matched comparisons, richer environments and grounded feedback generally provide stronger supervision than replaying or repeating data.

  • 6.1 Task Re-solving: Intent Recovery averages 52.1 on Terminal-Bench 2.1, versus 36.7 for source-trajectory SFT.Intent Recovery uses a stronger teacher to re-solve recovered tasks in reconstructed workspaces, while source SFT preserves original behavior.
  • 6.2 Impact of Agentic Completion: Agentic completion raises Intent Recovery performance by 4.2 points, from 48.7 to 52.9, while reducing run-to-run variation from ±3.5 to ±1.4.The completed and replay-only variants use closely matched training volumes and otherwise share recovered queries and teacher configuration.
  • 6.3 Verifier Filtering: Verifier filtering is most valuable for harder Cross-WS tasks, where the passed subset reaches 55.4 versus 53.2 for all trajectories using less than half the data.On Single-WS data, the verifier-passed subset performs similarly to the full corpus, at 56.4 versus 56.0.
  • 6.4 Breadth: Cross-WS data raises Terminal-Bench 2.1 performance from 56.4 to 58.4 when added to Single-WS training under Terminus2-XML.Cross-workspace tasks require reconciling information across related codebases and produce longer, more complex trajectories than Single-WS tasks.
  • 6.5 Depth: Multi-Round data raises EvoCode-Bench v2 MT@4 from 18.4 to 21.0 and Case score from 71.9 to 76.9.Removing round-level verifier feedback reduces MT@4 by 2.2 points and Case score by 3.7 points, making continuation longer but lower quality.
  • 6.6 Scaling Allocation: Environment expansion produces the largest movement under a matched budget, increasing performance from 53.2 to 56.0, while adding queries or solutions leaves scores near 53.8 and 53.9.The comparison suggests that distinct executable contexts provide more new supervision than repeated queries or solutions on the same workspace.
  • 6.7 Cross-domain Generalization: SWE-derived Intent Recovery trajectories improve Terminal-Bench average performance from 47.0 to 50.0 across 1,464 task-sufficient repositories.Both evaluation scaffolds improve: Claude Code from 47.8 to 50.6 and Terminus2-XML from 46.2 to 49.4.

7 Discussion and Limitations

Terminal-Universe’s scalability depends on the richness of source trajectories and remains bounded by environment fidelity, source coverage, and teacher reliability. The framework appears better suited to settings represented in collected trajectories and supported by standard containerized dependencies.

  • Discussion: Richer source trajectories correlate positively with the complexity of rollouts synthesized in reconstructed environments.Multi-file manipulations and long tool-use chains expose broader workspace state for subsequent synthesis.
  • Limitations: Standard Ubuntu 24.04 containers may reduce fidelity for tasks requiring specialized system dependencies or complex compilation steps.The paper does not build tailored repository-specific environments.
  • Limitations: Reconstructed workspace coverage is bounded by the domain, language, and toolchain distributions of collected source trajectories.Expanding beyond these distributions remains future work.
  • Limitations: Using one teacher for tasks, solutions, and verifiers may limit task coverage and allow solution errors to escape detection.The paper proposes multiple teachers and an independent verifier model as a future direction.

8 Conclusion

The paper concludes that recorded agent trajectories can be converted into reusable execution environments rather than treated only as fixed demonstrations. Deterministic replay, agentic completion, and multi-axis re-querying support grounded task synthesis and improve terminal-agent training outcomes.

  • 8 Conclusion: Terminal-Universe reframes recorded trajectories as recoverable, reusable execution environments.The framework turns latent workspace state into a resource for subsequent interaction and task generation.
  • 8 Conclusion: A two-stage process combines deterministic replay with agentic completion before synthesizing tasks within workspaces, across workspaces, and across rounds.These stages support single-workspace task generation, cross-workspace breadth, and multi-round depth.
  • 8 Conclusion: Verifier-selected Single-WS, Cross-WS, and Multi-Round trajectories improve both single-round and multi-round terminal-agent performance.The conclusion presents these results as evidence that trajectories can be repurposed into interactive execution environments without constructing environments from scratch.

A Data Sources and Selection

The data pipeline reconstructs environments from normalized file-operation evidence, completes missing context, and screens workspaces for task sufficiency. It excludes sources whose trajectories expose too little usable project state and checks completion quality for solution leakage.

  • Data Sources and Selection: Reconstruction eligibility depends on exposed file evidence: multi-file editing traces provide more rebuildable context than command-heavy CLI traces.Terminal-Bench-derived corpora and sources dominated by view-only operations or unsupported action formats are excluded.
  • Environment Reconstruction: Source corpora are normalized into ordered read, write, and edit events, retaining pre-change or read-only contents while excluding agent-created files and later changes.Observed contents may be partial or truncated, so replay produces only a partial workspace.
  • Environment Reconstruction: The completion agent fills missing files, partial files, and dependencies without implementing the requested task or revealing where the solution belongs.It receives the recovered request, partial workspace, and file inventory.
  • Completion Quality: 22 of 30 manually inspected completions contained only task-relevant support files, and none contained task solutions.Eight completions introduced substantial unnecessary files or code.

B.2 Workspace Sufficiency Evaluation

Workspace sufficiency is evaluated by an agentic judge that inspects reconstructed workspaces and retains only those exposing enough project-specific context for their tasks. The section also defines task generation constraints and verification practices for producing grounded, deterministic terminal tasks.

  • Workspace Sufficiency Evaluation: The agentic judge inspects each workspace with read-only shell and file tools, then labels it sufficient or insufficient for the recovered task.Evaluation considers source, configuration, data, and structure rather than build success.
  • Workspace Sufficiency Evaluation: Sufficiency rates depend on how much project context trajectories expose, because completion can add common files but cannot recover unseen project-specific content.Some SWE subsets are too small for fine-grained comparison.
  • Workspace Sufficiency Evaluation: A sufficient workspace contains enough project-specific context for a capable agent, while recoverable third-party packages, caches, generated outputs, and optional documentation may be absent.Critical task-referenced files, modules, data, configuration, or structure must not be absent, skeletal, or inconsistent.
  • Task Synthesis: Single-WS synthesis inspects targeted repository files and selects grounded tasks that are deterministic, nontrivial, repository-dependent, and independently verifiable.Candidates are rejected when they are documentation-only, broad, flaky, externally dependent, or reveal the implementation.
  • Verification: The generated test suite evaluates resulting product behavior with independently computed expectations, using focused tests for each requirement and no more than 18 tests.Preservation tests may use current observed behavior as a baseline, but new-behavior expectations cannot be derived from the incomplete implementation.

E.2 Cross-WS Synthesis

Cross-WS synthesis connects related workspaces through directional capability gaps, using a reference implementation to ground a new task in a target codebase. The RSA example illustrates how the method exposes a missing decryption capability, while Multi-Round continuation uses verifier feedback to revise and extend requirements.

  • Cross-WS Synthesis: Cross-WS synthesis profiles workspaces, retrieves technically similar pairs, and uses an LLM judge to identify target capabilities missing from a reference workspace.The resulting directional dependency determines which cross-codebase capability to request.
  • Cross-WS Synthesis: The RSA pair selects decryption because the target provides key generation, encryption, and signing while the reference implements the complete round trip.The reference supplies implementation details such as the private-key loader, decrypt call, padding mode, and input paths.
  • Cross-WS Synthesis: The cross-workspace layout mounts repo0 and repo1 under /app/workspaces, with a writable target, a read-only reference, and verification that the reference remains unchanged.The example’s target is repo1 and the reference is repo0.
  • Multi-Round Synthesis: Multi-Round continuation uses private verification to request corrections or compatible extensions while keeping tests and verifier results hidden from the coding agent.Requests preserve active requirements unless an explicitly permitted conflict replaces one.
  • Multi-Round Synthesis: A controlled conflict changes alerts.json from a per-run snapshot into an append-only history while preserving specified exit codes, timestamps, and severity.The revised history requirement governs subsequent reporting, reconciliation, and repair rounds.

F SFT Dataset Statistics

The final SFT corpus statistics report turns, tool calls, and tokens as per-record medians after length filtering. Multi-Round records are substantially longer because they extend completed sessions with follow-up requests.

  • SFT Dataset Statistics: The final SFT corpus statistics are reported after length filtering, with turns, tool calls, and tokens summarized as per-record medians.These statistics are presented in Table 19.
  • SFT Dataset Statistics: Multi-Round records are substantially longer than other records because they append follow-up user requests to completed sessions.The added turns capture continued interaction rather than a single completed exchange.

G Evaluation Configurations

Evaluation configurations are reported for Terminal-Universe-27B and five reproduced open-weight baselines. Settings generally apply to both benchmarks, with model- and benchmark-specific exceptions documented for TMax-27B and related scores.

  • Evaluation Configurations: Table 20 lists configurations for Terminal-Universe-27B and five reproduced open-weight baselines used in the evaluation.The configurations are reported for comparison across the reproduced systems.
  • Evaluation Configurations: The listed settings apply to both Terminal-Bench 2.1 and EvoCode-Bench v2 unless otherwise noted.TMax-27B has a configuration applying only to the EvoCode-Bench v2 reproduction, while its Terminal-Bench scores and scaffold follow the original report.
Loading 2609.04148v1…