get in touch
studyOctober 26, 20265 min read

harness2 plus loopmath: 95% of the gain at a quarter of the cost

harness2 improves a coding agent's harness, and it is expensive. Paired with loopmath, it kept about 95% of harness2's gain on 40 coding tasks at about a quarter of its list cost.

The result

harness2, from Google Cloud AI Research and Northwestern University, improves a coding agent's harness: its instruction file, skills and hooks. It works, and it is expensive. Every task it improves costs 11 sessions of a frontier model.

We kept harness2's editors and replaced the step where it decides which edits to keep with loopmath: a small, designed set of runs and a statistical estimate of what each edit is worth. On 40 coding tasks, harness2 with loopmath kept about 95% of harness2's gain at about a quarter of its cost: 2.64 against 10.18 list dollars per task.

  • Claude Haiku 5.5 does the tasks; Claude Opus 5.5 edits the harness.
  • The base harness scores 0.746 on the benchmark's hidden tests. harness2 as published lifts it to 0.798. harness2 with loopmath reaches 0.796.
  • harness2 cut down to the same budget as harness2 with loopmath reaches 0.773.
Mean score on 40 tasks, with list cost per task: baseline 0.746 at 0.02 dollars, harness² as published 0.798 at 10.18 dollars, harness² with loopmath 0.796 at 2.64 dollars, harness² at the same budget 0.773 at 2.61 dollars. Adding loopmath cuts the cost to 26% of harness² as published.
Mean score on the 40 tasks, 0 to 1 (the axis starts at 0.70), with each arm's list dollars per task under its bar.

What harness2 does

harness2 (Xu and colleagues, 2026; code) treats the harness as the thing to optimise. For each task, editor sessions propose edits to the harness, each candidate is run on the task, and composer sessions merge the best ideas into a refined harness, without ever seeing the answer. A reflector then writes a lesson into a library for the task's domain, so later tasks start from what earlier ones learned.

The cost is in the editor model. At its published setting, each task runs 6 editor sessions, 3 composers, a selector and a reflector: 11 Opus sessions and 12 task runs. On our tasks, the editing sessions alone were 343.49 of harness2's 407.06 list dollars.

Our question was simple: can a cheaper way of choosing which edits to keep hold most of that gain? Before the run we set the bar: the cheaper method must keep at least 80% of harness2's gain over the base harness.

The method, in plain words

loopmath treats a harness edit the way it treats any change to an agent workflow: as an experiment with a cost and an effect to estimate.

  1. Propose. Two Opus editors, one on how the agent works and one on domain knowledge, each propose up to 5 small edits that can be switched on and off on their own.
  2. Probe. Instead of trying the edits one by one, loopmath plans 12 runs that switch them on and off in a balanced pattern. Each edit is on in half of the runs and off in the other half, so 12 runs can weigh up to 10 edits at once.
  3. Score without the answers. Each run is scored by an answer-free tester: Claude Sonnet 5.5 writes acceptance tests from the task text and the repository. It never sees the hidden tests.
  4. Estimate and keep. A fit over the scored runs estimates each edit's effect. The edits that help are kept and run once as the final harness. If no edit helps, loopmath ships a plain run and spends nothing more.

That is 3 Opus sessions per task, against harness2's 11. The editors and the library are harness2's own; the deciding is loopmath's.

The test

We ran three arms on the same 40 test tasks from WorkBuddy-Bench Code, using harness2's own split, in the same order:

  • Arm 1, harness2 as published, at its default setting.
  • Arm 2, harness2 plus loopmath, as above.
  • Arm 3, harness2 at the same budget: harness2 cut down to arm 2's number of Opus sessions, to check that arm 2 does more than simply run less harness2.

The task model is Claude Haiku 5.5 running headless in Claude Code, in a fresh container for every run. The score is the benchmark's hidden tests, from 0 to 1, and only the one output an arm delivers for a task is scored. The base is harness2's own one-sentence starting harness, run three times on every task and averaged, so every arm is measured against the same figure.

Every model call was logged with its tokens and priced at public list prices, so the arms can be compared dollar for dollar.

Results

armmean scoregain over baseshare of harness2's gainlist $ per task
base, one-sentence harness0.7460.02
arm 1, harness2 as published0.798+0.053100%10.18
arm 2, harness2 + loopmath0.796+0.05095%2.64
arm 3, harness2 at the same budget0.773+0.02852%2.61

harness2 with loopmath clears the bar we set. It keeps 95% of harness2's gain, well above the 80% line, at 26% of harness2's list dollars. Both harness2's gain and loopmath's clear zero at the 95% level: both methods help on this benchmark. At the same money as harness2 with loopmath, harness2 cut down keeps 52% of the gain.

Where the money goes

Stacked bars of list dollars over the 40 tasks by part. Arm 1 407.06, of which 343.49 is Opus editing sessions. Arm 2 105.74. Arm 3 104.24.
List dollars over the 40 tasks, by part. The Haiku task runs are cheap; almost all of every arm's cost is Opus sessions.

Over the 40 tasks, harness2 as published cost 407.06 list dollars and harness2 with loopmath 105.74. Almost all of the difference is Opus editing sessions. loopmath runs more task runs than harness2, 12 probes on every task, but a Haiku run costs a few cents, and its Sonnet tester costs less than its task runs. The expensive part, the frontier model, is where loopmath saves.

Spending only where it pays

loopmath does not force an edit onto every task. It ran a final harness only when its fit found at least one edit worth keeping. That happened on 20 of the 40 tasks, where it kept between 1 and 10 edits, 5.7 on average. On the other 20, no edit showed a gain on the tester, so loopmath shipped a plain run and stopped.

Mean gain over base within two groups of 20 tasks. Where arm 2 shipped its edited final: arm 1 +0.083, arm 2 +0.070, arm 3 +0.065. Where it shipped a plain run: arm 1 +0.022, arm 2 +0.030, arm 3 -0.010.
Mean gain over base inside each group of 20 tasks, for all three arms. The two groups together make the 40-task means above.

On the 20 tasks where loopmath shipped its edits, its mean gain over base is +0.070, against +0.083 for harness2 on the same tasks. On the other 20, harness2's eleven sessions bought +0.022, and loopmath's plain run did as well. So on the half of the tasks where an edit could make a difference, loopmath found most of what harness2 found; on the other half, nobody gained much, and loopmath spent almost nothing finding that out.

Why it works

harness2 spends its budget generating and merging candidates, then trusts a single run of each. loopmath spends a little on generation and puts the rest into measurement. A balanced design means every run informs every edit, so the same 12 runs that would test 12 candidates once each instead estimate 10 edits from 6 runs apiece. The edits that help are kept together; the ones that do not are dropped before they cost a final run.

This is what loopmath does for any agent workflow: it treats each run as an experiment, estimates what each choice is worth on success and on cost, and spends where the evidence says it pays. Harness edits are one more choice it can weigh.

Try it

loopmath is open source under the MIT licence. The harness command is being packaged now; the rest of loopmath, the predictions, the success-cost curve and the paired checks, is on GitHub and PyPI today. To try loopmath on your own harness, get in touch.

← all postsRSS feed