Benchmarks: what kleene bench runs and what it measures
The benchmark harness end to end: the eleven task packs, the three modes,
how a task is judged, what the numbers mean and what the plots show.
Commands are in docs/CLI.md, the claims and
their reading in docs/WRITEUP.md, and the results
themselves in the README’s
results section and on
kleene.sh/benchmarks.
Where to look
| You want to know | Read |
|---|---|
| what each pack asks and how it is graded | Packs, Oracles |
what learning, frozen and plain mean | Modes |
| what a column in a table or CSV means | What is recorded, What bench report shows |
| how the README’s cross-model table is built | Results across models |
| what a plot shows and which claim it backs | The five plots |
| how to run a clean comparison | Comparisons the design calls for, Reading results |
| how to run offline or resume | Recording and replaying |
| how to add a pack | Adding a pack |
In one screen
| Pack | Tasks | Input | Answer | Oracle | Stands in for |
|---|---|---|---|---|---|
terminal | 6 | a workspace and a shell-level instruction | files left behind and a FINAL row | shell | Terminal-Bench |
oolong-like | 20 | dated meeting notes with hours per project | hours per project | exact | OOLONG |
finance-synthetic | 20 | a multi-year income statement with distractors | one number | number | FinanceBench |
legal-synthetic | 20 | a contract with planted clause categories | the categories present | exact | CUAD, Harvey LAB |
logbook-hard | 30 | 1,650 log entries (30k tokens), four phrasings, corrections | one of five aggregates | exact | OOLONG at scale |
memo-rubric | 20 | a 40-section agreement with an amendment and a rejected proposal | a short memo | judge | Harvey LAB drafting |
recursion-depth | 20 | a group’s unit reports, a tree 3 to 6 levels deep, with divested subtrees and corrections | a consolidated figure, the largest sub-unit, a count or the depth | number, exact | recursion depth: how far child sessions nest |
recursion-depth-long | 20 | the same trees, every report wrapped in 10k+ characters of commentary (200k to 1M characters a task) | the same | number, exact | recursion depth when the context no longer fits one call |
recursion-depth-guided | 20 | the same tasks, the task text naming the recursion (a sub-unit’s spend is the same question one level down) | the same | number, exact | recursion depth when the shape is spelled out |
coding | 12 | a small Python project with visible tests, in three-step episodes | files edited and a FINAL row | shell, hidden tests | SWE-bench |
oolong-hard | 20 | 1,300 dated tracker entries (25k tokens): time in mixed units, action items opened and closed by id, decisions, corrections | one of five aggregates | exact | OOLONG at scale, with joins |
finance-hard | 20 | a quarterly statement by segment over six years (1,100 figures, 16k tokens) with restatements and a discontinued segment | a number, a segment or a quarter | number, exact | FinanceBench over a filing, not a table |
legal-hard | 20 | a 350-section agreement (12k tokens) with twelve categories, a near miss for each, cross-references and amendments | the categories or sections present, or a count | exact | CUAD over a whole contract |
terminal-hard | 8 | a workspace of hundreds of files or thousands of rows | files changed and a FINAL row | shell, hidden graders | Terminal-Bench, tasks that need a pipeline |
Every pack runs in three modes: learning (Kleene, playbook on), frozen (Kleene, playbook off: the control) and plain (a tool-calling agent, no SQL: the baseline). Every task records whether it was solved, how many model calls it took and what it cost; everything else is a query over those rows.
The question the benchmarks answer
Kleene’s claim is that a model writing CallSQL over a relational engine solves the same tasks as a tool-calling agent for fewer model calls and dollars, and that the harness gets better over a stream of tasks because solved SQL is kept as a playbook. The benchmarks are built to test exactly that, so every run records three things per task: was it solved, how many model calls did it take, and what did it cost. Everything else (learning curves, cost parity, transfer) is a query over those rows.
Packs
A pack is a directory under tasks/ with a pack.json: a name, a one-line
description, a licence note, a default task kind (used to look up playbook
entries) and an ordered list of tasks. Each task has its text, optional
context (inline, or a file relative to the pack), optional setup commands
and a source directory for a fresh workspace, an oracle and a difficulty
prior. The schema is Pack and PackTask in
crates/kleene-harness/src/learn/packs.rs.
The full pack table: inputs, outputs, oracles with their tolerances, and what each pack stands in for
| Pack | Tasks | What the model gets | What it must produce | Oracle | Stands in for |
|---|---|---|---|---|---|
tasks/terminal | 6 | an empty or seeded workspace and an instruction (create a file, count lines, rename .log to .txt, count TODO lines, sum a CSV column, write a JSON file) | files left in the workspace and a one-row FINAL | shell: a command run in the workspace, exit 0 passes | Terminal-Bench: shell tasks graded by tests |
tasks/oolong-like | 20 | ctx: dated meeting notes, one per row, each naming a project and hours logged, with filler sentences | FINAL with one row per project: project, total_hours | exact: the row multiset must match | OOLONG-style long-context aggregation: read everything, group, sum |
tasks/finance-synthetic | 20 | ctx: a synthetic income statement, one line item per row, across several fiscal years, with distractor notes | FINAL with one row holding a number: a sum over a year, a year-on-year growth percentage, or a ratio | number: first cell of the first row within an absolute tolerance (0.5 for sums, 0.15 for percentages, 0.015 for ratios) | FinanceBench-style open-book numerical QA |
tasks/legal-synthetic | 20 | ctx: a synthetic contract, one clause per row, with planted clause categories among boilerplate, paraphrases and near-miss distractors | FINAL with one row per category present, out of six named categories | exact: the set of categories, spelled as given | CUAD / Harvey LAB-style clause classification |
tasks/logbook-hard | 30 | ctx: a work log of about 1,650 dated entries (about 118,000 characters, 30,000 tokens) in four phrasings, with entries about the same projects whose numbers are not hours, and Correction: entries that amend an earlier entry | FINAL answering one of five questions: hours per project, hours per person on one project, the top person, hours per project in one month, distinct people on a project | exact | OOLONG at a size that cannot be read once and answered: the context has to be filtered and aggregated |
tasks/memo-rubric | 20 | ctx: a synthetic services agreement of about 40 sections with six planted commercial terms, a rejected proposal in a schedule, and an amendment that supersedes one term | FINAL with one row holding a short written memo answering three questions about the terms | judge: a separate model grades the memo against a rubric naming each required fact and forbidding the superseded and rejected values, with a reference memo | Harvey LAB-style drafting graded by rubric |
tasks/recursion-depth | 20 | ctx: one report per unit of a group, shuffled, naming the unit, the unit it reports to, its direct spend in kEUR, distractor figures and its sub-units; some reports exclude one divested sub-unit with everything under it, and Correction: rows restate a unit’s spend. Five tasks at each of 3, 4, 5 and 6 levels (about 20, 40, 75 and 140 units; 3k to 25k characters) | FINAL with the consolidated spend of the top unit or of a unit one level down, the sub-unit with the largest consolidated spend, the number of units consolidated, or the number of levels | number within 0.5, or exact | recursion depth: consolidation is a recursion as deep as the tree, so a run shows the depth the model chose (evals.depth) next to accuracy and cost as the depth a task calls for grows past the default of two |
tasks/recursion-depth-long | 20 | the same trees, questions and answers, every report wrapped in at least 10,000 characters of management commentary with kEUR figures that are not the direct spend (about 200k to 1M characters a task, 50k to 260k tokens) | the same | number within 0.5, or exact | recursion depth when no single llm() call reads the context: the partition has to come from somewhere, and the tree is the natural one |
tasks/recursion-depth-guided | 20 | the same tasks, with one more sentence in the task: a sub-unit’s consolidated spend is this same question over that sub-unit’s reports | the same | number within 0.5, or exact | recursion depth when the recursion is spelled out: following it against finding it |
tasks/coding | 12 | a small Python project in the workspace (four projects: a finance CSV library, word statistics, warehouse stock, day-interval scheduling), visible unit tests, and a task: implement a module, then extend it, then fix a bug report | files edited in place and a one-row FINAL | shell: the grader’s own hidden unit tests for every step so far (visible tests plus edge cases the task text states) | SWE-bench-style code editing, in three-step episodes over one checkout |
tasks/oolong-hard | 20 | ctx: a project tracker of about 1,300 dated entries (about 98,000 characters, 25,000 tokens): time entries in hours, decimal hours, minutes or 2h 30m; action items opened on a project and closed later by id alone; decisions per project; entries with numbers that are not time; and Correction: entries that amend an earlier time entry | FINAL answering one of five questions: hours per project, open action items per project at the end, the project with the most decisions in a month, hours per person on one project in one month, how many of a project’s items were closed within a week | exact | OOLONG at a size that cannot be read once, where the questions join two kinds of entry and normalise units |
tasks/finance-hard | 20 | ctx: a quarterly income statement by segment, one figure per row (six segments, seven line items, six fiscal years: about 1,100 figures, 16,000 tokens), followed by restatements that replace earlier figures, a note marking one segment discontinued, and commentary full of numbers that are not figures | FINAL with a consolidated full-year total, a year-on-year change in operating income, a cost ratio for one segment, the segment with the highest revenue, or the quarter with the highest consolidated revenue | number (0.5 for totals, 0.15 for percentages, 0.015 for ratios) or exact | FinanceBench-style QA over a filing’s worth of figures, not one table |
tasks/legal-hard | 20 | ctx: a supply agreement of about 350 numbered sections (about 50,000 characters, 12,000 tokens) with three to seven planted categories out of twelve, each in one of three phrasings, a near-miss section for every category, cross-references, a recurring defined term, and amendments at the end that delete a planted clause, add a category by replacing a section, or touch a near miss | FINAL with the categories present as amended, the section numbers holding one category, or the number of sections using the defined term | exact | CUAD / Harvey LAB-style clause work over a whole contract, read as amended |
tasks/terminal-hard | 8 | a workspace generated at setup: 72 log files, a 4,000-row order file to join with customers, 420 files with duplicates, 150 files to move by a manifest, a 500-file tree, 60 JSON configs to repair, two 2,500-row ledgers to reconcile, 15,000 JSON events | files changed in place and a one-row or per-group FINAL | shell: a hidden grader recomputes the answer from the files; the generator and grader are not in the workspace | Terminal-Bench tasks that need a pipeline over many files, not one command |
The synthetic packs are frozen generator output, so two runs see the same tasks in the same order; the coding pack is hand-written and its three steps form an episode in one workspace. The mechanics:
How the synthetic packs are generated and frozen, and how a coding episode inherits its workspace
The synthetic packs are frozen output of the continual loop’s generators:
corpus, statements and contracts at dial 0.5, seeds 1 to 20, the
harder logbook (dial 0.9, 30 seeds) and memo (dial 0.8, 20 seeds), and
the *-hard generators tracker, ledger and agreement (dial 0.9, 20
seeds each), built after the original three packs saturated: every model
solved them in every mode, so they compared cost only.
Freezing means the tasks are checked into the repository, so two runs, or two
people, see the same tasks in the same order; bench build <dir> --from <generator> --count N --dial D --seed S regenerates a pack and the same
arguments give byte-identical tasks. The first three packs are written out in
full; logbook-hard, memo-rubric, oolong-hard, finance-hard,
legal-hard and recursion-depth are built with --lazy, so their pack.json holds a
generator, dial and seed per task (from) and the task is regenerated on
load. The two forms load to the same task, because every
generator is a pure function of its dial and seed; the lazy form keeps a
pack with 118,000-character contexts at a few kilobytes on disk. The dial is
the generator’s hardness knob in [0, 1]: it adds notes and distractors for
corpus, years, line items and notes for statements, length and
paraphrase for contracts, entries, phrasings, distractors and corrections
for logbook, length and the amendment for memo, entries and the
correction rate for tracker, segments, years and restatements for ledger,
sections, near misses and amendments for agreement, and depth for nest
(1 level at 0, 6 at 1: dials 0.4, 0.6, 0.8 and 1.0 give trees 3, 4, 5 and 6
levels deep, where every other generator grows wider). The difficulty prior
on every task is derived from the dial (800 rating points at 0, 1600 at 1, so
1200 at 0.5); the terminal tasks carry the 1000 baseline and the coding
steps 1150 to 1350.
The coding pack is hand-written. Each project is a directory under
tasks/coding/workspaces/ copied into the workspace, and its three steps
form an episode: the second and third steps carry continues naming the
step before, so they run in the workspace that step left, files and all,
rather than in a fresh copy. A step’s setup runs in the inherited
workspace; the coding steps use it to check the previous step with the
grader’s hidden tests and, when they fail (the earlier step was not solved,
or the run was resumed and the workspace is gone), to install the reference
solution for that step, so each step is measured on its own work. The
grader (.grader/run.sh N) runs its own copies of the tests for steps 1 to
N, so editing tests/ changes nothing; the visible tests under tests/ are
a subset, and the edge cases the hidden tests add are all stated in the task
text.
The external datasets these packs imitate (OOLONG, Terminal-Bench,
FinanceBench, CUAD, Harvey LAB) are not redistributed. Three import on
demand: bench import-oolong, bench import-lab and
bench import-redlining.
How each import works: slices, sampling, document formats, scoring with LAB's own evaluator
-
OOLONG (Bertsch et al. 2025, MIT):
bench import-oolong <out-dir>downloads questions from the Hugging Face datasetoolongbench/oolong-synthand writes a pack with theoolongoracle. The default is thetrec_coarsesource dataset at the 131,072-token bucket: 50 questions (33 counting, 17 per-user; comparisons, counts, labels and user ids) over two shared context windows of about 3,200 TREC questions each, which is the split the Recursive Language Models paper reports on.--dataset,--context-len,--limitand--offsetpick another slice (spamis the other validation dataset;agnews,app_reviews,formality,imdb,metaphors,multinli,negationandyahooare the test datasets; buckets run from 1,024 to 4,194,304 tokens). Every context window is written once tocontexts/and shared by its questions, one line of the original perctxrow, so the pack is self-contained and the same arguments give the same pack. The importer reads each parquet shard’s footer with a range request to find the row groups that hold the slice and fetches only those rows, so a 12 GB dataset costs a few tens of megabytes to import.--from-json <file>builds the pack from rows saved earlier instead of the network. -
Harvey LAB (MIT,
harveyai/harvey-labs): a checkout imports withbench import-lab <checkout>/tasks <out-dir>, all 2,010 tasks (1,599 standalone plus 411 workflow scenarios) in about twenty seconds. Each task’sdocuments/folder is copied in as its workspace; the 250 firm-knowledge tasks that share onedmscorpus throughdocs_dirshare one copy. The oracle isjudgeover the task’s rubric exactly as shipped: one line per criterion with its id, title,match_criteriaand the deliverables it is scoped to, all-pass. LAB’s own evaluator (lab_core.evaluation.run_eval, Sonnet 4.6 and GPT-5.5 as judges) stays the scorer of record; the in-loop oracle approximates it with one judge and no per-deliverable scoping. The matter documents are.docx,.xlsx,.pptxand.eml, whichreadreturns as text (paragraphs and tables, one CSV block per sheet, one block per slide, decoded mail), and a deliverable written withCALL write_fileto a.docxor.xlsxpath is built from the Markdown or CSV given (throughpandocwhen it is installed, else a minimal package), so LAB’s evaluator can open it.To score with LAB’s evaluator, run with
--outputs <checkout>/results: every task’soutput/is exported asresults/<task>/kleene-<mode>/<run>/output/with theconfig.jsonandmetrics.jsonLAB’s reports expect, andbench runprints onerun_evalcommand per task. Sampling keeps the cost of a first pass down:import-lab … --sample 50 --seed 1imports a seeded sample (and copies only its documents),bench run … --sample 20 --seed 1runs a seeded sample of any pack, in pack order, so two people with the same seed run the same tasks. One practice area (import-lab <checkout>/tasks/antitrust-competition …, 33 tasks) is the other cheap start. -
Contract redlining (UmaiTech, CC BY 4.0):
bench import-redlining <out-dir>downloads examples fromUmaiTech/legal-contract-qpt5-redlining-1k(--dataset 1k, 992 redlines by a GPT-5 model mix, the default) orUmaiTech/legal-contract-gpt41-redlining-10k(--dataset 10k, GPT-4.1), synthetic client-protective redlines of clauses from the CUAD contracts: ten contract types, ten US jurisdictions, the liability, termination, warranty, IP and governing-law categories. The default is the held-outtestsplit (10%, 100 examples of the 1k set), read from thealpacaconfig;--split train,--limitand--offsetpick another slice and--from-json <file>builds the pack from rows saved earlier. Each example becomes one task: the task text names the clause category, contract type, jurisdiction and expected risk reduction and quotes the original clause, and asks forFINALover one row withredline(the full revised clause) andrationale. The oracle isredline, which holds the reference redline, its rationale and the specific changes it lists (below). The reference is itself model-written, so the pack measures agreement with a GPT redline, not with a lawyer; it is the dataset’s own framing and it is cheap enough to run the whole test split.
Modes
Every pack runs under one of three modes, chosen with --mode. The point of
having three is that two comparisons fall out of them.
| Mode | What runs | Playbook shown | Adoption on | Purpose |
|---|---|---|---|---|
learning | Kleene: the model writes CallSQL, the harness executes it | yes, the entries recorded for the task kind | yes: SQL that solved a task becomes a candidate and is adopted after a replay eval wins on solves and cost | the treatment: does the stream get easier as the playbook fills |
frozen | Kleene, same model, same tools, same budgets | no | no: no candidate is recorded, no rating moves | the control for learning: the same abstraction with the playbook off |
plain | a tool-calling agent on the same provider, tools and budgets, no SQL: the tools go to the model as native tool definitions, its tool_use blocks run and their results come back as tool_result blocks, and a final tool carries the answer | n/a | n/a | the baseline for cost parity: same model, same spend, only the abstraction differs |
The two comparisons. learning against frozen isolates the
playbook. frozen against plain isolates the SQL abstraction. A
learning run also moves the Bradley-Terry ratings of the tasks and the
solver, so bench plot’s difficulty axis reflects what the loop has seen.
“Frozen” means frozen for the duration of the run, not empty. Both Kleene
modes read the same store, so a frozen run still uses the memo and the
function definitions the refinement ledger has already adopted (learn refine); what it does not do is show playbook entries, record new
candidates or adopt anything. That is what makes the transfer measurement
below work, and it is why a frozen run on a store that has seen a learning
run is not the same control as a frozen run on a fresh store.
The plain agent uses the provider’s native tool-calling API wherever the
provider has one (Anthropic, OpenAI-compatible): each tool is sent with a
positional args array, several tool_use blocks in one reply all run, and
the answer arrives through a final tool, so the loop is the one a vendor
agent runs. On a provider without tool calling (the scripted test provider)
it falls back to one JSON action per reply, {"tool": …} or {"final": …},
with the first balanced object of the reply run.
A task’s check (its visible test command, say) gates FINAL in every
mode: when the solver finishes, the command runs in the workspace, and a
non-zero exit refuses the finish with the output’s tail so the solver
continues. The hidden oracle in verify still grades the task; the check
only stops a solver from declaring victory while its own tests fail, which
is where most of the Haiku 4.5 coding failures ended.
Every task, in every mode, runs in its own fresh temporary workspace,
seeded from the pack’s workspace_from directory and setup commands, so
tasks and concurrent runs cannot see each other’s files; the exception is a
task that continues another, which inherits that task’s workspace (see the
coding pack above). Every bench session also drops the tables it created
(ctx, its CREATE TABLE scratch, a child’s namespace) when it finishes,
so the catalog a session sees does not grow with every session before it and
a recorded run replays from its own fixtures (drop_session_tables in the
harness configuration; a REPL keeps its tables).
Oracles
A task is solved when its oracle passes on the FINAL relation the model
produced. The code oracles are exact and free; the judge oracle costs one
model call and is never the solver’s own session. Definitions are in
crates/kleene-harness/src/learn/verify.rs.
| Oracle | Passes when |
|---|---|
exact | the rendered rows equal the expected rows as a multiset: cells trimmed, numbers compared numerically, text case-insensitive |
number | the first cell of the first row, with commas and currency signs stripped, is within an absolute tolerance of the expected value |
shell | a command run in the task’s workspace, with the answer rows as JSON on stdin, exits 0 |
sat | a 3-SAT verdict is right: SAT with a satisfying assignment, or UNSAT when brute force agrees |
judge | a separate judge model, given a rubric and an optional reference, answers PASS |
oolong | an OOLONG answer, scored as the paper scores it: a label, date, user id or comparison on exact match (any of the listed values when the dataset lists a tie), a number with partial credit `0.75^ |
redline | a contract redline: the redline cell of the first row must differ from the original clause (an unchanged clause fails outright), and it is scored on redline recall, the share of the reference redline’s new terms (words of four letters or more that the original lacks) the answer carries. With a judge configured the judge decides, given the original clause, the reference redline with its rationale and the specific changes it lists, and detail carries both (redline recall 0.83; judge: PASS …); without one the task passes at a recall of 0.50, so an imported redlining pack can be run for free at the cost of a lexical oracle |
human | a person marks it; the task waits in needs_review and counts as unsolved until then |
The shipped packs use shell (terminal, coding), exact (oolong-like,
legal, logbook-hard) and number (finance); only memo-rubric uses
judge, which sends the rubric, the reference and the answer’s cells in
full to the judge alias (Sonnet in the default routing) and costs one
short call per task. The judge is asked for PASS or FAIL on its first
line; a first line that says PASS but also mentions FAIL (“PASS or FAIL?”,
“PASS (provisional), though it would FAIL on …”) counts as a fail, since
a hedged pass is not a verdict. A rubric-judged verdict is as good as its
rubric: the memo rubrics name every fact the memo must state, with its
number, and forbid the superseded and rejected values, so the judge’s job
is checking, not appraising. An imported OOLONG pack uses oolong, which
needs no judge either; an imported redlining pack uses redline, which
uses the judge when there is one and its recall score when there is not.
What is recorded
bench run writes one row per task to the evals table in the store
(.kleene/run.duckdb) and one row per run to bench_runs. The evals
columns are the raw material for every report and plot:
| Column | Meaning |
|---|---|
run | the run id; one bench run invocation |
pack, mode | which pack, which of the three modes |
model | the model the root alias resolved to when the row was written (NULL under the replay and test providers, which cannot name one) |
seq | position in the stream, 0-based; the x axis of the learning curve |
task, kind | the task’s id within the pack and its kind |
solved | the oracle’s verdict |
detail | the oracle’s reason, for reading failures |
calls | model calls the root session made, children included |
tokens | tokens across those calls |
dollars | cost of those calls at the configured pricing |
depth | the deepest child session spawned (0 for plain, which has no children) |
turns | model turns the root took |
wall_ms | wall-clock time |
recorded_at | when the row was written |
bench csv prints these rows as CSV for plotting elsewhere. A learning-mode
run also writes to the loop’s own tables: attempts, task_ratings,
playbook and playbook_evals, which is how learn playbook can show what
was adopted after which replay and what was reverted.
What bench report shows
bench report groups evals by pack, mode and model over every recorded run:
| Column | Definition |
|---|---|
tasks | rows, so tasks times runs for that pack and mode |
accuracy | fraction of rows with solved = true |
calls_per_task | mean calls |
dollars | sum of dollars |
tokens_per_task | mean tokens |
depth | mean depth |
Because it aggregates across runs, a pack run twice in the same mode shows
forty tasks, not twenty. Use bench csv and filter on run for a single
run, or start from a fresh store (--db or a new directory) for a clean
comparison.
bench curve <run-id> [--window 5] reads one run and prints the rolling
solve rate: at each position the fraction solved over the last window
tasks, drawn as a sparkline and listed as numbers. This is the learning
curve of that run.
Results across models
Runs on different models usually live in different stores (one per
machine, per day, per pack and mode), so the comparison across models
starts from their bench csv exports rather than from a merged database:
kleene bench results plots/evals.csv plots/haiku-2026-10-01/evals.csv \
plots/haiku-2026-10-06/evals.csv plots/luna-2026-10-05/evals.csv \
plots/opus-2026-10-06/evals.csv --out plots/results --readme README.md \
--plot coding --plot memo-rubric --plot logbook-hard
reads every CSV given, groups the rows by pack, mode and model, and
writes to --out:
results.md: the results block, shortest first. A glance table with one row per pack and one column per model, each cell the pass rate inlearning / frozen / plainorder with the best mode in bold and–where a mode has not run; then, folded in<details>, the same table for mean dollars per task, the full table (one row per pack, mode and model: tasks, pass assolved/tasks (percent), dollars per task, total dollars, calls, tokens and seconds per task), and one block per plotted pack holding its plot. A model that has not run a pack in a mode keeps its place with a blank, not a zero, so the block can be published before every model has run every pack.<pack>-pareto.svg: dollars per task against pass rate, one point per model and mode (one colour per model, the mode written at the point) and a dashed line through the Pareto frontier, the points no other point beats on both axes. Reading it: a point on the line is a defensible choice at its budget; a point below and to the right of the line is dominated by one that is both cheaper and more often right.
--plot <pack> (repeatable) limits which packs get a <details> block
in the Markdown; every SVG is still written. The README shows the hard packs only: on the
four original packs every mode scored the same, so their points sit on one
horizontal line and the table says it all.
With --readme, the Markdown also replaces the block between
<!-- bench-results:begin --> and <!-- bench-results:end --> in that
document, with image links relative to it; the README’s results section
is maintained this way, so a new model is a new CSV and a re-run of the
command, never a hand-edited table. Models are shown by a readable form
of their id (claude-opus-5-5 as Claude Opus 5.5, a trailing date
dropped) and the mapping is printed under the table.
The model column is written by bench run from the provider’s answer for
the root alias (the router’s first candidate). CSVs exported before the
column existed need it added by hand, as plots/evals.csv (Opus 5.5) and
plots/haiku-2026-10-01/evals.csv (Haiku 4.5) were;
plots/luna-2026-10-05/evals.csv (GPT-6 Luna) was exported with it. The
command refuses a CSV without it rather than guessing.
The five plots
bench plot <out-dir> writes five standalone SVG files from the store,
without a plotting library. Each is the chart the write-up needs for one
claim; a plot with no data says so in the file rather than failing.
| File | Axes | Reads | Claim it supports |
|---|---|---|---|
learning_curve.svg | task number against rolling-5 accuracy, one line per run | a learning line that rises while the frozen line for the same pack stays flat | the playbook makes later tasks easier |
cost_parity.svg | cumulative dollars against cumulative accuracy, one line per pack and mode | at a given x (equal spend) which mode is higher | Kleene reaches the same accuracy for less money than the plain agent |
calls_vs_difficulty.svg | task rating against calls made, solved and failed as two scatter series | how call counts grow with difficulty, and where failures cluster | the harness spends calls where tasks are hard |
estimate_accuracy.svg | the planner’s estimated calls against the calls a statement actually made, from trace_statements, with the y = x diagonal | points on the diagonal are exact estimates; above it the planner under-estimated | the planner’s cost model is trustworthy enough to budget on |
plan_space.svg | relations joined against join orders considered (log scale), one point per statement | how the plan space grows with query shape | the planner’s search stays tractable at the shapes models write |
The first three come from evals, attempts and task_ratings; the last
two come from trace_statements, so they fill in from any session that ran
SQL through the planner, not only from bench run.
Comparisons the design calls for
The plan names four measurements; this is how each maps onto the commands.
- Learning curve:
bench run <pack> --mode learningand--mode frozenon the same pack, thenbench curveon each run id orbench plot. Use a fresh store (--db) for each mode: both Kleene modes read and write the same memo, so the second run in a store answers every prompt the first run already sent for free, and its calls and dollars are not an independent measurement (two coding steps in the Haiku learning run finished with zero calls this way). One store per pack and mode also lets the runs go in parallel, since DuckDB has one writer per file; the rows merge afterwards withkleene trace "ATTACH 'other.duckdb' AS o (READ_ONLY); INSERT INTO evals SELECT * FROM o.evals"(and the same forbench_runs,attempts,playbook_evals,trace_statements,tasks,task_ratings), after whichbench reportandbench plotread the merged store. - Cost parity:
--mode plainon the same pack, thenbench reportfor the totals andcost_parity.svgfor accuracy at equal spend. - Transfer:
bench run <pack> --mode learning --limit Nto learn on the first N tasks, thenbench run <pack> --mode frozenover the same store, and compare the tail against a frozen run on a fresh store. What carries over is what the prefix adopted into the store: refined function definitions and memo entries. Playbook entries are not shown in frozen mode, so the delta measures the learned objects, not few-shot prompting. - Damage control:
playbook_evalsties every adopted entry to the replay eval that admitted it, andlearn playbooklists reverts, so a regression can be traced to the entry that caused it.
Recursion depth
The other packs are flat: the models almost never spawned a child session
on them (evals.depth is 0 in nearly every cell of the results table, and
1 or 2 in the handful of exceptions), so they say nothing about how the
harness behaves when sessions nest. tasks/recursion-depth is built for
that question. Its generator, nest, grows deeper as the dial rises where
every other generator grows wider: a reporting tree whose consolidated
figures are a recursion exactly as deep as the tree, five tasks at each of
3, 4, 5 and 6 levels. Nothing forces a model to recurse (a flat recursive
CTE answers too), so a run records the depth the model chose next to
whether it was right and what it spent. Group evals by the depth a task
was built for, which its id carries (k3-01 … k6-05):
SELECT substr(task, 1, 2) AS built_for, mode,
COUNT(*) AS tasks, SUM(solved::INT) AS solved,
ROUND(AVG(depth), 1) AS depth_used, ROUND(AVG(calls), 1) AS calls,
ROUND(AVG(dollars), 3) AS dollars
FROM evals WHERE pack = 'recursion-depth'
GROUP BY 1, 2 ORDER BY 1, 2
The first real run, Claude Haiku 4.5 in frozen mode on 2026-10-29
(plots/haiku-recursion-2026-10-29/, --budget-dollars 1 per task,
$3.66 in all):
| built for | solved | depth used | calls per task | tokens per task | dollars |
|---|---|---|---|---|---|
| k3 | 2/5 | 0 | 14.6 | 339k | $0.95 |
| k4 | 2/5 | 0 | 23.6 | 318k | $0.79 |
| k5 | 1/5 | 0 | 19.0 | 457k | $1.13 |
| k6 | 2/5 | 0 | 23.0 | 346k | $0.79 |
Haiku never delegated: every task was flat SQL over ctx, right on the
structural questions (levels, units counted) and wrong on the consolidated
figures, where corrections and excluded subtrees have to be combined. The
run also found the harness holes this pack was built to find: a
WITH RECURSIVE ... UNION ALL with no bound grew to 14 GB inside the
recursion loop before the OOM killer stopped the process (now a row cap
and an error), a FINAL could not read a table its own reply had created,
and child sessions nested on the thread stack (both fixed in the same
change).
GPT-6 Luna, frozen, 2026-10-31 (plots/luna-recursion-2026-10-31/, same
--budget-dollars 1): 5/20 for $0.19, depth 0 on every task, and the
reason was in the trace. On k5-03 Luna wrote CROSS JOIN LATERAL rlm(...)
over the report rows three times, and the planner refused each statement:
“estimated at 488 calls ($4.68) but the remaining budget is $1”. The cost
model priced tokens at a fixed $2/$10 per million whatever the model, so on
Luna ($0.10/$0.50) every estimate was twenty times too high and the gate
built to keep recursion affordable was what blocked it. The fix in the same
change learns the per-token rate from the priced calls already in the
store’s trace_calls (once three have run; input to output fixed at the
rate cards’ five to one, cache reads at a tenth), and EXPLAIN ends its
learned: line with the measured rates. The rerun on the fixed binary
(plots/luna-recursion-2026-10-31/rerun/):
| built for | solved | depth used (max) | calls per task | dollars |
|---|---|---|---|---|
| k3 | 2/5 | 0.4 (1) | 79 | $0.03 |
| k4 | 1/5 | 0.4 (2) | 179 | $0.08 |
| k5 | 1/5 | 0.2 (1) | 411 | $0.14 |
| k6 | 0/5 | 0 | 635 | $0.19 |
4/20 for $0.44, with 99 child sessions over four tasks (depth 1 on k3-01,
k3-02, k5-01; depth 2 on k4-02, which it then solved exactly where
the first run returned 0). The shape of the recursion is a map, not a
divide: every child gets one report row and the question about the top
unit, so the children extract and the root still has to consolidate.
Nine tasks hit the 30-turn cap, mostly at five and six levels, and
accuracy did not improve; the pack now measures depth, and the first
measurement is that a cheap model recurses when the gate lets it and does
not yet recurse along the tree. Ways to move it that stay open: a verbosity
dial so a six-level context no longer fits one llm() call, a preamble
variant that names the sub-unit’s consolidated spend as the same task, and
a learning-mode run so one task’s working rlm plan reaches the next.
Two variants of the pack pull on the levers the Luna runs left open, with
the same trees, seeds, questions and answers as recursion-depth so their
rows compare task for task. tasks/recursion-depth-long (generator
nest-long) wraps every report in at least 10,000 characters of management
commentary, figures in kEUR among them that are not the direct spend, so a
six-level group is about a million characters (260k tokens) and no single
llm() call reads it: the context has to be partitioned, and the question is whether the
partition follows the tree. tasks/recursion-depth-guided (generator
nest-guided) adds one sentence to the task, that the consolidated spend of
a sub-unit is this same question asked of that sub-unit over its own
reports, so a child session given those reports can answer it. The guided
pack measures whether a model follows a recursion it is told about; the
plain pack whether it finds one. NestSolver reads the long variant
unchanged (the bench test runs a depth-3 task of it), since the facts keep
their sentences and only gain neighbours.
Luna, frozen, on both (2026-11-01, --budget-dollars 1, routers and rows
under plots/luna-recursion-2026-10-31/{guided,long}/):
| pack | solved | depth used (max) | tasks at depth > 0 | child sessions | calls per task | dollars |
|---|---|---|---|---|---|---|
recursion-depth (rerun, for reference) | 4/20 | 0.25 (2) | 4 | 99 | 326 | $0.44 |
recursion-depth-guided | 3/20 | 0.05 (1) | 1 | 64 | 124 | $0.18 |
recursion-depth-long | 2/20 | 0.9 (5) | 5 | 1,634 | 1,139 | $3.26 |
The guided sentence did nothing for Luna: half the tasks ended on turn one
with a guessed FINAL SELECT 0, as on the plain pack, and the one task
that delegated went one level. Length is what moved the depth. On the long
pack Luna went to depth 3 on k3-03, k4-03 and k6-04, depth 4 on
k6-01 and depth 5 on k5-05, the depth that task was built for, through
1,634 child sessions (653 at depth 1, 652 at depth 2, 317 at depth 3, 9 at
depth 4, 3 at depth 5), every one of which finished, so the harness side of
the question has an answer at five levels. The model side does not yet: the
recursion is text partitioning, children extracting facts from chunks of a
long report and delegating chunks of their chunk, not consolidation along
the tree, and nothing it did there made the answer better (2/20, nine tasks
out of turns, $0.65 on a single six-level task). The dial moves depth; it
has not yet moved the shape.
Claude Opus 5.5, frozen, on the plain pack (2026-11-02,
plots/opus-recursion-2026-11-02/, root Opus 5.5 at high effort, worker
Sonnet 5.5, --budget-dollars 2): 20/20 for $1.85, 6.75 calls and 60k
tokens a task, depth 0 on every task and no llm() at all. Opus parses the
reports with string functions and consolidates with a WITH RECURSIVE CTE
(25 of them over the run), one plan at every depth from 3 to 6, so the
pack’s recursion is answered in SQL and the model never needs a child. That
is the flat solution the pack always allowed, done right: the measure of
depth is only interesting for a model that cannot do this.
Two harness settings matter here. The harness refuses a child beyond
max_depth, which defaults to 2; the pack states depth: 6 and bench run
raises the maximum to at least a pack’s depth (--max-depth overrides
both), so the deepest tasks are not refused by construction. And a child
gets child_budget_fraction (50%) of its parent’s remaining budget, so
under a bounded budget.calls the budget a session can spend falls
geometrically with depth; the bench runs with no call budget, so this does
not bite there, but a depth-6 run under kleene run --budget-calls would.
The pack has an offline stand-in for a model: NestSolver in
kleene_harness::testing reads the unit and the measure from the task text
and delegates every sub-unit to a child with rlm, the same CallSQL at
every level, so it reaches exactly the dialled depth and every task passes.
It is what the integration test runs, and cargo test --workspace --all-features -- --ignored sweep runs it over the whole pack and prints
one line per task with the depth reached, calls and tokens. It is not a
model result; it shows what the harness records when a solver does recurse
and that the oracles accept the recursion’s answer.
Recording and replaying
bench run --record <dir> saves every model reply as a fixture while it
runs against a real provider; bench run --replay <dir> serves those
fixtures back, so the same run reproduces offline with no key and no cost.
This is how the first real-model run becomes repeatable for everyone after.
The recording directory is yours to choose and to check in; it is the same
ReplayProvider mechanism the test suite uses for its wire-format fixtures.
A replay serves a frozen or plain run exactly; a learning run cannot
be replayed from a frozen run’s fixtures, because the playbook it shows
changes the prompt and so the fingerprint, so record each mode separately.
A task that ends in an error without a single token spent means the
provider never answered (no credit, a bad key, a dead endpoint). The run
stops there with the reason in bench_runs.note instead of recording the
rest of the pack as failures, and bench run --resume <run-id> continues
that run at the first task without a row, keeping the rows before it. The
run must be the same pack and mode.
Reading results
Results against a real model are reported in
docs/WRITEUP.md, summarised in the README’s
results section and charted on
kleene.sh/benchmarks. When reading them:
- Accuracy on twenty tasks moves in steps of five points; a difference of one task is not a result.
- The three synthetic packs are generated, so a solver that learns the generator’s shape will look better than one meeting the real datasets; that is the point of freezing them for the learning curve, and the limitation for any absolute claim.
- Pace the long-context pack to the model. On Haiku 4.5 a
logbook-hardtask in frozen mode took some 500 calls and over twenty minutes, so 30 tasks in three modes is more than a day; run it with--limit 10and compare the same ten tasks across modes. - All three modes share the provider, tools and budget caps, so
dollarsis comparable between them. The replay evals alearningrun pays for when it gates a playbook candidate are not inevals; they are recorded inplaybook_evalswith their own dollars, so the true cost of a learning run is the sum of both.
Adding a pack
Write a pack.json following the schema above (or bench build from a
generator, with --lazy for long contexts, or bench terminal <dir> for
the built-in shell pack), give every task a stable id, a code oracle where
one exists, and a difficulty prior, and add a row to
tasks/README.md. A task may instead carry from
(generator, dial, seed) and be regenerated on load, with any of the other
fields as overrides. Steps of an episode name the step before in
continues, which must be an earlier task of the pack; their setup runs
in the inherited workspace, and a pack whose steps can repair a missing
predecessor there (as the coding pack does from its reference solutions)
resumes cleanly with --resume. A task whose workspace has a visible test
command should name it in check, so a FINAL is refused while it fails
(the coding pack’s is python3 -m unittest -q). Anything that needs a model to grade should
use judge with a written rubric and a reference answer, so the verdict is
auditable; leave human for tasks that truly need a person.