agent-mux is an unofficial, extensible profile wrapper for AI agent CLIs.
Command: amux.
Current built-in providers:
- Codex CLI (
codex) - Claude Code CLI (
claude) - Gemini CLI (
gemini)
It lets you keep account A in terminal A and account B in terminal B, while isolating provider storage per profile.
- Avoid repeated logout/login switching
- Keep auth and local state separated per profile
- Use one command shape across providers (
amux <provider> ...) - Add new providers (Gemini, etc.) without rewriting core profile logic
- This project is not an official OpenAI, Anthropic, or Google product.
- Product names are trademarks of their respective owners.
- amux only wraps installed CLIs and routes profile-specific environment variables.
- Node.js + npm
- Provider CLIs installed and available in PATH
- Codex CLI:
codex - Claude Code CLI:
claude - Gemini CLI:
gemini
- Codex CLI:
npm install
npm run build
npm linkThen:
amux --helpCommon profile commands:
amux use [profile]amux currentamux listamux providers
Provider commands:
amux codex login|logout|status|run [args...]amux claude login|logout|status|run [args...]amux gemini login|logout|status|run [args...]
Codex remote login helpers:
amux codex login-device->codex login --device-authamux codex callback-> forward a browserhttp://localhost:<port>/...redirect URL to the Codex login server on this machine
Selection aliases:
amux use-> choose from registered profilesamux login-> choose a provider, then run loginamux login <provider>-> run that provider login without a prompt
Legacy compatibility aliases:
amux logout->amux codex logoutamux run->amux codex runamux run <profile>-> run Codex with that profile withoutamux use
Run shortcuts:
amux codex run <profile>amux claude run <profile>amux gemini run <profile>
Terminal 1 (account A):
amux use a
amux login
amux claude login
amux codex run
amux run aTerminal 2 (account B):
amux use b
amux login claude
amux claude login
amux claude runStatus:
amux current
amux list
amux list --json
amux codex status
amux claude status
amux gemini statusamux does not automate OAuth/browser flows.
When running amux login, amux codex login, amux claude login, or amux gemini login, users complete browser sign-in and terminal confirmation directly. amux only isolates each profile's storage path.
Gemini CLI does not expose a separate login CLI subcommand; it starts auth from the gemini app. amux gemini login and amux login gemini launch Gemini CLI with the selected profile's GEMINI_CLI_HOME.
On a remote server, VM, or EC2 instance without a local browser, prefer device-code login.
amux use a
amux codex login-deviceYou can also pass the Codex option directly.
amux codex login --device-authIf you must use the browser redirect flow, keep the Codex login process running on the remote terminal. After signing in locally, copy the browser address bar's http://localhost:<port>/... redirect URL and paste it into amux codex callback on the remote machine.
# Remote terminal A
amux codex login
# Authenticate in your local browser and copy the localhost redirect URL.
# Remote terminal B
amux codex callbackThe redirect URL can contain a one-time code or token. Do not paste it into chats, issues, or shell history; prefer pasting it directly into the amux codex callback prompt.
Default home resolution order:
AMUX_HOME- fallback
~/.amux
State files:
state.jsonstate.backup.json(automatic backup before overwrite)
amux uses:
- state schema versioning (
v3) - automatic migration from older schemas (
codex-mux v1, unified v2) - atomic write (
temp file + rename) to reduce corruption risk
This is designed to prevent data loss during upgrades.
amux is intentionally isolated from legacy mux paths to avoid cross-project profile collisions.
The CLI is provider-registry based. To add a provider, define in src/index.ts:
- provider id/label
- binary name
- env var key
- default home dir name
- login/logout args
- status reader
After adding one provider definition, amux <provider> login/logout/run/status is created automatically.
Korean documentation is available at README.ko.md.