---
url: /harnesses/choosing.md
---
# Choosing the harness and model

Every run uses one harness, and a model that the harness serves. Flags choose them for one run, [targets](/configure/targets.md#targets) in your configuration choose them every time, and when nothing chooses, Pandra picks the harness it finds. Pandra runs a harness already on your `PATH`, or installs one itself ([which installation runs](#which-installation-runs)).

## Choosing for one run

```sh
# a harness, with its own default model, effort, and login
pandra run github.com/acme/changelog@v2.0.0 --harness codex
# a harness, model, and prompt
pandra run github.com/acme/reviewer@v1.2.0 --harness claude-code \
    --model claude-opus-5-5 --prompt "Review PR 12."
# a target from your configuration
pandra run github.com/acme/reviewer@v1.2.0 --target claude-work \
    --prompt "Review PR 12."
```

* `--harness` takes `claude-code`, `codex`, or `pi`.
* Without `--model`, the harness chooses the model.
* `--provider` takes `anthropic` on Claude Code, `openai` on Codex, and any provider Pi knows on Pi, where it needs a model ([Pi](/harnesses/pi.md#providers-and-models)).
* `--effort` takes `low`, `medium`, `high`, `xhigh`, or `max`. A model that lacks the level runs at the nearest one it has, with the warning `effort_adjusted`, and a run never fails because of its effort.

Every option is in the [`pandra run` reference](/reference/cli.md#pandra-run).

## What decides a run

The harness, provider, model, effort, and credentials come from one target, the first of these that applies:

1. `--target NAME`
2. the agent's target, set with `pandra config target use NAME --agent AGENT`
3. `defaults.target`, set with `pandra config target use NAME`
4. none: the harness's own defaults, on the harness Pandra finds ([which harness runs](#which-harness-runs))

On the target chosen, `--model` and `--effort` replace that key. A `--harness` or `--provider` that differs from the agent's target or `defaults.target` drops that target, so the run uses the harness's defaults. Next to an explicit `--target`, a differing value is a usage error, with exit code 2:

```text
error: --harness codex conflicts with --target deep, whose harness is claude-code
```

`--dry-run` shows what decided each value ([dry runs](/run/starting.md#dry-runs)).

## Which harness runs

With no target and no `--harness`, Pandra uses the harness it finds:

| Pandra finds | On a terminal | Without a terminal |
| --- | --- | --- |
| One supported harness: on `PATH`, pinned, or installed by Pandra | Uses it | Uses it |
| Several | Asks which one, then whether to make it the default target from now on; `--yes` never answers that, because it changes your configuration | Fails with `harness_ambiguous` |
| None | Asks which one to install, and installs its newest stable release | Fails with `harness_not_found`, which gives the `pandra harness install` command |

In a CI job, which has no terminal, a run with several harnesses installed fails:

```text
$ pandra run . --prompt "Review PR 12."
error: several harnesses are installed (claude-code, codex); choose one with --harness
  To run it on the harness you choose:
    pandra run . --harness HARNESS --headless --prompt 'Review PR 12.'
```

## Which installation runs

For the selected harness, a run uses the first of these that applies:

1. A pin: a version written by `pandra harness use`, or `--harness-version` for one run, which Pandra downloads and verifies on first use; or a program pinned with `pandra harness use NAME --path PATH`.
2. The harness on `PATH`, when Pandra supports its version.
3. The newest version Pandra installed.
4. None of these: on a terminal, the run asks before it downloads, and `--yes` answers the question:

   ```text
   claude-code is not installed.
   ? Install the latest (2.1.326, about 370 MB) now? [Y/n]
   ```

   Without a terminal and without `--yes`, the run fails before anything starts and points at `pandra harness install claude-code`.

To never download a harness automatically, for example in an image that must not download at start, run `pandra config set harnesses.downloads manual`. A run then never offers to install one, and a pinned version that is not installed fails until you install it with `pandra harness install`.

## Installing and pinning versions

To install a harness and keep every run on that version:

```text
$ pandra harness install claude-code
Installed claude-code 2.1.317
  In use: claude-code 2.1.285 on PATH
  To use 2.1.317 in every run:
    pandra harness use claude-code@2.1.317

$ pandra harness use claude-code@2.1.317
$ pandra harness list
HARNESS      VERSION  SOURCE   PANDRA SUPPORT  IN USE
claude-code  2.1.317  managed  yes             yes (pinned)
claude-code  2.1.285  PATH     yes             no
```

A run on a pinned version starts sooner, because Pandra runs a harness on `PATH` with `--version` before every run to check that it supports it. A version older than Pandra supports is an error; newer versions run without a warning.

* `pandra harness use NAME --path PATH` pins a program instead, and `pandra harness unuse NAME` stops pinning.
* `pandra harness install` with no name installs every version your configuration pins.
* `pandra harness remove NAME@VERSION` removes an installation Pandra made, never the one on `PATH`, and keeps the pin.

The [`pandra harness` reference](/reference/cli.md#pandra-harness) has every option. On Alpine and other musl systems, Pi is installed with npm ([Pi](/harnesses/pi.md#installation-on-musl-systems)).

## Passing harness arguments

Arguments after `--` go to the harness that the run selects. `--add-dir` is a Claude Code option, so this run selects Claude Code:

```sh
pandra run . --harness claude-code --prompt "Update the docs." -- \
    --add-dir /home/me/shared-docs
```

Pandra rejects arguments that repeat the ones it supplies itself, and a target's `args` work the same way:

```text
$ pandra run . --harness claude-code --prompt "Update the docs." -- --permission-mode plan
error: . cannot start: 1 problem
  the harness arguments repeat flags Pandra owns: --permission-mode
  To run it without the options the checks refused:
    pandra run . --harness claude-code --tui --prompt 'Update the docs.'
```

## How the harnesses differ

| | [Claude Code](/harnesses/claude-code.md) | [Codex](/harnesses/codex.md) | [Pi](/harnesses/pi.md) |
| --- | --- | --- | --- |
| Providers (`--provider`) | `anthropic` | `openai` | Any provider Pi knows, with a model; `anthropic`, `openai`, and `openrouter` also take a [target credential](/configure/targets.md#target-credentials) |
| Login Pandra reuses | Claude Code's own login, API key and token environment variables | `auth.json`, the provider your `~/.codex/config.toml` selects, `CODEX_ACCESS_TOKEN`, and `CODEX_API_KEY`; not a login only in the OS keyring | `auth.json`, `models.json`, API key and token environment variables |
| `--effort` becomes | `--effort` | `model_reasoning_effort` | `--thinking` |
| Permission checks | Automatic review | Automatic review of requests to leave its sandbox | None, so a run needs [`bypass` or `read-only`](/harnesses/permissions.md#pi) |
| Background work in a headless run | The run waits for it ([background work](/harnesses/claude-code.md#background-work)) | Stopped when the turn ends | None; a command detached with `&` or `nohup` keeps running after the run |
| Skill name | `/superpowers:brainstorming` | `$superpowers:brainstorming` | `brainstorming` |
| Kept out of the run | The workspace's settings, hooks, MCP servers, and instructions files | The workspace's `AGENTS.md`, `.codex/` configuration, hooks, rules, and skills | The `AGENTS.md` and `CLAUDE.md` files of the workspace and its parents, and the workspace's Pi resources |
| `[harnesses.<name>.settings]` goes into | `settings.json` | `config.toml` | `settings.json` |

Settings for one harness go under `[harnesses.<name>]` in your configuration ([harness programs and runners](/configure/targets.md#harness-programs-and-runners)). The instructions files of your home and of the repository reach a run only when you [add the instructions your harness reads](/configure/instructions-and-skills.md#add-the-instructions-your-harness-reads).
