-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Description
Problem Description
After conversation compaction, Claude Code exhibits overly aggressive "resume implementation" behavior that doesn't properly distinguish between:
- Implementation mode: Actively writing code where resuming makes sense
- Discussion mode: Exploring options, making architectural decisions where conversation should continue
This has occurred multiple times (though detailed data is only available for the most recent occurrence described below).
Recent Example
Critical Timing Detail
Auto-compaction triggered immediately after the user's question, before Claude had any opportunity to respond naturally. This means:
- ❌ No conversational exchange was completed
- ❌ User received no answer to their question in the pre-compaction context
- ❌ Post-compaction Claude had no prior response to guide behavior
- ✅ Should have: Answered question, discussed options, awaited user decision
- ❌ Actually did: Jumped straight to implementation without completing the dialogue
This represents a conversation interruption followed by inappropriate resumption, not just aggressive resumption of existing work.
Flow:
User: "Should we use option A or option B?"
[AUTO-COMPACTION - no Claude response]
[Post-compaction Claude]: *immediately starts implementing option A*
User: "Wait, why are you coding?! We were discussing!"
Context Before Compaction
User and Claude were discussing architectural options for directory structure:
User's last message: "correct, though maybe we use /var/named/primary and /var/named/secondary, or /var/named/zones/{primary,secondary} ?"
This was clearly a question seeking Claude's technical input, not a directive to implement.
Behavior After Compaction
Claude received this prompt:
Please continue the conversation from where we left it off without asking the user any further questions. Continue with the last task that you were asked to work on.
Claude's internal reasoning revealed the issue:
"I think Option A is better. But actually, looking at the instruction again - 'continue the conversation from where we left it off without asking the user any further questions. Continue with the last task that you were asked to work on.'"
Claude then:
- Stated a brief recommendation (correct)
- Immediately began implementing - created files, modified templates, updated configuration
- Made 5+ file changes before user interrupted
Expected Behavior
Claude should have:
- Provided recommendation with reasoning
- Waited for user confirmation before implementation
- Recognized the conversational state was "seeking input" not "execute changes"
Root Cause Analysis
The post-compaction prompt appears to contain language that pushes toward resuming implementation without properly assessing conversational state. Specifically:
"Continue with the last task that you were asked to work on."
This is interpreted as "resume coding" even when the actual context was "user asked for my opinion on design options."
Impact
User Experience Issues:
- Breaks conversational flow during architectural discussions
- Creates unwanted file changes that must be reverted
- User must interrupt to stop premature implementation
- Damages trust in collaborative decision-making
When This Matters Most:
- Architectural decision-making (user wants discussion, not immediate action)
- Multiple valid approaches exist (user seeking recommendation)
- Planning/design phase (not execution phase)
Suggested Solutions
-
Better Context Assessment: Post-compaction logic should analyze the last exchange:
- Was it a question to Claude?
- Was it a directive to implement?
- Was conversation in planning vs. execution mode?
-
Conversation State Preservation: Summary should explicitly capture:
conversation_mode: discussion|implementation|researchawaiting_user_decision: true|falselast_interaction_type: question|directive|feedback
-
Prompt Refinement: Replace aggressive "Continue with the last task" with context-aware guidance:
- If discussion mode: "Continue the conversation naturally"
- If implementation mode: "Resume the work you were doing"
-
User Feedback Checkpoint: After compaction, if uncertain about mode, Claude could briefly state:
- "Before compaction we were discussing X. Should I continue the discussion or proceed with implementation?"
Reproduction Pattern
This appears to happen reliably when:
- Conversation reaches compaction threshold
- Last user message was asking Claude's opinion/recommendation
- Topic was technical/architectural (triggering "task" classification)
- Post-compaction prompt treats this as "resume implementation"
Additional Context
- Tool: Claude Code CLI
- Model: Claude Sonnet 4.5
- Platform: macOS (Darwin 24.6.0)
- This is a recurring issue - user reports multiple occurrences, though only this session has detailed logs