Claude Code Statusline Generator

Toggle the segments you want, watch the exact statusline render live, then copy the tested script and settings.json block.

Live preview

[Sonnet 5] | 📁 clockedcode | 🌿 main | +2~5 | ▓▓▓▓░░░░░░42% | 💰 $1.87

What should it show?

All six are on by default - turn off what you don't want.

Show context usage as

Separator

Color

Recommended

Paste this into Claude Code

Saves the script, makes it executable, and merges the config into your settings.json instead of overwriting it.

Below is a generated Claude Code statusline script. Set it up for me:

1. Save it to ~/.claude/statusline.sh (create the ~/.claude directory if it doesn't exist).
2. Make it executable: chmod +x ~/.claude/statusline.sh
3. Check ~/.claude/settings.json - if a "statusLine" field already exists, leave the rest of the file alone and only update that field; otherwise add it:

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

4. Confirm jq is installed (jq --version) - if it's missing, tell me the install command for my OS instead of failing silently.

---

#!/bin/bash
# Generated by the ClockedCode statusline generator
# https://clockedcode.com/tools/claude-code-statusline
input=$(cat)

GREEN='\033[32m'; YELLOW='\033[33m'; RED='\033[31m'; RESET='\033[0m'

MODEL=$(echo "$input" | jq -r '.model.display_name')
DIR=$(echo "$input" | jq -r '.workspace.current_dir')
PCT=$(echo "$input" | jq -r '.context_window.used_percentage // 0' | cut -d. -f1)
COST=$(echo "$input" | jq -r '.cost.total_cost_usd // 0')

BRANCH=""; STAGED=0; MODIFIED=0
if git rev-parse --git-dir > /dev/null 2>&1; then
  BRANCH=$(git branch --show-current 2>/dev/null)
  STAGED=$(git diff --cached --numstat 2>/dev/null | wc -l | tr -d ' ')
  MODIFIED=$(git diff --numstat 2>/dev/null | wc -l | tr -d ' ')
fi

BAR_WIDTH=10
FILLED=$((PCT * BAR_WIDTH / 100))
EMPTY=$((BAR_WIDTH - FILLED))
BAR=""
[ "$FILLED" -gt 0 ] && printf -v FILL "%${FILLED}s" && BAR="${FILL// /▓}"
[ "$EMPTY" -gt 0 ] && printf -v PAD "%${EMPTY}s" && BAR="${BAR}${PAD// /░}"

if [ "$PCT" -ge 90 ]; then PCT_COLOR="$RED"
elif [ "$PCT" -ge 70 ]; then PCT_COLOR="$YELLOW"
else PCT_COLOR="$GREEN"; fi

MODEL_PART="[$MODEL]"
DIR_PART="📁 ${DIR##*/}"
BRANCH_PART=""
[ -n "$BRANCH" ] && BRANCH_PART="🌿 $BRANCH"
DIRTY_PART=""
[ "$STAGED" -gt 0 ] && DIRTY_PART="${DIRTY_PART}${GREEN}+${STAGED}${RESET}"
[ "$MODIFIED" -gt 0 ] && DIRTY_PART="${DIRTY_PART}${YELLOW}~${MODIFIED}${RESET}"
CONTEXT_PART="${PCT_COLOR}${BAR}${RESET} ${PCT}%"
COST_FMT=$(printf '$%.2f' "$COST")
COST_PART="💰 ${COST_FMT}"

PARTS=()
[ -n "$MODEL_PART" ] && PARTS+=("$MODEL_PART")
[ -n "$DIR_PART" ] && PARTS+=("$DIR_PART")
[ -n "$BRANCH_PART" ] && PARTS+=("$BRANCH_PART")
[ -n "$DIRTY_PART" ] && PARTS+=("$DIRTY_PART")
[ -n "$CONTEXT_PART" ] && PARTS+=("$CONTEXT_PART")
[ -n "$COST_PART" ] && PARTS+=("$COST_PART")

LINE=""
for i in "${!PARTS[@]}"; do
  if [ "$i" -eq 0 ]; then LINE="${PARTS[$i]}"
  else LINE="${LINE} | ${PARTS[$i]}"
  fi
done
echo -e "$LINE"

Manual setup

Or take the script

Save as ~/.claude/statusline.sh, chmod +x it, then add the settings.json block below.

#!/bin/bash
# Generated by the ClockedCode statusline generator
# https://clockedcode.com/tools/claude-code-statusline
input=$(cat)

GREEN='\033[32m'; YELLOW='\033[33m'; RED='\033[31m'; RESET='\033[0m'

MODEL=$(echo "$input" | jq -r '.model.display_name')
DIR=$(echo "$input" | jq -r '.workspace.current_dir')
PCT=$(echo "$input" | jq -r '.context_window.used_percentage // 0' | cut -d. -f1)
COST=$(echo "$input" | jq -r '.cost.total_cost_usd // 0')

BRANCH=""; STAGED=0; MODIFIED=0
if git rev-parse --git-dir > /dev/null 2>&1; then
  BRANCH=$(git branch --show-current 2>/dev/null)
  STAGED=$(git diff --cached --numstat 2>/dev/null | wc -l | tr -d ' ')
  MODIFIED=$(git diff --numstat 2>/dev/null | wc -l | tr -d ' ')
fi

BAR_WIDTH=10
FILLED=$((PCT * BAR_WIDTH / 100))
EMPTY=$((BAR_WIDTH - FILLED))
BAR=""
[ "$FILLED" -gt 0 ] && printf -v FILL "%${FILLED}s" && BAR="${FILL// /▓}"
[ "$EMPTY" -gt 0 ] && printf -v PAD "%${EMPTY}s" && BAR="${BAR}${PAD// /░}"

if [ "$PCT" -ge 90 ]; then PCT_COLOR="$RED"
elif [ "$PCT" -ge 70 ]; then PCT_COLOR="$YELLOW"
else PCT_COLOR="$GREEN"; fi

MODEL_PART="[$MODEL]"
DIR_PART="📁 ${DIR##*/}"
BRANCH_PART=""
[ -n "$BRANCH" ] && BRANCH_PART="🌿 $BRANCH"
DIRTY_PART=""
[ "$STAGED" -gt 0 ] && DIRTY_PART="${DIRTY_PART}${GREEN}+${STAGED}${RESET}"
[ "$MODIFIED" -gt 0 ] && DIRTY_PART="${DIRTY_PART}${YELLOW}~${MODIFIED}${RESET}"
CONTEXT_PART="${PCT_COLOR}${BAR}${RESET} ${PCT}%"
COST_FMT=$(printf '$%.2f' "$COST")
COST_PART="💰 ${COST_FMT}"

PARTS=()
[ -n "$MODEL_PART" ] && PARTS+=("$MODEL_PART")
[ -n "$DIR_PART" ] && PARTS+=("$DIR_PART")
[ -n "$BRANCH_PART" ] && PARTS+=("$BRANCH_PART")
[ -n "$DIRTY_PART" ] && PARTS+=("$DIRTY_PART")
[ -n "$CONTEXT_PART" ] && PARTS+=("$CONTEXT_PART")
[ -n "$COST_PART" ] && PARTS+=("$COST_PART")

LINE=""
for i in "${!PARTS[@]}"; do
  if [ "$i" -eq 0 ]; then LINE="${PARTS[$i]}"
  else LINE="${LINE} | ${PARTS[$i]}"
  fi
done
echo -e "$LINE"

settings.json block

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

That was one line for one terminal.

ClockedCode does this for your whole Claude Code setup - one paste.

See how it works

Free, no sign-up, nothing leaves your browser

FAQ

What is a Claude Code status line?

A customizable bar at the bottom of the terminal that Claude Code fills in by running a shell script you configure. The script receives JSON session data - model, working directory, cost, context usage, and more - on stdin and prints whatever you want displayed; Claude Code shows exactly what the script outputs.

Does the JSON include my git branch?

No. Claude Code's session JSON has no git fields at all - branch name and dirty-file counts have to come from running git commands inside your own script, guarded so it doesn't error when you're outside a repository. Every script this generator produces does that guard for you.

Where do I save the generated script?

~/.claude/statusline.sh is the conventional path (~ is your home directory), then chmod +x it so the shell can run it, then point settings.json's statusLine.command field at it. The paste-prompt output does all three steps for you and merges the config into settings.json instead of overwriting the file.

Why does my status line show -- or stay blank?

Context usage and a few other fields are null until your first message gets an API response back, so a status line can briefly show blank or a placeholder right after Claude Code starts. Every script here handles that with a fallback default instead of erroring. If it's still blank after a few messages, confirm the script is executable and that jq is installed.

Is this statusline generator free?

Yes - free, no sign-up, and nothing you toggle leaves your browser; the script and preview are assembled locally. ClockedCode separately sells a complete done-for-you Claude Code setup, but the generator itself is not gated.

This is a live builder for Claude Code's status line - the customizable bar Claude Code fills in by running a shell script at the bottom of your terminal. Toggle which session facts you want (model, folder, git branch, uncommitted changes, context usage, cost), pick a separator and a color scheme, and watch the exact rendered line update as you click. Nothing here waits for a final step - the preview is the tool.

Claude Code pipes a JSON blob to your script on every update, and it doesn't include your git branch or how many files are dirty - that has to come from shelling out to git, guarded so the script doesn't error outside a repository. Every script this generator emits does that guard correctly, extracts context usage with a null-safe fallback (the field is empty before your first message gets an API response back), and only declares the color codes it actually uses.

The context-usage segment has three display modes: a ten-block progress bar, a bare percentage, or tokens remaining, all colored green under 70%, yellow from 70 to 89%, and red at 90% and up - the same threshold Anthropic's own reference example uses. Pick the cyan color scheme and your model name and folder wrap in cyan brackets with the cost segment in yellow, matching that same example; pick plain text and you get zero ANSI codes, the safer choice on terminals that don't render color well.

The recommended path is the paste prompt: it tells Claude Code to save the script to ~/.claude/statusline.sh, make it executable, and merge the statusLine field into your settings.json instead of overwriting whatever else is already in that file - the same merge-aware pattern the settings.json generator uses for hooks and permissions. Prefer to do it by hand - the raw script and the exact JSON block are both right there to copy.

Setting up the status line is one piece of a full Claude Code setup - the complete VS Code setup guide walks through the extension, the CLI, CLAUDE.md, and the keybinding fixes that go with it, status line included.

I run Claude Code daily and this generator emits the same statusline conventions my own setup uses. If you want the finished version of the whole idea - a tuned CLAUDE.md, a tuned settings.json, and the full vetted tool stack, installed in one paste - that is what ClockedCode is. The link is at the bottom of this page.

Neo ZinoBy Neo Zino - builder of ClockedCode

Other free tools