Stop Flying Blind: Real-Time Context Usage in Claude Code
A tiny status line tweak that shows live context percentage, model name, and git branch so you stop guessing and start making better calls.

Context management is everything in agentic engineering. I genuinely believe that.
You get 200k tokens per session, which sounds generous until you kick off a real feature and watch it evaporate. Every tool call, every agent message, every back and forth. It all adds up. And as you approach the ceiling, the model gets dumber. Context rot. You've probably experienced it. You just didn't know what to call it.
The problem? You're flying blind. You can type /context to check, but not mid-execution. You have to wait for the agent to finish and hand control back. By then, who knows where you're at. There's no real-time feedback, which means there's no real-time decision making.
Anyway, there's a fix, and it's almost embarrassingly simple.
The Status Line
That little text strip below your input box that says "plan mode"? Customizable. I've got mine showing the model, git branch, and a color-coded context percentage. It updates live as the agent works. Green under 50%. Yellow 50-70%. Red above 70% (start a new session). Auto-compact kicks in at 80%, and if you're relying on that, you've already lost the plot.

Setup
The /statusline command will scaffold this for you:
/statusline show model name, context percentage with color coding, and git branch
I'll warn you though. I've been through this a few times and Claude sometimes gets confused about which percentage to show. It loves giving you some subscription-level number that is clearly wrong. You may need to clarify. Or just skip the negotiation and do it manually:
Add this to ~/.claude/settings.json:
{
"statusLine": {
"type": "command",
"command": "~/.claude/status_line_command.sh"
}
}Create ~/.claude/status_line_command.sh and chmod +x it:
#!/bin/bash
input=$(cat)
model=$(echo "$input" | jq -r '.model.display_name')
used=$(echo "$input" | jq -r '.context_window.used_percentage // empty')
branch=$(git --no-optional-locks -C "$(echo "$input" | jq -r '.cwd')" branch --show-current 2>/dev/null || echo "no-git")
if [ -n "$used" ]; then
int_used=${used%.*}
if [ "$int_used" -ge 70 ]; then
color="\e[31m" # red
elif [ "$int_used" -ge 50 ]; then
color="\e[33m" # yellow
else
color="\e[32m" # green
fi
reset="\e[0m"
printf "%s | ${color}Context: %.1f%%${reset} | %s" "$model" "$used" "$branch"
else
printf "%s | Context: N/A | %s" "$model" "$branch"
fiYou'll need jq (brew install jq). Use an external script like this rather than inline. Trust me, it's way easier to tweak.
Why Bother
Once that percentage is always visible, you start making better calls. You see what's expensive (tool call chains are hungry). You break sessions at clean points instead of pushing until things degrade. You start thinking about sub-agents to keep the main context lean. You tell the agent to file away progress before starting fresh.
For the full details, check out the official status line documentation.
It's a tiny change that takes your agentic engineering beyond vibes. And vibes, as a strategy, are terrible.
Stay in the loop
Get new posts delivered to your inbox. No spam, unsubscribe anytime.