[BUG] Project memory directory naming can collide when paths differ only by / vs -
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?
Project-specific memory directories under ~/.claude/projects/ are named by replacing / with - in the absolute path. This means two different project paths can map to the same directory and silently share memory and session transcripts.
What Should Happen?
Each distinct project path should map to a unique directory. A path hash suffix, URL-safe encoding (e.g. replacing / with %2F), or similar disambiguation would prevent collisions.
Error Messages/Logs
Steps to Reproduce
- Create two git repos whose paths differ only by / vs -
mkdir -p /tmp/test-project /tmp/test/project
cd /tmp/test-project && git init
cd /tmp/test/project && git init
- Run claude in each repo (any prompt, just enough to create a session)
cd /tmp/test-project && claude "hello"
cd /tmp/test/project && claude "hello"
- Observe a single shared directory with both session transcripts
ls -la ~/.claude/projects/-private-tmp-test-project/
# two .jsonl files from two different repos
Claude Model
None
Is this a regression?
Unknown
Last Working Version
_No response_
Claude Code Version
2.1.62
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
The most realistic scenario is a monorepo split — e.g. /org/company-platform becomes /org/company/platform. Both map to the same directory, so memory files (MEMORY.md, backlog, conventions) from the old project silently bleed into the new one. The failure mode is context pollution with no warning — Claude references patterns, file paths, and conventions from the wrong project.
Related: #19742 (ENAMETOOLONG for deeply nested paths) — same root cause of using raw path munging for directory names
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗