Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Manage tmux sessions for interactive background processes
.claude/skills/aiskillstore-tmux/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-04 | ✗→✓ | ▲ Improved | 69% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 203% | 0% |
| case-06 | ✗→✓ | ▲ Improved | 95% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 53% | 0% |
| case-08 | ✗→✓ | ▲ Improved | 125% | 0% |
Use tmux as a programmable terminal multiplexer for interactive work, background tasks, and service management. Works on Linux and macOS with stock tmux; uses a private socket to avoid interfering with your personal tmux configuration.
bash# Create a new session bun ~/.pi/agent/skills/tmux/lib.ts create my-task "echo 'Hello World'" task # List all sessions bun ~/.pi/agent/skills/tmux/lib.ts list # Capture output bun ~/.pi/agent/skills/tmux/lib.ts capture pi-task-my-task-20250107-123456 # Kill a session bun ~/.pi/agent/skills/tmux/lib.ts kill pi-task-my-task-20250107-123456
${TMPDIR:-/tmp}/pi-tmux-sockets/tmp/pi-tmux-sockets/pi.sockPI_TMUX_SOCKET_DIR (optional override)All Agent sessions use a private socket to avoid conflicts with your personal tmux configuration.
Sessions are named using the pattern: pi-{category}-{name}-{timestamp}
task: Temporary sub-tasks (compilation, testing)service: Long-running services (dev servers, databases)agent: Agent-specific tasks (training, data processing)pi-task-compile-20250107-123456pi-service-dev-server-20250107-123456pi-agent-training-20250107-123456bashbun ~/.pi/agent/skills/tmux/lib.ts create <name> <command> [category]
Creates a new tmux session and automatically prints the monitoring command.
Example:
bashbun ~/.pi/agent/skills/tmux/lib.ts create compile "make clean && make all" task
bashbun ~/.pi/agent/skills/tmux/lib.ts list [filter]
Lists all sessions with status and last activity time.
Example:
bashbun ~/.pi/agent/skills/tmux/lib.ts list bun ~/.pi/agent/skills/tmux/lib.ts list service
bashbun ~/.pi/agent/skills/tmux/lib.ts status <id>
Shows detailed information about a session.
Example:
bashbun ~/.pi/agent/skills/tmux/lib.ts status pi-task-compile-20250107-123456
bashbun ~/.pi/agent/skills/tmux/lib.ts send <id> <keys>
Sends keystrokes to a session. Uses literal mode to avoid shell escaping.
Example:
bashbun ~/.pi/agent/skills/tmux/lib.ts send pi-task-python-20250107-123456 "print('Hello')"
bashbun ~/.pi/agent/skills/tmux/lib.ts capture <id> [lines]
Captures pane output (default: 200 lines).
Example:
bashbun ~/.pi/agent/skills/tmux/lib.ts capture pi-task-compile-20250107-123456 500
bashbun ~/.pi/agent/skills/tmux/lib.ts kill <id>
Terminates a tmux session.
Example:
bashbun ~/.pi/agent/skills/tmux/lib.ts kill pi-task-compile-20250107-123456
bashbun ~/.pi/agent/skills/tmux/lib.ts cleanup [hours]
Removes inactive sessions older than the specified age (default: 24 hours).
Example:
bashbun ~/.pi/agent/skills/tmux/lib.ts cleanup bun ~/.pi/agent/skills/tmux/lib.ts cleanup 48
bashbun ~/.pi/agent/skills/tmux/lib.ts attach <id>
Prints the command to attach to a session interactively.
Example:
bashbun ~/.pi/agent/skills/tmux/lib.ts attach pi-task-python-20250107-123456 # Output: tmux -S /tmp/pi-tmux-sockets/pi.sock attach -t pi-task-python-20250107-123456
bashbun ~/.pi/agent/skills/tmux/lib.ts sync
Synchronizes session status with tmux actual state.
Session information is stored in ${TMPDIR:-/tmp}/pi-tmux-sessions.json. This allows:
Storage Format:
json{ "sessions": { "pi-task-compile-20250107-123456": { "id": "pi-task-compile-20250107-123456", "name": "compile", "category": "task", "socket": "/tmp/pi-tmux-sockets/pi.sock", "target": "pi-task-compile-20250107-123456:0.0", "command": "make clean && make all", "status": "running", "createdAt": "2025-01-07T12:34:56Z", "lastActivityAt": "2025-01-07T12:35:00Z" } }, "lastSync": "2025-01-07T12:35:00Z" }
Execute temporary tasks that require monitoring:
bash# Start compilation bun ~/.pi/agent/skills/tmux/lib.ts create compile "make all" task # Wait for completion (in script) bun ~/.pi/agent/skills/tmux/lib.ts capture pi-task-compile-20250107-123456 | grep "Build successful" # Get result bun ~/.pi/agent/skills/tmux/lib.ts capture pi-task-compile-20250107-123456 # Cleanup bun ~/.pi/agent/skills/tmux/lib.ts kill pi-task-compile-20250107-123456
Run tasks in the background and check progress later:
bash# Start training bun ~/.pi/agent/skills/tmux/lib.ts create training "python train.py --epochs 100" task # Check progress later bun ~/.pi/agent/skills/tmux/lib.ts list bun ~/.pi/agent/skills/tmux/lib.ts capture pi-task-training-20250107-123456
Start development servers or services:
bash# Start dev server bun ~/.pi/agent/skills/tmux/lib.ts create dev-server "npm run dev" service # Monitor logs tmux -S /tmp/pi-tmux-sockets/pi.sock attach -t pi-service-dev-server-20250107-123456 # Stop when done bun ~/.pi/agent/skills/tmux/lib.ts kill pi-service-dev-server-20250107-123456
Use interactive tools like Python REPL, gdb, or databases:
bash# Python REPL (always use PYTHON_BASIC_REPL=1) bun ~/.pi/agent/skills/tmux/lib.ts create python "PYTHON_BASIC_REPL=1 python3 -q" task # Send commands bun ~/.pi/agent/skills/tmux/lib.ts send pi-task-python-20250107-123456 "print('Hello')" bun ~/.pi/agent/skills/tmux/lib.ts send pi-task-python-20250107-123456 "2 + 2"
Sessions have three possible states:
Status is automatically synced with tmux actual state.
By default, sessions inactive for more than 24 hours are automatically cleaned up. You can:
bash bun ~/.pi/agent/skills/tmux/lib.ts cleanup [hours]
typescript const tmux = new TmuxManager({ autoCleanup: false });
Polls a pane for a regex pattern with timeout.
bash./scripts/wait-for-text.sh -t session:0.0 -p 'pattern' [-F] [-T 20] [-i 0.5] [-l 2000]
-t/--target: Pane target (required)-p/--pattern: Regex to match (required); add -F for fixed string-T: Timeout in seconds (default: 15)-i: Poll interval in seconds (default: 0.5)-l: History lines to search (default: 1000)Lists tmux sessions with metadata.
bash./scripts/find-sessions.sh -S "$SOCKET" ./scripts/find-sessions.sh --all # Scan all sockets
See the examples/ directory for complete examples:
python-repl.ts: Interactive Python REPLlong-task.ts: Long-running task with progressstart-service.ts: Service managementYou can also use the TypeScript API directly:
typescriptimport { TmuxManager } from "~/.pi/agent/skills/tmux/lib.ts"; const tmux = new TmuxManager(); // Create session const session = await tmux.createSession('compile', 'make all', 'task'); // Wait for output const success = await tmux.waitForText(session.target, 'Build successful', { timeout: 60 }); // Capture output const output = await tmux.capturePane(session.target, 200); // Cleanup await tmux.killSession(session.id);
After creating a session, ALWAYS tell the user how to monitor it:
To monitor this session yourself:
tmux -S /tmp/pi-tmux-sockets/pi.sock attach -t pi-task-compile-20250107-123456
Or to capture the output once:
tmux -S /tmp/pi-tmux-sockets/pi.sock capture-pane -p -J -t pi-task-compile-20250107-123456:0.0 -S -200This must be printed immediately after session creation and at the end of the tool loop.
-l) to prevent shell injectionRun sync to update session state:
bashbun ~/.pi/agent/skills/tmux/lib.ts sync
Ensure tmux is installed and the socket path is correct:
bashtmux -S /tmp/pi-tmux-sockets/pi.sock attach -t <session-id>
Manually trigger cleanup:
bashbun ~/.pi/agent/skills/tmux/lib.ts cleanup
Check socket directory permissions:
bashls -la /tmp/pi-tmux-sockets/
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→fail | 13,654 | 10,789 | -21% | 1 | 1 | 0% | 440 | 3,307 | +652% | 0 | 0 | — |
case-02 | fail→fail | 7,385 | 10,611 | +44% | 1 | 1 | 0% | 1,483 | 3,277 | +121% | 0 | 0 | — |
case-03 | fail→fail | 14,710 | 6,034 | -59% | 1 | 1 | 0% | 2,494 | 3,266 | +31% | 0 | 0 | — |
case-04 | fail→pass | 11,703 | 7,402 | -37% | 1 | 1 | 0% | 1,990 | 3,372 | +69% | 0 | 0 | — |
case-05 | fail→pass | 11,481 | 7,934 | -31% | 1 | 1 | 0% | 1,163 | 3,524 | +203% | 0 | 0 | — |
case-06 | fail→pass | 15,030 | 7,098 | -53% | 1 | 1 | 0% | 1,638 | 3,198 | +95% | 0 | 0 | — |
case-07 | fail→pass | 18,992 | 7,242 | -62% | 1 | 1 | 0% | 2,145 | 3,272 | +53% | 0 | 0 | — |
case-08 | fail→pass | 13,331 | 8,258 | -38% | 1 | 1 | 0% | 1,577 | 3,552 | +125% | 0 | 0 | — |
case-09 | fail→pass | 18,313 | 3,092 | -83% | 1 | 1 | 0% | 3,282 | 3,515 | +7% | 0 | 0 | — |
case-10 | pass→pass | 17,149 | 2,716 | -84% | 1 | 1 | 0% | 2,071 | 3,424 | +65% | 0 | 0 | — |
case-11 | pass→pass | 12,501 | 2,748 | -78% | 1 | 1 | 0% | 1,234 | 3,495 | +183% | 0 | 0 | — |
case-12 | pass→pass | 7,761 | 6,753 | -13% | 1 | 1 | 0% | 1,198 | 3,210 | +168% | 0 | 0 | — |
case-13 | fail→pass | 13,193 | 7,772 | -41% | 1 | 1 | 0% | 1,486 | 3,453 | +132% | 0 | 0 | — |
case-14 | pass→pass | 11,229 | 7,674 | -32% | 1 | 1 | 0% | 1,760 | 3,452 | +96% | 0 | 0 | — |
case-15 | fail→pass | 11,697 | 7,706 | -34% | 1 | 1 | 0% | 1,843 | 3,328 | +81% | 0 | 0 | — |
case-16 | fail→pass | 12,115 | 7,248 | -40% | 1 | 1 | 0% | 1,943 | 3,223 | +66% | 0 | 0 | — |
case-17 | fail→pass | 14,163 | 3,410 | -76% | 1 | 1 | 0% | 1,742 | 3,588 | +106% | 0 | 0 | — |
case-18 | fail→pass | 12,615 | 2,192 | -83% | 1 | 1 | 0% | 1,284 | 3,296 | +157% | 0 | 0 | — |
case-19 | fail→pass | 11,972 | 8,517 | -29% | 1 | 1 | 0% | 1,030 | 3,609 | +250% | 0 | 0 | — |
case-20 | fail→pass | 7,975 | 4,543 | -43% | 1 | 1 | 0% | 1,444 | 3,847 | +166% | 0 | 0 | — |
case-21 | pass→pass | 11,888 | 11,130 | -6% | 1 | 1 | 0% | 1,169 | 4,073 | +248% | 0 | 0 | — |
case-22 | pass→pass | 16,765 | 14,080 | -16% | 1 | 1 | 0% | 2,179 | 4,606 | +111% | 0 | 0 | — |
case-23 | pass→pass | 6,412 | 4,625 | -28% | 1 | 1 | 0% | 1,083 | 3,736 | +245% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 23 cases were attempted, and 20 counted toward the lift figure. The other 3 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +57 percentage points is the difference between those two pass rates over the 20 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.