The code wrapping an LLM matters as much as the model itself, with a 6x performance gap on one benchmark. Meta-Harness automates the search for that code by giving a coding agent filesystem access to the source code, execution traces and scores of every earlier candidate. Raw traces lift the median harness from 34.6% to 50.0%.
Pick what the proposer is allowed to read, then run 20 iterations of the search. Watch where the harnesses it finds land. Then we build, piece by piece, why seeing the raw traces changes everything.
You need LLM prompting basics, what an agent is and basic optimization intuition. We build the rest from zero.
Based on “Meta-Harness: End-to-End Optimization of Model Harnesses” by Yoonho Lee, Roshen Nair, Qizheng Zhang, Omar Khattab, Kangwook Lee and Chelsea Finn (Stanford, MIT, KRAFTON, 2026).
Each run searches harnesses for online text classification. Start with scores only, then give the proposer the raw traces.
The median accuracies are the paper’s ablation numbers for text classification: scores only 34.6, scores plus LLM-generated summaries 34.9, full filesystem access 50.0, and 56.7 for the best candidate with full access. The other 19 dots in each run, and the best candidates of the two ablations, are illustrative: the paper reports that the full-access median beats the best candidate of either ablation, and no more than that.
Chapter 0
See how the code around a fixed model changes its score by 6x, and why no existing optimizer can read the evidence
You have the same LLM: same weights, same architecture, same everything. You change only the code that wraps it. What goes in the prompt? How is context managed? What examples are retrieved? How is memory updated? The performance gap is 6x on the same benchmark.
This is the harness engineering problem. The harness is the code around the model, and it often matters as much as the model itself. Right now, designing a good harness is entirely manual. An engineer inspects failures, tweaks prompts, adjusts retrieval logic, and repeats. It is slow, it does not scale, and it depends entirely on the engineer’s intuition.
Why is this hard to automate? A harness is a program, not a prompt template. It decides what to store, when to retrieve it, how to build prompts, and how to update state after each model response. A single choice about what to put in context can change behavior many reasoning steps later. The feedback signal is spread across code, scores, and execution traces. It is extremely hard to compress into a simple gradient or summary.
Existing text optimizers (OPRO, TextGrad, AlphaEvolve, GEPA) try to improve prompts step by step, using feedback from prior attempts. But they compress that feedback too much. Some condition only on scalar scores, others use short LLM-generated summaries, and others restrict feedback to templates. The diagnostic context they work with ranges from 100 to 30,000 tokens per optimization step. For harness search, a single evaluation can produce 10,000,000 tokens of diagnostic information.
The same base model reaches very different scores depending on its harness. Press Shuffle harnesses to see how other harness designs land on the performance spectrum.
Illustrative: these bars show the shape of the spread on text classification, not measured results. The 6x figure itself is the paper’s, for SWE-Bench Mobile. Every shuffle draws new made-up scores from fixed ranges, with Meta-Harness always in the top range.
Every part of the instrument at the top of this page gets its own chapter. Here is where to look.
Chapter 1
Store every code file, trace and score, then let a coding agent decide what to read
Here is the central idea of Meta-Harness: give a coding agent full filesystem access to all prior experience, and let it decide what to inspect.
Instead of compressing feedback into a summary or a score, Meta-Harness stores everything: every candidate harness’s source code, every execution trace (the actual prompts sent, the model’s responses, the state updates), and every evaluation score. All of it goes into a filesystem. The proposer, a coding agent, navigates this filesystem freely with standard developer tools: grep, cat, ls. It reads what it needs and ignores what it does not.
The proposer is not a raw LLM that receives a fixed prompt assembled by the outer loop. It is a coding agent, Claude Code with Opus-4.6, that can invoke developer tools and modify code. This matters because the amount of experience quickly exceeds any model’s context window. In the most demanding setting, the proposer reads a median of 82 files per iteration, and it references over 20 prior candidates per step. The total diagnostic information from a single evaluation reaches up to 10 million tokens.
Chapter 2
Define the program around the model, then write the one equation that says what we are searching for
Before we can optimize harnesses, we need to define what one is. A harness is a stateful program that wraps a language model and determines what context the model sees at each step. It handles:
Let M be a fixed language model and X a task distribution. For a harness H and task instance x from X, we execute a rollout trajectory:
The harness builds prompts for M, the model responds, and the harness updates its state after each interaction. A task-specific reward function r(τ, x) scores the trajectory. The objective:
In plain English: find the harness program that makes the model perform best, on average, across the task distribution. When multiple objectives matter (accuracy and context cost), the system evaluates candidates under Pareto dominance and reports the resulting frontier. A candidate is on the frontier when no other candidate beats it on every objective at once.
In practice, each harness is implemented as a single Python file. This keeps the search space navigable: the agent can read, understand, and modify a single file more reliably than a multi-file project. The file contains all the logic for interacting with the base model M on a given task.
Chapter 3
Step through read, propose, evaluate and store, and watch the filesystem grow
The Meta-Harness search loop is deliberately simple. No evolutionary operators. No parent-selection rules. No fitness-proportionate sampling. Just a coding agent with a growing filesystem.
Every evaluated harness gets its own directory in the filesystem. It contains:
Press Next step to move the loop one phase. Watch the filesystem grow as candidates are evaluated and stored. The agent reads prior experience before each proposal. Or press Run all to play six iterations.
The four baseline scores (zero-shot 27.4, few-shot 34.3, MCE 40.0, ACE 40.9) are the paper’s text-classification numbers. The candidates the loop adds are illustrative: two per iteration, each scored a little above or below the best so far with fixed pseudo-random steps. A real run uses about 20 iterations; this toy stops at six.
Chapter 4
See what compression throws away, and why the ablation behind the hero jumps from 34.9 to 50.0
This is the engineering decision that makes Meta-Harness work. Prior text optimizers compress feedback for a practical reason: scalability. But that compression loses the information needed to trace downstream failures back to earlier harness decisions.
Consider what happens when a harness fails on a task. The failure might be caused by:
A scalar score tells you the harness failed. An LLM-generated summary might say “the model struggled with multi-step reasoning.” But the raw execution trace shows you exactly which prompt was sent, what the model said, what state was updated, and where the chain of reasoning went off the rails. That is the information you need to fix it.
| Method | History Access | Log Content | MTok/iter |
|---|---|---|---|
| OPRO | Window | past (solution, score) pairs | 0.002 |
| TextGrad | Last | textual feedback on current artifact | 0.015 |
| AlphaEvolve | Window | program database + eval scores | 0.022 |
| GEPA | Summary | reflective feedback from rollout traces | 0.008 |
| Feedback Descent | Summary | comparison + textual feedback | 0.012 |
| TTT-Discover | Window | prev solution fragment | 0.026 |
| Meta-Harness | Full | all logs and scores | 10.0 |
Tokens of diagnostic information available per optimization step. The scale starts on log, because Meta-Harness operates with ~1000x more context than any prior method. Switch to linear to see what a straight ruler does.
Values are the table’s MTok per iteration written as tokens (0.002 MTok is 2,000 tokens). Meta-Harness is the paper’s upper figure of up to 10 million tokens; the agent reads a selected part of it, a median of 82 files.
A natural question: why use a plain filesystem instead of a vector DB or a structured knowledge graph? Because the agent’s queries are unpredictable. Sometimes it needs to compare two specific harnesses’ retrieval logic. Sometimes it needs to grep for a particular error message across all traces. Sometimes it needs to read the reasoning log of the highest-scoring candidate. A filesystem with standard UNIX tools supports all of these access patterns without pre-committing to a retrieval strategy.
Chapter 5
Search over whole Python programs, and see why that makes credit assignment possible
Meta-Harness searches over full Python programs, not prompt templates or configuration files. This is a fundamental difference from prior text optimization methods.
A prompt template has a fixed structure with slots to fill. A code-space harness can change anything: the retrieval algorithm, the memory data structure, the prompt construction logic, the error handling, the multi-step orchestration strategy. The agent can rewrite the retrieval function from dense search to BM25, add a caching layer, change how examples are formatted, or restructure the entire control flow.
Code-space search makes credit assignment possible. When the agent reads an execution trace, it can see: “This harness used BM25 retrieval and got 3 irrelevant examples for problem #47, which led the model to apply the wrong proof technique.” That is actionable. The agent can then modify the retrieval function specifically, rather than making a vague “improve retrieval” edit.
In practice, the proposer is guided by a minimal domain-specific skill. The skill describes where to write new harnesses, how to inspect previous harnesses and their execution traces, and what files it can and cannot modify. It acts as a soft constraint on the search space without hard-coding any search strategy.
Chapter 6
Compare Meta-Harness with hand-designed harnesses and text optimizers on accuracy and on cost
The first test domain is online text classification. An LLM receives labeled examples one at a time, updates its memory, and is evaluated on a held-out test set. The model is GPT-OSS-120B. There are three datasets: LawBench (215 criminal charge classes), Symptom2Disease (22 classes), and USPTO-50k (180 chemical reaction classes).
The baselines are the current state-of-the-art hand-designed harnesses for this problem:
Meta-Harness reaches 48.6% accuracy, a 7.7-point improvement over ACE, while using only 11.4K context tokens. That is 4x fewer tokens than ACE. Higher accuracy, lower cost.
For a fair comparison against other search methods (same proposer model, same evaluation budget):
| Method | Median Acc | Best Acc |
|---|---|---|
| GEPA | 32.6 | 40.2 |
| Best-of-N | 34.0 | 44.2 |
| OpenEvolve | 39.1 | 43.3 |
| TTT-Discover | 34.1 | 45.6 |
| Meta-Harness | 50.0 | 56.7 |
Meta-Harness matches the best prior text optimizers’ final accuracy after just 4 evaluations, while they need 60. Its final accuracy surpasses theirs by more than 10 points.
The discovered harness generalizes to 9 entirely new datasets unseen during search, achieving 73.1% average accuracy vs 70.2% for ACE. This confirms that Meta-Harness captures generally effective strategies rather than overfitting to the search datasets.
Chapter 7
Check the same method on IMO-level retrieval and on a contested agentic coding leaderboard
The setup: augment an LLM with the ability to retrieve examples from a large corpus of 500,000+ solved problems before it attempts IMO-level math problems. The question is not whether retrieval helps. It is whether Meta-Harness can discover the right retrieval policy.
The search optimizes over retrieval harnesses for 40 iterations, using GPT-OSS-20B on a 250-problem search set. A single winning harness is then evaluated on 200 previously unseen IMO-level problems, across five models (including four never seen during search).
TerminalBench-2 evaluates LLM agents on 89 challenging tasks that need long-horizon, fully autonomous execution. This is an actively contested benchmark, and multiple teams directly optimize for it.
| Harness (Opus 4.6) | Pass % |
|---|---|
| Claude Code | 58.0 |
| Terminus 2 | 62.9 |
| Terminus-KIRA | 74.7 |
| Capy | 75.3 |
| Meta-Harness | 76.4 |
| Harness (Haiku 4.5) | Pass % |
|---|---|
| Claude Code | 27.5 |
| Mini-SWE-Agent | 29.8 |
| Terminus-KIRA | 33.7 |
| Goose | 35.5 |
| Meta-Harness | 37.6 |
On Haiku 4.5, Meta-Harness ranks #1 among all agents on the leaderboard. On Opus 4.6, it ranks #2 (76.4% vs ForgeCode’s reported 81.8%, though ForgeCode’s result could not be reproduced from their published code).
Performance across the three evaluation domains. Choose a task and read how far Meta-Harness (the warm bar) sits above the strongest baseline.
All bars use the values this page gives for the three domains: the text-classification averages of Chapter 6, the math gains over a no-retriever baseline, and the Haiku 4.5 pass rates. Each task has its own scale, so bar lengths are not comparable across tasks.
Chapter 8
Follow a real search trajectory and see the proposer form a hypothesis, test it and change course
The search trajectories reveal how the proposer agent behaves in practice. This is where the filesystem access pays off: the agent develops sophisticated strategies for navigating the search space.
Here is what the proposer actually does across iterations, reconstructed from the paper’s appendix:
In a typical iteration, the proposer:
This adds up to a median of 82 files per iteration, referencing over 20 prior candidates per step. The agent is doing what a skilled engineer would do (reading code, checking logs, forming hypotheses, testing edits), but at a scale and speed no human could match.
Chapter 9
Place Meta-Harness among the optimizers it builds on, and keep the numbers on one page
Meta-Harness sits at the intersection of several important research threads. Let us map where it fits.
AlphaEvolve (Google DeepMind) searches over executable code for mathematical functions and algorithms. Like Meta-Harness, it uses LLMs as mutation operators over code. But AlphaEvolve operates on designated functions within fixed scaffolds and uses a structured program database with eval scores (~22K tokens/iter). Meta-Harness searches over entire harness implementations with unrestricted filesystem access (~10M tokens/iter). On text classification, Meta-Harness outperforms OpenEvolve by 13+ points.
GEPA uses “reflective feedback from rollout traces”, but these are LLM-generated summaries of traces, not the raw traces themselves. Meta-Harness’s ablation shows this compression loses critical diagnostic information.
OPRO conditions only on past (solution, score) pairs. TextGrad uses textual feedback on the current artifact only. Both operate in a much narrower feedback regime than Meta-Harness.
The AI Scientist uses coding agents to propose and evaluate scientific hypotheses. Meta-Harness applies a similar agent-driven search loop, but specialized to harness optimization rather than scientific discovery.
Meta-Harness’s proposer is a coding agent (Claude Code with Opus-4.6). The key contribution is not the agent itself but the outer loop: what information the agent sees, how experience is accumulated, and how the search is structured.
The authors explicitly cite Sutton’s Bitter Lesson: “once a search space becomes accessible, stronger general-purpose agents can outperform hand-engineered solutions.” Meta-Harness is a concrete instance of this pattern applied to harness engineering.
| Aspect | Meta-Harness |
|---|---|
| What it optimizes | Harness code (Python programs wrapping an LLM) |
| Proposer | Claude Code with Opus-4.6 |
| Feedback mechanism | Full filesystem of code + traces + scores |
| Context per eval | Up to 10M tokens |
| Files read/iteration | Median 82 |
| Search budget | ~60 harnesses over 20 iterations |
| Text classification | +7.7 over ACE, 4x fewer tokens |
| Math reasoning | +4.7 on 200 IMO-level problems, 5 models |
| Agentic coding | #1 Haiku 4.5 on TerminalBench-2 (37.6%) |
| Key ablation finding | Full traces >> summaries >> scores only |
| Convergence speed | 10x fewer evals than best text optimizer |
The whole method fits in a few lines. This is a sketch, not the authors’ code: proposer, evaluate and pareto stand for the coding agent, the task runner and the frontier test.
pythonD = Filesystem() # code + traces + scores, all of it (Ch 1) for h in baselines: # zero-shot, few-shot, ACE, MCE D.store(h, evaluate(h)) # Ch 3: initialize for t in range(N): # about 20 iterations new = proposer(D, k=2) # grep/cat D, then write k single-file harnesses for h in new: if h.passes_interface_check(): D.store(h, evaluate(h)) # code, trace and score go back into D return pareto(D) # accuracy vs context cost (Ch 2)
Now press Present or Teach and explain the method from memory: why the harness matters, what the proposer reads, what one iteration does, and why summaries lose the cause of a failure. Then go back to the instrument at the top, switch between scores only and raw traces, and say why the dots land where they do.