myUdav4iik/claude-mods/tree/main/context-bar

A Claude Code plugin that draws a live context-window breakdown bar in the band above the prompt, showing category usage, a compaction threshold indicator, and rate-limit windows, toggled with /context-bar.
myUdav4iik/claude-mods/tree/main/context-bar

context-bar is a Claude Code mod that renders a live breakdown of the context window in the band above the prompt. Its header shows the share of the window in use as a colour-coded badge (green under 50%, yellow under 80%, red above), the tokens in use, the window size, and where auto-compaction runs. The bar gives one segment per category proportional to its share, followed by a free-space track, and a legend lists each category with its token count in the colours /context uses. An optional usage row shows the plan's rate-limit windows (5h, 7d, or a gateway spend limit) with share used and reset countdown, appearing only on subscriptions. It is toggled with /context-bar, /context-bar on and /context-bar off, and the choice persists across sessions. Hooks used: session.start (registration, restoring state, first reading, countdown timer), turn.complete (reading after each main-conversation turn, skipping subagents), session.compact (reading after compaction), session.measure (updating usage between turns), and ui.render on AbovePrompt (drawing the band, stepping aside for surveys). Readings come from $.session.usage({ breakdown: 'summary' }), which estimates locally and sends no requests. The bar uses flex boxes so it splits in exact proportion and never wraps, with free space drawn as a dim line in the terminal and a dark fill in the desktop app. Known limitations include estimated category figures, once-per-turn updates, stale usage percentages until the next API response, a placeholder before the first reading, and sharing the band with other mods. Tests live in tests/bar.test.tsx and can be run with claude plugin test ..
Check the author's README for the marketplace and plugin name first. Commands may change as the repository evolves.
claude plugin marketplace add myUdav4iik/claude-mods claude plugin install context-bar
A live breakdown of the context window, drawn in the band above Claude Code's prompt.
In the terminal:

In the desktop app:

/context uses.5h, 7d, or a gateway's spend limit), each with the share used, coloured like the context badge, and a countdown to when it resets. The row only appears on a subscription, where Claude Code receives these figures.| Command | Does |
| --- | --- |
| /context-bar | Shows or hides the bar |
| /context-bar on | Shows the bar |
| /context-bar off | Hides the bar |
The command runs at once, even while Claude is working. The choice is remembered across sessions. Claude Code's own [-] control on the band collapses it as well.
| Hook | What it does |
| --- | --- |
| session.start | Registers /context-bar, restores the saved on/off choice, takes a first reading, and starts a once-a-minute timer for the reset countdowns. |
| turn.complete | Takes a reading after each turn of the main conversation. Subagent turns are skipped. |
| session.compact | Takes a reading after the conversation is compacted. |
| session.measure | Updates the usage row when a rate-limit window moves, between turns too. |
| ui.render on AbovePrompt | Draws the band. It steps aside while Claude Code shows a survey there. |
Readings come from $.session.usage({ breakdown: 'summary' }), the same per-category breakdown /context shows. The summary mode estimates locally, so a reading sends no requests and costs nothing. The same call returns the rate-limit windows from the last API response; the usage row shows those, so it sends no requests either.
The bar is built from flex boxes, each growing by its share of the window, so it splits in exact proportion at any width and never wraps. Small categories still get at least one cell. Free space is drawn differently per surface:
The compaction reserve is drawn as part of the free track; the header shows where compaction runs.
/context, so the total can differ slightly from the status line.tests/bar.test.tsx feeds the mod a sample breakdown, draws the band on the terminal and desktop surfaces, and fails if either surface refuses the drawing. Claude Code drops a drawing it can't validate without an error you'd see, so run the tests after changing how the bar is drawn:
claude plugin test .