Skip to main content
skill Claude Code CX Codex Cursor GitHub Copilot

smux — Claude Code skill: what it does, how to install

Controls tmux panes and manages communication between AI agents via tmux-bridge. Useful when multiple agents or background tasks run in parallel panes.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add ShawnPana/smux --skill smux -a claude-code
Open on GitHub

What smux does

The skill lets agents interact across terminal panes using the tmux-bridge CLI alongside direct tmux commands. Every interaction is atomic. The agent types text, sends keystrokes, and captures pane output in distinct steps. Outgoing messages automatically include the sender identifier so the target knows where to reply.

A built-in read guard enforces safety by requiring the agent to inspect a pane before modifying it. Once text lands, the guard resets and demands another read before the next action. To restore dismissed sessions without losing context, the package adds smux-pane commands for reopening windows.

The skill requires tmux and tmux-bridge binaries in the system path on Linux or macOS. Without these binaries installed beforehand, calls fail immediately.

What it helps with

  • send instructions to an agent in another tmux pane
  • inspect background process logs without leaving the current pane
  • approve interactive prompts in non-agent terminal panes
  • restore recently closed tmux windows using smux-pane

Example prompts for the agent

  • Send a message to the codex pane asking for a code review
  • Inspect the worker pane and confirm the pending prompt
  • Reopen the most recently closed tmux pane

How to install smux

1Skills CLI (Vercel)

npx skills add ShawnPana/smux --skill smux -a claude-code

2Manually: put the files in place

~/.claude/skills/smux/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/smux/

Similar

configure-notifications Yeachan-Heo Configures Telegram, Discord, or Slack alerts through an interactive agent dialog. It alerts you when background runs complete or Claude awaits your input. Claude Code CX Codex Cursor +1 775installs tavily-extract tavily-ai Extracts clean text or Markdown from specified pages with Tavily CLI. Use it for JavaScript-rendered content or query-focused page chunks. Claude Code CX Codex Cursor +1 18,000installs opencode-delegate amElnagdy Hands coding tasks to OpenCode CLI as a background worker and returns diffs for your review. Keeps manual git commits under your control. Claude Code CX Codex Cursor +1 6,600installs workflow-init Vercel Inc. Sets up Vercel Workflow SDK in a project where workflow is not installed yet: picks the framework from package.json and walks the official guide up to a working first run. Claude Code CX Codex Cursor +1 3,800installs omc-plan Yeachan-Heo Creates structured, quality-gated implementation plans before writing code and asks targeted questions to clarify vague requirements. Claude Code CX Codex Cursor +1 760installs write-issue tldraw Enforces GitHub issue formatting and triage standards based on the tldraw repository. It helps draft clear titles, structure descriptions, and manage labels. Claude Code CX Codex Cursor +1 405installs setup-matt-pocock-skills Matt Pocock This skill configures a repository for Matt Pocock's engineering skills by setting its issue tracker, triage labels, and domain docs layout. Run it before using the other skills. Claude Code 1,052,851installs to-tickets Matt Pocock Turns a plan, spec, or conversation into small end-to-end tickets with explicit blockers. Use it to agree on the work breakdown before tickets go to a tracker. Claude Code 711,230installs

Questions about smux

How to install smux in Claude Code?

Run npx skills add ShawnPana/smux --skill smux -a claude-code to install the skill.

What does smux do?

It connects AI agents across tmux panes and provides atomic terminal pane controls.

What are the system requirements for smux?

It runs on Linux or macOS and requires tmux and tmux-bridge available in your system path.

Source text

SKILL.md · MIT
---
name: smux
description: Control tmux panes and communicate between AI agents. Use this skill whenever the user mentions tmux panes, cross-pane communication, sending messages to other agents, reading other panes, managing tmux sessions, or interacting with processes running in tmux. Includes tmux-bridge CLI for agent-to-agent messaging and raw tmux commands for direct session control.
metadata:
  { "openclaw": { "emoji": "🖥️", "os": ["darwin", "linux"], "requires": { "bins": ["tmux", "tmux-bridge"] } } }
---

# smux

Tmux pane control and cross-pane agent communication. Use `tmux-bridge` (the high-level CLI) for all cross-pane interactions. Fall back to raw tmux commands only when you need low-level control.

## tmux-bridge — Cross-Pane Communication

A CLI that lets any AI agent interact with any other tmux pane. Works via plain bash. Every command is **atomic**: `type` types text (no Enter), `keys` sends special keys, `read` captures pane content.

### DO NOT WAIT OR POLL

Other panes have agents that will reply to you via tmux-bridge. Their reply appears directly in YOUR pane as a `[tmux-bridge from:...]` message. Do not sleep, poll, read the target pane for a response, or loop. Type your message, press Enter, and move on.

The ONLY time you read a target pane is:
- **Before** interacting with it (enforced by the read guard)
- **After typing** to verify your text landed before pressing Enter
- When interacting with a **non-agent pane** (plain shell, running process)

### Read Guard

The CLI enforces read-before-act. You cannot `type` or `keys` to a pane unless you have read it first.

1. `tmux-bridge read <target>` marks the pane as "read"
2. `tmux-bridge type/keys <target>` checks for that mark — errors if you haven't read
3. After a successful `type`/`keys`, the mark is cleared — you must read again before the next interaction

```
$ tmux-bridge type codex "hello"
error: must read the pane before interacting. Run: tmux-bridge read codex
```

### Command Reference

| Command | Description | Example |
|---|---|---|
| `tmux-bridge list` | Show all panes with target, pid, command, size, label | `tmux-bridge list` |
| `tmux-bridge type <target> <text>` | Type text without pressing Enter | `tmux-bridge type codex "hello"` |
| `tmux-bridge message <target> <text>` | Type text with auto sender info and reply target | `tmux-bridge message codex "review src/auth.ts"` |
| `tmux-bridge read <target> [lines]` | Read last N lines (default 50) | `tmux-bridge read codex 100` |
| `tmux-bridge keys <target> <key>...` | Send special keys | `tmux-bridge keys codex Enter` |
| `tmux-bridge name <target> <label>` | Label a pane (visible in tmux border) | `tmux-bridge name %3 codex` |
| `tmux-bridge resolve <label>` | Print pane target for a label | `tmux-bridge resolve codex` |
| `tmux-bridge id` | Print this pane's ID | `tmux-bridge id` |

### Target Resolution

Targets can be:
- **tmux native**: `session:window.pane` (e.g. `shared:0.1`), pane ID (`%3`), or window index (`0`)
- **label**: Any string set via `tmux-bridge name` — resolved automatically

### Read-Act-Read Cycle

Every interaction follows **read → act → read**. The CLI enforces this.

**Sending a message to an agent:**
```bash
tmux-bridge read codex 20                    # 1. READ — satisfy read guard
tmux-bridge message codex 'Please review src/auth.ts'
                                              # 2. MESSAGE — auto-prepends sender info, no Enter
tmux-bridge read codex 20                    # 3. READ — verify text landed
tmux-bridge keys codex Enter                 # 4. KEYS — submit
# STOP. Do NOT read codex for a reply. The agent replies into YOUR pane.
```

**Approving a prompt (non-agent pane):**
```bash
tmux-bridge read worker 10                   # 1. READ — see the prompt
tmux-bridge type worker "y"                  # 2. TYPE
tmux-bridge read worker 10                   # 3. READ — verify
tmux-bridge keys worker Enter                # 4. KEYS — submit
tmux-bridge read worker 20                   # 5. READ — see the result
```

### Messaging Convention

The `message` command auto-prepends sender info and location:

```
[tmux-bridge from:claude pane:%4 at:3:0.0] Please review src/auth.ts
```

The receiver gets: who sent it (`from`), the exact pane to reply to (`pane`), and the session/window location (`at`). When you see this header, reply using tmux-bridge to the pane ID from the header.

### Agent-to-Agent Workflow

```bash
# 1. Label yourself
tmux-bridge name "$(tmux-bridge id)" claude

# 2. Discover other panes
tmux-bridge list

# 3. Send a message (read-act-read)
tmux-bridge read codex 20
tmux-bridge message codex 'Please review the changes in src/auth.ts'
tmux-bridge read codex 20
tmux-bridge keys codex Enter
```

### Example Conversation

**Agent A (claude) sends:**
```bash
tmux-bridge read codex 20
tmux-bridge message codex 'What is the test coverage for src/auth.ts?'
tmux-bridge read codex 20
tmux-bridge keys codex Enter
```

**Agent B (codex) sees in their prompt:**
```
[tmux-bridge from:claude pane:%4 at:3:0.0] What is the test coverage for src/auth.ts?
```

**Agent B replies using the pane ID from the header:**
```bash
tmux-bridge read %4 20
tmux-bridge message %4 '87% line coverage. Missing the OAuth refresh token path (lines 142-168).'
tmux-bridge read %4 20
tmux-bridge keys %4 Enter
```

---

## Raw tmux Commands

Use these when you need direct tmux control beyond what tmux-bridge provides — session management, window navigation, creating panes, or low-level scripting.

### Capture Output

```bash
tmux capture-pane -t shared -p | tail -20    # Last 20 lines
tmux capture-pane -t shared -p -S -          # Entire scrollback
tmux capture-pane -t shared:0.0 -p           # Specific pane
```

### Send Keys

```bash
tmux send-keys -t shared -l -- "text here"   # Type text (literal mode)
tmux send-keys -t shared Enter               # Press Enter
tmux send-keys -t shared Escape              # Press Escape
tmux send-keys -t shared C-c                 # Ctrl+C
tmux send-keys -t shared C-d                 # Ctrl+D (EOF)
```

For interactive TUIs, split text and Enter into separate sends:
```bash
tmux send-keys -t shared -l -- "Please apply the patch"
sleep 0.1
tmux send-keys -t shared Enter
```

### Closed Panes and Windows

The human closes panes with `Option+w` and windows with `Option+Shift+w`, and reopens the most recent one with `Option+Shift+n`. The same operations are available as a CLI, useful when the user asks you to bring back a pane or to close one in a way that can be undone:

```bash
smux-pane list                 # what can be reopened, newest first
smux-pane revive               # reopen the most recently closed pane or window
smux-pane close %3             # close a pane so it can be reopened
smux-pane close-window %3      # close the whole window %3 is in, as one entry
smux-pane peek %3              # what close would record (cwd, command, claude session)
```

A reopened pane comes back in its old slot and directory. A pane that was running Claude Code resumes the exact conversation it had; other processes are not restarted. Window numbers always equal their position in the status bar, so do not rely on a window keeping its number after another window is closed — address windows by name or by pane ID (`%N`), which never changes.

### Panes and Windows

```bash
# Create panes (prefer over new windows)
tmux split-window -h -t SESSION              # Horizontal split
tmux split-window -v -t SESSION              # Vertical split
tmux select-layout -t SESSION tiled          # Re-balance

# Navigate
tmux select-window -t shared:0
tmux select-pane -t shared:0.1
tmux list-windows -t shared
```

### Session Management

```bash
tmux list-sessions
tmux new-session -d -s newsession
tmux kill-session -t sessionname
tmux rename-session -t old new
```

### Claude Code Patterns

```bash
# Check if session needs input
tmux capture-pane -t worker-3 -p | tail -10 | grep -E "❯|Yes.*No|proceed|permission"

# Approve a prompt
tmux send-keys -t worker-3 'y' Enter

# Check all sessions
for s in shared worker-2 worker-3 worker-4; do
  echo "=== $s ==="
  tmux capture-pane -t $s -p 2>/dev/null | tail -5
done
```

## Tips

- **Read guard is enforced** — you MUST read before every `type`/`keys`
- **Every action clears the read mark** — after `type`, read again before `keys`
- **Never wait or poll** — agent panes reply via tmux-bridge into YOUR pane
- **Label panes early** — easier than using `%N` IDs
- **`type` uses literal mode** — special characters are typed as-is
- **`read` defaults to 50 lines** — pass a higher number for more context
- **Non-agent panes** are the exception — you DO need to read them to see output
- Use `capture-pane -p` to print to stdout (essential for scripting)
- Target format: `session:window.pane` (e.g., `shared:0.0`)

© ShawnPana · MIT · ShawnPana/smux

See also

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor