[BUG] Same project directory gets two different, non-syncing memory directories
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
The same project directory gets assigned two different memory directories across sessions, and they don't stay in sync.
Project directory: /home/<user>/codespace/College_FYP (folder name uses an underscore).
Depending on the session, Claude Code created and used one of two different memory directories for it:
- ~/.claude/projects/-home-<user>-codespace-College-FYP/memory/ (dash)
- ~/.claude/projects/-home-<user>-codespace-College_FYP/memory/ (underscore)
Memory written in a session that resolved to one directory was invisible in a session that resolved to the other. No warning or error was shown — this was only found by manually diffing the two directories and noticing they'd drifted apart.
What Should Happen?
A single project directory should map to exactly one memory directory, consistently, across all sessions. Memory written in one session should be visible in the next session opened against the same path.
Error Messages/Logs
Steps to Reproduce
- Open Claude Code in a project directory, e.g. /home/<user>/codespace/College_FYP
- Have Claude write project memory (any memory type) during the session
- In a later session opened against the same directory, check ~/.claude/projects/ for that project's memory folder — the folder slug used may differ between sessions (observed both "-home-<user>-codespace-College-FYP" and "-home-<user>-codespace-College_FYP" for the same underlying path)
- Compare the two memory directories — they contain different, unsynced content
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.207 (Claude Code)
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
VS Code integrated terminal
Additional Information
Two separate directories exist for what should be one project:
- -home-<user>-codespace-College-FYP
- -home-<user>-codespace-College_FYP
Only the underscore variant matches the actual on-disk folder name. Worked around manually by mirroring memory files between both directories, but this isn't sustainable if the assignment is nondeterministic per session.
Related but auto-closed issues that touch similar ground without a fix landing: #30828, #39424, #18122 (the latter is actually a different root cause — Windows drive-letter capitalization — closed as not_planned).