One Coding-Agent Account per GitHub Org
Create a context for the organization's accounts, then run aisw workspace bind --git-remote "github.com/<org>/*" --context <name>. Every repository whose remote matches the pattern resolves to that context, including repositories you clone later, and the workspace guard warns or blocks when Claude Code, Codex CLI, Gemini CLI, or Antigravity CLI starts on another account.
Binding repositories one at a time works until a client has forty of them, or until you clone a new one and forget. A Git remote rule binds a whole organization at once: every repository whose remote matches the pattern expects the same context, including repositories that don’t exist on your machine yet.
The short answer
aisw context create client-acme \ --claude acme-claude --codex acme-codex \ --gemini acme-gemini --antigravity acme-agyaisw workspace bind --git-remote "github.com/acme/*" \ --context client-acmeaisw workspace guard --mode strictFrom then on, starting claude, codex, gemini, or agy inside any github.com/acme/... repository checks that the client-acme accounts are active first.
Before you start
Install aisw, run aisw init so the shell hook is in place, and save the organization’s accounts as profiles. The hook is what runs the check when an agent starts; without it, a binding is only visible through aisw workspace status.
Set it up
1. Group the organization’s accounts into a context.
aisw context create client-acme \ --claude acme-claude --codex acme-codex \ --gemini acme-gemini --antigravity acme-agyA context can map any subset of tools. Leave out the agents you don’t use for that client.
2. Bind the remote pattern to the context.
aisw workspace bind --git-remote "github.com/acme/*" --context client-acmeThe pattern is written without a scheme or user, the same way for GitHub, GitLab, Bitbucket, or a self-hosted host: gitlab.com/acme/*, bitbucket.org/acme/*, git.acme.internal/*.
3. Choose what happens on a mismatch.
aisw workspace guard --mode warn # print a warning, let the agent startaisw workspace guard --mode strict # refuse to start the agentStart with warn for a day to confirm the rule matches the repositories you expect, then switch to strict.
4. Check a repository.
$ cd ~/src/acme-api$ aisw workspace statusWorkspace Workspace : ~/src/acme-api Repo root : ~/src/acme-api Expected : client-acme Active : claude personal, codex personal, gemini personal, agy none Status : mismatch Matched rule : git_remote:github.com/acme/* Action : aisw context use client-acmeMatched rule confirms the remote pattern resolved the repository, and Action is the command that brings the active accounts into line.
What the guard does on a mismatch
In strict mode, starting an agent with the wrong accounts active stops before the agent runs:
$ claudeError: workspace guard refused to launch Claude Code. Expected context: 'client-acme' Current state: 'claude personal, codex personal, gemini personal, agy none' Status: mismatch Run 'aisw context use client-acme'.Run aisw context use client-acme, start the agent again, and it launches on the client’s accounts.
How remote matching works
- Every remote counts. aisw reads all remote URLs in the repository’s Git config, not only
origin. A personal fork with anupstreamremote pointing atgithub.com/acme/...also resolves to the client context, which is usually what you want for client work. - URL forms are normalized. SSH, HTTPS, and
ssh://URLs are reduced tohost/owner/repo, with any.gitsuffix removed and letters lowercased before matching. *matches across slashes.gitlab.com/acme/*also covers nested groups such asgitlab.com/acme/platform/api.- The most specific pattern wins. If you bind both
github.com/acme/*andgithub.com/acme/billing, the billing repository uses the second rule.
Several organizations on one machine
aisw workspace bind --git-remote "github.com/acme/*" --context client-acmeaisw workspace bind --git-remote "github.com/globex/*" --context client-globexaisw workspace bind --git-remote "github.com/my-employer/*" --context workaisw workspace bind --default --context personalThe default context covers everything no rule matches, such as personal projects and scratch repositories.
When another rule takes priority
Remote rules sit third in the resolution order:
- Repo-local binding written by
aisw workspace bind .inside a clone - Path rule, such as
aisw workspace bind ~/clients --context client-acme - Git remote rule
- Default context
So a path rule on a parent directory overrides a remote rule. If a repository resolves to an unexpected context, run aisw workspace status and read Matched rule.
Remove the rule
aisw workspace unbind --git-remote "github.com/acme/*"Removing a rule changes only which context is expected. It doesn’t remove profiles, contexts, or credentials.
Verify the result
Switch to your personal accounts with aisw context use personal, open any repository from the organization, and run aisw workspace status. It should report the organization’s context as expected and a mismatch as the status. Then run aisw context use client-acme and confirm the status reads match.
Frequently asked questions
Does the remote pattern match both SSH and HTTPS clones?
Yes. aisw normalizes remote URLs before matching, so [email protected]:acme/api.git, https://github.com/acme/api.git, and ssh://[email protected]/acme/api.git all compare as github.com/acme/api. Matching ignores case.
Do I have to bind each repository again after cloning it?
No. A remote rule lives in ~/.aisw/workspaces.json, not inside a repository, so any repository with a matching remote resolves to the context as soon as it is cloned.
What wins when a repository matches more than one rule?
The most specific rule. A repo-local binding beats a path rule, a path rule beats a remote rule, and a remote rule beats the default context. Among remote rules, the pattern with more literal characters wins. aisw workspace status shows which rule matched.