Feature Request: Preserve recent conversation turns after context compaction

Status Fixed / completed
Maintainer reply None cached
Activity 3 comments · opened Feb 2, 2026 · closed Feb 2, 2026

Current behavior

When context compaction occurs, the entire conversation is summarized into prose. Zero recent turns are preserved verbatim.

Problem

This causes significant continuity issues:

  • AI loses track of what was actively being worked on
  • Stale/incorrect information in summary gets treated as current state
  • User has to re-explain context that was just discussed
  • Mid-task compaction leaves AI unable to continue work seamlessly

Requested behavior

After compaction, reinject the last N conversation turns (e.g., 5-10 exchanges) verbatim, similar to how Claude.ai handles this. The summary provides long-term context; recent turns provide immediate continuity.

Example failure

After compaction, my AI assistant believed I was using 'Open WebUI (third-party, can't modify)' when we had just been editing my custom UI together. The summary captured stale context and there were no recent turns to correct it. I had to spend several minutes re-orienting the AI to what we were actually working on.

Suggested implementation

  • Keep last 5-10 user/assistant turn pairs after summary
  • Or allow configuration via settings/CLAUDE.md for number of turns to preserve
  • Consider marking 'in-progress work' specially so it survives compaction

View original on GitHub ↗

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