I use one Claude account for client website work and another for my own apps as an indie developer. For a long time I moved between them with /login inside Claude Code: sign in to the work account, do the job, then run /login again when I went back to my wallpaper app. Clumsy, but it was enough.
What made me rethink it was a GitHub issue I read one evening. Someone switched accounts in one terminal, and a long task running in another terminal was cut off mid-turn and parked behind a prompt that said "This session belongs to another account."
It described my habit almost exactly, and I didn't like how that felt.
Since 2.1.333, a login switch stops running sessions
According to the report, the change arrived in Claude Code 2.1.333. Up to 2.1.332, a session kept going after you switched accounts elsewhere. From 2.1.333, the running turn is aborted when the login changes, and nothing moves until you pick one of three options:
- Exit Claude Code
- Change login (go back to the original account)
- Copy to … and continue (copy the conversation to the new account)
Picking the third one brings up a second confirmation, roughly: continuing this conversation in the new account shares its history with that account. If several sessions are open, each one needs the same steps.
The issue was filed on Windows 11 with an npm install and is marked High priority. A maintainer replied that the next release would add a "don't ask again for X → Y" option and an environment variable, CLAUDE_CODE_DISABLE_ACCOUNT_DIALOG=1, to turn the dialog off. As of December 4, though, neither appears in the published 2.1.336 changelog. Rather than wait for a setting that hasn't shipped, I decided to stop needing the switch at all.
The documented answer is to not switch
The authentication docs say that if you want to stay signed in to several accounts at once, such as work and personal, you should give each account its own configuration directory, chosen with the CLAUDE_CONFIG_DIR environment variable.
Each directory holds its own settings, session history, plugins, and claude.ai login or API key. On macOS, the Keychain entry is keyed to the directory too, so a session started with a different CLAUDE_CONFIG_DIR reads a different entry. On Linux and Windows, .credentials.json lives inside that directory.
So the two accounts stop being things you take turns with. They sit side by side.
Change the door you walk through, not the login behind it. That was the one line I kept on a sticky note while I moved things over.
The migration, step by step
1. Make a separate entry point for work
I left my personal account on plain claude with nothing set, and moved only the work account to a new directory. In Bash or Zsh, one line in ~/.bashrc or ~/.zshrc does it:
# Work entry point. Personal stays on plain `claude`
alias claude-work='CLAUDE_CONFIG_DIR="$HOME/.claude-work" claude'It's tempting to set CLAUDE_CONFIG_DIR="$HOME/.claude" explicitly for the personal side as well. I chose not to. The docs describe what happens when the variable is set; they don't say whether "unset" and "set to the default path" read the same Keychain entry. I'd rather not add something I haven't verified.
PowerShell aliases can't carry environment variables, so on Windows it's a function. Restoring the old value afterwards keeps a plain claude in the same window from picking up the work directory.
# Add to $PROFILE. Restores CLAUDE_CONFIG_DIR when Claude Code exits
function claude-work {
$prev = $env:CLAUDE_CONFIG_DIR
$env:CLAUDE_CONFIG_DIR = "$HOME\.claude-work"
try { claude @args }
finally { $env:CLAUDE_CONFIG_DIR = $prev }
}The first time you run claude-work in a new terminal, Claude Code walks you through login and setup for that directory. Sign in with the work account there and the entry point is ready.
2. Decide what comes along and what stays behind
The new directory starts empty, so your usual settings and personal CLAUDE.md aren't there. I copied settings and instructions only:
mkdir -p "$HOME/.claude-work"
# Copy settings and personal instructions only; skip what doesn't exist
for f in settings.json CLAUDE.md; do
[ -f "$HOME/.claude/$f" ] && cp -n "$HOME/.claude/$f" "$HOME/.claude-work/$f"
done
[ -d "$HOME/.claude/skills" ] && cp -Rn "$HOME/.claude/skills" "$HOME/.claude-work/"
# Do not copy .credentials.json or projects/ (conversation history)Credentials and history stay behind on purpose. Copying credentials would point both directories at the same account, which defeats the whole idea. Copying history is the same act as pressing "Copy to … and continue": it carries personal context into the work organization.
The -n flag is there so a later run never overwrites settings I've already tuned for work.
3. Check that the two doors lead to different accounts
This is the step that matters most. claude auth status prints JSON that includes configDirectory (v2.1.268 and later) and authMethod (claude.ai, oauth_token, api_key and so on), and exits with 1 when you're not signed in. I wrote a small script to show both side by side.
#!/usr/bin/env bash
# check-claude-accounts.sh: show the auth state of both entry points
set -u
# First, look for variables that outrank /login in both entry points
for v in ANTHROPIC_API_KEY ANTHROPIC_AUTH_TOKEN CLAUDE_CODE_OAUTH_TOKEN; do
if [ -n "${!v:-}" ]; then
echo "warning: $v is set; both entry points will use it"
fi
done
show() {
local label="$1"; shift
local json
if json="$("$@" claude auth status 2>/dev/null)"; then
printf '%s\n' "$json" | python3 -c '
import json, sys
d = json.load(sys.stdin)
print("%-8s method=%s dir=%s ends=%s" % (sys.argv[1], d.get("authMethod"), d.get("configDirectory"), d.get("loginExpiresAt")))
' "$label"
else
echo "$label not signed in (claude auth status exited 1)"
fi
}
show "personal" env -u CLAUDE_CONFIG_DIR
show "work" env CLAUDE_CONFIG_DIR="$HOME/.claude-work"What you want to see is two different dir= values, both with method=claude.ai. Which account each one is signed in to isn't a documented JSON field, so I confirmed that once by eye, with claude auth status --text and the email shown in /status.
If both lines come back the same
Sometimes both lines report method=oauth_token or method=api_key. The directories are separate, but the same credential is in use.
The most likely cause is a long-lived token from claude setup-token, made for unattended runs and left in your shell profile as CLAUDE_CODE_OAUTH_TOKEN. In the credential order, that variable and ANTHROPIC_API_KEY both rank above subscription logins from /login. Separate directories don't help, because an environment variable reaches both entry points equally. That's why the script checks for these variables first.
The fix is to remove the variable from your shell profile and set it only inside the script that runs unattended. Then open a new terminal, run the check again, and confirm the two lines are separate claude.ai logins.
A config directory separates where credentials are stored. It does not separate your environment. I wrote up the full credential order, and how to read which one is active, in the note on finding Console charges while paying for Pro.
What separate directories don't separate
The docs list a few more exceptions worth knowing before you rely on this.
| Situation | Separated? | What to do |
|---|---|---|
| claude.ai logins (Pro, Max, Team and so on) | Yes | Sign in once per entry point |
| Console sign-in without an API key | No | It's stored outside the config directory, so two of them can't sit side by side |
| CLAUDE_CONFIG_DIR in a project's .claude/settings.json | Ignored | Set it in your shell, user settings or managed settings (absolute path in a settings file) |
| ANTHROPIC_API_KEY or CLAUDE_CODE_OAUTH_TOKEN in your shell | No | Set them only inside the scripts that need them |
It would be lovely to mark a project folder as "work" and have the switch happen by itself, but project and local settings can't set CLAUDE_CONFIG_DIR. I've accepted that choosing the door is my job when I start a session.
Before you carry a conversation across
Even after the move, there are moments when I want to continue something I started on the personal side inside the work account. When that happens, I don't copy the conversation. I write the conclusion as a short note and hand that to a fresh session.
If your work account belongs to a Team or Enterprise organization, copied history falls under that organization. Going the other way, copying client work into a personal account leaves a client's code and circumstances in your personal history. "Copy to … and continue" is a convenient exit, but I think it's worth one pause first: would I be fine with the other account's owner seeing this conversation?
For the related boundary between Claude.ai projects and account memory, see what Claude learns inside a project can reach your everyday chats.
If you're stuck on the dialog right now
If a session is already waiting on the prompt, pick by what you need. To keep the running work on the original account, choose Change login. If you don't mind and you're in a hurry, Exit Claude Code, set up the separate entry point above, and reopen. That's the path I'd regret least. I save Copy to … and continue for times when I've decided the history can go to the other account.
The issue also mentions pinning 2.1.332 to avoid the prompt. That stops every later fix along with it, and what worries me more is my future self forgetting why the updates were frozen, so I didn't go that way.
Start with the one alias claude-work=… line and the check script, and look for two different dir= values. In my case, seeing those two lines next to each other was what finally broke the /login habit.