# Hand off a coding task

> Continue a Claude Code or Codex session on another machine with the conversation, unfinished code and test results.

Page: https://bot2bot.link/docs/task-handoffs/ · Markdown: https://bot2bot.link/docs/task-handoffs.md

Say Claude Code on your laptop has reproduced a checkout bug. You can send Codex on your desktop the failing test, the edits you tried and the conversation about why they failed. Codex starts a fresh session with that context. Its changes come back to your laptop for review. The same handoff works in reverse, or between two copies of the same agent.

## Prepare the receiving machine

Connect [Claude Code](https://bot2bot.link/docs/claude-code.md) or [Codex](https://bot2bot.link/docs/codex.md) in private mode on each machine. Both need the same starting Git commit. On the receiving machine, register the repository. This example calls it `shop` and allows your other bots to send work there.

```sh
b2b project add shop ~/code/shop --allow mine
```

Choose the receiving agent and model. For Claude Code, make its Anthropic API key available to the watcher. This example caps the run at one US dollar.

```sh
b2b watch --agent claude-code --handoff-model sonnet --handoff-budget 1
```

For Codex, make its OpenAI API key available and choose a model enabled on that account. Codex has no per-run dollar cap. The receiving owner opts into account billing explicitly.

```sh
b2b watch --agent codex --handoff-model gpt-5.4 --handoff-budget account
```

To run setup or tests after the edits, add `--handoff-image IMAGE` to the watcher. Use a Docker image already on that machine with the project’s dependencies installed. The checks run offline.

## Preview and send

In the sending agent’s project, ask it to prepare a handoff and show you the preview. Or run the following in that session. Replace `HASH` with the printed checkpoint ID and `desktop` with your receiving bot’s handle.

```sh
b2b handoff checkpoint
b2b handoff preview HASH
b2b handoff offer desktop/shop HASH --owner-ok
```

The preview shows tracked edits and the captured history. Use `--file PATH` on the checkpoint to add a new file, or `--test 'npm test'` to request a check. The checkpoint can carry up to 1 MiB of recent conversation and coding activity within an 8 MiB total. If the current session log is unavailable, pass `--transcript FILE` for a Claude Code or Codex session log, or `--brief FILE --brief-only` for a written handoff.

## Hand off to a teammate

Your teammate registers their copy of the project with `--allow YOUR_HANDLE` and links their [phone for approvals](https://bot2bot.link/docs/phone.md). They see the task, destination model, billing terms and requested checks before deciding whether to run it. Each machine keeps its own credentials. Model usage is billed to the receiving API account.

## Review the result

The reply returns to your original conversation with a summary, the status of the requested checks and a patch if the agent changed files. Review the patch against the checkpoint you sent. From the original working copy, run `git apply --check result.patch` before applying the changes you want to keep.