A single-file bash statusline for Claude Code that shows your working directory, git branch, active model, context window usage, session cost, and — for Claude subscribers — your 5-hour and 7-day rate limit usage, all in one line.
my-project ⎇main Sonnet 5 high ctx 12% $0.42 session 23%→21:10 week 87%
(my-project ⎇main is a placeholder — it always reflects whatever directory and git branch you're currently working in.)
| Segment | Meaning |
|---|---|
my-project ⎇main |
current directory basename + git branch (if inside a repo) |
Sonnet 5 high |
active model + effort level (and fast when Fast Mode is on) |
ctx 12% |
context window used |
$0.42 |
total cost for the current session |
session 23%→21:10 |
5-hour rate limit usage, and the local time it resets |
week 87% |
7-day rate limit usage |
Percentages are colored green (<60%), yellow (60–84%), or red (≥85%) so you can tell at a glance when you're getting close to a limit. Any segment whose data isn't available (e.g. rate limits, which Claude Code only sends after the first API response and only for Claude subscribers) is silently omitted instead of showing as empty or broken.
bashjq— used to parse the JSON Claude Code feeds to the statusline commandgit(optional — only needed for the branch segment)
On Windows, Claude Code runs the status line through Git Bash if it's installed (falling back to PowerShell otherwise), so this script works there too as long as Git Bash and jq are available — see Windows below.
macOS / Linux / Windows (Git Bash) — install script (recommended)
git clone https://github.com/Mahmutakin99/claude-code-statusline.git
cd claude-code-statusline
./install.shThis copies statusline.sh to ~/.claude/statusline.sh and adds/updates the statusLine key in ~/.claude/settings.json (an existing settings.json is backed up first, timestamped). Restart Claude Code afterwards.
Manual install (any OS)
-
Download
statusline.shand place it at~/.claude/statusline.sh. -
Make it executable:
chmod +x ~/.claude/statusline.sh. -
Add this to
~/.claude/settings.json(create the file if it doesn't exist):{ "statusLine": { "type": "command", "command": "~/.claude/statusline.sh" } } -
Restart Claude Code, or open a new session.
Claude Code needs Git for Windows (which provides Git Bash) installed to run this script — without it, Claude Code falls back to invoking your command through PowerShell, which can't execute a Bash script directly.
- Install
jqfor Windows, e.g. with one of:Make sure the resultingwinget install jqlang.jq # or: choco install jq # or: scoop install jq
jq.exeis on thePATHthat Git Bash sees (a normal winget/choco/scoop install already takes care of this). - Open Git Bash and run either the install script or the manual steps above from inside it —
chmod,~, and the rest behave the same as on macOS/Linux there. - In
settings.json, keep the path in forward-slash form, e.g."command": "~/.claude/statusline.sh"or"command": "C:/Users/you/.claude/statusline.sh". A Windows-style path with backslashes (C:\Users\...) will silently fail — see the Windows configuration docs.
Everything lives in one small script — open statusline.sh and edit directly:
- Color thresholds: the
hue()function (green/yellow/red cutoffs, currently 60 and 85). - Segments: each block (directory, branch, model, context, cost, session, week) is a self-contained
if— comment one out or reorder them to taste. - Colors: the
R/DIM/BLU/GRN/YEL/RED/MAG/CYNvariables at the top are standard ANSI escape codes.
Remove the statusLine key from ~/.claude/settings.json (or restore your .bak.* backup), then delete ~/.claude/statusline.sh.
Claude Code invokes the configured statusLine.command on every prompt render, piping a JSON payload (model, cost, context usage, rate limits, workspace info, …) to its stdin, and prints whatever the command writes to stdout. This script just reads that JSON with jq and formats it. See the Claude Code statusline docs for the full payload schema.
MIT — see LICENSE.