{"slug": "i-do-client-work-across-several-claude-code-accounts-so-i-built-a-tool-to-stop", "title": "I do client work across several Claude Code accounts, so I built a tool to stop logging in and out", "summary": "A developer built hatswap, an open-source CLI that keeps multiple Claude Code accounts signed in simultaneously by giving each account its own CLAUDE_CONFIG_DIR under ~/.claude-accounts/<name>, while symlinking settings, skills, agents, plugins, MCP servers, memory and history from the normal ~/.claude. The tool adds per-repo account pinning via a .hatswap file, private accounts that isolate conversation history between clients, and a handoff brief feature that redacts secrets before summarizing work for another tool such as Codex.", "body_md": "I do client work. Most of my clients give me a seat on **their own** Claude Code account, and a few give me a Codex login too. That's the right call for them: the usage is billed to the client, the work stays inside their organisation, and nothing of theirs ends up on my personal account.\n\nFor me it meant a day that looked like this:\n\nI was spending more time switching logins than writing code. So I built **[hatswap](https://github.com/orvi2014/hatswap)**, a small open-source CLI that keeps every Claude Code account signed in at once and moves work between them. Different client, different hat. (If you saw it on X, it was called `claude-account` until this week; old links redirect.)\n\nClaude Code stores its login per configuration directory. `hatswap` gives each account its own `CLAUDE_CONFIG_DIR` under `~/.claude-accounts/<name>`, so each one keeps its own login (in the macOS Keychain, or in that directory on Linux) and they never overwrite each other.\n\nEverything else (settings, skills, agents, plugins, MCP servers, memory and history) is symlinked from your normal `~/.claude`, so every account has the same setup. Only the login changes.\n\nIt never reads, copies or touches your credentials. Every sign-in is done by Claude Code itself. And if you have `ANTHROPIC_API_KEY` exported, hatswap clears it whenever it starts Claude on a named account, with a one-line note, so the key doesn't quietly override that account's login and bill the wrong place.\n\n```\ncurl -fsSL https://raw.githubusercontent.com/orvi2014/hatswap/main/install.sh | bash\n\nhatswap add acme        # browser opens, sign in to the client's account\nhatswap list\n# main   me@personal.com   (~/.claude)\n# acme   me@acme.com\n```\n\nYour existing login shows up as `main` and is used as-is.\n\nThis is the one I use most. Halfway through a task I realise I'm on the wrong account. Inside Claude Code:\n\n```\n! hatswap switch acme\n```\n\nA running Claude Code process can't change its login, so `switch` restarts it with `--resume` on the other account. Same conversation, same session ID, full history. It even restarts it **in the same tab**:\n\n`/exit`, then run `hatswap switch acme` in the same terminal.\nThere's a `/switch acme` slash command too.\n\nRemembering which account goes with which repo is exactly the kind of thing I get wrong at 6 pm.\n\n```\ncd ~/clients/acme && hatswap pin acme\n```\n\nNow plain `claude` in that folder, and every folder under it, starts on Acme's account. Outside it, you get your default. The pin is a one-line `.hatswap` file, and inside a git repo it's added to `.git/info/exclude`, so it never gets committed to the client's repo.\n\nThe order is: an explicit `CLAUDE_CONFIG_DIR` first, then the nearest pin, then your default account (`hatswap default <name>`), then `main`. `hatswap whoami` tells you which one applies and why.\n\nBy default all accounts share conversation history, which is great for your own projects. For client work you often don't want Client A's account able to read what you did for Client B:\n\n```\nhatswap add acme --private    # or: hatswap private acme\n```\n\nA private account keeps its conversations and memory in its own folder. Settings, skills and MCP servers are still shared. If you deliberately hand one of its conversations to another account, it's copied over and the command tells you so.\n\nSometimes I want a second opinion, or I want to try something quickly in Codex:\n\n```\nhatswap handoff codex\n```\n\nReplaying a 200k-token conversation into another tool doesn't work, so this writes a **handoff brief** instead:\n\nIt also collects your current branch, uncommitted changes, recent commits and open PRs, and tells the brief-writer to treat those as ground truth over the transcript. Passwords, API keys and tokens are redacted before anything is summarised.\n\nEach account can also have its **own Codex login**:\n\n```\nhatswap codex-login acme      # Acme's Codex account, in its own CODEX_HOME\nhatswap handoff codex         # uses the Codex login of the session's account\n```\n\nSo a session on Acme's Claude account hands off to Acme's Codex, not yours.\n\nLong sessions get slow and lose the plot. Instead of compacting again:\n\n```\nhatswap refresh               # same account, fresh session, seeded with the brief\nhatswap refresh --edit        # read and fix the brief first\n```\n\nA fresh session that starts from a couple of thousand tokens of accurate brief beats one dragging 200k tokens of history.\n\nIt's not a way to pool or get around usage limits. Creating accounts to evade limits, or sharing and reselling accounts, isn't allowed under Anthropic's terms, and the tool never switches accounts on its own. It's for people who legitimately work across several accounts: clients, a day job and side projects, personal and work.\n\nIt also reads Claude Code's on-disk session files, which aren't a public API. That format could change between versions, so the tool may need updating when it does.\n\nIt's one bash script plus Python 3, on macOS and Linux, MIT licensed, with 151 tests running in CI on both.\n\n```\ncurl -fsSL https://raw.githubusercontent.com/orvi2014/hatswap/main/install.sh | bash\n```\n\nIf it saves you some logging in and out, **I'd really appreciate a ⭐ on the repo**. It helps other people juggling several accounts find it. Issues and PRs are very welcome, and I'd love to hear how you're handling multiple accounts today.", "url": "https://wpnews.pro/news/i-do-client-work-across-several-claude-code-accounts-so-i-built-a-tool-to-stop", "canonical_source": "https://dev.to/robat_das_3c6e956212f6408/i-do-client-work-across-several-claude-code-accounts-so-i-built-a-tool-to-stop-logging-in-and-out-1khp", "published_at": "2026-10-12 17:37:12+00:00", "updated_at": "2026-10-12 17:50:18.381812+00:00", "lang": "en", "topics": ["ai-tools", "developer-tools", "ai-agents", "ai-products"], "entities": ["hatswap", "Claude Code", "Anthropic", "Codex", "OpenAI", "GitHub"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/i-do-client-work-across-several-claude-code-accounts-so-i-built-a-tool-to-stop", "markdown": "https://wpnews.pro/news/i-do-client-work-across-several-claude-code-accounts-so-i-built-a-tool-to-stop.md", "text": "https://wpnews.pro/news/i-do-client-work-across-several-claude-code-accounts-so-i-built-a-tool-to-stop.txt", "jsonld": "https://wpnews.pro/news/i-do-client-work-across-several-claude-code-accounts-so-i-built-a-tool-to-stop.jsonld"}}