Tmux Integration
AgileFlow wraps Claude Code in tmux sessions, giving you multi-window terminal management, smart conversation resume, freeze recovery, and a themed status bar - all with a single af command.
Getting Started
After installing AgileFlow, use the af command instead of claude:
af # Start Claude in tmux (or reattach to existing session)
af --new # Force a new session
af --no-tmux # Run Claude without tmux
af --kill # Kill all sessions for this directory
af --help # Show keybinding referenceTo install af globally:
sudo ln -s $(pwd)/.agileflow/scripts/af /usr/local/bin/afSession Management
Automatic Session Handling
When you run af, it automatically:
- Reattaches to detached sessions - If you previously detached with Alt+Q,
afbrings you right back - Joins existing sessions - If a session is active in another terminal, it attaches as a second client
- Creates new sessions - Only when no existing session is found
Sessions are named by directory: claude-myproject, claude-myproject-2, etc.
Smart Resume
Each tmux pane tracks its Claude conversation UUID. When you re-run Claude in the same pane, it automatically resumes the previous conversation. New windows start fresh conversations.
Session Lifecycle
af → Reattach to detached session (or create new)
af --new → Force new session (skip reattach)
Alt+s (in tmux) → New Claude window in current session
Alt+q → Detach (session stays alive in background)
af → Reattach to the detached session
af --kill → Kill all sessions for current directory
Multiple Sessions
Multiple terminals can run af from the same directory:
- First
afcreatesclaude-myproject - Running
af --newcreatesclaude-myproject-2 - When multiple detached sessions exist,
afshows a picker
Status Bar
The tmux session has a two-line status bar with a Tokyo Night-inspired dark theme:
Top line: Session name, live git branch, and keybinding hints
Bottom line: Window tabs with the active window highlighted in AgileFlow's brand orange
The status bar refreshes every 30 seconds to show the current git branch.
Keybindings
All keybindings use Alt as the modifier key (Option on Mac). Press Alt+h inside tmux to see the full reference as a popup.
Sessions
| Key | Action |
|---|---|
| Alt+s | New Claude session (new window) |
| Alt+l | Switch between sessions (interactive picker) |
| Alt+q | Detach (session stays alive, af to resume) |
Windows
| Key | Action |
|---|---|
| Alt+1 through Alt+9 | Switch to window 1-9 |
| Alt+c | Create new empty window |
| Alt+n | Next window |
| Alt+p | Previous window |
| Alt+r | Rename current window |
| Alt+w | Close window (with confirmation) |
Panes
| Key | Action |
|---|---|
| Alt+d | Split horizontally (side by side) |
| Alt+v | Split vertically (top/bottom) |
| Alt+Arrow | Navigate between panes |
| Alt+z | Zoom/unzoom pane (fullscreen toggle) |
| Alt+x | Close pane (with confirmation) |
Utility
| Key | Action |
|---|---|
| Alt+k | Interrupt (sends Ctrl+C twice, useful for frozen processes) |
| Alt+[ | Enter copy/scroll mode |
| Alt+h | Show keybinding help popup |
Freeze Recovery
If Claude freezes or hangs:
| Key | Action |
|---|---|
| Alt+k | Send Ctrl+C twice (soft interrupt) |
| Alt+K | Force kill the pane immediately |
| Alt+R | Respawn pane with fresh shell |
| Alt+q | Detach from tmux, then af to start fresh |
Auto-Cleanup
AgileFlow automatically cleans up:
- Dead sessions - Sessions where all panes have exited are removed
- Duplicate sessions - Numbered duplicates are consolidated
- Socket directory - Recreated automatically after macOS reboot clears
/tmp
Window Naming
New Claude sessions get sequential names:
- First window:
main - Alt+s windows:
claude-2,claude-3, etc.
Windows are automatically renumbered when you close one (no gaps).
Configuration
Disable Tmux
Add to docs/00-meta/agileflow-metadata.json:
{
"features": {
"tmuxAutoSpawn": {
"enabled": false
}
}
}Default Claude Flags
Configure startup flags (e.g., --dangerously-skip-permissions) via /agileflow:configure or in metadata:
{
"sessions": {
"defaultStartupMode": "dangerous"
}
}Refresh Config
If you update the tmux configuration, apply it to all running sessions:
af --refreshMac Users
On macOS, Alt is the Option key. If keybindings don't work, check your terminal settings:
- iTerm2: Preferences > Profiles > Keys > Left Option key > set to "Esc+"
- Terminal.app: Preferences > Profiles > Keyboard > check "Use Option as Meta key"
- Alacritty / Kitty / WezTerm: Usually works out of the box
Prerequisites
Tmux must be installed:
# macOS
brew install tmux
# Ubuntu/Debian
sudo apt install tmuxIf tmux isn't available, af falls back to running Claude directly.
Related
- Parallel Sessions - Working in multiple isolated git worktrees
- IDE Integrations - Setting up AgileFlow with your editor
On This Page
Tmux IntegrationGetting StartedSession ManagementAutomatic Session HandlingSmart ResumeSession LifecycleMultiple SessionsStatus BarKeybindingsSessionsWindowsPanesUtilityFreeze RecoveryAuto-CleanupWindow NamingConfigurationDisable TmuxDefault Claude FlagsRefresh ConfigMac UsersPrerequisitesRelated