Skip to content

feat(tui): add warning/compacting states to the context-usage gauge #3434

Description

@aheritier

Summary

Give the always-on context gauge visual warning states as usage approaches the compaction threshold, and show a "compacting…" state while compaction runs.

Motivation

The sidebar already renders "Context: N%" but with no color/warning cues. Users get no signal that they're near the limit or that compaction is happening.

Proposed behavior

  • Color the gauge (e.g. normal → warning → critical) as it nears the configured compaction threshold.
  • Show a "compacting…" indicator driven by the existing SessionCompactionEvent (pkg/runtime/event.go ~line 471).
  • Apply to both the main TUI sidebar and the lean TUI status line.

Implementation notes (starting points)

  • pkg/tui/components/sidebar/sidebar.go (gauge at ~560-566, 1109-1137)
  • pkg/tui/styles/styles.go
  • pkg/leantui/update.go

Complexity: S.

Background: shared plan context-management-gap-analysis (Phase 1, item 3).

Dependencies / Relationships

Metadata

Metadata

Assignees

Labels

area/runtimeRuntime engine, agent loop execution, tool dispatch, loop detectionarea/tuiFor features/issues/fixes related to the TUIkind/featPR adds a new feature (maps to feat:). Use on PRs only.

Fields

No fields configured for Enhancement.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions