A Claude Code status line that shows context and limits

Claude Code can show a line at the bottom of the terminal that updates as you work. Here is a small script that makes it show the model, how many tokens are in context, and how much of your 5-hour and weekly limits you have used.

The quick way

Type /statusline in Claude Code and describe what you want in plain words, for example "show the model, context percentage and my 5-hour limit". It writes the script and updates your settings for you.

The script

If you would rather set it up by hand, save this as ~/.claude/statusline.sh. It needs jq, which most developer Macs already have.

#!/bin/bash
# Claude Code status line: model, tokens in context, and plan limits when available.
input=$(cat)
MODEL=$(echo "$input" | jq -r '.model.display_name // "Claude"')
PCT=$(echo "$input" | jq -r '.context_window.used_percentage // 0' | cut -d. -f1)
SIZE=$(echo "$input" | jq -r '.context_window.context_window_size // 200000')
USED=$(( SIZE * PCT / 100 / 1000 ))
FIVE=$(echo "$input" | jq -r '.rate_limits.five_hour.used_percentage // empty' | cut -d. -f1)
WEEK=$(echo "$input" | jq -r '.rate_limits.seven_day.used_percentage // empty' | cut -d. -f1)
OUT="[$MODEL] ${USED}K in context (${PCT}%)"
[ -n "$FIVE" ] && OUT="$OUT | 5h ${FIVE}%"
[ -n "$WEEK" ] && OUT="$OUT | week ${WEEK}%"
echo "$OUT"

Make it runnable, then point Claude Code at it in ~/.claude/settings.json:

chmod +x ~/.claude/statusline.sh
{
  "statusLine": {
    "type": "command",
    "command": "~/.claude/statusline.sh"
  }
}

It prints a line like this:

[Opus] 128K in context (64%) | 5h 23% | week 41%

What the numbers mean

What a status line cannot tell you

It only describes the session you are looking at. It will not tell you that a session in another terminal is three times the size, or that a subagent fan-out used most of the morning. It also says nothing if you are not at the terminal.

That is the gap Cost Doctor fills: every session on the machine, ranked, in your menu bar, with a note on which one to compact. And if a check fails while an agent is waiting, it turns the screen red.

See it on your own sessions

Cost Doctor is a Mac menu bar app that reads the logs Claude Code and Codex already write. It names the session that is using your tokens, says why, and turns your screen red when a check fails while an agent sits waiting. Nothing leaves your Mac.

Download the free trialHow it works

14 days free, no account. Then $19 once, plus tax where it applies. For Apple silicon and Intel Macs on macOS 13 or later.