[FEATURE] Pre and/or Post Compaction warning/hook

Resolved 💬 3 comments Opened Jan 20, 2026 by abitofhelp Closed Jan 24, 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

  • Feature: Pre-compaction warning/hook
  • Problem: Context compaction happens without warning, losing critical session details that summaries don't capture
  • Impact: Complex multi-session work requiring strict methodology (like tree-ordered implementation) loses discipline across compactions

Proposed Solution

Either a warning when compaction is approaching, or a hook that triggers automatic session export before compaction occurs. Alternatively, use compaction is a scaled manner where the most recent 30 minutes is full detail chat and survices the compaction without summarization. Next 30 min, some summarization, next ... so you progressively summarize more and more to the level you have today. reasonable since information that old is stale, anyway. well, other than the inital discussion at the start of a session. I am working on a large grammar related project and keep running into Claude Code having the details of a task compacted away so I have to spend 15 minutes reorienting him with export I hopefully created and documentation.

Alternative Solutions

_No response_

Priority

High - Significant impact on productivity

Feature Category

Developer tools/SDK

Use Case Example

Claude Code Generated based on this issue arising again:

---
Use Case: Tree-Ordered AST Formatter Implementation

Context: Building an Ada code formatter that requires implementing ~334 AST node handlers in strict tree order (root to leaves). Implementing out of order
causes the "emission chain problem" - upstream changes break downstream handlers, requiring exponential rework.

What happened:

  1. Session 1: User and Claude (with GPT consultation) create detailed implementation plan - strict tree order starting from Compilation_Unit (root) →

Library_Item (Level 1) → deeper nodes

  1. Plan documented in CLAUDE.md and implementation_spec.md
  2. Work begins correctly
  3. Compaction occurs
  4. Session resumes from summary: "implementing Phase 1 handlers systematically"
  5. Claude continues adding handlers - but in arbitrary order (Representation, Renamings, Parameters) instead of tree order
  6. User catches this after ~15 handler packages added out of order
  7. Discovery: Level 1 nodes (Library_Item, Subunit) were never implemented - all deeper work may need revisiting

Impact: Hours of work potentially invalidated because the summary lost "strict tree order" nuance. User had reminded Claude multiple times during the project,
but each compaction reset the discipline.

What would have helped: Recent context (last 30 min) staying full-detail through compaction, preserving the active methodology.

Additional Context

_No response_

View original on GitHub ↗

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