Claude Code · Tested with aisw v0.3.7 · Updated July 16, 2026
Use the Right Claude Code Account for Each Repository
Bind a repository to the profile or context it should use with aisw workspace bind . --context <name>, then turn on aisw workspace guard --mode strict. aisw checks the active account against the binding whenever you're in that repo and warns or blocks if they don't match.
The most common way to accidentally use the wrong Claude Code account is opening a client repository right after working in a personal one, with no signal that the active account didn’t change. Workspace guardrails fix this by binding a repository to the context it’s supposed to use, so aisw can actively check instead of trusting you to remember.
Before you start
You need at least one profile or context already created. This guide assumes a client-acme context exists that maps a Claude Code profile — see profiles vs contexts if you haven’t created one yet.
CLI method
1. Bind the repository to the context it should use.
From inside the repository:
aisw workspace bind . --context client-acmeThis records the current directory (and its Git remote, if any) as expecting the client-acme context.
2. Turn on enforcement.
aisw workspace guard --mode strictStrict mode blocks a coding-agent launch when the active account doesn’t match the repository’s binding. Use --mode warn instead if you’d rather see a warning and decide yourself.
3. Confirm the binding.
aisw workspace statusThis shows the expected context for the current directory and whether the currently active accounts match it.
Desktop method (coming soon)
AI Switcher Desktop is currently in private testing and not yet available for public download. The steps below reflect the current build; use the CLI method above until it ships.
Screenshot placeholder
AI Switcher Desktop Workspaces screen showing a repository bound to the client-acme context, with a guardrail mode toggle set to Strict
- Open Workspaces and click Bind repository.
- Choose the folder (or let AI Switcher Desktop detect the one you have open) and select the context it should use.
- Set the guardrail mode to Strict or Warn.
- Any mismatch shows up on the Diagnostics screen with a one-click fix.
Verify the result
Switch to a different account, then re-run:
aisw workspace statusYou should see a mismatch reported. Switch back to the bound context and confirm it clears.
Common problems
If guard mode doesn’t seem to trigger, confirm the shell hook is installed — workspace guardrails run through it when you launch a coding agent from the terminal. Run aisw init --detect-live to check hook status, or see shell integration for manual setup.
Frequently asked questions
What happens if I open a repository with the wrong account active?
In strict mode, aisw's shell hook blocks the coding-agent launch and tells you which context the repository expects. In warn mode, it prints a warning but lets you continue.
Does workspace binding work for repositories cloned in different locations?
Bindings are matched by Git remote when available, so the same repository cloned to a different path on the same or another machine is still recognized. Path-only bindings also work for repos without a remote.