Path encoding strips all non-Latin characters — different directories collide, sessions cross-project visible, cleanup causes data loss

Open 💬 0 comments Opened Jun 24, 2026 by yurenpai

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):

  1. Non-Latin characters → hyphens: All CJK/non-Latin characters stripped.
  2. Directory collision: Different dirs with same char count → same session dir.
  3. Cross-project data loss: claude project purge in directory A deletes directory B's sessions.
  4. Cross-project session visibility: --resume in directory B shows directory A's conversations.
  5. 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\资料.

  1. Trust state separation: .claude.json stores 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:

  1. Different directories always map to different .claude/projects/ entries — regardless of language or character

set.

  1. claude project purge only deletes sessions from the specific directory where it was run — not from unrelated

directories that happen to have the same non-Latin character count.

  1. --resume only shows sessions from the current directory — not from other directories that collided via encoding.
  1. 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

  1. Create two directories with the same number of non-Latin characters:

mkdir C:\Users\...\Desktop\项目甲
mkdir C:\Users\...\Desktop\测试乙

  1. Run claude "hello" in each directory.
  1. Observe .claude/projects/ — both sessions stored in the same directory:

C--Users-...-Desktop----

  1. Run claude project purge from 项目甲 — confirm deletion.
  1. Run claude --resume from 测试乙 — no conversations found (deleted by step 4).
  1. 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

View original on GitHub ↗