Anthropic、Claude Code のセッション間メッセージング機能を追加
本文の状態
日本語全文を表示中
詳細モードで約27分の本文を読めます。
同じ出来事の情報源
この情報源を基点に整理
TLDR AI
Anthropic は Claude Code の新機能としてクロスセッションメッセージングを導入し、複数の独立したセッション間で AI が直接テキストを送受信して作業を調整・警告する仕組みを提供した。
Continue in AI NEW LAB
このニュースを、実務の判断につなげる
AI NEW LABで、試したことや先に確認したい条件を共有できます。まずはログインなしで読めます。
AI NEW LABで論点を見るAI深層分析を開く2026年8月11日 22:34
AI深層分析
キーポイント
クロスセッション間の直接通信
Claude は異なるセッション間でテキストメッセージを送受信でき、あるセッションの変更が他方の作業に影響を与える前に警告を発したり、ブロックされた質問への回答を共有したりする。
使用される技術ツール
この機能は「ListAgents」で到達可能なエージェントを検出し、「SendMessage」で名前でメッセージを送るという 2 つのツールを使用して実装されている。
具体的なユースケース
発見事項の引き渡し、並列したワークツリー間の調整、長時間実行中の作業からのステータス取得、異なるマシン間での通信など、複数のシナリオで利用可能である。
セッション再開機能との区別
会話履歴やファイル全体を移動する場合はこのメッセージングではなく、「セッションの再開」機能を使用すべきであり、本機能は独立したセッション間の調整に特化している。
セッション間の自動メッセージング
Claude は ListAgents と SendMessage ツールを使用してターゲットセッションを発見・送信するため、ユーザーが手動でツールを呼び出す必要はない。
重要な引用
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.
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.
Claude discovers the target with ListAgents and sends with SendMessage, so you never call either tool yourself.
編集コメントを表示
編集コメント
開発者が複数の AI セッションを並行して運用する際の課題を解決する実用的な機能であり、エージェント間の自律的な連携が現実のものとなった。この機能により、大規模なコードベースや複雑なプロジェクトにおける AI の協調作業の効率が大幅に向上すると期待される。
Source Article
元記事を日本語で読む
本文に関係しない購読案内、埋め込み通知、サイト内プロモーションは除いています。
クロスセッションメッセージ機能を使えば、Claude はある Claude Code セッションから別のセッションへメッセージを送ることができます。あるセッションの変更が、他のセッションが構築しているものに影響を与えた場合、ユーザーが気づく前にそのセッションに警告を出すことができます。また、あるセッションで解決した質問によって他セッションがブロックされている場合、その回答を跨いで伝えることも可能です。
メッセージとは、Claude が別の Claude に送るテキストの断片であり、会話履歴やファイルではありません。会話全体や文脈を移動させたい場合は、セッションの再開を行ってください。
Claude はこれに 2 つのツールを使用します。ListAgents で到達可能なエージェントを検出し、SendMessage で名前を指定してメッセージを送ります。同じ SendMessage ツールを使って、単一のセッション内やチーム内の サブエージェント や エージェントチーム のメンバーへもメッセージを送ることができます。このページでは、独立したセッション間のメッセージングについて解説します。
クロスセッションメッセージを使うべきタイミング
あるセッションが別のセッションのタスク中に必要な情報を持っている場合、メッセージ機能を使いましょう。Claude は必要と判断した場合に自らメッセージを送ることもできます。例えば、他のセッションで作業している内容に影響を与える変更を加えた後などです。あるいは、ユーザーから指示を出すことで送信させることも可能です。主な利用ケースは以下の通りです。
- 発見結果の引き渡し: あるセッションが破壊的な変更を発見したり、決定を下したりした場合、Claude がその内容を影響を受ける領域で作業中のセッション向けに要約します。ユーザーが再度説明する必要はありません。
独立して起動・操作するセッション間でメッセージを送受信しましょう。Claude Code には、複数のセッションを運用・接続するための専用機能も用意されていますが、それぞれの用途に最適化された機能を使い分けるのがおすすめです。
- 他のターミナルで会話を継続したり、そのコンテキストを新しいセッションと共有したい場合は、セッションの再開 を利用してください。
- Claude が生成・管理する複数のセッションによる協調チームを構築したい場合は、エージェントチーム を活用しましょう。
- 1 つの場所から多数のセッションを監視・操作したい場合は、エージェントビュー が適しています。
- セッション同士が互いにメッセージを送り合うのではなく、スマートフォンや別のデバイスから直接セッションを操作したい場合は、リモートコントロール を使用してください。
- CI の結果やチャットメッセージなどの外部イベントをセッションにプッシュしたい場合は、チャンネル を利用しましょう。
他のセッションへメッセージを送る
セッション間で学習した情報を共有する際、あるセッションが別のセッションで必要な知見やステータス、決定事項などを把握した場合、手動でコピー&ペーストする代わりに、Claude が自動的に引き継ぎます。Claude は ListAgents ツールで対象のセッションを特定し、SendMessage で送信するため、ユーザーがこれらのツールを手動で呼び出す必要はありません。Claude は要求されなくても自発的にメッセージを送信できるほか、ユーザー側から指示を出すことも可能です。
自分でメッセージを送る場合は、他のセッションに伝えたい内容や実行してほしい動作を Claude に指示します。以下の例は、ユーザーが入力するプロンプトであり、Claude が送信するメッセージそのものではありません:
Claude は実際のメッセージ内容を自ら作成するため、プロンプトでは具体的な文言まで指定する必要はありません。このプロンプトは要約を求めているだけで、表現形式までは拘束していません。そのため、Claude が実際に送る内容は状況に応じて変わります。
Claude が作成するメッセージが到着した際の見た目や具体例については、メッセージの実際の様子 をご覧ください。
メッセージの配信
受信側の Claude は、アクティブなターン内でツール呼び出しの間隔にメッセージを読み込みます。そのため、実行中のツール処理が中断されることはありません。受信セッションがアイドル状態にある場合、Claude Code はそのメッセージをきっかけに新しいターンを開始します。
デフォルト設定の通常の対話型セッション間では、Claude Code がメッセージを配信します。ただし、すべての構成で配信が保証されているわけではありません。受信側セッションは、到着した各メッセージを独自の 受信制御 と照合し、その結果として以下のいずれかの結果になります:
- Delivered(配信完了): Claude Code がメッセージを受信側の Claude に引き渡します。
- 保留中: Claude Code はメッセージを未着信のまま保留します。保留されたメッセージは、あなたが承認するか、後続のモードや設定変更によって送信が許可されるまで、Claude に到達しません。
- 拒否: Claude Code はメッセージを受け取らずに破棄します。
一度配信されると、そのメッセージは 使用量 のカウント対象となり、あなたが直接入力したプロンプトと同様に扱われます。また、受信側の Claude も送信者に対して返信できますが、1 方向の他マシン間通信の場合 はこの限りではありません。
権限の境界はセッションごとに設定されます。Claude には、自身のセッションで拒否またはブロックされたアクションを他のセッションに依頼しないよう指示されており、また自身の権限設定によってブロックされる可能性のあるリクエストも他セッションへ送らず、代わりにあなたに振り分けるように設定されています。受信側では、メッセージを受信したセッション固有の権限プロンプトとルール が、そのメッセージが要求するすべてのアクションに対して依然として適用されます。
Claude が到達可能なセッションを確認する
Claude はメッセージの宛先を自動的に特定するため、送信前に特別な操作を行う必要はありません。実際にどのセッションにアクセスできるか確認したい場合は、/list-agents コマンドを実行してください。このコマンドは、各セッションが応答するための名前を一覧表示します。Claude がメッセージを送信する際は、この名前で宛先を指定します。一覧に含まれるのは以下の通りです。
- サブエージェント: 現在のセッション内で実行されているエージェント。エージェントチーム のメンバーは一覧に表示されません。Claude はチーム固有のロスターを通じて、これらのメンバーにメッセージを送信します。
他のローカルセッション:同じマシン上で実行されている Claude Code のセッションには、バックグラウンドセッション も含まれます。これらのセッションは、インボックスソケット にバインドされた場合にのみ表示されます。
クラウド上のセッション:ウェブ版 Claude Code のセッションです。これらは、このセッションがクラウドアクセス権限を持っている場合に表示されます。具体的には、Anthropic 公式 API への claude.ai ログインと、クラウドセッションを許可する組織ポリシーが必要です。
他のマシン上のリモートコントロールセッション:`Remote Control` に接続している間のみ表示され、「Remote Control」というラベルが付きます。
Claude は、このマシン上のセッションだけでなく、他のマシン上のセッションにも名前を指定してメッセージを送ることができます。これらのメッセージがどのように転送されるかは、「他のマシンのセッションにメッセージを送る」をご覧ください。
セッションは、`/rename` コマンドまたは `--name` フラグで設定した名前で識別されます。名前を指定しない場合、Claude Code が自動的にセッション名を生成します。インタラクティブなセッションの場合、その作業ディレクトリのフォルダ名に基づいた名前(例:myapp-3f)が割り当てられます。
同じ名前のセッションが複数存在する場合があります。/list-agents コマンドの出力には、各ローカルセッションの作業ディレクトリが表示されるため、異なるディレクトリで実行されている同名のセッションを区別できます。Claude 自身のリスト表示では、衝突した際に識別子として使用するために、各行に短い識別子を付加しています。
他のマシン上のセッションへのメッセージ送信
メッセージがどのように伝達され、Anthropic サーバーを経由するかどうかは、対象となるセッションがどこで実行されているかによって異なります。
| 他のセッションが実行されている場所 | メッセージの経路 |
|---|---|
| このマシン上 | セッションごとのソケットを介して、Anthropic サーバーを経由せず |
| 別のマシン上 | Anthropic サーバーを介して、そのマシンの リモートコントロール 接続を通じて到着 |
| Web 版 Claude Code 上 | Anthropic サーバーを介して、直接クラウドセッションへ |
別のマシンで稼働しているセッションと対話するには、Claude Code v2.1.225 以降が必要です。また、そのセッションが 一覧に表示されていること も条件となります。v2.1.225 より前のバージョンでは、Claude は自分宛てに届いたメッセージに応答することしかできませんでした。
同じマシン内でのメッセージ送受信は、この機能が有効になっている場所であればどこでも動作します。各セッションはディスク上のファイルに登録され、その場所にインボックスソケットをバインドします。Claude がローカルセッションの一覧を表示したりメッセージを送信したりする際、Claude Code はこれらのファイルを読み込んで対象のセッションを検出します。つまり、2 つのセッションが互いに通信できるのは、両方が同じファイルにアクセスできる場合に限られます。コンテナは独自のファイルシステムを持つため、コンテナ内のセッションとホスト上のセッションが直接通信することはできません。ただし、同じコンテナ内に存在する 2 つのセッションであれば、セルフホスト型ランナー 上であっても互いにメッセージを送受信できます。
返信には 返信先アドレス が必要ですが、ほぼすべてのメッセージはこの情報を含んでいます。このマシンを超えて送信されるセッション宛てのメッセージは、送信元セッションが Remote Control に接続されていない場合でも Anthropic サーバーを経由して直接届きます。ただし、そのメッセージには返信先アドレスが含まれていないため、受信側からは応答できません。Claude は、メッセージを送信する際にこの制限について知らされます。
このマシンを超えてのメッセージ送受信を許可する前に必ず承認を求める場合は、`isolatePeerMachines` を設定してください。
セッションが着信メッセージをどう扱うか
セッションAからセッションBへメッセージを送信した場合、Claude CodeはB側のClaudeに対して、そのメッセージがあなたからのものではなく別のセッションからのものだとして伝え、実行可能な範囲を制限します。
- 承認できない: 別のセッションからのメッセージはあなたの同意とはみなされないため、保留中の権限プロンプトに代わって回答することはできません。
- 設定を変更できない: Claude Codeは、受け取る側のClaudeに対して、別のセッションの要求に応じて権限設定や
CLAUDE.md、その他の設定ファイルを変更しないよう指示します。
- コマンドは実行されない: メッセージ本文に含まれる
/compactなどのコマンドも、単なるテキストとして扱われます。Claude Code はこれを実行しません。
- 権限プロンプトは依然として表示される: メッセージの処理に受け取る側のセッションが持っていない権限が必要な場合、他の作業と同様に同じ権限プロンプトが表示されます。
メッセージの見た目
メッセージが到着すると、送信者との会話画面に表示されます。Claude が応答中(ターン途中)の場合はキューに積まれ、セッションがアイドル状態であれば即座に新しいターンとして処理されます。Claude がメッセージを読み込むと、その行は「Message from」の 1 行表示に縮小され、Ctrl+O を押すことで展開できます。
メッセージとは、ある Claude が別の Claude に送るテキストのことです。送信者の名前と返信先アドレスを添えて受け取りますが、他マシンのセッション宛ての一方通行メッセージ の場合は返信先アドレスが含まれません。受信側では名前と本文のみが表示され、送信元の会話履歴やファイルは一切見ることができません。
以下は、ある Claude が別の Claude に送ったメッセージを、受信側のセッションがどのように表示するかを示した例です:
着信メッセージの制御
`crossSessionInbound` を設定することで、他のセッションから届くメッセージに対して各セッションがどう反応するかを指定できます。
| 値 | 動作 |
|---|---|
accept | Claude Code は各メッセージを Claude に配信します |
hold | Claude Code は各メッセージに対して通知を表示し、配信しません。その後 優先順位ルール に従って accept が適用された場合、Claude Code は保留中のメッセージを解放します |
refuse | Claude Code は各メッセージを配信せずに破棄します |
適用される値を確認するには、設定リファレンス の crossSessionInbound 優先順位ルールに従ってください。どの値も適用されない場合、Claude Code は2つのセッションの権限モードに基づいてメッセージごとに判断します。
セッションは、権限プロンプトをバイパスする セッションと、それ以外のセッションの2 つに分類されます。バイパス権限が利用可能なセッションでは Plan モードもバイパスとして扱われます。一方、auto、acceptEdits、dontAsk はプロンプトが発生するモードとして扱われます。
- 受信側セッションで権限確認が行われる場合: Claude Code は各メッセージを配信します。送信側セッションが「権限プロンプトのバイパス」を名乗っている場合に限り、1 つのメッセージを承認待ちに保留します。
- 受信側セッションで権限プロンプトをバイパスする場合: Claude Code は各メッセージを承認待ちに保留し、送信側セッションも同様に「バイパス」を名乗っている場合のみ、その 1 つのメッセージを配信します。
デフォルトでメッセージが保留された場合、Claude Code は受信側セッションで承認ダイアログを開きます。このダイアログには送信元とプレビューが表示されます。
- Approve: その 1 つのメッセージを Claude に配信します。
- Deny またはダイアログを閉じる: メッセージは破棄されます。
ダイアログが `dialogExpiry` で設定された期限を過ぎても未回答の場合、ダイアログは閉じられ、Claude Code はメッセージを破棄します。この期限のデフォルト値は 5 分です。
このセッションのパフォーマンスモードクラスが保留中のメッセージ間で変更された場合、Claude Code は受信ルールを再適用し、現在受け入れるようになったメッセージを配信して通知を表示します。
変更の結果 refuse が適用される状態になり、メッセージが保留されている場合、Claude Code は保留中のすべてのメッセージを破棄し、到達可能な送信者それぞれに拒否の報告を行います。
送信側が同じマシン上で実行されている場合、Claude Code はそのセッションに対して処理結果を伝えます。メッセージが保留された際に通知が表示され、受信側で後日配信、拒否、または期限切れになった際にその結果を追跡する通知が表示されます。到着時点で拒否されたメッセージには、送信側の通知は表示されません。
Claude Code が保持できるメッセージの上限は 100 件です(配信キューとは別管理)、これを超えると最も古いメッセージから破棄されます。
インタラクティブでないセッション
Claude Code は、claude -p セッションに対してインタラクティブなセッションと同様にインボックスソケットをバインドします。そのため、長時間実行される -p ワーカーもメッセージを受信でき、エージェント一覧に表示されます。
一方、ベアモード でセッションを開始した場合、Claude Code はソケットをバインドしません。このため、そのセッションはメッセージを受信できず、エージェントリストにも表示されません。
-p セッションでは承認ダイアログを表示できません。インバウンドメッセージのデフォルト設定 にメッセージが保留されている場合、後続のモードや設定変更によって送信が可能になったタイミングで Claude Code がそのメッセージを配信します。一方、`dialogExpiry` の期限が過ぎた場合はメッセージを破棄し、送信元に期限切れの通知を行います。
v2.1.225 より前のバージョンでは、-p セッションで保留されたメッセージはそのまま保留状態となり、送信元には何らの通知も期限切れの設定も存在しませんでした。
-p ワーカーが手動操作なしでメッセージを受け取るには、--settings 値に crossSessionInbound: accept を設定して起動します。
ユーザー設定で「accept」を設定すると、実行するすべてのセッションに適用されます。
セッションの受信ボックスソケット
エージェント一覧に期待したセッションが表示されない場合、特定のセッションへスクリプトやフックを投稿したい場合、あるいはサンドボックス化されたコマンドがソケットに到達できない場合に、このセクションをお読みください。
Claude Code は、クロスセッションメッセージング機能を有効にした各セッションに対してインボックスソケットをバインドします。これにより、同じマシン上の他のセッションからメッセージを送信することが可能になります。ただし、このソケットはオペレーティングシステムのユーザー権限に制限されているため、共有環境では別のユーザーのセッションがアクセスすることはできません。どの種類のセッションでこのソケットがバインドされるかは、非対話型セッション を参照してください。
パスの確認先は以下の 2 か所です:
/statusコマンドを実行すると、その情報が「Peer address」の行に表示されます。パスはuds:というプレフィックスで始まります。
Claude Code は、これを hooks や Bash コマンドとして `CLAUDE_CODE_MESSAGING_SOCKET` 環境変数にエクスポートします。このエクスポートは SessionStart を含むすべてのフックが実行される前に行われます。各セッションは独自のソケットをエクスポートし、親セッションから継承されたものを使用することはありません。
Claude Code は、他のピアからのメッセージと同様に、インバウンド制御 を通じてソケットに到着するメッセージを処理します。ただし、例外と前提条件が一つずつあります。
Own-child メッセージ:crossSessionInbound の値が適用されない場合、Claude Code はセッション自身の子プロセス(フックや Bash コマンドなど)から送信されたと検証されたメッセージを配信します。Linux 上では WSL 2 を含む環境でも、すでに終了した子プロセスからのメッセージであっても検証が可能です。一方、macOS では投稿プロセスが実行中の間のみ検証可能で、Claude Code が PID 1 としてコンテナ内で動作している場合は検証できません。検証できない場合、このメッセージは権限クラスを主張しない他のメッセージと同様に扱われ、権限プロンプトをバイパスしたセッションからのものはユーザーの承認待ちとなります。
- サンドボックス化されたセッション: サンドボックス内の Bash コマンドがソケットにアクセスできるかどうかは、Unix ソケット設定である
sandbox.network.allowAllUnixSocketsとsandbox.network.allowUnixSocketsで制御できます。
セッション間のメッセージングを制限する
1 通ごとのデフォルト設定に加え、以下の 2 つの方法でメッセージングをさらに制限できます。マシンから送信されるすべてのメッセージに承認を必須にするか、セッションまたは組織全体でメッセージ機能を無効化します。
マシン間メッセージの送信には承認が必要
SendMessage によるメッセージが、このマシン以外のセッションに到達する前に明示的な承認を要求するには、`isolatePeerMachines` を true に設定してください。
この設定により、Claude Code は、通常の権限プロンプトをスキップする bypassPermissions モードであっても、このマシンを超えて他のセッションにメッセージを送信する前に承認を求めるようになります。どの設定スコープでも true が有効となるため、チェックインされたプロジェクトファイルでこの要件をオンにすることはできますが、オフにはできません。同じマシン上のセッション間でのメッセージ交換ではプロンプトは表示されません。
クロスセッションメッセージングの無効化
受信と送信は個別の制御項目であるため、必要な方向(片方または両方)を無効化してください。到着するメッセージには crossSessionInbound を使用し、ここで Claude が送信またはリストできる内容については権限ルールを設定します。
- 受信を停止する:
crossSessionInboundをrefuseに設定すると、Claude Code は外部セッションからのメッセージを受け取らずに破棄します。
プロジェクト設定またはローカル設定では、refuse は他のすべてのソースよりも優先されます。一方、ユーザー設定から指定された場合は、管理設定や --settings フラグで値が設定されていない場合にのみ適用されます。
- 送信と一覧の停止:
SendMessageとListAgentsという名前の 権限拒否ルール を追加してください。いずれも、指定子なしでツール名そのものを使用します。
管理者は、管理設定 で組織全体に対して両側の機能をオフにできます。これにより、拒否ルールと refuse が組み合わされます。
この設定により、Claude Code は各セッションの受信ボックスソケットをバインドしたままになりますが、到着したメッセージはすべて破棄され、Claude には届きません。SendMessage を拒否すると、同じツールがサブエージェントやチームメンバーとの通信にも使われているため、それらへのメッセージ送信もできなくなります。拒否されたセッションでは、そのセッション自身の /status や他のセッションのリスト表示に目に見える変化は現れないため、設定の確認は必ずセッションの設定画面から行ってください。
利用可能性
クロスセッション間のメッセージングには、Claude Code v2.1.224 以降が必要です。また、プラットフォームやプロバイダー、構成によっても利用可否が異なります:
対応OS: macOS および Linux(WSL 2 内の Linux も含む)で利用可能です。Claude Code はネイティブ Windows ではセッション間のメッセージング機能を提供していません。
提供元: Amazon Bedrock、AWS の Claude Platform、Google Cloud の Agent Platform、Microsoft Foundry では利用できません。
- 機能フラグの評価: `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`、
DISABLE_TELEMETRY、DO_NOT_TRACK、またはのいずれかが設定された場合
DISABLE_GROWTHBOOK](https://code.claude.com/docs/en/env-vars#variables) を設定すると、その機能に依存するフィーチャーフラグの評価がオフになります。これにより、セッション間を跨いだ通信が可能になります。
メッセージングはオフにします。各変数の行には、その値がどの機能を無効にするかが記載されています。該当するものをすべて未設定(unset)にしてください。これらの変数は、シェルから、設定ファイルの env マップから、または管理された設定から取得されます。
セッションを確認するには、/list-agents と入力してください。これは /peers としても利用可能です。
このコマンドの結果では、該当機能がないセッションと、メッセージ送信をブロックする何らかの制限(例えば SendMessage ツールの欠如や送信拒否など)があるセッションが区別されます。
/list-agentsは認識されません:このセッションでは、他セッションとのメッセージ送受信はできません。上記の要件に従って進めてください。まずはclaude --versionでバージョン要件を確認することから始めましょう。
/list-agentsコマンドは動作しますが、メッセージが送信されませんでした。これはメッセージング機能が有効であるにもかかわらず、より狭い範囲の制限が適用されているためです。具体的には拒否ルール(Deny rules)によって、SendMessageおよびListAgentsツールの使用権限が剥奪されています。
クロスセッション間のメッセージングを無効にする 方法についてはこちらをご参照ください。
受信側の制御
受信セッションのインバウンドコントロール が、送信したメッセージを保持するか破棄するかを決定します。
クラウドセッションが表示されない場合
このセッションが クラウドアクセス権限 を持っている場合に限り、クラウドセッションが表示されます。
他機種のセッションが表示されない場合
他のマシン上のセッションは、そのマシンで Remote Control が実行されており、かつ現在のセッションも接続されている場合にのみ表示されます。
コミュニケーションの開始
このマシン以外のセッションとの会話を始める方法は、他機種のセッションへのメッセージ送信 で解説しています。
なお、メッセージ機能を利用できるセッションでは、/status コマンドを実行すると、そのセッション固有の受信トレイアドレスを示す Peer address という項目も表示されます。
制限事項
この機能の制限は、メッセージングチャネル自体の特性に起因するものであり、機能が動作するあらゆる場所で適用されます。プラットフォームやプロバイダー間のギャップについては、代わりに 利用状況 を参照してください。
- プレーンテキストのみ: Claude はセッション間でプレーンテキストのみを送信します。構造化された エージェントチーム プロトコルメッセージは、チーム内でのみ保持されます。
- メッセージループの制限: Claude Code は、送信者ごとに繰り返し送られるメッセージをレート制限し、短時間内に到着する同一のメッセージを重複として除外します。また、Claude が読み込むのを待っている受け入れ可能なメッセージ数は、セッションあたり最大 50 件に制限されます。したがって、2 つのセッション間のメッセージループは自動的に停止します。
Subagents や Agent Teams については、単一のセッション内やチーム間でのメッセージングが可能です。
Background agents を利用すれば、並行して実行されるセッションの起動と監視を行い、必要に応じてメッセージを送ることができます。
また、Remote Control を使えば、このセッションを他のマシン上のセッションに接続して操作することもできます。
設定項目では、crossSessionInbound、isolatePeerMachines、そして dialogExpiry といったパラメータを確認・調整可能です。
さらに、Permission modes を理解しておくことで、インバウンド通信のデフォルト設定が適用される2つのモードの違いを把握できます。
- ツールのリファレンス: ツールテーブル内の
ListAgentsとSendMessageの行
- 並列実行するエージェント: Claude Code が複数のエージェントをどのように実行するか、その方法を比較します
原文を表示
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 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 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.
- 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:
- 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 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:
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:
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 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 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.
- Your cloud sessions: your 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, 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 command or the --name 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
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 connection |
| On 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.
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.
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 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
Set 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, 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. 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.
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 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 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 delivers it if a later mode or settings change allows it, and otherwise drops it when the dialogExpiry 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.
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 and Bash commands as the CLAUDE_CODE_MESSAGING_SOCKET 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 with the sandbox’s Unix-socket settings, sandbox.network.allowAllUnixSockets and sandbox.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
Set isolatePeerMachines to true to require your explicit approval before any SendMessage reaches a session beyond this machine:
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.
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 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, combining the deny rules with the 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 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:
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 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.
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.
- 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.
- 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, and dialogExpiry
- Permission modes: the modes behind the inbound default’s two classes
- Tools reference: the ListAgents and SendMessage rows in the tools table
- Run agents in parallel: compare the ways Claude Code runs multiple agents
関連記事
News to Guide
ニュースの次に確認する
発表内容を、現在の料金や仕様と照らし合わせられる関連ガイドです。
今日のまとめ
AIデイリーブリーフで今日の重要ニュースをまとめ読み