Feature request: Pre-compaction hook and warning before automatic context compression

Resolved 💬 5 comments Opened Mar 14, 2026 by Akakmax Closed Apr 11, 2026

Summary

When the context window fills up, automatic compaction kicks in with no warning and no opportunity to preserve important information beforehand. A pre-compaction hook or warning would let users (or automation) save critical context before it gets compressed.

Problem

  • Auto-compaction happens silently — no heads-up, no chance to act
  • Users lose detailed inputs, decisions, and specifics they may need later
  • The only workaround is manually running /compact before it happens, which requires guessing when context is getting full

Proposed Solution

One or more of:

  1. pre-compact hook — fires before auto-compaction, allowing users to run custom scripts (e.g., save user inputs to a file, dump key context to memory)
  2. Context usage warning — notify at ~80% capacity: "Context getting full — want to save anything before compaction?"
  3. Preserve user inputs by default — during compaction, prioritize keeping user messages (inputs) verbatim over assistant outputs, since outputs are reproducible given the same inputs but user intent is irreplaceable

Rationale

Inputs have higher information entropy than outputs — a user's message is unique and unpredictable, while the model's response is largely derivable from the input. Compressing outputs more aggressively while preserving inputs would improve post-compaction quality with minimal cost. And if something is lost, re-running from preserved inputs is cheap and getting cheaper as models improve.

🤖 Generated with Claude Code

View original on GitHub ↗

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