What
Claude Code keeps each project's history and sessions in a folder under projects in its config directory, named after the project path. You can now name that folder yourself with CLAUDE_CODE_PROJECT_DIR_NAME, which only applies when CLAUDE_CONFIG_DIR is also set.
Details
- The name must match
[A-Za-z0-9_-]{1,64}. - Windows reserved device names are rejected: con, prn, aux, nul, com0-9, lpt0-9.
- When the override differs from the usual path-derived name, history and session lookup searches both folders, so existing sessions are still found.
Usage
export CLAUDE_CONFIG_DIR=~/.claude-work
export CLAUDE_CODE_PROJECT_DIR_NAME=my-projectEvidence
CLAUDE_CODE_PROJECT_DIR_NAME
Strings lifted out of the shipped bundle, so the claim above can be checked against them.
Names in the bundleCLAUDE_CODE_PROJECT_DIR_NAMECLAUDE_CONFIG_DIR
The entry above is what we published on the day. These lines were added later, as Anthropic's own pages caught up, and they sit beside the original rather than replacing it.
Added since
A small documentation edit on Customize sessions in self-hosted environments touched a line naming CLAUDE_CONFIG_DIR after this was published.
| `CLAUDE_CONFIG_DIR` | Per-session Claude config directory, written at session start from the snapshot of the runner host's config that the runner captures at startup; see [Permissions and tool approval](#permissions-and-tool-approval). W…self-hosted-environments-configuration see the edit
Confirmed since
Anthropic's documentation has since written up CLAUDE_CONFIG_DIR, on Claude Code changelog.
* \[VSCode] Fixed the session list, settings toggles, and chat tabs when `CLAUDE_CONFIG_DIR` is set in a settings file or the `environmentVariables` settingchangelog see the edit
Two sources agreeTwo things we can check say the same as this entry.
Anthropic's documentation agrees
Anthropic's documentation has since written up CLAUDE_CONFIG_DIR, on Claude Code changelog.
Anthropic's release notes agree
Added the optional CLAUDE_CODE_PROJECT_DIR_NAME environment variable: hosts that give each session its own config directory can choose a…
The name it cites is new in this build
New in this build: CLAUDE_CODE_PROJECT_DIR_NAME