Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion NEXT.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Next

Updated 2026-10-13.
Updated 2026-10-26.

1. Paired Bayes interval for small-n pass rates (Bowyer et al. 2025), next to the paired t.
2. Converters into manifest + samples: Harbor job/trial `result.json`, and EVMbench-style per-audit `grade.json` results.
Expand All @@ -11,6 +11,13 @@ Updated 2026-10-13.
7. export-eee: carry sample transcripts into EEE `messages` for multi_turn and agentic runs (today an empty list).
8. Task filters: a negated match (`not_in`) and a lint warning when a filter keeps no task, if a bench needs them.

Done in 0.6.0 (2026-10-26): sweep hygiene, STANDARD.md section 11. Tracked sweep ledger
`data/sweeps/<sweep-id>.json` (schema `bench-sweep/1`, `bench-kit ledger`); `bench-kit check-run`
marks provider auth failures (401, revoked token, invalid key) as errors and stops a sweep after N
in a row, plus a required-files check; `bench-kit scrub` replaces secret values named by env var or
values file and `--check` verifies none is left; lint BL012 (run record or ledger dir gitignored)
and BL013 (auth-error rows in a complete run), and BL001 validates `bench-sweep/1` ledgers.

Done in 0.5.1 (2026-10-13): tiny numbers print in e-notation below 1e-6 and a sign-test p below
0.001 prints as `p<0.001` (a 520-task comparison printed p as a 150-digit decimal).

Expand Down
32 changes: 26 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
A results standard for benchmark repos, with JSON Schemas, a renderer, small-sample stats, a linter and an Every Eval Ever exporter (STANDARD.md is the source of truth).

## Status
Updated 2026-10-13. State: active, v0.5.1. Next: see NEXT.md.
Updated 2026-10-26. State: active, v0.6.0. Next: see NEXT.md.

## Latest result
bench-kit is tooling, not a bench, so it has no runs. The standard it enforces is in STANDARD.md.
Expand All @@ -19,22 +19,42 @@ per task x subject x repeat. bench-kit then:
per-metric task subsets (`task_filter`, e.g. recall over positive tasks only).
- `bench-kit render`: regenerates the README latest block (between the `bench:latest` markers),
RESULTS.md and runs/INDEX.md from all manifests.
- `bench-kit lint`: checks the repo against the standard, rules BL001-BL011 (`bench-kit rules`).
- `bench-kit lint`: checks the repo against the standard, rules BL001-BL013 (`bench-kit rules`).
- `bench-kit export-eee <run> [--org NAME]`: writes Every Eval Ever 0.3.0 aggregate + samples
files and validates them against the vendored EEE schemas.

Sweep hygiene (STANDARD.md section 11), for the bench's runner to call:

- `bench-kit ledger <sweep-id> --run <run-id>`: writes or updates the tracked sweep ledger
`data/sweeps/<sweep-id>.json` (per-trial verdicts, schema `bench-sweep/1`). Raw transcripts
may stay gitignored; the ledger is committed.
- `bench-kit check-run <trial>...`: flags trials that failed on provider auth (401, revoked or
expired token, invalid API key), so they are recorded as errors instead of scored, and exits 3
after `--stop-after N` in a row so the sweep stops. `--require GLOB` checks the trial kept
every file the bench needs.
- `bench-kit scrub <path>... --env '*_API_KEY'`: replaces secret values (named by env var or a
`--values-file`) in run files with `<redacted:NAME>`; `--check` exits 1 if any value is left.

## Run it
```bash
# from a bench repo checkout
uv tool install git+https://github.com/aaronjmars/bench-kit@v0.5.1 # or: pipx install git+https://...
uv tool install git+https://github.com/aaronjmars/bench-kit@v0.6.0 # or: pipx install git+https://...
bench-kit stats && bench-kit render && bench-kit lint
bench-kit export-eee <run-id> --out eee-export --org "Your Org"

# inside a sweep loop, after each trial
bench-kit check-run runs/<run-id>/raw/<trial> --streak-file runs/.auth-streak.json # 2 = auth error row, 3 = stop
bench-kit scrub runs/<run-id> --env '*_API_KEY' --env '*_TOKEN'
bench-kit ledger <sweep-id> --run <run-id> --status running
# at sweep end
bench-kit scrub runs/<run-id> --env '*_API_KEY' --env '*_TOKEN' --check
bench-kit ledger <sweep-id> --run <run-id> --status finished && git add data/sweeps runs/<run-id>
```

In any repo's GitHub Actions CI:
```yaml
- uses: actions/checkout@v4
- uses: aaronjmars/bench-kit@v0.5.1
- uses: aaronjmars/bench-kit@v0.6.0
with:
args: --warn-only # drop once the repo is migrated
```
Expand All @@ -46,8 +66,8 @@ uv sync && uv run pytest && uv run ruff check . && uv run ruff format --check .

## Layout
- `STANDARD.md`: the standard (files, README shape, manifest and samples fields, stats rules, lint rules)
- `schema/`: `bench-manifest-1.schema.json`, `bench-sample-1.schema.json`, and `eee/` (vendored Every Eval Ever 0.3.0 schemas, MIT, see `schema/eee/SOURCE.md`)
- `src/bench_kit/`: `stats.py`, `render.py`, `lint.py`, `export_eee.py`, `cli.py`
- `schema/`: `bench-manifest-1.schema.json`, `bench-sample-1.schema.json`, `bench-sweep-1.schema.json`, and `eee/` (vendored Every Eval Ever 0.3.0 schemas, MIT, see `schema/eee/SOURCE.md`)
- `src/bench_kit/`: `stats.py`, `render.py`, `lint.py`, `export_eee.py`, `ledger.py`, `runcheck.py`, `scrub.py`, `cli.py`
- `action.yml`: composite action that installs bench-kit from the action checkout and runs `bench-kit lint`
- `tests/`: pytest, including hand-computed stats checks

Expand Down
114 changes: 111 additions & 3 deletions STANDARD.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Bench standard v2.4 (bench-kit 0.5.1)
# Bench standard v2.5 (bench-kit 0.6.0)

One shape for every bench repo: how runs are recorded, checked and reported,
whatever the bench measures (models, agent harnesses, prompts, CI runners,
Expand Down Expand Up @@ -28,6 +28,13 @@ paired diff is equal (or there is 1 task, 1 shared task or 1 cluster), stats
leaves out the interval and writes `uncertainty.no_interval_reason`, render
prints `[CI n/a: <reason>]`, and lint warns on a stored zero-width interval
(BL011); every v2.3 manifest stays valid as `bench-manifest/1`.
v2.5 (bench-kit 0.6.0) adds sweep hygiene (section 11): a tracked sweep ledger
per sweep (`data/sweeps/<sweep-id>.json`, schema `bench-sweep/1`, `bench-kit
ledger`), auth errors recorded as errors and a sweep stop after a few in a row
(`bench-kit check-run`), and a secret scrub of run files after every trial
(`bench-kit scrub`); lint warns when a run record or the ledger dir is
gitignored (BL012) or a complete run holds auth-error rows (BL013). Manifests and
samples are unchanged.
Sources at the end.

Note: every number, id and hash in the examples below is made up to show the
Expand All @@ -54,7 +61,8 @@ shape. They are not results.
|---|---|---|
| `runs/<id>/manifest.json` | the run (or a human right after) | Source of truth for one run. Section 4. Required. |
| `runs/<id>/samples.jsonl` | the run | One row per task x subject x repeat. Section 5. Required when any metric is computed from samples. |
| `runs/<id>/` other files | the run | Raw logs, transcripts, judge outputs, as the bench already writes them. If not committed, `raw.location` or `raw.reason` says why. |
| `runs/<id>/` other files | the run | Raw logs, transcripts, judge outputs, as the bench already writes them. If not committed, `raw.location` or `raw.reason` says why. Gitignore only these raw files (e.g. `runs/*/raw/`), never `manifest.json` or `samples.jsonl` (BL012). |
| `data/sweeps/<sweep-id>.json` | the sweep runner (`bench-kit ledger`) | Sweep ledger: one record per trial with its verdict. Tracked in git, never gitignored. Section 11. |
| `README.md` | human + generated block | Fixed sections, section 2. |
| `RESULTS.md` | **generated** | Every run, newest first, from manifests. Section 3. |
| `runs/INDEX.md` | **generated** | One line per run: id, date, question, verdict, status. |
Expand Down Expand Up @@ -353,7 +361,10 @@ One JSON line per task x subject x repeat (EEE instance names where they exist):
consistently within a run.
- `error` is null or `{"source": "infra|agent|judge|task", "type", "message"}`.
With `errors.counted_as: zero` an errored row with a null score counts as 0
(and not correct); with `excluded` it is dropped.
(and not correct); with `excluded` it is dropped. A trial that failed on
provider auth (section 11) gets `"type": "auth"` (usually `"source": "infra"`)
and a null score; it is re-run, and a run that still holds such rows is not
`complete` (BL013).
- Row count per subject must equal `n_completed x repeats.completed`, or that
subject's entries in `source_data.n_completed_by_subject` and
`repeats.completed_by_subject` when the manifest declares them.
Expand Down Expand Up @@ -459,6 +470,7 @@ comparison must list what differs (`compared_with`).
- Subject short form: `harness@version+model` (Harbor style), e.g. `omp@18.3.2+claude-haiku-5-5`.
- Any number quoted outside the repo (tweet, blog, PR) carries run id and date.
- Secrets come from a secret store at run time; never in repo, manifests, samples or logs.
Run files are scrubbed after every trial (section 11).
- No em or en dashes anywhere.
- GitHub: description = README one-liner; topic `bench`.

Expand All @@ -474,6 +486,12 @@ Commands:
- `bench-kit lint [--warn-only]`: GitHub `::error file=..::` annotations in CI
- `bench-kit export-eee <run> [--org NAME]`: EEE 0.3.0 aggregate + samples files,
validated against the vendored EEE schemas
- `bench-kit ledger <sweep-id> [--run ID] [--records FILE] [--status S]`: writes or
updates the tracked sweep ledger (section 11)
- `bench-kit check-run <trial>... [--require GLOB] [--stop-after N]`: auth errors
and missing files in finished trials (section 11)
- `bench-kit scrub <path>... --env NAME|GLOB [--values-file FILE] [--check]`:
replaces secret values in run files (section 11)

Rules (code, level):
- BL001 error: manifest or samples fail JSON Schema, duplicate run id, or id differs from directory
Expand All @@ -487,6 +505,8 @@ Rules (code, level):
- BL009 warn: task-set version not in the METHOD.md changelog
- BL010 warn: leftover TODO in docs, or `raw.kept` false without location or reason
- BL011 warn: a stored confidence interval has zero width (lower equals upper), e.g. from an older bench-kit or a hand-written external metric (section 7 rule 13)
- BL012 warn: a path that must be tracked is gitignored: a run's `manifest.json` or `samples.jsonl`, or the `data/sweeps/` ledger dir (checked with `git check-ignore`, so tracked files never count; skipped outside a git work tree). BL001 also checks every `data/sweeps/*.json` that declares `bench-sweep/1` against its schema and its file name
- BL013 warn: a run with `status: complete` has sample rows with `error.type: "auth"` (section 11)

Suppress in a markdown file with `<!-- bench-lint: ignore BL0xx <reason> -->`,
in a manifest with `lint_ignore`, or repo-wide in `.bench-lint-ignore`.
Expand All @@ -506,6 +526,94 @@ Legacy repos start with `--warn-only` and switch to errors once migrated.
5. Add the lint to CI with `--warn-only` first, then switch to errors once the
repo is clean.

## 11. Sweeps: ledger, auth errors, secrets (bench-kit 0.6.0)

A sweep is one launch of the bench's runner over many trials (task x subject x
repeat), often paid and often spread over several runs. Three rules keep a sweep
from being lost, misread or leaking a key.

**1. Persist the sweep ledger.** Raw transcripts may stay out of git
(`runs/*/raw/` in `.gitignore`, kept elsewhere per `raw.location`), but each
sweep's per-trial verdicts go to a tracked file, `data/sweeps/<sweep-id>.json`
(schema `bench-sweep/1`), and are committed with the run records. A paid sweep
whose only ledger sat in a gitignored folder cannot be re-read once that folder
is gone. The ledger holds verdicts, never outputs or transcripts:

```json
{"schema_version": "bench-sweep/1", "sweep_id": "2026-01-15-ab-sweep", "bench": "example-bench",
"started_at": "2026-01-15T14:00:00Z", "updated_at": "2026-01-15T16:00:00Z",
"status": "halted", "halted": "3 consecutive auth errors on candidate", "note": null,
"runs": ["2026-01-15-summarizer-ab"],
"counts": {"records": 3, "scored": 1, "errored": 1, "skipped": 1, "auth_errors": 1},
"records": [
{"run_id": "2026-01-15-summarizer-ab", "sample_id": "task-0001", "subject": "baseline", "repeat": 1,
"status": "scored", "score": 3.2, "is_correct": null, "error": null},
{"run_id": "2026-01-15-summarizer-ab", "sample_id": "task-0001", "subject": "candidate", "repeat": 1,
"status": "errored", "score": null, "is_correct": null,
"error": {"source": "infra", "type": "auth", "message": "auth error: 401 Unauthorized"}},
{"run_id": null, "sample_id": "task-0002", "subject": "candidate", "repeat": 1,
"status": "skipped", "note": "sweep halted"}]}
```

- `status`: running | finished | stopped | halted; `halted` says why it stopped early.
- Record `status`: scored | errored | skipped. Records may carry more keys (cost, judge
votes, a proof field); error messages are cut to 300 characters.
- `bench-kit ledger <sweep-id> --run <run-id>` adds every sample row of a run;
`--records <file.jsonl>` adds records the runner wrote itself. Calls merge (the
newest record per run, task, subject and repeat wins, `started_at` is kept), so
a runner can call it after every trial and once more at the end with
`--status finished|stopped|halted`. It exits 2 if the ledger path is gitignored.
From Python: `bench_kit.ledger.write(root, sweep_id, runs=..., records=..., status=...)`.
- A bench that already keeps its own ledger format there is left alone: lint
checks only files that declare `bench-sweep/1`.

**2. Fail loud on auth errors.** A trial whose output shows a provider auth
failure (HTTP 401, a revoked or expired token, an invalid API key, a lost
login) measured nothing. A clean exit code does not make it a result: it is
recorded as errored with `error.type: "auth"` and a null score, never scored,
and re-run once the login is fixed. Every later trial on the same login fails the
same way, so the sweep stops after a few in a row (default 3).

- `bench-kit check-run <trial>...` scans each finished trial (a dir or a file, in
run order) for generic auth-error wording and prints one status per trial: `ok`,
`incomplete`, or `auth-error` with the file, line and a masked excerpt (long
token-like strings print as `<masked>`). Exit 0 clean, 1 a required file is
missing, 2 an auth error (mark the trial errored), 3 the streak reached
`--stop-after N` (stop the sweep). `--streak-file` keeps the streak between
calls when the runner checks one trial at a time; a clean trial resets it.
`--json` prints the same for scripts.
- Agent transcripts of benches whose tasks call HTTP services can quote the
target's own 401 responses. Those benches point `--only` at the harness result
and error files, or `--skip` the transcript. `--pattern REGEX` adds a
bench-specific marker.
- From Python: `bench_kit.runcheck.check_trial(...)`, `AuthStreak`, and
`sample_error(check)` for the samples row's `error` object.
- A complete run must hold no auth-error rows (BL013): re-run them, or mark the run
`partial`.

**3. Scrub secrets from run files.** Each trial scrubs its own files when it
ends, and the sweep scrubs all its run dirs again at the end, since a trial killed
mid-run skips its own scrub. The caller names the secrets; bench-kit never reads
a secret store:

```bash
bench-kit scrub runs/<id> data/sweeps/<sweep-id>.json --env '*_API_KEY' --env '*_TOKEN'
bench-kit scrub runs/<id> --values-file <(my-secret-tool export --names-and-values) # NAME=value lines
bench-kit scrub runs/<id> --env '*_API_KEY' --check # completeness: exit 1 if any value is left
```

- Each value is replaced with `<redacted:NAME>`, longest first (a URL that holds a
key is masked whole), plus its JSON-escaped forms. Binary files are skipped, and
values shorter than 8 characters are skipped with a warning.
- Completeness has two halves: `scrub --check` finds no value left, and
`check-run --require <glob>` finds every file the bench needs to judge the trial
later (result, log, transcript, verifier output, as the bench defines them).

A sweep loop then reads, per trial: run it, `check-run` (2: write an auth error
row, 3: stop), `scrub`, then `ledger`; at the end `scrub` and `scrub --check` over
the sweep's run dirs, `ledger --status ...`, and commit `data/sweeps/` with the run
records.

## Sources

- Harbor job/trial results, lock, parity rules: https://github.com/harbor-framework/harbor (src/harbor/models/job/result.py, models/trial/result.py, models/job/lock.py, adapters/ADAPTER_CONTRIBUTING.md, scripts/validate_adapter.py)
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: bench-kit lint
description: Check a bench repo against the bench standard (bench-kit lint, rules BL001-BL011).
description: Check a bench repo against the bench standard (bench-kit lint, rules BL001-BL013).
inputs:
args:
description: Extra arguments for bench-kit lint, e.g. --warn-only
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "bench-kit"
version = "0.5.1"
version = "0.6.0"
license = "MIT"
description = "Shared standard, schema, renderer, stats and linter for bench repos"
readme = "README.md"
Expand Down
56 changes: 56 additions & 0 deletions schema/bench-sweep-1.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://github.com/aaronjmars/bench-kit/schema/bench-sweep-1.schema.json",
"title": "bench-sweep/1",
"description": "A sweep ledger, data/sweeps/<sweep-id>.json: one record per trial with its verdict, never outputs or transcripts. Tracked in git.",
"type": "object",
"required": ["schema_version", "sweep_id", "started_at", "status", "runs", "records"],
"properties": {
"schema_version": {"const": "bench-sweep/1"},
"sweep_id": {"type": "string", "minLength": 1},
"bench": {"type": ["string", "null"]},
"started_at": {"type": "string"},
"updated_at": {"type": ["string", "null"]},
"status": {"enum": ["running", "finished", "stopped", "halted"]},
"halted": {"type": ["string", "null"], "description": "Why the sweep stopped early, e.g. 3 consecutive auth errors."},
"note": {"type": ["string", "null"]},
"runs": {"type": "array", "items": {"type": "string"}, "description": "Run ids (directories under runs/) this sweep wrote."},
"counts": {
"type": "object",
"properties": {
"records": {"type": "integer", "minimum": 0},
"scored": {"type": "integer", "minimum": 0},
"errored": {"type": "integer", "minimum": 0},
"skipped": {"type": "integer", "minimum": 0},
"auth_errors": {"type": "integer", "minimum": 0}
}
},
"records": {
"type": "array",
"items": {
"type": "object",
"required": ["sample_id", "subject", "status"],
"properties": {
"run_id": {"type": ["string", "null"]},
"sample_id": {"type": "string", "minLength": 1},
"subject": {"type": "string", "minLength": 1},
"repeat": {"type": ["integer", "null"], "minimum": 0},
"status": {"enum": ["scored", "errored", "skipped"]},
"score": {"type": ["number", "null"]},
"is_correct": {"type": ["boolean", "null"]},
"cost_usd": {"type": ["number", "null"]},
"error": {
"type": ["object", "null"],
"required": ["message"],
"properties": {
"source": {"type": ["string", "null"]},
"type": {"type": ["string", "null"]},
"message": {"type": "string"}
}
},
"note": {"type": ["string", "null"]}
}
}
}
}
}
2 changes: 1 addition & 1 deletion src/bench_kit/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""bench-kit: shared standard, schema, renderer, stats and linter for bench repos."""

__version__ = "0.5.1"
__version__ = "0.6.0"
Loading
Loading