File size: 8,681 Bytes
2ef5cbd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f4533f6
 
 
 
 
2ef5cbd
 
 
 
 
 
 
 
 
f4533f6
2ef5cbd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f4533f6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2ef5cbd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
---
license: apache-2.0
pretty_name: Doc2Harness
language:
- en
task_categories:
- text-generation
tags:
- code
- agents
- coding-agents
- harness-engineering
- benchmark
- llm-evaluation
size_categories:
- n<1K
configs:
- config_name: scenarios
  default: true
  data_files:
  - split: test
    path: data/scenarios.jsonl
- config_name: leaderboard
  data_files:
  - split: test
    path: data/leaderboard.jsonl
---

<p align="center">
  <a href="https://geyuyao.com/doc2harness/"><img src="assets/logo.png" alt="Doc2Harness" width="420"></a>
</p>

<h3 align="center">Benchmarking LLMs on Long-Horizon Harness Engineering of Coding Agents</h3>

<p align="center">
  <a href="https://geyuyao.com/doc2harness/">🌐 Project page</a> β€’
  <a href="https://arxiv.org/abs/2610.20344">πŸ“„ Paper</a> β€’
  <a href="https://github.com/YuyaoGe/doc2harness">πŸ’» Code</a>
</p>

Doc2Harness measures how well a model can **build a working coding agent harness**
from a development document, rather than how well it writes a patch inside an
existing one.

- **Stage 1, build.** A build model, working through a fixed builder harness
  (OpenCode) in an isolated container, receives a development document and an
  interface-only contract skeleton, and implements a complete candidate harness.
- **Stage 2, evaluate.** 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**. Each test case is judged on four
  observable channels (requests sent to the model, files on disk, process exit
  code, command output), and **positive controls** rule out vacuous passes.

<p align="center">
  <img src="assets/pipeline.png" alt="Doc2Harness pipeline" width="92%">
</p>

> [!NOTE]
> **This is a partial release.** The full benchmark in the paper has **328 test
> cases**. This dataset releases the same public subset as the
> [GitHub repository](https://github.com/YuyaoGe/doc2harness): **94 scenarios**,
> i.e. 53 scored test cases plus the 41 positive controls that gate them. The
> remaining test cases are held out. The leaderboard numbers come from the full
> suite and cannot be reproduced from this subset alone.

> [!IMPORTANT]
> Doc2Harness is an **executable** benchmark. The `scenarios` and `leaderboard`
> configs are for browsing and analysis; `load_dataset` alone does not score
> anything. To score a harness, use the full evaluation code shipped in
> [`code/`](#run-the-benchmark) (a snapshot of the
> [GitHub repository](https://github.com/YuyaoGe/doc2harness)) with Docker.

## Contents

| Path | What it is |
|---|---|
| `data/scenarios.jsonl` | The 94 public scenarios, one per row (config `scenarios`) |
| `data/leaderboard.jsonl` | Pass rates of 19 frontier models on the full 328-case suite (config `leaderboard`) |
| `development_document/functional_spec_v6.md` | The development document given to the build model in Stage 1 |
| `contract_skeleton/` | The interface-only contract skeleton (CLI, headless entry point, evaluation API), plus `AGENT_CONTRACT-v2.md` |
| `code/` | Full evaluation code: Stage 1 build pipeline and Stage 2 framework (catalog, drivers, mock gateway), identical to GitHub commit [`5411f53`](https://github.com/YuyaoGe/doc2harness/tree/5411f53d497a6c76c1dd41bd55f08cc033203d2b) |

## Usage

```python
from datasets import load_dataset

scenarios = load_dataset("YuyaoGe/doc2harness", "scenarios", split="test")
leaderboard = load_dataset("YuyaoGe/doc2harness", "leaderboard", split="test")

scored = scenarios.filter(lambda r: r["scored"])
print(len(scenarios), len(scored))   # 94 53
```

The development document and the skeleton are plain files:

```python
from huggingface_hub import snapshot_download

path = snapshot_download("YuyaoGe/doc2harness", repo_type="dataset",
                         allow_patterns=["development_document/*", "contract_skeleton/**"])
```

## Run the benchmark

**Requirements:** Python 3.11+ and Docker. Both stages use the standard library only.

```bash
pip install -U huggingface_hub
hf download YuyaoGe/doc2harness --repo-type dataset --include "code/*" --local-dir doc2harness
cd doc2harness/code

# sanity check: loading the catalog verifies its digests
PYTHONPATH=src python3 -c "from doc2harness.benchmark.dispatch import active_scenario_ids as a; print(len(a()))"
# 94
```

**Stage 2 only: score an existing harness.** No model key is needed; scenarios
drive the product against a mock gateway.

```bash
docker build --target evaluation -t doc2harness/evaluation:candidate -f containers/Dockerfile .

PYTHONPATH=src:tools:run python3 tools/run_production_catalog.py \
  --artifact /path/to/product --artifact-id my-product \
  --output /tmp/scores --concurrency 12 --timeout 300
```

Each scenario writes a JSON receipt, plus a `catalog_receipt.json`. The score is
`pass / (pass + fail)` over applicable scenarios; a scenario that cannot be
observed on a product is `INCONCLUSIVE`, not a failure. Narrow the selection
with `--family headless` or `--scenario-id <id>`.

**Stage 1: build a new harness, then score it.** This needs the builder image
and a local LiteLLM gateway holding your own API key; see
`code/src/stage1/README.md`.

```bash
docker pull ghcr.io/yuyaoge/doc2harness-builder:latest
PYTHONPATH=src python3 src/stage1/run_build.py --builder-tag <model> --dry-run   # prints the plan, no key needed
PYTHONPATH=src python3 src/stage1/run_build.py --builder-tag <model> --out-dir results/
# then score results/<run_id>/agent as above
```

## Scenario fields (`scenarios`)

| Field | Type | Description |
|---|---|---|
| `scenario_id` | string | Stable identifier, equal to the scenario file name |
| `family` | string | Framework family: `permission`, `file`, `state`, `direct`, `headless`, `tui`, `artifact`, `startup`, `extension` |
| `category` | string | Category name used in the paper (e.g. `permissions`, `session state`, `interactive terminal`) |
| `role` | string | `test_case` (scored) or `positive_control` (not scored) |
| `scored` | bool | Whether the scenario counts toward the pass rate |
| `difficulty` | string | `standard` or `hard` |
| `gated_by` | list[string] | Positive controls that must PASS for this test case's status to count |
| `requires` | list[string] | Other scenarios this one depends on |
| `summary` | string | One-line purpose of the scenario |
| `description` | string | Purpose and step-by-step flow, from the scenario file |
| `source_path` | string | Path of the scenario file in the GitHub repository |
| `source_code` | string | Full source of the scenario (setup, stimulus, observation, and judgement) |

A **scenario** is the session through which the mock model drives the candidate
harness; a **test case** is a scenario plus its assertion. A **positive control**
proves that the probed operation *can* succeed when nothing blocks it, so a
blocked run in the gated test case reads as "the rule held" rather than "the
command never worked". If you select a subset, keep it closed under `gated_by`.

| Family | Total | Scored | Controls |
|---|--:|--:|--:|
| `file` | 17 | 9 | 8 |
| `permission` | 16 | 8 | 8 |
| `state` | 14 | 7 | 7 |
| `headless` | 13 | 6 | 7 |
| `direct` | 11 | 6 | 5 |
| `tui` | 9 | 5 | 4 |
| `artifact` | 7 | 7 | 0 |
| `startup` | 5 | 4 | 1 |
| `extension` | 2 | 1 | 1 |
| **Total** | **94** | **53** | **41** |

## Leaderboard (`leaderboard`)

<p align="center">
  <img src="assets/leaderboard.png" alt="Pass rate of nineteen models" width="100%">
</p>

Pass rate (%) of 19 frontier models on the **full 328-case suite**. Each model
built three independent candidate harnesses; `pass_rate` is their mean and
`pass_rate_std` the standard deviation. Category columns are the per-category
pass rates; `other` merges artifact checks, startup, and extension discovery.
Positive controls are excluded from every denominator. GPT-6 Astra leads at
53.05%, the weakest model reaches 27.44%, and the cross-model mean is 38.30%.

## Citation

```bibtex
@article{ge2026doc2harness,
  title   = {Doc2Harness: Benchmarking LLMs on Long-Horizon Harness Engineering of Coding Agents},
  author  = {Ge, Yuyao and Liu, Shenghua and Gao, Peizhong and Ge, Chendi and Liu, Chenxu and
             Wang, Yiwei and Mei, Lingrui and Bi, Baolong and Yao, Jiayu and Guo, Jiafeng and
             Cheng, Xueqi},
  journal = {arXiv preprint arXiv:2610.20344},
  year    = {2026}
}
```

## License

Apache 2.0, same as the [code repository](https://github.com/YuyaoGe/doc2harness).
The contract skeleton derives from the project layout of
[mini-swe-agent](https://github.com/SWE-agent/mini-swe-agent) (MIT); see `NOTICE`
for upstream attribution.