Agent skill
tmux
Control interactive terminal sessions via tmux. Use when tasks need persistent REPLs, parallel CLI agents, or any process requiring a TTY that simple shell execution cannot handle.
Install this agent skill to your Project
npx add-skill https://github.com/vaayne/agent-kit/tree/main/skills/tmux
Metadata
Additional technical details for this skill
- os
-
[ "darwin", "linux" ] - requires
-
{ "bins": [ "tmux" ] }
SKILL.md
tmux Skill
Use tmux only when you need an interactive TTY. Prefer exec background mode for long-running, non-interactive tasks.
Quickstart
SOCKET_DIR="${TMUX_SOCKET_DIR:-${TMPDIR:-/tmp}/tmux-sockets}"
mkdir -p "$SOCKET_DIR"
SOCKET="$SOCKET_DIR/tmux.sock"
SESSION=my-session
tmux -S "$SOCKET" new -d -s "$SESSION" -n shell
tmux -S "$SOCKET" send-keys -t "$SESSION":0.0 -- 'PYTHON_BASIC_REPL=1 python3 -q' Enter
tmux -S "$SOCKET" capture-pane -p -J -t "$SESSION":0.0 -S -200
Essential Commands
| Action | Command |
|---|---|
| Send text | tmux -S "$SOCKET" send-keys -t target -l -- "$cmd" |
| Send Enter/Ctrl-C | tmux -S "$SOCKET" send-keys -t target Enter / C-c |
| Capture output | tmux -S "$SOCKET" capture-pane -p -J -t target -S -200 |
| List sessions | tmux -S "$SOCKET" list-sessions |
| Kill session | tmux -S "$SOCKET" kill-session -t "$SESSION" |
| Kill server | tmux -S "$SOCKET" kill-server |
Conventions
- Socket:
TMUX_SOCKET_DIRenv var (default${TMPDIR:-/tmp}/tmux-sockets) - Target format:
session:window.pane(defaults to:0.0) - Python REPLs: Set
PYTHON_BASIC_REPL=1to avoid readline issues
Helper Scripts
./scripts/find-sessions.sh -S "$SOCKET" # list sessions
./scripts/find-sessions.sh --all # scan all sockets
./scripts/wait-for-text.sh -t sess:0.0 -p 'pattern' [-T 20] [-i 0.5]
Parallel Agents Example
SOCKET="${TMPDIR:-/tmp}/agents.sock"
for i in 1 2 3; do tmux -S "$SOCKET" new-session -d -s "agent-$i"; done
tmux -S "$SOCKET" send-keys -t agent-1 "codex --yolo 'Fix bug'" Enter
# Poll for completion
tmux -S "$SOCKET" capture-pane -p -t agent-1 -S -3 | grep -q "❯" && echo "Done"
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
pi-delegate
Delegate tasks to Pi subagents with preset roles (oracle, worker, reviewer, ui-engineer, librarian) or ad-hoc prompts. Use for fresh context, model specialization, second opinions, code review, isolated execution, or parallel task delegation.
mcp-jetbrains-ide
Control JetBrains IDE (IntelliJ, WebStorm, PyCharm) via MCP. Use when manipulating IDE files, running configurations, searching code, or performing refactoring. Triggers on "open in IDE", "run configuration", "refactor code", "IDE search", "JetBrains".
mcp-context7-docs
Query up-to-date documentation and code examples for any programming library or framework. Use when looking up API docs, finding code examples, or checking library usage. Triggers on "how to use [library]", "docs for [package]", "show me examples of [framework]", "Context7 lookup".
web-fetch
Fetch and extract clean content from URLs using Jina Reader API. Use when users need to read webpage content, extract article text, or fetch URL content for analysis. Triggers on "fetch this page", "read this URL", "extract content from", "get the content of", "what does this page say".
specs-dev
Plan-first development workflow with review gates. Use when implementing features, refactoring, or any task requiring structured planning, iterative implementation with reviews, and clean commits. Triggers on requests like "implement feature X", "plan and build", "spec-driven development", or when user wants disciplined, reviewed code changes.
mcp-grep-code
Search real-world code examples from over a million public GitHub repositories. Use when finding code patterns, implementation examples, or how libraries are used in practice. Triggers on "find code examples", "how is [library] used", "search GitHub code", "grep.app search", "code pattern".
Didn't find tool you were looking for?