Context Meter

Know when to /compact a Claude Code session

·

source at a2babd9

·

MIT license

The session's context window fill, right above the prompt: gray while there is room, yellow when it is time to /compact, red when a new session is better.

What this mod can do

  • Reviewed at commit a2babd9
1 thing it can do
  • Runs on a timer
Good to know (3)
  • Change the 50% and 75% thresholds with the warnAt and dangerAt settings in /config
  • Before the first response, and after a compaction or rewind, it shows an estimate marked ~
  • The footer is left as it is, and anything else drawn above the prompt stays above the meter
Are mods safe?

Preview

Terminal

context 22% [-]

Claude Desktop

Context Meter in Claude Desktop

What it does

A small context 58% readout at the right end above the prompt, gray, yellow or red, so you know when to /compact without typing /context.

What you see
A context N% readout at the right end above the prompt
Works in
Terminal and Claude Desktop
Slash commands
None
Uses your tokens
No
Changes files
Nothing
Network access
None
Reviewed commit
a2babd9
Preview recorded with
Claude Code 2.1.296

How it works

  1. Takes a first reading from $.session.usage() when the session starts
  2. Updates from context.percent after each response that moves it
  3. Rereads usage every 2 seconds, since a resume or rewind raises no event
  4. Draws context N% above the prompt: gray, yellow from 50%, red from 75%

Common questions

How do I see context window usage in Claude Code?

The /context command counts it on demand. This mod keeps the figure on screen instead: context N% sits at the right end of the band above the prompt and updates after each response that changes it.

When should I run /compact in Claude Code?

This mod turns yellow from 50% full, which its README calls a good moment for /compact, and red from 75%, when it suggests compacting now or starting a new session. Both thresholds are the warnAt and dangerAt settings in /config.

Why does the meter show a ~ before the number?

Before the first response of a fresh or resumed session, and right after a compaction or a rewind, Claude Code has no reading yet. The meter counts the window once, as /context does, and marks that estimate with ~ until the next response brings the real figure.

More like this

· ↑ 37.0k ↓ 1.4k cache 7.0k · session ↑ 111.0k ↓ 4.2k

Each turn's tokens and the session's running total, in color at the end of the hint line under the prompt.

Token Weather Usage in Claude Desktop

One line above the prompt: context tokens with their weather, a bar per recent prompt, your 5-hour and 7-day limits against the time elapsed, the prompt cache with its time left, the session cost with the last prompt's share in dollars and in points of the 5-hour limit, and the subagents running. Labels in English, French or Russian. After Token Weather (Anthropic, Apache-2.0) and the ideas of usage-meter (HolyGrail) and prompt-cache-control (Daniel San).

⏵⏵ auto mode on · ← for agents 5h ━━━─────── 26% ↻ 2h 7m

Your subscription usage at the bottom right of Claude Code: the 5-hour and weekly windows, taking turns, side by side or fixed on one of them.

Deck in Claude Desktop

A cockpit for Claude Code: plan bars and subagent strips, context, usage limits with reset countdowns and burn rates, spend, the model route and a pet. Six bar styles, three collapsed looks. CLI and Desktop.

Opus 4.8 · ctx ● 22% · 5h ● 26% · 7d ● 7%

One short Python line: the model, then context, five-hour and seven-day usage, each as a percentage with a dot that shifts from green to red as it fills. No dependencies, no network calls.

╭─ CONTEXT ────────────────────────────────────────────╮ │ ████▊░░░░░░░░░░░░░░░░░ 22% of 200K · GOOD │ ├─ STATS ──────────────────────────────────────────────┤ │ ↓ 44.0K ↑ 1.4K │ $0.41 │ ⏱ 10m 12s │ +128/-34 │ ├─ REPO ───────────────────────────────────────────────┤ │ ◆ Opus 4.8 · main · 16:21 │ ╰──────────────────────────────────────────────────────╯

A boxed multi-line panel with auto-sizing borders: a context section with a gradient bar and status word, a stats section (tokens, cost, duration, lines changed), and a repo section (model, git branch with file counts, clock, vim mode), in a terracotta Claude-brand palette.

app · main · Opus-4.8 · effort high · ctx 22% · 5h 26% ↻2h6m · 7d 7% ↻2d0h

One-line status bar showing your directory, git branch (with a * when dirty), model, live effort level, context-window usage, and 5-hour/7-day rate-limit usage.