Report the context a session holds, not what it has spent
The number on the status row was a running total of tokens spent, so it could only ever climb: a session compacted from 128k down to 10k, or cleared outright, went on reporting the larger figure, and disagreed with the divider directly above it saying what the compaction had recovered. It now reports what the model is holding -- prompt plus both cache figures -- folded through `driver::context_after`, which is the one rule the pump, the transcript and the phone all use: a turn sets it, a compaction replaces it with what the compaction measured, and a clear leaves it unmeasured. Unmeasured says so in words, because an empty context and one nobody has counted used to look identical. Taken from the turn's last assistant message rather than its `result`: measured against CLI 2.1.237, a two-message turn reported a cache read of 40,211, being 14,259 and 25,952 -- the same conversation counted twice, and no size the model ever held.
This commit is contained in:
1 parent
81c8a57181
commit
5e11b9da80
12 files changed
+442
-130
No files matched your search
@@ -181,8 +181,18 @@ it touches the transcript or the phone:
|
||||
not just the one that answered (added 2026-08-24, same reasoning as
|
||||
`UserMessage`).
|
||||
- `Status { state }` — idle / running / awaiting-input / compacting / exited.
|
||||
- `UsageDelta { tokens }` — per-turn token counts where the dialect reports
|
||||
them (both do).
|
||||
- `UsageDelta { tokens, context }` — what a turn cost, and how much the
|
||||
model was holding when it ended, where the dialect reports them (both do).
|
||||
`context` is prompt plus both cache figures, taken from the **last
|
||||
assistant message** rather than the turn's `result`: measured 2026-08-30
|
||||
against CLI 2.1.237, the result adds a turn's messages up, so its cache
|
||||
read of 40,211 was the same conversation counted twice and no size the
|
||||
model ever held. It is carried rather than summed by readers because it
|
||||
goes *down* — a compaction replaces it with what the compaction reports,
|
||||
and a clear leaves it unmeasured. `driver::context_after` is that rule,
|
||||
and the phone folds with the same one (2026-08-30: this replaced a running
|
||||
spend total, which could only climb and so kept reporting a context a
|
||||
compaction or a clear had already taken away).
|
||||
- `Error { message }`.
|
||||
|
||||
Every event is appended to the session's transcript file with a sequence
|
||||
@@ -611,7 +621,9 @@ dev-updater (Kotlin 2.4.x, CMP 1.11.x, JDK 21). Screens:
|
||||
- Input bar: text, attach (camera/gallery/file), send — **always enabled**;
|
||||
mid-run sends become steering messages.
|
||||
- Top bar: model chip (tap to change), stop button while running, token
|
||||
count, compact button (llama), overflow → delete.
|
||||
count, compact button (llama), overflow → delete. (The count settled as
|
||||
context held rather than tokens spent, and sits on the status row under
|
||||
the transcript — see `UsageDelta` above.)
|
||||
4. **Usage** — window bars for the 5-hour and weekly limits with reset times.
|
||||
5. **Settings** — server address + token, hosts editor, llama model list
|
||||
editor.
|
||||
|
||||
Reference in new issue
Block a user