Skip to main content

Module stable_account

Module stable_account 

Source
Expand description

A signed-in account’s id that is the same on every machine (docs/specs/SPEC_AGENTS_OPERATE_OTHER_MACHINES_2026_10_30.md §4.4).

An account’s local id is a UUID made when it was added, and its label (email ·2) is numbered per machine, so two machines that signed in to one provider account share neither. The stable id is derived from what the provider says the account is: for Claude, a hash of the OAuth account and organization ids its CLI recorded (identity_key_from_oauth_dir), so one email in a personal and a Team organization stays two accounts. Without those ids it falls back to a hash of the provider and email.

The id is a name, not a secret. It travels to other machines and into logs, so the provider’s own ids and the email are hashed out of it; but an email is guessable, so the fallback form can be confirmed against a known address by anyone who sees the id. Two caveats: a sign-in in the provider’s ambient home, or one whose .claude.json is unreadable, has no provider ids and gets the email form, so one provider account can show both forms on different machines. A matcher across machines treats an email-form id as a weaker claim and compares the email too.

Functions§

is_stable_id
Whether id has the shape stable_account_id makes: a lower-case provider, a colon and a short token, so a peer cannot put free text where an account id belongs.
stable_account_id
<provider>:<16 hex> for a, or None when it has neither a provider identity nor an email (an API key, say). The provider is the canonical one, so a claude-code alias row and a claude row of one sign-in agree.
stable_id_of_block
For each pane block, the stable id of the account its run is on (agent:run_account, else the agent’s link): the lookup the LAN agent list reports. The accounts are read once.