Harness

A record of the harness I've built around Claude Code and Codex, and what an AI agent harness is in the first place.

The main page here is My outer harness: the instructions, checks and limits I've added around the two coding agents I use, profiled across all my repos. The rest of the site is the background it rests on: what a harness is, and how Claude Code and Codex build theirs.

Working definition

A model takes text in and puts text out. A harness is everything around it that turns that into an agent: the loop that calls the model again and again, the tools it can use, the choice of what goes into its context, and the rules for what it may do without asking.

Two harnesses running the same model can behave very differently. Much of what people call "the model" in a coding agent actually comes from the harness.

Block diagram of a harness around a model HARNESS INTERFACE a person CONTEXT what it sees MODEL text in, text out CHECKS may it act? TOOLS shell, files, web steer, watch allowed results the loop: who decides the next step
The parts every harness has. The model only reads its context and writes text. Everything else is harness.

Parts

This list has been revised after the survey of my own agents and the teardowns of Claude Code and Codex. The first guess, loop, tools, context, permissions, memory, delegation and interface, held up only partly. The evidence splits the parts into two groups.

In every harness

All eight harnesses looked at so far have these, including a Wordle player with one tool.

Who drives
Whether the model or the code decides the next step. In Claude Code, Codex and two of my agents, the model calls tools until it decides to stop. In the other four, the code sets the turns and the model only supplies content. This matters more than whether there's a loop at all.
Tools
What the model can do, and how each tool is described to it. A closed tool, like a Wordle guess, can't do harm. An open tool, like a shell, can do anything, and that difference drives most of the second group.
Context
What the model sees on each turn. Every harness designs this carefully, often as the whole point. Examples: a private MIND stripped before the other agent sees the reply, a date cutoff so prices can't leak from the future, a key only one player can see.
Checks
What stops a bad output or action from taking effect. It's one idea that scales with risk: validating a Wordle guess or a JSON schema, then permission rules, then an operating-system sandbox. Permissions are checks for tools that can do damage.
Interface
Where a person watches, steers or interrupts, even if that's only a transcript read afterwards.

Added by open-ended harnesses

These appear only once the tools are open-ended and the sessions are long. None of my small agents needed them. Claude Code and Codex both have all of them, and they build them differently.

Tool loading
Dozens of tool definitions take up context on every turn. Claude Code shows the model names only and loads the definitions on demand. Codex gives the model one tool that runs code, and the other tools are functions inside it.
Instruction layering
Guidance comes from the harness's own prompt, the user's files, the project's files, connected services and hooks, so something has to say which one wins. Both tools now read AGENTS.md, which lets one project file serve both.
Compaction
When the context fills, older turns get summarized. Then part of the context gets rebuilt: Claude Code re-reads its instruction files and recently used files, and Codex lets you replace the summarizing prompt. It's more than truncation.
Delegation
The model starts other agents and gets their results back. My multi-agent experiments had several roles, but the code set them up. Here the model decides. Claude Code goes much further than Codex, with workflows, teams and cross-session messages.
Memory
Anything carried from one session to the next. It's optional: nothing I built used it. Claude Code has it on by default and Codex has it off.

Pages