An open-source CLI to run multiple Claude Code accounts at once, one per client. Switch a running conversation between them, history intact.
curl -fsSL https://raw.githubusercontent.com/orvi2014/hatswap/main/install.sh | bashThe problem
Changing accounts used to cost you the conversation.
Claude Code holds one login at a time, so switching Claude Code accounts meant logging out, signing in through the browser, and starting again from nothing.
Without hatswap context lost
Every switch is a logout, a browser sign-in and a blank session.
With hatswap same chat
One command. The tab restarts on the other account and the conversation carries on.
Built for people who bill more than one client.
Multiple accounts, all signed in
Each client keeps its own login. Run two of them in two terminals at once. hatswap add acme
Folders that know their client
Pin a folder once. Every claude started inside it uses that client's account.
Hand off to Codex
Claude writes a brief of the session and repo state; Codex starts from it.
Private history per client
History is shared by default. Mark a client private and its chats stay with it.
Always know where you are
The account sits in Claude Code's status line. statusline --install
How it works
One folder per login. Everything else is shared.
- Logins stay separateEach account is its own
CLAUDE_CONFIG_DIR, so Claude Code keeps a separate sign-in for it (its own Keychain item on macOS). hatswap never reads or copies credentials. - Your setup is written onceSettings, skills, plugins, hooks and history are linked from
~/.claude. Nothing to keep in sync. - Plain
claudepicks the accountA one-line shell hook finds the nearest pinned folder, falls back to your default, and starts Claude there. - It never switches on its ownAccounts change only when you ask.
hatswap usagereports limits and does nothing else.
Running in two minutes.
More than a CLAUDE_CONFIG_DIR alias
An alias per account gets you a second login. hatswap adds what client work needs on top. See how it differs from other account switchers.
| alias claude-acme='CLAUDE_CONFIG_DIR=… claude' | hatswap | |
|---|---|---|
| A separate login per account | Yes | Yes |
| Settings, skills, plugins and history shared | No, each folder starts empty | Yes, linked from ~/.claude |
Plain claude picks the account per folder | No | Yes, with pin |
| Move a live conversation to another account | No | Yes, /switch |
| Hand a session to Codex with a brief | No | Yes, /handoff codex |
| Every account's usage in one table | No | Yes, usage |
| Switches accounts automatically at a limit | No | No, by design |
Before you install
Is it allowed to use several Claude Code accounts?
hatswap is for accounts you legitimately hold, such as your own and the seats clients give you. It never switches accounts automatically and does not rotate between accounts when you hit a limit. Creating accounts to get around usage limits, or sharing and reselling them, is against Anthropic's policies.
How do I switch Claude Code accounts without logging out?
Add each account once with hatswap add, then run /switch <account> inside Claude Code. The session restarts on the other account and resumes the same conversation; in tmux, iTerm2 and Terminal.app it happens in the same tab.
Does hatswap touch my credentials?
No. Sign-in is handled entirely by Claude Code; hatswap only chooses which config folder Claude starts with. Handoff briefs are written through your own Claude login, with common secret formats redacted first.
Can one client see another client's conversations?
By default every account shares history, which is what most people want on their own machine. Run hatswap private <account> and that account keeps its conversations and memory to itself.
What do I need to run it?
macOS or Linux, Bash 3.2 or later, Python 3 and Claude Code. tmux, iTerm2 or Terminal.app let a switch restart the same tab; the Codex CLI is needed only for Codex handoffs.
Is hatswap official?
No. hatswap is an independent, MIT-licensed open-source project. Claude Code's session format is not a public interface, so a Claude Code update can occasionally need hatswap update.
The right hat for every client.
Free and open source. One line to install.
curl -fsSL https://raw.githubusercontent.com/orvi2014/hatswap/main/install.sh | bash