Evaluation harness
Evaluation harness
The harness runs a set of tasks through the loop under a matrix of engine and model configurations. Each run gets its own throwaway git repository, and each task-and-config pair gets a result. It answers questions a single run can’t: which model converges faster on this kind of task, which config lets defects slip past its own gate and review, and what each costs.
Usage
aloop-eval ./eval/spec.mjsaloop-eval ./eval/spec.mjs --jsonThe spec is a module that exports a task corpus array and a config matrix array. Use either a default export (export default { corpus, matrix }) or named exports (export const corpus = [...]; export const matrix = [...];).
By default the command prints a table with one row per cell, then a summary table with one row per config. With --json, stdout holds only the JSON document with results and summaries. Run progress goes to stderr. aloop-eval --help lists the options, and aloop-eval --version prints the package version.
Spec file
export const corpus = [ { id: 'greet-hello', files: { 'greet.js': 'module.exports = () => "TODO";\n', 'gate-check.js': 'if (require("./greet.js")().length === 0) process.exit(1);\n', 'hidden-check.js': 'if (require("./greet.js")() !== "hello") process.exit(1);\n', }, task: 'Make greet.js return "hello".', gate: ['node gate-check.js'], heldOutCheck: ['node hidden-check.js'], },];
export const matrix = [ { name: 'claude-high', engine: { name: 'claude', effort: 'high' } }, { name: 'codex-high', engine: { name: 'codex', effort: 'high' } },];Task fields
Each task is one self-contained fixture:
id: the task’s name in results and tables.files: the starting repo contents, written relative to the fixture root before the first commit.task: the task text, written to the run’s task file.gate: the visible gate commands the loop enforces during the run. Same shape asgateinloop.config.mjs.heldOutCheck: hidden checks run against the approved worktree after the run finishes. They never appear in the gate or in any prompt, so they measure defects that got past both the gate and the review, not just gate coverage.phases: optional phase list. Defaults to['implement', 'gate', 'review'].
Config fields
Each config is one point in the matrix:
name: the config’s name in results and tables.engine,phases,configExtra: used to build a minimal generatedloop.config.mjs.configExtrais shallow-merged last, so it can add or override keys such aspublishoradapters.configSource: full control over the generated config. Either a(task) => stringfunction or a literal config-file string. Use it for configs the minimal file can’t express, such as a fake adapter in tests.runArgs: extra arguments merged into therunLoopcall, for examplemaxRounds.
What each cell reports
runEvalCell runs one task under one config in a fresh temporary git repository. It runs git init, commits files, writes the generated config into the repository, writes the task file to a separate temporary directory outside it, then calls runLoop with --yes. It returns:
completed: whether the run finished without stalling.escapedDefect:nullif the task has noheldOutCheckor the run didn’t complete. Otherwisetrueif the held-out check fails against the approved worktree even though the run completed, andfalseif it passes.roundsToConverge,cost,durationMs: read from the run’smanifest.jsonby the samecomputeRunMetricsthataloop metricsuses, so the numbers match what a real run reports.approvedSha,runDir,snapshotPath: the run branch’s HEAD and the run’s saved artifacts.error: the error message, if the run itself threw.
A repo’s .loop/ run-state directory and the generated config would show up as untracked changes and trip the clean-tree check in implement and review. The harness appends both to the fixture’s .git/info/exclude, so they stay out of commits and out of the task’s own .gitignore. A task that supplies its own loop.config.mjs in files keeps that file, and the generated config is written under a unique hidden name instead.
The generated config sets worktrees: false, so the fixture repository is also the run’s checkout. The run creates the run branch feat/<task id> from master (the default baseBranch and branchPrefix), switches to it, and leaves it checked out. approvedSha is that branch’s HEAD, and heldOutCheck runs in the fixture repository. A configSource that sets worktrees: true runs the cell in a separate worktree instead.
runEval({ corpus, matrix }) runs every task against every config and returns the flat list of cells. summarizeEval(results) aggregates per config:
completionRateescapedDefectRate, over cells that had aheldOutCheckavgRoundsToConvergetotalCost, which isnullunless every cell in the config reported a costtotalDurationMs
Library API
runEval, runEvalCell, summarizeEval, formatEvalTable, and formatEvalSummaryTable are also exported from the package root:
import { runEval, summarizeEval } from '@syntax-syllogism/aloop';