Repository navigation
Claude Code Plugin
clauth ships an MCP server that hands your profiles to a live Claude Code session: compare usage across accounts, relink the active one, or hand a whole prompt to another account without spending the window you are in.
Open the TUI's Services tab, move to the plugin row, then press f and ⏎. Confirming the prompt installs the plugin at user scope through Claude Code's own installer. If a broken registration ever trips it, the plugin repairs itself: its SessionStart hook runs clauth self-heal, which reinstalls a registered-but-broken install and leaves a deliberate uninstall alone. clauth self-heal also converges plugin install paths Claude Code recorded through a dead session tree back to their shared ~/.claude twins, and clauth start plus the daemon run the same convergence before a session loads, so a plugin whose recorded path dangled loads again, no manual fix.
Claude Code keeps loading the plugin version it installed until something reinstalls it. After clauth updates, the next session's clauth self-heal updates an enabled plugin, and sessions started after it load the new version. Until then the plugin row warns with both versions on its version line, and f then ⏎ updates it at once. A plugin you disabled is never updated on its own, so it keeps the warning until you turn it back on or run that fix, which does both. A plugin newer than the running clauth (a dashboard left open across an update) reads fine: it belongs to the newer clauth. A clauth started before the update, such as a daemon left running, skips reinstalling the plugin, since that would put its older version back; the updated clauth's next session start, clauth start or daemon does it. On Linux and macOS a running daemon restarts itself on the new binary within seconds (Daemon). When the daemon is still running the old binary after a few seconds (on Windows, from a release that predates that restart, when the new binary is an older clauth that cannot take over, when a --listen daemon's new binary cannot load the API certificate, or while a token save in flight holds the restart up), the TUI says so: a warning toast naming clauth daemon --replace, the Services tab tinted until you visit it, and a line on the plugin row until the daemon restarts; when the daemon's binary was removed rather than replaced, the toast and the line say so at once and ask you to reinstall clauth first. Each kind toasts at most once per run; on Windows an update briefly leaves no file at the path, so a removed toast can come first and the replaced one follows it. A TUI left open across an update or a rebuild toasts once that it is still running the old binary and you should reopen it (an update the TUI installed itself says so in its own toast instead), and its f fix, install or update, refuses until you do, since it would install the plugin its old binary carries. A TUI whose binary was removed (cargo uninstall clauth) toasts that its binary was removed, and its install refuses until you reinstall clauth and open it again.
/plugin marketplace add uwuclxdy/clauth then /plugin install clauth@clauth is the other route. It registers the same plugin against this repo rather than the local tree, and clauth converges the two: the registration is re-pointed at the locally materialized tree the next time clauth mcp starts, the daemon ticks, or clauth start runs (a daemon started before an update leaves it to the updated clauth). Nothing to do by hand, and nothing to undo if you took that route before.
clauth start is the one of the three that can repair a registration too broken to load. Once a marketplace stops loading, the plugin loads no hooks and starts no MCP server, so neither the SessionStart self-heal nor the clauth mcp startup heal can be what fires.
Claude Code launches clauth mcp in the background for the session's lifetime. clauth has to be on PATH, which it is after any standard install.
To wire the server by hand instead, add this to mcpServers in ~/.claude.json:
"clauth": { "type": "stdio", "command": "clauth", "args": ["mcp"] }The TUI's Services tab writes exactly that entry for you, into ~/.claude.json and the copy in every shared runtime tree of a clauth start session that is still running, under ~/.clauth/profiles/ (a background session's tree counts while its job is still running; a tree no running session holds, and an isolated session's copy, is left alone; a file that already carries the entry is left alone; a missing ~/.claude.json is created holding the entry alone): on the plugin row, f to the wire mcp server line, then ⏎. It refuses with a wire failed toast carrying one of four lines: clauth is syncing Claude Code's config; try again in a moment while another clauth process is merging those files; {path} is being written by Claude Code; try again in a moment for a file that kept changing under it (the file's own path replaces {path}; copies the fix already wrote keep the entry); {path} does not parse as a JSON object; nothing was changed for a file that is not a JSON object or cannot be read, which the fix leaves alone for you to repair; and failed to write {path} when a file cannot be written; a ~/.clauth clauth cannot open shows the sync lock's own error instead. The manual route gives you the same four tools, minus the bundled hooks and module. Without the plugin, a backgrounded delegate result has to be collected with monitor, a conversation is never told when the account behind it changes or its context crosses the configured threshold, and no session reaches the clauth app through the module.
| Tool | Input | Returns | Cost |
|---|---|---|---|
profiles |
names (optional, case-insensitive), scope (all default, or session) |
every profile with live cached 5h / 7d percentages or a provider's own live bars (a lapsed window drops), provider, tier, endpoint host, active flag; scope: "session" returns the one account this session runs on and how it resolved |
none, reads the disk cache |
switch_profile |
name |
relinks the global active profile; the reply says what the switch does to THIS session | none |
delegate |
see below | the target account's answer, or a job_id
|
a real usage window on the target account |
monitor |
job_ids (optional list, capped at 256), cancel (needs job_ids) |
with job_ids: a backgrounded job's envelope, its running status, or a named reason for a dead or absent id, one result per id; with none: the delegates clauth is holding, live runs first; an id whose run finished while its caller waited answers job_id <id>: the run finished, its result went back through the call that started it
|
none |
Every reply reads as prose; there is no format parameter.
The four tools are Claude Code only: they see the Claude Code roster, and a codex profile (Codex) never appears in profiles. A codex profile named to profiles, switch_profile or delegate (one name or a fan-out list) is refused as a codex account the plugin does not manage, never as an unknown name; the match is case-insensitive and the refusal names the roster's spelling: profile not found: cx; cx names a CODEX account, which these tools do not manage — they are Claude Code only. Switch it with `clauth switch <name>` . A list mixing unknown and codex names keeps the tool's own fix for the unknown ones and adds the codex clause for the rest.
clauth's state can move under a live session: the active profile switches, the background scheduler refreshes usage figures, a rotation rewrites the credentials file. Replies that carry live usage (profiles({scope:"session"}), switch_profile, delegate, monitor) carry a since_your_last_call note too, naming what moved since the last reply that reported one, and only when something did.
monitor with no job_ids lists the delegates clauth is holding, live runs first, then the most recently finished, bounded, with a count of anything left out. That is how a session recovers the id of a delegate it interrupted, since the reply carrying the id at the moment of interruption is dropped rather than sent. The call answers at once from local disk: no wait, no network, no quota, no background thread. A shared orphaned or stopped row in that list carries the run's session_id, so a crashed shared run leaves a resume handle rather than a dead end; an isolated orphaned row names none, since its id resumes nothing, and neither does an orphaned row whose delegate is still running.
A switch_profile that runs never carries the digest for its own switch: the reply itself already says what it did, and it refreshes the baseline so the switch is not reported twice. A switch clauth refuses changes nothing, so that reply does carry the digest, naming whatever moved before the call.
profiles({scope:"session"}) is the authority on which account owns the current session. The all-scope roster reads a cache and can lag it.
profiles answers for every profile by default, and names narrows it to the ones you ask for. Eleven fields appear only when they have something to say: how many of the account's banked usage-limit resets a spend could use at its last read (2 limit resets available, the resets left on every grant usable now whose id clauth sends), when the plan ends or renews, off the dates you gave the profile in its config.toml (Configuration) (plan ends 2026-11-20, still plan ends with that date once it has passed, or plan renews 2026-12-15, which never shows while the plan reads canceled or refused), how many sessions run on that profile now, counted the way the TUI header's live chip counts them (1 live session, 3 live sessions (2 delegates)), then disabled, login expired, no api key, key rejected and token rejected (the server refused the account's setup token to the usage probe), printed together so they read as one group. When clauth cannot read everything the count comes from (a session or job store, or a running background job's supervisor record), the reply ends with live sessions: partly unknown (a session store could not be read), and the counts above it may be short. disabled, no api key, key rejected and token rejected refuse a delegate on that account outright, the last naming its re-mint, clauth login <name> --setup-token; login expired refuses one except on an account that runs its own endpoint with its own key, where it reports a stale usage reading instead; and a balance the provider itself has marked too low refuses one too. Then subscription canceled, which is not a refusal: it tells you the account dropped to whatever the free plan allows; or, in its place, org refused, not a refusal either: the account's organization refuses it, on hold, disabled or out of reach, and no login fixes that. Then credit cap spent: the account's usage-credit cap is spent, so Claude Code refuses the models it bills against usage credits (Fable, plus any family its flag adds) there. A delegate there is refused when it would run one of them, and also when clauth cannot tell what it would run — no model named, one it cannot place, or an agent run with no model named — whatever that account's credit gate says; the gate never decides a refusal. An account that serves inference on its own endpoint with its own key never carries the flag: no launch spends its usage credits, so no delegate on it is refused for a cap. Last come the throughput rows, when a model there is degraded or was recently rate-limited. An account whose endpoint sits on your own machine or your own network carries local endpoint in its bracket. The word says where the endpoint is, never who pays for it or whether it is your cheapest target. On a 27-profile fleet that reply is just over half the size it would otherwise be, which matters because the model is told to call it at the start of every session.
A conversation can end up on a different account three ways, and none of them is visible from inside it. You resume it under another profile, which keeps the same conversation and appends to the same transcript. A clauth switch lands while a global session is working. A clauth start --with-fallback session swaps credentials mid-run. The first case has cost a real session a round of reasoning spent working out which account it was on.
With the plugin installed, clauth says so. A resume reads clauth note: session resumed under `DS4`; earlier turns ran under `z.ai`. A move under a live session reads clauth note: the active profile for this session switched from `kerry` to `cld`; its 5h window is 42% used. The 5h figure appears when clauth holds a usage reading for the new account, and is left off when it does not. The note arrives on the next prompt or, mid-turn, on a tool call (checked at most once every 10 seconds, and on every subagent the main conversation spawns), whichever comes first, and separately for each subagent running at the time. It comes back once more after a compaction, which drops it along with everything else clauth injected.
Nothing is said while the account holds still. The check that decides costs a stat of the credential file plus a quick scan of your profile directory per check, and only reads the accounts themselves when something has moved. clauth stays quiet when it cannot tell which of your accounts the loaded credentials belong to, rather than naming one it is guessing at.
Where the connect brief names a clauth start session's runtime directory, it keeps naming the profile you launched on. That is the directory's name and it does not move. The note is what answers which account you are spending.
switch_profile repoints the global ~/.claude credentials. A session running on those adopts the new account at its next request, mid-task. A clauth start session runs against its own profile and is unaffected; the reply says which case your session is in.
To use another account without disturbing the current session, use delegate.
The plugin also carries a small module that runs inside every Claude Code session it loads into (Claude Code 2.1.326 or newer; Linux and macOS; on Windows it does nothing). On an older Claude Code the plugin as clauth installs it still loads and its tools work, but the module does not load until you update Claude Code; a plugin added through /plugin marketplace add instead is skipped whole by Claude Code 2.1.323 to 2.1.325 until the daemon or clauth start re-points it at the local tree. It reports the session to the clauth daemon over ~/.clauth/bridge.sock: when it starts and ends, when a turn starts and ends, a notice for most new transcript rows (never the row itself: the daemon reads it from the transcript file, so a row with no notice of its own usually arrives with the next notice for its file or at the session's end, and one in a file no notice named, or after a crash or a /clear, can stay in the session's history alone), and every permission ask it could hold for you. The clauth app then lists the session, shows its transcript live, and can send it a prompt, interrupt it, or answer its asks, the same as a herdr pane, with or without herdr. A session the module reaches but herdr does not is flagged to the app with what it lacks: no live terminal, and dialogs only the desk can answer (plan approval among them). A /clear or a /resume inside the session keeps phone control: the module registers the new conversation once the daemon takes it, a few seconds later (until then its asks get Claude Code's own dialog, no phone prompt or interrupt reaches it, and its first rows reach only the history), and an ask held across the change goes back to Claude Code's own dialog.
Permission asks. The module asks Claude Code first and steps in only where Claude Code itself would ask you; a call your rules already allow or deny never reaches your phone. When the daemon runs with --listen and a device paired with --control has its event stream open (REST API), the module holds that ask and draws its own row above the prompt instead of Claude Code's dialog:
Bash cargo test
Allow this? Answer here or on your phone. 1: Allow 2: Deny
The first answer wins, desk or phone. 1 and 2 answer once the row has the keyboard: if a digit lands in your prompt instead (in about the first second after the row appears, whether or not the model is streaming), clear it and press the digit again. Esc is Claude Code's own interrupt, not an answer: it stops the main turn, so a tool the main turn asked about does not run, while a background subagent's ask stays until it is answered. With no listening daemon or no control device connected, the module steps aside and Claude Code draws its usual dialog; a push subscription alone, or a view device's stream, does not count as connected. A control device stays counted for 5 s after its last stream closes, so the app's routine reconnect keeps a hold. Once none is counted, a held ask or question goes back to the desk: the row goes, Claude Code draws its usual dialog, and the phone keeps listing it read-only, as it lists one the module never held, until the call settles (a question once the desk answers it, a permission ask once its tool has run or been denied; a check with no tool call behind it closes at once). If a wait fails mid-hold (the daemon stops answering, or refuses it), the module steps aside the same way and closes the ask at once. A session with no one at it never holds an ask (claude -p, a clauth delegate); a claude --bg session holds like any other, since the phone may be the only place to answer it. Several asks held at once (parallel subagents) are each answerable from your phone; the desk row shows the oldest first. Past eight at once, the rest get Claude Code's own dialog.
Questions. An AskUserQuestion the phone can answer is held the same way, with a row offering the desk the question instead:
AskUserQuestion Which test should I run first?
Answer on your phone, or here. 1: Answer here Esc cancels
1 hands the question back to Claude Code's own dialog at the desk. A phone answer can carry a note on each question, which the model reads with that question; a noted answer to a session still running an older plugin, which cannot take notes, is refused instead of dropping the note.
An endpoint account's key lives in its profile's config.toml; Claude Code gets it through settings.json's apiKeyHelper, which runs clauth __api-key <profile> and prints the stored key. The command reads, it never mints: every call prints the same static key, so the value survives any number of child sessions and stays valid until clauth login <name> --api-key re-captures it or the divergence flow adopts the key the live settings hold (on a proxy account, until clauth login <name> --proxy <service> replaces it). It is not single-use. A child session inherits the parent's settings.json and auths through the same helper; exporting the key into a child's env by hand is unnecessary.
clauth __oauth-token <profile> prints the OAuth access token a switch to that profile would install, so a script can hand it to claude as CLAUDE_CODE_OAUTH_TOKEN. A refreshable token with less than an hour left is refreshed first, under the same lock clauth's other refreshes take, and the refresh token never leaves clauth. The active profile is never refreshed here: it prints the token a running claude last wrote to ~/.claude (its stored token when that file is missing), and refuses when clauth can't tie that login to the profile's own account or Claude Code has logged it out. A profile with a long-lived session-token.json prints that sidecar token instead, active or not — never the rotating usage pair in credentials.json. On macOS, a profile with its own live clauth start session, or an unfinished background job holding the rotating login, also prints its stored token unrefreshed; a rolling-token profile there prints its current bearer as-is and exits 1 with could not refresh only when that bearer is stale and the session launched on the rotating pair. An expired token never prints: where a running claude owns the refresh, the error says to run claude on the profile once. An endpoint or disabled profile gets nothing: the command exits 1 with nothing on stdout.
Runs a headless claude -p under another profile and returns what it produced.
| Field | Type | Default |
|---|---|---|
profiles |
array of strings | one name = one target; two or more = fan-out, one row per account |
prompt |
string | the task text, or a path to a prompt file; a prompt starting with -, or a prompt file whose text does, is refused: claude would read it as an option |
model |
string | the profile's own default |
cwd |
string | the server's working directory |
env |
object | none |
args |
array | none, appended to the claude invocation, except a --settings before --, which clauth merges into its own settings file when it passes one. Refused before anything starts: --session-id, --resume/-r, --fork-session, --from-pr and --teleport (clauth pins the delegate's session id and exports it as CLAUTH_DELEGATE_SESSION_ID; resume via session_id); --managed-settings anywhere in args (Claude Code's SDK-only policy tier, which outranks every setting clauth passes); a --settings after -- or taken as another flag's value (claude would read it in place of clauth's); args ending in a --settings with no value (claude would refuse it); and, on a shared delegate with a cleanupPeriodDays to carry, a --settings clauth cannot read, parse or merge its hooks into (see Transcript retention below) |
session_id |
string | none, a session id to resume |
subagent_type |
string | none; runs the whole delegate as one of your agent types, and with no model named (model or --model in args) its credit demand is unknown |
allowed_tools |
array of strings | none; maps to --allowedTools
|
permission_mode |
string | none; maps to --permission-mode
|
result |
string | inline; result: "file" writes the envelope to disk and returns its path, sha256, and cost line |
isolated |
bool | false |
background |
bool | false |
Cost. A delegate to a subscription account opens a real 5-hour window there (a plan with no 5h limit has none to open). To a pay-as-you-go API-key account it bills real money. To a prepaid plan account it draws down quota you already bought, so it costs nothing extra. A loopback or LAN host is free. Call profiles first to pick the account with headroom.
The cost figure in a finished delegate's reply comes from the delegated claude itself, which prices every run at Anthropic's rates whatever endpoint answered it. So it is the real amount only on a subscription account. On any account whose requests go somewhere else, the reply labels the figure as Anthropic-priced rather than letting it read as the bill. That covers an account with an endpoint host and an account whose endpoint is set only as an ANTHROPIC_BASE_URL entry in its [env], which the roster's host column does not show. Where clauth cannot read an account's config at all it says the endpoint is unknown instead of guessing. It never reprices the figure, because the envelope reports the model id that was sent, never the model the endpoint actually served. The usage line beside it names the provider that answered, as (served by DeepSeek), and stays bare only when Anthropic did.
What it sees. Only the prompt you pass. It has no view of the calling conversation, so the prompt has to carry the whole task.
Prompt. One arg carries the task: either the task text, or a path to a prompt file. A path is detected by a leading ./ or /, or by the file existing at that path. A value detected as a path whose file does not exist is refused rather than run as text, naming the path and the cwd it was resolved against. The file must be valid UTF-8 and at most 64 KiB.
Targets. profiles takes one name or several. One name runs a single delegate, blocking by default; set background to get a job id back at once. Two or more fan out one delegate per named account and spend one real usage window per account, waiting for every one and returning one row per account, or one job_id per account with background: true. Duplicate names (case-insensitive), unknown names, a disabled member, a member clauth has quarantined after its refresh token was rejected, a member with no inference auth (no usable api key and no ANTHROPIC_AUTH_TOKEN/ANTHROPIC_API_KEY in its [env]), a member whose api key the provider has already rejected, a member whose provider has said its balance cannot fund a call, a member whose usage-credit cap is spent when the delegate runs a credit-billed model (the demand: the last --model in args, else the model you pass; with neither, a launch running as an agent — subagent_type, else an --agent in args, else a resumed session's agent, else the settings agent — has no model clauth can tell, since clauth reads no agent def; with no agent, the ANTHROPIC_MODEL the child sees — a --settings or project settings env value, else the account's own or your global one, else the call's env — else the settings model — a --settings tier, the project settings of the directory it runs in, or the account's own default — plus its subagent model, the call's env one included, its advisor model (the last non-blank --advisor in args, else the advisorModel of a --settings tier, else of the project settings of the directory it runs in, else the account's [models] advisor row; none when the child's CLAUDE_CODE_DISABLE_ADVISOR_TOOL is 1, true, yes or on, the call's env one included), and its one fallback list (the last --fallback-model in args, set aside when it equals the --model the child runs, else the fallbackModel of a --settings tier, else of the project settings of the directory it runs in, else your global one unless the delegate is isolated); with no model clauth can tell — none named, one it cannot place (even beside ones it can), or an agent run with no model named — whatever the account's credit gate says), and an empty profiles list on anything but a resume are refused before any spawn. A disabled account is refused as '<name>': account is disabled, the sentence clauth start, clauth switch <name>, switch_profile and the API's switch and session-create routes refuse with. Two refusals name the command that fixes them: clauth login <name> for a quarantined account (the same sentence switch_profile refuses with), and clauth login <name> --api-key <key> for a missing or rejected key, which on a proxy account is clauth login <name> --proxy <service>, the only login it takes. A refusal for a balance the provider itself called too low carries that balance and how old the reading is, and asks for another account: no command refills a wallet. A credit-cap refusal names the model family, names the model clauth cannot place, says no model was named, or names the agent whose model it cannot tell (credit cap spent: <name> runs agent <agent>, whose model clauth cannot tell; name another account or a model), and asks for another account or another model. An account that serves inference on its own endpoint with its own key takes no credit-cap refusal, never sorts last for one, and never carries the flag. An account with its own endpoint and a working key is not refused for a quarantine, whether or not clauth recognises the provider: the login clauth quarantined feeds usage polling, and the delegate runs on the api key regardless. Every other account still takes that refusal, an endpoint with no key and a key with no endpoint alike: the exemption is for an account that demonstrably routes and authenticates on its own. Separately, an account on a recognised endpoint with no key is refused for the missing key, which is what actually stops it. An endpoint clauth has no provider for is exempt from that one, since it may be a local model needing no key at all. A proxy account on its proxy's address is not exempt, since the proxy serves only the key it minted: it is refused, and profiles flags it no api key.
Refusal echoes. A refusal echoes a caller-supplied name or id with every character that can break or reorder a line — a control character, U+2028 or U+2029, or a bidi control (U+200E, U+200F, U+202A–U+202E, U+2066–U+2069) — turned to a space, cut at 64 characters plus an ellipsis; accents (precomposed or combining), emoji and every other character stay as written. A path echoes exactly as written, unless it holds one of those characters or a ", then it is quoted and escaped in Rust's debug form, which also escapes a combining mark inside it.
Recursion. Hard-capped at depth 1. A delegated session cannot call delegate again.
Subagent type. subagent_type runs the whole delegate as one of your agent types: the spawned claude gets --agent <name>, so the delegate's system prompt is that agent's, and unless model or --model names one, clauth cannot tell which model it runs, so a spent cap refuses the delegate whatever its credit gate says. The definition resolves from the delegate session's cwd (the server's working directory by default), so a cwd override without the agents tree in reach fails at the spawn rather than at clauth. @"{type} (agent)" at the head of the prompt still works and spawns the agent inside the delegate instead. Setting subagent_type while args carries --agent itself is refused. A blank subagent_type is ignored, so a resume keeps the transcript's own agent.
Result file. result: "file" writes the finished envelope to disk under ~/.clauth/jobs/results/ and the reply carries its path, its sha256, and the cost line instead of the full text. The model reads the file when it wants the body, so a long result costs the conversation nothing. A write failure falls back to the inline reply, saying so.
Kill rules. A delegate has no clauth-side deadline: a run that keeps producing output is never cut off, no matter how long it runs. The bound is the host's: Claude Code parks a long blocking call as a Task at about 120 s and delivers the result later as a notification, so the call's own slot is never lost to a slow delegate. To stop a run you regret, pass cancel: true to monitor with the job ids, or stop the parked Task itself. A killed run still returns the text it had written, in partial_result, along with elapsed_secs, and a session_id when the work is resumable. A run that exits non-zero, or whose output clauth cannot read as an answer, hands back the same two: the account paid for that text either way. Where there is no resume handle the reply says why, so silence never has to be read as one.
Resume. Pass a killed run's session_id back as session_id rather than paying for the work again. Leave profiles off and it runs on the account clauth recorded for that session; one it cannot attribute is refused by name instead. clauth runs the resume in the workspace that session was recorded in, and refuses a cwd that disagrees with it. A resume is judged by the model it will run, not the account's default: clauth scans the transcript the session_id pins whole, and if its last agent record names an agent the resumed session re-runs it, so with no model named a capped account refuses it like any agent launch (the refusal names runs agent <agent>). A named model — or --model in args — decides the resume alone; an explicit non-blank --agent in args, or a subagent_type, outranks the transcript's agent, and a blank one is ignored so the transcript's agent stands. The session_id must name a top-level transcript: a session name, a nested subagent id, or an id with no transcript here is refused by name, never handed to Claude Code's transcript picker. Both kinds are resumable: a shared delegate's transcript already lives in the global store, and an isolated one's is lifted there before its throwaway runtime is deleted. After a crash, the handle lives in clauth jobs --json and in the monitor listing: a job's record keeps the session_id the run had reached, for a day. A crashed isolated run's transcript reaches the global store at clauth's next stale-session cleanup (when clauth start or resume launches, the TUI opens, or the daemon or the plugin's MCP server starts); until then there is nothing to resume. monitor answers a crashed run's id the same way rather than calling it unknown: a run that had recorded its session id answers that it was stopped when its session exited (below), any other that it died without finishing and left no result, and each names the session id when there is one to give.
Isolated. isolated: true drops your CLAUDE.md, plugins, hooks, skills, subagent types, and every MCP server, keeping the account's auth. Besides your prompt, the run sees only its cwd's own project config (its CLAUDE.md and .claude/ settings); of your own config, nothing. clauth's per-spawn --settings adds its subagent-shell hook (below), plus its memory and tool-result-read exemptions where the runtime's projects resolves through a symlink. That makes it right for blind runs and evals. For ordinary delegated work leave it off: a native Claude Code subagent runs with your context loaded, so the shared default is the one that behaves like a subagent does. It is not a token saving in either direction. Dropping the MCP servers can take the session back under Claude Code's tool-deferral threshold, which then sends every built-in tool schema in full; measured on one machine with five MCP servers configured, an isolated run billed about 15% more input than a shared one, and a machine with no MCP servers configured can measure the opposite.
Subagent shells. A delegate is a claude -p run. Claude Code keeps such a run open for the background agents and shells its main thread starts, but not for a shell one of its subagents backgrounds: once that subagent's turn ends, nothing reads the shell, and its output never reaches the delegate's result. Every delegate, shared or isolated, therefore carries a hook that refuses a subagent's Bash call with run_in_background: true and tells the model to re-send it in the foreground. Every other call passes, background agents and the main thread's own background shells included. On a delegate with no cleanupPeriodDays to carry (below), a --settings in args before -- that clauth cannot read or parse, or whose hooks is malformed, drops the hook, and so does a spawn settings file clauth cannot write: clauth logs a warning and passes args to claude unchanged. A session you start with clauth start carries no such hook.
Transcript retention. A shared delegate's spawn --settings carries the cleanupPeriodDays clauth keeps for your transcript store: the positive integer in ~/.claude/settings.json, else the one clauth remembered (Configuration). When the delegate's own --settings holds a positive integer, the larger of the two is passed, so while there is a number to carry a delegate's args can raise retention but not shorten it; any other value of its own gives way to clauth's number. With no number to carry, the delegate's own value passes as it is. A later change to the number rewrites the file to the larger of the new number and the delegate's own, and remove it rewrites it to the delegate's own number where it had one, so that number stays as the file's floor. While there is a number to carry, a --settings clauth cannot read, parse or merge its hooks into refuses the delegate before it starts, and so does a spawn settings file clauth cannot write, whether or not args holds a --settings; the refusal names the file or the reason and ends the delegate was not started, since clauth could not keep cleanupPeriodDays at <n> or more in it. An isolated delegate carries no number, nor does a shared one when ~/.claude/settings.json holds no positive integer and clauth remembers none.
Background. background: true returns a job_id immediately so the session keeps working, along with that account's headroom and anything that moved in clauth's state since the last reply, exactly as a blocking delegate's answer carries them. A fan-out reply carries headroom for every account it just spent, and with result: "file" names where each run's result will be written. A fan-out without background waits for every account and returns one row per account; background: true is still how you get ids to collect. With the plugin installed, a bundled hook waits out every turn end for the session's background delegates and delivers each result as its job finishes, waking the session with the envelope. The wait is the job's own end — a slow delegate is never cut off by clauth — with a 24 h safety net that ends the wait and nudges the session to call monitor. A session that has sat idle 55 min with a delegate still running gets one wake saying the job is still working and clauth will wake the session when it finishes, and only when this session's prompt cache lives 1 h: which cache length Claude Code picked is read in Claude Code's own order (FORCE_PROMPT_CACHING_5M, CLAUDE_CODE_PROMPT_CACHE_TTL, the promptCacheTtl setting, ENABLE_PROMPT_CACHING_1H, else automatic — 1 h on a claude.ai subscription whose usage window is not read as full, 5 min otherwise), and the Services tab's plugin row shows the setting or variable that picks it in the dashboard's own environment, or the automatic rule when none does; turn the wake off there (its OPTIONS row) or with [plugin] idle_wake = false. A delegate whose server died wakes the session once to say the result is lost, and what it offers depends on the run: a resumable one names the session id to pass back to delegate (or run the task again), while an isolated one or a job with no recorded session says only to run it again. A run that had already recorded its session id gets no such wake: it reads stopped once its delegate is gone, and the session's next resume or compaction names it (below). A wake more than 5 min after the job was last seen adds how long ago (2h 10m ago); several at once are named together, without ages, and point at monitor for each session id only when every run has one and none ran isolated — otherwise they say to run them again. Without the plugin, or with hooks disabled, collect a result with monitor, which answers a job's done envelope, its running status, or a named reason for a dead or absent id. That hook belongs to the session that started the job, so a result still uncollected when that session closes is never pushed; resume the session and its first turn names up to ten such results with the account each ran on, counts the rest, and points at monitor to collect them, then names them again after a compaction. A result past the day clauth keeps it is not named. Call monitor with no job_ids to list the delegates clauth is holding, live runs first, then take the id from there. clauth jobs shows the same list in the terminal. A blocking delegate you interrupted keeps running as an ordinary background job, and the next turn end's hook delivers its result like any other; the listing is how you recover the id with hooks disabled, since the account paid for the run either way. Jobs live in ~/.clauth/jobs/, and a finished one is kept for a day after it finishes, so a late collect still gets its result even after a reboot. To stop a regretted run rather than paying it out, pass cancel: true alongside the ids: each named job is asked to stop and keeps whatever text it had already written, plus a session_id where the run is resumable; on Linux and macOS the stop also ends the processes the run started, with the same exceptions as a session exit's (below). The reply reports each job's state at the moment of the ask; a job still winding down comes back as running, so poll again to collect it. Any id this server holds no running job for is named rather than reported as running: it may already be finishing, or it may belong to a clauth mcp that has since exited.
A check on a job that is still running is worth the turn it costs: it names the account being spent, how long the run has gone, how long ago the delegate last wrote anything, and the newest line of the delegate's own answer. It carries that account's headroom where clauth has it cached: a subscription account's 5h/7d windows, or an api-key account's own provider figures. A window or bar past its reset is left out rather than reported at its last reading. Every figure is dated off its cache and marked (stale) once it ages past a fixed 2-hour threshold. An api-key account whose provider publishes usage bars of its own shows them and nothing else (pro: 5h 100%, 7d 96%, mcp tools 13%); one that publishes none shows a wallet balance as it is (api balance: 3.06 USD, total: 31.45 CNY), and any other figure after a note that no window applies (no 5h/7d limits; credits: 42 units), so the number is never read as a window that will reset. A wallet figure whose balance has been moving carries its recent spend and how long the balance lasts at that pace (api balance: 2.53 CNY · ~4.2 CNY/day (~14 h left): whole days from one day up, whole hours below, each rounded to the nearest, <1 h under half an hour, and no runway beside a spend that reads ~0.0) on this line, the roster row and a delegate's reply alike — the same figures wherever the plugin renders that balance, never a refusal. unknown appears only where clauth has no figure, and when both windows have lapsed it carries the age of the cache it last read, so a long-unknown is distinguishable from a never-fetched account. A shared orphaned or stopped row in the listing carries the run's session_id, so a crashed shared run leaves you a resume handle rather than a dead end (an isolated orphaned row names none: its id resumes nothing; nor does an orphaned row whose delegate is still running); a running row carries none, because its session is still held by the live run.
Session exit. On Linux and macOS, a delegate still running when its Claude Code session exits, background or blocking, is stopped rather than left spending the account: clauth stops its claude and every process still carrying the run's CLAUTH_DELEGATE_JOB_ID in its environment, the shells it backgrounded included. A backgrounded process started with a cleared environment (env -i), or on macOS a backgrounded system binary that hides its environment, escapes the stop. The run keeps a stopped record for a day, holding the session id that resumes it; one stopped before its claude started spent nothing, holds no session id and is not named. Resume the session and, with hooks on, its first turn names it: clauth note: a delegate this session started was stopped when the session exited: `<job>` on `<profile>`. `delegate` with `session_id: "<sid>"` and `profiles: ["<profile>"]` resumes it. Several share one note, up to ten named and the rest counted. An isolated run whose transcript never reached the global store is named as one that cannot be resumed: clauth note: an isolated delegate this session started was stopped when the session exited and cannot be resumed: `<job>` on `<profile>`. `monitor` with its job_id shows what it wrote before it stopped. The note comes back after a compaction until a delegate resumes that session_id, which retires the record. clauth jobs, the monitor listing and the dashboard's delegates detail show the run as stopped; monitor with its id says it was stopped when the session exited, with whatever it had written and, where it can be resumed, the session id, then drops the record. If the session's clauth server is killed before it can stop them, the next one to start stops what they left running and keeps the same record.
Pane state. In herdr, a delegate's pane state reports as a metadata token (clauth_delegate) that reads working while any delegate runs, sync and background alike, and idle once the last one ends. The agent icon in the agents panel is herdr's own: it moves with the pane's own agent, and clauth's report never moves it on any pane. The report lands in the pane's metadata beside the account tag instead. Where the state reads: herdr pane get and herdr pane list print the pane's tokens; the sidebar row clauth herdr install writes names the token only with the delegate_row_text knob on, which is off by default. The report applies only inside a herdr pane, is dropped without an error when herdr refuses it, and carries a 60 s TTL, so a clauth server that dies mid-delegate leaves a stale working for at most that long. Two Claude Code sessions sharing one pane both report under the same name, so one session's idle can clear the other's live working. A stuck report is killed after two seconds, so it can never fail a delegate. It does cost that wait: a delegate sends one report when it starts and one when it ends, and the MCP server is single-threaded, so a stuck herdr holds up your other tool calls for up to two seconds per report that runs there. For a blocking delegate that is both reports, four seconds in total; a background delegate's end report runs off that thread and holds up nothing.
Restore. When herdr restarts and brings its panes back, each Claude Code pane comes back in the mode its conversation started in: the hook the plugin installs tells herdr the command that relaunches it, in place of herdr's builtin claude --resume <sid>. A clauth start pane comes back as clauth resume <sid> --profile <account>, on the same account, in the same runtime wrapper, without prompting. A clauth start --with-fallback pane comes back as clauth resume <sid> --profile <account> --with-fallback, naming the chain member it ran on last, and keeps following the chain. A bare claude pane comes back as clauth __restore <sid>, a hidden command herdr runs for you, never one to type: it runs claude --resume <sid>, a bare claude again that keeps following the global account, never pinned to the one that happened to be global when herdr restarted. The agent chip stays herdr's own on every pane; the resume command is clauth's only addition. A pane an older clauth reported in another mode gets the right command on the hook's next fire. When the hook reaches herdr before herdr has spotted Claude Code in the pane, herdr refuses the command and clauth sends it again on the conversation's next prompt or tool call; a re-send that fails for any other reason stops there until the session next starts, resumes or changes account. herdr refuses the same way, for good, when another tool holds the pane's state or the pane runs an agent other than Claude Code; such a pane falls back to herdr's builtin restore. A clauth start session clauth cannot attribute to an account, and anything outside a herdr pane, reports nothing and falls back to herdr's builtin restore — which loses the account and answers No conversation found for isolated-store sessions.
Restore notice. A bare restore runs claude --resume <sid> without the options the conversation was started with, so a pane started as claude --model opus --mcp-config servers.json comes back without either. So that this does not pass unnoticed, the first prompt after such a restore is refused once with a notice naming the lost options by name, not their values: clauth: this conversation resumed as `claude --resume <sid>`, without the options it was started with: --model, --mcp-config. This prompt was not sent: submit it again to continue as restored, or restart the conversation with those options. Submit the prompt again to carry on as restored. --agent is never named, because a plain resume restores the agent by itself. The notice fires only on linux and macOS, only in a process herdr's restore launched through clauth __restore (a claude --resume you type yourself is never refused), only when an option was lost, and only for a conversation whose start clauth recorded (one started before this clauth version has nothing to compare against). Turn it off with the restore notice row in the Services tab's herdr options (herdr plugin), stored as [herdr] restore_notice; off stops a new notice from arming.
Restore on the chain. clauth resume <sid> --with-fallback, typed or run by a restore, follows the fallback chain as clauth start --with-fallback does. When the account can no longer follow the chain, the session still resumes, pinned to that account: stderr shows clauth: resumed pinned to '<account>', not following the fallback chain: <reason>., and the first prompt in the session is refused once with that line plus This prompt was not sent: submit it again to continue on '<account>'. The reason reads '<account>' is no longer a fallback-chain member, the fallback chain has no second account to move to, '<account>' is no longer an OAuth account, or this host cannot swap credentials (<cause>). A degraded session no longer follows the chain, so later restores bring it back pinned. With no clauth daemon running at the resume, stderr shows clauth: '<account>' follows the fallback chain once `clauth daemon` runs and the session keeps the chain, with no refusal. Either line prints just before Claude Code starts, so a resume refused before that never shows it. The restore notice knob does not turn this refusal off.
Permissions. A delegate spawns with Claude Code's permission gate armed and nobody to answer it, so a task that writes files fails on a denial rather than doing the work. Pass allowed_tools or permission_mode (they map to --allowedTools and --permission-mode on the spawned claude; setting either while args carries the matching flag itself is refused) when the delegate is meant to edit anything, and add --add-dir for reads outside cwd through args. Denials come back in a permission_denials array, so check that field rather than the prose result. An inline or collected reply sorts them by the layer that refused, reading the delegate's transcript: hook refusals: Edit 2 times for calls a PreToolUse hook refused (the delegate may have retried and succeeded since), permission denials: Grep for the rest, such as a permissions.deny rule, which --dangerously-skip-permissions does not lift either. With no transcript to read, every entry reads as a permission denial.
Throughput. clauth records observed tokens/sec per model per profile and flags an account as degraded or recently rate-limited in profiles. Subscription throttling is per model and absent from the usage snapshot, so this is the only signal for it.
Watching delegates in Claude Code. On Linux and macOS the plugin's module shows the delegates the current conversation started, read from clauth's job files, in a band above the prompt and in a clauth delegates pane: beside the transcript in fullscreen from 110 columns, else above the prompt. A delegate call, blocking or background, opens no pane by itself: the band and /delegates do.
The band. While any delegate runs, the band reads ● [ 3 delegates ] ✻ D1 5m ✓ zcode 33m ✢ D4 35m: a gray dot that fades to half-dim and back every 2 s, the count, then a chip per delegate of the current batch, newest first, each with its mark, its account and its run time (a live run's time so far, a finished one's whole length). The current batch is every delegate since the last moment none was running. The mark cycles Claude Code's own spinner in its orange while the run goes, then reads a green ✓ once done, a dim ■ once stopped or cancelled, and a red ✗ for a run that died. Chips past the band's width give way to a dim +N. Once every delegate has finished, the band turns faint and counts every delegate of the conversation: ● [ 4 delegates ] done.
The pane's controls. The count opens the pane on the newest delegate, a chip on its own delegate: click them in fullscreen, or on the main screen press ctrl+x tab, then Enter. /delegates opens the pane too, at any width and on the main screen, and again after you close it; with no delegate yet the pane reads no delegates in this session yet, and the command answers delegates pane open, or delegates pane waits: <reason> when Claude Code has not placed the pane, or could not open the delegates pane when the open is refused. While the module holds a permission ask or a question for your phone, its row takes the band's place. While Claude Code's own survey row is up, the band gives way to it.
The list and the header. The pane lists every delegate of the conversation, newest first, each with its mark, account and run time, the chosen one marked ❯; a list taller than the pane scrolls. Beside the list, the chosen delegate's header gives the first line of its prompt (its account until the transcript names one), cut to fit, with [ stop ] at its right while the run goes, and under it, dim, <account> · <model> · <job id>, the model left out until its transcript names one.
The transcript. Under the header, the delegate's own transcript draws as Claude Code draws one: each tool call as ⏺ Bash(cargo test), its dot gray until the result returns, then green, or red for an error, with up to three dim result lines under ⎿ and … +N lines for the rest (a Read's result reads Read N lines); paths under the delegate's working directory relative to it, others under your home as ~/…. The delegate's messages sit in rounded cards with their markdown drawn, up to four rows each, a longer one cut with …. A prompt the delegate was given after its first reads > …; text a skill load or a compaction injected never shows as a prompt.
The status line. The pane's bottom row, under one blank row, is the status line: the mark and the state word, then, dim, the transcript's tool-call count and, while the run goes, how long ago it last wrote (✻ running · 21 tool calls · last output 3s ago). The state is running or blocking while the run goes (blocking for a delegate call that holds the conversation until it returns), then done, cancelled, stopped (its Claude Code session exited mid-run), orphaned (its clauth server died mid-run) or ended (its record went with no result left).
Scrolling. The wheel over the list scrolls the list; anywhere else in the pane it scrolls the transcript alone, while the header, the list and the status line stay put. With the pane's keyboard (a click on it, or ctrl+x tab), the page keys, Home and End move the transcript by the rows it shows. At its end the transcript follows new output; scrolled up, it holds still while output arrives, until you scroll back to the end. It reaches back through the last 512 KiB of the delegate's transcript file. Choosing a delegate puts its transcript at the end.
An empty transcript. A run with no transcript to read shows no transcript to show: one whose record names no session or working directory yet, a live isolated run (its transcript sits in a throwaway tree until the run ends and clauth lifts it into the global store; after a crash, until clauth's next stale-session cleanup), or a transcript file that cannot be read. A transcript with nothing to draw yet shows nothing in the transcript yet.
Stopping. [ stop ] cancels the run, the same as monitor with cancel: true; the delegate then reads cancelled. could not stop <job id> means clauth did not take the cancel.
Toasts. Each run that ends raises one toast: delegate <job id> on <account> <state> after <elapsed>. could not show a delegate in the pane means the pane opened but clauth could not put the chosen delegate in it.
Reopening after a dialog. A permission prompt or a question closes the pane; once the last one open is answered, at the desk or on your phone, the pane comes back on the delegate it showed: as an allowed tool starts running, otherwise once the call settles. Claude Code places a pane it reopens this way only from 144 columns wide (110 for one you have opened yourself before, until you close it by hand), so on a narrower terminal it waits closed until the terminal widens or you open it from the band or /delegates. Under any other Claude Code dialog that takes the keys (/model, a search) the pane stays open with an empty body. Close the pane from Claude Code's own frame around it.
How long a delegate stays listed. Finished delegates stay listed for the conversation. A /clear keeps the runs still going (their rows, [ stop ] and toast); a /resume drops the rows of the conversation you left and lists the resumed one's own delegates clauth still holds.
On connect it sends a short brief: a one-line index of the four tools, what switch_profile would do to this specific session, and a roster of your profiles as of session start, with disabled accounts left out (the active account and a shared clauth start session's own account stay listed, marked disabled when they are). profiles still lists them, marked disabled. A clauth start session gets one more note: each entry in its runtime directory mirrors the same-named entry under your real ~/.claude, so an edit there reaches the global file. On a symlink host it lands directly. On a host that copies the tree (no symlink privilege), clauth's background sync lands it at sync cadence. The session-aware switch note and the runtime-paths note ride switch_profile's and profiles({scope:"session"})'s replies too, so a client that never shows the connect brief still sees them.
The roster groups profiles that share a provider, tier and endpoint host onto one line, and leads with the account that has the most window left, counted over live windows only — a lapsed window counts no headroom, so the account ranks on its next live figure. An account whose usage-credit cap is spent sorts after the others on its line while its credit gate is on, unless it serves its own endpoint with its own key, and a line holding only such accounts comes last. Live usage numbers are deliberately left out of that snapshot, since they go stale immediately; only the ordering reflects them. profiles is the live read.
Everything specific to one tool rides that tool's own description rather than the brief: what a delegate costs, that it sees only its prompt, the depth cap. It loads when the tool does, and is never stated twice.
Start here
Reference
Headless
Help