A custom status line script for Claude Code that displays real-time session information in your terminal.
Line 1
- Current model name (e.g.,
[Sonnet 4.6]) - Clickable repository link (supports OSC 8 hyperlinks in iTerm2 / WezTerm / Kitty)
- Current git branch
- Git status: staged file count (green
+N) and modified file count (yellow~N)
Line 2
- Context window usage bar (color changes green → yellow → red as usage increases)
- Context usage percentage
- Total session cost (USD)
- Session duration
- Claude Code v2.0+
bashgitjq— JSON processor used to parse Claude Code's status input
Copy statusline-command.sh to your Claude config directory:
# The script must be placed at:
~/.claude/statusline-command.shchmod +x ~/.claude/statusline-command.shAdd the following to ~/.claude/settings.json:
{
"statusLine": {
"type": "command",
"command": "~/.claude/statusline-command.sh"
}
}Claude Code calls this script on each status line update, passing a JSON payload via stdin. The script extracts:
| Field | JSON Path |
|---|---|
| Model name | .model.display_name |
| Working directory | .workspace.current_dir |
| Session cost | .cost.total_cost_usd |
| Context usage | .context_window.used_percentage |
| Duration | .cost.total_duration_ms |
The context bar uses 10 block characters (█ filled, ░ empty) and changes color based on usage:
| Usage | Color |
|---|---|
| < 70% | Green |
| 70–89% | Yellow |
| ≥ 90% | Red |
The clickable repository link uses OSC 8 hyperlink escape sequences and is supported in:
- iTerm2
- WezTerm
- Kitty
- Windows Terminal (partial)
In unsupported terminals, the repository name will still appear as plain text.
winget install jqlang.jqscoop install jqbrew install jqsudo apt install jq- Download
jq-windows-amd64.exefrom the jq releases page - Rename it to
jq.exe - Move it to a directory in your
PATH(e.g.,C:\Windows\System32\)
Verify installation:
jq --version
