Coral

Claude Code status line builder

Pick what Claude Code shows under your prompt. See it live, then install it with one command.

Runs in your browser. Nothing is sent anywhere.

1 · Pick what to show

2 · Style

Between items
Context used
Colors
Lines

Preview

Colors follow your terminal’s theme. Limits only show on Pro, Max and Ultra plans.

3 · Install it

mkdir -p ~/.claude && [ -f ~/.claude/statusline.sh ] && cp ~/.claude/statusline.sh ~/.claude/statusline.sh.bak
cat > ~/.claude/statusline.sh <<'CORAL_STATUSLINE'
#!/bin/bash
# Claude Code status line. Made with https://usecoral.app/tools/statusline
# Claude Code sends session JSON on stdin; this prints what to show. Needs jq.
export LC_ALL=C
command -v jq >/dev/null || { echo "Status line needs jq: brew install jq"; exit 0; }
input=$(cat)

# one jq call reads every field; \x1f separates them so empty fields stay in place
IFS=$'\x1f' read -r MODEL DIR SID PCT COST F5P F5R <<< "$(printf '%s' "$input" | jq -r 'def num: if type == "number" then tostring else "" end; def clean: explode | map(select(. >= 32 and . != 127)) | implode; [(.model.display_name // "" | clean), (.workspace.current_dir // .cwd // ""), (.session_id // ""), (.context_window.used_percentage | num), (.cost.total_cost_usd | num), (.rate_limits.five_hour.used_percentage | num), (.rate_limits.five_hour.resets_at | num)] | join("\u001f")')"

c_bold=$'\033[1m' c_dim=$'\033[2m' c_red=$'\033[31m' c_green=$'\033[32m' c_yellow=$'\033[33m' c_blue=$'\033[34m' c_magenta=$'\033[35m' c_cyan=$'\033[36m' c_off=$'\033[0m'
SEP="${c_dim} · ${c_off}"

# minutes to 5m, 2h 10m or 3d 4h
span() { local m=$1; [ "$m" -lt 0 ] && m=0
  if [ "$m" -ge 1440 ]; then printf '%dd %dh' $((m / 1440)) $((m % 1440 / 60))
  elif [ "$m" -ge 60 ]; then printf '%dh %dm' $((m / 60)) $((m % 60))
  else printf '%dm' "$m"; fi; }

# print one line from the items in $L
emit() { local out="" p; for p in "${L[@]}"; do out="${out:+$out$SEP}$p"; done; [ -n "$out" ] && printf '%s\n' "$out"; }

L=()
[ -n "$MODEL" ] && L+=("${c_bold}$MODEL${c_off}")
d=${DIR##*/}; d=${d//[[:cntrl:]]/}; [ -n "$d" ] && L+=("${c_blue}$d${c_off}")
# git runs at most every 5 seconds per session; big repos stay fast
BRANCH=""
if [ -n "$DIR" ]; then
  cache="${XDG_RUNTIME_DIR:-${TMPDIR:-/tmp}}/claude-statusline-git-${SID//[^A-Za-z0-9_-]/}"
  # stat -c (Linux) must come first: on Linux, stat -f prints to stdout before failing
  age=$(( $(date +%s) - $(stat -c %Y "$cache" 2>/dev/null || stat -f %m "$cache" 2>/dev/null || echo 0) ))
  if [ -z "$SID" ] || [ "$age" -gt 5 ]; then
    BRANCH=$(git -C "$DIR" branch --show-current 2>/dev/null)
    [ -z "$BRANCH" ] && BRANCH=$(git -C "$DIR" rev-parse --short HEAD 2>/dev/null)
    [ -n "$BRANCH" ] && [ -n "$(git --no-optional-locks -c core.fsmonitor=false -C "$DIR" status --porcelain 2>/dev/null | head -n 1)" ] && BRANCH="$BRANCH*"
    [ -n "$SID" ] && printf '%s' "$BRANCH" > "$cache"
  else
    BRANCH=$(cat "$cache" 2>/dev/null); BRANCH=${BRANCH//[[:cntrl:]]/}
  fi
fi
[ -n "$BRANCH" ] && L+=("${c_magenta}$BRANCH${c_off}")
if [ -n "$PCT" ]; then
  pct=$(printf '%.0f' "$PCT")
  c=$c_green; [ "$pct" -ge 50 ] && c=$c_yellow; [ "$pct" -ge 80 ] && c=$c_red
  filled=$((pct / 10)); [ "$filled" -gt 10 ] && filled=10
  meter=""; i=0
  while [ $i -lt 10 ]; do if [ $i -lt "$filled" ]; then meter="$meter▓"; else meter="$meter░"; fi; i=$((i + 1)); done
  L+=("$c$meter $pct%${c_off}")
fi
[ -n "$COST" ] && L+=("$(printf '$%.2f' "$COST")")
if [ -n "$F5P" ]; then
  pct=$(printf '%.0f' "$F5P")
  c=$c_green; [ "$pct" -ge 50 ] && c=$c_yellow; [ "$pct" -ge 80 ] && c=$c_red
  item="${c_dim}5h${c_off} $c$pct%${c_off}"
  [ -n "$F5R" ] && item="$item${c_dim}, resets in $(span $(( (${F5R%.*} - $(date +%s)) / 60 )))${c_off}"
  L+=("$item")
fi
emit
exit 0
CORAL_STATUSLINE
chmod +x ~/.claude/statusline.sh
f=~/.claude/settings.json; [ -s "$f" ] || echo '{}' > "$f"; cp "$f" "$f.bak" && jq --argjson s '{"type":"command","command":"~/.claude/statusline.sh","refreshInterval":60}' '.statusLine = $s' "$f.bak" > "$f" || cp "$f.bak" "$f"

Paste it in a terminal. It saves ~/.claude/statusline.sh and adds statusLine to ~/.claude/settings.json, keeping a .bak of both. Your next message shows it.

Needs jq. macOS 15 and later have it; otherwise brew install jq or apt install jq.

Questions

How do I add a status line to Claude Code?

Pick what to show above, copy the one command and paste it in a terminal. It saves the script as ~/.claude/statusline.sh and points statusLine in ~/.claude/settings.json at it. You can also run /statusline inside Claude Code and describe what you want.

Does the status line use tokens?

No. It runs on your Mac or Linux machine. Claude Code sends the script the session’s data as JSON and shows what it prints. No API call is made.

Why don’t I see my 5-hour or weekly limit?

Claude Code only sends limits on the Pro, Max and Ultra plans, and only after the session’s first reply. With an API key there are no plan limits to show, so that part stays empty.

How do I turn it off?

Delete the statusLine block from ~/.claude/settings.json. The install command keeps your old file as settings.json.bak, so you can also copy that back.