How to use multiple Claude Code accounts on one machine

Logging out of your work account to use your personal one gets old fast. With a config directory per account, both stay signed in and can still share one setup.

Updated

Point CLAUDE_CONFIG_DIR at a separate directory for every extra account. Then link everything except the sign-in and the account's own state back to your main ~/.claude.

clausona does that in three commands:

clausona init              # register the account already signed in
clausona add claude:work   # a second account, with Claude Code's own sign-in
csn use work               # plain `claude` now starts as that account

Why a second account is awkward

Claude Code keeps one signed-in account at a time.

Switching with /logout and /login works, but you have to sign in again. And one terminal can't stay on your work account while another uses your personal one.

The CLAUDE_CONFIG_DIR environment variable moves Claude Code's whole config directory, so a second directory can hold a second sign-in.

But the new directory starts empty. Your settings and hooks aren't there, and neither are your skills or plugins. CLAUDE.md and your history stay behind too.

Install a plugin under one account and the other doesn't have it. From there, the two setups drift apart.

Do it by hand with CLAUDE_CONFIG_DIR

Keep ~/.claude as your main directory. Give the second account a new one, and link into it whatever both accounts should share:

# a directory for the second account
mkdir -p ~/.claude-work

# link what both accounts should share
for item in settings.json CLAUDE.md skills commands agents hooks; do
  [ -e ~/.claude/$item ] && ln -sn ~/.claude/$item ~/.claude-work/$item
done

# start Claude Code there and sign in with the second account
CLAUDE_CONFIG_DIR=~/.claude-work claude

Hooks are configured in settings.json, so linking it shares them. It also shares your permissions, status line and model choice.

The hooks link covers scripts you keep in ~/.claude/hooks.

Then add an alias for the second account:

alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude'

Leave CLAUDE_CONFIG_DIR unset for your main account. Claude Code treats any value as a separate directory, even ~/.claude. With the variable set, it reads ~/.claude/.claude.json instead of ~/.claude.json. On macOS it also looks for a different Keychain item. You land in a second identity that isn't signed in. (Checked with Claude Code 2.1.278 on macOS.)

What must not be shared

A few things must stay out of the links.

Newer Claude Code versions also add directories.

A link you made today doesn't cover a directory that appears next month. The second account quietly ends up with a separate copy, so check your links after you update Claude Code.

This upkeep is where the manual setup wears thin.

Let clausona do it

clausona is a free, open-source CLI that does the steps above and keeps them correct. Install it:

macOS and Linux curl -fsSL https://github.com/larcane97/clausona/releases/latest/download/install.sh | bash
Windows PowerShell irm https://github.com/larcane97/clausona/releases/latest/download/install.ps1 | iex

Then register the account you're signed in to, and add the others:

clausona init              # registers the accounts already signed in
clausona add claude:work   # makes ~/.claude-work and opens Claude Code's sign-in
csn use work               # plain `claude` now starts as the work account
csn use claude:default     # back to the first account; init names it default

clausona gives each account a directory. It links everything from ~/.claude into it except the sign-in, the account file, per-directory state and what Claude Code keeps for one account, like the org's policy limits. Conversation history stays out too, unless you merge sessions.

So settings, hooks, skills, commands, agents, plugins and CLAUDE.md are the same under all of them. clausona also keeps the two plugin files in step, account by account.

When a newer Claude Code adds a directory, clausona doctor reports that it isn't linked yet. clausona repair <profile> links it.

csn is the short name for clausona.

There's no wrapper around Claude Code. A shell hook sets CLAUDE_CONFIG_DIR for the run and starts the real claude, and nothing stays running in the background.

A plain claude launch reads a cached script in the shell, so Claude Code starts as fast as it does without clausona. clausona's own process runs on the first launch after you change something, such as csn use, and on every launch of an API profile. clausona run starts it every time, routed or not.

Share conversation history between accounts

Conversation history lives in projects/. Two directories next to it refer to it by session id: jobs/ for background sessions, and teams/.

Share all three or none of them. A background session can't be resumed if its record and transcript sit in different directories.

With clausona, it's one switch per account:

clausona config claude:work --merge-sessions

Turning it on first copies the account's existing conversations into the shared history, so none are lost.

From then on, claude --resume lists conversations from all the accounts that share history.

claude --continue picks up the latest one in the current folder, whichever account started it. A /goal set in that conversation comes back with it.

--separate-sessions turns it off.

You can also pass --merge-sessions to clausona add or clausona init.

Use two accounts at the same time

csn use sets the account that new claude launches use. To run one session under another account without changing that, start it with clausona run:

clausona run claude:work

One terminal can stay on your main account while another runs the work one, on the same setup.

Arguments after -- go to Claude Code.

See how much each account has left

clausona list shows the 5-hour and weekly limits for all your accounts. It reads them from Claude Code's usage endpoint, with the credential Claude Code stored for the account:

PROFILE             ACCOUNT              5H         7D
claude:work         dev@example.com      62% 1h     41% 3d
claude:personal     me@example.org       8%         77% 5d

Running csn with no arguments opens a dashboard with the same readings and the exact reset times.

Optimize usage across multiple accounts with dynamic routing

With two accounts, it's easy to burn through one while the other sits unused.

clausona's dynamic routing picks the account for you, every time a run starts. It reads each account's current 5-hour and weekly usage and starts on one with room. Accounts take turns, so usage spreads across all of them instead of piling onto one.

You set it up as a route, a named group of your accounts:

clausona route add main        # every Claude Code account, taking turns
clausona route explain main    # who a run would get now, and why
clausona run --route main      # Claude Code starts on that account

An account at 80% or more of its 5-hour or weekly limit sits out while another is still under 80%. The run names the account it got on one line.

clausona route explain main lists three Claude Code accounts with their 5-hour and weekly usage. personal is over 80%, and work is picked next. clausona run --route main says it took claude:work and opens Claude Code, whose /status shows the work account. The same command again takes claude:team, the next in turn.
Of the route's three accounts, personal is over 80%. The first run goes to work and the next to team.

A route doesn't need every account. clausona route add work --from '*@work.example' takes only the accounts on your work email. After clausona route dir ~/work work, a plain clausona run claude anywhere under ~/work starts on one of them.

Plain claude isn't routed. It still starts on the account csn use set.

If every account in the route is used up, nothing starts, and clausona says when each one resets. The routing docs cover the rest, including waiting for an account to free up.

The pick happens once, when the run starts. A running session never moves to another account.

Keep the accounts to what they're for, such as work and personal use, within Anthropic's terms.

Questions

Can I be signed in to two Claude Code accounts at once?

Yes, with one config directory per account. Two terminals with different CLAUDE_CONFIG_DIR values run two accounts side by side. clausona run claude:work starts one session under another account without changing the default.

Do MCP servers carry over to the other account?

Servers that come with a plugin do, because plugins are shared. Servers added with claude mcp add don't. They're stored in that account's own .claude.json, and that file must not be shared. Add them under the other account too, or put them in a project's .mcp.json. The Extensions guide shows which account has which.

Does clausona switch accounts automatically when I hit a limit?

A running session never moves to another account. With a route, clausona picks the account when a run starts. clausona run --route main gets one that still has quota left. Set a directory rule or a default route, and plain clausona run claude does the same. clausona use and clausona run <profile> leave the choice to you. Keep the accounts to what they're for, such as work and personal use, within Anthropic's terms.

Does clausona slow down Claude Code's start?

Not a plain claude launch. That reads a cached script in the shell. On an M4 Pro Mac, claude --version took a median 25 ms with the hook and 25 ms without it. clausona run starts clausona's own process first, routed or not, and that takes about a third of a second. The first launch after a change such as csn use starts it too, and so does every launch of an API profile.

Is my sign-in ever shared?

No, credentials and .claude.json stay with their account.

Does it work with tools that start Claude Code themselves?

The shell hook covers claude started from your shell. A tool that launches Claude Code itself, such as Superset, can start clausona run claude:work -- <args> instead, and it then runs on that account. Give it clausona's full path, which command -v clausona prints.

Can a profile use an API key or another model?

Yes. clausona add claude:gw --api --base-url <url> adds a profile for the Anthropic API, a gateway such as OpenRouter, or a model you serve yourself. It shares the same setup and switches like any account.

Does it work on Windows?

Yes, in PowerShell 5.1 or later. Shared directories are junctions. Turn on Developer Mode. Without it, settings.json, CLAUDE.md and keybindings.json stay a per-account copy, because Claude Code replaces them on every save. clausona doctor says so.

Try clausona

It's free and open source. If it saves you a few sign-ins a day, a star on GitHub helps other people find it.

Using Codex CLI as well? Here's how to use multiple Codex CLI accounts. Running several agents at once? Put them on different accounts and models.