Display AI coding agent usage (tokens, cost, duration) in your tmux status bar. Supports Claude Code and Gemini CLI simultaneously.
◆ claude │ 8% │ 80k │ $3.50 │ 22m │ 5h:12% 7d:32% ◇ gemini │ 1% │ 9k │ ~$0.01 │ 2m
One-liner (no git clone needed):
curl -fsSL tmux.jimmyliao.net/install | bashOr manually:
git clone https://github.com/jimmyliao/agent-status-tmux.git
cd agent-status-tmux
./scripts/install.shThat's it. Every tmux session (tmux new -s xxx) will automatically show AI status. Works whether your status bar is at the top or bottom.
Installs to ~/.agent-status-tmux by default. Override with AGENT_STATUS_TMUX_DIR=/your/path.
- tmux >= 3.2 (hex color
#[fg=#rrggbb]support; tested on 3.4–3.6) - jq
- Claude Code and/or Gemini CLI
- Real-time token usage, cost, and session duration in tmux status-right
- Claude Code: context %, tokens, actual cost, duration, rate limits (5h/7d)
- Gemini CLI: context %, tokens, estimated cost, duration
- Shows both providers simultaneously when both are active
- Process-aware: detects running AI sessions, not just stale cache files
- Gemini CLI Extension with AfterAgent/SessionStart hooks
- Fallback: direct-reads Gemini chat recordings when hooks are unavailable
- Tokyo Night color scheme (customizable)
git clone https://github.com/jimmyliao/agent-status-tmux.git
cd agent-status-tmux
./scripts/install.shThe install script will:
- Create cache directory (
~/.cache/ai-usage/) - Patch
~/.claude/statusline.shto write session data (with backup) - Update
~/.tmux.confto display AI status (with backup) - Link the Gemini CLI extension (if Gemini CLI is installed)
- Reload tmux config
All modifications are idempotent and create timestamped backups.
Once installed, every new tmux session (tmux new -s xxx) automatically shows AI status — no extra setup needed. The config lives in ~/.tmux.conf which tmux loads on startup.
Note: You don't need to be inside tmux to run
install.sh. The cache-writing patches (Claude statusline, Gemini hooks) work independently. You just need tmux running to see the display.
The installer automatically runs gemini extensions link to register the extension. If you installed Gemini CLI after running install.sh, link manually:
gemini extensions link /path/to/agent-status-tmuxVerify with:
gemini extensions listThe extension provides AfterAgent and SessionStart hooks that write token data to ~/.cache/ai-usage/gemini.json after each turn.
Claude Code Gemini CLI
│ │
▼ ▼
statusline.sh AfterAgent hook
(patched, 3 lines) (or fallback reader)
│ │
▼ ▼
~/.cache/ai-usage/ ~/.cache/ai-usage/
claude.json gemini.json
│ │
└──────────┬───────────────────┘
▼
ai-tmux-status.sh
(called by tmux every 5s)
│
▼
tmux status-right
| Provider | Fields |
|---|---|
| Claude | context % ・ tokens ・ cost ・ duration ・ 5h rate ・ 7d rate |
| Gemini | context % ・ tokens ・ ~estimated cost ・ duration |
Active detection: process alive + cache exists, or cache mtime < 5 minutes after process exits.
agent-status-tmux/
├── gemini-extension.json # Gemini CLI extension manifest
├── hooks/
│ └── hooks.json # AfterAgent + SessionStart hooks
├── scripts/
│ ├── after-agent.sh # Gemini hook: extract tokens from transcript
│ ├── session-start.sh # Gemini hook: initialize session
│ ├── gemini-reader.sh # Fallback: read Gemini chat recordings
│ ├── ai-tmux-status.sh # tmux status-right script (core)
│ └── install.sh # One-command installer
├── LICENSE
├── PLAN.md
└── README.md
Restore from backups created during installation:
# Check for backups
ls ~/.claude/statusline.sh.bak.*
ls ~/.tmux.conf.bak.*
# Restore
cp ~/.claude/statusline.sh.bak.<timestamp> ~/.claude/statusline.sh
cp ~/.tmux.conf.bak.<timestamp> ~/.tmux.conf
tmux source-file ~/.tmux.confMIT
在 tmux 狀態列顯示 AI 編程助手的使用量(tokens、費用、時間),同時支援 Claude Code 和 Gemini CLI。
◆ claude │ 8% │ 80k │ $3.50 │ 22m │ 5h:12% 7d:32% ◇ gemini │ 1% │ 9k │ ~$0.01 │ 2m
一行安裝(不需要 git clone):
curl -fsSL tmux.jimmyliao.net/install | bash或手動:
git clone https://github.com/jimmyliao/agent-status-tmux.git
cd agent-status-tmux
./scripts/install.sh就這樣。每個 tmux session(tmux new -s xxx)都會自動顯示 AI 狀態。不管 status bar 在上方或下方都能用。
預設安裝到 ~/.agent-status-tmux。可用 AGENT_STATUS_TMUX_DIR=/your/path 自訂路徑。
- tmux >= 3.2(hex 色碼支援;已測試 3.4–3.6)
- jq
- Claude Code 和/或 Gemini CLI
- 即時顯示 token 用量、費用、Session 時長
- Claude Code:context %、tokens、實際費用、時長、頻率限制(5h/7d)
- Gemini CLI:context %、tokens、估算費用、時長
- 兩個 provider 可同時顯示
- 偵測 process 是否存活,非僅依賴快取時間
- Gemini CLI Extension 提供 AfterAgent/SessionStart hooks
- Fallback 機制:hooks 未安裝時直讀 Gemini chat recording 檔案
git clone https://github.com/jimmyliao/agent-status-tmux.git
cd agent-status-tmux
./scripts/install.sh安裝腳本會自動:
- 建立快取目錄
~/.cache/ai-usage/ - 修改
~/.claude/statusline.sh(寫入 session 資料,已備份) - 更新
~/.tmux.conf(顯示 AI 狀態,已備份) - 連結 Gemini CLI Extension(若已安裝 Gemini CLI)
- 重新載入 tmux 設定
安裝後,每個新的 tmux session(tmux new -s xxx)都會自動顯示 AI 狀態,不需額外設定。
備註: 不需要在 tmux 裡面執行
install.sh。快取寫入(Claude statusline、Gemini hooks)獨立運作,只有顯示需要 tmux。
安裝腳本會自動執行 gemini extensions link。若之後才安裝 Gemini CLI,手動連結:
gemini extensions link /path/to/agent-status-tmux
gemini extensions list # 驗證MIT