Mischa Sigtermans

Thoughts
· AI Open Source

How I set up my Claude Code status line

I built a custom Claude Code status line that shows git info, context usage, and turns red at 80%. Here's my setup and why each piece matters.

How I set up my Claude Code status line

We're all spending more time with AI than ever. Lately I'm almost living with Claude Code, jumping between four to six projects on any given day. Stagent features, Ryde Ventures products, side projects, this blog.

AI makes us efficient. But efficiency means nothing if you lose track of where you are. Which repo am I in? How much context have I burned through? Do I have uncommitted work?

So I built a custom status line that helps me stay oriented. Nothing fancy. Just the information I actually need.

What I actually need to see

My status line shows four pieces of information:

stagent · development · 14 · 42%

That is: repo name, git branch, uncommitted changes, and context window percentage. Plain text. No colors except when the context hits 20%, then it turns Claude Orange.

I prefer things simple. No emojis. No powerline arrows. No fancy themes. Less is more.

The problem with defaults

Claude Code does not prominently display context usage during a session. You can check it manually, but by the time you think to look, you might already be at 90%. And when context fills up, AI quality degrades. Responses get worse. The model starts forgetting earlier parts of your conversation.

I also jump between repositories constantly. Without visual confirmation, it's easy to lose track of where you are and what state your work is in.

The uncommitted changes count solves a different problem. It's a gentle reminder before I close a session or switch context. If that number isn't zero, I have work that isn't saved to git yet.

The setup

My configuration uses a wrapper pattern: one main script that combines two sources of information. The wrapper uses ccstatusline for context percentage. The npx command handles installation automatically, so no setup needed there.

Create the wrapper script at ~/.claude/statusline-wrapper.sh:

#!/bin/bash

input=$(cat)
git_info=$(echo "$input" | bash ~/.claude/statusline-command.sh)
context_pct=$(echo "$input" | npx ccstatusline 2>/dev/null | sed 's/\x1b\[[0-9;]*m//g; s/ //g; s/%//')
pct_num=${context_pct%%.*}

if [[ $pct_num =~ ^[0-9]+$ ]] && (( pct_num >= 80 )); then
  context_display=$'\033[1;38;2;204;139;137m'"${pct_num}%"$'\033[0m'
else
  context_display="${pct_num}%"
fi

printf '%s · %s' "$git_info" "$context_display"

Then the git info script at ~/.claude/statusline-command.sh:

#!/bin/bash

input=$(cat)
cwd=$(echo "$input" | sed -n 's/.*"current_dir":"\([^"]*\)".*/\1/p')
cwd_display=${cwd/#$HOME/\~}

if git -C "$cwd" rev-parse --git-dir &>/dev/null; then
  repo_name=${cwd##*/}
  branch=$(git -C "$cwd" --no-optional-locks symbolic-ref --short HEAD 2>/dev/null) || \
  branch=$(git -C "$cwd" --no-optional-locks rev-parse --short HEAD 2>/dev/null)
  uncommitted=$(git -C "$cwd" --no-optional-locks status --porcelain 2>/dev/null | wc -l)

  if (( uncommitted > 0 )); then
    printf '%s · %s · %d↑' "$repo_name" "$branch" "$uncommitted"
  else
    printf '%s · %s' "$repo_name" "$branch"
  fi
else
  printf '%s' "$cwd_display"
fi

Make both scripts executable with chmod +x ~/.claude/statusline-*.sh.

Finally, add the status line to your Claude Code settings at ~/.claude/settings.json:

{
  "statusLine": {
    "type": "command",
    "command": "bash ~/.claude/statusline-wrapper.sh"
  }
}

Why the 80% threshold

The context window matters more than most people realize. Claude Code reserves roughly 40k tokens as a buffer, and auto-compact triggers when you hit that threshold. But by the time auto-compact runs, the AI has already been struggling with a full context for several exchanges.

I found 80% to be a good warning point. When the number turns red, I know to either compact the conversation or start fresh. This simple visual cue has saved me from plenty of degraded responses.

What you can display

My setup is intentionally minimal. But the status line can show almost anything. Claude Code passes a JSON object to your script with session data, and you can pull in external information from git, system commands, or anything else your shell can access.

Here is everything available to you:

Session data

Field Example Access
Model name Opus 4.5 model.display_name
Context % 42.5% context_window.used_percentage
Context remaining 57.5% context_window.remaining_percentage
Tokens used 85,000 context_window.total_input_tokens
Tokens remaining 115,000 context_window_size - used
Context window size 200k context_window.context_window_size
Session cost $1.42 cost.total_cost_usd
Session duration 14m cost.total_duration_ms
API time 8m cost.total_api_duration_ms
Lines added +142 cost.total_lines_added
Lines removed -38 cost.total_lines_removed
Net lines +104 added - removed
Claude version 2.1.7 version
Project dir stagent workspace.project_dir
Current dir /Users/... workspace.current_dir

Git info

Field Example How
Repo name stagent basename of cwd
Branch main git symbolic-ref
Uncommitted files 24 changes git status --porcelain
Staged files 3 staged git diff --cached
Unstaged files 12 modified git diff
Untracked files 5 new git ls-files --others
Ahead/behind 2 ahead, 3 behind git rev-list --count
Last commit 2h ago git log -1 --format=%cr
Stash count 3 stashes git stash list
Tag v1.2.3 git describe --tags

System info

Field Example How
Time 14:32 date
Hostname macbook hostname
User mischa whoami
Node version v20.1 node -v
PHP version 8.4 php -v
Python version 3.12 python --version
Battery 87% pmset -g batt

Some setups to inspire you

With all this data, you can build a status line that fits exactly how you work:

Minimal - just the essentials:

stagent · main · 12%

Cost-conscious - track what you're spending:

Opus · $1.42 · +142/-38 lines · 45%

Git-heavy - for complex branching workflows:

stagent · feat/billing · 2 ahead, 1 behind · 3 staged · 12%

Time-aware - know how long you've been at it:

14:32 · stagent · main · 8m active · 25%

You can add threshold colors that change at certain percentages, use icons if your terminal supports them, or go full powerline with arrow separators.

Tools like ccstatusline offer multi-line support, powerline themes, and an interactive configuration UI. The official documentation has the complete JSON schema if you want to go deep.

I just prefer plain.

The philosophy

This connects to how I think about building products. Functionality first. Ship what works. Add complexity only when you actually need it.

I wrote about this same principle in the context of AI coding with sub-agents: the goal is code that is 'simple and disposable and easy to change'. The same applies to tooling. My status line does exactly what I need. When I need it to do more, I will add more.

For now, four pieces of information and one color change is enough.

thanks for reading

Hi, I'm Mischa. I've been Shipping products and building ventures for over a decade. First exit at 25, second at 30. Now Partner & CPO at Ryde Ventures, an AI venture studio in Amsterdam. Currently shipping Stagent and Onoma. Based in Hong Kong. I write about what I learn along the way.

Keep reading: Launching Onoma alpha: building AI memory that actually works.

Thoughts