chatcli eval is that harness. Use it to prove a prompt, model or engine change made ChatCLI better rather than worse, and to compare models and providers on the same tasks.
For a large external benchmark run through the same idea (a fixed question set, the real binary, a judge), see chatcli on LongMemEval.
Evals spend real tokens: every case is a real model call, and judge checks add more. Use
--max-cost to cap a run and validate/list to check a suite without spending anything.Quick start
✗ tests pass: exited 1 (expected 0): --- FAIL: TestSum ….
The repository ships a starter suite in evals/ (chat language, JSON format, arithmetic, refusing to invent a flag, fixing a Go bug, creating a file, answering without touching files).
How a trial runs
1
Sandbox
A temp directory is created. The case’s
fixture is copied into it, its inline files are written, and its setup commands are run (for example git init). A failing setup marks the trial as an error, and the candidate never runs.2
Coder policy
For
coder cases the per-case policy is delivered through the CHATCLI_CODER_POLICY_OVERLAY environment variable — a path the candidate reads from its process environment and merges in full over your global policy. It is not a coder_policy.json written into the sandbox: a policy file in the (untrusted) workspace is no longer honored for this. By default the overlay allows @coder, including exec, inside the throwaway workspace. Set policy: on a case to narrow it. Safety-immune operations still require approval, and an eval has nobody to approve them, so they are denied. No “approve everything” switch exists for this.3
Candidate
The real binary runs
chatcli -p "<prompt>" --raw --no-anim, with /coder in front for coder cases, with no stdin and under the case timeout. The run is hermetic by default: long-term memory, bootstrap, memory and session recall, session autosave, coder checkpoints and REPL history are off, so the outcome depends on the suite alone. --with-memory evaluates with your real memory and recall instead. Your hooks never fire in a candidate, with or without --with-memory: they are side effects on your machine, and a hook that runs an eval would recurse.4
Record
Through
CHATCLI_EVAL_RECORD, the one-shot reports its final answer, tool calls, turns, tokens, cost and transcript to a file outside the sandbox, which the candidate can neither read nor change.5
Grading
Every check runs against the answer and the sandbox. Commands such as
go test ./... run inside it. A trial passes only if every check passes, and its score is the weighted mean of the check scores.6
Cleanup
The sandbox is deleted.
--keep leaves it on disk and the report records its path.Suite format
A suite is a YAML file. Passing a directory loads every*.yaml / *.yml file directly inside it. Subdirectories are not scanned, so fixtures can carry YAML of their own. Keys are strict: a misspelled key is an error, never a check that is silently ignored.
Files on disk or inline
A case gets its workspace from two places:
A plain
files: value is the file’s content. To keep a file on disk and only reference it from the suite, tag the value with !file. The path resolves against the suite file, like fixture::
fixture: testdata/strutil does the same in one line.
-
The sandbox is built in this order: the fixture is copied, then
files:are written over it (inline and!filealike), thensetup:runs. A fixture shared by several cases can carry the module, and each case can replace one file. -
!fileworks under YAML anchors (files: &name…files: *name), so several cases can share the same entries. -
What is refused when the suite loads, so
chatcli eval validatecatches it for free:A misspelled tag is an error, never content: without that rule,!fiel testdata/go.modwould quietly become a file whose text is the path. -
Keep a broken fixture away from the host repository’s tooling. Name the directory
testdata/, whichgo build,go test ./...andgo vetskip, and give a Go fixture its owngo.mod. In a repository whose gates scan every.gofile anyway (coverage, license headers), keep small fixtures inline underfiles:. ChatCLI’s starter suite does this.
Workspace patterns
fixture, files and setup shape what a coder case works on, and what command: and file_* checks look at. A chat case runs without tools, so it never reads the sandbox.
How setup: runs:
- Each line runs with
sh -c(cmd /Con Windows) inside the sandbox, with the case’senv:, afterfixtureandfilesare in place. - Each line has a fixed 2-minute limit.
- The
defaultslines run first, then the case’s own: the two add up. - A line that exits non-zero marks the trial as an error, and the candidate never runs. Append
|| trueto a command that is meant to fail. defaultshas nofixtureorfiles. To share them, repeat the line or use a YAML anchor (fixture: &fx testdata/strutil…fixture: *fx).
1. Inline only: a few small files
1. Inline only: a few small files
When: the case needs a handful of short files and nothing else.
2. Fixture only: a whole project as real files
2. Fixture only: a whole project as real files
When: the project is more than a few files, or you want to edit it in your IDE.
4. Single files from different places, with !file
4. Single files from different places, with !file
When: the files already exist on disk, in different directories, and copying a whole directory would bring too much.
5. Setup that builds a state: a merge conflict
5. Setup that builds a state: a merge conflict
When: the task starts from a repository state that is easier to produce with commands than to write as files: branches, history, a conflict.
6. Setup that generates input data
6. Setup that generates input data
When: the input is large or repetitive, and a command produces it in one line.
7. An executable script read with !file, run by setup
7. An executable script read with !file, run by setup
When: preparing the state takes more than a line or two. Keep the script on disk;
!file keeps its exec bit, so setup: can run it.Check the workspace without a model
--bin replaces the binary that runs each case. A stand-in that changes nothing and only writes the record the harness reads lets you exercise fixture, files, setup and every check without calling a model:
testdata/no-op-candidate
- Is the workspace what you expect? Run a copy of the suite whose checks describe the prepared state (the merge conflict is pending, the script is executable, the fixture’s tests fail). Every case should pass.
- Does every check measure the agent’s work? Run the real suite. Every case should fail, because nothing was done. A case that passes has checks that do not depend on the agent, like a planted bug the tests never exercise.
Checks
Deterministic checks come first: they are cheap, reproducible and not open to argument. Use the judge only for what has no deterministic test.
Every check accepts
name: (shown in reports) and weight: (its weight in the trial score, default 1). Paths in checks and files must be relative and stay inside the sandbox: absolute paths and .. escapes are rejected when the suite loads.
The judge
The judge receives the task, the rubric, the optionalreference answer, the tools the candidate called and the candidate’s answer. It does not learn which model produced the answer. It replies with {"score": 0..1, "reasoning": "..."}, and the reply is parsed leniently: a fenced block is accepted, and a score given on a 0–10 or 0–100 scale is normalized. A failed or unparsable judge call counts as a zero sample. It never counts as a silent pass.
- Which model judges:
--judge-provider/--judge-model, else the firstjudge:a suite declares, else your configured default. - Self-grading is flagged: when the judge is the same model as the candidate, the report marks the run
self_judgedand warns. - Judge spend is booked on your real cost tracker and reported separately from the candidate’s.
Trials, pass@k and pass^k
LLM output varies, so a case can runtrials times. For each case the report gives:
The case verdict follows
pass_policy. all (the default, pass^k) is strict: a case that passes two times out of three is flaky and fails, and the report says so instead of hiding it. any and majority are available per case. A trial whose run crashed or timed out is an error, kept separate from a fail, so “ChatCLI broke” never reads as “ChatCLI answered wrong”.
Baselines and the CI gate
--out saves the JSON report. A later run with --baseline compares case by case:
- Regressions: cases that passed before and do not pass now.
- Fixes: cases that did not pass before and pass now.
- Added and removed cases.
- Pass rate, mean score and cost before and after, measured only over the cases graded in both runs. A filtered run compared with a full baseline therefore compares like with like.
--markdown writes the same result as a Markdown document (summary table, baseline delta, failing checks) ready for a PR comment or a CI job summary.
Testing a change
To learn what a change does, run the same suite with only that change against a baseline produced by the unchanged suite.-
Keep the suite
nameand every caseid. The comparison matches cases by<suite>/<id>; a renamed case shows up as removed plus added. -
Put variants in subfolders. A directory run loads only the files directly in it, so
chatcli eval run evals/never picks up a variant. -
Where the change goes:
-
Look past pass/fail. A change can keep every case green and still cost more: compare
turns,output_tokensandcost_usdper trial between reports (jq -r '.cases[].trials[] | "\(.turns) \(.output_tokens) \(.cost_usd)"' report.json). -
Read the exit code without a pipe, or with
set -o pipefail: afterchatcli eval … | tail,$?belongs totail. - Trial and case lines show candidate plus judge cost; the summary line splits the two.
Recipe: Catching a Regression with Evals
A full walkthrough with real runs: a baseline, a change that only costs more turns, and a policy change that fails the run with exit code 3.
Command reference
Ctrl+C stops scheduling new trials and kills the ones running. The report marks them skipped.
CHATCLI_EVAL_RECORD is the harness’s private contract with the binary it drives: when set, a one-shot run writes its record to that path at exit. Unset, which covers every run not driven by chatcli eval, the one-shot path writes nothing.Evals and the quality pipeline
The quality patterns change how ChatCLI answers. Evals show whether that change was worth it. To measure, for example, whether turning on CoVe improves a model on your tasks, run the same suite twice and compare:CHATCLI_* setting can be compared this way, as can a case’s own env:.