How to set up a Claude Code status line
Updated 17 November 2026
Run /statusline and describe what you want, for example "show model name and context percentage", and Claude Code writes the script and the setting for you. To do it by hand, save a script that reads JSON from stdin and add a statusLine entry to ~/.claude/settings.json.
The status line is a bar at the bottom of Claude Code that shows whatever a script of yours prints. Claude Code hands the script JSON about the session, such as the model, the folder, how full the context window is and what the session has cost, and displays the output.
It runs on your Mac and uses no API tokens. The steps follow the status line page of the Claude Code docs.
What is the quickest way to set one up?
Ask Claude Code to do it. The /statusline command takes a plain description:
/statusline show model name and context percentage with a progress bar
Claude Code writes a script file in ~/.claude/ and updates your settings. Approve the file edits if it asks.
To remove it later, run /statusline delete, or delete the statusLine field from your settings.
How do I write one by hand?
-
Save this as
~/.claude/statusline.sh. It needsjq, which you can install withbrew install jq.#!/bin/bash # Read JSON data that Claude Code sends to stdin input=$(cat) # Extract fields using jq MODEL=$(echo "$input" | jq -r '.model.display_name') DIR=$(echo "$input" | jq -r '.workspace.current_dir') # The "// 0" provides a fallback if the field is null PCT=$(echo "$input" | jq -r '.context_window.used_percentage // 0' | cut -d. -f1) # Output the status line - ${DIR##*/} extracts just the folder name echo "[$MODEL] ${DIR##*/} | ${PCT}% context" -
Make it executable.
chmod +x ~/.claude/statusline.sh -
Point Claude Code at it in
~/.claude/settings.json.{ "statusLine": { "type": "command", "command": "~/.claude/statusline.sh" } }
Claude Code reloads settings by itself and runs the script as soon as you save.
For something very short you can skip the file and put the command inline:
{
"statusLine": {
"type": "command",
"command": "jq -r '\"[\\(.model.display_name)] \\(.context_window.used_percentage // 0)% context\"'"
}
}
What data can the status line show?
These are the fields most people use. The docs list many more.
| Field | What it is |
|---|---|
model.display_name |
Current model |
workspace.current_dir |
Current working directory |
context_window.used_percentage |
How full the context window is |
cost.total_cost_usd |
Estimated session cost in USD, computed locally at list price |
cost.total_duration_ms |
How long the session has been running |
cost.total_lines_added, cost.total_lines_removed |
Lines of code changed |
rate_limits.five_hour.used_percentage |
Share of the 5-hour limit used, 0 to 100 |
rate_limits.seven_day.used_percentage |
Share of the 7-day limit used |
rate_limits.five_hour.resets_at |
When that window resets, in Unix epoch seconds |
session_name |
Name set with --name or /rename |
worktree.name, worktree.branch |
Present in a worktree session |
Two notes on those. The cost figure is an estimate and resets to $0 when /clear starts a new session. And rate_limits appears only for Pro, Max and Ultra subscribers, and only after the first API response, so read it with a fallback such as // empty.
How do I show session cost and time?
This is the cost example from the docs, with the emoji left out:
#!/bin/bash
input=$(cat)
MODEL=$(echo "$input" | jq -r '.model.display_name')
COST=$(echo "$input" | jq -r '.cost.total_cost_usd // 0')
DURATION_MS=$(echo "$input" | jq -r '.cost.total_duration_ms // 0')
COST_FMT=$(printf '$%.2f' "$COST")
DURATION_SEC=$((DURATION_MS / 1000))
MINS=$((DURATION_SEC / 60))
SECS=$((DURATION_SEC % 60))
echo "[$MODEL] $COST_FMT | ${MINS}m ${SECS}s"
There is more on reading these numbers in how to see what a Claude Code session costs, and on the limit percentages in checking your Claude Code usage limit.
When does the status line update?
The script runs when a session starts, and again when a new assistant message arrives, when /compact finishes, and when the permission mode changes. Updates are debounced at 300ms.
When the session is idle, nothing triggers it. If you show a clock or anything else that changes over time, add refreshInterval, which re-runs the command every N seconds:
{
"statusLine": {
"type": "command",
"command": "~/.claude/statusline.sh",
"refreshInterval": 5
}
}
The script can print several lines, and ANSI colour codes work if your terminal supports them. Because it runs often, keep slow commands such as git status out of it or cache their output.
Why is my status line blank?
Check these in order:
-
The script is executable:
chmod +x ~/.claude/statusline.sh. -
It prints to stdout. Output on stderr is not shown.
-
It works when you run it yourself. Test it with mock input:
echo '{"model":{"display_name":"Opus"},"workspace":{"current_dir":"/home/user/project"},"context_window":{"used_percentage":25},"session_id":"test-session-abc"}' | ./statusline.sh -
disableAllHooksis not set totruein your settings. That turns the status line off too. -
You have trusted the folder. An untrusted workspace leaves it blank.
If values show as -- or empty, they are probably null because the first API response has not arrived. Add jq fallbacks such as // 0. claude --debug logs the script’s stderr.
What can a status line not do?
It sits at the bottom of one terminal. You see it only when that terminal is in front of you, and with three sessions open there are three status lines in three places. It also hides while a permission prompt is showing, which is the moment you most need to know which session is asking.
NotchDaddy puts the same kind of numbers in the MacBook notch for every session at once: what each one is doing, its tokens and cost read locally from the transcripts, and the request it is waiting on. You can run it alongside a status line.
You do not need it if you run one session and its terminal stays visible. A status line covers that well and is free. For how the session list works, see the agents page.
Start a 3-day trial for $0, then $19 once for 2 Macs.