Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Claude Code Status Line

A compact, color-coded status line for Claude Code that shows model, context usage, rate limits, and session duration at a glance.

◆ Claude Opus 4.6  ====------  40%  |  5h: 23% (↺ 23:00)  |  7d: 5% (↺ Thu 16:00)  |  ⎇ main  |  12m

What it shows

Section Description
◆ Model Current model name (cyan)
====------ 40% Context window usage bar (green < 40%, yellow < 70%, red ≥ 70%)
5h: 23% 5-hour rate limit usage + reset time
7d: 5% 7-day rate limit usage + reset time
⎇ main Current git branch of the working directory (magenta), when it's a git repo
12m Session duration (dimmed)

Sections only appear when the data is available. Rate limits are hidden when not present in the JSON payload. The git branch is resolved directly with git (using --no-optional-locks so it never contends with a concurrent git command) — it's not part of the JSON payload.

Requirements

  • jq (JSON processor) — install via brew install jq, apt install jq, etc.
  • bash 3.2+
  • Works on macOS and Linux (date commands handle both)

Installation (for Claude Code agents)

Copy the script and update settings.json:

cp statusline-command.sh ~/.claude/statusline-command.sh
chmod +x ~/.claude/statusline-command.sh

Then add to ~/.claude/settings.json:

{
  "statusLine": {
    "type": "command",
    "command": "bash ~/.claude/statusline-command.sh"
  }
}

If settings.json already exists, merge the statusLine key into it — do not overwrite other settings.

One-liner install

curl -fsSL https://raw.githubusercontent.com/jorgesm/claude-code-statusline/main/statusline-command.sh -o ~/.claude/statusline-command.sh && chmod +x ~/.claude/statusline-command.sh

Then add the statusLine entry to ~/.claude/settings.json as shown above.

How it works

Claude Code pipes a JSON object to the status line command via stdin. The script extracts fields with jq and renders ANSI-colored output. The JSON schema includes:

{
  "model": { "display_name": "Claude Opus 4.6" },
  "context_window": { "used_percentage": 42.5 },
  "rate_limits": {
    "five_hour": { "used_percentage": 23, "resets_at": "2026-04-01T23:00:00Z" },
    "seven_day": { "used_percentage": 5, "resets_at": "2026-04-03T16:00:00Z" }
  },
  "cost": { "total_duration_ms": 720000 }
}

Color thresholds

Usage Color
< 40% Green
40–69% Yellow
≥ 70% Red

License

MIT

About

Compact, color-coded status line for Claude Code showing model, context usage, rate limits, and session duration

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages