Coding assistants · Research feature

Doc2Harness: Benchmarking LLMs on Long-Horizon Harness Engineering of Coding Agents

The researchers propose Doc2Harness, a two-stage benchmark that evaluates long-horizon harness engineering directly.

Adapted from research by Yuyao Ge, Shenghua Liu, Peizhong Gao and colleagues.

arXiv preprint revision · 2026-10-14 · Attribution & reuse
In this article
Editorial illustration of developer workstation.

Authors’ overview

Agents driven by large language models are increasingly deployed on long-horizon tasks, where they use tools and modify real workspaces. How well they perform depends as much on the harness around the model as on the model itself. Existing benchmarks measure downstream task success under a fixed harness, leaving harness engineering itself unexplored. We propose Doc2Harness, a two-stage benchmark that evaluates long-horizon harness engineering directly. In Stage 1, a build model operating inside a fixed builder harness receives an interface-only contract skeleton and a development document that consolidates behavior across twelve frontier harnesses, and then constructs a complete candidate harness in an isolated container. In Stage 2, the frozen candidate harness runs in containers separate from the construction environment, one per test case, and is driven end to end by a scripted mock model. We score each test case using four observable channels, namely the requests sent to the model, the files on disk, the process exit code, and the command output; positive controls rule out vacuous passes. Across nineteen frontier models, each evaluated with three independent builds on 328 test cases, GPT-6 Astra achieves the highest pass rate at 53.05%, while the weakest model reaches 27.44%, a gap of roughly twenty-six percentage points. Even the strongest model fails nearly half of the test cases, and failures cluster around how cross-cutting functionality is split across modules. To our knowledge, Doc2Harness provides the first deterministic benchmark for measuring long-horizon harness engineering.

Introduction

As coding agents driven by large language models (LLMs) become more capable, they are deployed in increasingly complex settings. The harness therefore matters more: it manages the interaction loop, tool execution, context, permissions, session state, failure recovery, and result verification, and so determines how much of the model’s capability reaches the environment. At the same time, human supervision of every agent step has become difficult. This has motivated recursive self-improvement, in which an agent modifies the infrastructure that governs its own behavior. An agent executes a task, observes the outcome, modifies its own harness, and then uses the modified harness on the next task, improving itself over time. A model’s ability to generalize this process may ultimately determine the capability of the resulting agent.

Building a harness is a type of software engineering (SWE) task, but it tests a kind of generalization that ordinary SWE tasks do not capture. At the data-source level, the open-source repositories used by SWE benchmarks are mostly mature projects that may have appeared repeatedly in training corpora. Harnesses, by contrast, have appeared only in the past few years and are updated at high frequency, so the resulting evaluation places greater emphasis on generalization. On the evaluation side, existing SWE benchmarks such as SWE-bench Pro, NL2Repo-Bench, and Commit0 judge whether the model’s output is acceptable using the interactive unit tests supplied with the task. Such criteria do not transfer directly to harnesses, for two reasons. (1) A single feature can be realized in many ways inside a harness, whereas an ordinary unit test observes behavior through a fixed interface. (2) A harness does not complete a downstream task on its own, so its correctness must be assessed by driving it with a model.

We therefore propose Doc2Harness, a two-stage benchmark for evaluating how well LLMs develop harnesses. In Stage 1, the build model under evaluation operates inside a fixed builder harness and, given a development document and a contract skeleton that declares interfaces only, constructs a complete candidate harness inside an isolated container. In Stage 2, the candidate harness is moved into isolated containers, one per test case, launched and executed end to end as a black box, with a mock model providing responses according to a preset script and each test case running the harness through one complete session. We observe four channels for each test case, namely the requests sent to the model, the files on disk, the process exit code, and the command output, and aggregate the resulting statuses into a pass rate. The build model’s ability to develop a harness is reflected indirectly in the pass rate.

Both inputs are designed to reduce reliance on parametric knowledge that the build model may already possess: the development document is rewritten from the user documentation of twelve frontier harnesses after merging and disambiguation, and the contract skeleton is distilled further from mini-swe-agent with all internal implementation removed. For Stage 2, we design several hundred test cases covering a wide range of scenarios. A test case may pass even though the feature under test never ran, a situation we call a vacuous pass; to guard against it we introduce positive controls that verify the observation preconditions. If a positive control fails, the observation precondition is not satisfied, and the test case is recorded as FAIL regardless of its own status.

Task Description

Stage 2, Evaluation. Inside containers isolated from the construction environment, one per test case, a mock model drives the candidate harness, and we determine the status of each test case in turn. Some test cases are additionally equipped with positive controls, which test whether an apparent pass reflects the required behavior rather than a failure of the observation mechanism (§2.4). A test case is recorded as PASS only when it passes on its own and every positive control gating it also passes. The build model’s ability to develop a harness is reflected indirectly through the pass rate over test cases. We therefore rank build models rather than candidate harnesses.

Each stage holds one component fixed to reduce confounding. In Stage 1, the builder harness is uniformly the open-source coding agent framework OpenCode rather than harnesses such as Claude Code or Codex CLI, because such harnesses are developed by model vendors alongside their own models and may confer an advantage on the Claude and GPT model families. In Stage 2, the mock model supplies responses according to a preset script, which avoids interference from the instability that a real LLM introduces.

Development Document

The development document is written in three steps, namely collecting a feature inventory, turning that inventory into clauses, and disambiguating so that the clauses are self-consistent. The clause is the document’s basic unit. Most clauses specify the external behavior of one feature, while the consistency rules specify relations across features and chapters.

Collecting a feature inventory. In the first phase we crawl the user documentation of twelve frontier harnesses (Claude Code, Kimi Code, Gemini CLI, Qwen Code, OpenCode, OpenClaw, Codex CLI, Aider, OpenHands, Cline, Crush, and Cursor ) and extract candidate features from it. The second phase examines each candidate feature from the first phase in greater detail, filling in invocation form, parameter semantics, and boundary behavior. The outputs of the two phases are merged, deduplicated, and pruned into one inventory of frontier-harness capabilities.

Disambiguating features. The clauses from the previous step come from twelve sources, and to avoid semantic conflicts we use the following two disambiguation rules. (1) We merge commands with overlapping semantics. For example, Claude Code names context compaction /compact whereas Cursor names it /summarize, and the development document adopts /compact. (2) We split distinct concepts that occupy the same name. Take the word plan: in Claude Code it is one of six permission modes and means read-only, whereas in Aider, proposing changes and carrying out edits are handled by two model roles, architect and editor, and Aider’s documentation instead specifies the responsibilities assigned to each role. The development document accordingly assigns the read-only constraint to permissions and responsibility for proposing and applying changes to roles, so that permissions and roles each form their own clause.

Public Issue Mining

This method rests on an assumption about the distribution of defects. LLMs are trained on code written by human developers. Mature harnesses and the harnesses written by build models face the same interface semantics and the same class of boundary conditions. We therefore expect substantial overlap between the defects mature harnesses have exposed over years of evolution and the mistakes made by the harnesses written by build models, which makes public issue records a ready source of candidates.

Collection. We pull every issue from the public repositories of four frontier harnesses (Claude Code, OpenCode, Gemini CLI, and Kimi Code); after filtering out pull requests these number 9,868, 5,438, 4,831, and 946 respectively, 21,083 in total.

Ranking and stopping. More than 20,000 records cannot be reviewed manually in full, so we first rank them by relevance to the development document. Manual review starts at the top of the ranking and stops when the marginal yield falls below the cost of further review.

Clustering. The same defect is often reported repeatedly, worded differently yet all pointing at one feature. We cluster the records we have read by the phenomenon they report, forming one candidate test case per cluster, into whose material the records of that cluster are then merged.

Single-Variable Expansion

Expansion. A test case consists of a scenario and an assertion; the scenario is the session through which the mock model drives the candidate harness, and it fixes only the setting and the flow, while the adjudication rests with the assertion. We vary only the scenario, keeping the assertion fixed. Each time we change exactly one variable of the seed scenario to obtain a new candidate, and every candidate must still be anchored to some clause of the development document. We use four variables.

Distance check. Not every modified scenario adds discriminative power beyond the seed, so we assess whether each candidate’s scenario is far enough from the seed scenario. A candidate too close to the seed is discarded; otherwise we retain it as a test case and use it as the next seed, from which the following round of single-variable expansion proceeds.

This method spreads outward from seeds, complementing the two preceding methods. A clause with no anchored test case cannot provide a seed, and such gaps can only be filled by the first two methods; the three are therefore used in alternation.

Positive Control

A test case that passes does not necessarily show that the candidate harness has implemented the requirement in question. Consider path escape: the mock model’s script has the candidate harness read a symlink pointing outside the workspace with its read tool, and the test case asserts that the external file’s content does not appear in the requests sent to the model. That the content is absent may mean the implementation blocked this out-of-bounds read, or it may mean its read tool cannot read any file at all. The assertion holds in both situations; only the former constitutes meeting the requirement, and the latter is a vacuous pass.

To rule out vacuous passes, we design the positive control mechanism. A positive control shares the scenario and the fixture with its test case, where the fixture consists of the files and initial state prepared in the workspace before a run. It changes only the input or access route, selects a case outside the constraint imposed by the clause under test, and asserts an outcome that must occur when the observation precondition holds, that is, when the effect the test case inspects is in fact observable. In the example above, the positive control reuses the same symlink, accesses it through the bash tool instead, and asserts that the external file is indeed readable.

We group test cases that share an observation precondition under one positive control, and a test case with several such preconditions is gated by several controls. If a positive control fails, the precondition does not hold, so a pass by the test cases in its group can only be vacuous and they are recorded as FAIL regardless of their own statuses. Positive controls themselves do not count toward the pass rate.

Channel. The tool’s result may never reach the channel being observed at all. A test case observes only one of the four channels; if an implementation’s read tool never places file content into a request, then the content of a file outside the workspace will not appear there either. We therefore read an ordinary file with the read tool and confirm that its content does appear in the requests sent to the model. Failure here means the implementation does not put tool results onto this channel at all, so the absence of the forbidden content does not constitute interception. The path-escape test case does not require a control of its own, because its reverse control, described below, already covers this condition.

Experimental Setup

Models under evaluation. We evaluate nineteen models drawn from eleven vendors, namely Claude Opus 4.6, Opus 4.7, Opus 4.8, and Opus 5; GPT-5.5, GPT-5.6-sol, and GPT-6 Astra; Qwen3.8 Max 0902; Kimi K3; GLM 5.2 and GLM 5.3; DeepSeek V4 Pro and DeepSeek V4.1 Flash; Hy3 and Hy4 preview; Doubao Seed 2.1 Pro; MiMo-V2.6-Flash; Grok 4.7; and Step 5 Preview.

Configuration. In Stage 1, the builder harness is OpenCode 1.17.0, installed into the build container as a single compiled executable. The builder constructs the candidate harness through OpenCode’s non-interactive entry point opencode run, with the task description supplied once on the command line. Because that entry point advances the session by only one turn per invocation, we resume the same session with —continue, as OpenCode’s official documentation describes, and supply a further prompt whenever no submission has yet been made, up to twenty-four turns or until the wall clock is exhausted. As the session approaches the context limit, the builder harness compacts the history automatically, with the trigger threshold set at eighty percent of the model’s context window. Each build is subject to a two-hour wall-clock limit and to a quota of at most three submissions, and terminates as soon as either is exhausted. In Stage 2, every test case is executed once inside its own container, on its own fixture, subject to a 900-second limit beyond which execution is terminated and the test case recorded as FAIL.

Architecture of the Candidate Harnesses

This section analyzes the source code of the fifty-seven scored candidate harnesses. A module is a Python source file under the root of a candidate harness and a code line is a non-blank line; we define a category as having a dedicated module when at least one module filename contains a keyword associated with that category.

Harness Benchmarks

A harness is a class of software whose functional surface can be enumerated feature by feature. This makes it a suitable target for a construction benchmark. Most harness benchmarks evaluate existing harnesses. Claw-SWE-Bench fixes the prompt, budget, workspace, and evaluator, and finds that the choice of harness shifts scores by 27.4 points, compared with 29.4 points for the choice of model; Harness-Bench isolates configuration-level effects over 106 sandboxed tasks and concludes that ability should be reported at the model–harness configuration level rather than attributed to the base model alone.

Other benchmarks hold the harness fixed and evaluate a single capability of it, such as rule compliance across the surfaces an agent reads, skill retrieval under progressive disclosure, component-lifecycle reasoning, or safety along a policy ladder and across persistent carriers. Still others let the given harness change from stage to stage and ask whether the agent keeps pace.

A further line of work asks a model to produce or revise the harness itself, starting from an existing harness and its execution feedback; because gains are measured on downstream tasks, they cannot be separated from those obtained by simply allowing more test-time search, a confound noted in this literature. All of these studies infer harness quality from downstream tasks. Such tasks must be prepared in advance, and the ability of the model that drives them also influences the measured score. Nor is output-only scoring sufficient, since a harness can return a correct and harmless answer along a trajectory that reached unauthorized resources, and output-level evaluation cannot see failures of that kind. None of them adjudicates, clause by clause, whether a harness’s own behavior conforms to a specification.

Position of This Work

Doc2Harness differs from the work above in three respects. First, the target deliverable does not correspond to any existing implementation: the development document consolidates the functionality of twelve frontier harnesses into a self-consistent set of clauses, whereas prior repository-level deliverables are reconstructions of something already published. Second, the candidate harness is driven by a mock model following a preset script rather than by a real model on downstream tasks, so the evaluation is deterministic and what is judged is the candidate harness itself. Third, the candidate harness is executed end to end as a black box through a complete scripted session, with effects read from four channels. This makes constraints of the form “a rejected operation must not take place” adjudicable clause by clause; and because an assertion requiring some effect not to appear may hold simply because the feature under test never ran, such test cases are equipped with positive controls confirming that the observation precondition holds. In sum, Doc2Harness is the first benchmark able to assess deterministically how well a model develops a harness.

Limitations

The protocol measures a single build. Each build allows up to three submissions and is not an iterative build–evaluate–repair loop. The contract check tests form rather than behavior, so the amount of revision a candidate harness receives depends on when the model submits, and the pass rate of an early submitter is a lower bound rather than an upper bound. The protocol does not measure improvement based on behavioral feedback after the candidate harness is frozen.

A single defect can fail several test cases at once. Some test cases are built around the same feature: the single-variable expansion of §2.3.3 derives several variants from one seed test case, and although the distance check discards candidates too close to their seed, the variants that remain are still correlated. A single defect can therefore cause correlated failures across these variants.