tmux Integration
tmux is the transport layer for all Genie agents. Every spawned agent runs in a tmux pane, receives messages viasend-keys injection, and is monitored through pane content capture. Understanding the tmux structure helps with debugging and manual intervention.
Session Architecture
Naming Conventions
| Entity | Naming Pattern | Example |
|---|---|---|
| Session | Team name or genie | feat-auth-fix |
| Window | Agent role or task ID | engineer, wish-42 |
| Pane | Auto-assigned by tmux | %14, %15 |
Agent Lifecycle in tmux
Spawn
Whengenie spawn engineer runs:
- Find or create the tmux session (based on team or default)
- Create a new window named after the agent role
- Launch Claude Code in the window’s pane with the appropriate arguments
- Register the agent in the worker registry with the pane ID
Message Delivery
Messages are injected into panes usingtmux send-keys:
State Detection
The orchestrator captures pane content to determine agent state:| Pattern | Detected State |
|---|---|
Prompt character visible (>, $) | idle |
| Tool execution in progress | working |
| Permission dialog visible | permission |
| Question prompt visible | question |
| Process exited | done |
Kill and Suspend
suspended in the registry. Their session ID is preserved for potential resume.
Session Management
Current Session
Genie detects the current tmux session through a fallback chain:- Inside tmux (
$TMUXset) — usedisplay-messagefor authoritative session name - Outside tmux —
list-sessions, prefer session matching a hint (team name)
Auto-Create
Whensession.autoCreate is true (default), Genie automatically creates the tmux session if it doesn’t exist. This means genie spawn works even if tmux has no sessions.
Team Sessions
Each team gets its own tmux session (or window group). The session name is derived from the sanitized team name:Keyboard Shortcuts
Install shortcuts withgenie setup --shortcuts or genie shortcuts install.
tmux Shortcuts
| Shortcut | Action | How It Works |
|---|---|---|
Prefix + G | Open Genie | Bound via tmux.conf |
Prefix + g | Quick status | Shows genie ls output |
Shell Aliases
| Alias | Expansion |
|---|---|
genie | Launches or attaches to the Genie tmux session |
Mosaic Layout
For teams with multiple agents, Genie supports a mosaic layout that tiles all agent panes in a single view:mosaic-layout.ts and applied via tmux select-layout.
Configuration
tmux-related settings in~/.genie/config.json:
| Setting | Effect |
|---|---|
session.name | Default tmux session name |
session.defaultWindow | Window name for non-agent use |
session.autoCreate | Create session automatically |
terminal.execTimeout | Timeout for tmux command execution (ms) |
terminal.readLines | Lines to capture from pane for state detection |
logging.tmuxDebug | Enable verbose tmux command logging |
Troubleshooting
Agent Not Receiving Messages
- Check if the pane is alive:
tmux list-panes -t genie -a - Check agent state:
genie ls— should showidle - Check mailbox for pending messages: look at
.genie/mailbox/<agent>.json
Session Not Found
Pane Content Not Captured
Ifgenie read or state detection fails, check:
terminal.readLinesis sufficient (increase if prompts are far from bottom)- The pane ID in the worker registry matches an actual tmux pane
- tmux server hasn’t been restarted since agents were spawned