A Status Line for Claude Code That Shows What Each Prompt Costs You

Most status lines show where your session is. Mine shows what each prompt just did to it: context added, cost added, and whether the cache held. Here's what I watch and the repo if you want a starting point.

Share
Claude Code status line showing repo and branch, lines changed, model and effort, context bar with growth pill, cache hit rate, 5-hour and 7-day limits, session cost, and token total.
The full status line, annotated. Each segment appears only when Claude Code reports its data.

During a long agent session, I want to know how much context I’m carrying, how close I am to a usage limit, and what the session is costing me. Those numbers help me decide when to start fresh, switch effort levels, or stop for the day.

Watching how much each prompt adds to my context, and what it costs, has made me a more efficient prompter. I don’t have to type /usage to find out anymore. The numbers are right there after every response, and that feedback has taught me to get the same results for fewer tokens.

Claude Code lets you run a script that draws a status line under the prompt. It’s not much work to build one from scratch by running /statusline in your own session.

If you want a starting place, I’ve shared mine here: zerofaultlabs/claude-statusline. It’s MIT licensed and takes about five minutes to install. Once it’s set up, you can fork it and maintain your own variation, and Claude will do the heavy lifting.

The problem

If you run coding agents for hours at a time, you’re making decisions all day with numbers you can’t see. When should I clear this session? Did that last request just read a 40k-token file? Am I about to hit my usage limit? Is the prompt cache still working?

You can answer all of these with /usage and a bit of arithmetic, but checking that 50x a day adds up. Without seeing the live changes, it can be much harder to figure out where the tokens are going between prompts.

What it shows

  • Context usage as a gradient bar, colored by how full the window is.
  • Growth per prompt, a small pill showing how much context your last prompt added, as a percent of your window. If one request adds 8%, I know right away, while I can still change how I work.
  • Cache hit rate, the lowest one since your last prompt. A cold-cache call stays visible even after the next call warms things back up, so a quietly broken prompt cache doesn’t slip by.
  • 5-hour and 7-day rate limits, with the time until each resets (plan accounts).
  • Session cost, plus what your last prompt added to it. Something like $4.12 +$0.03.
  • Repo, branch, worktree, lines changed, model, effort level, and a token total. Effort is colored from green at low to red at max, so I notice when I’ve left something on max.

Every segment appears only if Claude Code reports the data, so the line gets shorter instead of broken when something is missing. It adapts to your window width and to whether you’re on a subscription or straight API keys.

Deltas, not just totals

Totals tell you where you are. Deltas tell you what just happened. That’s the idea the whole line is built around.

A small hook runs each time you submit a prompt and snapshots token totals and cost. On the next render, the script subtracts, so both the context growth and the cost show what the last prompt added.

Here's what that looks like across two prompts. The first asked Claude to read the main script and explain the layout:

Status line showing context at 5% with a +5.1% growth pill, 41% cache hit rate, and session cost $0.25 with +$0.25 for the last prompt.
After the first prompt: a 5.1% jump, a cold cache, and $0.25.

That one prompt added 5.1% of a 1M window and $0.25. The cache hit was 41%, which is normal for a first prompt, since the cache is being written, not read.

The follow-up was a short question about the same code:

Status line showing context at 5% with a +0.0% growth pill, 100% cache hit rate, and session cost $0.27 with +$0.02 for the last prompt.
After a follow-up: almost no growth, a warm cache, and $0.02.

Context barely moved, the cache hit 100%, and it cost two cents. A cache rate that stays low later in a session is the one worth investigating.

Themes, pills, and narrow windows

There are seven themes: sorbet, ember, sunset, ocean, forest, grape, and mono. Each has two color ranges. One colors the usage bars. The other colors what a prompt costs you: growth, cache, cost, and effort.

Seven status lines, one per theme: sorbet, ember, sunset, ocean, forest, grape, and mono.
All seven themes. The usage bars match on every line, so you can compare colors. Growth, cache and cost climb from low to high down the page.

Set PILLS=true and every segment gets its own rounded pill. It’s the same information with more visual separation.

Seven status lines with every segment in a rounded pill, one per theme.
The same themes with PILLS=true and effort set to max.

The script reads your terminal width on every render and drops the least important segments first, in a defined order. Repo, context bar, and the growth pill are never dropped. If you’d rather it wrap to two lines or never shrink, there’s a setting for that.

What it’s changed for me

Seeing context climb in steps, and which prompts caused the big steps, makes it easier to clear a session at a natural break instead of dragging old context forward. A noisy command output or an accidental large file read shows up as a jump, and I can adjust the next prompt. When the cache hit rate dips, I know something changed the start of the conversation.

None of this is sophisticated. The information I needed was in a place I wasn’t looking, and moving it changed what I do.

Install it

You need bash, jq, git, python3, and a Nerd Font set as your terminal font. The pills and caps are Nerd Font glyphs, and without one you’ll see empty boxes. I developed it on macOS; Linux should work but is less tested.

The easiest way is to open Claude Code and paste the prompt from INSTALL_PROMPT.md. It reads the scripts, checks your font and tools, asks before installing anything, merges your settings without overwriting what’s there, and tests against fake data.

To install by hand, clone the repo, copy the scripts into ~/.claude/, and add this to ~/.claude/settings.json:

"statusLine": {"type": "command", "command": "bash ~/.claude/statusline-command.sh"},
"hooks": {"UserPromptSubmit": [{"hooks": [{"type": "command", "command": "bash ~/.claude/statusline-hook.sh"}]}]}

Either way, read the scripts first. They’re short, and they execute on every refresh. That’s good practice for anything you let run inside your agent’s environment.

Everything is configured in one optional file, ~/.claude/statusline.conf, and changes apply on the next refresh with no restart.

Depending on your local setup, ask Claude to optimize it. I had a pyenv shim costing 300ms on every refresh.

What it doesn’t do

  • Usage credits aren’t supported yet. Claude Code doesn’t currently report usage credits (the overage charges). However, once you hit a limit, start a new session and just watch the cost.
  • Rate-limit bars depend on your plan. If Claude Code doesn’t report limits for your account, they don’t appear.
  • The token total measures work done, not a bill. Use your provider’s usage page for money.
  • The cache figure doesn’t weigh call size. One small cold call among large warm ones still reads low.
  • Light mode is a minimal adaptation, not a full theme set.

Why we’re sharing this

At ZeroFault Labs we spend our days building with coding agents, and most of what makes them work well in practice is small and unglamorous: visibility, guardrails, and habits. A status line isn’t a platform. It’s the cheapest observability I’ve added to my workflow, and it paid for itself the first week.

The same idea applies if you’re rolling agents out across a team. People work better with agents when they can see what the agent is doing to their context and their budget.

If you try it, I’d like to hear which segment you added or removed. Open an issue or start a discussion on the repo.