[BUG] After /clear command some context seems to be kept in memory?
Environment
- Platform (select one):
- [x] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [ ] Other: <!-- specify -->
- 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
- In one session, tell Claude Code to use a markdown document (in my case TestPlan.md) as a prd scratchpad.
- Delete the TestPlan.md document, then /clear command to clear context
- Work with some other session in planning mode, without referring to TestPlan.md.
- 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.
This issue has 7 comments on GitHub. Read the full discussion on GitHub ↗