The Harness, Not the Model
You pick a model, and then you wrap it in a harness: the terminal agent that holds the context, owns the tools, gates the permissions, and runs the loop. The model gets the debate. The harness gets the bill. Terminal-Bench scores the pair rather than the model on purpose, because the same weights move ten points or more depending on the harness they run in, and I have argued the same thing from the build side, that the harness is where an agent’s reliability and cost are decided. Ten of them do this one job, and they spread wide on how they treat the resource that matters most: your context window.
The harness is the product now
A year ago you could argue that a model's own first-party tool had a structural edge, because the model was trained to drive it. That argument has thinned. Frontier models now handle a terminal well enough that Anthropic cut Claude Code's system prompt by about 80 percent and lost nothing. Every model vendor now ships a command-line harness of its own, and an independent, model-agnostic layer has grown up beside them. So the question stopped being how native the harness is, and became how it manages context, how cleanly it exposes tools, and how much it stays out of the model's way. Three mechanisms carry most of that difference, and each one is worth watching before naming who does it best.
Same model, different bill
Start with one measurement that makes the point concrete. A harness sends the model a fresh context on every turn: its system prompt, its tool definitions, and the growing history of the task. A heavy harness front-loads a large prompt and a wall of tools, then carries it turn after turn. A minimal one sends a short prompt and a tight working set. Databricks reported that a lean harness like Pi sent roughly three times less context per turn and finished in fewer turns, for the same result. Watch the two run the same task below.
Token counts are illustrative of the shape. The real finding is from Databricks' benchmark: same model, same effort, different harness, and cost per task moved more than 2x at equal quality, with the lean harness sending about 3x less context per turn.
Where the cost hides: the prefix
The reason the numbers move is the key-value cache. A model does not reread a stable prompt from scratch; it caches the attention state for a prefix and starts new work at the first token that changed. So the moment a harness edits anything early in the context, every token from that point on has to be computed again, and on a long context that re-prefill is slow and expensive. This is where compaction strategies diverge. Truncating the oldest turns shifts the whole window and breaks the prefix. Summarizing the middle rewrites it. Pi's answer, which it calls context discipline, is to never change the context unless you ask, so the prefix stays cached and only the new turn computes. Trigger each strategy below and read the re-prefill cost.
Who can drive what
The other axis is portability. A first-party harness is usually locked to its maker's models, which buys tight integration and costs you a choice. The model-agnostic harnesses point at any OpenAI-compatible endpoint, which means they can drive a frontier API today and a model you run yourself tomorrow. That second option matters more every month, because a local endpoint from vLLM or Ollama turns the marginal token cost to zero. Pick a model source and see which of the ten can drive it.
The ten, in one line each
Claude Code (Anthropic, proprietary, locked to Claude) is the deep end. The richest extension surface on the list: subagents, eight hook types, Skills, Plugins, an MCP client with lazy tool search, and automatic compaction. Best for repo-wide understand-and-change work and for people who script the harness itself. The trade-off is vendor lock-in and heavier token use than the lean tools. I took its loop apart in a separate teardown.
OpenAI Codex CLI (Apache-2.0, Rust) leads on safety and efficiency. Its signature is a real OS-level sandbox, Apple Seatbelt on macOS and Landlock with seccomp on Linux, not a container. It runs OpenAI models, and local ones through its --oss mode. Best for long terminal command chains and CI, where codex exec runs unattended inside the sandbox. I traced its stateless transcript in its own writeup.
Gemini CLI (Apache-2.0, Google) was the generous free-tier entry point, with a 1M-token context. Note the change: Google is moving consumer usage to Antigravity CLI, a closed binary, and the open repo lives on mostly through forks. Treat it as transitioning.
Grok Code (xAI, Apache-2.0, Rust) is the fast second agent. Plan mode with approve-before-execute, subagents on git worktrees, and the standard kit of AGENTS.md, hooks, skills, and MCP work out of the box. Reviews land on the same line: a good fast second agent, not your only one.
Kimi CLI (Moonshot, MIT, TypeScript) pairs an open model with a self-host path. It defaults to Moonshot's open-weight Kimi K2 line but points at any OpenAI-compatible endpoint, so you can serve K2 yourself on vLLM or SGLang and pay nothing at the margin. Best for teams that want an open model in their own infrastructure. More on its session model in the Kimi CLI essay.
opencode (SST, MIT) is the reference model-agnostic agent. A client-server design where the terminal is one client, support for dozens of providers including local models through Ollama, and no lock-in. Best for developers who want a hackable, provider-neutral base.
Qwen Code (Alibaba, Apache-2.0) is a living fork of Gemini CLI, defaulting to the open Qwen3-Coder model but able to point at any OpenAI-compatible API. A cost-effective, model-flexible option and a natural home for orphaned Gemini CLI users, with a looser agentic loop than Claude Code.
Pi (Earendil, minimal by design) ships four tools and a system prompt under a thousand tokens, and adds power through extensibility rather than defaults. Its context discipline is the reason it topped Databricks' cost-per-task at equal quality and why Shopify built its own autoresearch loop as a Pi extension. Best when you want a small, cheap, self-editable core, especially against local models. I took its prefix-stability idea apart in a separate essay.
The iii harness (iii, Apache-2.0, Rust) takes a different shape: a thin, durable turn loop on a worker mesh instead of a foreground CLI. It wires a transcript store, a token-budgeting context manager, and a model router into one loop whose every step is resumable, so a crash or restart picks up mid-turn. It is model-agnostic through the router, deny-by-default on tools until you allow them per send, and exposes five hook points around the loop plus sub-agents as child sessions. Best when the agent has to survive restarts and run as durable infrastructure. It is the composable-runtime idea I wrote up in an earlier essay.
Prime Agent (Prime Intellect, open-source) is the newest and the most experimental, and it is built on Pi. It hands the model a persistent IPython kernel as its only tool, so sub-agents and skills are called as functions in code (await rlm("sub-task")) instead of through fixed tool schemas, and it treats its own prompts, skills, and memory as state the agent edits from its own trajectory and improves with a /refine loop. Prime Intellect reports Opus 5 in Prime Agent reaching 95.5 percent on ARC-AGI-3, past the human-expert baseline, at lower token use than the model’s native harness. Model-agnostic, and strongest on long-horizon, long-context work. It is early: the same self-improvement loop once taught itself to cheat at a benchmark, which the authors report plainly.
The ten, side by side
| Harness | License | Model lock-in | Local models | MCP | Hooks | Sandbox |
|---|---|---|---|---|---|---|
| Claude Code | proprietary | Anthropic only | no | yes | 8 types | permissions |
| Codex CLI | Apache-2.0 | OpenAI + oss | yes | yes | yes | OS sandbox |
| Gemini CLI | Apache-2.0 | via API | yes | limited | no | |
| Grok Code | Apache-2.0 | xAI | no | yes | yes | plan/approve |
| Kimi CLI | MIT | any OpenAI-compat | yes | yes | no | no |
| opencode | MIT | agnostic (75+) | yes | yes | no | permissions |
| Qwen Code | Apache-2.0 | any OpenAI-compat | yes | yes | no | no |
| Pi | open | agnostic | yes | yes | extensible | plan/approve |
| iii harness | Apache-2.0 | agnostic (router) | yes | via worker | 5 hooks | deny-by-default |
| Prime Agent | open-source | agnostic | yes | REPL-native | self-refine | gate |
Blank-ish cells reflect current focus, not a hard absence. Three standards now cut across the row: AGENTS.md for project instructions, MCP for tools, and ACP for editor embedding. Versions move weekly; verify before you commit.
Which harness for which user
- Deep repo-wide changes, power-user extensibility. Claude Code. Accept the Anthropic lock-in and the higher token bill.
- Unattended CI and long command chains, with a real sandbox. Codex CLI.
codex execinside Seatbelt or Landlock. - Fully local, offline, or zero marginal cost. opencode or Kimi CLI against Ollama or a self-hosted endpoint; Codex through
--oss. - No model lock-in, hackable base. opencode for the client-server design, or Pi for a minimal self-editable core.
- An open model you run in your own infrastructure. Kimi CLI with K2, or Qwen Code with Qwen3-Coder.
- The cheapest tokens per task at equal quality. Pi. Its context discipline is the whole argument, and it is measurable.
- A generous free tier. Gemini CLI was the answer; follow it to Antigravity CLI or to Qwen Code, its living fork.
- An agent that must survive restarts and run as durable infrastructure. The iii harness: a resumable turn loop on a worker mesh, deny-by-default on tools.
- Long-horizon autonomous runs and research, on the experimental edge. Prime Agent: programmatic tool-calling in a REPL and a self-improving harness, built on Pi.
The honest part
Benchmarks here score a pair, not a model. Terminal-Bench exists precisely because the same model can move ten points or more depending on the harness it runs in, so read any leaderboard as a statement about the pairing. A lot of 2026 comparison content is machine-generated and quotes model version names and percentages that do not exist; I left those out and leaned on sources I can stand behind: Terminal-Bench for the harness-moves-the-score effect, Databricks for cost per task, Earendil for the context-discipline mechanism, and my own teardowns of these loops. The takeaway survives the noise. The model you argue about is table stakes now. The harness you wrap it in, how it handles context and how much of your prompt it leaves untouched, is the lever that shows up on the invoice.