When /compact performs context compression, the quality of the compressed context is poor.
Preflight Checklist
- [x] I have searched existing issues for similar behavior reports
- [x] This report does NOT contain sensitive information (API keys, passwords, etc.)
Type of Behavior Issue
Other unexpected behavior
What You Asked Claude to Do
Auto-compact or manually triggered /compact
What Claude Actually Did
Current Behavior
When /compact is executed:
- A portion of the most recent messages are preserved as-is.
- The earlier history that needs to be summarized is not first consolidated into a single continuous block of text — instead, it remains in its raw conversational form.
- A user message is appended at the end, instructing the model to produce a summary.
The Problem
The portion to be summarized retains its original back-and-forth conversational structure throughout, and the tail end of that portion is abruptly cut off. This pulls the model's attention toward the most recent messages within the to-be-summarized section, causing its reasoning to drift away from the actual task. Even if the model catches itself and refocuses on the summarization goal later in the reasoning process, the quality of the subsequent <analysis> and <summary> output is still affected.
Expected Behavior
When /compact is run, the summary should cover the conversation as a whole — it should not be skewed by the most recent messages that happen to be cut off at the boundary.
Files Affected
Permission Mode
I don't know / Not sure
Can You Reproduce This?
Yes, every time with the same prompt
Steps to Reproduce
_No response_
Claude Model
Opus
Relevant Conversation
Impact
Low - Minor inconvenience
Claude Code Version
2.1.158
Platform
Anthropic API
Additional Context
_No response_