-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Collapsible real-time session stats panel (tokens, context, API calls, premium requests, cache, duration) #1784
Copy link
Copy link
Open
Labels
area:context-memoryContext window, memory, compaction, checkpoints, and instruction loadingContext window, memory, compaction, checkpoints, and instruction loadingarea:sessionsSession management, resume, history, session picker, and session stateSession management, resume, history, session picker, and session state
Description
Describe the feature or problem you'd like to solve
There is currently no way to monitor session resource usage at a glance during an active session. To understand how much context has been consumed, how many API calls have been made, or how many premium requests have been used, a user must either wait for a crash/compaction or dig through logs after the fact. For power users, teams on metered plans, and anyone running long or expensive sessions, this lack of real-time visibility is a significant gap.
Proposed solution
Add an optional Session Stats panel — collapsible/expandable, togglable via config — that renders a live compact summary of resource and performance metrics for the current session.
Folded (compact, one-line):
📊 Stats ctx 68% ↑42k/↓18k tok 🕒 12m 34s calls 37 premium 8
Unfolded (expanded):
📊 Session Stats
Context 68% used (87,040 / 128,000 tokens)
Tokens sent 42,310
Tokens received 18,045
Cached tokens 11,200 (21% of sent)
API calls 37 total (28 standard · 8 premium · 1 cached)
Premium requests 8
Duration 12m 34s
Avg. turn time ~20s
Suggested stats to surface:
| Stat | Description |
|---|---|
| Context usage | Current fill % and absolute tokens vs. window size |
| Tokens sent | Cumulative input tokens for the session |
| Tokens received | Cumulative output tokens for the session |
| Cached tokens | Tokens served from prompt cache (where applicable) |
| API calls | Total LLM requests, broken down by standard / premium / cached |
| Premium requests | Count of premium-model calls against plan quota |
| Session duration | Wall-clock time since session start |
| Avg. turn time | Average time per agent turn |
Controls:
- Toggle fold/unfold: a dedicated keyboard shortcut (the specific key should avoid conflicts — e.g.
Ctrl+Ssends XOFF in some terminals and should not be used; a safe alternative such as a function key or a free modifier combo should be chosen) or by clicking the panel header - Opt-in via
config.json:{ "statsPanel": true } - Fully disabled by default to preserve a clean UI for new users; power users explicitly enable it.
- Stats persist and accumulate across compaction events so the total is always session-wide, not just the current context window.
Example prompts or workflows
- User on a metered Copilot plan monitors premium request count in real time — knows at a glance when they're approaching their quota before the session ends.
- Long refactor session running for 45 minutes: user glances at the folded one-liner to see context is at 72% and decides to manually
/compactbefore it auto-compacts. - User notices cached token % is low and adjusts their workflow to reuse more context, reducing cost.
- Team lead shares a screenshot of the expanded stats panel with their team to communicate session cost and complexity.
- User keeps the panel folded for minimal UI footprint — the single-line summary gives just enough signal without cluttering the screen.
Additional context
- OS: Windows 11 Pro (Build 26200 / 24H2)
- Shell: PowerShell 7.5.4
- Copilot CLI: 0.0.420 (win32-x64)
- The
/contextcommand already surfaces context usage — this panel extends that concept to a persistent, live, multi-metric view accessible without leaving the main session flow. - The collapsible panel pattern is already established in the TUI (checkpoints, MCP, context) — this fits the same model.
- Stats should survive context compaction and reflect true session totals, not just the current window's figures.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area:context-memoryContext window, memory, compaction, checkpoints, and instruction loadingContext window, memory, compaction, checkpoints, and instruction loadingarea:sessionsSession management, resume, history, session picker, and session stateSession management, resume, history, session picker, and session state
Type
Fields
Give feedbackNo fields configured for Feature.