Feature Request: Preserve recent conversation turns after context compaction
Status Fixed / completed
Maintainer reply None cached
Workaround ✓ Mentioned in thread ↓
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
3 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Closing - found a user-side solution that achieves the same result.
Workaround: Add instructions to your
CLAUDE.mdfile telling Claude to read the transcript directly after compaction:This works because:
~/.claude/projects/<project>/<session>.jsonlNo built-in feature needed - the pieces are already there.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.