claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[FEATURE] First-class multi-account support: non-interactive account switching, path-independent credentials, and programmatic usage/limit visibility

Open BTForIT opened this issue 3 months ago • 7 comments

Problem

Account switching in Claude Code is effectively unsupported, and working around it is painful. For users who legitimately hold multiple subscriptions (personal + work, or several Max seats across a team), the current model forces a pile of fragile external machinery:

  1. /login is interactive and browser-based only. There is no non-interactive or scriptable way to switch the account a session runs under, and no way to pre-authorize a set of accounts and pick between them.

  2. Credentials are bound to the config directory path. The stored credential (macOS keychain item) is keyed by a hash of CLAUDE_CONFIG_DIR, so the only way to hold N accounts is N complete config-dir trees — duplicating settings, hooks, and MCP config per account, and keeping them all in sync by hand. Moving or renaming a config dir silently orphans its credential.

  3. Switching a running session to another account requires killing the process. There is no in-process account switch; you must terminate, change CLAUDE_CONFIG_DIR, and relaunch with --resume, losing in-flight state and racing whatever the session was doing.

  4. No rate-limit failover. When a Max/Pro account hits its 5-hour or weekly cap, sessions just stall on the limit banner. There is no built-in "continue on my other account" path — users have to detect the cap by scraping terminal text and orchestrate the kill/relogin/resume dance externally.

  5. Usage/limit state is not exposed programmatically. The 5h/weekly usage meters exist only as rendered UI text. External tooling that wants to swap before hitting a cap has to screen-scrape the footer.

Suggested solution

Any subset of these would help enormously:

  • Account profiles: claude --account <name> / a /accounts picker — multiple stored logins under one config dir, switchable without re-running the browser flow each time.
  • Decouple the credential store from the config-dir path, or at least survive a directory rename.
  • Non-interactive switch: a CLI/headless way to select which stored account a new (or resumed) session uses.
  • Programmatic usage visibility: expose the 5h/weekly utilization (and "rate limited until X") via a CLI command or status JSON so tooling can act before the cap.
  • Graceful cap behavior: on hitting a limit, offer to continue on another authorized account (or at minimum exit with a distinct machine-readable status).

Context

  • Related: #42775 (closed not-planned, locked) asked for the switching half of this; filing fresh per the lock message, with the credential-store and rate-limit-failover aspects added, since those are what make the workaround genuinely horrible rather than merely inconvenient.
  • Platform: macOS (headless + interactive), Claude Code CLI, subscription auth (not API key — API key switching is easy; this is specifically about Max/Pro OAuth accounts).

BTForIT avatar Aug 27 '26 04:08 BTForIT

Strong agreement from a five-account setup on Windows. Two things I can add: a cost that is not on your list, and a measurement supporting your point 5.

A sixth cost: sessions on different accounts cannot address each other.

Sessions under one login can message each other in realtime. Sessions under a different login cannot, in either direction. The session tooling enumerates an in-memory map of sessions the app itself spawned under that login, so a session on another config root is never entered into it. Not filtered out. Never registered, so it cannot be listed or messaged.

For anyone holding N accounts to get past the 20x ceiling, this is the expensive one. Your items 1 through 5 make multi-account operable. This one decides whether the sessions can coordinate at all once it is. Two of mine can sit in the same repository, on the same machine, at the same moment, under the same human, and be unable to talk.

I filed it separately as #92135 rather than pile it on here, since it needs a trust model (pairing, permission intersection) that the plumbing items do not. Happy for a maintainer to fold it in if that reads as the same request.

My workaround is a file-based mailbox inside .git, because a file write is the only transport blind to which login a session authenticated against. It works, and it is asynchronous, so a message lands on the recipient's next turn rather than now.

On your point 5, usage state is not exposed programmatically.

Confirming with a measurement, because the failure mode is worse than screen-scraping being ugly.

I built exactly the scraper you describe. It goes blind under load. Checked today across all five of my config roots: every one reports UNKNOWN, with refresh HTTP 429 as the reason. That is rate limiting rather than an expired token, so re-authenticating does not clear it.

The instrument that would let me swap accounts before hitting a cap is least available precisely when a cap is close, because the same busy period that burns quota also trips the limit on the usage read. A documented endpoint or a --json usage surface would fix this outright.

One framing note. All of this exists because 20x is the largest tier sold. I run five accounts only to get past that ceiling, and I would rather buy one larger tier than operate five. That is not this repository's decision, but it is the root cause behind most of the items in your list.

wshallwshall avatar Sep 04 '26 16:09 wshallwshall

Point 3 of this issue — switching a running session to another account means killing the process — is the one that costs me real work, and I'd like to add the multi-device shape of it, which I think is a distinct requirement rather than a restatement.

A session today is owned by the account that created it. I hold several accounts and work from several machines (Claude Code 2.1.292, desktop app, Windows 11). When I'm at the machine logged in with the other account, I cannot pick up the session that already holds the context; the only available move is to start a new session and rebuild it. Context is the expensive part of this product, so every account boundary is also a boundary where I pay for context twice.

Concretely, beyond in-process switching: let a session's transcript, worktree binding and Remote Control pairing be resumed by another account the same person is authenticated as, with the session's identity independent of the credential that created it. That is what makes multi-account support usable for one person holding several seats, as opposed to merely survivable.

dykatana avatar Oct 21 '26 16:10 dykatana

For points 1 and 5, a CLI-side option: Agent Guild (I'm the author) lets you pick the account when you start a session, so there's no /login round trip, and it shows each account's 5-hour and 7-day used % and reset time on the page and at GET /usage on its local API. Moving a running session to another account still means starting a new session. https://github.com/oddessentials/agent-guild

oddessentials avatar Oct 22 '26 02:10 oddessentials

For points 1 to 4, and part of 5, a CLI-side option: fairshare (I’m the author), https://github.com/Dongli99/fairshare

1, 2: it builds one config dir per account, all linked to one shared set of history, transcripts, settings (hooks included), CLAUDE.md and skills, so the N trees stay in sync by themselves. Each account signs in once through Claude Code’s own sign-in; fairshare never reads the credential. Sessions start with fairshare (best account) or fairshare run -a . 3: fairshare pickup stops the session and resumes it with --resume on another account, context kept. Underneath it is still the kill-and-resume you describe, but the launcher does it: it stops the child, waits for it to exit, then resumes it, so nothing runs twice. 4: a StopFailure hook tells the launcher about the cap (no terminal scraping). By default it waits for Claude Code’s own resume at the reset; a pickup moves the session now. It also warns the session at 90% and 95% of a window, so the agent can move before the cap. 5: the 5h and weekly numbers come from the statusLine input Claude Code passes on every redraw, plus claude /usage at launch; fairshare status shows them. A documented JSON surface from Claude Code would still be better.

An in-process switch and cross-device resume (dykatana’s point) still still need Claude Code itself.

Dongli99 avatar Nov 18 '26 05:11 Dongli99

The cross-device context problem @dykatana describes is something WorkLedger addresses independently of which account created the chat.

We build WorkLedger at Digital Disruptors. The project requirements, assigned work, decisions and recorded delivery evidence live in the company workspace. On another machine, a fresh supported Claude Code or Codex session retrieves that work record and continues from it, rather than asking someone to carry a handover file between accounts or tools.

Agent Guild and fairshare already cover account-selection workarounds above. WorkLedger adds shared work continuity; it doesn’t transfer Claude’s live process, native transcript or Remote Control pairing between accounts.

If you’d like to test that with one repository across two machines, we offer a free guided 30-day pilot: https://workledger-ai.com/early-access?utm_source=github&utm_medium=referral&utm_campaign=wl-cross-device-context-20261122

AI-assisted reply.

dijarvrella avatar Nov 22 '26 02:11 dijarvrella

We hit this same wall on the Desktop side and managed to fix it: fully isolated copies of Claude Desktop running at the same time, each signed into its own account with its own session — five accounts, five windows, never touching /login.

We packed that into Multi Instance Pro: https://apps.microsoft.com/detail/9N3X1FSCLMWK?cid=gh-89993

radelqui avatar Nov 23 '26 11:11 radelqui

"Non-interactive account switching" has a degenerate answer that works today on Windows: don't switch. One Desktop instance per account, all permanently signed in, own user-data folder and own Claude Code config dir each — switching becomes Alt-Tab, and nothing an update or a logout does to one account touches another. That is the model behind Multi Instance Pro (disclosure: my app, paid, Microsoft Store).

https://apps.microsoft.com/detail/9N3X1FSCLMWK?cid=gh-89993

Native per-account config dirs would still be the cleaner fix. Unofficial, not affiliated with Anthropic.

radelqui avatar Nov 30 '26 17:11 radelqui