*This is my Claude Code screenshot: [Project], [Model], [Context Usage Percentage], [Remaining Usage],[Session Duration]
Hello, this time I'll share a simple tip.
Have you been typing /context or /cost every time to check how much context percentage you used and the cost while using Claude Code? If you display it on the status bar at the bottom of the screen, your workflow will be much smoother. You can do it with natural language without writing any scripts.
Official documentation: https://code.claude.com/docs/en/statusline
Set in Natural Language
/statusline Just add what you want to the slash command.
/statusline Show me the model name and context percentage with a progress bar
Claude Code will automatically create a script and register it in ~/.claude/settings.json.
Displayable Information
Please refer to this when making requests:
Model name, current directory, git branch
Context usage (percentage)
Session cost (USD estimate)
Session duration
Rate limit (Claude.ai Pro/Max only): 5 hours/7 days usage
Number of lines changed in code
Vim mode, inference effort level
Natural Language Examples
Just say what you want.
/statusline Turn yellow when context exceeds 70%, red when it exceeds 90%
/statusline Git branch and the number of staged/modified files
/statusline Display on two lines. The first line is model + directory + branch, and the second line is the context bar and cost
/statusline Show me the 5 hours/7 days rate limit
Delete
/statusline delete
/statusline clear
/statusline remove it
All three work.
How It Works (If You're Curious)
Every time Claude Code receives a message, it passes JSON session information to the script via stdin and displays the script output directly on the status bar. It doesn't use tokens (local execution).
The settings file is ~/.claude/settings.json and the script is automatically saved to ~/.claude/statusline.sh.
Even if it seems trivial, being able to see how much context percentage you have left makes it easier to time when to use /compact, and you can naturally track costs.
Codex also has /statusline, but it's a bit different from Claude Code. You can only toggle/change the order of preset items, so natural language commands don't work. You have to configure it directly.