ai newsMi., 25. Nov.
EilmeldungYale’s Sonnenfeld: Nvidia is a ‘detriment’ to U.S. industrial might — not a champion

Zwei Claude Code Accounts gleichzeitig nutzen: so klappt der Wechsel ohne Logout

Claude Code kann zwei Accounts parallel angemeldet halten, wenn jeder Account ein eigenes Konfigurationsverzeichnis bekommt. Über eine Umgebungsvariable wählt man das passende Verzeichnis aus und wechselt so schnell, ohne sich each Mal ab- und anzumelden.

dev.toDienstag 06:21 · 24.11.DE6 Min. Lesezeit
Bild: dev.to

Veröffentlicht am 24. November, ursprünglich erschienen auf ponymux.com

Ein Claude-Code-Konto erreicht mitten in einer Aufgabe sein Limit. Das andere hat noch reichlich übrig. Jedes Mal sich ab- und wieder anzumelden ist langsam.

Claude Code kann beide gleichzeitig angemeldet halten. Jedes Konto bekommt seinen eigenen Ordner, und eine Umgebungsvariable wählt den Ordner aus:

alias claude-work= 'CLAUDE_CONFIG_DIR=$HOME/.claude-work claude' claude-work auth login Vollbildmodus öffnen Vollbildmodus beenden Wechseln: claude-work statt claude ausführen. Das Konto, das Sie bereits nutzen, braucht keinen Alias. Prüfen: claude-work auth status --text gibt die Anmelde­methode, die Organisation und die E-Mail-Adresse dieses Ordners aus.

Der Haken: Die Variable wird gelesen, wenn Claude Code startet. Eine laufende Session behält ihr Konto, und jeder Ordner hat eigene Einstellungen, MCP-Server und Verlauf. Wenn ein Konto aufgebraucht ist: Eine Session gehört zu genau einem Ordner.

Um sie auf dem anderen Konto fortzusetzen, kopieren Sie ihr Transcript herüber (siehe unten). Anthropic beschreibt dieses Setup in seiner Authentifizierungs­dokumentation, um mit mehreren Konten wie Arbeits- und Privatkonto angemeldet zu bleiben. Dort steht nichts dazu, mehr als ein persönliches Abo zu halten, prüfen Sie also die Bedingungen Ihres Plans.

Ich habe die Befehle unter macOS getestet; unter Windows setzen Sie CLAUDE_CONFIG_DIR in der Shell, bevor Sie claude ausführen, was ich nicht ausprobiert habe.

Wählen Sie für jedes Konto einen Namen und legen Sie pro Namen einen Ordner an. Der Ordner wird beim ersten Start von Claude Code dort erstellt.

Fügen Sie pro zusätzlichem Konto einen Alias zu ~/.zshrc oder ~/.bashrc hinzu:

alias claude-work= 'CLAUDE_CONFIG_DIR=$HOME/.claude-work claude' alias claude-personal= 'CLAUDE_CONFIG_DIR=$HOME/.claude-personal claude' Vollbildmodus öffnen Vollbildmodus beenden Öffnen Sie eine neue Shell und melden Sie sich dann in jeder einmal an:

claude-work auth login Vollbildmodus öffnen Vollbildmodus beenden Ein Browserfenster öffnet sich. Melden Sie sich mit dem anderen Konto an. Von da an startet claude-work Claude Code unter diesem Konto, und ein einfaches claude startet weiterhin das zuvor genutzte Konto. Als ein Claude-Code-Maintainer die Feature-Anfrage nach Multi-Account-Unterstützung im August 2026 schloss, war die Antwort dieses Setup: Jeder Ordner enthält seine eigene Anmeldung, Einstellungen und Sitzungshistorie, das Wechseln ist also nur eine Frage dessen, welchen Alias Sie ausführen.

Lassen Sie es unverändert. Ein einfaches claude nutzt den Standardordner ~/.claude. Wenn Sie CLAUDE_CONFIG_DIR auf denselben Ordner setzen, behandelt Claude Code ihn als anderen Ort: Auf meinem Mac meldete CLAUDE_CONFIG_DIR=$HOME/.claude claude auth status loggedIn: false, während ein einfaches claude angemeldet war.

Der Grund liegt darin, wo die Anmeldung gespeichert ist. Unter macOS befindet sie sich im Keychain, und Claude Code verknüpft den Eintrag mit dem Ordner. Der Standardordner verwendet Claude Code-credentials. Jeder Ordner, den Sie über die Variable setzen, erhält diesen Namen plus ein Suffix, das auf Version 2.1.331 aus den ersten 8 Zeichen des SHA-256 des Ordnerpfads besteht. Die Dokumentation sagt nur, dass der Eintrag an den Ordner gebunden ist; das Suffix ist das, was ich beobachtet habe, bauen Sie also keine Werkzeuge darauf.

Dieselbe Variable verschiebt auch ~/.claude.json, die Datei mit Ihren Kontodaten, Vertrauens­entscheidungen und persönlichen MCP-Servern. Deshalb startet ein zweiter Ordner ohne all das.

Die dokumentierten Statuszeilen-Felder enthalten kein Konto. Drei Wege, es herauszufinden:

Ein Alias setzt die Variable nur für diesen einen Befehl. Eine Shell, in der Sie claude-work ausgeführt haben, hat weiterhin kein CLAUDE_CONFIG_DIR, deshalb sagt echo $CLAUDE_CONFIG_DIR dort nichts über eine bereits laufende Session aus.

Nichts, weil jeder Ordner ein eigenes ~/.claude ist. Jeder hat seine eigenen:

Wenn Sie dieselbe CLAUDE.md oder dieselben Einstellungen in beiden nutzen möchten, verlinken Sie die Datei mit einem Symlink von einem Ordner in den anderen. Ein Bericht macht das für Skills, Einstellungen und Plugins und weist darauf hin, dass MCP-Server, die sich per OAuth anmelden, pro Ordner erneut angemeldet werden müssen. Ein Hook, der auf ein Skript unter ~/.claude zeigt, führt für beide Konten dasselbe Skript aus, verwenden Sie also einen Pfad, der nicht vom Ordner abhängt.

claude --resume sucht nur in dem Ordner, unter dem es läuft, das andere Konto kann die Session also nicht sehen:

No conversation found with session ID: <session-id> Vollbildmodus öffnen Vollbildmodus beenden Das Transcript ist eine gewöhnliche Datei, projects/<project>/<session-id>.jsonl, und Kopieren funktioniert. Ich habe es ausprobiert: Ich habe eine Session unter einem Konto erstellt, die Datei in denselben Projektordner des anderen kopiert und sie dort fortgesetzt. Die Konversation lief weiter, und Claude Code konnte meine erste Nachricht wiederholen. Das Original bleibt, wo es war, und die beiden Sessions sind von da an getrennt.

Finden Sie die Datei, kopieren Sie sie an dieselbe Stelle unter dem anderen Ordner und setzen Sie sie aus demselben Arbeitsverzeichnis fort:

SID =< session-id > SRC = $HOME /.claude-work DST = $HOME /.claude-personal f = $( find "$SRC/projects" -name "$SID.jsonl" ) proj = $( basename "$(dirname " $f ")" ) mkdir -p "$DST/projects/$proj" cp "$f" "$DST/projects/$proj/" cd < the project folder where the session ran > CLAUDE_CONFIG_DIR = $DST claude --resume "$SID" Vollbildmodus öffnen Vollbildmodus beenden Der Projektordnername wird aus dem Arbeitsverzeichnis gebildet, führen Sie claude also aus dem Verzeichnis aus, in dem die Session gestartet wurde. Das neueste Transcript ist die jüngste Datei: ls -t "$SRC/projects/$proj" | head -1.

Das verschiebt die Konversation, nicht Ihre Dateien. Wenn beide Konten am selben Checkout arbeiten sollen, nutzen Sie für das zweite ein git worktree, wie in how to fork a session beschrieben. Auto Memory unter projects/<project>/memory bleibt, wo es ist. Claude Code löscht Transcripts standardmäßig nach 30 Tagen, kopieren Sie also zeitig; siehe Claude Code conversation history.

Führen Sie /usage innerhalb einer Session jedes Kontos aus. Es zeigt die 5-Stunden- und Wochenfenster nur für dieses Konto. Was jede Zahl bedeutet, steht in how to check your usage limits.

Melden Sie sich zuerst ab und löschen Sie dann den Ordner. Der Ordner enthält die Sitzungshistorie dieses Kontos, kopieren Sie also jedes Transcript heraus, das Sie behalten möchten.

claude-work auth logout rm -r "$HOME/.claude-work" Vollbildmodus öffnen Vollbildmodus beenden Unter macOS liegt die Anmeldung im Keychain, nicht im Ordner, das bloße Löschen des Ordners hinterlässt sie also dort. Entfernen Sie auch den Alias aus Ihrer Shell-Datei.

PonyMux verwaltet für Sie einen Ordner pro Anmeldung. Wählen Sie unter Settings → Integrations bei Claude Code Add another profile…, benennen Sie es und melden Sie sich an. Wenn Sie bereits von Hand einen Ordner mit CLAUDE_CONFIG_DIR erstellt haben, findet PonyMux ihn und bietet Add an.

Jede Anmeldung bekommt ihre eigene Zeile in der Seitenleiste, mit ihrem Namen und ihrem eigenen Nutzungskreis, sodass Sie sehen, welches Konto zur Neige geht, ohne /usage einzugeben. Eine Session kehrt bei Wiederaufnahme oder beim Aufwecken ihres Terminals unter der Anmeldung zurück, mit der sie gestartet wurde. Beim Start eines neuen Agents wählt ein Profil-Chip im Startfenster die Anmeldung aus.

Da die Konten nichts teilen, ist der nützliche Teil, Arbeit zwischen ihnen zu verschieben:

PonyMux wählt nicht zwischen Ihren Konten für Sie, und jede Anmeldung braucht weiterhin ihre eigene Anmeldung und ihr eigenes Connect…. Siehe Use several logins per agent.

PonyMux ist kostenlos für Mac und Windows. Laden Sie es herunter.

Automatisch übersetzt. Das Original auf Englisch ist unten aufklappbar.

Original (Englisch) anzeigen

Posted on Nov 24 • Originally published at ponymux.com

One Claude Code account hits its limit in the middle of a task. The other one has plenty left. Logging out and back in every time is slow.

Claude Code can keep both signed in at once. Each account gets its own folder, and an environment variable picks the folder:

alias claude-work= 'CLAUDE_CONFIG_DIR=$HOME/.claude-work claude' claude-work auth login Enter fullscreen mode Exit fullscreen mode Switch: run claude-work instead of claude. The account you already use needs no alias. Check: claude-work auth status --text prints the login method, organization, and email of that folder.

The catch: the variable is read when Claude Code starts. A running session keeps its account, and each folder has its own settings, MCP servers, and history. When one runs out: a session belongs to one folder.

To continue it on the other account, copy its transcript across (below). Anthropic's authentication docs describe this setup for staying signed in to several accounts, such as work and personal. They don't say anything about holding more than one personal subscription, so check the terms of your plan.

I tested the commands on macOS; on Windows, set CLAUDE_CONFIG_DIR in the shell before you run claude, which I haven't tried.

Pick a name for each account and make one folder per name. The folder is created the first time Claude Code runs there.

Add one alias per extra account to ~/.zshrc or ~/.bashrc:

alias claude-work= 'CLAUDE_CONFIG_DIR=$HOME/.claude-work claude' alias claude-personal= 'CLAUDE_CONFIG_DIR=$HOME/.claude-personal claude' Enter fullscreen mode Exit fullscreen mode Open a new shell, then sign in once in each:

claude-work auth login Enter fullscreen mode Exit fullscreen mode A browser window opens. Sign in with the other account. From then on, claude-work starts Claude Code under it, and plain claude still starts the account you had before. When a Claude Code maintainer closed the feature request for multi-account support in August 2026, the reply was this setup: each folder holds its own login, settings, and session history, so switching is a matter of which alias you run.

Leave it alone. Plain claude uses the default folder, ~/.claude. If you set CLAUDE_CONFIG_DIR to that same folder, Claude Code treats it as a different place: on my Mac, CLAUDE_CONFIG_DIR=$HOME/.claude claude auth status said loggedIn: false, while plain claude was signed in.

The reason is where the sign-in lives. On macOS it is in the Keychain, and Claude Code ties the entry to the folder. The default folder uses Claude Code-credentials. Any folder you set through the variable gets that name plus a suffix, which on 2.1.331 is the first 8 characters of the SHA-256 of the folder's path. The docs only say the entry is tied to the folder; the suffix is what I saw, so don't build tooling on it.

The same variable also moves ~/.claude.json, the file that holds your account details, trust decisions, and personal MCP servers. That is why a second folder starts with none of them.

The documented status line fields have no account in them. Three ways to know:

An alias sets the variable only for that one command. A shell where you ran claude-work still has no CLAUDE_CONFIG_DIR, so echo $CLAUDE_CONFIG_DIR there tells you nothing about a session that is already running.

Nothing, because each folder is a separate ~/.claude. Each one has its own:

If you want the same CLAUDE.md or settings in both, symlink the file from one folder into the other. One write-up does this for skills, settings, and plugins, and notes that MCP servers that sign in with OAuth need signing in again per folder. A hook that points at a script under ~/.claude runs the same script for both accounts, so use a path that doesn't depend on the folder.

claude --resume only looks in the folder it runs under, so the other account can't see the session:

No conversation found with session ID: <session-id> Enter fullscreen mode Exit fullscreen mode The transcript is a plain file, projects/<project>/<session-id>.jsonl, and copying it works. I tried it: I made a session under one account, copied the file into the same project folder of the other, and resumed it there. The conversation continued, and Claude Code could repeat my first message. The original stays where it was and the two sessions are separate from then on.

Find the file, copy it into the same place under the other folder, and resume from the same working directory:

SID =< session-id > SRC = $HOME /.claude-work DST = $HOME /.claude-personal f = $( find "$SRC/projects" -name "$SID.jsonl" ) proj = $( basename "$(dirname " $f ")" ) mkdir -p "$DST/projects/$proj" cp "$f" "$DST/projects/$proj/" cd < the project folder where the session ran > CLAUDE_CONFIG_DIR = $DST claude --resume "$SID" Enter fullscreen mode Exit fullscreen mode The project folder name is made from the working directory, so run claude from the same directory the session started in. The most recent transcript is the newest file: ls -t "$SRC/projects/$proj" | head -1.

This moves the conversation, not your files. If both accounts will edit the same checkout, use a git worktree for the second one, as in how to fork a session. Auto memory under projects/<project>/memory stays where it is. Claude Code deletes transcripts after 30 days by default, so copy soon; see Claude Code conversation history.

Run /usage inside a session of each account. It shows the 5-hour and weekly windows for that account only. See how to check your usage limits for what each number means.

Sign out first, then delete the folder. The folder holds that account's session history, so copy out any transcript you still want.

claude-work auth logout rm -r "$HOME/.claude-work" Enter fullscreen mode Exit fullscreen mode On macOS the sign-in is in the Keychain, not in the folder, so deleting the folder alone leaves it there. Remove the alias from your shell file too.

PonyMux keeps one folder per login for you. In Settings → Integrations, choose Add another profile… under Claude Code, name it, and sign in. If you already made a folder by hand with CLAUDE_CONFIG_DIR, PonyMux finds it and offers Add.

Each login gets its own row in the sidebar, with its name and its own usage ring, so you see which account is running low without typing /usage. A session comes back under the login it started with when you resume it or wake its Terminal. When you start a new agent, a Profile chip in the launch panel picks the login.

Since the accounts share nothing, the useful part is moving work between them:

PonyMux doesn't choose between your accounts for you, and each login still needs its own sign-in and its own Connect…. See Use several logins per agent.

PonyMux is free for Mac and Windows. Download it.

Originaltitel: How to use two Claude Code accounts at the same timeQuelle: dev.to (dev.to). Original öffnen