DEV Community

Cover image for Multi-account failover for Claude Code & Codex without losing your session (TernaryCode v0.3.5)
Ilham Nadhif
Ilham Nadhif

Posted on Fully Autonomous

Multi-account failover for Claude Code & Codex without losing your session (TernaryCode v0.3.5)

If you run Claude Code or Codex across several projects every day, two things interrupt flow more than anything else:

  1. Not knowing which terminal pane stopped waiting for your approval.
  2. Hitting a 5-hour or weekly usage limit mid-task, having to log out, log into a second account, and losing your active session.

In TernaryCode v0.3.5 (free, MIT, written in Rust for macOS, Windows, and Linux), I built isolated multi-account management with failover directly into the workspace alongside hook-backed status tracking.

TernaryCode multi-account failover and usage tracking

How isolated accounts work under the hood

Instead of overwriting your global ~/.claude or ~/.codex directories, TernaryCode gives each registered account its own isolated config directory:

  • Claude Code: launches with a per-account CLAUDE_CONFIG_DIR
  • Codex: launches with a per-account CODEX_HOME

Everything stays local on your machine (~/Library/Application Support/ternarycode on macOS, %APPDATA%\ternarycode on Windows, ~/.local/share/ternarycode on Linux). There is no cloud account and no telemetry.

Real 5-hour & weekly usage + conversation-preserving failover

Each account reports real server-side 5-hour and weekly usage percentages along with reset times. You drag accounts into your preferred failover order in Settings → Accounts.

When a running pane hits a usage limit:

  • The pane flags the rate-limit state immediately in the Inbox and pane notice.
  • With one click (or automatically when auto-failover is enabled), TernaryCode switches to the next healthy account and resumes the same conversation without forcing you to re-explain the task from scratch.

What else shipped in v0.3.5

TernaryCode focus workspace with hook-backed approval notice

  • Slate UI redesign + live Overview (⌘0 / Ctrl+Shift+0): view every project's live terminal side by side in tiles and type straight into any of them.
  • Hook-backed attention queue (⌘J / Ctrl+Shift+J): Needs input, Running, Done, and Failed straight from each agent's hooks (Claude Code, Codex, OpenCode; Antigravity CLI shows plain Active instead of guessing).
  • Embedded native browser (WebKit / WebView2 / WebKitGTK): agents drive it over MCP while you watch, plus in-place preview for PDF, Word, PowerPoint, Excel, CSV, and images.
  • Local Wi-Fi phone companion: scan the QR code in Settings → Phone to view live output, approve/reject prompts, send follow-ups, and switch accounts from your phone using revocable per-device tokens.
  • Native Rust performance: built with egui/wgpu, alacritty_terminal, and wry — launches in ~0.2 s and idles at 0% CPU on macOS, Windows, and Linux.

Try it

If you run multiple Claude Code, Codex, OpenCode, or Antigravity CLI sessions — especially on Windows or Linux — I'd love feedback on where failover or hook detection can be sharper.


Disclosure: I'm the author of TernaryCode. This post was drafted with AI assistance from TernaryCode's source code and README, and verified against v0.3.5.

Top comments (2)

Collapse
 
userxnom profile image
Abdullah Naseer •

The per-account CLAUDE_CONFIG_DIR / CODEX_HOME isolation is the detail that makes this believable — overwriting the global ~/.claude directory is exactly how these setups usually break. Resuming the same conversation after a 5-hour limit instead of re-explaining the task is the part I'd actually pay attention to, since that context loss is the expensive bit. When auto-failover switches mid-task, how does it handle a pane that is waiting on an approval rather than just a usage limit — does it carry the pending approval over, or does that still need a manual yes on the new account?

Collapse
 
ilhamnadhif profile image
Ilham Nadhif •

Great question — auto-failover only triggers on a detected usage/rate-limit hit, never on a normal approval prompt.

When it switches accounts mid-task, TernaryCode interrupts the rate-limited CLI process, copies the session file from the old isolated config root to the new account's config root (so native --resume <id> keeps the full conversation history on same-provider switches, or falls back to a redacted handoff context file across providers), clears the old pane's waiting notice, and relaunches under the next account.

Because the old CLI process is replaced, a pending interactive approval isn't carried over or auto-approved across the switch — if the resumed session asks to run a tool on the new account, it fires a fresh approval prompt that still requires your explicit yes.

Thanks for taking a look!