An account mistake is easy to make when several terminal tabs, repositories, and coding agents are open at once. The danger is not only using the wrong subscription or API key. The wrong account can also create the wrong audit trail, apply a different organization policy, or expose a private repository to an identity that should never touch it.
A reliable fix needs a repository boundary, not another reminder to check the prompt. AI Switcher makes that boundary explicit with three layers: a profile stores one account for one tool, a context groups the profiles for a complete setup, and a workspace rule binds that setup to a repository.
Start with a named context
Use a context when a repository depends on a complete client or work setup. It can map a different profile for each supported tool, so one switch changes the whole coding-agent setup consistently.
aisw init
aisw add claude client-acme-claude
aisw add codex client-acme-codex
aisw add gemini client-acme-gemini
aisw add antigravity client-acme-antigravity
aisw context create client-acme \
--claude client-acme-claude \
--codex client-acme-codex \
--gemini client-acme-gemini \
--antigravity client-acme-antigravityIf the repository only uses one agent, a single profile may be enough. A context becomes useful when you want Claude Code and Codex CLI, or all four supported tools, to follow the same repository boundary.
Bind the repository to its expected setup
Run the binding from the repository. When a Git remote is available, aisw records the repository identity so the rule can continue to match after the project is cloned at a different local path.
cd ~/code/client-acme-app
aisw workspace bind . --context client-acme
aisw workspace statusReview the status output before enforcing anything. It shows the bound context, the current directory, and whether the active profiles match. This is the point to catch a misspelled profile name or a repository that was bound from the wrong directory.
Roll out warn mode before blocking
Enable warnings first if you are adding guardrails to existing repositories. A warning makes the mismatch visible while you confirm that the shell hook runs in every terminal where you launch an agent.
aisw workspace guard --mode warn
aisw context use personal
cd ~/code/client-acme-app
claudeThe launch should print a mismatch and explain how to switch back to the expected context. Repeat the check with the agents your team actually uses, including launches from an integrated VS Code terminal. A VS Code terminal is still a shell session, so it uses the same hook and repository binding as a standalone terminal.
Use strict mode for sensitive repositories
Once the warning is correct, make the policy enforceable. Strict mode blocks the coding agent before it starts when the active account does not match the repository rule.
aisw workspace guard --mode strict
aisw context use personal
cd ~/code/client-acme-app
codexThe expected result is a blocked launch with a recovery command such asaisw context use client-acme. Switching to the expected context and starting the agent again should proceed normally. Re-run aisw workspace status when a result is surprising.
Repair mismatches from Desktop
AI Switcher Desktop uses the same local profiles, contexts, and workspace rules as the CLI. Open Diagnostics to see repository mismatches together, select the repository, and switch to the expected context. This is useful when several repositories need review, but enforcement still happens through the CLI shell hook at launch time.
Desktop does not create a cloud account or proxy agent traffic. Credentials remain in the provider's normal local storage and AI Switcher does not inspect prompts or repository contents. See the security model for the exact storage and credential boundaries.
A small operating policy that scales
For a team, give each repository an owner and a named context, enable warn mode while onboarding, and use strict mode for client or production code. Keep the binding close to the repository setup documentation so a new clone gets the same protection. Profiles and contexts remain local, so each developer must configure the rule on their own machine.
The complete command reference is in therepository guardrail guide. If you need to manage several accounts first, start with the guide to multiple AI coding-agent accounts.
Install the CLI for terminal-first workflows or use Desktop for a visual switcher and diagnostics view.
