# Coding agent benchmark scorecard

An open, reusable template for benchmarking coding agents and models on your
own codebase, from AutoRouter. It has four parts: a task spec, a run log, a
summary and a validation checklist. The guide that explains each part, with a
worked example, is at
https://autorouter.com/blog/coding-agent-benchmark-scorecard.

Every number in the example files is made up to show the arithmetic. Each
example row carries `illustrative: true`. Nothing in them is a measurement.

| File                    | What it holds                                       |
| ----------------------- | --------------------------------------------------- |
| `task-spec.yaml`        | One entry per task, with a template and one example |
| `task-spec.schema.json` | JSON Schema (draft 2020-12) for `task-spec.yaml`    |
| `runs.csv`              | One row per task × setup × run                      |
| `summary.csv`           | One row per setup, computed from `runs.csv`         |
| `scorecard.md`          | This file: definitions, formulas and the checklist  |
| `check.py`              | Validates the files and writes `summary.csv`        |

Run `uv run check.py` to validate the task spec against the schema and the run
log against the columns below, and to compare `summary.csv` with `runs.csv`.
Run `uv run check.py --write` to rewrite `summary.csv` after new runs.

## 1. Task spec

One entry per benchmark task, usually one merged pull request.

| Field                  | Required          | What it records                                                      |
| ---------------------- | ----------------- | -------------------------------------------------------------------- |
| `id`                   | yes               | Stable id, used as `task_id` in `runs.csv`                           |
| `illustrative`         | yes               | `true` for made-up example tasks, `false` for real ones              |
| `source_pr_url`        | yes               | The merged pull request the task comes from                          |
| `workflow`             | yes               | Kind of work: bug-fix, feature, refactor, test-writing, migration... |
| `repo`                 | yes               | Repository, as owner/name or a clone URL                             |
| `parent_commit`        | yes               | The pull request's base commit; the agent starts here                |
| `prompt`               | yes               | The original request, as the engineer gave it                        |
| `setup`                | yes               | Commands run before the agent starts, in order (may be empty)        |
| `grading.method`       | yes               | `tests`, `rubric` or `llm-judge`                                     |
| `grading.command`      | for tests         | Exact grading command; exit code 0 is a pass                         |
| `grading.fail_to_pass` | no                | Tests that must go from failing to passing                           |
| `grading.pass_to_pass` | no                | Tests that must keep passing                                         |
| `grading.rubric`       | for rubric, judge | Criteria written before any run, each met or not met                 |
| `grading.judge_model`  | for judge         | Judge model and setting                                              |
| `pass_criteria`        | yes               | What counts as a pass, in a sentence                                 |
| `time_limit_minutes`   | yes               | Wall-clock limit for one run, or `null`                              |
| `validation`           | no                | The task half of the checklist below                                 |

## 2. Run log

One row per task × setup × run. A setup is one combination of harness,
harness version, model and effort setting; give each combination its own
`setup_id`.

| Column                | Type          | What it records                                         |
| --------------------- | ------------- | ------------------------------------------------------- |
| `run_id`              | text          | Unique id, such as `<task_id>.<setup_id>.<run>`         |
| `task_id`             | text          | A task `id` from the task spec                          |
| `setup_id`            | text          | The setup this run used                                 |
| `run`                 | integer       | Repeat number, 1 to k, for this task and setup          |
| `date`                | YYYY-MM-DD    | Date of the run                                         |
| `harness`             | text          | The coding agent or harness that ran the task           |
| `harness_version`     | text          | Its exact version                                       |
| `model`               | text          | Model id as the provider names it                       |
| `effort`              | text          | Effort or reasoning setting                             |
| `passed`              | true or false | The grader's verdict                                    |
| `grader_notes`        | text          | Why it passed or failed, in a line                      |
| `wall_time_s`         | number        | Seconds from start to the agent's final answer          |
| `input_tokens`        | integer       | Uncached input tokens                                   |
| `output_tokens`       | integer       | Output tokens, reasoning included                       |
| `cached_tokens`       | integer       | Cache-read input tokens                                 |
| `cost_usd`            | number        | What the run cost at the prices you pay                 |
| `tool_calls`          | integer       | Tool calls the agent made                               |
| `human_interventions` | integer       | Times a person had to step in (0 for an unattended run) |
| `illustrative`        | true or false | `true` for made-up example rows                         |

## 3. Summary

One row per setup, computed from the run log. With n tasks and k runs per
task:

- **pass_rate** = passed runs ÷ (n × k)
- **95% interval** = Wilson score interval for pass_rate, with n = the number
  of tasks, not runs, because repeated runs of one task are not independent
  samples. With z = 1.96 and p = pass_rate:
  - center = (p + z² ÷ 2n) ÷ (1 + z² ÷ n)
  - half-width = z × √(p(1 − p) ÷ n + z² ÷ 4n²) ÷ (1 + z² ÷ n)
  - interval = center ± half-width
- **solved_tasks** = tasks that passed in more than half of their runs
- **cost_per_solved_task_usd** = total cost of all runs ÷ passed runs (what
  one passing result costs on average, failed attempts included)
- **median_wall_time_s** = median of `wall_time_s` over all runs
- **flakiness_rate** = flaky tasks ÷ n, where a flaky task passed in some runs
  and failed in others

| Column                                          | Meaning                                     |
| ----------------------------------------------- | ------------------------------------------- |
| `setup_id`                                      | The setup                                   |
| `harness`, `harness_version`, `model`, `effort` | Its settings                                |
| `tasks`                                         | n                                           |
| `runs_per_task`                                 | k                                           |
| `runs`                                          | n × k                                       |
| `passed_runs`                                   | Runs the grader passed                      |
| `pass_rate`                                     | As above                                    |
| `pass_rate_ci_low`, `pass_rate_ci_high`         | The 95% Wilson interval                     |
| `solved_tasks`                                  | As above                                    |
| `total_cost_usd`                                | Sum of `cost_usd`                           |
| `cost_per_solved_task_usd`                      | As above                                    |
| `median_wall_time_s`                            | As above                                    |
| `flaky_tasks`                                   | Tasks with mixed results                    |
| `flakiness_rate`                                | As above                                    |
| `illustrative`                                  | `true` if any row behind it is illustrative |

To compare two setups, also count paired wins: tasks one setup solved and the
other didn't, in each direction. Overlapping intervals don't settle a
comparison on their own.

## 4. Validation checklist

Before the first run:

- [ ] Each task's grader fails at `parent_commit` (`validation.fails_before_fix`).
- [ ] Each task's grader passes with the merged change applied (`validation.passes_after_fix`).
- [ ] No gold-patch leakage: the agent's copy has no later commits, branches,
      tags, test changes or pull request text that reveal the fix
      (`validation.gold_patch_hidden`).
- [ ] Every setup uses the same harness and version, tools, permissions, time
      limit and prompt; only the model or the one setting under test changes.

While running:

- [ ] At least 3 runs per task per setup.
- [ ] Every setup runs the same tasks.
- [ ] Every run records its date, harness version, model and effort setting.
- [ ] Interventions, if any, are counted and reported beside the pass rate.

## Help building and running it

AutoRouter, the Mac app for all your coding agents, builds a free company
benchmark from a team's merged pull requests and agent traces:
https://autorouter.com/benchmarks
