thiagowfx's avatar

Β¬ just serendipity πŸ€ (not just serendipity)

Claude Code: add context window % to status line

β€’ 122 words β€’ 1 min β€’ updated

Claude code now officially supports showing context window information like percentage of usage in status line (via Ashik Nesin):

> /statusline Add a progress bar showing the percentage of context currently used

⏺ statusline-setup(Configure statusline progress bar)
  ⎿  Done (3 tool uses · 7.4k tokens · 44s)

⏺ I've configured your statusline to include a context usage progress bar. Your status line will now show something like:

  .claude (git:main) [Claude 3.5 Sonnet] [β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘ 60%]

  The progress bar displays:
  - Filled blocks (β–ˆ) for used context
  - Empty blocks (β–‘) for remaining context
  - Percentage showing exact usage

  The context calculation includes input tokens, cache creation tokens, and cache read tokens relative to the total context window size.

My updated .claude/statusline.sh.

The diff.