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 claude from 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:

  1. How the working directory maps to the ~/.claude/projects/ directory name
  2. That the git repository root is used when inside a git repo (not $PWD)
  3. Where session .jsonl files are stored and their naming convention
  4. That $PWD in hook scripts may differ from the project directory path

Related

  • #24745 (Cannot rename project directory)
  • #22248 (Sessions fail after moving project directory)

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗