# claude-account: run two Claude Code subscription logins side by side and swap the active one when one hits its usage cap (Linux)

> Source: <https://gist.github.com/kwadwoadu/7ade7269dfeee6ddc4f51d19dc302c14>
> Published: 2026-07-24 15:34:21+00:00

Run any number of Claude Code subscription logins side by side, switch between them, and auto-rotate to a healthy account when one hits its usage cap. Plus a one-line terminal statusline that shows which account you're on.

Files in this gist:

— the CLI: hold N subscription logins, switch/rotate between them.`claude-account`

— cron probe that auto-switches when the active account is capped.`claude-limit-watchdog`

— bash/zsh tab-completion for the CLI.`claude-account.completion.sh`

- Companion statusline (separate gist):
[https://gist.github.com/kwadwoadu/c8278b2dc005797af6034343c1b2afa5](https://gist.github.com/kwadwoadu/c8278b2dc005797af6034343c1b2afa5)

Claude Code (Linux) stores its login as a single plaintext OAuth file at
`~/.claude/.credentials.json`

, and there's no built-in multi-account support.

- Conversations are
**not** in that file. They live locally in`~/.claude/projects/<cwd>/*.jsonl`

, independent of the account. Switching accounts leaves every conversation in place — there is nothing to "port" on one machine. - So multi-account = keep
**named copies** of the credentials file and swap which one is live.

```
claude-account status          # or: list   -- shows active slot + [capped Nm ago] marks
claude-account save <Name>     # store the current live login into a named slot
claude-account switch <Name>   # or: use    -- make that slot live
claude-account next            # rotate to the next slot (works for any number of slots)
claude-account pin             # pause auto-switch: hold the current account
claude-account unpin           # resume auto-switch
claude-account --help | --version
```

First-time setup (repeat `save`

for each account):

```
install -m 755 claude-account ~/.claude/bin/claude-account   # ~/.claude/bin on PATH
# log into account A in claude (/login), then:  claude-account save accountA
# log into account B in claude (/login), then:  claude-account save accountB
# add a 3rd, 4th, ... the same way. flip any time:  claude-account next
```

Tab-completion (subcommands + your account names):

```
install -m 644 claude-account.completion.sh ~/.claude/bin/claude-account.completion.sh
echo '[ -f ~/.claude/bin/claude-account.completion.sh ] && source ~/.claude/bin/claude-account.completion.sh' >> ~/.bashrc  # and/or ~/.zshrc
install -m 755 claude-limit-watchdog ~/.claude/bin/claude-limit-watchdog
crontab -e   # add:
*/10 * * * * ~/.claude/bin/claude-limit-watchdog
```

Every 10 minutes it probes the **active** account with a tiny Fable call (caps are
per-model, so a cheaper model would falsely read "healthy"). On a cap it marks that
slot and rotates to the next non-capped one; it only declares **all** accounts capped
(the `both-hot`

flag) when every slot carries a fresh cap mark — never guessed from a
timer. The mark clears the instant an account probes healthy again.

```
every 10 min ─▶ probe ACTIVE account
                    │
        ┌───────────┼─────────────┐
      healthy      capped        error
        │            │             │
   clear marks   mark it,      log, wait
   clear both-hot  rotate ─▶ next NON-capped slot ──▶ switch (verify next tick)
                     │
              none left? ─▶ raise both-hot flag (all subs exhausted)
```

Test it without burning quota: `WATCHDOG_FAKE_PROBE=ok|capped|error claude-limit-watchdog`

.

**Pinning (manual hold).** `claude-account pin`

pauses the watchdog on the current account
so it won't rotate you off, even if that account is capped; `claude-account unpin`

resumes.
The pin follows your deliberate `switch`

/`use`

/`next`

moves so it never points at the wrong
account. While pinned the watchdog does nothing at all (no probe, no rotation).

- A
**running** session keeps its OAuth token in memory, so a switch only helps**new or restarted** sessions.`claude --resume`

after a cap picks up the switched account with context intact. - After any manual
`/login`

, run`claude-account save <Name>`

or the slot drifts stale. - Slot files are
`chmod 600`

, the slots dir is`chmod 700`

— these are live credentials. The scripts copy credential files; they never print secrets. - Paths are overridable:
`CLAUDE_ACCOUNTS_DIR`

,`CLAUDE_CREDENTIALS`

,`CLAUDE_ACCOUNT_BIN`

.
