Automating tmux Windows

VerifiedCaution

Automates terminal sessions in tmux windows using MCP tools. Use for launching background processes, monitoring servers, or running interactive commands.

Sby Skills Guide Bot
DevelopmentIntermediate
7/28/2026
Claude Code
#tmux#terminal-automation#background-processes#mcp#interactive-debugging

Recommended for

Automated summary

Automates terminal sessions in tmux windows through the orchestrator MCP server's tools: creating windows, sending commands, capturing output, and managing processes.

Strengths

  • Relies on stable window IDs (e.g. @3) that stay valid when other windows are created or killed
  • File-based workflow via tmux_run_and_read and the __OUTPUT_FILE__ placeholder yields clean output instead of parsing pane text
  • tmux_wait_idle waits for a command to finish before capture, and work can be delegated to a tmux-runner subagent to save context
  • Handles interactive cases: CLI prompts, sudo commands, pdb/gdb debuggers, and long-running servers

Limitations

  • Fully dependent on the orchestrator MCP server and tmux being installed and configured
  • The tmux-runner subagent and Task call with the haiku model are Claude Code-specific
  • tmux_wait_idle is based on absence of output changes, which can give false positives for silent or very long-running processes
When to use it

Use it when an agent needs to launch and monitor long-running processes, servers, builds, or interactive debugging sessions in persistent terminals.

When not to use it

Avoid it for one-off commands whose output fits in a single call, or in environments without tmux and the orchestrator MCP server.

Security analysis

Caution
Quality score88/100

The skill provides instructions for automating tmux windows to run commands, send keystrokes, and interact with CLI prompts. It does not contain malicious or obfuscated actions, but it does enable execution of arbitrary commands, including privileged operations via sudo, and could be used to send secrets if misused. This is legitimate terminal automation but warrants caution due to the power of the tools involved.

Findings
  • •Uses tmux MCP tools to execute arbitrary shell commands, including sudo and interactive password prompts, which is powerful but intended for legitimate terminal automation.
How this analysis is made

Examples

Monitor a dev server
Start the dev server in a tmux window, wait until it's listening, then show me the last 50 lines of output.
Interactive debugger session
Open a tmux window running python -m pdb on scripts/train.py, set a breakpoint at line 42, and report the local variables when it hits.
Parallel background builds
Run the frontend and backend builds in two separate tmux windows, wait for both to finish, and summarize any errors from each.

name: automating-tmux-windows description: Automates terminal sessions in tmux windows using MCP tools. Use when launching background processes, monitoring builds/servers, sending commands to debuggers (pdb/gdb), interacting with CLI prompts, using interactive commands or commands that require sudo, or orchestrating parallel tasks across multiple terminal sessions. triggers: tmux, terminal automation, background process, interactive commands, sudo, debugger, pdb, gdb, long-running process, server monitoring

Automating tmux Windows

Control tmux windows programmatically: create windows, send commands, capture output, and manage processes. Each window gets full screen space for easier output tracking.

Note: These tools are provided by the orchestrator MCP server, which also includes AI CLI tools (see ai-orchestration skill).

Recommended: Use Subagent for Context Efficiency

To save context in the main conversation, delegate tmux operations to the tmux-runner subagent:

# Instead of calling tmux tools directly, use Task tool:
Task(
    subagent_type="tmux-runner",
    description="Run npm build",
    prompt="Run 'npm run build' in the project directory. Return success/failure and any errors.",
    model="haiku"  # Fast and cheap for simple commands
)

When to use subagent:

  • Simple build/test commands
  • Any command where you just need pass/fail + output
  • Commands that don't need real-time monitoring

When to use direct tmux tools:

  • Long-running servers you need to monitor over time
  • Complex interactive debugging sessions
  • When you need the window to persist across multiple operations

Quick Reference

| Tool | Purpose | | -------------------------------------- | ------------------------------------- | | mcp__orchestrator__tmux_new_window | Create new window with command | | mcp__orchestrator__tmux_send | Send text/keys to window | | mcp__orchestrator__tmux_capture | Get window output | | mcp__orchestrator__tmux_list | List windows (JSON) | | mcp__orchestrator__tmux_kill | Close window | | mcp__orchestrator__tmux_interrupt | Send Ctrl+C | | mcp__orchestrator__tmux_wait_idle | Wait for idle (no output changes) | | mcp__orchestrator__tmux_select | Switch to window (bring to front) | | mcp__orchestrator__tmux_run_and_read | Run command, wait, return file output |

Window Identifiers

Always use the window ID returned by tmux_new_window (e.g., "@3"). These IDs:

  • Never change when other windows are created or killed
  • Persist until the window itself is destroyed
  • Are the only reliable way to reference windows across operations

Window names are visible in the tmux status bar for easy identification.

Standard Workflow

# 1. Create window - SAVE THE RETURNED ID
# Can pass any command directly - non-shell commands are auto-wrapped in a shell
window_id = mcp__orchestrator__tmux_new_window(command="npm run build", name="build")  # Returns "@3"

# 2. Wait for completion
mcp__orchestrator__tmux_wait_idle(target=window_id, idle_seconds=2.0)  # Returns "idle" or "timeout"

# 3. Get output
output = mcp__orchestrator__tmux_capture(target=window_id, lines=50)

# 4. Optionally switch to window to view it
mcp__orchestrator__tmux_select(target=window_id)

# 5. Cleanup
mcp__orchestrator__tmux_kill(target=window_id)

File-Based Output Workflow

For commands that write to a file (cleaner than capturing pane output):

# Single call: run command, wait for completion, return file contents
# Use __OUTPUT_FILE__ placeholder - it gets replaced with a random /tmp path
result = mcp__orchestrator__tmux_run_and_read(
    command="my-tool --output __OUTPUT_FILE__",
    name="my-task",
    timeout=300
)

Key differences from tmux_new_window:

  • Does NOT spawn a shell wrapper (command runs directly)
  • Waits for window to close (command exit) instead of idle detection
  • Returns file contents instead of pane capture
  • Auto-generates safe temp file path (replaces __OUTPUT_FILE__ placeholder)
  • Auto-cleans up window and output file

Use cases:

  • CLI tools with -o or --output flags that accept a path argument
  • Wrapper scripts that write results to a specified path

Parallel Windows

Create multiple windows for parallel tasks:

# Create named windows - commands run directly
logs_window = mcp__orchestrator__tmux_new_window(command="tail -f /var/log/app.log", name="logs")
work_window = mcp__orchestrator__tmux_new_window(command="cd ~/project && make", name="work")

# Capture from both
logs = mcp__orchestrator__tmux_capture(target=logs_window, lines=100)
output = mcp__orchestrator__tmux_capture(target=work_window, lines=50)

Interactive Commands

For commands requiring input (sudo, prompts, debuggers):

# Start interactive session
window_id = mcp__orchestrator__tmux_new_window(command="sudo apt update", name="sudo")

# Wait for password prompt
mcp__orchestrator__tmux_wait_idle(target=window_id, idle_seconds=1, timeout=10)

# Send password (if needed)
mcp__orchestrator__tmux_send(target=window_id, text="password")

# Wait for completion
mcp__orchestrator__tmux_wait_idle(target=window_id, idle_seconds=2, timeout=120)

Window Navigation

  • Use tmux_select to switch to a window programmatically
  • User can navigate with Ctrl+b n (next) / Ctrl+b p (previous)
  • Window names appear in tmux status bar

Tool Parameters

tmux_new_window

| Parameter | Type | Default | Description | | --------- | ------ | ------- | ----------------------------------- | | command | string | "zsh" | Command to run (auto shell-wrapped) | | name | string | "" | Window name for status bar |

tmux_run_and_read

| Parameter | Type | Default | Description | | --------- | ------ | -------- | ------------------------------------------ | | command | string | required | Command with __OUTPUT_FILE__ placeholder | | name | string | "" | Window name for status bar | | timeout | int | 300 | Max seconds to wait |

The __OUTPUT_FILE__ placeholder is replaced with an auto-generated /tmp/tmux_output_<uuid>.txt path.

tmux_wait_idle

| Parameter | Type | Default | Description | | -------------- | ------ | -------- | --------------------------- | | target | string | required | Window ID (e.g., "@3") | | idle_seconds | float | 2.0 | Seconds of no change = idle | | timeout | int | 60 | Max seconds to wait |

tmux_capture

| Parameter | Type | Default | Description | | --------- | ------ | -------- | ----------------------------- | | target | string | required | Window ID (e.g., "@3") | | lines | int | 100 | Lines to capture (max: 10000) |

Safety

  • Cannot kill own window (server prevents this)
  • Use mcp__orchestrator__tmux_interrupt to stop runaway processes
  • Check is_claude field in mcp__orchestrator__tmux_list to identify your window
  • Always store and reuse the window ID from mcp__orchestrator__tmux_new_window
  • Target validation prevents command injection via window IDs

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/automating-tmux-windows-ms47vr19/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/automating-tmux-windows-ms47vr19' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/automating-tmux-windows-ms47vr19/download' --output '.skill-downloads/automating-tmux-windows-ms47vr19/SKILL.md.part' && mv '.skill-downloads/automating-tmux-windows-ms47vr19/SKILL.md.part' '.skill-downloads/automating-tmux-windows-ms47vr19/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

Original excerpt: Quick Reference
ToolPurpose
mcp__orchestrator__tmux_new_windowCreate new window with command
mcp__orchestrator__tmux_sendSend text/keys to window
mcp__orchestrator__tmux_captureGet window output
mcp__orchestrator__tmux_listList windows (JSON)
mcp__orchestrator__tmux_killClose window
mcp__orchestrator__tmux_interruptSend Ctrl+C
mcp__orchestrator__tmux_wait_idleWait for idle (no output changes)
mcp__orchestrator__tmux_selectSwitch to window (bring to front)
mcp__orchestrator__tmux_run_and_readRun command, wait, return file output

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/automating-tmux-windows-ms47vr19/SKILL.md' && test -s '.skill-downloads/automating-tmux-windows-ms47vr19/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/automating-tmux-windows' && cp -R '.skill-downloads/automating-tmux-windows-ms47vr19' '.claude/skills/automating-tmux-windows'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/automating-tmux-windows-ms47vr19'

openskills read 'automating-tmux-windows-ms47vr19'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/automating-tmux-windows-ms47vr19/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills