Skip to main content
The quality patterns (Self-Refine, CoVe, Reflexion) make ChatCLI check its own answer while it works. That helps the answer in front of you, but it leaves nothing to compare from one version to the next, and a model checking itself shares its own blind spots. Evals fill that gap. An eval suite is a fixed set of cases with known pass criteria, run the same way every time. It produces a score: pass rate, mean score, cost and latency. You can save that score as a baseline and gate CI on it. 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

A real run of the starter suite, with Claude Haiku 5.5 as the candidate and Claude Sonnet 5.5 as the judge, compared against an earlier run in which the Go bug-fix case had timed out. Each finished trial prints a line on stderr while the run works, then the summary goes to stdout:
A failing case lists the checks that failed under its line, for example ✗ 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.
With --with-memory the run can also write to your memory: a one-shot queues its turn for memory extraction like any other run. Keep hermetic runs for baselines.

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::
For the whole directory, 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 !file alike), then setup: runs. A fixture shared by several cases can carry the module, and each case can replace one file.
  • !file works 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 validate catches it for free: A misspelled tag is an error, never content: without that rule, !fiel testdata/go.mod would quietly become a file whose text is the path.
  • Keep a broken fixture away from the host repository’s tooling. Name the directory testdata/, which go build, go test ./... and go vet skip, and give a Go fixture its own go.mod. In a repository whose gates scan every .go file anyway (coverage, license headers), keep small fixtures inline under files:. 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 /C on Windows) inside the sandbox, with the case’s env:, after fixture and files are in place.
  • Each line has a fixed 2-minute limit.
  • The defaults lines 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 || true to a command that is meant to fail.
  • defaults has no fixture or files. To share them, repeat the line or use a YAML anchor (fixture: &fx testdata/strutil … fixture: *fx).
The examples below come from one suite. Its defaults give every case a git repository and a commit identity:
When: the case needs a handful of short files and nothing else.
When: the project is more than a few files, or you want to edit it in your IDE.
When: several cases share a project but each starts from a different bug or variant. files: is written over the fixture, so only the file that differs lives in the case.
Make sure the tests catch the bug you plant. A bug they do not exercise lets the case pass with no work at all; the no-op check below finds that.
When: the files already exist on disk, in different directories, and copying a whole directory would bring too much.
When: the task starts from a repository state that is easier to produce with commands than to write as files: branches, history, a conflict.
When: the input is large or repetitive, and a command produces it in one line.
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.
With Claude Haiku 5.5 as the candidate, all seven cases above pass in one trial each, for about $0.04 in total.

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
It answers two questions for free:
  • 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.
A partial score is normal here: a check such as “the tests are untouched” passes when nobody touched anything.

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 optional reference 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 first judge: 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_judged and 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 run trials 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 name and every case id. 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_tokens and cost_usd per 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: after chatcli eval … | tail, $? belongs to tail.
  • 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:
The candidate inherits the environment, so any CHATCLI_* setting can be compared this way, as can a case’s own env:.