Path encoding strips all non-Latin characters — different directories collide, sessions cross-project visible, cleanup causes data loss
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?
Claude Code's path encoding for session storage replaces all non-Latin characters with hyphens.
For example: C:\Users\...\Desktop\测试中文目录 is encoded as C--Users-...-Desktop------- — all 6 Chinese
characters become 6 hyphens.
This means two different directories with the same number of non-Latin characters map to the SAME .claude/projects/
directory. Sessions from both directories are stored together, visible to each other, and deleted together during
cleanup.
Confirmed across 4 languages: Chinese (测试中文目录), Japanese (日本語テスト), Korean (한국어테스트), Arabic
.)رابتخا(
Impact chain (6 layers discovered, all from the same root cause):
- Non-Latin characters → hyphens: All CJK/non-Latin characters stripped.
- Directory collision: Different dirs with same char count → same session dir.
- Cross-project data loss:
claude project purgein directory A deletes directory B's sessions. - Cross-project session visibility:
--resumein directory B shows directory A's conversations. - Pre-existing collisions: Reporter's own system already has 5 hyphen-only entries with sessions from real
directories, e.g. C--Users-...-Desktop-------- contains sessions from C:\Users\...\Desktop\资料.
- Trust state separation:
.claude.jsonstores trust by real path (separate), but sessions by encoded path
(collided). "Don't ask again" permissions in one directory apply to the collided directory.
Detection tool created: https://github.com/yurenpai/ai-config-guard (NON_LATIN_DIRNAME rule)
What Should Happen?
Claude Code should preserve the full directory name in path encoding so that:
- Different directories always map to different
.claude/projects/entries — regardless of language or character
set.
claude project purgeonly deletes sessions from the specific directory where it was run — not from unrelated
directories that happen to have the same non-Latin character count.
--resumeonly shows sessions from the current directory — not from other directories that collided via encoding.
- All languages (Chinese, Japanese, Korean, Arabic, Russian, Hebrew, Thai, and any other non-Latin script) are
handled identically to Latin-script directory names.
Suggested fix: Use URL-encoding, Base64, or a hash of the full path — rather than stripping non-Latin characters.
Error Messages/Logs
No error messages, warnings, or log entries are produced at any stage:
- Directory encoding: Silent. No indication the path was modified.
- Session collision: Silent. No warning that two directories share a session directory.
- `claude project purge`: No warning that sessions from other directories will also be deleted.
- `--resume`: No indication that displayed sessions originate from a different directory.
- `.claude/projects/`: No validation that encoded directory names are unique.
The only way to detect the issue is manual inspection of `.claude/projects/` directory names or use of a detection
tool.
Steps to Reproduce
- Create two directories with the same number of non-Latin characters:
mkdir C:\Users\...\Desktop\项目甲
mkdir C:\Users\...\Desktop\测试乙
- Run
claude "hello"in each directory.
- Observe
.claude/projects/— both sessions stored in the same directory:
C--Users-...-Desktop----
- Run
claude project purgefrom项目甲— confirm deletion.
- Run
claude --resumefrom测试乙— no conversations found (deleted by step 4).
- Reproduce the collision with other non-Latin languages:
- Japanese:
日本語テスト - Korean:
한국어테스트 - Arabic:
رابتخا
All produce identical collision behavior.
Claude Model
Other
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
2.1.190
Platform
Other
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
Also confirmed on version 2.1.186 before auto-update. Detection tool:
https://github.com/yurenpai/ai-config-guard