{"slug": "one-brain-two-wallets-two-claude-code-accounts-on-one-machine", "title": "One Brain, Two Wallets: Two Claude Code Accounts on One Machine", "summary": "A developer created a setup to run two Claude Code subscriptions on one machine by using separate config directories and symlinks, allowing seamless switching between accounts while sharing skills, MCP servers, and settings. The solution includes aliases, symlinks for shared resources, and a shell shim to route session resumes to the correct account.", "body_md": "I hit my Claude Code usage limit mid-week. I have a second subscription, but switching accounts the naive way — `/logout`\n\n, `/login`\n\n, repeat — is miserable, and it turns out \"switching accounts\" in Claude Code silently means switching *everything*: skills, MCP servers, settings, hooks, memory, session history. All of it.\n\nWhat I actually wanted: **one brain, two wallets.** Same skills, same MCP servers, same muscle memory — just a different subscription getting billed.\n\nHere's the setup that got me there. ~20 minutes, fully reversible.\n\nClaude Code keeps all its state in a config directory — `~/.claude`\n\nby default — and honors a `CLAUDE_CONFIG_DIR`\n\nenv var to point elsewhere. That's the whole trick:\n\n```\n# ~/.zshrc\n# Claude Code multi-account aliases\nalias claude-work='CLAUDE_CONFIG_DIR=~/.claude claude'\nalias claude-personal='CLAUDE_CONFIG_DIR=~/.claude-personal claude'\nmkdir ~/.claude-personal\nsource ~/.zshrc\nclaude-personal   # prompts OAuth login for the second account — one time\n```\n\nCredentials land in whichever dir is active. Bare `claude`\n\nstill defaults to `~/.claude`\n\n, so nothing about your existing workflow changes.\n\n`.claude.json`\n\nmoves when you set the env var\nClaude Code's user-level config file (`~/.claude.json`\n\n— MCP servers, folder trust, onboarding state) lives *next to* `~/.claude`\n\n, not inside it. But when `CLAUDE_CONFIG_DIR`\n\nis set, it's read from *inside* the config dir instead.\n\nSo `claude-work`\n\n— even though it points at the same `~/.claude`\n\nyou've always used — creates a fresh, empty `~/.claude/.claude.json`\n\nand suddenly has zero MCP servers. Fix: symlink it to the master, since it's the same account:\n\n```\nln -s ~/.claude.json ~/.claude/.claude.json\n```\n\nNow bare `claude`\n\nand `claude-work`\n\nare byte-for-byte identical.\n\nThe second account starts as a blank slate. Since only billing should differ, symlink everything shareable from the main dir:\n\n```\ncd ~/.claude-personal\nln -s ~/.claude/skills skills\nln -s ~/.claude/CLAUDE.md CLAUDE.md\nln -s ~/.claude/settings.json settings.json        # hooks, permissions, env\nln -s ~/.claude/settings.local.json settings.local.json\nln -s ~/.claude/plugins plugins\n```\n\nOne source of truth: add a skill or tweak a hook once, both accounts see it.\n\nMCP servers need more care. They live in `.claude.json`\n\n, which *also* holds the account identity (`oauthAccount`\n\n) — so you can't symlink the whole file across accounts. Merge just the `mcpServers`\n\nblock:\n\n```\njq --slurpfile mcp <(jq '.mcpServers' ~/.claude.json) \\\n   '.mcpServers = $mcp[0]' ~/.claude-personal/.claude.json \\\n   > /tmp/merged.json && mv /tmp/merged.json ~/.claude-personal/.claude.json\n```\n\n`--resume`\n\ndoesn't know about accounts\nSession transcripts live at `<config-dir>/projects/<project>/<session-id>.jsonl`\n\n. Resume a personal session under the work account and Claude just says the session doesn't exist. Worse, anything that launches bare `claude`\n\nfor you — crash-restore scripts, launchd jobs — always resumes against the default dir.\n\nThe fix is a tiny shim earlier in `$PATH`\n\nthan the real binary. Every session ID exists in exactly one account's tree, so ownership *is* the routing signal:\n\n``` bash\n#!/bin/bash\n# ~/.local/bin/claude — routes --resume to the account that owns the session\nREAL=/opt/homebrew/bin/claude   # wherever `command -v claude` pointed before\n\nif [[ -z \"$CLAUDE_CONFIG_DIR\" ]]; then\n  id=\"\" prev=\"\"\n  for arg in \"$@\"; do\n    if [[ $prev == \"--resume\" || $prev == \"-r\" ]]; then id=$arg; break; fi\n    if [[ $arg == --resume=* ]]; then id=${arg#--resume=}; break; fi\n    prev=$arg\n  done\n  if [[ -n $id ]] && compgen -G \"$HOME/.claude-personal/projects/*/$id.jsonl\" >/dev/null; then\n    export CLAUDE_CONFIG_DIR=\"$HOME/.claude-personal\"\n  fi\nfi\nexec \"$REAL\" \"$@\"\n```\n\nNow `claude --resume <id>`\n\njust works, from anywhere, for either account. Explicit `CLAUDE_CONFIG_DIR`\n\n(your aliases) passes through untouched.\n\nThe whole reason I did this was running out of credits *mid-conversation*. Since a session is just a transcript file, \"continue this work conversation on my personal account\" is a copy + resume:\n\n``` bash\n#!/bin/bash\n# ~/.local/bin/claude-pickup <session-id> — continue a work session as personal\nset -euo pipefail\nid=${1:?usage: claude-pickup <session-id>}\nsrc=$(ls ~/.claude/projects/*/\"$id\".jsonl 2>/dev/null | head -1)\n[[ -n $src ]] || { echo \"session $id not found\" >&2; exit 1; }\nproj=$(basename \"$(dirname \"$src\")\")\nmkdir -p ~/.claude-personal/projects/\"$proj\"\ncp -n \"$src\" ~/.claude-personal/projects/\"$proj\"/\nCLAUDE_CONFIG_DIR=~/.claude-personal exec claude --resume \"$id\"\n```\n\nThe work account keeps its copy as history; new turns land only in the personal copy. And since the shim checks the personal tree first, future bare `claude --resume`\n\nof that ID follows the conversation to its new wallet automatically.\n\n`/mcp`\n\nonce in the new account to re-auth. CLI-based MCP servers that use machine credentials work immediately.\n\n```\nclaude              # work (default, unchanged)\nclaude-personal     # second subscription, same brain\nclaude --resume X   # figures out the account itself\nclaude-pickup X     # mid-conversation wallet swap\n```\n\nSame skills, same MCP servers, same hooks, same memory. The only thing that changes is who gets the bill.", "url": "https://wpnews.pro/news/one-brain-two-wallets-two-claude-code-accounts-on-one-machine", "canonical_source": "https://dev.to/daksh-gargas/one-brain-two-wallets-two-claude-code-accounts-on-one-machine-5ejb", "published_at": "2026-07-20 18:56:18+00:00", "updated_at": "2026-07-20 19:06:02.823989+00:00", "lang": "en", "topics": ["developer-tools", "artificial-intelligence", "ai-tools"], "entities": ["Claude Code", "Anthropic"], "alternates": {"html": "https://wpnews.pro/news/one-brain-two-wallets-two-claude-code-accounts-on-one-machine", "markdown": "https://wpnews.pro/news/one-brain-two-wallets-two-claude-code-accounts-on-one-machine.md", "text": "https://wpnews.pro/news/one-brain-two-wallets-two-claude-code-accounts-on-one-machine.txt", "jsonld": "https://wpnews.pro/news/one-brain-two-wallets-two-claude-code-accounts-on-one-machine.jsonld"}}