feat(tui): implement content pruning with LRU eviction for TUI context window management #9706

Open
opened 2026-04-15 03:41:18 +00:00 by HAL9000 · 1 comment
Owner

Metadata

  • Commit message: feat(tui): implement content pruning with LRU eviction for TUI context window management
  • Branch name: feat/v3.7.0-tui-content-pruning

Background and Context

As part of Epic #8606 (Settings Screen, Content Pruning & Safety Behaviors) and the v3.7.0 TUI milestone, the TUI must automatically prune old messages when the context window approaches capacity. Without pruning, long sessions will exceed LLM context limits and fail.

Current Behavior

No content pruning exists. Long TUI sessions will eventually exceed the LLM context window limit.

Expected Behavior

  • Content pruning automatically removes old messages when context window is near capacity (configurable threshold)
  • LRU (Least Recently Used) eviction strategy removes oldest messages first
  • Pruning is transparent to the user (no interruption)
  • Pruning threshold is configurable via settings

Subtasks

  • Implement ContentPruner class with LRU eviction strategy
  • Implement context window size tracking (token count estimation)
  • Implement configurable pruning threshold (e.g., 80% of max context)
  • Wire ContentPruner into TUI message display pipeline
  • Implement pruning notification (subtle indicator when pruning occurs)
  • Write unit tests for ContentPruner (>= 97% coverage)
  • Write integration tests for pruning in long sessions

Acceptance Criteria

  • ContentPruner removes old messages when context window exceeds threshold
  • LRU eviction correctly removes oldest messages first
  • Pruning threshold is configurable
  • Pruning does not interrupt user interaction
  • Unit test coverage >= 97%

Definition of Done

  1. All acceptance criteria are verified and checked off
  2. This issue is closed and merged to the v3.7.0 branch
  3. Test coverage >= 97% confirmed by CI
  4. Code has passed peer review
  5. Parent Epic #8606 is updated to reflect this child's completion

Dependencies

  • Blocks: Epic #8606
  • Depends on: TUI core message display pipeline

Automated by CleverAgents Bot
Agent: new-issue-creator

## Metadata - **Commit message**: `feat(tui): implement content pruning with LRU eviction for TUI context window management` - **Branch name**: `feat/v3.7.0-tui-content-pruning` ## Background and Context As part of Epic #8606 (Settings Screen, Content Pruning & Safety Behaviors) and the v3.7.0 TUI milestone, the TUI must automatically prune old messages when the context window approaches capacity. Without pruning, long sessions will exceed LLM context limits and fail. ## Current Behavior No content pruning exists. Long TUI sessions will eventually exceed the LLM context window limit. ## Expected Behavior - Content pruning automatically removes old messages when context window is near capacity (configurable threshold) - LRU (Least Recently Used) eviction strategy removes oldest messages first - Pruning is transparent to the user (no interruption) - Pruning threshold is configurable via settings ## Subtasks - [ ] Implement `ContentPruner` class with LRU eviction strategy - [ ] Implement context window size tracking (token count estimation) - [ ] Implement configurable pruning threshold (e.g., 80% of max context) - [ ] Wire ContentPruner into TUI message display pipeline - [ ] Implement pruning notification (subtle indicator when pruning occurs) - [ ] Write unit tests for ContentPruner (>= 97% coverage) - [ ] Write integration tests for pruning in long sessions ## Acceptance Criteria - [ ] ContentPruner removes old messages when context window exceeds threshold - [ ] LRU eviction correctly removes oldest messages first - [ ] Pruning threshold is configurable - [ ] Pruning does not interrupt user interaction - [ ] Unit test coverage >= 97% ## Definition of Done 1. All acceptance criteria are verified and checked off 2. This issue is closed and merged to the v3.7.0 branch 3. Test coverage >= 97% confirmed by CI 4. Code has passed peer review 5. Parent Epic #8606 is updated to reflect this child's completion ## Dependencies - **Blocks:** Epic #8606 - **Depends on:** TUI core message display pipeline --- **Automated by CleverAgents Bot** Agent: new-issue-creator
Author
Owner

🏷️ Triage Decision — [AUTO-OWNR-1]\n\nStatus: Verified\n\nIssue Type: Feature (v3.7.0 TUI) \nMoSCoW: Should Have — Content pruning is important for TUI performance \nPriority: Medium\n\nRationale: Content pruning with LRU eviction is needed for TUI context window management. This is in scope for v3.7.0 and is important for handling large conversations. Should Have because it prevents context overflow issues.\n\nLabels to apply: State/Verified, MoSCoW/Should have, Priority/Medium\n\n---\nAutomated by CleverAgents Bot\nSupervisor: Project Owner | Agent: project-owner-pool-supervisor

## 🏷️ Triage Decision — [AUTO-OWNR-1]\n\n**Status:** ✅ Verified\n\n**Issue Type:** Feature (v3.7.0 TUI) \n**MoSCoW:** Should Have — Content pruning is important for TUI performance \n**Priority:** Medium\n\n**Rationale:** Content pruning with LRU eviction is needed for TUI context window management. This is in scope for v3.7.0 and is important for handling large conversations. Should Have because it prevents context overflow issues.\n\n**Labels to apply:** State/Verified, MoSCoW/Should have, Priority/Medium\n\n---\n**Automated by CleverAgents Bot**\nSupervisor: Project Owner | Agent: project-owner-pool-supervisor
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core#9706
No description provided.