Skip to content

Environment variables

VariableDefaultEffect
AGENT_SWITCH_HOME~/.agent-switchWhere all data and accounts live. The shell integration reads it too, to find active-cli. The downloaded desktop app stays in ~/.agent-switch/gui/ either way.
AGENT_SWITCH_ALLOW_DUPLICATEunsetStart a session on an account that already has one, this once. Any value except empty, 0 or false counts.
AGENT_SWITCH_CC_VERSION_OVERRIDEunsetLets rebind run on a Claude Code version it has not been verified against. Meant for maintainers who re-ran the verification by hand.
SHELL—Picks the shell for shellenv when --shell is not given. On Windows the default is PowerShell.
PSModulePath—Tells shellenv install whether to ask PowerShell 7 or Windows PowerShell for $PROFILE first.
TMUX—Tells takeover --in-place whether it runs inside tmux.
PATH—Where the tools and agent-switch itself are looked up. doctor checks that agent-switch is on it.
APPDATA—On Windows, where the regular Claude Desktop keeps its data (read by desktop).
CLAUDE_CONFIG_DIR—Read by the hook command, to tell which account a hook event came from. A Claude start from inside a session on the same account is not counted as a second session.
CLAUDE_SECURESTORAGE_CONFIG_DIRunsetIf set, rebind refuses: Claude Code would read a different keychain entry. Unset it first.

Variables agent-switch sets for each start

Section titled “Variables agent-switch sets for each start”

When the shell integration or agent-switch run starts a tool on an account, it sets one variable to that account’s folder, <AGENT_SWITCH_HOME>/<tool>/<name>/config:

ToolVariableWhat the tool does with it
Claude Code (claude)CLAUDE_CONFIG_DIRKeeps its settings, history and login there. On macOS the login sits in a keychain entry named after this folder.
Codex (codex)CODEX_HOMEKeeps its settings, history and auth.json there.
Antigravity (agy)HOMEKeeps its files under .gemini/ there.

For Antigravity, agent-switch run also sets CFFIXED_USER_HOME to the same folder on macOS, so the login lands in that account’s own keychain.

add --browser and login --browser set BROWSER for the sign-in, so Claude Code opens that browser.

Nothing else in your environment changes. A running session never changes account because of these variables; only a new start reads them.

If one of these is set, the tool uses it instead of the account’s login. Every account then uses the same key, usually billed per use. doctor warns when any of them is set (it reports the name, never the value).

VariableTool
ANTHROPIC_API_KEY, ANTHROPIC_AUTH_TOKEN, CLAUDE_CODE_OAUTH_TOKENClaude Code
OPENAI_API_KEY, CODEX_API_KEYCodex
GEMINI_API_KEY, GOOGLE_API_KEYAntigravity

Fix: remove the line that sets it from your shell’s startup file, then open a new terminal.

VariableUsed by
AGENT_SWITCH_CONTRACT_TESTSLive checks against a real Claude Code install.
AGENT_SWITCH_CONTRACT_CONFIG_DIR, AGENT_SWITCH_CONTRACT_ACCESS_TOKEN, AGENT_SWITCH_CONTRACT_SRC_PROFILE, AGENT_SWITCH_CONTRACT_TGT_PROFILEInputs for those checks.
AGENT_SWITCH_SWITCH_TESTSEnd-to-end switch tests (never run in CI).