Summary
Add a /context slash command that opens a dialog (consistent with the existing /cost dialog) showing the current context-window composition, broken down by category.
Motivation
Competitors (Claude Code's /context grid) let users see exactly what is consuming their context window. docker-agent today shows only a single aggregate "Context: N%" in the sidebar and a cost-centric /cost dialog — there is no window-centric breakdown.
Proposed behavior
Show estimated tokens and % of the resolved context limit for each category:
- system prompt
- tool definitions
- prompt files (AGENTS.md / add_prompt_files)
- conversation messages
- tool results
- compaction summary
Render as a dialog with a bar/grid. Numbers are estimates (len/4 heuristic via compaction.EstimateMessageTokens) — label them as such.
Implementation notes (starting points)
- New command in
pkg/tui/commands/commands.go
- New message type in
pkg/tui/messages/session.go
- New dialog
pkg/tui/dialog/context.go
- Breakdown computed in
pkg/runtime from Session.GetMessages output; consider a ContextBreakdownEvent
- Reuse
pkg/tui/components/toolcommon/tokencount.go
Complexity: M. Command name decided as /context (not /status).
Background: shared plan context-management-gap-analysis (Phase 1, item 1).
Dependencies / Relationships
Summary
Add a
/contextslash command that opens a dialog (consistent with the existing/costdialog) showing the current context-window composition, broken down by category.Motivation
Competitors (Claude Code's
/contextgrid) let users see exactly what is consuming their context window. docker-agent today shows only a single aggregate "Context: N%" in the sidebar and a cost-centric/costdialog — there is no window-centric breakdown.Proposed behavior
Show estimated tokens and % of the resolved context limit for each category:
Render as a dialog with a bar/grid. Numbers are estimates (len/4 heuristic via
compaction.EstimateMessageTokens) — label them as such.Implementation notes (starting points)
pkg/tui/commands/commands.gopkg/tui/messages/session.gopkg/tui/dialog/context.gopkg/runtimefromSession.GetMessagesoutput; consider aContextBreakdownEventpkg/tui/components/toolcommon/tokencount.goComplexity: M. Command name decided as
/context(not/status).Background: shared plan
context-management-gap-analysis(Phase 1, item 1).Dependencies / Relationships
/drop) #3435 (context inventory extends this/contextdialog), feat(runtime): cross-agent compaction orchestration (explicit, user-triggered) #3439 (team-level view extends/context)