Add a Stylish and Info-Dense Status Line to Claude Code

by Josh Branchaud

I've seen screenshots of other people's Claude Code sessions which include a fancy looking status line. It made me jealous. I've always been one to customize my Vim setup, tmux, my shell prompt, and so forth. It was time to do the same for Claude Code. Here is what I came up with.

Claude Code terminal session start screen with a custom status line showing model, context usage, git diff and auto mode.

My initial search turned up the Claude Code docs ↗, a Reddit post ↗, and some npm packages that will set up your status line for you with a bunch of swappable components, all for the tradeoff of installing a pile of dependencies.

Taking some inspiration from that Reddit post, I asked Claude to set up a status line script and build a minimal version with:

  • Model name and "thinking" level
  • Context window token usage number and percentage
  • Current 5-hour window usage and reset time
  • Current 7-day window usage and reset time
  • Git diff short stats (e.g. +74 -18)
  • Current Git branch

The first pass was pretty good. I prompted for a couple tweaks though.

  1. First, I didn't like the vibe of the colors, so I asked Claude to make it look like the Tokyo Night theme ↗.

  2. Second, my branch names tend to be pretty long. This meant all those elements I listed above were not fitting on the single line. I prompted it to break things up into two lines with the git diff short stats and branch name on the second line.

I love how this turned out. The context window and overall usage stats along with the current git branch are points of info that I reference all the time as I work.

If you are interested in achieving something similar to what I have, check out the full source of my setup below.

My status line config in ~/.claude/settings.json:

"statusLine": {
  "type": "command",
  "command": "~/.claude/statusline.sh"
}

The script, ~/.claude/statusline.sh:

#!/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"

Tell us about your project

We build good software through good partnerships. Reach out and we can discuss your business, your goals, and how VisualMode can help.