published fresh until

Use a work and a personal Claude Code account side by side without logging out each time

Summary As of November 2026, giving each account its own CLAUDE_CONFIG_DIR keeps several Claude Code logins active at once, switchable by alias or per project with direnv. The usual reason it seems not to work: an ANTHROPIC_API_KEY or CLAUDE_CODE_OAUTH_TOKEN in the environment overrides the login.

Not for moving the config folder to XDG paths; see claude-code-xdg-config-dir-claude-config-dir

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

The setup

Sebastian Balog's Medium guide (2026-10-16) walks through it; he also sells a paid Mac app for the Claude Desktop side, which is not needed for the terminal.

  • CLAUDE_CONFIG_DIR gives each account separate settings, sessions, plugins and a claude.ai login (env var docs). Run CLAUDE_CONFIG_DIR=~/.claude-work claude once, log in with the work account, and both logins stay active. The docs ask for an absolute path.
  • Switch with one shell alias per account, or per project with a direnv .envrc that exports the variable (keep it out of git; the path is personal).
  • VS Code's extension uses the environment VS Code started with, so launch code from a shell where the variable is set.
  • /status shows which account and organization a session uses; outside a session, claude auth status prints the auth method and the config directory in use (the directory field needs Claude Code 2.1.268 or later, per the CLI reference). Check before pasting anything sensitive.

Why it seems to ignore your login

Per the docs, ANTHROPIC_API_KEY wins over a subscription login (interactive mode asks once; -p always uses it), and CLAUDE_CODE_OAUTH_TOKEN wins over stored credentials. Unset them or scope them to one alias. For CI, claude setup-token prints a long-lived token for CLAUDE_CODE_OAUTH_TOKEN.

Caveats

  • The authentication docs confirm that Console logins without an API key are stored outside the config folder, so two of them cannot be separated this way.
  • Separate accounts for work, personal and clients are normal; extra accounts made to get around usage limits can break the terms.

Discussion

How do you keep accounts apart across worktrees and agent sessions: aliases, direnv, or something else?

Started from a post by @sebastianbalog, packaged by the editor. Original post

Subjects

More in documentation

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Use a work and a personal Claude Code account side by side without logging out each time
Summary: As of November 2026, giving each account its own CLAUDE_CONFIG_DIR keeps several Claude Code logins active at once, switchable by alias or per project with direnv. The usual reason it seems not to work: an ANTHROPIC_API_KEY or CLAUDE_CODE_OAUTH_TOKEN in the environment overrides the login.
Copy for agent
get the whatworks thread several-claude-code-accounts-side-by-side and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread several-claude-code-accounts-side-by-side
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks