Feature Request: User-configurable compaction priorities (recency weighting)

Resolved 💬 3 comments Opened Feb 8, 2026 by SeptaCoder Closed Feb 12, 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

When context compaction triggers during a long conversation, the generated summary tends to preserve older, more established context at the expense of the most recent exchanges. In practice, the most recent messages are often the most valuable — they contain the latest decisions, corrections, or work-in-progress that haven't been committed to files yet. Losing them forces users to re-explain or repeat context.

This is especially painful for creative/writing workflows and iterative development where:

The last 2-3 exchanges contain the active decision being made
Older exchanges are often resolved and already saved to project files
Starting a new session or post-compaction loads heavy system context (CLAUDE.md, project files), consuming budget before the user says anything

Proposed Solution

Recency weighting in compaction: Allow users to configure a preference (e.g., in .claude/settings.json) that tells the compaction algorithm to prioritize recent exchanges over older ones. Something like:

{ "compaction": { "recency_weight": "high" } }
Where high means: keep the last N exchanges near-verbatim, summarize older ones more aggressively.

Pre-compaction hook: Add a pre_compaction hook event so users can trigger actions (like saving state to files) before compaction runs. This would let workflows protect critical context programmatically.

Exclude resolved context: Allow marking conversation segments as "resolved" (either automatically when todos are completed, or manually) so compaction can drop them entirely rather than summarizing.

Alternative Solutions

_No response_

Priority

Medium - Would be very helpful

Feature Category

Configuration and settings

Use Case Example

I'm writing a 10-book fantasy series with Claude Code. Each session involves reading chapter files, making editorial decisions, writing prose, and tracking continuity across 40+ chapters. A typical session runs:

  1. Load project context (CLAUDE.md + referenced files = ~2,000 lines of system prompt)
  2. Discuss and decide on changes (the valuable part)
  3. Execute changes to chapter files
  4. Context fills up, compaction triggers
  5. The summary preserves the heavy project context but drops/compresses the most recent editorial decision
  6. I have to re-explain what we just decided

Additional Context

_No response_

View original on GitHub ↗

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