Custom Status Line for Claude Code
Today I discovered Claude Code supports custom status lines through a simple bash script.
After squinting at the default status bar one too many times, I built one that shows everything I actually care about - git context and token burn rate - in a single glanceable line.
The Problem
Claude Code’s default status line is functional but minimal.
When you’re deep in a refactoring session, you want to know:
- What branch am I on?
- How many lines have I changed?
- How much context window do I have left?
- Am I burning through tokens?
The Solution
Claude Code pipes JSON to your status line script via stdin. You parse it with jq, grab git info, calculate padding, and output a single line with left/right alignment.
#!/bin/bash
input=$(cat)
# Parse JSON from Claude Code
dir=$(echo "$input" | jq -r '.workspace.current_dir')
model=$(echo "$input" | jq -r '.model.display_name // .model.id')
total_input=$(echo "$input" | jq -r '.context_window.total_input_tokens // 0')
# Git info
branch=$(git -c core.useBuiltinFSMonitor=false branch --show-current 2>/dev/null)
diff_stats=$(git diff --shortstat 2>/dev/null)
# Terminal width for right-alignment
term_width=${COLUMNS:-$(stty size 2>/dev/null | cut -d' ' -f2)}
[ -z "$term_width" ] && term_width=120
# Calculate padding between left and right sections
padding=$((term_width - left_len - right_len))
printf '%b%*s%b' "$left" "$padding" "" "$right"
The full script handles context window percentage (color-coded: green >50%, yellow >20%, red otherwise), session duration, and token formatting with k suffixes.
Configuration
Add to ~/.claude/settings.json:
{
"statusLine": {
"type": "command",
"command": "/Users/<you>/.claude/statusline-command.sh"
}
}
What It Shows
| Left Side | Right Side |
|---|---|
| Directory name | Model name |
| Git branch | Session duration |
| Lines added/removed | Context window % left |
| Token in/out counts |
The output adapts to terminal width:

What I Learned
- Claude Code exposes rich JSON data to status line scripts: workspace, model, tokens, context window usage
tput colsdoesn’t work in piped contexts - use$COLUMNSorstty sizeinstead- Unicode characters (
│,↓) break${#var}length calculations - usewc -mfor visible width - The
core.useBuiltinFSMonitor=falseflag prevents git from hanging on optional locks
References
Customizing your Claude Code setup? I’d love to see what status lines others have built. Reach out on LinkedIn.