The fastest way to switch Codex accounts when limits hit.
Codex is effectively single-active-auth on a local machine. When one account hits its 5-hour usage window, many users end up in repeated logout/login cycles across accounts. cma removes that overhead with safe account switching, encrypted storage, and encrypted backup/restore.
Repository: https://github.com/prakersh/codexmultiauth
If you run multiple Codex accounts, the pain is usually not setup - it is repeated switching after a usage window is consumed. Manual logout/login loops and auth-file handling are slow, error-prone, and distracting.
cma solves that with:
- encrypted credential storage at rest
- atomic account activation with rollback
- encrypted backups and guided restore
- confidence-tiered usage reporting
- both CLI and TUI workflows
cma is built for users who need fast account rotation with less overhead:
- power Codex users juggling multiple accounts to avoid repeated auth friction
- consultants and agencies switching between client identities during tight delivery windows
- teams with strict security posture that want fewer manual auth-file mistakes
- Save current Codex auth into an encrypted vault:
cma save - Switch active account safely:
cma activate <selector> - Create encrypted backups:
cma backup <encrypthash/pass> <name|abspath> - Restore selectively or all-at-once:
cma restore ... [--all] - View account usage with confidence labels:
cma usage <selector|all> - Run interactive terminal UI:
cma tui - Print release info and links:
cma version
- Go
1.24.2 codexCLI onPATH(required forcma newlogin flow)- Optional OS keyring support (CMA falls back to file key storage when needed)
go build -o cma .
./cma --help# Save current Codex account (encrypted)
./cma save
# List saved accounts
./cma list
# Activate an account by selector
./cma activate 1# Encrypted backup (interactive passphrase prompt)
./cma backup prompt weekly-backup
# Restore with interactive selection
./cma restore prompt weekly-backup
# Restore all entries atomically with conflict policy
./cma restore prompt weekly-backup --all --conflict overwrite./cma tuiUse ./app.sh as the standard project workflow entrypoint for building, testing, verification, and release artifacts.
# Quick pre-commit checks
./app.sh --smoke
# Full host-shell verification matrix
./app.sh --verify
# Full verification in isolated temp HOME/XDG/CODEX
./app.sh --verify-sandbox
# Build local binary (./bin/cma)
./app.sh --build
# Run cma through orchestrator
./app.sh --run -- version
./app.sh --run -- tui
# Cross-platform release artifacts (./dist)
./app.sh --release
# Draft-first GitHub release publish
./app.sh --publish-release --draft --notes-file docs/release-notes.mdExecution order for combined flags:
deps -> clean -> fmt -> lint -> test -> race -> cover -> build -> smoke -> verify -> verify-sandbox -> release -> publish-release -> run
./test.sh is a small convenience layer over ./app.sh.
./test.sh quick
./test.sh full
./test.sh prerelease
./test.sh publish -- --notes-file docs/release-notes.mdMappings:
./test.sh quick->./app.sh --smoke./test.sh full->./app.sh --verify-sandbox./test.sh prerelease->./app.sh --verify-sandbox --release./test.sh publish->./app.sh --publish-release --draft
Recommended path:
# 1. Verify in isolated temp HOME/XDG/CODEX
./app.sh --verify-sandbox
# 2. Build dist artifacts and checksums
./app.sh --release
# 3. Create GitHub draft release with assets
./app.sh --publish-release --draft --notes-file docs/release-notes.mdTo publish a draft release after review:
gh release edit v$(cat cmd/VERSION) --draft=falsecma listcma usage <selector|all>cma version [--short]cma savecma new [--device-auth]cma activate <selector>cma delete <selector>cma backup <encrypthash/pass> <name|abspath> [--allow-plain-pass-arg]cma restore <encrypthash/pass> <pathtobackup|name> [--all] [--conflict ask|overwrite|skip|rename] [--allow-plain-pass-arg]cma tui
Full syntax and examples: docs/COMMANDS.md
cma version prints the app version, repository URL, and support URL.
./cma version
./cma version --shortVersion resolution order:
cmd.Version(build-time ldflags override)cmd/VERSION- fallback
dev
Example release build metadata injection:
VERSION=$(cat cmd/VERSION)
COMMIT=$(git rev-parse --short HEAD)
DATE=$(date -u +%Y-%m-%dT%H:%M:%SZ)
go build -ldflags "-X github.com/prakersh/codexmultiauth/cmd.Version=${VERSION} -X github.com/prakersh/codexmultiauth/cmd.Commit=${COMMIT} -X github.com/prakersh/codexmultiauth/cmd.Date=${DATE}" -o cma .- Vault and backup encryption:
XChaCha20-Poly1305 - Backup key derivation:
Argon2id - Strict filesystem permissions: files
0600, dirs0700 - Mutations use lock + atomic write + verification + rollback
- Secrets are not printed in normal command output
Details: docs/SECURITY.md
cma usage labels each result as:
confirmedbest_effortunknown
This prevents false precision when no stable machine-readable quota source is available. It is especially useful for users trying to decide when to rotate to another account without guessing.