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.
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 and agent team 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, 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.
- To continue one conversation in another terminal, or share its context with a new session, resume the session
- For a coordinated team of sessions Claude spawns and supervises, use agent teams
- To watch and steer many sessions from one place, use agent view
- To steer a session yourself from your phone or another device, rather than have sessions message each other, use Remote Control
- To push external events, such as CI results or chat messages, into a session, use 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 withListAgents 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:
@ followed by the first letters of the sessionâs name and pick the session from the typeahead, the same way you @-mention a subagent. 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:
@, 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.
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 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 lists these checks.
- 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.
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: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:refuseon 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 withrefusenever subscribes.holdon 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.
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 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. A session appears only when it binds an inbox socket. The worker process that 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 sessions, shown while this session is connected to Remote Control. Claude Code labels them
cloudin the listing. - Your Remote Control sessions on other machines: shown while this session is connected to Remote Control, and labeled
Remote Control. Claude Code showsofflineas the status of a session whose Remote Control connection has dropped.
/rename command or the --name 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.
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. 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.
Message sessions on other machines
How a message travels, and whether it passes through Anthropic servers, depends on where the target session runs:
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. 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.
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 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:Control inbound messages
SetcrossSessionInbound to choose what a session does with messages arriving from your other sessions:
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. When no value applies, Claude Code decides per message from the two sessionsâ permission modes. It groups sessions that bypass permission prompts into one class, and every other session into the other. Plan mode counts as bypassing in sessions with bypass permissions available, and auto, 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.
- Approve delivers that one message to Claude.
- Deny, or dismissing the dialog, drops it.
- When the dialog stays unanswered past the
dialogExpirydeadline, Claude Code closes it and drops the message. The deadline defaults to five minutes. While no terminal is attached to a background session, 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
refuseapply while messages are held, Claude Code drops every held message and reports a refusal to each sender it can reach.
Non-interactive sessions
Claude Code binds an inbox socket for aclaude -p 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, 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 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.
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.
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:/statusshows it in thePeer addressrow. The path is prefixed withuds:.- Claude Code exports it to hooks and Bash commands as the
CLAUDE_CODE_MESSAGING_SOCKETenvironment 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.
- In a session that starts with messaging on, Claude Code exports the variable before any hook runs, including
CLAUDE_CODE_MESSAGING_TOKEN. 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.
- Own-child messages: when no
crossSessionInboundvalue 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.
- 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_TOKENin 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 with the sandboxâs Unix-socket settings,
sandbox.network.allowAllUnixSocketsandsandbox.network.allowUnixSockets.
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
SetisolatePeerMachines to true to require your explicit approval before any SendMessage reaches a session beyond this machine:
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
Receiving and sending are separate controls, so turn off whichever direction you need, or both. UsecrossSessionInbound for messages that arrive, and permission rules for what Claude here can send or list:
- Stop receiving: set
crossSessionInboundtorefuse, and Claude Code drops inbound peer messages without delivering them. From project or local settings,refuseapplies over every other source, and from your user settings it applies unless managed settings or the--settingsflag set a value. - Stop sending and listing: add permission deny rules naming
SendMessageandListAgents. Both take the bare tool name with no specifier.
refuse:
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
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, orDISABLE_GROWTHBOOKturns 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âsenvmap, or from managed settings.
/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-agentsisnât recognized: the session doesnât have cross-session messaging. Work through the requirements above, starting withclaude --versionfor the version requirement./list-agentsworks but a send didnât arrive: messaging is on, and something narrower applies:- Deny rules: a permission deny rule removes the
SendMessageandListAgentstools. - 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.
- Other-machine session missing: a session on another of your machines appears only when it runs with 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.
- Deny rules: a permission deny rule removes the
/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 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. 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 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.
Related resources
- Subagents and agent teams: messaging within a single session or team
- Background agents: dispatch and monitor the parallel sessions you might message
- Remote Control: connect this session to reach your sessions on other machines
- Settings:
crossSessionInbound,isolatePeerMachines, anddialogExpiry - Permission modes: the modes behind the inbound defaultâs two classes
- Tools reference: the
ListAgentsandSendMessagerows in the tools table - Run agents in parallel: compare the ways Claude Code runs multiple agents