Add a stylish and info-dense status line to Claude Code
A developer shared a dependency-free Bash script for Claude Code that displays model effort, context tokens, rate limits, and git stats in two lines.
By Dillip Chowdary • Dec 06, 2026 • Source: visualmode.dev

At a glance
- Product
- Claude Code custom status line
- Config file
- ~/.claude/settings.json
- Script path
- ~/.claude/statusline.sh
- Color theme
- Tokyo Night 24-bit RGB ANSI
- Default context
- 200000 tokens fallback
- Required tool
- jq
In this post
A developer has published a custom two-line Bash status bar for Claude Code that surfaces model effort, context window usage, rate-limit windows, and live git statistics without external npm packages, detailed in visualmode.dev's guide. Rather than installing a third-party package with a pile of dependencies, the author used Claude itself to generate a single shell script configured directly through Claude Code's settings file.
This walkthrough covers the complete ~/.claude/settings.json configuration, the full ~/.claude/statusline.sh script, and the token, rate-limit, and git parsing logic inside it. It is aimed at Claude Code users who already customize tools like Vim, tmux, or shell prompts and want a compact, readable status line that stays legible even on repositories with long branch names.
01Minimal Bash script without npm dependencies
After seeing screenshots of stylized Claude Code sessions, the author searched the Claude Code documentation, a Reddit post, and several npm packages that offer swappable status line components. Those npm options required pulling in extra dependencies, so the author instead prompted Claude to write a minimal standalone script inspired by the Reddit post.
The initial prompt asked for six specific readouts in the terminal bar: the active model name and thinking level, context window token usage as both a count and a percentage, 5-hour usage with its reset time, 7-day usage with its reset time, git diff short stats such as +74 -18, and the current git branch. Keeping everything in one Bash script meant no package manager overhead and full control over formatting.
02Two-line layout and Tokyo Night palette
While the first generated script worked, two visual issues stood out during everyday coding. The default color palette did not match the author's setup, and long git branch names caused the single-line bar to overflow horizontally when all six metrics were displayed together.
| Aspect | Initial pass | Final revision |
|---|---|---|
| Layout | Single status line | Two-line split layout |
| Color scheme | Default generated colors | Tokyo Night RGB palette |
| Git placement | Inline with session metrics | Dedicated second line (+a -d dir@branch) |
| Dependencies | None beyond shell tools | Bash and jq only |
To fix both problems, the author asked Claude to apply the Tokyo Night color palette using 24-bit ANSI escape sequences and move the git diff stats and branch name onto a second line. Line 1 now holds the model, effort level, context usage, 5-hour limit, 7-day limit, and version, while Line 2 displays the working directory name, branch, and diff counts.
03JSON payload parsing and token math
Advertisement
Tech Pulse Daily
Get tomorrow's pulse first
Join engineers who read Tech Pulse before stand-up. Free, weekday mornings.
The script begins by reading Claude Code's JSON status payload from standard input using jq -r and evaluating @sh assignments into shell variables. It extracts model.display_name, effort.level, cwd, context_window.context_window_size, context_window.current_usage, rate_limits.five_hour, rate_limits.seven_day, and version.
Used context tokens are calculated by summing input_tokens, cache_creation_input_tokens, and cache_read_input_tokens, then dividing by context_window_size to compute the usage percentage. A helper function formats totals of 1000000 or more in m units and totals of 1000 or more in k units, while stripping the word context so "Opus (1M context)" renders cleanly as "Opus (1M)".
04Configuration in Claude Code settings
Enabling the status bar requires adding a statusLine object to ~/.claude/settings.json that points Claude Code to the executable shell script. Save the JSON snippet below inside ~/.claude/settings.json:
"statusLine": {
"type": "command",
"command": "~/.claude/statusline.sh"
}Next, create ~/.claude/statusline.sh with the full script below and make sure it has execute permissions in your shell environment:
#!/bin/bash
# Line 1: Model (effort) | used/total (pct) | 5h pct @reset | 7d pct @reset | vX
# Line 2: +a -d dir@branch
eval "$(jq -r '
@sh "model=\(.model.display_name // "Claude")",
@sh "effort=\(.effort.level // env.CLAUDE_CODE_EFFORT_LEVEL // "medium")",
@sh "cwd=\(.cwd // "")",
@sh "size=\(.context_window.context_window_size // 200000)",
@sh "used=\(.context_window.current_usage // {} | [.input_tokens, .cache_creation_input_tokens, .cache_read_input_tokens] | add // 0)",
@sh "h5=\(.rate_limits.five_hour.used_percentage // "" | if . == "" then . else round end)",
@sh "h5r=\(.rate_limits.five_hour.resets_at // "")",
@sh "d7=\(.rate_limits.seven_day.used_percentage // "" | if . == "" then . else round end)",
@sh "d7r=\(.rate_limits.seven_day.resets_at // "")",
@sh "ver=\(.version // "")"
')"
c() { printf '\033[38;2;%sm' "$1"; }
# Tokyo Night palette
blue=$(c '122;162;247') orange=$(c '255;158;100') green=$(c '158;206;106') cyan=$(c '125;207;255')
red=$(c '247;118;142') yellow=$(c '224;175;104') purple=$(c '187;154;247') white=$(c '192;202;245')
teal=$(c '115;218;202') dim=$(c '86;95;137') reset=$'\033[0m'
sep=" ${dim}|${reset} "
pct_color() {
if (($1 >= 90)); then echo "$red"; elif (($1 >= 70)); then echo "$orange"
elif (($1 >= 50)); then echo "$yellow"; else echo "$green"; fi
}
tokens() {
if (($1 >= 1000000)); then awk "BEGIN{printf \"%gm\", int($1/100000)/10}"
elif (($1 >= 1000)); then echo "$(($1 / 1000))k"
else echo "$1"; fi
}
fmt_epoch() { date -r "$1" "+$2" 2>/dev/null || date -d "@$1" "+$2"; }
# Model + effort
model=${model/ context)/)}
# "Opus (1M context)" -> "Opus (1M)"
case $effort in
low) ec=$dim ;; medium) ec=$orange effort=med ;; xhigh) ec=$purple ;; max) ec=$red ;; *) ec=$green ;;
esac
out="${blue}${model}${reset} ${dim}(${reset}${ec}${effort}${reset}${dim})${reset}"
# Line 2: diff stat, dir, branch
line2=""
if [[ -n $cwd ]]; then
line2="${cyan}${cwd##*/}${reset}"
if branch=$(git -C "$cwd" branch --show-current 2>/dev/null) && [[ -n $branch ]]; then
line2+="${dim}@${reset}${purple}${branch}${reset}"
read -r a d < <(git -C "$cwd" diff --numstat 2>/dev/null | awk '{a+=$1; d+=$2} END{print a+0, d+0}')
((a + d)) && line2="${green}+${a}${reset} ${red}-${d}${reset} ${line2}"
fi
fi
# Context window
((size > 0)) || size=200000
ctx=$((used * 100 / size))
out+="${sep}${teal}$(tokens "$used")/$(tokens "$size")${reset} ${dim}(${reset}$(pct_color "$ctx")${ctx}%${reset}${dim})${reset}"
# Rate limits
limit() { # label pct reset_epoch date_fmt
if [[ -z $2 ]]; then out+="${sep}${white}$1${reset} ${dim}-${reset}"; return; fi
out+="${sep}${white}$1${reset} $(pct_color "$2")$2%${reset}"
[[ -n $3 ]] && out+=" ${dim}@$(fmt_epoch "$3" "$4")${reset}"
}
limit 5h "$h5" "$h5r" '%H:%M'
limit 7d "$d7" "$d7r" '%a %b %-d, %H:%M'
[[ -n $ver ]] && out+="${sep}${dim}v${ver}${reset}"
printf '%s' "$out"
[[ -n $line2 ]] && printf '\n%s' "$line2"Note: The script requires jq to parse the JSON payload, falls back to a 200000 token context size and medium effort level (med) if omitted, and tries BSD date -r before GNU date -d for reset timestamps.
05Rate limits and git branch tracking
Both the context window percentage and the 5-hour and 7-day rate limits share a threshold function that shifts color as consumption climbs: green below 50%, yellow at 50% or higher, orange at 70% or higher, and red at 90% or higher. Reset epochs render as %H:%M for the 5-hour window and %a %b %-d, %H:%M for the 7-day window, with the Claude Code version appended when present.
On the second line, git -C "$cwd" branch --show-current and git -C "$cwd" diff --numstat append the active branch and total added or deleted line counts beside the directory name. Because line2 is only printed when cwd is non-empty, the script stays clean outside project directories while keeping context, quota, and git state visible at a glance.
Frequently asked questions
How is the custom status line enabled in Claude Code?
Add a statusLine object with "type": "command" and "command": "~/.claude/statusline.sh" inside ~/.claude/settings.json. Claude Code then executes the script and renders its two-line output.
Why does the script use two lines instead of one?
Long git branch names prevented all six metrics from fitting cleanly on a single line. Moving the diff stats and dir@branch label to Line 2 keeps Line 1 readable for model, context, and rate-limit data.
How does the script calculate context window usage?
It parses input_tokens, cache_creation_input_tokens, and cache_read_input_tokens from context_window.current_usage via jq and sums them. That total is divided by context_window_size, which defaults to 200000 if missing or zero.
What do the status line colors represent?
The script uses the Tokyo Night RGB palette, with effort levels mapped to dim (low), orange (med), purple (xhigh), and red (max). Usage percentages turn yellow at 50%, orange at 70%, and red at 90%.
Sources
Author
Dillip Chowdary
Writes Tech Bytes coverage of AI, engineering, and the tools that actually ship. Editor of Tech Pulse Daily.
Related on Tech Bytes
Advertisement