Behavioral harnesses made a cheap coding model reliable, and a frontier one pricier
A controlled test of coding agents with and without a behavioral harness, decoded for developers deciding between cheap models plus checks and frontier models.
Picture a two-person API shop building a backend-for-frontend for a retail client. One developer runs the top-tier model through Codex because it gets the work right, and the token bill is starting to show up in client invoices. They tried the cheaper model on the same brief. It produced something that looked done, but it handled the awkward cases wrong: the timeout that should become a 202 with a poll link, the transient failure that needs a 429 and a retry interval. Now they're stuck. Pay frontier prices for every task, or pay a human to catch the cheap model's misses?
An experiment published on martinfowler.com on 13 October 2026 tests that exact trade-off with numbers. It compares coding agents building the same API service with and without a behavioral harness. GPT-6 Luna, a cost-optimized model, passed in 3 of 10 runs without the harness and in all 10 runs with it. That cost $0.273 per run, against $0.406 for the frontier GPT-6 Sol running without a harness. For Sol itself, the harness bought nothing measurable and cost about 7 times more.
What it is
This is a write-up of a controlled experiment, not a product. The author borrows Birgitta Böckeler's framing: a behavioral harness combines guides, which steer the agent before it acts, and sensors, which observe what it did and feed back so it can self-correct. Working Surface's 14 October issue attributes the experiment to Naresh Jain, founder of the API testing company Specmatic. The post that surfaced it, from @bibryam, credits @thoughtworks.
The task was a product-discovery BFF. It had to validate requests and downstream responses, call an Order API, publish only the first returned product to Kafka, and map failures to specific status codes (202, 429, 503, 502). These are the edge cases where the lede's cheap model trips. Each capability of the harness lines up with one of those failures:
- Machine-readable contracts as guides. OpenAPI specs covered the BFF and the Order API, and an AsyncAPI spec covered Kafka. Request-response examples covered timeouts, malformed payloads, filter violations, retry sequences and Kafka confirmations.
- Deterministic sensors. Contract conformance checks, API tests on response values, and assertions on side effects such as calls to downstream mocks and Kafka publication. Results came back as test results, CTRF reports and API coverage reports.
- An executable environment. Contract-driven mocks let the agent exercise its code against defined downstream failures and recovery sequences. An agent plugin supplied an API-development skill and MCP tools.
- Expectations the agent can't rewrite. The agent was told to preserve the contracts, examples and helpers, and to fix the implementation instead of weakening the expectations.
The author built the harness with Specmatic and writes that "equivalent contract-testing and service virtualization tools could provide the same capabilities." Evaluation was kept separate. Each run happened in an isolated Docker container with a fresh Codex home, and afterwards an outer loop ran 178 acceptance tests that the inner harness never had access to.
The alternatives, each from its own source:
- Frontier model, no harness. In this experiment Sol passed 10 of 10 unharnessed at ~$0.406 per run. That's simpler, but you pay frontier rates on every run (martinfowler.com).
- Spec-driven development. Spec Coding describes a spec as deciding what one change must do, while the harness enforces it and proves it was done. It argues teams end up needing both. A spec on its own doesn't check anything.
- A lightweight steering loop. SpecStory describes adding a guide line to AGENTS.md and a sensor only when a mistake slips through or repeats. It relies on a person noticing the repeat failures.
- Off-the-shelf agent harnesses. Strands Agents reports that the general-purpose harness you run (Strands, OpenCode, Claude Code, Codex and others) can roughly double token usage, often with little accuracy difference. Strands is reporting on its own product.
Who it's for
Pick this up if you run repeated, well-specified agent tasks, especially API work with clear contracts, and want to move them to a cheaper model without losing reliability. The result also applies to anyone accepting agent output on the agent's own say-so. The author argues the same sensors serve as an independent acceptance check "which matters for every model." daily.dev's summary reads the conclusion as: cost-optimized models benefit from continuous feedback, while frontier models only need a final independent verification gate.
Skip the full inner-loop harness if you're already on a frontier model and it passes your acceptance checks consistently. For Sol, the harness used about 10.5 times the tokens and nearly 3 times the runtime, with no change in accepted runs. Skip it too if you don't have contracts or examples to build guides from. This harness was only as good as the specs fed into it.
Before and after
Before (cheap model, no harness), as the experiment ran it:
- The agent gets the brief and the baseline repo instructions.
- It writes the service on its own interpretation.
- External tests run afterwards. With Luna, 7 of 10 runs failed acceptance.
After (cheap model, behavioral harness):
- The agent reads the brief alongside the OpenAPI/AsyncAPI specs and examples.
- The skill directs it to map components and link each required behavior to its downstream interactions and checks. Helper scripts scaffold those documents and the build/start/test commands.
- It runs the project's test command. That validates the examples against the specs, runs build and unit checks, starts the mocks, launches the app and runs the contract and behavior checks.
- Reports name specific contract, value and interaction mismatches. The agent fixes the code, reruns the affected scenarios, then runs the full suite as a final gate.
- External acceptance tests run. With Luna, 10 of 10 runs passed.
For a frontier model, the evidence points to a lighter workflow: let it build unaided, then run an independent acceptance suite that the agent can't edit. In exploratory runs, Claude Sonnet 4.6, Claude Opus 4.6 and Gemini 3.8 Flash also completed the task unassisted on the first try, all at low reasoning effort, according to the article.
Try it
The sources do not publish the harness code, the application brief or the 178-test suite, so you can't rerun this experiment as-is. What you can reproduce is the method.
- Write the acceptance check outside the agent's reach first. The article's acceptance bar was strict: the app had to start and pass every external test. SpecStory's walkthrough shows the small version. Add a browser or API test under an
acceptance/path, add a deny rule so the agent's edit tools can't change that path, and add a Stop hook that runs the test when the agent tries to end its turn. - Add guides only where the model misses. SpecStory's example adds one AGENTS.md line ("Changing the delivery address must not change the cart") after a specific failure.
- If you have API contracts, use them as sensors. The article generated contract checks deterministically from OpenAPI/AsyncAPI specs and validated example payloads against the specs before tests ran. That kept the guides and sensors from contradicting each other.
- Measure on your own task. Run the same brief several times per condition in clean, isolated workspaces, as the article did with Docker and a fresh Codex home. Count accepted runs, tokens, time and estimated cost separately.
SpecStory's wording on scope is "illustrative" and "simplified," and the sources give no commands, versions or pricing for setting any of this up.
Where it breaks
- One task, ten runs per condition, low reasoning effort. The article says the brief was unusually detailed and that the author does "not yet know how the results would change with a less complete brief." The rest of the article's own boundaries section wasn't available to us. Whether the result holds on existing codebases, or on tasks hard enough to trip frontier models, is untested in these sources.
- The harness raises Luna's cost too. daily.dev states the harness added about $0.187 per attempt to Luna compared with running it unharnessed. The savings exist only relative to the frontier model. The sources don't make clear whether $0.273 is an average over all 10 harnessed runs, or which pricing date the estimates use. Treat the dollar figures as estimates.
- Vendor interest. The harness was built with Specmatic, and Working Surface identifies the author as Specmatic's founder. Working Surface also notes the numbers come from one project.
- The agent has to call the harness. The article says the feedback loop "did not run automatically after every code edit." It depended on the agent invoking the tools.
- Keeping guides and sensors in sync is real work. The author calls it one of the big challenges. Contradictory guides and sensors confuse the agent.
- Directional support, different setups. A research summary from Machine Learning At Scale reports, from 176 ablation settings, that rich toolsets help weaker models but can bottleneck frontier ones, and that persistent planning tends to prune verification steps. Strands' figures use high reasoning effort and a September 17, 2026 snapshot, with estimated costs. Neither replicates this experiment.
- Checks only find what they check. SpecStory notes a sensor is only as good as its source of expected results. The article's own answer was human-agreed contracts, and it frames human review as focusing on "what the contracts don't cover."
Sources
- Are Harnesses Worth the Cost? · martinfowler.com
- Are Harnesses Worth the Cost? | daily.dev · daily.dev
- Dissecting Coding Agent Harnesses: What Actually Drives Performance · Machine Learning At Scale
- We ran 94,000 trials to measure the cost of harness choice · Strands Agents
- 14 October 2026 · Working Surface · Working Surface
- Harness Engineering vs Spec-Driven Development | Spec Coding · Spec Coding
- What is harness engineering? | AI coding agents | SpecStory · SpecStory
- @bibryam: 🤔 Are Harnesses Worth the Cost? - @thoughtworks · @bibryam