[BUG] Path collision in project state directory still exists (Reopening #7009)
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?
When Claude Code encodes project absolute paths to create session/state folders (e.g., in ~/.claude/projects/), it simply replaces / with -. This creates a severe naming collision for similarly named nested directories, which leads to context pollution, state overriding, and history contamination between completely different codebases.
Because kebab-case (my-project) is the industry standard for project naming, this collision is highly likely to occur. When it does, conversation histories, memories, and codebase contexts from Project A will cross-contaminate Project B, which is particularly dangerous for an AI coding agent.
What Should Happen?
To maintain human readability while preventing collisions, the folder naming logic should append a short hash (e.g., MD5/SHA) of the true absolute path.
For example: -Users-username-Projects-demo-app-[8-char-hash]
Error Messages/Logs
Steps to Reproduce
- Create two separate project directories:
~/Projects/demo-app~/Projects/demo/app
- Run
claudein both directories. - Observe the generated state directory in
~/.claude/projects/. Both sessions will map to the exact same directory name:-Users-username-Projects-demo-app
Claude Model
None
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
2.1.162
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗