Custom two-line status line for the Claude Code CLI displaying session information and quota usage. Supports multiple concurrent Claude accounts on the same machine via CLAUDE_CONFIG_DIR.
Opus 4.6 · 📁 my-project 🌿 main±3 📝 +156−23 · ⏩ 4m32s · 📊 42% · 🧩 71↓ 17.6k↑ · 💲 1.37
⏰ Session ↺2h30m (20:45) ██████░░░░ 55% · 📅 Week ↺fri 14:00 ████░░░░░░ 35% · opus ██████░░░░ 60%
git clone <this-repo> ~/Workspaces/ai-tools
cd ~/Workspaces/ai-tools/claude-statusline
./install.shThe installer:
- Creates a wrapper at
~/.claude/statusline-wrapper.sh(orstatusline-wrapper-<account>.shwhenCLAUDE_CONFIG_DIRis set) that execs thestatusline.pyfrom this repo. - Writes/updates
statusLinein the activesettings.json(in$CLAUDE_CONFIG_DIRif set, otherwise in~/.claude/). - Preserves other keys in
settings.jsonand is idempotent — safe to re-run.
If you use several Claude accounts on the same machine (e.g. claude-personal-account, claude-work-account), run the installer once per account with CLAUDE_CONFIG_DIR pointed at each account's config folder:
CLAUDE_CONFIG_DIR=/path/to/claude-personal-account ./install.sh
CLAUDE_CONFIG_DIR=/path/to/claude-work-account ./install.shEach account gets its own wrapper (statusline-wrapper-<basename>.sh) and settings entry, but they all share the single statusline.py from this repo. Quota is isolated at runtime — see How multi-account isolation works.
- Ensure
python3is on your PATH. - Create a wrapper at
~/.claude/statusline-wrapper.sh:#!/bin/bash exec python3 "/absolute/path/to/statusline.py"
chmod +xit. - Add to the
settings.jsonof the account (inside$CLAUDE_CONFIG_DIRor~/.claude/):{ "statusLine": { "type": "command", "command": "~/.claude/statusline-wrapper.sh", "padding": 0 } } - Restart Claude Code.
Credentials are located automatically from CLAUDE_CONFIG_DIR/.credentials.json (falling back to ~/.claude/.credentials.json). No manual path configuration is required.
cd ~/Workspaces/ai-tools && git pullThen restart any open Claude Code sessions. All installed accounts point to the same statusline.py, so one pull upgrades everything.
Earlier versions of this project suggested copying statusline.py into each account folder (e.g. inside CLAUDE_CONFIG_DIR) and hardcoding CREDENTIALS_FILE per copy. If you still have that layout, consolidate once with these steps:
- Pull the latest
statusline.pyin this repo. - Delete the per-account copies of
statusline.py(keep yoursettings.jsonand.credentials.json):rm /path/to/claude-personal-account/statusline.py rm /path/to/claude-work-account/statusline.py # ...one per account - Repoint each wrapper in
~/.claude/to the repo file:REPO="$HOME/Workspaces/ai-tools/claude-statusline/statusline.py" for w in ~/.claude/statusline*-wrapper.sh ~/.claude/statusline-wrapper.sh; do [ -f "$w" ] || continue cat > "$w" <<EOF #!/bin/bash exec python3 "$REPO" EOF chmod +x "$w" done
- Clear stale cache from the old shared cache location (optional but recommended):
rm -f /tmp/claude-statusline-cache/*.json - Restart each Claude Code session.
From now on, upgrades are just git pull in step 1.
The script resolves the active account on every invocation:
- Credentials are read from
$CLAUDE_CONFIG_DIR/.credentials.json(or~/.claude/.credentials.json) — guaranteeing each session uses its own OAuth token. - Cache lives in
/tmp/claude-statusline-cache/<hash>/, where<hash>is derived from the config dir path. Concurrent sessions on different accounts cannot read each other's quota data. - Fallback: if the API is unreachable and no cache exists, the script uses the
rate_limitsblock that Claude Code already passes in on stdin — so the 5h / 7d bars stay correct even offline.
| Icon | Information | Example | Description |
|---|---|---|---|
| — | Model | Opus 4.6 or Opus 4.6 fast |
Active model name. Shows fast when fast mode is enabled |
| 📁 | Directory | 📁 my-project |
Current working directory |
| 🌿 | Git branch | 🌿 main±3 |
Current branch. ±N = number of modified files in the working tree |
| 📝 | Lines edited | 📝 +156−23 |
Lines added (+) and removed (−) during the session. Shown next to the branch |
| ⏩ | Execution time | ⏩ 4m32s |
Total API call time. Formats: 350ms, 45s, 4m32s, 1h02m30s |
| 📊 | Context window | 📊 42% |
Percentage of the context window in use |
| 🧩 | Tokens | 🧩 71↓ 17.6k↑ |
Session tokens: input (↓) and output (↑). Suffixes: k (thousands), M (millions) |
| 💲 | Cost | 💲 1.37 |
Total session cost in USD |
Percentage values use colors to indicate usage level:
- Green — below 50%
- Yellow — between 50% and 80%
- Red — above 80%
| Icon | Information | Example | Description |
|---|---|---|---|
| ⏰ | Session (5h) | ⏰ Session ↺2h30m (20:45) ██████░░░░ 55% |
5-hour window usage. Shows remaining time and local reset time in parentheses |
| 📅 | Week (7d) | 📅 Week ↺fri 14:00 ████░░░░░░ 35% |
7-day window usage. Shows weekday and time of reset |
| — | Per-model | opus ██████░░░░ 60% |
Per-model 7-day usage (opus, sonnet, haiku). Only shown when data is available |
| — | Extra usage | extra ██░░░░ 18% $3.60/$20.00 |
Pay-as-you-go credits, if enabled. Shows usage percentage and USD amounts |
Each item displays a progress bar using the same color coding (green/yellow/red).
Cached data is written to /tmp/claude-statusline-cache/<account-hash>/ to avoid excessive API calls:
| File | TTL | Content |
|---|---|---|
quota.json |
60s | Quota data from the Anthropic API |
debug_input.json |
— | Last JSON input received (for debugging) |
To clear cache for all accounts:
rm -rf /tmp/claude-statusline-cache- Python 3.10+
- Git (for branch information)
- Claude Code account with OAuth (for quota data)