← Blog · 2026-10-16
Claude Code Status Line Not Showing? 9 Fixes, Plus a Script That Shows Context and Cost
Shortcut: our free status line builder writes a tested
statusline.shand thesettings.jsonblock for you. Tick what you want to see, copy, done. It runs in your browser.
The status line is the bar at the bottom of Claude Code that runs a small script and shows whatever it prints: model, folder, git branch, how full the context window is, what the session has cost so far. Claude Code sends the script a blob of JSON about the session on standard input, and the script prints one or more lines.
When it works, you stop being surprised by /compact and by your bill. When it doesn't, you get a blank bar and no error. Here's how to get from blank to working.
The minimum that works
Two pieces. First, a script at ~/.claude/statusline.sh:
#!/bin/bash
input=$(cat)
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')
printf '[%s] %s | ctx %s%% | $%.2f\n' "$MODEL" "${DIR##*/}" "$PCT" "$COST"
Then make it executable with chmod +x ~/.claude/statusline.sh and point your settings at it. In ~/.claude/settings.json:
{
"statusLine": {
"type": "command",
"command": "~/.claude/statusline.sh"
}
}
If that file already has settings, add the "statusLine" block inside the existing outer braces instead of replacing the file. The script needs jq installed (brew install jq on a Mac, your package manager on Linux).
There's also a no-script route: type /statusline show model name and context percentage inside Claude Code and it writes the script and updates your settings for you.
Test it without Claude Code
This one step catches most problems. Feed the script fake session data and see what it prints:
echo '{"model":{"display_name":"Opus"},"workspace":{"current_dir":"/home/me/client-a"},"context_window":{"used_percentage":42},"cost":{"total_cost_usd":0.37}}' | ~/.claude/statusline.sh
You should get [Opus] client-a | ctx 42% | $0.37. If you get an error or nothing, the problem is the script, not Claude Code.
9 reasons it stays blank, in the order to check them
- The script isn't executable. Run
chmod +x ~/.claude/statusline.sh. This is the most common one. - The script exits with an error. Claude Code only shows output after the script exits with code 0. A non-zero exit, or no output at all, means a blank bar. Run the test above and check
echo $?right after. - It prints to stderr instead of stdout. Only standard output is displayed.
echoandprintfgo to stdout by default; anything you redirect with>&2won't show. jqisn't installed. The script then fails on the firstjqline. Runwhich jq.- You haven't trusted the folder. The status line runs a shell command, so Claude Code holds it back until you accept the workspace trust dialog for that folder, the same rule that applies to hooks. Restart Claude Code in the folder and accept the dialog.
- Hooks are switched off. If
disableAllHooksistruein your settings, your own status line won't run either. Remove it or set it tofalse. On a work machine, an admin setting calledallowManagedHooksOnlyhides personal status lines with no warning; ask whoever manages it. - Windows path backslashes. With Git Bash, backslashes in the
commandpath can get eaten before the script runs. Use forward slashes. - The script is too slow. A slow script blocks updates, and if a new update arrives while it's still running, Claude Code cancels it.
git statusin a big repository is the usual culprit. Cache it (see below) or drop it. - Something else is wrong and you can't see it. Start Claude Code with
claude --debug. It logs the script's error output on every run and its exit code on the first run of a session. If you seeStatus line command skipped: workspace trust not accepted, go back to number 5.
It shows, but the values are empty or --
Some fields are empty until the first reply in a session comes back. That's normal. Give every field a fallback in jq, like // 0 or // "", as the script above does. If values are still empty after several messages, restart Claude Code.
Rate-limit fields (rate_limits.five_hour.used_percentage and rate_limits.seven_day.used_percentage) only appear for Claude Pro and Max subscribers, and only after the first reply. Each one can be missing on its own, so use // empty and skip that part when it's blank.
The context % doesn't match /context
They measure slightly different moments. The status line uses the numbers from the last reply. /context adds an estimate for whatever you've typed since then, so it can read higher until the next reply arrives. For a simple, accurate number, use context_window.used_percentage. It counts input tokens only, not output.
The cost looks wrong
cost.total_cost_usd is an estimate Claude Code works out on your computer at list prices, and it can differ from your actual bill. It resets to $0 when /clear starts a new session. If you're on a Pro or Max plan, the rate-limit percentages usually matter more to you than the dollar figure.
It doesn't update while Claude is idle
The script reruns when a new reply arrives, when /compact finishes, when you switch permission or vim mode, and a few other events, with a 300ms pause to batch rapid changes. When nothing is happening, nothing reruns. If you show a clock or anything that changes on its own, add "refreshInterval": 5 to the statusLine block to rerun it every 5 seconds (the minimum is 1).
Keep it fast: cache git
If you want the git branch, don't run git on every update in a large repository. Anthropic's docs suggest caching it in a temp file for a few seconds, and naming that file with the session_id from the JSON (not the process ID, which changes every run), so two sessions in different folders don't read each other's branch. The status line builder adds the branch plus staged and modified file counts as an optional box; in a very large repository, leave it unticked or add a cache.
Turning it off
Type /statusline clear (or remove), or delete the statusLine block from your settings.
Facts on this page come from Anthropic's status line documentation. This guide isn't affiliated with Anthropic.
If you use Claude Code for client work, the status line is a small win. The bigger one is skills that handle the repeat work. Start with our free 3-skill sample (client follow-ups, meeting notes to tasks, invoice chasing), or get the full Solo Consultant Kit.