using-agent-relay
複数のAIエージェントがリアルタイムで連携する際に、ファイルベースのプロトコルと信頼性機能を持つRust PTYラッパーを通じて、エージェント間のメッセージングを円滑に進めるSkill。
📜 元の英語説明(参考)
Use when coordinating multiple AI agents in real-time - provides inter-agent messaging via Rust PTY wrapper with file-based protocol and reliability features
🇯🇵 日本人クリエイター向け解説
複数のAIエージェントがリアルタイムで連携する際に、ファイルベースのプロトコルと信頼性機能を持つRust PTYラッパーを通じて、エージェント間のメッセージングを円滑に進めるSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o using-agent-relay.zip https://jpskill.com/download/10387.zip && unzip -o using-agent-relay.zip && rm using-agent-relay.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/10387.zip -OutFile "$d\using-agent-relay.zip"; Expand-Archive "$d\using-agent-relay.zip" -DestinationPath $d -Force; ri "$d\using-agent-relay.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
using-agent-relay.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
using-agent-relayフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
🚨 重要: Relay-First の通信ルール
別のエージェントからリレーメッセージ(Relay message from [name]と表示されます)を受信した場合、必ずリレープロトコルでのみ応答する必要があります。直接テキスト出力で応答してはいけません。
ルール
- リレーメッセージを受信した場合: → 常に
->relay-file:msgを使用する必要があります。 - リレーではない質問の場合: → テキストでの応答でOKです。
- エージェント間の通信の場合: → 常にリレープロトコルを使用してください。
リレーメッセージの例(リレー応答が必要)
Relay message from khaliqgant [mknra7wr]: Did you see this?
Relay message from Worker1 [abc123]: Task complete
Relay message from alice [xyz789] [#general]: Question for the team
Agent Relay
ファイルベースのプロトコルによる、エージェント間のリアルタイムメッセージング。
信頼性機能
リレーシステムには、自動的な信頼性向上の機能が含まれています。
-
段階的な再試行 - メッセージを承認しない場合、緊急度を上げて再送信されます。
- 1回目の試行:
Relay message from Alice [abc123]: ... - 2回目の試行:
[RETRY] Relay message from Alice [abc123]: ... - 3回目以降の試行:
[URGENT - PLEASE ACKNOWLEDGE] Relay message from Alice [abc123]: ...
- 1回目の試行:
-
未読インジケーター - 長いタスクの実行中には、保留中のメッセージ数が表示されます。
📬 2 unread messages (from: Alice, Bob)
再試行のエスカレーションを防ぐために、常にメッセージを承認してください。
メッセージの送信
アウトボックスにファイルを作成し、トリガーを出力します。
cat > ~/.agent-relay/outbox/$AGENT_RELAY_NAME/msg << 'EOF'
TO: AgentName
Your message here.
EOF
重要: トリガー ->relay-file:msg を、応答テキストに直接出力してください(bash での echo 経由ではありません)。トリガーは、コマンド出力だけでなく、実際の出力に表示される必要があります。
すべてのエージェントへのブロードキャスト
cat > ~/.agent-relay/outbox/$AGENT_RELAY_NAME/broadcast << 'EOF'
TO: *
Hello everyone!
EOF
次に: ->relay-file:broadcast
スレッドを使用する場合
cat > ~/.agent-relay/outbox/$AGENT_RELAY_NAME/reply << 'EOF'
TO: AgentName
THREAD: issue-123
Response in thread context.
EOF
次に: ->relay-file:reply
メッセージ形式
TO: Target
THREAD: optional-thread
Message body (everything after blank line)
| TO Value | 動作 |
|---|---|
AgentName |
ダイレクトメッセージ |
* |
すべてにブロードキャスト |
#channel |
チャンネルメッセージ |
通信プロトコル
すぐにACKする - タスクを受信したら、作業を開始する前に承認します。
cat > ~/.agent-relay/outbox/$AGENT_RELAY_NAME/ack << 'EOF'
TO: Sender
ACK: Brief description of task received
EOF
次に: ->relay-file:ack
完了を報告する - 完了したら、完了メッセージを送信します。
cat > ~/.agent-relay/outbox/$AGENT_RELAY_NAME/done << 'EOF'
TO: Sender
DONE: Brief summary of what was completed
EOF
次に: ->relay-file:done
優先順位の処理 - [RETRY] または [URGENT] タグが表示された場合は、すぐに応答してください。
メッセージの受信
メッセージは次のように表示されます。
Relay message from Alice [abc123]: Content here
再試行エスカレーションのあるメッセージ:
[RETRY] Relay message from Alice [abc123]: Did you receive my message?
[URGENT - PLEASE ACKNOWLEDGE] Relay message from Alice [abc123]: Please respond!
チャンネルルーティング(重要!)
general(ブロードキャストチャンネル)からのメッセージには、[#general] インジケーターが含まれます。
Relay message from Alice [abc123] [#general]: Hello everyone!
[#general] が表示された場合: 送信者に直接ではなく、*(ブロードキャスト)に応答します。
エージェントの生成と解放
重要: ファイル名は常に spawn(spawn-agentname ではありません)であり、トリガーは常に ->relay-file:spawn です。エージェントは一度に1つずつ順番に生成してください。
ワーカーの生成
cat > ~/.agent-relay/outbox/$AGENT_RELAY_NAME/spawn << 'EOF'
KIND: spawn
NAME: WorkerName
CLI: claude
Task description here.
EOF
次に: ->relay-file:spawn
特定のディレクトリに生成する
CWD を使用して、マルチリポジトリワークスペース内の特定のリポジトリにエージェントを生成します。
cat > ~/.agent-relay/outbox/$AGENT_RELAY_NAME/spawn << 'EOF'
KIND: spawn
NAME: RepoWorker
CLI: claude
CWD: relay
Work on the relay repository.
EOF
次に: ->relay-file:spawn
ワーカーの解放
cat > ~/.agent-relay/outbox/$AGENT_RELAY_NAME/release << 'EOF'
KIND: release
NAME: WorkerName
EOF
次に: ->relay-file:release
ヘッダーリファレンス
| ヘッダー | 必須 | 説明 |
|---|---|---|
| TO | はい (メッセージ) | ターゲットエージェント/チャンネル |
| KIND | いいえ | message (デフォルト), spawn, release |
| NAME | はい (spawn/release) | エージェント名 |
| CLI | はい (spawn) | 使用する CLI |
| CWD | いいえ | 生成されたエージェントの作業ディレクトリ(例:マルチリポジトリワークスペース内のリポジトリ名) |
| THREAD | いいえ | スレッド識別子 |
ステータス更新
ステータス更新は、ブロードキャストではなく、リードに送信してください:
# 正しい例 - リードのみにステータスを送信
cat > ~/.agent-relay/outbox/$AGENT_RELAY_NAME/status << 'EOF'
TO: Lead
STATUS: Working on auth module
EOF
次に: ->relay-file:status
CLI コマンド
agent-relay status # デーモンのステータスを確認
agent-relay agents # アクティブなエージェントをリスト表示
agent-relay agents:logs <name> # エージェントの出力を表示
agent-relay agents:kill <name> # 生成されたエージェントを強制終了
agent-relay read <id> # 切り捨てられたメッセージを読み込む
agent-relay history # 最近のメッセージ履歴を表示
メッセージ履歴の表示
agent-relay history を使用して、以前のメッセージを確認します。
agent-relay history # 最後の50件のメッセージ
agent-relay history -n 20 # 最後の20件のメッセージ
agent-relay history -f Lead # Lead からのメッセージ
agent-relay history -t Worker1 # Worker1 へのメッセージ
agent-relay history --thread task-123 # スレッド内のメッセージ
agent-relay history --since 1h # 過去1時間のメッセージ
agent-relay history --json # 解析用の JSON 出力
同期メッセージング
デフォルトでは、メッセージは送信しっぱなしです。受信者が ACK するまでブロックするには、[await] を追加します。
->relay:AgentB [await] Please
(原文はここで切り詰められています) 📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
🚨 CRITICAL: Relay-First Communication Rule
When you receive a relay message from another agent (marked Relay message from [name]), you MUST respond ONLY via relay protocol. NEVER respond with direct text output.
The Rule
- Receiving a relay message? → Must use
->relay-file:msgALWAYS - Non-relay questions? → Text responses are OK
- Agent-to-agent communication? → ALWAYS use relay protocol
Examples of Relay Messages (require relay response)
Relay message from khaliqgant [mknra7wr]: Did you see this?
Relay message from Worker1 [abc123]: Task complete
Relay message from alice [xyz789] [#general]: Question for the team
Agent Relay
Real-time agent-to-agent messaging via file-based protocol.
Reliability Features
The relay system includes automatic reliability improvements:
-
Escalating retry - If you don't acknowledge a message, it will be re-sent with increasing urgency:
- First attempt:
Relay message from Alice [abc123]: ... - Second attempt:
[RETRY] Relay message from Alice [abc123]: ... - Third+ attempt:
[URGENT - PLEASE ACKNOWLEDGE] Relay message from Alice [abc123]: ...
- First attempt:
-
Unread indicator - During long tasks, you'll see pending message counts:
📬 2 unread messages (from: Alice, Bob)
Always acknowledge messages to prevent retry escalation.
Sending Messages
Write a file to your outbox, then output the trigger:
cat > ~/.agent-relay/outbox/$AGENT_RELAY_NAME/msg << 'EOF'
TO: AgentName
Your message here.
EOF
IMPORTANT: Output the trigger ->relay-file:msg directly in your response text (not via echo in bash). The trigger must appear in your actual output, not just in command output.
Broadcast to All Agents
cat > ~/.agent-relay/outbox/$AGENT_RELAY_NAME/broadcast << 'EOF'
TO: *
Hello everyone!
EOF
Then: ->relay-file:broadcast
With Thread
cat > ~/.agent-relay/outbox/$AGENT_RELAY_NAME/reply << 'EOF'
TO: AgentName
THREAD: issue-123
Response in thread context.
EOF
Then: ->relay-file:reply
Message Format
TO: Target
THREAD: optional-thread
Message body (everything after blank line)
| TO Value | Behavior |
|---|---|
AgentName |
Direct message |
* |
Broadcast to all |
#channel |
Channel message |
Communication Protocol
ACK immediately - When you receive a task, acknowledge it before starting work:
cat > ~/.agent-relay/outbox/$AGENT_RELAY_NAME/ack << 'EOF'
TO: Sender
ACK: Brief description of task received
EOF
Then: ->relay-file:ack
Report completion - When done, send a completion message:
cat > ~/.agent-relay/outbox/$AGENT_RELAY_NAME/done << 'EOF'
TO: Sender
DONE: Brief summary of what was completed
EOF
Then: ->relay-file:done
Priority handling - If you see [RETRY] or [URGENT] tags, respond immediately.
Receiving Messages
Messages appear as:
Relay message from Alice [abc123]: Content here
Messages with retry escalation:
[RETRY] Relay message from Alice [abc123]: Did you receive my message?
[URGENT - PLEASE ACKNOWLEDGE] Relay message from Alice [abc123]: Please respond!
Channel Routing (Important!)
Messages from #general (broadcast channel) include a [#general] indicator:
Relay message from Alice [abc123] [#general]: Hello everyone!
When you see [#general]: Reply to * (broadcast), NOT to the sender directly.
Spawning & Releasing Agents
IMPORTANT: The filename is always spawn (not spawn-agentname) and the trigger is always ->relay-file:spawn. Spawn agents one at a time sequentially.
Spawn a Worker
cat > ~/.agent-relay/outbox/$AGENT_RELAY_NAME/spawn << 'EOF'
KIND: spawn
NAME: WorkerName
CLI: claude
Task description here.
EOF
Then: ->relay-file:spawn
Spawn in a Specific Directory
Use CWD to spawn an agent in a specific repo within a multi-repo workspace:
cat > ~/.agent-relay/outbox/$AGENT_RELAY_NAME/spawn << 'EOF'
KIND: spawn
NAME: RepoWorker
CLI: claude
CWD: relay
Work on the relay repository.
EOF
Then: ->relay-file:spawn
Release a Worker
cat > ~/.agent-relay/outbox/$AGENT_RELAY_NAME/release << 'EOF'
KIND: release
NAME: WorkerName
EOF
Then: ->relay-file:release
Headers Reference
| Header | Required | Description |
|---|---|---|
| TO | Yes (messages) | Target agent/channel |
| KIND | No | message (default), spawn, release |
| NAME | Yes (spawn/release) | Agent name |
| CLI | Yes (spawn) | CLI to use |
| CWD | No | Working directory for spawned agent (e.g., repo name in multi-repo workspace) |
| THREAD | No | Thread identifier |
Status Updates
Send status updates to your lead, NOT broadcast:
# Correct - status to lead only
cat > ~/.agent-relay/outbox/$AGENT_RELAY_NAME/status << 'EOF'
TO: Lead
STATUS: Working on auth module
EOF
Then: ->relay-file:status
CLI Commands
agent-relay status # Check daemon status
agent-relay agents # List active agents
agent-relay agents:logs <name> # View agent output
agent-relay agents:kill <name> # Kill a spawned agent
agent-relay read <id> # Read truncated message
agent-relay history # Show recent message history
Viewing Message History
Use agent-relay history to review previous messages:
agent-relay history # Last 50 messages
agent-relay history -n 20 # Last 20 messages
agent-relay history -f Lead # Messages from Lead
agent-relay history -t Worker1 # Messages to Worker1
agent-relay history --thread task-123 # Messages in a thread
agent-relay history --since 1h # Messages from the last hour
agent-relay history --json # JSON output for parsing
Synchronous Messaging
By default, messages are fire-and-forget. Add [await] to block until the recipient ACKs:
->relay:AgentB [await] Please confirm
Custom timeout (seconds or minutes):
->relay:AgentB [await:30s] Please confirm
->relay:AgentB [await:5m] Please confirm
Recipients auto-ACK after processing when a correlation ID is present.
Troubleshooting
agent-relay status # Check daemon
agent-relay agents # List connected agents
ls -la /tmp/agent-relay.sock # Verify socket
ls -la ~/.agent-relay/outbox/ # Check outbox directories
Common Mistakes
| Mistake | Fix |
|---|---|
| Using bash to send messages | Write file to outbox, then output ->relay-file:ID |
| Messages not sending | Check agent-relay status and outbox directory exists |
| Incomplete message content | agent-relay read <id> for full text |
| Missing trigger | Must output ->relay-file:<filename> after writing file |
| Wrong outbox path | Use ~/.agent-relay/outbox/$AGENT_RELAY_NAME/ |