Show output tokens separately from context in agent turns
Fix turn token accounting
Leo described the working line as:
“Also in this bottom section, when you guys, like it's posting, like however many tokens you're using or whatever. I'm, like, I am pretty sure you guys should be doing it, like... It's output tokens, typically speaking, not input tokens. Like you can still have it, but just separate out the output tokens.”
“Although, to be honest, I don't know if those token numbers are really accurate. I feel like there's— it's just too much accumulated stuff. I feel like your context window doesn't even fill that fast.”
The pane previously added usage_update.used for every marked model call. Claude's stdio adapter populated used as input_tokens + cache_read_input_tokens + cache_creation_input_tokens + output_tokens, so a five-step turn that reread 100K of context on every step displayed about 505K. The result repeats the last context usage for the context ring and is unmarked, but the marked calls still re-added their context.
This change keeps the last call's prompt-side total (input + cache read + cache write) as the context-window used value, emits the individual call fields, and sums only outputTokens into the running line. The line now reads · 5K out; input/cache remain available through the context card and are never folded into output. No per-token or per-row scan was added.
Validation
- Red/green regression: a fake five-step turn (100K prompt/context each, 1K output each) reports
5K, not505K. - Focused web tests: 38 passing locally;
node scripts/pages/gen-strings.mjs --check agent-pane; Rust formatting check passed. - Native context-window tests now assert prompt-side usage (4,200 for the public 1,200 input + 3,000 cache-read fixture).
Gallery
Gallery: agent-session/acpmux/conversation/transcript.gallery.ts#working-tokens
Before/after gallery capture run and its gallery-advisory-25118-233729cd4efb1e21ec73e0beb82b9e632e54901b artifact provide the public fixture frames.
Direct artifact: gallery-advisory-25118-233729cd4efb1e21ec73e0beb82b9e632e54901b.zip.
agent-session/acpmux/conversation/transcript.gallery.ts, entry working-tokens (public fixture). Gallery CI should capture before/after in light and dark themes; the before frame shows the old tokens label/accumulated value and the after frame shows the output-only out label. No private Leo screenshots or references are used.
Agent-Session: big-red