multi-clawd

Drakon Systems@drakon-systems

Multi-account Claude Code failover for OpenClaw — register additional Claude (Max/Pro) logins as first-class CLI backends and keep the full skills/MCP harness across every account. Also imports those accounts' setup tokens into Hermes Agent's Anthropic credential pool.

Readme

multi-clawd — the lobster with two extra claws

🦞 multi-clawd

One Claude is never enough.

Pool every Claude Max account you own into a single failover chain — same model, next account, full harness on every hop.

OpenClaw plugin npm version license: MIT TypeScript

A normal lobster has two claws. This one has four.


Quick start

bash
npm i -g @drakon-systems/multi-clawd   # the CLI (once)

multi-clawd update    # install (or update) the OpenClaw plugin — right flags, restart, doctor
multi-clawd setup     # guided wizard: accounts, isolated second login, pool, watchdog
multi-clawd login claw2   # launch the right Claude sign-in for an account (or re-auth it)
multi-clawd explain   # your whole setup in plain English — accounts, chain, live health
multi-clawd explain --history --since 7d   # per-account launches, retries, rotations
multi-clawd explain --json   # live health plus a rough weekly pace estimate, machine-readable
multi-clawd account disable claw2 --dry-run  # preview benching an account
multi-clawd chain     # audit your model routing — what actually serves each turn
multi-clawd direct    # the direct anthropic/* route: status, or `direct sync` (v1.9, optional)
multi-clawd usage    # live usage per account from the provider
multi-clawd doctor    # health check (add --probe: one live turn per account plus one for the pool)
multi-clawd <command> --help   # flags for any command

That's the entire lifecycle. update installs the plugin when it's missing and upgrades it when it's not — nobody types registry flags. setup walks you through the whole shape below and merges config non-destructively (backup first, existing accounts never overwritten, re-runs are no-ops). Prefer not to install anything? Every command also runs as npx @drakon-systems/multi-clawd <command>.

The 3-step picture setup walks you through:

  1. Main account — your existing claude login, used as-is (nothing to do).
  2. Second account — lives in its own isolated config dir (a separate Claude "app", e.g. ~/.claw2), so the two logins can never clobber each other; token via a secret-manager reference (recommended), token file, or the dir's own login.
  3. The pool — one backend id (clawd/…) fronting both: every launch runs on the first account that isn't nearly maxed out, and your fallback chain routes through it.

Then multi-clawd explain shows you exactly what you built.

multi-clawd explain --history adds per-account served launches, in-turn retry hops, rotations, and the last served time for the past seven days. Use --since 24h or another positive Nd/Nh duration to change the window. The local history is size capped; it records account and model IDs and short reason codes, never prompts, credentials, transcripts, tokens, or costs.

Hermes Agent integration

multi-clawd can also import the configured Claude subscriptions into Hermes Agent's native Anthropic credential pool. Install and set up Hermes Agent first, keep hermes on PATH, then preview and apply the import:

bash
multi-clawd hermes sync --dry-run
multi-clawd hermes sync --strategy round_robin
multi-clawd hermes doctor

# An existing Hermes profile (create it first: hermes profile create work):
multi-clawd hermes sync --profile work --strategy least_used

# Read a non-default OpenClaw configuration:
multi-clawd hermes doctor --config ~/configs/openclaw.json

Validated against Hermes Agent 0.20.6. The bridge/core/CLI integration tests exercise that installed release's real Python APIs in isolated temporary homes; on machines without a compatible Hermes install, those integration tests skip while the no-Hermes CLI safety tests still run.

Only stable setup tokens are imported

The one credential this adapter will copy is an account's oauthTokenFile — a plain claude setup-token value, the same string multi-clawd already passes to Claude Code as CLAUDE_CODE_OAUTH_TOKEN. It carries no refresh token and nothing rotates it, so a second copy in Hermes stays valid.

Everything else is refused, on purpose:

  • native logins are not importable, but need nothing imported. A native login is a .credentials.json file holding a rotating OAuth grant whose refresh token is single-use, so copying it into Hermes and the next refresh — by Claude Code, or by Hermes itself — would invalidate the other copy, which Hermes then marks dead and drops from rotation. It doesn't need copying anyway: Hermes' own claude_code credential source already reads that exact same native ~/.claude/.credentials.json directly, so leave a native account on that source instead of duplicating the grant.
  • configDir logins are not importable, and Hermes cannot be pointed at them either. The same single-use-refresh-token problem applies, and unlike a native login there is no Hermes-side fallback: as of Hermes Agent 0.20.6, its claude_code credential source reads only the native path above, never an arbitrary configDir. A configDir account can only reach Hermes' pool by getting its own oauthTokenFile (a claude setup-token, same as above), or it stays OpenClaw-only.
  • oauthTokenRef is never resolved. Reading a gateway secret reference here would turn a reference into a copied plaintext secret in a second store; the adapter fails closed and says so. An account may carry a configDir alongside its oauthTokenFile — it is simply ignored for Hermes.

doctor names every account it cannot import and why; sync refuses to write anything until they are fixed or removed. Re-run sync whenever a setup-token file changes — nothing propagates a new token automatically.

What sync does

Accounts are read from plugins.entries["multi-clawd"].config.accounts in the OpenClaw config (~/.openclaw/openclaw.json by default; see Config and state location). Every account is validated and every token file read and parsed before Hermes is asked to write anything.

  • Only deterministic rows labelled multi-clawd:<account-id> are added or updated, and only those rows are sent to Hermes — it merges them into the pool under its own lock, so unrelated credentials are never read, copied, or rewritten. The operation is idempotent.
  • Row priority follows your pool.accounts preference order (home account first), which is the order Hermes' fill_first drains in. Accounts absent from pool.accounts follow in accounts[] order.
  • --strategy sets Hermes' Anthropic pool strategy to one of fill_first, round_robin, random, least_used. Omit it and your configured strategy is left alone (fill_first only when nothing is set at all).
  • --dry-run runs the same validation and planning and writes nothing.
  • Planning always reads the target home's own pool. A Hermes profile with no Anthropic rows yet falls back to reading the global pool — doctor labels that as an effective-only view, and sync never copies those rows into the profile.
  • Named profiles must already exist; the adapter never creates one, so a deleted profile is not resurrected as an empty skeleton. Run hermes profile create <name> first. The target home is whatever Hermes itself reports as its root (via its own hermes_constants module) — never reimplemented here — which is ~/.hermes on POSIX, %LOCALAPPDATA%\hermes on native Windows, or a Docker/custom HERMES_HOME root; a named profile is <root>/profiles/<name>. --profile default always targets that root, even when the active HERMES_HOME currently points at another profile.
  • Only multi-clawd's own broken state (duplicate or malformed managed rows) blocks a sync. Several claude_code rows, or another tool's malformed row, are reported as warnings — they are legitimate states and not this plugin's to fix.

The pool and the config are two separate Hermes files. Each write is atomic on its own and both are verified by re-reading afterwards; the pair is not atomic, so the pool is written first and both are idempotent — an interruption between them leaves a state that re-running sync repairs, rather than one needing a rollback.

What this integration is (and is not)

Hermes talks to the native Anthropic Messages API with Hermes' own tool system. It does not run the OpenClaw plugin backend or the Claude Code harness, so OpenClaw skills/MCP wiring and Claude Code's built-in harness are not copied across. multi-clawd supplies the account credentials and the configured Hermes pool distribution only. Hermes then provides native reactive failover and the selected distribution strategy. Proactive near-limit telemetry/rotation from multi-clawd's OpenClaw pool is not implemented for Hermes yet.

Security model

Tokens are read from real files with strict size limits, parsed locally, and sent to the bundled Python bridge only as one JSON document on stdin. They are never placed in argv, exported as environment variables, or printed to stdout/stderr — no token, no prefix, no fingerprint — and command errors use fixed safe messages. On POSIX, a token source file must be private — group/other-readable or -writable (any chmod bits beyond 600) is refused outright, not just warned about, checked via fstat on the already-open file descriptor so there is no gap between the check and the read (Windows has no equivalent bit layout, so the check is a no-op there; the config JSON is read through the same code path but never needs to be private). The bridge uses Hermes' installed Python APIs directly (no shell-string execution), writes only inside the selected HERMES_HOME, and never echoes identifiers or other fields belonging to a row it doesn't manage — an unrelated row is reported by position only, even when its own source/label/status fields are stuffed with a token-like string. Paths reject NUL bytes, expand only a leading ~/, and profile names cannot contain traversal or separators.

doctor validates files, account configuration, and the shape of Hermes' pool and config on disk — it makes no live request to Anthropic and cannot prove a setup token is still accepted. A token can pass every doctor check and still be expired or revoked; that is discovered at runtime, where Hermes' own native 401/429 handling takes over exactly as it does for any other credential in its pool.

Why

OpenClaw's bundled claude-cli backend runs Claude Code on a single login. When that account hits its usage limit, OpenClaw can't move the running subprocess onto your second Claude account — it drops down to the next model instead. If you own two Claude Max accounts, the second one's capacity just sits there, idle, while you get downgraded.

multi-clawd fixes that. Each extra account becomes its own first-class backend that slots into the failover chain like any other model — so a limit on account #1 rolls to account #2 on the same model before any tier drop:

text
claude-cli/claude-fable-5        # main login
  → claw2/claude-fable-5         # 2nd login (this plugin) — same model
    → claw3/claude-fable-5       # 3rd login? go on then
      → anthropic/claude-opus-4-8   # only NOW drop a tier

Automation compatibility

OpenClaw 2026.11.2, isolated agent-turn automations: An automation bound to a stored inference account cannot route clawd/* as its primary model or fallback. Changing only its model preserves the recorded account binding, so an existing bound job still rejects the pool. A new clawd/* job may also fail admission: the pool is not a stored, bindable inference account. Interactive model availability does not prove automation compatibility. Unbound native-CLI and configured-auth paths have different admission rules; this does not mean all automations are impossible, but neither path is a verified pool workaround. No plugin-only runtime fix is established for this gap. Do not create placeholder credentials to bypass the account check. See the source diagnosis in #155.

Manual /compact compatibility

A single-account backend (claw<N>/*) on the verified launch declares OpenClaw's manual-compaction contract, so a manual /compact is accepted there. The pooled backend (clawd/*) does not, and OpenClaw answers CLI backend "clawd" owns compaction but does not support manual compaction. without starting anything. This is deliberate. For a manual compaction OpenClaw runs the backend's command itself, outside the plugin's launch path, and does not tell the plugin which session it is compacting (read from OpenClaw 2026.8.1, 2026.10.10, 2026.11.1 and 2026.11.2). On the verified launch that command is claude, started on the one account whose config dir can hold the session. The pool cannot check which account holds the newest copy of a pooled conversation, and compacting an older copy after a rotation would replace the newer turns. Claude Code's automatic compaction inside a turn is unaffected on every backend. The plugin selects the verified launch when the host runs plugin execute transports (OpenClaw 2026.8.1, the plugin's minimum, has them) and claude is on the gateway's PATH; the gateway log line [multi-clawd] launch mode: verified confirms it. On a legacy launch single-account backends stay refused as well. The plugin's shim does not run for the request, so multi-clawd's usage history and health capture do not see it. Evidence so far is a fixture claude driven by those launch rules: a live /compact from a chat surface against a running gateway has not been exercised, on any backend. Tracked in #159.

What you get

  • 🦞 Extra claws — every account registers as a real CLI backend (claw2/…, claw3/…), resolvable in model refs, fallback chains, and per-agent overrides. No API keys, no baseUrl hacks.
  • 🎱 The pool (v0.2) — one backend id (clawd/…) fronting all your accounts. Every launch runs on the first account that is not nearly maxed out, using live rate_limit_event health (status, utilization, reset time) captured from each account's own Claude stream. Hand over before the limit error; return home automatically when the window resets; when the whole pool is exhausted, fail for real so your chain drops provider (OpenAI → xAI → …) exactly as configured.
  • 📈 Usage-aware accounts — a transparent shim tees each account's stream-json and records per-window health to ~/.openclaw/state/multi-clawd/<account>.json. Passthrough-first: a state write can never break a live turn.
  • 📡 Live usage (v1.10) — the pool also asks the provider what is left, on a timer, using the login each account already holds. Both windows come back as real percentages with reset times — including the 5-hour window the stream never puts a number on — so hand-over happens at 85% of the session window, not at the error. Passing 95% raises an operator alert through the heartbeat; multi-clawd usage shows it on demand.
  • 🧰 Full harness on every hop — each backend is a genuine Claude Code subprocess: native tools, skills, MCP bridge, and native compaction all stay intact when failover steps across accounts.
  • 🔮 Future-proof models (v0.2) — model ids are not hardcoded: the catalog mirrors the bundled Claude model list live (with a built-in fallback), and any modern claude-* id resolves on demand. When the flagship subscription model changes (Fable 5 → Opus 5), clawd/claude-opus-5 just works — no plugin update.
  • 🏠 Native accounts (v0.2) — "native": true pools the machine's main Claude login (default config dir / OS keychain) without duplicating its credentials.
  • 🔐 Token hygiene — setup-tokens are read at launch and passed only via the child process env. Never committed, never logged. v0.3: oauthTokenRef resolves tokens through the gateway's own secret providers (1Password etc.) — same {source, provider, id} shape as the rest of openclaw.json, no plaintext files, fixed-reason-code redaction on failure.
  • 🧲 Sticky rotation (v0.3) — after handing over, the pool dwells on the spare account (default 10 min) before returning home, so turns never flap across the threshold. Health always overrides stickiness.
  • 🔁 In-turn retry on a reactive limit — when an account hits a model cap during a launch, the pool no longer loses that turn to the next provider in your chain: the refusal is swallowed before anything reaches you and the turn is re-spawned on a healthy account. Covers ongoing conversations too: the session is handed to the sibling as it stood before the refused attempt. One retry. Works for config-dir, native, and setup-token-file accounts; the shim is handed paths only and reads a token file at the moment it retries. A transient provider error (529 overload, 5xx, or a throttle 429 that is not a spent window) gets the same single hop to an idle sibling — but records nothing against the account that met it, because it is not spent, and is passed through unchanged when no idle sibling exists (never onto an account the pool believes is spent). The Claude CLI retries these itself first; the shim keeps the hop armed through those announced retry sleeps, bounded (MULTI_CLAWD_HOLD_RETRY_MAX_MS, default 120s, hard cap 150s).
  • 📟 Operator alerts (v0.3) — dead logins (probed every 15 min without spending quota), pool rotations, whole-pool exhaustion, and watchdog restarts surface through your agent's next heartbeat (e.g. straight into Telegram) — not just journal lines.
  • 🩺 npm run doctor (v0.3) — one command that says whether a box is actually ready: config/manifest agreement (with the exact --force preflight strip plan), dist freshness, CLI presence, credential health judged on evidence — an unexpired token or a successful turn, never mere presence (values never printed), a credential split-store warning when a login's OAuth credential exists in more than one place, which Claude login each account authenticates as and which one the next turn will run on, telemetry age, pool + sticky state, whether every non-Claude chain rung still has a usable auth profile, watchdog presence, optional --probe (one live turn per account plus one for the pool; --probe-pool with --probe tests the pool only). --verbose (or DOCTOR_VERBOSE=1) adds detail; --raw (or DOCTOR_RAW=1) shows login emails and session ids unmasked, so do not paste that output into issues.
  • 🧯 Self-healing config — registration re-reads the resolved runtime config if the loader hands it an empty block, so a flaky registration pass can't silently no-op the plugin.
  • 🔎 Observable registration — every register() pass logs which config source won and which backends it registered, so a silent no-op can't hide in a long-running gateway.
  • 🐶 Turn-safe eviction watchdog — scripts/eviction-watchdog.mjs mitigates upstream openclaw#107408 (idle plugin backends silently dropped) by restarting the gateway when the Unknown CLI backend signature appears. v0.3: it defers while any turn is in flight (transcript activity across all agents + opt-in worker pidfiles), with a 15-min defer cap and 10-min restart cooldown — a restart can no longer eat a live reply.

Config and state location

Every command, the gateway plugin, the shim and the scheduled watchdog operate on one OpenClaw instance: the one the environment points at, as OpenClaw itself does (multiple gateways).

VariableEffectDefault
OPENCLAW_CONFIG_PATHThe OpenClaw config file that is read and, by setup and account, written.<state dir>/openclaw.json
OPENCLAW_STATE_DIRThe OpenClaw state directory: plugin installs (extensions/, npm/projects/), agent session stores (agents/) and everything multi-clawd writes (state/multi-clawd/).<home>/.openclaw
OPENCLAW_HOMEThe home directory the default state directory hangs off.the OS home

Values are trimmed, a blank value counts as unset, a leading ~ expands against the effective home, and a relative path resolves against the working directory. OPENCLAW_PROFILE on its own is not interpreted: openclaw --profile <name> exports the two variables above to the processes it starts, and those are what multi-clawd reads. hermes sync|doctor --config <path> still overrides the config file for that one command.

What this means in practice:

  • A command run with OPENCLAW_CONFIG_PATH=~/.openclaw/b.json reads and writes b.json; the default openclaw.json is never touched. When the file is missing, the error names that path and the variable that chose it.
  • doctor prints the config path it read (and the variable, when one is set) under install & config, so a report always says which instance it is about.
  • setup run for a non-default instance writes the watchdog launcher into that instance's state dir and pins OPENCLAW_STATE_DIR / OPENCLAW_CONFIG_PATH / OPENCLAW_HOME into the scheduler unit, so the scheduled run serves the same instance (the launcher reads those variables, not its own location). There is one watchdog unit per user (multi-clawd-eviction-watchdog / com.multi-clawd.eviction-watchdog), and it follows whichever instance last ran setup or update: an existing unit that runs another instance's launcher, or the right launcher without this instance's variables, is reported as not serving this instance and rewritten (after a yes in setup; automatically by update's self-heal), with the previous unit kept next to it as a .bak-… copy. The gateway plugin and shim take the variables from the gateway process that loads them.

Platform support

multi-clawd uses Node without native modules. External commands are run with argument arrays, never through a shell string. Launch mode varies by platform.

PlatformStatus
Linux✅ Verified in production (x64 and arm64)
macOS✅ Supported — reads Claude logins from the Keychain through the security CLI and schedules the optional watchdog with a launchd plist in ~/Library/LaunchAgents/
Windows (WSL2)✅ Supported — OpenClaw's recommended gateway runtime on Windows; follow the Linux instructions inside WSL
Windows (native)⚠️ Not yet verified by us — verified launch is not implemented on Windows; it falls back to the legacy node + shim launch, so the v2.1.0 verified-launch fix for OpenClaw 2026.10.2 setup authority ("Ask OpenClaw") does not apply there. Reports welcome.

Install

The CLI does it all (recommended) — see Quick start:

bash
npm i -g @drakon-systems/multi-clawd && multi-clawd update

update installs from ClawHub first, offers the gateway restart, and finishes with a doctor health check.

⚠️ Keeping up to date: there are two halves

One package installs as two separate artifacts, and they update by different routes:

HalfWhat it isHow it updates
The pluginserves your turns — pooling, rotation, credentialsmulti-clawd update
The CLIthe multi-clawd command — doctor, chain, setup, explainnpm i -g @drakon-systems/multi-clawd@latest

multi-clawd update upgrades the plugin, not itself. Since v1.6.0 it notices when the command has fallen behind and offers to update it — but that notice ships in the command, so a CLI older than v1.6.0 has no code to warn you with. We found this on three of our own machines, all running current plugins behind commands that were three versions stale.

So run the global install once, by hand, to arm it:

bash
npm i -g @drakon-systems/multi-clawd@latest

After that it maintains itself. It matters because doctor and chain live in the CLI — a stale command reports stale diagnostics about a current plugin, which is a confusing way to be told nothing is wrong. multi-clawd version shows both halves, and since v1.6.0 says plainly whether the pair is a problem.

⚠️ Pinned installs need multi-clawd update

For a versioned ClawHub install (or npm --pin fallback), openclaw plugins update --all can tell you the plugin is up to date when it is not. OpenClaw resolves registry metadata for the pinned spec — comparing 1.6.0 against 1.6.0 and returning "up to date" while a newer version sits on npm. The honest "pinned to X; registry default resolves to Y" message exists in OpenClaw but is built inside its --dry-run branch, so a real update run never prints it.

Use multi-clawd update for versioned installs. Since v1.7.2 doctor also checks the registry itself (cached, and silent when offline), so a lagging plugin is reported rather than left to a command that reassures you wrongly.

Prefer the raw form?

bash
openclaw plugins install clawhub:@drakon-systems/multi-clawd
# Only after a successful install, and with operator approval:
# openclaw gateway restart

Either way the gateway pulls the prebuilt package — no clone, no build step, nothing to keep in sync. ClawHub is the source OpenClaw trusts; npm installs show a source caution. For existing installs, prefer the guarded multi-clawd update command rather than a raw source retry.

Raw-install fallback boundary: use npm only after positively identifying a ClawHub availability failure (for example, package/version not found or registry unreachable), or an older OpenClaw CLI explicitly rejecting the clawhub: spec as unsupported. An old CLI version alone is not evidence of that incompatibility. Stop; do not retry through npm for moderation, security, integrity, trust, signature or policy failures, unknown errors, cancellation or interruption. These stops take precedence even if availability diagnostics appeared first. If the cause is unclear, stop and investigate; do not switch sources or restart the gateway after a failed or interrupted install.

Only after the availability/unsupported-spec check above, an unversioned fresh install may use openclaw plugins install @drakon-systems/multi-clawd --pin. For a versioned install, retain the same selected exact target: if ClawHub was clawhub:@drakon-systems/multi-clawd@X.Y.Z, the permitted npm retry is openclaw plugins install @drakon-systems/multi-clawd@X.Y.Z --pin. Replace X.Y.Z with that same exact version; never drop it, re-resolve latest, or substitute a different version during fallback. An unversioned ClawHub spec follows newer releases; add @X.Y.Z to keep a specific release. openclaw itself is a peer dependency (the host provides it), so the install stays lean.

From source (contributors, or ahead of a release):

bash
git clone https://github.com/Drakon-Systems-Ltd/multi-clawd.git
cd multi-clawd && npm install && npm run build
openclaw plugins install "$(pwd)"

Node for a source install. multi-clawd's own package.json declares no engines field, so npm will not stop you on an unsupported Node. The contributor npm install pulls in the pinned dev dependency openclaw 2026.8.1, whose declared engines are >=22.22.3 <23 || >=24.15.0 <25 || >=25.9.0. CI builds and tests this repo on Node 22 and 24 only; other lines are not covered by our CI. If npm install fails with an engines or dependency error, switch to a Node version inside those ranges (for example with nvm) and re-run npm install && npm run build.

npm version. CI installs npm 11 on Node 22, because npm 10 (bundled with Node 22) crashed while resolving this dev tree ("Cannot read properties of null (reading 'edgesOut')"). Use npm 11 on Node 22. We have not verified npm 10 as a working source-install path, so no claim is made that it works.

powershell
# Windows (native, PowerShell)
git clone https://github.com/Drakon-Systems-Ltd/multi-clawd.git
cd multi-clawd; npm install; npm run build
openclaw plugins install (Get-Location).Path

Or let your agent install it. Running an OpenClaw assistant or Claude Code on the target machine already? Paste it this and go make coffee:

Read https://raw.githubusercontent.com/Drakon-Systems-Ltd/multi-clawd/v2.7.3/SETUP-AGENT.md and follow it to set up multi-clawd on this machine. I own a second Claude account — ask me when you need me to log in.

The guide has the guardrails built in (config backup, merge-don't-overwrite, never print tokens, ask before touching routing).

That URL is pinned to a release tag on purpose: what your agent reads — and therefore executes — is fixed at a version you chose, not whatever master happens to say today. Swap the tag if you want a different release, but prefer a tag over a branch.

Requirements: OpenClaw ≥ 2026.8.1, the claude CLI on PATH, and a second Claude subscription you own. The current plugin SDK contract and runtime registration path are tested against OpenClaw 2026.8.1. The standalone multi-clawd CLI and Hermes commands do not require the optional OpenClaw peer to be resolvable; plugin loading and OpenClaw-backed commands still require the host-provided peer.

Node on the OpenClaw host. The Node requirement for running the plugin is whatever your OpenClaw host declares, not what the dev SDK above declares. The OpenClaw release checked for this note (2026.11.3, its published package.json and Node compatibility docs) declares >=24.16.0 <25 || >=26.1.0, and those docs list Node 22, 23 and 25 as unsupported. That differs from the 2026.8.1 dev SDK range used for source installs, and requirements may change between OpenClaw releases, so check the docs for your installed version. If OpenClaw refuses to start on your Node, upgrade Node per the OpenClaw install docs rather than changing multi-clawd. Platform notes (including macOS and native Windows) are in Platform support; Node versions were not separately measured on macOS.

Upgrading:

bash
npx @drakon-systems/multi-clawd update

One command: checks the registry, installs the chosen version from ClawHub (with npm fallback only when ClawHub is unavailable), offers the gateway restart, and finishes with a doctor health check. Security, integrity, and policy failures stop the update without trying npm. (npm i -g @drakon-systems/multi-clawd once, and it's just multi-clawd update — with multi-clawd setup, multi-clawd explain (your setup in plain English), and multi-clawd doctor alongside.)

bash
# From source:
cd multi-clawd && git pull && npm install && npm run build && npm run doctor

On the source path run npm run build explicitly — don't rely on the prepare hook to refresh dist/ on a pull-upgrade (observed stale on a live production rollout; doctor flags it STALE if you forget). If a release adds new config keys, openclaw plugins install --force validates against the old manifest — run multi-clawd doctor --preflight (from a source checkout: node scripts/doctor.mjs --preflight) first for the strip → install → re-add plan.

Set up a second account

Easiest: the wizard, then the login command. The wizard walks you through the whole shape below — main account, isolated second account, token storage, pool — and merges the result into openclaw.json non-destructively (backup first, merge by id, existing accounts never overwritten, re-runs are no-ops, never sees a token value). Then login performs the actual Claude sign-in for any account — right flow, right config dir, verified afterwards with the signed-in email shown:

bash
multi-clawd setup            # wire the accounts + pool (add --dry-run to preview)
multi-clawd login claw2      # launch the second account's Claude sign-in
multi-clawd login claw1      # (works for re-authing ANY account, any time)

login knows what each account is: a native account signs in against the default dir/keychain, an isolated-dir account inside its own dir (created 0700 if missing), and token accounts get claude setup-token — in a throwaway scratch dir when the account has no dir of its own, so your main login is never disturbed. You do the OAuth in the launched flow; the CLI never captures, stores, or prints a token value. (From a source checkout, npm run setup still works for the wizard.)

The key idea either way: your main account keeps the default ~/.claude login untouched, and each extra account gets its own isolated config dir — a separate Claude "app" — so the logins can never clobber each other.

Or by hand:

  1. Give the account an isolated config dir and capture its Claude Code setup-token into it.

    macOS / Linux / WSL2:

    bash
    mkdir -p ~/.claw2 && chmod 700 ~/.claw2
    CLAUDE_CONFIG_DIR=~/.claw2 claude setup-token   # log in as the 2nd account; it prints the token
    install -m 600 /dev/null ~/.claw2/oauth-token
    nano ~/.claw2/oauth-token   # paste ONLY the printed sk-ant-oat01-… token, on one line; save
    

    Do not redirect claude setup-token > file: that captures the whole screen (sign-in prompts and instructions) around the token. multi-clawd refuses a token file holding anything but the single token line — the account is skipped with an alert naming the file, and multi-clawd doctor says exactly what to fix — rather than guess which part is the token.

    Windows (native, PowerShell):

    powershell
    New-Item -ItemType Directory -Force "$HOME\.claw2" | Out-Null
    $env:CLAUDE_CONFIG_DIR = "$HOME\.claw2"
    claude setup-token   # log in as the 2nd account
    # store the token as $HOME\.claw2\oauth-token, then lock it to your user:
    icacls "$HOME\.claw2\oauth-token" /inheritance:r /grant:r "$($env:USERNAME):(R,W)"
    
  2. Configure the plugin (in openclaw.json; if plugins.allow is set, add "multi-clawd" to it). ~ expands on every platform; absolute Windows paths (C:\\Users\\you\\.claw2) work too:

    jsonc
    {
      "plugins": {
        "entries": {
          "multi-clawd": {
            "enabled": true,
            "config": {
              "accounts": [
                {
                  "id": "claw2",
                  "label": "Second Max",
                  "configDir": "~/.claw2",
                  "oauthTokenFile": "~/.claw2/oauth-token"
                }
              ]
            }
          }
        }
      },
      "agents": {
        "defaults": {
          // allow the model for agents (separate from the failover chain)
          "models": { "claw2/claude-fable-5": {} }
        }
      }
    }
    
  3. Slot the backend into your fallback chain:

    jsonc
    "agents": { "defaults": { "model": {
      "primary": "anthropic/claude-fable-5",
      "fallbacks": [
        "claw2/claude-fable-5",
        "anthropic/claude-opus-4-8"
      ]
    } } }
    
  4. Restart the gateway. Done — a limit on the main account now rolls to the second account on the same model before any tier drop.

The pool: proactive rotation (v0.2)

Individual backends (claw2/…) fail over reactively — OpenClaw steps the chain when a turn actually dies with a limit error. The pool goes one better: it watches each account's own usage signal and hands over before the error.

jsonc
"plugins": { "entries": { "multi-clawd": { "enabled": true, "config": {
  "accounts": [
    { "id": "claw1", "label": "Main Claude", "native": true },
    { "id": "claw2", "label": "Second Max", "configDir": "~/.claw2",
      // "disabled": true, // optional; default false: bench without removing the pool member
      // v0.3 preferred: resolve via your gateway's secret providers —
      // no plaintext token file on disk
      "oauthTokenRef": { "source": "exec", "provider": "onepassword",
                         "id": "op://YourVault/claw2-setup-token/password" } }
  ],
  "pool": {
    "id": "clawd",
    "accounts": ["claw1", "claw2"],   // preference order; first = home for ordered strategy
    "strategy": "ordered",            // optional: "reset-aware" drains healthy weekly quota that resets soonest;
                                      //           "spread" starts each new session on the least-served healthy account
    // "spreadWindowMs": 3600000,     // optional, spread only: how far back served launches count (default 1h)
    "utilizationThreshold": 0.85,     // default hand-over; minute/hour and overage windows use this
    "weeklyUtilizationThreshold": 0.97, // optional: day/week/month quota windows at 97%
    "minDwellMs": 600000,             // v0.3: anti-flap dwell before returning home
    "sessionAffinity": true,          // optional; default false: keep healthy CLI sessions on their serving account
    "sessionAffinityTtlMs": 2592000000, // optional; default 30 days
    "degrade": {                      // v0.3.5: last step before provider drop
      "ladder": ["claude-opus-4-8"],  // whole pool exhausted → same account, lower tier
      "pins": [                       // contractual lanes never degrade
        { "agentDirIncludes": "billing-app" }
      ]
    }
  }
} } } },
"agents": { "defaults": {
  "models": { "clawd/claude-fable-5": {} },
  "model": {
    "primary": "clawd/claude-fable-5",        // the pool IS the Claude lane
    "fallbacks": [
      "openai/gpt-5.6",                        // both accounts exhausted
      "xai/grok-4.5"                           // ...or Anthropic is down
    ]
  }
} }

Set accounts[].disabled: true to bench a member while keeping it in pool.accounts and visible in explain, doctor, and usage as "disabled by operator". It is excluded from pool selection, in-turn retries, session affinity, and the managed direct Anthropic order. Transcript lookup still searches its session directory. To edit ~/.openclaw/openclaw.json with a timestamped backup and without reformatting unrelated config, run multi-clawd account disable <id> or multi-clawd account enable <id>. Add --dry-run to preview without writing anything. If every pool member is disabled, pooled launches fail closed with an error naming pool.accounts[].disabled; they never fall back to a disabled member. On the direct anthropic/* route, a disabled member is left out of the order multi-clawd writes. If every direct member is disabled, multi-clawd stops managing that order and logs a warning naming pool.accounts[].disabled, but it cannot empty an order OpenClaw has already stored, so clear or edit that stored order yourself if the direct route must not use those profiles. Changes take effect when the plugin next reads its config, for example after a gateway reload. A turn already admitted or running continues on its selected account; the command does not interrupt it.

pool.strategy defaults to "ordered", which retains the configured account order. In every strategy, when no ok or no_data account is left but some are near their limit, the launch goes to the near-limit account with the most headroom: the lowest fresh utilization, taking the newer of the stream and usage-poll records for each window. Equal figures keep pool order, an account with a figure outranks one without, and two without keep pool order. Exhausted, billing-refused and credential-failed accounts are never chosen. explain says "all near limit, picked X at N%" and the direct Anthropic route orders its near-limit profiles the same way. Set it to "reset-aware" to use healthy weekly quota before its seven_day window resets: among ok accounts with live seven-day reset data, the soonest reset wins. Accounts without that data follow in pool order; near-limit or exhausted accounts never outrank a healthy one. Equal reset times keep pool order. The existing minDwellMs delay still holds an account that remains usable. Both CLI launches and the direct Anthropic route use the same preference. Other values are rejected by the plugin config schema.

Set pool.strategy to "spread" when several agent lanes start sessions at once and you want them on different accounts instead of queueing behind one account's concurrency ceiling. Each new session starts on the healthy (ok or no_data) account that served the fewest launches in the last spreadWindowMs (default one hour; clamped between one minute and seven days), counted from the served-launch journal explain --history reads. On a tie the account served least recently wins, then pool order, so equally idle accounts are used in turn. Near-limit, exhausted, billing-refused and credential-failed accounts are never chosen; when no healthy account is left the pool answers exactly as ordered does. Spread keeps every session on the account that first served it: it switches sessionAffinity on for the pool (an explicit sessionAffinity: false is overridden with a warning, because without it a conversation would move on every turn). A pinned session moves only when its account stops being healthy, exactly as under sessionAffinity. Launches without a session id take the spread pick. There is no home account, no dwell and no rotation alert under spread; explain, usage and doctor show the strategy, the next placement and the served counts behind it. The direct Anthropic route orders its profiles by the same counts.

pool.sessionAffinity: true remembers the account that successfully served each Claude CLI session (--session-id or --resume) and prefers it on later turns while its health is ok or no_data. A near-limit or otherwise unhealthy account loses its pin; the successful replacement becomes the new pin. New sessions and launches without a session id keep normal pool selection. Pins live in ~/.openclaw/state/multi-clawd/pool-<id>.sessions.json, expire after 30 days by default (sessionAffinityTtlMs), and the store keeps at most 1000 sessions. Contended writes can temporarily leave extra parked pin files while their session is being read or trimmed; a later write retries the cleanup. This applies to shimmed CLI launches; direct Anthropic and side-question launches keep their existing routing. The shim can switch to native, config-dir, and token-file accounts. On verified OpenClaw launches, the gateway also resolves a pinned secret-reference account at execution time. Legacy shim launches fall back to normal selection when a secret-reference pin needs a different account.

How it decides, per launch (all data from each account's live rate_limit_event stream, captured by the shim):

Account stateEffect
rejected + reset in the futureskipped until resetsAt passes
rejected with no reset, on a named windowskipped for an hour, then re-probed (v1.7.2)
rejected on the unknown windowstill used — that is where a single-model limit lands, and it must not strand the account
any window utilization ≥ thresholdskipped (nearly maxed — the point of the pool)
allowed_warning with a number below thresholdstill used — trust the number
allowed_warning and no number, on a short windowskipped (v1.7.2) — see below
allowed_warning and no number, on the weekly windowstill used — weekly warns from ~30% and would flap
no data / stale dataused — never rotate on missing evidence
every usable account near its limitthe near-limit account with the most headroom (lowest fresh utilization) serves; equal figures and accounts without a number keep pool order
whole pool exhaustedhome account anyway → real limit error → your chain drops provider
billing refusal — the CLI's typed billing_error (credit balance too low)account benched 15 min (billing_refused), the turn hops to a sibling in-turn, explain says BILLING REFUSED; the same words without the typed kind, or any other error, are forwarded unchanged

Why the short-window rule exists (v1.7.2). (v1.10's live usage poll now supplies the missing number — see below — so this rule is the fallback for hosts where polling is off or the account cannot be polled.) The threshold rule needs a utilization number, and Anthropic does not send one for the 5-hour session window — across every observation we hold from two accounts it arrives as a bare status plus a reset time, while the weekly windows carry percentages. A rule that waits for a number therefore could never pre-empt the session limit: the pool would take the hit and rotate afterwards. So on hour-scoped windows the warning counts on its own. It stays narrow deliberately — a reported number always wins over the status, and a warning from a window that has since reset is void, exactly like a stale percentage.

Notes:

  • Rotation happens at limit boundaries only. A mid-conversation handover costs the Claude CLI its native session (it lives in the previous account's config dir); OpenClaw's fresh-session retry recovers the turn.
  • Plugin lifecycle hooks were investigated and ruled out for this job: on OpenClaw ≤ 2026.7.1, before_model_resolve never fires for gateway RPC turns and before_agent_start overrides are ignored on the prompt path. The pool therefore decides inside the backend's own prepareExecution, which runs on every launch on every turn path. Details in DESIGN.md.

Live usage: ask, don't wait to be told (v1.10)

Everything above learns about quota from the stream — the rate_limit_event records the CLI emits at the top of a turn. That is reactive by construction: nothing is observed between turns, and the 5-hour session window arrives with a status but no percentage, so the pool could see "warning" but never "how close". v1.10 closes both gaps by reading each pooled account's live usage from the provider on a timer — the same figures the Claude CLI's own /usage command shows — with the OAuth session the CLI already holds.

jsonc
"pool": {
  "id": "clawd",
  "accounts": ["claw1", "claw2"],
  "utilizationThreshold": 0.85,     // hand over here (unchanged)
  "weeklyUtilizationThreshold": 0.97, // optional: day/week/month quota windows at 97%; overage stays at 85%
  "usagePoll": {                    // v1.10 — on by default
    "intervalMs": 120000,           // every 2 min (minimum 60000)
    "warnThreshold": 0.95           // operator alert from here
  }
}

What a poll does, per account:

Provider saysHealth file getsPool does
5-hour at 40%, weekly at 20%usage:five_hour / usage:seven_day, allowed with the number and resetnothing — home account serves
5-hour at 86%the same, utilization 0.86next launch rotates to the spare (threshold rule, now with a real number on the session window)
5-hour at 96%the samerotates, and raises an alert: account, window, reset time, where launches now go
5-hour at 100%rejected with the provider's resetexhausted until that reset — for every model, before any turn is refused
every account past 95%—pool-wide alert: at 100% the ladder or the host's chain takes over; soonest reset named
model-scoped limit (e.g. one family at 97%)—alert naming the model; the shim's reactive capture still handles the refusal

Polled records live under their own keys (usage:<window>) so they never race the shim's five_hour / seven_day for the same slot — the shim's next bare allowed cannot erase the number the poll just wrote, and explain shows both ("5-hour (live) 40%"). The health rules are the existing ones; the poll only improves what they can see.

Boundaries:

  • Read-only on credentials. The poll reads the access token from the account's .credentials.json and sends it to the usage endpoint — nowhere else. It never refreshes, rewrites, or copies a token; an expired one is a skipped tick (the next CLI launch refreshes it, as it always has).
  • Best-effort. A failed poll changes nothing: the health file keeps what the shim wrote, selection keeps working from it, and the failure is logged once per transition, not per tick.
  • Native and configDir logins only — not setup-token accounts. A claude setup-token token carries only the user:inference scope, and the usage endpoint requires user:profile: it answers 403 oauth_scope_insufficient (checked against the live endpoint; upstream anthropics/claude-code#11985). Reading a credentials file from the account's dir instead would read a different login than the one it runs on. So token accounts (oauthTokenFile / oauthTokenRef) are not polled, and doctor, usage and the gateway log say so. What that means in practice for a pool of token accounts:
    • Still works: rotation from stream telemetry — every turn's rate_limit_event feeds the same threshold rule, the numberless 5-hour warning rule (v1.7.2), and rejection-with-reset handling in the table above; and the in-turn retry still catches a limit that lands mid-turn.
    • Missing: an idle account is not re-measured between turns, the 5-hour window usually has no percentage (only a warning status), and there is no 95% usage alert. macOS native logins kept in the keychain (no .credentials.json) are likewise not polled.
  • Off switch: "usagePoll": { "enabled": false }.

On demand:

text
multi-clawd usage           # live figures per account + what the next launch would do
multi-clawd usage --json

What "seamless" means here. Rotation is decided per launch, so a turn that starts after the poll has seen 85% simply runs on the other account — the user sees nothing. A turn already in flight when its account runs out is covered by the shim's in-turn retry (v1.9): the refusal is held back, the sibling is spawned, the conversation is handed over, and the turn completes there. The poll's job is to make that second path rare by moving work off an account before it reaches the cliff, and to tell you when every account is nearing one.

Direct route: the pool for anthropic/* too (v1.9)

OpenClaw reaches Claude two ways. The pool above drives Claude Code CLI backends (clawd/…). OpenClaw's own anthropic/* models skip the CLI and call the Anthropic API directly, with an auth profile. A claude setup-token works for both, and both use up the same account limits.

From v1.9 the pool can steer both. Opt accounts in with direct:

jsonc
"accounts": [
  // native login: give it its own setup-token for the API route
  { "id": "claw1", "native": true,
    "direct": { "tokenRef": { "source": "exec", "provider": "onepassword",
                              "id": "op://YourVault/claw1-setup-token/password" } } },
  // already has a setup-token for the CLI: reuse it
  { "id": "claw2", "configDir": "~/.claw2",
    "oauthTokenRef": { "source": "exec", "provider": "onepassword",
                       "id": "op://YourVault/claw2-setup-token/password" },
    "direct": true }
],
"directRoute": { "agents": ["main"] }   // optional; default ["main"]

Then run multi-clawd direct sync. It does two things:

  1. Stores one OpenClaw profile per account (anthropic:claw1, anthropic:claw2), using OpenClaw's own commands:
    • A secret reference is stored as a reference (openclaw secrets apply). OpenClaw resolves it at runtime, so the token is never copied.
    • A token file is piped to openclaw models auth paste-token on stdin.
    • Profiles that already exist are left alone; --resync rewrites them.
  2. Sets the anthropic auth order to match pool health.

The plugin then keeps that order up to date inside the gateway, re-checking every minute:

  • The healthiest account goes first; a nearly-maxed one moves to the back before it errors.
  • The rule is the same one the CLI pool uses, and it reads the same health data, so both routes lean on the same account at the same time.
  • OpenClaw's own rotation covers the rest mid-turn: a 429 cools that profile down and the turn moves to the next one.

What to know:

  • Why a native or config-dir login needs its own token. That login is a rotating one-time OAuth grant, and a copy of it breaks on the next refresh. multi-clawd never copies that login into a direct profile. (The usage poll and login checks do read Claude's credential files, but never copy or rewrite them.) Run claude setup-token signed in as that account and store the token. setup walks you through it.
  • Already stored a profile yourself? Adopt it with "direct": { "profileId": "anthropic:<id>" }. It gets ordered, never rewritten.
  • Existing sessions stay on their account. OpenClaw pins a profile to each session. A new order applies to new sessions, and to a session whose profile cools down. A pinned session moves when its account actually hits its limit, and the next account in line is by then the healthiest.
  • Your own profiles are kept. Anything in the anthropic order that multi-clawd doesn't manage stays there, after the pool's accounts. "directRoute": { "manageOrder": false } hands the order back to you.
  • Health comes from CLI turns only. Traffic that only uses the API route doesn't update it. With no recent CLI turns an account counts as healthy, and OpenClaw's reactive rotation does the work.
  • Nothing changes without direct. No timer, no OpenClaw calls, and the same explain/chain/doctor output as before.

multi-clawd direct shows, per account: the profile, whether it's stored, any cooldown, and the live order. explain shows the same, and doctor --probe makes one tiny live call per profile.

How it works

Three moves, all through the official plugin SDK (details in DESIGN.md):

  1. registerCliBackend mirrors the bundled claude-cli backend — same argv, same JSONL stream parsing, same MCP config-file bridge — scoped to one account id.
  2. A minimal provider per account implements resolveDynamicModel + augmentModelCatalog, which is what makes claw2/claude-fable-5 resolvable without an API key (installed extensions can't use the bundled plugins' static-catalog path — this is the supported alternative).
  3. prepareExecution injects that account's own login (CLAUDE_CONFIG_DIR + CLAUDE_CODE_OAUTH_TOKEN) into the child process env, after the host's ambient Claude credentials are stripped.

Which path shell commands take. On OpenClaw 2026.10.10 and later the bundled claude-cli backend declares exec and process as host-owned: a normal chat turn runs shell commands through OpenClaw's own exec tool, under OpenClaw's approval and allowlist policy, and Claude Code's native Bash is disabled for that turn. From v2.6.6 the pool declares the same set, so a turn on clawd/* or claw<N>/* takes the same path as one on claude-cli/*. Before v2.6.6 the pool left native Bash enabled on those gateways, governed only by the permission mode derived from tools.exec.mode, so OpenClaw's exec approvals did not apply to it. On OpenClaw 2026.8.x there is no host-owned contract on either backend: commands run through Claude Code's native Bash under that permission mode, unchanged. Exact-cap runs (cron tool policies, disableTools) are unchanged.

Side questions are tool-free. A side question (/btw, setup probes) runs on the pool exactly as on claude-cli/*: the argv is rewritten to --safe-mode --tools "" --disallowedTools mcp__* --strict-mcp-config --no-session-persistence --max-turns 1 --permission-mode default, with any session, resume, fork, effort, tool and MCP-config flags dropped first. No native tool (Bash, Edit, Write, ...) and no MCP tool is selectable, except that an explicit native-tool cap supplied by OpenClaw is applied last and is honoured as named (a side question capped to Read gets --tools Read), and bypassPermissions from tools.exec.mode: full does not carry over. From v2.7.0 this holds on every supported gateway, with or without host-owned exec. Before v2.7.0 the pool ignored the side-question mode, so a side question kept Claude Code's native tools under the operator's permission mode. Published v2.6.6 did not include this projection; it was still tracked in #142.

Legacy issue: idle backend eviction on OpenClaw ≤ 2026.7.1

On OpenClaw ≤ 2026.7.1, core's scoped harness activation can silently drop a plugin-registered CLI backend from the live registry: when an agent turn selects a harness owned by a different plugin and that scoped set isn't already fully loaded, core rebuilds the plugin registry with only that plugin (+ the memory plugin) and swaps it in globally. Your claw2 backend then fails with Unknown CLI backend: claw2 — while openclaw infer model list (a separate cache) still lists its models. A common real-world trigger is an hourly heartbeat running on a model served by another harness.

OpenClaw 2026.8.1 includes the fix. On affected older runtimes, a gateway restart always restores the backend (startup loads are full-scope), and backends that are in regular use effectively re-assert themselves. This repo ships a ready-made mitigation — scripts/eviction-watchdog.mjs — which tails the gateway log for the Unknown CLI backend signature and restarts the gateway at most once per eviction event. Run it every few minutes from cron/launchd/systemd:

bash
node scripts/eviction-watchdog.mjs                    # restart on detection
MULTI_CLAWD_WATCHDOG_DRY=1 node scripts/eviction-watchdog.mjs   # report only

An in-process fix was investigated and is impossible by design: registerCliBackend is not late-callable, there is no registry-rebuilt event, and no plugin API can force a rebuild. See DESIGN.md.

Known limitations

  • Control UI shows the pool as unavailable on OpenClaw 2026.10 (multi-clawd ≤ 2.1.0). OpenClaw 2026.10 computes model availability per provider, and a plugin provider backed by a Claude login (a native or configDir account) had no credential to show it — so Settings → Models greyed out every clawd/* and claw<N>/* row with "missing auth" and showed a different model than the configured primary, even though agent turns worked. openclaw gateway call models.list --json shows the same rows as available: false, unavailableReason: "missing-auth". Fixed in 2.1.1: a usable login now reports as available, a dead one still reports "missing-auth", and the direct API transport keeps refusing CLI-login accounts as before. Update with multi-clawd update. If an account's stored login is deleted or becomes unreadable, the account can stay available until the 30-second cache window that began at its last assessment ends; the window runs from that assessment, not from the loss. The first availability check after the window ends starts a background re-check, and the account stays available only while that re-check is pending; once it finishes it marks the account unavailable. Even if the re-check stalls, a login backed by a valid access token is refused at its access-token expiry minus 60 seconds, including at that exact moment and even inside the first window. A login proven only by a recent successful turn (its stored token can already be expired) is refused at two windows after the assessment or 24 hours after that turn, whichever comes first. A CLI login failure recorded on a real turn removes it at once.

  • Shim state and retry coordination is best effort under lock contention. Concurrent shims for one account use a short advisory lock around each state merge and rename. A second short lock covers recording a refusal and reading sibling health for the in-turn retry. Later decisions can therefore see rejections already recorded by another shim. If a lock stays busy beyond 150 ms or filesystem locking fails, the shim proceeds without it so the turn still runs; concurrent writes in that fallback can lose an observation. A replacement between the lock's final ownership check and removal can still remove another live holder's lock because those steps are not atomic. The guard does not pace requests sent to a newly chosen sibling.

Security

See SECURITY.md for how to report a vulnerability, exactly how credentials are handled, and a table documenting every process-spawn callsite (the ones static scanners flag) and why each exists.

Full declaration of what this plugin touches — nothing else:

SurfaceWhat multi-clawd does
NetworkThe gateway plugin polls https://api.anthropic.com/api/oauth/usage for eligible pooled accounts on an interval (default 120000 ms / 2 minutes); pool.usagePoll.enabled: false disables that poll. multi-clawd usage requests the same endpoint on demand. doctor runs npm view when its registry cache is stale; install and update commands contact the package registry. Claude Code subprocesses make their own provider requests. No plugin telemetry or analytics endpoint.
CredentialsReads declared setup-token files or gateway-resolved oauthTokenRef values for Claude child launches; reads each eligible account's .credentials.json access token for the usage poll; reads Claude login credentials from files or the macOS Keychain via the security CLI for login checks and runtime auth; reads account identity for file-backed logins from .claude.json (~/.claude.json for a native login, or the account config dir). Setup tokens are passed to Claude through the child environment.
Files readThe OpenClaw config (~/.openclaw/openclaw.json, or the file OPENCLAW_CONFIG_PATH / OPENCLAW_STATE_DIR / OPENCLAW_HOME select; see Config and state location), declared account config dirs and token files, Claude .credentials.json and .claude.json files as described above, and local state files.
Files writtenUnder <OpenClaw state dir>/state/multi-clawd/ (~/.openclaw/state/multi-clawd/ by default; OPENCLAW_STATE_DIR relocates it): <id>.json, <id>.usage.json, history.jsonl (bounded account activity, plus history.jsonl.pending-* event files written while its lock is contended and removed by a later launch that takes the lock), pool-<id>.sticky.json, pool-<id>.sessions.json (when affinity is enabled, plus pool-<id>.sessions.json.pending-* pin files written while its lock is contended: normally one per session, removed by a later launch, and short-lived pool-<id>.sessions.json.parked-<session key>.lock files while a session's pin files are trimmed and pool-<id>.sessions.json.parked-<session key>.reader-*.lock markers when a read loses a listed file), direct-order.sticky.json, known-models.json, alerts-spool.jsonl, watchdog.json, registry-check.json, auth-profiles-<agent>.json, runtime/<hash>/ (copied runtime files), and watchdog-launcher.mjs. The watchdog state file can be redirected with MULTI_CLAWD_WATCHDOG_STATE. Setup writes the selected OpenClaw config file (~/.openclaw/openclaw.json by default) and a dated backup; `account enable
ProcessesLaunches Claude Code and the node + shim transport; CLI, setup and doctor run npm, OpenClaw, Claude and OS scheduler commands; the optional watchdog checks OpenClaw logs and may restart the gateway; Hermes integration runs its Python bridge. See SECURITY.md for the process-call table.
ConsentThe wizard asks before every write, merges non-destructively, and never overwrites an existing account entry. --dry-run previews everything.

Housekeeping:

  • Tokens are never committed and never logged; .gitignore blocks token and account directories by default.
  • Prefer a secret reference (oauthTokenRef, v0.3) over a plaintext file; when a file is used, keep it 0600 (POSIX) or locked to your user with icacls (Windows).
  • Credential resolution fails closed (v1.7.3; configDir no longer an exception). An account that declares oauthTokenRef or oauthTokenFile is authenticated by that token and nothing else. If it resolves to nothing — provider briefly unavailable, empty secret, truncated file, or a file holding anything besides the single token line — the launch on that account is refused with declares a token source but none resolved, even when the account also has a configDir (whatever login sits in that dir is not the credential you declared). In a pool the account is skipped, the turn runs on a sibling, and an operator alert names the account and why; only when no member resolves does the launch fail. Native accounts are exempt: the default login is their credential.
  • Migrating a token file into a vault? op read (and most secret CLIs) append a trailing newline on output — resolution trims the resolved value (guaranteed in token-resolution.ts), so a file-vs-vault diff showing only a trailing-newline mismatch is a false alarm.
  • Use only accounts you own, within your provider's terms of service.

Security notes: verified launch (OpenClaw ≥ 2026.8.1)

  • Same verification bar as the built-in backend, no stronger. Each backend's command is the claude executable found on the gateway's PATH. It declares exactly the runtime artifact OpenClaw's built-in claude-cli backend declares (@anthropic-ai/claude-code, native executable names claude / claude.exe). For a native install, OpenClaw verifies that executable by its basename, the same check it applies to its own claude-cli. multi-clawd adds no package or binary of its own to that authority and never lists node as a native executable.
  • The shim runs only the verified binary. Agent turns go through the shim, which is given the realpath checked when the turn starts and runs that file under the registered command name. A different command, a different argv0, or an interpreter prefix is refused rather than wrapped.
  • MULTI_CLAWD_CLAUDE_BIN is operator-trusted. When it is set in the gateway's environment, the plugin uses it in place of the PATH lookup. Whoever can set the gateway's environment already controls which binary runs, so the variable widens nothing. Only point it at an executable you trust. If it is set but not executable, the launch fails; nothing falls back to another claude.

Status & roadmap

Early but real — built for and dogfooded in production.

  • v0.1 — single extra account, verified end-to-end ✅
  • v0.1.1 — jsonlDialect declared on registered backends, fixing raw stream-JSON reaching connected channels on live turns ✅
  • v0.1.2 — registration-pass logging (config-source attribution + registered-backend summary) ✅
  • v0.2 — the pool: proactive near-limit rotation from live rate_limit_event health; native (keychain) accounts; future-proof model resolution (mirrored catalog + permissive claude-* pass-through); eviction watchdog; vitest suite ✅
  • v0.3 — hardening from field feedback: oauthTokenRef via gateway secret providers with strict redaction; sticky rotation with anti-flap dwell; login-health probes + heartbeat operator alerts; turn-safe watchdog (lane-guard); doctor + --preflight; build-on-install; shim window persistence ✅
  • v0.3.5 — tier-aware degradation (whole pool exhausted → step down the configured ladder on the same account, e.g. Fable → Opus, instead of dropping provider) + never-degrade pins for contractual model lanes + single-account pools ✅
  • v0.3.6 — reactive model-limit capture: a 429 "reached your limit" error is recorded as a model-scoped rejected window, and health is model-aware (exhausted-for-Fable ≠ exhausted-for-Opus) — the first hard limit teaches the pool, the next launch flips accounts ✅
  • v0.3.7 — reset-aware per-window staleness: reset-bearing windows (weekly, model:*) bind until their reset regardless of observation age (capped at 8d with a clock-skew alarm), reset-less windows keep TTL/decay, and model windows age by their own TTL independent of pool staleAfterMs — closes the quiet-pool blindness half of the no-flip failure class ✅
  • v1.0 — the public line: published to npm as @drakon-systems/multi-clawd, openclaw demoted to an optional peer, registry installs verified end-to-end ✅
  • v1.1–v1.2 — the multi-clawd CLI (update / setup / doctor); wizard owns the eviction watchdog (schedules it, detects + repoints orphaned units after migrations); wizard account-protection (existing accounts default to keep-unchanged; suspicious secret refs challenged) ✅
  • v1.3 — multi-clawd explain: the whole setup in plain English — accounts, pool decisions, every fallback rung annotated, live health with reset times ✅
  • v1.4 — multi-clawd login <account>: the right Claude sign-in flow for each account shape, verified afterwards (signed-in email shown, token values never touched); ClawHub package published under @drakon-systems ✅
  • v1.9 — one pool, both transports: accounts can also serve OpenClaw's direct anthropic/* route; the gateway keeps the anthropic auth order in pool-health order; multi-clawd direct / direct sync ✅
  • Unreleased — optional per-session affinity for shimmed Claude CLI launches; health overrides the pin, with bounded expiring state ✅
  • Next — standalone localhost proxy (OpenAI-compatible) so Hermes and custom runtimes can share the pool; local five-hour-window signal (turn counting); per-account lock for the shim persistence race

See DESIGN.md for the architecture, the three obvious approaches that don't work, and why.


Built by Drakon Systems Ltd · MIT licensed

🦞 Claws out.