Side Projects
Claude Identity
Go CLI to switch between Claude Code accounts without logging in again.
- Go
- CLI
- Claude Code
- Keyring
- GoReleaser


- Role
- Author and maintainer
- Period
- Oct 2026 – Present
Stack
- Backend
- Go 1.26go-keyring 0.2
- Infrastructure
- GoReleaserGitHub Actionsrelease-please
- Testing
- go test
- Tooling
- Claude Code plugin
Personal project, active since October 2026. It is open source and I maintain it alone.
The problem
Anyone using Claude Code with more than one account (say personal and work, or two with separate usage limits) has to log out and log in again, and loses the context of what they were doing. When an account hits its limit, the work stalls.
What I built
cid is a Go binary that stores each account in the OS keyring (Windows Credential Manager, macOS Keychain or Linux Secret Service) and switches between them inside a running Claude Code session. It includes:
- A Claude Code plugin with an
/accountcommand that answers instantly without spending a model turn. - Per-account usage bars for the 5-hour and weekly windows.
- Automatic switching between a principal and a reserve account as the limit approaches.
- Self-update for the binary and the plugin, with checksum verification.
- English and Spanish output.
How a user interacts
- Step 1
User · Registers their accounts
Isolated login, once per account
- Step 2
User · Types /account in Claude Code
- Step 3
Hook · Runs cid hook
No model turn, no shell
- Step 4
cid · Swaps the credentials
Waits for lock files and verifies the login
- Step 5
Claude Code · Continues the same session
Architecture
Claude Code
- PluginType: clientHooks and skills
- Status lineType: channelUsage per account
cid
- CLIType: serviceGo 1.26
- Safe swapType: workerLocks and rollback
- Auto-switchType: workerAnti-flap policy
System
- OS keyringType: infraCredentials
- Claude configType: dataLocal files
Connections
- PluginCLIcid hook
- Status lineAuto-switchusage
- CLISafe swap
- Auto-switchSafe swap
- Safe swapOS keyring
- Safe swapClaude config
- Go test files
- 4141
- Lines of Go, excluding tests
- 8.48.4kapproximate
- Binaries per release
- 66Windows, macOS and Linux, amd64 and arm64
- Latest published release
- v9090
Architecture
cid is a single Go binary (cmd/cid) with its logic in internal/. The Claude Code plugin is Markdown and JSON: a hook calls cid hook and skills invoke the CLI. Each account’s credentials are stored in the OS keyring.
Claude Code
- PluginType: clientUserPromptExpansion
- Status lineType: channelrate_limits
internal/
- cliType: serviceCommands, --json, exit 0/1/2
- swapType: workerSafe swap
- autoType: workerPolicy and state
- profileType: dataProfiles and recovery
System
- KeyringType: infrago-keyring
- FilesType: infraAtomic writes, flock
Connections
- Pluginclicid hook
- Status lineauto
- cliswap
- autoswap
- swapprofile
- swapKeyring
- profileFiles
Account switch flow
- Step 1
cid · Waits for Claude Code lock files
- Step 2
cid · Refuses empty or unknown logins
A token counts as expired 5 minutes early
- Step 3
cid · Writes the target account credentials
Atomic write
- Step 4
cid · Verifies the login
- Step 5
cid · Restores the previous login on failure
Repository layout
- cmd/cid/: entry point
- internal/
- cli/: commands and hook
- swap/: safe swap
- claudecfg/: keyring and Claude files
- credentials/
- profile/: profiles and .bak recovery
- auto/: auto-switch policy and JSON schemas
- settings/: config: env, file, defaults
- login/: isolated login
- pathenv/
- fsutil/: atomic writes, Windows rename
- i18n/: English and Spanish
- plugin/: hooks and skills
- scripts/: install.ps1 and install.sh installers
- docs/: RELEASING and spikes
Stack
Backend
- Go1.26
- go-keyring0.2
Infra
- GoReleaser
- GitHub Actions
- release-please
Testing
- go test
Tooling
- Claude Code plugin
Key decisions
- OS keyring as the store.
ciddoes not implement its own OAuth: login runsclaude auth loginin an isolated temp directory and the credentials end up in Windows Credential Manager, macOS Keychain or Linux Secret Service, throughgo-keyring. - A swap that can be undone. It waits for Claude Code’s lock files, verifies the login after writing and restores the previous one if anything fails. Before building it I ran an experiment (
docs/spikes/r2-hot-swap.md) showing the hot swap was viable. - A hook with no model and no shell.
/accountresolves through aUserPromptExpansionhook that runscid hook, so it answers instantly and uses no turn. - Auto-switch with anti-flap rules. A principal account and reserves, with a 5-point headroom and 5 minutes between switches, so it does not bounce back and forth near the limit.
- Failure-resistant files. Atomic writes,
flocklocking and recovery of corrupt files from a.bakcopy. JSON schemas validate the configuration. - Stable contract.
--jsonoutput and exit codes 0/1/2, so scripts can depend on the CLI.
Testing, CI and deployment
41 test files. GitHub Actions runs gofmt, go vet and go test -race ./... on Ubuntu, macOS and Windows, plus a lint job, CodeQL and Dependabot. Actions are pinned by commit SHA. release-please picks versions from conventional commits and GoReleaser publishes binaries for Windows, macOS and Linux on amd64 and arm64. The installers (install.ps1, install.sh) verify SHA-256 and use gh attestation verify when gh is present. Current version: v0.9.0.
Repository docs
The nicoarbelaez/claude-identity repository includes README.md, README.en.md, docs/architecture.md and docs/RELEASING.md.