Sandbox
@yohey-w/multi-agent-shogun

Tmux multi-agent harness for Claude Code and other CLIs

multi-agent-shogun is a workflow harness that launches a Shogun commander, a Karo manager, and multiple Ashigaru workers in separate tmux panes. It moves tasks through YAML files and generated instructions so agents can work in parallel with visible state and minimal coordination overhead.

1,420 stars290 forksShellUpdated 1mo ago
Who it's for

Builders who want Claude Code and other coding CLIs to run as a coordinated team in tmux.

What it delivers

You can hand off one task and watch several agents work on it in parallel without re-explaining the setup each time.

What it does

Role-based agent hierarchy

Defines Shogun, Karo, Ashigaru, and Gunshi roles so work is assigned and reviewed in layers.

Parallel tmux execution

Starts multiple CLI sessions at once and keeps them visible in separate panes.

Multi-CLI support

Works with Claude Code, Codex, Copilot, Cursor, OpenCode, Kimi, and Antigravity.

Generated instruction files

Builds CLI-specific files such as `CLAUDE.md`, `AGENTS.md`, and Copilot instructions from shared templates.

Skill discovery

Lets workers propose reusable patterns as new skills during real work.

Dashboard and queue files

Uses YAML queue files and a dashboard view to track tasks, reports, and progress.

How to get it

  1. 1Requirements: tmux, bash 4+, at least one of: Claude Code / Codex / Copilot / Kimi /…
    git clone https://github.com/yohey-w/multi-agent-shogun
    cd multi-agent-shogun
    bash first_setup.sh                        # one-time setup: config, dependencies, MCP
    source ~/.bashrc                           # reload PATH
    claude --dangerously-skip-permissions      # first run only: OAuth + accept Bypass Permissions → /exit
    bash shutsujin_departure.sh                # launch all agents
  2. 2Open Ubuntu and run (first time only)
    cd /mnt/c/tools/multi-agent-shogun
    ./first_setup.sh
  3. 3Deploy!
    ./shutsujin_departure.sh
  4. 4After first_setup.sh, run these commands once to authenticate
    # 1. Apply PATH changes
    source ~/.bashrc
    
    # 2. OAuth login + Bypass Permissions approval (one command)
    claude --dangerously-skip-permissions
    #    → Browser opens → Log in with Anthropic account → Return to CLI
    #    → "Bypass Permissions" prompt appears → Select "Yes, I accept" (↓ to option 2, Enter)
    #    → Type /exit to quit
  5. 5Open an Ubuntu terminal (WSL) and run
    cd /mnt/c/tools/multi-agent-shogun
    ./shutsujin_departure.sh
  6. 6Using Tailscale (connect from anywhere)
    # Server-side (WSL2)
    curl -fsSL https://tailscale.com/install.sh | sh
    sudo tailscaled &
    sudo tailscale up --authkey tskey-auth-XXXXXXXXXXXX
    sudo service ssh start

README

multi-agent-shogun

Command your AI army like a feudal warlord.

Run 10 AI coding agents in parallel — Claude Code, OpenAI Codex, GitHub Copilot, Kimi Code, OpenCode, Cursor, Antigravity — orchestrated through a samurai-inspired hierarchy with zero coordination overhead.

Talk Coding, not Vibe Coding. Speak to your phone, AI executes.

GitHub Stars License: MIT v5.1.0 Karo Traffic Control Shell

English | 日本語

📖 Sequel (Aug 2026): The author has since disbanded his own 10-agent army down to a single agent that carries his judgment. The successor project is kagemusha — it ships the forms of a judgment loop (corrections → principles → standing rules), not the agents. The story of the disbandment: article (JP). multi-agent-shogun itself continues to work as-is.

Latest translucent command session in the Shogun pane

Quick natural-language command in the Shogun pane Karo and Ashigaru panes reacting in parallel

One Karo (manager) coordinating 7 Ashigaru (workers) + 1 Gunshi (strategist) — real session, no mock data.


Quick Start

Requirements: tmux, bash 4+, at least one of: Claude Code / Codex / Copilot / Kimi / OpenCode / Antigravity

git clone https://github.com/yohey-w/multi-agent-shogun
cd multi-agent-shogun
bash first_setup.sh                        # one-time setup: config, dependencies, MCP
source ~/.bashrc                           # reload PATH
claude --dangerously-skip-permissions      # first run only: OAuth + accept Bypass Permissions → /exit
bash shutsujin_departure.sh                # launch all agents

For full install steps (incl. Windows) and the first-30-minutes walkthrough, see 🚀 Quick Start and the basic usage section below.

Type a command in the Shogun pane:

"Build a REST API for user authentication"

Shogun delegates → Karo breaks it down → 7 Ashigaru execute in parallel. You watch the dashboard. That's it.

Want to go deeper? The rest of this README covers architecture, configuration, memory design, and multi-CLI setup.


What is this?

multi-agent-shogun is a system that runs multiple AI coding CLI instances simultaneously, orchestrating them like a feudal Japanese army. Supports Claude Code, OpenAI Codex, GitHub Copilot, Kimi Code, OpenCode, Cursor, and Antigravity.

Why use it?

  • One command spawns 7 AI workers + 1 strategist executing in parallel
  • Zero wait time — give your next order while tasks run in the background
  • AI remembers your preferences across sessions (Memory MCP)
  • Real-time progress on a dashboard
        You (上様 / The Lord)
             │
             ▼  Give orders
      ┌─────────────┐
      │   SHOGUN    │  ← Receives your command, delegates instantly
      └──────┬──────┘
             │  YAML + tmux
      ┌──────▼──────┐
      │    KARO     │  ← Distributes tasks to workers
      └──────┬──────┘
             │
    ┌─┬─┬─┬─┴─┬─┬─┬─┬────────┐
    │1│2│3│4│5│6│7│ GUNSHI │  ← 7 workers + 1 strategist
    └─┴─┴─┴─┴─┴─┴─┴────────┘
       ASHIGARU      軍師

Why Shogun?

Most multi-agent frameworks burn API tokens on coordination. Shogun doesn't.

Claude Code Task toolClaude Code Agent TeamsLangGraphCrewAImulti-agent-shogun
ArchitectureSubagents inside one processTeam lead + teammates (JSON mailbox)Graph-based state machineRole-based agentsFeudal hierarchy via tmux
ParallelismSequential (one at a time)Multiple independent sessionsParallel nodes (v0.2+)Limited8 independent agents
Coordination costAPI calls per TaskToken-heavy (each teammate = separate context)API + infra (Postgres/Redis)API + CrewAI platformZero (YAML + tmux)
Multi-CLIClaude Code onlyClaude Code onlyAny LLM APIAny LLM API7 CLIs (Claude/Codex/Copilot/Kimi/OpenCode/Cursor/Antigravity)
ObservabilityClaude logs onlytmux split-panes or in-processLangSmith integrationOpenTelemetryLive tmux panes + dashboard
Skill discoveryNoneNoneNoneNoneBottom-up auto-proposal
SetupBuilt into Claude CodeBuilt-in (experimental)Heavy (infra required)pip installShell scripts

What makes this different

Zero coordination overhead — Agents talk through YAML files on disk. The only API calls are for actual work, not orchestration. Run 8 agents and pay only for 8 agents' work.

Full transparency — Every agent runs in a visible tmux pane. Every instruction, report, and decision is a plain YAML file you can read, diff, and version-control. No black boxes.

Battle-tested hierarchy — The Shogun → Karo → Ashigaru chain of command prevents conflicts by design: clear ownership, dedicated files per agent, event-driven communication, no polling.


Why CLI (Not API)?

Most AI coding tools charge per token. Running 8 Opus-grade agents through the API costs $100+/hour. CLI subscriptions flip this:

API (Per-Token)CLI (Flat-Rate)
8 agents × Opus~$100+/hour~$200/month
Cost predictabilityUnpredictable spikesFixed monthly bill
Usage anxietyEvery token countsUnlimited
Experimentation budgetConstrainedDeploy freely

"Use AI recklessly" — With flat-rate CLI subscriptions, deploy 8 agents without hesitation. The cost is the same whether they work 1 hour or 24 hours. No more choosing between "good enough" and "thorough" — just run more agents.

Multi-CLI Support

Shogun isn't locked to one vendor. The system supports 7 CLI tools, each with unique strengths:

CLIKey StrengthDefault Model
Claude CodeBattle-tested tmux integration, Memory MCP, dedicated file tools (Read/Write/Edit/Glob/Grep)Claude Sonnet 4.6
OpenAI CodexSandbox execution, JSONL structured output, codex exec headless mode, per-model --model flaggpt-5.3-codex / gpt-5.3-codex-spark
GitHub CopilotBuilt-in GitHub MCP, 4 specialized agents (Explore/Task/Plan/Code-review), /delegate to coding agentClaude Sonnet 4.6
Kimi CodeFree tier available, strong multilingual supportKimi k2
OpenCodeShared AGENTS.md instructions, agent-specific definitions via --agent, /new context reset, restart-only model changes, deterministic interactive TUI launch, provider-qualified --model routingprovider/model
CursorAuto-loads CLAUDE.md/AGENTS.md/.cursor/rules/, built-in web search, inbox-write skill via .cursor/skills/, /model live switching, --yolo auto-runVaries
Antigravity CLIGoogle Antigravity CLI integration via agy, host-managed auth, YOLO-style launch, gemini/agy legacy aliaseshost default / last-used

OpenCode sessions load the agent-specific .opencode/agents/<agent_id>.md definition via --agent and keep automation resets on /new; model changes require a relaunch. Automation uses the repository-provided config/opencode-tui.json via OPENCODE_TUI_CONFIG, which disables app_exit and pins session_interrupt/input_clear to known bindings. Role boundaries are embedded in the generated agent frontmatter: Shogun can read queue/reports/* for oversight but cannot write them, Karo is limited to coordination files plus report aggregation, Ashigaru only touch their own task/report pair, and Gunshi reads ashigaru reports but only writes gunshi_report.yaml.

Antigravity sessions launch with agy --dangerously-skip-permissions. Shogun treats type: antigravity, type: agy, and legacy type: gemini as Antigravity. Authentication and default model selection stay in the host user's Antigravity CLI setup; settings.yaml may optionally pass a concrete model, but auto uses the host default or last-used model.

A unified instruction build system generates CLI-specific instruction files from shared templates:

instructions/
├── common/              # Shared rules (all CLIs)
├── cli_specific/        # CLI-specific tool descriptions
│   ├── claude_tools.md  # Claude Code tools & features
│   ├── copilot_tools.md # GitHub Copilot CLI tools & features
│   ├── opencode_tools.md # OpenCode tools, agent frontmatter, and permission model
│   └── cursor_tools.md  # Cursor Agent tools, skills, and session rules
└── roles/               # Role definitions (shogun, karo, ashigaru)
    ↓ build
CLAUDE.md / AGENTS.md / .github/copilot-instructions.md / .opencode/agents/*.md / .cursor/rules/*.md
  ← Generated per CLI

One source of truth, zero sync drift. Change a rule once, all CLIs get it.


Bottom-Up Skill Discovery

This is the feature no other framework has.

As Ashigaru execute tasks, they automatically identify reusable patterns and propose them as skill candidates. The Karo aggregates these proposals in dashboard.md, and you — the Lord — decide what gets promoted to a permanent skill.

Ashigaru finishes a task
    ↓
Notices: "I've done this pattern 3 times across different projects"
    ↓
Reports in YAML:  skill_candidate:
                     found: true
                     name: "api-endpoint-scaffold"
                     reason: "Same REST scaffold pattern used in 3 projects"
    ↓
Appears in dashboard.md → You approve → Skill created in .claude/commands/
    ↓
Any agent can now invoke /api-endpoint-scaffold

Skills grow organically from real work — not from a predefined template library. Your skill set becomes a reflection of your workflow.


Quick Start

Windows (WSL2)

Step 1

📥 Download the repository

Download ZIP and extract to C:\tools\multi-agent-shogun

Or use git: git clone https://github.com/yohey-w/multi-agent-shogun.git C:\tools\multi-agent-shogun

Step 2

🖱️ Run install.bat

Right-click → "Run as Administrator" (if WSL2 is not installed). Sets up WSL2 + Ubuntu automatically.

Step 3

🐧 Open Ubuntu and run (first time only)

cd /mnt/c/tools/multi-agent-shogun
./first_setup.sh

Step 4

Deploy!

./shutsujin_departure.sh

First-time only: Authentication

After first_setup.sh, run these commands once to authenticate:

# 1. Apply PATH changes
source ~/.bashrc

# 2. OAuth login + Bypass Permissions approval (one command)
claude --dangerously-skip-permissions
#    → Browser opens → Log in with Anthropic account → Return to CLI
#    → "Bypass Permissions" prompt appears → Select "Yes, I accept" (↓ to option 2, Enter)
#    → Type /exit to quit

This saves credentials to ~/.claude/ — you won't need to do it again.

Daily startup

Open an Ubuntu terminal (WSL) and run:

cd /mnt/c/tools/multi-agent-shogun
./shutsujin_departure.sh

📱 Mobile Access — Dedicated Android App (Recommended)

Shogun Terminal Agents Grid Dashboard

Monitor and command 10 AI agents from your phone with the dedicated Android companion app.

FeatureDescription
Shogun TerminalSSH terminal + voice input + special key bar (C-c, C-b, Tab, etc.)
Agents Grid9-pane simultaneous monitoring. Tap to expand fullscreen + send commands
DashboardRenders dashboard.md with full table text selection/copy
Rate LimitTap the FAB on the Agents tab to check Claude Max 5h/7d usage with progress bars
Voice InputJapanese continuous recognition via Google Speech API — higher accuracy than phone keyboard voice
Screenshot ShareShare images via Android share menu → SFTP transfer to server

Note: Android only for now. No iOS version — the developer doesn't own an iPhone. If there's demand, please open an Issue. PRs welcome!

Setup

Prerequisites:

  • Shogun system running on WSL2 (or Linux server)
  • SSH server started (sudo service ssh start)
  • Phone and server on same network (LAN or Tailscale)

Steps:

  1. Install APK

    1. Download android/release/multi-agent-shogun.apk on your phone (open the file on GitHub → "Download raw file")
    2. Tap the download notification → "Install"
    3. If "Unknown sources" warning appears → "Settings" → enable "Allow from this source" for your browser → go back → "Install"
    4. Done → "Open"
  2. Configure SSH (Settings tab)

    FieldExampleDescription
    SSH Host100.xxx.xxx.xxxServer IP (e.g., Tailscale IP)
    SSH Port22Usually 22
    SSH Useryour_usernameSSH login username
    SSH Key Path/data/data/.../id_ed25519Private key path on phone (*1)
    SSH Password****Use if no key available
    Project Path/mnt/c/tools/multi-agent-shogunServer-side project directory
    Shogun Sessionshoguntmux session name for Shogun
    Agent Sessionmultiagenttmux session name for agents

    *1 Transfer your private key to the phone, or use password authentication

  3. Save → Switch to Shogun tab → auto-connects

Using Tailscale (connect from anywhere):

# Server-side (WSL2)
curl -fsSL https://tailscale.com/install.sh | sh
sudo tailscaled &
sudo tailscale up --authkey tskey-auth-XXXXXXXXXXXX
sudo service ssh start

Install the Tailscale app on your phone, log in with the same account, and use the displayed Tailscale IP as the SSH Host in the app.

With ntfy notifications:

See ntfy setup section for push notifications from Karo on task completion.

📟 Termux Method (without the Android app) (click to expand)

SSH via Termux also works. More limited than the dedicated app, but requires no APK sideloading.

Requirements (all free):

NameIn a nutshellRole
TailscaleA road to your home from anywhereConnect to your home PC from anywhere
SSHThe feet that walk that roadLog into your home PC through Tailscale
TermuxA black screen on your phoneRequired to use SSH — just install it

Setup:

  1. Install Tailscale on both WSL and your phone
  2. In WSL (auth key method — browser not needed):
    curl -fsSL https://tailscale.com/install.sh | sh
    sudo tailscaled &
    sudo tailscale up --authkey tskey-auth-XXXXXXXXXXXX
    sudo service ssh start
    
  3. In Termux on your phone:
    pkg update && pkg install openssh
    ssh youruser@your-tailscale-ip
    css    # Connect to Shogun
    
  4. Open a new Termux window (+ button) for workers:
    ssh youruser@your-tailscale-ip
    csm    # See all 9 panes
    

Disconnect: Just swipe the Termux window closed. tmux sessions survive — agents keep working.


🐧 Linux / macOS (click to expand)

First-time setup

# 1. Clone
git clone https://github.com/yohey-w/multi-agent-shogun.git ~/multi-agent-shogun
cd ~/multi-agent-shogun

# 2. Make scripts executable
chmod +x *.sh

# 3. Run first-time setup
./first_setup.sh

Daily startup

cd ~/multi-agent-shogun
./shutsujin_departure.sh

What is WSL2? Why is it needed? (click to expand)

About WSL2

WSL2 (Windows Subsystem for Linux) lets you run Linux inside Windows. This system uses tmux (a Linux tool) to manage multiple AI agents, so WSL2 is required on Windows.

If you don't have WSL2 yet

No problem! Running install.bat will:

  1. Check if WSL2 is installed (auto-install if not)
  2. Check if Ubuntu is installed (auto-install if not)
  3. Guide you through next steps (running first_setup.sh)

Quick install command (run PowerShell as Administrator):

wsl --install

Then restart your computer and run install.bat again.


📋 Script Reference (click to expand)
ScriptPurposeWhen to run
install.batWindows: WSL2 + Ubuntu setupFirst time only
first_setup.shInstall tmux, Node.js, Claude Code CLI + Memory MCP configFirst time only
shutsujin_departure.shCreate tmux sessions + launch the configured CLI for each agent + load instructions + start ntfy listenerDaily
scripts/switch_cli.shLive switch agent CLI/model (settings.yaml → /exit → relaunch)As needed

What install.bat does automatically:

  • ✅ Checks if WSL2 is installed (guides you if not)
  • ✅ Checks if Ubuntu is installed (guides you if not)
  • ✅ Shows next steps (how to run first_setup.sh)

What shutsujin_departure.sh does:

  • ✅ Creates tmux sessions (shogun + multiagent)
  • ✅ Launches each agent with the CLI configured in config/settings.yaml (Claude/Codex/Copilot/Kimi/OpenCode)
  • ✅ Auto-loads instruction files or generated agent definitions for each CLI
  • ✅ Resets queue files for a fresh state
  • ✅ Starts ntfy listener for phone notifications (if configured)

After running, all agents are ready to receive commands!


🔧 Manual Requirements (click to expand)

If you prefer to install dependencies manually:

RequirementInstallationNotes
WSL2 + Ubuntuwsl --install in PowerShellWindows only
Set Ubuntu as defaultwsl --set-default UbuntuRequired for scripts to work
tmuxsudo apt install tmuxTerminal multiplexer
Node.js v20+nvm install 20Required for MCP servers
Claude Code CLIcurl -fsSL https://claude.ai/install.sh | bashOfficial Anthropic CLI (native version recommended; npm version deprecated)
OpenAI Codex CLIInstall from the official OpenAI Codex distributionRequired only for agents with type: codex
GitHub Copilot CLIInstall and authenticate GitHub Copilot CLIRequired only for agents with type: copilot
Kimi Code CLIInstall and authenticate Kimi CodeRequired only for agents with type: kimi
OpenCode CLInpm install -g opencode-aiRequired only for agents with type: opencode; provider API keys must be available in the agent shell
Cursor CLISee Cursor CLI docs — use cursor-agent or agent commandRequired only for agents with type: cursor
Antigravity CLIInstall and authenticate Google Antigravity CLI (agy)Required only for agents with type: antigravity, type: agy, or legacy type: gemini

After Setup

Whichever option you chose, 10 AI agents are automatically launched:

AgentRoleCount
🏯 ShogunSupreme commander — receives your orders1
📋 KaroManager — distributes tasks, quality checks1
⚔️ AshigaruWorkers — execute implementation tasks in parallel7
🧠 GunshiStrategist — handles analysis, evaluation, and design1

Two tmux sessions are created:

  • shogun — connect here to give commands
  • multiagent — Karo, Ashigaru, and Gunshi running in the background

How It Works

Step 1: Connect to the Shogun

After running shutsujin_departure.sh, all agents automatically load their instructions and are ready.

Open a new terminal and connect:

tmux attach-session -t shogun

Step 2: Give your first order

The Shogun is already initialized — just give a command:

Research the top 5 JavaScript frameworks and create a comparison table

The Shogun will:

  1. Write the task to a YAML file
  2. Notify the Karo (manager)
  3. Return control to you immediately — no waiting!

Meanwhile, the Karo distributes tasks to Ashigaru workers for parallel execution.

Step 3: Check progress

Open dashboard.md in your editor for a real-time status view:

## In Progress
| Worker | Task | Status |
|--------|------|--------|
| Ashigaru 1 | Research React | Running |
| Ashigaru 2 | Research Vue | Running |
| Ashigaru 3 | Research Angular | Completed |

Project-Unit Operation (Equivalent to Visual Studio "Solution")

Once set up, the Shogun system can handle multiple projects under the same Shogun, switching between them as needed. The unit equivalent to a Visual Studio "solution" is projects/{name}.yaml + context/{name}.md.

1. Running your first project

# (1) Connect to the Shogun (after shutsujin_departure.sh completes)
tmux attach-session -t shogun

# (2) Just give the Shogun your command — the project starts automatically
#     → Shogun writes cmd to queue/shogun_to_karo.yaml and notifies Karo
#     → Karo distributes to Ashigaru for parallel execution
#     → Results aggregate in dashboard.md

No explicit "create a project" command is needed. The Shogun attaches a project: field to the cmd when relevant, and related files are automatically separated.

2. Explicitly registering a project (optional, for long-term work)

For ongoing projects, you can place metadata in projects/{name}.yaml:

# projects/example.yaml
id: example
name: "Sample Project"
working_directory: /path/to/repo
north_star: "The ultimate goal for this project"
notes: |
  Project-specific notes, stakeholders, special rules

The Shogun and Karo reference this file and inject project context when issuing cmds.

Detailed project knowledge (requirements, design, past feedback) lives in context/{name}.md. When the Shogun issues a cmd related to the project, it automatically references this file.

3. Customizing the agent formation

The agent formation (which CLI each agent uses) lives in config/settings.yaml:

cli:
  agents:
    ashigaru1:
      type: codex          # codex / claude / copilot / kimi / opencode / antigravity
      model: gpt-5.5
    ashigaru2:
      type: claude
      model: claude-sonnet-4-6
    # Same for ashigaru3-7, gunshi, karo

OpenCode uses provider-qualified model IDs:

cli:
  agents:
    ashigaru3:
      type: opencode
      model: openrouter/openai/gpt-4o-mini
      variant: high  # optional provider-specific reasoning variant
``

Files in the repo

Repository payload37 top-level entries
  • .claude
  • .cursor
  • .github
  • .opencode
  • agents
  • android
  • config
  • context
  • docs
  • images
  • instructions
  • lib
  • memory
  • reports
  • saytask
  • scripts
  • skills
  • templates
  • tests
  • .gitattributes
  • .gitignore
  • .gitleaks.toml
  • .gitmodules
  • AGENTS.md
  • CHANGELOG.md
  • CLAUDE.md
  • CONTRIBUTING.md
  • first_setup.sh
  • install.bat
  • LICENSE
  • Makefile
  • README_ja.md
  • README.md
  • requirements.txt
  • SECURITY.md
  • setup.sh
  • shutsujin_departure.sh

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More harnesses

affaan-m/
ECC
affaan-m/ECCHarnesses

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

258k

The job search that runs on your machine. AI job application framework built on Claude Code: evaluate postings, tailor CVs, write cover letters, prep interviews. Fork it and own it.

42k
ruvnet/rufloHarnesses

🌊 The original agent meta-harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

72k

Practical patterns, starters & CLI tools for loop engineering with AI coding agents. Design systems that prompt and orchestrate agents (inspired by Addy Osmani and Boris Cherny). Includes loop-audit, loop-init, loop-cost.

11k