A powerline-style two-line status bar for Claude Code that shows model, git branch, directory, effort level, cost, session duration, context usage, token counts, and rate limits — all at a glance.
Line 1: <model> ❯ <branch> ❯ <directory> 5h:<rate-limit>%
Line 2: <effort> ❯ $<cost> ❯ <duration> <context-bar> <context-%> t:<input>/<output>
| Segment | Source field | Example |
|---|---|---|
| Model | model.display_name |
Opus |
| Branch | git branch --show-current |
feat/statusline |
| Directory | workspace.current_dir (basename) |
claude-sandbox |
| 5h rate limit | rate_limits.five_hour.used_percentage |
5h:23% |
| Effort | effort.level |
high |
| Cost | cost.total_cost_usd |
$1.42 |
| Duration | cost.total_duration_ms |
12m05s |
| Context bar | context_window.used_percentage |
▰▰▰▰▱▱▱▱▱▱ 42% |
| Tokens | context_window.total_input_tokens / total_output_tokens |
t:156k/12k |
- jq — JSON parser (
brew install jq) - A Nerd Font — the powerline separators (
) and icons (branch,folder) require patched font glyphs
- Save
statusline.shto~/.claude/statusline.sh chmod +x ~/.claude/statusline.sh- Add to
~/.claude/settings.json:{ "statusLine": { "type": "command", "command": "~/.claude/statusline.sh" } }
The script uses 256-color ANSI codes. Key values:
| Variable | Color code | Used for |
|---|---|---|
A_BG |
234 |
Dark background (model, effort segments) |
B_BG |
236 |
Mid background (branch, cost segments) |
C_BG |
234 |
Dark background (dir, duration segments) |
GREEN_FG |
148 |
Filled context bar blocks, percentage |
DIM_FG |
240 |
Empty context bar blocks |
Preview 256-color codes:
for i in {0..255}; do printf "\033[48;5;%sm %3s \033[0m" $i $i; ((i%16==15)) && echo; doneEach segment follows the pattern:
printf "$(fg COLOR)$(bg BG) CONTENT ${R}"
printf "$(fg BG)$(bg NEXT_BG)${SEP}${R}"The SEP variable ( ) creates the powerline arrow. Set its foreground to the current segment's background and its background to the next segment's background.
fmt_tokens converts raw counts: 500 → 500, 15600 → 15k, 1200000 → 1.2M.
Full list of JSON fields Claude Code sends via stdin
| Field | Description |
|---|---|
model.id, model.display_name |
Model identifier and name |
workspace.current_dir |
Current working directory |
workspace.project_dir |
Directory where Claude Code was launched |
workspace.added_dirs |
Additional dirs added via /add-dir |
workspace.git_worktree |
Git worktree name (if in a linked worktree) |
workspace.repo.host, .owner, .name |
Repository identity from origin remote |
cost.total_cost_usd |
Estimated session cost in USD |
cost.total_duration_ms |
Wall-clock time since session start |
cost.total_api_duration_ms |
Time spent waiting for API responses |
cost.total_lines_added, .total_lines_removed |
Lines of code changed |
context_window.total_input_tokens |
Input tokens in current context window |
context_window.total_output_tokens |
Output tokens from most recent response |
context_window.context_window_size |
Max context size (200k or 1M) |
context_window.used_percentage |
Pre-calculated context usage % |
context_window.current_usage.* |
Per-component breakdown (input, cache write, cache read) |
effort.level |
Reasoning effort: low / medium / high / xhigh / max |
thinking.enabled |
Whether extended thinking is on |
rate_limits.five_hour.used_percentage |
5-hour rate limit usage % |
rate_limits.seven_day.used_percentage |
7-day rate limit usage % |
exceeds_200k_tokens |
Whether total tokens exceed 200k |
session_id, session_name |
Session ID and custom name |
version |
Claude Code version |
vim.mode |
NORMAL / INSERT / VISUAL / VISUAL LINE |
agent.name |
Agent name (when using --agent) |
pr.number, pr.url, pr.review_state |
Open PR info for current branch |
worktree.name, .path, .branch |
Worktree session info |
- The statusline runs locally and does not consume API tokens.
- Updates after each assistant message, after
/compact, and on permission mode changes (debounced at 300ms). - Add
"refreshInterval": 5to the settings block to also refresh on a timer (useful while subagents run). COLUMNSandLINESenv vars are available inside the script for terminal-width-aware layouts.- Use
/statuslinecommand with a natural-language description to generate or regenerate interactively.