- Johnny Huang/
- Posts/
- Syncing Antigravity CLI (agy) Status to tmux: Live Tab States, Quota Bars, and Smart Notifications/
Syncing Antigravity CLI (agy) Status to tmux: Live Tab States, Quota Bars, and Smart Notifications
Table of Contents
When you start running multiple Antigravity CLI (agy) sessions in parallel — one per repo, each in its own tmux window — a new kind of friction creeps in fast.
With three or four agents running across different tabs, you have no idea what any of them is doing without flipping through every window:
- Is it still actively working, or already done?
- Is it silently blocked waiting for me to approve a command?
- How much of my 5-hour and weekly token quota do I have left?
I wanted the tmux top bar to answer all of those questions at a single glance — and nudge me with a macOS notification only when I’m not looking at my terminal. Here is what the final top bar looks like:

The hook that makes it possible #
Antigravity CLI has a built-in title command hook in ~/.gemini/antigravity-cli/settings.json:
{
"title": {
"type": "command",
"command": "~/.local/bin/agy-title.sh",
"enabled": true
}
}
Whenever the agent’s state updates, agy runs that script and pipes a JSON payload of the live session state into stdin, including:
agent_state(idle,working,tool_use,reviewing,authenticating, …)tool_confirmation_pending(truewhen blocked waiting for permission approval)subagents(array of spawned subagents, each with astatussuch as"running"or"completed")cwd(active workspace path)quota["gemini-5h"].remaining_fractionandquota["gemini-weekly"].remaining_fraction
Whatever the script prints to stdout becomes the terminal title (which tmux stores as #T / #{pane_title}). Better yet, the script inherits $TMUX_PANE, so it can write custom window and pane options directly back into tmux.
Two gotchas worth knowing:
- When
agypauses for tool permission approval,agent_statestays"tool_use"rather than switching to"reviewing". The actual signal is the dedicated boolean"tool_confirmation_pending": truein the JSON payload.- When
agyspawns subagents and yields to wait for them, the top-levelagent_statecan flip to"idle"even though subagents are still running. Checking.subagents[] | select(.status == "running" or .status == "pending" or .status == "working")keeps the effective state as"working"until all subagents finish — preventing premature ✅ done badges and notifications.
Four states, synced across tabs and status-left #
To keep things scannable without clutter, every agy window falls into one of four states (evaluated in priority order):
| Priority | State | Icon | Criteria | Clears When |
|---|---|---|---|---|
| 1 | Blocked | 🔒 | tool_confirmation_pending == true or agent_state == "reviewing" | Permission approved/denied |
| 2 | Working | ⚙️ | agent_state is working, tool_use, or reviewing, or any entry in subagents is still running/pending/working | Agent and all subagents finish |
| 3 | Done | ✅ | Transitions from active → idle while the tmux window is inactive | Switching to that window (after-select-window) |
| 4 | Idle | 💤 | Any agy:* pane not blocked, working, or done | New work starts |
Here is how a single tab walks through those states while you work in another window:

One small detail that prevents false positives: agy-title.sh remembers the pane’s previous agent_state in @agy_prev_state and only sets @agy_done=1 on an explicit working|tool_use|reviewing → idle transition while #{window_active} == 0. That way, startup (authenticating → idle) and repeated idle ticks never trigger a bogus green checkmark, and finishing a task in the window you’re already looking at doesn’t leave a stale badge behind.
Left status bar: counts + remaining quota bars (agy-status.sh) #
On the left side of the tmux status bar, ~/.local/bin/agy-status.sh scans all panes across the tmux server in a single tmux list-panes -a call, tallies blocked / working / done / idle agy sessions (hiding zero counts), and renders the 5-hour (⚡) and weekly (📅) remaining quota as 5-segment ▰/▱ bars rounded to the nearest 20%:
make_bar() {
local pct="$1"
local filled=$(( (pct + 10) / 20 ))
if [ "$filled" -lt 0 ]; then filled=0; fi
if [ "$filled" -gt 5 ]; then filled=5; fi
local empty=$(( 5 - filled ))
local color="#a6e3a1" # green (>=50%)
if [ "$pct" -lt 20 ]; then
color="#f38ba8" # red (<20%)
elif [ "$pct" -lt 50 ]; then
color="#f9e2af" # yellow (20-49%)
fi
local f_str="" e_str="" i
for ((i = 0; i < filled; i++)); do f_str+="▰"; done
for ((i = 0; i < empty; i++)); do e_str+="▱"; done
printf '#[fg=%s]%s#[fg=#585b70]%s#[default]' "$color" "$f_str" "$e_str"
}
I also updated my right-side sysinfo.sh to use the exact same ▰/▱ bars for CPU and memory usage (inverted colors: green <50%, yellow 50–79%, red ≥80%), so both ends of the top bar share one visual language.
Syncing state & sending smart macOS notifications (agy-title.sh) #
In ~/.local/bin/agy-title.sh, a single jq call parses the JSON payload into tab-separated fields, updates tmux options (@agy_blocked, @agy_working, @agy_done, @agy_quota_5h, @agy_quota_wk), and prints agy: <dir> to stdout.
For notifications, I wanted desktop alerts only when WezTerm itself isn’t in focus — if I’m already in WezTerm, the 🔒 and ✅ icons in the tmux tab bar are plenty. On macOS, /usr/bin/lsappinfo checks the frontmost app bundle ID in a few milliseconds without needing Accessibility permissions:
is_wezterm_focused() {
local front_asn
front_asn="$(/usr/bin/lsappinfo front 2>/dev/null || true)"
[ -n "$front_asn" ] || return 1
/usr/bin/lsappinfo info -only bundleid "$front_asn" 2>/dev/null \
| /usr/bin/grep -q '"com.github.wez.wezterm"'
}
notify() {
local title="$1" msg="$2"
/opt/homebrew/bin/terminal-notifier \
-title "$title" \
-message "$msg" \
-group "agy-${TMUX_PANE:-global}" \
-sound default \
-execute "/opt/homebrew/bin/tmux select-window -t '$TMUX_PANE' && /usr/bin/open -b com.github.wez.wezterm" \
</dev/null >/dev/null 2>&1 &
}
Using terminal-notifier gives two nice bonuses over osascript:
-group "agy-$TMUX_PANE"deduplicates notifications per pane instead of stacking them.-executeboth focuses WezTerm and jumps straight to the exact tmux window when I click the banner.
tmux theming #
Styling the tabs directly in ~/.tmux.conf turned out to be ~15 lines:
# Transparent status bar and clean inactive tabs (disable inverted activity highlight)
set -g status-style "bg=default,fg=#cdd6f4"
set -g window-status-style "bg=default"
set -g window-status-activity-style "none"
set -g window-status-bell-style "none"
set -g window-status-separator " "
# Sync tab icons & colors 1:1 with status-left (agy-status.sh)
# (In my actual config I use Nerd Font icons: nf-md-lock, nf-md-cog, nf-md-check_circle)
set -g window-status-format "\
#{?#{==:#{@agy_blocked},1},#[fg=#f9e2af]! ,#{?#{==:#{@agy_working},1},#[fg=#89b4fa]⚙ ,#{?#{==:#{@agy_done},1},#[fg=#a6e3a1]✓ ,}}}\
#[fg=#{?#{==:#{@agy_blocked},1},#f9e2af,#{?#{==:#{@agy_working},1},#89b4fa,#{?#{==:#{@agy_done},1},#a6e3a1,#6c7086}}}]#I \
#[fg=#{?#{||:#{==:#{@agy_blocked},1},#{==:#{@agy_done},1}},#cdd6f4,#7f849c}]#T#[default]"
set -g window-status-current-format "\
#{?#{==:#{@agy_blocked},1},#[fg=#f9e2af]! ,#{?#{==:#{@agy_working},1},#[fg=#89b4fa]⚙ ,}}\
#[fg=#{?#{==:#{@agy_blocked},1},#f9e2af,#{?#{==:#{@agy_working},1},#89b4fa,#cba6f7}},bold]#I \
#[fg=#cdd6f4,bold,underscore]#T#[default]"
# Clear done indicator automatically when switching to that window
set-hook -g after-select-window 'set -w @agy_done 0'
# Left: agy counts + quota bars | Right: system info (toggleable with prefix + S)
set -g status-left-length 100
set -g status-left "#(bash ~/.local/bin/agy-status.sh)"
set -g status-right-length 100
set -g status-right "#{prefix_highlight} #(~/.local/bin/sysinfo.sh) "
bind S if-shell -F '#{==:#{status-right},}' \
'set -gF status-right "#{@saved_status_right}"' \
'set -gF @saved_status_right "#{status-right}" ; set -g status-right ""'
Setting window-status-activity-style "none" was an important catch — with monitor-activity on, tmux otherwise applies a reverse style that paints a pale background on inactive tabs whenever there is output.
Wrapping up #
Now I can keep four or five agy sessions running across tmux windows without ever guessing which one needs me:
- One glance at the tabs tells me which agent is working (⚙️), blocked on permission (🔒), or finished in the background (✅).
- One glance at the left bar tells me the overall tally and how much 5-hour / weekly quota is left.
- If I’m in another app, macOS notifies me only when an agent actually needs approval or finishes — and clicking the notification lands me right in that tmux window.