Skip to content

About

A single-file bash statusline for Claude Code: dir, git branch, model, context %, cost, and rate-limit usage.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

claude-code-statusline

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.

Requirements

  • bash
  • jq — used to parse the JSON Claude Code feeds to the statusline command
  • git (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.

Install

macOS / Linux / Windows (Git Bash) — install script (recommended)

git clone https://github.com/Mahmutakin99/claude-code-statusline.git
cd claude-code-statusline
./install.sh

This 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)

  1. Download statusline.sh and place it at ~/.claude/statusline.sh.

  2. Make it executable: chmod +x ~/.claude/statusline.sh.

  3. Add this to ~/.claude/settings.json (create the file if it doesn't exist):

    {
      "statusLine": {
        "type": "command",
        "command": "~/.claude/statusline.sh"
      }
    }
  4. Restart Claude Code, or open a new session.

Windows

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.

  1. Install jq for Windows, e.g. with one of:
    winget install jqlang.jq
    # or: choco install jq
    # or: scoop install jq
    Make sure the resulting jq.exe is on the PATH that Git Bash sees (a normal winget/choco/scoop install already takes care of this).
  2. 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.
  3. 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.

Customizing

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/CYN variables at the top are standard ANSI escape codes.

Uninstall

Remove the statusLine key from ~/.claude/settings.json (or restore your .bak.* backup), then delete ~/.claude/statusline.sh.

How it works

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.

License

MIT — see LICENSE.

About

A single-file bash statusline for Claude Code: dir, git branch, model, context %, cost, and rate-limit usage.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages