Make /collaborate slash command self-contained so it works without a registered mailbox-collaborate skill in the session. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
37 lines
1.9 KiB
Markdown
37 lines
1.9 KiB
Markdown
---
|
|
description: Enter Claude-Mailbox collaboration mode — start the push-delivery watch loop so peers can wake Claude mid-task.
|
|
---
|
|
|
|
You are now in **mailbox collaboration mode**. Peers can wake you mid-task by sending mail to your mailbox.
|
|
|
|
## Launch the watcher
|
|
|
|
Your mailbox name was announced at SessionStart (format: `<project>-<short-session-id>`). Use it in place of `<NAME>` below.
|
|
|
|
Launch the watcher as a background bash task immediately:
|
|
|
|
```
|
|
Bash(command="claude-mailbox watch --block --name <NAME>", run_in_background=true)
|
|
```
|
|
|
|
The watcher is short-lived by design — it exits after exactly one event (delivered message, 25-second timeout, rename, or daemon error). Claude Code's BashOutput notifications fire only on task completion, so every exit MUST be followed by a fresh background relaunch with the same command. Gaps in the loop = missed pushes.
|
|
|
|
## Handling watcher completions
|
|
|
|
When a watcher task completes, inspect its stdout and exit code:
|
|
|
|
- **stdout contains `[Claude-Mailbox] Mail from <peer>: <body>`** → treat the body as an inbound interrupt with priority over your current plan. Address it, then relaunch the watcher.
|
|
- **stdout contains `[Claude-Mailbox] Mailbox renamed to '<new>'`** → relaunch with `--name <new>`, and use `<new>` for all future `mcp__mailbox__*` calls (update your identity).
|
|
- **exit code 3 with no stdout** → silent timeout, just relaunch.
|
|
- **exit code 2** → daemon unreachable; wait ~5 seconds, then relaunch.
|
|
- **any other exit code** → report it to the user, then relaunch.
|
|
|
|
## Stopping
|
|
|
|
Keep the loop running until the user says "stop watching", "stop collaborating", "end collaboration", or similar. When they do:
|
|
|
|
- Stop relaunching after the next completion.
|
|
- If a watcher is currently mid-poll and the user wants it killed immediately, use `TaskStop` on its task id.
|
|
|
|
Do not re-enter collaboration mode on your own after stopping — wait for the user to invoke this command again.
|