Skip to content

Detail a hovered token-meter column as bars per model - #1217

Merged
edwin-zvs merged 2 commits into
mainfrom
token-hover-bars
Aug 5, 2026
Merged

Detail a hovered token-meter column as bars per model#1217
edwin-zvs merged 2 commits into
mainfrom
token-hover-bars

Conversation

@edwin-zvs

@edwin-zvs edwin-zvs commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

What

Hovering a token-meter column used to list its models as one line of comma-separated figures. A column is a stack, and the question asked of it — what was this mostly, and how much of it was real work — is about proportion, so the division was left to the eye; past two models the line read as a run of text with no shape.

The detail is now a small panel: the span and the column's total, then one row per model — name, a horizontal bar of that model's share, and the exact figures.

┌──────────────────────────────────────────────────────────┐
│ 1m · 24k tok                                             │
│ ● claude-opus-5   ▓▓▓▓▓▓▓███████████     18k · 9.0k cached │
│ ● gpt-5.5         █████                               6.0k │
└──────────────────────────────────────────────────────────┘

( = the model's darker cache-served tone, = full-strength fresh. Both are painted as cell backgrounds, so in a text dump the bars are invisible — the sketch above stands in for them.)

Design notes

  • Same tones and order as the graph. One hue per model, cache-served part darker at the bar's start, fresh part full-strength after it. Rows follow series order — the order the column stacks them and the legend names them — so a row's position matches its band.
  • Whole cells, so the bar stays square. The bars deliberately do not inherit the column's sub-cell resolution. A column is a few cells tall and buys precision by topping out on a partial block glyph, against empty background where the glyph's leading doesn't show. In a bar, that glyph would sit beside background-filled cells, and a font that draws it short of the line box (Paint solid token-meter cells as background, not as a block glyph #1183) notches the bar's corner. Every cell of a bar is a background fill; largest-remainder apportionment keeps the parts summing to exactly the bar's length and keeps a band with volume from rounding away.
  • Bars answer proportion, figures answer amount. Shares scale to the hovered column's own total; a model that did any work keeps at least one cell. Cached stays a named subset, never summed (spec 0167) — spelled out as the word cached rather than a glyph, since a symbol has to be learned and a borrowed one (a refresh arrow) actively misleads.
  • Narrow terminals. Below a bar length whose cells can still separate one share from another, the old text detail renders instead of a stub bar that would misstate every share.
  • Project pane parity. The project dashboard's meter had no hover detail at all. It now records its graph rect and shares this renderer — scoping the meter changes which sessions are counted, not what the graph means.

token_meter gains only split_units, the largest-remainder split shared by the column's eighths and the bar's cells; column_cells / band_cell are untouched.

Specs

  • specs/0167-fleet-token-meter.md — new "The hover detail restates the column as bars" section (including why resolution legitimately differs between the two orientations), plus consequences and examples.
  • specs/0191-project-dashboard-pane.md — the project meter hovers like the fleet meter.

Tests

  • token_meter: split_units hands out whole cells exactly and never starves a band with volume; stacked_eighths is the same split at eighth resolution.
  • ui: figures name cached as a subset in words; layout gives the bar the slack and never clips names/figures for it; declines a too-narrow terminal; header widens the box; segments split into whole cells cached-first, keep a tiny share visible, and omit a zero-volume part.
  • app: end-to-end — hover the newest column, then assert the header total, the per-row figures, and that the opus row painted exactly 15 contiguous background-filled cells (18k of 24k over 20) in two tones, with no glyph anywhere in the bar.
  • project_dashboard: the meter records its graph rect only on frames that draw columns (and clears it otherwise, so a stale rect can't answer hovers over whatever replaced it).

construct suite: 1382 pass. One pty_render wall-clock perf threshold (smith_tool_expand_collapse_rebuilds_only_retained_suffix) fails on this machine under parallel load — it fails identically on unmodified main, and that file isn't touched here. No new rustfmt or clippy findings.

Binary

Only crates/cli changed → the relevant binary is construct:
/Users/moon/construct/.claude/worktrees/token-hover-bars/target/debug/construct

🤖 Generated with Claude Code

Hovering a meter column listed its models as one line of comma-separated
figures. A column is a stack, and the questions asked of it — what was
this mostly, how much of it was real work — are about proportion, so the
division was left to be done by eye; past two models the line read as a
run of text with no shape at all.

The detail is now a small panel: the span and the column's total, then
one row per model with its name, a horizontal bar of that model's share,
and its exact figures (cache-served volume marked as the subset it is).
The bars are the column's own paint laid along a row instead of up one —
one hue per model, the cache-served part in the darker tone at the bar's
start, boundaries carried at eighth resolution — so the detail describes
the graph under the pointer rather than a second vocabulary for it.

Rows follow series order, the order the column stacks them and the
legend names them, so a row's position matches its band. Bars scale to
the hovered column's total, and a model that did any work keeps a
visible bar however small its share. A terminal too narrow for a bar
that would still separate a tenth from a fifth falls back to the
previous text detail rather than drawing a stub bar.

The project dashboard's meter had no hover detail at all; it now records
its graph rect and shares this one renderer, since scoping the meter to
a project changes which sessions are counted, not what the graph means.

Column paint gains a horizontal axis (`bar_cells`) rather than a second
implementation: same eighth arithmetic and the same fg-over-bg encoding
for a boundary inside a cell, only the glyph table differs.
Two fixes to the hover detail.

The cached figure was marked with `↺`, which reads as "refresh" and has
to be learned before the row can be read. It now says the word: `18k ·
9.0k cached`. The box was already sized from its rows, so it just gets
wider.

The bars ended on a partial block glyph, inherited from the column paint.
That cost a square edge: cells a band fills outright are painted as
background, and a foreground block beside them is only drawn where the
font puts ink — a font that draws it short of the line box (#1183)
notches the bar's corner, which reads as damage rather than precision.
Bars now spend whole cells only, every one a background fill, so the
rectangle is clean on any font. Largest-remainder apportionment keeps the
cached and fresh parts summing to exactly the bar's length and keeps a
band with volume from rounding away.

A column still needs its eighths — it is a few cells tall and buys
resolution there, against empty background where the glyph's leading
doesn't show. A twenty-cell bar doesn't need them, so the horizontal axis
machinery added for it is gone again; what remains of the sharing is
`split_units`, the largest-remainder split both resolutions use.
@edwin-zvs
edwin-zvs merged commit 4335e0f into main Aug 5, 2026
1 check passed
@edwin-zvs
edwin-zvs deleted the token-hover-bars branch August 5, 2026 05:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant