The Harness Is the Other Half of Every AI Tool
· 14 min read
When an AI tool fixes a bug, edits a spreadsheet, or books a meeting, it is tempting to hand the model all the credit. But the model on its own cannot do any of those things. It cannot see your files, run a command, or check whether its own answer is right. All it can do is produce text.
The thing that turns that text into real work is the harness, and it is the part most people never stop to think about. Claude Code and Codex are both good examples, and neither one is a model. Claude Code is Anthropic's harness wrapped around its Claude models, and Codex is OpenAI's harness wrapped around models like GPT-6 Astra. Even a plain chat window is a harness, just a very simple one: it takes your message, passes it to the model, and shows you the reply that comes back.
In this article I want to walk through what a model can and cannot do by itself, the five parts of a harness that close the gap, and the loop that ties them together. I will lean on one example the whole way through, the kind of task you would hand to a tool like Claude Code or Codex: "The checkout tests are failing. Find out why and fix it."
Here is the part that surprised me when I first dug into it: the same model can perform very differently depending on the harness around it. A 2026 paper on agent evaluation makes the point directly. Holding the model fixed and changing only the harness raised its Terminal-Bench 2 score from 69.7% to 77.0%, and third-party monitoring has seen the harness alone account for up to 15 percentage points of variation on SWE-bench Verified. The paper's conclusion is that every benchmark score is really produced by a model and a harness together, even though we almost always pin the number on the model.
The harness can even flip which model looks better. In another 2026 study, Claude beat GPT on Terminal-Bench 4 inside one open-source harness, OpenHands, by 36 tasks to 31, and a different harness reversed that order, 22 to 33. The same study found that a model's own vendor harness was not always the best one to run it in.
That changes how you should read AI progress, too. When a tool suddenly gets better at something, it is easy to assume the model got smarter, but just as often the harness got better at handing the same model the right context, tools, and checks. And unlike training a model, improving a harness is ordinary software work, which is a big part of why so much of the recent progress has landed there.
A large language model is, at heart, a text predictor. Give it "The sky is" and it predicts the next token, most likely "blue", because that is what tends to follow in the enormous amount of text it learned from. Do that one token at a time, over and over, and you get paragraphs, code, and answers.
That is a lot, but it leaves four real gaps:
- No memory. Every new conversation starts from nothing. The model does not know who you are or what you worked on yesterday.
- No senses. It cannot see your files, your screen, or your codebase unless someone puts them in front of it.
- No hands. It can tell you what to do, "open this file, change that line", but it cannot do any of it itself.
- No way to check. It cannot run its code or test its answer. The most it can do is tell you whether the answer looks right to it.
Hand a bare model the failing checkout tests and the best it can offer is a plausible guess about what might be wrong, written without ever seeing the code or running a single test.
I find it helps to picture a harness the way you would a saddle and reins on a horse. The horse has all the power; what it does not have, on its own, is anything to point that power where you need it to go. A harness gives the model that direction and control, and it does it through five parts: context, memory, tools, verification, and permissions.
When a session begins, the model knows nothing about your situation. Say "hello" and it will say hello back, but it has no idea of your name, your project, or what you are trying to get done.
The harness fixes that by quietly adding information to the very start of the conversation: which project you are in, how the files are laid out, what changed recently, which tools are available, and how you like things done. You never see most of it, but the model reads all of it before it ever reaches your first message.
For the part you control, coding harnesses use instruction files. Claude Code reads a CLAUDE.md file, which its docs describe as persistent instructions Claude reads at the start of every session, things like build commands, conventions, and "always do X" rules. Codex and plenty of other tools use AGENTS.md for the same job, and Claude Code can read that one too. For our example, the file might say:
- Use pnpm, not npm.
- Run `pnpm test` before you say a change is done.
- Don't edit anything in `src/generated/`.
You write this once, and every session from then on starts with it already in place. That is the real value of good context. Instead of repeating the same instructions in every prompt, you solve the problem a single time.
The longer you work with a model, the more of its context window fills up with messages, file contents, and command output. That window is a fixed size, set when the model was built, and as it fills, things get worse rather than better: the model grows less reliable, and older instructions start to clash with newer ones.
Harnesses deal with this through compaction. When the window is close to full, the harness condenses the history into a shorter summary that holds on to what matters, the goal, the plan, the files changed, the current step, and the errors so far, while old steps shrink to a line or two and dead ends drop away. The model keeps going in the same direction, with room to actually work. Claude Code does this on its own as a session nears its limit, and Anthropic now offers compaction in the API as well, where Claude writes the summary on the server.
Memory can reach past a single session, too. Claude Code's auto memory, for instance, is a set of notes Claude keeps for itself based on your corrections and preferences, stored per project and loaded at the start of each new conversation. Tell it once this week that the checkout tests need a local database running, and next week's session can start already knowing it.
Since a model can only put out text, tools work by agreement. The harness tells the model which tools exist and how to ask for them, and when the model wants to act, it writes a request in a structured format, something like "run pnpm test checkout". The harness spots that request, matches it to the right tool, runs it, and feeds the result back to the model as more text.
This is happening constantly. In a single coding session a harness might handle dozens of tool calls a minute, reading files, searching the codebase, running commands, almost none of which you ever see. If the model is the brain, tools are the hands: a brain can plan to pick up a cup, but with nothing connecting it to a hand, the cup stays exactly where it is.
A lot of harness improvement lives at this layer. Trimming long tool outputs so they do not flood the context, designing tools that come back with short and useful results, helping the model reach for the right tool in the first place, all of it makes the same model faster and cheaper to run.
The most common way to add tools right now is the Model Context Protocol (MCP), an open standard Anthropic introduced in November 2024 for connecting AI systems to data sources and apps. An MCP server describes a set of tools in a standard way, so any harness that supports MCP can use them. If you want a model to work with an internal system at your company, you can build an MCP server for it, often with the agent's own help, and plug it into whatever harness you already use.
Ask a model to review its own code with nothing else to go on and it will usually tell you it looks fine. It can judge whether the code reads well and has roughly the right shape. What it cannot do is know whether the code actually runs.
Verification gives it a way to find out. The harness runs something with a built-in check, a test suite, a linter, a type checker, a formatter, and feeds the result back. In our example, the model changes the checkout code, runs pnpm test, and then either watches every test pass or reads the failure output and tries again. An exit code of 0 tells it the fix held, and that is a far stronger signal than its own opinion of the code.
Arithmetic is the simplest version of this. Because a model predicts digits as text, early chat models would sometimes answer something like 17 × 3 with a confident 48 instead of 51, and then dig in when you pushed back. Handing the model a calculator or a code tool put an end to that. It stops trying to work the answer out in its head and leans on something that is reliably right instead. We do the same thing ourselves: we reach for calculators, spell checkers, and code review precisely because our own judgment slips.
The last part decides what the model is allowed to do at all. Before a tool call runs, the harness checks it against a set of rules. Reading files inside the project might be fine on its own. Deleting a folder, pushing to the main branch, or sending data to a site it has never touched before might need your sign-off first.
Most harnesses let you add your own checks through hooks, which are points in the harness's lifecycle where your code gets to run. In Claude Code, a PreToolUse hook runs before a tool call and can allow it, deny it, or stop and ask you. You might use one to block any command that writes to the production database. Hooks help with verification as well: a PostToolUse hook that runs your test suite after every file edit means the model gets test results after each change, whether or not it thought to ask for them.
Some harnesses now put a second model in the gatekeeper's seat. In Claude Code's auto mode, a classifier reviews actions in your place, blocking things like mass deletions or sending sensitive data out, so you are not hand-approving every routine step.
A sandbox is the backstop underneath all of that. It is a restricted environment where the model can work freely without being able to reach outside it. Codex, for one, runs commands in a sandbox where, by default, writes are limited to your workspace and network access stays off until you turn it on. Sandboxes earn their place for two reasons:
- Mistakes stay contained. Models still get things wrong, and if one runs a command that deletes the wrong files, the damage stays inside the sandbox.
- Actions stay within scope. Models sometimes take shortcuts, or do more than you asked. A sandbox puts a hard limit on what they can reach, no matter what they decide to try.
For all of that, the model is still the part doing the deciding. At each step it reads the context and the current state of the task, and it works out what to do next from your instructions.
A lot of models now reason before they act, writing out their thinking first and then choosing an action. That ability is mostly trained into the model itself, but the harness controls how it gets used, for instance by setting how much thinking the model is allowed on a given task. Researchers have shown how much that can matter. In the s1 paper, a simple trick called budget forcing stretched a model's thinking by appending the word "Wait" whenever it tried to stop, which nudged it into checking its own work for longer.
Once the model finishes reasoning, the harness routes whatever it produced. The model might keep thinking, request a tool, hand you a result, or stop to ask a clarifying question. The harness cannot make the model more intelligent. What it can do is make the intelligence it already has far more useful.
Put all five parts together and you get the loop that most agent harnesses run. It builds on ReAct, short for reasoning plus acting, a pattern from a 2022 paper by researchers at Princeton and Google in which a model alternates between reasoning traces and actions. A modern harness wraps its own steps around the action:
- Think. The model reasons about the goal and settles on the next step.
- Act. It requests a tool call.
- Check permissions. The harness decides whether that call is allowed, needs approval, or gets blocked.
- Run. The harness runs the call, often inside a sandbox.
- Trim. It cuts the output down to the part that is actually useful.
- Observe. The model reads the result and works out what it means.
Then it loops back to the first step, and keeps going until the goal is met.
Here is how that plays out on the failing checkout tests. The model reads the instruction file and asks to run pnpm test checkout. The harness allows it, runs it in the sandbox, and trims a long log down to the two failing tests. The model reads them, asks to open the checkout code, and spots a discount being applied twice. It edits the file, and a post-edit hook reruns the tests on its own. One still fails, so the model reads the new error, finds a second place with the same bug, and fixes that one too. The tests pass with exit code 0, so it stops and tells you what it changed. Every one of those steps went through the harness: the context it started from, the tools it reached for, the checks that told it whether it was done, and the permissions that kept it inside your project.
Because harnesses are software, they are improving fast, and a few directions are already clear:
- More apps connected through MCP. As more platforms ship MCP servers, harnesses like Claude Code and Codex can reach them through connectors and plugins, with no custom integration work for each one.
- Agents working as teams. Today's harnesses already let an agent hand work off to sub-agents. Expect that to grow more built-in, with agents sharing context from others that have worked on similar problems.
- Many attempts, one answer. Rather than a single try, a harness can run the same task several times, sometimes across different models, check each attempt with its verification tools, and keep only the one that passes.
- Harnesses that improve themselves. A harness can study its own failures and adjust. If it notices the model wasting tokens listing every file in a project before it starts, for example, it can learn to search for the relevant files first.
Every one of those works on the harness rather than the model. As the models keep getting better, a lot of the improvement you will actually feel in your day-to-day work is going to come from the harness wrapped around them.