I have Claude Code, Codex, OpenCode, and Pi installed right now. Four terminal agents doing pretty much the same job, and constantly picking between them made me realise nobody has properly written about what actually separates them.
And it is not the models.
You can run the same model across all four. What changes is everything around the model. That "wrapper" is what we are going to look at in this post, and why it even matters.
So that became the plan. Same repos, same tasks, 14 days, all four harnesses.
This is not really a benchmark. It is more of a local, real world test of the harnesses (there is a benchmark later too, but that is just one part of the test). Actual daily use, looking at the stuff you only start noticing after a week or more. The agent loop, context handling, extensibility, permissions, and what each one actually costs to run.
ℹ️ Just looking at model pricing does not tell you the actual cost. The agent matters too, especially how it manages context and what it keeps sending back into the prompt.
I will not exaggerate, but some of what I found was kinda unexpected. The most popular harness turned out to be the most wasteful with tokens. The safest harness came from the company people probably trust the least.
I'll leave the rest for some suspense...
Let's get into it.
TL;DR
If you just want the answer:
| Harness | Best for | Biggest downside |
|---|---|---|
| Claude Code | Best overall daily driver | Heavy token usage, Claude only |
| Codex | Best sandbox and safety | Slow |
| Pi | Best if you pay per token | Almost no guardrails |
| OpenCode | Best model and provider flexibility | Weakest results in my benchmark |
A few quick takeaways:
- Claude Code is still the one I use the most. Fast, polished, and has almost everything built in.
- Codex is the safest of the four. The OS level sandbox is genuinely useful, especially with random repos.
- Pi was the surprise winner in my benchmark. Cheapest, most successful, and somehow does it with just four tools.
- OpenCode gives you the most freedom with models, but I personally used it the least.
If I had to sum up the whole post in one line: pick the harness first, pick the model second.
What is a coding agent harness?
ℹ️ The harness is everything around the model: the system prompt, the tools, the agent loop, context management, and permissions.

To be fair, strip away the branding and every one of these tools is basically the same thing. A loop.
The model reads your task, calls a tool, gets the result back in context, and repeats until it decides it is done. That loop, plus everything wrapped around it, is the harness.
And that wrapping is exactly where they differ:
- What tools the model gets. Pi ships 4. Claude Code ships 10+.
- How big the system prompt is. Community test put Claude Code at roughly 33,000 tokens of prompt and tool schemas before your first word, compared to OpenCode at roughly 6,900. 🤯
- What happens when context fills up. Silent auto compaction, or you managing it yourself.
- What the agent is allowed to touch. Kernel level sandboxes on one end, full YOLO on the other.
Before all these options like Pi, OpenCode, and Codex showed up, none of this mattered much because the harness and model came as one package. You used Claude Code, you got Claude. That is over now.
OpenCode and Pi run 20+ providers each, and open weight models like Kimi K3 are genuinely frontier class now.
Here is proof that the harness is pretty load bearing. Databricks ran the same model, Opus 4.8, through different harnesses on their internal codebase. Claude Code sent 742,000 tokens per task. Pi sent 236,999. Same model, same success rate, around half the cost.

Same model, half the cost in one harness. Yeah, that really happens.
When I say harness, I mean the CLI tool itself. When I say model, I mean the thing the harness calls. Keep that in mind.
How I tested
Okay, so there are two parts to the test:
Test 1: daily driving. For 14 days, all four harnesses stayed installed and I rotated them through my actual work. Same repos, same kind of tasks: a Next.js app with a decent amount of legacy mess, a mid size Go API, and a couple of smaller TypeScript side projects.
I ran all the harnesses through OpenRouter, so it's fair to all of them.
💁 I added this because you notice things here that benchmarks never catch. More about how the agent actually feels to use, and what a full day with it costs.
Test 2: controlled benchmark. Just saying this is good and that is bad based on daily use is obviously subjective. So I also ran a proper eval. 30 hard agentic tool use tasks against real apps, every harness wired to the same model, DeepSeek V4 Flash, through a hosted MCP tool router, with a 900 second limit per task.
Same model, same tasks, same tools. The only variable is the harness. Whatever gap shows up is the wrapper, not the model.
Claude Code
ℹ️ Anthropic's batteries included coding agent. Proprietary, Claude only.

Claude Code probably needs no introduction at this point. Boris Cherny hacked together the first version during his first week at Anthropic in late 2024, mostly to see what Claude would do with shell and file access.
By early 2026 it was around $2.5B in run rate, and SemiAnalysis estimates roughly 4% of public GitHub commits are now authored by it. 🤯
It ships with pretty much everything: 10+ built in tools, sub agents, Agent Teams, plan mode, MCP, Agent Skills, plugins, hooks, checkpoints with rewind, and a deny first permission system with five modes. It runs in the terminal, VS Code, JetBrains, a desktop app, browser, and even your phone.
Inside Anthropic, over 80% of engineers run it daily, and the tool now writes a huge chunk of its own codebase. Which is either inspiring or terrifying. You decide. 🤧
Anthropic trains the model and harness together, so as models improve, they keep removing scaffolding. More than 80% of the system prompt got cut for the Claude 5 generation.
OpenAI Codex
ℹ️ OpenAI's coding agent, with one Rust harness behind the CLI, IDE extension, and a lot more.

Codex started as a TypeScript CLI in 2025, then OpenAI rewrote the core in Rust.
That same Codex Core now powers the CLI, IDE, desktop app, and more, so the agent loop, tool execution, context handling, and permissions are shared across them.
The local harness is also more model agnostic. Codex supports custom providers, local models through Ollama and LM Studio, and compatible third party APIs. So yes, you can actually run Codex without an OpenAI model.
It also has kernel level isolation through macOS Seatbelt and Linux bubblewrap plus seccomp, with network off by default. Not permission prompts. Actual OS enforcement. It is the only harness in this lineup with that.
OpenAI's own internal numbers are almost always absurd to me. They claim nearly 98% of employees use it, and it serves trillions of tokens weekly across 8M+ weekly users. Upto you to believe. 🤷♂️

Typical OpenAI things.
Codex comes with every ChatGPT plan, from Free to Pro, so if you already pay $20 for ChatGPT Plus, you already have it.
This whole thing where Anthropic started closing OAuth authentication while OpenAI was encouraging people to use Codex happened around the same time too. OpenAI knows how to win developers. I'll give them that.
Codex's sandbox restrictions are enforced outside the model itself. The model is not simply being prompted to behave.
Pi Agent
ℹ️ The smallest harness in this list. Four tools, under a thousand tokens of prompt.

Pi is basically a protest project against Claude Code.
Mario Zechner, better known as badlogic, the libGDX author, spent most of 2025 inside Claude Code. But the system prompts and workflow kept changing every now and then. Eventually he decided the fix was to build an agent so small that almost nothing could change underneath him.
That became Pi.
The model gets read, write, edit, and bash. That is the whole tool list.

Zechner's argument is that frontier models have absorbed so much coding agent behaviour through RL that most of the extra scaffolding is not needed anymore. Anything else you want, ripgrep, gh, a browser, is either custom built or written on demand.
What Pi leaves out is kinda the whole point. No MCP, no sub agents, no plan mode, no permission dialogs, nothing. Super simple.
But most of it can be added with TypeScript extensions. These live inside the agent process and can intercept, rewrite, or replace almost anything, including Pi's own tools. And since the agent can read Pi's source, a missing feature is basically you asking it to build one.
By mid 2026 it sits at 85k+ stars and over a million weekly npm installs.
Remember OpenClaw? It uses Pi underneath.
The only problem is that there are basically no guardrails unless you add them yourself.
OpenCode
ℹ️ The most popular open source provider agnostic coding agent in the world.

OpenCode is the open source coding agent from the SST team, now rebranded to Anomaly.
It runs pretty much any model you want. Claude, GPT, Gemini, Kimi K3, DeepSeek, or local models through Ollama. 75+ providers in total.
It is also the most used open source harness right now, with around 196k GitHub stars and about 8 million monthly developers. Even Cloudflare has official docs for setting it up. Lol.

Under the hood, it runs as a client and server. The agent stays in a local server and the terminal UI, where we chat, just connects to it. So your session survives if the terminal closes or even if SSH drops.
The overhead is pretty small too. Around 6,900 tokens before your first message, while Claude Code sends roughly 33,000.
The project itself is completely open source, so the tool is free.
But how do they make money? 🤔
Anomaly makes money from Zen, their model gateway, and a $10/month Go plan with open models.
This is also the tool Anthropic cut off from Claude subscriptions in January 2026. So, a bit of bad news for Claude fans using OpenCode. The removal PR commit says just three words: "anthropic legal requests"

Context Management
ℹ️ How well an AI agent handles context is one of the biggest things deciding how good it feels to use.
Every file read, every tool result, every retry ends up in the context window, and each harness handles that very differently.
Every model has a limited context window. Say it is 1M tokens. Once you go past that, the model cannot keep everything around. So the agent has to decide what stays and what goes.
Claude Code auto compacts. When the window gets close to full, it summarises the conversation and keeps going. You can trigger it manually with /compact, and CLAUDE.md files act as persistent memory that gets loaded every session. Sub agents help too, since each one can read files in its own context and only send a summary back to the main session.
Codex does compaction on the server side. The model prepares compressed context, restarts in a fresh window, and keeps going. This is how it handles those 24+ hour autonomous runs OpenAI likes to demo. Similar to Claude Code, it also has a manual /compact command.
OpenCode does things a little differently. It never really deletes old messages. It just marks them as compacted so they become invisible to the model while staying in the database.
A hidden compaction agent writes the summary, then replays your last message automatically. Kinda confusing, but think of it like a soft delete in a database.
Pi barely needs much of this because it barely sends anything. In the Databricks benchmark, Pi sent around 3x less context per turn than Claude Code and Codex on the same tasks. Sessions are also trees, so you can branch from any point instead of always compacting.

💁 Let's talk numbers again. On the same Opus 4.8 model, Databricks measured 742,000 tokens per task through Claude Code, 1,235,000 through Codex, and 236,999 through Pi. Same success rate.
That kinda explains by itself why context management matters so much.
Extensibility
ℹ️ All four are extensible. The difference is how much comes in the box and how much you are expected to build yourself.
Claude Code has the biggest ecosystem. No contest.
Skills, plugins, hooks on lifecycle events, MCP as both client and server, custom slash commands, output styles, sub agents, Agent Teams, and the Claude Agent SDK.
If a workflow exists, someone has probably already shipped a plugin for it. Quite literally.
Codex created the AGENTS.md file you probably remember, which is now used by 60,000+ open source projects and got donated to the Linux Foundation.
It adopted the SKILL.md format in December 2025, the same one Claude Code uses, so skills are portable between the two. MCP works as client and server through config.toml.
There is also a proper SDK in TypeScript and Python, plus codex exec for CI.
OpenCode is configured through a single opencode.json. Custom agents are Markdown files with frontmatter, plugins are TypeScript modules you can pull from npm, and it supports MCP and skills.
Recently they also added support for reading .claude/skills, so your Claude Code setup mostly carries over to OpenCode too.
Pi skips most of this on purpose. No MCP, because popular MCP servers can dump 13k to 18k tokens of tool schemas into your context before you even type a word.
Instead, you get extensions. TypeScript files running inside the agent process that can intercept, rewrite, or replace almost anything, including the system prompt itself. The whole prompt lives in .pi/SYSTEM.md and you can swap it.
Skills somehow became the one standard everyone agreed on. Claude Code, Codex, and OpenCode all read the same SKILL.md format now.
Noiceee!

Permissions and sandboxing
ℹ️ This is where things get very different between the four harnesses.
Codex has the strongest setup here and it is not close. Restrictions are enforced by the OS kernel. macOS Seatbelt on Mac, bubblewrap plus seccomp on Linux.
You pick a sandbox mode, read only, workspace write, or full access, and an approval policy separately. Network access is also off by default in workspace mode.
Claude Code is prompt and deny by default. Risky actions ask first, you can allow specific commands, and there are five permission modes. You can also completely bypass them using bypassPermissions.
Anthropic added OS level sandboxing for bash later, but the normal experience is still mostly approval prompts.
OpenCode uses config rules. Every tool gets allow, ask, or deny, with glob patterns like "git *": "allow" and "rm *": "deny".
But there is no OS level sandbox underneath. If you approve something bad, nothing else catches it.
Pi ships with nothing. No prompts, no rules, full system access from the first message.
Zechner's argument is that permission dialogs are "security theatre" once an agent can write and run code, and the real fix is running the whole thing inside Docker or a VM. I am not a huge fan of this approach, but I can see why some people like it.

If you review random code from the internet, this section alone might decide which harness you use.
Model Support
ℹ️ Who runs what?
| Harness | Models | Local models |
|---|---|---|
| Claude Code | Claude only | No, there are some hacky ways though |
| Codex | OpenAI by default, custom providers possible | Yes, via Ollama and LM Studio |
| OpenCode | 75+ providers | Yes |
| Pi | 20+ providers, 300+ models | Yes |
Claude Code is Claude or nothing. Opus 5 is the default on Max plans. Enterprise routes through Bedrock and Vertex exist, but they are still Claude.
Codex is more open than people assume. codex --oss points it at Ollama, and any API that speaks the OpenAI format can be added as a custom provider.
OpenCode treats models like a dropdown. 75+ providers through the models.dev registry, plus their Zen gateway if you want one bill instead of five API keys.
Pi does the same. You can also switch models mid session and keep the conversation context. Ctrl+P, pick a different model, done.

Pricing
ℹ️ Two subscription harnesses, two BYOK harnesses. The approach is pretty different.
Claude Code: comes with a Claude subscription. Pro at $20/month or $17 annually for light daily work, Max 5x at $100, Max 20x at $200.
Codex: included in every ChatGPT plan, and I mean every one. Free, Go, Plus, Pro, Business, Enterprise. If you already pay $20 for ChatGPT Plus, you already have Codex.
Since April 2026, usage is tracked using token based credits, and local plus cloud usage share the same five hour window.

OpenCode: the tool is free. Bring an API key and pay the provider directly, or use Zen, their gateway.
There is also Go at $10/month, with open models like Kimi K3, GLM, and Qwen using dollar based limits.
Pi: also free with API key access. No subscription to hide behind, so you see exactly what every task costs.
Combine that with it being the most token efficient harness of the four and the bill stays surprisingly small and pretty consistent.
💡 If you're a heavy user, subscriptions probably make more sense. If you use these models occasionally, API pricing can be better.
Agentic Benchmark Comparison
ℹ️ 30 hard tasks testing tool calling abilities. Same model, only the wrapper changes.
Here's what we got with DeepSeek V4 Flash:
| Harness | Passed | Median time | Avg tokens per task | Total cost | Cost per success |
|---|---|---|---|---|---|
| Pi | 20/30 (66.7%) | 132.2s | 558,885 | $0.56 | $0.028 |
| Claude Code | 16/30 (53.3%) | 122.7s | 741,659 | $3.12 | $0.195 |
| Codex | 16/30 (53.3%) | 245.0s | 664,772 | $1.29 | $0.081 |
| OpenCode | 14/30 (46.7%) | 129.7s | 692,195 | $1.03 | $0.073 |

A few things worth noting:
Pi won, and it was not even close on cost. It passed the most tasks at around 3 cents per successful task, compared to Claude Code's 19 cents. The harness that ships four tools beat the harness that ships everything.
See, less is more sometimes.
Claude Code was the fastest and the most token hungry. Best median time of the four, but 741k tokens per task. Seriously.
On a subscription you barely notice that number. On an API key you definitely do. $3.12 for the run compared to Pi's 56 cents. Yeah, cents.
Codex was the slow one. Same pass rate as Claude Code at less than half the cost, but a 245 second median. Basically double everyone else.
It reads more, verifies more, and costs a lot less than Claude Code.
OpenCode came last on passes, which honestly surprised me given how lean its prompt is. Turns out lean overhead does not automatically mean better task completion.

It was still cheap per success, just less successful.
The Pi arm ran on high reasoning instead of max, and 24 of its 30 trials went through the official DeepSeek API rather than OpenRouter. Keep that in mind when looking at Pi's exact numbers.
The wild part is how closely this matches what Databricks found on their multi million line codebase with Opus 4.8.
Different model, different tasks, different company. Pretty much the same conclusion.
💁 Conclusion: the harness dramatically changes cost at the same quality.
Raw opinions after 14 days
No tables here, no token numbers. This is just how each one felt in my actual coding workflow.
I also did not stick to one model here. I switched depending on the work. So here is the raw review.
Claude Code
I will be honest, I still use Claude Code more than any other agent. Maybe because I have been using it since the start, or maybe because I already pay for the subscription.
Almost every time I wanted an LLM in the terminal, I opened Claude Code. Bugs, features, random fixes, whatever.
It was also the fastest of the four in my benchmark. I barely have to think about the tool itself.
What bugged me over the two weeks:
- The token hunger. 741k tokens per task in my run, the most of any harness here.
- Since usage is shared across Claude products, there were times I hit the session limit and had to stop.
- It only runs Claude. No escape from Anthropic. This might bug some of you more than me, especially considering how good Fable and Opus 5 are at coding.
This is a bit unrelated, but the recent Opus 5 feels so freaking unhuman sometimes. The replies are dry, dense, and very AI coded. It takes a while just to understand what it is trying to say.
The thing I hate most is still the token usage. Having to stop because of limits on a plan I already pay for just feels wrong.

OpenAI Codex
Codex is slow. That is basically my only major problem with it so far.
What I absolutely love is the sandbox. This is the only harness where I ran random cloned repos without thinking twice, because the OS enforces the boundary instead of some dialog box.
Same pass rate as Claude Code at less than half the cost, and it comes with the ChatGPT plan I already pay for. What more do you want?
Well, maybe speed.

Pi Agent
Pi is a little too much for my taste. Asking it to build everything that is not there from scratch gets tiring in a long coding session.
But it was so good at times that I genuinely started questioning what all those extra tools and all that engineering in the other three were even doing. Lol. It even won my benchmark at 3 cents per successful task.

The problem is that Pi gives you basically nothing for free:
- Full system access from the first message, no prompts, no rules. Either run it in Docker or take the risk.
- You spend quite some time setting up things that come by default in the other three.
- There is always this tiny thought in your head asking what happens if it decides to
rm -rfyour entire system.
I am a NeoVim guy and I actually enjoy setting things up from scratch. But having to rebuild the same basic stuff again and again gets a little annoying.
Everything else about Pi is honestly great.
OpenCode
OpenCode is the one I used the least, I would say. And I kinda feel bad about it.
There is real engineering here:
- Sessions survive SSH drops and closed terminals because the agent lives in a local server.
- Any model is one dropdown away, including local ones.
- And there is a lot more.
But it came last in my benchmark, and daily use felt kinda similar. Same tasks, but I got a few more bad responses compared to the others.
There is also no OS sandbox. And the TUI felt a little heavy on my machine. Not sure if it is the same for everyone, but it ate more RAM than I expected.
Conclusion
14 days, four harnesses, one benchmark, and I think the biggest takeaway for me is pretty simple.
The model decides how smart your agent is, but the harness decides how fast, safe, and expensive that intelligence is to actually use.
Wow, what a line I created on the fly. 😎
But yeah, before doing this I probably cared way more about the model than the harness. After using the same model across different agents, I don't think that's the right way to look at it anymore. The wrapper decides what tools the model gets, how it manages context, what it can touch, and eventually how much the whole thing costs.
So if I had to put it in one line: pick the harness first, pick the model second.
For me, Claude Code is still the one I use for day to day work. Codex is what I'd pick when sandboxing matters a lot, Pi is really hard to ignore when I'm paying per token, and OpenCode is there when I want the freedom to run pretty much whatever model I want.
That's the post, literally. This took me way too long to test and write, so hopefully it helps you pick your coding agent without having to install all four and spend two weeks figuring this out yourself.
And if you disagree, well, all four are one install command away. Try them and come argue with me. ✌️
