I would like to share a cool trick for Claude Code that I learned recently.
It all started while watching a coding video by Matt Pocock. As he was working in his Claude Code shell, I noticed something extra pinned right below his prompt input box—a cool status line showing key information like the active model, token usage, and other real-time session stats.
Curious to know how he set it up, I jumped straight into Google and discovered a built-in command: /statusline. You can find more information on their dedicated (page)[https://code.claude.com/docs/en/statusline].
But let's not keep you waiting any longer. Here is what I managed to achieve:
And here is a ready-made prompt using the /statusline command:
/statusline Create an OS-agnostic status line. Put the script and `settings.json` config in the user's Claude config dir (wherever it lives on this OS). Pick whatever scripting language is reliably available on this machine (POSIX shell, or Python/Node
if shell tooling isn't guaranteed) — don't assume bash or jq.
The script reads the status JSON from stdin. Output two lines:
Line 1: `[model.id] 📁 cwd 🌿 branch* | Xk`
- Model ID from .model.id in square brackets
- 📁 then basename of .workspace.current_dir
- 🌿 then git branch; omit this segment entirely if not a git repo; append `*` if the tree is dirty; invoke git so it won't disturb locks/index
- ` | ` then token usage from .context_window.total_input_tokens, rounded DOWN to nearest 1000 with a `k` suffix (e.g. 34k)
- Color the token count on a gradient toward a 150k threshold: green <25%, yellow <50%, orange <75%, red >=75% (256-color ANSI 46/226/208/196)
- Base text bright white (ANSI 97) for contrast
Line 2: `🕐 duration 💰 $cost`
- 🕐 session duration from .cost.total_duration_ms, formatted `Hh Mm` / `Mm Ss` / `Ss`
- 💰 session cost from .cost.total_cost_usd, formatted `$0.00`
- Same bright-white base color
Print the two lines separated by a newline. Guard every field access with a sensible default. Make the script executable/invokable per this OS's conventions.

Top comments (0)