claude-code - 💡(How to fix) Fix CLAUDE_CONFIG_DIR does not isolate global CLAUDE.md — always loads from ~/.claude/CLAUDE.md

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

The docs state:

CLAUDE_CONFIG_DIR: Override the configuration directory (default: ~/.claude). All settings, credentials, session history, and plugins are stored under this path.

This is false. The global user CLAUDE.md is always loaded from ~/.claude/CLAUDE.md regardless of CLAUDE_CONFIG_DIR.

Root Cause

The docs state:

CLAUDE_CONFIG_DIR: Override the configuration directory (default: ~/.claude). All settings, credentials, session history, and plugins are stored under this path.

This is false. The global user CLAUDE.md is always loaded from ~/.claude/CLAUDE.md regardless of CLAUDE_CONFIG_DIR.

Code Example

# Fresh config dir — no CLAUDE.md inside it
CLAUDE_CONFIG_DIR=~/.claude.test claude

---

Contents of ~/.claude/CLAUDE.md (project instructions, checked into the codebase)

---

alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude'
RAW_BUFFERClick to expand / collapse

Version

2.1.143

OS

macOS

Severity

Documentation mismatch / isolation break

Summary

The docs state:

CLAUDE_CONFIG_DIR: Override the configuration directory (default: ~/.claude). All settings, credentials, session history, and plugins are stored under this path.

This is false. The global user CLAUDE.md is always loaded from ~/.claude/CLAUDE.md regardless of CLAUDE_CONFIG_DIR.

Reproduction

# Fresh config dir — no CLAUDE.md inside it
CLAUDE_CONFIG_DIR=~/.claude.test claude

With ~/.claude/CLAUDE.md present, the injected system prompt contains its full contents even though the active config dir is ~/.claude.test.

Proof: intercepting the raw API payload shows the second user block grows from ~410 chars (just baseline context, when ~/.claude is absent) to ~5,428 chars (same + full ~/.claude/CLAUDE.md content) when ~/.claude is restored — with CLAUDE_CONFIG_DIR unchanged throughout.

The path surfaced in the injection is:

Contents of ~/.claude/CLAUDE.md (project instructions, checked into the codebase)

This path is not in the CWD directory ancestry, ruling out a project-level walk. It is a hardcoded load.

Impact

The advertised multi-account isolation pattern:

alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude'

...does not isolate system prompt instructions. Any CLAUDE.md in ~/.claude bleeds into every profile. For users with sensitive per-account instructions, this is a real confidentiality and behaviour break.

Expected behaviour

Global CLAUDE.md should be loaded from $CLAUDE_CONFIG_DIR/CLAUDE.md, not ~/.claude/CLAUDE.md.

Actual behaviour

Global CLAUDE.md is always loaded from ~/.claude/CLAUDE.md.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix CLAUDE_CONFIG_DIR does not isolate global CLAUDE.md — always loads from ~/.claude/CLAUDE.md