
Using Tmux For Interactive Commands
This handles the annoying problem of running interactive CLI tools like vim, Python REPLs, or git rebase through Claude. Standard bash can't control these because they need a real terminal, so this uses tmux's detached sessions with send-keys and capture-pane to programmatically drive them. You spin up a session, send input as tmux key names (Enter, Escape, C-c), capture the screen state, repeat as needed. The pattern works well once you remember to sleep briefly after starting a session and always send Enter as a separate argument. Makes it possible to automate things that genuinely need terminal interaction without building your own PTY management.
- skills.sh installs
- 510
- GitHub stars
- 438
- last updated
- Aug 21, 2026
Install
$ npx -y skills add obra/superpowers-lab --skill using-tmux-for-interactive-commands --agent claude-codeInstalls into .claude/skills of the current project.
Files
Using tmux for Interactive Commands
Overview
Interactive CLI tools (vim, interactive git rebase, REPLs, etc.) cannot be controlled through standard bash because they require a real terminal. tmux provides detached sessions that can be controlled programmatically via send-keys and capture-pane.
When to Use
Use tmux when:
- Running vim, nano, or other text editors programmatically
- Controlling interactive REPLs (Python, Node, etc.)
- Handling interactive git commands (
git rebase -i,git add -p) - Working with full-screen terminal apps (htop, etc.)
- Commands that require terminal control codes or readline
Don't use for:
- Simple non-interactive commands (use regular Bash tool)
- Commands that accept input via stdin redirection
- One-shot commands that don't need interaction
Quick Reference
| Task | Command |
|---|---|
| Start session | tmux new-session -d -s <name> <command> |
| Send input | tmux send-keys -t <name> 'text' Enter |
| Capture output | tmux capture-pane -t <name> -p |
| Stop session | tmux kill-session -t <name> |
| List sessions | tmux list-sessions |
Core Pattern
Sponsors
Details
- Repository
- github.com/obra/superpowers-lab
- Categories
- Git & Pull Requests, Python, CLI & Terminal
- First seen
- Jun 3, 2026