Show HN: I put my Claude Code rate-limit burndown in the status line

fotoflo1 pts0 comments

What My Claude Code Status Line Tells Me — AimHuge<br>Claude Code · June 2026<br>What My Claude Code Status Line Tells Me<br>Claude Code lets you replace the status line with any command you like. Mine packs the four things I actually glance at into two rows — so I always know how much runway I have before something runs out.

Row 1 — where am I?<br>~/dev/aimhuge (main) [opus] — the working directory, the git branch, and the model I'm on. Then the session's name (here, the task in flight: "Invert menu order in projects page"). One glance answers "which repo, which branch, which model, doing what."<br>Row 2 — how much runway?<br>ctx:65% — how much of the context window is left. Every percentage on this line is a burndown: it starts at 100% and counts down, green while there's room and shading to red as it runs out. When ctx gets low — around 20% on Opus's 1M-token window — a compaction is coming, so it's my cue to wrap up a thread or hand off.<br>tok:351.5k — total tokens used this session.<br>+1681/−676 — lines added and removed this session. This is the one I love: it's how much work actually landed — real code churn, not just tokens spent. And the deletions aren't waste — lines removed is often the sign of a good refactor: cutting cruft, collapsing duplication, simplifying. A session that's net-negative can be the most valuable kind.<br>5hr:95% reset 10pm · 7d:95% — the part I care about most: how much of my 5-hour and weekly rate-limit budget is left, and when the window resets. Green means plenty; it shades to red as I burn it down. No more surprise "you've hit your limit" mid-task.<br>Row 3 — what can it do without asking?<br>▸▸ bypass permissions on (shift+tab to cycle) — the current permission mode. Handy to keep visible so "why didn't it ask me?" is never a mystery.<br>How it works<br>Claude Code pipes a JSON blob (cwd, model, session, token and cost data) to whatever command you point statusLine at. Mine is a POSIX shell script that reads that JSON with jq and prints two ANSI-colored rows. It colors each percentage by how much budget remains — green when there's room, red when there isn't — so the line reads at a glance without me having to parse numbers.<br>Install it<br>The easy way: let Claude Code do it<br>Paste this page's URL into Claude Code and say "install this status line for me":<br>https://aimhuge.com/blog/claude-code-status-lineClaude will read the steps below and set everything up. The rest of this section is written so it (or you) can follow along.

Requirements: jq and git on your PATH (the script degrades gracefully without git). Three steps:<br>1. Save the script below to ~/.claude/statusline-command.sh (or grab it directly: statusline-command.sh).<br>#!/bin/sh<br># Claude Code status line<br># Row 1: ~/dir (branch) [model] session-name<br># Row 2: ctx:N% tok:Nk +N/-N ║ 5hr:N% reset Xam · 7d:N% reset day Xpm

input=$(cat)

# --- Helpers ---<br>col() { printf '\033[%sm%s\033[0m' "$1" "$2"; }<br>grn() { col 32 "$1"; }<br>cyn() { col 36 "$1"; }<br>ylw() { col 33 "$1"; }<br>wht() { col 97 "$1"; }<br>mag() { col 35 "$1"; }<br>red() { col 31 "$1"; }<br>dim() { col 90 "$1"; }

jv() { echo "$input" | jq -r "$1"; }

# Join parts with double-space separator<br>row=""<br>add() { row="${row:+$row }$1"; }

# Format token count as human-readable<br>fmt_tok() {<br>if [ "$1" -ge 1000000 ]; then<br>awk "BEGIN{printf \"%.1fM\",$1/1000000}"<br>elif [ "$1" -ge 1000 ]; then<br>awk "BEGIN{printf \"%.1fk\",$1/1000}"<br>else<br>echo "$1"<br>fi

# Color a percentage by remaining budget: high=green, low=red<br>pct_color() {<br>_remaining=$(printf '%.0f' "$1")<br>if [ "$_remaining" -ge 60 ]; then<br>col 32 "$2" # green<br>elif [ "$_remaining" -ge 30 ]; then<br>col 33 "$2" # yellow<br>else<br>col 31 "$2" # red<br>fi

# Format rate limit: "LABEL:N% reset TIME" — shows REMAINING, colored<br>fmt_limit() {<br>_label="$1" _used="$2" _at="$3" _datefmt="$4"<br>[ -z "$_used" ] && return<br>_remaining=$(printf '%.0f' "$(awk "BEGIN{print 100-$_used}")")<br>_reset=""<br>[ -n "$_at" ] && _reset=$(date -r "$_at" "+$_datefmt" 2>/dev/null | tr '[:upper:]' '[:lower:]')<br>_colored_pct=$(pct_color "$_remaining" "${_remaining}%")<br>if [ -n "$_reset" ]; then<br>printf '%s:%b %s' "$_label" "$_colored_pct" "$(dim "reset $_reset")"<br>else<br>printf '%s:%b' "$_label" "$_colored_pct"<br>fi

# --- Extract ---<br>raw_dir=$(jv '.workspace.current_dir // .cwd // empty')<br>short_dir=$(echo "$raw_dir" | sed "s|^$HOME|~|")

branch=""<br>if [ -n "$raw_dir" ] && git -C "$raw_dir" rev-parse --git-dir >/dev/null 2>&1; then<br>branch=$(git -C "$raw_dir" --no-optional-locks symbolic-ref --short HEAD 2>/dev/null \<br>|| git -C "$raw_dir" --no-optional-locks rev-parse --short HEAD 2>/dev/null)<br>fi

model_id=$(jv '.model.id // empty')<br>case "$model_id" in<br>*opus*) model="opus" ;;<br>*sonnet*) model="sonnet" ;;<br>*haiku*) model="haiku" ;;<br>*) model=$(jv '.model.display_name // empty' | sed 's/Claude //' | tr '[:upper:]' '[:lower:]') ;;<br>esac

session=$(jv '.session_name // empty')<br>ctx=$(jv '.context_window.remaining_percentage // empty')<br>total_tok=$(( $(jv '.context_window.total_input_tokens // 0') + $(jv '.context_window.total_output_tokens // 0')...

claude code model line status session

Related Articles