A Custom Two-Line Statusline for Claude Code
~/.bnux
February 27, 2026
I've been trying out Claude Code, and one thing that bugged me was not having a quick read on session state. Context window usage, session cost, current branch, that kind of thing.
Claude Code has a setting that lets you run a shell script and display the output at the bottom of the terminal. I put together a two-line statusline that gives me all of that at a glance:
What It Shows
Line 1: user@host, model name, current folder, git branch with a dirty indicator ( for uncommitted changes), and mode flags (, ) that only appear when you're in a non-default mode.
Line 2: A color-coded context window bar (green under 50%, yellow under 75%, red above) with token counts, background task count (only when tasks are running), conversation turn count, session cost, and elapsed time.
Everything conditional hides itself when there's nothing to show, so it stays clean during a simple session and surfaces more info as complexity grows.
How It Works
Claude Code's setting runs a shell script and pipes session data as JSON to stdin. The script parses it with , formats with ANSI colors, and prints two lines.
Add this to your :
Then create the script at and make it executable ().
The Script
One Gotcha
If your statusline shows up once and then disappears, check your calls. Using will break if the line contains (like from the context bar). Use instead. That one took me longer to figure out than I'd like to admit.
Resources
Claude Code Documentation
Claude Code Hooks
jq Manual
Discussion in the ATmosphere