Back to blog

Claude Code vs Codex vs OpenCode vs Pi: what's different?

LearnOS Team, October 3, 2026 · 6 min read

Claude Code, Codex CLI, OpenCode and Pi all do roughly the same job: you describe a change, and an agent reads your repo, runs commands and edits files until it's done. Side by side in a terminal they can look interchangeable. Under the hood they make very different bets, and those bets decide which one fits how you work.

This post compares them the way our course does: not on vibes, but on the specific design decisions every agent harness has to make. (If the term is new, start with What is an agent harness?.) We also cover the newer and smaller harnesses worth knowing, including Gemini CLI, Aider, Cline, Goose, OpenHands, mini-swe-agent and DeepSeek Harness.

The one-line version of each

  • Claude Code (Anthropic, proprietary, ~148.7k GitHub stars on 2026-10-01). The maximal harness: 40+ tools, layered permissions with an OS sandbox, checkpoints you can rewind, hooks, skills, MCP, plugins and subagents. Runs Claude models only.
  • Codex CLI (OpenAI, Apache-2.0, Rust, ~127.4k stars). The middle path: a small shell-first toolbox, its own apply_patch edit grammar, the most explicit permission model in the field (sandbox mode × approval policy, enforced by the OS), and a prompt layout designed around caching. Speaks only the Responses API.
  • OpenCode (Anomaly, MIT, TypeScript, ~211k stars). The provider-agnostic one: 75+ providers through the AI SDK, a client/server split where the TUI is just one client, LSP diagnostics fed back after edits, and shadow-git undo. Rich permission rules, but no OS sandbox.
  • Pi (Mario Zechner / Earendil, MIT, TypeScript, ~111k stars). The minimalist counter-argument: four default tools, a system prompt plus tools under 1,000 tokens, no permission prompts, no plan mode, no built-in subagents. Everything else is an extension. 15+ providers.

Star counts measure attention, not quality, and they move fast. They're here to show these four are the mainstream, not to rank them.

How they compare on the decisions that matter

In the course we score each harness on a 10-point anatomy rubric. Each score is a position, not a grade: 0 means "minimal, you compose it yourself" (Pi-like), 4 means "many built-ins" (Claude Code-like). A summary for the big four:

DecisionClaude CodeCodex CLIOpenCodePi
Loop & stop4 · Esc, steering, Stop hook, budget caps2 · turn ends on assistant message3 · per-agent step limits, doom-loop guard1 · no step cap, steering queue
Tools4 · 40+ tools, output caps2 · shell, apply_patch, plan, MCP3 · 13 built-ins, ripgrep0 · read / write / edit / bash
Edit format2 · exact-match replace3 · *** Begin Patch grammar, lenient parser4 · fuzzy replace cascade, patch tool for GPT1 · exact-match replace
Context4 · clear tool output, then summarise3 · cache-shaped prefix, server-side compaction3 · compaction agent2 · auto-compact, keep recent
Project memory4 · CLAUDE.md + auto memory3 · AGENTS.md chain, 32 KiB cap3 · AGENTS.md, CLAUDE.md fallback2 · AGENTS.md / CLAUDE.md upward
Sandbox & permissions4 · rules + modes + OS sandbox4 · sandbox × approval, OS-enforced2 · allow / ask / deny, no OS sandbox0 · none; use a container
Sessions4 · JSONL, fork, rewind3 · resume and fork, no rewind4 · server sessions, shadow-git undo3 · JSONL tree sessions
Extensibility4 · hooks, skills, MCP, plugins4 · hooks, skills, MCP, app-server4 · plugins, tools, skills, MCP4 · TS extensions, skills, MCP
Subagents4 · built-in + custom3 · explicit-only, depth 13 · general / explore / scout + custom0 · spawn itself via bash
Providers & UI2 · Claude only, every surface3 · Responses API only4 · 75+ providers, TUI / desktop / IDE / web4 · 15+ providers, 5 modes

Two patterns jump out. First, everyone converged on extensibility: hooks, skills and MCP are now table stakes. Second, the real differences are in permissions, edit format and which models you're allowed to use.

The differences that actually change your day

Which models you can run. This is the biggest practical split. Claude Code runs Claude. Codex speaks the Responses API. OpenCode and Pi will talk to almost anything, which also makes them the natural choice if you want to compare models on one fixed harness, or bring a single OpenRouter key to everything.

What the agent can do without asking. Claude Code and Codex both enforce limits at the OS level, not just in prompts. OpenCode gives you fine-grained allow/ask/deny rules but no OS box. Pi deliberately has no permission layer at all, and its own docs tell you to run it in a container. Prompt injection through a file, comment or command output reaches whatever shell the agent has, so this row matters more than it looks.

How edits land on disk. Exact-match replace (Claude Code, Pi) is predictable and fails loudly. Codex's patch grammar is tuned for OpenAI models. OpenCode adds a forgiving fuzzy cascade and switches to a patch tool for GPT models. Edit format sounds like plumbing, but on Aider's benchmark changing it alone moved one model from 20% to 61%.

How much harness you want. Pi's author left Claude Code because it had "turned into a spaceship with 80% of functionality I have no use for" (Zechner, 2025). That's a real argument: a tiny, stable prompt is easier to audit and evaluate. But Pi has since reversed on two of its 2025 "won'ts", adding MCP and auto-compaction, and "build it as an extension" moves complexity onto each user rather than removing it.

Beyond the big four

The wider field mostly takes one strong position each:

  • Gemini CLI: maximal like Claude Code, but for Gemini: a policy engine, five sandbox backends and opt-in checkpoints.
  • Aider: weak on autonomy, strongest on edit formats (whole, diff, udiff, architect) and a ranked repo map, with a git commit per change.
  • Cline: built around human approval, with Plan/Act modes and a checkpoint after every tool call, in your IDE.
  • Goose: everything is an MCP extension, and recipes package a workflow. Starts in autonomous mode by default.
  • OpenHands: an SDK and an event-sourced log with Docker or remote workspaces, aimed at unattended runs.
  • mini-swe-agent: about 100 lines, bash only, no tool API. It's the reference baseline researchers use to hold the harness fixed while comparing models.
  • DeepSeek Harness: open-sourced in August 2026, where everything, including the agent loop itself, is a replaceable plugin. Read-only sandbox by default. It's a developer preview that promises breaking changes, so try it in a disposable VM.

One more lesson from the field: check liveness first. Continue and Roo Code both went read-only this year. A harness runs shell commands on your machine; an abandoned one stops getting model-format and security fixes.

So which one should you use?

There's no best column, only a best fit:

  • Daily terminal agent, happy with one vendor: Claude Code (Claude), Codex CLI (GPT) or Gemini CLI (Gemini).
  • Any model, one harness: OpenCode for batteries included, Pi for a minimal core you extend yourself.
  • Supervised work in an IDE: Cline.
  • Pair programming with reviewable commits: Aider.
  • Unattended or remote fleets: OpenHands.
  • Comparing models fairly: mini-swe-agent.

Whatever you pick, read its defaults. They are the real policy.

Go deeper: tear them down, then build your own

This comparison is a compressed version of Module 02 of Agent Harnesses: Anatomy, Build, Frameworks, Benchmarks. The course gives Claude Code, Codex CLI, OpenCode and Pi a full teardown each, with every claim linked to the vendor's docs, and runs the same failing-test task through each one on your own OpenRouter key. Then you build tinyharness, your own harness in Python, borrowing the best idea from each teardown, and benchmark it on a Terminal-Bench slice.

Start Agent Harnesses on LearnOS

Command Palette

Search for a command to run...