statuslin.es

Context Burn Bar

A minimal 5-slot block bar showing context-window usage with a green/yellow/red status dot.

MIT licensed · original source

Updated 2026-06-29

0 copies

Preview

Clean repo
5h ▓░░░░ 🟢
New session
5h ░░░░░ 🟢
Dirty branch
5h ▓▓░░░ 🟢
Near-full
5h ▓▓▓▓▓ 🔴
1M context
5h ▓▓▓░░ 🟡
Post-compact
5h ░░░░░ 🟢
Worktree
5h ▓▓░░░ 🟢
Non-git
5h ▓░░░░ 🟢

Source

#!/bin/bash
# Claude Code context-window status bar.
# Reads the Claude Code status line JSON from STDIN and renders
# a compact 5-slot bar for the context window (5h) usage.

set -euo pipefail

input=$(cat)

PCT=$(echo "$input" | jq -r '.context_window.used_percentage // 0' | cut -d. -f1)

# Build a 5-slot progress bar: each slot = 20%.
filled=$(( (PCT + 10) / 20 ))
[ "$filled" -gt 5 ] && filled=5
bar=""
for i in 1 2 3 4 5; do
  if [ "$i" -le "$filled" ]; then
    bar="${bar}▓"
  else
    bar="${bar}░"
  fi
done

# Icon: green <50%, yellow 50-90%, red 90%+
if [ "$PCT" -ge 90 ]; then
  icon="🔴"
elif [ "$PCT" -ge 50 ]; then
  icon="🟡"
else
  icon="🟢"
fi

printf "5h %s %s\n" "$bar" "$icon"

What it shows

  • Context window usage as a five-slot block bar, one filled block per roughly 20% used
  • A traffic-light dot for context usage: green under 50%, yellow from 50%, red from 90%
  • A fixed '5h' text label at the start of the line

Requirements

  • bash
  • jq, used to parse the status line JSON from stdin
  • cut, used to strip decimals from the percentage
  • A terminal font that renders the block characters and the colored circle emoji
  • No network access; the script declares no network hosts and makes no network calls

Behavior notes

  • Only context_window.used_percentage changes the output; model, git repo, worktree, vim mode, PR state, cost, and rate limits are ignored and every scenario prints the same single-line format
  • Blocks fill by rounding to the nearest 20%: 22% shows one block, 37% and 48% show two, 64% shows three, 91% shows all five
  • The dot turns yellow at 64% usage and red at 91%; it stays green at 48% and below
  • When used_percentage is null or missing (brand-new session, just after /compact), the jq fallback treats it as 0, printing an empty bar with a green dot and still exiting 0
  • Despite the '5h' label, the bar tracks context-window usage, not the 5-hour rate limit: the post-/compact scenario had the 5-hour limit at 52% but printed an empty bar because context usage was null

More status lines

Dreambase Panel

150 copies

╭─ CONTEXT ────────────────────────────────────────────╮ ████▊░░░░░░░░░░░░░░░░░ 22% of 200K · GOOD ├─ STATS ──────────────────────────────────────────────┤ 44.0K 1.4K $0.41 ⏱ 10m 12s +128/-34 ├─ REPO ───────────────────────────────────────────────┤ Opus 4.8 · main · 16:21 ╰──────────────────────────────────────────────────────╯
app · main · Opus-4.8 · effort high · ctx 22% · 5h 26% ↻2h6m · 7d 7% ↻2d0h
Opus 4.8 [high] ~/app main 16:20:55 | ⛁ ██░░░░░░░░ 22% | 5h ●◔○○○ 26% ↻2h7m | 7d ◔○○○○○○ 7% ↻2d1h │ $0.41 ⏱ 10m
Opus 4.8 main app 44k/200k $0.41

Activity Feed

36 copies

Opus 4.8 high ctx 22% app (main) PR #1287 $0.41 · 10m +128 -34 Session 74% left Resets in 2h 6m Weekly 93% left Resets in 2d 0h Fable 85% left Resets in 2d 0h ◐ Read:index.ts ✓ Read×1 ✓ Bash×1 ✓ Edit×1 ✓ Grep×1 ◐ code-reviewer Review the change for regressions
████▊░░░░░░░░░░░░░░░░░ 22% of 200K · GOOD 44.0K 1.4K $0.41 ⏱ 10m 12s +128/-34 Opus 4.8 · main · 16:22