Smart tab management for AI-heavy terminal workflows. An iTerm2 plugin that monitors your tabs, detects which AI agents need your attention, and surfaces them.
If you run 20 Claude Code sessions at once, autotabs tells you which 5 actually need you right now.
autotabs polls each tab every 1.5 seconds, reads the terminal buffer, and classifies the session into one of four states:
| Badge | Color | State | Meaning |
|---|---|---|---|
| ⚠ INPUT | Red | INPUT |
Agent is blocked waiting for your response (permission prompt, Y/n, question) |
| ⚡ ACTIVE | Blue | ACTIVE |
Output is streaming — agent is working |
| ● READY | Green | READY |
Claude prompt is open, waiting for your next command |
| ○ IDLE | Gray | IDLE |
Plain shell prompt, nothing running |
Each tab gets a colored badge so you can visually scan all your tabs instantly.
git clone https://github.com/roham/autotabs.git
cd autotabs
./install.shThen:
- iTerm2 → Settings → General → Magic → Enable Python API
- Restart iTerm2
By default, autotabs only paints badges and colors. To have tabs physically sort by priority (INPUT tabs float left, IDLE tabs sink right):
Edit autotabs.py and set:
AUTO_REORDER = TrueOr bind a hotkey to toggle it live:
- iTerm2 → Settings → Keys → add shortcut → Action: "Invoke Script Function"
- Function:
autotabs_toggle_reorder()
The tab you're currently looking at never moves (controlled by PROTECT_FOCUSED = True).
autotabs detects agent state by pattern-matching the last 8 lines of terminal output:
INPUT (agent blocked on you):
- Claude Code permission prompts (
Allow/Deny) - Confirmation prompts (
Y/n,Press Enter) - Password/passphrase prompts
ACTIVE (agent working):
- Screen content changed in the last 3 seconds
READY (Claude waiting for command):
- Bare
>or❯prompt with cursor at bottom
IDLE (shell):
- Standard
$/%/#prompt
You can add your own patterns by editing the INPUT_PATTERNS, CLAUDE_PROMPT_PATTERNS, and SHELL_PATTERNS lists in autotabs.py.
All config is at the top of autotabs.py:
POLL_INTERVAL = 1.5 # seconds between scans
ACTIVITY_TIMEOUT = 3.0 # seconds of no change → not "active"
AUTO_REORDER = False # tabs auto-sort by priority
REORDER_COOLDOWN = 3.0 # min seconds between reorders
PROTECT_FOCUSED = True # never move the focused tab
NOTIFY_ON_INPUT = True # set session variable on INPUT transition- Tab grouping (cluster related agent sessions)
- Tab minimize (collapse idle tabs to a compact strip)
- Bookmarks (snapshot + restore a session's state)
- Sound/notification on INPUT transition
- Support for non-Claude agents (Copilot, Cursor, aider, etc.)
Some of these will require forking iTerm2 for native UI changes. The Python API can only go so far.
MIT