Claude Corner

Never Sure How Full Claude's Context Is? Put It in Claude Code's Status Line.

By · 22 Oct 2026

Claude Corner illustration for “Never Sure How Full Claude's Context Is? Put It in Claude Code's Status Line.”

At a glance

  • /statusline plus a plain English description builds a status line for you and wires it into your settings.
  • A short script can show the model, effort level, context percentage and git branch on every turn, without spending API tokens.
  • A blank line usually means workspace trust, a failing script or a null field, and each has a quick fix.

You are an hour into a refactor. Claude starts forgetting a decision you made early on, and you are not sure whether the context is nearly full, whether you are still on the model you picked, or which branch you are on. So you stop, run /context, check /model, and type git branch in another tab. Claude Code can keep all of that on screen for you.

Why it matters

The status line is a bar at the bottom of Claude Code that runs a shell command you choose. Claude Code sends it JSON about the session on stdin and shows whatever the command prints. Anthropic's docs pitch it for watching context use, tracking session cost, telling sessions apart and showing the git branch. The docs also say it runs locally and does not consume API tokens.

Our reading: the useful part is seeing context climb before it bites, not after Claude loses the thread.

How to set up a status line

  1. The fast route: in Claude Code, run /statusline with what you want, for example /statusline show model name and context percentage with a progress bar. Claude Code writes a script in ~/.claude/ and updates your settings. Approve the file edits if it asks. Run /statusline with no arguments and it configures one from your shell prompt instead.
  2. Prefer your own script? Save the code below as ~/.claude/statusline.sh and run chmod +x ~/.claude/statusline.sh. It needs jq, which you may have to install.
  3. Point Claude Code at it in ~/.claude/settings.json, or a project's settings, with the statusLine block shown in the comments. It runs as soon as you save.
  4. Test it outside a session with the mock input line at the bottom. Claude Code itself sends the JSON on stdin.
  5. To turn it off, run /statusline and ask it to remove the status line, or delete the statusLine field from settings.
#!/bin/bash
# We have not run this in a live Claude Code session; we tested it on mock input only.
# Save as ~/.claude/statusline.sh: model, effort, context bar, git branch
input=${1:-$(cat)}
MODEL=$(jq -rn --argjson s "$input" '$s.model.display_name // "model?"')
EFFORT=$(jq -rn --argjson s "$input" '$s.effort.level // empty')
DIR=$(jq -rn --argjson s "$input" '$s.workspace.current_dir // empty')
PCT=$(jq -rn --argjson s "$input" '$s.context_window.used_percentage // 0')
PCT=${PCT%%.*}
FILLED=$((PCT / 10)); BAR=""
for i in 1 2 3 4 5 6 7 8 9 10; do
  if [ "$i" -le "$FILLED" ]; then BAR="${BAR}#"; else BAR="${BAR}."; fi
done
BRANCH=""
if [ -n "$DIR" ] && [ -e "$DIR/.git" ]; then
  BRANCH=$(git -C "$DIR" branch --show-current)
fi
echo "[$MODEL${EFFORT:+ $EFFORT}] $BAR ${PCT}% ctx${BRANCH:+ on $BRANCH}"

# In ~/.claude/settings.json:
# { "statusLine": { "type": "command", "command": "~/.claude/statusline.sh" } }

# Test with mock input (passing it as an argument is our shortcut):
# ~/.claude/statusline.sh '{"model":{"display_name":"Opus"},"effort":{"level":"high"},"context_window":{"used_percentage":42.7}}'

Gotchas

  • Blank in a new folder? Because the status line runs a shell command, Claude Code waits until you accept the workspace trust dialog for that folder. claude --debug logs the skip.
  • Blank after you edit the script? Claude Code only shows output when the script exits with code 0 and prints to stdout. Slow scripts hold the line, so keep git calls light.
  • Shows 0% or no effort early on? Context fields can be null before the first response, and the effort field is absent on models that do not support effort. The // 0 and // empty fallbacks above handle that.
  • Number differs from /context? The status line uses the last API response, while /context adds an estimate for newer messages, so /context can read higher until the next reply.
  • Your keyboard hints go away. A custom status line hides most footer hints, including esc to interrupt and ? for shortcuts.
  • Still nothing at work? If your organization sets allowManagedHooksOnly, or disableAllHooks is on outside managed settings, your own status line will not run. Ask your admin.
  • On Windows? We have not tested this script on Windows. The docs say Claude Code uses Git Bash there when installed, otherwise PowerShell.

Sources:

Recommended AI prompt

Copy this paragraph into ChatGPT, Claude, Gemini, Grok, or whatever AI you use.

Prompt

I use Claude Code in a terminal and I want a status line that shows how full the context window is, plus whatever else helps me. Ask me my operating system and shell, whether I have jq installed, how wide my terminal usually is, and what I want to see (model, effort, context, cost, git branch, rate limits). Then write me a short, fast status line script and the matching statusLine block for settings.json, a one-line mock input test, and a checklist for when the line stays blank. Use only fields listed on the official Claude Code status line docs page and link me to it.