Always-On Cost and Plan-Quota Visibility for Claude Code: Building a Statusline A developer built a statusline script for Claude Code that displays plan quota, context usage, and session cost in real time without authentication or API calls. The script reads JSON from stdin via jq, showing 5-hour and 7-day rate limits, context percentage, and daily cost converted to yen, with color-coded thresholds for at-a-glance monitoring. In my last post, "Letting Claude Code improve itself autonomously — autopilot" https://zenn.dev/bokuwalily/articles/claude-autopilot , I covered how to keep autopilot from running away, but I glossed over the part about "surfacing your plan quota in the statusline" in a single paragraph. This time I'll walk through that implementation in full. No auth, no endpoint calls. All you do is read the JSON that Claude Code passes to the statusline script over stdin with jq , and you get your 5h/7d plan quota, context usage, and session cost plus today's running total converted to yen always visible in three lines. Claude Max's API has soft rate limits. As your output tokens approach the cap within a 5-hour block or a 7-day window, the model's behavior changes, and once you burn through it, subsequent slots get skipped. The problem is that you usually can't see this consumption . The "open a dashboard in a separate tab" approach dies within three days. If the numbers are always on your working screen, the remaining quota catches your eye without you having to think about it. Every time Claude Code launches the statusline script, it streams JSON to stdin. Almost everything you need is already there. ~/.claude/scripts/statusline.sh INPUT="$ cat 2 /dev/null || echo '{}' " j { printf '%s' "$INPUT" | jq -r "$1" 2 /dev/null; } CTX=$ j '.context window.used percentage // empty' H5=$ j '.rate limits.five hour.used percentage // empty' H5R=$ j '.rate limits.five hour.resets at // empty' D7=$ j '.rate limits.seven day.used percentage // empty' D7R=$ j '.rate limits.seven day.resets at // empty' SESSION USD=$ j '.cost.total cost usd // 0' .context window.used percentage is a value Claude Code precomputes and hands you, so you don't have to count tokens yourself. rate limits only appears after a subscription user has received their first API response, so without the // empty fallback you'll get an error right at the start of a session. rate limits only appears "after the first API response, and only on a subscription." Right after startup, fall back to a -- display; the numbers start showing once the first turn comes back. Reset times arrive as epoch seconds, so convert them to local time with date . clk { -n "$1" && date -r "$1" "+%H:%M" 2 /dev/null; } → HH:MM mdhm { -n "$1" && date -r "$1" "+%-m/%-d %H:%M" 2 /dev/null; } → M/D HH:MM The output is a fixed three-line structure. line1: 📁 dir ⌥ branch line2: 🤖 model·effort 🧠 ctx% 🕐 5h N% ⏪HH:MM 📅 7d N% ⏪M/D HH:MM line3: 💴 session ≈¥x 今日 ≈¥y