Cross-Session Messaging in Claude Code

From the guide: Claude Code Comprehensive Guide

Since v2.1.224, every interactive Claude Code session on a Mac or Linux box binds a Unix socket the moment it starts (mine sits at /tmp/cc-socks/38590.sock, with owner-only permissions), and any other session you run can drop a text message into it.1 Two tools drive the feature: ListAgents discovers which of your sessions are reachable, and SendMessage delivers to one of them by name.2 Nothing to enable, nothing to configure. If both sessions run v2.1.224 or later on the same machine, they can already talk.

TL;DR

Claude Code sessions can now message each other: on one machine over local sockets that never touch Anthropic’s servers, and across machines through Remote Control – reply-only at launch, with v2.1.225 adding the ability to start those conversations by name.15 A message is plain text only, never conversation history, files, or permissions, and the receiving session treats it as input, not authority: it cannot approve prompts, change configuration, or execute commands.1 The feature turns a fleet of independent terminals into something closer to a team, and the best uses are coordination messages you used to ferry by hand: “the migration finished,” “I renamed that column,” “main is safe to rebase.” The sharpest trap is silent absence: four unrelated privacy environment variables each quietly disable the feature.3

What Shipped

The v2.1.224 release added cross-session SendMessage with ListAgents discovery on macOS and Linux; v2.1.225 extended it so a session can also start a conversation with your Remote Control sessions on other machines, where previously it could only reply.45

Three surfaces let you see the machinery:

  • /list-agents (alias /peers) lists every session Claude can reach: subagents inside the current session, your other local sessions including background ones, and, while Remote Control is connected, your sessions on other machines and on Claude Code on the web.1
  • /status shows a Peer address row with the session’s own inbox socket, prefixed uds:.1
  • CLAUDE_CODE_MESSAGING_SOCKET is exported to every hook and Bash command, holding the session’s own socket path.6 More on why that matters below.

Verifying on my own machine: a session running v2.1.226 lists two peer sessions with their state (“busy”) and age, and the socket file carries srw------- permissions: readable and writable by my user alone, which is the boundary on shared machines.1

Sessions answer to names. Set one with /rename or the --name flag; otherwise Claude Code derives one from the working directory, like myapp-3f.1 When two sessions collide on a name, the listing distinguishes them by working directory and a short identifier.1

The Trust Model Is the Interesting Part

Anthropic’s design answers a question most multi-agent systems fumble: what is a message from another agent worth? The answer here is precise: a message is information, never authority.1

When session A messages session B, four rules bind what arrives:1

  1. It cannot approve anything. A pending permission prompt in B ignores anything A says. Only you answer prompts.
  2. It cannot change configuration. The receiving Claude is instructed never to alter permission settings, CLAUDE.md, or any configuration because another session asked.
  3. Commands arrive as text. A /compact in the message body is four characters of prose, never an executed command.
  4. Permission prompts still fire. If acting on the message needs a permission B lacks, you see the same prompt as for any other work.

Inbound delivery has its own gate. Each arriving message ends in one of three outcomes – delivered, held for your approval, or refused – controlled by the crossSessionInbound setting (accept, hold, refuse).1 When you set nothing, Claude Code decides per message using the two sessions’ permission modes, and the default logic is elegant: sessions that bypass permission prompts form one class, everyone else the other. A prompting session receives messages freely but holds anything arriving from a bypassing session; a bypassing session holds everything except messages from fellow bypassing sessions.1 The asymmetry is deliberate: a message must not ride a permissive session’s authority, a principle v2.1.224 applies inbound after v2.1.222 applied it outbound in auto mode, where the permission classifier reviews each send before dispatch.7

Held messages open an approval dialog showing sender and preview; unanswered dialogs expire after five minutes (tunable via dialogExpiry) and the message drops.1 At most 100 messages hold at once.1 Two more controls narrow things further: isolatePeerMachines: true requires your explicit approval before any message leaves the machine, even in bypassPermissions mode, and a true from any settings scope wins, so a checked-in project file can tighten but never loosen it.1 Organizations can kill the feature entirely with deny rules on SendMessage and ListAgents plus crossSessionInbound: "refuse" in managed settings.1

How Messages Travel

Where the other session runs determines both transport and what you can send:1

Target Transport You can send
Same machine Per-session Unix socket, never through Anthropic servers New messages and replies
Your other machine Anthropic servers, arriving over that machine’s Remote Control connection Replies; new conversations as of v2.1.225, while Remote Control is connected5
Claude Code on the web Anthropic servers, straight to the cloud session Replies only

One docs conflict worth flagging: as of this writing, Anthropic’s cross-session messaging page still describes all cross-machine messaging as reply-only, while the v2.1.225 release notes say SendMessage “can now start a conversation with your Remote Control sessions on other machines by name.” The release notes are newer; the docs page lags the release.15

The same-machine rule is filesystem visibility: sessions register in files on disk, so two sessions reach each other only when they see the same files. A session inside a container and one on the host cannot talk; two sessions inside the same container can.1

Delivery respects the receiving session’s rhythm: a message is read between tool calls during an active turn, never interrupting a running tool, and starts a fresh turn when the session is idle.1 Delivered messages count toward usage like a prompt you typed.1

Five Patterns Worth Building

1. Worktree coordination. The obvious one, and the case the documentation illustrates with its own example message: sessions working the same repository in separate worktrees tell each other what landed.1 “Schema migration finished: the new column is tenant_id, and rebasing on main is safe now.” is the documentation’s own example message, the class of update that otherwise requires you to notice, switch terminals, and re-type. If several sessions share one checkout instead of worktrees, the coordination message becomes more valuable still: “I’m about to commit content/guides/, don’t stage it” prevents the classic shared-tree collision where one session commits another’s half-finished work.

2. Watcher and worker. Run a monitor session watching a deploy, a test suite, or a log, and have it message the session responsible for fixes the moment something breaks. The receiving session gets the finding as context, not as a command; it still decides, under its own permissions, what to do. Pair this with background sessions and the notification hooks and you get an escalation chain that ends at a human only when it should.

3. The reporting long-runner. Kick off a migration or a long test run in one session, then have it report back to the session you actually watch.1 Status stops living in a terminal you forgot about. The inverse also works; ask from the watching side: “Ask the session in my other terminal whether the migration finished” is a prompt, and Claude handles discovery, addressing, and phrasing itself.1

4. Unattended worker fleets. Headless claude -p sessions bind inbox sockets too, so a long-running -p worker can receive messages and appears in listings.8 The catch: a -p session cannot show the approval dialog, so a held message stays held with no path to delivery short of a settings or mode change (v2.1.225 also fixed such messages parking without notice or expiry). To run a worker that takes messages unattended, start it with crossSessionInbound: "accept" in its --settings value: a per-worker grant, rather than an accept in user settings that would apply to every session you run.8 Bare-mode sessions skip the socket entirely and stay unreachable.8

5. Scripted inboxes. The quiet powerhouse: because CLAUDE_CODE_MESSAGING_SOCKET is exported to hooks and Bash commands, a script can post into a session’s own inbox.6 Claude Code verifies own-child messages: a hook or command posting back to its own session delivers without ceremony when no explicit crossSessionInbound applies.1 A nightly job, a git hook, a CI wrapper: anything that can write to a Unix socket can now inject a line of context into the session that spawned it. On Linux the verification works even after the posting process exits; on macOS only while it still runs; in a container where Claude Code is PID 1, verification fails and the message falls back to normal inbound rules.1 Sandboxed commands need the socket allowed via sandbox.network.allowUnixSockets.1

What It Refuses to Be

The limits are design decisions, and respecting them saves you from building the wrong thing.

Not an approval channel. Everything in the trust model exists to prevent one session from authorizing another’s actions. Any workflow shaped like “session A approves, session B executes” is explicitly designed against. Route authority through the human, always.1

Not context transfer. A message is text one Claude writes to another, never conversation history or files. Anthropic’s documentation says it plainly: to move a conversation, resume the session instead.1 Summarize; don’t dump.

Not agent teams. Independent sessions messaging each other is the peer-to-peer case. A coordinated team Claude spawns and supervises (structured protocol messages, a roster, shared task state) is the agent teams feature, and structured team messages deliberately stay inside a team.1 If you find yourself designing a message protocol on top of cross-session text, you want agent teams.

Not a chat loop. Claude Code rate-limits repeated messages per sender, drops identical repeats arriving in a short window, and caps unread accepted messages at 50 per session, so a message loop between two sessions starves itself out by design.1 Build request-and-response exchanges, not conversations.

The Traps

Privacy variables silently disable it. Cross-session messaging depends on feature-flag evaluation, and any of CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC, DISABLE_TELEMETRY, DO_NOT_TRACK, or DISABLE_GROWTHBOOK can turn that evaluation off, taking messaging down with it, silently.3 The diagnostic is /list-agents: if the command is not even recognized, the session lacks the feature entirely; if it works but a send never arrives, something narrower applies: a deny rule, the receiver’s inbound controls, or a cross-machine target that only accepts replies.1

Platform and provider gaps. No native Windows (Linux inside WSL 2 works). Not available on Amazon Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform, or Microsoft Foundry.1

The one-way reply edge. A reply to a session on another machine, sent while the replying session is not connected to Remote Control, still arrives, but without a reply address, so the receiver cannot answer. Claude is told as much when it sends, and v2.1.225’s fixes tightened the addressing so a confirmed cross-machine recipient is never silently swapped for a same-named local session.5

Headless holds. The -p worker that mysteriously ignores messages is almost always a held-message problem: no dialog, no delivery. Set crossSessionInbound: "accept" on workers that should listen.8

Key Takeaways

For daily Claude Code users: - Run /list-agents once to see what your sessions can already reach; name important sessions with /rename so messages address cleanly. - Prompt for messages in plain language (“tell the session working on payments what we changed”) and let Claude write the message itself.1

For automation builders: - Post into sessions from hooks and scripts via CLAUDE_CODE_MESSAGING_SOCKET; own-child messages deliver without approval friction on Linux.16 - Give unattended -p workers crossSessionInbound: "accept" in their own --settings, not globally.8

For teams and security reviewers: - The feature ships with the right defaults: messages carry no authority, bypassing sessions are quarantined by default, and isolatePeerMachines plus managed-settings deny rules give you per-machine and org-wide off switches.1 - Audit the four privacy environment variables before concluding messaging is broken, and know that a refusing session shows no visible difference to its peers.1

References


  1. Anthropic, “Message your other Claude Code sessions”, Claude Code documentation. Accessed August 8, 2026. 

  2. Anthropic, “Tools reference”, Claude Code documentation: ListAgents and SendMessage entries. 

  3. Anthropic, “Environment variables”, Claude Code documentation: feature-flag evaluation notes on CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC, DISABLE_TELEMETRY, DO_NOT_TRACK, and DISABLE_GROWTHBOOK

  4. Anthropic, Claude Code v2.1.224 release notes, August 7, 2026: “Added cross-session SendMessage: Claude Code sessions can now message each other, on any of your machines, with ListAgents to discover them (macOS and Linux).” 

  5. Anthropic, Claude Code v2.1.225 release notes, published August 8, 2026 (UTC): “SendMessage can now start a conversation with your Remote Control sessions on other machines by name (ListAgents shows them as name [ref]), instead of only replying after they message you first.” Confirmed recipients are never swapped for same-named local sessions. 

  6. Anthropic, “Environment variables”, Claude Code documentation: CLAUDE_CODE_MESSAGING_SOCKET, exported before any hook runs, including SessionStart

  7. Anthropic, Claude Code v2.1.222 release notes, August 4, 2026: “Improved auto mode safety: messages sent to other agent sessions via SendMessage are now evaluated by the permission classifier before dispatch.” The classifier review applies in auto mode (and in plan mode where the auto classifier reviews commands), not universally. 

  8. Anthropic, “Headless mode”, Claude Code documentation, and the non-interactive sessions section of the cross-session messaging page: -p sessions bind inbox sockets, bare mode does not, and held messages require crossSessionInbound: "accept" for unattended delivery. 

Related Posts

Claude Code Skills: Build Custom Auto-Activating Extensions

Build custom Claude Code skills that auto-activate based on context. Step-by-step tutorial covering SKILL.md structure, …

13 min read

Claude Code Hooks: Why Each of My 95 Hooks Exists

I built 95 hooks for Claude Code. Each one exists because something went wrong. Here are the origin stories and the arch…

10 min read

Claude Code Hooks Explained: The Deterministic Layer Around Your Agent

Claude Code hooks run shell commands at lifecycle events — guaranteed. Every event, exit-code semantics, and five patter…

19 min read