brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: /statusline builds you a status bar with context usage in it

CLI
~/tips/tip-claude-statusline-command

/statusline show model name and context percentage with a progress bar

Adds a custom status bar to Claude Code showing things like model and context usage.

I would want to see how full the context window is without typing a command to find out.

Run /statusline and describe what you want in plain words. Claude Code writes a script into ~/.claude/ and updates your settings itself.

/statusline show model name and context percentage with a progress bar

Under the hood, it is a statusLine entry in settings.json. Claude Code pipes JSON about the session to your command on stdin, and whatever the command prints becomes the bar. A one-liner is enough:

{
  "statusLine": {
    "type": "command",
    "command": "jq -r '\"[\\(.model.display_name)] \\(.context_window.used_percentage // 0)% context\"'"
  }
}

The JSON includes the model and context_window.used_percentage. Add refreshInterval (in seconds) if you show something time-based, like a clock.

I like a status line for context usage because I no longer have to check. A number on screen all the time tells you when to compact before the window is full, instead of finding out from a warning. And since it is just a script, you can show anything a shell command can print, like the git branch or a clock.

The caveat: with a custom status line, Claude Code stops showing some footer hints such as ? for shortcuts. To remove it again, ask /statusline to delete it.

Further reading: Customize your status line – Claude Code docs, On this site: /context shows what is eating your Claude Code context window, On this site: /branch lets you try another direction without losing this conversation

More CLI tips printf 'GET /\r\n' | hexdump -C hexdump -C -s 512 -n 64 disk.img wget --limit-rate=2m https://example.com/big-file.iso wget --spider https://example.com/file.zip rg 'apiKey' -g '!*.min.js' -g '!package-lock.json' All CLI tips (46) All topics

Link