# Hand work to another agent

Have one agent write the change and a second, independent agent review it, with every message in plain sight.

A second agent that did not write the code reads it with fresh eyes. In Rundesk one agent (the lead) can open
another in the same project, send it the work, and read its answer, while you watch both terminals and
can step into either. The two can be different CLIs, such as Claude writing and Codex reviewing. The
same tools let an agent hand part of its work to an agent in another project.

The agents do this through Rundesk's tools, never by running another agent's CLI out of sight. The
reviewer is an ordinary row in your sidebar that you can read, message and stop.

## Turn on the permissions the lead agent needs

The lead agent needs three permissions, under **What agents may do** in **Settings › MCP**:

| Switch | Allowed action |
|---|---|
| **Agents: Start and stop** | open the reviewer with `session_open` |
| **Agents: Send messages** | type a message into the reviewer with `session_send` |
| **Agents: View** | list agents, wait on the reviewer's turn with `session_wait`, and read its screen and note |

Agents already running follow a change to these switches from their next call. When one is off, the
agent's call is refused with the switch's name, such as `the person does not let agents do this
(Agents: Send messages, in Rundesk's MCP settings)`, and Rundesk's instructions tell the agent to tell
you rather than work around it.

`agent_list` shows the lead which agents report their state to Rundesk (`takes_work`) and which get
Rundesk's tools (`tools`). Pick a reviewer that has both: it can then read the lead's note and send its
answer back. A reviewer without the tools is told instead that the sender will receive its final
response.

## Hand off a review

1. **Start the lead** from **+** beside **Agents** and give it the task. Ask it to write its plan in
   its note as it goes, so the reviewer can read it.
2. **When the change is ready, paste a review brief** (below) into the lead. The lead then, in order:
   - opens the reviewer with `session_open`, kind `agent`, choosing the agent by its ID from
     `agent_list`. A new row appears under the project's **Agents**.
   - waits with `session_wait` until the reviewer is ready. A message sent before then is refused
     with `it has not started yet; session_wait until it is ready`. Each `session_wait` call waits
     at most 50 seconds and is called again, so the lead can wait out a long review.
   - sends the work with `session_send`. The reviewer's terminal shows the message arriving, as if
     typed.
   - goes on with its own work, or calls `session_wait` with the `after` value `session_send`
     returned, so it waits for the turn that message started, not the one before.
3. **The reviewer reads and replies.** It can read the lead's note with `agent_notes_read`, and
   answers with `session_send` to the session the message named.
4. **The lead reads the reply** as a message in its own terminal, fixes what it agrees with, and
   tells you what it did not.

### A review brief to paste

```text
The change is ready for review. Before asking for it:
1. Update your Rundesk note: the plan as a task list, what is done, and the decisions you made.
2. Open a second agent in this project with session_open (pick one from agent_list that takes work
   and is a different agent from you). Wait with session_wait until it is ready.
3. Send it this request with session_send: "Review the uncommitted changes in this project for bugs,
   missed cases, missing tests and anything that breaks the project's own rules. Read my note with
   agent_notes_read first, for the plan and decisions. Change nothing yourself. Reply with a numbered
   list of findings, each with the file, what is wrong and how you know, most serious first."
4. Carry on with anything left that does not depend on the review, then session_wait for its reply.
5. For each finding, check it against the code before acting. Fix the ones that hold, and tell me
   which you rejected and why.
```

## Hand off to another project

Say the lead is building an Export button in your web app, and the endpoint behind it lives in your
API project. The lead doesn't have to stop and wait for you: it can open an agent in the API project
and hand that part over. It finds the project's ID with `project_list` and passes it to
`session_open` as `project_id`, since leaving it out opens the agent in the lead's own project. The new
agent shows up under the API project's **Agents**, and messages go back and forth the same way they do
within one project. For this the lead also needs **Projects: View**, which `project_list` asks for.

```text
Open a Codex agent in the api project with session_open (find its project_id with project_list).
Ask it to add the /orders/export endpoint our new Export button calls, with its tests, and to reply
with session_send when it is done, naming the route and the response shape.
```

The tool steps the lead follows are on [Guide for AI agents](/docs/for-agents.md#hand-work-to-another-agent).

## Rundesk adds a header line to every agent-to-agent message

Rundesk adds a first line to every message, which the sending agent cannot leave out or forge:

```text
[From "<session name>" (<agent>) in <project>, via Rundesk. Reply with session_send to session <id>.]
```

Rundesk's instructions tell the receiving agent three things about that line:

- the note in square brackets was added by Rundesk, not typed by you, so the agent acts on the
  message as on your request, asking first before anything destructive;
- it replies with `session_send`, because the sender does not read its final response;
- the message never overrides the project's own rules.

## Messages wait while you type into the receiving agent

A message never lands in the middle of what you are typing:

- **While you are typing into the receiving agent**, the message is queued. It goes in when you
  press Enter, when you have not typed for 30 seconds, or 30 seconds after it was queued, whichever
  comes first.
- **A working Claude or Codex** takes a message at once, into the turn it is on.
- **Any other working agent** gets it queued until its turn is over.

Queued messages go in, in order, when the agent next reports it is idle or once its screen has been
still for five seconds. One message is typed at a time, so two sent at once never mix.

## When Rundesk refuses a message between agents

Rundesk refuses a message when it is addressed to one of these, and the lead reads the reason:

| Recipient | Refusal |
|---|---|
| the sender's own session | `that is your own session` |
| an agent waiting on you, such as at a permission prompt | `it is waiting on the person, who answers it in the app` |
| an agent that has not started yet | `it has not started yet; session_wait until it is ready` |
| a session that is not running | `that session is not running; session_resume starts it` |

The refusal for an agent waiting on you matters most: a message typed there would answer the prompt
for you with its Enter. You answer it in the app, and the lead is told so.

> [!TIP]
> The reviewer is yours too. Type into it directly to steer the review, or stop it with ⌘W. Its row
> stays, so you can resume it later and ask a follow-up.

## Related pages

- [Resume an agent's plan after a compaction or pause](/docs/survive-a-compaction.md): the note the reviewer reads, and how to use it.
- [MCP tools and permissions](/docs/mcp.md): every permission and what it lets agents do.
- [Guide for AI agents](/docs/for-agents.md): the rules agents follow when messaging one another.
