[FEATURE]
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
Claude Code stores all user state, configuration, and cached data in a single, fixed directory at ~/.claude on macOS, with no supported way to isolate this data per workspace, project, or client.
For users working with multiple clients—each using separate API keys and proprietary codebases—this creates a risk of unintentional intellectual property leakage. Because all Claude Code state is shared:
Prompts, context, or cached artifacts from one client session may persist and be accessible in another.
API keys and related configuration for different clients are stored side-by-side with no isolation boundary.
There is no clean or verifiable way to guarantee that Claude Code state from one client is not reused when switching to another.
This lack of isolation makes it difficult to meet common contractual and security requirements when working with multiple clients, especially in regulated or high-trust environments. Users are forced to rely on manual workarounds (such as symlinks, wiping directories, or overriding $HOME) that are error-prone and not suitable for security-sensitive workflows.
Proposed Solution
Introduce support for a configurable Claude Code home directory via an environment variable, following the same model used by Codex.
Codex supports the CODEX_HOME environment variable, which defines the root directory for all Codex state (including configuration, credentials, and cached artifacts). This allows users to fully isolate Codex environments by scoping CODEX_HOME per project, client, or API key.
Claude Code could adopt an equivalent approach by:
Supporting an environment variable such as CLAUDE_HOME
Using this directory as the root location for all persistent Claude Code state (config, credentials, cache, session data)
Resolving this path at process startup and ensuring no state is shared across runs when CLAUDE_HOME differs
Defaulting to ~/.claude when the variable is not set, preserving backward compatibility
This pattern is well-understood, easy to audit, and already familiar to users of Codex. It would provide a clear isolation boundary between client environments and materially reduce the risk of cross-client IP or credential leakage without requiring fragile workarounds such as symlinks or $HOME overrides.
Alternative Solutions
_No response_
Priority
Medium - Would be very helpful
Feature Category
Configuration and settings
Use Case Example
_No response_
Additional Context
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗