---
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
---
Benchmarking LLMs on Long-Horizon Harness Engineering of Coding Agents
🌐 Project page •
📄 Paper •
💻 Code
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.
> [!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 `.
**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 --dry-run # prints the plan, no key needed
PYTHONPATH=src python3 src/stage1/run_build.py --builder-tag --out-dir results/
# then score results//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`)
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.