Free Tool
Claude Code Statusline Generator
Pick what you want to see at the bottom of Claude Code (model, context used, cost, git branch, plan limits), check the live preview, then copy a ready-to-run script and the statusLine block for settings.json. It uses the official status line JSON fields.
Live preview
> _
[Opus] | my-app | git:main | ▓▓▓▓░░░░░░ 42% | +156 -23Presets:
Show
Status line script
~/.claude/statusline.sh
#!/bin/bash
# Claude Code status line. Made with claudeagents.co/tools/claude-code-statusline-generator
# Claude Code sends session data as JSON on stdin. Needs jq.
input=$(cat)
DIR=$(echo "$input" | jq -r '.workspace.current_dir // .cwd')
MODEL=$(echo "$input" | jq -r '.model.display_name // "Claude"')
BRANCH=$(git -C "$DIR" branch --show-current 2>/dev/null)
PCT=$(echo "$input" | jq -r '.context_window.used_percentage // 0' | cut -d. -f1)
ADDED=$(echo "$input" | jq -r '.cost.total_lines_added // 0')
REMOVED=$(echo "$input" | jq -r '.cost.total_lines_removed // 0')
parts=()
parts+=("\033[36m[$MODEL]\033[0m")
parts+=("\033[34m${DIR##*/}\033[0m")
[ -n "$BRANCH" ] && parts+=("\033[32mgit:$BRANCH\033[0m")
FILLED=$((PCT * 10 / 100)); EMPTY=$((10 - FILLED)); BAR=""
[ "$FILLED" -gt 0 ] && printf -v F "%${FILLED}s" && BAR="${F// /▓}"
[ "$EMPTY" -gt 0 ] && printf -v E "%${EMPTY}s" && BAR="${BAR}${E// /░}"
parts+=("\033[33m$BAR $PCT%\033[0m")
parts+=("\033[32m+$ADDED\033[0m \033[31m-$REMOVED\033[0m")
SEP=" | "
out=""
for p in "${parts[@]}"; do [ -n "$out" ] && out+="$SEP"; out+="$p"; done
printf "%b\n" "$out"
settings.json
~/.claude/settings.json
{
"statusLine": {
"type": "command",
"command": "~/.claude/statusline.sh",
"padding": 0
}
}
Make it executable and test it
chmod +x ~/.claude/statusline.sh
# Test it with sample data
echo '{"model":{"display_name":"Opus"},"workspace":{"current_dir":"'"$PWD"'"},"context_window":{"used_percentage":42},"cost":{"total_cost_usd":0.37,"total_lines_added":156,"total_lines_removed":23,"total_duration_ms":720000}}' | ~/.claude/statusline.shHow to install your status line
- Save the script as
~/.claude/statusline.sh(or download it and move it there). - Make it executable and test it with the sample command shown above. You need
jqinstalled. - Add the
statusLineblock to~/.claude/settings.json. If the file has other settings, add the block next to them. - Start Claude Code. The line appears at the bottom and updates after each reply.
Fields like the 5-hour and weekly limits only appear for Claude Pro, Max and Ultra subscribers, and the script simply skips them when they are missing. Cost is an estimate at list price.
Frequently asked questions
Save a script (for example ~/.claude/statusline.sh), make it executable with chmod +x, and add a statusLine block to ~/.claude/settings.json with type "command" and the script path as command. Claude Code runs the script and shows what it prints at the bottom of the screen.
Claude Code sends JSON on standard input. Useful fields include model.display_name, workspace.current_dir, cost.total_cost_usd, cost.total_lines_added, context_window.used_percentage, effort.level and, for Pro, Max and Ultra subscribers, rate_limits.five_hour.used_percentage and rate_limits.seven_day.used_percentage.
It runs when a session starts and again after each new assistant message, after /compact, and when the permission or vim mode changes. Updates are debounced at 300 ms. Add refreshInterval (in seconds, minimum 1) to also re-run it on a timer.
Yes. ANSI color codes work if your terminal supports them, and each line your script prints becomes its own row. Keep each line a few characters narrower than your terminal so it doesn't wrap.
No. The script runs locally on your computer and uses no API tokens.
You can type /statusline in Claude Code and describe what you want, and Claude writes the script for you. This generator is useful when you want to see a preview first, pick exact fields, and keep a script you understand.