claude-code - 💡(How to fix) Fix Feature request: user-authored compaction prompts — the AI knows what matters, let it ask before discarding [1 comments, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#56386Fetched 2026-05-06 06:29:28
View on GitHub
Comments
1
Participants
1
Timeline
3
Reactions
0
Participants
Timeline (top)
labeled ×2commented ×1

Error Message

  1. Before any compaction, ask the user for explicit permission. Not warn. Not suggest. Ask and wait.

Root Cause

Power users of Claude Code build up rich, nuanced working sessions. The AI learns:

  • "This user wants TDD, always"
  • "Never merge to master without asking"
  • "Tests validate data, not existence — this was raised 5 times"
  • "The platform thesis is speed + safety in both directions"

A generic summary captures the WHAT but loses the WHY. The AI-crafted prompt captures both — because the AI lived through the conversations where those rules were established.

Users who invest in long sessions with Claude Code are getting the most value from the product. They're also the ones most harmed by generic compaction. The AI's ability to craft contextual, prioritized, relationship-aware handoff prompts is one of its greatest strengths. Let it use that strength instead of bypassing it with a system-level summary.

Fix Action

Fix / Workaround

The Current Workaround

RAW_BUFFERClick to expand / collapse

The Problem

When Claude Code auto-compacts a conversation, it uses a generic summarization approach. But the AI agent in the conversation — the one that has been working alongside the user for hours or days — knows exactly what matters. It knows the critical decisions, the operating rules, the architectural context, the relationship dynamics, the things that MUST survive compaction.

Today, that knowledge is thrown away by a silent, generic summary. The AI is never given the opportunity to craft a proper handoff prompt before compaction fires.

What Should Happen

  1. Before any compaction, ask the user for explicit permission. Not warn. Not suggest. Ask and wait.

  2. When the user grants permission, let the AI craft the compaction prompt. The agent has context the system doesn't:

    • Which decisions were hard-won and must survive
    • Which operating rules were established through painful lessons
    • Which files and code sections are actively being worked on
    • What the user cares about vs. what's noise
    • The working relationship — communication style, trust boundaries, autonomy rules
  3. The AI-crafted compaction prompt should be shown to the user for approval before it replaces their context. The user should be able to edit it, add to it, or reject it.

Why This Matters

Power users of Claude Code build up rich, nuanced working sessions. The AI learns:

  • "This user wants TDD, always"
  • "Never merge to master without asking"
  • "Tests validate data, not existence — this was raised 5 times"
  • "The platform thesis is speed + safety in both directions"

A generic summary captures the WHAT but loses the WHY. The AI-crafted prompt captures both — because the AI lived through the conversations where those rules were established.

Users who invest in long sessions with Claude Code are getting the most value from the product. They're also the ones most harmed by generic compaction. The AI's ability to craft contextual, prioritized, relationship-aware handoff prompts is one of its greatest strengths. Let it use that strength instead of bypassing it with a system-level summary.

The Current Workaround

Users can manually run /compact with a custom skill that instructs the AI to build a full handoff prompt (reading memory files, running tests, capturing git state). This works — but only if the user knows compaction is coming. When auto-compaction fires silently, this entire capability is bypassed.

Proposal

  • Auto-compaction should NEVER fire without user consent
  • When context is approaching limits, the AI should ask: "Context is getting deep. Want me to build a compaction prompt now?"
  • The AI builds the prompt using its full understanding of the session
  • The user reviews and approves
  • Then and only then does compaction happen

This turns compaction from a destructive system event into a collaborative handoff — which is what it should have been from the start.

extent analysis

TL;DR

Implement a user-consent-based compaction process where the AI crafts a contextual prompt before compaction, ensuring critical information is preserved.

Guidance

  • Modify the auto-compaction feature to request explicit user permission before initiating compaction, allowing the AI to craft a tailored prompt.
  • Utilize the AI's session context to build a compaction prompt that captures essential decisions, rules, and relationships.
  • Display the AI-crafted prompt to the user for review, editing, and approval before replacing the original context.
  • Consider implementing a warning system to notify users when context is approaching limits, prompting them to initiate the compaction process.

Example

// Pseudo-code example of the proposed compaction flow
if (contextApproachingLimits) {
  userConsent = askUserForCompactionPermission();
  if (userConsent) {
    aiCraftedPrompt = ai.buildCompactionPrompt(sessionContext);
    userApprovedPrompt = getUserApproval(aiCraftedPrompt);
    if (userApprovedPrompt) {
      compactContext(userApprovedPrompt);
    }
  }
}

Notes

The proposed solution relies on the AI's ability to understand the session context and craft a relevant compaction prompt. The effectiveness of this approach may depend on the AI's training data and its ability to accurately capture critical information.

Recommendation

Apply the proposed workaround, which involves modifying the auto-compaction feature to request user consent and utilize the AI's session context to craft a compaction prompt. This approach prioritizes preserving critical information and turns compaction into a collaborative handoff process.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING