# Orchestration

An orchestration is a team of agents that you start together. One role, the **orchestrator**, receives your request and hands tasks to the other roles, the **workers**, with `dot-agent-deck delegate`. Each worker runs in its own pane, does its task, and reports back with `dot-agent-deck work-done`. You talk to the orchestrator; it runs the team.

The team is defined in a `.dot-agent-deck.toml` file in the project directory. Both clients start and show orchestrations: the TUI opens one as an orchestration tab, and the desktop app shows it as an **ORCHESTRATION** group on its Dashboard. The orchestration keeps running in the daemon when you detach the TUI or close the desktop app, and the workers' reports are in the orchestrator's pane when you come back.

A video walkthrough of a coder → reviewer + auditor → release pipeline is at <https://youtu.be/ZIWWDDu02Ik>.

## Set up a three-role orchestration

This task creates an orchestrator, a `coder` and a `reviewer` for one project, starts them, and hands them a first request.

Before you start:

- `dot-agent-deck` is installed and `dot-agent-deck --version` prints a version. See [Installation](installation.md).
- The agent CLI each role runs is installed and signed in. The example uses `claude` (Claude Code). The other agents the deck recognises are `opencode`, `pi`, `codex`, `devin` and `agy` (Antigravity; see [Installation → Antigravity CLI](installation.md#antigravity-cli)).
- The agent's hooks are installed, so role cards show live status. See [Getting Started](getting-started.md).

### 1. Write `.dot-agent-deck.toml`

Create `.dot-agent-deck.toml` in the project's root directory, the directory you will open the orchestration in:

```toml
[[orchestrations]]
name = "team"

[[orchestrations.roles]]
name = "orchestrator"
command = "claude"
start = true
prompt_template = """
You coordinate the team. You never write or review code yourself; you delegate.

Workflow:
1. Delegate implementation to coder.
2. When coder reports done, delegate a review of the change to reviewer.
3. If reviewer reports blocking issues, re-delegate to coder with the exact findings.
4. When reviewer is satisfied, summarise the result for the user and stop.

Workers start with no memory of this conversation. Put everything a worker needs in the task:
file paths, the spec, and the previous worker's findings.
"""

[[orchestrations.roles]]
name = "coder"
command = "claude"
description = "Implements features, fixes bugs, refactors code"
prompt_template = "Implement the requested change. Run the project's tests before reporting completion. If the project is a Git repository, commit your changes before you report."

[[orchestrations.roles]]
name = "reviewer"
command = "claude"
description = "Reviews code changes for correctness, style, and edge cases"
prompt_template = "Review the change. Report findings only; do not modify code."
```

The example works in any directory. In a Git repository (`git rev-parse --is-inside-work-tree` prints `true`), the coder also commits each change, which gives the reviewer a commit to read; outside one it leaves the changes in the working tree.

`dot-agent-deck init` writes a two-role starter file with the same shape if you prefer to start from it; it refuses to overwrite an existing `.dot-agent-deck.toml`. Every key is described in the [configuration reference](#configuration-reference).

**Check:** run `dot-agent-deck validate` in the same directory. It prints `Config is valid.` and exits 0. Anything it prints instead is described under [Validate your config](#validate-your-config).

### 2. Let the roles write files and run the deck's commands

The orchestrator and the workers hand tasks and reports to each other through files under `.dot-agent-deck/` and through the `dot-agent-deck delegate`, `work-done` and `ack` commands. A role whose agent must ask permission for each of those stops at an approval prompt, and an unattended pane waits there indefinitely. If you launch a role with a restricted tool allowlist, see [Context handoff and permissions](#context-handoff-and-permissions) before continuing. A plain `claude` command, as in the example, asks you to approve these steps in its pane the first time.

### 3. Start the orchestration

**TUI:**

1. Run `dot-agent-deck`.
2. Press `Ctrl+n` to open the New Agent form.
3. Use `Enter` to step into directories and `Space` to select the project directory.
4. On the **Mode** field, press `Left`/`Right` (or `h`/`l`) until it shows `Orch: team`. The Command field disappears: each role runs its own `command`.
5. Press `Enter`.

A new tab named after the orchestration opens beside **Dashboard**, with one pane per role. The role cards are stacked in the left sidebar, the orchestrator's card carries an **ORCHESTRATOR** badge, and the orchestrator's pane is focused.

**Desktop:**

1. Open **New agent** from the Dashboard (or press `Ctrl+N` / `⌘N`) and choose the daemon.
2. Browse to the project directory (it is tagged **project**) and press **Use this directory**.
3. Under **Mode**, pick the `Orch: team` chip. There is no **Command** field: each role runs its own `command`.
4. Optionally type a **Name** for the run, then press **Activate orchestration**.

The first time you start an orchestration, and again after its roles' commands, descriptions or prompts change, both clients show **Review project commands** before anything starts: read what each role will run and be told, then press `a` in the TUI or **Approve and start** in the desktop app. Schedules and dispatched units can start it only after you have approved it. See [Approving Project Commands](project-trust.md).

The Dashboard shows an **ORCHESTRATION** group with a numbered row per role and an **ORCHESTRATOR** badge on the orchestrator. Click a row to open that role's terminal. The group carries the orchestration's name and a **Close** button. See [Desktop app → Dashboard](desktop/dashboard.md) and [New agent](desktop/new-agent.md).

**Check:** run `dot-agent-deck daemon status`. It prints one row per agent with the columns `PANE AGENT ROLE STATUS TOOL INBOX WAKE LABEL CWD`. The three roles appear with ROLE `orchestrator (orchestrator)`, `coder` and `reviewer`, and CWD is the project directory. `(orchestrator)` marks the role that may delegate.

### 4. Give the orchestrator a request

Type your request into the orchestrator's pane, for example *"Add input validation to the signup form and have it reviewed."* The orchestrator already knows the roles and how to delegate; the deck gives it that context when the orchestration starts.

**Check each hand-off:**

- When the orchestrator delegates, the `coder` card (TUI) or tile (desktop) shows `✉1 queued` until the coder takes the task, then `✉ delivered`, and its status changes to a working one. The task reaches the coder's pane as a deck message whose `Sent by:` line names the orchestrator; see [Delivery in the TUI and desktop app](#delivery-in-the-tui-and-desktop-app) for how each agent shows it. In the desktop app, the handoff rail shows `delegated · queued`, then `delivered · working`. A copy of the task is also saved to `.dot-agent-deck/worker-task-coder.md` in the project directory.
- When the coder finishes, it runs `dot-agent-deck work-done` with the task's id. Its report appears in the orchestrator's pane and is saved to `.dot-agent-deck/work-done-coder.md`.
- The orchestrator then delegates to `reviewer`, and the same two signs appear for it.

If a step does not happen, see [When something goes wrong](#when-something-goes-wrong). If a worker stops responding, the deck reports it to the orchestrator; see [Idle Workers & Notifications](idle-workers-and-notifications.md).

## Quick setup

Instead of writing the file yourself, you can ask an agent that is already running in the project to propose one. The TUI and the desktop app do this the same way, and the file the agent writes is used by both.

1. Start an agent on the project directory with **Mode** left on **No mode**: `Ctrl+n` in the TUI, **New agent** in the desktop app ([Desktop app → New agent](desktop/new-agent.md)).
2. Ask that agent to generate the config:
   - **TUI:** press `Ctrl+d` to enter command mode, select the agent's card and press `g`, or click **Generate** in the footer.
   - **Desktop:** open the agent's pane from the Dashboard and press **Generate config** in its header. With voice on, say **"generate config with"** and the agent's name on the Dashboard, or **"generate config"** in its pane ([Voice Control → Generating a config](desktop/voice.md#generating-a-config)).

   A dialog titled **Generate .dot-agent-deck.toml** asks whether to instruct your agent to analyse the project and create one.

   When the agent's project directory already has a `.dot-agent-deck.toml`, the same control reads **Update** instead: `[Update g]` in the TUI's footer, **Update config** on the agent's row (`Update config with <name>`) and in its pane's header in the desktop app. Both clients notice within a few seconds when the file appears or goes away, so once the agent has written it the control reads **Update**. The dialog is then titled **Update .dot-agent-deck.toml** and asks whether to instruct your agent to analyse the project and update the existing config. The key, the voice phrases and the steps are the same; you can also say **"update config"**.

   When the deck can't tell whether the file exists, for example because the project is on a network drive that stopped answering, the control reads **Generate** and the dialog, still titled **Generate .dot-agent-deck.toml**, asks whether to instruct your agent to check the project for `.dot-agent-deck.toml` and create it, or propose updates to it if it already exists. The agent then looks for the file itself and, if it finds one, updates it as above.
3. Choose **Yes**. **No** (or `Esc`) closes the dialog and sends nothing.
4. The deck sends the agent a [deck message](#delivery-in-the-tui-and-desktop-app) asking it to analyse the project, pick roles from the [role library](#role-library), find the commands that launch agents in this project (devbox scripts, Makefile targets, bare `claude`, `opencode`, `pi`, `codex`, `devin` or `agy`), and propose a config. Both clients say `Config request sent to the agent's inbox.` and bring the agent in front of you: the TUI focuses its pane, so what you type next goes to the agent, and the desktop app opens its pane. In the desktop app, pressing **No** while the dialog says `Sending…` closes it but does not take the request back; the app then leaves you where you are instead of opening the agent's pane.
5. Read the proposal in the agent's pane and tell the agent what to change. It writes `.dot-agent-deck.toml` to the project directory only after you approve the proposal. When the file already exists, the agent reads it first and proposes changes to it rather than a new file, keeping what you wrote unless you agree to drop it. This is decided when you press **Yes**: if the file exists by then, the agent is asked to update it, whichever word the control showed. If `.dot-agent-deck.toml` is a symbolic link, the agent edits the file it points to and keeps the link; if the link points to a file that does not exist, the agent tells you so and writes nothing.
6. Run `dot-agent-deck validate`.

The request reaches the agent the way any deck message does, so every supported agent can take it; [Which agents wake for messages](#which-agents-wake-for-messages) says when one needs a prompt from you first. Devin, for example, takes it only when you ask it in its pane to run `dot-agent-deck inbox fetch`. If the agent's card or tile says its message is waiting, do what it says.

If it does not work, the TUI's status line or the desktop app's notice says why; the first two messages, reasons included, read the same in both clients:

| Message | What it means | What to do |
|---|---|---|
| `This daemon is too old to generate a config. Upgrade the daemon to use Generate config.` | The daemon running your agents comes from a release without this feature. Nothing was sent. | Upgrade the deck on the daemon's machine and restart the daemon on the new release ([After upgrading](installation.md#after-upgrading); for a daemon the desktop app watches, [Desktop app → Daemons](desktop/daemons.md)). Restarting the daemon stops its agents, so do it when you are ready to. |
| `Failed to send config prompt: <reason>` | The daemon could not send the request to that agent, for example because the agent exited, another agent replaced it in that pane after you chose it, or the daemon does not know the agent's directory. Nothing was sent to another agent. `Failed to send config prompt: no answer from the daemon within 15s` means the daemon did not answer in time, so the request may or may not have arrived. | Fix what the reason names, or start a new agent on the project directory and try again. After `no answer from the daemon within 15s`, look in the agent's pane before asking again. |
| `No active agent to send prompt to.` (TUI) · `That agent has no pane the daemon can send the request to, so nothing was sent.` (desktop) | The agent you chose has no running pane. | Select an agent that is running in the project, or start one. |

## Configuration reference

### Where the file is read from

The deck reads `.dot-agent-deck.toml` from the directory the orchestration is opened in, and only from that directory; it does not look in parent directories. A dispatched unit reads the copy in its own worktree ([Dispatcher Mode](dispatcher-mode.md)).

When edits take effect:

- A worker's `command`, `agent`, `prompt_template` and `clear` are re-read on every delegation, so an edit applies to that worker's next task without restarting anything.
- What the orchestrator knows (its own `prompt_template` and the workers' names and `description`s) is written into its context when the orchestration starts. To be sure the orchestrator sees an edit to those, start the orchestration again.
- Role **names** are fixed when the orchestration starts. A running role keeps the name it was started with. A role you **add** to the file can be started into the running orchestration with [`dot-agent-deck pane spawn <role>`](#commands); a role you **rename** is reachable under its new name only after you start the orchestration again.

Keys the deck does not recognise are ignored without a warning, and `dot-agent-deck validate` does not report them, so a misspelled key (`promt_template`) silently has no effect.

### Top-level keys

These go **above the first table header** in the file. TOML attaches a key written below a table header to that table, where the deck ignores it.

| Key | Type | Default | Description |
|---|---|---|---|
| `worker_response_timeout_minutes` | integer | `120` | Minutes a worker may take before the orchestrator is told it has not reported. `0` turns the report off; `1`–`10080` are used as written; any other value falls back to `120`. See [Idle Workers & Notifications](idle-workers-and-notifications.md#change-how-long-a-worker-may-take). |
| `[features]` | table | — | Feature flags such as `experimental`. See [Configuration](configuration.md). |
| `[[orchestrations]]` | array of tables | none | One entry per orchestration, described below. |

A `[[modes]]` block from older releases is ignored; `dot-agent-deck validate` warns that it can be deleted.

### `[[orchestrations]]`

| Key | Type | Required | Default | Description |
|---|---|---|---|---|
| `name` | string | no | the directory's name | The orchestration's name, shown in the tab bar, on the `Orch: <name>` Mode chip, and used by `dispatch --orchestration <name>` and a schedule's `shape = "orchestration:<name>"`. An empty or missing name uses the project directory's name. |
| `default` | boolean | no | `false` | Marks the orchestration a run opens when nothing names one. See [Which orchestration a schedule opens](#which-orchestration-a-schedule-opens). |
| `extends` | string | no | — | The `name` of another orchestration in the same file whose roles this one inherits. See [Sharing a workflow with `extends`](#sharing-a-workflow-with-extends). |
| `subscribe` | array of strings | no | `[]` | Announcement topics received by roles in this orchestration. See [Announcements and pooled jobs](#announcements-and-pooled-jobs). |
| `roles` | array of tables | yes | — | The roles, written as `[[orchestrations.roles]]` entries. `validate` requires at least two after inheritance. A block that `extends` another may list only the roles it changes. |

### `[[orchestrations.roles]]`

| Key | Type | Required | Default | Description |
|---|---|---|---|---|
| `name` | string | yes | — | The role's name: shown on its card, passed to `delegate --to`, `pane restart` and `pane spawn`, and used in the file names `.dot-agent-deck/worker-task-<name>.md` and `work-done-<name>.md`. Must be unique within the orchestration, must not be empty, and must not contain `/`, `\` or `..`. Case-sensitive. |
| `command` | string | yes | — | The shell command that starts the role's agent, run in the orchestration's directory, for example `claude`, `claude --model sonnet`, `opencode --model gpt-6-luna`, `codex`, `agy`, `devbox run agent-coder`. May be omitted only in a block that `extends` another and inherits the role. |
| `agent` | string | no | derived from `command` | Which agent `command` starts, when `command` runs it through a launcher: one of `claude`, `opencode`, `pi`, `codex`, `devin`, `agy`. See [Declaring the agent behind a launcher command](#declaring-the-agent-behind-a-launcher-command). |
| `start` | boolean | no | `false` | `true` marks the orchestrator. `validate` requires exactly one role with `start = true`. |
| `description` | string | no | — | What the role is for. The orchestrator reads it to choose which worker gets a task, and it is shown on the role's card. `validate` warns about a worker without one. |
| `prompt_template` | string | no | — | Standing instructions. For a worker, they are written at the top of every task file it receives, followed by a `## Task` heading and the orchestrator's task. For the orchestrator, they are included in the context it receives when the orchestration starts. |
| `clear` | boolean | no | `true` | `true` restarts the worker's agent before each task, so every task starts with a fresh context. `false` keeps the agent running and queues each task in its inbox. See [What `clear` does to delivery](#what-clear-does-to-delivery). |
| `subscribe` | array of strings | no | `[]` | Additional announcement topics received by this role. |
| `take_offers` | array of strings | no | `[]` | Job pools this role can take work from. |

Which role is the orchestrator, for a file `validate` rejects: the first role with `start = true`; if none has it, the role named `orchestrator`; otherwise the first role.

### Declaring the agent behind a launcher command

The deck identifies the agent from the start of `command`: `claude --model opus`, `/usr/local/bin/codex`, `env FOO=1 codex` and `sh -c 'codex …'` are recognised. It cannot see what a launcher starts: `devbox run -- codex`, `mise exec -- codex`, `nix develop -c codex`, `make codex`, `./run-codex.sh`.

A role whose agent the deck cannot identify:

- shows **No agent** and no status on its TUI card, and a blank **CLI** column in the desktop app. A Codex role behind a launcher stays blank until its first task starts, and an Antigravity role until its first prompt. A Claude Code role behind a launcher identifies itself when it starts, so it looks normal;
- gets no doorbell typed into it, and can lack status detection, until its integration identifies itself. Native inbox wake depends on that integration, so a launcher does not by itself prevent native delivery.

`dot-agent-deck validate` warns about each such role. Fix it by declaring the agent:

```toml
[[orchestrations.roles]]
name = "reviewer"
command = "devbox run -- codex --sandbox workspace-write"
agent = "codex"
description = "Reviews code changes"
```

- The value is lower case: `claude`, `opencode`, `pi`, `codex`, `devin` or `agy` (Antigravity is declared by its command's name, `agy`).
- For Antigravity, declare it whenever a launcher starts `agy`: the deck shows its **Needs Input** status, and types the doorbell into it, only in a pane it knows runs `agy`.
- A name the deck does not know gives the role no agent at all; it does not fall back to the command. `validate` warns and lists the accepted names.
- `agent` wins over `command`. Keep the two consistent.
- An empty value is the same as leaving the key out.

### Validate your config

```bash
cd your-project
dot-agent-deck validate            # or: dot-agent-deck validate --path your-project
```

| Output | Exit status | Meaning |
|---|---|---|
| `Config is valid.` | 0 | No errors and no warnings. |
| lines starting `[warning]` on stderr | 0 | Usable, but something is probably not what you meant. |
| any line starting `[error]` on stderr | non-zero | The orchestration will not open correctly. Fix every error. |
| `No .dot-agent-deck.toml found in <dir>` | non-zero | No file in that directory. |
| a TOML parse error naming the file | non-zero | The file cannot be read at all, and no orchestration in it opens. |

Each issue is printed as `[error] '<orchestration>': <message>` or `[warning] '<orchestration>': <message>`.

Errors:

- `orchestration must have at least 2 roles`
- `orchestration must have exactly one role with start = true`
- `role name is empty or whitespace`, or `role name '…' contains unsafe path characters (../, /, or \)`
- `role '…' has an empty command`
- `duplicate role name '…'`
- `more than one orchestration declares default = true (…)`
- `declares default = true but defines no roles, …`

Warnings:

- `duplicate orchestration name`
- `N orchestrations are defined and none declares default = true, …`
- `worker role '…' has no description — orchestrator won't know its capabilities`
- `role '…': unknown agent '…' …` (an `agent` value the deck does not know)
- `role '…': the deck cannot tell which agent … launches and the role declares no agent …`
- `workspace modes were removed (#1199); this block is ignored and can be deleted` (a leftover `[[modes]]` block)

These are reported as parse errors instead, and stop the whole file from loading: an `extends` naming an orchestration that is not in the file, naming a name that more than one block uses, or forming a cycle; an empty `extends`; and a new role (one not inherited through `extends`) with no `command`.

## Role library

Roles are yours to define; the deck imposes no fixed set. When it [generates a config](#quick-setup), the agent starts from these suggestions:

| Role | Description | Suggested `clear` |
|---|---|---|
| `coder` | Implements features, fixes bugs, refactors code | `true` |
| `reviewer` | Reviews code changes for correctness, style, and edge cases | `true` |
| `auditor` | Audits code for security vulnerabilities and unsafe patterns | `true` |
| `tester` | Writes and runs tests; useful for TDD-style flows | `true` |
| `documenter` | Writes and updates documentation only — never modifies source code | `true` |
| `release` | Runs the project's release/PR/merge workflow; never modifies code | `false` |
| `researcher` | Investigates the codebase or external sources to gather context | `true` |

Each suggested `prompt_template` also tells the worker how to share a checkout with the rest of the team. A worker reports back to the orchestrator rather than stopping to ask you something or handing work to another role, and opens that report with its outcome: done, blocked, or needs a decision. Every role except `researcher` checks it is on the branch or commit the task tells it to work from, and stops rather than switching if it is not. Roles that change files leave other agents' changes alone, stage the files they changed by name rather than everything in the checkout, and check what is staged before committing.

A `release` role uses `clear = false` because a release spans several tasks (open the PR, wait for CI, merge), and a restarted agent would forget the branch and PR it was working on.

## Example orchestrations

### Code review pipeline

Orchestrator → coder → reviewer and auditor in parallel → release.

```toml
[[orchestrations]]
name = "dev-flow"

[[orchestrations.roles]]
name = "orchestrator"
command = "claude --model opus"
start = true
prompt_template = """
You coordinate the team. You never implement, review, or audit work yourself.

Workflow:
1. Delegate implementation to coder. Include the relevant spec path.
2. After coder is done, delegate to reviewer and auditor in parallel. Include the files coder changed.
3. If reviewer or auditor flags a blocking issue, re-delegate to coder with the exact finding.
4. Repeat until reviewer and auditor are satisfied.
5. Before delegating to release, summarise what to validate end-to-end and stop until the user confirms.
6. Delegate the release flow to release.

Workers start with no memory of this conversation or of other workers' output. Include all context in
the task: file paths, spec paths, error messages, findings. If context is long, write it to
.dot-agent-deck/<slug>.md and pass that file rather than pasting it.
"""

[[orchestrations.roles]]
name = "coder"
command = "claude --model sonnet"
description = "Implements features, fixes bugs, refactors code"
prompt_template = """
Implement the requested change. Read the spec file first if one is referenced.
Run the project's test suite before reporting completion.
Commit your changes before calling dot-agent-deck work-done.
If critical context is missing from the task, say so in your work-done summary.
"""

[[orchestrations.roles]]
name = "reviewer"
command = "claude"
description = "Reviews code changes for correctness, style, and edge cases"
prompt_template = """
Review the change. Report findings only; do not modify code.
Focus on correctness, consistency with the codebase, edge cases, and missed requirements.
If a spec is referenced, verify the implementation matches it.
"""

[[orchestrations.roles]]
name = "auditor"
command = "opencode --model gpt-6-luna"   # OpenCode 1.x; OpenCode 2 takes the model from its configuration
description = "Audits code for security vulnerabilities and unsafe patterns"
prompt_template = """
Audit the change for security vulnerabilities and OWASP top-10 class issues. Report findings only; do not modify code.
"""

[[orchestrations.roles]]
name = "release"
command = "claude --model haiku"
clear = false
description = "Runs the project's release flow; never modifies source code"
prompt_template = """
Run the release flow: create branch, push, open PR, wait for CI, merge.
Do not modify source code. If any step fails, report the exact error and stop.
"""
```

### TDD cycle

Orchestrator → tester (writes failing tests) → coder (makes them pass) → tester (confirms) → repeat.

```toml
[[orchestrations]]
name = "tdd"

[[orchestrations.roles]]
name = "orchestrator"
command = "claude --model opus"
start = true
prompt_template = """
You run a TDD cycle. You never write code or tests yourself.

Workflow:
1. Delegate to tester to write failing tests for the requested feature.
2. Delegate to coder to implement until the tests pass.
3. Delegate back to tester to confirm the tests pass and coverage is adequate.
4. If tester finds gaps, re-delegate to coder with the specific failing tests.

Include test file paths and the feature spec in every delegation. When chaining tester → coder, list which tests fail.
"""

[[orchestrations.roles]]
name = "tester"
command = "claude"
description = "Writes and runs tests; useful for TDD-style flows"
prompt_template = """
Write tests first, then run them to confirm they fail before any implementation.
Follow the project's test layout and naming conventions.
Report which tests you wrote and which pass or fail.
"""

[[orchestrations.roles]]
name = "coder"
command = "claude --model sonnet"
description = "Implements features, fixes bugs, refactors code"
prompt_template = """
Implement the minimum code to make the listed failing tests pass.
Do not modify the test files. Run the test suite before reporting completion.
"""
```

## Working in an orchestration

### Navigating the orchestration tab

*The TUI's orchestration tab. In the desktop app, open a role's terminal by clicking its row in the ORCHESTRATION group.*

The pane column shows the focused role's pane at full height. These keys work in command mode; press `Ctrl+d` first if you are typing in a role pane:

| Key | Action |
|---|---|
| `Left` / `Right` (or `h` / `l`) | Previous / next tab |
| `1`–`9` | Focus role card N and its pane |
| `Ctrl+l` | Toggle the sidebar width between 34% and 25% of the frame (one setting for every orchestration tab) |
| `Ctrl+z` | Zoom the focused pane to the whole frame; press again to return |
| `Ctrl+w` | Close the orchestration tab, which stops every role, after a confirmation |

`Ctrl+PageDown` / `Ctrl+PageUp` switch tabs from anywhere, including while typing in a role pane. The keys can be remapped; see [Keyboard Shortcuts](keyboard-shortcuts.md).

The sidebar shows each role's status live. A **background** orchestration tab's label takes the colour of its most urgent role: Error (red), then Needs Input (magenta), then Working (green), then Thinking (blue). A tab whose roles are all idle keeps the ordinary tab colour.

### Zooming the focused pane

`Ctrl+z` in command mode shows the focused role's pane over the whole frame, and pressing it again restores the previous view. Every agent keeps running while you are zoomed, and reports and statuses carry on, but the sidebar is hidden, so you do not see a worker that starts waiting for you while the border shows `[Z]`. See [Keyboard Shortcuts](keyboard-shortcuts.md#ctrlz-zooms-the-focused-agent-pane).

### Prompt suggestions are off in workers

Claude Code suggests your next prompt after each turn, and each suggestion costs a model request. A worker takes its tasks from the orchestrator rather than from you, so the deck starts Claude Code workers with suggestions off. You can still type into a worker; you just get no suggestion there. The orchestrator keeps them, as you configured Claude Code. See [Configuration](configuration.md#set-by-the-deck).

### Closing an orchestration

**TUI:** `Ctrl+w` on the orchestration tab, after a confirmation. **Desktop:** the group's **Close** button, after a confirmation that lists the roles (**Close all N roles**), or **Close orchestration** in any role's own close confirmation, which also offers **Close agent** to close only that role. Either stops every role's agent.

### When the orchestrator's conversation is compacted or cleared

A long session compacts the orchestrator's conversation into a summary, and `/clear` empties it. Either can lose the orchestrator its role, and an orchestrator that has lost it can start doing the work itself instead of delegating it. So each time it happens, the deck sends the orchestrator its role again: its `prompt_template`, the workers and how to delegate, and its task if it was given one, with an instruction to carry on coordinating the work under way and to delegate the next step rather than doing it. The message reaches the orchestrator after the summary, and the orchestrator reads its role file again. You do nothing, and nothing is shown for it.

Who sends it depends on how the orchestration was started, not on which client you are watching:

- **Started from the desktop app, by `dot-agent-deck dispatch`, or by a schedule:** the deck sends it, whether or not the TUI or the desktop app is attached. It sends the instructions the orchestration was started with, so a change to `.dot-agent-deck.toml` since then reaches the orchestrator only when you start the orchestration again.
- **Opened in the TUI with `Ctrl+n`:** the TUI sends it, while a TUI is attached, from the orchestration's configuration as you approved it ([Approving Project Commands](project-trust.md#an-orchestrators-instructions-after-compaction-or-clear)). When no TUI is attached, nothing is sent.

| Orchestrator | After a compaction | After `/clear` |
|---|---|---|
| Claude Code | yes | yes |
| Codex | yes | no |
| OpenCode | yes | no |
| Pi | no | no |
| Devin | no | no |

A Pi orchestrator is given its role when it starts rather than as a message, and the deck does not send it again. After a `/clear`, the deck re-sends the role to a Claude Code orchestrator only, and re-sending the role to a Devin orchestrator is not supported yet. Where the table says no, remind the orchestrator yourself: type `Read .dot-agent-deck/orchestrator-context-<id>.md again and carry on coordinating`, naming the newest `orchestrator-context-*.md` in the orchestration's `.dot-agent-deck/` directory.

The role reaches the orchestrator, but whether it follows it is up to the model. If it still does work itself, say so in its pane; [Quick setup](#quick-setup) writes an orchestrator `prompt_template` that opens with what the orchestrator may and may not do itself, which helps.

## How delegation works

1. The orchestrator runs `dot-agent-deck delegate --to <role> --task-file <file>` (or `--task "<text>"`).
2. The deck writes the worker's task file, `.dot-agent-deck/worker-task-<role>.md` in the worker's directory: the role's `prompt_template`, then `## Task`, then the task. It queues an inbox message pointing the worker to that file.
3. The worker's integration receives and acknowledges the message. The task names its id, and the worker does the work and runs `dot-agent-deck work-done --task-id <id> --task-file <file>`.
4. The deck keeps the report, saves a copy to `.dot-agent-deck/work-done-<role>.md`, and puts `<role> completed task <id>` in the orchestrator's inbox. That completes the task, and the worker is free for the next one.

The deck teaches the orchestrator and the workers these commands when they start, so a `prompt_template` only needs to describe your workflow.

The orchestrator can delegate one task to several roles at once (`--to reviewer --to auditor`). Each receives its own inbox message and reports back separately.

### Commands

These commands work only from a pane the deck started, which sets `DOT_AGENT_DECK_PANE_ID` and the other variables they need. Run anywhere else, `delegate`, `work-done`, `pane restart` and `pane spawn` print `Error: DOT_AGENT_DECK_PANE_ID environment variable not set.` and exit non-zero; `ack` prints a message and exits 0. `delegate`, `pane restart` and `pane spawn` are further limited to the orchestrator's pane, and are refused, starting nothing, when the orchestration's roles changed in `.dot-agent-deck.toml` since you approved them; the deck opens **Review project commands** in the TUI and the desktop app attached to it so you can approve the change there, and the message also names the `dot-agent-deck trust approve` command to run from a terminal outside the deck. Once you approve or deny, the orchestrator gets a notice in its inbox saying which, so it knows whether to run the command again ([Approving Project Commands](project-trust.md#work-that-starts-an-orchestration-on-its-own)).

| Command | Who runs it | What it does |
|---|---|---|
| `dot-agent-deck delegate --to <role> [--to <role> …] (--task <text> \| --task-file <path>) [--supersede]` | orchestrator | Sends a task to one or more workers. `--task-file -` reads the task from stdin. `--task-file` is the safe choice for text with quotes, backticks, `$` or newlines; the file must be a regular file of at most 1 MiB. `--supersede` sends even to a worker that still owes a `work-done` ([One task per worker at a time](#one-task-per-worker-at-a-time)). |
| `dot-agent-deck work-done [--task-id <id>] (--task <text> \| --task-file <path>) [--done]` | worker, or orchestrator with `--done` | Reports a finished task to the orchestrator. `--task-id` names the task the report completes, as the task's instructions give it. Without `--task-id` or `--done`, the report is delivered as a note that completes no task. The orchestrator uses `--done` to mark the whole orchestration complete; in a dispatched unit, that reports back to the dispatcher ([Dispatcher Mode](dispatcher-mode.md)). |
| `dot-agent-deck ack <message-id>` | worker or agent integration | Acknowledges a message. The installed integration normally does this itself. Acknowledge a message only after taking it with the integration or `inbox fetch`: when the deck has not handed the message to the agent yet, or has recorded that none of its current hand-overs reached the agent, it answers `unknown` and does not mark the message delivered. Exits non-zero when the deck answers that the id is unknown, belongs to another agent or can no longer be delivered. |
| `dot-agent-deck inbox list [--all] [--json]` | agent | Lists its inbox messages and their delivery states. An orchestrator can use `--all` to inspect its orchestration's inboxes. |
| `dot-agent-deck inbox fetch [--json]` | agent | Reads its waiting messages and confirms to the deck each one it printed in full. Run inside the recipient's deck pane; fetching changes delivery state. `--json` prints each message's id, subject, sender and text. |
| `dot-agent-deck inbox send (--folder <path> \| --orchestration <name> \| --name <name> \| --pane <pane>) (--text <text> \| --file <path>)` | any agent | Messages an orchestration's orchestrator from outside that orchestration, or one standalone agent. See [Messaging an orchestrator from outside](#messaging-an-orchestrator-from-outside). |
| `dot-agent-deck pane restart <role> [--force]` | orchestrator | Replaces the worker's agent with a fresh one and drops the task it owed. Without `--force`, only a worker whose agent has exited (crashed or finished) is restarted. |
| `dot-agent-deck pane spawn <role>` | orchestrator | Starts a role that is in `.dot-agent-deck.toml` but not running in this orchestration, for example one added to the file after the orchestration started, or one whose pane was closed. Refused for a role that is already running and for the orchestrator role. |

`delegate` exit status and output:

| Outcome | Exit status | Printed on stderr |
|---|---|---|
| Accepted for every named role | 0 | `Delegated …`, naming the pane each role's worker runs in and the task id the deck queued the task under; check the inbox badge, or `dot-agent-deck inbox list --all`, for delivery. |
| Accepted for some roles, not others | 0 | `Warning: …` naming the roles that were missed and why, followed by the `Delegated …` line for the roles that were accepted. Re-send only to the missed roles; repeating the whole command gives the accepted roles the task twice. |
| Accepted for no role | non-zero | `Error: delegate from pane … reached no worker for role(s): …`, or `… was NOT sent: every worker it reached still owes a work-done …` |
| Refused: the caller is not the orchestrator | non-zero | `Error: delegate from pane … failed: pane … is the \`<role>\` role, not this orchestration's orchestrator, so it may not delegate.` |
| Daemon not reachable | non-zero | `Error: could not reach the dot-agent-deck daemon socket, …` |

A role "reaches no worker" when it is not in the file, when it is the orchestrator itself, when its pane was closed, or when it was renamed or added after the orchestration started.

`delegate` always gives the task to a worker in the orchestrator's own orchestration, even when other orchestrations running on the deck have roles with the same names. The `Delegated …` line is how to check: its pane is the one `dot-agent-deck roles` lists in its PANE column, beside the worker's orchestration, and its task id is the one the worker's report names when it arrives as `<role> completed task <id>`. A deck older than this `dot-agent-deck` names no pane, and the command then prints nothing for a task accepted for every role.

`work-done` answers once the deck has kept the report:

| Outcome | Exit status | Printed |
|---|---|---|
| The task's report was taken | 0 | `Reported task <id> to the orchestrator.`, or, when the orchestrator is no longer running, that the deck saved the report to a file, with the report's id. The report is listed with the worker's work in [Interrupted Work](interrupted-work.md), in the TUI, the desktop app and `dot-agent-deck interrupted list`; [Saved results and reports](troubleshooting.md#saved-results-and-reports) says where the file is |
| The same report was already taken | 0 | `Task <id> was already reported; nothing new was sent.` |
| A different report for a task already reported | non-zero | `Task <id> was already reported; this different report was NOT delivered. …` |
| No `--task-id` | 0 | `Sent to the orchestrator as a note that completes no task. …` |
| Refused | non-zero | `Error: nothing was reported: …`, saying why and what to do: the task is unknown, was replaced, or ended with its agent; the deck cannot save the report; or it is too large |
| An earlier `work-done` for the same task is still being saved | non-zero | `Error: nothing new was reported: … Run the same command again in a moment …` |
| The report was sent and no answer came back | non-zero | `The report may have been accepted; its result is unconfirmed. …` |
| The deck daemon is older than this `dot-agent-deck` | non-zero | `Error: this deck daemon did not confirm it supports task work-done reports; nothing was reported. …` |

A repeat of a report with the same `--task-id` is answered with the first result while the deck still remembers the task (its last 256 tasks per orchestration, until the daemon restarts), and is never delivered twice. [Troubleshooting](troubleshooting.md#work-done-is-refused-pending-or-unconfirmed) explains each refusal.

Completing a task with `--task-id` has been checked with real Claude Code, Codex, Pi and Antigravity workers. It has not yet been checked with a real OpenCode or Devin worker. With those, watch for `<role> completed task <id>` in the orchestrator's inbox; if it does not come, have the worker run `work-done` again with the `--task-id` from its task's instructions.

### One task per worker at a time

A worker that has been given a task is busy until it sends `work-done`, and until then `delegate` refuses to give it another. What counts is whether the worker has reported, not its status: a worker's card (TUI) or row (desktop) can read idle while the worker still owes a `work-done`. When a worker's agent exits without reporting, the orchestrator is told which of its tasks were not reported, and the worker no longer counts as busy with them.

When the earlier task is not coming back:

- **`delegate --supersede`** queues the new task and ends the earlier one, whether or not the worker had taken it, so the worker owes one `work-done`, for the new task. On a `clear = false` worker, work it already received can finish. On a `clear = true` worker the agent is restarted, so its earlier work is lost.
- **`pane restart <role>`** replaces the worker's agent and drops the task it owed, together with its pending [idle-worker reports](idle-workers-and-notifications.md).
- **Wait.** Seven days after a task was sent, the deck stops counting it.

If the orchestrator's own agent was replaced since it delegated, the new orchestrator is not blocked by the old one's tasks; `delegate` says which earlier task it superseded.

### Adding to a task in progress

When the orchestrator needs to give a worker more information about the task it is already doing (a correction, a missing detail, a forgotten constraint), whether the worker keeps its work depends on the role's `clear`:

- **`clear = false`:** `delegate --supersede` reaches the running agent, which keeps its conversation and its work. The orchestrator says in the task that it adds to the current one. The addition replaces the original task, so the worker owes one `work-done`, for both together.
- **`clear = true`:** every delegate restarts the worker's agent, `--supersede` included, so the worker loses its conversation and anything it had not saved. The orchestrator waits for the `work-done` and delegates a follow-up that restates what the worker needs, or supersedes with the whole task restated and lets the worker start over.

The deck marks the `clear = true` workers in the orchestrator's instructions as starting fresh for every task, and tells it the above. This is the same whether you run the orchestration in the TUI or the desktop app: the orchestrator's agent runs the same commands in either. A follow-up delegated after a `work-done` is a new task too, so a `clear = true` worker starts it without the earlier conversation. If a role's work usually continues from one task to the next, for example a coder that addresses review findings on its own change, set `clear = false` on that role.

### What `clear` does to delivery

With `clear = true` (the default), the deck replaces the worker's agent in the same pane and queues the task for the replacement. Its card in the TUI or row in the desktop app keeps the same name, and its previous conversation is gone. With `clear = false`, the task goes to the running agent's inbox and the worker keeps its conversation. A `clear = true` worker whose agent has exited is started again on its next task; restart a `clear = false` worker before delegating to it again.

When the orchestrator hands tasks to several `clear = true` workers at once, the deck starts their fresh agents one at a time, at least 3 seconds apart, so their first requests do not all reach the provider in the same second and trip its rate limit. A worker given a task with no other worker starting just before it starts at once; of three handed tasks together, the second starts at least 3 seconds after the first and the third at least 3 seconds after the second, plus however long each one's previous agent takes to stop. Until its turn comes, a waiting worker's card in the TUI and its row in the desktop app still show its previous agent, which is replaced when the worker starts. The spacing applies across every orchestration on the daemon, because they share the provider account. Set `DOT_AGENT_DECK_ROLE_START_SPACING_MS` in the daemon's environment to change it, or to `0` to turn it off ([Configuration](configuration.md#daemon-behaviour)).

If the replacement cannot start, or exits before taking the task, the orchestrator is told. See [A delegated worker never came up](#a-delegated-worker-never-came-up).

### Delivery in the TUI and desktop app

Tasks, worker reports, dispatch results, scheduled prompts and deck notices wait in the recipient's inbox. The installed hooks, plugin or extension hand them to the agent and acknowledge receipt. A successful `delegate` means the task was accepted; delivery and finishing the work are separate steps.

Both clients show `✉N queued` while messages await acknowledgement and `✉ delivered` after receipt when nothing remains pending. On a TUI card that line sits beside the status, moves to the right end of the `Dir:` row where it would cut the agent's name short, and shortens to `✉N` on a narrow card ([Message delivery](session-management.md#message-delivery)). In the desktop app it is on the agent's tile and in its open pane. If messages wait longer than a wake-up normally takes while the agent is not working, both clients show `✉N waiting to wake: send it a prompt`. That happens when nothing the deck can do wakes the agent, for example when the agent did not answer the doorbell. Send the agent any prompt: the agent takes its messages at the start or end of its next turn, and the badge goes back to `✉N queued` or `✉ delivered`. When the deck can tell what is keeping the doorbell from ringing, the card and the tile say so instead, under the agent's directory, and the badge keeps only the count:

- `✉N waiting: there may be an unsent draft. Send it or clear it.` Something was typed into the agent's input box and the deck's check of the box found it not empty: text, spaces or empty lines you left there. Send it, or clear it with whatever keys you like; the deck checks the box again and the doorbell goes ahead once it is empty. The deck checks the input box of Claude Code running on Linux when it started Claude Code directly in the pane, not through a launcher script, provided it has somewhere safe to keep its helper ([how the check works](#how-the-deck-checks-claude-codes-input-box)), and of Codex running on Linux when it started Codex in the pane, directly or through a launcher ([how it checks Codex](#how-the-deck-checks-codexs-input-box)). For any other agent, and on macOS, you see one of the lines below instead.
- `✉N waiting: ask the agent to run dot-agent-deck inbox fetch; reinstall the deck integration to restore automatic delivery` Something was typed into the input box of a Claude Code agent whose box the deck can't check, for example one started through a launcher script, or any Claude Code on macOS, where the deck has no input-box check yet, so the deck doesn't type its doorbell into it again until the agent restarts, and every later message waits the same way. Ask the agent, in its pane, to run `dot-agent-deck inbox fetch`, or send it a prompt: it takes its messages at that turn. Clearing the box yourself doesn't make the deck ring. Claude Code's own wake-up delivers without the doorbell: run `dot-agent-deck hooks install`, then restart Claude Code from the deck once it has taken its messages ([Which agents wake for messages](#which-agents-wake-for-messages)).
- `✉N waiting: the deck can't check this agent's input box. Check its pane.` Something was typed into the input box of an agent whose box the deck checks, and it can't check it right now: it is still finding out which version the agent is, its last checks of the box didn't complete, the box holds a prompt recalled with the Up arrow, you opened your own editor with `Ctrl+G` in that pane, something set the agent's `VISUAL` or `EDITOR` again (its shell's start-up file, a launcher, the `env` of Claude Code's settings files or Codex's `.env` file), its shell's start-up file or a launcher changed or removed `DOT_AGENT_DECK_EDITOR_GEN`, the `env` of those settings files or that `.env` file names a `DOT_AGENT_DECK_` variable, a launcher started it with settings of its own, its settings files changed while it ran, one of them can't be read or moves the folder the agent reads its key bindings from, or, for Codex, its home is inside the folder it works in, inside a folder you let Codex write with `writable_roots` or `--add-dir`, under `/tmp` or under your `TMPDIR`, `/cd` or `/worktree` moved it to another folder, or the deck can't read the folder on its status line ([How the deck checks Claude Code's input box](#how-the-deck-checks-claude-codes-input-box), [How the deck checks Codex's input box](#how-the-deck-checks-codexs-input-box)). It types nothing meanwhile, and tries the check again later, with these exceptions, after which it doesn't check that agent's box again until the agent restarts: a Codex started through a launcher that runs it where the deck can't follow, such as `ssh host codex` or `docker run … codex`, which the deck never finds below its launcher; a `VISUAL` or `EDITOR` set again, a `DOT_AGENT_DECK_EDITOR_GEN` changed or removed, or a `DOT_AGENT_DECK_` variable in those settings files or that `.env` file; a launcher's own settings, a change to the agent's settings while it ran, or a settings file the deck can't read or that moves that folder; a Codex home in one of those folders; a Codex moved to another folder; and your own editor. A recalled prompt needs clearing first. Look at the agent's pane, and send it a prompt to have it take its messages. On a busy machine its checks can fail to complete without your having used `Ctrl+G`, the Up arrow or an editor, and these words can then stay for a while: send it a prompt in the same way, or wait for the deck to check again.
- `✉N waiting: a paste into its input has not finished.` A paste into the agent's pane has started and not ended. Finish or cancel the paste.
- `✉N not yet taken: the agent may be waiting at a prompt. Check its pane.` The agent is waiting for an answer, such as a permission prompt or a dialog, or the deck found no input box it could type into. Look at the agent's pane and answer what it is asking, or send it a prompt yourself.
- `✉N not taken: the agent shows as busy but has sent nothing for a while. Ask it to run dot-agent-deck inbox fetch.` The agent's TUI card or desktop tile shows it thinking or working, but its messages have waited 15 minutes with nothing coming from the agent: no tool use, no status change. Its turn may have ended without the deck seeing it, so the deck still reads it as busy and doesn't ring. Look at the agent's pane. If it is sitting idle, ask it, in its pane, to run `dot-agent-deck inbox fetch` and continue. If it really is still working, for example on one long command, there is nothing to do: the words go as soon as the agent does something the deck sees, such as using a tool.
- `✉N waiting for the agent to fetch it. Send it a prompt.` The deck does not type the doorbell into this agent: you turned the doorbell off for it ([Turn the doorbell off for an agent](#turn-the-doorbell-off-for-an-agent)), the agent is one the deck never types into, the deck could not read the agent's version when it started, or something was typed into the input box of a Codex agent whose box the deck can't check, such as one started through a shell (`sh -c …`), one started through a launcher whose command doesn't name Codex, such as a `devbox run` script, when its role has no `agent = "codex"` line, or any Codex on macOS: then the doorbell stays off for that agent until it restarts, and every later message waits the same way. Type a prompt in the agent's own pane and it takes its waiting messages at that turn ([troubleshooting](troubleshooting.md#a-card-says-waiting-for-the-agent-to-fetch-it-send-it-a-prompt) says what each cause asks of you).
- `✉N waiting: the agent did not take the deck's Enter. Send it a prompt.` The deck typed its line and pressed Enter, the agent did not submit it, and the deck deleted its line again. It does not ring again until the agent ends a turn or the messages are taken. Send the agent a prompt.
- `✉N waiting: the deck's notice may be in its input. Check it before Enter.` The deck could not confirm what happened to the line it typed, so it may still be in the agent's input box, possibly beside your own text. Look at the input box: delete the deck's line, or send it if you want the agent to fetch its messages. The deck types nothing more into the agent until you submit or clear its input box, and even then only once it has checked that the box is empty, which it can do on Linux for Claude Code started directly in the pane and for Codex started directly or through a launcher; for any other agent, and on macOS, the doorbell stays off until the agent restarts. With no messages waiting, the card says `The deck's notice may be in its input. Check it before pressing Enter.`
- `✉N waiting: a dialog may have taken the deck's keys. Check its pane.` A dialog appeared while the deck was typing, so some of the deck's keys may have gone to the dialog instead of the input box. Look at the agent's pane and check what the dialog did. The deck types nothing more into the agent until you submit or clear its input box, and then, as above, only after a check that the box is empty. With no messages waiting, the card says `A dialog may have taken the deck's keys. Check the agent's pane.`

These words go away by themselves once the agent takes its messages or starts working, except the last two, which go once you submit or clear the agent's input box. If a message cannot be delivered, the recipient shows **Error** (desktop **error**) and a `not delivered: …` notice. When the agent's pane ended first, the notice says what ended, such as `not delivered: the command started in the agent's pane exited (code 1) before taking this message`, rather than that the agent exited. The TUI keeps that agent's card, with the notice, until you restart or close the agent. The desktop app takes the agent's tile off the dashboard once its pane ends, so there the notice is in the evidence rail; an orchestration role's row then says it exited and why ([A role card says "Exited"](#a-role-card-says-exited)). A pane ending doesn't prove that an agent started in the background ended, so check before you restart the agent or give its message to another ([troubleshooting](troubleshooting.md#a-message-says-not-delivered)). Delivered means the agent received the message; read its `work-done` report to judge the result.

While the deck holds a message for an agent for one of these reasons, the agent's card in the TUI, and its tile and its row on the agent dashboard in the desktop app, say `held` beside its status. The status itself doesn't change: it says what the agent is doing, which can still be Working, and `held` says the deck is waiting before it delivers. In the desktop app, hover over `held` to see the reason. Both clients also name the held agents at the top of the screen, whichever tab or agent you are on, for example `✉ held: release / orchestrator, my-agent`: an orchestration's start role first, the agent you talk to, then the others by name, each orchestration's agents after the orchestration's name, as their cards and tiles show them. The TUI shows it after the tabs in the tab bar, shortening the tabs' names to make room when the bar is full (or on the dashboard's title row when only the Dashboard tab is open), and the desktop app shows it in its top bar, on the deck and on the agent dashboard, where it names the held agents on every daemon the dashboard shows. Click a name to go to that agent: the TUI switches to the tab its card is on and selects it, and the desktop app opens its pane; in the desktop app, hovering over a name also shows its reason. With more than three held agents it shows how many instead, for example `✉ 4 held`, and so does the TUI when its row is too narrow for the names; in the desktop app, hover over the count to see who they are. It names exactly the agents whose card, tile or row says `held` on a daemon that is answering, stays while the reason does and goes with it, as the card's words do; switching tabs, selecting another agent or reconnecting doesn't clear it. When a daemon stops answering, the desktop app shows an open agent's last report greyed, `last seen` status and `held` marker included, and the top bar stops naming it until the daemon answers again.

For Claude Code, OpenCode and Pi agents the deck also knows when a message reached the agent. For Claude Code, the deck confirms a message once Claude Code's session transcript shows it took the prompt carrying the message, so a prompt that another of your `UserPromptSubmit` hooks blocks does not count, and the message is sent again. Both clients show the agent idle again, since Claude Code ran no turn. Claude Code puts the blocked prompt back in its input box, and the deck does not type over it, so the card says the message is not yet taken: press Enter in the agent's pane to send that prompt again, and the message is handed over. For a Claude Code that keeps no session transcript, the deck confirms the message about 20 seconds after handing it over. OpenCode and Pi report it themselves. For Codex, the deck confirms a message once Codex's session log shows Codex took it. If you interrupt Codex (Esc) while the deck's hook is handing a message over, Codex drops it, so it does not count and the message is sent again. If another of your Codex `UserPromptSubmit` hooks blocks the prompt carrying a message, Codex still keeps the message, and the agent sees it on its next turn: send the agent a prompt, or wait for its next one, and it works on the message then. If the deck cannot tell, it sends the message again, at most twice, with a line asking the agent to continue rather than restart work it already began. If it still cannot tell, both clients show `✉ delivery uncertain` (or `✉ N deliveries uncertain`) and explain it under the card's directory. The deck also shows a message as uncertain, without sending it again, when for a few minutes it cannot check whether the agent started on it, or when the agent's deck integration stopped and nothing has taken its place.

For a Pi agent there is one more case. When the deck has handed Pi a message and Pi has then been idle for a few minutes without the deck seeing it start on that message, both clients show `✉ may not have reached the agent` (or `✉ N may not have reached the agent`), with this explanation: `the agent has been idle for a few minutes and the deck has not seen it start on this deck message, so the message may not have reached it. Retry sends it again, so the agent may get it twice. Cancel stops further delivery but cannot take back a copy the agent already has.` It usually means Pi took the message but could not start a turn on it, for example because it cannot reach its model provider; a long start-up before Pi's first reply can also show it, which is why it says "may". Showing this notice sends nothing again: only Retry does. It is not an error, and it goes away by itself when Pi starts working. Open the pane first: fix whatever stopped Pi, then choose:

- **Retry** sends the message again, marked as a possible repeat. If Pi did have the first copy, it may now see the message twice; the repeat asks it to continue rather than restart work it already began.
- **Cancel** stops the deck delivering the message. A copy Pi already has stays with it; when Pi may already have the message, a delegated task's orchestrator is told the task may already have reached the worker.

Choose what happens next, for any of these messages:

- In the TUI, select the card and press `i` to open **Deck messages**. Each row names who sent the message and its subject. The selected row shows its whole explanation, which says what Retry would do; the other rows show the start of theirs. Press `r` to **Retry** (send it again, marked as a possible repeat) or `c` to **Cancel** (stop delivering it); `j`/`k` move between rows and Escape closes the list. When the window is too small to show the selected row's whole explanation, `r` sends nothing and says `make the window taller to see what Retry does` or `make the window wider to see what Retry does`; make the terminal window larger, or its font smaller, then press `r` again.
- In the desktop app, the tile lists the same rows, each with its whole explanation and **Retry** and **Cancel** buttons. The list scrolls, so the desktop app does not ask for a bigger window. With voice control on, you can also say "retry the message to the coder" or "cancel the message to the coder" on the Daemons screen, and press the confirmation's button; see [Voice Control](desktop/voice.md#retrying-or-cancelling-a-deck-message).

If two people choose at the same time, the second is told another client acted first; the card shows where the message stands now. A message whose state changed while you were deciding, for example because Pi started on it, answers Retry with `another client already acted on this message; the card shows where it stands now` or `this message no longer needs a decision`, and nothing is sent. A message the deck sent as many times as it allows offers only Cancel; post it again if it is still needed. A message the agent has held for an hour without starting on it shows a one-time reminder, `the agent has had a deck message for an hour without confirming it`, with the same two choices; it is not an error, and the agent may still be working on it. An orchestrator whose task is uncertain is told so and asked to check the worker's pane before delegating the task again; a correction may follow if the task reached the worker after all. When you cancel a task the deck had already handed over, its orchestrator is told it may already have reached the worker, so it checks the worker's pane before delegating the task again; a task cancelled before it was handed over is reported as not delivered.

If the deck refuses an agent's own requests for its messages while messages wait for it, both clients say `Messages can't reach this agent`, followed by the cause and `Restart it from the deck; messages addressed to it are not handed to the restarted agent, so have them sent again.` In the TUI the notice heads the card's notice row; when the card is too narrow to show all of it, select the card and press `i` to open **Deck messages**, which shows the whole notice, or says to make the window taller when it is too short for all of it and has room for that line. With nothing else to decide it offers only **Close**; beside a delivery waiting on you, that delivery keeps its **Retry** and **Cancel**. The desktop tile shows the whole notice under its directory. The notice clears once one of the agent's requests is accepted, or when the agent exits. Each orchestrator with a delegated task waiting for that agent while the refusal lasts gets one `worker cannot take its messages` message naming its tasks, including one that delegates after the refusal started. [Troubleshooting → An inbox request is refused](troubleshooting.md#an-inbox-request-is-refused) lists the causes.

Restarting an agent, or its exiting, ends delivery to it: messages already waiting for it, uncertain ones included, are not handed to the agent that replaces it. They show as not delivered, an orchestrator is told about each task among them, and a job offered to it goes back to its pool. Post the others again if they are still needed.

Long turns affect delivery the same way in the TUI and the desktop app:

- When OpenCode or Pi keeps a message queued behind a busy turn, the message waits for that turn to end. The deck does not report it as not delivered during this wait, and the agent does not receive another copy. An OpenCode or Pi agent that was already running before you upgraded the deck can still receive a second copy, marked as a possible repeat, after a long pause; restart the agent to avoid that. Claude Code, with hooks from the same release as the deck, waits the same way: a message it has taken waits for the turn to end, and the deck neither sends it again nor reports it not delivered while the turn runs. A message that arrives while Claude Code is in the middle of a turn, such as one you started by typing a prompt, is held by the deck until that turn ends, so Claude Code takes it up as a task of its own rather than in the middle of other work; if the turn is still running after about a minute, the deck hands it over anyway. If Claude Code is idle for about a minute without submitting it, the deck sends it again, marked as a possible repeat.
- In a Pi pane, pressing Escape while a deck message waits in Pi's queue, or moving Pi's queued messages back to its input box, can put that message's text in Pi's input box. The deck then sends the message again by itself, marked as a possible repeat. If you also submit the restored text, the agent gets the task twice, so clear it from the input box unless you want that.
- If the deck reported a task as not delivered, check the agent's pane before posting it again: the agent may take it after all. When it does, the orchestrator may be told that the task arrived, and the agent's TUI card or desktop tile may leave its delivery error state once no other delivery error remains. Go by the pane, not by whether that notice arrives.
- If the orchestrator was told a task has not reached its worker, it is asked to check the worker's pane before delegating the task again. If the worker then picks it up, the orchestrator may be told the task arrived after all.
- OpenCode, Pi and Claude Code with hooks from the deck's release keep a message queued this way for as long as the busy turn lasts, with no time limit. After an hour without the agent starting on it, the card shows the one-time reminder described above. An offered job waits the same way; see [Announcements and pooled jobs](#announcements-and-pooled-jobs).

The desktop app's handoff rail shows `delegated · queued`, `delivered · working`, `work-done` or `not delivered` for worker handoffs. The rail is a desktop surface; TUI users follow the cards and the orchestrator's pane.

In the recipient's pane, deck messages show a `Sent by:` line. Reports from other agents are marked UNTRUSTED: read them as information. After refreshing Claude Code's hooks, native messages show `✉ dot-agent-deck message` in its pane. Codex's turn-end hand-over can appear as **Blocked by hook** with an explanation of the deck message; this is how the next task reaches Codex.

A long message can arrive as an excerpt naming a file with its full content, usually in the project's `.dot-agent-deck/` directory. Read that file to get the rest of the task or report. If the deck cannot save the full content, it refuses the message and reports the problem to the sender.

The deck removes these files itself, on the same schedule whether you watch the agents in the TUI or the desktop app:

- While the message waits to be received, its file stays.
- A delegated task's file stays until the worker reports `work-done`, a newer task replaces it, or the worker exits.
- After that, and for any other message once it has been received or dropped, the file is kept for about a day.
- When many long messages pile up, the deck removes the oldest of these files sooner, but not within an hour of the message being received or the task ending.
- Restarting the deck keeps counting from when the message was received. A file the deck was still keeping for a waiting message or an unfinished task when it stopped is kept for about a day from the restart.

Copy anything you want to keep out of these files into your own project files.

### Which agents wake for messages

The delivery behavior is the same whether you watch the pane in the TUI or the desktop app. Run `dot-agent-deck hooks install` after upgrading the deck or an agent, then restart the agent to load the refreshed integration.

| Agent | What happens when a message arrives | Fallback or limitation |
|---|---|---|
| Claude Code | Native wake is enabled from version 2.1.296 after installing the integration. From version 2.1.328 it also wakes Claude Code after a turn that ended on an API error, such as an overloaded API, so the next message still starts a new turn. After a usage or credit limit (a **Blocked** card), its messages wait until it works again. | Its hooks must come from the same `dot-agent-deck` release as the deck: when they are older, the card says `this agent's deck hooks run a dot-agent-deck too old for its messages` and names the command to run, and the agent's messages wait until you run it and restart Claude Code ([A card says the deck integration is out of date, too old, or not connected](troubleshooting.md#a-card-says-the-deck-integration-is-out-of-date-too-old-or-not-connected)). If Claude Code shows an error from the deck's hook instead, see [Claude Code shows an error from the deck's hook](troubleshooting.md#claude-code-shows-an-error-from-the-decks-hook). A job not claimed within the deck's wait can go to the next worker while the Claude worker is still busy. When Claude Code's own wake-up isn't working, or on a version below 2.1.296, the deck types the doorbell line into it, whatever its version. If a Claude Code update makes the doorbell misbehave, turn it off for Claude Code ([Turn the doorbell off for an agent](#turn-the-doorbell-off-for-an-agent)): the agent's messages then wait, and its card says `waiting for the agent to fetch it. Send it a prompt.`; type a prompt in that agent's pane and it takes them at that turn ([troubleshooting](troubleshooting.md#a-card-says-waiting-for-the-agent-to-fetch-it-send-it-a-prompt)). For delivery without a prompt, run Claude Code 2.1.296 or later with the integration installed, so its own wake-up delivers. |
| Codex | Hooks hand messages over at turn end when it is busy. When Codex is idle and its input box is empty, the deck types the doorbell line into it, at the earliest about seven seconds after its empty input box first appears, and Codex fetches its messages, so a delegated Codex worker takes its task without a prompt. | Once anything has been typed into a Codex pane (your text, an arrow key, Escape or the answer to one of its start-up dialogs), the deck checks Codex's input box before it rings, on Linux, for a Codex it started in the pane directly or through a launcher: it waits while the box shows anything, and rings once you have cleared it and a check finds it empty ([How the deck checks Codex's input box](#how-the-deck-checks-codexs-input-box)). Where it can't check the box, for example a Codex started through `sh -c` or any Codex on macOS, it types no doorbell into that Codex until it restarts: its messages wait, and the TUI card and the desktop tile say `waiting for the agent to fetch it. Send it a prompt.`; send it a prompt, and its hooks hand the messages over at that turn. If a Codex update makes the doorbell or the check misbehave, turn it off for Codex ([Turn the doorbell off for an agent](#turn-the-doorbell-off-for-an-agent)): an idle Codex's messages then wait the same way. When the deck can't tell from Codex's screen that its input box is empty, it types nothing. That can happen, for example, to a Codex that has had no prompt yet, in a pane under 32 rows tall whose height changed after Codex started. Its messages wait, and after a couple of minutes the TUI card and the desktop tile say `not yet taken: the agent may be waiting at a prompt. Check its pane.`; send it a prompt. With untrusted hooks, the model runs `inbox fetch` itself when you ask it to, and needs `network_access = true`. Codex's hooks and `inbox fetch` must come from the same release as the deck daemon; if one of them shows an error, see [Codex's deck hook or `inbox fetch` shows an error](troubleshooting.md#codexs-deck-hook-or-inbox-fetch-shows-an-error). |
| OpenCode | The full TUI receives messages through its TUI plugin. OpenCode 1.x's `--mini` receives messages natively and gets a redraw so they become visible; a partial frame can remain briefly. OpenCode 2's `opencode mini` receives them natively too, and keeps what you were typing, unless another OpenCode session starts in the same directory while that mini is starting ([Deck messages in `opencode mini`](installation.md#opencode-1x-and-2x)). | OpenCode 2 needs its own server in each pane: the deck adds `--standalone` to a command that runs `opencode` directly, and a wrapper has to add it itself ([OpenCode 1.x and 2.x](installation.md#opencode-1x-and-2x)). The deck does not type the doorbell into OpenCode. On OpenCode 1.x, if the deck cannot update `tui.json`, the plugin does not load, the agent's messages wait and its card says `waiting for the agent to fetch it. Send it a prompt.`; add the plugin entry by hand as described below, then restart OpenCode from the deck. On OpenCode 1.x, a `/models` choice before the first prompt is not readable by the integration; launch with `--model` to choose that first message's model. `attach`, `acp`, `web`, `pr` and `github` have not been measured for this delivery path; expect messages to wait there. Completing a task with `work-done --task-id` has not yet been checked with a real OpenCode worker ([How delegation works](#how-delegation-works)). |
| Pi | Native delivery works while idle and queues follow-ups while busy. | The deck does not type the doorbell into Pi: while its extension is not connected, its messages wait and its card says `waiting for the agent to fetch it. Send it a prompt.` The extension stops trying to connect when Pi runs outside a deck pane. Restart Pi inside the deck to receive deck messages. A Pi that loaded an older copy of the deck's extension shows `this agent's deck integration is out of date; restart the agent to update it`, and its deck messages wait until you restart it: when the deck starts an agent it identifies as Pi, it first updates the extension in the directory that agent loads it from. See [A card says the deck integration is out of date, too old, or not connected](troubleshooting.md#a-card-says-the-deck-integration-is-out-of-date-too-old-or-not-connected). |
| Devin | Devin takes its messages by running `dot-agent-deck inbox fetch`, which confirms each message it prints to the deck. | No native inbox wake integration is provided, and the deck does not type the doorbell into Devin: its messages wait, and its card says `waiting for the agent to fetch it. Send it a prompt.` Ask Devin in its pane to run `dot-agent-deck inbox fetch`. Message delivery to Devin through `dot-agent-deck inbox fetch` has been checked against a real Devin session; completing a task with `work-done --task-id` has not yet. |
| Antigravity | Hooks hand messages over at turn end when it is busy. When `agy` is idle and its input box is empty, the deck types the doorbell line into it, and `agy`'s hook hands it the messages with that line, so a delegated Antigravity worker takes its task without a prompt, before its first prompt too. The deck waits until `agy` has drawn its input box before it rings. | The deck types the doorbell only into an `agy` it knows the pane runs: the pane's command starts with `agy`, or the role declares `agent = "agy"` ([Declaring the agent behind a launcher command](#declaring-the-agent-behind-a-launcher-command)). It types nothing while the input box holds text, or while a dialog or permission prompt is up. Once you have typed into its pane, the messages wait until you send `agy` a prompt: that turn hands them over, and the doorbell rings there again once `agy` has taken a prompt you sent with Enter and nothing was typed after it. Answering a permission prompt or dialog, the folder-trust question `agy` asks in a new worktree included, doesn't count as typing when you answer it with one key, its number, Enter or Esc, after moving with the arrow keys if you like, in the pane or from the card, press nothing after that key, and nothing was typed into the box before the prompt appeared. Typing a letter or pasting while it is up does count, and so does any key you press after the one that answered it, an arrow included: send `agy` a prompt after that. A turn that ends in an error hands nothing over: the messages wait for the next turn end or the doorbell. If an `agy` update makes the doorbell misbehave, turn it off for Antigravity ([Turn the doorbell off for an agent](#turn-the-doorbell-off-for-an-agent)): its messages then wait, its card says `waiting for the agent to fetch it. Send it a prompt.`, and a prompt you send it hands them over at that turn. |

When OpenCode 1.x's installation reports that it left `tui.json` unchanged, use the exact path it prints in that file's `plugin` list, for example:

```json
"plugin": ["/home/you/.config/opencode/dot-agent-deck-tui.js"]
```

Preserve your other plugin entries, then restart OpenCode. The installer prints the path for the configuration directory it found; yours may differ.

#### A lost task is re-sent into the same worker

The deck knows where each message stands for every agent, so it sends one again only as described in [Delivery in the TUI and desktop app](#delivery-in-the-tui-and-desktop-app), marked as a possible repeat. A message that an older `dot-agent-deck`'s hooks or `inbox fetch` took and never acknowledged becomes available again after the deck's wait instead; its id stays the same so an agent can recognise a repeat. The deck stops retrying after the delivery limit and shows `not delivered`; a delegated task that remains unacknowledged also produces a notice for its orchestrator. Restarting an agent does not move an already bound message to the replacement: delegate the task again when needed.

In both clients, replacing an earlier task with a new delegation or restarting the worker stops delivery notices for the superseded task. A worker's report names its task, so it completes that task and no other: a late report of a task that was replaced is refused, and a newer task stays queued and watched until it is reported or delivered. A worker that takes its task directly from its file reports it the same way, by the id its task file names.

### A deck prompt waits while you have an unsent draft

Native inbox delivery does not type a task into your input box. When native wake is unavailable, the deck types a one-line doorbell into Claude Code, Codex or Antigravity, only when the agent is idle, its input box is on screen and empty, and nothing has been typed into it since the deck last knew it was empty:

```text
(bmrtzx) dot-agent-deck: message m-… waiting, run: /home/you/.local/bin/dot-agent-deck inbox fetch
```

The command names the `dot-agent-deck` the deck daemon runs from, by its full path, so the agent runs that copy even when another, perhaps older, `dot-agent-deck` comes first on the agent's own `PATH`. The commands the deck gives agents elsewhere name it the same way: the `work-done` and `delegate` commands in tasks and in an orchestrator's instructions, and the reply command in a message from an agent outside the team. To have agents use a different copy, start the deck from that copy, restarting its daemon ([Recycling the daemon](troubleshooting.md#recycling-the-daemon)). `DOT_AGENT_DECK_BIN` changes the binary agents' hooks, the OpenCode plugin and the Pi extension run, not the commands the deck writes for the agent ([Environment variables](configuration.md#paths-and-endpoints)).

The six letters in brackets are drawn afresh each time the deck types the line. They let the deck tell its own line from anything else on the screen, so it can check that the line reached the input box intact and that the agent took it. The deck does not type the doorbell into other agents ([Which agents wake for messages](#which-agents-wake-for-messages)).

After an agent starts, or a worker restarts for a new task, the doorbell also waits until the agent shows it is ready for input: Claude Code once its input box is on screen after it starts, or once it ends a turn; Codex about seven seconds after its empty input box first appears; Antigravity once `agy` reports that its input box is up. If the deck does not recognise Claude Code's input box, it types nothing. Claude Code's own wake-up still delivers the message when it is working; when it is not, the message waits until you type the agent's first prompt yourself or press Enter in its empty input box ([troubleshooting](troubleshooting.md#an-agent-shows-the-doorbell-instead-of-waking)).

The deck types the line, checks that the input box shows exactly that line, presses Enter, and then checks that the agent took it. If the deck sees the message taken some other way, or the agent stop being idle, before it presses Enter, it presses nothing. It checks the screen once more just before the Enter; a dialog that opens after that last look can still receive the Enter. If that happens, or the agent does not take the Enter, the deck deletes the line it typed only where it can confirm the input box is empty afterwards; with Claude Code it can't, so it leaves the line in the input box. When it has left its line there, or can't tell what happened to it, it types nothing more into that agent until you submit or clear its input box and a check of the box finds it empty (for an agent whose box it can't check, until the agent restarts), and the card tells you to check the input box: delete the line, or press Enter to send it, which asks the agent to fetch its messages. When the deck deleted a line whose Enter the agent did not take, the card says `the agent did not take the deck's Enter` instead. Keys you type in the pane while the deck is typing its line are held until the deck has finished, then sent exactly as you typed them.

The message stays queued while the input box shows anything other than the empty box, a menu or dialog covers it, or the agent needs a permission or dialog answer. It also stays queued once anything has been typed into the input box since the deck last knew it was empty: your text, spaces or empty lines (Claude Code draws nothing for some of them), arrow keys, Escape to interrupt a turn, or keys a menu took. The deck can't tell from the screen whether such a box is empty again, so it checks the box first, and rings once a check finds it empty: clear the box any way you like. It can do that on Linux for Claude Code started directly in the pane ([how the check works, and what it changes](#how-the-deck-checks-claude-codes-input-box)) and for Codex started in the pane directly or through a launcher ([how it checks Codex](#how-the-deck-checks-codexs-input-box)). For any other agent, and on macOS, where the deck has no input-box check yet, it can't check the box, so from the first key typed into its pane the doorbell stays off for that agent until it restarts, and every later message waits the same way: the TUI card and the desktop tile say why, for example `waiting: ask the agent to run dot-agent-deck inbox fetch; …` for Claude Code started through a launcher or running on macOS, and `waiting for the agent to fetch it. Send it a prompt.` for a Codex started through `sh -c` or running on macOS. Ask the agent to run that command in its pane, or send it a prompt, and it takes its messages at that turn. The deck's own line, once the agent took it, doesn't count as typing, so the doorbell keeps working for an agent nobody types into. In either client, no timeout forces the doorbell over what was typed. The installed integration can replace this line with the message; otherwise the agent runs the fetch command.

#### How the deck checks Claude Code's input box

The deck checks the input box of Claude Code running on Linux, whatever its release version, a pre-release build included, when the deck started Claude Code directly in the pane: the pane's command starts with `claude` (or a path to it) and has no shell syntax such as `;`, `&&`, `|` or a redirection. Claude Code you start by typing `claude` into a shell pane isn't checked. The deck also needs a directory only you can change to keep the small helper it checks with; where it finds none, it checks no Claude Code's box ([Claude Code's input box is never checked](troubleshooting.md#claude-codes-input-box-is-never-checked)). The TUI and the desktop app show the same thing, since the check happens in the agent's pane, and the TUI card and the desktop tile use the same words.

- **What you see.** While the deck checks, Claude Code's input box disappears for a moment and comes back with what it held. Your text isn't changed. What you type during a check is kept and reaches Claude Code in the order you typed it, except as the next items say ([A card says `input held: …`](troubleshooting.md#a-card-says-input-held-)).
- **Keys that wait for the check to end.** These keys, the same keys with `Alt`, and anything you type after one of them wait until Claude Code is back from the check: `Enter`, `Backspace` (not the forward `Delete` key), `Ctrl+C`, `Ctrl+D`, `Ctrl+U`, `Ctrl+W`, `Ctrl+Z`, `Ctrl+\`, `Ctrl+R`, `Ctrl+V`, `Ctrl+O`, `Ctrl+S` and `Ctrl+Q`. Deleting to the start of the line or the previous word ([Editing an agent's prompt](keyboard-shortcuts.md#editing-an-agents-prompt)) sends one of these keys, so it waits too. Part or all of a paste that contains a line break, or of a very long paste, can wait the same way. The wait is a moment on a quiet machine and can be longer on a busy one; if Claude Code doesn't come back from the check, they wait until you restart the agent ([what to do](troubleshooting.md#a-claude-code-agent-can-hold-your-typing-until-it-restarts)). If the agent exits or restarts while the deck holds your keys, those keys are dropped, not typed: type them again.
- **`Ctrl+C` during a check.** A single `Ctrl+C` pressed during a check does what it always does once the check ends, unless the check opens your editor (next item): it clears a non-empty input box, and on an empty one Claude Code asks you to press it again. Two `Ctrl+C` presses during one check reach Claude Code back to back, as two quick presses would; on an empty input box that exits Claude Code. A `Ctrl+C` pressed just as an editor closes, your own (opened with `Ctrl+G` during a check) or one a check opened (next item), can still end Claude Code's session.
- **When a check opens your editor.** Rarely, for example on a very busy machine, a check opens your own editor, as `Ctrl+G` would; close it as usual. The deck then checks that agent's input box no more until it restarts, as after your own editor. In an editor that runs in the pane, such as vim, the keys you type go to that editor, and so do the keys you had typed for Claude Code during the check before it opened, which vim can take as commands: check the text before you leave the editor. With an editor that opens its own window, most of what you type in the pane waits for Claude Code; more than about 4 KB typed there without `Enter` waits until you close the editor and can lose its end then, so type long text once the editor has closed. Either way, a `Ctrl+C`, `Ctrl+Z` or `Ctrl+\` typed during that check or while the editor it opened is open isn't sent, and neither is what you had typed after it by then: the TUI's status line and the desktop tile say `Input not delivered: your Ctrl+C, Ctrl+Z or Ctrl+\ and what you typed after it, while the deck's check had your editor open; type it again once the editor has closed`, and the TUI stays in the pane.
- **Your editor.** For such a Claude Code, the deck sets `VISUAL` and `EDITOR` to a small helper of its own, which is how it checks the box; `Ctrl+G` still opens your own editor through it. Claude Code's Bash tool, its background commands and its subagents still see your own `VISUAL` and `EDITOR`, unset where you had them unset: the deck hands them over through Claude Code's `CLAUDE_ENV_FILE`, after which your own `CLAUDE_ENV_FILE`, if you set one, still runs. A program that reads `VISUAL` or `EDITOR` another way gets the helper, which runs your editor.
- **`VISUAL` or `EDITOR` set again for Claude Code.** The deck checks the box only when the editor Claude Code would open on `Ctrl+G`, as Claude Code's starting environment and its settings files select it, is the deck's helper. A Claude Code whose pane command has arguments, such as `claude --model haiku`, starts through your shell, and zsh reads `~/.zshenv` and fish reads `config.fish` even then: if that file sets `VISUAL`, or unsets `VISUAL` and sets `EDITOR`, Claude Code gets that editor, and if it changes or removes `DOT_AGENT_DECK_EDITOR_GEN`, which the deck sets for its helper, the deck doesn't check that agent's box either. The deck's other variables there don't stop the check: the socket variables [Remote requirements](remote-requirements.md#daemon-socket-security) has you set in your shell profile on a shared host are fine. Claude Code also sets the variables in the `env` of its settings files as it starts (`~/.claude/settings.json`, `~/.claude.json`, the project's `.claude/settings.json` and `.claude/settings.local.json`, the managed settings in `/etc/claude-code`, and settings your organisation's server sends it, which Claude Code keeps in `~/.claude/remote-settings.json`, or in `~/.claude/state/hybrid-settings.json` when you signed in through your organisation); the deck reads those files, and treats the box the same way when one of them names `VISUAL` or `EDITOR` in its `env`, sets `HOME`, `CLAUDE_CONFIG_DIR` or `CLAUDE_CODE_REMOTE_SETTINGS_PATH` there (which can move where Claude Code reads its key bindings or its organisation's settings), sets a variable whose name starts with `DOT_AGENT_DECK_` there, names a policy helper (`policyHelper` or `policyHelpers`, a program your administrator has Claude Code run as it starts, which can set these variables where no file shows them), or can't be read, when `CLAUDE_CODE_REMOTE_SETTINGS_PATH` is set in Claude Code's environment, or when Claude Code was started with `--settings` or `--project-config-root`. The settings of a folder you add with `--add-dir` don't set Claude Code's variables, so they don't stop the check. In each case, once anything is typed into that agent's box, the deck doesn't check it and types nothing more into it, and its card says `the deck can't check this agent's input box. Check its pane.` until the agent restarts; a change to the `env` of one of those files while the agent runs does the same when it is still there at the deck's next check. To have the box checked, set `VISUAL` and `EDITOR` where only an interactive shell reads them (zsh's `~/.zshrc`, or inside `if status is-interactive` in fish's `config.fish`) and not in Claude Code's settings files, or start the pane with a bare `claude`. Where your organisation's managed settings name a policy helper, the deck doesn't check the box of a Claude Code that reads them; a prompt hands such an agent its messages, or you can turn the doorbell off for Claude Code ([Turn the doorbell off for an agent](#turn-the-doorbell-off-for-an-agent)) so that its messages simply wait for its next turn. Don't set `DOT_AGENT_DECK_` variables in those settings files, or `DOT_AGENT_DECK_EDITOR_GEN` in your shell's start-up file: the deck sets that one for each agent itself.
- **After you use your own editor.** Once you open your editor with `Ctrl+G` in a Claude Code pane, the deck checks that agent's input box no more until the agent restarts. Messages for it then wait, with the TUI card and the desktop tile saying `the deck can't check this agent's input box. Check its pane.`, and reach the agent at your next prompt to it, without the doorbell.
- **A prompt recalled with Up.** A prompt you bring back into the box from history with the Up arrow can't be checked: nothing is typed, and the TUI card and the desktop tile say `the deck can't check this agent's input box. Check its pane.` Clear the box, and the next check goes ahead.
- **Claude Code's key bindings.** The check relies on `Ctrl+G` opening Claude Code's editor. If `~/.claude/keybindings.json` binds `Ctrl+G`, or Claude Code's editor action, when the agent starts, or if `CLAUDE_CONFIG_DIR` is set for it, in its environment or in the `env` of its settings files, the deck doesn't check its box. If you create, change or delete that file while the agent runs, a check the deck sends shortly afterwards can reach Claude Code under your new bindings, and if they give `Ctrl+G` another action, Claude Code runs that action once. This can happen for a few seconds after you save the file, longer on a busy machine. The deck then notices the change and checks that agent's box no more until it restarts, but it can't undo that action. Restart Claude Code from the deck after you change its key bindings.
- **Themes.** The deck reads the box in Claude Code's `dark`, `light`, `dark-ansi`, `light-ansi` and `dark-daltonized` themes. With any other theme it either doesn't recognise the box, and then checks and types nothing, or reads the box in a theme it hasn't been tested against.
- **After a Claude Code update.** The deck checks every Claude Code version the same way. If a new version breaks the check, for example its input box stops coming back after a check or your editor opens when you didn't press `Ctrl+G`, turn the doorbell off for Claude Code ([Turn the doorbell off for an agent](#turn-the-doorbell-off-for-an-agent)); the check goes with it, and Claude Code you start afterwards gets no helper.
- **A launcher.** Claude Code started through a launcher script or another program gets no helper and keeps your environment as you set it; the deck can't check its box.
- **Your temporary directory.** To check the box, the deck reads the file Claude Code writes in `claude-<your user id>` under your temporary directory (`TMPDIR`, or `/tmp` when it is unset), and only when no other user could have changed it on the way: every directory on that path must belong to you or to root, must not be writable by its group or by others (a shared directory with the sticky bit set, such as `/tmp`, is fine), and must be on a local ext4, XFS, Btrfs or tmpfs filesystem. With `TMPDIR` unset this normally holds. If `TMPDIR` points to a directory that fails it, for example one created group-writable under a `umask 0002`, every check reads the box as not empty: messages wait and the card says `there may be an unsent draft. Send it or clear it.` even when the box is empty ([what to do](troubleshooting.md#claude-codes-empty-input-box-reads-as-a-draft)).

#### How the deck checks Codex's input box

The deck checks the input box of Codex running on Linux, whatever its release version, a pre-release build such as `0.172.0-alpha.2` included, when the deck started Codex in the pane: directly (the pane's command starts with `codex` or a path to it, with no shell syntax), or through a launcher when the deck knows the pane runs Codex, such as `npx codex`, `env FOO=1 codex` or `devbox run -- codex`. A launcher whose command doesn't say it runs Codex, such as a `devbox run` script of your own, is checked when its role declares `agent = "codex"` ([Declaring the agent behind a launcher command](#declaring-the-agent-behind-a-launcher-command)), and isn't without it. That includes a Codex installed with npm whose launcher puts a `node` of its own first on `PATH`, as `devbox run` does in a project whose Devbox environment includes Node.js. With Node.js 23.11 or later, a Codex installed with `npm install -g @openai/codex` is checked; one installed with pnpm or bun, or into a project's own `node_modules`, usually isn't: once anything is typed into its box, its card says `the deck can't check this agent's input box. Check its pane.` until Codex restarts, and a prompt hands it its messages meanwhile. Reinstall it with `npm install -g @openai/codex` to have its box checked. Codex you start by typing `codex` into a shell pane, or through `sh -c`, isn't checked. The TUI and the desktop app show the same thing, and the TUI card and the desktop tile use the same words.

- **When it checks.** Only while Codex shows its empty input box, with its grey placeholder text. A Codex that hasn't had its first prompt yet may not be checked: if something is typed into its box before then, its card can say `the deck can't check this agent's input box. Check its pane.` until you send it a prompt. While the box shows anything, the deck doesn't check it and types nothing: the card says `there may be an unsent draft. Send it or clear it.` Clear the box any way you like; once Codex shows its placeholder again, the deck checks the box, and the doorbell rings once the check finds it empty.
- **What you see.** While the deck checks, Codex's input box can change for a moment and comes back as it was. Your text isn't changed. What you type during a check is kept and reaches Codex in the order you typed it, except as the [`input held` lines](troubleshooting.md#a-card-says-input-held-) say.
- **Your editor.** For such a Codex, the deck sets `VISUAL` and `EDITOR` to a small helper of its own, which is how it checks the box; `Ctrl+G` still opens your own editor through it. In a Codex started directly in the pane, the commands Codex runs see your own `VISUAL` and `EDITOR` where you set them; where you left them unset, they see the helper, and a command that opens an editor through them, such as `git commit` without `-m`, fails rather than opening one. In a Codex started through a launcher they see the helper either way, which runs your own editor, or fails when you set none.
- **`VISUAL` or `EDITOR` set again for Codex.** The deck checks the box only when the editor Codex would open on `Ctrl+G`, as Codex's starting environment and its `.env` file select it, is the deck's helper. Something between the deck and Codex that sets `VISUAL`, or unsets `VISUAL` and sets `EDITOR`, gives Codex that editor: your shell's start-up file, because the deck starts Codex through your shell and zsh reads `~/.zshenv` and fish reads `config.fish` even then, or a launcher such as `VISUAL=nvim codex`. The deck doesn't check that Codex's box either when the start-up file or launcher changes or removes `DOT_AGENT_DECK_EDITOR_GEN`, which the deck sets for its helper; the deck's other variables there don't stop the check, so the socket variables [Remote requirements](remote-requirements.md#daemon-socket-security) has you set in your shell profile on a shared host are fine. Codex also loads the `.env` file in its home (`~/.codex/.env`, or the one in `CODEX_HOME`) as it starts, and its variables replace the ones Codex started with; the deck reads that file, and treats the box the same way when it mentions `VISUAL`, `EDITOR` or a `DOT_AGENT_DECK_` variable at all, sets `HOME`, `CODEX_HOME` or `TMPDIR` (which can move the folders Codex reads its key bindings from and hands its editor a file in), or can't be read. In each case, once anything is typed into that Codex's box, the deck doesn't check it and types nothing more into it, and its card says `the deck can't check this agent's input box. Check its pane.` until Codex restarts; a change to that `.env` file while Codex runs does the same. To have the box checked, set `VISUAL` and `EDITOR` where only an interactive shell reads them (zsh's `~/.zshrc`, or inside `if status is-interactive` in fish's `config.fish`), and not in the launcher or in Codex's `.env`, leave `DOT_AGENT_DECK_` variables out of the `.env`, and `DOT_AGENT_DECK_EDITOR_GEN` out of the start-up file and the launcher; `Ctrl+G` still opens your own editor through the deck's helper. Meanwhile, send the agent a prompt to have it take its messages.
- **Your key settings.** The deck reads Codex's settings files (its `config.toml`, a profile, the project's `.codex/config.toml`) and its `-c` options when it starts Codex. If you change one of those files while Codex runs, the deck stops checking that Codex's box until it restarts, and its card says `the deck can't check this agent's input box. Check its pane.` A project whose `.codex/config.toml` sets key bindings isn't checked at all. Codex writes a few lines of its own into `config.toml` on its first starts in a new Codex home; the deck expects that, and you have nothing to configure.
- **`/cd`, `/worktree` and `/resume`.** Codex shows the folder it works in on the status line under its input box, for example `gpt-5.5 medium · ~/code/project`. Before each check the deck reads that line. Once it names another folder than the one the pane started Codex in, for example after you move Codex into another project with `/cd` or `/worktree`, the deck stops checking that Codex's box until it restarts, even if you move Codex back: once anything is typed into its box, the TUI card and the desktop tile say `the deck can't check this agent's input box. Check its pane.` and the deck types nothing more into it. The same applies to `/resume` when Codex shows the resumed conversation's folder on that line. Send the agent a prompt to have it take its messages, or close its pane and start Codex again in the new folder. The deck also doesn't check the box, and the card and the tile say the same, while it can't read the folder on that line: when Codex's status line is set up without the current folder (`tui.status_line` in Codex's settings), when the pane is too narrow for the whole line and Codex cuts the folder short with `…` (widen the pane), when the folder's name holds a character two columns wide, or when a folder beside the one Codex started in is named like it followed by ` · ` and the status line shows something after the folder, such as the conversation's name.
- **Codex's home inside a folder Codex may write to.** The deck reads the file Codex hands an editor in `editor` in Codex's home (`~/.codex`, or `CODEX_HOME`). When that home is inside a folder Codex's sandbox may write to, Codex keeps the file elsewhere, and the deck can't check the box. The deck sees that before it checks anything when Codex's home is inside the folder the pane starts Codex in, inside a folder you add with `sandbox_workspace_write.writable_roots` (in `config.toml`, a profile, the project's `.codex/config.toml` or a `-c` option) or with `--add-dir`, or under `/tmp` or your `TMPDIR`; a folder's own `.codex` doesn't count, since Codex doesn't write there. Once anything is typed into that Codex's box, the deck doesn't check it and types nothing more into it, and its card in the TUI and its tile in the desktop app say `the deck can't check this agent's input box. Check its pane.` until Codex restarts. It does so also when Codex runs with `--sandbox read-only` or `danger-full-access` (or, for `/tmp`, with `exclude_slash_tmp`), where Codex would use that home after all. A folder that a Codex permissions profile (`default_permissions`) lets Codex write, the deck doesn't see in advance: there, Codex shows `Failed to open editor: editor exited with status exit status: 1` each time the deck checks the box, and the card keeps saying `there may be an unsent draft. Send it or clear it.` Either way, move `CODEX_HOME` out of the project, out of the folders you let Codex write and out of `/tmp`, or [turn the doorbell off for Codex](#turn-the-doorbell-off-for-an-agent); a prompt hands the agent its messages meanwhile.
- **A launcher with settings of its own.** A launcher that passes Codex a profile, or `-c` options under `tui`, `profile` or `profiles`, or starts it in another directory, leaves the deck unable to check the box (other `-c` options, such as `-c model_reasoning_effort=high`, don't, except `otel` and `shell_environment_policy` options other than the ones the deck adds itself, which do): once you type into that Codex, its card says `the deck can't check this agent's input box. Check its pane.` until it restarts. Send it a prompt to have it take its messages. As for a Codex started directly, the deck creates its `editor` directory before it starts when there is none ([A Codex agent's card names its `editor` directory](troubleshooting.md#a-codex-agents-card-names-its-editor-directory)).

On macOS the deck doesn't check any agent's input box yet and leaves Claude Code's and Codex's environment as you set it. OpenCode, Pi and Devin take their messages their own way and need no check. The deck reads Antigravity's input box from its screen, on macOS and Linux, and changes nothing in its environment for that.

### Turn the doorbell off for an agent

The deck types the doorbell into every release of Claude Code, Codex and Antigravity, pre-release builds (a version with a suffix such as `-beta.1` or `-alpha.1`) included, and checks Claude Code's and Codex's input boxes, the same way. If an update to one of them makes the doorbell misbehave, for example the line lands somewhere it shouldn't, Enter isn't taken, or the agent's input box flickers or your editor opens on its own, turn the doorbell off for that agent until a deck release fixes it:

```sh
dot-agent-deck config set doorbell.claude false
dot-agent-deck config set doorbell.codex false
dot-agent-deck config set doorbell.antigravity false
```

The config key is the one to use, and the one that works with the desktop app: the daemon reads it each time it starts an agent. `DOT_AGENT_DECK_DOORBELL_CLAUDE=0`, `DOT_AGENT_DECK_DOORBELL_CODEX=0` or `DOT_AGENT_DECK_DOORBELL_ANTIGRAVITY=0` wins over the config file, but only in the daemon's own environment when it starts: a daemon that is already running, or one the desktop app started after you opened it from the Dock, Finder or an application menu, never sees a variable you set in a shell ([Configuration](configuration.md#turn-the-doorbell-off-for-claude-code-codex-or-antigravity)). For a service, `daemon install` saves these three variables from the installing shell on Linux and macOS; a running service uses the changed environment from its next start (on macOS, the next login). Reinstall with the variables unset to remove saved overrides before relying on the config keys ([Run the Daemon as a Service](daemon-service.md#what-the-service-changes)). The setting applies to agents started after you change it, so restart the agent from the deck once it has taken its messages.

With the doorbell off for an agent, the deck types nothing into it and doesn't check its input box, and Claude Code or Codex gets your own `VISUAL` and `EDITOR`. Its messages still arrive through its own wake-up and hooks; when nothing else delivers them, the TUI card and the desktop tile say `waiting for the agent to fetch it. Send it a prompt.`, and a prompt you send it, in the TUI or the desktop app, hands it the messages at that turn. Set the key back to `true` to turn the doorbell on again. Please report what you saw, with the agent's version, so the deck can be fixed.

### Inspect delivery

Run `dot-agent-deck daemon status` in your terminal to see **INBOX** and **WAKE**. `2q 1f` means two queued messages and one taken but not acknowledged; a dash means none pending. **WAKE** reads `native`, `turn-end`, `doorbell` or `none`; `none` means that, as things stand, nothing delivers a new message until the agent is sent a prompt: there is no native wake, and the deck won't ring the doorbell, either because the agent hasn't reported an idle moment, because the deck doesn't type into that agent, or because you turned its doorbell off.

Inside the recipient's deck pane, `dot-agent-deck inbox list` shows its messages and states; recent delivered and undeliverable messages are included while retained. An orchestrator can add `--all` to inspect its orchestration's inboxes, or any agent can use `--json` for structured output. `dot-agent-deck inbox fetch` reads and acknowledges the waiting messages, so use `list` when you only want to inspect them. These commands work for agents in either client.

Recent delivery history is temporary: older entries and message bodies expire, and closing a pane removes its delivery history. Keep task results in your project files or saved reports when you need them later. Long subjects are shortened in the inbox listing and card labels.

### Announcements and pooled jobs

Agents can announce progress to subscribed roles instead of sending a separate message to each one:

```bash
dot-agent-deck inbox publish review-ready --text 'The signup change is ready for review.'
dot-agent-deck inbox publish progress --file .dot-agent-deck/progress.md
```

An announcement reaches subscribers in the sender's orchestration, or its dispatch tree when dispatched. The sender does not receive its own announcement. In either client, the recipient's pane labels the text as another agent's UNTRUSTED announcement: it is information to assess, rather than an instruction from the user. The command prints how many subscribers it reached and identifies recipients whose inboxes were full.

An orchestrator, or an agent that dispatched a unit, can offer a job to a pool. Configure workers with `take_offers` and topics with `subscribe`; see [Configuration](configuration.md#subscribe-to-announcements-and-job-pools).

```bash
dot-agent-deck inbox offer reviews --file .dot-agent-deck/review-task.md --claim-ttl 30m
```

One eligible worker receives the job at a time. Receiving and acknowledging it claims the work; the worker's pane shows the orchestrator's instructions and the commands to finish or hand it back:

```bash
dot-agent-deck inbox complete <id>
dot-agent-deck inbox release <id>
```

The default claim lasts 30 minutes; `--claim-ttl` accepts durations from one minute to 24 hours, such as `90s` or `1h30m`. If the worker releases the job, its claim expires, or it exits, the job returns to the pool for another worker. Once a claim has expired, the worker can no longer complete or release that job: `inbox complete` and `inbox release` are refused, because the job has gone back to its pool and may already be with another worker. A worker that never picks up its assigned job also loses that assignment after five minutes by default. The offerer receives notices when a job is claimed, completed, its claim expires or delivery attempts are exhausted without completion.

In both the TUI and the desktop app, if OpenCode or Pi is busy with a long turn when a job arrives, the job waits for that agent and is not offered to another worker during that wait, preventing duplicate work. It waits for as long as the agent keeps it queued, and the job's claim time starts when the agent starts on it. For Claude Code, a job not claimed within the deck's wait still goes to the next worker.

In the TUI and desktop app, a claimed job stays counted as a taken message until completed or handed back. The desktop evidence rail records **Job handed back to its pool** when an assignment returns. The CLI commands work in agent panes in either client. Both `publish` and `offer` accept exactly one of `--text` or `--file`; `--file -` reads standard input, with a 1 MiB body limit.

If a command is refused, check its explanation: offers require an orchestrator or dispatching pane, topic and pool names must follow the [configuration rules](configuration.md#subscribe-to-announcements-and-job-pools), and publish and offer share a limit of 60 requests per minute per agent. For a full inbox, let the recipient consume its queued work before trying again.

### Setting the delivery variables

Delivery normally needs no timing settings. The waiting-for-input notice is configurable in [Idle Workers & Notifications](idle-workers-and-notifications.md#tune-or-turn-off-the-other-reports). Daemon settings must be present when it starts; a variable on a later client command does not change an already running daemon. See [Configuration](configuration.md#daemon-behaviour).


## Context handoff and permissions

A worker starts each task with no memory of your conversation with the orchestrator and no access to other workers' output. The task text, plus the worker's `prompt_template`, is everything it knows. Use the orchestrator's `prompt_template` to say how to delegate well: which files to reference, how to summarise earlier findings when chaining workers, what to include when retrying.

A reliable pattern is to give the orchestrator a tracking file (a spec, a PRD, a checklist) and tell it to keep it updated. Workers can be pointed at it, and an orchestrator whose context was compacted or restarted can read it to resume.

The roles hand over tasks and reports by writing files and running the deck's commands. For roles launched with a restricted tool allowlist:

- **Allow writing files.** A role launched with `claude --allowedTools Bash Read`, for example, stops at an approval prompt each time it writes a task or report. Add the file-writing tool: `--allowedTools Bash Read Write`.
- **Match the full path.** The deck tells agents to run its commands by their full path, such as `/home/you/.local/bin/dot-agent-deck work-done …`. A rule written against the bare command text, such as the Claude Code allow rule `Bash(dot-agent-deck work-done:*)`, does not match. Write the rule against the path shown in the agent's pane.
- **Allow `ack` wherever you allow `work-done`.** An allowlist that names `Bash(/home/you/.local/bin/dot-agent-deck work-done:*)` also needs `Bash(/home/you/.local/bin/dot-agent-deck ack:*)`, or the worker stops at an approval prompt at the start of every task. The orchestrator needs `delegate` (and `pane` if it should restart workers) allowed the same way.

## Files the deck writes

The deck keeps its hand-off files in `.dot-agent-deck/` inside the orchestration's directory (for a worker in another directory, inside that worker's directory). In a git repository, `dot-agent-deck init` and writing an orchestrator context add `.dot-agent-deck/` to `.git/info/exclude`, if it is not already there, so git does not pick the files up; `.gitignore` is not edited. A file git already tracks stays tracked.

| File | Written when | Contents |
|---|---|---|
| `orchestrator-context-<id>.md` | when an orchestration starts, and again each time the orchestrator's conversation is compacted or cleared ([When the orchestrator's conversation is compacted or cleared](#when-the-orchestrators-conversation-is-compacted-or-cleared)) | What the orchestrator is told: its `prompt_template`, the available workers, how to delegate, and its task if it was given one. |
| `worker-task-<role>.md` | each delegation | The task for that role, overwritten by the next one. |
| `work-done-<role>.md` | each `work-done` for a delegated task | The worker's last report. |
| other `*.md` files | when an agent writes them | Longer context an orchestrator passes by file. |

When it writes an orchestrator context, the deck deletes `.md` files in this directory, other than the saved copies of long messages (`inbox-message-*.md`), that were last modified more than 14 days ago. It also deletes an `orchestrator-context.md` there, whatever its age: earlier versions of the deck kept a copy of the latest orchestrator context under that name, and it is no longer written or read, so a role command or prompt that reads it gets an old brief, or nothing. Each orchestrator's context is the `orchestrator-context-<id>.md` its first message names. The saved copies follow their own schedule, described in [Delivery in the TUI and desktop app](#delivery-in-the-tui-and-desktop-app). `DOT_AGENT_DECK_COORDINATION_RETENTION_DAYS` changes the number of days, and `0` turns the clean-up off, except for that `orchestrator-context.md`. Do not keep your own files there.

## More than one orchestration

A project can define several `[[orchestrations]]` blocks, for different kinds of work or to run the same team on different providers.

### Sharing a workflow with `extends`

`extends` makes an orchestration inherit another's roles, so you write only what differs. Typical use: the same team on another provider, where only each role's `command` changes.

```toml
[[orchestrations]]
name = "mixed"
default = true

[[orchestrations.roles]]
name = "orchestrator"
command = "devbox run agent-orchestrator"
start = true
prompt_template = """
You coordinate the team. …
"""

[[orchestrations.roles]]
name = "coder"
command = "devbox run agent-coder"
description = "Implements features, fixes bugs"

[[orchestrations]]
name = "GPT"
extends = "mixed"

[[orchestrations.roles]]
name = "orchestrator"
command = "devbox run agent-orchestrator-oc"

[[orchestrations.roles]]
name = "coder"
command = "devbox run agent-coder-oc"
```

`GPT` gets both roles with `mixed`'s `start`, `description` and `prompt_template`; only the commands differ.

Rules:

- `extends` names the parent's literal `name`. The parent may be anywhere in the file. A block with no `name` cannot be a parent, and a name used by more than one block cannot be extended.
- Roles are matched by name and keep the parent's order, whatever order the overrides are written in.
- A key you omit keeps the parent's value. To turn off an inherited `clear = true`, write `clear = false`; an omitted key means "inherit", not "false". The same applies to `start`.
- A role name the parent does not have is added as a new role at the end and must have its own `command`.
- Chains work (`a` extends `b` extends `c`); a cycle is an error.
- `name`, `default` and `extends` itself are not inherited.

An `extends` error stops the whole file from loading, with a message naming the orchestrations involved.

### Which orchestration a schedule opens

When you start an orchestration yourself you choose it: the TUI's Mode field and the desktop app's **Mode** chips list the project's orchestrations, and a [dispatcher](dispatcher-mode.md) asks you. `default = true` matters when nobody is asked: a [schedule](scheduled-tasks.md) whose directory defines several orchestrations and whose `shape` names none, or `dispatch --orchestration=` with an empty value.

```toml
[[orchestrations]]
name = "prd"
default = true
# roles …

[[orchestrations]]
name = "issue"
# roles …
```

- At most one orchestration may set `default = true`, and it must have roles.
- If none sets it, the first orchestration in the file that has roles is used. With several orchestrations, set it anyway: otherwise reordering the blocks changes which team every scheduled run opens, and `validate` warns about exactly that.
- With a single orchestration the key has no effect.

A dispatcher agent sees the default marked in its target list:

```
Available dispatch targets:
  single            one agent (--single)
  orchestration     'prd' — 6 roles (--orchestration 'prd')  [default]
  orchestration     'issue' — 4 roles (--orchestration 'issue')

Ask the user which they want before dispatching, then pass the matching flag.
```

A schedule shows nothing, so for a schedule the "none declares default" warning reaches only the [daemon log](troubleshooting.md#enabling-debug-logs).

### Running several at the same time

Orchestrations in **different directories** run side by side. Tasks and reports stay within their own orchestration, even when two orchestrations have the same `name`.

For parallel work on the same project, give each orchestration its own git worktree:

```bash
git worktree add ../myproject-feature-x -b feature-x
```

Then start the orchestration in `../myproject-feature-x`. A [dispatcher](dispatcher-mode.md) does this for you.

Two orchestrations in the **same directory** still route tasks to the right workers, but they share the task and report files (`worker-task-<role>.md` and `work-done-<role>.md` are named by role only, so two `coder` roles overwrite each other's) and the working tree. The TUI's New Agent form warns before you start one:

```
  ! This directory already runs an orchestration.
    Both share .dot-agent-deck/*-{role}.md files
    and one working tree; /worktree-prd isolates.
```

`Enter` starts it anyway. The desktop app's **New agent** shows a similar warning, and **Activate orchestration** still starts the run.

## Messaging an orchestrator from outside

Agents reach a team through its orchestrator. Inside an orchestration, a worker reports to its own orchestrator with `work-done` and never messages another worker. An agent outside the orchestration, such as a standalone agent, a dispatched unit or an agent in another orchestration, does the same: it messages the orchestrator, never one of the workers. The deck tells the orchestrator this when it starts, and the worker prompts in the [role library](#role-library) say it too.

### Find the orchestrator

`dot-agent-deck roles` lists the live agents. It works from any shell, and the `ORCHESTRATOR` column marks each orchestration's orchestrator:

```
PANE   NAME          FOLDER                 ORCHESTRATION      ROLE          ORCHESTRATOR
p-12   orchestrator  /home/me/shop          shop               orchestrator  yes
p-13   coder         /home/me/shop          shop               coder
p-20   docs-helper   /home/me/notes         -                  -
```

A standalone agent shows `-` for its orchestration and role. The ORCHESTRATION column shows the orchestration's tab title, which for a dispatched unit is the orchestration's name followed by its folder, such as `shop · shop-fix-login`.

| Option | What it does |
|---|---|
| `--json` | Prints a JSON array with one object per agent: `pane_id`, `name`, `folder`, `orchestration` (the tab title), `orchestration_name` (the name in `.dot-agent-deck.toml`), `orchestration_id`, `role` and `orchestrator` (`true` for the orchestrator). The orchestration fields and `role` are `null` for a standalone agent. |
| `--folder <path>` | Lists only the agents `inbox send --folder <path>` would choose between, as described below, when `roles` runs on the same machine as the deck, which is how agents in deck panes run it. |
| `--orchestration <name>` | Lists only the orchestrations with that name or tab title. Combined with `--folder`, both must match. |
| `--name <name>` | Lists only the standalone agents with that name, the ones `inbox send --name <name>` would choose between. |
| `--pane <pane>` | Lists only the standalone agent in that pane, or the whole orchestration whose orchestrator is in it. |

You can see the orchestrator in the clients too: in the TUI its card in the orchestration tab's sidebar carries an `ORCHESTRATOR` badge, and in the desktop app its row carries the same badge. When a TUI sidebar card is too narrow for the badge beside the agent's type and name, the badge moves to a line of its own on the card.

### Send a message

From an agent's deck pane:

```bash
dot-agent-deck inbox send --folder /home/me/shop --text 'The API you depend on changes on Friday.'
dot-agent-deck inbox send --orchestration shop --file .dot-agent-deck/note.md
dot-agent-deck inbox send --folder /home/me/notes --name docs-helper --text 'The notes are ready.'
```

Give at least one of `--folder`, `--orchestration`, `--name` or `--pane`, and exactly one of `--text` or `--file` (`--file -` reads standard input, with a 1 MiB limit). A relative `--folder`, including `.`, is read from the directory the command runs in.

Which agent receives the message:

- `--folder` picks the orchestration in that folder. When none is there, it picks the one in the nearest parent folder that has one, so `--folder .` works from a subfolder of the project. It never picks an orchestration in a subfolder.
- `--orchestration` matches the name in `.dot-agent-deck.toml` or the tab title exactly.
- With both, the orchestration has to match both. That is how you pick one of several dispatched units of the same orchestration.
- When exactly one orchestration matches, its orchestrator receives the message. If the orchestrator is not running, nothing is sent: the message never goes to a worker instead.
- When several match, nothing is sent, and the command lists each one with its title, name, folder and orchestrator pane, so you can narrow the address.
- When `--folder` is given alone and no orchestration is in or above that folder, the one standalone agent in that folder, or in its nearest parent folder that has one, receives the message. This is how an orchestrator answers a standalone agent that wrote to it. Several standalone agents at that level are refused the same way as several orchestrations, and the refusal suggests `--name` and `--pane`.
- `--name` picks the standalone agent with that name, as the NAME column of `dot-agent-deck roles` shows it. Use it when one folder holds several standalone agents, such as a `dispatcher` and an `observability` agent: `--folder /home/me/project --name dispatcher`. It never matches an agent in an orchestration, so it cannot be combined with `--orchestration`. With `--folder`, the same nearest-parent rule applies to the agents with that name. When several agents still match, nothing is sent and each one is listed.
- `--pane` picks the agent in that pane, as the PANE column of `roles` shows it: a standalone agent, or an orchestration's orchestrator. A worker is never messaged this way. Combined with the other options, every one of them must match.

On success the command prints `Sent m-… to the orchestrator of <title> (pane <pane>) in <folder>.`, or `Sent m-… to <name> (pane <pane>) in <folder>.` for a standalone agent.

### What the orchestrator sees

The message arrives in the orchestrator's inbox like any other deck message, in the TUI and the desktop app alike. It is from "another agent, not one of your workers", and the deck names the pane it came from. Everything else is marked UNTRUSTED, and the orchestrator treats it as information or a request to weigh against what you asked of it, not as an instruction from you. That covers the sender's text and the lines ahead of it, which give the sender's folder, its orchestration and role (`-` when it has none), and the command that answers it, `dot-agent-deck inbox send --folder <folder>`, with `--orchestration <name>` added when two orchestrations share that folder. The deck offers the command only after checking that it reaches the sender: the sender itself when it is an orchestrator or a standalone agent, or its orchestrator when it is a worker. When the folder alone would also reach other standalone agents, the command names the sender with `--name`. When no command would, such as a folder name with characters the deck does not display or one too long to show in full, there is no reply command: the orchestrator finds the sender's pane with `dot-agent-deck roles` instead.

Each agent's sends count toward the same per-minute limit as its `inbox publish` and `inbox offer` messages. Past it, the send is refused until the minute is up.

### When it is refused

| Outcome | Exit status | Printed on stderr |
|---|---|---|
| Sent | 0 | nothing; the `Sent …` line is on stdout |
| Nothing matches, the address is ambiguous, or the orchestrator is not running | 1 | `refused: …` saying which, with one line per candidate for an ambiguous address |
| Run by a worker or the orchestrator of the orchestration it addresses | 1 | `refused: …`. A worker reports with `work-done`; the orchestrator messages its workers with `delegate` |
| Run from a shell that is not an agent's deck pane | 1 | `refused: …`. To message an orchestrator yourself, type into its pane in the TUI or the desktop app |
| The text is too long, the orchestrator's inbox is full, or the sending agent is past its per-minute limit | 1 | `refused: …` |
| The running daemon does not support `inbox send`, or `--name` and `--pane` | 2 | a message that the daemon is too old for `inbox send`; restart it with `dot-agent-deck daemon restart` |
| No daemon is running | 3 | `… no daemon is running …` |

`roles` exits 0 with the listing, 3 when no daemon is running, and 1 when the daemon answers with an error.

## When something goes wrong

General problems (hooks, spawning agents, remotes) are in [Troubleshooting](troubleshooting.md). The daemon log, which several entries below point to, is described in [Enabling debug logs](troubleshooting.md#enabling-debug-logs).

### `DOT_AGENT_DECK_PANE_ID environment variable not set`

`delegate`, `work-done`, `dispatch` or `pane` was run outside a pane the deck started, for example in your own terminal. Run them from a role pane.

### `… is the <role> role, not this orchestration's orchestrator, so it may not delegate`

Only the orchestrator can run `delegate`, `pane restart` and `pane spawn`. Check that exactly one role has `start = true` (`dot-agent-deck validate`). A file without one makes the role named `orchestrator`, or else the first role, the orchestrator, which may not be the one you meant.

### `the daemon holds no orchestration role for pane …`

The pane is not part of a running orchestration in the daemon. If the orchestration was running earlier, see [An orchestration stops being able to delegate](troubleshooting.md#an-orchestration-stops-being-able-to-delegate-the-daemon-holds-no-orchestration-role-for-pane-).

### `delegate` says "reached no worker for role(s)"

- The `--to` value must match a role `name` exactly, including case.
- A role renamed in the file after the orchestration started keeps its old name until the orchestration is started again.
- A role added after the orchestration started, or whose pane was closed, is not running: have the orchestrator run `dot-agent-deck pane spawn <role>`.
- A worker that crashed or quit on its own is not running either, unless its role has `clear = true`, which starts a fresh worker for every task: have the orchestrator run `dot-agent-deck pane restart <role>`, then delegate again.
- The orchestrator cannot delegate to itself.
- Delegation does not cross orchestrations: the worker must be in the same orchestration as the orchestrator.

### `delegate` says "this delegate was NOT sent: every worker it reached still owes a work-done"

The worker has not reported its earlier task. See [One task per worker at a time](#one-task-per-worker-at-a-time). If you believe it did report, look for its `work-done` in its pane: a refused one (for example over a [capability token](troubleshooting.md#work-done-dispatch-or-delegate-fails-with-refused--hook-capability-token)) never reached the deck.

### The worker received the task line but never started

Check the inbox badge and run `dot-agent-deck daemon status`. If the message stays queued, see [An agent shows the doorbell instead of waking](troubleshooting.md#an-agent-shows-the-doorbell-instead-of-waking). If the card says `not delivered`, see [A message says not delivered](troubleshooting.md#a-message-says-not-delivered). A delivered task whose agent does no work needs its pane inspected; receipt does not mean completion.

### A worker stops at an approval prompt at the start of every task

Its allowlist does not permit `ack`, writing files, or `work-done` by its full path. See [Context handoff and permissions](#context-handoff-and-permissions).

### A role card reads "No agent", or a Codex role stays blank until its first task

The role's `command` starts the agent through a launcher. Add an [`agent`](#declaring-the-agent-behind-a-launcher-command) line. If there already is one, check its spelling; `dot-agent-deck validate` names an unknown value.

### A role card says "Exited"

The role's command ended on its own, often at once because it could not start the agent: a launcher that fails in that directory, a binary missing from the `PATH` the daemon was started with, or an agent that exits while loading. The TUI card and the desktop app's dashboard row both name the role, say **Exited**, say why, such as `its command exited (code 1)`, and show the last lines its pane printed under **Last output**. In the TUI, selecting the card puts the same reason on the status line, for example `reviewer exited: its command exited (code 1)`, and keeps the card. In the desktop app, the row has no terminal to open, and the dashboard's filter leaves exited rows out until you press **Show all**. In the dashboard's **Cards** view, the role's **Stopped** card says **Exited**, the reason and the last lines on its status line, cut short to fit; click the card to see them in full. An orchestration whose roles have all exited keeps its group on the desktop dashboard, but with no **Close** button: close it from the TUI, with the tab's `[×]` or `Ctrl+W` on its tab in command mode ([Closing Agents](closing-agents.md)).

Run the role's `command` yourself in the orchestration's directory to see the whole error, and fix it. Then have the orchestrator run `dot-agent-deck pane restart <role>` for a worker, or close the orchestration and start it again; starting the role again runs the same command, so it fails the same way until the command is fixed.

### A delegated worker never came up

A `clear = true` worker was restarted for a new task and the new agent did not come up, so the task was not delivered and no `work-done` will come for it. The orchestrator's pane gets one of:

- `⚠ delegated worker respawn failed (dot-agent-deck daemon report)`: the new agent could not be started at all.
- `⚠ delegated worker never came up (dot-agent-deck daemon report)`: the new agent started, then exited before it took the task.

The report names the worker's pane; the daemon log names the role and, for a failed start, the error. The usual cause is the role's `command`: a launcher that fails in that directory, a binary that is not on the `PATH` the daemon was started with, or an agent that exits immediately. Look at the worker's pane for what the agent printed, and run the role's `command` yourself in the worker's directory. Re-delegating to the role runs the same command, so it fails the same way until the command is fixed.

### `pane restart` says "has not crashed; pass --force to restart a healthy pane"

Without `--force`, `pane restart` restarts only a worker whose agent has exited. An agent that is running but hung has not exited, so it is refused the same way. Look at the worker's pane; if it is stuck, run `dot-agent-deck pane restart <role> --force`. The orchestrator can use `--force` when it sees this message; if you want force-restarts to stay your decision, say so in its `prompt_template`.

### `pane restart` says the worker's working directory "is not a directory"

The directory the worker runs in has been deleted, or a file now has its path. Nothing was restarted and the running worker was left as it was. Put the directory back, or close the orchestration and start it again from a directory that exists.

### `pane restart` says the prepared working directory "was replaced"

The role was started from the desktop app's New agent dialog or Runs screen, and the directory at its path is no longer the one that launch checked: the project was moved away and another directory put in its place. Nothing was restarted and the running worker was left as it was. Move the original directory back, or start the orchestration again from the desktop app.

### `pane spawn` says the role "is already running in this orchestration"

`pane spawn` starts a role that has no pane; it does not start a second copy. To run two workers of the same kind, give the second its own role name in `.dot-agent-deck.toml` (for example `reviewer2`) and spawn that.

### The orchestrator receives no report

Reports wait in the orchestrator's inbox and appear in its pane when taken. If that agent exits, its pending messages are not transferred to a replacement; a delegated report is also saved to `.dot-agent-deck/work-done-<role>.md`. If the daemon log shows `failed to write work-done summary`, that file is from an earlier task; the orchestrator then receives the report inline, on one line, without its Markdown formatting.

An orchestrator that runs `work-done` without `--done` reports to nobody; it should delegate the work to a role instead.

### The orchestrator is told a report was "unsolicited"

A `work-done` the deck cannot match to a task the orchestrator delegated reaches it labelled as unsolicited, and `.dot-agent-deck/work-done-<role>.md` is not updated. Causes:

- you gave the worker a task directly by typing in its pane, and it reported again. Give tasks through the orchestrator instead;
- the task never reached the worker (the orchestrator saw `⚠ delegated worker respawn failed` or `⚠ delegated worker never came up`);
- the task was sent more than seven days ago;
- `pane restart` dropped the task the worker owed.
- the worker the task went to exited before reporting, and the report came from a different agent started in its pane since.

### The report went to a different file than `work-done-<role>.md`

A file the deck did not write was already at `.dot-agent-deck/work-done-<role>.md`, usually because the worker saved its own report there. The deck leaves that file as it is and saves the report to a new file in the same `.dot-agent-deck` directory. The orchestrator's pane, in the TUI and in the desktop app alike, is told where the report is and that the existing file was left alone, since it may hold more of the worker's report. To avoid this, have workers save their reports under another name; the reporting instructions the deck gives them already suggest one.

### The orchestrator does not know its workers, or a dispatched orchestration is refused

The orchestrator learns its roles and how to delegate from a context file the deck writes into `.dot-agent-deck/`. The deck will not write it into a `.dot-agent-deck` that is a symlink, or that grants write access to group or other and cannot be fixed with `chmod`. A dispatched orchestration is then not started, and the dispatcher is told why: the reason names the symlink, or the directory's mode and `chmod go-w`. An orchestration started from the TUI still opens, but its orchestrator is not given that context. Replace a symlinked `.dot-agent-deck` with a real directory in the project, or run `chmod go-w .dot-agent-deck`, then start the orchestration again.

### A `prompt_template` change has no effect

Changes apply to the next task. Check that the file is in the orchestration's directory, that the key is spelled `prompt_template` (unknown keys are ignored silently), and that the role's `name` matches the `--to` value exactly.

## See also

- [Idle Workers & Notifications](idle-workers-and-notifications.md): what the deck reports to the orchestrator about stuck workers
- [Dispatcher Mode](dispatcher-mode.md): start an agent or a whole orchestration in an isolated copy of the repository
- [Schedules](scheduled-tasks.md): start an orchestration on a timer
- [Configuration](configuration.md): the rest of `.dot-agent-deck.toml`, global settings and environment variables
- [Keyboard Shortcuts](keyboard-shortcuts.md): every TUI key
