CLAUDE_CONFIG_DIR explained: what moves, stays and breaks
CLAUDE_CONFIG_DIR is the one setting behind every “two Claude Code accounts” setup. It looks simple: point it at a folder and Claude Code uses that folder. In practice it moves almost everything, leaves a few important things where they were, and has some rough edges that are still open bugs.
This post maps all three, for Windows, using Anthropic’s docs and what we saw on Claude Code 2.1.287.
The short answer
Section titled “The short answer”- Moves: your login, settings, user
CLAUDE.md, skills, agents, commands, plugins, history and the account state file. - Stays: everything in your repositories, managed settings from your company, and any API key or token in your environment.
- Breaks, or needs care: plugin folders shared between config folders, some plugin installs, the VS Code extension, and a user
CLAUDE.mdthat is still read from the default folder in some cases.
What the variable does
Section titled “What the variable does”The environment variable reference says: “Override the configuration directory (default: ~/.claude). All settings, session history, and plugins are stored under this path.” It adds: “Useful for running multiple accounts side by side”, and “Set it in your shell, user settings, or managed settings. Ignored in project and local settings.”
On Windows, “~/.claude means %USERPROFILE%\.claude”.
To see which folder a running claude uses:
claude auth statusThe JSON has a configDirectory field (Claude Code 2.1.268 or later), which names the folder in use.
What moves with it
Section titled “What moves with it”The docs page on the .claude directory says: “If you set CLAUDE_CONFIG_DIR, every ~/.claude path on this page lives under that directory instead.” That page lists, among others:
| Item | Path inside the folder |
|---|---|
| Settings | settings.json |
| User memory | CLAUDE.md, rules\*.md |
| Skills | skills\<name>\SKILL.md |
| Agents and commands | agents\*.md, commands\*.md |
| Plugins | plugins\ |
| History | history.jsonl, projects\<project>\... |
| Login | .credentials.json |
| Keybindings, output styles, themes | their own files and folders |
Two details matter for accounts:
- The login is a plain file on Windows. The docs: “On Windows, credentials are stored in
%USERPROFILE%\.claude\.credentials.jsonand inherit the access controls of your user profile directory.” And: “If you’ve set theCLAUDE_CONFIG_DIRenvironment variable, Claude Code keeps the.credentials.jsonfile under that directory instead.” Windows Credential Manager is not involved. - The account state file moves inside. For the default account,
.claude.jsonsits outside the folder, at%USERPROFILE%\.claude.json. The settings docs say it “holds your sign-in session, MCP server configurations, per-project state such as trust decisions”. The docs do not say where it goes when the variable is set. In our test, runningclaude auth statuswithCLAUDE_CONFIG_DIRpointing at an empty folder created.claude.json(and abackupsfolder) inside that folder. There is an open proposal to move the default one inside too (#83143).
So the default account is split across %USERPROFILE%\.claude and %USERPROFILE%\.claude.json, while every other account is one folder. Keep that in mind when you back up, copy or delete.
What stays where it was
Section titled “What stays where it was”- Your repositories. Project files “live in your repo under
.claude/”, plusCLAUDE.mdand.mcp.jsonat the root. Every account sees the same project settings, project skills and project MCP servers. - Managed settings. On Windows, company policy lives in
C:\Program Files\ClaudeCode\and in the registry underHKLM\SOFTWARE\Policies\ClaudeCodeandHKCU\SOFTWARE\Policies\ClaudeCode. ManagedCLAUDE.mdis atC:\Program Files\ClaudeCode\CLAUDE.md. These apply to every config folder. - Credentials from the environment. The docs list an order: cloud provider credentials,
ANTHROPIC_AUTH_TOKEN,ANTHROPIC_API_KEY,apiKeyHelper,CLAUDE_CODE_OAUTH_TOKEN, then the subscription login from/login. Anything earlier in that list wins over the folder’s login. - Console sign-ins without an API key. The docs warn that separate directories “don’t keep two Claude Console sign-ins without an API key apart, because Claude Code stores that kind of sign-in outside the configuration directory”.
What breaks, or needs care
Section titled “What breaks, or needs care”These are open issues on the Claude Code GitHub as of 2 October 2026. Check them before you build on top.
Shared plugin folders. Linking one account’s plugins folder to another’s is tempting. #82272 reports that a marketplace added from one config folder is flagged as “corrupted installLocation” in the other, because the path is checked as text, not as the real folder. The reporter adds that the suggested fix, removing and re-adding the marketplace, removed every installed plugin of that marketplace from their list. Install plugins in each account instead.
Plugin installs landing in the default folder. #74393 reports /plugin install writing to ~/.claude instead of the folder in CLAUDE_CONFIG_DIR. After installing, check with claude plugin list under the account you meant.
The user CLAUDE.md. #88528 and #80580 report that ~/.claude/CLAUDE.md can still be loaded when the variable points elsewhere. If your accounts must not share instructions, test this on your version.
The VS Code extension. The extension has a claudeCode.environmentVariables setting. The changelog for 2.1.284 says CLAUDE_CONFIG_DIR there now applies “only when it is an absolute path”. There is also an open bug titled “VS Code extension ignores CLAUDE_CONFIG_DIR environment variable” (#30538). The desktop app’s docs do not mention the variable at all.
Logins and token refresh. Each folder has its own login and refreshes it on its own. There are open reports in this area, such as #95822 (short-lived commands that start a refresh and exit without saving it) and #91571 (a Windows refresh problem with .credentials.json). Signing the same account in to two folders doubles your exposure to these, with no benefit.
Never copy these files
Section titled “Never copy these files”When you set up a second folder from your first, leave these out:
.credentials.json: the login itself..claude.json: account state, trust decisions and MCP server entries, some of which may hold API keys.- any
*.lockfile.
Sign the new folder in with claude auth login instead. The rest of what you want to bring over (skills, agents, commands, CLAUDE.md, settings) is covered in Share Claude Code skills between two accounts.
How Devpit uses the variable
Section titled “How Devpit uses the variable”Devpit’s Claude Code accounts are built on exactly this documented variable. See Claude Code accounts.
- One folder per extra account, under
%USERPROFILE%\.devpit\accounts\claude\<name>\, outside OneDrive and outside Devpit’s cache. Your default account stays in%USERPROFILE%\.claude, untouched. Folders you already have stay where they are and are just pointed at. - Set per process, never per session. A small
claude.exeshim setsCLAUDE_CONFIG_DIRfor the oneclaudeit starts, chosen by the nearest folder rule. Nothing is written into your PowerShell session or your user environment. - The login files are never copied. Devpit’s sharing step has a fixed deny list:
.credentials.json,.claude.jsonand*.lockare never cloned. Login and account info are shown in the list, locked. - Plugins are “same list”, not a shared folder, because of #82272. Devpit copies the list of enabled plugins and marketplaces, and each account installs its own copy.
- MCP servers are copied only as the server entries from
.claude.json, never the whole file. That item is unticked by default and asks twice, since entries may contain API keys. - Same email twice shows a warning when you add the account.
- “Who am I” is
claude auth statuswith the folder set. Devpit reads the email and organization, never the token. - Devpit’s Clean feature refuses to select login and account folders, so a disk clean-up cannot remove them.
Like the variable itself, Devpit’s rules apply to claude in terminals. Editor extensions and the desktop app keep their own login.
Checklist
Section titled “Checklist”- Run
claude auth statusand readconfigDirectoryto know which folder is in use. - Remember the default account has a second file,
%USERPROFILE%\.claude.json. - Check for API keys or tokens in your environment; they win over the folder.
- Never copy
.credentials.jsonor.claude.jsonbetween folders. - Install plugins per account; do not link the plugins folder.
- Test the VS Code extension separately if you rely on it.
Sources
Section titled “Sources”- Claude Code: Environment variables (
CLAUDE_CONFIG_DIR) - Claude Code: The .claude directory
- Claude Code: Settings (
.claude.json, Windows paths) - Claude Code: Authentication (credential storage, precedence, multiple accounts)
- Claude Code: Managed settings
- Claude Code: CLI reference (
claude auth status) - Claude Code: Changelog
- Issue #82272: installLocation validated by string prefix
- Issue #74393: /plugin install writes to ~/.claude
- Issue #88528: user memory not redirected
- Issue #80580: user-level CLAUDE.md discovery
- Issue #30538: VS Code extension ignores CLAUDE_CONFIG_DIR
- Issue #83143: move ~/.claude.json into the config directory
- Issue #95822: short-lived commands and OAuth refresh
- Issue #91571: Windows refresh-token rotation
Common questions
Where is the Claude Code config folder on Windows?
By default %USERPROFILE%\.claude. The docs say that on Windows ~/.claude means %USERPROFILE%\.claude. The account state file .claude.json sits next to it, at %USERPROFILE%\.claude.json.
Can I set CLAUDE_CONFIG_DIR in a project's settings file?
No. The docs say to set it in your shell, user settings or managed settings, and that it is ignored in project and local settings.
Is it safe to copy my whole .claude folder to make a second account?
Not as a whole. The folder holds .credentials.json, your login, and copying it would give the second folder your first account's login. Copy or link only the parts you want to share, such as skills, and sign the new folder in on its own.
