claude-code-multi-accounts
v0.3.3
Published
Installer and CLI for switching Claude Code oauthAccount entries across Windows, WSL, and Unix shells.
Maintainers
Readme
Claude Code Multi-Account Switcher
This project installs a local workaround for switching Claude Code OAuth accounts by keeping account snapshots in ~/.ClaudeCodeMultiAccounts.json and writing only the active account back into Claude's live files when switching.
Supported user-facing commands:
cc-switchcc-switch <index>cc-sync-oauthccs(short alias forcc-switch)ccso(short alias forcc-sync-oauth)/cc-switch/cc-sync-oauth
Supported environments:
- Windows (PowerShell/CMD/Git Bash)
- Ubuntu WSL
- Native macOS/Linux with Node.js
- Claude chat shell mode via
!cc-switchand!cc-sync-oauth
Prerequisites:
- Node.js 18+
- Claude Code already installed and logged in at least once
Install:
Recommended (via npm):
npx claude-code-multi-accounts installManual (from source):
git clone https://github.com/Leuconoe/ClaudeCodeMultiAccounts.git
cd ClaudeCodeMultiAccounts
./install.cmd # Windows
./install.sh # macOS / Linux / WSLWhat install does:
- copies the Node CLI into
~/.claude/multi-account-switch/bin - installs
cc-switch,cc-sync-oauth,ccs, andccsowrapper commands - keeps stored account snapshots in
~/.ClaudeCodeMultiAccounts.json - adds an
auth_successhook entry to~/.claude/settings.json - adds a
SessionStartreminder hook to~/.claude/settings.json - if
statusLine.commandalready exists, wraps it and prependsuse !cc-switch / !ccsto the existing HUD output - installs global Claude command wrappers in
~/.claude/commands - creates backups under
~/.claude/backups/multi-account-switch-installer
Uninstall:
Recommended (via npm):
npx claude-code-multi-accounts uninstallManual (from source):
./uninstall.cmd # Windows./uninstall.sh # macOS / Linux / WSLUsage:
cc-switch
cc-switch 1
cc-sync-oauth
ccs
ccsoExample shell output:
$ cc-switch
--- Usage ---
5h used/reset: 22.0% / 2026. 4. 2. 2:00 PM
7d used/reset: 31.0% / 2026. 4. 7. 10:00 PM
Available Claude accounts:
* [0] Alex Example <[email protected]> - Example Workspace - Pro | 5H:22%(~2h 7min) | 7D:31% (5D 10h) | synced: just now
[1] Taylor Example <[email protected]> - Example Workspace - Teams | 5H:?(unknown) | 7D:? (unknown) | synced: never
[2] Jordan Example <[email protected]> - Example Workspace - Enterprise | 5H:42%(~1h 10min) | 7D:51% (4D 6h) | synced: 1d ago
Run cc-switch <index> to make one of these stored entries the active Claude account.$ cc-switch 1
Switched active account to [1] Taylor Example <[email protected]> (Teams).
Stored account list:
[0] Alex Example <[email protected]> - Example Workspace - Pro | 5H:22%(unknown) | 7D:31% (unknown) | synced: just now
* [1] Taylor Example <[email protected]> - Example Workspace - Teams | 5H:?(unknown) | 7D:? (unknown) | synced: never
[2] Jordan Example <[email protected]> - Example Workspace - Enterprise | 5H:42%(unknown) | 7D:51% (unknown) | synced: 1d agoOutput columns:
synced: When the account was last synced into the store5H: Current or cached 5-hour usage percent and reset estimate7D: Current or cached 7-day usage percent and reset estimate- Top usage block: live
5h used/resetand7d used/resetvalues fetched from Claude when available
Claude chat shell usage:
!cc-switch
!cc-switch 1
!cc-sync-oauth
!ccs
!ccsoClaude /command usage:
/cc-switch
/cc-switch 1
/cc-sync-oauth/cc-switch currently still goes through Claude's command-processing path, so !cc-switch remains the primary deterministic execution path. The slash command is installed now so it can benefit from future improvements in Claude's command handling.
Claude startup reminder:
Claude Code Multi-Account Switcher is available.
Use !cc-switch or !ccs to list/switch accounts.
Use !cc-sync-oauth or !ccso to sync the active account into oauthList.Platform notes:
- Windows installs
cc-switch.cmdandcc-sync-oauth.cmdinto~/bin, plus Git Bash-friendlycc-switchandcc-sync-oauthwrappers in the same directory. - Short aliases
ccsandccsoare installed alongside the full command names. - Native macOS/Linux installs commands into
~/.local/bin. - WSL also uses the Unix shell wrappers.
- If a shell says
command not foundright after install, restart the shell or runhash -ronce.
Behavior notes:
- The tool stores metadata and credential snapshots in
~/.ClaudeCodeMultiAccounts.json. cc-sync-oauthimports the current live account into that store.- Switching writes only the active
oauthAccountback into~/.claude.jsonand the active credential snapshot back into~/.claude/.credentials.json. - It creates backups before writing live files or the store file.
- Stored account ordering is stable.
- If a stored
displayNameis already corrupted, output falls back to the email local part. - The displayed plan type is a best-effort inference from the available account fields and credential snapshot.
- The
reset:column shows rate limit countdown for the current account, or a 7-day window estimate for others. - Usage info from the Claude API is shown before the account list when rate limited.
Warnings:
- This is a local workaround, not an official Claude plugin.
- It still mutates internal Claude live files when switching accounts, but it no longer uses
~/.claude.jsonas the primary multi-account store. - Native macOS/Linux support is implemented, but still needs real-host validation beyond Windows/WSL testing.
- npm packaging is prepared, but npm registry publish still requires npm authentication.
After this:
- npm /
npxrelease refresh forv0.2.5 - non-AI hook execution path for
/cc-switchif Claude exposes a direct command hook in the future - improve plan type detection beyond the current best-effort inference
