app: redesign the panel and add limit forecasts and daily week use (#6)

Redesign the stats panel after the developer's feedback on v1 and add
limit forecasts, daily week use and token-based estimates (D7, D8).

- Panel: a fixed header with range and provider controls, limit tiles
  with pace chips, meters and forecasts, week use per day, token KPIs
  and charts, one burn-up chart per limit window with past instances,
  and a sortable breakdown whose "Other" row expands. One tooltip
  component for every chart, tile and table.
- Core (D7): average and recent-rate forecasts, the reach date whenever
  use is over pace, days of a long window with even pace and daily
  budget, window instances derived from resets with a 15-minute
  tolerance, and estimates from price-weighted tokens where samples are
  missing. Forecasts start at 10 % of a window, or as soon as it is
  ahead, so a Codex week far ahead right after its reset warns too.
- Settings, popups and the version (1.1.0) follow the new design.

Closes #5
Closes #7
This commit was merged in pull request #6.
This commit is contained in:
2026-10-15 19:06:04 +02:00
parent f8afd11679
commit adb8f5b88d
31 changed files with 2461 additions and 246 deletions
+63 -5
View File
@@ -149,15 +149,62 @@ probe.
- expected use `100·e`, pace delta `d = u − 100·e` in percentage points
- **ahead** when `d ≥ +threshold`; **behind** when `d ≤ −threshold` and `e ≥ 0.5`; **on track**
otherwise. The threshold defaults to 10 points and is a setting.
- when ahead, the projected time of reaching 100 % at the average rate so far,
`t + (100 − u) · e·W / u`, shown only if it comes before `r`.
- **Forecasts.** At the average rate so far, the use at reset is `u / e` (for `e > 0`). Whenever
that passes 100 % (that is, `d > 0`, whatever the threshold), the time of reaching 100 %,
`t + (100 − u) · e·W / u`, is shown; it always comes before `r`. A second forecast uses the
recent rate: the rise of `u` over the window's samples from the last 24 h, when they span at
least 3 h. It is shown beside the average forecast, never instead of it. Forecasts start once
10 % of the window has passed (30 min of a session, about 17 h of a week), or as soon as the
window is ahead. Before either, one hour at 1 % already "reaches" 100 % within days, which is
noise. Until forecasts start, the tile and the window chart say when they will.
- **Window instance.** The samples of one window whose reset times lie within 15 minutes of each
other. Claude reports resets to the minute and drifts by a minute between probes ("8pm", then
"7:59pm"), so exact equality would split one week. A reset starts a new instance at 0 %.
- **Days of a long window.** For a window longer than a day: today's use is `u` now minus `u` at
the local start of today (the last sample of the same instance at or before it, or 0 when the
instance began today). The use of each local day of the instance is computed the same way.
The even pace per day is `100 · 1 d / W`. The daily budget is `(100 − u)` divided by the days
left until `r`. A 7-day instance that resets at another time than midnight touches 8 local
dates; the first and the last are partial days and both are shown.
- **Estimates from tokens.** Where samples do not cover a span, its use is estimated from the
token history. Tokens are weighted by the provider's API price ratios: Claude input 1,
output 5, cache write 1.25, cache read 0.1; Codex uncached input 1, cached input 0.1,
output 8. A window whose label names a model family ("Fable") counts only that family's
models; any other window counts all of the provider's models. Because an instance starts at
0 %, the scale `k = u / (weighted tokens from the instance start to the sample)` turns weighted
tokens into percent of the limit; the newest sample gives `k`. A day, or a stretch of the
window chart, then uses samples where they exist at both ends, and `k` × its weighted tokens
where they do not. A finished instance uses its own last sample for `k` when it has one, else
the current `k`. Estimates are always marked as estimates and never exceed 100 %: a limit that
is reached stops use, so an estimate that would pass it shows "limit reached (estimated)" at
the time it crosses. No tokens in the instance means no estimate. Instance boundaries come from
resets: an instance starts at its reset minus its length, and ends at its reset or at the next
instance's start, whichever comes first (Codex can start a new window early). Spans between
instances (a session window opens only with the next message) belong to none. A past instance
with samples is always the real one; an instance is only inferred where no samples exist, by
stepping back one window length, and never overlaps a real one. Windows of a day or shorter are
never inferred, since a session starts with whatever message comes next. Past instances are
labelled with their real start and end.
A window without a known length or reset has no pace; FinalToken never guesses one.
A window without a known length or reset has no pace; FinalToken never guesses one; an estimate
is a marked calculation from measured tokens, not a guess.
**Why.** R5. A straight line from the window's start to its reset is a pace the user can check
by hand.
by hand. A user over pace by less than the threshold still runs out before the reset, so the
date shows from the first point over pace. The day figures answer "how much of the week did I
use today" and "how much may I use per day from now on" (developer feedback, 2026-10-14).
Measured samples alone left the day chart empty until the app had run for a whole week, while the
token history already covers it; the estimate fills it at once and agrees with the measured use
of the instance by construction (developer feedback, 2026-10-15). A window that is ahead in
its first 10 % is no noise: a Codex week at 39 % ten hours after its reset reaches 100 % within
a day, and that is the warning the user needs (developer feedback, 2026-10-15).
**Gives up.** Weekday and working-hour patterns.
**Gives up.** Weekday and working-hour patterns. Forecasts assume a constant rate; early in a
window, a burst that puts it ahead gives a reach date that a quiet hour moves out again.
Measured day figures are only as fine as the samples (D5 keeps one per hour while the value
stands still). Estimates miss use from other devices and from claude.ai or the web, which
counts against the limit but leaves no local tokens; they also miss changes in model mix within
an instance and any weighting the provider applies beyond the price ratios.
## D8 — Desktop app
@@ -173,6 +220,17 @@ by hand.
The tray icon offers Open, Refresh now, Settings and Quit. Closing the window keeps the app
running in the tray. Starting the app opens the stats panel (R4). Start with the OS is an
opt-in setting.
- **Panel (R4).** It leads with one tile per limit window: used percent, pace, the forecasts of
[D7](#d7--pace) and, for windows longer than a day, today's use and the daily budget. Then
follow the per-day use of the long windows, token totals and charts, one window chart per limit
window, and the top entries by model and by project, with the rest folded into an expandable
"Other". A window chart is a burn-up of one instance from its start to its reset: the used
percent as a line (measured, or estimated before the first sample), the even-pace diagonal
from 0 % to 100 %, the forecast to the reset and the previous instance faintly behind, with no
point markers; under it, the peak each past instance reached. Tooltips are one component: a
title and a label/value grid. Diagnostics are collapsed. Provider colours are fixed (Claude orange, Codex blue, validated for colour vision
deficiency on both themes). Pace states use status colours with an icon and a label, never
colour alone.
- **Popups (R5).** A small borderless, topmost window that does not take focus, at the
bottom right of the primary screen's work area. It goes away after 8 s or on a click; a click
opens the stats panel. A popup shows when a window's pace state ([D7](#d7--pace)) changes to