Skip to content

Separate context window and session stats in sidebar#6313

Closed
R44VC0RP wants to merge 6 commits intoanomalyco:devfrom
R44VC0RP:feat/sidebar-session-stats
Closed

Separate context window and session stats in sidebar#6313
R44VC0RP wants to merge 6 commits intoanomalyco:devfrom
R44VC0RP:feat/sidebar-session-stats

Conversation

@R44VC0RP
Copy link
Collaborator

@R44VC0RP R44VC0RP commented Dec 28, 2025

Issue

On some /compact instances the session costs would be reset and the token count isn't ongoing which is nice for visuals.

Summary

  • Split the sidebar Context section into two: Context (current window) and Session (cumulative)
  • Context shows tokens and % used from the last assistant message (resets on compaction)
  • Session shows total tokens across all messages and cumulative spend (only increases)
  • Improves visibility into both current context usage and overall session costs
image

Changes

  • Added sessionTokens memo that sums tokens from all assistant messages
  • Moved spend to Session section alongside total tokens
  • Kept Context section focused on current LLM context window

Split the sidebar Context section to show current context window (tokens, % used) separately from Session stats (total tokens, spent). This allows users to see both the current LLM context size (which resets on compaction) and cumulative session usage at a glance.
@R44VC0RP R44VC0RP force-pushed the feat/sidebar-session-stats branch from 329df12 to 4507fd6 Compare December 28, 2025 20:23
- Session tokens now sums peak context size before each compaction
- Shows context limit alongside percentage (e.g. '25% used of 200k')
Sums tokens.input + tokens.output across all assistant messages,
which represents total tokens billed across all API calls.
Remove reasoning and cache tokens from context calculation since:
- reasoning tokens are internal to the model, not context window
- cache tokens are metadata about caching, not additional tokens
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