Lesson 1.3

What Is a Harness? Claude Code vs Codex vs Pi vs OpenCode

Understand what an agent harness is and choose between Claude Code, Codex, Pi and OpenCode for a given job

22 minFoundations - From Zero to Your First Shipped AppAvailable

What you learn

  • What a harness is and how it turns a text-predicting model into an agent that takes action
  • How Claude Code, Codex, Pi and OpenCode differ in philosophy, control and integration
  • A decision rule for picking a harness, including when minimal Pi beats Claude Code

Summary

The model is the engine. The harness is the car around it: the steering, pedals and tools that let the engine actually take you somewhere. A harness gives the model the ability to read and write files, run terminal commands, see the results, and loop until the job is done. This lesson defines the harness and compares the four worth knowing in 2026 so you stop confusing the model with the tool wrapped around it.

What you will learn

You will learn what a harness does, why the same model behaves very differently inside different harnesses, and how Claude Code, Codex, Pi and OpenCode compare on philosophy, control and integration. You will leave with a decision rule, including the non-obvious case where the tiny Pi harness beats the powerful Claude Code.

Prerequisites

The two previous lessons. You should be comfortable that a model only predicts tokens and that context discipline matters, because a harness is largely a machine for feeding the right context to the model and acting on its output.

The problem

People say "Claude is better than GPT" or "Codex cannot do X" when they actually mean the harness, not the model. The same Claude model feels brilliant in one tool and clumsy in another because the harness decides what files it sees, what commands it can run and how it loops. If you do not separate model from harness in your head, you will draw the wrong conclusions and pick the wrong tool.

What a harness actually does

A harness is the program that sits between you and the model and gives the model hands. At each step it gathers context (your instruction plus relevant files and command output), sends it to the model, reads back the model's proposed action, executes that action in your environment, and feeds the result back so the model can decide the next step. That loop - context, model, action, result, repeat - is the whole game. Everything that makes one harness better than another is a variation on how well it manages that loop.

  • Reads and edits files in your project.
  • Runs terminal commands and reads their output (tests, builds, git).
  • Manages the context window: deciding what to include and when to compact.
  • Loops autonomously until the task is done or it needs you.

Claude Code

Claude Code is Anthropic's official command-line harness, built around Claude models. It is the heavyweight: deep project integration, a rich permissions system, support for project rules in a CLAUDE.md file, reusable skills, hooks and sub-agents. It is the tool this very course is built and maintained with. When you want an agent that lives inside a real repository, runs your tests, respects your conventions and handles multi-step work, Claude Code is the default recommendation. The trade-off is that it is opinionated and powerful enough to feel heavy for tiny one-off jobs.

Codex

Codex is OpenAI's command-line coding agent, wrapping GPT models. It is pragmatic and strong at reading unfamiliar code, explaining it, and making focused, well-scoped changes. If you live in the OpenAI ecosystem or want a second opinion from a GPT-family model on a tricky change, Codex is a natural reach. Treat it as a capable peer to Claude Code rather than a rival to fear: many serious builders keep both installed and pick per task.

Pi and OpenCode

Pi is the minimalist. It is a deliberately tiny, transparent, extensible harness: you can see exactly what it does, and you bend it to your workflow rather than the other way around. OpenCode is an open-source harness in a similar spirit, model-agnostic and community-driven, often used with models routed through OpenRouter. Both trade hand-holding for control and transparency. The surprising truth is that for certain jobs - a quick scripted task, a custom loop, a setup where you want full visibility and zero magic - the minimal harness beats the heavyweight, because there is less between you and the model and nothing hidden.

  • Pi: minimal, transparent, highly extensible. You own the behaviour.
  • OpenCode: open-source, model-agnostic, pairs well with OpenRouter.
  • When minimal wins: scripted or repeatable tasks, full-visibility setups, custom loops, or when a heavyweight harness fights your workflow.

Step by step: a decision rule

You do not need to agonise. Run your task through this rule and pick in seconds. The point is to stop treating the choice as a loyalty question and start treating it as a fit question.

  • Deep work inside a real repo with tests, conventions and multi-step changes: Claude Code.
  • Reading or explaining unfamiliar code, or a GPT second opinion: Codex.
  • A scripted, repeatable, or fully transparent custom loop: Pi.
  • Open-source, model-agnostic, OpenRouter-routed setup: OpenCode.
  • Unsure: start with Claude Code, because the rest of this course assumes it.

Typical mistakes

The big mistake is blaming the model for the harness. The second is tool tribalism - insisting one harness is universally best when the honest answer is "it depends on the task". The third is reaching for the heaviest tool for trivial jobs, where a tiny harness or even a plain chat would be faster. Keep two harnesses installed and let the task decide.

Business ROI

Choosing the right harness is choosing how much of your team's work you can safely delegate to an agent. A heavyweight harness with good project rules lets you hand off real engineering tasks end to end, which is where the time savings compound. A minimal harness lets you build cheap, transparent, repeatable automations. Knowing both means you never over-pay in complexity for a simple job or under-power a hard one.

Checklist

Confirm you can do the following before moving on, because the next lesson gets hands-on with installation.

  • Explain the difference between a model and a harness in one sentence.
  • Describe the context-model-action-result loop.
  • Match a task to Claude Code, Codex, Pi or OpenCode.
  • Give one example where a minimal harness beats Claude Code.

Resources

You do not need to install anything yet - the next lesson walks installation step by step. For now, just hold the mental model: model is the engine, harness is the car. The fundamentals page on the terminal will help if the command line still feels foreign.

Your task

Write down the single task you most want an agent to do for you this week, then apply the decision rule and name the harness you would use. You will install it in the next lesson, so pick something real.

Next lesson

Time to stop reading and start installing. The next lesson gets Claude Code and Codex running on your machine, explains the subscription plans, and makes the case for why the 200 dollar per month plan is actually cheap for a serious builder.

Comments

Loading comments.

Post a comment
CommentsNext
Next step

Ready to put AI to work as a real workflow?

Start with the foundations course, keep your progress locally and sync everything to your free account whenever you like.