# Agent harness

> The harness is the program that puts the model to work: it gives the model its tools, context, memory and limits. It is the first level of control over an agent. The same model gives different results from one harness to the next.

A model on its own produces text. The harness runs it in a loop, executes the commands it asks for, feeds the results back and decides what to keep in memory. Claude Code, Codex and OpenCode are harnesses.

You can think of it as having six jobs: splitting and routing tasks, picking and summarizing context so it fits in the context window, running tools in a sandbox, keeping memory and state, running verification loops, monitoring and setting guardrails. Seen this way, the harness is a control plane right next to the agent. The software factory’s orchestration layer is another one, a level up.

A team configures its harness through files: an instructions file read at every session, skills for in-house rules, hooks that block certain actions, subagents for repeated tasks. These files are versioned with the code.

Being able to run several harnesses keeps you from depending on one provider. At least one should work with open-weight models. You can then compare model and harness combinations on your own tasks.

**When**: When choosing a coding agent, and again whenever results disappoint: check the harness and the context before switching models.

**Trade-offs**: A harness tied to one lab tracks its models closely but locks you into its ecosystem. Several harnesses let you compare, at the cost of maintaining a configuration for each.

## Where to start

- Pick a default harness
- Have every harness read the same instructions file (AGENTS.md or equivalent)
- Add skills and hooks for your rules
- Try a second harness on the same tasks

## Common mistakes

- Blaming or crediting the model for what the harness does
- Relying on a single harness tied to a single provider
- Letting each developer set up their harness their own way

## Metrics

- Task success rate per harness
- Cost per successful task, per harness

## Sources

- [Potpie, vendor site (layered agent architecture)](https://potpie.ai/)
- [Warp, The Factory Stack](https://www.warp.dev/blog/the-factory-stack)
- [Anthropic, The AI-native SDLC playbook](https://claude.com/fr/resources/articles/the-ai-native-sdlc-playbook)
