Claude Code status line A developer published a bash script that renders a custom Claude Code status line, parsing the tool's JSON session data with a single jq pass to display the current folder, git branch, model and effort level, a context-window usage bar, remaining 5-hour and 7-day rate limits, and a reset countdown. The script extracts numeric fields first so newlines in text values cannot corrupt the bash arithmetic, applies green/yellow/red coloring at 70% and 90% usage, and only shows the 7-day limit once half of it is consumed. | | /usr/bin/env bash | | | Claude Code status line: folder \| branch \| model · effort \| context bar \| 5-hour limit left \| reset countdown \| 7-day limit left from 50% used | | | | | | One jq pass: the numbers on the first line "-" when absent , then text values one per line, the path last, | | | so a newline in any text value can't shift the numbers that reach bash arithmetic | | | { read -r pct rate used reset secs week used; IFS= read -r model; IFS= read -r effort; IFS= read -r full dir; } < < jq -r ' | | | def whole: if . then floor else "-" end; | | | .rate limits as $r \| | | | "\ .context window.used percentage // 0 \| floor \ $r.five hour.used percentage \| whole \ $r.five hour.resets at \| if . then floor - now \| floor else "-" end \ $r.seven day.used percentage \| whole ", | | | .model.display name // "" , | | | .effort \| if type == "object" then .level else . end // "" , | | | .workspace.current dir // .cwd // "" | | | ' 2 /dev/null | | | Defaults for when jq printed nothing input that isn't JSON | | | : "${pct:=0}" "${rate used:=-}" "${reset secs:=-}" "${week used:=-}" "${full dir:=$PWD}" | | | | | | RED=$'\033 31m'; YELLOW=$'\033 33m'; GREEN=$'\033 32m'; RESET=$'\033 0m' | | | Colour for a percentage used: red from 90, yellow from 70 | | | colour { | | | if $1 = 90 ; then printf '%s' "$RED" | | | elif $1 = 70 ; then printf '%s' "$YELLOW" | | | else printf '%s' "$GREEN"; fi | | | } | | | "