claude-code - 💡(How to fix) Fix [FEATURE] /clear should prompt the user whether to save memories before clearing context. [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#48692Fetched 2026-04-16 06:53:36
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Author
Participants
Timeline (top)
labeled ×3
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing requests and this feature hasn't been requested yet
  • This is a single feature request (not multiple features)

Problem Statement

Sometimes I clear context and Claude hasn't written memories.

Proposed Solution

I would like when I type /clear for Claude to ask if I want to write memories before clearing.

Alternative Solutions

I created a /save skill that I call before clearing. A little cumbersome and especially since if I forget to run /save and just hit /clear I lose those memories if Claude hasn't taken it upon itself to do it.

Priority

Medium - Would be very helpful

Feature Category

CLI commands and flags

Use Case Example

/clear Claude replies: "Would you like to save memories first?"

Additional Context

No response

extent analysis

TL;DR

Implement a confirmation prompt for saving memories before clearing context when the /clear command is used.

Guidance

  • Consider modifying the /clear command to include a conditional check for unsaved memories and prompt the user to save them before clearing the context.
  • Evaluate the existing /save skill and determine if it can be integrated or repurposed to automate the memory saving process when /clear is invoked.
  • Assess the feasibility of adding a flag or option to the /clear command to allow users to choose whether to save memories automatically.
  • Review the current implementation of memory saving and clearing to ensure that the proposed solution does not introduce any unintended side effects or conflicts.

Example

def clear_context():
    if has_unsaved_memories():
        response = input("Would you like to save memories first? (yes/no): ")
        if response.lower() == "yes":
            save_memories()
    # Clear context logic here

Notes

The implementation details may vary depending on the underlying architecture and technology stack used by Claude. This solution assumes a text-based input/output interface and a programming language that supports conditional statements and user input.

Recommendation

Apply workaround: Implement the proposed solution of prompting the user to save memories before clearing the context, as it provides a straightforward and user-friendly way to address the issue.

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