cld lets you keep multiple Claude Code logins (e.g. personal and work) on one
machine and hop between them instantly:
cld auth switch workEach account authenticates exactly once. After that, switching is just a local file swap — no browser, no re-login, no waiting.
Claude Code stores a single active login on your machine. If you have more than one account (a personal Max plan and a work seat, say), the only built-in way to change accounts is to log out and log back in through the browser every time.
cld snapshots each login once and swaps them on demand.
A Claude Code login lives in two files:
| File | What cld reads from it |
|---|---|
~/.claude/.credentials.json |
claudeAiOauth — the OAuth access + refresh tokens (the actual auth) |
~/.claude.json |
userID + oauthAccount — email, org, display name (so the UI and /usage show the right account) |
A profile is a snapshot of just those identity bits. cld auth switch writes
the chosen profile back into the live files. Because the refresh token comes
along for the ride, Claude Code silently refreshes the access token the next time
you use it — so a profile keeps working indefinitely without re-login.
Everything else in ~/.claude.json (your project history, settings, etc.) is left
untouched — cld only rewrites the two identity keys.
Claude Code rotates the refresh token periodically and rewrites
.credentials.json. To make sure a stored profile never goes stale, switching
away from a profile re-snapshots its live tokens first. The practical rule:
Always change accounts with
cld auth switch. Don't hand-edit the credential files, or you can strand a refresh token.
- Linux or macOS
- Python 3.6+ (standard library only — no dependencies)
- Claude Code installed and used at least once
Note:
cldtargets the file-based credential store used on Linux (and macOS when not using the system Keychain). If your Claude Code stores credentials in the macOS Keychain, see Keychain note below.
# clone
git clone https://github.com/10xAlien/cld.git
cd cld
# put it on your PATH (pick a dir that's already on $PATH)
install -m 755 bin/cld ~/.local/bin/cld
# or: sudo install -m 755 bin/cld /usr/local/bin/cldVerify:
cld --help# 1. log into your first account the normal way
claude /login
cld auth save work # snapshot it as "work"
# 2. log into your second account
claude /login # choose the other account in the browser
cld auth save personal # snapshot it as "personal"
# 3. switch freely, forever — no re-auth
cld auth switch work
cld auth switch personalRestart any running claude session after a switch (a live session reads its
credentials at startup and won't pick up the new account mid-run). New sessions
use the new account immediately.
| Command | Description |
|---|---|
cld auth save <profile> |
Snapshot the current Claude Code login as <profile>. Run this once per account, right after claude /login. |
cld auth switch <profile> |
Make <profile> the active account. Re-snapshots the previously active profile first so its tokens stay fresh. |
cld auth list |
List saved profiles. * marks the active one; shows each account's email. |
cld auth current |
Print the active profile. |
cld auth rm <profile> |
Delete a profile. (Does not log that account out elsewhere.) |
The auth word is optional — cld switch work works too.
$ cld auth save work
saved profile 'work' (you@company.com)
$ claude /login
$ cld auth save personal
saved profile 'personal' (you@gmail.com)
$ cld auth list
* personal you@gmail.com
work you@company.com
$ cld auth switch work
switched to 'work' (you@company.com)
restart any running `claude` session to pick up the new account.
$ cld auth current
work (you@company.com)~/.claude/cld-profiles/
├── work.json # a profile (tokens + account identity)
├── personal.json
├── .active # name of the currently active profile
└── .backups/ # timestamped copies of the live files before each write
Profiles and backups are written with 0600 permissions; the directory is 0700.
- Profiles contain live OAuth tokens. Treat
~/.claude/cld-profiles/like a password store. Anyone who can read it can act as those accounts. cldkeeps automatic timestamped backups of.credentials.jsonand.claude.jsonin.backups/before every write, so a bad switch is recoverable. Prune that folder occasionally — those backups also hold tokens.- The repo's
.gitignoreexcludescld-profiles/,*.credentials.json, and.activeso you can never accidentally commit credentials. cld auth rmonly removes the local snapshot. It does not revoke the session — revoke from your Anthropic account settings if you need that.
no credentials at ~/.claude/.credentials.json — run claude /login first
You haven't logged into Claude Code yet (or it's using the Keychain — see below).
Run claude /login, then cld auth save <name>.
Switched, but the running claude still shows the old account
A live session loads credentials at startup. Quit and relaunch claude.
/usage or the displayed email looks wrong after a switch
cld updates oauthAccount in ~/.claude.json. If you edited that file by hand
or it was rebuilt, re-run cld auth save <name> while logged into that account to
refresh the snapshot.
macOS Keychain
If Claude Code stores your token in the Keychain rather than
~/.claude/.credentials.json, cld can't see it. You can force the file-based
store, or extract/inject via the security CLI — this isn't automated yet
(PRs welcome).
rm ~/.local/bin/cld # or wherever you installed it
rm -rf ~/.claude/cld-profiles # removes saved profiles + backups (tokens!)Your active Claude Code login is unaffected.
MIT