Skip to content

feat(opencode): display cached token count inline in TUI - #23111

Open
bainos wants to merge 1 commit into
anomalyco:devfrom
bainos:feat/tui-cache-display
Open

feat(opencode): display cached token count inline in TUI#23111
bainos wants to merge 1 commit into
anomalyco:devfrom
bainos:feat/tui-cache-display

Conversation

@bainos

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes#23109

Type of change

  • New feature

What does this PR do?

Shows `(N cached)` inline next to the token count in the sidebar context panel, prompt footer, and subagent footer when `cache.read + cache.write > 0`. No change when zero.

How did you verify your code works?

Tested locally with Bedrock Sonnet 4.6. See screenshot below.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@bainos

Copy link
Copy Markdown
ContributorAuthor
imageimage

@bainos
bainosforce-pushed the feat/tui-cache-display branch 2 times, most recently from 3c3107e to d686247CompareApril 29, 2026 12:26
@bainos
bainosforce-pushed the feat/tui-cache-display branch 2 times, most recently from 94ddc20 to cc89ae1CompareMay 4, 2026 21:55
@bainos
bainosforce-pushed the feat/tui-cache-display branch from cc89ae1 to 45b3bb3CompareMay 8, 2026 06:13
@bainos
bainosforce-pushed the feat/tui-cache-display branch from 45b3bb3 to 1fcb807CompareMay 27, 2026 20:30
Shows cache tokens inline when non-zero:
- Sidebar context: "68,356 tokens (12.5K cached)"
- Subagent footer: same format with percentage
- Prompt footer: same format with percentage
Implementation:
- Extract cached tokens separately before summing
- Show only when cached > 0 to reduce noise
- Use existing Locale.number() for consistent formatting
- Applied to all 3 TUI locations that display token usage
@GHuyHuynh

GHuyHuynh commented Jul 19, 2026

Copy link
Copy Markdown

Hi everyone, any updates on this?

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Show cached token count inline in TUI context panels

2 participants

@bainos@GHuyHuynh