Skip to content

[BUG] After /clear command some context seems to be kept in memory? #2538

Closed as not planned

Description

@joakimriedel

Environment

  • Platform (select one):
    • Anthropic API
    • AWS Bedrock
    • Google Vertex AI
    • Other:
  • Claude CLI version: 1.0.33
  • Operating System: macOS 15.5
  • Terminal: Terminal

Bug Description

I expected the /clear command to do the same as exiting claude and starting again. But it seems some context are still left in memory after clearing.

Steps to Reproduce

  1. In one session, tell Claude Code to use a markdown document (in my case TestPlan.md) as a prd scratchpad.
  2. Delete the TestPlan.md document, then /clear command to clear context
  3. Work with some other session in planning mode, without referring to TestPlan.md.
  4. Claude will try to read and update the TestPlan.md document!

Expected Behavior

Claude should not know about TestPlan.md

Actual Behavior

⏺ Now let me create the test plan document:

⏺ Read(prds/TestPlan.md)
  ⎿  Error: File does not exist.

EDIT: Except file names, it also seems to have some cache of branches that is not cleared properly.

I just finished a feature branch. Committed, switched branch, ran /clear and then asked Claude to pull latest and rebase. Somehow it remembered the old feature branch name and tried to switch back to it. (I did not have any uncommitted changes anywhere, and this was the first output after clearing the session)

I see you're on branch joakim/foo, not the joakim/bar branch that had uncommitted changes.
   Let me check if you have multiple branches with changes:

Workaround

Quite Claude Code and restart claude. This will clear the file and branch caches, and makes it possible to continue on a clean session.

Activity

  1. github-actions commented on Aug 16, 2025

    @github-actions

    Found 3 possible duplicate issues:

    1. [BUG] gitStatus in the system reminder gets stale #3901
    2. [BUG] clear not reloading config #4840
    3. "Plan Mode Failure in WSL Ubuntu: Graphical Glitch and State Corruption on Plan Acceptance" #2390

    This issue will be automatically closed as a duplicate in 3 days.

    • If your issue is a duplicate, please close it and 👍 the existing issue instead
    • To prevent auto-closure, add a comment or 👎 this comment

    🤖 Generated with Claude Code

  2. joakimriedel commented on Aug 16, 2025

    @joakimriedel
    Author

    #3901 is similar but more recent, please keep this issue until fixed

  3. vanakema commented on Sep 26, 2025

    @vanakema

    This is pretty annoying. This has happened to me several times recently, as I've been using /clear more between tasks. Should be a simple task! Would be nice if it was fixed. It probably should get updated before the execution of every prompt so it's always up to date. It's a very cheap operation to at least just get the branch.

  4. github-actions commented on Dec 9, 2025

    @github-actions

    This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

  5. github-actions commented on Jan 9, 2026

    @github-actions

    This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.

  6. xpader commented on Jan 14, 2026

    @xpader

    This is not same as #4629 and #4872.
    Old conversation showed after /clear is very bother me every day, when /clear and start new chat about 2 times, old message showed, it happend everytime, and happend in 2.1.x all new version.

  7. github-actions commented on Jan 21, 2026

    @github-actions

    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.

  8. locked as resolved and limited conversation to collaborators on Jan 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:coreautocloseIssue will be closed automaticallybugSomething isn't workinghas reproHas detailed reproduction stepsmemoryplatform:macosIssue specifically occurs on macOS

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions