[FEATURE] Proactive Context Management with Smart Compacting

Resolved 💬 7 comments Opened Sep 15, 2025 by Magke Closed Jan 28, 2026

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

Implement proactive context management to prevent workflow interruptions by warning users before reaching the
auto-compact limit and providing flexible compacting options.

Related Issues

This feature request addresses underlying causes of issues like:

  • #7617: "This is constantly compacting and I cannot use it"
  • #7615: "Frequent Unexpected Conversation Compaction Interrupting Workflow"

Rather than fixing the symptoms, this proposes a proactive solution that prevents disruptive auto-compacts by
giving users control and visibility.

Current Problem

  • Auto-compact only triggers at 100% context capacity
  • Causes abrupt interruptions during active development sessions (as reported in #7617, #7615)
  • Forces immediate conversation breaks at inconvenient times
  • No visibility into context usage levels
  • Users lose momentum when forced to compact mid-task
  • Creates frustrating "compact loops" where users can barely type before hitting limits again

Proposed Solution

  1. Progressive Context Warnings
  • 50% threshold: Subtle notification "Context at 50% - compact recommended when convenient"
  • 70% threshold: More prominent warning "Context at 70% - consider compacting soon for optimal performance"
  • 85% threshold: Urgent notice "Context at 85% - auto-compact will trigger soon"
  • 95% threshold: Final warning "Auto-compact imminent - use /compact now to control timing"
  1. Smart Compact Commands
  • /compact --when-ready - Queues compact to trigger at next natural pause (e.g., after current task

completion)

  • /compact --preview - Shows what would be preserved vs. removed before compacting
  • /compact --preserve-todos - Ensures current todo lists and active work context remain intact
  • /compact --threshold <percentage> - Set custom warning thresholds
  1. Context Usage Visibility
  • Context usage indicator: [Context: 67%] in status updates
  • /context-status command to check current usage and estimated messages until auto-compact
  • Optional progress bar or percentage display
  1. Intelligent Auto-Compact Prevention
  • Smart detection of natural break points (completed todos, finished tasks, idle periods)
  • Preserve essential context (active todos, current file being worked on, recent decisions)
  • Remove redundant context (old search results, completed task discussions, outdated file contents)
  • Configurable auto-compact behavior - users can disable aggressive auto-compact if preferred

Benefits

  • Solves #7617/#7615: Eliminates surprise interruptions and compact loops
  • Improved UX: Users maintain workflow continuity
  • Better Performance: Proactive management prevents performance degradation
  • User Control: Flexibility to compact at convenient times
  • Reduced Frustration: No more workflow-breaking surprises
  • Enhanced Productivity: Developers can stay in flow state longer

Use Cases

  • Long development sessions with multiple features
  • Complex debugging that requires extensive context building
  • Architectural discussions spanning multiple topics
  • Code reviews involving many files and changes
  • Any scenario currently causing issues in #7617/#7615

Implementation Considerations

  • Configurable thresholds via user preferences or /config commands
  • Graceful degradation if smart detection fails
  • Backward compatibility with existing auto-compact behavior
  • Clear user education about new features
  • Address root causes of frequent compacting reported in related issues

Alternative Approaches Considered

  • Simply increasing context limits (doesn't solve the core UX problem)
  • Disabling auto-compact entirely (could cause performance issues)
  • Only fixing the bugs in #7617/#7615 (reactive rather than proactive solution)

This feature would proactively prevent the frustrating experiences described in issues #7617 and #7615 while
significantly improving the Claude Code experience for all users, especially during long development
sessions.

Alternative Solutions

_No response_

Priority

Medium - Would be very helpful

Feature Category

CLI commands and flags

Use Case Example

_No response_

Additional Context

_No response_

View original on GitHub ↗

This issue has 7 comments on GitHub. Read the full discussion on GitHub ↗