Build your own harness
Don’t get locked in builds on the same assumption: AI providers can change their limits, pricing or access, and if we use their harness, we have to work out how to take our skills and setup with us. I wrote that after trying to plan around unpredictable Codex usage resets. If we used Pi or OpenCode, we’d be solving that issue already. Pi is deliberately small and extensible, so it’s a good place to start.
However, Pi and OpenCode are both too generalized for my taste. We can probably beat them too on our specific use cases. We’re focused on a narrow use case, so we have fewer scenarios to handle and fewer edge cases to investigate. That makes it easier to hill-climb.
A lot of my work now revolves around preparing properties and measurements for different components so I can then let agents hill-climb and improve. Kogen and its components are great for this because a build either succeeds or fails. The state in between is useful when I need to investigate what happened. For scoring the run, I want the outcome and what it cost to get there.
What goes around the model
In September I posted about HarnessTax, by Melissa Z. Pan and colleagues at UC Berkeley and Arena Intelligence. They tried seven models in Claude Code, Codex CLI and Pi, on SWE-bench Lite and Terminal-Bench 2.0 (30 sampled tasks from each, three attempts for each model/harness pairing and task). I’d been spending plenty of time comparing models and effort levels, and here was a comparison where changing the harness could change the cost a lot without changing how much work got done.
Claude Code cost about twice as much as Pi on SWE-bench Lite across the shared models, and about 1.5 times as much on Terminal-Bench 2.0. Pi was competitive with just read, write, edit and bash. Across the two benchmarks, an alternative harness had the highest observed success rate in nine of the twelve comparisons involving Anthropic and OpenAI models.
Pi beats Claude Code and Codex with their own models. It’s sad that even with access to private models and effectively unlimited token budgets, OpenAI and Anthropic haven't optimized their harnesses to get the most out of their own models. harnesstax.github.io
Databricks tried agents on its own codebase and found something similar: with the model and thinking effort held the same, the harness could cost over twice as much in some cases without improving quality. Pi sent about three times less context per turn. They used their own changes for the benchmark, so the agents would be doing work that represented what they needed.
If I want to change what the model gets back after a failed check, I can do that in our loop. Or change its tools, or the context it gets. Then I can run the same tasks again, with the same Intent and checks. Are we making it read things it already knows? I want to be able to try a different version and measure that.
Keeping the part we need
For a prototype, I’d still start with an existing harness. There’s provider integration, cancellation, sessions and context handling to deal with, and Pi’s extension system might give you the workflow you want already.
I can keep returning to Kogen’s approved-Intent runs and measuring them. We extracted the engine as Kogen Loop, a standalone Go library and CLI, so we can change the engine while Kogen handles approval, verification, independent review and the commit. We wanted to be able to use Claude Code with our Claude subscription as well as our own agent for Claude through an API key, ChatGPT through a subscription or API key, SuperGrok and OpenCode Go.
Running our loop and Codex
For the first comparison, we gave Kogen Loop and Codex CLI the same Terra model and 24 Go tasks. We ran both at medium effort and then both at high. They passed everything at both efforts, which made the cost comparison fairly straightforward: how much did each use to get the task done?
At medium, Loop used 38.9% of Codex’s token-equivalents per passed task. At high, it used 42.2%. It used fewer on every individual task too, at both efforts. These were subscription-route runs, so we’re counting token-equivalents, with different weights for uncached input, cached input and output.

We checked API costs separately, putting both through the same key on 14 fresh Go tasks at high effort. They passed everything again. At API list prices, a pass cost $0.0876 with Loop and $0.1053 with Codex, with Loop cheaper on thirteen of the fourteen tasks. In another twelve-task round, both passed everything and the costs per pass were $0.1101 and $0.1420.
Getting the model to use a tool
We added a batching tool so the model could do several operations in one request. It used the tool, and in the twelve-task confirmation it did more operations per request. Requests and cost per pass were slightly lower, but the twelve-task comparison didn’t show a reliable reduction in either. We also tried asking it to batch work without adding the tool. That version failed two tasks. So the default loop still doesn’t have the batching change.
We’ve tried reasoning replay, lower text verbosity, an apply_patch tool and a yielding shell too. I haven’t adopted those changes from the published comparisons; some need more runs.
For each change we compare the current version and the candidate using the same tasks and checks. Failed runs cost tokens too, so they count. When something looks useful, we try fresh tasks as well.
I can now change that engine without rebuilding the rest of the workflow.
← All notes