Knowledges 13 min

Harness engineering: the model doesn't matter, the “environment” is everything

Same Claude Opus model, yet it feels way better inside Claude Code than in other tools? It's not a nerf, folks. What makes the difference is the harness - the entire environment the model works inside.

Also in: Tiếng Việt · 中文 · 한국어 · 日本語

Mở bài gốc trên X
You've probably wondered: “why is it the same Claude Opus model, yet it seems so much better in Claude Code/Claude Desktop than in Antigravity or OpenCode?” - this post explains why.

It's not because Anthropic hands out “juiced-up” models or nerfs them for those other tools. It's the exact same model.

And if you're still arguing online about “is GPT-5 or Claude Opus better”… you're arguing about the wrong thing.

The thing that actually makes the difference has a name: Harness Engineering.

The model is just the brain. The harness is what decides what that brain can do.

This is the context engineering I've talked about many times - but taken to a whole new level.


Table of contents

  1. What is a harness? (and why it's not a system prompt)
  2. SWE-agent - the first evidence: same model, 64% better performance
  3. How Anthropic built the harness for Claude Code
  4. OpenAI - 1 million lines of code, 0 written by hand
  5. The 7-layer taxonomy of agent harnesses
  6. 5 design patterns that keep showing up in every great team
  7. [Side rant] How this relates to ClaudeKit and the reality in Vietnam
  8. Wrapping up

1/ What is a harness? (and why it's not a system prompt)

This is the crux that a lot of people get wrong.

A harness is not a system prompt. It's not a wrapper around an API call. It's not an eval framework or a prompt template.

A harness is the entire environment an LLM operates inside - including:

  • The tools the model can call
  • The format of the information the model receives
  • How conversation history is compressed and managed
  • Guardrails that catch errors before they spread
  • Scaffolding that lets the model “hand off” work to the next session

The word “harness” was chosen very deliberately. The horse (the model) is strong and fast, but it has no idea where to run. The harness is what steers all that power.


2/ SWE-agent - same model, 64% better performance

In 2024, the Princeton NLP group (John Yang, Carlos Jimenez and colleagues) published a hugely important paper at NeurIPS 2024: SWE-agent.

The paper introduced the concept of an Agent-Computer Interface (ACI) - an abstraction layer sitting between the LLM agent and the computer environment. Just like HCI (Human-Computer Interface) is designed for human brains, ACI is designed for the LLM's “brain”.

The result? Same GPT-4 model, same task, same compute budget:

  • With a plain bash shell: solved 3.97% of issues on SWE-bench
  • With a custom ACI: solved 12.47% of issues
SWE-agent: % of SWE-bench issues solved (same GPT-4)
SWE-agent: % of SWE-bench issues solved (same GPT-4)
Label% of issues solved
Plain bash shell3.97
Custom ACI12.47

A 64% relative performance gain. No model change. No prompt change. Only the interface changed.

Let me explain why this number is insane: 64% isn't a marginal gain. It's the difference between “a tool that works” and “a tool you throw away”.

What's in SWE-agent's ACI?

4 main components, each reflecting a deep insight into how LLMs fail:

a/ Search with capped results (capped search)

Instead of returning 10,000 lines of grep output (flooding the context window), the ACI caps results at 50. If there are more than 50, it tells the agent to “narrow your search”.

Sounds so simple it's almost… insulting. But it's one of the highest-leverage changes in the whole paper. Why? Because agents are like people - when confused, they search all over the place, and the more they search the noisier it gets, and the noisier it gets the dumber they get. Capped search forces the agent to think more specifically instead of “grepping the whole world”.

b/ A file viewer that shows 100 lines, with state and line numbers

They tested several configurations: 30 lines (too few, loses context), the full file (too much, loses focus). 100 lines was the sweet spot.

And a small but extremely important detail: show the line number before every line of code. Because when the agent needs to write “edit lines 47-52”, it has to read the line numbers directly instead of counting. Reducing the model's cognitive load = freeing up capacity for solving the real problem.

c/ An editor with a built-in linter

After every edit, the tool automatically runs a linter. If the edit causes a syntax error, it gets rejected immediately before being applied, with a clear error message.

Why does it matter? Because without a linter, the agent might introduce a syntax error → run tests → see a failure for some other reason (not that syntax error) → chase the wrong bug → burn the whole context window → freeze up.

d/ Context management - compressing old observations

Observations older than the last 5 steps get compressed into a 1-line summary. This keeps the context focused on the most recent information instead of being “buried” in the full history.


3/ How Anthropic built the harness for Claude Code

If SWE-agent solves the “single session” problem, Anthropic faced a much harder one: what happens when a task is too big to fit in one context window?

And that's the reality of most real software projects. A web app has hundreds of files, thousands of functions, a test suite, config, docs, dependencies. Even a 200K token context window isn't enough.

Two classic failure patterns

Anthropic documented 2 kinds of failures when letting a model run on its own across many context windows:

Pattern 1: Doing too much at once. The agent gets the prompt “build a claude.ai clone” → tries to implement every feature → runs out of context window halfway → the next session inherits a pile of half-finished code, no docs, no idea what's done → burns context trying to make sense of the mess instead of moving forward.

Pattern 2: Declaring victory too early. The agent looks around, sees code already exists → concludes “it's done” → stops while the app is still incomplete. This isn't stupidity - it's reasonable inference from incomplete information. The agent simply has no way of knowing what “done” means for this project.

Locked section: The fix: a 2-agent architecture

Locked section: Testing: bugs that code review can't see

Locked section: 4/ OpenAI - 1 million lines of code, 0 written by hand

Locked section: The most valuable insight: redefining “engineering work”

Locked section: AGENTS.md - from monolith to progressive disclosure

Locked section: Enforce architecture with machines, not code review

Locked section: “Boring technology” wins

Locked section: 5/ The 7-layer taxonomy of agent harnesses

Locked section: 6/ 5 recurring design patterns

Locked section: Pattern 1: Progressive disclosure

Locked section: Pattern 2: Git worktree isolation

Locked section: Pattern 3: Spec first, the repo is the source of truth

Locked section: Pattern 4: Mechanical architecture enforcement

Locked section: Pattern 5: Integrated feedback loops

Locked section: 7/ [Side rant] How this relates to ClaudeKit and the real world

Locked section: Progressive disclosure

Locked section: Context engineering > prompt engineering

Locked section: Feedback loops

Locked section: What about the Vietnamese market?

Locked section: 8/ Wrapping up

Locked section: References

The rest is for Knowledges members

Plus 21 more sections (about 8 min) for members

You are reading roughly the first third. Knowledges, Combo and Community plans unlock paid articles in full; the Zuey AI plan reads previews only.