---
url: https://bishop.agentdeployment.co/running/harness.md
description: >-
  Choosing between the Claude and Codex harnesses, model credentials, and model
  and effort settings.
---

# Harness and Model

The harness is what runs the agent. `claude` is the default and runs the Claude Agent SDK. `codex` runs OpenAI's Codex SDK. Both come with Bishop, so there's no separate agent CLI to install.

```json
{
  "agent": {
    "harness": "codex"
  }
}
```

`--harness` overrides it for one run, and an unsupported name fails at startup naming the ones that exist:

```
$ bishop --harness codex
$ bishop --harness gemini
unknown harness "gemini"; supported: claude, codex
```

## Model credentials

Bishop manages no model credentials. Each harness authenticates however its own CLI does in that directory, so make `claude` or `codex` work there first.

* **Claude** uses `ANTHROPIC_API_KEY` or `CLAUDE_CODE_OAUTH_TOKEN` if one is set, and otherwise whatever login `claude` has on that machine. Bishop logs which it used at startup.
* **Codex** uses `codex login`, or `CODEX_API_KEY` in the environment or `.env`. Bishop warns at startup when it can find neither, since the first turn would otherwise fail on authentication with nothing to explain it.

These reach the agent through its environment, so an `agent.env.allow` list has to include whichever one the harness uses. See [Permission Levels](/running/access#what-each-level-runs-with).

`OPENAI_API_KEY` isn't read, because `codex` doesn't read it either. With only `OPENAI_API_KEY` set and no login, `codex` sends no credential at all and the request comes back `401 Missing bearer`. Picking it up would also override a working `codex login` and move billing to the API key without saying so.

## Switching harness

A session belongs to the harness that started it, so switching leaves running threads unable to resume. Bishop notices, logs it, and starts each thread a fresh session on its next message rather than failing the turn. Nothing else is lost.

Codex threads read differently in one way that shows: their tool cards are vaguer, because a command comes through as a raw shell line and nothing else, which Bishop won't put in a thread.

## Model and effort

Every harness has a model and a reasoning level, so both sit at the top of `agent` rather than inside `agent.options`:

```json
{
  "agent": {
    "harness": "codex",
    "model": "gpt-5.6-codex",
    "effort": "high"
  }
}
```

Both are free strings, passed to the harness as written. The names belong to the harness and change with it, so Bishop doesn't check them: `claude` takes `claude-sonnet-5` and `low` through `max`, `codex` takes `gpt-5.6-codex` and `modelReasoningEffort`'s levels.

Leave `model` unset and the harness uses its own default model, which can change when a Bishop release upgrades the harness. Set `model` to keep an agent on the same model across upgrades.

Nothing checks the value before the first turn. A name the harness doesn't know surfaces in a thread instead, differently by harness. Codex fails the turn with the API's own complaint about the field. Claude answers a bad model with the agent saying in prose that the model is wrong, and ignores an effort level it doesn't recognize. So an effort typo under Claude is silent: check the log line at startup, which names the model and effort Bishop passed.

`--model` and `--effort` override the config for one run:

```sh
bishop --harness claude --model claude-opus-5 --effort high
```

Setting the same thing again in `agent.options` loses to these, and startup logs a warning naming the key it overrode. [`! model`](/interfaces/commands#model) changes them for one conversation, and `agent.permissionLevels` for every conversation at one level, such as a cheaper model at read. See [Permission Levels](/running/access#what-each-level-runs-with).

## Keep alive

Under Claude, each thread's Claude Code process keeps running between messages. The thread's first message starts it, and Claude Code loads the agent's MCP servers, hooks and plugins before the agent can answer. Later messages in the thread go to the process already running, so the agent answers without that wait.

A thread's process closes once it has been idle for 10 minutes, and never while the agent is running something in the background. At most 4 are kept at once for each [permission level](/running/access): past that, the one idle longest closes, though one that is running something never does, so busy threads can take the count over. Each holds a few hundred megabytes. A scheduled run doesn't keep its process, but a reply to its report starts one. A thread whose process closed starts a new one on its next message and carries on where it left off.

```json
{
  "agent": {
    "harnesses": {
      "claude": { "keepAlive": { "idleMinutes": 10, "max": 4 } }
    }
  }
}
```

`"keepAlive": false` starts Claude Code for every message, as Bishop did before. A `harnesses.claude` block holding only `keepAlive` leaves `agent.options` alone. Codex starts a process for every message regardless, and `keepAlive` under `codex` fails at startup.

An edit to the agent's `.claude/settings.json`, a model change, or a new snapshot takes effect on the thread's next message, which starts a new process and pays the usual startup. A process with something running in the background keeps its old configuration until that finishes. Other edits to a local agent's files, like `CLAUDE.md`, `.mcp.json` or its skills, may not reach a process that is already running; they apply once it closes and the next message starts a new one.

**Background work reports back.** When the agent starts something in the background, like a long build, and finishes its reply first, it posts again in the thread once the work is done. That follow-up runs as Bishop rather than as whoever asked, so the agent can share a file or rename the Slack thread in it but can't use Bishop's other tools. An agent with nothing worth saying stays quiet. While subagents it started are still running, a report on one that finished is progress: it's posted only where the [verbosity](/interfaces/commands#verbosity) is `medium` or `high`, and never by email. The report that comes once they have all finished is always posted, with any file a held report shared. Claude Code's own scheduling tools, which only fire while its process is running, are turned off; Bishop's [schedules](/running/schedules) do the same job.

## Agent options

`agent.options` is passed to the harness unvalidated. Under Claude it's the Agent SDK's own options object, not a settings file: anything from [Claude Code's settings reference](https://code.claude.com/docs/en/settings-reference) goes in the nested `settings` object, which is shaped like a `.claude/settings.json`. A settings key written at the top level is dropped by the SDK without a word, so put it a level down:

```json
{
  "agent": {
    "options": {
      "maxTurns": 30,
      "settings": {
        "permissions": { "allow": ["Bash(python3:*)"] }
      }
    }
  }
}
```

These layer over the agent's own settings files rather than replacing them, so a project that sets `model` in `.claude/settings.json` keeps it unless `agent.options` names `model` too. [The agent's own settings](#the-agent-s-own-settings) covers how the two combine.

Bishop sets `cwd`, `resume`, `systemPrompt`, `abortController`, `sessionId`, `forkSession`, and `canUseTool` itself and ignores them here, logging a warning for each. They decide which agent runs, which conversation it continues, and how Bishop tells the agent who it's talking to.

Bishop sets three defaults, all overridable:

* **`permissionMode: "auto"`.** Nothing in a conversation can answer a permission prompt, and an agent needing approval for a tool reports itself blocked instead of doing the work. Override it if you want something stricter.
* **`mcpServersDelivery: "initialize"`.** The MCP servers in `agent.options.mcpServers` reach Claude Code over stdin rather than on its command line, where anyone on the host can read their `headers` and `env` with `ps`. It needs the Claude Code bundled with Bishop's SDK or newer, so if `pathToClaudeCodeExecutable` points at an older one, set `"argv"`.
* **`settings.autoMemoryEnabled: false`.** Auto memory writes to `projects/<agent-directory>/memory` in Claude's config directory, outside the agent's own repository, so it doesn't travel when you deploy the agent somewhere else, and a git-URL agent's directory changes with every commit. Turn it back on with `"settings": { "autoMemoryEnabled": true }`. Bishop warns if you put it at the top of `agent.options`, where the harness ignores it.

`hooks` and `settings` merge instead of being replaced. Your hooks run alongside the one [worktree mode](/running/worktrees) installs, and your `settings` object keeps Bishop's defaults and the agent's own settings for the keys it doesn't name. Pointing `settings` at a settings file instead opts out of Bishop's `settings` defaults and of the agent's own settings, which Bishop warns about.

### Under Codex

`agent.options` takes Codex's own fields instead:

```json
{
  "agent": {
    "harness": "codex",
    "options": {
      "sandboxMode": "danger-full-access",
      "additionalDirectories": ["/srv/data"]
    }
  }
}
```

Bishop's defaults are `approvalPolicy: "never"`, `sandboxMode: "workspace-write"`, `networkAccessEnabled: true`, and `skipGitRepoCheck: true`. Nothing in a conversation can answer an approval prompt, so an agent that asks for one stalls the turn. The sandbox is the compensation: writes stay inside the working directory, and network access stays on because an agent that can't push, install, or fetch fails at something in most threads. Override any of them here.

Bishop sets `workingDirectory` and `developer_instructions` itself and ignores them here. `config` and `configOverrides` reach Codex's own `--config` mechanism, which is how anything in `config.toml` can be set per agent. A `config` object you set is merged with Bishop's rather than replacing it.

## The agent's own settings

The agent's committed harness config applies in full: `.claude/settings.json` under Claude, `.codex/config.toml` and `.codex/hooks.json` under Codex. The plugins it declares are installed. Deploying an agent under Bishop is the decision to trust its repository, so nobody has to run the harness in the directory first to accept it.

Bishop reads the config from each thread's working directory on every turn, so a thread pinned to a snapshot of a git-URL agent runs with that commit's config. It layers weakest first under both harnesses: Bishop's defaults, then the agent's file, then `agent.options`. The agent's file can't change what Bishop sets to run a turn, listed for each harness below.

A thread's first turn waits up to 60 seconds for the agent's plugins to install, and Bishop logs a warning if a marketplace or plugin fails or the install runs out of time. Later turns load them from the harness's cache.

The repository is authoritative. Its rules, hooks and plugins take effect with no review step, and with `--auto-update` a push to the agent's repository changes what the agent may do from the next thread on. To keep each harness's untrusted behavior instead:

```json
{
  "agent": {
    "projectSettings": false
  }
}
```

### Claude

Left to itself, headless Claude Code treats a repository's settings as untrusted and quietly drops `permissions.allow`, `permissions.additionalDirectories`, and plugins from them. Bishop passes the file to the harness as the host's own settings. A relative path in `permissions.additionalDirectories` resolves against the agent's directory, not its `.claude` folder.

The file sits between Bishop's defaults and `agent.options.settings`. Objects merge key by key and lists combine, so an operator's `permissions.deny` adds to the agent's permissions rather than replacing them, and `"enabledPlugins": { "formatter@tools": false }` turns off one plugin the agent enabled. What Bishop sets is the permission mode, its own hooks and tools, the working directory, and the system prompt.

The agent's file outranks `~/.claude/settings.json` and `.claude/settings.local.json` on the host, so put anything you want to override it in `agent.options.settings`. A thread with a [home of its own](/running/sandbox#what-the-agent-can-reach) doesn't read `~/.claude` at all, so `agent.options` and the agent's file are the places for anything every thread needs.

A file Claude would reject, such as one with a list where a string belongs, is skipped with a warning naming it, and the turn runs with Bishop's defaults and your settings. Under the [sandbox](/running/sandbox), a settings file that resolves outside the agent's grants, through a symlink, is skipped the same way.

#### Claude plugins

Declare an agent's plugins in a marketplace written inline in `.claude/settings.json`, and pin each one, so updating a plugin is a commit to the agent's repository:

```json
{
  "extraKnownMarketplaces": {
    "agent-plugins": {
      "source": {
        "source": "settings",
        "name": "agent-plugins",
        "plugins": [
          {
            "name": "formatter",
            "source": {
              "source": "github",
              "repo": "acme/claude-formatter",
              "sha": "4f2a9c1e8b7d6a5f4e3d2c1b0a9f8e7d6c5b4a39"
            }
          }
        ]
      }
    }
  },
  "enabledPlugins": { "formatter@agent-plugins": true }
}
```

Each plugin source pins its own way: `sha` for `github`, `url` (any git repository) and `git-subdir`, `sha256` for `archive`, and an exact `version` for `npm`. A thread with a home of its own loads plugins from `.bishop/plugins`, which Bishop installs into once and threads can read but not change. Otherwise plugins install into the `~/.claude` cache, which every agent on the host shares. Claude caches a pinned plugin under its SHA, so threads on different snapshots of an agent keep separate versions.

A marketplace declared as a `github` or `git` repository doesn't pin its plugins. Its `ref` takes a branch or tag and fixes only the marketplace's list, and an entry there naming another repository without a `sha` installs whatever that repository serves on the day.

Once the host has fetched a marketplace, Claude Code keeps using that copy, so an unpinned marketplace doesn't pick up new commits on its own. Set `"autoUpdate": true` on its `extraKnownMarketplaces` entry, and Bishop refreshes it before a thread's first turn, at most once an hour. Threads already running keep the plugins they started with. Claude caches a plugin by its `version` when it has one, so a plugin that sets `version` arrives only when the version changes. Bishop logs a warning if a refresh fails, and the thread runs with the copy already fetched.

A marketplace committed inside the agent's repository, such as `"source": { "source": "directory", "path": "./.claude/marketplace" }`, loads from the thread's own checkout, so each snapshot of a git-URL agent uses the copy it was committed with. As in Claude Code, a relative path starts at the top of the agent's repository, which is the agent's directory unless it sits inside a larger repository.

### Codex

Left to itself, `codex exec` treats a repository as untrusted: it ignores `.codex/config.toml` and `.codex/hooks.json` without saying so, and never installs a plugin. `AGENTS.md` and `.agents/skills` apply either way. Bishop trusts each thread's working directory for that turn only, writing nothing to Codex's own state. Only the agent's own `.codex` folder is trusted, not one in a larger repository around it.

The agent's hooks run without anyone approving them: Bishop approves each hook in the agent's `.codex` folder, and each hook of a plugin the agent enables, by the hash Codex records when a person approves one. Hooks in `CODEX_HOME` still need approving there.

Where the agent's file sets `sandbox_mode` or `sandbox_workspace_write.network_access`, Bishop's `sandboxMode` and `networkAccessEnabled` defaults step aside for it, and Bishop logs which did. Lists in `agent.options.config` combine with the agent's, so your `sandbox_workspace_write.writable_roots` adds to the agent's rather than replacing them. `notify` and MCP server entries are commands, so yours replace the agent's whole. Set `projects` and `hooks` in `agent.options.config` rather than as whole tables in `configOverrides`, where Bishop's own replace them. What Bishop sets is the approval policy, Codex's sandbox mode under the [sandbox](/running/sandbox), Bishop's tool server, the working directory, and the instructions that say who is speaking. The agent's own `developer_instructions` follow Bishop's. Codex itself refuses `model_provider` and `model_providers` from a project.

Outside the sandbox, the agent's file can loosen Codex's own sandbox, for example with `sandbox_mode = "danger-full-access"`. Set `sandboxMode` in `agent.options` to hold it.

A config Codex would refuse, such as `model_reasoning_effort = 42`, is skipped with a warning naming the reason, and the turn runs as if the repository were untrusted. So is one that declares an MCP server named `bishop`, which Codex would merge into Bishop's own. A `hooks.json` Codex can't parse is logged, and Codex skips it. Under the sandbox, Bishop asks Codex about the project through the sandbox, so a file the agent couldn't read itself isn't read. The turn then fails, because Codex reads `.codex/config.toml` even when the repository is untrusted.

#### Codex plugins

Declare an agent's plugins with Codex's own keys in `.codex/config.toml`, the ones `codex plugin add` writes, and pin the marketplace to a commit:

```toml
[marketplaces.agent-plugins]
source_type = "git"
source = "https://github.com/acme/codex-plugins.git"
ref = "4f2a9c1e8b7d6a5f4e3d2c1b0a9f8e7d6c5b4a39"

[plugins."formatter@agent-plugins"]
enabled = true
```

`source` takes what `codex plugin marketplace add` takes: `owner/repo`, an HTTPS or SSH git URL, or a local path, which resolves against the agent's directory. `ref` takes a branch, a tag or a commit SHA, and a SHA fixes every plugin the marketplace's own repository holds. Pinning one plugin apart from its marketplace is untested.

Bishop installs only from marketplaces the agent's file declares, and skips a plugin that `agent.options.config` turns off with `plugins."<plugin>@<marketplace>".enabled = false`. Each process installs a declaration once, so a changed pin installs on the next thread. A plugin already cached at the same version is left in place, since running threads may be using it, so a plugin updates when its version changes.

Plugins install into `.bishop/plugins` for a thread with a home of its own, and otherwise into the shared `CODEX_HOME`'s plugin cache, which keeps one version of each plugin: threads on different snapshots of an agent share whichever version installed last. Bishop doesn't enable them in `CODEX_HOME/config.toml`, so another agent sharing that home loads them only if its own config enables them.

## One config for both harnesses

`agent.options` is written in one harness's vocabulary, so a config meant to run either one keeps a block per harness:

```json
{
  "agent": {
    "harness": "claude",
    "worktrees": true,
    "effort": "high",

    "harnesses": {
      "claude": {
        "options": { "maxTurns": 30 }
      },
      "codex": {
        "model": "gpt-5.6-codex",
        "options": { "sandboxMode": "danger-full-access" }
      }
    }
  }
}
```

`bishop` runs Claude with its block, and `bishop --harness codex` runs Codex with its own model and sandbox setting.

A block takes `model`, `effort`, and `options`. `model` and `effort` layer over the ones beside `harness`, so `effort` above applies to both harnesses and Codex adds a model. `options` doesn't layer: it replaces `agent.options` outright, since merging two objects written in different vocabularies would splice one harness's keys into the other's call.

`agent.options` is then the options for whichever harness has no block of its own. Set both for the same harness and startup warns that the block wins. Switch to a harness with no block and startup warns that it's being handed options meant for the other one. A harness name Bishop doesn't run fails at startup, so a misspelled block can't quietly do nothing.
