Skip to content

feat: support multiple accounts with identical email addresses #1

Description

@lucasgsalaroli

Description

When two Claude accounts share the same email address (e.g. a personal Pro subscription and a corporate Team/Pro seat under the same email), cux add detects the email match and updates the existing slot instead of creating a new one. This makes it impossible to register both accounts natively.

Steps to reproduce

  1. Add account A (user@example.com — personal Pro) via cux add
  2. Log into account B (user@example.com — corporate, different organizationUuid) via claude /login
  3. Run cux add again

Expected: slot 3 created for account B
Actual: "Refreshed slot 1 (user@example.com)" — account B overwrites account A's token

Root cause

The deduplication logic in cux add uses emailAddress as the unique key. However, Anthropic's identity model allows the same email to be a member of multiple organizations, each with a distinct organizationUuid and independent rate limit windows. Two accounts with identical emailAddress but different organizationUuid are functionally separate accounts with separate tokens and separate 5h/7d usage buckets.

Secondary issue: usage cache collision

Even after manually adding the second account via filesystem/Keychain hacks, the usage cache (runtime/usage-cache.json) is also keyed by email. Both slots display identical usage metrics, making threshold-based auto-swap unreliable:

SLOT 01  user@example.com      5h: 40%  ← correct
SLOT 03  user@example.com__…   5h: 40%  ← wrong (actual: 4%)

The Anthropic usage API (GET /api/oauth/usage) is token-scoped and returns correct per-account data. The issue is the cache keying, not the API itself.

Proposed fix

Use organizationUuid (already present in oauth.json) as the deduplication key instead of (or in addition to) emailAddress. This uniquely identifies an account across all Anthropic subscription types.

The same change should apply to the usage cache key in runtime/usage-cache.json to ensure independent usage tracking per slot.

Workaround (until fixed)

  1. Temporarily alias slot 1's email in state.json and rename its directory
  2. Run cux add while logged into account B → creates slot 3
  3. Restore slot 1's original email and directory name
  4. Alias slot 3's email to email__corp in state.json, Keychain entry, and accounts directory to prevent usage cache collision

This is fragile and breaks on any cux add refresh.

Environment

  • cux version: cux 0.2.5
  • OS: macOS (Apple Silicon)
  • Claude plan: Pro (personal) + Pro (corporate Team seat)
  • Same email: yes — different organizationUuid per account

This issue was documented with AI assistance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions