tmux

Send keystrokes and capture pane output in tmux sessions.

3|Updated Jun 4, 2021
One-click install
npx skills add https://github.com/tizee/dotfiles --skill tmux-tizee
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tmux
Source: https://github.com/tizee/dotfiles/tree/main/claude/skills/tmux
Command: npx skills add https://github.com/tizee/dotfiles --skill tmux-tizee

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires tmux, and includes scripts (resource) components.

What problem does it solve?

This Skill empowers AI to programmatically interact with complex command-line interfaces (CLIs) running within tmux sessions. It eliminates the need for manual input and output monitoring in interactive CLI workflows, such as debugging, running REPLs, or managing database clients. By allowing the AI to control these tools as if a human were typing, it ensures consistent execution, reduces manual effort, and accelerates development and operational tasks.

Core Features & Use Cases

  • Interactive CLI Control: Send keystrokes and commands to any interactive CLI (e.g., Python REPL, GDB, psql, bash) running in a tmux pane, enabling seamless automation of interactive processes.
  • Output Scraping & Monitoring: Capture and analyze real-time output from tmux panes to understand program state, detect specific prompts, or verify command execution results.
  • Isolated Session Management: Create, manage, and terminate isolated tmux sessions for different tasks, ensuring a clean, reproducible, and controlled environment for each operation.
  • Use Case: Debug a complex C++ application. The AI can use this Skill to start GDB in a tmux session, set breakpoints, step through code, inspect variables, and capture the output to pinpoint the root cause of an issue, all without direct human intervention.

Quick Start

To start a Python REPL session and execute a command: Use the tmux skill to create a clean Python REPL session named 'my-python-repl' with the program 'PYTHON_BASIC_REPL=1 python3 -q' and wait for the prompt '^>>> '. Once the session is ready, send the command "print('Hello, Claude!')" followed by Enter to the 'my-python-repl' session. Capture the last 5 lines of output from the 'my-python-repl' session.

Frequently Asked Questions about tmux

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automate interactive CLI sessions like Python REPLs or debuggers?

Automate interactive CLI sessions by using tmux to create isolated terminal environments, send keystrokes and commands to specific panes, and capture output in real time. This enables hands-off control of Python REPLs, GDB, LLDB, psql, and other interactive tools without manual monitoring.

Can I control tmux sessions programmatically to debug applications?

Yes. Programmatically control tmux sessions by sending commands to start debuggers like GDB or LLDB, set breakpoints, step through code, inspect variables, and scrape output to analyze program state—all without human intervention.

What's the best way to capture output from running terminal processes?

Capture output from terminal processes by scraping tmux pane content in real time. Monitor specific prompts, verify command execution results, and detect program state changes as they occur within isolated session environments.

How do I set up isolated terminal environments for testing and automation?

Create isolated tmux sessions for each task with socket-managed session directories. This ensures clean, reproducible environments where you can run multiple interactive CLIs in parallel without interference or state leakage between operations.

Can I use tmux automation with Python REPLs and other interactive terminals?

Yes. Send keystrokes to Python REPLs, bash shells, psql clients, and any interactive terminal running in a tmux pane. Use prompt detection and output capture to drive sequences of commands and verify results end to end.

What are the limitations when automating interactive CLI control?

Session isolation requires per-session socket directories and proper input delivery modes. Timing between keystrokes and prompt detection is critical; ensure pane output scraping waits for expected prompts before sending subsequent commands to avoid race conditions.