cyberneticlibrary

Control tmux sessions and capture output

tmuxskillsetup L2377,536
openclaw/openclaw
What it does

Control tmux panes and sessions for interactive CLI automation

Best for

Controlling long-running interactive CLI sessions (CI/CD pipelines, SSH tunnels, Postgres shells) from scripts without direct terminal access.

Inputs
  • · Session:window.pane target
  • · Text to send, special keys (C-c, C-d, Escape)
Outputs
  • · Pane output capture (last N lines or full scrollback)
  • · Command execution status
Requires
  • · tmux
Preconditions
  • · tmux session already created and running
  • · Caller has shell access to tmux binary
Failure modes
  • · Invalid session:window.pane target causes command failure
  • · Session closed or pane killed before command execution
  • · Paste/newline handling requires -l -- flags to avoid surprises
Trust signals
  • · Supports capture-pane with -S - for full scrollback
  • · Helpers: find-sessions.sh, wait-for-text.sh for prompt detection
  • · Tested pattern for permission/confirmation prompts