Manage Multiple AI Coding Agent Accounts

Cross-tool · CLI v0.3.11 · Desktop v0.2.1 · Updated September 29, 2026

Save each login as a named aisw profile per tool, map one profile per tool into a context with `aisw context create work --claude work --codex work --gemini work --antigravity work`, then run `aisw context use work` to switch Claude Code, Codex CLI, Gemini CLI and Antigravity CLI together. If every tool has a profile with the same name, `aisw use --all --profile work` does the same without a context. Check the result with `aisw status --context`.

Each coding agent keeps its login somewhere different: Claude Code in its config directory or the macOS Keychain, Codex CLI under CODEX_HOME, Gemini CLI and Antigravity CLI under ~/.gemini. Logging out and back in works for one switch. With a work account, a personal account and four tools, it is how you end up running Codex on the wrong bill.

aisw handles multiple AI coding agent accounts on one machine in two layers. A profile is one saved account for one tool. A context is a named set of profiles, one per tool, that you switch with a single command. The profiles, contexts and workspace rules guide explains when you need each layer; this page is the setup.

1. Save a profile per tool

Run aisw init once. It installs the shell hook and offers to import whatever accounts are already signed in. Then add the rest. Pick the input path per account:

Terminal window
aisw add claude work --from-live
aisw add codex work
aisw add gemini work --api-key "$GEMINI_API_KEY"
aisw add antigravity work --from-live
  • --from-live captures the account the tool is signed in to right now, without a login flow, and marks that profile active. Sign in to the work account upstream first, then capture it.
  • No flag runs the tool’s own sign-in. For Claude Code aisw spawns claude auth login; for Codex CLI it points CODEX_HOME at the profile and runs the device-auth flow there; for Antigravity CLI it runs agy. Prefer this for Codex ChatGPT accounts: a --from-live capture works, but the interactive login keeps future token refreshes tied to that profile.
  • --api-key stores a key. Use --api-key-stdin or --from-env when you don’t want the key in shell history. Gemini CLI stopped serving personal Google accounts on June 18, 2026, so an API key or Vertex AI is the usual Gemini profile now.

Repeat with personal for your second set of accounts. A name only has to be unique within its tool: work can exist for Claude Code and for Codex CLI. If you add the same underlying account twice under different names, aisw rejects the second one when it can read the account identity.

Per-tool details, including Claude Code’s shared Keychain caveat, are in the Claude Code login guide and the Codex CLI login guide.

2. Create a context

Map one profile per tool under a single name:

Terminal window
aisw context create work \
--claude work \
--codex work \
--gemini work \
--antigravity work

The profile names don’t have to match the context name or each other. --codex work-api-key is fine if that is the Codex profile you want for work. Leave out a tool and the context won’t change it.

Every profile must already exist. A typo fails before anything is saved:

Error: profile 'acme' not found for claude.
Run 'aisw list claude' to see available profiles.

Review what you saved with aisw context list, and change one mapping later with aisw context set work --codex work-api-key.

3. Switch every account with aisw context use

Terminal window
aisw context use work
Activated context
─────────────────
Context : work
Effects
Claude Code -> work (isolated)
Codex CLI -> work (isolated)
Gemini CLI -> work
Antigravity CLI -> work
Next
Run 'aisw status --context' to verify the active mapping.

Before writing anything, aisw snapshots the live state of every tool in the context. It then applies each profile and records the new active set only after all of them succeed. If one tool fails, it restores the snapshots, so a half-switched setup does not survive the error. On macOS, the Claude Code step can trigger a Keychain prompt because Claude reads its active login from the Keychain.

Switching back is the same command with the other name: aisw context use personal.

Or skip the context: aisw use --all --profile

If every tool already has a profile with the same name, you don’t need a context:

Terminal window
aisw use --all --profile personal

This switches every tool that has a personal profile in the same snapshot-and-rollback transaction as a context. It prints nothing on success, except for tools it skipped because no profile has that name:

(skipped agy — no profile named 'personal')

Read that line before you start work. A skipped tool is still on its previous account. If no tool has the profile, the command fails with Error: no tool has a profile named 'personal'.

Verify before you open the repository

Terminal window
aisw status --context
Status
────────────
Context : exact
Active context: work
Matches : work
claude : work
codex : work
gemini : work
agy : work

exact means every active profile matches one saved context. Below this block, status lists each tool’s auth type, backend and credential state. If you later switch one tool by hand, for example aisw use codex personal, the header changes to Context : drift and names the contexts that nearly match. Run aisw context use work again to bring all four back in line.

aisw status --json and aisw context use work --json give scripts the same information. aisw verify compares aisw’s records against the live tool state, but it checks every supported tool. A tool you never installed reports tool binary not found on PATH and makes the summary fail even if it isn’t in your context.

To make a repository refuse the wrong accounts, bind it to the context and let the shell hook warn or block before claude, codex, gemini or agy starts. See prevent the wrong account in a repository.

Desktop method

AI Switcher Desktop shows the same contexts as Sets. Select work, check the four mapped profiles, and activate it. The live-match indicator shows whether each tool actually reached the expected account.

AI Switcher Desktop showing saved multi-tool context mappings and live-match status

Common problems

Only some tools changed. Run aisw context list. A tool shown as - is not mapped, so the context leaves it alone by design. With aisw use --all, look for (skipped …) lines.

Error: context 'work' not found. Context names are exact. aisw context list shows what exists.

A session that was already running still uses the old account. aisw changes each tool’s live account state, not processes that already loaded it. Restart Claude Code, Codex CLI, Gemini CLI or agy sessions, and any editor extension or long-lived shell, after a switch.

Codex CLI logs out or lands on another account after a refresh. This happens when a ChatGPT-managed Codex profile was captured with --from-live. An imported session is a bootstrap, not a durable profile. Add the account again through the interactive login, for example aisw add codex work-chatgpt, then point the context at it with aisw context set work --codex work-chatgpt.

For client work, where each client gets its own context and repositories, see managing client accounts.

Frequently asked questions

Do all four tools need to be in every context?

No. A context maps only the tools you pass to aisw context create. Leave a tool out and aisw context use never touches it, so you can switch Claude Code and Codex CLI together while Gemini CLI stays on its own account.

Can the profile names differ across tools?

Yes. The context name is the reusable setup name, and each mapping points at whatever profile exists for that tool, for example --claude work --codex work-api-key. Only aisw use --all requires the same profile name in every tool.

What happens if one tool fails to switch halfway through?

aisw snapshots the live state of every tool in the context before it writes anything. If any tool fails, it restores those snapshots and reports the error, so you are not left with Claude Code on one account and Codex CLI on another.

Should I use aisw context use or aisw use --all?

Use aisw use --all --profile <name> when your profiles already share a name across tools and you want no extra setup. Use a context when the names differ, when only some tools should move, or when a repository binding or the desktop app needs a saved name to refer to.

Is Antigravity CLI isolated per profile like Claude Code and Codex CLI?

No. Upstream does not document a per-profile auth root for agy, so aisw switches Antigravity CLI by restoring its shared live keyring entry and its ~/.gemini config roots. It is still part of the context and switches in the same transaction.

Make your next account switch a single command.

Install aisw, run aisw init, and the accounts you are signed into become named profiles.

brew install burakdede/tap/aisw