Meta-Harness is a method from researchers at Stanford, MIT and KRAFTON in which an AI coding agent rewrites the code around a language model, while the model itself stays frozen. What makes it work is what the agent gets to read: not just the scores of earlier attempts, but every raw execution log, up to about ten million tokens per round. With that, an automatically discovered harness beat the best hand-built harnesses it started from on a demanding coding benchmark. For organisations building agents, the lesson goes beyond one paper. The logs your agents produce today are the raw material for better agents tomorrow.
What a harness is, and what Meta-Harness automates
A harness is all the code that surrounds a model: the system prompt, the tools it may call, what it remembers, which examples it sees and when a task counts as finished. Claude Code is a harness around Claude, Codex a harness around OpenAI’s models. The authors’ paper points to a study in which changing only the harness around the same model produced a sixfold performance gap on the same benchmark.
Most teams still build harnesses by hand, through trial, error and intuition. Meta-Harness turns that into a search. A coding agent proposes a new harness, the harness is tested, and everything that happens is written to an ordinary folder of files. In the next round the agent reads that folder and proposes something better. The weights of the model never change.
The paper, by Yoonho Lee, Roshen Nair, Qizheng Zhang, Kangwook Lee, Omar Khattab and Chelsea Finn, appeared in March 2026 and was presented at COLM 2026, with a shorter version at an ICML 2026 workshop.
How the search loop works
The researchers start from a few working harnesses, such as an existing open agent. Then four steps repeat.
- The proposer, Claude Code running Opus 4.6 in the experiments, searches the folder of earlier candidates.
- It writes one or more new harnesses as plain Python code.
- Each candidate that passes an interface check runs on the tasks.
- Its source code, score and full execution logs are added to the folder.
At the end you get a set of harnesses that trade accuracy against cost, rather than a single winner. According to the authors, a run takes a few hours.

The folder is the key difference with earlier methods. A coding agent can search it with grep and cat, the way a developer works through log files. In the TerminalBench-2 runs, the proposer read a median of 82 files per round: about 41 percent source code, 40 percent logs and only 6 percent score summaries, across more than twenty earlier candidates.
Why raw logs beat summaries
Earlier techniques that optimise prompts or code automatically, such as OPRO, GEPA, TextGrad and AlphaEvolve, feed the model a heavily compressed history: the last attempt, a few scores or a summary. By the authors’ estimate that is 2,000 to 26,000 tokens per round. Meta-Harness allows up to roughly 10 million tokens of diagnostic context, hundreds of times more.
An ablation shows why this matters. With scores only, the median candidate scored 34.6 percent. Adding summaries written by a language model barely helped, at 34.9 percent. With access to the raw logs, the median jumped to 50.0 percent and the best candidate reached 56.7 percent.

Anyone who has chased a bug knows why. A score tells you something failed. A summary tells you roughly what. Only the log shows, for instance, that an agent lost three turns working out which Python version was installed, or that a command stalled halfway. Those details point to a targeted fix.
What the results show
| Task | Model | Meta-Harness | Best comparison |
|---|---|---|---|
| Text classification, three datasets | GPT-OSS-120B | 48.6% | 40.9% (ACE), using 4× more context |
| IMO-level maths, 200 problems | average of 5 unseen models | 38.8% | 37.5% (BM25), 34.1% without retrieval |
| TerminalBench-2, 89 tasks | Claude Opus 4.6 | 76.4% | 74.7% (Terminus-KIRA) |
| TerminalBench-2, 89 tasks | Claude Haiku 4.5 | 37.6% | 35.5% (Goose) |
The biggest gains in text classification come where many labels look alike, about 16 points on legal categories. In maths, a harness found with one set of models also helped five models that were never part of the search. On TerminalBench-2 the discovered harness beat the hand-built agents it started from, and with Haiku 4.5 it ranks first among reported agents. Stock Claude Code scored 58.0 percent with Opus 4.6 and 27.5 percent with Haiku on the same test.
What the search discovered
The discovered harnesses are readable code that an engineer can review. Three examples from the paper:
- Look around first. Before the first model call, the TerminalBench harness runs one shell command that maps the working directory, installed languages, package managers and free memory. It adds about 80 lines of code, saves two to four exploratory turns and wins 7 of the 89 tasks, mostly ones that need specialised software.
- Show the labels up front. For classification, the best harness puts the list of possible labels in the prompt, with examples per label and pairs that look alike but differ. It needs no extra model calls.
- Route by problem type. For maths, the harness sends problems down four routes, combinatorics, geometry, number theory and the rest, each with its own way of retrieving examples.
After six failed attempts that changed prompts and control flow at once, the proposer tried a purely additive change, and that one won. It attributed the earlier failures to a prompt rewrite that mixed too many things together. That is the conclusion a good engineer would draw from the same logs.
Read the numbers with care
- Same tasks for search and test. On TerminalBench-2 the researchers used the same 89 tasks to search for the harness and to score it. They checked by hand and with pattern searches that no task-specific answers leaked into the code, but the harness is tuned to that benchmark.
- Not the top score. ForgeCode reports 81.8 percent with Opus 4.6. The authors could not reproduce that result from public code. Among Opus agents, Meta-Harness ranks second.
- One proposer, three domains. All experiments used Claude Code with Opus 4.6 as the proposer. Whether other models search as well is untested.
- No price tag. The paper gives no cost in dollars or euros. Ten million tokens of context per round, dozens of candidates and five test runs per task add up quickly.
- Small margins in places. In maths the gap with the classic BM25 retrieval method is 1.3 points.
Google’s Harness², released in October, takes a related approach that adapts the harness per task during use. In that paper, Meta-Harness is the strongest alternative in three of four WorkBuddy-Bench comparisons. That the harness is a lever in its own right is no longer in doubt. How best to automate it still is.
Three things now called meta-harness
- Stanford’s Meta-Harness is the research in this article: a harness that searches for better harnesses. The code is open under the MIT licence.
- A meta-harness as a control layer sits above the agents you already use. Databricks’ Omnigent, open source under Apache 2.0 since June 2026 and still in alpha, puts Claude Code, Codex and other agents behind one interface with cost budgets, approval rules and a sandbox. Automatic optimisation is on its roadmap; today it is about control and collaboration.
- Meta, the company, has shipped its own harness, Muse Code, around its Muse Spark models since 5 August. Meta researchers also published HyperAgents, agents that modify their own improvement process. That work is in the same family as Meta-Harness, but it is a separate project.
What it means for organisations building agents
Meta-Harness makes a practical point that matters well beyond research labs. If raw logs are what let a system improve, then agent logs stop being a debugging by-product and become an asset to manage.
- Keep full traces, and govern them. Store prompts, tool calls, outputs and errors per run. In Europe those logs often contain personal data and confidential documents, so retention, access and anonymisation need the same care as any other dataset under the GDPR.
- Build your own test set first. An automated search optimises exactly what you measure. Without a test set of tasks that matter to your business, it will diligently improve the wrong things. Keep a held-out set aside, something the paper did not do for TerminalBench-2.
- Review generated harnesses like any other code. A discovered harness decides what your agent sees and does. It belongs in code review, security review and, where relevant, your AI Act documentation.
- Set a budget before you search. Start with a few rounds on a small task set and look at what the proposer finds before scaling up.
- Write the instructions carefully. The authors found that refining the instructions for the proposer did more than adding rounds or candidates.
Models are rented and change every quarter. The harness and the logs that improve it are yours, which is one more reason why context is owned and worth investing in. For more on the building blocks, see how DeepSeek Harness makes every part of an agent runtime swappable and why Anthropic deleted most of its system prompt for Claude 5.
Trying it yourself
The code is on GitHub, with the framework, the two reference experiments from the paper and a separate archive holding the discovered TerminalBench-2 harness. You need uv and Claude Code as the proposer; other models work if you adapt the wrapper that logs every interaction. The authors note that they only checked that the cleaned-up code runs. For a new domain, point a coding assistant at ONBOARDING.md, which leads to a plan of what to improve and how to measure it.
The log is worth more than the score
For years, improving an AI system meant better models or better prompts written by people. Meta-Harness shows a third route: let an agent read everything that went wrong and rewrite the code around the model. The teams that benefit first will not be the ones with the biggest model budget, but the ones that kept their logs and know what good looks like.
Frequently asked questions about Meta-Harness
Does the model itself learn with Meta-Harness?
No. The model’s weights do not change. Only the surrounding code is rewritten: prompts, tools, memory and the logic that decides what the model sees.
Is Meta-Harness made by Meta?
No. Meta-Harness comes from researchers at Stanford, MIT and KRAFTON. Meta has its own agent work, such as Muse Code and the HyperAgents research.
How is it different from Google’s Harness²?
Meta-Harness searches once, on a fixed set of tasks, for a better harness that you then reuse. Harness² adapts the harness per task during use and keeps lessons in a library.
Does a discovered harness work with other models?
Sometimes. The maths harness helped five models that were not in the search, with gains between 1.6 and 8.7 points. The TerminalBench harness was searched and tested per model.
What does a Meta-Harness run cost?
The paper gives no figure. A run takes a few hours, with up to about 10 million tokens of context per round for the proposer, on top of the cost of every test run.