Skip to content
Max Narditdata & ai systems
← Articles
11 mindev

Claude Code's /claude-api harness-audit on an agent harness that serves two Claude models: why I would run it once per model

The audit re-sets harness code for one target model and keeps permission boundaries. The Freehand paper, out the same week, shows why the target matters: on Terminal-Bench 4, Claude Code scored higher than a bare harness with Sonnet 5.5 and lower with Opus 5.5.

Contents

Claude Code v2.1.335 shipped on December 3 with a new subcommand in its bundled API skill: /claude-api harness-audit, which finds “agent harness code written for older models (loop limits, sub-agents, context management, injected reminders, session-start code)” and proposes fixes as a diff. Two days earlier, a preprint called Freehand argued that agent harnesses have become a cage for frontier models, with eleven benchmark settings in which a harness built around one shell tool beat Claude Code, Codex and Gemini CLI on their own flagship models.

The audit is built to re-set harness code for one named model, and the paper’s data shows the ordering of two harnesses flipping between a frontier model and a cheaper one from the same family. For a harness that runs a lead on one Claude model and workers on another, my rule is to run the audit once for each model and measure each change on the model it targets. The procedure does not prescribe that; it follows from how it picks a target.

What does Claude Code’s /claude-api harness-audit check?

It reads the code around the model in your own agent harness, lists every component that shapes what the model sees, may do or is stopped by, and reports the ones that encode an assumption about an older model, with a proposed diff for the eligible findings. It changes nothing unless you ask.

Like the prompt-audit that /doctor runs on CLAUDE.md, the subcommand is a plain-English procedure shipped inside the binary, and it is new in this release: the 2.1.334 bundle has prompt-audit.md and no harness-audit.md. Claude Code unpacks bundled skill files into a per-version folder under its temp directory, so you can read the procedure before you run it:

shell
find "${CLAUDE_CODE_TMPDIR:-${TMPDIR:-/tmp}}" -path '*bundled-skills*' -name harness-audit.md 2>/dev/null

The inventory covers seven areas: the loop (turn, step, tool-call, wall-clock and spend limits, and which of them the model sees), tools and their results, context management, sub-agents and review stages, injected text, request settings, and code that runs when a session starts, resumes or continues after compaction. Each finding carries file:line, the pattern, the assumption behind it, the model it was tuned for and a confidence level. Hunks go into the diff only for high- and medium-confidence findings with a code action, and an empty diff is a valid result.

The first rule in the file is the one to read:

Prime directive: a harness setting is a per-model artifact.

The same paragraph says every finding names the model the component was tuned for and the model it is audited against, and that every removal is a hypothesis to measure. The audit’s stated job is to find these assumptions and say how to confirm each, “not to make the harness smaller.”

Which code does harness-audit read, and what does it leave out?

By default, your own harness code in the project, plus the logs and transcripts the repository keeps or the request points to. Not Claude Code’s built-in harness, and not your coding agent’s settings.

That boundary matters when you read the paper next to the command. Freehand measured Claude Code itself as a harness, with its built-in tools and reminders. harness-audit does not touch that layer. It audits a loop you wrote: an Agent SDK app, a Messages API agent, a batch job with tools. In a harness that also calls another provider, it audits only the Claude routes; if no route calls Claude, it says so and stops.

Some refusals are deliberate. Settings files such as .claude/settings.json are not read, so a hook you registered there is not in the inventory. From a .mcp.json at the project root it lists server names and nothing else (or only the path, if that check fails), and every other MCP file is reported by path. .env, credential and key files are skipped, and each report says so in a fixed sentence. Logs are read for counts and usage fields, never quoted. Transcripts are read for signs that the model struggles with a tool, such as the same call failing across runs, reported as counts without quotes. It runs no project code at all.

Prompt text is mostly prompt-audit’s job, and the report names it. The split is not perfectly clean: request settings and architecture are covered by both, and the harness audit runs the prompt audit’s architecture group as part of its own scan, reporting an overlap once.

How does harness-audit decide what to remove, rewrite or keep?

It sorts every component into one of four classes, and only the first holds removal candidates.

  1. Guards the model now supplies itself: preconditions it can judge, planning aids, steering it follows unprompted. Removal candidates, tested one at a time.
  2. Per-model settings: delegation, verification, progress updates, autonomy, tool-use triggers. Re-set from the target model’s section of the bundled migration guide; where that section says nothing, reported as “measure”.
  3. Measured values: effort, max_tokens, caps, timeouts, budgets, compaction thresholds. Kept when a measurement on the target model is recorded, otherwise reported as “measure” with no new value.
  4. Facts the model cannot supply: what the user can see, the date, a permission boundary, a check that a file changed since the model read it. These stay.

Removal candidates in the first group include read-before-edit gates, a required todo or think tool, context resets on a token count, and a reviewer at or below the lead’s tier, added for accuracy, on every step of work that fits one context. Two rows in another group overlap with what the paper measured, and their fix is a rewrite rather than a deletion: reminders concatenated into tool_result content move into a mid-conversation system message, and a fire-then-poll tool gets a real completion path. A component with a current measured win stays even when it matches a row, and so does one tied to a failure that still reproduces on the target.

The audit proposes a new number in only three cases. For a configuration the target rejects (a disabled-thinking flag or a thinking budget that returns a 400), only the rejected field is removed or replaced. A compaction trigger counted in tokens and set below the API’s default goes back to the default, unless the window, pricing, a policy or a recorded measurement says otherwise. And a fixed token budget the model is shown, that the harness does not enforce, that sits below the API’s minimum and has no measurement on the target recorded, is raised to that minimum. An enforced cap below it, another limit that reads the same value, or a link to a cost, safety or data-handling policy gets a flag instead, and so does a value whose history the audit could not look up. A deliberate spending limit is not something this audit raises on its own.

The keep list holds the rest: tests, validators, schema checks, checks of the task against its written criteria, permission gates, and anything whose job is blocking actions that break a safety or permission policy. A stop-or-ask rule scoped to destructive or hard-to-reverse actions is a permission boundary, not an autonomy setting. A reviewer that blocks “anything unsafe” without naming a policy is flagged for its owner, not deleted.

What did the Freehand paper measure about Claude Code’s harness?

The paper reports that on Claude Opus 5.5, a harness with one bash tool, a transcript the model can edit, and a per-turn meter of context, tokens, cost and time scored higher than Claude Code on all five of its benchmarks, at lower cost per task. Across all eleven settings, including GPT-6-astra in Codex and Gemini 4 Carbon in Gemini CLI, it reports +5.1 points on average against each model’s first-party harness and $3.73 against $7.34 per task. The Opus 5.5 margins range from about one point on Terminal-Bench Science (54.3% against 55.2%) to 7.0 points on Terminal-Bench 4.

Freehand’s prompt is about 200 words, and its opening paragraph hands the model everything the harness does not:

Nothing else is decided for you. How you approach the task, how you use your context, and so on are all yours to manage.

Some of the trace evidence lines up with the audit’s rows. The paper counts 38 to 199 runtime reminders per task injected by Claude Code across benchmarks, “roughly doubling model turns at matched command counts.” In one Terminal-Bench Science run, Claude Code’s 120-second command cutoff and 127 budget reminders produced 298 turns and $8.83 for a score of zero. A different bash-only harness with a hardcoded 30-second timeout spent 334 polling calls on a task Freehand finished by waiting up to 24 minutes in one call. The audit’s cap row makes the general point: a cap sized for one model either fires mid-task on another or no longer bounds anything.

Read the caveats before quoting any of it. This is a v1 preprint by the harness’s own authors. The Claude Code runs pinned versions 2.1.170 and 2.1.299, well behind 2.1.335. The two-benchmark ablations ran on GPT-6-astra; one restored Codex’s prompt and tools together, the other swapped the editable transcript for threshold compaction. Neither isolated a Claude Code component.

Does Claude Code’s harness help a cheaper model like Claude Sonnet 5.5?

On the one benchmark the paper used to test it, yes. On Terminal-Bench 4, Claude Code scored higher than Freehand with Sonnet 5.5 and lower with Opus 5.5:

Terminal-Bench 4, 63 tasks, 5 rounds (mean ± SD)Claude CodeFreehandCost per task (CC / FH)
Claude Sonnet 5.541.6% ± 6.334.9% ± 3.2$1.70 / $1.75
Claude Opus 5.554.9% ± 2.761.9% ± 1.6$4.91 / $3.38

The paper tests the flip directly on the same 63 tasks: within the Claude family, Freehand’s gap moves from minus 6.7 points to plus 7.0, a net reversal of 13.7 points with a 95% interval of +4.1 to +23.5. The GPT family points the same way but sits right at the 5% boundary. Freehand saved nothing on Sonnet 5.5 either. This is a whole-harness swap on one benchmark at high effort. It says the ordering reversed; it does not say which presets carried Sonnet, or how much harness any model needs.

The migration guide bundled with the same release makes the same point at the level of single settings. Claude Opus 4.8 needed prompting to delegate to subagents; Claude Opus 5 delegates freely, and the guide tells subagent-capable harnesses to remove the “delegate more” guidance and add a cap. Opus 5’s section says to delete verification instructions, while the Fable 5.1 section tells you to keep an existing test-before-reporting line and says the Opus 5 advice “doesn’t apply here,” marked tentative. For Sonnet 5.5, the guide adds a line telling the agent to run a real check before reporting code as done when it runs at low effort or reports changes without test or build output. A harness tuned once is tuned for one of those models.

The audit’s target comes from your request first; otherwise from the destination of an in-progress migration the repository documents; otherwise from the newest model the repository’s code or docs point at; otherwise from the provider’s current flagship. Read literally, that yields one target per run, and nothing in the procedure splits a repository by route. A harness whose lead runs Opus 5.5 and whose workers run Sonnet 5.5 points at both. I would not leave the choice to the fallback.

How do you run harness-audit for each model your harness uses?

Run it once per target model, naming the model in the request, over a scope that includes the code both routes share. Then test each proposed change on every route it touches.

Check the version first (2.1.335 or later):

shell
claude --version

The documented invocation is the bare subcommand, from the harness repository:

/claude-api harness-audit

To pin the target, say it in words. The skill matches a bare subcommand directly and treats anything longer as a plain request, and its reference table sends a request to audit an agent harness to the same procedure, whose Step 0 takes scope and target from the request. These two requests were not run for this article; they show the shape:

/claude-api Audit this agent harness against claude-opus-5-5, the model the lead loop runs on.
/claude-api Audit this agent harness against claude-sonnet-5-5, the model the worker loop runs on.

Keep the scope at the repository rather than one route’s folder. A shared tool layer, a common reminder or one compaction setting belongs to both loops, and a removal can reach callers and tests outside a narrow scope. Read the top of each report before the findings: it states the target, what was assumed, what was skipped (git history needs git 2.45 or newer, and the procedure skips it when the repository’s .git looks unusual), which searches were narrowed, and which files were left unread.

Where the Opus report proposes removing a guard that the Sonnet report keeps, you have a hypothesis for each route, not a verdict. Test the change on both, including an end-to-end task where lead and worker interact, before you decide whether the setting should differ by route.

How do you measure a harness-audit change before you keep it?

One finding at a time, on 20 to 30 fixed real tasks plus the hardest ones the agent fails today, with cost per completed task next to the score.

That is the audit’s own Step 7, and a report with findings has to say that it did not run your code. Keep the model, effort and settings the same on both sides unless the finding changes one of them, run both sides in the same week under the same rate limits, and count every call of every agent the task spawned, retries included, in the cost. Two rules in it are easy to skip. To test removing a check, first add the failure it was written for to the task set, otherwise the removal passes by default. And run the unchanged harness a few times first, because a difference inside its spread is no result. The Sonnet row above is a reminder of how wide that spread can be: Claude Code’s five rounds there ran from 36.5% to 49.2%.

Review the hunks the audit labels mechanical (usage logging, a stable tool order, visible truncation markers) before you merge them; behavioral hunks get measured one at a time. Re-audit at the next model release and at the next harness change, since a benchmark score moves with the harness as well as with the model.

Which parts of an agent harness should no harness-audit remove?

The parts that limit what the agent may do, as opposed to the parts that decide how it solves the task. My read is that this sort comes first, because it is the one that does not change with the model.

Crutch or cage is a per-model question, which is why the audit has a target and why I would run it twice on a two-model harness. Boundary or judgment is a per-harness question. A permission gate, a sandbox or a total budget says what the system is allowed to do, and it says the same thing to Sonnet 5.5 and to Opus 5.5. Both sources draw this line. Freehand keeps permissions, sandboxing and total budgets with the host and says safety boundaries “are best enforced by the execution environment rather than by prompt-level rules.” The audit’s security row goes further than keeping them:

Rising capability makes a behavioral assumption unsafe, not just wasteful

Its fix for a guardrail that relies on the model behaving is to add a structural boundary and keep the behavioral layer. I have argued the same from the other side: a prompt is not an invariant, and anything that has to hold without judgment belongs in code or CI. So keep the boundaries in scope on every pass, because the audit has to see a prompt-only rule to report that nothing enforces it. Preserve the policy, check how the harness enforces it, and let the per-model findings re-set only the parts that steer.

01 / Discussion

No comment section here — all discussions happen on X.

Max Nardit@mnardit

02 / More articles