# I do client work across several Claude Code accounts, so I built a tool to stop logging in and out

> 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: 2026-10-12 17:37:12+00:00

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.

For me it meant a day that looked like this:

I 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.)

Claude 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.

Everything 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.

It 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.

```
curl -fsSL https://raw.githubusercontent.com/orvi2014/hatswap/main/install.sh | bash

hatswap add acme        # browser opens, sign in to the client's account
hatswap list
# main   me@personal.com   (~/.claude)
# acme   me@acme.com
```

Your existing login shows up as `main` and is used as-is.

This is the one I use most. Halfway through a task I realise I'm on the wrong account. Inside Claude Code:

```
! hatswap switch acme
```

A 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**:

`/exit`, then run `hatswap switch acme` in the same terminal.
There's a `/switch acme` slash command too.

Remembering which account goes with which repo is exactly the kind of thing I get wrong at 6 pm.

```
cd ~/clients/acme && hatswap pin acme
```

Now 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.

The 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.

By 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:

```
hatswap add acme --private    # or: hatswap private acme
```

A 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.

Sometimes I want a second opinion, or I want to try something quickly in Codex:

```
hatswap handoff codex
```

Replaying a 200k-token conversation into another tool doesn't work, so this writes a **handoff brief** instead:

It 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.

Each account can also have its **own Codex login**:

```
hatswap codex-login acme      # Acme's Codex account, in its own CODEX_HOME
hatswap handoff codex         # uses the Codex login of the session's account
```

So a session on Acme's Claude account hands off to Acme's Codex, not yours.

Long sessions get slow and lose the plot. Instead of compacting again:

```
hatswap refresh               # same account, fresh session, seeded with the brief
hatswap refresh --edit        # read and fix the brief first
```

A fresh session that starts from a couple of thousand tokens of accurate brief beats one dragging 200k tokens of history.

It'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.

It 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.

It's one bash script plus Python 3, on macOS and Linux, MIT licensed, with 151 tests running in CI on both.

```
curl -fsSL https://raw.githubusercontent.com/orvi2014/hatswap/main/install.sh | bash
```

If 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.
