Expand description
The context bar: how much of the model’s window the last prompt took, drawn the same way wherever it is read.
Three surfaces show this number — the line under the composer, the full-screen read-out, and the
dashboard’s stats row — and they had three arithmetics. The dashboard’s was the one that was
wrong: its denominator was the compaction rail because that was the only number the stats event
carried, so ctx 12.3K/279K was saying the prompt was 4% of a number the model had never been
told, and the rail’s own share of the window was drawn nowhere.
So the shape lives here, and a surface only chooses a width and a colour. That is the whole point: a bar whose denominator differs per screen is a bar two screens can disagree about.
Structs§
- Pieces
- One read-out, in the pieces a surface needs to colour it.
- Reading
- One reading of the context bar: what was used, out of what, with the tripwire where the compaction policy puts it.
Constants§
- MARKER
- The column where compaction begins.
│is one cell wide in a monospaced terminal and reads as a tripwire even where there is no colour at all. - PAST_
MARKER - The fill once it has reached the marker: the “living on borrowed time” zone. A shape rather
than a colour, so it survives a pipe, a
--no-colorrun, and a screenshot.
Functions§
- bar
- A proportional bar.
widthcells; the fill is clamped, so an over-budget prompt shows a full bar rather than a panic or a negative count. - bar_
marked - A bar whose denominator is the whole window, with the compaction threshold marked as one
column.
shareandmarkerare both shares of that window;markeroutside(0, 1)is not a tripwire (0is off,1is the hard limit the bar’s own end already is) and the bar falls back to being unmarked. - short_
tokens 1234→1.2K,1234567→1.2M. One decimal below 100 units, none above, so the numbers stop changing width on every turn.