Skip to main content
Glama

zSwarm

Coordinate CLI AI crews across Zellij terminal panes. Control agents, pass prompts between panes, manage git worktrees, inspect outputs, and sync crew tasks via CLI or Model Context Protocol (MCP).

                       you ──▶ any agent ──┐
                                           │ zswarm({op:"send", to:"reviewer"})
                                           ▼
      every pane can call zswarm ──▶ ┌─────────┐
      so agents drive each other     │ zswarm  │
                                     │ cli/mcp │
                                     └────┬────┘
                       paste + Enter ┌────┴────┐ read screen / pushed state
                                     ▼         ▼
 ══ this machine ══════════════════════════════╗ ══ ssh user@build-01 ═════════╗
   zellij "crew"                               ║   zellij "ci"                 ║
                                               ║                               ║
   ┌────────────┐  send   ┌────────────┐       ║   ┌────────────┐              ║
   │ codex      │────────▶│ claude     │───────╫──▶│ opencode   │              ║
   │ builder    │◀────────│ reviewer   │  send ║   │ test-runner│              ║
   │ wt:feat-a  │ signal  │ wt:rev-a   │       ║   │ wt:feat-a  │              ║
   └────────────┘         └────────────┘       ║   └──────┬─────┘              ║
   ┌────────────┐         ┌────────────┐       ║   ┌──────▼─────┐              ║
   │ cursor     │         │ agy        │       ║   │ pi         │              ║
   │ refactor   │         │ docs       │       ║   │ deploy     │              ║
   │ wt:feat-b  │         │ wt:docs    │       ║   │ cwd:/srv   │              ║
   └────────────┘         └────────────┘       ║   └────────────┘              ║
 ═══════════════════════════════════════════════╝ ══════════════════════════════╝
     one pane = one agent + one role + optionally its own worktree
     any pane can drive any other, on this machine or across the ssh boundary

⚡ Quick Start

Requirements

  • Zellij ≥ 0.42 on PATH (or set ZSWARM_BIN / ZSWARM_PATH)

  • Node.js ≥ 20

Installation

npm i -g zswarm
zswarm list

Enable the optional Zellij event-bus plugin once per machine for zero-polling state updates:

zswarm bus --install

MCP Server Setup

Configure zswarm-mcp (stdio MCP server bundled with the package) in your MCP host:

{
  "mcpServers": {
    "zswarm": {
      "command": "/absolute/path/to/zswarm-mcp",
      "env": {
        "ZSWARM_SESSION": "my-zellij-session"
      }
    }
  }
}

Note: Use the absolute path to zswarm-mcp and specify ZSWARM_SESSION to prevent ambiguous session errors when multiple Zellij sessions run.


Related MCP server: multi-agent-mcp

Usage & Quick Syntax

Every operation is supported both via CLI (zswarm <op> [flags]) and MCP (zswarm({ op: "<op>", ... })).

Essential Examples

# 1. Inspect Panes & Status
zswarm list                                     # List active panes
zswarm status                                   # Check status: busy | waiting | idle | exited

# 2. Spawn Panes & Worktrees
zswarm spawn --command "claude" --name reviewer # Spawn agent pane
zswarm spawn --command "codex" --worktree feature-auth --name auth-dev   # Isolated git worktree pane

# 3. Pass Prompts & Input
zswarm send --to reviewer --body "Review changes in src/" --submit auto
zswarm keys --to reviewer --key "Ctrl c"        # Send special keys / interrupts

# 4. Read Outputs & Wait
zswarm dump --to reviewer --max 4000            # Read recent screen tail
zswarm tail --to reviewer                       # Incremental read since last check
zswarm wait --to reviewer --match "DONE"        # Block until pattern matched or pane idle

# 5. Coordinate Crew & Sync Signals
zswarm broadcast --all --group builder --body "Run test suite"  # group matches pane title or command
zswarm signal --channel tests --payload ok      # Send signal to durable channel
zswarm await --channel tests --count 3          # Wait for 3 worker signals

📋 Operations Reference

Operation

Purpose

Key Parameters / Flags

list / sessions

List panes or live Zellij sessions

verbose

status

Panes classified by state (idle, busy, waiting, exited)

to, sampleMs, since-last

spawn

Launch command in new pane, tab, or git worktree

command, name, cwd, worktree, tab, newTab

send

Send text / prompt into a pane

to, body, submit (auto|double-enter|none), expect

dump

Read screen content (screen tail)

to, max (default 8000)

tail

Incremental screen read since last cursor

to, reset

wait

Block until quiet, pattern match, or idle

to, match, for (idle), idleMs, timeoutMs

broadcast

Send one prompt to multiple panes

to, tab, all, group, body

keys / interrupt

Send key combos (Ctrl c, Esc) or raw chars

to, keys, chars, enter, hard

close

Close a pane

to, force

signal / signals / await

Durable message channels & barrier sync

channel, payload, count

worktrees / unworktree

List or remove managed git worktrees

cwd, branch, path, force

diff / checkpoint

Inspect peer worktree patch or autocommit WIP

branch, path, stat, message

rename / focus

Retitle pane/tab or focus pane

to, tab, name

tabs / layout / stack

Inspect tabs, layout KDL, or stack panes

to, max

bus / log

Event bus plugin management & delivery log

install, clear, failed, limit


🛡️ Safety & Policy Guards

  • Self-Target Guard: Operations refuse to modify zSwarm's own pane (allowSelf: true to override).

  • Execution & Exited Guards: Prevents writing to exited panes (force: true to override).

  • Prompt Safety (expect): send --expect <text> ensures target pane screen contains <text> before writing (prevents accidental shell execution).

  • Submission Verification (submit): auto verifies text submission into TUI composers and retries Enter if unsubmitted.

Environment Security Controls

Env Variable

Effect

ZSWARM_READONLY=1

Disable all write ops (send, spawn, close, etc.)

ZSWARM_ALLOW_PANES / ZSWARM_DENY_PANES

Comma-separated list/patterns of allowed/denied pane titles

ZSWARM_ALLOW_SPAWN=0

Disable spawning new panes

ZSWARM_ALLOW_CLOSE=0

Disable closing panes

ZSWARM_ALLOW_WORKTREE_REMOVE=0

Disable removing git worktrees


⚙️ Environment Variables

Variable

Description

ZSWARM_BIN / ZSWARM_PATH

Path to zellij executable

ZSWARM_SESSION

Default Zellij session name

ZELLIJ_SESSION_NAME

Active Zellij session (set automatically inside Zellij panes)

ZSWARM_WORKTREE_ROOT

Directory for linked worktrees (default: <repo>-worktrees)

ZSWARM_STATE_DIR

State storage directory for logs, signals, and cursors (default: ~/.zswarm)

ZSWARM_SSH

user@host — Route Zellij commands across SSH


📦 Monorepo Structure

Package

Purpose

zswarm

Main meta-package (npm i -g zswarm)

@zswarm/core

Core Zellij client and shared dispatch engine

@zswarm/cli

zswarm command line interface

@zswarm/mcp

Stdio MCP server (zswarm-mcp)

@zswarm/wasm

Precompiled Rust event-bus WASM plugin

@zswarm/pi

Extension bridge for harnesses without native MCP support


📜 License

MIT

A
license - permissive license
-
quality - not tested
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

View all related MCP servers

Related MCP Connectors

  • Git-backed platform for skills, tools, and context for AI agents

  • Cross-agent artifact workspace with provenance across Claude Code, Codex, Cursor, LangGraph.

  • Create and manage AI agents that collaborate and solve problems through natural language interacti…

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/brandonkramer/zswarm'

If you have feedback or need assistance with the MCP directory API, please join our Discord server