# Multiple accounts on one machine

`~/.awesomate/credentials.json` can hold several account **profiles** (one per
slug), and each project folder is bound to one via a committable
`.awesomate.json` pin (`{"account": "<slug>"}`) written by the bootstrap in
the folder it ran in.

## Resolution order

`AWESOMATE_PAT` env → `AWESOMATE_ACCOUNT` env → nearest folder pin (walking
up, stopping at `$HOME`) → sole profile → `defaultProfile`. A pin naming a
missing profile is a **hard error, never a fallback** — that's deliberate.

## Verifying which account is active

`awesomate_whoami` reports the connected account and why (`source`: a
`.awesomate.json` folder pin, `AWESOMATE_ACCOUNT`, the sole profile, or the
default profile). Its `plan` is the hub's (`planSource: "hub"`, one short read
the first time in a session); `planSource: "connect"` means the hub couldn't
be asked and the plan is the one recorded when this computer connected. Every subsequent tool response is stamped
`account: <slug> (source: …)` — treat a mismatch there the same as a wrong
whoami result.

## Fixes

- **Wrong account connected?** Compare `awesomate_whoami` against the folder's
  `.awesomate.json`. Fix by editing the pin (if the profile exists) or by
  running Connect Claude Code from the hub **while logged into the right hub
  account, from the right folder** — the connect command carries
  `--account <slug>` and the bootstrap aborts on a mismatch instead of storing
  anything.
- **"Multiple accounts … folder isn't pinned" error?** Create the pin file or
  set `AWESOMATE_ACCOUNT`. Don't guess an account for the user.
- Connecting a second account never disconnects the first; re-pairing an
  account just refreshes its profile.
