Mechanics

Claude Code Statusline

Set up a Claude Code statusline to show model, context usage, cost, branch, rate-limit signals, and session data without adding prompt noise.

The Claude Code statusline is a customizable row at the bottom of the terminal interface. Use it when you want persistent visibility into model, context usage, estimated cost, branch, session name, or rate-limit signals while you work.

Last checked on July 8, 2026. Statusline fields and Claude Code versions change quickly, so treat scripts and JSON fields as implementation details you should verify against the official docs before standardizing them for a team.

Quick Answer

Use /statusline when you want Claude Code to generate a statusline script from a natural-language request. Configure statusLine manually in ~/.claude/settings.json or project settings when you need a reviewed script, stable team behavior, or custom formatting.

Do not use the statusline as a second prompt, a policy engine, or a place to print secrets. It should answer one operational question at a glance: "What session am I in, how much context or usage am I burning, and is this the right project?"

What To Show First

NeedGood statusline fieldWhy it helps
Avoid running expensive work in the wrong modelmodel.display_nameShows model drift immediately.
Watch context before auto-compactcontext_window.used_percentageGives a visible context budget signal.
Distinguish similar repos or worktreesworkspace.current_dir, workspace.git_worktree, branch from gitPrevents editing the wrong checkout.
Control subscription or API spendcost.total_cost_usdUseful for API-billed sessions; still an estimate.
Track quota pressurerate_limits.five_hour.used_percentageHelps plan breaks and avoid surprise limit stops.
Resume or debug a sessionsession_name, session_id, transcript_pathMakes support and handoff easier.

Keep the first version boring: model, repo folder, branch, context percentage. Add cost or rate-limit fields only if your workflow actually needs them.

Setup Options

OptionUse whenTradeoff
/statusline show model name and context percentageYou want the fastest setup.Convenient, but still review the generated script.
User settingsYou want the same statusline everywhere.Personal defaults can be wrong for some repos.
Project settingsA team wants consistent local signals.Needs review because every contributor will inherit the behavior.
Inline commandThe output is very simple.Harder to audit once formatting grows.
Script fileYou need git, cost, context, or rate-limit formatting.Must be executable and maintained.

Example manual settings shape:

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

Safe Script Rules

  1. Read JSON from stdin and print only the statusline text.
  2. Keep the script local and fast.
  3. Do not call external APIs from the statusline.
  4. Do not print tokens, file contents, environment variables, or customer data.
  5. Treat cost.total_cost_usd as an estimate, not a billing ledger.
  6. Use refreshInterval only when a time-based display truly needs it.
  7. Review project-level statusline scripts like any other executable code.

Common Mistakes

MistakeWhy it hurtsBetter approach
Showing too many fieldsThe footer becomes noise and hides the useful signal.Limit it to 3-5 values.
Depending on undocumented JSON fieldsA Claude Code update can break the script.Use fields listed in the official statusline docs.
Running slow commands every updateClaude Code cancels in-flight statusline runs and the UI feels unstable.Cache expensive work or remove it.
Printing secrets or paths that should stay privateScreenshots and screen shares can leak data.Redact or omit sensitive fields.
Using statusline instead of permissionsA footer cannot block unsafe tools.Use tools allowlist and hooks.

Statusline vs Other Mechanics

If you need...Use
A visible session signalStatusline
A reusable instructionSlash commands
A durable project ruleCLAUDE.md
Automatic enforcementHooks
Lower context wasteContext management
Shared permission policyTools allowlist

Official Sources