Claude Code Statusline Builder
Build a custom statusline, preview it live, and export the script.
Templates
Segments
Model Name
Active Claude model (e.g. Opus)
Directory
Current working directory
Context %
Context window usage percentage
Progress Bar
Visual context usage bar
Cost
Total session cost in USD
Duration
Session duration
Lines Added
Total lines added (+)
Lines Removed
Total lines removed (-)
Version
Claude Code version
Tokens In
Total input tokens
Tokens Out
Total output tokens
Color Theme
Multi-line
Split output across two lines
Live Preview
statusline preview
Export
Installation
Easiest — give this to Claude Code
Copy the prompt below and paste it into Claude Code. It handles the rest.
or do it manually
Paste in terminal
cat > ~/.claude/statusline.sh << 'STATUSLINE_EOF'
#!/bin/bash
# Claude Code Statusline — generated by ookay.dev/tools/statusline
input=$(cat)
model=$(echo "$input" | jq -r '.model.display_name // "unknown"')
dir=$(echo "$input" | jq -r '.workspace.current_dir // ""')
dir_short=$(basename "$dir")
ctx=$(echo "$input" | jq -r '.context_window.used_percentage // 0')
cost=$(echo "$input" | jq -r '.cost.total_cost_usd // 0')
cost_fmt=$(printf "$%.2f" "$cost")
CLR="\033[32m"
DIM="\033[2m"
BOLD="\033[1m"
RST="\033[0m"
echo -e "${BOLD}[${model}]${RST}${DIM} | ${RST}${dir_short}${DIM} | ${RST}${CLR}${ctx}%${RST}${DIM} | ${RST}${cost_fmt}"
STATUSLINE_EOF
chmod +x ~/.claude/statusline.sh
# Merge statusline config into settings.json
SETTINGS="$HOME/.claude/settings.json"
[ -f "$SETTINGS" ] || echo '{}' > "$SETTINGS"
jq '. + {"statusLine":{"type":"command","command":"~/.claude/statusline.sh"}}' "$SETTINGS" > "$SETTINGS.tmp" && mv "$SETTINGS.tmp" "$SETTINGS"
echo "Done — restart Claude Code to see the statusline"What the command does
1. Writes your statusline script to ~/.claude/statusline.sh
2. Makes it executable with chmod +x
3. Merges statusline config into ~/.claude/settings.json (keeps your existing settings)
After running the command
Restart Claude Code. The statusline appears at the bottom of the terminal.
Nothing showing up? Check that jq is installed: run jq --version — if missing, install with brew install jq (macOS) or sudo apt install jq (Linux).