๐Ÿค– Tmux Multi-Agent Communication Demo

June 26, 2025 ยท View on GitHub

A demo system for agent-to-agent communication in a tmux environment.

๐Ÿ“– Read this in other languages: ๆ—ฅๆœฌ่ชž

๐ŸŽฏ Demo Overview

Experience a hierarchical command system: PRESIDENT โ†’ BOSS โ†’ Workers

๐Ÿ‘ฅ Agent Configuration

๐Ÿ“Š PRESIDENT Session (1 pane)
โ””โ”€โ”€ PRESIDENT: Project Manager

๐Ÿ“Š multiagent Session (4 panes)  
โ”œโ”€โ”€ boss1: Team Leader
โ”œโ”€โ”€ worker1: Worker A
โ”œโ”€โ”€ worker2: Worker B
โ””โ”€โ”€ worker3: Worker C

๐Ÿš€ Quick Start

0. Clone Repository

git clone https://github.com/nishimoto265/Claude-Code-Communication.git
cd Claude-Code-Communication

1. Setup tmux Environment

โš ๏ธ Warning: Existing multiagent and president sessions will be automatically removed.

./setup.sh

2. Attach Sessions

# Check multiagent session
tmux attach-session -t multiagent

# Check president session (in another terminal)
tmux attach-session -t president

3. Launch Claude Code

Step 1: President Authentication

# First, authenticate in PRESIDENT session
tmux send-keys -t president 'claude' C-m

Follow the authentication prompt to grant permission.

Step 2: Launch All Multiagent Sessions

# After authentication, launch all multiagent sessions at once
for i in {0..3}; do tmux send-keys -t multiagent:0.$i 'claude' C-m; done

4. Run Demo

Type directly in PRESIDENT session:

You are the president. Follow the instructions.

๐Ÿ“œ About Instructions

Role-specific instruction files for each agent:

  • PRESIDENT: instructions/president.md
  • boss1: instructions/boss.md
  • worker1,2,3: instructions/worker.md

Claude Code Reference: Check system structure in CLAUDE.md

Key Points:

  • PRESIDENT: "You are the president. Follow the instructions." โ†’ Send command to boss1
  • boss1: Receive PRESIDENT command โ†’ Send instructions to all workers โ†’ Report completion
  • workers: Execute Hello World โ†’ Create completion files โ†’ Last worker reports

๐ŸŽฌ Expected Operation Flow

1. PRESIDENT โ†’ boss1: "You are boss1. Start Hello World project"
2. boss1 โ†’ workers: "You are worker[1-3]. Start Hello World task"  
3. workers โ†’ Create ./tmp/ files โ†’ Last worker โ†’ boss1: "All tasks completed"
4. boss1 โ†’ PRESIDENT: "All completed"

๐Ÿ”ง Manual Operations

Using agent-send.sh

# Basic sending
./agent-send.sh [agent_name] [message]

# Examples
./agent-send.sh boss1 "Urgent task"
./agent-send.sh worker1 "Task completed"
./agent-send.sh president "Final report"

# Check agent list
./agent-send.sh --list

๐Ÿงช Verification & Debug

Log Checking

# Check send logs
cat logs/send_log.txt

# Check specific agent logs
grep "boss1" logs/send_log.txt

# Check completion files
ls -la ./tmp/worker*_done.txt

Session Status Check

# List sessions
tmux list-sessions

# List panes
tmux list-panes -t multiagent
tmux list-panes -t president

๐Ÿ”„ Environment Reset

# Delete sessions
tmux kill-session -t multiagent
tmux kill-session -t president

# Delete completion files
rm -f ./tmp/worker*_done.txt

# Rebuild (with auto cleanup)
./setup.sh

๐Ÿ“„ License

This project is licensed under the MIT License.

๐Ÿค Contributing

Contributions via pull requests and issues are welcome!


๐Ÿš€ Experience Agent Communication! ๐Ÿค–โœจ