| name | tmux-background-agents |
|---|---|
| description | Manage background Claude Code sessions using tmux. Start sessions, send prompts, read responses, and open sessions in Terminal windows. |
Manage background Claude Code sessions using tmux. Start sessions, send prompts, read responses, and open sessions in Terminal windows.
# Basic - starts in current directory
tmux new-session -d -s SESSION_NAME "cd /path/to/dir && claude --dangerously-skip-permissions"
# With initial prompt
tmux new-session -d -s SESSION_NAME "cd /path/to/dir && claude --dangerously-skip-permissions 'YOUR PROMPT HERE'"tmux send-keys -t SESSION_NAME "your prompt here" EnterNote: Sometimes an extra Enter is needed:
tmux send-keys -t SESSION_NAME Entertmux capture-pane -t SESSION_NAME -pFor full scrollback:
tmux capture-pane -t SESSION_NAME -p -S -100tmux lsosascript <<'APPLESCRIPT'
tell application "Terminal"
activate
do script "tmux attach -t SESSION_NAME"
end tell
APPLESCRIPTtmux kill-session -t SESSION_NAME- Start session:
tmux new-session -d -s my-agent "cd /path/to/your/project && claude --dangerously-skip-permissions"
sleep 5- Send prompt:
tmux send-keys -t my-agent "Fix the bug in auth.swift" Enter- Wait and read response:
sleep 15
tmux capture-pane -t my-agent -p- Hand off to user:
osascript -e 'tell application "Terminal" to do script "tmux attach -t my-agent"'When the user asks to:
- "start a background agent" -> create tmux session with Claude
- "send prompt to agent X" -> use
tmux send-keys - "check agent X" -> use
tmux capture-pane - "open agent X" -> open Terminal attached to tmux session
- "list agents" -> use
tmux ls - "stop agent X" -> use
tmux kill-session
- Always wait 5-8 seconds after starting a session for Claude to initialize
- After sending a prompt, wait 10-15 seconds for response
- Send an extra
Enterif the prompt doesn't seem to submit - Use descriptive session names like
auth-fix,ui-refactor, etc.