[BUG] claude code create project folders delimited by "-" but this is a legitimate character in the path
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?
It's the folder name in ~/.claude/projects/.
When you run claude from C:\git\cc-plus - /c/git/cc-plus, Claude creates: ~/.claude/projects/C--git-cc-plus/
That's where it stores all the .jsonl session files for that project. The encoded path IS the folder name.
So Claude Code chose to encode the full path as a folder name, using -- for the colon and - for path
separators. That's their design choice - and it's lossy.
❯ Well, what do you mean it's lossy? As if that's a meaningful word.
● You're right, let me be clear.
When Claude encodes the path, it uses - for two different things: 1. A hyphen that was already in a folder name (my-project)
- A path separator (\ or /)
So when you look at the encoded folder name, you can't tell which dashes were originally hyphens and which
were path separators. That information is gone. You can't get it back.
That's what I meant - Claude threw away information during encoding that makes it impossible to decode
accurately.
❯ And you find this where inside the session, the JSON, the session file?
● No, it's not inside the session file. It's the folder name where the session file lives.
~/.claude/projects/C--git-cc-plus/abc123.jsonl ^^^^^^^^^^^^^^
This is the encoded path (it's a folder name)
The session .jsonl file is stored inside a folder named after the encoded project path. That folder name is
how Claude knows which project the session belongs to.
❯ Wow, that's a major bug on anthropic like codes part. It is, it is a obvious bug.
● Yes, it's a design flaw. They should have:
- Used a character that can't appear in folder names (like % or URL encoding) 2. Or stored the original path in a metadata file inside the project folder
- Or used base64 encoding
Instead they used - which is valid in folder names, so you can't tell the difference between an encoded
separator and a literal hyphen.
If someone at Anthropic named their project my-cool-project, the encoding is indistinguishable from
my/cool/project or my/cool-project or my-cool/project.
What Should Happen?
don't use valid characters "-" to delimit paths that can also be part of the path
Error Messages/Logs
Steps to Reproduce
It's the folder name in ~/.claude/projects/.
When you run claude from C:\git\cc-plus, Claude creates: ~/.claude/projects/C--git-cc-plus/
That's where it stores all the .jsonl session files for that project. The encoded path IS the folder name.
So Claude Code chose to encode the full path as a folder name, using -- for the colon and - for path
separators. That's their design choice - and it's lossy.
❯ Well, what do you mean it's lossy? As if that's a meaningful word.
● You're right, let me be clear.
When Claude encodes the path, it uses - for two different things: 1. A hyphen that was already in a folder name (my-project)
- A path separator (\ or /)
So when you look at the encoded folder name, you can't tell which dashes were originally hyphens and which
were path separators. That information is gone. You can't get it back.
That's what I meant - Claude threw away information during encoding that makes it impossible to decode
accurately.
❯ And you find this where inside the session, the JSON, the session file?
● No, it's not inside the session file. It's the folder name where the session file lives.
~/.claude/projects/C--git-cc-plus/abc123.jsonl ^^^^^^^^^^^^^^
This is the encoded path (it's a folder name)
The session .jsonl file is stored inside a folder named after the encoded project path. That folder name is
how Claude knows which project the session belongs to.
❯ Wow, that's a major bug on anthropic like codes part. It is, it is a obvious bug.
● Yes, it's a design flaw. They should have:
- Used a character that can't appear in folder names (like % or URL encoding) 2. Or stored the original path in a metadata file inside the project folder
- Or used base64 encoding
Instead they used - which is valid in folder names, so you can't tell the difference between an encoded
separator and a literal hyphen.
If someone at Anthropic named their project my-cool-project, the encoding is indistinguishable from
my/cool/project or my/cool-project or my-cool/project.
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.11
Platform
Other
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗