plugins/autorun/skills/tmux-automation/SKILL.md
Complete CLI testing automation using tmux/byobu sessions with ai-monitor integration. Create automated workflows for testing plugins, CLIs, and terminal applications. Includes session management, keystroke control, output capture, and autonomous monitoring capabilities.
npx skillsauth add ahundt/autorun tmux-automationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill provides comprehensive capabilities for automated testing of CLI applications, plugins, and terminal workflows using tmux/byobu sessions with full ai-monitor integration. Perfect for testing Claude Code plugins, command-line tools, and automated workflows.
byobu new-session -d -s <session-name> - Create new detached sessionbyobu list-sessions - List all active sessionsbyobu attach-session -t <session-name> - Attach to existing sessionbyobu detach-session - Detach from session (F6)byobu kill-session -t <session-name> - Terminate sessiontmux list-sessions - List tmux sessionsbyobu new-window -t <session-name> - Create new windowbyobu list-windows -t <session-name> - List windows in sessionbyobu kill-window -t <session-name>:<window-index> - Kill specific windowbyobu select-window -t <session-name>:<window-index> - Select windowbyobu send-keys -t <session-name> <keys> - Send keystrokes to windowbyobu send-keys -t <session-name> C-m - Send Enter/Return keybyobu send-keys -t <session-name> C-c - Send Ctrl+C interruptbyobu capture-pane -t <session-name> - Capture window outputbyobu capture-pane -t <session-name> -p -S -<lines> - Capture last N linestmux new-session -d -s <session-name> - Create new detached tmux sessiontmux list-sessions - List all tmux sessionstmux attach-session -t <session-name> - Attach to tmux sessiontmux detach - Detach from tmux sessionC-c - Ctrl+C (interrupt/stop current command)C-m - Ctrl+M (Enter/Return)C-d - Ctrl+D (EOF/end of input)C-l - Ctrl+L (clear screen)C-a - Ctrl+A (tmux prefix, then command)C-z - Ctrl+Z (suspend current process)Tab - Tab completionEsc - Escape keyF2 - Create new windowShift+F2 - Split window horizontallyCtrl+F2 - Split window verticallyF3 - Previous windowF4 - Next windowF5 - Reload profileF6 - Detach sessionF7 - Search scrollback bufferF8 - Enter scrollback modeF9 - Configure byobuShift+F3/Shift+F4 - Move window left/rightCtrl+F3/Ctrl+F4 - Focus pane left/rightCtrl+B c - Create new windowCtrl+B & - Kill current windowCtrl+B , - Rename windowCtrl+B n - Next windowCtrl+B p - Previous windowCtrl+B % - Split window horizontallyCtrl+B " - Split window verticallyCtrl+B o - Switch panesCtrl+B d - Detach sessionCtrl+B s - List sessionsThe ai_monitor.py in autorun provides comprehensive tmux monitoring and automation:
# Start monitoring a session
start_monitor(session_id, prompt="Continue working", stop_marker="COMPLETE", max_cycles=5)
# Stop monitoring
stop_monitor(session_id)
# Check if monitor is running
check_monitor(session_id)
autorun provides convenient commands for tmux session automation:
/ar:tabs - Discover and manage all Claude sessions across tmux windows
all:continue, awaiting:status, A:pwd, B:ls/ar:tmux or /ar:tm - Create and manage isolated tmux sessions
create <name> - Create new isolated sessionlist - List all sessions with health statuscleanup - Remove sessions older than 1 hour/ar:ttest or /ar:tt - Automated CLI testing in isolated sessions
commands/tabs.md - Session discovery user interfacecommands/tmux-session-management.md - Enhanced session managementagents/tmux-session-automation.md - Advanced automation patterns| Task | Manual tmux Command | autorun Shortcut |
|------|-------------------|-------------------|
| List Claude sessions | tmux list-windows (manual) | /ar:tabs |
| Create session | tmux new-session -d -s name | /ar:tm create name |
| Send to all sessions | for s in $(tmux list-sessions); do ... | /ar:tabs all:continue |
| Test CLI | Manual scripting required | /ar:tt test my-cli |
--prompt/-p <text> - Custom prompt to send when idle--stop/-s <string> - Stop marker to detect completion--stop-delay-seconds <n> - Delay before stopping after detecting stop marker--max-retry-cycles/-c <n> - Maximum number of re-prompt cycles--max-runtime-minutes <n> - Maximum runtime in minutes--check-interval <n> - Seconds between checks--prompt-on-start - Send prompt immediately on start--start <window_numbers> - Target specific windows# Create session (default: autorun)
byobu new-session -d -s "autorun"
# Navigate and start process
byobu send-keys -t "autorun" "cd /path/to/project" C-m
byobu send-keys -t "autorun" "npm test" C-m
# Start ai-monitor (from separate terminal)
python3 ai_monitor.py "autorun" --prompt "Continue testing" --stop "Tests completed" --max-cycles 3
# Create Claude Code session (default: autorun unless user specifies otherwise)
byobu new-session -d -s "autorun"
byobu send-keys -t "autorun" "cd /project" C-m
byobu send-keys -t "autorun" "claude" C-m
# Start monitoring for autonomous work
python3 ai_monitor.py "autorun" --prompt "Continue working autonomously" --stop "AUTORUN_ALL_TASKS_COMPLETED" --max-cycles 10
# Create session for autorun testing (default: autorun)
byobu new-session -d -s "autorun"
# Navigate to project (replace with your autorun directory)
byobu send-keys -t "autorun" "cd \$HOME/.claude/autorun" C-m
# Start Claude Code
byobu send-keys -t "autorun" "claude" C-m
sleep 5
# Set model to haiku for efficiency
byobu send-keys -t "autorun" "/model haiku" C-m
sleep 2
# Install plugin locally (replace with your autorun directory)
byobu send-keys -t "autorun" "/plugin marketplace add \$HOME/.claude/autorun" C-m
sleep 3
# Install plugin
byobu send-keys -t "autorun" "/plugin install autorun@autorun" C-m
sleep 5
# Test commands
byobu send-keys -t "autorun" "/afs" C-m
sleep 3
byobu send-keys -t "autorun" "/afst" C-m
sleep 3
# Capture output for verification
byobu capture-pane -t "autorun" -p -S -20
# Check if session exists before operations
if byobu list-sessions | grep -q "test-session"; then
echo "Session exists, proceeding..."
else
echo "Session not found, creating..."
byobu new-session -d -s "test-session"
fi
# Interrupt hanging commands
byobu send-keys -t "test-session" C-c
# Kill and recreate session if needed
byobu kill-session -t "test-session"
byobu new-session -d -s "test-session"
❌ Common Mistake: Incorrect Enter Key Syntax
# WRONG - This will NOT work as expected
byobu send-keys -t "session_name" "command" "C-m" # WRONG syntax
byobu send-keys -t "session_name" "command C-m" # WRONG syntax
✅ CORRECT: Proper Control Sequence Syntax
# CORRECT - Each operation is ALWAYS a separate byobu send-keys command
byobu send-keys -t "session_name" "command" # Step 1: Type the command text
byobu send-keys -t "session_name" C-m # Step 2: Press Enter to execute
byobu send-keys -t "session_name" "cd /path" # Step 1: Type "cd /path"
byobu send-keys -t "session_name" C-m # Step 2: Press Enter to execute
# EFFICIENCY TIP: Chain operations with && for single-line execution
byobu send-keys -t "session_name" C-c && byobu send-keys -t "session_name" C-m # Interrupt + confirm
byobu send-keys -t "session_name" C-c # Step 1: Press Ctrl+C interrupt
byobu send-keys -t "session_name" C-m # Step 2: Press Enter to confirm (if needed)
Key Rules:
C-m = Enter/Return, C-c = Ctrl+C, C-d = EOF, C-l = Clear screenProblem: Commands appear to execute but fail silently
C-m as separate argument after commandProblem: Commands hang or timeout
sleep 2-5 between commands, especially after Claude Code startupProblem: Session becomes unresponsive
C-c) to interrupt, recreate session if neededProblem: Marketplace addition fails with "not found"
Problem: Plugin installation fails after marketplace addition
Discovery: Slash Commands vs Plugin Installation
~/.claude/commands/ rather than formal pluginsls -la ~/.claude/commands//afs, /afst, /afa, /afj may be available as slash commands even when no plugins are installedbyobu list-sessionsbyobu kill-session&& to chain byobu commands for single-line execution: byobu send-keys C-c && byobu send-keys C-m~/.claude/commands/ first before plugin installation attemptsByobu Official Documentation - https://www.byobu.org/
Tmux Manual - https://github.com/tmux/tmux/wiki
Claude Code Skills Documentation - https://docs.claude.com/en/docs/claude-code/skills
Claude Code Plugin Documentation - https://docs.claude.com/en/docs/claude-code/plugins
Claude Code Plugin Examples - https://raw.githubusercontent.com/anthropics/claude-code/refs/heads/main/plugins/README.md
AI-Monitor Integration (autorun) - src/autorun/ai_monitor.py
Bash Scripting Guide - https://www.gnu.org/software/bash/manual/
Setup Phase:
Development Phase:
Debugging Phase:
Best Practices:
tools
Use this skill when the user asks to "enable cache protection", "block on cache miss", "avoid cache expiration cost", "/ar:cache", "protect against compaction", "cache pressure guard", "cache hit ratio threshold", or "set cache-miss threshold". Covers the /ar:cache slash command family for blocking tool use when the Claude Code prompt cache is cold or context is near compaction.
tools
(Renamed) Search, recover, and analyze sessions from Claude Code, AI Studio, and Gemini CLI — use /ar:ai-session-tools (this is an alias that redirects there).
tools
Expertise in maintaining, debugging, and deploying the autorun hook system for Claude Code and Gemini CLI. Use when the user asks to "fix hooks", "deploy autorun", "debug hook errors", "update autorun version", or when troubleshooting "invisible failures" where safety guards appear inactive, piped commands are blocked, or work appears to have "reverted" after a session.
tools
Search, recover, and analyze AI session histories across Claude Code, AI Studio, and Gemini CLI. Use when user asks to "find that file from last week", "search sessions", "recover context after compaction", "what did the AI do", "export session to markdown", "find corrections", "analyze session quality", "improve CLAUDE.md from past mistakes", or "turn AI mistakes into rules". Contains session search, file recovery, correction detection, self-improvement workflow.