Harness for agents

This page is for coding agents, and for the people who set them up. Harness runs coding agents (Claude Code, Codex and others) in terminal sessions called harnesses. From its own shell, an agent can start harnesses, wait for them, read their answers and close them. The person sees every harness in the Harness app on their desktop, on the web and on their phone, and can watch it, answer it or stop it.

A shorter, plain-text version is at /llms.txt.

What Harness gives an agent

Every harness spends the person's tokens. Start one only for work that can run in parallel with yours, needs another model's view (a review, a second opinion from Codex), takes long, or belongs in its own folder. Do quick work yourself, and a quick parallel search or edit inside one task with your own sub-agents (Claude Code's Agent tool, Codex sub-agents): they are cheaper and faster. Close each harness once you have its answer.

Harness, or running codex yourself

If Codex or Claude Code is installed, you can run it yourself for a one-off answer (codex exec "<task>", claude -p "<task>"). Use Harness instead when:

The taskWhy Harness
The person should see the work, or may need to answer itEvery harness is in their Harness app, where they can watch it, answer its questions or stop it. A process you run yourself is invisible to them, and its questions go unanswered.
Several tasks at onceharness wait <name>,<name> waits for all of them, or the first with --any.
Work that takes longer than your turnA harness keeps running after your turn ends, and its answer stays there to read.
Another of the person's machinesharness new --machine <machine>: no SSH, once that machine runs Harness signed in to the person's account.
Cleaning up after yourselfLimits on how many you start, and Harness closes what you leave behind.

Install

curl -fsSL https://harness.autonomous.ai/cli/install.sh | bash
harness start

Install, step by step, for an agent

StepWhoHow
1. Is it there already?Youharness version. Found: skip to step 4.
2. Ask before installingThe personIt installs software on their computer: ask them first.
3. InstallYou, once they agreecurl -fsSL https://harness.autonomous.ai/cli/install.sh | bash. On Linux it may need their password for apt-get; without one, ask them to run sudo apt-get install -y tmux curl first. It ends by saying what to run next.
4. Start Harness hereYouharness start. No account is needed.
5. See what you may doYouharness whoami. It says whether you may start harnesses, and if not, what to ask the person.
6. Sign inThe personharness login, in a browser. Needed for agents to start harnesses, and for other machines.
7. Let agents start agentsThe personSettings ▸ Experimental ▸ Agents can start other agents, or harness settings agents-start-agents on in their own terminal. It is their consent: run by an agent, it is refused (exit 5).
8. CheckYouharness whoami says Can start harnesses: yes.

macOS and Linux. harness start starts Harness on this computer. No account is needed for the harnesses the person starts on this computer; harness login signs in, which the person needs for their other machines, the phone app, and what they let agents do. The agents you start must be installed and signed in to their own providers: claude for Claude Code, codex for Codex.

An agent starts harnesses only once the person turns on Agents can start other agents, an experiment of their Harness account, off by default. Until then harness new refuses (exit 5) and says how: tell the person, and do the work yourself. The agent commands are new: if harness whoami is an unknown command, run harness update.

Add the skill

The harness skill tells an agent when to use Harness and how. It comes as a plugin for Claude Code and Codex, which also registers Harness's MCP server (harness mcp, over stdio).

Claude Code

claude plugin marketplace add autonomous-ai/openharness --sparse .claude-plugin plugins
claude plugin install harness@openharness

Inside a session, the same is /plugin marketplace add autonomous-ai/openharness, then /plugin install harness@openharness. Without --sparse the whole repository is cloned, several hundred megabytes, which takes a minute or more. Run /reload-plugins or start a new session to load it. Adding a marketplace from GitHub needs git: on a Mac without Apple's developer tools, macOS first offers to install them.

Codex

codex plugin marketplace add autonomous-ai/openharness --sparse .claude-plugin --sparse plugins
codex plugin add harness@openharness

Start a new Codex session to load it. Inside Codex, /plugins opens the plugin browser, where the marketplace's plugins are listed once it is added.

Any agent that reads SKILL.md

mkdir -p ~/.agents/skills/harness
curl -fsSL https://raw.githubusercontent.com/autonomous-ai/openharness/main/plugins/harness/skills/harness/SKILL.md \
  -o ~/.agents/skills/harness/SKILL.md

Codex reads skills from ~/.agents/skills; Claude Code reads them from ~/.claude/skills.

The commands

CommandWhat it does
harness whoamiWho you are to Harness: which agent, on which machine, inside Harness or not; whether you may start harnesses now and, if not, who can change that; how many of yours are open. Run it first.
harness ps [--all]The harnesses on this machine: name, agent, state, who started it, when it was last active, its folder and what it is about. --all adds the ones stopped in the last week.
harness new [agent] [--machine NAME] [folder | project] --name NAME -- TASKStart a harness and give it a task. agent is claude (the default), codex, or another agent installed there. The folder is the current directory when left out. For scratch or new work, give a project name (harness new codex review -- …) rather than a folder of your own: Claude Code and Codex ask the person to trust a folder Harness did not make.
harness wait NAME[,NAME…] [--any] [--timeout 30m]Wait until each harness stops working. --any returns when the first one does. The timeout takes 90s, 30m or 2h (30 minutes by default); 0 waits as long as it takes.
harness show NAME [--chars N]Its state, the last thing it was asked, and its answer: the text after its last tool call, the first 4,000 characters by default.
harness send NAME "text"A message to a teammate in your tab, while Agent Messages are on (Settings ▸ Experimental, off by default). A harness you started is no exception. Works from inside a harness.
harness close NAME [--now]Save its screen and stop it. Its conversation is kept, and the person can resume it. Refused while it is working, unless --now.

Name every harness you start with --name: an unnamed one takes its session's title, which changes. Every command also takes the start of a harness's id, takes --json for JSON, and prints its usage with --help. Every command ends with Next:, the command to run next (in JSON, next), and every error says what to run next. A harness waiting on a question or a permission is shown as needs the person: tell the person. harness help agents prints the commands, states, exit codes and rules on one screen.

Once Harness runs on a computer, Claude Code and Codex there run these commands and Harness's MCP tools without asking: Harness adds them to their permission rules (Claude Code's settings.json, Codex's rules/harness.rules), and Codex runs them outside its sandbox. What an agent may do with them is still Harness's to decide: the person's switch for agents starting agents, the limits below, and closing only what it started. Run each command by itself, or join them with &&; piped into another command, after ;, or with a variable set in front, the rule no longer matches.

Exit codes

CodeMeaning
0Done. For wait: every harness is idle; read it with harness show.
1Failed. The message says what to run next.
2The command was used wrongly; the usage follows.
3wait: a harness needs the person (a question or a permission). Tell the person; only they answer it.
4wait: a harness stopped or is gone.
5Refused: your limits, the person's setting, or a harness you did not start. Do not retry it; tell the person, or do the work yourself.
124wait: timed out while a harness was still working. Wait again, or read it.

When several apply, wait exits with the first of 124, 3 and 4.

Run Claude Code agents in parallel

harness new claude --name api-tests -- "Make the tests in api/ pass. Change only files in api/. Answer with what you changed and why."
harness new claude --name ui-tests -- "Make the tests in ui/ pass. Change only files in ui/. Answer with what you changed and why."
harness wait api-tests,ui-tests --timeout 45m
harness show api-tests
harness show ui-tests
harness close api-tests
harness close ui-tests

Each harness is a full Claude Code session in its own terminal, in the folder you ran the command from. Give harnesses that edit files separate folders or separate files (a git worktree each works well): two agents editing the same file overwrite each other's work.

Wait for a background agent to finish

harness wait reviewer --timeout 30m

Its exit code says how it ended. 0: it is idle, read it with harness show reviewer. 3: it is waiting for the person; tell them, and do not answer it yourself. 4: it stopped. 124: it is still working; wait again. With several names, --any returns as soon as one finishes. A harness counts as finished when it has stopped working on two looks in a row, three seconds apart, so a short pause between tool calls does not end the wait.

Hand a task to Codex and read its answer

harness new codex --name reviewer -- "Review the changes on this branch against main for bugs. Do not edit files. Answer with the findings, most serious first, each with file and line."
harness wait reviewer --timeout 20m && harness show reviewer
harness close reviewer

Put the whole task in it: what to do, where, what done looks like, and what to answer with. A task holds 2,000 characters; for a longer one, write it to a file and name the file in the task. show cuts long answers at 4,000 characters and prints how to read the rest (--chars N).

Keep working while another agent reviews

harness new codex --name reviewer -- "Review commit 3f2a9c1 for bugs. Do not edit files. Answer with the findings."
# … go on with your own work; harness new returned as soon as the harness started …
harness ps                                   # is it still working?
harness wait reviewer && harness show reviewer

Starting a harness does not let you message it, so put everything in the task. For a follow-up, start a new harness with the fuller task. Only in a tab you share, while Agent Messages are on, can you ask it from inside a harness, with harness send reviewer "…", then wait and show again.

Run on another machine

harness machines
harness new codex --machine mini ~/code/app --name train -- "Run the training script and report the final loss."

Needs the person signed in to Harness on both computers (harness login). harness ps lists this machine; harness ps --machine mini, harness show --machine mini train and harness wait --machine mini train reach the other.

Inside a harness, or outside Harness

MCP tools

harness mcp serves the same commands as MCP tools over stdio, for agents that reach their tools through MCP (the plugin above registers it). Configure it as command harness with arguments ["mcp"].

ToolArgumentsSame as
harness_whoaminoneharness whoami
harness_listall?harness ps
harness_starttask, name, folder? or project? (a new project for scratch or new work), agent? (claude or codex), machine?harness new
harness_waitnames, any?, timeout_seconds? (120 by default, 600 at most; if they are still working, call it again)harness wait
harness_readname, chars?harness show
harness_closename, now?harness close
harness_sendto, text; offered only when the server runs inside a harness, and only to teammates in its tab while Agent Messages are onharness send

Add it to a client

{"mcpServers": {"harness": {"command": "harness", "args": ["mcp"]}}}

Or in one step, once Harness is installed: Add to Cursor, Add to VS Code (Insiders), Add to LM Studio, or in Claude Code claude mcp add harness -- harness mcp. An app opened from the Finder may not have ~/.local/bin on its PATH; if it cannot find harness, give it the full path that command -v harness prints.

Rules

When something fails

More