Read API: experiments and runs
The /api routes for experiments, compare, benchmarks, workflows, tasks, runs and bundles, update, work and ingest status.
These routes take the same read key, errors and time rules as the rest of the Read API.
GET /api/experiments
Dataset experiments written by coding.sh exp run, newest first, without their per-case runs. Parameters: limit (1 to 500, default 50), dataset (dataset id) and name. Empty for a scoped key.
curl -sS "$CSH/api/experiments?dataset=refunds&name=baseline" -H "Authorization: Bearer $READ_KEY" {
"items": [{
"id": "exp_01M6T9E8YNKKKEX4GTT1TY5XQ5", "name": "baseline", "status": "completed",
"dataset": {"id": "refunds", "name": "refunds", "version": "09d855430b57ff15"},
"task": {"kind": "command", "ref": "echo 4"},
"graders": [{"id": "exact", "version": "48fe67515f989183", "kind": "exact"}],
"trials": 1, "createdAt": 1794031166421, "finishedAt": 1794031166436,
"summary": {"n": 3, "cases": 3, "passed": 1, "errors": 0, "ungraded": 0,
"passRate": {"p": 0.3333333333333333, "lo": 0.06149194472039621, "hi": 0.7923403991979522}, "ciMethod": "wilson", …},
"runCount": 3
}]
} These fields are present only when they apply:
| Field | When | Holds |
|---|---|---|
samples, summary.caseVerdicts | exp run --samples adaptive | "samples": "adaptive", and verdicts passed, failed, tieBreaks. The passRate interval is then biased, so use the verdicts |
regression | --stop-on-regression stopped the run (status cancelled) | {caseId, baseline} |
metadata.checkpoint | A partial record written while the run was going (status cancelled) | done, total, at |
metadata.weights | exp run --weights <SHA256> | sha256: the SHA-256 of the checkpoint the task ran, 64 hex characters as given to the flag, stored in lowercase. /api/compare carries it as a.weights and b.weights, with weightsWarning when both are the same or only one side has one. exp show --json, exp compare --json, exp list --json, the MCP tools experiments_list and experiment_compare, /api/compare and /api/experiments/{id} add weights.sessions, the ids of the sessions whose weights.checkpoint event recorded that hash (at most 5, newest first). It is looked up when printed, never stored, and absent when no session recorded it |
metadata.selection | A run of part of the dataset | from ({kind: "failing"|"errors", experiment}), cases, sample, seed, firstN, selected, of |
metadata.seq | exp run --seq K | k, feedback, history |
summary.seq | exp run --seq K | k, feedback, history, curve ([{k, rate, lo, hi}], Seq@1..K), egs, lgs, unchangedRate, costToSolve; with 2+ trials also passAtK ([{k, rate}]), front ([{protocol, k, cost, success, overall}]) and costUnit (usd or attempts) |
seq on each run | exp run --seq K | k, solvedAt, feedback, history, attempts ([{pass, latencyMs, costUsd?, criticCostUsd?, unchanged?, error?, feedback?}]) |
GET /api/experiments/{id}
One experiment with its case runs (up to 5,000; runsTruncated says when more exist). Outputs over 4,000 characters are cut and marked outputTruncated. Ids come from coding.sh exp list. Unknown ids, and any id for a scoped key, get 404 {"error":"experiment not found","status":404}.
When a session recorded the experiment's weights file as a checkpoint, a top-level weights object holds sha256 and sessions, as exp show --json prints it. The stamp itself is in metadata.weights.
curl -sS "$CSH/api/experiments/$EXP_A" -H "Authorization: Bearer $READ_KEY" {
"id": "exp_01M6T9E8YNKKKEX4GTT1TY5XQ5", "name": "baseline", "status": "completed", …, "runCount": 3,
"runs": [
{"caseId": "c_992c448def7d1479", "trial": 1, "latencyMs": 11.42, "grades": [{"graderId": "exact", "result": {"score": 1, "pass": true}}], "pass": true, "startedAt": 1794031166424, "output": 4},
{"caseId": "c_47dd42650c395e5c", "trial": 1, "latencyMs": 6.63, "grades": [{"graderId": "exact", "result": {"score": 0, "pass": false, "reason": "expected \"6\", got \"4\""}}], "pass": false, "startedAt": 1794031166429, "output": 4}
],
"runsTruncated": false
} GET /api/compare
Paired comparison of two experiments: a is the baseline, b the candidate. Both are required. The server computes the statistics. partial lists sides that were cancelled.
curl -sS "$CSH/api/compare?a=$EXP_A&b=$EXP_B" -H "Authorization: Bearer $READ_KEY" {
"a": {"id": "exp_01M6T9E8YNKKKEX4GTT1TY5XQ5", "name": "baseline", "passRate": 0.3333333333333333},
"b": {"id": "exp_01M6T9E94FSMK542B6WQHNCDMR", "name": "candidate", "passRate": 1},
"ungraded": {"a": 0, "b": 0}, "paired": 3, "onlyInA": [], "onlyInB": [],
"diff": {"mean": 0.6666666666666666, "lo": 0, "hi": 1, "iters": 4000},
"mcnemar": {"b": 0, "c": 2, "n": 2, "p": 0.5}, "signFlip": {"p": 0.5, "units": 3, "method": "exact"}, "verdict": "inconclusive",
"timing": {"interleaved": false, "gapMs": 81, "warning": "A and B ran one after the other, not interleaved, …"},
"regressions": [], "improvements": [{"caseId": "c_47dd42650c395e5c", "a": 0, "b": 1, "delta": 1}, …],
"graders": [{"id": "exact", "n": 3, "meanA": 0.3333333333333333, "meanB": 1, "diff": {"mean": 0.6666666666666666, "lo": 0, "hi": 1}}],
"attrition": {"a": {"runs": 3, "completed": 3, "errored": 0, "infra": 0, "agent": 0, "ungraded": 0, "missing": 0, "lost": 0}, "b": {…}, "p": 1},
"power": {"alpha": 0.05, "power": 0.8, "n": 3, "mde": 0.9338617396156048, "minPaired": 200, "warnings": […], …},
"posterior": {"pBetter": 0.875, "mean": 0.2857142857142857, "lo": -0.24060826256615866, "hi": 0.7345975081216372, "prior": 1, "draws": 20000},
"partial": []
} | Field | Meaning |
|---|---|
signFlip | The exact two-sided sign-flip test on the per-case differences (per-cluster sums when clustered). units counts cases or clusters; method is exact up to 20 changed units and monte-carlo above |
verdict | better or worse only when diff excludes zero and signFlip.p is below 0.05 |
power.exact | The exact McNemar design when some case flipped: {"n", "discordance", "alpha", "power", "minDiscordant", "ceiling", "mde"}. ceiling is the power at the largest possible gap |
timing.interleaved | Also true for two cells of one exp run matrix (both carry the same metadata.matrix.id) |
When power.exact.mde is null, no gap reaches power, and power.warnings has a no-power entry.
These fields are present only when they apply:
| Field | When |
|---|---|
graders[].versionChanged | The sides were graded with different grader versions: {"a","b"} |
gradersOnlyIn | The sides were graded by different graders: {"a":[…],"b":[…]} |
instrumentWarning | The sides were graded differently; the text says how |
ungradedCases | Cases ran on both sides but have no graded run on one |
selectionWarning | One side ran only on the other's failures (exp run --failing). The verdict is then inconclusive |
seqK | Both sides ran --seq with the same K and feedback: k, feedback, n, a, b, diff |
seqNote | Only one side ran --seq, or their K or feedback differ |
a.weights, b.weights | The side ran with exp run --weights: sha256, and sessions when a session recorded that file as a checkpoint |
weightsWarning | Both sides ran the same weights, or only one side records which it ran |
A missing or malformed id gets 400 {"error":"a and b must be experiment ids","status":400}; an unknown one gets 404 {"error":"experiment not found","status":404}.
GET /api/benchmarks
Daily benchmarks written by coding.sh bench run, read from ~/.coding.sh/benchmarks/<name>/runs. Newest first. Each item has the latest run's leaderboard and the last 30 daily pass rates per contender. coding.sh ui reads the local benchmark folder; coding.sh serve has none, so it answers an empty list, as does a scoped key.
curl -sS "$CSH/api/benchmarks" -H "Authorization: Bearer $READ_KEY" {
"items": [{
"name": "coding-sh-issues", "description": "Fresh coding.sh issues each day; the agent's patch has to pass the repo's tests.",
"counted": 24, "total": 24, "reference": "claude-code",
"latest": {"id": "bench_codingshissues20261107", "date": "2026-11-07", "cases": 30, "mode": "scheduled", "status": "complete", "dataset": "coding-sh-issues@261107"},
"contenders": [{"name": "codex", "model": "gpt-6.1-sol", "place": 1, "n": 30, "passed": 19, "passRate": {"p": 0.6333, "lo": 0.4551, "hi": 0.7813}}, …],
"trend": {"claude-code": [0.6, 0.4, 0.7333, …], "codex": [0.4667, 0.3333, …]}
}]
} counted is the number of runs on the current protocol; total counts every run.
GET /api/benchmarks/{name}
The same report coding.sh bench show <name> --json prints: the latest run, daily history per metric, the gap to the reference contender, the pooled gap, difficulty, the anchor set, cases whose content changed, the seed check and the failed cases.
Two things differ: cases is left out, and each failure carries hasSession (whether the session is in this index, so the page can link to it) in place of sessionUrl.
Each pair in latest.comparisons has a verdict: a or b (that contender is ahead), tie (no significant difference) or no-verdict. A run that excluded over 10% of its cases draws no verdict: every pair says no-verdict and withheld says why, for example "7 of 47 cases excluded, over 10%". withheld is absent when the test decided.
curl -sS "$CSH/api/benchmarks/coding-sh-issues" -H "Authorization: Bearer $READ_KEY" {
"v": 1, "bench": "coding-sh-issues", "reference": "claude-code", "window": 28,
"latest": {"id": "bench_codingshissues20261107", "date": "2026-11-07", "summaries": […], "comparisons": […], "anchor": {…}, …},
"history": {"pass": {"codex": [{"date": "2026-10-15", "run": "bench_codingshissues20261015", "value": 0.4667, "lo": 0.3023, "hi": 0.6386, "n": 30, "segment": 0}, …]}, "cost": {…}, …},
"vsReference": {"codex": [{"date": "2026-10-15", "value": -0.1333, "lo": -0.3333, "hi": 0.0667, …}, …]},
"protocolBreaks": [15],
"pooled": {"codex": {"k": 9, "cases": 270, "random": {"mean": -0.0852, "lo": -0.1918, "hi": 0.0215}, "i2": 0.2018, …}},
"difficulty": {"fresh": [{"date": "2026-10-15", "value": 0.5111, "n": 30}, …], "anchor": […]},
"anchor": {"version": "v1", "cases": 10, "sha256": "…", "frozenBy": "bench_…", "history": {…}, "vsReference": {…}},
"contentChanges": [{"key": "anchor-2", "anchor": true, "from": {"date": "2026-10-15", …}, "to": {"date": "2026-11-03", …}}],
"seedCheck": {"ok": true, "publishedBy": {"run": "bench_codingshissues20261106", "date": "2026-11-06"}, "checks": […]},
"failures": {"codex": [{"caseId": "2026-11-07-004", "failure": "wrong", "detail": "tsc: 1 error in src/viewer/server.ts", "latencyMs": 223519, "sessionId": "…", "hasSession": true}, …]},
"unsolved": [{"caseId": "2026-11-07-011", "input": "…"}]
} A name outside [a-z0-9][a-z0-9._-]* (up to 63 characters) gets 400 {"error":"invalid benchmark name","status":400}; a benchmark with no runs gets 404 {"error":"benchmark not found","status":404}.
GET /api/workflows
Workflow runs recorded by coding.sh workflows, newest first: the list coding.sh workflows list --json prints. Filters: limit (1 to 500, default 50), framework and name. coding.sh ui reads the local workflow store; coding.sh serve has none, so it answers an empty list, as does a scoped key.
curl -sS "$CSH/api/workflows?limit=1" -H "Authorization: Bearer $READ_KEY" {
"runs": [{
"id": "wf_45d472ff-246", "framework": "claude-code-workflow", "name": "improve", "status": "ok",
"error": null, "startedAt": "2026-11-08T09:12:04.000Z", "endedAt": "2026-11-08T10:40:51.000Z",
"wallMs": 5327000, "agents": 14, "costUsd": 31.2, "tokens": 18450210, "variant": null,
"experimentId": null, "caseId": null, "resumedFrom": null, "hostSessionId": "…", "tags": []
}]
} error is why a run that workflows run started failed, as its driver reported it (timed out, the last lines of its stderr, or its exit code), redacted. It is null otherwise. A limit outside 1 to 500 or a malformed framework gets 400.
GET /api/workflows/{id}
One run, as coding.sh workflows show <run> --json prints it: run (the list fields plus stats and, when set, concurrencyCap) and nodes (every node but subagent, tool and LLM nodes, as show without --tree). The CLI's run also has output, what the run returned; this endpoint leaves it out.
/api/workflows/{id}/gantt answers the timeline workflows show --gantt --json prints: phases with one row per node (start, end, status, critical), and concurrency over time.
curl -sS "$CSH/api/workflows/wf_45d472ff-246/gantt" -H "Authorization: Bearer $READ_KEY" {
"runId": "wf_45d472ff-246", "startedAt": 1794128524000, "endedAt": 1794133851000, "cap": 8,
"phases": [{"name": "Build", "rows": [{"nodeId": "…", "label": "store", "start": 1794128530000, "end": 1794129912000, "status": "ok", "critical": true, "costUsd": 2.1}, …]}],
"concurrency": [{"t": 1794128530000, "running": 6}, …]
} An unknown run gets 404, as does any other path under it, and on coding.sh serve every run.
GET /api/tasks, GET /api/runs, GET /api/bundles
Eval tasks (coding.sh eval), runs (coding.sh compare) and harness bundles (coding.sh harness). All three answer {"items":[…]} and are empty for a scoped key.
| Route | Filters | Notes |
|---|---|---|
/api/tasks | status (draft, validated or archived), tag | |
/api/runs | experimentId, taskId, bundleId | Run fields below |
/api/bundles | id, name, agent, model, createdAt and note only; overlay files stay behind /api/blobs |
A run carries these fields when they apply:
| Field | Meaning |
|---|---|
cellKey | The content key compare --reuse matches on. Absent on older runs |
reusedFrom | The id of the run compare --reuse copied this one from |
tamper | Set when the run's diff was checked: flagged, flags (each with kind, path, why and detail) and addedTests, the existing test files the agent only added new test cases to (absent when none) |
verifierOutput | The end of what the verifier printed: stdout and stderr, each the last 4096 characters, colour codes removed, redacted with capture.redact and capture.redactPatterns. An empty stream is absent, and so is the field when both were |
repair | From compare --repair: signal (bit or names), mode (resume or fresh), limit, rounds, pass, falseAlarm and falseAlarmFired with --false-alarm, and skipped (error or timeout) when the first attempt could not be repaired |
repair.pass | The outcome after the last round. pass on the run stays the first attempt's |
repair.rounds[] | n, pass, verifierExit, verifierOutput, durationMs, usage, sessionId, diffBlob; unchanged when the round changed no file, tamper when its diff tampers with tests, namesParsed with signal names |
agentVersion | The agent release the run started on (the adapter's detected version). Absent when the adapter can't tell, and on older runs |
isolation | How the verifier's tree was built: carried, stripped and skipped, below. Absent with --no-isolation, on a task without a verifier command, and on older runs |
isolation.carried | The agent's changes applied to the fresh start tree |
isolation.stripped | Each change left out, with path, why (hook, config, scripts, verifier, dependency, symlink or special) and change (add, modify or delete) |
isolation.skipped | Why the tree could not be isolated |
traceId | The trace id the agent got in TRACEPARENT with compare --otel |
sequence | The run's place (stream, step) with compare --sequential |
coding.sh compare --json adds claims with baseline and candidate when the final answer (agent.finalText) of at least one run in either arm claims success. Each arm has runs, claims, failureReports, claimRate (claims / runs), claimPrecision (verifier passes among claims, absent when the arm made no claim), silentFailures (claims the verifier failed) and silentFailureRate (silent failures / runs). Cancelled, superseded and infrastructure-lost runs are left out.
curl -sS "$CSH/api/tasks?status=validated" -H "Authorization: Bearer $READ_KEY" {"items":[]} GET /api/update
Release check for the viewer's update banner. coding.sh serve never checks, so it always answers:
curl -sS "$CSH/api/update" -H "Authorization: Bearer $READ_KEY" {"current":"","latest":null,"updateAvailable":false,"url":null,"command":"","checkedAt":null} GET /api/star, POST /api/star
The viewer's "star on GitHub" card. Only coding.sh ui answers; coding.sh serve and every other host answer 404. Neither call makes a network request. The state is star.json in the coding.sh home.
GETreturns{"show": true}when the first run was 3 or more days ago, the store holds at least 5 top-level sessions (subagents do not count), and neitherdismissedAtnorstarredAtis set. Otherwise it returns{"show": false}.- The prompt is off, and nothing is written, when
CODING_SH_NO_STAR_PROMPTis set to a value other than empty,0orfalse, orNO_UPDATE_NOTIFIERis set to anything (even empty). - It is also off in CI: when
CI,CONTINUOUS_INTEGRATION,BUILD_NUMBER,GITHUB_ACTIONS,GITLAB_CI,BUILDKITEorTF_BUILDis set to such a value. POSTtakes{"action": "dismiss"}or{"action": "starred"}as JSON and recordsdismissedAtorstarredAt. Any other action answers 400. The body is capped at 1 KB and theOriginmust match the host.
Either one ends the card and the one line coding.sh prints in a terminal.
GET /api/work, POST /api/work/ack, POST /api/work/snooze
The viewer's Work page (#/work): the queue coding.sh work prints. Only coding.sh ui answers; coding.sh serve and every other host answer 404, because acks and snoozes live in work.json in this machine's coding.sh home.
GET takes the work command's filters as query parameters:
| Parameter | Meaning |
|---|---|
since | the window, default 7d |
agent | a name, or several separated by commas |
repo | one repo |
stage | only items in these stages, hidden ones too, like --stage: repeated, or a comma list (review,approval) |
all=1 | show hidden items, like --all |
limit | default 20, at most 1000 |
It returns what coding.sh work --json returns for the same store and filters, built by the same code, plus fields for the page: members maps each listed item's id to its member session ids (the main session first, at most 50), and hiddenBy counts the hidden items by reason (running, done, acked or snoozed). A bad since, limit or stage answers 400.
totals counts every item the answer holds before limit cuts it, by bucket, with hidden for hidden items (0 unless all=1 or stage lists them). The page's headings read "20 of 671" from it.
Item fields for workflow runs, replaced failures and linked worktrees:
- A workflow run's item has
workflow: the run'sid, itsnamewhen known, andphases. Each phase has itsname(absent if none),agents,running,failed,done, andcostUsdwhen known. - A failed item that a later item on the same branch replaced has
supersededBy, that item's id. - An item whose main session ran in a linked worktree has
repoMain, the root of the repo's main checkout.repostays the worktree. It is absent in a main checkout. - The top-level
needYoucounts blocked and failed items that are neither probably closed nor superseded.
POST /api/work/acktakes{"id": "w1a2b3c"}and acknowledges the item's current cause, ascoding.sh work ackdoes. It returnsid,acked: true, thebucketand itslabel, andnow, the item after the ack.- An item with no cause to acknowledge returns
id,acked: falseandhidden, and writes nothing. POST /api/work/snoozetakes{"id": "w1a2b3c", "duration": "1h"}and hides the item until then, ascoding.sh work snoozedoes. It returnsid,snoozedUntil(an ISO time) and thebucketthe snooze holds.- Both writes look the item up in the last 7 days, or the window in
?since=. An item not in the window answers 404. - An id that is not an item id, or a duration that does not parse, answers 400. The body must be JSON, is capped at 1 KB, and the
Originmust match the host.
GET /api/work/{id}
The viewer's item page (#/w/<id>): one item, as coding.sh work show <id> --json prints it, built by the same code, plus the list's now and index and, for a superseded failure, sessionOf. It leaves out the CLI's indexUpdatedAt, asOf and pending: index gives the index's age. Only coding.sh ui answers.
It takes since, agent and repo as GET /api/work does. An id that is not an item id answers 400; an item not in the window, or not matching the filters, answers 404.
GET /api/ingest
Progress of the local spool ingest, for the viewer's "Indexing N files…" pill.
coding.sh uiingests in a background worker after it starts listening, so pages answer from what is already indexed whilefilesPendingcounts down.lastIngestAtis the end of the last finished pass (epoch ms),nullbefore the first.- Under
coding.sh ui,refoldingistruewhile the worker folds the stored sessions again because another version folded them. The pill then says "Rebuilding stats…"; sessions not reached yet keep the older stats and flags. It is absent otherwise. - Under
coding.sh ui,importingistruewhile past sessions are being imported (the background importcoding.sh initstarts when its 8 seconds run out). The pill and the empty session list then say "Importing past sessions…". - Under
coding.sh uion its own home,indexgives the age of the last finished ingest:updatedAt,text(index updated 4m ago), andstale: truewhen it is 15 minutes old and no ingest runs.
coding.sh serve ingests events as they arrive, so it always answers:
curl -sS "$CSH/api/ingest" -H "Authorization: Bearer $READ_KEY" {"ingesting":false,"filesPending":0,"lastIngestAt":null}