---
url: /configure/agent-settings.md
---
# Agent settings

An agent's settings, such as its target, its permission mode, and its variables, apply to its runs only. `pandra config set --agent` writes one for an agent you have pulled, built, or loaded:

```sh
pandra config set --agent github.com/acme/reviewer permission-mode read-only
```

```toml
# ~/.config/pandra/config.toml
[agents."github.com/acme/reviewer"]
permission-mode = "read-only"
```

## Settings of one agent

`[agents."<identity>"]` takes these keys; the [`config.toml` reference](/reference/config-toml.md#agentsname) lists the rest, which [instructions and skills](/configure/instructions-and-skills.md) describes:

| Key | Meaning |
| --- | --- |
| `target` | The [target](/configure/targets.md) for this agent. |
| `permission-mode` | `auto` (the default), `bypass`, or `read-only` ([permissions](/harnesses/permissions.md)). `bypass` skips the harness's permission checks. `--permission-mode` chooses the mode for one run over this key. |
| `env.<VAR>` | A variable for the agent's runs ([below](#environment-variables-for-agents)). |
| `mcp.<server>` | The MCP configuration for one of the agent's servers ([allowing servers](/mcp-servers/allowing.md)). |
| `instructions-mode` | `append` (the default) adds the agent's instructions to the harness's built-in instructions; `replace` puts them in place of the built-in ones. |

With `instructions-mode = "replace"`, the harness's built-in instructions, such as its guidance on its tools, are removed, while the permission checks and sandbox the harness enforces stay. What each harness loses is on its page: [Claude Code](/harnesses/claude-code.md#instructions), [Codex](/harnesses/codex.md#instructions), and [Pi](/harnesses/pi.md#instructions). A session keeps the mode it was created with.

## Agent identity

An agent's table is named by its identity, which depends on how you refer to the agent, never on its version, so settings survive upgrades:

| Reference | Identity | Note |
| --- | --- | --- |
| `github.com/acme/reviewer@v1.2.0` | `github.com/acme/reviewer` | |
| `github.com/acme/agents/reviewer@v1.2.0` | `github.com/acme/agents/reviewer` | |
| `gitlab.com/acme/tools/agents//reviewer@v1.2.0` | `gitlab.com/acme/tools/agents//reviewer` | On hosts other than `github.com`, `bitbucket.org`, and `codeberg.org`, `//` separates the subdirectory. |
| `ghcr.io/acme/reviewer:1.2.0` | `ghcr.io/acme/reviewer` | |
| `oci://codeberg.org/acme/reviewer:1.2.0` | `oci://codeberg.org/acme/reviewer` | A registry on `github.com`, `gitlab.com`, `bitbucket.org`, or `codeberg.org` is written with `oci://`. |
| `.`, `./reviewer`, or `./reviewer.agent.tar` | `/home/me/src/reviewer`, the absolute path | In a worktree that `git worktree add` made, the same path in the main checkout. |
| `reviewer` | `reviewer`, the local name | For a package built or loaded into the store. |

`--agent` takes any reference and writes to the identity's table, so `--agent .` means the current project, and `--agent github.com/acme/reviewer@v1.2.0` writes to `[agents."github.com/acme/reviewer"]`. In the file, write the key as Pandra shows it: a key in another spelling is an error that shows the key to write. `pandra ps` shows each run's identity.

`pandra config set --agent` and `pandra config target use --agent` need the agent in the store; a project directory or a package file only needs to exist. For an agent the store does not hold, they change nothing and print the command that fetches it, or `pandra agent list` for a local name, so a mistyped name never writes a setting that no run uses. `pandra agent remove` keeps the agent's settings, and an agent you pull again finds them. `pandra config unset --agent` removes a setting, also for an agent the store no longer holds.

A local project's settings follow its path, and every worktree of a repository shares the main checkout's. A moved directory, a second clone, or a checkout on another machine needs its settings written again.

## Environment variables for agents

An agent inherits your shell's environment variables. To give runs a value, set it in one of four places; when several set the same variable, the narrowest wins:

| Where | Applies to | For example |
| --- | --- | --- |
| `[defaults.env]` | every run, on every harness | proxies and certificates |
| `[harnesses.<name>.env]` | every run of that harness | Claude Code's telemetry opt-outs |
| `env.<VAR>` in `[targets.<name>]` | the runs that use that target | an LLM gateway's URL |
| `env.<VAR>` in `[agents."<identity>"]` | the runs of that agent | a variable the agent declares, such as the channel it posts to |

```sh
pandra config set defaults.env.HTTPS_PROXY http://proxy.corp.example:8080
pandra config set harnesses.claude-code.env.DISABLE_TELEMETRY 1
pandra config set \
    --target claude-work env.ANTHROPIC_BASE_URL https://llm-gateway.corp.example
pandra config set \
    --agent github.com/acme/notifier env.SLACK_CHANNEL alerts
pandra config secret set sentry-token --1password op://Work/Sentry/token
pandra config set --agent github.com/acme/notifier env.SENTRY_TOKEN \
    --secret sentry-token
pandra config unset --agent github.com/acme/notifier env.SLACK_CHANNEL
```

* `[defaults.env]` and `[harnesses.<name>.env]` take literal values only. A target's and an agent's `env` also take a [logical secret](/secrets.md), with `--secret`, and a variable the agent declares as secret must be one.
* Every `PANDRA_*` name, and, outside a target's `env`, the harness's credential variables, such as `ANTHROPIC_API_KEY`, are refused with the place to use instead, such as `pandra config target set --login`.
* `pandra config show --agent AGENT` shows what is set for each variable the agent declares, and `pandra run AGENT --dry-run` shows each variable a run would get, with where it came from.

## Which environment variables reach the agent

A harness and the processes it starts inherit your shell's environment variables, because git, gh, cloud CLIs, and proxies depend on them. Pandra removes a few, and adds the ones that describe the run. For example, when you start a run from a shell that has these variables, with a configuration that reads a secret from Bitwarden, on a Claude Code target whose credential is a subscription token:

| In your shell | In the agent's environment | Why |
| --- | --- | --- |
| `GITHUB_TOKEN=ghp_...` | the same | Inherited, so `gh` and `git` work. |
| `AWS_PROFILE=work` | the same | Inherited, also when a secret comes from AWS Secrets Manager, because the agent's own tools use it. |
| `ANTHROPIC_API_KEY=sk-ant-...` | removed | The target's credential is the run's only one ([target credentials](/configure/targets.md#target-credentials)). Without a credential on the target, it stays. |
| `BW_SESSION=...` | removed | It serves only a secret store that your configuration uses. `OP_SERVICE_ACCOUNT_TOKEN` is removed the same way when a secret comes from 1Password. |
| `PANDRA_SECRET_SLACK_TOKEN=...` | removed | It supplies a secret's value to Pandra only ([supplying a value without its store](/secrets/using.md#supplying-a-value-without-its-store)). |
| `PANDRA_QUEST_ID=...`, in a quest's script that runs `pandra run` | removed | Pandra sets the `PANDRA_QUEST_*` variables for the script alone ([scripts](/quests/scripts.md)). |
| `CLAUDECODE=1`, from the Claude Code you started Pandra in | removed | A parent harness sets it for itself. Pandra removes `CLAUDE_*`, `CODEX_*`, and `PI_*` the same way, except login and provider variables, such as `CLAUDE_CODE_OAUTH_TOKEN`, and the ones your configuration sets. |
| none | `PANDRA_RUN_ID`, `PANDRA_AGENT`, `PANDRA_AGENT_DIGEST` | Pandra sets the run's ID, the agent's identity, and its package's digest, so the agent and its commands can tell which run they are in. A run that an agent starts also gets `PANDRA_PARENT_RUN_ID`. |

`pandra run AGENT --dry-run` lists the variables your configuration gives a run, each with the place it came from.

::: security
There is no setting to filter these variables, and the agent and its tools can read every one of them.
:::

## Agents that run agents

An agent can run Pandra itself to hand work to other agents. `[nested]` sets how deep that goes:

```toml
# ~/.config/pandra/config.toml
[nested]
max-depth = 2
```

`max-depth` is `1` by default: an agent you start can start other agents, and those cannot. `0` prevents nesting.

::: security
These limits keep well-behaved agents from overreaching; they are not a security boundary.
:::

A nested run:

* uses the same Pandra, the same configuration file, and your own harness login;
* never asks a question and never approves a package, even with `--yes`, so approve a remote agent first with `pandra agent trust`;
* cannot change the configuration: each command that writes it refuses and says that you have to run it.

A nested run does not get `PANDRA_SECRET_*` variables or secret-store credentials. A secret it needs from such a source fails the check before the run. The error asks for a keychain or file source, and gives `pandra --config-file PATH config secret set NAME --keychain`, with the configuration file the run read as `PATH`, for you to run outside the agent. This matters most in CI, where secrets usually arrive as environment variables.

## Show and edit the file

`pandra config show` lists each value with its file and line ([Configuration](/configure.md) shows an example). Each `pandra config` command validates the whole file before it saves, and keeps your comments and formatting. `pandra config set` writes any key, as a dotted path from the top of the file, or from the agent's table with `--agent`, or from the target's table with `--target NAME`:

```sh
pandra config set defaults.permission-mode bypass
pandra config set targets.claude-work.model claude-opus-5-5
pandra config unset targets.claude-work.effort
pandra config set harnesses.claude-code.settings.permissions.allow '["Bash(npm test)", "Read"]'
```

A value under `[harnesses.<name>.settings]` is read as TOML. A list of Pandra's own, such as `defaults.instruction-sources`, takes the whole list as a TOML list, which replaces the list in the file. Every `env.*` value is a string, so `env.DEBUG true` sets `"true"`.

### Add to and remove from a list

`pandra config add` appends values to a list and `pandra config remove` takes them out, without writing the whole list again:

```sh
pandra config add policy.allow-hosts \
    registry.npmjs.org internal.example.com:8443
pandra config add --agent ghcr.io/acme/reviewer vm.ports 3000:3000
pandra config remove --agent ghcr.io/acme/reviewer \
    policy.allow-hosts internal.example.com
pandra config add --target team args -- --add-dir /srv/shared
```

The `policy` and `vm` tables configure runs in a microVM ([Running in a microVM](/run/vm.md)), and [`pandra config add`](/reference/cli.md#pandra-config-add) in the reference lists how each list takes its values.

`pandra config edit` opens the file in `$VISUAL`, `$EDITOR`, or `vi` and saves it only when it is valid; otherwise it shows each problem and asks again:

```text
$ pandra config edit
warning: config.toml:30: unknown key "permision" in [agents."github.com/acme/notifier"]
? Edit again? [y/N]
```

To edit the file with another tool, or as an AI agent, which has no terminal for `config edit`:

```sh
# Find the file
pandra config path
# Edit it with any editor, then check it
pandra config validate
```

`pandra config validate` reports each problem that `config edit` shows as a warning, such as the unknown key above, as an `error:` and exits 1.

* Never write `[allowed-servers]` yourself: Pandra writes it when you allow an MCP server.
* A `pandra config` command that writes during your edit can lose one of the two changes.

## What overrides what

A setting can appear in several places. For each setting, the first place in its list that sets it wins.

The target:

1. `--target`
2. the agent's `target`
3. `defaults.target`
4. none: the harness Pandra finds ([which harness runs](/harnesses/choosing.md#which-harness-runs))

The harness, provider, model, and effort ([what decides a run](/harnesses/choosing.md#what-decides-a-run)):

1. `--harness`, `--provider`, `--model`, and `--effort`
2. the [guild profile](/guilds/running.md#run-members-with-a-profile) you name
3. the target
4. the harness's own defaults

The permission mode:

1. `--permission-mode`
2. the agent's `permission-mode`
3. `[harnesses.<name>] permission-mode`
4. `defaults.permission-mode`
5. `auto`

An environment variable:

1. the agent's `env`
2. the target's `env`
3. `[harnesses.<name>.env]`
4. `[defaults.env]`
5. your shell

The instruction and skill sources:

1. `--instruction-sources` and `--skill-sources`
2. the agent's `instruction-sources` and `skill-sources`
3. the same keys in `[defaults]`
4. none

The preloaded skills:

1. the agent's `preload-skills`
2. a guild member's `preload-skills`
3. `defaults.preload-skills`
4. none

The harness installation ([which installation runs](/harnesses/choosing.md#which-installation-runs)):

1. `--harness-version`
2. a pin in `[harnesses.<name>]`
3. the harness on `PATH`
4. the newest installation Pandra made

A target or an MCP configuration is used whole, with no merging of fields; only environment variables are layered. A `--harness` or `--provider` that differs from the configured target drops that target, and next to an explicit `--target` it is a usage error. `pandra run AGENT --dry-run` shows each value with the place it came from.
