Add /context command to display session token usage #7563

Open
opened 2026-02-16 18:07:36 -05:00 by yindo · 1 comment
Owner

Originally created by @bpeers01 on GitHub (Jan 25, 2026).

Originally assigned to: @rekram1-node on GitHub.

Problem
OpenCode already tracks per-request token usage, but there’s no quick way to view it in the TUI. This makes it hard to check context headroom without leaving the session.

Proposal
Add a session-level /context command that opens a dialog showing last-request token usage, context limit, usable input budget, and cache hit ratio.

Scope
TUI only. No new tracking data; just a UI for existing usage fields.

Why this matters
Improves visibility into prompt headroom and cache usage while staying in the session flow.

Verification
I will include a short repro in the PR and before/after screenshots for the dialog.

Originally created by @bpeers01 on GitHub (Jan 25, 2026). Originally assigned to: @rekram1-node on GitHub. Problem OpenCode already tracks per-request token usage, but there’s no quick way to view it in the TUI. This makes it hard to check context headroom without leaving the session. Proposal Add a session-level /context command that opens a dialog showing last-request token usage, context limit, usable input budget, and cache hit ratio. Scope TUI only. No new tracking data; just a UI for existing usage fields. Why this matters Improves visibility into prompt headroom and cache usage while staying in the session flow. Verification I will include a short repro in the PR and before/after screenshots for the dialog.
yindo added the opentui label 2026-02-16 18:07:36 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 25, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #6152: [FEATURE]: Session context usage (similar to /context in Claude) - Requests a TUI dialog showing context window breakdown and token usage

Feel free to ignore if this doesn't address your specific case.

@github-actions[bot] commented on GitHub (Jan 25, 2026): This issue might be a duplicate of existing issues. Please check: - #6152: [FEATURE]: Session context usage (similar to /context in Claude) - Requests a TUI dialog showing context window breakdown and token usage Feel free to ignore if this doesn't address your specific case.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#7563