docs: document project directory path mapping behavior
Resolved 💬 2 comments Opened Feb 28, 2026 by ppiankov Closed Mar 28, 2026
Problem
Claude Code maps working directories to ~/.claude/projects/<encoded-path>/ but the encoding rules are undocumented:
- Slashes are replaced with dashes (
/→-) - The path is resolved to the git root, not the current working directory
- Running
claudefrom a subdirectory uses the git root for the project directory
This matters for anyone building hooks or tooling that needs to find session files programmatically. The current hooks documentation does not mention how project directories are derived or where session .jsonl files are stored.
Proposed Solution
Document the mapping behavior in the hooks documentation, specifically:
- How the working directory maps to the
~/.claude/projects/directory name - That the git repository root is used when inside a git repo (not
$PWD) - Where session
.jsonlfiles are stored and their naming convention - That
$PWDin hook scripts may differ from the project directory path
Related
- #24745 (Cannot rename project directory)
- #22248 (Sessions fail after moving project directory)
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗