Expand description
A container agent’s login for a Claude account whose credentials are in the macOS Keychain.
On Linux and Windows the bound account’s .credentials.json is bind-mounted into the container. On macOS
Claude Code keeps that login in the Keychain, under Claude Code-credentials-<first 8 hex of the sha256 of the config dir>, and never writes the file, so nothing was mounted and the container started signed out.
Here srv reads that one Keychain entry and writes it to a staging file of its own, which is mounted like the
account’s file would be. The Keychain stays the source of truth: when either side refreshes the token the
newer expiresAt wins, and a refresh made in the container is written back to the same entry, because refresh
tokens rotate and the host’s login would otherwise stop working.
The guards:
- only the bound account’s own entry is read or written, by the service name computed from its config dir; nothing is searched or listed;
- the staging folder is
<AgentMux root>/container-credentials/<container>/<account>(0700, the file0600), never in the account’s dir or the agent’s workspace, and it is deleted with the container; - a refresh is written back only when the container’s
.claude.jsonnames the same account as the host’s and the stagedexpiresAtis newer than the Keychain’s; - each read and each write-back is one audit row (agent, account, direction), and no value is ever logged.