Skip to content

Instantly share code, notes, and snippets.

@lukehedger
Last active April 30, 2026 19:43
Show Gist options
  • Select an option

  • Save lukehedger/506b5f95f417dc9920063b548e28e449 to your computer and use it in GitHub Desktop.

Select an option

Save lukehedger/506b5f95f417dc9920063b548e28e449 to your computer and use it in GitHub Desktop.
Claude Code custom status line

Claude Code Custom Status Line

A custom status line that shows session info: model, reasoning effort, context usage, and cost.

Opus 4.7 (1M context) | max | 4% | $0.02
  • Model (blue) - shortened model name
  • Effort (neon rainbow) - reasoning effort level, cyan → green → yellow → orange → pink as effort increases. Hidden on models that don't support it
  • Context (yellow) - percentage of context window used
  • Cost (green) - session cost in USD

Image

Prerequisites

  • jq installed (brew install jq on macOS)
  • A terminal that supports 24-bit truecolor (most modern terminals do: iTerm2, Alacritty, Kitty, WezTerm, Ghostty, recent macOS Terminal)

Setup

1. Create the script

Create ~/.claude/statusline-command.sh:

#!/bin/bash
input=$(cat)

model=$(echo "$input" | jq -r '.model.display_name | sub("^anthropic\\.claude-";"") | sub("-v[0-9]+$";"")')
effort=$(echo "$input" | jq -r '.effort.level // empty')
ctx=$(echo "$input" | jq -r '.context_window.used_percentage // 0')
cost=$(echo "$input" | jq -r '.cost.total_cost_usd')

cost_fmt=$(printf "%.2f" "$cost")

case "$effort" in
  low)    effort_color=$'\033[38;2;0;255;255m' ;;    # neon cyan
  medium) effort_color=$'\033[38;2;57;255;20m' ;;    # neon green
  high)   effort_color=$'\033[38;2;255;255;51m' ;;   # neon yellow
  xhigh)  effort_color=$'\033[38;2;255;102;0m' ;;    # neon orange
  max)    effort_color=$'\033[38;2;255;16;240m' ;;   # neon pink
  *)      effort_color=$'\033[35m' ;;                # fallback magenta
esac

printf "\033[34m%s\033[0m" "$model"
if [ -n "$effort" ]; then
  printf " \033[2m|\033[0m %s%s\033[0m" "$effort_color" "$effort"
fi
printf " \033[2m|\033[0m \033[33m%s%%\033[0m \033[2m|\033[0m \033[32m\$%s\033[0m" "$ctx" "$cost_fmt"

Make it executable:

chmod +x ~/.claude/statusline-command.sh

2. Configure Claude Code

Add the statusLine entry to ~/.claude/settings.json:

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

That's it. The status line appears at the bottom of the Claude Code terminal.

How it works

Claude Code pipes a JSON object to the status line command's stdin on each refresh. The script extracts four fields:

Field JSON path Description
Model .model.display_name Active model, trimmed to short name (e.g. opus-4-7)
Effort .effort.level Reasoning effort (low, medium, high, xhigh, max). Absent on unsupported models
Context .context_window.used_percentage Percentage of context window consumed
Cost .cost.total_cost_usd Cumulative session cost in USD

The effort segment is rendered conditionally, so models that don't expose .effort produce a status line without that pipe.

Effort colors

Each level gets its own neon truecolor shade, progressing cool to hot so the status line visually signals how hard the model is thinking:

Level Color Hex
low Neon cyan #00FFFF
medium Neon green #39FF14
high Neon yellow #FFFF33
xhigh Neon orange #FF6600
max Neon pink #FF10F0

Customisation

Colors

The ANSI escape codes in the printf control colors. The model, context, and cost segments use the 16-color palette:

Code Color
\033[31m Red
\033[32m Green
\033[33m Yellow
\033[34m Blue
\033[35m Magenta
\033[36m Cyan
\033[1m Bold
\033[2m Dim

The effort segment uses 24-bit truecolor: \033[38;2;R;G;Bm. Swap in any RGB triple to re-theme a level.

Available fields

The full JSON input includes:

{
  "session_id": "...",
  "cwd": "/path/to/project",
  "model": { "id": "...", "display_name": "..." },
  "effort": { "level": "high" },
  "version": "2.1.39",
  "cost": {
    "total_cost_usd": 3.10,
    "total_duration_ms": 80201764,
    "total_api_duration_ms": 545739,
    "total_lines_added": 106,
    "total_lines_removed": 38
  },
  "context_window": {
    "used_percentage": 19,
    "remaining_percentage": 81,
    "context_window_size": 200000
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment