opencode icon indicating copy to clipboard operation
opencode copied to clipboard

feat(tui): add context preview dialog

Open cedefrespo opened this issue 2 weeks ago • 1 comments

Summary

  • Add context preview dialog accessible via command palette
  • Shows breakdown of context being sent to LLM before submission
  • Displays system prompt, instruction files, environment context, and conversation history with token estimates

Motivation

Users currently see total token count but cannot inspect what comprises the context. This makes it difficult to:

  • Identify unnecessary context consumption
  • Understand why token counts are high
  • Optimize context before sending

Changes

  • dialog-context.tsx: New dialog component showing context breakdown by type
  • app.tsx: Register "Preview context" command in command palette

Usage

  1. Open command palette
  2. Select "Preview context"
  3. View breakdown of context items with token estimates

cedefrespo avatar Dec 16 '25 09:12 cedefrespo

It would probably be cool if this could be bound to a key (although it should probably be bound to "none" by default and left for the user to bind themselves if they choose to as the team hasn't been a fan of new default keybindings recently).

ariane-emory avatar Dec 16 '25 13:12 ariane-emory