A custom status line for Claude Code that shows useful session info at a glance.
Requires a Nerd Font for some icons.
Opus5(high) ๐ 72%(56.0k/200k) ๐ฒ2.18(+0.12) ๓ฐชฐ 99%(+1.2k) ๐ฅ10:42โ11:42(~$0.85) โณ 5h/7d: 42%/18%
๐ current_dir ๎ main*โ2 ๐ +120/-35 ๐ง 1.2k/3.4k ๓ฐ 7 ๓ฐ 1m10s
| Icon | Metric | Description |
|---|---|---|
| Model | Model name, version and reasoning effort (e.g. Opus5(high), Opus4.6(high)) |
|
| ๐ | Context | Remaining %, used/total tokens. Red below 20% |
| ๐ฒ | Cost | Total session cost in USD, and how much it rose at the last change (+0.12). The previous total is kept per session in a small file in the OS temp directory, since the status line payload only carries the running total |
| ๓ฐชฐ | Cache | Prompt cache hit ratio of the last request, and tokens written to the cache by it (+12.7k) |
| ๐ฅ/โ๏ธ | Cache TTL | Time of the last API response โ when its prompt cache expires. ๐ฅ while still hot, โ๏ธ (red) once expired. (5m) is appended when the last request only wrote to the 5-minute cache. (~$0.85) is the estimated cost of the first request after expiry, which has to rewrite the whole cache |
| ๐ | Folder | Current working directory name (second line) |
| ๎ | Branch | Current git branch. * when there are uncommitted changes, โ2/โ1 for commits ahead of/behind upstream |
| ๐ | Lines | Lines added/removed in this session (+120/-35), shown once non-zero (second line) |
| ๐ง | Last turn | How hard the model worked on the last prompt: thinking/output tokens, ๓ฐ API steps (tool round-trips) and ๓ฐ wall time. Compare turns across effort levels. Thinking tokens are left out for models that don't report them (second line) |
| โณ | Plan limits | Usage of the 5-hour and weekly plan limits. Each value is red at 80% or more. Shown only when Claude Code reports them (subscription plans) |
-
Copy
statusline-command.shto~/.claude/:cp statusline-command.sh ~/.claude/statusline-command.sh chmod +x ~/.claude/statusline-command.sh
-
Add to
~/.claude/settings.json:{ "statusLine": { "type": "command", "command": "bash ~/.claude/statusline-command.sh" } } -
Restart Claude Code.
- Node.js (used to parse the JSON data from stdin)
- Nerd Font in your terminal for and ๓ฐชฐ icons
- Git (for branch detection)
The status line only re-renders when the conversation updates, so an elapsed-time counter would freeze while you are idle. Instead the label shows absolute clock times: the timestamp of the last assistant entry in the session transcript (transcript_path from the status line payload) and that time plus the cache TTL. The TTL is taken from the last response's usage.cache_creation: 1 hour normally, 5 minutes if the request only wrote to the 5-minute cache. Reading it at a glance tells you whether resuming now will hit the cache (cheap) or rewrite the whole context (expensive), and when to run /compact before stepping away.
Claude Code reports prompt_cache.recache_tokens_if_cold (how many tokens the next request would have to write to the cache if it has expired) and prompt_cache.ttl. The estimate is those tokens times the model's cache-write price: the input price ร2 for the 1-hour TTL, ร1.25 for the 5-minute TTL. Input prices are hard-coded per model family in the script (Fable $10, Opus 5.5 $4, Opus 4.5โ5 $5, Sonnet 5 $2, Sonnet 4.x $3, Haiku 4.5 $1 per million tokens); unknown models show no estimate. It is shown while the cache is still hot too, since the status line doesn't re-render while you are idle: read it as "what it costs to come back after the expiry time".
The transcript is read backwards to the start of the last turn: a prompt you typed, or a background-task notification that woke the model up (tool results, interrupts, slash commands and compact summaries don't count). Every API response since then adds its usage.output_tokens and usage.output_tokens_details.thinking_tokens; a response is written as several entries sharing one message.id, so each id is counted once, and the number of ids is the step count. Wall time is the turn_duration Claude Code writes when the turn ends, or prompt โ latest entry while it is still running. The thinking text itself isn't stored, so token counts are the only measure of depth.
MIT