Message your other Claude Code sessions
--- a/cross-session-messaging.md
+++ b/cross-session-messaging.md
@@ -121,7 +121,6 @@
When session A messages session B, Claude Code tells B’s Claude that the message came from another session, not from you, and limits what the message can do:
* **It can’t approve anything** : a message from another session never counts as your consent, so it can’t answer a pending permission prompt on your behalf.
- * **It can’t change configuration** : Claude Code instructs the receiving Claude never to change permission settings, `CLAUDE.md`, or other configuration because another session asked.
* **Commands don’t run** : a command in the message’s text, such as `/compact`, arrives as plain text. Claude Code never executes it.
* **Permission prompts still fire** : if acting on the message requires a permission the receiving session doesn’t have, you see the same prompt you’d see for any other work.
--- a/cross-session-messaging.md
+++ b/cross-session-messaging.md
@@ -182,7 +182,7 @@
On macOS and Linux, Claude Code restricts the socket to your operating-system user. On native Windows, it instead requires each connection to authenticate first with a key that only your operating-system user can read. Either way, on a shared machine another user’s sessions can’t deliver to it. On macOS and Linux, Claude Code also refuses to create the socket in a directory it can’t accept, for example one that another user owns, and uses a private per-user directory, `/tmp/cc-socks-<uid>`, instead. When it can’t accept any directory, the session runs without an inbox: Claude Code shows a notice, `/status` shows `unavailable` and the reason in its `Peer address` row, and the [`--debug`](</docs/en/cli-reference#cli-flags>) log records the full refusal. Alongside the socket’s path, Claude Code exports a per-session token as [`CLAUDE_CODE_MESSAGING_TOKEN`](</docs/en/env-vars#variables>). A script posting to its own session’s socket can send `{"type":"auth","token":"<token>"}` as the first line of its connection, where `<token>` is the value of `CLAUDE_CODE_MESSAGING_TOKEN`. Whether Claude Code requires the line depends on the platform:
- * **macOS and Linux, including WSL 2** : the line is optional. Claude Code accepts a connection with or without it.
+ * **macOS and Linux, including WSL 2** : the line is optional.
* **Native Windows** : the line is required. Claude Code closes any connection whose first line isn’t a valid auth line and delivers nothing from that connection.
Open the connection only when the message you’re posting is ready. Claude Code closes a connection that hasn’t sent a complete line within 30 seconds, so capture a slow command’s output first and then open the connection to send it. Claude Code runs messages arriving on the socket through the same inbound controls as any other peer message, with one exception and one prerequisite:
--- a/cross-session-messaging.md
+++ b/cross-session-messaging.md
@@ -105,7 +105,7 @@
On another of your machines| Through Anthropic servers, arriving over that machine’s [Remote Control](</docs/en/remote-control>) connection
In the [cloud](</docs/en/claude-code-on-the-web>)| Through Anthropic servers, straight to the cloud session
-Starting a conversation with a session on another of your machines requires Claude Code v2.1.225 or later and a target that appears in the listing. A session’s row in the listing can show a condition that changes what happens when Claude messages that session:
+Starting a conversation with a session on another of your machines requires Claude Code v2.1.225 or later. A session’s row in the listing can show a condition that changes what happens when Claude messages that session:
* **`offline`** : that session’s Remote Control connection has dropped. The message goes through, but arrives only after that session’s machine reconnects.
* **`can't receive cross-session messages (off in that session)`** : messaging isn’t available in that session, or its [`crossSessionInbound`](</docs/en/settings-reference#crosssessioninbound>) value is `refuse`. Claude Code refuses a message to that session before the message leaves this machine. The result under Claude’s `SendMessage` call begins `Not sent` and names the reason. Once the cause is fixed in that session, a later listing no longer shows this condition, and Claude can message that session.
--- a/cross-session-messaging.md
+++ b/cross-session-messaging.md
@@ -243,6 +243,7 @@
* **Other-machine session missing** : a session on another of your machines appears only when it runs with [Remote Control](</docs/en/remote-control>) and this session is connected as well.
* **Other-machine session`offline`**: a message to a session listed as `offline` goes through, but arrives only after that session’s machine reconnects.
* **Cloud or other-machine session`can't receive cross-session messages`**: a message to a session listed with this condition doesn’t leave this machine, and the result under `SendMessage` begins `Not sent`.
+ * **Long exchange between sessions** : if an exchange paused or stopped after many replies, type a prompt in the sending session to resume it.
* **Older cloud or other-machine session missing** : Claude Code reads those session lists newest first and stops after a bounded number of pages, so Claude can’t message a session that fell past them by name.
In a session with messaging, `/status` also shows a `Peer address` row with the session’s own inbox address, or `unavailable` and the reason when Claude Code couldn’t set up an inbox.
@@ -254,7 +255,10 @@
* **Plain text only** : Claude sends only plain text across sessions. Structured [agent team](</docs/en/agent-teams>) protocol messages stay within a team.
* **Same-machine message size is capped** : Claude Code refuses a message to a session on this machine once its serialized form passes about a million characters. The refusal [names the exact sizes](</docs/en/errors#message-too-large-for-cross-session-delivery>). Nothing reaches the receiving session.
* **Rapid bursts to one session are refused at the sender** : once a rapid burst of messages to a session on this machine reaches what that session’s inbox accepts, Claude Code refuses further sends in the sending session. The [refusal names the burst](</docs/en/errors#too-many-messages-to-this-session-just-now>) and tells Claude to batch the rest into one message or wait.
- * **Message loops are throttled** : in the receiving session, Claude Code rate-limits repeated messages per sender, drops identical repeats arriving within a short window, and queues at most 50 accepted messages for Claude to read. A message loop between two sessions therefore stops on its own.
+ * **Message loops are throttled** : in the receiving session, Claude Code rate-limits repeated messages per sender, drops identical repeats arriving within a short window, and queues at most 50 accepted messages for Claude to read.
+ * **Slower loops on this machine can continue** : two sessions that answer each other slowly enough not to be throttled can exchange thousands of messages without a prompt from you, and each delivered message counts toward usage. To stop the exchange, end one of the sessions or stop it from receiving messages. To end a [background session](</docs/en/agent-view#attach-to-a-session>), attach to it and run `/stop`.
+ * **Sending can pause after a long exchange** : if a session’s `SendMessage` result begins `Not delivered: this session keeps answering other sessions`, type a prompt in that session to resume sending.
+ * **Some long reply chains can be cut off** : when a chain of replies grows long, delivery can stop, for example in a chain that includes a session beyond this machine. To continue the exchange, type a prompt in one of the sessions in the chain.
## Related resources
--- a/cross-session-messaging.md
+++ b/cross-session-messaging.md
@@ -110,11 +110,11 @@
* **`offline`** : that session’s Remote Control connection has dropped. The message goes through, but arrives only after that session’s machine reconnects.
* **`can't receive cross-session messages (off in that session)`** : messaging isn’t available in that session, or its [`crossSessionInbound`](</docs/en/settings-reference#crosssessioninbound>) value is `refuse`. Claude Code refuses a message to that session before the message leaves this machine. The result under Claude’s `SendMessage` call begins `Not sent` and names the reason. Once the cause is fixed in that session, a later listing no longer shows this condition, and Claude can message that session.
-A session inside a container and a session on the host can’t reach each other. Two sessions inside the same container can still message each other, including on a [self-hosted runner](</docs/en/self-hosted-environments>). A session inside WSL 2 and a native Windows session on the same computer can’t reach each other either. To require your approval before any message goes beyond this machine, set `isolatePeerMachines`.
+A session inside a container and a session on the host can’t reach each other. Two sessions inside the same container can still message each other, including on a [self-hosted runner](</docs/en/self-hosted-environments>). A session inside WSL 2 and a native Windows session on the same computer can’t reach each other either. To require your approval before Claude’s messages go beyond this machine, set `isolatePeerMachines`.
#### Replies from other machines and cloud sessions
-A [cloud session](</docs/en/claude-code-on-the-web>), including one on a [self-hosted runner](</docs/en/self-hosted-environments>), can’t use `SendMessage` to answer a message from another machine, even when the message carries a reply address. The message still arrives. Read the cloud session’s response in its transcript at [claude.ai/code](<https://claude.ai/code>). If this session isn’t connected to Remote Control when Claude sends to a session beyond this machine, the message still goes through, but without a reply address. The receiving Claude can’t answer it.
+A [cloud session](</docs/en/claude-code-on-the-web>), including one on a [self-hosted runner](</docs/en/self-hosted-environments>), can’t use `SendMessage` to answer a message from another machine, even when the message carries a reply address. The message still arrives. Read the cloud session’s response in its transcript at [claude.ai/code](<https://claude.ai/code>). To receive a reply from a session on another of your machines, connect your session to Remote Control before Claude sends. Otherwise the message carries no reply address, and the receiving Claude can’t answer it.
## How a session treats an incoming message
@@ -195,11 +195,11 @@
## Restrict cross-session messaging
-Beyond the per-message defaults, you can narrow messaging in two ways. Require your approval before any message leaves the machine, or turn messaging off for a session or an organization.
+Beyond the per-message defaults, you can narrow messaging in two ways. Require your approval before Claude’s messages leave the machine, or turn messaging off for a session or an organization.
### Require approval for cross-machine messages
-Set [`isolatePeerMachines`](</docs/en/settings-reference#isolatepeermachines>) to `true` to require your explicit approval before any `SendMessage` reaches a session beyond this machine:
+Set [`isolatePeerMachines`](</docs/en/settings-reference#isolatepeermachines>) to `true` to require your explicit approval before Claude’s `SendMessage` reaches a session beyond this machine:
{
"isolatePeerMachines": true
Show diff (259 lines)
--- a/cross-session-messaging.md
+++ b/cross-session-messaging.md
@@ -2,11 +2,7 @@
Cross-session messaging lets Claude deliver a message from one of your Claude Code sessions to another. When a change in one session breaks what another is building on, Claude can warn that session before you notice. When one session settles a question another is blocked on, Claude can send the answer across. A message is a piece of text one Claude writes to another, never the sender’s conversation history or files. To move a whole conversation or its context, [resume the session](</docs/en/sessions#resume-a-session>) instead.
-##
-
-
-
-When to use cross-session messaging
+## When to use cross-session messaging
Use messaging when one of your sessions has something another session needs mid-task. Claude can send a message on its own when it sees the need, for example after making a change that affects work another session is doing, or you can ask it to send one. The common cases:
@@ -15,11 +11,7 @@
* **Get status from long-running work** : have a migration or test run report back to the session you’re watching, or ask it yourself from there. If that session is on this machine, Claude can also ask it for one notice when it next goes idle or exits.
* **Message across machines** : reach one of your sessions on another machine or in the cloud.
-##
-
-
-
-Message another session
+## Message another session
When one of your sessions learns something another session needs, such as a finding, a status, or a decision, Claude passes it along instead of you copy-pasting between terminals. Claude discovers the target with `ListAgents` and sends with `SendMessage`, so you never call either tool yourself. Claude can decide to send a message without being asked, and you can also prompt for one. To prompt one yourself, tell Claude what you want the other session to know or do. This example is a prompt you type, not a message Claude sends:
@@ -40,11 +32,7 @@
You can also type the mention without the picker. When more than one live session answers to the mentioned name, Claude asks you which one you mean before sending. For what the message Claude writes looks like when it arrives, including an example of one, see what a message looks like.
-###
-
-
-
-Message delivery
+### Message delivery
The receiving Claude reads the message between tool calls during an active turn. When the receiving session is idle, Claude Code starts a new turn with the message. A message from another session arrives as plain text. If it mentions a file or an [MCP resource](</docs/en/mcp#use-mcp-resources>) with `@`, Claude sees the mention as written and Claude Code attaches nothing, whether the message starts a new turn or arrives during one. Claude can still open a mentioned path on the receiving machine with its own tools, subject to that session’s permissions. Claude Code refuses a message in the following cases:
@@ -61,19 +49,11 @@
Once delivered, the message counts toward [usage](</docs/en/costs>) like a prompt you type. The receiving Claude can reply to the sender with `SendMessage`, except in the cases under Replies from other machines and cloud sessions and Turn off cross-session messaging. Permission boundaries stay per-session. Claude is instructed never to ask another session for an action that was denied or blocked in its own session, or that its own permission settings would block, and to route that work back to you instead. On the receiving side, the receiving session’s own permission prompts and rules still apply to anything the message asks for.
-###
-
-
-
-Get a notice when another session goes idle
+### Get a notice when another session goes idle
Claude can ask one of your sessions on this machine to send back one notice when that session next goes idle or exits. Idle here means the session finished a turn with nothing queued. Use it when you’re waiting on a long task in another session and want to hear when it’s done instead of checking. Requires Claude Code v2.1.236 or later in both sessions.
-####
-
-
-
-Ask for a notice
+#### Ask for a notice
Tell Claude what you’re waiting on. This prompt asks for a notice from the migration session:
@@ -81,19 +61,11 @@
Claude subscribes with the `SendMessage` tool’s `notify_when_idle` input, either attached to a message it’s sending anyway or on its own. On its own, Claude Code subscribes without starting a turn or spending tokens in the watched session, and sends the notice right away if that session is already idle. Attached to a message, Claude Code delivers the message first and sends the notice later.
-####
-
-
-
-What each session shows
+#### What each session shows
The watched session shows a line saying another process asked to be told when the session is next idle. The asking session shows the notice as a line naming the watched session. The line can include the time that session’s turn finished and a one-line status from that turn. If the asking session is idle, Claude Code starts a new turn with the notice.
-####
-
-
-
-Limits
+#### Limits
If no notice arrives within 12 hours, Claude Code drops the subscription and tells Claude, so it doesn’t keep waiting. Each side’s inbound controls apply to a notice like a message:
@@ -102,11 +74,7 @@
Only the Claude in your main conversation can subscribe, and only to your sessions on this machine. When Claude asks for a notice from any other target, such as a teammate, a subagent, or a session beyond this machine, Claude Code refuses the whole call, including any message attached to it.
-###
-
-
-
-See which sessions Claude can reach
+### See which sessions Claude can reach
Claude finds a message’s target on its own, so you don’t need to run anything before asking it to send. To see for yourself which sessions Claude can reach, run the `/list-agents` command. The first line, when present, is this session’s own name, the one your other sessions use to message it. The rows below it are the sessions Claude can reach:
@@ -127,11 +95,7 @@
* **One session answers to the name** : Claude Code delivers the message on the name alone.
* **Several sessions share the name, or Claude Code couldn’t check everywhere your sessions run** : Claude adds a short identifier to each row of its listing and uses the identifier in the address.
-###
-
-
-
-Message sessions on other machines
+### Message sessions on other machines
How a message travels, and whether it passes through Anthropic servers, depends on where the target session runs:
@@ -148,19 +112,11 @@
A session inside a container and a session on the host can’t reach each other. Two sessions inside the same container can still message each other, including on a [self-hosted runner](</docs/en/self-hosted-environments>). A session inside WSL 2 and a native Windows session on the same computer can’t reach each other either. To require your approval before any message goes beyond this machine, set `isolatePeerMachines`.
-####
-
-
-
-Replies from other machines and cloud sessions
+#### Replies from other machines and cloud sessions
A [cloud session](</docs/en/claude-code-on-the-web>), including one on a [self-hosted runner](</docs/en/self-hosted-environments>), can’t use `SendMessage` to answer a message from another machine, even when the message carries a reply address. The message still arrives. Read the cloud session’s response in its transcript at [claude.ai/code](<https://claude.ai/code>). If this session isn’t connected to Remote Control when Claude sends to a session beyond this machine, the message still goes through, but without a reply address. The receiving Claude can’t answer it.
-##
-
-
-
-How a session treats an incoming message
+## How a session treats an incoming message
When session A messages session B, Claude Code tells B’s Claude that the message came from another session, not from you, and limits what the message can do:
@@ -169,11 +125,7 @@
* **Commands don’t run** : a command in the message’s text, such as `/compact`, arrives as plain text. Claude Code never executes it.
* **Permission prompts still fire** : if acting on the message requires a permission the receiving session doesn’t have, you see the same prompt you’d see for any other work.
-###
-
-
-
-What a message looks like
+### What a message looks like
When a message arrives, Claude Code shows it in the conversation as a dim one-line preview, and the preview line stays in the conversation afterward. The preview carries the sender’s name and the first line of the message, cut with `…` when it’s long, such as `› Message from @api-worker: Schema migration finished (ctrl+o to expand)`. Any of these shows you the full text:
@@ -186,11 +138,7 @@
Schema migration finished
The new column is tenant_id, and rebasing on main is safe now.
-###
-
-
-
-Control inbound messages
+### Control inbound messages
Set [`crossSessionInbound`](</docs/en/settings-reference#crosssessioninbound>) to choose what a session does with messages arriving from your other sessions:
@@ -215,11 +163,7 @@
A session in the VS Code extension or the Desktop app can’t show the dialog. Claude Code keeps a held message there until the same deadline, as Non-interactive sessions describes. Claude Code holds at most 100 messages, and past that drops the oldest.
-###
-
-
-
-Non-interactive sessions
+### Non-interactive sessions
Claude Code binds an inbox socket for a [`claude -p`](</docs/en/headless>) session like an interactive one, so a long-running `-p` worker can receive messages and appears in the listing. When you start a session in [bare mode](</docs/en/headless#start-faster-with-bare-mode>), Claude Code doesn’t bind the socket, so that session can’t receive messages and doesn’t appear in the agent list. A `-p` session can’t show the approval dialog. When the inbound default holds a message there, Claude Code keeps it for the same [`dialogExpiry`](</docs/en/settings-reference#dialogexpiry>) deadline the dialog uses, five minutes by default:
@@ -228,11 +172,7 @@
Set `dialogExpiry` to `"never"` to keep default-held messages until the session ends. A message held by an explicit `hold` setting doesn’t expire; Claude Code delivers it when an `accept` later applies. To let a `-p` worker take messages unattended, start it with `crossSessionInbound` set to `accept` in its `--settings` value. An `accept` in your user settings also works but applies to every session you run.
-###
-
-
-
-The session’s inbox socket
+### The session’s inbox socket
Read this section when a session you expect isn’t in the agent list, when you want a script or hook to post into a session, or when a sandboxed command can’t reach the socket. Claude Code binds an inbox socket for each session with cross-session messaging enabled, where other sessions on the machine deliver messages. The socket is a Unix domain socket on macOS and Linux, including Linux inside WSL 2, and a named pipe on native Windows. For which session kinds bind one, see Non-interactive sessions. You can find the socket’s path in two places:
@@ -253,19 +193,11 @@
* When Claude Code can verify neither way, it treats the message like any other that asserts no permission class, so a session that bypasses permission prompts holds it for your approval.
* **Sandboxed sessions** : control whether a Bash command can reach the socket from inside the [sandbox](</docs/en/sandboxing>) with the sandbox’s Unix-socket settings, [`sandbox.network.allowAllUnixSockets` and `sandbox.network.allowUnixSockets`](</docs/en/settings-reference#sandbox-settings>).
-##
-
-
-
-Restrict cross-session messaging
+## Restrict cross-session messaging
Beyond the per-message defaults, you can narrow messaging in two ways. Require your approval before any message leaves the machine, or turn messaging off for a session or an organization.
-###
-
-
-
-Require approval for cross-machine messages
+### Require approval for cross-machine messages
Set [`isolatePeerMachines`](</docs/en/settings-reference#isolatepeermachines>) to `true` to require your explicit approval before any `SendMessage` reaches a session beyond this machine:
@@ -275,11 +207,7 @@
With this set, Claude Code asks for your approval before Claude’s message to a session beyond this machine leaves, even in `bypassPermissions` mode, which skips ordinary permission prompts. A `true` from any settings scope applies, so a checked-in project file can turn the requirement on but not off. Claude Code doesn’t prompt for messages between sessions on the same machine.
-###
-
-
-
-Turn off cross-session messaging
+### Turn off cross-session messaging
Receiving and sending are separate controls, so turn off whichever direction you need, or both. Use `crossSessionInbound` for messages that arrive, and permission rules for what Claude here can send or list:
@@ -297,11 +225,7 @@
With this in place, Claude Code still binds each session’s inbox socket, but drops every message that arrives on it without delivering anything to Claude. Denying `SendMessage` also removes messaging to subagents and agent-team teammates, since the same tool serves both. A refusing session shows no visible change, in its own `/status` or in the listings of other sessions on the same machine, so to confirm it, check the settings files that apply to that session rather than its status.
-##
-
-
-
-Availability
+## Availability
Cross-session messaging requires Claude Code v2.1.224 or later on macOS, Linux, and WSL 2, and v2.1.234 or later on native Windows. Availability, and which sessions Claude can message, also depend on your operating system, provider, and configuration:
@@ -323,11 +247,7 @@
In a session with messaging, `/status` also shows a `Peer address` row with the session’s own inbox address, or `unavailable` and the reason when Claude Code couldn’t set up an inbox.
-##
-
-
-
-Limitations
+## Limitations
The limits here are properties of the messaging channel itself and apply wherever the feature runs. For platform and provider gaps, see Availability instead.
@@ -336,11 +256,7 @@
* **Rapid bursts to one session are refused at the sender** : once a rapid burst of messages to a session on this machine reaches what that session’s inbox accepts, Claude Code refuses further sends in the sending session. The [refusal names the burst](</docs/en/errors#too-many-messages-to-this-session-just-now>) and tells Claude to batch the rest into one message or wait.
* **Message loops are throttled** : in the receiving session, Claude Code rate-limits repeated messages per sender, drops identical repeats arriving within a short window, and queues at most 50 accepted messages for Claude to read. A message loop between two sessions therefore stops on its own.
-##
-
-
-
-Related resources
+## Related resources
* [Subagents](</docs/en/sub-agents#resume-subagents>) and [agent teams](</docs/en/agent-teams#messages-between-agents>): messaging within a single session or team
* [Background agents](</docs/en/agent-view>): dispatch and monitor the parallel sessions you might message
--- a/cross-session-messaging.md
+++ b/cross-session-messaging.md
@@ -46,7 +46,7 @@
Message delivery
-The receiving Claude reads the message between tool calls during an active turn, so a running tool is never interrupted. When the receiving session is idle, Claude Code starts a new turn with the message. A message from another session arrives as plain text. If it mentions a file or an [MCP resource](</docs/en/mcp#use-mcp-resources>) with `@`, Claude sees the mention as written and Claude Code attaches nothing, whether the message starts a new turn or arrives during one. Claude can still open a mentioned path on the receiving machine with its own tools, subject to that session’s permissions. Claude Code refuses a message in the following cases:
+The receiving Claude reads the message between tool calls during an active turn. When the receiving session is idle, Claude Code starts a new turn with the message. A message from another session arrives as plain text. If it mentions a file or an [MCP resource](</docs/en/mcp#use-mcp-resources>) with `@`, Claude sees the mention as written and Claude Code attaches nothing, whether the message starts a new turn or arrives during one. Claude can still open a mentioned path on the receiving machine with its own tools, subject to that session’s permissions. Claude Code refuses a message in the following cases:
* The message is over the size cap. Claude Code refuses it in the sending session, before it leaves.
* A rapid burst to a session on this machine has reached what that session’s inbox accepts. Claude Code refuses further messages to that session.
--- a/cross-session-messaging.md
+++ b/cross-session-messaging.md
@@ -177,7 +177,7 @@
When a message arrives, Claude Code shows it in the conversation as a dim one-line preview, and the preview line stays in the conversation afterward. The preview carries the sender’s name and the first line of the message, cut with `…` when it’s long, such as `› Message from @api-worker: Schema migration finished (ctrl+o to expand)`. Any of these shows you the full text:
- * Press `Ctrl+O` to open the [transcript viewer](</docs/en/interactive-mode#transcript-viewer>) and read the full text under the sender’s session name.
+ * Press `Ctrl+O` to open the [transcript viewer](</docs/en/interactive-mode#transcript-viewer>) and read the full text under the sender’s session name. If Claude is busy and hasn’t received the message yet, scroll to the end of the transcript, where the message is listed under `Waiting to be delivered`. Requires Claude Code v2.1.309 or later.
* In [fullscreen rendering](</docs/en/fullscreen#use-the-mouse>), click a preview line that leaves part of the message out to expand it in place.
* In a session started with [`--verbose`](</docs/en/cli-reference#cli-flags>), Claude Code shows the full text instead of the preview.
--- a/cross-session-messaging.md
+++ b/cross-session-messaging.md
@@ -59,7 +59,7 @@
* **Held** : Claude Code sets the message aside undelivered. A held message reaches Claude only when you approve it or a later mode or settings change allows it.
* **Refused** : Claude Code drops the message without delivering it.
-Once delivered, the message counts toward [usage](</docs/en/costs>) like a prompt you type, and the receiving Claude can reply to the sender the same way, except in the one-way cross-machine case. Permission boundaries stay per-session. Claude is instructed never to ask another session for an action that was denied or blocked in its own session, or that its own permission settings would block, and to route that work back to you instead. On the receiving side, the receiving session’s own permission prompts and rules still apply to anything the message asks for.
+Once delivered, the message counts toward [usage](</docs/en/costs>) like a prompt you type. The receiving Claude can reply to the sender with `SendMessage`, except in the cases under Replies from other machines and cloud sessions and Turn off cross-session messaging. Permission boundaries stay per-session. Claude is instructed never to ask another session for an action that was denied or blocked in its own session, or that its own permission settings would block, and to route that work back to you instead. On the receiving side, the receiving session’s own permission prompts and rules still apply to anything the message asks for.
###
@@ -146,7 +146,15 @@
* **`offline`** : that session’s Remote Control connection has dropped. The message goes through, but arrives only after that session’s machine reconnects.
* **`can't receive cross-session messages (off in that session)`** : messaging isn’t available in that session, or its [`crossSessionInbound`](</docs/en/settings-reference#crosssessioninbound>) value is `refuse`. Claude Code refuses a message to that session before the message leaves this machine. The result under Claude’s `SendMessage` call begins `Not sent` and names the reason. Once the cause is fixed in that session, a later listing no longer shows this condition, and Claude can message that session.
-A session inside a container and a session on the host can’t reach each other. Two sessions inside the same container can still message each other, including on a [self-hosted runner](</docs/en/self-hosted-environments>). A session inside WSL 2 and a native Windows session on the same computer can’t reach each other either. If this session isn’t connected to Remote Control when Claude sends to a session beyond this machine, the message still goes through, but without a reply address, so the receiving Claude can’t answer it. To require your approval before any message goes beyond this machine, set `isolatePeerMachines`.
+A session inside a container and a session on the host can’t reach each other. Two sessions inside the same container can still message each other, including on a [self-hosted runner](</docs/en/self-hosted-environments>). A session inside WSL 2 and a native Windows session on the same computer can’t reach each other either. To require your approval before any message goes beyond this machine, set `isolatePeerMachines`.
+
+####
+
+
+
+Replies from other machines and cloud sessions
+
+A [cloud session](</docs/en/claude-code-on-the-web>), including one on a [self-hosted runner](</docs/en/self-hosted-environments>), can’t use `SendMessage` to answer a message from another machine, even when the message carries a reply address. The message still arrives. Read the cloud session’s response in its transcript at [claude.ai/code](<https://claude.ai/code>). If this session isn’t connected to Remote Control when Claude sends to a session beyond this machine, the message still goes through, but without a reply address. The receiving Claude can’t answer it.
##
@@ -218,7 +226,7 @@
* **Before the deadline** : if a mode or settings change allows the message, Claude Code delivers it.
* **Past the deadline** : Claude Code drops the message and reports it as expired to a sender it can reach.
-Set `dialogExpiry` to `"never"` to keep default-held messages until the session ends. A message held by an explicit `hold` setting doesn’t expire; Claude Code delivers it only when an `accept` later applies. To let a `-p` worker take messages unattended, start it with `crossSessionInbound` set to `accept` in its `--settings` value. An `accept` in your user settings also works but applies to every session you run.
+Set `dialogExpiry` to `"never"` to keep default-held messages until the session ends. A message held by an explicit `hold` setting doesn’t expire; Claude Code delivers it when an `accept` later applies. To let a `-p` worker take messages unattended, start it with `crossSessionInbound` set to `accept` in its `--settings` value. An `accept` in your user settings also works but applies to every session you run.
###
--- a/cross-session-messaging.md
+++ b/cross-session-messaging.md
@@ -122,7 +122,7 @@
* **Session names** : it leaves out any session name it can’t attribute to a person, so a row left with no name reads `(unnamed session)`.
* **The first line** : it leaves out the line with this session’s own name unless you typed that name at this terminal, with `--name` or with `/rename` and the name, since you launched or last resumed the session.
-When the output lists anything, it ends with a note saying details were withheld. Running `/rename` followed by an unused name at a session’s own keyboard gives that session a name that appears in the output. A session answers to the name you set with the [`/rename`](</docs/en/commands>) command or the [`--name`](</docs/en/cli-reference#cli-flags>) flag. When you don’t set one, Claude Code names the session itself. For an interactive session, that is the name shown in [listings of running sessions](</docs/en/sessions#name-your-sessions>). When you rename a session, or start or resume an interactive one, with a name another live session on this machine already uses, Claude Code leaves the name with the session that already has it and [renames yours to a variant](</docs/en/sessions#name-your-sessions>). Sessions can still share a name, for example when one of them runs an earlier version of Claude Code or the shared name is one Claude Code generated. Unless this session is connected to Remote Control, Claude Code shows each local session’s working directory in the `/list-agents` output, so you can tell same-named sessions apart when they run in different directories. Claude addresses the message in one of two ways, depending on how many live sessions answer to the name:
+When the output lists anything, it ends with a note saying details were withheld. Running `/rename` followed by an unused name at a session’s own keyboard gives that session a name that appears in the output. A session answers to the name you set with the [`/rename`](</docs/en/commands>) command or the [`--name`](</docs/en/cli-reference#cli-flags>) flag. When you don’t set one, Claude Code names the session itself. For an interactive session, that is the name shown in [listings of running sessions](</docs/en/sessions#name-your-sessions>). Unless this session is connected to Remote Control, Claude Code shows each local session’s working directory in the `/list-agents` output, so you can tell same-named sessions apart when they run in different directories. Claude addresses the message in one of two ways, depending on how many live sessions answer to the name:
* **One session answers to the name** : Claude Code delivers the message on the name alone.
* **Several sessions share the name, or Claude Code couldn’t check everywhere your sessions run** : Claude adds a short identifier to each row of its listing and uses the identifier in the address.
--- a/cross-session-messaging.md
+++ b/cross-session-messaging.md
@@ -167,9 +167,10 @@
What a message looks like
-When a message arrives, Claude Code shows it in the conversation as a dim one-line preview, and the preview line stays in the conversation afterward. The preview carries the sender’s name and the first line of the message, cut with `…` when it’s long, such as `› Message from @api-worker: Schema migration finished (ctrl+o to expand)`. Either of these shows you the full text:
+When a message arrives, Claude Code shows it in the conversation as a dim one-line preview, and the preview line stays in the conversation afterward. The preview carries the sender’s name and the first line of the message, cut with `…` when it’s long, such as `› Message from @api-worker: Schema migration finished (ctrl+o to expand)`. Any of these shows you the full text:
* Press `Ctrl+O` to open the [transcript viewer](</docs/en/interactive-mode#transcript-viewer>) and read the full text under the sender’s session name.
+ * In [fullscreen rendering](</docs/en/fullscreen#use-the-mouse>), click a preview line that leaves part of the message out to expand it in place.
* In a session started with [`--verbose`](</docs/en/cli-reference#cli-flags>), Claude Code shows the full text instead of the preview.
The preview shortens only what you see. Whether or not you expand it, Claude reads the full message. Claude receives the message with the sender’s name and a reply address, except for a one-way cross-machine message, which carries no reply address. This example is a message one Claude wrote to another, as its full text reads when you expand it:
--- a/cross-session-messaging.md
+++ b/cross-session-messaging.md
@@ -196,7 +196,7 @@
* **The receiving session prompts for permissions** : Claude Code delivers each message. It holds one for your approval only when the sending session identifies itself as bypassing permission prompts.
* **The receiving session bypasses permission prompts** : Claude Code holds each message for your approval. It delivers one only when the sending session identifies itself as also bypassing.
-When the default holds a message, Claude Code opens an approval dialog in the receiving session. The dialog shows the sender and a preview:
+When the default holds a message in an interactive terminal session, Claude Code opens an approval dialog there. The dialog shows the sender and a preview:
* **Approve** delivers that one message to Claude.
* **Deny** , or dismissing the dialog, drops it.
@@ -204,7 +204,7 @@
* While no terminal is attached to a [background session](</docs/en/agent-view>), Claude Code leaves the dialog open past the deadline. After you attach, if the dialog stays unanswered for a full deadline period, Claude Code closes it and drops the message.
* If this session’s permission-mode class changes while messages are held, Claude Code re-applies the inbound rules, delivers the messages they now accept, and shows a notice.
-Claude Code holds at most 100 messages, and past that drops the oldest.
+A session in the VS Code extension or the Desktop app can’t show the dialog. Claude Code keeps a held message there until the same deadline, as Non-interactive sessions describes. Claude Code holds at most 100 messages, and past that drops the oldest.
###
--- a/cross-session-messaging.md
+++ b/cross-session-messaging.md
@@ -50,6 +50,7 @@
* The message is over the size cap. Claude Code refuses it in the sending session, before it leaves.
* A rapid burst to a session on this machine has reached what that session’s inbox accepts. Claude Code refuses further messages to that session.
+ * A session beyond this machine is listed as unable to receive cross-session messages. Claude Code refuses the message in the sending session, before it leaves this machine.
* The reply target on this machine fails a safety check, such as a symlinked target. [Refusing to send a cross-session message](</docs/en/errors#refusing-to-send-a-cross-session-message>) lists these checks.
The receiving session checks each arriving message against its own inbound controls, and the check ends in one of three outcomes:
@@ -140,7 +141,12 @@
On another of your machines| Through Anthropic servers, arriving over that machine’s [Remote Control](</docs/en/remote-control>) connection
In the [cloud](</docs/en/claude-code-on-the-web>)| Through Anthropic servers, straight to the cloud session
-Starting a conversation with a session on another of your machines requires Claude Code v2.1.225 or later and a target that appears in the listing. You can message a session shown as `offline` in the listing, one whose Remote Control connection has dropped. The send goes through, but the message arrives only after that session’s machine reconnects. A session inside a container and a session on the host can’t reach each other. Two sessions inside the same container can still message each other, including on a [self-hosted runner](</docs/en/self-hosted-environments>). A session inside WSL 2 and a native Windows session on the same computer can’t reach each other either. If this session isn’t connected to Remote Control when Claude sends to a session beyond this machine, the message still goes through, but without a reply address, so the receiving Claude can’t answer it. To require your approval before any message goes beyond this machine, set `isolatePeerMachines`.
+Starting a conversation with a session on another of your machines requires Claude Code v2.1.225 or later and a target that appears in the listing. A session’s row in the listing can show a condition that changes what happens when Claude messages that session:
+
+ * **`offline`** : that session’s Remote Control connection has dropped. The message goes through, but arrives only after that session’s machine reconnects.
+ * **`can't receive cross-session messages (off in that session)`** : messaging isn’t available in that session, or its [`crossSessionInbound`](</docs/en/settings-reference#crosssessioninbound>) value is `refuse`. Claude Code refuses a message to that session before the message leaves this machine. The result under Claude’s `SendMessage` call begins `Not sent` and names the reason. Once the cause is fixed in that session, a later listing no longer shows this condition, and Claude can message that session.
+
+A session inside a container and a session on the host can’t reach each other. Two sessions inside the same container can still message each other, including on a [self-hosted runner](</docs/en/self-hosted-environments>). A session inside WSL 2 and a native Windows session on the same computer can’t reach each other either. If this session isn’t connected to Remote Control when Claude sends to a session beyond this machine, the message still goes through, but without a reply address, so the receiving Claude can’t answer it. To require your approval before any message goes beyond this machine, set `isolatePeerMachines`.
##
@@ -303,6 +309,7 @@
* **Cloud session missing** : a cloud session appears only while this session is connected to [Remote Control](</docs/en/remote-control>).
* **Other-machine session missing** : a session on another of your machines appears only when it runs with [Remote Control](</docs/en/remote-control>) and this session is connected as well.
* **Other-machine session`offline`**: a message to a session listed as `offline` goes through, but arrives only after that session’s machine reconnects.
+ * **Cloud or other-machine session`can't receive cross-session messages`**: a message to a session listed with this condition doesn’t leave this machine, and the result under `SendMessage` begins `Not sent`.
* **Older cloud or other-machine session missing** : Claude Code reads those session lists newest first and stops after a bounded number of pages, so Claude can’t message a session that fell past them by name.
In a session with messaging, `/status` also shows a `Peer address` row with the session’s own inbox address, or `unavailable` and the reason when Claude Code couldn’t set up an inbox.
--- a/cross-session-messaging.md
+++ b/cross-session-messaging.md
@@ -50,7 +50,7 @@
* The message is over the size cap. Claude Code refuses it in the sending session, before it leaves.
* A rapid burst to a session on this machine has reached what that session’s inbox accepts. Claude Code refuses further messages to that session.
- * The reply target on this machine fails a safety check, such as a symlinked target or an endpoint that isn’t the expected process. [Refusing to send a cross-session message](</docs/en/errors#refusing-to-send-a-cross-session-message>) lists these checks.
+ * The reply target on this machine fails a safety check, such as a symlinked target. [Refusing to send a cross-session message](</docs/en/errors#refusing-to-send-a-cross-session-message>) lists these checks.
The receiving session checks each arriving message against its own inbound controls, and the check ends in one of three outcomes:
Show diff (165 lines)
--- a/cross-session-messaging.md
+++ b/cross-session-messaging.md
@@ -1,6 +1,6 @@
Cross-session messaging requires Claude Code v2.1.224 or later on macOS and Linux, including Linux inside WSL 2. On native Windows, it requires Claude Code v2.1.234 or later. When a session meets the requirements, messaging is on with nothing to enable. See Availability for provider requirements and how to confirm a session has it.
-Cross-session messaging lets Claude deliver a message from one of your Claude Code sessions to another. When a change in one session breaks what another is building on, Claude can warn that session before you notice. When one session settles a question another is blocked on, Claude can send the answer across. A message is a piece of text one Claude writes to another, never the sender’s conversation history or files. To move a whole conversation or its context, [resume the session](</docs/en/sessions#resume-a-session>) instead. Claude uses two tools for this: `ListAgents` to discover which agents it can reach, and `SendMessage` to deliver a message to one of them by name. With the same `SendMessage` tool, Claude can also message [subagents](</docs/en/sub-agents#resume-subagents>) and [agent team](</docs/en/agent-teams>) teammates within a single session or team. This page covers messages between your independent sessions.
+Cross-session messaging lets Claude deliver a message from one of your Claude Code sessions to another. When a change in one session breaks what another is building on, Claude can warn that session before you notice. When one session settles a question another is blocked on, Claude can send the answer across. A message is a piece of text one Claude writes to another, never the sender’s conversation history or files. To move a whole conversation or its context, [resume the session](</docs/en/sessions#resume-a-session>) instead.
##
@@ -15,14 +15,6 @@
* **Get status from long-running work** : have a migration or test run report back to the session you’re watching, or ask it yourself from there. If that session is on this machine, Claude can also ask it for one notice when it next goes idle or exits.
* **Message across machines** : reach one of your sessions on another machine or in the cloud.
-Use messaging between independent sessions that you start and steer yourself. Claude Code has a dedicated feature for each of the other ways to run or reach multiple sessions, so use the one built for what you’re doing instead:
-
- * To continue one conversation in another terminal, or share its context with a new session, [resume the session](</docs/en/sessions#resume-a-session>)
- * For a coordinated team of sessions Claude spawns and supervises, use [agent teams](</docs/en/agent-teams>)
- * To watch and steer many sessions from one place, use [agent view](</docs/en/agent-view>)
- * To steer a session yourself from your phone or another device, rather than have sessions message each other, use [Remote Control](</docs/en/remote-control>)
- * To push external events, such as CI results or chat messages, into a session, use [channels](</docs/en/channels>)
-
##
@@ -54,12 +46,11 @@
Message delivery
-The receiving Claude reads the message between tool calls during an active turn, so a running tool is never interrupted. When the receiving session is idle, Claude Code starts a new turn with the message. A message from another session arrives as plain text. If it mentions a file or an [MCP resource](</docs/en/mcp#use-mcp-resources>) with `@`, Claude sees the mention as written and Claude Code attaches nothing, whether the message starts a new turn or arrives during one. Claude can still open a mentioned path on the receiving machine with its own tools, subject to that session’s permissions. Before v2.1.251, an `@` mention in a message that started a new turn attached the file or MCP resource on the receiving side. Claude Code refuses a message in the following cases:
+The receiving Claude reads the message between tool calls during an active turn, so a running tool is never interrupted. When the receiving session is idle, Claude Code starts a new turn with the message. A message from another session arrives as plain text. If it mentions a file or an [MCP resource](</docs/en/mcp#use-mcp-resources>) with `@`, Claude sees the mention as written and Claude Code attaches nothing, whether the message starts a new turn or arrives during one. Claude can still open a mentioned path on the receiving machine with its own tools, subject to that session’s permissions. Claude Code refuses a message in the following cases:
* The message is over the size cap. Claude Code refuses it in the sending session, before it leaves.
* A rapid burst to a session on this machine has reached what that session’s inbox accepts. Claude Code refuses further messages to that session.
* The reply target on this machine fails a safety check, such as a symlinked target or an endpoint that isn’t the expected process. [Refusing to send a cross-session message](</docs/en/errors#refusing-to-send-a-cross-session-message>) lists these checks.
- * Claude addresses the message to this session’s own name, as described under See which sessions Claude can reach.
The receiving session checks each arriving message against its own inbound controls, and the check ends in one of three outcomes:
@@ -103,12 +94,12 @@
Limits
-The notice is one-shot: Claude Code sends it once from the watched session, and neither session polls the other. If no notice arrives within 12 hours, Claude Code drops the subscription and tells Claude, so it doesn’t keep waiting. Each side’s inbound controls apply to a notice like a message:
+If no notice arrives within 12 hours, Claude Code drops the subscription and tells Claude, so it doesn’t keep waiting. Each side’s inbound controls apply to a notice like a message:
* **`refuse` on either side**: nothing arrives. The watched session drops the request without recording or answering it, so the subscription expires unanswered after 12 hours, and an asking session with `refuse` never subscribes.
* **`hold` on either side**: the notice arrives with less. The watched session leaves the one-line status out, and the asking session shows the notice in your transcript without delivering it to Claude.
-Only the Claude in your main conversation can subscribe, and only to your sessions on this machine. When a subagent or an agent team teammate sets `notify_when_idle`, Claude Code makes no subscription and tells it so. When Claude asks for a notice from any other agent, such as a teammate, a subagent, or a session beyond this machine, Claude Code refuses the whole call, including any message attached to it, and reports the refusal to Claude so it can resend the message without the request.
+Only the Claude in your main conversation can subscribe, and only to your sessions on this machine. When Claude asks for a notice from any other target, such as a teammate, a subagent, or a session beyond this machine, Claude Code refuses the whole call, including any message attached to it.
###
@@ -119,18 +110,18 @@
Claude finds a message’s target on its own, so you don’t need to run anything before asking it to send. To see for yourself which sessions Claude can reach, run the `/list-agents` command. The first line, when present, is this session’s own name, the one your other sessions use to message it. The rows below it are the sessions Claude can reach:
* **Subagents** : agents running inside the current session.
- * **Teammates** : this session’s own [agent team](</docs/en/agent-teams>) teammates. Before v2.1.239, teammates didn’t appear in the listing, though Claude could already message them by name.
+ * **Teammates** : this session’s own [agent team](</docs/en/agent-teams>) teammates.
* **Your other local sessions** : Claude Code sessions running on the same machine, including [background sessions](</docs/en/agent-view>). A session appears only when it binds an inbox socket.
- * **Your[cloud sessions](</docs/en/claude-code-on-the-web>)**: shown while this session is connected to [Remote Control](</docs/en/remote-control>). Claude Code labels them `cloud` in the listing.
+ * **Your[cloud sessions](</docs/en/claude-code-on-the-web>)**: shown while this session is connected to [Remote Control](</docs/en/remote-control>).
* **Your Remote Control sessions on other machines** : shown while this session is connected to [Remote Control](</docs/en/remote-control>), and labeled `Remote Control`. Claude Code shows `offline` as the status of a session whose Remote Control connection has dropped.
-This session isn’t one of the rows. If Claude addresses a message to this session’s own name, Claude Code refuses it and tells Claude the target is the current session. Before v2.1.239, the listing didn’t show this session’s name, and Claude Code reported a message sent to it as an agent it couldn’t find. While this session is connected to [Remote Control](</docs/en/remote-control>), Claude Code withholds some details of your local sessions from the `/list-agents` output, without changing what Claude itself sees when it looks for a session to message:
+While this session is connected to [Remote Control](</docs/en/remote-control>), Claude Code withholds some details of your local sessions from the `/list-agents` output, without changing what Claude itself sees when it looks for a session to message:
* **Working directories** : it leaves out each local session’s working directory.
* **Session names** : it leaves out any session name it can’t attribute to a person, so a row left with no name reads `(unnamed session)`.
* **The first line** : it leaves out the line with this session’s own name unless you typed that name at this terminal, with `--name` or with `/rename` and the name, since you launched or last resumed the session.
-When the output lists anything, it ends with a note saying details were withheld. Running `/rename` followed by an unused name at a session’s own keyboard gives that session a name that appears in the output. Claude Code reads your cloud and Remote Control session lists newest first and stops after a bounded number of pages for each. If your account has more of those sessions than fit, Claude Code doesn’t list the older ones, and Claude can’t message them by name. When this happens, Claude Code says so in the listing, and Claude sees the same note when it sends a message. Claude addresses a session beyond this machine by name, the same as a local session. See Message sessions on other machines for how those messages travel. A session answers to the name you set with the [`/rename`](</docs/en/commands>) command or the [`--name`](</docs/en/cli-reference#cli-flags>) flag. When you don’t set one, Claude Code names the session itself. For an interactive session, that is the name shown in [listings of running sessions](</docs/en/sessions#name-your-sessions>). When you rename a session, Claude Code also updates the shared record your other sessions use to look up the session’s name. If it can’t update that record, it warns you in the `/rename` output that other sessions may still show the old name. Run the session with [`--debug`](</docs/en/cli-reference#cli-flags>), and Claude Code logs the cause of the failed update. When you rename a session, or start or resume an interactive one, with a name another live session on this machine already uses, Claude Code leaves the name with the session that already has it and [renames yours to a variant](</docs/en/sessions#name-your-sessions>). Sessions can still share a name, for example when one of them runs an earlier version of Claude Code or the shared name is one Claude Code generated. Unless this session is connected to Remote Control, Claude Code shows each local session’s working directory in the `/list-agents` output, so you can tell same-named sessions apart when they run in different directories. Claude addresses the message in one of two ways, depending on how many live sessions answer to the name:
+When the output lists anything, it ends with a note saying details were withheld. Running `/rename` followed by an unused name at a session’s own keyboard gives that session a name that appears in the output. A session answers to the name you set with the [`/rename`](</docs/en/commands>) command or the [`--name`](</docs/en/cli-reference#cli-flags>) flag. When you don’t set one, Claude Code names the session itself. For an interactive session, that is the name shown in [listings of running sessions](</docs/en/sessions#name-your-sessions>). When you rename a session, or start or resume an interactive one, with a name another live session on this machine already uses, Claude Code leaves the name with the session that already has it and [renames yours to a variant](</docs/en/sessions#name-your-sessions>). Sessions can still share a name, for example when one of them runs an earlier version of Claude Code or the shared name is one Claude Code generated. Unless this session is connected to Remote Control, Claude Code shows each local session’s working directory in the `/list-agents` output, so you can tell same-named sessions apart when they run in different directories. Claude addresses the message in one of two ways, depending on how many live sessions answer to the name:
* **One session answers to the name** : Claude Code delivers the message on the name alone.
* **Several sessions share the name, or Claude Code couldn’t check everywhere your sessions run** : Claude adds a short identifier to each row of its listing and uses the identifier in the address.
@@ -149,7 +140,7 @@
On another of your machines| Through Anthropic servers, arriving over that machine’s [Remote Control](</docs/en/remote-control>) connection
In the [cloud](</docs/en/claude-code-on-the-web>)| Through Anthropic servers, straight to the cloud session
-Starting a conversation with a session on another of your machines requires Claude Code v2.1.225 or later and a target that appears in the listing. Before v2.1.225, Claude could only reply to a message that arrived from one. You can message a session shown as `offline` in the listing, one whose Remote Control connection has dropped. The send goes through, but the message arrives only after that session’s machine reconnects. Claude is told as much when it sends. Same-machine delivery works wherever the feature is enabled. Each session registers itself in files on disk. When Claude lists or messages your local sessions, Claude Code reads those files to find the sessions, so two sessions can reach each other only when they can see the same files. A container has its own filesystem, so a session inside it and a session on the host can’t reach each other. Two sessions inside the same container can still message each other, including on a [self-hosted runner](</docs/en/self-hosted-environments>). A session inside WSL 2 and a native Windows session on the same computer can’t reach each other either, because they register under different home directories and listen on different socket types. While this session is connected to Remote Control, when you message a session on another of your machines, Claude Code shows the message in that session’s conversation under this session’s Remote Control name. The Claude on that machine can reply to that name. For example, when this session is connected to Remote Control as `laptop-graceful-unicorn` and you message your desktop, you see the message in the desktop session under `laptop-graceful-unicorn`. If this session isn’t connected to Remote Control when Claude sends to a session beyond this machine, the message still goes through, but without a reply address, so the receiving Claude can’t answer it. Claude is told as much when it sends. To require your approval before any message goes beyond this machine, set `isolatePeerMachines`.
+Starting a conversation with a session on another of your machines requires Claude Code v2.1.225 or later and a target that appears in the listing. You can message a session shown as `offline` in the listing, one whose Remote Control connection has dropped. The send goes through, but the message arrives only after that session’s machine reconnects. A session inside a container and a session on the host can’t reach each other. Two sessions inside the same container can still message each other, including on a [self-hosted runner](</docs/en/self-hosted-environments>). A session inside WSL 2 and a native Windows session on the same computer can’t reach each other either. If this session isn’t connected to Remote Control when Claude sends to a session beyond this machine, the message still goes through, but without a reply address, so the receiving Claude can’t answer it. To require your approval before any message goes beyond this machine, set `isolatePeerMachines`.
##
@@ -170,12 +161,12 @@
What a message looks like
-When a message arrives, Claude Code shows it in the conversation as a dim one-line preview, and the preview line stays in the conversation afterward. The preview carries the sender’s name and the first line of the message, cut with `…` when it’s long, such as `› Message from @api-worker: Schema migration finished (ctrl+o to expand)`. Before v2.1.247, Claude Code showed the arriving message in full instead of a preview. Either of these shows you the full text:
+When a message arrives, Claude Code shows it in the conversation as a dim one-line preview, and the preview line stays in the conversation afterward. The preview carries the sender’s name and the first line of the message, cut with `…` when it’s long, such as `› Message from @api-worker: Schema migration finished (ctrl+o to expand)`. Either of these shows you the full text:
* Press `Ctrl+O` to open the [transcript viewer](</docs/en/interactive-mode#transcript-viewer>) and read the full text under the sender’s session name.
* In a session started with [`--verbose`](</docs/en/cli-reference#cli-flags>), Claude Code shows the full text instead of the preview.
-The preview shortens only what you see. Whether or not you expand it, Claude reads the full message. Claude receives the message with the sender’s name and a reply address, except for a one-way cross-machine message, which carries no reply address. Beyond the name and reply address, the receiving Claude gets the message’s text, never the sender’s conversation history or files. Message delivery covers `@` mentions in the text. A message that a [subagent](</docs/en/sub-agents>) wrote arrives under the sending session’s name, with the subagent identified in the message text. A reply to it reaches that session’s main conversation, not the subagent. This example is a message one Claude wrote to another, as its full text reads when you expand it:
+The preview shortens only what you see. Whether or not you expand it, Claude reads the full message. Claude receives the message with the sender’s name and a reply address, except for a one-way cross-machine message, which carries no reply address. This example is a message one Claude wrote to another, as its full text reads when you expand it:
Schema migration finished
The new column is tenant_id, and rebasing on main is safe now.
@@ -206,9 +197,8 @@
* When the dialog stays unanswered past the [`dialogExpiry`](</docs/en/settings-reference#dialogexpiry>) deadline, Claude Code closes it and drops the message. The deadline defaults to five minutes.
* While no terminal is attached to a [background session](</docs/en/agent-view>), Claude Code leaves the dialog open past the deadline. After you attach, if the dialog stays unanswered for a full deadline period, Claude Code closes it and drops the message.
* If this session’s permission-mode class changes while messages are held, Claude Code re-applies the inbound rules, delivers the messages they now accept, and shows a notice.
- * If a settings change makes `refuse` apply while messages are held, Claude Code drops every held message and reports a refusal to each sender it can reach.
-
-When the sender is a session on the same machine, Claude Code sends a notice back to it when the receiver holds the message, and a follow-up when the receiver later delivers, denies, or expires it. The notice reaches the sending Claude, so it knows not to keep waiting on a message the other session hasn’t read. In an interactive sending session, the notice appears in the transcript. A [`claude -p`](</docs/en/headless>) sender receives it in [streamed output](</docs/en/headless#stream-responses>) as an [informational `system` message](</docs/en/agent-sdk/typescript#sdkinformationalmessage>). Notices to `claude -p` senders require Claude Code v2.1.271 or later. If the receiver refuses the message, the sender’s notice says the receiver isn’t accepting cross-session messages and tells the sender’s Claude not to wait or resend. Claude Code holds at most 100 messages, separately from the delivery queue, and past that drops the oldest.
+
+Claude Code holds at most 100 messages, and past that drops the oldest.
###
@@ -221,7 +211,7 @@
* **Before the deadline** : if a mode or settings change allows the message, Claude Code delivers it.
* **Past the deadline** : Claude Code drops the message and reports it as expired to a sender it can reach.
-Set `dialogExpiry` to `"never"` to keep default-held messages until the session ends. A message held by an explicit `hold` setting doesn’t expire; Claude Code delivers it only when an `accept` later applies. When the session ends with messages still held, Claude Code reports them as expired to each sender it can reach. Before v2.1.225, no deadline applied in a `-p` session: a held message stayed held unless a permission-mode change during the run delivered it, and a session that ended with held messages reported nothing to their senders. To let a `-p` worker take messages unattended, start it with `crossSessionInbound` set to `accept` in its `--settings` value. An `accept` in your user settings also works but applies to every session you run.
+Set `dialogExpiry` to `"never"` to keep default-held messages until the session ends. A message held by an explicit `hold` setting doesn’t expire; Claude Code delivers it only when an `accept` later applies. To let a `-p` worker take messages unattended, start it with `crossSessionInbound` set to `accept` in its `--settings` value. An `accept` in your user settings also works but applies to every session you run.
###
@@ -234,14 +224,13 @@
* `/status` shows it in the `Peer address` row. The path is prefixed with `uds:`.
* Claude Code exports it to [hooks](</docs/en/hooks>) and Bash commands as the [`CLAUDE_CODE_MESSAGING_SOCKET`](</docs/en/env-vars#variables>) environment variable:
* In a session that starts with messaging on, Claude Code exports the variable before any hook runs, including `SessionStart`.
- * Each session exports its own socket, never one inherited from a parent session.
On macOS and Linux, Claude Code restricts the socket to your operating-system user. On native Windows, it instead requires each connection to authenticate first with a key that only your operating-system user can read. Either way, on a shared machine another user’s sessions can’t deliver to it. On macOS and Linux, Claude Code also refuses to create the socket in a directory it can’t accept, for example one that another user owns, and uses a private per-user directory, `/tmp/cc-socks-<uid>`, instead. When it can’t accept any directory, the session runs without an inbox: Claude Code shows a notice, `/status` shows `unavailable` and the reason in its `Peer address` row, and the [`--debug`](</docs/en/cli-reference#cli-flags>) log records the full refusal. Alongside the socket’s path, Claude Code exports a per-session token as [`CLAUDE_CODE_MESSAGING_TOKEN`](</docs/en/env-vars#variables>). A script posting to its own session’s socket can send `{"type":"auth","token":"<token>"}` as the first line of its connection, where `<token>` is the value of `CLAUDE_CODE_MESSAGING_TOKEN`. Whether Claude Code requires the line depends on the platform:
* **macOS and Linux, including WSL 2** : the line is optional. Claude Code accepts a connection with or without it.
* **Native Windows** : the line is required. Claude Code closes any connection whose first line isn’t a valid auth line and delivers nothing from that connection.
-Open the connection only when the message you’re posting is ready. Claude Code closes a connection that hasn’t sent a complete line within 30 seconds, so capture a slow command’s output first and then open the connection to send it. The own-child rules below say when Claude Code consults the token and how it treats a message it can’t verify. Claude Code runs messages arriving on the socket through the same inbound controls as any other peer message, with one exception and one prerequisite:
+Open the connection only when the message you’re posting is ready. Claude Code closes a connection that hasn’t sent a complete line within 30 seconds, so capture a slow command’s output first and then open the connection to send it. Claude Code runs messages arriving on the socket through the same inbound controls as any other peer message, with one exception and one prerequisite:
* **Own-child messages** : when no `crossSessionInbound` value applies, Claude Code delivers a message it verifies came from the session’s own child processes, such as a hook or Bash command posting back to its own session’s socket.
* On Linux, including inside WSL 2, Claude Code can verify by process evidence even for a child that has already exited. On macOS it can verify that way only while the posting process is still running, and in a container where Claude Code runs as process ID 1 it has no process evidence at all. On native Windows it also has none.
@@ -315,7 +304,6 @@
* **Other-machine session missing** : a session on another of your machines appears only when it runs with [Remote Control](</docs/en/remote-control>) and this session is connected as well.
* **Other-machine session`offline`**: a message to a session listed as `offline` goes through, but arrives only after that session’s machine reconnects.
* **Older cloud or other-machine session missing** : Claude Code reads those session lists newest first and stops after a bounded number of pages, so Claude can’t message a session that fell past them by name.
- * **Starting a conversation** : Message sessions on other machines covers starting a conversation with a session beyond this machine.
In a session with messaging, `/status` also shows a `Peer address` row with the session’s own inbox address, or `unavailable` and the reason when Claude Code couldn’t set up an inbox.
@@ -329,8 +317,8 @@
* **Plain text only** : Claude sends only plain text across sessions. Structured [agent team](</docs/en/agent-teams>) protocol messages stay within a team.
* **Same-machine message size is capped** : Claude Code refuses a message to a session on this machine once its serialized form passes about a million characters. The refusal [names the exact sizes](</docs/en/errors#message-too-large-for-cross-session-delivery>). Nothing reaches the receiving session.
- * **Rapid bursts to one session are refused at the sender** : once a rapid burst of messages to a session on this machine reaches what that session’s inbox accepts, Claude Code refuses further sends in the sending session. The [refusal names the burst](</docs/en/errors#too-many-messages-to-this-session-just-now>) and tells Claude to batch the rest into one message or wait. Before v2.1.236, Claude Code reported those sends as sent while the receiving session dropped them.
- * **Message loops are throttled** : in the receiving session, Claude Code rate-limits repeated messages per sender, drops identical repeats arriving within a short window, and queues at most 50 accepted messages for Claude to read. A message loop between two sessions therefore stops on its own. When the rate limit, repeat check, or queue cap drops a message from an interactive session on this machine, Claude Code tells that session which one dropped it and tells its Claude not to resend right away.
+ * **Rapid bursts to one session are refused at the sender** : once a rapid burst of messages to a session on this machine reaches what that session’s inbox accepts, Claude Code refuses further sends in the sending session. The [refusal names the burst](</docs/en/errors#too-many-messages-to-this-session-just-now>) and tells Claude to batch the rest into one message or wait.
+ * **Message loops are throttled** : in the receiving session, Claude Code rate-limits repeated messages per sender, drops identical repeats arriving within a short window, and queues at most 50 accepted messages for Claude to read. A message loop between two sessions therefore stops on its own.
##
@@ -341,6 +329,7 @@
* [Subagents](</docs/en/sub-agents#resume-subagents>) and [agent teams](</docs/en/agent-teams#messages-between-agents>): messaging within a single session or team
* [Background agents](</docs/en/agent-view>): dispatch and monitor the parallel sessions you might message
* [Remote Control](</docs/en/remote-control>): connect this session to reach your sessions on other machines
+ * [Channels](</docs/en/channels>): push external events, such as CI results or chat messages, into a session
* [Settings](</docs/en/settings-reference#all-settings>): `crossSessionInbound`, `isolatePeerMachines`, and `dialogExpiry`
* [Permission modes](</docs/en/permission-modes>): the modes behind the inbound default’s two classes
* [Tools reference](</docs/en/tools-reference>): the `ListAgents` and `SendMessage` rows in the tools table
--- a/cross-session-messaging.md
+++ b/cross-session-messaging.md
@@ -13,7 +13,7 @@
* **Hand over a finding** : when one session discovers a breaking change or makes a decision, Claude summarizes it for the session working on the affected area, instead of you re-explaining it there.
* **Coordinate parallel worktrees** : when sessions work the same repository in separate [worktrees](</docs/en/worktrees>), Claude can tell the other sessions what landed.
* **Get status from long-running work** : have a migration or test run report back to the session you’re watching, or ask it yourself from there. If that session is on this machine, Claude can also ask it for one notice when it next goes idle or exits.
- * **Message across machines** : reach one of your sessions on another machine or on the web.
+ * **Message across machines** : reach one of your sessions on another machine or in the cloud.
Use messaging between independent sessions that you start and steer yourself. Claude Code has a dedicated feature for each of the other ways to run or reach multiple sessions, so use the one built for what you’re doing instead:
@@ -121,7 +121,7 @@
* **Subagents** : agents running inside the current session.
* **Teammates** : this session’s own [agent team](</docs/en/agent-teams>) teammates. Before v2.1.239, teammates didn’t appear in the listing, though Claude could already message them by name.
* **Your other local sessions** : Claude Code sessions running on the same machine, including [background sessions](</docs/en/agent-view>). A session appears only when it binds an inbox socket.
- * **Your cloud sessions** : your [Claude Code on the web](</docs/en/claude-code-on-the-web>) sessions, shown while this session is connected to [Remote Control](</docs/en/remote-control>). Claude Code labels them `cloud` in the listing.
+ * **Your[cloud sessions](</docs/en/claude-code-on-the-web>)**: shown while this session is connected to [Remote Control](</docs/en/remote-control>). Claude Code labels them `cloud` in the listing.
* **Your Remote Control sessions on other machines** : shown while this session is connected to [Remote Control](</docs/en/remote-control>), and labeled `Remote Control`. Claude Code shows `offline` as the status of a session whose Remote Control connection has dropped.
This session isn’t one of the rows. If Claude addresses a message to this session’s own name, Claude Code refuses it and tells Claude the target is the current session. Before v2.1.239, the listing didn’t show this session’s name, and Claude Code reported a message sent to it as an agent it couldn’t find. While this session is connected to [Remote Control](</docs/en/remote-control>), Claude Code withholds some details of your local sessions from the `/list-agents` output, without changing what Claude itself sees when it looks for a session to message:
@@ -147,7 +147,7 @@
---|---
On this machine| Over a per-session socket on macOS and Linux, or a per-session named pipe on native Windows, never through Anthropic servers
On another of your machines| Through Anthropic servers, arriving over that machine’s [Remote Control](</docs/en/remote-control>) connection
-On [Claude Code on the web](</docs/en/claude-code-on-the-web>)| Through Anthropic servers, straight to the cloud session
+In the [cloud](</docs/en/claude-code-on-the-web>)| Through Anthropic servers, straight to the cloud session
Starting a conversation with a session on another of your machines requires Claude Code v2.1.225 or later and a target that appears in the listing. Before v2.1.225, Claude could only reply to a message that arrived from one. You can message a session shown as `offline` in the listing, one whose Remote Control connection has dropped. The send goes through, but the message arrives only after that session’s machine reconnects. Claude is told as much when it sends. Same-machine delivery works wherever the feature is enabled. Each session registers itself in files on disk. When Claude lists or messages your local sessions, Claude Code reads those files to find the sessions, so two sessions can reach each other only when they can see the same files. A container has its own filesystem, so a session inside it and a session on the host can’t reach each other. Two sessions inside the same container can still message each other, including on a [self-hosted runner](</docs/en/self-hosted-environments>). A session inside WSL 2 and a native Windows session on the same computer can’t reach each other either, because they register under different home directories and listen on different socket types. While this session is connected to Remote Control, when you message a session on another of your machines, Claude Code shows the message in that session’s conversation under this session’s Remote Control name. The Claude on that machine can reply to that name. For example, when this session is connected to Remote Control as `laptop-graceful-unicorn` and you message your desktop, you see the message in the desktop session under `laptop-graceful-unicorn`. If this session isn’t connected to Remote Control when Claude sends to a session beyond this machine, the message still goes through, but without a reply address, so the receiving Claude can’t answer it. Claude is told as much when it sends. To require your approval before any message goes beyond this machine, set `isolatePeerMachines`.
@@ -194,7 +194,7 @@
`hold`| Claude Code shows a notice for each message and doesn’t deliver it. If an `accept` later applies, per the [precedence rules](</docs/en/settings-reference#crosssessioninbound>), Claude Code releases the held messages
`refuse`| Claude Code drops each message without delivering it
-Beyond editing a settings file, you can select the value in the `/config` row **Messages from your other sessions**. Claude Code writes the value you select to your user settings. The row requires Claude Code v2.1.232 or later and doesn’t appear while managed settings or the `--settings` flag sets the key, since a user-settings value wouldn’t apply then. Claude Code rejects the `/config crossSessionInbound=value` shorthand for this key. To see which value applies, follow the `crossSessionInbound` precedence rules in the [settings reference](</docs/en/settings-reference#crosssessioninbound>). When no value applies, Claude Code decides per message from the two sessions’ permission modes. It groups sessions that [bypass permission prompts](</docs/en/permission-modes#skip-all-checks-with-bypasspermissions-mode>) into one class, and every other session into the other. Plan mode counts as bypassing in sessions with bypass permissions available, and [auto](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>), `acceptEdits`, and `dontAsk` count as prompting:
+Beyond editing a settings file, you can select the value in the `/config` row **Messages from your other sessions**. Claude Code writes the value you select to your user settings. The row requires Claude Code v2.1.232 or later and doesn’t appear while managed settings or the `--settings` flag sets the key, since a user-settings value wouldn’t apply then. Claude Code rejects the `/config crossSessionInbound=value` shorthand for this key. To see which value applies, follow the `crossSessionInbound` precedence rules in the [settings reference](</docs/en/settings-reference#crosssessioninbound>). When no value applies, Claude Code decides per message from the two sessions’ permission modes. It groups sessions that [bypass permission prompts](</docs/en/permission-modes#skip-all-checks-with-bypasspermissions-mode>) into one class, and every other session into the other. Plan mode counts as bypassing in interactive terminal sessions with bypass permissions available, and [auto](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>), `acceptEdits`, and `dontAsk` count as prompting:
* **The receiving session prompts for permissions** : Claude Code delivers each message. It holds one for your approval only when the sending session identifies itself as bypassing permission prompts.
* **The receiving session bypasses permission prompts** : Claude Code holds each message for your approval. It delivers one only when the sending session identifies itself as also bypassing.
@@ -303,7 +303,7 @@
* **Operating system** : available on macOS, Windows, and Linux, including Linux inside WSL 2.
* **Sessions on this machine** : available on every provider, including Amazon Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform, and Microsoft Foundry, and in sessions that run with [feature-flag fetching](</docs/en/env-vars#features-that-need-feature-flag-fetching>) off. On those providers, and with flag fetching off, same-machine messaging requires Claude Code v2.1.248 or later. Claude Code delivers these messages over a per-session socket on your machine, never through Anthropic servers. To stop a session from receiving them, set `crossSessionInbound` to `refuse`.
- * **Sessions beyond this machine** : Claude finds your [Claude Code on the web](</docs/en/claude-code-on-the-web>) sessions and your sessions on other machines from a session that is connected to Remote Control, which needs a claude.ai sign-in as this session’s active authentication and the other [Remote Control requirements](</docs/en/remote-control#requirements>). Claude can’t find those sessions with an API key or on Amazon Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform, and Microsoft Foundry.
+ * **Sessions beyond this machine** : Claude finds your [cloud sessions](</docs/en/claude-code-on-the-web>) and your sessions on other machines from a session that is connected to Remote Control, which needs a claude.ai sign-in as this session’s active authentication and the other [Remote Control requirements](</docs/en/remote-control#requirements>). Claude can’t find those sessions with an API key or on Amazon Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform, and Microsoft Foundry.
To check a session, type `/list-agents`, also available as `/peers`. The result separates a session that doesn’t have the feature from a session where something narrower blocked a message, such as a missing `SendMessage` tool or a refused send:
--- a/cross-session-messaging.md
+++ b/cross-session-messaging.md
@@ -208,7 +208,7 @@
* If this session’s permission-mode class changes while messages are held, Claude Code re-applies the inbound rules, delivers the messages they now accept, and shows a notice.
* If a settings change makes `refuse` apply while messages are held, Claude Code drops every held message and reports a refusal to each sender it can reach.
-When the sender is an interactive session on the same machine, Claude Code shows a notice there when the receiver holds the message, and a follow-up when the receiver later delivers, denies, or expires it. If the receiver refuses it, Claude Code shows a notice there that the receiver isn’t accepting cross-session messages and tells the sender’s Claude not to wait or resend. Claude Code holds at most 100 messages, separately from the delivery queue, and past that drops the oldest.
+When the sender is a session on the same machine, Claude Code sends a notice back to it when the receiver holds the message, and a follow-up when the receiver later delivers, denies, or expires it. The notice reaches the sending Claude, so it knows not to keep waiting on a message the other session hasn’t read. In an interactive sending session, the notice appears in the transcript. A [`claude -p`](</docs/en/headless>) sender receives it in [streamed output](</docs/en/headless#stream-responses>) as an [informational `system` message](</docs/en/agent-sdk/typescript#sdkinformationalmessage>). Notices to `claude -p` senders require Claude Code v2.1.271 or later. If the receiver refuses the message, the sender’s notice says the receiver isn’t accepting cross-session messages and tells the sender’s Claude not to wait or resend. Claude Code holds at most 100 messages, separately from the delivery queue, and past that drops the oldest.
###
--- a/cross-session-messaging.md
+++ b/cross-session-messaging.md
@@ -149,7 +149,7 @@
On another of your machines| Through Anthropic servers, arriving over that machine’s [Remote Control](</docs/en/remote-control>) connection
On [Claude Code on the web](</docs/en/claude-code-on-the-web>)| Through Anthropic servers, straight to the cloud session
-Starting a conversation with a session on another of your machines requires Claude Code v2.1.225 or later and a target that appears in the listing. Before v2.1.225, Claude could only reply to a message that arrived from one. Same-machine delivery works wherever the feature is enabled. Each session registers itself in files on disk. When Claude lists or messages your local sessions, Claude Code reads those files to find the sessions, so two sessions can reach each other only when they can see the same files. A container has its own filesystem, so a session inside it and a session on the host can’t reach each other. Two sessions inside the same container can still message each other, including on a [self-hosted runner](</docs/en/self-hosted-environments>). A session inside WSL 2 and a native Windows session on the same computer can’t reach each other either, because they register under different home directories and listen on different socket types. While this session is connected to Remote Control, when you message a session on another of your machines, Claude Code shows the message in that session’s conversation under this session’s Remote Control name. The Claude on that machine can reply to that name. For example, when this session is connected to Remote Control as `laptop-graceful-unicorn` and you message your desktop, you see the message in the desktop session under `laptop-graceful-unicorn`. If this session isn’t connected to Remote Control when Claude sends to a session beyond this machine, the message still goes through, but without a reply address, so the receiving Claude can’t answer it. Claude is told as much when it sends. To require your approval before any message goes beyond this machine, set `isolatePeerMachines`.
+Starting a conversation with a session on another of your machines requires Claude Code v2.1.225 or later and a target that appears in the listing. Before v2.1.225, Claude could only reply to a message that arrived from one. You can message a session shown as `offline` in the listing, one whose Remote Control connection has dropped. The send goes through, but the message arrives only after that session’s machine reconnects. Claude is told as much when it sends. Same-machine delivery works wherever the feature is enabled. Each session registers itself in files on disk. When Claude lists or messages your local sessions, Claude Code reads those files to find the sessions, so two sessions can reach each other only when they can see the same files. A container has its own filesystem, so a session inside it and a session on the host can’t reach each other. Two sessions inside the same container can still message each other, including on a [self-hosted runner](</docs/en/self-hosted-environments>). A session inside WSL 2 and a native Windows session on the same computer can’t reach each other either, because they register under different home directories and listen on different socket types. While this session is connected to Remote Control, when you message a session on another of your machines, Claude Code shows the message in that session’s conversation under this session’s Remote Control name. The Claude on that machine can reply to that name. For example, when this session is connected to Remote Control as `laptop-graceful-unicorn` and you message your desktop, you see the message in the desktop session under `laptop-graceful-unicorn`. If this session isn’t connected to Remote Control when Claude sends to a session beyond this machine, the message still goes through, but without a reply address, so the receiving Claude can’t answer it. Claude is told as much when it sends. To require your approval before any message goes beyond this machine, set `isolatePeerMachines`.
##
@@ -203,7 +203,8 @@
* **Approve** delivers that one message to Claude.
* **Deny** , or dismissing the dialog, drops it.
- * When the dialog stays unanswered past the [`dialogExpiry`](</docs/en/settings-reference#dialogexpiry>) deadline, Claude Code closes it and drops the message. The deadline defaults to five minutes. While no terminal is attached to a [background session](</docs/en/agent-view>), Claude Code leaves the dialog open past the deadline. After you attach, Claude Code closes the dialog and drops the message only if it stays unanswered for a full deadline period.
+ * When the dialog stays unanswered past the [`dialogExpiry`](</docs/en/settings-reference#dialogexpiry>) deadline, Claude Code closes it and drops the message. The deadline defaults to five minutes.
+ * While no terminal is attached to a [background session](</docs/en/agent-view>), Claude Code leaves the dialog open past the deadline. After you attach, if the dialog stays unanswered for a full deadline period, Claude Code closes it and drops the message.
* If this session’s permission-mode class changes while messages are held, Claude Code re-applies the inbound rules, delivers the messages they now accept, and shows a notice.
* If a settings change makes `refuse` apply while messages are held, Claude Code drops every held message and reports a refusal to each sender it can reach.
@@ -312,6 +313,7 @@
* **Inbound controls** : the receiving session’s inbound controls can hold or drop what you send it.
* **Cloud session missing** : a cloud session appears only while this session is connected to [Remote Control](</docs/en/remote-control>).
* **Other-machine session missing** : a session on another of your machines appears only when it runs with [Remote Control](</docs/en/remote-control>) and this session is connected as well.
+ * **Other-machine session`offline`**: a message to a session listed as `offline` goes through, but arrives only after that session’s machine reconnects.
* **Older cloud or other-machine session missing** : Claude Code reads those session lists newest first and stops after a bounded number of pages, so Claude can’t message a session that fell past them by name.
* **Starting a conversation** : Message sessions on other machines covers starting a conversation with a session beyond this machine.
--- a/cross-session-messaging.md
+++ b/cross-session-messaging.md
@@ -120,7 +120,7 @@
* **Subagents** : agents running inside the current session.
* **Teammates** : this session’s own [agent team](</docs/en/agent-teams>) teammates. Before v2.1.239, teammates didn’t appear in the listing, though Claude could already message them by name.
- * **Your other local sessions** : Claude Code sessions running on the same machine, including [background sessions](</docs/en/agent-view>). A session appears only when it binds an inbox socket. The worker process that the [supervisor process](</docs/en/agent-view#the-supervisor-process>) keeps ready for your next background session appears once you dispatch work to it.
+ * **Your other local sessions** : Claude Code sessions running on the same machine, including [background sessions](</docs/en/agent-view>). A session appears only when it binds an inbox socket.
* **Your cloud sessions** : your [Claude Code on the web](</docs/en/claude-code-on-the-web>) sessions, shown while this session is connected to [Remote Control](</docs/en/remote-control>). Claude Code labels them `cloud` in the listing.
* **Your Remote Control sessions on other machines** : shown while this session is connected to [Remote Control](</docs/en/remote-control>), and labeled `Remote Control`. Claude Code shows `offline` as the status of a session whose Remote Control connection has dropped.
--- a/cross-session-messaging.md
+++ b/cross-session-messaging.md
@@ -54,7 +54,7 @@
Message delivery
-The receiving Claude reads the message between tool calls during an active turn, so a running tool is never interrupted. When the receiving session is idle, Claude Code starts a new turn with the message. When a message that starts a new turn mentions a file as an `@` immediately followed by its path, Claude Code [attaches that file](</docs/en/common-workflows#reference-files-and-directories>) as it exists on the receiving machine, resolving a relative path from the receiving session’s working directory. The receiving session’s [`Read` deny rules](</docs/en/permissions#read-and-edit>) apply to that file, as they do to a file you mention with `@` yourself. When such a message mentions an [MCP resource](</docs/en/mcp#use-mcp-resources>) with `@`, Claude Code attaches that resource from the receiving session’s MCP servers. A path written without the `@` stays plain text and attaches nothing. A message that Claude reads during an active turn arrives as plain text with nothing attached, even if it mentions files or MCP resources with `@`. Claude Code refuses a message in the following cases:
+The receiving Claude reads the message between tool calls during an active turn, so a running tool is never interrupted. When the receiving session is idle, Claude Code starts a new turn with the message. A message from another session arrives as plain text. If it mentions a file or an [MCP resource](</docs/en/mcp#use-mcp-resources>) with `@`, Claude sees the mention as written and Claude Code attaches nothing, whether the message starts a new turn or arrives during one. Claude can still open a mentioned path on the receiving machine with its own tools, subject to that session’s permissions. Before v2.1.251, an `@` mention in a message that started a new turn attached the file or MCP resource on the receiving side. Claude Code refuses a message in the following cases:
* The message is over the size cap. Claude Code refuses it in the sending session, before it leaves.
* A rapid burst to a session on this machine has reached what that session’s inbox accepts. Claude Code refuses further messages to that session.
@@ -175,7 +175,7 @@
* Press `Ctrl+O` to open the [transcript viewer](</docs/en/interactive-mode#transcript-viewer>) and read the full text under the sender’s session name.
* In a session started with [`--verbose`](</docs/en/cli-reference#cli-flags>), Claude Code shows the full text instead of the preview.
-The preview shortens only what you see. Whether or not you expand it, Claude reads the full message. Claude receives the message with the sender’s name and a reply address, except for a one-way cross-machine message, which carries no reply address. Beyond the name and reply address, the receiving Claude gets the message’s text, never the sender’s conversation history or files. An `@` mention in the text can still attach a file or MCP resource on the receiving side, as described under Message delivery. A message that a [subagent](</docs/en/sub-agents>) wrote arrives under the sending session’s name, with the subagent identified in the message text. A reply to it reaches that session’s main conversation, not the subagent. This example is a message one Claude wrote to another, as its full text reads when you expand it:
+The preview shortens only what you see. Whether or not you expand it, Claude reads the full message. Claude receives the message with the sender’s name and a reply address, except for a one-way cross-machine message, which carries no reply address. Beyond the name and reply address, the receiving Claude gets the message’s text, never the sender’s conversation history or files. Message delivery covers `@` mentions in the text. A message that a [subagent](</docs/en/sub-agents>) wrote arrives under the sending session’s name, with the subagent identified in the message text. A reply to it reaches that session’s main conversation, not the subagent. This example is a message one Claude wrote to another, as its full text reads when you expand it:
Schema migration finished
The new column is tenant_id, and rebasing on main is safe now.
Show diff (102 lines)
--- a/cross-session-messaging.md
+++ b/cross-session-messaging.md
@@ -1,6 +1,6 @@
Cross-session messaging requires Claude Code v2.1.224 or later on macOS and Linux, including Linux inside WSL 2. On native Windows, it requires Claude Code v2.1.234 or later. When a session meets the requirements, messaging is on with nothing to enable. See Availability for provider requirements and how to confirm a session has it.
-Cross-session messaging lets Claude deliver a message from one of your Claude Code sessions to another. When a change in one session breaks what another is building on, Claude can warn that session before you notice. When one session settles a question another is blocked on, Claude can send the answer across. A message is a piece of text one Claude writes to another, never conversation history or files. To move a whole conversation or its context, [resume the session](</docs/en/sessions#resume-a-session>) instead. Claude uses two tools for this: `ListAgents` to discover which agents it can reach, and `SendMessage` to deliver a message to one of them by name. With the same `SendMessage` tool, Claude can also message [subagents](</docs/en/sub-agents#resume-subagents>) and [agent team](</docs/en/agent-teams>) teammates within a single session or team. This page covers messages between your independent sessions.
+Cross-session messaging lets Claude deliver a message from one of your Claude Code sessions to another. When a change in one session breaks what another is building on, Claude can warn that session before you notice. When one session settles a question another is blocked on, Claude can send the answer across. A message is a piece of text one Claude writes to another, never the sender’s conversation history or files. To move a whole conversation or its context, [resume the session](</docs/en/sessions#resume-a-session>) instead. Claude uses two tools for this: `ListAgents` to discover which agents it can reach, and `SendMessage` to deliver a message to one of them by name. With the same `SendMessage` tool, Claude can also message [subagents](</docs/en/sub-agents#resume-subagents>) and [agent team](</docs/en/agent-teams>) teammates within a single session or team. This page covers messages between your independent sessions.
##
@@ -41,7 +41,12 @@
Let @api-worker know the schema migration finished
-Once you type at least one letter after the `@`, Claude Code suggests your other live sessions on this machine; after a bare `@`, session rows don’t appear. A cloud or Remote Control session appears in the suggestions only after Claude has already listed or messaged your sessions beyond this machine. You can also type the mention without the picker. When more than one live session answers to the mentioned name, Claude asks you which one you mean before sending. For what the message Claude writes looks like when it arrives, including an example of one, see what a message looks like.
+The typeahead lists your other live sessions on this machine. Two cases need more than the first letters of a name:
+
+ * **A session beyond this machine** : a cloud or Remote Control session appears in the typeahead only after Claude has listed or messaged your sessions beyond this machine, so ask Claude to list them first.
+ * **A name with a space or other characters outside letters, digits, hyphens, and underscores** : type it in double quotes, such as `@"release notes"`. When you pick the session from the typeahead, Claude Code inserts the quotes for you.
+
+You can also type the mention without the picker. When more than one live session answers to the mentioned name, Claude asks you which one you mean before sending. For what the message Claude writes looks like when it arrives, including an example of one, see what a message looks like.
###
@@ -49,7 +54,7 @@
Message delivery
-The receiving Claude reads the message between tool calls during an active turn, so a running tool is never interrupted. When the receiving session is idle, Claude Code starts a new turn with the message. Claude Code refuses a message in the following cases:
+The receiving Claude reads the message between tool calls during an active turn, so a running tool is never interrupted. When the receiving session is idle, Claude Code starts a new turn with the message. When a message that starts a new turn mentions a file as an `@` immediately followed by its path, Claude Code [attaches that file](</docs/en/common-workflows#reference-files-and-directories>) as it exists on the receiving machine, resolving a relative path from the receiving session’s working directory. The receiving session’s [`Read` deny rules](</docs/en/permissions#read-and-edit>) apply to that file, as they do to a file you mention with `@` yourself. When such a message mentions an [MCP resource](</docs/en/mcp#use-mcp-resources>) with `@`, Claude Code attaches that resource from the receiving session’s MCP servers. A path written without the `@` stays plain text and attaches nothing. A message that Claude reads during an active turn arrives as plain text with nothing attached, even if it mentions files or MCP resources with `@`. Claude Code refuses a message in the following cases:
* The message is over the size cap. Claude Code refuses it in the sending session, before it leaves.
* A rapid burst to a session on this machine has reached what that session’s inbox accepts. Claude Code refuses further messages to that session.
@@ -111,7 +116,7 @@
See which sessions Claude can reach
-Claude finds a message’s target on its own, so you don’t need to run anything before asking it to send. To see for yourself which sessions Claude can reach, run the `/list-agents` command. The first line is this session’s own name, the one your other sessions use to message it. The rows below it are the sessions Claude can reach, each with the name it answers to:
+Claude finds a message’s target on its own, so you don’t need to run anything before asking it to send. To see for yourself which sessions Claude can reach, run the `/list-agents` command. The first line, when present, is this session’s own name, the one your other sessions use to message it. The rows below it are the sessions Claude can reach:
* **Subagents** : agents running inside the current session.
* **Teammates** : this session’s own [agent team](</docs/en/agent-teams>) teammates. Before v2.1.239, teammates didn’t appear in the listing, though Claude could already message them by name.
@@ -119,7 +124,13 @@
* **Your cloud sessions** : your [Claude Code on the web](</docs/en/claude-code-on-the-web>) sessions, shown while this session is connected to [Remote Control](</docs/en/remote-control>). Claude Code labels them `cloud` in the listing.
* **Your Remote Control sessions on other machines** : shown while this session is connected to [Remote Control](</docs/en/remote-control>), and labeled `Remote Control`. Claude Code shows `offline` as the status of a session whose Remote Control connection has dropped.
-This session isn’t one of the rows. If Claude addresses a message to this session’s own name, Claude Code refuses it and tells Claude the target is the current session. Before v2.1.239, the listing didn’t show this session’s name, and Claude Code reported a message sent to it as an agent it couldn’t find. Claude Code reads your cloud and Remote Control session lists newest first and stops after a bounded number of pages for each. If your account has more of those sessions than fit, Claude Code doesn’t list the older ones, and Claude can’t message them by name. When this happens, Claude Code says so in the listing, and Claude sees the same note when it sends a message. Claude addresses a session beyond this machine by name, the same as a local session. See Message sessions on other machines for how those messages travel. A session answers to the name you set with the [`/rename`](</docs/en/commands>) command or the [`--name`](</docs/en/cli-reference#cli-flags>) flag. When you don’t set one, Claude Code names the session itself. For an interactive session, that is the name shown in [listings of running sessions](</docs/en/sessions#name-your-sessions>). When you rename a session, Claude Code also updates the shared record your other sessions use to look up the session’s name. If it can’t update that record, it warns you in the `/rename` output that other sessions may still show the old name. Run the session with [`--debug`](</docs/en/cli-reference#cli-flags>), and Claude Code logs the cause of the failed update. When you rename a session, or start or resume an interactive one, with a name another live session on this machine already uses, Claude Code leaves the name with the session that already has it and [renames yours to a variant](</docs/en/sessions#name-your-sessions>). Sessions can still share a name, for example when one of them runs an earlier version of Claude Code or the shared name is one Claude Code generated. Claude Code shows each local session’s working directory in the `/list-agents` output, so you can tell same-named sessions apart when they run in different directories. Claude addresses the message in one of two ways, depending on how many live sessions answer to the name:
+This session isn’t one of the rows. If Claude addresses a message to this session’s own name, Claude Code refuses it and tells Claude the target is the current session. Before v2.1.239, the listing didn’t show this session’s name, and Claude Code reported a message sent to it as an agent it couldn’t find. While this session is connected to [Remote Control](</docs/en/remote-control>), Claude Code withholds some details of your local sessions from the `/list-agents` output, without changing what Claude itself sees when it looks for a session to message:
+
+ * **Working directories** : it leaves out each local session’s working directory.
+ * **Session names** : it leaves out any session name it can’t attribute to a person, so a row left with no name reads `(unnamed session)`.
+ * **The first line** : it leaves out the line with this session’s own name unless you typed that name at this terminal, with `--name` or with `/rename` and the name, since you launched or last resumed the session.
+
+When the output lists anything, it ends with a note saying details were withheld. Running `/rename` followed by an unused name at a session’s own keyboard gives that session a name that appears in the output. Claude Code reads your cloud and Remote Control session lists newest first and stops after a bounded number of pages for each. If your account has more of those sessions than fit, Claude Code doesn’t list the older ones, and Claude can’t message them by name. When this happens, Claude Code says so in the listing, and Claude sees the same note when it sends a message. Claude addresses a session beyond this machine by name, the same as a local session. See Message sessions on other machines for how those messages travel. A session answers to the name you set with the [`/rename`](</docs/en/commands>) command or the [`--name`](</docs/en/cli-reference#cli-flags>) flag. When you don’t set one, Claude Code names the session itself. For an interactive session, that is the name shown in [listings of running sessions](</docs/en/sessions#name-your-sessions>). When you rename a session, Claude Code also updates the shared record your other sessions use to look up the session’s name. If it can’t update that record, it warns you in the `/rename` output that other sessions may still show the old name. Run the session with [`--debug`](</docs/en/cli-reference#cli-flags>), and Claude Code logs the cause of the failed update. When you rename a session, or start or resume an interactive one, with a name another live session on this machine already uses, Claude Code leaves the name with the session that already has it and [renames yours to a variant](</docs/en/sessions#name-your-sessions>). Sessions can still share a name, for example when one of them runs an earlier version of Claude Code or the shared name is one Claude Code generated. Unless this session is connected to Remote Control, Claude Code shows each local session’s working directory in the `/list-agents` output, so you can tell same-named sessions apart when they run in different directories. Claude addresses the message in one of two ways, depending on how many live sessions answer to the name:
* **One session answers to the name** : Claude Code delivers the message on the name alone.
* **Several sessions share the name, or Claude Code couldn’t check everywhere your sessions run** : Claude adds a short identifier to each row of its listing and uses the identifier in the address.
@@ -164,7 +175,7 @@
* Press `Ctrl+O` to open the [transcript viewer](</docs/en/interactive-mode#transcript-viewer>) and read the full text under the sender’s session name.
* In a session started with [`--verbose`](</docs/en/cli-reference#cli-flags>), Claude Code shows the full text instead of the preview.
-The preview shortens only what you see. Whether or not you expand it, Claude reads the full message. Claude receives the message with the sender’s name and a reply address, except for a one-way cross-machine message, which carries no reply address. Beyond the name and reply address, the receiving Claude gets only the message’s text, never the sender’s conversation history or files. This example is a message one Claude wrote to another, as its full text reads when you expand it:
+The preview shortens only what you see. Whether or not you expand it, Claude reads the full message. Claude receives the message with the sender’s name and a reply address, except for a one-way cross-machine message, which carries no reply address. Beyond the name and reply address, the receiving Claude gets the message’s text, never the sender’s conversation history or files. An `@` mention in the text can still attach a file or MCP resource on the receiving side, as described under Message delivery. A message that a [subagent](</docs/en/sub-agents>) wrote arrives under the sending session’s name, with the subagent identified in the message text. A reply to it reaches that session’s main conversation, not the subagent. This example is a message one Claude wrote to another, as its full text reads when you expand it:
Schema migration finished
The new column is tenant_id, and rebasing on main is safe now.
@@ -222,10 +233,9 @@
* `/status` shows it in the `Peer address` row. The path is prefixed with `uds:`.
* Claude Code exports it to [hooks](</docs/en/hooks>) and Bash commands as the [`CLAUDE_CODE_MESSAGING_SOCKET`](</docs/en/env-vars#variables>) environment variable:
* In a session that starts with messaging on, Claude Code exports the variable before any hook runs, including `SessionStart`.
- * When a session starts before Claude Code has fetched the feature flag that turns messaging on, such as the first session after you install Claude Code or upgrade from a version without messaging, Claude Code binds the inbox and exports the variable as soon as the fetch completes. Hooks and processes that started before that point keep the variable unset, while later hooks and Bash commands see it.
* Each session exports its own socket, never one inherited from a parent session.
-On macOS and Linux, Claude Code restricts the socket to your operating-system user. On native Windows, it instead requires each connection to authenticate first with a key that only your operating-system user can read. Either way, on a shared machine another user’s sessions can’t deliver to it. Alongside the socket’s path, Claude Code exports a per-session token as [`CLAUDE_CODE_MESSAGING_TOKEN`](</docs/en/env-vars#variables>). A script posting to its own session’s socket can send `{"type":"auth","token":"<token>"}` as the first line of its connection, where `<token>` is the value of `CLAUDE_CODE_MESSAGING_TOKEN`. Whether Claude Code requires the line depends on the platform:
+On macOS and Linux, Claude Code restricts the socket to your operating-system user. On native Windows, it instead requires each connection to authenticate first with a key that only your operating-system user can read. Either way, on a shared machine another user’s sessions can’t deliver to it. On macOS and Linux, Claude Code also refuses to create the socket in a directory it can’t accept, for example one that another user owns, and uses a private per-user directory, `/tmp/cc-socks-<uid>`, instead. When it can’t accept any directory, the session runs without an inbox: Claude Code shows a notice, `/status` shows `unavailable` and the reason in its `Peer address` row, and the [`--debug`](</docs/en/cli-reference#cli-flags>) log records the full refusal. Alongside the socket’s path, Claude Code exports a per-session token as [`CLAUDE_CODE_MESSAGING_TOKEN`](</docs/en/env-vars#variables>). A script posting to its own session’s socket can send `{"type":"auth","token":"<token>"}` as the first line of its connection, where `<token>` is the value of `CLAUDE_CODE_MESSAGING_TOKEN`. Whether Claude Code requires the line depends on the platform:
* **macOS and Linux, including WSL 2** : the line is optional. Claude Code accepts a connection with or without it.
* **Native Windows** : the line is required. Claude Code closes any connection whose first line isn’t a valid auth line and delivers nothing from that connection.
@@ -288,11 +298,11 @@
Availability
-Cross-session messaging requires Claude Code v2.1.224 or later on macOS, Linux, and WSL 2, and v2.1.234 or later on native Windows. Availability also depends on your platform, provider, and configuration:
+Cross-session messaging requires Claude Code v2.1.224 or later on macOS, Linux, and WSL 2, and v2.1.234 or later on native Windows. Availability, and which sessions Claude can message, also depend on your operating system, provider, and configuration:
* **Operating system** : available on macOS, Windows, and Linux, including Linux inside WSL 2.
- * **Provider** : not available on Amazon Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform, or Microsoft Foundry.
- * **Feature-flag evaluation** : when any of [`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`, `DISABLE_TELEMETRY`, `DO_NOT_TRACK`, or `DISABLE_GROWTHBOOK`](</docs/en/env-vars#variables>) turns off the feature-flag evaluation the feature depends on, cross-session messaging stays off. Each variable’s row says which values do that. Unset whichever applies. These variables can come from your shell, from a settings file’s `env` map, or from managed settings.
+ * **Sessions on this machine** : available on every provider, including Amazon Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform, and Microsoft Foundry, and in sessions that run with [feature-flag fetching](</docs/en/env-vars#features-that-need-feature-flag-fetching>) off. On those providers, and with flag fetching off, same-machine messaging requires Claude Code v2.1.248 or later. Claude Code delivers these messages over a per-session socket on your machine, never through Anthropic servers. To stop a session from receiving them, set `crossSessionInbound` to `refuse`.
+ * **Sessions beyond this machine** : Claude finds your [Claude Code on the web](</docs/en/claude-code-on-the-web>) sessions and your sessions on other machines from a session that is connected to Remote Control, which needs a claude.ai sign-in as this session’s active authentication and the other [Remote Control requirements](</docs/en/remote-control#requirements>). Claude can’t find those sessions with an API key or on Amazon Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform, and Microsoft Foundry.
To check a session, type `/list-agents`, also available as `/peers`. The result separates a session that doesn’t have the feature from a session where something narrower blocked a message, such as a missing `SendMessage` tool or a refused send:
@@ -305,7 +315,7 @@
* **Older cloud or other-machine session missing** : Claude Code reads those session lists newest first and stops after a bounded number of pages, so Claude can’t message a session that fell past them by name.
* **Starting a conversation** : Message sessions on other machines covers starting a conversation with a session beyond this machine.
-In a session with messaging, `/status` also shows a `Peer address` row with the session’s own inbox address.
+In a session with messaging, `/status` also shows a `Peer address` row with the session’s own inbox address, or `unavailable` and the reason when Claude Code couldn’t set up an inbox.
##
--- a/cross-session-messaging.md
+++ b/cross-session-messaging.md
@@ -119,7 +119,7 @@
* **Your cloud sessions** : your [Claude Code on the web](</docs/en/claude-code-on-the-web>) sessions, shown while this session is connected to [Remote Control](</docs/en/remote-control>). Claude Code labels them `cloud` in the listing.
* **Your Remote Control sessions on other machines** : shown while this session is connected to [Remote Control](</docs/en/remote-control>), and labeled `Remote Control`. Claude Code shows `offline` as the status of a session whose Remote Control connection has dropped.
-This session isn’t one of the rows. If Claude addresses a message to this session’s own name, Claude Code refuses it and tells Claude the target is the current session. Before v2.1.239, the listing didn’t show this session’s name, and Claude Code reported a message sent to it as an agent it couldn’t find. Claude Code reads your cloud and Remote Control session lists newest first and stops after a bounded number of pages for each. If your account has more of those sessions than fit, Claude Code doesn’t list the older ones, and Claude can’t message them by name. When this happens, Claude Code says so in the listing, and Claude sees the same note when it sends a message. Claude addresses a session beyond this machine by name, the same as a local session. See Message sessions on other machines for how those messages travel. A session answers to the name you set with the [`/rename`](</docs/en/commands>) command or the [`--name`](</docs/en/cli-reference#cli-flags>) flag. When you don’t set one, Claude Code names the session itself. For an interactive session, that is the name shown in [listings of running sessions](</docs/en/sessions#name-your-sessions>). When you rename a session, or start or resume an interactive one, with a name another live session on this machine already uses, Claude Code leaves the name with the session that already has it and [renames yours to a variant](</docs/en/sessions#name-your-sessions>). Sessions can still share a name, for example when one of them runs an earlier version of Claude Code or the shared name is one Claude Code generated. Claude Code shows each local session’s working directory in the `/list-agents` output, so you can tell same-named sessions apart when they run in different directories. Claude addresses the message in one of two ways, depending on how many live sessions answer to the name:
+This session isn’t one of the rows. If Claude addresses a message to this session’s own name, Claude Code refuses it and tells Claude the target is the current session. Before v2.1.239, the listing didn’t show this session’s name, and Claude Code reported a message sent to it as an agent it couldn’t find. Claude Code reads your cloud and Remote Control session lists newest first and stops after a bounded number of pages for each. If your account has more of those sessions than fit, Claude Code doesn’t list the older ones, and Claude can’t message them by name. When this happens, Claude Code says so in the listing, and Claude sees the same note when it sends a message. Claude addresses a session beyond this machine by name, the same as a local session. See Message sessions on other machines for how those messages travel. A session answers to the name you set with the [`/rename`](</docs/en/commands>) command or the [`--name`](</docs/en/cli-reference#cli-flags>) flag. When you don’t set one, Claude Code names the session itself. For an interactive session, that is the name shown in [listings of running sessions](</docs/en/sessions#name-your-sessions>). When you rename a session, Claude Code also updates the shared record your other sessions use to look up the session’s name. If it can’t update that record, it warns you in the `/rename` output that other sessions may still show the old name. Run the session with [`--debug`](</docs/en/cli-reference#cli-flags>), and Claude Code logs the cause of the failed update. When you rename a session, or start or resume an interactive one, with a name another live session on this machine already uses, Claude Code leaves the name with the session that already has it and [renames yours to a variant](</docs/en/sessions#name-your-sessions>). Sessions can still share a name, for example when one of them runs an earlier version of Claude Code or the shared name is one Claude Code generated. Claude Code shows each local session’s working directory in the `/list-agents` output, so you can tell same-named sessions apart when they run in different directories. Claude addresses the message in one of two ways, depending on how many live sessions answer to the name:
* **One session answers to the name** : Claude Code delivers the message on the name alone.
* **Several sessions share the name, or Claude Code couldn’t check everywhere your sessions run** : Claude adds a short identifier to each row of its listing and uses the identifier in the address.
@@ -159,9 +159,15 @@
What a message looks like
-When the message arrives, it appears in the conversation under the sender’s session name and stays there. Claude Code queues it while Claude is mid-turn, or starts a new turn with it right away when the session is idle. A message is a piece of text one Claude writes to another. Claude receives it with the sender’s name and a reply address, except for a one-way cross-machine message, which carries no reply address. You see the name and the text, and the receiving session gets only that text, never the sender’s conversation history or files. This example is a message one Claude wrote to another, as the receiving session sees it:
-
- Schema migration finished: the new column is tenant_id, and rebasing on main is safe now.
+When a message arrives, Claude Code shows it in the conversation as a dim one-line preview, and the preview line stays in the conversation afterward. The preview carries the sender’s name and the first line of the message, cut with `…` when it’s long, such as `› Message from @api-worker: Schema migration finished (ctrl+o to expand)`. Before v2.1.247, Claude Code showed the arriving message in full instead of a preview. Either of these shows you the full text:
+
+ * Press `Ctrl+O` to open the [transcript viewer](</docs/en/interactive-mode#transcript-viewer>) and read the full text under the sender’s session name.
+ * In a session started with [`--verbose`](</docs/en/cli-reference#cli-flags>), Claude Code shows the full text instead of the preview.
+
+The preview shortens only what you see. Whether or not you expand it, Claude reads the full message. Claude receives the message with the sender’s name and a reply address, except for a one-way cross-machine message, which carries no reply address. Beyond the name and reply address, the receiving Claude gets only the message’s text, never the sender’s conversation history or files. This example is a message one Claude wrote to another, as its full text reads when you expand it:
+
+ Schema migration finished
+ The new column is tenant_id, and rebasing on main is safe now.
###
@@ -224,7 +230,7 @@
* **macOS and Linux, including WSL 2** : the line is optional. Claude Code accepts a connection with or without it.
* **Native Windows** : the line is required. Claude Code closes any connection whose first line isn’t a valid auth line and delivers nothing from that connection.
-The own-child rules below say when Claude Code consults the token and how it treats a message it can’t verify. Claude Code runs messages arriving on the socket through the same inbound controls as any other peer message, with one exception and one prerequisite:
+Open the connection only when the message you’re posting is ready. Claude Code closes a connection that hasn’t sent a complete line within 30 seconds, so capture a slow command’s output first and then open the connection to send it. The own-child rules below say when Claude Code consults the token and how it treats a message it can’t verify. Claude Code runs messages arriving on the socket through the same inbound controls as any other peer message, with one exception and one prerequisite:
* **Own-child messages** : when no `crossSessionInbound` value applies, Claude Code delivers a message it verifies came from the session’s own child processes, such as a hook or Bash command posting back to its own session’s socket.
* On Linux, including inside WSL 2, Claude Code can verify by process evidence even for a child that has already exited. On macOS it can verify that way only while the posting process is still running, and in a container where Claude Code runs as process ID 1 it has no process evidence at all. On native Windows it also has none.
Show diff (159 lines)
--- a/cross-session-messaging.md
+++ b/cross-session-messaging.md
@@ -1,4 +1,4 @@
-Cross-session messaging requires Claude Code v2.1.224 or later and runs on macOS and Linux. When a session meets the requirements, messaging is on with nothing to enable. See Availability for provider requirements and how to confirm a session has it.
+Cross-session messaging requires Claude Code v2.1.224 or later on macOS and Linux, including Linux inside WSL 2. On native Windows, it requires Claude Code v2.1.234 or later. When a session meets the requirements, messaging is on with nothing to enable. See Availability for provider requirements and how to confirm a session has it.
Cross-session messaging lets Claude deliver a message from one of your Claude Code sessions to another. When a change in one session breaks what another is building on, Claude can warn that session before you notice. When one session settles a question another is blocked on, Claude can send the answer across. A message is a piece of text one Claude writes to another, never conversation history or files. To move a whole conversation or its context, [resume the session](</docs/en/sessions#resume-a-session>) instead. Claude uses two tools for this: `ListAgents` to discover which agents it can reach, and `SendMessage` to deliver a message to one of them by name. With the same `SendMessage` tool, Claude can also message [subagents](</docs/en/sub-agents#resume-subagents>) and [agent team](</docs/en/agent-teams>) teammates within a single session or team. This page covers messages between your independent sessions.
@@ -54,6 +54,7 @@
* The message is over the size cap. Claude Code refuses it in the sending session, before it leaves.
* A rapid burst to a session on this machine has reached what that session’s inbox accepts. Claude Code refuses further messages to that session.
* The reply target on this machine fails a safety check, such as a symlinked target or an endpoint that isn’t the expected process. [Refusing to send a cross-session message](</docs/en/errors#refusing-to-send-a-cross-session-message>) lists these checks.
+ * Claude addresses the message to this session’s own name, as described under See which sessions Claude can reach.
The receiving session checks each arriving message against its own inbound controls, and the check ends in one of three outcomes:
@@ -110,14 +111,15 @@
See which sessions Claude can reach
-Claude finds a message’s target on its own, so you don’t need to run anything before asking it to send. To see for yourself which sessions Claude can reach, run the `/list-agents` command. It lists each session with the name it answers to, and that name is where Claude addresses a message. The listing covers:
-
- * **Subagents** : agents running inside the current session. [Agent team](</docs/en/agent-teams>) teammates aren’t listed; Claude messages them through the team’s own roster.
+Claude finds a message’s target on its own, so you don’t need to run anything before asking it to send. To see for yourself which sessions Claude can reach, run the `/list-agents` command. The first line is this session’s own name, the one your other sessions use to message it. The rows below it are the sessions Claude can reach, each with the name it answers to:
+
+ * **Subagents** : agents running inside the current session.
+ * **Teammates** : this session’s own [agent team](</docs/en/agent-teams>) teammates. Before v2.1.239, teammates didn’t appear in the listing, though Claude could already message them by name.
* **Your other local sessions** : Claude Code sessions running on the same machine, including [background sessions](</docs/en/agent-view>). A session appears only when it binds an inbox socket. The worker process that the [supervisor process](</docs/en/agent-view#the-supervisor-process>) keeps ready for your next background session appears once you dispatch work to it.
* **Your cloud sessions** : your [Claude Code on the web](</docs/en/claude-code-on-the-web>) sessions, shown while this session is connected to [Remote Control](</docs/en/remote-control>). Claude Code labels them `cloud` in the listing.
* **Your Remote Control sessions on other machines** : shown while this session is connected to [Remote Control](</docs/en/remote-control>), and labeled `Remote Control`. Claude Code shows `offline` as the status of a session whose Remote Control connection has dropped.
-Claude Code reads your cloud and Remote Control session lists newest first and stops after a bounded number of pages for each. If your account has more of those sessions than fit, Claude Code doesn’t list the older ones, and Claude can’t message them by name. When this happens, Claude Code says so in the listing, and Claude sees the same note when it sends a message. Claude addresses a session beyond this machine by name, the same as a local session. See Message sessions on other machines for how those messages travel. A session answers to the name you set with the [`/rename`](</docs/en/commands>) command or the [`--name`](</docs/en/cli-reference#cli-flags>) flag. When you don’t set one, Claude Code names the session itself. For an interactive session, Claude Code derives the name from the working directory’s folder name, such as `my-app-3f` in a `my-app` directory. When you rename a session, or start or resume an interactive one, with a name another live session on this machine already uses, Claude Code leaves the name with the session that already has it and [renames yours to a variant](</docs/en/sessions#name-your-sessions>). Sessions can still share a name, for example when one of them runs an earlier version of Claude Code or the shared name is one Claude Code generated. Claude Code shows each local session’s working directory in the `/list-agents` output, so you can tell same-named sessions apart when they run in different directories. Claude addresses the message in one of two ways, depending on how many live sessions answer to the name:
+This session isn’t one of the rows. If Claude addresses a message to this session’s own name, Claude Code refuses it and tells Claude the target is the current session. Before v2.1.239, the listing didn’t show this session’s name, and Claude Code reported a message sent to it as an agent it couldn’t find. Claude Code reads your cloud and Remote Control session lists newest first and stops after a bounded number of pages for each. If your account has more of those sessions than fit, Claude Code doesn’t list the older ones, and Claude can’t message them by name. When this happens, Claude Code says so in the listing, and Claude sees the same note when it sends a message. Claude addresses a session beyond this machine by name, the same as a local session. See Message sessions on other machines for how those messages travel. A session answers to the name you set with the [`/rename`](</docs/en/commands>) command or the [`--name`](</docs/en/cli-reference#cli-flags>) flag. When you don’t set one, Claude Code names the session itself. For an interactive session, that is the name shown in [listings of running sessions](</docs/en/sessions#name-your-sessions>). When you rename a session, or start or resume an interactive one, with a name another live session on this machine already uses, Claude Code leaves the name with the session that already has it and [renames yours to a variant](</docs/en/sessions#name-your-sessions>). Sessions can still share a name, for example when one of them runs an earlier version of Claude Code or the shared name is one Claude Code generated. Claude Code shows each local session’s working directory in the `/list-agents` output, so you can tell same-named sessions apart when they run in different directories. Claude addresses the message in one of two ways, depending on how many live sessions answer to the name:
* **One session answers to the name** : Claude Code delivers the message on the name alone.
* **Several sessions share the name, or Claude Code couldn’t check everywhere your sessions run** : Claude adds a short identifier to each row of its listing and uses the identifier in the address.
@@ -132,11 +134,11 @@
Where the other session runs| How the message travels
---|---
-On this machine| Over a per-session socket, never through Anthropic servers
+On this machine| Over a per-session socket on macOS and Linux, or a per-session named pipe on native Windows, never through Anthropic servers
On another of your machines| Through Anthropic servers, arriving over that machine’s [Remote Control](</docs/en/remote-control>) connection
On [Claude Code on the web](</docs/en/claude-code-on-the-web>)| Through Anthropic servers, straight to the cloud session
-Starting a conversation with a session on another of your machines requires Claude Code v2.1.225 or later and a target that appears in the listing. Before v2.1.225, Claude could only reply to a message that arrived from one. Same-machine delivery works wherever the feature is enabled. Each session registers itself in files on disk and binds its inbox socket there. When Claude lists or messages your local sessions, Claude Code reads those files to find them, so two sessions can reach each other only when they can see the same files. A container has its own filesystem, so a session inside it and a session on the host can’t reach each other. Two sessions inside the same container can still message each other, including on a [self-hosted runner](</docs/en/self-hosted-environments>). While this session is connected to Remote Control, when you message a session on another of your machines, Claude Code shows the message in that session’s conversation under this session’s Remote Control name. The Claude on that machine can reply to that name. For example, when this session is connected to Remote Control as `laptop-graceful-unicorn` and you message your desktop, you see the message in the desktop session under `laptop-graceful-unicorn`. If this session isn’t connected to Remote Control when Claude sends to a session beyond this machine, the message still goes through, but without a reply address, so the receiving Claude can’t answer it. Claude is told as much when it sends. To require your approval before any message goes beyond this machine, set `isolatePeerMachines`.
+Starting a conversation with a session on another of your machines requires Claude Code v2.1.225 or later and a target that appears in the listing. Before v2.1.225, Claude could only reply to a message that arrived from one. Same-machine delivery works wherever the feature is enabled. Each session registers itself in files on disk. When Claude lists or messages your local sessions, Claude Code reads those files to find the sessions, so two sessions can reach each other only when they can see the same files. A container has its own filesystem, so a session inside it and a session on the host can’t reach each other. Two sessions inside the same container can still message each other, including on a [self-hosted runner](</docs/en/self-hosted-environments>). A session inside WSL 2 and a native Windows session on the same computer can’t reach each other either, because they register under different home directories and listen on different socket types. While this session is connected to Remote Control, when you message a session on another of your machines, Claude Code shows the message in that session’s conversation under this session’s Remote Control name. The Claude on that machine can reply to that name. For example, when this session is connected to Remote Control as `laptop-graceful-unicorn` and you message your desktop, you see the message in the desktop session under `laptop-graceful-unicorn`. If this session isn’t connected to Remote Control when Claude sends to a session beyond this machine, the message still goes through, but without a reply address, so the receiving Claude can’t answer it. Claude is told as much when it sends. To require your approval before any message goes beyond this machine, set `isolatePeerMachines`.
##
@@ -167,15 +169,15 @@
Control inbound messages
-Set [`crossSessionInbound`](</docs/en/settings#available-settings>) to choose what a session does with messages arriving from your other sessions:
+Set [`crossSessionInbound`](</docs/en/settings-reference#crosssessioninbound>) to choose what a session does with messages arriving from your other sessions:
Value| Behavior
---|---
`accept`| Claude Code delivers each message to Claude
-`hold`| Claude Code shows a notice for each message and doesn’t deliver it. If an `accept` later applies, per the [precedence rules](</docs/en/settings#available-settings>), Claude Code releases the held messages
+`hold`| Claude Code shows a notice for each message and doesn’t deliver it. If an `accept` later applies, per the [precedence rules](</docs/en/settings-reference#crosssessioninbound>), Claude Code releases the held messages
`refuse`| Claude Code drops each message without delivering it
-Beyond editing a settings file, you can select the value in the `/config` row **Messages from your other sessions**. Claude Code writes the value you select to your user settings. The row requires Claude Code v2.1.232 or later and doesn’t appear while managed settings or the `--settings` flag sets the key, since a user-settings value wouldn’t apply then. Claude Code rejects the `/config crossSessionInbound=value` shorthand for this key. To see which value applies, follow the `crossSessionInbound` precedence rules in the [settings reference](</docs/en/settings#available-settings>). When no value applies, Claude Code decides per message from the two sessions’ permission modes. It groups sessions that [bypass permission prompts](</docs/en/permission-modes#skip-all-checks-with-bypasspermissions-mode>) into one class, and every other session into the other. Plan mode counts as bypassing in sessions with bypass permissions available, and [auto](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>), `acceptEdits`, and `dontAsk` count as prompting:
+Beyond editing a settings file, you can select the value in the `/config` row **Messages from your other sessions**. Claude Code writes the value you select to your user settings. The row requires Claude Code v2.1.232 or later and doesn’t appear while managed settings or the `--settings` flag sets the key, since a user-settings value wouldn’t apply then. Claude Code rejects the `/config crossSessionInbound=value` shorthand for this key. To see which value applies, follow the `crossSessionInbound` precedence rules in the [settings reference](</docs/en/settings-reference#crosssessioninbound>). When no value applies, Claude Code decides per message from the two sessions’ permission modes. It groups sessions that [bypass permission prompts](</docs/en/permission-modes#skip-all-checks-with-bypasspermissions-mode>) into one class, and every other session into the other. Plan mode counts as bypassing in sessions with bypass permissions available, and [auto](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>), `acceptEdits`, and `dontAsk` count as prompting:
* **The receiving session prompts for permissions** : Claude Code delivers each message. It holds one for your approval only when the sending session identifies itself as bypassing permission prompts.
* **The receiving session bypasses permission prompts** : Claude Code holds each message for your approval. It delivers one only when the sending session identifies itself as also bypassing.
@@ -184,7 +186,7 @@
* **Approve** delivers that one message to Claude.
* **Deny** , or dismissing the dialog, drops it.
- * When the dialog stays unanswered past the [`dialogExpiry`](</docs/en/settings#available-settings>) deadline, Claude Code closes it and drops the message. The deadline defaults to five minutes. While no terminal is attached to a [background session](</docs/en/agent-view>), Claude Code leaves the dialog open past the deadline. After you attach, Claude Code closes the dialog and drops the message only if it stays unanswered for a full deadline period.
+ * When the dialog stays unanswered past the [`dialogExpiry`](</docs/en/settings-reference#dialogexpiry>) deadline, Claude Code closes it and drops the message. The deadline defaults to five minutes. While no terminal is attached to a [background session](</docs/en/agent-view>), Claude Code leaves the dialog open past the deadline. After you attach, Claude Code closes the dialog and drops the message only if it stays unanswered for a full deadline period.
* If this session’s permission-mode class changes while messages are held, Claude Code re-applies the inbound rules, delivers the messages they now accept, and shows a notice.
* If a settings change makes `refuse` apply while messages are held, Claude Code drops every held message and reports a refusal to each sender it can reach.
@@ -196,7 +198,7 @@
Non-interactive sessions
-Claude Code binds an inbox socket for a [`claude -p`](</docs/en/headless>) session like an interactive one, so a long-running `-p` worker can receive messages and appears in the listing. When you start a session in [bare mode](</docs/en/headless#start-faster-with-bare-mode>), Claude Code doesn’t bind the socket, so that session can’t receive messages and doesn’t appear in the agent list. A `-p` session can’t show the approval dialog. When the inbound default holds a message there, Claude Code keeps it for the same [`dialogExpiry`](</docs/en/settings#available-settings>) deadline the dialog uses, five minutes by default:
+Claude Code binds an inbox socket for a [`claude -p`](</docs/en/headless>) session like an interactive one, so a long-running `-p` worker can receive messages and appears in the listing. When you start a session in [bare mode](</docs/en/headless#start-faster-with-bare-mode>), Claude Code doesn’t bind the socket, so that session can’t receive messages and doesn’t appear in the agent list. A `-p` session can’t show the approval dialog. When the inbound default holds a message there, Claude Code keeps it for the same [`dialogExpiry`](</docs/en/settings-reference#dialogexpiry>) deadline the dialog uses, five minutes by default:
* **Before the deadline** : if a mode or settings change allows the message, Claude Code delivers it.
* **Past the deadline** : Claude Code drops the message and reports it as expired to a sender it can reach.
@@ -209,7 +211,7 @@
The session’s inbox socket
-Read this section when a session you expect isn’t in the agent list, when you want a script or hook to post into a session, or when a sandboxed command can’t reach the socket. Claude Code binds an inbox socket for each session with cross-session messaging enabled, where other sessions on the machine deliver messages. It restricts the socket to your operating-system user, so on a shared machine another user’s sessions can’t reach it. For which session kinds bind one, see Non-interactive sessions. You can find the path in two places:
+Read this section when a session you expect isn’t in the agent list, when you want a script or hook to post into a session, or when a sandboxed command can’t reach the socket. Claude Code binds an inbox socket for each session with cross-session messaging enabled, where other sessions on the machine deliver messages. The socket is a Unix domain socket on macOS and Linux, including Linux inside WSL 2, and a named pipe on native Windows. For which session kinds bind one, see Non-interactive sessions. You can find the socket’s path in two places:
* `/status` shows it in the `Peer address` row. The path is prefixed with `uds:`.
* Claude Code exports it to [hooks](</docs/en/hooks>) and Bash commands as the [`CLAUDE_CODE_MESSAGING_SOCKET`](</docs/en/env-vars#variables>) environment variable:
@@ -217,13 +219,18 @@
* When a session starts before Claude Code has fetched the feature flag that turns messaging on, such as the first session after you install Claude Code or upgrade from a version without messaging, Claude Code binds the inbox and exports the variable as soon as the fetch completes. Hooks and processes that started before that point keep the variable unset, while later hooks and Bash commands see it.
* Each session exports its own socket, never one inherited from a parent session.
-Alongside the path, Claude Code exports a per-session token as [`CLAUDE_CODE_MESSAGING_TOKEN`](</docs/en/env-vars#variables>). A script posting to its own session’s socket can send `{"type":"auth","token":"<token>"}` as the first line of its connection. The own-child rules below say when Claude Code consults the token and how it treats a message it can’t verify. Claude Code runs messages arriving on the socket through the same inbound controls as any other peer message, with one exception and one prerequisite:
+On macOS and Linux, Claude Code restricts the socket to your operating-system user. On native Windows, it instead requires each connection to authenticate first with a key that only your operating-system user can read. Either way, on a shared machine another user’s sessions can’t deliver to it. Alongside the socket’s path, Claude Code exports a per-session token as [`CLAUDE_CODE_MESSAGING_TOKEN`](</docs/en/env-vars#variables>). A script posting to its own session’s socket can send `{"type":"auth","token":"<token>"}` as the first line of its connection, where `<token>` is the value of `CLAUDE_CODE_MESSAGING_TOKEN`. Whether Claude Code requires the line depends on the platform:
+
+ * **macOS and Linux, including WSL 2** : the line is optional. Claude Code accepts a connection with or without it.
+ * **Native Windows** : the line is required. Claude Code closes any connection whose first line isn’t a valid auth line and delivers nothing from that connection.
+
+The own-child rules below say when Claude Code consults the token and how it treats a message it can’t verify. Claude Code runs messages arriving on the socket through the same inbound controls as any other peer message, with one exception and one prerequisite:
* **Own-child messages** : when no `crossSessionInbound` value applies, Claude Code delivers a message it verifies came from the session’s own child processes, such as a hook or Bash command posting back to its own session’s socket.
- * On Linux, including inside WSL 2, Claude Code can verify by process evidence even for a child that has already exited. On macOS it can verify that way only while the posting process is still running, and in a container where Claude Code runs as process ID 1 it has no process evidence at all.
- * Where that process evidence is missing, on macOS after the posting process has exited and in containers where Claude Code runs as process ID 1, Claude Code verifies a child that sent the session’s exported [`CLAUDE_CODE_MESSAGING_TOKEN`](</docs/en/env-vars#variables>) as its first-line auth frame.
+ * On Linux, including inside WSL 2, Claude Code can verify by process evidence even for a child that has already exited. On macOS it can verify that way only while the posting process is still running, and in a container where Claude Code runs as process ID 1 it has no process evidence at all. On native Windows it also has none.
+ * On macOS after the posting process has exited and in containers where Claude Code runs as process ID 1, that process evidence is missing, and Claude Code instead verifies a child that sent the session’s exported [`CLAUDE_CODE_MESSAGING_TOKEN`](</docs/en/env-vars#variables>) in the auth line that opened its connection. On native Windows, that token is the only way Claude Code verifies an own-child message.
* When Claude Code can verify neither way, it treats the message like any other that asserts no permission class, so a session that bypasses permission prompts holds it for your approval.
- * **Sandboxed sessions** : control whether a Bash command can reach the socket from inside the [sandbox](</docs/en/sandboxing>) with the sandbox’s Unix-socket settings, [`sandbox.network.allowAllUnixSockets` and `sandbox.network.allowUnixSockets`](</docs/en/settings#sandbox-settings>).
+ * **Sandboxed sessions** : control whether a Bash command can reach the socket from inside the [sandbox](</docs/en/sandboxing>) with the sandbox’s Unix-socket settings, [`sandbox.network.allowAllUnixSockets` and `sandbox.network.allowUnixSockets`](</docs/en/settings-reference#sandbox-settings>).
##
@@ -239,7 +246,7 @@
Require approval for cross-machine messages
-Set [`isolatePeerMachines`](</docs/en/settings#available-settings>) to `true` to require your explicit approval before any `SendMessage` reaches a session beyond this machine:
+Set [`isolatePeerMachines`](</docs/en/settings-reference#isolatepeermachines>) to `true` to require your explicit approval before any `SendMessage` reaches a session beyond this machine:
{
"isolatePeerMachines": true
@@ -258,7 +265,7 @@
* **Stop receiving** : set `crossSessionInbound` to `refuse`, and Claude Code drops inbound peer messages without delivering them. From project or local settings, `refuse` applies over every other source, and from your user settings it applies unless managed settings or the `--settings` flag set a value.
* **Stop sending and listing** : add [permission deny rules](</docs/en/permissions#tool-specific-permission-rules>) naming `SendMessage` and `ListAgents`. Both take the bare tool name with no specifier.
-Administrators can turn both sides off for an organization in [managed settings](</docs/en/permissions#managed-settings>), combining the deny rules with the `refuse`:
+Administrators can turn both sides off for an organization in [managed settings](</docs/en/managed-settings>), combining the deny rules with the `refuse`:
{
"permissions": {
@@ -275,9 +282,9 @@
Availability
-Cross-session messaging requires Claude Code v2.1.224 or later. Availability also depends on your platform, provider, and configuration:
-
- * **Operating system** : available on macOS and Linux, including Linux inside WSL 2. Claude Code doesn’t offer cross-session messaging on native Windows.
+Cross-session messaging requires Claude Code v2.1.224 or later on macOS, Linux, and WSL 2, and v2.1.234 or later on native Windows. Availability also depends on your platform, provider, and configuration:
+
+ * **Operating system** : available on macOS, Windows, and Linux, including Linux inside WSL 2.
* **Provider** : not available on Amazon Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform, or Microsoft Foundry.
* **Feature-flag evaluation** : when any of [`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`, `DISABLE_TELEMETRY`, `DO_NOT_TRACK`, or `DISABLE_GROWTHBOOK`](</docs/en/env-vars#variables>) turns off the feature-flag evaluation the feature depends on, cross-session messaging stays off. Each variable’s row says which values do that. Unset whichever applies. These variables can come from your shell, from a settings file’s `env` map, or from managed settings.
@@ -316,7 +323,7 @@
* [Subagents](</docs/en/sub-agents#resume-subagents>) and [agent teams](</docs/en/agent-teams#messages-between-agents>): messaging within a single session or team
* [Background agents](</docs/en/agent-view>): dispatch and monitor the parallel sessions you might message
* [Remote Control](</docs/en/remote-control>): connect this session to reach your sessions on other machines
- * [Settings](</docs/en/settings#available-settings>): `crossSessionInbound`, `isolatePeerMachines`, and `dialogExpiry`
+ * [Settings](</docs/en/settings-reference#all-settings>): `crossSessionInbound`, `isolatePeerMachines`, and `dialogExpiry`
* [Permission modes](</docs/en/permission-modes>): the modes behind the inbound default’s two classes
* [Tools reference](</docs/en/tools-reference>): the `ListAgents` and `SendMessage` rows in the tools table
* [Run agents in parallel](</docs/en/agents>): compare the ways Claude Code runs multiple agents
Show diff (126 lines)
--- a/cross-session-messaging.md
+++ b/cross-session-messaging.md
@@ -12,7 +12,7 @@
* **Hand over a finding** : when one session discovers a breaking change or makes a decision, Claude summarizes it for the session working on the affected area, instead of you re-explaining it there.
* **Coordinate parallel worktrees** : when sessions work the same repository in separate [worktrees](</docs/en/worktrees>), Claude can tell the other sessions what landed.
- * **Get status from long-running work** : have a migration or test run report back to the session you’re watching, or ask it yourself from there.
+ * **Get status from long-running work** : have a migration or test run report back to the session you’re watching, or ask it yourself from there. If that session is on this machine, Claude can also ask it for one notice when it next goes idle or exits.
* **Message across machines** : reach one of your sessions on another machine or on the web.
Use messaging between independent sessions that you start and steer yourself. Claude Code has a dedicated feature for each of the other ways to run or reach multiple sessions, so use the one built for what you’re doing instead:
@@ -49,7 +49,13 @@
Message delivery
-The receiving Claude reads the message between tool calls during an active turn, so a running tool is never interrupted. When the receiving session is idle, Claude Code starts a new turn with the message. Between two ordinary interactive sessions with default settings, Claude Code delivers the message. Delivery isn’t guaranteed in every configuration, though. Claude Code refuses a message over the size cap in the sending session, before it leaves. The receiving session checks each arriving message against its own inbound controls, and the check ends in one of three outcomes:
+The receiving Claude reads the message between tool calls during an active turn, so a running tool is never interrupted. When the receiving session is idle, Claude Code starts a new turn with the message. Claude Code refuses a message in the following cases:
+
+ * The message is over the size cap. Claude Code refuses it in the sending session, before it leaves.
+ * A rapid burst to a session on this machine has reached what that session’s inbox accepts. Claude Code refuses further messages to that session.
+ * The reply target on this machine fails a safety check, such as a symlinked target or an endpoint that isn’t the expected process. [Refusing to send a cross-session message](</docs/en/errors#refusing-to-send-a-cross-session-message>) lists these checks.
+
+The receiving session checks each arriving message against its own inbound controls, and the check ends in one of three outcomes:
* **Delivered** : Claude Code passes the message to the receiving Claude.
* **Held** : Claude Code sets the message aside undelivered. A held message reaches Claude only when you approve it or a later mode or settings change allows it.
@@ -61,16 +67,57 @@
+Get a notice when another session goes idle
+
+Claude can ask one of your sessions on this machine to send back one notice when that session next goes idle or exits. Idle here means the session finished a turn with nothing queued. Use it when you’re waiting on a long task in another session and want to hear when it’s done instead of checking. Requires Claude Code v2.1.236 or later in both sessions.
+
+####
+
+
+
+Ask for a notice
+
+Tell Claude what you’re waiting on. This prompt asks for a notice from the migration session:
+
+ Tell me when the migration session finishes what it's working on
+
+Claude subscribes with the `SendMessage` tool’s `notify_when_idle` input, either attached to a message it’s sending anyway or on its own. On its own, Claude Code subscribes without starting a turn or spending tokens in the watched session, and sends the notice right away if that session is already idle. Attached to a message, Claude Code delivers the message first and sends the notice later.
+
+####
+
+
+
+What each session shows
+
+The watched session shows a line saying another process asked to be told when the session is next idle. The asking session shows the notice as a line naming the watched session. The line can include the time that session’s turn finished and a one-line status from that turn. If the asking session is idle, Claude Code starts a new turn with the notice.
+
+####
+
+
+
+Limits
+
+The notice is one-shot: Claude Code sends it once from the watched session, and neither session polls the other. If no notice arrives within 12 hours, Claude Code drops the subscription and tells Claude, so it doesn’t keep waiting. Each side’s inbound controls apply to a notice like a message:
+
+ * **`refuse` on either side**: nothing arrives. The watched session drops the request without recording or answering it, so the subscription expires unanswered after 12 hours, and an asking session with `refuse` never subscribes.
+ * **`hold` on either side**: the notice arrives with less. The watched session leaves the one-line status out, and the asking session shows the notice in your transcript without delivering it to Claude.
+
+Only the Claude in your main conversation can subscribe, and only to your sessions on this machine. When a subagent or an agent team teammate sets `notify_when_idle`, Claude Code makes no subscription and tells it so. When Claude asks for a notice from any other agent, such as a teammate, a subagent, or a session beyond this machine, Claude Code refuses the whole call, including any message attached to it, and reports the refusal to Claude so it can resend the message without the request.
+
+###
+
+
+
See which sessions Claude can reach
Claude finds a message’s target on its own, so you don’t need to run anything before asking it to send. To see for yourself which sessions Claude can reach, run the `/list-agents` command. It lists each session with the name it answers to, and that name is where Claude addresses a message. The listing covers:
* **Subagents** : agents running inside the current session. [Agent team](</docs/en/agent-teams>) teammates aren’t listed; Claude messages them through the team’s own roster.
- * **Your other local sessions** : Claude Code sessions running on the same machine, including [background sessions](</docs/en/agent-view>). A session appears only when it binds an inbox socket.
+ * **Your other local sessions** : Claude Code sessions running on the same machine, including [background sessions](</docs/en/agent-view>). A session appears only when it binds an inbox socket. The worker process that the [supervisor process](</docs/en/agent-view#the-supervisor-process>) keeps ready for your next background session appears once you dispatch work to it.
* **Your cloud sessions** : your [Claude Code on the web](</docs/en/claude-code-on-the-web>) sessions, shown while this session is connected to [Remote Control](</docs/en/remote-control>). Claude Code labels them `cloud` in the listing.
* **Your Remote Control sessions on other machines** : shown while this session is connected to [Remote Control](</docs/en/remote-control>), and labeled `Remote Control`. Claude Code shows `offline` as the status of a session whose Remote Control connection has dropped.
-Claude addresses a session beyond this machine by name, the same as a local session. See Message sessions on other machines for how those messages travel. A session answers to the name you set with the [`/rename`](</docs/en/commands>) command or the [`--name`](</docs/en/cli-reference#cli-flags>) flag. When you don’t set one, Claude Code names the session itself. For an interactive session, Claude Code derives the name from the working directory’s folder name, such as `my-app-3f` in a `my-app` directory. When you rename a session, or start or resume an interactive one, with a name another live session on this machine already uses, Claude Code leaves the name with the session that already has it and [renames yours to a variant](</docs/en/sessions#name-your-sessions>). Sessions can still share a name, for example when one of them runs an earlier version of Claude Code or the shared name is one Claude Code generated. Claude Code shows each local session’s working directory in the `/list-agents` output, so you can tell same-named sessions apart when they run in different directories. Claude addresses the message in one of two ways, depending on how many live sessions answer to the name:
+Claude Code reads your cloud and Remote Control session lists newest first and stops after a bounded number of pages for each. If your account has more of those sessions than fit, Claude Code doesn’t list the older ones, and Claude can’t message them by name. When this happens, Claude Code says so in the listing, and Claude sees the same note when it sends a message. Claude addresses a session beyond this machine by name, the same as a local session. See Message sessions on other machines for how those messages travel. A session answers to the name you set with the [`/rename`](</docs/en/commands>) command or the [`--name`](</docs/en/cli-reference#cli-flags>) flag. When you don’t set one, Claude Code names the session itself. For an interactive session, Claude Code derives the name from the working directory’s folder name, such as `my-app-3f` in a `my-app` directory. When you rename a session, or start or resume an interactive one, with a name another live session on this machine already uses, Claude Code leaves the name with the session that already has it and [renames yours to a variant](</docs/en/sessions#name-your-sessions>). Sessions can still share a name, for example when one of them runs an earlier version of Claude Code or the shared name is one Claude Code generated. Claude Code shows each local session’s working directory in the `/list-agents` output, so you can tell same-named sessions apart when they run in different directories. Claude addresses the message in one of two ways, depending on how many live sessions answer to the name:
* **One session answers to the name** : Claude Code delivers the message on the name alone.
* **Several sessions share the name, or Claude Code couldn’t check everywhere your sessions run** : Claude adds a short identifier to each row of its listing and uses the identifier in the address.
@@ -139,9 +186,9 @@
* **Deny** , or dismissing the dialog, drops it.
* When the dialog stays unanswered past the [`dialogExpiry`](</docs/en/settings#available-settings>) deadline, Claude Code closes it and drops the message. The deadline defaults to five minutes. While no terminal is attached to a [background session](</docs/en/agent-view>), Claude Code leaves the dialog open past the deadline. After you attach, Claude Code closes the dialog and drops the message only if it stays unanswered for a full deadline period.
* If this session’s permission-mode class changes while messages are held, Claude Code re-applies the inbound rules, delivers the messages they now accept, and shows a notice.
- * If a change makes `refuse` apply while messages are held, Claude Code drops every held message and reports a denial to each sender it can reach.
-
-When the sender runs on the same machine, Claude Code tells the sending session what happened. A notice appears there when the message is held, and a follow-up reports the outcome when the receiver later delivers, denies, or expires it. A message refused on arrival produces no sender-side notice. Claude Code holds at most 100 messages, separately from the delivery queue, and past that drops the oldest.
+ * If a settings change makes `refuse` apply while messages are held, Claude Code drops every held message and reports a refusal to each sender it can reach.
+
+When the sender is an interactive session on the same machine, Claude Code shows a notice there when the receiver holds the message, and a follow-up when the receiver later delivers, denies, or expires it. If the receiver refuses it, Claude Code shows a notice there that the receiver isn’t accepting cross-session messages and tells the sender’s Claude not to wait or resend. Claude Code holds at most 100 messages, separately from the delivery queue, and past that drops the oldest.
###
@@ -220,7 +267,7 @@
"crossSessionInbound": "refuse"
}
-With this in place, Claude Code still binds each session’s inbox socket, but drops every message that arrives on it without delivering anything to Claude. Denying `SendMessage` also removes messaging to subagents and agent-team teammates, since the same tool serves both. A refusing session shows no visible change, in its own `/status` or in other sessions’ listings, so confirm the setting from the session’s configuration.
+With this in place, Claude Code still binds each session’s inbox socket, but drops every message that arrives on it without delivering anything to Claude. Denying `SendMessage` also removes messaging to subagents and agent-team teammates, since the same tool serves both. A refusing session shows no visible change, in its own `/status` or in the listings of other sessions on the same machine, so to confirm it, check the settings files that apply to that session rather than its status.
##
@@ -242,6 +289,7 @@
* **Inbound controls** : the receiving session’s inbound controls can hold or drop what you send it.
* **Cloud session missing** : a cloud session appears only while this session is connected to [Remote Control](</docs/en/remote-control>).
* **Other-machine session missing** : a session on another of your machines appears only when it runs with [Remote Control](</docs/en/remote-control>) and this session is connected as well.
+ * **Older cloud or other-machine session missing** : Claude Code reads those session lists newest first and stops after a bounded number of pages, so Claude can’t message a session that fell past them by name.
* **Starting a conversation** : Message sessions on other machines covers starting a conversation with a session beyond this machine.
In a session with messaging, `/status` also shows a `Peer address` row with the session’s own inbox address.
@@ -256,7 +304,8 @@
* **Plain text only** : Claude sends only plain text across sessions. Structured [agent team](</docs/en/agent-teams>) protocol messages stay within a team.
* **Same-machine message size is capped** : Claude Code refuses a message to a session on this machine once its serialized form passes about a million characters. The refusal [names the exact sizes](</docs/en/errors#message-too-large-for-cross-session-delivery>). Nothing reaches the receiving session.
- * **Message loops are throttled** : Claude Code rate-limits repeated messages per sender, drops identical repeats arriving within a short window, and caps accepted messages waiting for Claude to read them at 50 per session. A message loop between two sessions therefore stops on its own.
+ * **Rapid bursts to one session are refused at the sender** : once a rapid burst of messages to a session on this machine reaches what that session’s inbox accepts, Claude Code refuses further sends in the sending session. The [refusal names the burst](</docs/en/errors#too-many-messages-to-this-session-just-now>) and tells Claude to batch the rest into one message or wait. Before v2.1.236, Claude Code reported those sends as sent while the receiving session dropped them.
+ * **Message loops are throttled** : in the receiving session, Claude Code rate-limits repeated messages per sender, drops identical repeats arriving within a short window, and queues at most 50 accepted messages for Claude to read. A message loop between two sessions therefore stops on its own. When the rate limit, repeat check, or queue cap drops a message from an interactive session on this machine, Claude Code tells that session which one dropped it and tells its Claude not to resend right away.
##
--- a/cross-session-messaging.md
+++ b/cross-session-messaging.md
@@ -49,7 +49,7 @@
Message delivery
-The receiving Claude reads the message between tool calls during an active turn, so a running tool is never interrupted. When the receiving session is idle, Claude Code starts a new turn with the message. Between two ordinary interactive sessions with default settings, Claude Code delivers the message. Delivery isn’t guaranteed in every configuration, though. The receiving session checks each arriving message against its own inbound controls, and the check ends in one of three outcomes:
+The receiving Claude reads the message between tool calls during an active turn, so a running tool is never interrupted. When the receiving session is idle, Claude Code starts a new turn with the message. Between two ordinary interactive sessions with default settings, Claude Code delivers the message. Delivery isn’t guaranteed in every configuration, though. Claude Code refuses a message over the size cap in the sending session, before it leaves. The receiving session checks each arriving message against its own inbound controls, and the check ends in one of three outcomes:
* **Delivered** : Claude Code passes the message to the receiving Claude.
* **Held** : Claude Code sets the message aside undelivered. A held message reaches Claude only when you approve it or a later mode or settings change allows it.
@@ -255,6 +255,7 @@
The limits here are properties of the messaging channel itself and apply wherever the feature runs. For platform and provider gaps, see Availability instead.
* **Plain text only** : Claude sends only plain text across sessions. Structured [agent team](</docs/en/agent-teams>) protocol messages stay within a team.
+ * **Same-machine message size is capped** : Claude Code refuses a message to a session on this machine once its serialized form passes about a million characters. The refusal [names the exact sizes](</docs/en/errors#message-too-large-for-cross-session-delivery>). Nothing reaches the receiving session.
* **Message loops are throttled** : Claude Code rate-limits repeated messages per sender, drops identical repeats arriving within a short window, and caps accepted messages waiting for Claude to read them at 50 per session. A message loop between two sessions therefore stops on its own.
##
--- a/cross-session-messaging.md
+++ b/cross-session-messaging.md
@@ -37,7 +37,11 @@
Explain what we just did to the session working on the payments API
-For what the message Claude writes looks like when it arrives, including an example of one, see what a message looks like.
+To name the target yourself, mention the session in your prompt: type `@` followed by the first letters of the session’s name and pick the session from the typeahead, the same way you [@-mention a subagent](</docs/en/sub-agents#invoke-subagents-explicitly>). Requires Claude Code v2.1.232 or later. Claude Code inserts the mention, such as `@api-worker`, and tells Claude which session it names, so Claude can message that session without listing your sessions first. This prompt names the target with a mention:
+
+ Let @api-worker know the schema migration finished
+
+Once you type at least one letter after the `@`, Claude Code suggests your other live sessions on this machine; after a bare `@`, session rows don’t appear. A cloud or Remote Control session appears in the suggestions only after Claude has already listed or messaged your sessions beyond this machine. You can also type the mention without the picker. When more than one live session answers to the mentioned name, Claude asks you which one you mean before sending. For what the message Claude writes looks like when it arrives, including an example of one, see what a message looks like.
###
@@ -63,10 +67,13 @@
* **Subagents** : agents running inside the current session. [Agent team](</docs/en/agent-teams>) teammates aren’t listed; Claude messages them through the team’s own roster.
* **Your other local sessions** : Claude Code sessions running on the same machine, including [background sessions](</docs/en/agent-view>). A session appears only when it binds an inbox socket.
- * **Your cloud sessions** : your [Claude Code on the web](</docs/en/claude-code-on-the-web>) sessions, shown while this session is connected to [Remote Control](</docs/en/remote-control>).
- * **Your Remote Control sessions on other machines** : shown while this session is connected to [Remote Control](</docs/en/remote-control>), and labeled `Remote Control`.
-
-Claude addresses a session beyond this machine by name, the same as a local session. See Message sessions on other machines for how those messages travel. A session answers to the name you set with the [`/rename`](</docs/en/commands>) command or the [`--name`](</docs/en/cli-reference#cli-flags>) flag. When you don’t set one, Claude Code names the session itself. An interactive session gets a name derived from its working directory’s folder name, such as `myapp-3f`. Two sessions can end up with the same name. The `/list-agents` output shows each local session’s working directory, which tells same-named sessions apart when they run in different directories. Claude’s own listing adds a short identifier to each row and uses it in the address when names collide.
+ * **Your cloud sessions** : your [Claude Code on the web](</docs/en/claude-code-on-the-web>) sessions, shown while this session is connected to [Remote Control](</docs/en/remote-control>). Claude Code labels them `cloud` in the listing.
+ * **Your Remote Control sessions on other machines** : shown while this session is connected to [Remote Control](</docs/en/remote-control>), and labeled `Remote Control`. Claude Code shows `offline` as the status of a session whose Remote Control connection has dropped.
+
+Claude addresses a session beyond this machine by name, the same as a local session. See Message sessions on other machines for how those messages travel. A session answers to the name you set with the [`/rename`](</docs/en/commands>) command or the [`--name`](</docs/en/cli-reference#cli-flags>) flag. When you don’t set one, Claude Code names the session itself. For an interactive session, Claude Code derives the name from the working directory’s folder name, such as `my-app-3f` in a `my-app` directory. When you rename a session, or start or resume an interactive one, with a name another live session on this machine already uses, Claude Code leaves the name with the session that already has it and [renames yours to a variant](</docs/en/sessions#name-your-sessions>). Sessions can still share a name, for example when one of them runs an earlier version of Claude Code or the shared name is one Claude Code generated. Claude Code shows each local session’s working directory in the `/list-agents` output, so you can tell same-named sessions apart when they run in different directories. Claude addresses the message in one of two ways, depending on how many live sessions answer to the name:
+
+ * **One session answers to the name** : Claude Code delivers the message on the name alone.
+ * **Several sessions share the name, or Claude Code couldn’t check everywhere your sessions run** : Claude adds a short identifier to each row of its listing and uses the identifier in the address.
###
@@ -121,7 +128,7 @@
`hold`| Claude Code shows a notice for each message and doesn’t deliver it. If an `accept` later applies, per the [precedence rules](</docs/en/settings#available-settings>), Claude Code releases the held messages
`refuse`| Claude Code drops each message without delivering it
-To see which value applies, follow the `crossSessionInbound` precedence rules in the [settings reference](</docs/en/settings#available-settings>). When no value applies, Claude Code decides per message from the two sessions’ permission modes. It groups sessions that [bypass permission prompts](</docs/en/permission-modes#skip-all-checks-with-bypasspermissions-mode>) into one class, and every other session into the other. Plan mode counts as bypassing in sessions with bypass permissions available, and [auto](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>), `acceptEdits`, and `dontAsk` count as prompting:
+Beyond editing a settings file, you can select the value in the `/config` row **Messages from your other sessions**. Claude Code writes the value you select to your user settings. The row requires Claude Code v2.1.232 or later and doesn’t appear while managed settings or the `--settings` flag sets the key, since a user-settings value wouldn’t apply then. Claude Code rejects the `/config crossSessionInbound=value` shorthand for this key. To see which value applies, follow the `crossSessionInbound` precedence rules in the [settings reference](</docs/en/settings#available-settings>). When no value applies, Claude Code decides per message from the two sessions’ permission modes. It groups sessions that [bypass permission prompts](</docs/en/permission-modes#skip-all-checks-with-bypasspermissions-mode>) into one class, and every other session into the other. Plan mode counts as bypassing in sessions with bypass permissions available, and [auto](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>), `acceptEdits`, and `dontAsk` count as prompting:
* **The receiving session prompts for permissions** : Claude Code delivers each message. It holds one for your approval only when the sending session identifies itself as bypassing permission prompts.
* **The receiving session bypasses permission prompts** : Claude Code holds each message for your approval. It delivers one only when the sending session identifies itself as also bypassing.
--- a/cross-session-messaging.md
+++ b/cross-session-messaging.md
@@ -82,7 +82,7 @@
On another of your machines| Through Anthropic servers, arriving over that machine’s [Remote Control](</docs/en/remote-control>) connection
On [Claude Code on the web](</docs/en/claude-code-on-the-web>)| Through Anthropic servers, straight to the cloud session
-Starting a conversation with a session on another of your machines requires Claude Code v2.1.225 or later and a target that appears in the listing. Before v2.1.225, Claude could only reply to a message that arrived from one. Same-machine delivery works wherever the feature is enabled. Each session registers itself in files on disk and binds its inbox socket there. When Claude lists or messages your local sessions, Claude Code reads those files to find them, so two sessions can reach each other only when they can see the same files. A container has its own filesystem, so a session inside it and a session on the host can’t reach each other. Two sessions inside the same container can still message each other, including on a [self-hosted runner](</docs/en/self-hosted-environments>). A reply needs a reply address, and almost every message carries one. A message to a session beyond this machine, sent while the sending session isn’t connected to Remote Control, still goes through as a direct request to Anthropic servers, but it arrives without a reply address, so the receiver can’t answer it. Claude is told as much when it sends. To require your approval before any message goes beyond this machine, set `isolatePeerMachines`.
+Starting a conversation with a session on another of your machines requires Claude Code v2.1.225 or later and a target that appears in the listing. Before v2.1.225, Claude could only reply to a message that arrived from one. Same-machine delivery works wherever the feature is enabled. Each session registers itself in files on disk and binds its inbox socket there. When Claude lists or messages your local sessions, Claude Code reads those files to find them, so two sessions can reach each other only when they can see the same files. A container has its own filesystem, so a session inside it and a session on the host can’t reach each other. Two sessions inside the same container can still message each other, including on a [self-hosted runner](</docs/en/self-hosted-environments>). While this session is connected to Remote Control, when you message a session on another of your machines, Claude Code shows the message in that session’s conversation under this session’s Remote Control name. The Claude on that machine can reply to that name. For example, when this session is connected to Remote Control as `laptop-graceful-unicorn` and you message your desktop, you see the message in the desktop session under `laptop-graceful-unicorn`. If this session isn’t connected to Remote Control when Claude sends to a session beyond this machine, the message still goes through, but without a reply address, so the receiving Claude can’t answer it. Claude is told as much when it sends. To require your approval before any message goes beyond this machine, set `isolatePeerMachines`.
##
@@ -103,7 +103,7 @@
What a message looks like
-When the message arrives, it appears in the conversation with its sender, queued while Claude is mid-turn or starting a new turn right away when the session is idle. Once Claude has read it, Claude Code collapses it to a one-line `Message from` row, which `Ctrl+O` expands. A message is a piece of text one Claude writes to another. Claude receives it with the sender’s name and a reply address, except for a one-way cross-machine message, which carries no reply address. You see the name and the text, and the receiving session gets only that text, never the sender’s conversation history or files. This example is a message one Claude wrote to another, as the receiving session sees it:
+When the message arrives, it appears in the conversation under the sender’s session name and stays there. Claude Code queues it while Claude is mid-turn, or starts a new turn with it right away when the session is idle. A message is a piece of text one Claude writes to another. Claude receives it with the sender’s name and a reply address, except for a one-way cross-machine message, which carries no reply address. You see the name and the text, and the receiving session gets only that text, never the sender’s conversation history or files. This example is a message one Claude wrote to another, as the receiving session sees it:
Schema migration finished: the new column is tenant_id, and rebasing on main is safe now.
@@ -158,11 +158,17 @@
Read this section when a session you expect isn’t in the agent list, when you want a script or hook to post into a session, or when a sandboxed command can’t reach the socket. Claude Code binds an inbox socket for each session with cross-session messaging enabled, where other sessions on the machine deliver messages. It restricts the socket to your operating-system user, so on a shared machine another user’s sessions can’t reach it. For which session kinds bind one, see Non-interactive sessions. You can find the path in two places:
* `/status` shows it in the `Peer address` row. The path is prefixed with `uds:`.
- * Claude Code exports it to [hooks](</docs/en/hooks>) and Bash commands as the [`CLAUDE_CODE_MESSAGING_SOCKET`](</docs/en/env-vars#variables>) environment variable. The export happens before any hook runs, including `SessionStart`. Each session exports its own socket, never one inherited from a parent session.
-
-Claude Code runs messages arriving on the socket through the same inbound controls as any other peer message, with one exception and one prerequisite:
-
- * **Own-child messages** : when no `crossSessionInbound` value applies, Claude Code delivers a message it verifies came from the session’s own child processes, such as a hook or Bash command posting back to its own session’s socket. On Linux, including inside WSL 2, it can verify even for a child that has already exited, while on macOS it can verify only while the posting process is still running, and in containers where Claude Code runs as process ID 1 it can’t verify at all. Whenever it can’t verify, it treats the message like any other that asserts no permission class, so a session that bypasses permission prompts holds it for your approval.
+ * Claude Code exports it to [hooks](</docs/en/hooks>) and Bash commands as the [`CLAUDE_CODE_MESSAGING_SOCKET`](</docs/en/env-vars#variables>) environment variable:
+ * In a session that starts with messaging on, Claude Code exports the variable before any hook runs, including `SessionStart`.
+ * When a session starts before Claude Code has fetched the feature flag that turns messaging on, such as the first session after you install Claude Code or upgrade from a version without messaging, Claude Code binds the inbox and exports the variable as soon as the fetch completes. Hooks and processes that started before that point keep the variable unset, while later hooks and Bash commands see it.
+ * Each session exports its own socket, never one inherited from a parent session.
+
+Alongside the path, Claude Code exports a per-session token as [`CLAUDE_CODE_MESSAGING_TOKEN`](</docs/en/env-vars#variables>). A script posting to its own session’s socket can send `{"type":"auth","token":"<token>"}` as the first line of its connection. The own-child rules below say when Claude Code consults the token and how it treats a message it can’t verify. Claude Code runs messages arriving on the socket through the same inbound controls as any other peer message, with one exception and one prerequisite:
+
+ * **Own-child messages** : when no `crossSessionInbound` value applies, Claude Code delivers a message it verifies came from the session’s own child processes, such as a hook or Bash command posting back to its own session’s socket.
+ * On Linux, including inside WSL 2, Claude Code can verify by process evidence even for a child that has already exited. On macOS it can verify that way only while the posting process is still running, and in a container where Claude Code runs as process ID 1 it has no process evidence at all.
+ * Where that process evidence is missing, on macOS after the posting process has exited and in containers where Claude Code runs as process ID 1, Claude Code verifies a child that sent the session’s exported [`CLAUDE_CODE_MESSAGING_TOKEN`](</docs/en/env-vars#variables>) as its first-line auth frame.
+ * When Claude Code can verify neither way, it treats the message like any other that asserts no permission class, so a session that bypasses permission prompts holds it for your approval.
* **Sandboxed sessions** : control whether a Bash command can reach the socket from inside the [sandbox](</docs/en/sandboxing>) with the sandbox’s Unix-socket settings, [`sandbox.network.allowAllUnixSockets` and `sandbox.network.allowUnixSockets`](</docs/en/settings#sandbox-settings>).
##
--- a/cross-session-messaging.md
+++ b/cross-session-messaging.md
@@ -63,7 +63,7 @@
* **Subagents** : agents running inside the current session. [Agent team](</docs/en/agent-teams>) teammates aren’t listed; Claude messages them through the team’s own roster.
* **Your other local sessions** : Claude Code sessions running on the same machine, including [background sessions](</docs/en/agent-view>). A session appears only when it binds an inbox socket.
- * **Your cloud sessions** : your [Claude Code on the web](</docs/en/claude-code-on-the-web>) sessions. These appear when this session has cloud access: a claude.ai login on the first-party Anthropic API and an organization policy that allows cloud sessions.
+ * **Your cloud sessions** : your [Claude Code on the web](</docs/en/claude-code-on-the-web>) sessions, shown while this session is connected to [Remote Control](</docs/en/remote-control>).
* **Your Remote Control sessions on other machines** : shown while this session is connected to [Remote Control](</docs/en/remote-control>), and labeled `Remote Control`.
Claude addresses a session beyond this machine by name, the same as a local session. See Message sessions on other machines for how those messages travel. A session answers to the name you set with the [`/rename`](</docs/en/commands>) command or the [`--name`](</docs/en/cli-reference#cli-flags>) flag. When you don’t set one, Claude Code names the session itself. An interactive session gets a name derived from its working directory’s folder name, such as `myapp-3f`. Two sessions can end up with the same name. The `/list-agents` output shows each local session’s working directory, which tells same-named sessions apart when they run in different directories. Claude’s own listing adds a short identifier to each row and uses it in the address when names collide.
@@ -130,7 +130,7 @@
* **Approve** delivers that one message to Claude.
* **Deny** , or dismissing the dialog, drops it.
- * Left unanswered past the [`dialogExpiry`](</docs/en/settings#available-settings>) deadline, the dialog closes and Claude Code drops the message. The deadline defaults to five minutes.
+ * When the dialog stays unanswered past the [`dialogExpiry`](</docs/en/settings#available-settings>) deadline, Claude Code closes it and drops the message. The deadline defaults to five minutes. While no terminal is attached to a [background session](</docs/en/agent-view>), Claude Code leaves the dialog open past the deadline. After you attach, Claude Code closes the dialog and drops the message only if it stays unanswered for a full deadline period.
* If this session’s permission-mode class changes while messages are held, Claude Code re-applies the inbound rules, delivers the messages they now accept, and shows a notice.
* If a change makes `refuse` apply while messages are held, Claude Code drops every held message and reports a denial to each sender it can reach.
@@ -142,7 +142,12 @@
Non-interactive sessions
-Claude Code binds an inbox socket for a [`claude -p`](</docs/en/headless>) session like an interactive one, so a long-running `-p` worker can receive messages and appears in the listing. When you start a session in [bare mode](</docs/en/headless#start-faster-with-bare-mode>), Claude Code doesn’t bind the socket, so that session can’t receive messages and doesn’t appear in the agent list. A `-p` session can’t show the approval dialog. When the inbound default holds a message there, Claude Code delivers it if a later mode or settings change allows it, and otherwise drops it when the [`dialogExpiry`](</docs/en/settings#available-settings>) deadline passes and reports the expiry to the sender. Before v2.1.225, a held message stayed held in a `-p` session, with no sender notice and no expiry. To let a `-p` worker take messages unattended, start it with `crossSessionInbound` set to `accept` in its `--settings` value. An `accept` in your user settings also works but applies to every session you run.
+Claude Code binds an inbox socket for a [`claude -p`](</docs/en/headless>) session like an interactive one, so a long-running `-p` worker can receive messages and appears in the listing. When you start a session in [bare mode](</docs/en/headless#start-faster-with-bare-mode>), Claude Code doesn’t bind the socket, so that session can’t receive messages and doesn’t appear in the agent list. A `-p` session can’t show the approval dialog. When the inbound default holds a message there, Claude Code keeps it for the same [`dialogExpiry`](</docs/en/settings#available-settings>) deadline the dialog uses, five minutes by default:
+
+ * **Before the deadline** : if a mode or settings change allows the message, Claude Code delivers it.
+ * **Past the deadline** : Claude Code drops the message and reports it as expired to a sender it can reach.
+
+Set `dialogExpiry` to `"never"` to keep default-held messages until the session ends. A message held by an explicit `hold` setting doesn’t expire; Claude Code delivers it only when an `accept` later applies. When the session ends with messages still held, Claude Code reports them as expired to each sender it can reach. Before v2.1.225, no deadline applied in a `-p` session: a held message stayed held unless a permission-mode change during the run delivered it, and a session that ended with held messages reported nothing to their senders. To let a `-p` worker take messages unattended, start it with `crossSessionInbound` set to `accept` in its `--settings` value. An `accept` in your user settings also works but applies to every session you run.
###
@@ -180,7 +185,7 @@
"isolatePeerMachines": true
}
-With this set, Claude Code asks for your approval before Claude’s message to a session beyond this machine leaves, even in `bypassPermissions` mode, which skips ordinary permission prompts. A `true` from any settings scope applies, so a checked-in project file can turn the requirement on but not off. Messages between sessions on the same machine don’t prompt.
+With this set, Claude Code asks for your approval before Claude’s message to a session beyond this machine leaves, even in `bypassPermissions` mode, which skips ordinary permission prompts. A `true` from any settings scope applies, so a checked-in project file can turn the requirement on but not off. Claude Code doesn’t prompt for messages between sessions on the same machine.
###
@@ -222,7 +227,7 @@
* **`/list-agents` works but a send didn’t arrive**: messaging is on, and something narrower applies:
* **Deny rules** : a permission deny rule removes the `SendMessage` and `ListAgents` tools.
* **Inbound controls** : the receiving session’s inbound controls can hold or drop what you send it.
- * **Cloud session missing** : a cloud session appears only when this session has cloud access.
+ * **Cloud session missing** : a cloud session appears only while this session is connected to [Remote Control](</docs/en/remote-control>).
* **Other-machine session missing** : a session on another of your machines appears only when it runs with [Remote Control](</docs/en/remote-control>) and this session is connected as well.
* **Starting a conversation** : Message sessions on other machines covers starting a conversation with a session beyond this machine.
--- a/cross-session-messaging.md
+++ b/cross-session-messaging.md
@@ -13,7 +13,7 @@
* **Hand over a finding** : when one session discovers a breaking change or makes a decision, Claude summarizes it for the session working on the affected area, instead of you re-explaining it there.
* **Coordinate parallel worktrees** : when sessions work the same repository in separate [worktrees](</docs/en/worktrees>), Claude can tell the other sessions what landed.
* **Get status from long-running work** : have a migration or test run report back to the session you’re watching, or ask it yourself from there.
- * **Reply across machines** : answer a message that arrived from one of your sessions on another machine or on the web. Across machines, Claude can only reply. It can’t start the exchange.
+ * **Message across machines** : reach one of your sessions on another machine or on the web.
Use messaging between independent sessions that you start and steer yourself. Claude Code has a dedicated feature for each of the other ways to run or reach multiple sessions, so use the one built for what you’re doing instead:
@@ -63,9 +63,10 @@
* **Subagents** : agents running inside the current session. [Agent team](</docs/en/agent-teams>) teammates aren’t listed; Claude messages them through the team’s own roster.
* **Your other local sessions** : Claude Code sessions running on the same machine, including [background sessions](</docs/en/agent-view>). A session appears only when it binds an inbox socket.
- * **Sessions beyond this machine** : shown while [Remote Control](</docs/en/remote-control>) is connected and labeled `Remote Control`. These are your sessions on other machines and your [Claude Code on the web](</docs/en/claude-code-on-the-web>) sessions. Claude can’t send a message to start a conversation with one of these sessions. It can only reply to a message that arrived from one of them. See Message sessions on other machines.
-
-A session answers to the name you set with the [`/rename`](</docs/en/commands>) command or the [`--name`](</docs/en/cli-reference#cli-flags>) flag. When you don’t set one, Claude Code names the session itself. An interactive session gets a name derived from its working directory’s folder name, such as `myapp-3f`. Two sessions can end up with the same name. The `/list-agents` output shows each local session’s working directory, which tells same-named sessions apart when they run in different directories. Claude’s own listing adds a short identifier to each row and uses it in the address when names collide.
+ * **Your cloud sessions** : your [Claude Code on the web](</docs/en/claude-code-on-the-web>) sessions. These appear when this session has cloud access: a claude.ai login on the first-party Anthropic API and an organization policy that allows cloud sessions.
+ * **Your Remote Control sessions on other machines** : shown while this session is connected to [Remote Control](</docs/en/remote-control>), and labeled `Remote Control`.
+
+Claude addresses a session beyond this machine by name, the same as a local session. See Message sessions on other machines for how those messages travel. A session answers to the name you set with the [`/rename`](</docs/en/commands>) command or the [`--name`](</docs/en/cli-reference#cli-flags>) flag. When you don’t set one, Claude Code names the session itself. An interactive session gets a name derived from its working directory’s folder name, such as `myapp-3f`. Two sessions can end up with the same name. The `/list-agents` output shows each local session’s working directory, which tells same-named sessions apart when they run in different directories. Claude’s own listing adds a short identifier to each row and uses it in the address when names collide.
###
@@ -73,15 +74,15 @@
Message sessions on other machines
-Where the other session runs decides how a message travels and what Claude here can send:
-
-Where the other session runs| How the message travels| What Claude here can send
----|---|---
-On this machine| Over a per-session socket, never through Anthropic servers| New messages and replies
-On another of your machines| Through Anthropic servers, arriving over that machine’s [Remote Control](</docs/en/remote-control>) connection| Replies only
-On [Claude Code on the web](</docs/en/claude-code-on-the-web>)| Through Anthropic servers, straight to the cloud session| Replies only
-
-Same-machine delivery works wherever the feature is enabled. Each session registers itself in files on disk and binds its inbox socket there. When Claude lists or messages your local sessions, Claude Code reads those files to find them, so two sessions can reach each other only when they can see the same files. A container has its own filesystem, so a session inside it and a session on the host can’t reach each other. Two sessions inside the same container can still message each other, including on a [self-hosted runner](</docs/en/self-hosted-environments>). A reply needs a reply address, and almost every message carries one. A reply to a session beyond this machine, sent while the replying session isn’t connected to Remote Control, still goes through as a direct request to Anthropic servers, but it arrives without a reply address, so the receiver can’t answer it. Claude is told as much when it sends. To require your approval before any message goes beyond this machine, set `isolatePeerMachines`.
+How a message travels, and whether it passes through Anthropic servers, depends on where the target session runs:
+
+Where the other session runs| How the message travels
+---|---
+On this machine| Over a per-session socket, never through Anthropic servers
+On another of your machines| Through Anthropic servers, arriving over that machine’s [Remote Control](</docs/en/remote-control>) connection
+On [Claude Code on the web](</docs/en/claude-code-on-the-web>)| Through Anthropic servers, straight to the cloud session
+
+Starting a conversation with a session on another of your machines requires Claude Code v2.1.225 or later and a target that appears in the listing. Before v2.1.225, Claude could only reply to a message that arrived from one. Same-machine delivery works wherever the feature is enabled. Each session registers itself in files on disk and binds its inbox socket there. When Claude lists or messages your local sessions, Claude Code reads those files to find them, so two sessions can reach each other only when they can see the same files. A container has its own filesystem, so a session inside it and a session on the host can’t reach each other. Two sessions inside the same container can still message each other, including on a [self-hosted runner](</docs/en/self-hosted-environments>). A reply needs a reply address, and almost every message carries one. A message to a session beyond this machine, sent while the sending session isn’t connected to Remote Control, still goes through as a direct request to Anthropic servers, but it arrives without a reply address, so the receiver can’t answer it. Claude is told as much when it sends. To require your approval before any message goes beyond this machine, set `isolatePeerMachines`.
##
@@ -102,7 +103,7 @@
What a message looks like
-When the message arrives, it appears in the conversation with its sender, queued while Claude is mid-turn or starting a new turn right away when the session is idle. Once Claude has read it, Claude Code collapses it to a one-line `Message from` row, which `Ctrl+O` expands. A message is a piece of text one Claude writes to another. Claude receives it with the sender’s name and a reply address, except for a one-way cross-machine reply, which carries no reply address. You see the name and the text, and the receiving session gets only that text, never the sender’s conversation history or files. This example is a message one Claude wrote to another, as the receiving session sees it:
+When the message arrives, it appears in the conversation with its sender, queued while Claude is mid-turn or starting a new turn right away when the session is idle. Once Claude has read it, Claude Code collapses it to a one-line `Message from` row, which `Ctrl+O` expands. A message is a piece of text one Claude writes to another. Claude receives it with the sender’s name and a reply address, except for a one-way cross-machine message, which carries no reply address. You see the name and the text, and the receiving session gets only that text, never the sender’s conversation history or files. This example is a message one Claude wrote to another, as the receiving session sees it:
Schema migration finished: the new column is tenant_id, and rebasing on main is safe now.
@@ -141,7 +142,7 @@
Non-interactive sessions
-Claude Code binds an inbox socket for a [`claude -p`](</docs/en/headless>) session like an interactive one, so a long-running `-p` worker can receive messages and appears in the listing. When you start a session in [bare mode](</docs/en/headless#start-faster-with-bare-mode>), Claude Code doesn’t bind the socket, so that session can’t receive messages and doesn’t appear in the agent list. A `-p` session can’t show the approval dialog. A held message stays held there. Claude Code delivers it only if a later mode or settings change allows it, under the same rules as above. To let a `-p` worker take messages unattended, start it with `crossSessionInbound` set to `accept` in its `--settings` value. An `accept` in your user settings also works but applies to every session you run.
+Claude Code binds an inbox socket for a [`claude -p`](</docs/en/headless>) session like an interactive one, so a long-running `-p` worker can receive messages and appears in the listing. When you start a session in [bare mode](</docs/en/headless#start-faster-with-bare-mode>), Claude Code doesn’t bind the socket, so that session can’t receive messages and doesn’t appear in the agent list. A `-p` session can’t show the approval dialog. When the inbound default holds a message there, Claude Code delivers it if a later mode or settings change allows it, and otherwise drops it when the [`dialogExpiry`](</docs/en/settings#available-settings>) deadline passes and reports the expiry to the sender. Before v2.1.225, a held message stayed held in a `-p` session, with no sender notice and no expiry. To let a `-p` worker take messages unattended, start it with `crossSessionInbound` set to `accept` in its `--settings` value. An `accept` in your user settings also works but applies to every session you run.
###
@@ -179,7 +180,7 @@
"isolatePeerMachines": true
}
-With this set, Claude Code asks for your approval before Claude’s reply to a session beyond this machine leaves, even in `bypassPermissions` mode, which skips ordinary permission prompts. A `true` from any settings scope applies, so a checked-in project file can turn the requirement on but not off. Messages between sessions on the same machine don’t prompt.
+With this set, Claude Code asks for your approval before Claude’s message to a session beyond this machine leaves, even in `bypassPermissions` mode, which skips ordinary permission prompts. A `true` from any settings scope applies, so a checked-in project file can turn the requirement on but not off. Messages between sessions on the same machine don’t prompt.
###
@@ -218,7 +219,12 @@
To check a session, type `/list-agents`, also available as `/peers`. The result separates a session that doesn’t have the feature from a session where something narrower blocked a message, such as a missing `SendMessage` tool or a refused send:
* **`/list-agents` isn’t recognized**: the session doesn’t have cross-session messaging. Work through the requirements above, starting with `claude --version` for the version requirement.
- * **`/list-agents` works but a send didn’t arrive**: messaging is on, and something narrower applies. A permission deny rule removes the `SendMessage` and `ListAgents` tools, the receiving session’s inbound controls can hold or drop what you send it, and a session beyond this machine is reply-only.
+ * **`/list-agents` works but a send didn’t arrive**: messaging is on, and something narrower applies:
+ * **Deny rules** : a permission deny rule removes the `SendMessage` and `ListAgents` tools.
+ * **Inbound controls** : the receiving session’s inbound controls can hold or drop what you send it.
+ * **Cloud session missing** : a cloud session appears only when this session has cloud access.
+ * **Other-machine session missing** : a session on another of your machines appears only when it runs with [Remote Control](</docs/en/remote-control>) and this session is connected as well.
+ * **Starting a conversation** : Message sessions on other machines covers starting a conversation with a session beyond this machine.
In a session with messaging, `/status` also shows a `Peer address` row with the session’s own inbox address.
@@ -241,7 +247,7 @@
* [Subagents](</docs/en/sub-agents#resume-subagents>) and [agent teams](</docs/en/agent-teams#messages-between-agents>): messaging within a single session or team
* [Background agents](</docs/en/agent-view>): dispatch and monitor the parallel sessions you might message
- * [Remote Control](</docs/en/remote-control>): connect the sessions that cross-machine messaging travels through
+ * [Remote Control](</docs/en/remote-control>): connect this session to reach your sessions on other machines
* [Settings](</docs/en/settings#available-settings>): `crossSessionInbound`, `isolatePeerMachines`, and `dialogExpiry`
* [Permission modes](</docs/en/permission-modes>): the modes behind the inbound default’s two classes
* [Tools reference](</docs/en/tools-reference>): the `ListAgents` and `SendMessage` rows in the tools table
Show diff (251 lines)
--- a/cross-session-messaging.md
+++ b/cross-session-messaging.md
@@ -0,0 +1,248 @@
+Cross-session messaging requires Claude Code v2.1.224 or later and runs on macOS and Linux. When a session meets the requirements, messaging is on with nothing to enable. See Availability for provider requirements and how to confirm a session has it.
+
+Cross-session messaging lets Claude deliver a message from one of your Claude Code sessions to another. When a change in one session breaks what another is building on, Claude can warn that session before you notice. When one session settles a question another is blocked on, Claude can send the answer across. A message is a piece of text one Claude writes to another, never conversation history or files. To move a whole conversation or its context, [resume the session](</docs/en/sessions#resume-a-session>) instead. Claude uses two tools for this: `ListAgents` to discover which agents it can reach, and `SendMessage` to deliver a message to one of them by name. With the same `SendMessage` tool, Claude can also message [subagents](</docs/en/sub-agents#resume-subagents>) and [agent team](</docs/en/agent-teams>) teammates within a single session or team. This page covers messages between your independent sessions.
+
+##
+
+
+
+When to use cross-session messaging
+
+Use messaging when one of your sessions has something another session needs mid-task. Claude can send a message on its own when it sees the need, for example after making a change that affects work another session is doing, or you can ask it to send one. The common cases:
+
+ * **Hand over a finding** : when one session discovers a breaking change or makes a decision, Claude summarizes it for the session working on the affected area, instead of you re-explaining it there.
+ * **Coordinate parallel worktrees** : when sessions work the same repository in separate [worktrees](</docs/en/worktrees>), Claude can tell the other sessions what landed.
+ * **Get status from long-running work** : have a migration or test run report back to the session you’re watching, or ask it yourself from there.
+ * **Reply across machines** : answer a message that arrived from one of your sessions on another machine or on the web. Across machines, Claude can only reply. It can’t start the exchange.
+
+Use messaging between independent sessions that you start and steer yourself. Claude Code has a dedicated feature for each of the other ways to run or reach multiple sessions, so use the one built for what you’re doing instead:
+
+ * To continue one conversation in another terminal, or share its context with a new session, [resume the session](</docs/en/sessions#resume-a-session>)
+ * For a coordinated team of sessions Claude spawns and supervises, use [agent teams](</docs/en/agent-teams>)
+ * To watch and steer many sessions from one place, use [agent view](</docs/en/agent-view>)
+ * To steer a session yourself from your phone or another device, rather than have sessions message each other, use [Remote Control](</docs/en/remote-control>)
+ * To push external events, such as CI results or chat messages, into a session, use [channels](</docs/en/channels>)
+
+##
+
+
+
+Message another session
+
+When one of your sessions learns something another session needs, such as a finding, a status, or a decision, Claude passes it along instead of you copy-pasting between terminals. Claude discovers the target with `ListAgents` and sends with `SendMessage`, so you never call either tool yourself. Claude can decide to send a message without being asked, and you can also prompt for one. To prompt one yourself, tell Claude what you want the other session to know or do. This example is a prompt you type, not a message Claude sends:
+
+ Ask the session running in my other terminal whether the migration finished
+
+Claude writes the actual message itself, so your prompt can leave the content to Claude. This prompt asks for a summary without dictating its wording, and what Claude sends varies:
+
+ Explain what we just did to the session working on the payments API
+
+For what the message Claude writes looks like when it arrives, including an example of one, see what a message looks like.
+
+###
+
+
+
+Message delivery
+
+The receiving Claude reads the message between tool calls during an active turn, so a running tool is never interrupted. When the receiving session is idle, Claude Code starts a new turn with the message. Between two ordinary interactive sessions with default settings, Claude Code delivers the message. Delivery isn’t guaranteed in every configuration, though. The receiving session checks each arriving message against its own inbound controls, and the check ends in one of three outcomes:
+
+ * **Delivered** : Claude Code passes the message to the receiving Claude.
+ * **Held** : Claude Code sets the message aside undelivered. A held message reaches Claude only when you approve it or a later mode or settings change allows it.
+ * **Refused** : Claude Code drops the message without delivering it.
+
+Once delivered, the message counts toward [usage](</docs/en/costs>) like a prompt you type, and the receiving Claude can reply to the sender the same way, except in the one-way cross-machine case. Permission boundaries stay per-session. Claude is instructed never to ask another session for an action that was denied or blocked in its own session, or that its own permission settings would block, and to route that work back to you instead. On the receiving side, the receiving session’s own permission prompts and rules still apply to anything the message asks for.
+
+###
+
+
+
+See which sessions Claude can reach
+
+Claude finds a message’s target on its own, so you don’t need to run anything before asking it to send. To see for yourself which sessions Claude can reach, run the `/list-agents` command. It lists each session with the name it answers to, and that name is where Claude addresses a message. The listing covers:
+
+ * **Subagents** : agents running inside the current session. [Agent team](</docs/en/agent-teams>) teammates aren’t listed; Claude messages them through the team’s own roster.
+ * **Your other local sessions** : Claude Code sessions running on the same machine, including [background sessions](</docs/en/agent-view>). A session appears only when it binds an inbox socket.
+ * **Sessions beyond this machine** : shown while [Remote Control](</docs/en/remote-control>) is connected and labeled `Remote Control`. These are your sessions on other machines and your [Claude Code on the web](</docs/en/claude-code-on-the-web>) sessions. Claude can’t send a message to start a conversation with one of these sessions. It can only reply to a message that arrived from one of them. See Message sessions on other machines.
+
+A session answers to the name you set with the [`/rename`](</docs/en/commands>) command or the [`--name`](</docs/en/cli-reference#cli-flags>) flag. When you don’t set one, Claude Code names the session itself. An interactive session gets a name derived from its working directory’s folder name, such as `myapp-3f`. Two sessions can end up with the same name. The `/list-agents` output shows each local session’s working directory, which tells same-named sessions apart when they run in different directories. Claude’s own listing adds a short identifier to each row and uses it in the address when names collide.
+
+###
+
+
+
+Message sessions on other machines
+
+Where the other session runs decides how a message travels and what Claude here can send:
+
+Where the other session runs| How the message travels| What Claude here can send
+---|---|---
+On this machine| Over a per-session socket, never through Anthropic servers| New messages and replies
+On another of your machines| Through Anthropic servers, arriving over that machine’s [Remote Control](</docs/en/remote-control>) connection| Replies only
+On [Claude Code on the web](</docs/en/claude-code-on-the-web>)| Through Anthropic servers, straight to the cloud session| Replies only
+
+Same-machine delivery works wherever the feature is enabled. Each session registers itself in files on disk and binds its inbox socket there. When Claude lists or messages your local sessions, Claude Code reads those files to find them, so two sessions can reach each other only when they can see the same files. A container has its own filesystem, so a session inside it and a session on the host can’t reach each other. Two sessions inside the same container can still message each other, including on a [self-hosted runner](</docs/en/self-hosted-environments>). A reply needs a reply address, and almost every message carries one. A reply to a session beyond this machine, sent while the replying session isn’t connected to Remote Control, still goes through as a direct request to Anthropic servers, but it arrives without a reply address, so the receiver can’t answer it. Claude is told as much when it sends. To require your approval before any message goes beyond this machine, set `isolatePeerMachines`.
+
+##
+
+
+
+How a session treats an incoming message
+
+When session A messages session B, Claude Code tells B’s Claude that the message came from another session, not from you, and limits what the message can do:
+
+ * **It can’t approve anything** : a message from another session never counts as your consent, so it can’t answer a pending permission prompt on your behalf.
+ * **It can’t change configuration** : Claude Code instructs the receiving Claude never to change permission settings, `CLAUDE.md`, or other configuration because another session asked.
+ * **Commands don’t run** : a command in the message’s text, such as `/compact`, arrives as plain text. Claude Code never executes it.
+ * **Permission prompts still fire** : if acting on the message requires a permission the receiving session doesn’t have, you see the same prompt you’d see for any other work.
+
+###
+
+
+
+What a message looks like
+
+When the message arrives, it appears in the conversation with its sender, queued while Claude is mid-turn or starting a new turn right away when the session is idle. Once Claude has read it, Claude Code collapses it to a one-line `Message from` row, which `Ctrl+O` expands. A message is a piece of text one Claude writes to another. Claude receives it with the sender’s name and a reply address, except for a one-way cross-machine reply, which carries no reply address. You see the name and the text, and the receiving session gets only that text, never the sender’s conversation history or files. This example is a message one Claude wrote to another, as the receiving session sees it:
+
+ Schema migration finished: the new column is tenant_id, and rebasing on main is safe now.
+
+###
+
+
+
+Control inbound messages
+
+Set [`crossSessionInbound`](</docs/en/settings#available-settings>) to choose what a session does with messages arriving from your other sessions:
+
+Value| Behavior
+---|---
+`accept`| Claude Code delivers each message to Claude
+`hold`| Claude Code shows a notice for each message and doesn’t deliver it. If an `accept` later applies, per the [precedence rules](</docs/en/settings#available-settings>), Claude Code releases the held messages
+`refuse`| Claude Code drops each message without delivering it
+
+To see which value applies, follow the `crossSessionInbound` precedence rules in the [settings reference](</docs/en/settings#available-settings>). When no value applies, Claude Code decides per message from the two sessions’ permission modes. It groups sessions that [bypass permission prompts](</docs/en/permission-modes#skip-all-checks-with-bypasspermissions-mode>) into one class, and every other session into the other. Plan mode counts as bypassing in sessions with bypass permissions available, and [auto](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>), `acceptEdits`, and `dontAsk` count as prompting:
+
+ * **The receiving session prompts for permissions** : Claude Code delivers each message. It holds one for your approval only when the sending session identifies itself as bypassing permission prompts.
+ * **The receiving session bypasses permission prompts** : Claude Code holds each message for your approval. It delivers one only when the sending session identifies itself as also bypassing.
+
+When the default holds a message, Claude Code opens an approval dialog in the receiving session. The dialog shows the sender and a preview:
+
+ * **Approve** delivers that one message to Claude.
+ * **Deny** , or dismissing the dialog, drops it.
+ * Left unanswered past the [`dialogExpiry`](</docs/en/settings#available-settings>) deadline, the dialog closes and Claude Code drops the message. The deadline defaults to five minutes.
+ * If this session’s permission-mode class changes while messages are held, Claude Code re-applies the inbound rules, delivers the messages they now accept, and shows a notice.
+ * If a change makes `refuse` apply while messages are held, Claude Code drops every held message and reports a denial to each sender it can reach.
+
+When the sender runs on the same machine, Claude Code tells the sending session what happened. A notice appears there when the message is held, and a follow-up reports the outcome when the receiver later delivers, denies, or expires it. A message refused on arrival produces no sender-side notice. Claude Code holds at most 100 messages, separately from the delivery queue, and past that drops the oldest.
+
+###
+
+
+
+Non-interactive sessions
+
+Claude Code binds an inbox socket for a [`claude -p`](</docs/en/headless>) session like an interactive one, so a long-running `-p` worker can receive messages and appears in the listing. When you start a session in [bare mode](</docs/en/headless#start-faster-with-bare-mode>), Claude Code doesn’t bind the socket, so that session can’t receive messages and doesn’t appear in the agent list. A `-p` session can’t show the approval dialog. A held message stays held there. Claude Code delivers it only if a later mode or settings change allows it, under the same rules as above. To let a `-p` worker take messages unattended, start it with `crossSessionInbound` set to `accept` in its `--settings` value. An `accept` in your user settings also works but applies to every session you run.
+
+###
+
+
+
+The session’s inbox socket
+
+Read this section when a session you expect isn’t in the agent list, when you want a script or hook to post into a session, or when a sandboxed command can’t reach the socket. Claude Code binds an inbox socket for each session with cross-session messaging enabled, where other sessions on the machine deliver messages. It restricts the socket to your operating-system user, so on a shared machine another user’s sessions can’t reach it. For which session kinds bind one, see Non-interactive sessions. You can find the path in two places:
+
+ * `/status` shows it in the `Peer address` row. The path is prefixed with `uds:`.
+ * Claude Code exports it to [hooks](</docs/en/hooks>) and Bash commands as the [`CLAUDE_CODE_MESSAGING_SOCKET`](</docs/en/env-vars#variables>) environment variable. The export happens before any hook runs, including `SessionStart`. Each session exports its own socket, never one inherited from a parent session.
+
+Claude Code runs messages arriving on the socket through the same inbound controls as any other peer message, with one exception and one prerequisite:
+
+ * **Own-child messages** : when no `crossSessionInbound` value applies, Claude Code delivers a message it verifies came from the session’s own child processes, such as a hook or Bash command posting back to its own session’s socket. On Linux, including inside WSL 2, it can verify even for a child that has already exited, while on macOS it can verify only while the posting process is still running, and in containers where Claude Code runs as process ID 1 it can’t verify at all. Whenever it can’t verify, it treats the message like any other that asserts no permission class, so a session that bypasses permission prompts holds it for your approval.
+ * **Sandboxed sessions** : control whether a Bash command can reach the socket from inside the [sandbox](</docs/en/sandboxing>) with the sandbox’s Unix-socket settings, [`sandbox.network.allowAllUnixSockets` and `sandbox.network.allowUnixSockets`](</docs/en/settings#sandbox-settings>).
+
+##
+
+
+
+Restrict cross-session messaging
+
+Beyond the per-message defaults, you can narrow messaging in two ways. Require your approval before any message leaves the machine, or turn messaging off for a session or an organization.
+
+###
+
+
+
+Require approval for cross-machine messages
+
+Set [`isolatePeerMachines`](</docs/en/settings#available-settings>) to `true` to require your explicit approval before any `SendMessage` reaches a session beyond this machine:
+
+ {
+ "isolatePeerMachines": true
+ }
+
+With this set, Claude Code asks for your approval before Claude’s reply to a session beyond this machine leaves, even in `bypassPermissions` mode, which skips ordinary permission prompts. A `true` from any settings scope applies, so a checked-in project file can turn the requirement on but not off. Messages between sessions on the same machine don’t prompt.
+
+###
+
+
+
+Turn off cross-session messaging
+
+Receiving and sending are separate controls, so turn off whichever direction you need, or both. Use `crossSessionInbound` for messages that arrive, and permission rules for what Claude here can send or list:
+
+ * **Stop receiving** : set `crossSessionInbound` to `refuse`, and Claude Code drops inbound peer messages without delivering them. From project or local settings, `refuse` applies over every other source, and from your user settings it applies unless managed settings or the `--settings` flag set a value.
+ * **Stop sending and listing** : add [permission deny rules](</docs/en/permissions#tool-specific-permission-rules>) naming `SendMessage` and `ListAgents`. Both take the bare tool name with no specifier.
+
+Administrators can turn both sides off for an organization in [managed settings](</docs/en/permissions#managed-settings>), combining the deny rules with the `refuse`:
+
+ {
+ "permissions": {
+ "deny": ["SendMessage", "ListAgents"]
+ },
+ "crossSessionInbound": "refuse"
+ }
+
+With this in place, Claude Code still binds each session’s inbox socket, but drops every message that arrives on it without delivering anything to Claude. Denying `SendMessage` also removes messaging to subagents and agent-team teammates, since the same tool serves both. A refusing session shows no visible change, in its own `/status` or in other sessions’ listings, so confirm the setting from the session’s configuration.
+
+##
+
+
+
+Availability
+
+Cross-session messaging requires Claude Code v2.1.224 or later. Availability also depends on your platform, provider, and configuration:
+
+ * **Operating system** : available on macOS and Linux, including Linux inside WSL 2. Claude Code doesn’t offer cross-session messaging on native Windows.
+ * **Provider** : not available on Amazon Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform, or Microsoft Foundry.
+ * **Feature-flag evaluation** : when any of [`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`, `DISABLE_TELEMETRY`, `DO_NOT_TRACK`, or `DISABLE_GROWTHBOOK`](</docs/en/env-vars#variables>) turns off the feature-flag evaluation the feature depends on, cross-session messaging stays off. Each variable’s row says which values do that. Unset whichever applies. These variables can come from your shell, from a settings file’s `env` map, or from managed settings.
+
+To check a session, type `/list-agents`, also available as `/peers`. The result separates a session that doesn’t have the feature from a session where something narrower blocked a message, such as a missing `SendMessage` tool or a refused send:
+
+ * **`/list-agents` isn’t recognized**: the session doesn’t have cross-session messaging. Work through the requirements above, starting with `claude --version` for the version requirement.
+ * **`/list-agents` works but a send didn’t arrive**: messaging is on, and something narrower applies. A permission deny rule removes the `SendMessage` and `ListAgents` tools, the receiving session’s inbound controls can hold or drop what you send it, and a session beyond this machine is reply-only.
+
+In a session with messaging, `/status` also shows a `Peer address` row with the session’s own inbox address.
+
+##
+
+
+
+Limitations
+
+The limits here are properties of the messaging channel itself and apply wherever the feature runs. For platform and provider gaps, see Availability instead.
+
+ * **Plain text only** : Claude sends only plain text across sessions. Structured [agent team](</docs/en/agent-teams>) protocol messages stay within a team.
+ * **Message loops are throttled** : Claude Code rate-limits repeated messages per sender, drops identical repeats arriving within a short window, and caps accepted messages waiting for Claude to read them at 50 per session. A message loop between two sessions therefore stops on its own.
+
+##
+
+
+
+Related resources
+
+ * [Subagents](</docs/en/sub-agents#resume-subagents>) and [agent teams](</docs/en/agent-teams#messages-between-agents>): messaging within a single session or team
+ * [Background agents](</docs/en/agent-view>): dispatch and monitor the parallel sessions you might message
+ * [Remote Control](</docs/en/remote-control>): connect the sessions that cross-machine messaging travels through
+ * [Settings](</docs/en/settings#available-settings>): `crossSessionInbound`, `isolatePeerMachines`, and `dialogExpiry`
+ * [Permission modes](</docs/en/permission-modes>): the modes behind the inbound default’s two classes
+ * [Tools reference](</docs/en/tools-reference>): the `ListAgents` and `SendMessage` rows in the tools table
+ * [Run agents in parallel](</docs/en/agents>): compare the ways Claude Code runs multiple agents