How it works
How it works
Section titled “How it works”- Resolve. The shim asks git for the folder’s common git directory. That way the main checkout and every worktree of a registered repository resolve to the same project, wherever the worktrees live (Superset’s included). A submodule or a repository nested in a checkout belongs to the checkout around it, in worktrees too. Outside a registered repository, the nearest registered parent folder counts. If nothing matches, the real tool runs unchanged. If git can’t answer inside a repository (after a macOS update broke the Command Line Tools, say), the tool doesn’t start;
keyfit doctorshows why. - Verify. Keyfit builds the project’s environment and checks each account you mapped. Fast local checks run on every launch: does the profile exist, has the sign-in expired, is the key well-formed. Then come the online checks: who does each service say you are? A successful online check is reused for 30 minutes. If any check fails, the tool does not start.
- Inject. The real tool starts with that environment: the project’s credentials are set, and conflicting ones inherited from your shell are removed. MCP servers that belong to other projects are hidden for that session. Nothing is written into your repository or into the tools’ config files.
Along the way:
- Expired sign-ins are one keypress. In a terminal, when the only problem is an expired or missing sign-in, Keyfit asks
Sign in now? [Y/n], runs the sign-in, checks again and starts the tool. Agents, scripts and commands inside a session Keyfit started are never asked; they get the message and the fix. - Sign-in commands always run, with the project’s environment, so they fix the right account:
aws sso login,gh auth login,codex loginand the like. A few that would change a login the project doesn’t use are stopped, with the right command instead. - Other accounts are refused. Inside a project,
aws --profile <another profile>,vercel --scope <another team>and similar options that point a tool at another account don’t run, and neither does an agent pointed at another project’s folder (codex -C ~/code/globex,opencode ~/code/globex). docs/accounts.md lists them per tool. - Agent sessions stay on their project. The
aws,gh,vercel,supabase,wrangler,convex,gcloudandfirebasecommands an agent runs stay on that session’s project, even after acdelsewhere. - Claude Code’s status line shows the project and its accounts, unless you configured a status line of your own.
- Superset: when Superset’s agent wrapper (
~/.superset/bin) is on PATH, it goes first and the shims right behind it, ahead of everything else. The chain is Superset wrapper → Keyfit → real tool, and Superset’s hooks keep working (for OpenCode too: Keyfit leaves theOPENCODE_CONFIG_DIRthe wrapper sets). Without Superset, the shims go first.
What is checked
Section titled “What is checked”Agents get, and check, all of the project’s accounts:
| Agent | Command | Keyfit confirms |
|---|---|---|
claude |
the Claude organization | |
codex |
a ChatGPT login, without an API key | |
opencode |
OpenCode’s sign-ins | |
copilot |
the GitHub account it runs as | |
gemini |
the Google account it is signed in to |
Since 18 June 2026, Gemini CLI no longer serves Google AI Pro, Ultra or free personal accounts: Google moved them to Antigravity CLI, which Keyfit doesn’t cover. Gemini CLI still works with a Gemini Code Assist licence or an API key.
CLIs get only their own account:
| Service | Command | Keyfit confirms |
|---|---|---|
aws |
the account behind the profile | |
gh |
the login | |
vercel |
the login and the team | |
supabase |
the organization, and that the linked project belongs to it | |
wrangler |
the account behind wrangler’s sign-in | |
convex |
the team, and that the folder’s deployment belongs to it | |
gcloud |
the Google account and the project | |
firebase |
the Google account and the Firebase project |
Also for agents: the Linear workspace behind the key, and the Google account behind the project’s Gmail, Drive and Calendar MCP servers. MCP servers that belong to other projects are hidden.
Each link goes to that account’s section in docs/accounts.md: how to map it, what the tool gets, what is checked, and its limits.