tmux_skill

This skill enables programmable tmux sessions to automate interactive CLIs by sending keystrokes and capturing pane output.
  • TypeScript

705

GitHub Stars

1

Bundled Files

3 weeks ago

Catalog Refreshed

2 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstart where the catalogue uses aiagentskills.

npx veilstart add skill mitsuhiko/agent-stuff --skill tmux

  • SKILL.md5.4 KB

Overview

This skill programs tmux as a controllable terminal multiplexer to run interactive CLIs (Python, gdb, databases, shells) by sending keystrokes and scraping pane output. It isolates agent sessions on a private socket so agent activity does not clash with a user’s personal tmux. The skill is TypeScript-based and designed for Linux and macOS with stock tmux.

How this skill works

The skill creates a tmux server on a private socket and starts named sessions and panes. It sends literal keystrokes to a target pane, polls or captures pane output to detect prompts or completion text, and cleans up sessions when finished. Helper scripts support polling for text, listing sessions, and capturing pane history with joined lines to avoid wrapping artifacts.

When to use it

  • Run an interactive Python REPL or script and exchange code programmatically.
  • Drive a debugger (gdb or lldb) for automated debugging tasks.
  • Interact with TTY-only tools (ipdb, psql, mysql, node, bash) without attaching a user terminal.
  • Isolate agent-driven terminal work to avoid interfering with the user's tmux config.
  • Capture or monitor long-running CLI output and wait for specific prompts or completion messages.

Best practices

  • Always use a private socket directory (CLAUDE_TMUX_SOCKET_DIR) and tmux -S "$SOCKET" to avoid using the user's tmux instance.
  • After starting a session, immediately print a copy/paste monitor command so the user can attach or capture output.
  • Prefer literal send-keys (-l or -- with proper quoting) to avoid shell splitting and use control sequences like C-c for interrupts.
  • Set PYTHON_BASIC_REPL=1 when launching Python interactive shells to keep prompt behavior stable.
  • Poll for prompts or completion text with a timed helper script to avoid race conditions before sending further input.

Example use cases

  • Start a Python REPL, wait for the >>> prompt, then send multi-line code and capture results.
  • Launch gdb --quiet on a binary, disable pagination, run until a breakpoint, collect backtraces and local variables.
  • Spawn a psql or mysql session, run queries programmatically, and capture the last N lines of output.
  • Run an instrumented test that prints a completion message, poll the pane for that message, then gather logs.
  • Provide the user with an attach command so they can monitor or intervene in the running session.

FAQ

Immediately print a copy/paste command such as: tmux -S "$SOCKET" attach -t session-name or to capture output once: tmux -S "$SOCKET" capture-pane -p -J -t session-name:0.0 -S -200

How do I wait for a prompt before sending input?

Use the wait-for-text.sh helper to poll a pane for a regex or fixed string with a timeout, e.g. ./scripts/wait-for-text.sh -t session:0.0 -p '^>>>' -T 15 -l 4000

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational