carlos / platform Public

spec: CLI command registry (slice 4 project 1), approved

Design for the registry the carlos CLI will dispatch from: the walk takes
only command words, leaves get their arguments unchanged, flag
registration moves into each node, golden-corpus replay gates byte for
byte. Dispatcher audit and Astra rounds 1-3 (READY AFTER FIXES) beside it.
Approved by Paul 2026-11-09. Docs only.

Squashed from design-cli-registry into main.
claude agent, operated by paul@keymail.dev 7f4bdf3a3674f1794241aab961f9c9b2a585036a parent fd6d39e
6 files changed, +1,704 −0
  • docs/superpowers/notes/2026-11-09-cli-dispatch-audit.md +720 −0
  • docs/superpowers/specs/2026-11-09-cli-registry-design.md +713 −0
  • docs/superpowers/specs/CODEX-FINDINGS-cli-registry-R2.md +59 −0
  • docs/superpowers/specs/CODEX-FINDINGS-cli-registry-R3.md +40 −0
  • docs/superpowers/specs/CODEX-FINDINGS-cli-registry.md +65 −0
  • docs/superpowers/specs/CODEX-REVIEW-BRIEF-cli-registry.md +107 −0

CI passed — run details

diff --git a/docs/superpowers/notes/2026-11-09-cli-dispatch-audit.md b/docs/superpowers/notes/2026-11-09-cli-dispatch-audit.md
new file mode 100644
index 000000000..24e301039
--- /dev/null
+++ b/docs/superpowers/notes/2026-11-09-cli-dispatch-audit.md
@@ -0,0 +1,720 @@
+# CLI dispatch audit (2026-11-09, main fd68e4ee)
+
+Read-only audit of every carlos dispatcher, written for the CLI registry design
+(`docs/superpowers/specs/2026-11-09-cli-registry-design.md`). Part A covers top-level
+commands a-l, part B m-z plus the pre-switch words, the docsite scanner and the
+update hint. Line numbers are against fd68e4ee. Two Sonnet readers; rows marked
+lighter in each part were read from signatures and usage only.
+
+# Part A
+
+# carlos CLI dispatch audit A: top-level commands a-l (+ help)
+
+Repo: /home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-cli-registry
+Read-only audit. Line numbers are in this worktree (branch design-cli-registry, fd68e4ee).
+
+## 0. Global conventions (apply unless a row says otherwise)
+
+- Entry: main.go:25 `main()`. `len(os.Args) < 2` -> `usage(os.Stderr)`, exit 2 (main.go:38-41). `cmd, args := os.Args[1], os.Args[2:]` (main.go:42).
+- Hidden plumbing commands handled BEFORE the switch (main.go:43-67): `__demo-snapshot` (must have 0 args, else log.Fatal), `__registry-child`, `__rootfs-check-probe`, `__rootfs-check-prepare` (own flagsets in ship_check_probe.go:66,109, ContinueOnError). Not in a-l scope, but a generic dispatcher must not claim `__*`.
+- `switch cmd` (main.go:68-247): exact string match, no prefix match, no aliases except `help|-h|--help`. `default:` -> `usage(os.Stderr)`, exit 2 (main.go:243-245).
+- After a handler RETURNS normally, `maybeUpdateHint(cmd)` runs (main.go:249; update.go:116). Handlers that `return` early inside main.go's switch (channels sub-verbs) still reach it? NO: `channels resign|digests` do `return` from main() itself (main.go:149-164), skipping maybeUpdateHint. Same for `releases retention|authorize` (not in scope). `channels` bare falls through to the hint.
+- `flag.ExitOnError` (used by nearly every leaf): `-h/--help` prints usage (stderr unless SetOutput) and exits 0 (Go >= 1.15 semantics, go.mod says go 1.26.0); a bad/undefined flag prints error + usage and exits 2. Fatal validation errors use `log.Fatal*` = stderr with log timestamp prefix (no log.SetFlags in the main binary) via `newErrorWriter`, exit 1. Wherever a row says "usage->exit 1" this is log.Fatal(usage).
+- `flag.ContinueOnError` leaves return the error to a caller that maps it (rows say how).
+- Go `flag` accepts `-x` and `--x` identically. `-x=v` and `-x v` both work for non-bool flags. Standard parse stops at the first non-flag word (`std`), and `--` terminates flags.
+- Flag aliases registered by `aliasedString`/`appFlag`/`channelFlag`/`environmentFlag`/`versionFlag` (flags.go; internal/cliflag/cliflag.go:22): app=a, channel=c, destination=d, environment=e, version=v. `-a` etc. exist only on flagsets that used those registrars (`flagWasSet` flags.go:98 is alias-aware).
+- Common flag helper groups: `consoleOption(fs)` (flags.go:41) registers `--console` and `--destination/-d`; `-d` WRITES THE PACKAGE GLOBAL `destinationFlag` (flags.go destinationValue.Set) which `loadConfig` reads later (a flag with a global side effect, not just a local value). `accountFlags(fs)` (cli.go:2315) = `--account`, `--account-id`, `--registry`. `addMutationMessageFlags(fs)` (mutation_message.go:36) = `--message`, `--no-prompt`. Many leaves hand-register `--account`/`--account-id` without `--registry`.
+- "bare" below = no further args after the command words; "-h" = a first arg of `-h`.
+- Where a row says positionals are "ignored", the leaf never reads `fs.Args()`/`NArg()`, so trailing words are silently dropped (does not error).
+
+Abbreviations in the dispatch-style column: WS = word-switch, F-then-W = flags-then-word, leaf = leaf.
+
+## 1. Rows
+
+Format: `path | handler (file:line) | dispatch style | positionals | flag parsing | bare/unknown-word behaviour | notes`
+
+### help / usage (main.go)
+
+- `help`, `-h`, `--help` | inline main.go:70-73 -> usage(os.Stdout) (main.go:253) | leaf (3 aliases of one case) | extra args ignored (`carlos help foo` prints top usage) | none | prints usage on STDOUT, exit 0 (fallthrough to maybeUpdateHint) | the only exit-0 help at top; bare `carlos` is stderr/exit 2 (main.go:38).
+
+### add
+
+- `add` | runAdd (cli.go:268) | leaf | `<host>` exactly 1, free value (hostname) | std, ExitOnError (cli.go:269) | `NArg()!=1` -> log.Fatal("usage: carlos add [flags] <host>") exit 1; `-h` exit 0 | flags: --registry --app/-a --account --account-id --slug --kind(instance|service|static) --socket --addr --channel/-c --hibernate --status-named --backing --unit --db. Host must come AFTER flags (std parse); `add host --app x` leaves --app unparsed and NArg=3 -> usage. Value `--kind` is an enum but a flag value, not positional.
+
+### accounts (RunAccounts accounts.go:76)
+
+- `accounts` | RunAccounts | WS on args[0] | n/a | n/a | bare -> accountsUsage stderr exit 1; unknown word (incl. `-h`) -> same, exit 1 (accounts.go:77-80,89-92) | words: create, list, migrate, plan. No aliases, no default child.
+- `accounts create` | runAccountsCreate (accounts.go:96) | leaf | none (ignored) | std, ExitOnError | `--name` empty -> log.Fatal("usage: ...") exit 1 | flags --registry --name --owner --console/-d. Rest of file not read for further positional use; NArg not checked.
+- `accounts list` | runAccountsList (accounts.go:223) | leaf | none (ignored) | std, ExitOnError | -h exit 0 | flags --registry --console/-d. Uses `fs.Visit` to learn if --registry was explicit (mode choice: registry vs console).
+- `accounts migrate` | runAccountsMigrate (accounts.go:323) | leaf | none | std, ExitOnError | missing --app/--to -> log.Fatal(usage) exit 1 (accounts.go:333) | flags --app --to --from --dry-run (+ registry).
+- `accounts plan` | runAccountsPlan (accounts_plan.go:87) -> runAccountsPlanWithSession (accounts_plan.go:96) | leaf | none; `NArg()!=0` -> error "unexpected argument %q" | std, ContinueOnError, SetOutput(stdout) (accounts_plan.go:97-98) | ErrHelp -> return (exit 0, usage printed to STDOUT); other error -> log.Fatalf("accounts plan: %v") exit 1 | flags --account --set --pack (repeatable packFlags) --sponsored --reason --console/-d.
+
+### adopt (host.RunAdopt internal/host/agent.go:5617)
+
+- `adopt` | RunAdopt -> runAdopt (agent.go:5619) -> runAdoptWithEnsureSystemUnits (5627) -> runAdoptUnderRootRelease (5642); flagset at agent.go:5663 | leaf | none (ignored) | std, ExitOnError, `_ = fs.Parse(args)` (agent.go:5671) | -h exit 0 (after expensive startup work: reapStagingWrites, claim wiring happen BEFORE flags are parsed) | flags -registry -config-only -stage-only -restart-only (Bool). Several systemd units exec this with these flags; startup side effects precede flag parse (agent.go:5643-5662), so a generic parse-first dispatcher changes ordering for `adopt -h`/bad flag.
+
+### agent (host.RunAgent internal/host/agent.go:236)
+
+- `agent` | RunAgent (agent.go:236) -> runAgent (agent.go:264) -> edge.RunWithActivatorReady (edge.go:4602, agent.go:1188) | leaf | none (ignored) | PARENT PEEKS: `peekRegistryPath` (agent.go:1640) and `peekAcmeCache` (agent.go:3731) each run a throwaway ContinueOnError flagset (io.Discard) over the SAME args, then the edge's ExitOnError flagset does the authoritative parse (edge.go:4606-4614, `_ = fs.Parse`) | unknown flag ends the peek early; the edge parse then reports it and exits 2; -h from the edge flagset exit 0 | flags (edge's): -registry -acme-cache -https(:443) -http(:80) -fallback -dev. RunAgent does loadGroupConfiguration/IMDS work (agent.go:237-261) before any flag parse. Hard case (5).
+
+### analytics
+
+- `analytics` | runAnalytics (analytics_cmd.go:25) | leaf | none (ignored) | std, ExitOnError | -h exit 0; no --app and no default app -> resolvedApp usage | flags --app/-a --range(today|7d|30d) --set-count(edge|off) --set-door(on|off) --console/-d --account --account-id. Enums are FLAG VALUES.
+
+### apps (RunApps apps.go:151)
+
+- `apps` | RunApps | WS on args[0] | n/a | n/a | bare -> appsUsage stderr exit 1; unknown word (incl `-h`) -> same exit 1 (apps.go:152-155,179-182) | words: source create place region build-probe set show delete restore ttl keep list. No aliases.
+- `apps source` | runAppsSource (apps_source.go:26) | WS-ish: requires `args[0]=="pull"` else log.Fatal(sourcePullUsage) exit 1 (also when bare) | the word `pull` | n/a before pull | no `-h` special-case: `apps source -h` -> Fatal exit 1 | only child: pull.
+- `apps source pull` | runAppsSource continues inline, flagset "apps source pull" (apps_source.go:30) | leaf | none; `NArg()!=0 || app==""` -> Fatal(usage) | std on `args[1:]`, ExitOnError | | flags --app/-a --account --account-id --console/-d --output.
+- `apps create` | runAppsCreate (apps.go:514) | leaf | none (ignored) | std, ExitOnError | `--app` empty -> Fatal(usage) exit 1 | flags --app/-a --place (""|fleet/<name>) --control-plane --build-probe --region --analytics --no-analytics --account --account-id --console/-d.
+- `apps place` | runAppsPlace (apps.go:702) | leaf | none | std, ExitOnError | missing --app or --target (tri-state via fs.Visit) -> Fatal(placeUsage) exit 1 | `--target ""` is a legal value (clears).
+- `apps region` | runAppsRegion (apps_region_cmd.go:55) | leaf | none; `NArg()!=0` -> Fatal(usage) | std, ExitOnError | | flags --app/-a --set (presence via fs.Visit = write mode) --account --account-id --console/-d.
+- `apps build-probe` | runAppsBuildProbe (apps_buildprobe.go:42) | leaf | `<path|->` exactly 1 (`-` = clear sentinel, a free value that LOOKS like a flag prefix; std parse treats a lone `-` as a non-flag) | std, ExitOnError | NArg!=1 or no --app -> Fatal(buildProbeUsage) | positional must be AFTER flags.
+- `apps set` | runAppsSet (apps_swap.go:163) | leaf with leading positional | `<app>` : before the flags (leadingArg apps_swap.go:91), via --app/-a, OR after the flags (appsSetApp apps_swap.go:100); 2 different names -> error | std, ExitOnError; first arg lifted BY HAND if it does not start with "-" | no app -> Fatal(appsSetUsage); nothing to set -> Fatal(appsSetNothing); -h exit 0 | flags --app/-a --copies --message --no-prompt --swap(overlap|hold) --swap-concurrency --account --account-id --instance-control --default-updates --default-channel --default-major --egress-allow --size --interactive --console/-d. Hard case (2): first word may be a free value (app) OR a flag; never a sub-command word.
+- `apps show` | runAppsShow (apps_policy.go:312) | leaf with leading positional | `<app>` before flags (leadingArg) OR exactly 1 after flags | std after leadingArg | no app -> Fatal(appsShowUsage) exit 1 | flags --account --account-id --console/-d.
+- `apps delete` | runAppsDelete (apps.go:243) | leaf | `<app>` exactly 1, free, AFTER flags | std, ExitOnError | NArg!=1 -> Fatal usage exit 1 | accountFlags (+--registry), --console/-d. `apps delete app --account x` leaves --account unparsed -> NArg 3 -> usage.
+- `apps restore` | runAppsRestore (apps.go:390) | leaf | `<app>` exactly 1 after flags | std, ExitOnError | NArg!=1 -> Fatal usage | same flags as delete.
+- `apps ttl` | runAppsTTL (temporary.go:257) | leaf | `<ttl>` (1h to 30d, e.g. 5d; free value validated by parseTTL), exactly 1, BEFORE or AFTER flags | INTERSPERSED parseInterspersed (config_cli.go:182) on an ExitOnError flagset (appsLifecycleFlags temporary.go:247) | missing --app or len(pos)!=1 -> Fatal(usage) exit 1 | flags --app/-a --account --account-id --console/-d. `--` is eaten by fs.Parse, then following words continue to be parsed as FLAGS (quirk of parseInterspersed: it re-calls fs.Parse after each positional).
+- `apps keep` | runAppsKeep (temporary.go:286) | leaf | none (`len(pos)!=0` -> usage) | parseInterspersed | missing --app -> Fatal(usage) | shares appsLifecycleFlags.
+- `apps list` | runAppsList (temporary.go:304) | leaf | none (`len(pos)!=0` -> usage) | parseInterspersed | | shares appsLifecycleFlags (its --app unused).
+
+### assets (runAssets assets_cli.go:50)
+
+- `assets` | runAssets | WS on args[0] | n/a | n/a | bare or unknown (incl `-h`) -> log.Fatal(assetsUsage) exit 1 | words: purge, status.
+- `assets purge` | runAssetsPurge (assets_cli.go:79) | leaf | none (ignored) | std, ExitOnError | | --app/-a --account --account-id --console/-d.
+- `assets status` | runAssetsStatus (assets_cli.go:126) | leaf | none (ignored) | std, ExitOnError | | same flags.
+
+### auth (RunAuth auth.go:84)
+
+- `auth` | RunAuth | WS on args[0], then errors mapped centrally (auth.go:90-109) | n/a | n/a | bare or unknown word (incl `-h`) -> authUsage stderr exit 1. A leaf `error` return prints `carlos auth <args[0]>: <err>` to stderr (coloured), exit 1 | words: login, whoami, logout, default. Child functions get `os.Stdout` and return error; they never exit themselves.
+- `auth login` | authLogin (auth.go:802) | leaf | none (ignored) | std, ContinueOnError, SetOutput(out=stdout) | `-h`: Parse returns ErrHelp (usage on STDOUT) and RunAuth prints "carlos auth login: flag: help requested" exit 1 (NOT 0). Bad flag: Parse prints error+usage to stdout, then RunAuth also prints it, exit 1 (not 2) | flags --console/-d --label --no-wait --wait (--no-wait with --wait refused).
+- `auth whoami` | authWhoami (auth.go:903) | leaf | none | std, ContinueOnError, SetOutput(stdout) | same ErrHelp->exit 1 behaviour | --console/-d.
+- `auth logout` | authLogout (auth.go:958) | leaf | none | std, ContinueOnError | same | --console/-d.
+- `auth default` | authDefault (auth.go:1004) | leaf | `[<url>]` 0 or 1 (free value); `switch fs.NArg()` 0=show, 1=set, >1 -> error "usage: carlos auth default ..." | std, ContinueOnError. NB: the url must come AFTER flags | exit 1 on error | flags --project --destination/-d (destinationOption only, NOT --console). `-d` global side effect.
+
+### availability
+
+- `availability` | runAvailability (availability_cmd.go:28) | leaf | none (ignored) | std, ExitOnError | | --app/-a --since(24h) --until --host --release --fp --console/-d --account --account-id.
+
+### billing (runBilling billing_cli.go:35 -> runBillingWithSession billing_cli.go:44)
+
+- `billing` | runBillingWithSession | F-then-W-ish: builds the flagset `"billing "+verb` and registers `--console` BEFORE the switch, then `switch verb` registers verb-specific flags and parses `rest` (billing_cli.go:44-148) | the verb word (problems|close|house), taken from args[0] | std, ContinueOnError, SetOutput(stdout) | bare -> `errors.New(cliBillingCopyUsage)` -> log.Fatalf("billing: usage: ...") exit 1; unknown verb (incl `-h`) same exit 1; per-verb `-h` -> ErrHelp -> runBilling returns (exit 0, usage on stdout) | words: problems, close, house. Flag-parse errors surface as log.Fatalf exit 1 (not 2).
+- `billing problems` | billing_cli.go:54 (inline case) | leaf | none; NArg!=0 -> error | std | | --all (+ --console/-d).
+- `billing close` | billing_cli.go:83 | leaf | none | std | `-id`<=0 or empty `-note` -> error exit 1 | --id (int64) --note.
+- `billing house` | billing_cli.go:111 | leaf | none | std | needs exactly one of --on/--off, --account, --note | --account --on --off --note.
+
+### bootstrap (host.RunBootstrap internal/host/bootstrap.go:302)
+
+- `bootstrap` | RunBootstrap | leaf | none (ignored) | std, ExitOnError, `_ = fs.Parse` (bootstrap.go:302-310) | -h exit 0 | flags -root(/) -offcloud -plan-json (only with non-/ root) -socket-consumer (repeatable repeatableFlag).
+
+### canary (runCanary canary.go:78)
+
+- `canary` | runCanary | WS with a NON-ERROR DEFAULT: `switch args[0]` ls|list, rm|delete, deploy; ANYTHING else (incl no args, flags, or an artifact path) falls through to `runCanaryDeploy(args)` (canary.go:79-95) | | | | Hard cases (3)+(2): the first positional of the deploy form is a file path; a file literally named `ls`/`list`/`rm`/`delete`/`deploy` would be captured as a sub-verb. Aliases: ls=list, rm=delete.
+- `canary` / `canary deploy` | runCanaryDeploy (canary.go:493; flagset canary.go:494) | leaf | `<files-or-site-dir>...` 1+ (free paths); `NArg()==0` -> Fatal(canaryUsage) exit 1 (canary.go:514) | std, ExitOnError | `-h` exit 0 | flags --app/-a --name --account --account-id --registry --console/-d --kind(binary|static) --region --environment/-e --scope --version/-v --target --label --timeout. Paths must follow flags.
+- `canary ls|list` | runCanaryList (canary.go:673) | leaf | none (ignored) | std, ExitOnError | | --app/-a --account --account-id --registry --console/-d. Flagset name "canary ls" for both spellings.
+- `canary rm|delete` | runCanaryRemove (canary.go:743) | leaf | none | std, ExitOnError | empty --name -> Fatal | --app/-a --name --account --account-id --registry --console/-d.
+
+### channels (main.go:149-165 + cli.go:3113 + channels_digests.go)
+
+- `channels` | main.go:149-165 inline word peek, then runChannels (cli.go:3113) | WS in main.go on args[0]: `resign`, `digests`; otherwise the bare form runChannels(args) | n/a | n/a | any other first word (incl. `-h` or an app name) goes to runChannels where std flag parse stops at the word and it is ignored | words: resign, digests. Hard case (3): unknown word is NOT a usage error; trailing words are dropped. `channels resign|digests` `return` from main() directly (skips maybeUpdateHint).
+- `channels` (list) | runChannels (cli.go:3113) | leaf | none (ignored) | std, ExitOnError | -h exit 0 | accountFlags(--account --account-id --registry) --app/-a --console/-d. Works in API and direct-bucket mode.
+- `channels resign` | runChannelsResign (channels_digests.go:60) | leaf | `[<app>] <channel>`: 1 positional = channel; 2 positionals AND `--app` empty -> first is the APP, second the channel (channels_digests.go:69-72); else usage | std, ExitOnError; positionals AFTER flags | len(pos)!=1 -> Fatal(usage) | flags --app/-a --account(s) --account-id --registry --yes --console/-d. Hard case (2): positional arity changes meaning depending on whether --app was given.
+- `channels digests` | runChannelsDigests (channels_digests.go:149) | F-then-W: peels a leading `on`|`off` word from args BEFORE flags (channels_digests.go:160-162); no word = show | `[on|off]` enum, must be FIRST (before flags); `NArg()!=0` after flag parse -> Fatal(usage) | std, ExitOnError | | flags --account-id (repeatable multiFlag) --console/-d. Hard case (1)/(2): the word is positioned BEFORE flags only; `digests --account-id x on` leaves `on` as a positional -> usage error.
+
+### config (RunConfig config_cli.go:52)
+
+- `config` | RunConfig | WS | n/a | n/a | bare or unknown (incl `-h`) -> configUsage stderr exit 1 (config_cli.go:53-55,60-63) | word: destinations only. Error mapping after the call (config_cli.go:65-73): ErrHelp -> return (exit 0); flagParseError -> exit 2; other error -> "carlos config <args[0]>: <err>" stderr exit 1.
+- `config destinations` | configDestinations (config_cli.go:79) | WS with DEFAULT CHILD and a flag-peek: `verb := "list"`; if args[0] exists and does not start with "-", it is the verb (config_cli.go:80-83) | the verb | n/a | no verb or a flag first = list. Unknown verb -> error "no verb %q\n<destinationsUsage>" -> RunConfig prints it, exit 1. `help` -> destinationsUsage to stdout, exit 0 | words: list|ls, add, set, default, remove|rm, rename, help. Hard cases (3)+(4-ish): default child; aliases ls/rm.
+- `config destinations list|ls` | destinationsList (config_cli.go:344) | leaf | none (`len(pos)!=0` -> error "usage: ...") | INTERSPERSED parseInterspersed (config_cli.go:182), ContinueOnError via destinationsFlagSet (config_cli.go:203-208), output = stdout | -h -> ErrHelp -> RunConfig returns (exit 0) | flags --global.
+- `config destinations add` | destinationsAdd (config_cli.go:398) | leaf | `<name>` exactly 1 (free, validDestinationName) before or after flags | parseInterspersed | len(pos)!=1 -> error exit 1 | flags --global --console --account --app/-a --kind(binary|static) --artifact --target --default --from-current.
+- `config destinations set` | destinationsSet (config_cli.go:517) | leaf | `<name>` exactly 1 | parseInterspersed | | flags --global + destinationKeyFlags (console, account, app/-a, kind, artifact, target); `--key ""` removes a key.
+- `config destinations default` | destinationsDefault (config_cli.go:561) | leaf | `[<name>]` 0 (show) or 1 (set); more -> usage error | parseInterspersed | | --global.
+- `config destinations remove|rm` | destinationsRemove (config_cli.go:605) | leaf | `<name>` exactly 1 | parseInterspersed | | --global.
+- `config destinations rename` | destinationsRename (config_cli.go:653) | leaf | `<old> <new>` exactly 2 | parseInterspersed | | --global.
+ Note for all config destinations leaves: ContinueOnError + bad flag => flagParseError => exit 2 (usage already printed); other errors exit 1. `--` quirk of parseInterspersed applies (words after `--` are still flag-parsed).
+
+### console
+
+- `console` | runConsole (interactive_cli.go:613) -> parseConsoleArgs (interactive_cli.go:589) | leaf | none: `NArg()>0` or a literal `--` anywhere in args -> error consoleNoCommandMsg | std, ContinueOnError, SetOutput(stderr) | ErrHelp -> exit 0; no --instance -> errRunUsage -> consoleUsage to stderr exit 2; any other parse error: message + usage, exit 2 | flags --app/-a --instance (required) --account --account-id --registry --console/-d. Uses `slices.Contains(args,"--")` to forbid `--` (interactive-run counterpart `run` allows `-- cmd`).
+
+### db (runDB db.go:58)
+
+- `db` | runDB | WS | n/a | n/a | bare -> dbUsage stderr exit 2; `-h|--help|help` -> dbUsage to stdout, exit 0; unknown -> "carlos db: unknown verb %q\n<usage>" stderr exit 2 (db.go:59-72) | words: pull, query, -h, --help, help. One of few dispatchers with exit 2 and help-words.
+- `db pull` | runDBPull (db.go:258) | leaf | none (ignored) | std, ExitOnError | `--out` blank -> stderr + exit 2 (db.go:264-267); out exists -> exit 2 | flags --out + dbFlags (db.go:~108): --app/-a --instance --account --account-id --registry? (accountFlags) --console/-d --at.
+- `db query` | runDBQuery (db.go:371) | leaf | none | std, ExitOnError | `--sql` blank -> exit 2 | flags --sql + dbFlags.
+
+### deploy
+
+- `deploy` | runDeploy (deploy.go:133) | leaf | `<files-or-site-dir>...` 0+ (free paths). ZERO positionals = distinct mode (saved-defaults / first-run wizard, deploy.go:278) | std, ExitOnError | -h exit 0; usage->exit 1 when no app resolvable (deploy.go:266) | flags --app/-a --account --account-id --registry --console/-d --kind(binary|static) --version/-v --target --capabilities --channel/-c --host --timeout --label --notes --temporary --ttl --region --swap --assets (repeatable assetPathsFlag) --env (repeatable deployEnvFlag) --no-assets. Paths come after flags. Arity-dependent behaviour (0 vs 1+) must survive.
+
+### devbox (runDevbox devbox_cli.go:245)
+
+- `devbox` | runDevbox | WS in two stages: (a) `args[0]=="serve"` peeled in runDevbox (devbox_cli.go:246-251); (b) everything else to `devboxCLI.run` (devbox_cli.go:291) | n/a | n/a | run(): bare -> usage stderr, returns 2; `help|-h|--help` -> usage stdout, 0; unknown -> `devboxUnknownCommand` (devbox_cli.go:164) stderr, returns 2. Exit code mapping at devbox_cli.go:310-328: nil/ErrHelp -> 0; errDevboxUsage or flagParseError -> 2; devboxRefusal -> prints lines, 1; other error -> 1 | words: share, unshare, list, help/-h/--help, serve (hidden-from-usage, handled first).
+- `devbox serve` | runDevboxServe (devbox_cli.go:714) | leaf | none; `NArg()>0` -> error | std, ContinueOnError, usage via flagUsage | ErrHelp swallowed in runDevbox -> exit 0; other errors log.Fatal exit 1 | flag --env-file. Note it is NOT in `usage()`; the name is matched only in runDevbox.
+- `devbox share` | (*devboxCLI).share (devbox_cli.go:364) | leaf | `[<name>]` 0 or 1 (free); >1 -> usage printed + errDevboxUsage (exit 2) | INTERSPERSED parseInterspersed (devbox_cli.go:370), ContinueOnError, output stderr (flagSet devbox_cli.go:337) | | flags --port --dir --socket --allow; exactly ONE of port/dir/socket required (flagGiven). Without a name, the name comes from the git branch.
+- `devbox unshare` | unshare (devbox_cli.go:507) | leaf | `[<name>]` 0 or 1 | parseInterspersed | >1 -> exit 2 | none beyond -h.
+- `devbox list` | list (devbox_cli.go:532) | leaf | none (`len(pos)>0` -> usage exit 2) | parseInterspersed | | flag --allowed.
+
+### domains (runDomains domains_cli.go:95)
+
+- `domains` | runDomains | WS | n/a | n/a | bare or unknown (incl `-h`) -> log.Fatal(domainsUsage) exit 1 | words: check, buy, attach, verify, detach, list, paths, placements.
+- `domains check` | runDomainsCheck (domains_buy_cli.go:24) -> runDomainBuyVerb(args,false) (domains_buy_cli.go:27) | leaf | `<domain>` exactly 1 (free; before or after flags) | INTERSPERSED parseInterspersed (domains_buy_cli.go:47) on ExitOnError set | len(pos)!=1 -> Fatal(domainsCheckUsage) exit 1 | flags --account --account-id --console/-d --country (2 letters). A shared handler; flagset name "domains check".
+- `domains buy` | runDomainsBuy (domains_buy_cli.go:25) -> runDomainBuyVerb(args,true) | leaf | `<domain>` exactly 1; `--app` required | parseInterspersed | | flags --account --account-id --console/-d --app/--(StringVar "app" only, NO -a alias) --contact-file --yes --no-wait. Note: buy's `--app` is a plain fs.StringVar, not appFlag; no `-a`.
+- `domains attach` | runDomainsAttach (domains_cli.go:127) | leaf | `<hostname>` exactly 1 AFTER flags | std, ExitOnError | Fatal(domainsAttachUsage) exit 1 | flags --app/-a --route --wildcard --catchall --platform --account --account-id --console/-d.
+- `domains verify` | runDomainsVerify (domains_cli.go:265) | leaf | `<hostname>` exactly 1 AFTER flags | std | | --app/-a --channel/-c --account --account-id --console/-d.
+- `domains detach` | runDomainsDetach (domains_cli.go:318) | leaf | `<hostname>` 1 AFTER flags | std | |
+- `domains list` | runDomainsList (domains_cli.go:345) | leaf | none (ignored) | std | |
+- `domains paths` | runDomainsPaths (domains_cli.go:443) | leaf | `<hostname>` 1 AFTER flags | std | |
+- `domains placements` | runDomainsPlacements (domains_cli.go:489) | leaf | `<hostname>` 1 AFTER flags | std | | --set <region>=<instance> (repeatable) --wildcard --catchall.
+ attach/verify/detach/paths/placements all do `host := fs.Arg(0)`; `host=="" || NArg()>1` -> Fatal(usage). Non-bool flags after the hostname are NOT parsed (they count as extra positionals -> usage).
+
+### economics (runEconomics economics.go:117)
+
+- `economics` | runEconomics | WS | n/a | n/a | bare or unknown (incl `-h`) -> economicsUsage stderr, exit 2 (economics.go:118-134) | words: bill, backhaul. Comment at economics.go:107-116 states exit 2 for dispatch errors vs exit 1 for leaf validation (deliberate, must be kept).
+- `economics bill` | runEconomicsBill (economics.go:275) | leaf | none | std, ExitOnError | missing --month or --total (presence via fs.Visit) -> log.Fatal(economicsUsage) exit 1 | flags --month(YYYY-MM) --total(float) --line (repeatable serviceLines Service=usd) --console/-d.
+- `economics backhaul` | runEconomicsBackhaul (economics.go:190) | leaf | none | std, ExitOnError | | --period(mtd|last|7d) --console/-d.
+
+### edge (edge.Run internal/edge/edge.go:4579)
+
+- `edge` | Run -> RunWithActivator -> RunWithActivatorReady (edge.go:4602) | leaf | none (ignored) | std, ExitOnError, `_ = fs.Parse` (edge.go:4606-4614) | -h exit 0 | flags -registry -acme-cache -https -http -fallback -dev. Shared with `agent` (see its row).
+
+### email (runEmail mail_cli.go:145)
+
+- `email` | runEmail | WS | n/a | n/a | bare or unknown (incl `-h`) -> emailUsage stderr, exit 1 (mail_cli.go:146-149,164-167) | words: enable, domains, status, events, test, credentials, rotate, pause, resume. pause/resume share ONE handler `runEmailPause(args, paused bool)`.
+- `email enable` | runEmailEnable (mail_cli.go:679) | leaf | none (ignored) | std, ExitOnError | | flags --app/-a --env-prefix --from --domain --timeout --account --account-id --registry(accountFlags) --console/-d.
+- `email domains` | runEmailDomains (mail_cli.go:787) | WS | n/a | n/a | bare/unknown -> emailUsage stderr exit 1 | words: add, rm|remove (alias).
+- `email domains add` | runEmailDomainsAdd (mail_cli.go:807) | leaf | `<domain>` exactly 1 AFTER flags | std | NArg!=1 -> Fatal(usage) | flags --app/-a --timeout --account --account-id --registry --console/-d.
+- `email domains rm|remove` | runEmailDomainsRemove (mail_cli.go:880), flagset "email domains rm" | leaf | `<domain>` 1 AFTER flags | std | | --app/-a --account --account-id --registry --console (plain, NO destination -d).
+- `email status` | runEmailStatus (mail_cli.go:974) | leaf | none (ignored) | std | |
+- `email events` | runEmailEvents (mail_cli.go:1060) | WS on args[0]=="push" else leaf | `push` word | n/a then std | not an error path: any other first word is simply parsed by flag (std stops, word ignored) | Hard case (3). Leaf flags --app/-a --account --account-id --registry --since --message --to -n --json --console/-d.
+- `email events push` | runEmailEventsPush (mail_cli.go:1175) | leaf | none | std, ExitOnError | --path and --off mutually exclusive | flags --app/-a --account --account-id --registry --path --off --json --console/-d.
+- `email test` | runEmailTest (mail_cli.go:1465) | leaf | none | std | `--to` lacking "@" -> Fatal(usage) | --app/-a --to + account/console.
+- `email credentials` | runEmailCredentials (mail_cli.go:1679) | WS | n/a | n/a | bare/unknown -> emailUsage stderr exit 1 | words: create, list, revoke.
+- `email credentials create` | runEmailCredentialsCreate (mail_cli.go:1697) | leaf | none | std | empty --name -> Fatal(usage) | --app/-a --name + account/console.
+- `email credentials list` | runEmailCredentialsList (mail_cli.go:1743) | leaf | none | std | |
+- `email credentials revoke` | runEmailCredentialsRevoke (mail_cli.go:1785) | leaf | none | std | empty --name -> Fatal(usage) |
+- `email rotate` | runEmailRotate (mail_cli.go:1819) | leaf | none | std | | --app/-a --finish + account/console.
+- `email pause` / `email resume` | runEmailPause(args, true|false) (mail_cli.go:1862); flagset "email pause"/"email resume" | leaf | none | std | | --app/-a + account/console. Two words, one handler with a bool.
+
+### env (RunEnv appconfig_cli.go:306)
+
+- `env` | RunEnv | WS | n/a | n/a | bare or unknown (incl `-h`) -> envUsage stderr exit 1 (appconfig_cli.go:307-310,331-334) | words: set, unset, list, environments, exec-delivery, sync, adopt, release, fork.
+- `env set` | runEnvSet (appconfig_cli.go:440) | leaf | `KEY=value ...` 1+ (free `k=v` words, parseKV) AFTER flags | std, ExitOnError | none -> usage exit 1 | flags --message --no-prompt, --app/-a, --environment/-e, accountFlagsWithRegistry (--account --account-id --registry), --console/-d.
+- `env unset` | runEnvUnset (appconfig_cli.go:506) | leaf | `KEY ...` 1+ | std | NArg==0 -> usage | same flags.
+- `env list` | runEnvList (appconfig_cli.go:560) | leaf | none | std | |
+- `env environments` | runEnvEnvironments (appconfig_cli.go:768) | leaf | none | std | |
+- `env exec-delivery` | runEnvExecDelivery (appconfig_cli.go:663) | leaf | ONE enum word: `file`|`off` when --environment is empty; `file`|`inherit` when --environment is set. `off` with --environment is a dedicated Fatal (appconfig_cli.go:691-696) | std, ExitOnError | NArg!=1 -> usage exit 1 | Hard case: the ALLOWED SET of the positional enum depends on a flag's value (--environment), so positional validation must run after flag parse.
+- `env sync` | runEnvSync (appconfig_cli.go:822) | leaf | none | std | |
+- `env adopt` | runEnvAdopt (appconfig_cli.go:1374) | leaf | none | std | missing --environment/--scope -> usage | flags --app --environment --scope --console.
+- `env release` | runEnvRelease (appconfig_cli.go:1404) | leaf | none | std | | --app --environment --console.
+- `env fork` | runEnvFork (appconfig_cli.go:1431) | leaf | none | std | | --app --from --to --scope --console.
+
+### errors
+
+- `errors` | runErrors (errors_cmd.go:28) | leaf | none (ignored) | std, ExitOnError | | flags --app/-a --since(24h) --until --source(log|edge|server|browser) --level(error|warn) --host --release --fp --set-level(error|warn) --console/-d --account --account-id. `--set-level` switches read->write mode.
+
+### explain
+
+- `explain` | runExplain (explain_cmd.go:47) | leaf with leading positional | `<code>` exactly 1 (free) before OR after flags | std after `ipLast(args)` (geo_cmd.go:95): if args[0] exists and does not start with "-" it is moved to the end | NArg!=1 -> fs.Usage() + os.Exit(2) (not log.Fatal); 404 -> stderr message + exit 1 | flags --app/-a --json --console/-d --account --account-id. Hard case (2): hand-rewritten argument order.
+
+### features (runFeatures features_cli.go:46)
+
+- `features` | runFeatures | WS | n/a | n/a | bare/unknown (incl `-h`) -> log.Fatal(featuresUsage) exit 1 | words: set, list.
+- `features set` | runFeaturesSet (features_cli.go:94) | leaf | `key=value ...` 1+ (free; `key=` clears) AFTER flags | std, ExitOnError | none -> Fatal exit 1 | flags --app/-a --message --no-prompt --console/-d --account --account-id.
+- `features list` | runFeaturesList (features_cli.go:129) | leaf | none (ignored) | std | |
+
+### fleets (RunFleets fleets.go:131)
+
+- `fleets` | RunFleets | WS (+ one nested inline check) | n/a | n/a | bare/unknown (incl `-h`) -> fleetsUsage stderr exit 1 (fleets.go:132-135,162-165) | words: create, boxes, add-box, rotate-token, tag-box, drain, detach-box, secrets-key, show, ls.
+- `fleets boxes add` | inline check fleets.go:141-146 then runFleetsManagedAdd (fleets_managed.go:86) | two-word WS: `boxes` requires `args[1]=="add"` else log.Fatal("usage: carlos fleets boxes add ...") exit 1 (also for bare `fleets boxes`) | `<fleet>` exactly 1 AFTER flags | std, ExitOnError (fleets_managed.go:87) | `NArg!=1 || boxes<=0` -> Fatal | flag --boxes (int) + account/console.
+- `fleets create` | runFleetsCreate (fleets.go:205) | leaf | `<name>` exactly 1 | std | Fatal(usage) if NArg!=1 or (not --managed and no --bucket) | flags --managed --region --size --boxes --bucket --account --account-id --console/-d.
+- `fleets add-box` | runFleetsAddBox (fleets.go:251) | leaf | `<fleet> <label>` exactly 2 | std | |
+- `fleets rotate-token` | runFleetsRotateToken (fleets.go:280) | leaf | `<fleet> <label>` exactly 2 | std | |
+- `fleets tag-box` | runFleetsTagBox (fleets.go:344) | leaf | `<fleet> <label>` exactly 2 | std | requires --tags |
+- `fleets drain` | runFleetsDrain (fleets.go:395) | leaf | `<fleet> <label>` exactly 2 | std | |
+- `fleets detach-box` | runFleetsDetachBox (fleets.go:424) | leaf | `<fleet> <label>` exactly 2 | std | | flag --terminated.
+- `fleets secrets-key` | runFleetsSecretsKey (fleets.go:568) | leaf | `<fleet> [<pubkey>]` 1 or 2; with --file only 1 | std | Fatal(keyUsage) | flags --account --file.
+- `fleets show` | runFleetsShow (fleets_managed.go:17) | leaf | `<fleet>` exactly 1 | std | NArg!=1 -> fs.Usage() then log.Fatal("fleets show: provide one fleet name") |
+- `fleets ls` | runFleetsList (fleets.go:457) | leaf | none (ignored) | std | |
+ All fleets leaves: flagset name "fleets <verb>", ExitOnError, mostly `--account --account-id --console/-d` hand-registered; positionals must follow flags.
+
+### gate (runGate gate_cli.go:39)
+
+- `gate` | runGate | WS | n/a | n/a | bare/unknown (incl `-h`) -> log.Fatal(gateUsage) exit 1 | words: set, clear, list.
+- `gate set` | runGateSet (gate_cli.go:117) | leaf (shared gateFlags gate_cli.go:107) | none (ignored) | std, ExitOnError | empty -password given -> Fatal; password also readable from stdin | flags --app/-a --host --console/-d --account --account-id --password (presence via fs.Visit).
+- `gate clear` | runGateClear (gate_cli.go:181) | leaf | none | std | | gateFlags.
+- `gate list` | runGateList (gate_cli.go:194) | leaf | none | std | | gateFlags (--host accepted, unused).
+
+### geo
+
+- `geo` | runGeo (geo_cmd.go:35) | leaf with leading positional | `<ip>` exactly 1 (free) before or after flags | std after `ipLast(args)` | NArg!=1 -> fs.Usage() + os.Exit(2) | flags --app/-a --json --console/-d --account --account-id.
+
+### instance-* (internal/host, internal/instanceexec) -- systemd-exec'd, not human verbs
+
+- `instance-control` | host.RunInstanceControl (internal/host/claimstop_run.go:24) | F-then-W-ish (exact single-arg matches): `len(args)==1 && args[0]==` `--group-hairpin-verify-identity` | `--group-hairpin-install` | `--group-hairpin-reset` handled BEFORE any flag parse (claimstop_run.go:25-49); everything else -> instancectl.runWithClaim (internal/instancectl/server.go:294) | none | std, ExitOnError flagset "instance-control" with ZERO flags (server.go:295-297, `_ = fs.Parse`): any flag other than -h errors exit 2; non-flag words ignored | -h exit 0 | the three `--group-hairpin-*` are WORDS in flag clothing: exact-match, only when they are the sole arg; they must NOT be given to a flag parser.
+- `instance-exec` | instanceexec.RunExec (internal/instanceexec/exec.go:44) via parseExecArgs (exec.go:96) | leaf | `<role> <instance-id>` exactly 2; role enum from instancectl.ParseRole (names.go:52): run, gvisor-run, seed, sidecar, cmd, worker, tty (error text lists only run/seed/sidecar/cmd; `worker` needs --rootfs; ParseRole accepts `gvisor-run` too) | std, ExitOnError, `_ = fs.Parse` (exec.go:96-104) | NArg!=2 -> fs.Usage(), errUsage -> os.Exit(2); bad role -> log.Fatal exit 1 | flags --claim-reservation --rootfs --sandbox. Positionals AFTER flags. Enum positional.
+- `instance-exit` | instanceexec.RunExit (exit.go:33) via parseExitArgs (exit.go:63) | leaf | `<role> <instance-id>` exactly 2, same enum as instance-exec | std, ExitOnError | usage -> exit 2; other parse error: log.Print and RETURN (exit 0, "never fails the unit") | flags --run-dir --rootfs --sandbox.
+- `instance-stop` | instanceexec.RunStop (stop_linux.go:34) -> stopMain (stop_linux.go:47) | leaf, NO flag parsing | `[<main-pid>]` 0 or 1 (int); empty/0 args -> exit 0; >1 or non-integer -> stderr usage exit 2 | none (hand-checks len(args)) | non-linux build: prints "instance-stop: linux only", exit 2 (stop_other.go:11) | `-h` is NOT a flag here: "-h" is not an int -> usage, exit 2.
+- `instance-probe` | instanceexec.RunProbe (probe.go:116) | leaf | none (ignored) | std, ExitOnError, `_ = fs.Parse` | -h exit 0; always exits 0 otherwise (verdict is in stdout JSON) | flags --rootfs --sandbox.
+
+### instances (runInstances cli.go:574)
+
+- `instances` | runInstances | WS WITH A NON-ERROR DEFAULT: if args[0] is one of the words below -> that handler; ANY other first word (or none) falls to the bare LISTING flow, which std-parses flags and silently ignores non-flag words (cli.go:575-626) | | | `instances` bare = list THIS box's registry routes. `instances foo` = list (foo ignored, exit 0). `instances -h` -> listing's flagset -> usage exit 0. | words: enable, create, import, list, delete, door-key, set, update, set-upstreams, set-channel, set-environment, set-assets, set-pages, retry. Hard cases (3). NB `list` here (API records) is a DIFFERENT code path from the bare form (registry routes).
+- `instances` (bare list) | runInstances inline, flagset cli.go:626 | leaf | none (ignored) | std, ExitOnError | | flag --registry only. Prints HOST/APP/KIND/... table from the local registry.
+- `instances enable` | runInstancesEnable (instances_cli.go:63) | leaf | none | std, ExitOnError | missing --app or --domain -> Fatal(instancesEnableUsage) | flags --app/-a --domain --pool --channel/-c --regions --seed --private-storage + accountFlags + --console/-d.
+- `instances create` | runInstancesCreate (instances_cli.go:311) | leaf | none | std | missing --host -> Fatal(instancesRecordsUsage) | flags --message --no-prompt --app/-a --host --region --channel/-c --kind(instance|service|static) --environment/-e --scope --addr --health-path --health-status --account --account-id --console/-d --role --from --at --replicas --restore.
+- `instances import` | runInstancesImport (instances_import.go:116) | F-then-W-ish WS: `args[0]` is `commit`|`abort` -> runInstancesImportVerb(verb, args[1:]) (instances_import.go:117-120); else the import itself | `commit`/`abort` word first | leaf std, ExitOnError | missing --host/--file/--replaces -> fs.Usage() + exit 2 | flags --message --no-prompt --app/-a --host --file --replaces --environment/-e --verify --console/-d --account --account-id. Hard case (2)-ish: first word selects different code, otherwise flags.
+- `instances import commit|abort` | runInstancesImportVerb (instances_import.go:394), flagset "instances import <verb>" | leaf | none | std | missing --host -> usage, exit 2 | --app/-a --host --console/-d --account --account-id.
+- `instances list` | runInstancesList (instances_cli.go:758) | leaf | none | std | | --app/-a --match --health --console/-d --account --account-id.
+- `instances delete` | runInstancesDelete (instances_cli.go:796) | leaf | none | std | missing --host -> Fatal(usage) | --message --no-prompt --app/-a --host ...
+- `instances door-key` | runInstancesDoorKey (doorkeys_cli.go:127) | WS | n/a | n/a | bare/unknown -> log.Fatal(doorKeyUsage) exit 1 | words: create, list, revoke.
+- `instances door-key create` | runInstancesDoorKeyCreate (doorkeys_cli.go:144) | leaf | none | std | | --app/-a --label --console/-d --account --account-id.
+- `instances door-key list` | runInstancesDoorKeyList (doorkeys_cli.go:174) | leaf | none | std | |
+- `instances door-key revoke` | runInstancesDoorKeyRevoke (doorkeys_cli.go:213) | leaf | `<key-id>` exactly 1 (free) AFTER flags | std | empty or >1 -> Fatal(doorKeyUsage) |
+- `instances set` | runInstancesSet (instances_updates.go:96) | leaf with leading positional | `<host>`: BEFORE flags (leadingArg apps_swap.go:91, taken only if args[0] does not begin with "-") OR exactly 1 after flags | std after leadingArg | usage->exit 1 | flags --app/-a --updates --channel/-c --major --pin --size --console/-d --account --account-id. Host is lowercased.
+- `instances update` | runInstancesUpdate (instances_updates.go:216) | leaf with leading positional | `<host>` same as set | std after leadingArg | | flags --app/-a --fast-track + console/account.
+- `instances set-upstreams` | runInstancesSetUpstreams (instances_cli.go:839) | leaf | none (host is `--host`) | std | missing --host -> Fatal | --app/-a --host --addrs --health-path --health-status.
+- `instances set-channel` | runInstancesSetChannel (instances_cli.go:991) | leaf | none | std | needs --host and --channel | --app/-a --host --channel/-c.
+- `instances set-environment` | runInstancesSetEnvironment (instances_cli.go:1117) | leaf | none | std | needs --host and --environment (presence via flagWasSet; empty value legal = clear) | --app/-a --host --environment/-e --scope.
+- `instances set-assets` | runInstancesSetAssets (instances_assets.go:18) | leaf | `<host> <on|off>` exactly 2; second is a FIXED ENUM (on|off); both before or after flags | MANUAL interspersed loop (instances_assets.go:~27-37): fs.Parse(rest); take rest[0]; repeat | wrong count/enum -> Fatal(instancesSetAssetsUsage) exit 1 | flags --message --no-prompt --app/-a --console/-d --account --account-id. Not parseInterspersed itself, but identical logic (hand-copied); `--` quirk same.
+- `instances set-pages` | runInstancesSetPages (instances_pages.go:18) | leaf | `<host> <on|off>` (enum) | MANUAL interspersed loop (same copy) | Fatal(instancesSetPagesUsage) | same flags.
+- `instances retry` | runInstancesRetry (instances_cli.go:1212) | leaf with leading positional | `<host>` before flags (leadingArg) or exactly 1 after | std | | --message --no-prompt --app/-a + console/account.
+
+### ledger (RunLedger cli.go:3514)
+
+- `ledger` | RunLedger | WS | n/a | n/a | bare/unknown (incl `-h`) -> ledgerUsage stderr exit 1 | words: append, head, list, publish, blob, verify.
+- `ledger append` | runLedgerAppend (cli.go:3578) | leaf | `<ledger> <entry.json|->` exactly 2 (free; `-` = stdin) AFTER flags | std, ExitOnError | NArg!=2 -> Fatal(usage) | flags --app/-a --account --account-id --console/-d (ledgerAccountFlags: no --registry).
+- `ledger head` | runLedgerHead (cli.go:3626) | leaf | `<ledger>` exactly 1 | std | |
+- `ledger list` | runLedgerList (cli.go:3656) | leaf | none (ignored) | std | |
+- `ledger publish` | runLedgerPublish (cli.go:3705) | leaf | `<ledger>...` 1+ | std | NArg==0 -> Fatal | + --public(bool) --title.
+- `ledger blob` | runLedgerBlob (cli.go:3751) | leaf | `<ledger> <file>...` 2+ | std | NArg<2 -> Fatal |
+- `ledger verify` | runLedgerVerify (cli.go:3796) | leaf | `<ledger>` exactly 1 | std | needs --app --account(sqid) --url | no console used.
+
+### logs
+
+- `logs` | runLogs (logs.go:38) | leaf | none (ignored) | std, ExitOnError | | flags --app/-a --since(1h) --until --stream(app|platform|edge|release) --host --level --grep --field (repeatable) -n -f (single-letter primaries, no alias) --console/-d --account --account-id. `-f` and `-n` are claimed short primaries (cliflag.go:19-21).
+
+## 2. Hard cases
+
+### (1) A word that selects different code comes AFTER flags (or is peeled before flags in an order-sensitive way)
+- `channels digests [on|off]`: the on/off word only counts when FIRST (channels_digests.go:160-162 peels args[0] before fs.Parse). `digests --account-id x on` => `on` becomes a stray positional => usage Fatal at channels_digests.go:164. Dispatched from main.go:149-164.
+- `canary deploy` is the default: a flag or path first goes to deploy (canary.go:91-94). Sub-verb words only recognised as args[0].
+- `env exec-delivery file|off|inherit`: the positional word follows flags AND its legal set depends on --environment (appconfig_cli.go:684-702).
+- `instances set-assets|set-pages <host> on|off`: positional enum word may appear before or after flags via a hand loop (instances_assets.go:~27-38, instances_pages.go:~27-38).
+- `billing <verb>`: verb word is args[0], but `--console` is registered before the verb switch (billing_cli.go:50-52); per-verb flags are registered in the case.
+- `instance-control`: `--group-hairpin-*` are exact-match words in flag form, checked before parsing (claimstop_run.go:25-49).
+- `instance-exec/instance-exit <role> <iid>`: enum role word is positional AFTER flags (exec.go:96-111, exit.go:63-80).
+
+### (2) One position can hold either a sub-command word or a free value (or positional arity changes meaning)
+- `canary [ls|list|rm|delete|deploy] | <artifact-path>...` (canary.go:79-95): first position is a verb OR a file path.
+- `instances [enable|create|...|retry] | (flags only)`: first position is a verb or nothing; an unknown word is silently ignored by the listing flow (cli.go:575-626, 626-631).
+- `channels [resign|digests] | (flags only)` in main.go:149-165: unknown first word flows into runChannels where std parsing stops at it and it is ignored.
+- `email events [push] | (flags only)` (mail_cli.go:1060-1063): any other first word is ignored by std parse.
+- `config destinations [verb | -flag]`: a first arg not starting with "-" is the verb (config_cli.go:80-83); a first arg starting with "-" means list. A destination NAME can never be first.
+- `channels resign [<app>] <channel>`: 2 positionals => (app, channel) only if --app unset (channels_digests.go:69-72).
+- `apps set <app> ...`, `apps show <app>`, `instances set <host>`, `instances update <host>`, `instances retry <host>`: leadingArg (apps_swap.go:91) lifts args[0] if it does not start with "-"; same value can also come via --app or as one positional after flags. `apps set` refuses two different names (apps_swap.go:100-114).
+- `geo <ip>`, `explain <code>`: ipLast (geo_cmd.go:95) moves a non-flag args[0] to the end.
+- `auth default [<url>]`: 0 = show, 1 = set (auth.go:1017-1054). `fleets secrets-key <fleet> [<pubkey>]` (fleets.go:577-593). `config destinations default [<name>]` (config_cli.go:561-603).
+- `deploy [<paths>...]`: ZERO positionals triggers a different mode (deploy.go:278).
+- `apps build-probe <path|->`: the sentinel `-` is a lone-dash non-flag (apps_buildprobe.go:~55).
+
+### (3) Dispatcher behaves differently for unknown words than "usage error"
+- `canary`: unknown -> deploy (canary.go:94). Exit code is whatever deploy does (usage Fatal if no paths).
+- `instances`: unknown -> bare listing, exit 0, word ignored (cli.go:623-631).
+- `channels`: unknown -> runChannels, ignored (main.go:158).
+- `email events`: unknown first word -> flags (mail_cli.go:1060-1065).
+- `config destinations`: no word / flag-first -> list (config_cli.go:80); unknown word -> error text on stderr exit 1 (via RunConfig, not log.Fatal) (config_cli.go:96).
+- `help`/`-h`/`--help` at top level: stdout, exit 0 (main.go:70). `db help|-h|--help` stdout exit 0 (db.go:69). `devbox help|-h|--help` stdout exit 0 (devbox_cli.go:297). All other dispatchers treat `-h` as an unknown word => usage on STDERR, exit 1 (e.g. accounts, apps, assets, auth, config, domains, email, env, features, fleets, gate, ledger, instances door-key) or exit 2 (top-level default, db unknown, devbox unknown, economics).
+- EXIT CODE SPLIT for "usage" at a dispatcher: exit 2 = main default (main.go:243), `db` (db.go:61,69), `economics` (economics.go:119,131), `devbox` (devbox_cli.go:293,307), `console` errors; exit 1 = accounts, apps, auth, config, email, env, fleets, ledger (Fprint stderr + os.Exit(1)) and assets, domains, features, gate, instances door-key, `apps source`, `fleets boxes` (log.Fatal(usage)); `billing`: log.Fatalf exit 1.
+- `auth *`: `-h` on a leaf returns ErrHelp, which RunAuth turns into "carlos auth <word>: flag: help requested" exit 1 (auth.go:100-108) rather than the usual exit 0; bad flags exit 1 not 2. `config destinations *` and `devbox *`, `billing *`: ErrHelp -> exit 0; bad flags: config 2, devbox 2, billing 1.
+- `instance-stop`: `-h` is an invalid pid -> exit 2. `instance-exit`: parse failures other than usage log and exit 0 (exit.go:35-40).
+- `adopt`/`agent`/`bootstrap`/`edge`: unknown flags -> exit 2 via ExitOnError; non-flag words ignored.
+
+### (4) Words dispatched via a map/slice instead of a switch
+- None in this a-l slice. All sub-verb dispatch is `switch` on a literal string (runInstances, runDomains, runAssets, runFeatures, runGate, runDB, runEmail*, RunEnv, RunAuth, RunConfig, configDestinations, RunApps, RunFleets, RunLedger, RunAccounts, runEconomics, runCanary, runDevbox.run, billing's switch).
+- Data-driven word sets inside leaves (not dispatchers): `ParseRole` (internal/instancectl/names.go:52, switch over Role consts: run, gvisor-run, seed, sidecar, cmd, worker, tty) used by instance-exec/instance-exit; `cliAliases` map (flags.go:20; internal/cliflag/cliflag.go:22) maps flag names to short flags; `destinationKeys` slice (config_cli.go) names destination keys used to register flags.
+- (`offlineVerbs`-style slices mentioned by the brief belong to other letters, e.g. `move`; none seen in a-l.)
+
+### (5) Flags parsed by the parent and passed down to children
+- `agent` -> `edge`: runAgent pre-parses -registry and -acme-cache with throwaway flagsets (agent.go:1640, 3731) and passes the SAME raw `args` to edge.RunWithActivatorReady which re-parses (agent.go:1188; edge.go:4606). The peek flagsets must list every edge flag (-registry -acme-cache -https -http -fallback -dev) or an unknown one ends the peek early.
+- `billing`: parent registers `--console` on the flagset before choosing the verb (billing_cli.go:50-52).
+- `consoleOption`/`destinationOption` (flags.go:41-56): `-d/--destination` writes the package-global `destinationFlag` during Parse; later `loadConfig`/`resolveMode` read it (`deploy` re-runs auth login on a moved console and relies on not wiping it, flags.go comments). A generic dispatcher that parses flags centrally must keep this side effect.
+- Shared flag-registrars called by children, not parents: appsLifecycleFlags (temporary.go:247) for apps ttl/keep/list; gateFlags (gate_cli.go:107) for gate set/clear/list; dbFlags (db.go) for db pull/query; destinationsFlagSet (config_cli.go:203) for all `config destinations *`; runDomainBuyVerb shares one flagset builder for check and buy; runEmailPause for pause/resume.
+- `instances` bare listing and `runChannels` are the parent's own flow (flags parsed for the "default child").
+- `runInstancesImport` peeks args[0] for commit/abort BEFORE building its flagset (instances_import.go:117).
+
+## 3. Other notes a generic walker would trip on
+
+- Positionals after flags: with std parsing (the majority), `carlos apps delete myapp --account x` fails (the flag is treated as a positional); only parseInterspersed users (apps ttl/keep/list, config destinations *, devbox share/unshare/list, domains check/buy, temporary.go flows) and manual-loop users (instances set-assets/set-pages) accept them in either order. leadingArg users (apps set/show, instances set/update/retry) and ipLast users (geo/explain) accept a leading positional.
+- Hand-rolled loops duplicating parseInterspersed: instances_assets.go:~27-37 and instances_pages.go:~27-37.
+- Usage text conventions: ExitOnError leaves print `flagUsage(fs, header)` via fs.Usage; a dispatcher's own usage constants differ (e.g. `accountsUsage`, `appsUsage`, `fleetsUsage`, `emailUsage`, `envUsage`, `ledgerUsage`, `authUsage`, `configUsage`, `dbUsage`, `economicsUsage`, `domainsUsage`, `featuresUsage`, `assetsUsage`, `gateUsage`, `doorKeyUsage`, `sourcePullUsage`); some are printed to stdout on explicit help (db, devbox, top-level) and stderr elsewhere.
+- Some leaves read stdin (gate set password; ledger append `-`; domains buy prompt; fleets) or the terminal (deploy wizard, mutation message prompt): behaviour depends on TTY, not on the command words.
+- Handlers reached from main.go with different capitalisation (`RunApps`, `RunAuth`, ...) vs lowercase are only a naming accident; the exported ones are used by tests/other packages too.
+- Not examined (outside a-l / outside this brief): `ship`, `promote`, `restart`, `run`, `route(s)`, `ratelimit`, `remove`, `schedule`, `store`, `relay`, `steering`, `sidecars`, `services`, `secrets`, `skills`, `status`, `system`, `update`, `vet`, `version`, `pipeline`, `releases`, `proof`, `ops`, `move`, `protection`, `rollback`, `release-keygen`.
+
+
+# Part B
+
+# CLI dispatch audit B: commands m-z, pre-switch dispatch, docsite scanner, update hint
+
+Repo: .../platform/.claude/worktrees/design-cli-registry (read-only audit; nothing run).
+Paths are relative to the repo root. Line numbers are from this tree (main.go is 371 lines; the
+`switch cmd` is main.go:68-235, so the brief's "25-245" is approximate).
+
+Conventions used below
+- "std/ExitOnError": `flag.NewFlagSet(name, flag.ExitOnError)` + `fs.Parse(args)`. Go semantics: stops at the
+ first non-flag argument (so flags after a positional become positionals); `-h`/`-help`/`--help` calls
+ fs.Usage then exit 0; any bad flag exits 2; every `-x` may be written `--x`. Almost all leaves use this.
+- `log.Fatal(...)` exits 1 (the logger is wrapped by newErrorWriter, main.go:34). "usage->1" means log.Fatal(usage).
+- appFlag registers `--app` plus alias `-a`; consoleOption registers `--console` plus `--destination`/`-d`
+ (flags.go:39-51); the alias table (internal/cliflag/cliflag.go:16) is app=a, channel=c, destination=d,
+ environment=e, version=v. accountFlags registers `--account`, `--account-id`.
+- "NArg unchecked" = after fs.Parse the leaf never looks at fs.NArg()/fs.Args(), so stray positionals are
+ silently ignored.
+- Every top-level verb that RETURNS normally (does not os.Exit / log.Fatal) falls out of the switch into
+ maybeUpdateHint(cmd) (main.go:242, see section D).
+
+======================================================================
+## B. Dispatched BEFORE the switch (main.go:25-66)
+
+Order in main() (main.go:25-66):
+1. main.go:26 `runtime.KeepAlive(execsandbox.ProtocolMarker)` (linker keepalive, no argv).
+2. main.go:30 `cgroup.RunShimIfRequested()` (internal/cgroup/shim.go:39). Sets shimHooked, then, only if
+ len(os.Args) >= 2, `switch os.Args[1]`:
+ - `__cgexec` (cgroup.ShimVerb, shim.go:21) -> `os.Exit(runShim(os.Args[2:]))` (shim_linux.go:394). Takes exactly 3
+ decimal fd numbers (keep, keep+1, keep+2, with keep>=3); anything else returns 125. Never reaches the
+ logger. On non-linux runShim returns 127 (shim_other.go:16). The parent starts it with
+ argv `carlos-cgexec __cgexec <keep> <keep+1> <keep+2>` (shim_linux.go:192) via /proc/self/exe, empty env.
+ - `__cgprobe` (cgroup.ProbeVerb, shim.go:25) -> `os.Exit(runProbe())` (shim_linux.go:544): prints own cgroup
+ path, exit 0/1; no args read. Non-linux returns 127.
+ - any other os.Args[1] (including real commands): returns, main continues.
+ No flags, no help, no usage. These two words are matched on os.Args[1] only.
+3. main.go:31 `rootaws.ScrubEnvironment()` then main.go:36 log.SetOutput(newErrorWriter(os.Stderr)).
+4. main.go:37-40 `len(os.Args) < 2` -> usage(os.Stderr), exit 2.
+5. main.go:41 `cmd, args := os.Args[1], os.Args[2:]`.
+6. main.go:42-50 `cmd == "__demo-snapshot"`: if len(args) != 0 -> log.Fatal(democlaim.ErrSnapshot) (exit 1);
+ else democlaim.RunSnapshotWorker(ctx) (internal/democlaim/worker.go:13; refuses euid 0 with ErrSnapshot);
+ error -> log.Fatal; success -> `return` from main (skips maybeUpdateHint). No flags.
+7. main.go:51-57 `cmd == "__registry-child"`: host.RunRegistryChild(args) (internal/host/registrychild_unix.go:87).
+ Positionals: `<registry-path> <uid> <gid> [read-only]` (len 3, or len 4 with args[3]=="read-only"; else
+ "registry: invalid child arguments"). No flags. Error -> log.Fatal (exit 1); success -> `return` (no hint).
+ Non-unix returns an error (registrychild_other.go:14).
+8. main.go:58-65 (comment at 58-59): `__rootfs-check-probe` -> `os.Exit(runRootfsCheckProbe(args))`
+ (ship_check_probe.go:65): ContinueOnError flag set (no SetOutput change; errors go to stderr), flags
+ `--socket <path>` (required), `--timeout <dur>`; any parse error, missing --socket or any positional -> exit 2.
+ `__rootfs-check-prepare` -> `os.Exit(runRootfsCheckPrepare(args))` (ship_check_probe.go:108): ContinueOnError,
+ output discarded, flags `--dir <d>` (required) `--uid <n>` (required, >=0); parse error/positional -> exit 2;
+ prepare failure -> message on stderr, exit 1.
+Note all four `__` words are plain `if cmd == "..."` statements, NOT cases of the `switch cmd`, so the docsite
+scanner never sees them (section C). `__cgexec`/`__cgprobe` are not even in main.go's own text.
+
+======================================================================
+## A. Top-level commands m-z (main.go `switch cmd`)
+
+Entry format: path | handler (file:line) | dispatch style | positionals | flag parsing | bare/unknown-word behaviour | notes
+
+Pre-switch top-level arms that are not in m-z but affect all of them: unknown cmd -> `default:` main.go:235
+usage(os.Stderr), exit 2, with NO message naming the word. `help|-h|--help` -> usage(os.Stdout), exit 0, extra
+args ignored (`carlos help ship` prints the general usage).
+
+### move (main.go:209; moveMain move.go:223; runMove move.go:107)
+runMove does `os.Exit(moveMain(...))`: it never returns, so maybeUpdateHint never runs for `move` (it is also
+not in noHintVerbs: irrelevant because of os.Exit). Exit codes: moveExit* consts move.go:56-61
+(0 done, 1 error, 2 usage, 3 rolled, 4 waiting, 5 refused). ALL output (usage sentences, flag help) goes to stdout.
+
+Parse = parseMoveArgs (move.go:138-217): word-switch on args[0] BEFORE flags, but the word selects which flag
+SET is built (flag set differs per verb), then std flag.ContinueOnError parse, then a post-parse check.
+- `move [flags]` (no verb word, "request") | parseMoveArgs move.go:138, mutate path move.go:223+ | word-switch on args[0] in {status,cut,abort,resolve,offline}; anything else (including no args, a flag, or an unknown word) = implicit verb "request" | positionals none (any leftover -> "carlos move needs --host <host>." exit 2) | std ContinueOnError, output captured to a buffer; flags --host --app/-a --account --account-id --console (all verbs) + request: --to --manual-cut --no-wait | bare `move` -> request path -> "needs --host" (exit 2). `move -h` -> flag.ErrHelp -> flag help printed on stdout, exit 0 (move.go:226-228). Unknown word e.g. `move foo` -> request path, NArg>0 -> moveNeedsHost, exit 2 (misleading message) | `move --host h status` does NOT select status: the flag-first form makes "status" a stray positional. A generic "walk words then leaf" is fine but the DEFAULT child (request) must keep catching unknown words with this exact message.
+- `move status` | parseMoveArgs move.go:146 -> mover.status move.go:637 | word-switch | none | std ContinueOnError; verb flags: common + --wait | usage as above; unknown flag from another verb (e.g. `--to`) -> flag error text + defaults on stdout, exit 2 | requires --host.
+- `move cut` | move.go:146 -> m.mutate POST /cut | word-switch | none | common + --no-wait | as above | --wait is derived: `a.wait = !a.noWait` (move.go:213).
+- `move abort` | move.go:146 -> m.mutate DELETE | word-switch | none | common + --no-wait | as above | .
+- `move resolve` | move.go:146 -> m.mutate POST /resolve or m.declareLost move.go:893 | word-switch | none | common + --retry --declare-lost <box> --no-wait | needs exactly one of --retry / --declare-lost (post-parse checks move.go:196-205, messages moveNeedsRetry / moveRetryOrLost, exit 2) | .
+- `move offline <verb>` | parseMoveArgs move.go:144-150 -> mover.offline move.go:1493 | TWO-LEVEL word-switch: args[0]=="offline", then args[1] checked with `slices.Contains(offlineVerbs, args[1])` (slice `offlineVerbs` move.go:1005 = stage,start,seal,flip,open,finish,abort,status) | the offline verb word is an ENUM positional | std ContinueOnError on args[2:]; common flags, plus --to only for offline stage|start (move.go:171-174) | `move offline` with <2 args or unknown word: prints moveOfflineUsage (move.go:84) on stdout, returns "no offline verb", exit 2. Note `move offline -h` hits the same branch (usage, exit 2, not help-exit-0). | a.offline stays "" for non-offline verbs; `--to` is rejected on seal/flip/open/finish/abort/status (unknown flag). The offline verbs are dispatched inside m.offline by a.offline, so the registry must expose them as sub-commands, driven by a slice not a switch.
+- Phase-1 gate: for status/request/cut/abort/resolve the handler first GETs the status and refuses (moveNotEnabled, exit 5) if protocol != "phase1"; offline skips that (move.go:240-260). Also refuses euid 0 (moveAsRoot, exit 5) after parsing.
+
+### ops (main.go:205; runOps hostclaim_cli.go:35 -> internal/ops/ops.go:32 Run)
+- `ops` dispatcher | runOps hostclaim_cli.go:35 | word-switch with an ENV GATE: if env CARLOS_HOST_CLAIM is non-blank AND args[0]=="host" -> runOpsHost(args[1:]); otherwise boxops.Run(args) (so `ops host ...` with the env unset falls to boxops.Run -> "unknown verb host", exit 2) | - | - | see below | The word `host` exists only when the env var is set. A static registry cannot express this; it needs a runtime predicate.
+- `ops host resolve <host> (--declare-lost <box> | --readmit <box>) [--yes] [--console <url>]` | runOpsHost hostclaim_cli.go:92, parseHostResolve hostclaim_cli.go:43 | word-switch on args[0]=="resolve" (any other/no word -> error "usage: carlos ops host resolve ..." via log.Fatal, exit 1) | `<host>` free value (one; a second -> "unexpected argument") | MANUAL loop (hostclaim_cli.go:52-86): `--yes`, `--declare-lost V`/`--readmit V` (mutually exclusive, `--x` only, no single-dash form; value is next token), `--console V` and `--console=V`; any other token starting with "-" -> `unknown option`; first non-dash = host. Flags and the host can be interleaved in any order. | needs host + exactly one action. Single-dash `-yes` is NOT accepted (only the exact strings `--yes`, `--declare-lost`, `--readmit`, `--console`).
+- `ops litestream` | internal/ops/ops.go:93 runLitestream | word-switch (internal/ops/ops.go:38-54) | none, NArg unchecked | std ExitOnError, fs.Usage = cliflag.Usage | flags: --registry --data --bucket --prefix --region --out --litestream-bin --allow-shrink --memory-dropin; --bucket/--prefix required (log.Fatal) | .
+- `ops restore-verify` | ops.go:223 | word-switch | none, NArg unchecked | std ExitOnError | - | .
+- `ops hibernate-verify` | ops.go:267 | word-switch | none, NArg unchecked | std ExitOnError | - | .
+- `ops` bare/unknown/help | ops.go:32-54 | | | | bare (verb ""): usage() to STDERR then exit 2. `help`, `-h`, `--help`: usage() to stderr, exit 0 (falls out; in noHintVerbs). Unknown verb: `ops: unknown verb "x"` + usage to stderr, exit 2. | `ops` is in noHintVerbs.
+
+### pipeline (main.go:161; runPipeline pipeline.go:69)
+- `pipeline` | pipeline.go:69 | word-switch on args[0] in {init,set,add,remove,show} with DEFAULT = show: unknown first word or leading flag falls through to runPipelineShow(args) (pipeline.go:90) | none for show | see below | bare `pipeline` = show. `pipeline foo` -> runPipelineShow(["foo"]) -> NArg != 0 -> log.Fatal(pipelineUsage) (exit 1). So unknown word does error, but through the default child. | The word `show` is also accepted explicitly. Comment pipeline.go:63-68 states this is deliberate, same shape as `instances`.
+- `pipeline show` | runPipelineShow pipeline.go:246 | leaf | none (NArg != 0 -> usage->1) | std ExitOnError via pipelineFlagSet (pipeline.go:~113): --app/-a --account --account-id --console/--destination/-d; fs.Usage = flagUsage(fs, pipelineUsage) (every subcommand's -h prints the whole pipeline help) | .
+- `pipeline init --template edge-production|full-ladder` | runPipelineInit pipeline.go:285 | leaf | none; template is a flag whose value is an enum (pipelineTemplate) | std ExitOnError | bad/missing template -> log.Fatal(usage) | positional NArg unchecked.
+- `pipeline set --channel <n> [--bake --passkey --promote-approvals --change-approvals]` | pipeline.go:319 | leaf | none, NArg unchecked | std ExitOnError; uses fs.Visit for tri-state | missing --channel -> usage->1 | .
+- `pipeline add --channel <n> [--after <n>] [policy flags]` | pipeline.go:382 | leaf | none, NArg unchecked | std | - | .
+- `pipeline remove --channel <n>` | pipeline.go:437 | leaf | none, NArg unchecked | std | - | .
+
+### promote (main.go:111; runPromote cli.go:2941)
+- `promote [flags] <version> [channel]` | cli.go:2941 | leaf | `<version>` free, `[channel]` free optional (1 or 2 positionals, else usage->1). Channel may be omitted only in console mode (resolved via promoteChannel); in direct-bucket mode with no channel -> usage->1 | std ExitOnError; flags: --message --no-prompt (addMutationMessageFlags) --app/-a --hotfix --retry --account --account-id --console/--destination/-d | bare `promote` -> NArg 0 -> log.Fatal(usage) exit 1; `-h` -> help exit 0 | Positionals MUST come after flags (std parse). `promote 1.2.3 --app x` fails: --app becomes a positional and NArg is 3.
+
+### proof (main.go:203; runProof proof_cli.go:33)
+- `proof` dispatcher | proof_cli.go:33 | word-switch on args[0] in {history,keygen,get,put}, flag sets built inline per case | - | - | bare -> log.Fatal(proofUsage) exit 1. Unknown word, `-h`, `help` -> default log.Fatal(proofUsage), exit 1 (no help-exit-0) | .
+- `proof history <status|reconstruct|retire|resume> ...` | runHistory history_cli.go:27 -> historyCommandWithSave history_cli.go:47 | SECOND word-switch (history_cli.go:51-54: verb must be exactly status|reconstruct|retire|resume, else error historyUsage) | verb is an ENUM positional | std flag.ContinueOnError, output = stdout; flags --bucket (default env CARLOS_DEPLOYMENT_BUCKET) --box --enrollment --account --app --host --state --input --wait(dur) | all errors (including bad verb, no verb, leftover positional) -> log.Fatal(err) exit 1 EXCEPT flag.ErrHelp (swallowed, exit 0, history_cli.go:38) | per-verb field rules enforced by a single big boolean (history_cli.go:71); `--app` here is a plain fs.String (no -a alias).
+- `proof keygen [--out <file>]` | proof_cli.go:43 (inline) | word | none (NArg!=0 -> usage->1) | std ExitOnError, flagUsage | .
+- `proof get --app <a> --sha256 <hex> [--prover <name>] [acct flags]` | proof_cli.go:55 (inline) | word | none (NArg must be 0) | std ExitOnError | missing --app/--sha256 -> usage->1.
+- `proof put --app <a> <file>` | proof_cli.go:68 (inline) | word | `<file>` free path (exactly 1) | std ExitOnError | usage->1 | file after flags.
+
+### protection (main.go:147; runProtection protection_cmd.go:28)
+- `protection [--record-only on|off]` | protection_cmd.go:28 | leaf | none, NArg unchecked | std ExitOnError, flagUsage; --app/-a --record-only --console/-d --account --account-id | `--record-only` value is an enum (on|off|""), validated by protectionMode (protection_cmd.go:~68); bad value -> log.Fatalf exit 1. No `protection on`/`off` word form. | mode flag decides show vs set.
+
+### ratelimit (main.go:107; runRatelimit ratelimit_cli.go:79)
+- `ratelimit` | ratelimit_cli.go:79 | word-switch on args[0] in {show,set,clear}; fallthrough = log.Fatal(ratelimitUsage) | - | - | bare, `-h`, `help`, unknown -> log.Fatal(ratelimitUsage), exit 1 (no help-exit-0 at this level) | .
+- `ratelimit show` | ratelimit_cli.go:156 | word | none, NArg unchecked | std ExitOnError via ratelimitFlags (ratelimit_cli.go:~111), fs.Usage prints ratelimitUsage; flags --app/-a --host --console/-d --account --account-id | `ratelimit show -h` prints usage, exit 0 | .
+- `ratelimit set` | ratelimit_cli.go:371 | word | none, NArg unchecked | std; adds --busy-at --share --rate --burst (int) --path (repeatable pathFlags) --remove-path (repeatable) | - | .
+- `ratelimit clear` | ratelimit_cli.go:424 | word | none, NArg unchecked | std | - | .
+
+### relay (main.go:131; runRelay relay.go:83)
+- `relay` | relay.go:83 | word-switch on args[0] in {enable,status,disable,adopted,rotate,serve,keygen,-h,--help,help} | - | - | bare: relayUsage to STDERR, exit 2. `-h|--help|help`: relayUsage to STDOUT (fmt.Println), exit 0. Unknown word: relayUsage to stderr, exit 2 | .
+- `relay enable --app <a> [--regions r1,r2]` | relay.go:189 | word | none, NArg unchecked | std ExitOnError, flagUsage; --app/-a --regions --account --account-id --console/-d | .
+- `relay status --app <a>` | relay.go:222 | word | NArg unchecked | std | .
+- `relay disable --app <a>` | relay.go:248 | word | NArg unchecked | std | .
+- `relay adopted ...` | relay.go:274 | word | NArg unchecked | std | .
+- `relay rotate --region <r> ...` | relay.go:310 | word | NArg unchecked | std | .
+- `relay serve` | runRelayServe relay.go:116 | word | args IGNORED (`_ []string`, no parse) | none | what carlos-relay.service execs; handles SIGTERM/SIGINT via signal.NotifyContext. `relay serve -h` starts the server.
+- `relay keygen` | runRelayKeygen relay.go:149 | word | args IGNORED | none | prints one `<kid> <b64key> -` line. `relay keygen -h` mints a key.
+
+### release-keygen (main.go:201; runKeygen cli.go:3839)
+- `release-keygen [--scope rungs --name label --expires dur]` | cli.go:3839 | leaf | none, NArg unchecked | std ExitOnError, flagUsage; --scope --name --expires | `--name`/`--expires` without `--scope` -> log.Fatalf "only apply with --scope" (uses fs.Visit) | mode decided by flags (--scope present = scoped key, absent = ROOT key). In noHintVerbs.
+
+### releases (main.go:165-178; runReleases cli.go:3370)
+- `releases` dispatcher | main.go:165-178 (inline in main, NOT a function) | word-switch on args[0] in {retention,authorize} before any flag parse; anything else falls to runReleases(args) (default child = list) | - | - | `releases foo` -> runReleases(["foo"]): positional silently ignored, lists (or demands --app) | The dispatch lives inside main.go's case body, so a registry must replace it (and `channels`, same shape, main.go:149-160).
+- `releases [--app a]` (list) | cli.go:3370 | leaf | none, NArg unchecked (silently ignores `foo`) | std ExitOnError, flagUsage; --app/-a --account --account-id --console/-d | no app and no console -> usage->1 | .
+- `releases retention` | runReleasesRetention retention.go:22 | word (main.go:168) | none, NArg unchecked | std; --app/-a --keep --off --dry-run --account --account-id --console | combinations validated post-parse (log.Fatal) | .
+- `releases authorize [--app a] [--yes] <version> | <app> <version>` | runReleasesAuthorize releases_authorize.go:25 | word (main.go:172) | 1 positional `<version>` free; OR 2 positionals `<app> <version>` when --app is empty (releases_authorize.go:~38-41: pos[0] becomes the app) | std ExitOnError; --app/-a --account --account-id --yes --console | otherwise usage->1 | ONE POSITION CAN BE EITHER app OR version depending on count and on --app.
+
+### remove (main.go:89; runRemove cli.go:548)
+- `remove <host>` | cli.go:548 | leaf | `<host>` free (exactly 1, NArg != 1 -> log.Fatal("usage: carlos remove <host>")) | std ExitOnError; --registry | box-local; in noHintVerbs.
+
+### restart (main.go:115; runRestart restart.go:50)
+- `restart [--app a] [--host h] [--environment e] [--dry-run]` | restart.go:50 | leaf | none, NArg unchecked | std ExitOnError; --message --no-prompt --app/-a --host --environment/-e --dry-run --account --account-id --console/-d; fs.Usage = flagUsage(fs, restartUsage) | a flag given with an empty value (`--host ""`) is refused via flagWasSet (restart.go:~64-72) | route choice (whole app vs scoped door) depends on flags, not words.
+
+### rollback (main.go:179; runRollback cli.go:3422)
+- `rollback [flags] <channel>` | cli.go:3422 | leaf | `<channel>` free (exactly 1) | std ExitOnError; --message --no-prompt --app/-a --account --account-id --console/-d; fs.Usage = flagUsage(fs, usage) | NArg != 1 -> log.Fatal(usage) exit 1 | channel after flags.
+
+### route (main.go:91; runRoute cli.go:796-1507)
+- `route --host h ... | --app a ...` | cli.go:796 | leaf; MODE chosen by which flags are present (cli.go:~855-1507: --grant/--revoke, --hibernate, --backing, --unit, --tunnel, --replication, --channel/--environment) via fs.Visit | none, NArg unchecked | std ExitOnError; --registry --host --app/-a --account --account-id --channel/-c --environment/-e --grant --revoke --hibernate (tri-state via Visit) --backing --unit --tunnel --replication --allow-version-change --dry-run; flagUsage(fs, usage+...) | bare `route` -> goes through flag checks, then a usage log.Fatal (not verified in detail); `route foo` silently ignores foo | in noHintVerbs. Different modes of one verb are flag-selected: no word dispatch to preserve.
+
+### routes (main.go:97; runRoutes routes_cli.go:43)
+- `routes [--app a] [--match s]` | routes_cli.go:43 | leaf | none, NArg unchecked | std ExitOnError; --app/-a --match --console/-d --account --account-id; flagUsage(fs, routesUsage) | .
+
+### run (main.go:119; runRun run.go:864, parseRunArgs run.go:65)
+- `run --app a --instance h [--file p]... [--timeout d] [--follow id] [--idempotency-key k] [-it|--interactive] -- <argv>...` | run.go:864 | leaf with a SEPARATOR: the FIRST literal `--` in args (slices.Index, run.go:67) splits flagArgs from the tenant argv; everything after is argv, untouched | `argv...` after `--` are free values (the command to run); no positionals before `--` (NArg>0 -> errRunUsage) | std flag.ContinueOnError on args[:i] only, output stderr; flags --app/-a --instance --file (multiFlag, repeatable) --timeout (duration) --follow --idempotency-key -it and --interactive (bool, both registered; single-dash `-it` is a flag NAME "it") --account --account-id --console/-d | runRun (run.go:864-872): parse error: ErrHelp -> os.Exit(0); errRunUsage -> run usage on stderr exit 2; other errors -> message + run usage, exit 2. Always os.Exit (never reaches hint). | Hard case: `--` splitting happens BEFORE flag.Parse and flag values that equal `--` are impossible. Keep `--` handling in the leaf; a generic dispatcher must not strip `--` itself.
+
+### schedule (main.go:125; runSchedule schedule.go:67)
+- `schedule` | schedule.go:67 | word-switch on args[0] in {ls,set,rm,run}, before any flag parse | - | - | bare/unknown/`-h`/`help` -> log.Fatal(scheduleUsage), exit 1 | .
+- `schedule ls` | schedule.go:106 | word | NArg unchecked | std ExitOnError, flagUsage(fs, scheduleLsUsage); --app/-a --account --account-id --console | .
+- `schedule set --name n (--every d | --cron expr) --path /p` | schedule.go:125 | word | NArg unchecked | std; --app/-a --name --every --cron --path ... | .
+- `schedule rm --name n` | schedule.go:174 | word | NArg unchecked | std | .
+- `schedule run --name n` | schedule.go:198 | word | NArg unchecked | std | usage const scheduleRunUsage at schedule.go~60.
+
+### secrets (main.go:199; RunSecrets appconfig_cli.go:890)
+- `secrets` | appconfig_cli.go:890 | word-switch on args[0] in {set,unset,list,genkey,fingerprint} | - | - | bare: secretsUsage to stderr, exit 1. Unknown (incl. -h, help): secretsUsage to stderr, exit 1 | .
+- `secrets set KEY=value ...` | runSecretsSet appconfig_cli.go:1007 | word | one or more `KEY=value` free pairs (parseKV appconfig_cli.go:422: split on first `=`, empty key rejected, 0 pairs rejected) | std ExitOnError, flagUsage; --app/-a --environment/-e --account --account-id --registry (accountFlagsWithRegistry) --console/-d | pairs must follow all flags (std stop at first non-flag; a later `--x` would be treated as a pair and rejected by position without echoing it) | values are secrets: never echo.
+- `secrets unset KEY ...` | appconfig_cli.go:1208 | word | one or more free key names (NArg==0 -> usage->1) | std | same as above.
+- `secrets list` | appconfig_cli.go:1267 | word | none, NArg unchecked | std | .
+- `secrets genkey` | runSecretsGenkey appconfig_cli.go:1316 | word | args IGNORED, no flag set | none | `genkey -h` mints a key. Prints KEY/PUBKEY on stdout and notes on stderr.
+- `secrets fingerprint [--file path]` | appconfig_cli.go:1355 | word | none (NArg != 0 -> usage->1) | std | default file /etc/carlos/host.env.
+
+### services (main.go:195; RunServices services.go:87)
+- `services` | services.go:87 | word-switch on args[0] in {create,ls,rotate,revoke} | - | - | bare: servicesUsage stderr, exit 1. Unknown (incl. -h): servicesUsage stderr, exit 1 | `services` was not in the brief's list but starts with "s".
+- `services create --role r [flags] <name>` | services.go:159 | word | `<name>` free (exactly 1; NArg != 1 or empty --role -> usage->1) | std ExitOnError, flagUsage; --role (enum value checked via svcrole.Parse) --app/-a --rungs --commands --scope --account --account-id --console | name AFTER flags.
+- `services ls` | services.go:314 | word | none, NArg unchecked | std.
+- `services rotate <name>` | services.go:383 | word | `<name>` free (exactly 1) | std.
+- `services revoke <handle>` | services.go:432 | word | `<handle>` free (exactly 1; validServiceHandle) | std.
+
+### ship (main.go:109; runShip cli.go:2477)
+- `ship [flags] <files-or-site-dir>...` | cli.go:2477 | leaf | one or more free paths (NArg == 0 -> usage->1), EXCEPT `--rootfs` where the file list is not used; rootfs source comes from the flag and the ship branches into runShipRootfs(fs, ...) (ship_rootfs.go) passing the parsed FlagSet | std ExitOnError; huge flag set: --message --no-prompt --app/-a --account --account-id --console/-d --kind (binary|static, enum flag) --version/-v --target --capabilities --label --notes --notes-file --stateless --swap --assets (repeatable assetPathsFlag) --program-change --rootfs --processes --hibernate --jit --check --env (shipCheckEnvFlag, repeatable) | bare -> usage->1 | Hard case (5): the FlagSet is parsed by the parent and handed into runShipRootfs, and rootfs-only flags are refused elsewhere via shipRootfsOnlyRefusal(fs) using fs.Visit. Files must come after flags.
+
+### sidecars (main.go:95; runSidecars sidecars_cli.go:527)
+- `sidecars` | sidecars_cli.go:527 | word-switch on args[0] BEFORE any flag parse in {enable,create,ls,wake,rm,logs} | - | - | bare: log.Fatal(sidecarsEnableUsage) exit 1. Unknown: log.Fatalf `carlos sidecars: unknown subcommand %q` + usage, exit 1 (so `-h` gives this unknown-subcommand error, exit 1) | no bare default child (comment: "every word is required").
+- `sidecars enable` | sidecars_cli.go:103 | word | NArg unchecked | std ExitOnError; fs.String("app") (NO `-a` alias here, plain fs.String) --args --placement --pool --channel (plain fs.String, no -c) --regions --idle --max-run --no-hibernate --console/-d --account --account-id | .
+- `sidecars create <name>` | :339 | word | `<name>` free (exactly 1, non-blank) | std | .
+- `sidecars ls` | :392 | word | NArg unchecked | std; --app --long ... | .
+- `sidecars wake <name>` | :436 | word | `<name>` exactly 1 | std.
+- `sidecars rm <name>` | :465 | word | `<name>` exactly 1 | std.
+- `sidecars logs <name>` | :492 | word | `<name>` exactly 1 | std; then REBUILDS an argv `-app A -host H [-console C] [-account X] [-account-id Y]` and calls runLogs(logsArgs) (sidecars_cli.go:~513-521) | Hard case (5)-like: the parent parses, then synthesises single-dash flags for another command's parser (runLogs). runLogs must keep accepting `-app`, `-host`, `-console`, `-account`, `-account-id`.
+
+### skills (main.go:163; runSkills skills.go:152)
+- `skills [--index url] [<name>]` | skills.go:152 | leaf | `<name>` OPTIONAL FREE value: 0 positionals -> list; >=1 -> prints that skill (only fs.Arg(0) used; extras ignored) | std ExitOnError, flagUsage(fs, skillsUsage); --index | no word set: any word (`help`, `list`, ...) is treated as a skill NAME and fetched. | Hard case (2): free-value in the first position, so a registry must not add child words to `skills`.
+
+### status (main.go:211; RunStatus cli.go:3945)
+- `status` | cli.go:3945 | leaf; MODE chosen by flags in priority order --instances > --layout > --live > --dry-run (cli.go:3957-3989) | none, NArg unchecked | std ExitOnError, flagUsage(fs, statusUsage); --dry-run <dir> --live --instances --account --layout --console/-d | no mode flag -> statusUsage to stderr, exit 1 | in noHintVerbs.
+
+### steering (main.go:123; runSteering instances_cli.go:944)
+- `steering --app a --host h latency|off` | instances_cli.go:944 | flags-then-word: std parse first, THEN `switch fs.Arg(0)` at instances_cli.go:957 with words `latency` -> "latency", `off` -> "" | positional is an ENUM {latency, off} | std ExitOnError; --app/-a --host --console/-d --account --account-id; flagUsage(fs, steeringUsage) | `*host == "" || NArg != 1` -> usage->1; other word -> usage->1 | Hard case (1). Word must come after flags and any other word is an error.
+
+### store (main.go:129; runStore store.go:111)
+- `store` | store.go:111 | word-switch on args[0] in {create,status,grant,rotate,apply,approvals,approve,decline,scan} | - | - | bare: storeUsage stderr, exit 1. Unknown: storeUsage stderr, exit 1 | .
+- `store create` | :168 | word | NArg unchecked | std ExitOnError; --app/-a --env-prefix --environment (storeEnvironmentFlag store.go:205) --account --account-id --console
+- `store status` | :257 | word | NArg unchecked | std
+- `store grant` | :287 | word | NArg unchecked | std
+- `store rotate` | :318 | word | NArg unchecked | std
+- `store apply` | :349 | word | NArg must be 0 | std
+- `store approvals` | :369 | word | NArg must be 0 | std
+- `store approve` | runStoreApprove :397 -> runStoreApproveWithSession :406 | word | NArg must be 0 (error `unexpected argument`) | std flag.ContinueOnError with output to stdout; --account --console | ErrHelp swallowed (exit 0); other errors -> log.Fatalf `store approve: %v` exit 1 | different error plumbing from siblings (returns an error).
+- `store decline` | :434 | word | NArg must be 0 | std ExitOnError
+- `store scan` | runStoreScan scan.go:61 | SECOND word-switch on args[0] in {request,status,grant,revoke,sweep,enforce,rotate-webhook-key} | - | - | bare / unknown: storeScanUsage stderr, exit 1 | .
+ - `store scan request` scan.go:111 | word | NArg unchecked | std (via scanTarget scan.go:88); extra --plaintext --client-encrypted (exactly one required)
+ - `store scan status` scan.go:134 | word | std
+ - `store scan grant|revoke|sweep|rotate-webhook-key` | runStoreScanSimple scan.go:146 (verb passed in) | word | std via scanTarget (fs.String app uses appFlag; scanTarget scan.go:88 builds app/account/console flags AND calls fs.Parse)
+ - `store scan enforce --app a on|off` | runStoreScanEnforce scan.go:169 | PRE-FLAG WORD EXTRACTION: scans the whole args slice for bare tokens `on`/`off` BEFORE flag parsing (scan.go:178-196), removing them, last one wins; then scanTarget parses the remainder | positional is an ENUM {on, off}, accepted ANYWHERE (before, between or after flags) | std ExitOnError on the leftover args | not seen -> log.Fatal("store scan enforce: say which ..."), exit 1 | Hard case (1). The takesValue skip-list (scan.go:182-185) protects only `--app/-app/--account/-account/--account-id/-account-id/--console/-console` followed by a separate token. It does NOT include `-a` (the alias) or `-d`/`--destination`, so `-a on` (an app named "on") is eaten as the switch today. The forms `--app=on` are safe (single token). Must be preserved byte-for-byte or deliberately fixed.
+
+### system (main.go:207; runSystem system.go:62; systemVerb system.go:~48)
+Dispatcher: systemVerb(args) (system.go:46-60): (1) if args[0]=="router" it is dropped (an optional COMPONENT word; `component` is returned but runSystem ignores it: `verb, rest, _ := systemVerb(args)`); (2) if len(args)==0 -> verb ""; (3) word-switch on args[0] against the long list in the `case` at system.go:51-52: runsc-ensure, exec-sandbox-allows-prev, group-maintenance, demos, managed-fleets, files, guard-arm, guard-exec, journal-migrate, floor-allows-prev, update, status, rollback, cancel-activation, apply, antivirus, pdf, layout, geoip, seeds-floor, legacy-routes, lifetimes, hosts-used, box, group, install-channel, host-env, db-worker, named-units, help, -h, --help; (4) anything else -> verb "" with rest = args (so the "unknown verb" message reads rest[0]).
+runSystem (system.go:62-132): `default:` -> optional message line via systemUnknownVerbMessage (system.go:145: `system: unknown verb "x"` if rest non-empty; `system: no verb given` if only `router` was typed; nothing for bare `system`), then systemUsage() to stderr, os.Exit(2). `help|-h|--help` -> systemUsage() to stderr and RETURN (exit 0). Note `system router router update` -> unknown verb "router".
+Nothing is printed to stdout by the usage. `system` is in noHintVerbs.
+
+- `system update` | runSystemUpdate system.go:307 | word | none, NArg unchecked | std ExitOnError, flagUsage; --console/-d --channel (default stable; canary|stable, free string) --version --file --platform --spread --yes + the three release.*FloorOverrideFlag bools | `--file` requires `--version` (log.Fatal)
+- `system status` | system.go:505 | word | NArg unchecked | std; --console --channel
+- `system rollback` | system.go:600 | word | NArg unchecked | std; --console --channel(required) --yes + 3 override bools
+- `system cancel-activation` | runSystemCancelActivation system_activation.go:20 | word | NArg unchecked | std; --console --channel(required) --activation --yes
+- `system apply` | host.RunSystemApply internal/host/systemapply.go:116 | word | NArg unchecked | std ExitOnError, `_ = fs.Parse` ; --recover + rootfs-floor override | root only (euid check after parse)
+- `system antivirus <status|enable|disable|rotate-webhook-key>` | runSystemAntivirusVerb system.go:~700; leaf runSystemAntivirus system.go:719 | SECOND word-switch at system.go:709 (word BEFORE flags; the verb string is passed into the leaf) then `switch verb` at system.go:731 inside the leaf after flags | enum | std ExitOnError on rest[1:]; --console | bare: "system antivirus: no verb given" + systemUsage, exit 2; unknown (incl. -h, help): `system antivirus: unknown verb "x"` + usage, exit 2 | the verb is selected before flags; the post-flag `switch verb` is just a payload switch. NArg unchecked.
+- `system pdf [status]` | runSystemPDFVerb system.go:646 | word-switch at system.go:651 on rest[0] in {help,-h,--help (usage, exit 0 via return), status}; bare -> usage, exit 2; unknown -> usage, exit 2 | none (NArg != 0 -> fs.Usage + exit 2) | std ExitOnError on rest[1:]; --console | .
+- `system layout <status|migrate|revert>` | runSystemLayout system.go:813 | word-switch at system.go:819 (before flags) {help,-h,--help -> systemLayoutUsage on stderr, RETURN exit 0; status|migrate|revert}; bare -> usage exit 2; unknown -> `system layout: unknown verb "x"` + usage, exit 2 | enum | std ExitOnError on rest; --console --box --force --yes; flagUsage(fs, systemLayoutUsage) | the same FlagSet serves all three; `status` ignores --box/--force/--yes silently.
+- `system geoip <publish|status|off>` | runSystemGeoipVerb system_geoip.go:20 | word-switch at system_geoip.go:26 BEFORE flags | publish: `<file.mmdb>` free path (exactly 1, else fs.Usage + exit 2) | std ExitOnError on rest[1:]; publish: --console --force; fs.Usage = flagUsage(fs,"<file.mmdb>"); status: system_geoip.go:186 --console; off: :261 --console | bare: "system geoip: no verb given" + systemUsage, exit 2; unknown: `system geoip: unknown verb "x"` + usage, exit 2 | status/off: NArg unchecked.
+- `system demos ...` | runSystemDemos system_demos.go:19 | MANUAL, no flag package (see Hard cases). Grammar: `help|--help|-h` (exactly one arg, stdout, exit 0); `reports [resolve] [--console v] [--after v] [--limit v] [--id v]`; else `<verb> [on|off] [--host h] [--console c]` where verb in {status, serving, takedown, takedown-status} | positionals: verb word (enum), and for `serving` a required enum `on|off` (system_demos.go:35-41) | manual pairwise loop (system_demos.go:43-65): every option MUST be `--host V`/`-host V`/`--console V`/`-console V` as two tokens; `--host=V` is rejected; duplicates rejected; a trailing odd token rejected; empty args -> invalid | every error: systemDemosInvalid ("Check the command arguments. Run carlos system demos help.") to stderr, exit 2 (no usage text). `-h` only as the sole argument. | Hard case (1)(3): the verb is validated AFTER the flag loop (system_demos.go:69-83): status/serving forbid --host; takedown/takedown-status require a valid lower-case --host. Unknown verb words are only discovered after flag parsing (so `demos foo --bar` reports the same invalid message either way).
+ - `system demos reports` | runSystemDemosReports system_demos.go:162 | word `resolve` optional (first arg only) | none | manual pairs; accepts `-key` and `--key` spelling (system_demos.go:177-182) for keys console|after|limit|id; `--key=V` rejected | invalid() -> stderr message, exit 2; runtime errors exit 1 (log.Print) | `resolve` requires --id and forbids --after/--limit; list forbids --id.
+- `system managed-fleets <show|set --file f.json>` | runSystemManagedFleets system_managedfleets.go:24 | word-switch (inline ifs) BEFORE flags | enum {show,set} | std ExitOnError on args[1:]; --console/-d --file | bare: usage to stderr, exit 2. `help|--help|-h`: usage to STDOUT, exit 0. Other word: log.Fatal(usage) exit 1 | `show` forbids --file; `set` requires it (post-parse check).
+- `system seeds-floor publish --min-release v` | runSystemSeedsFloorVerb system_seeds.go:14 | word (only `publish`; bare/other -> systemUsage, exit 2) | none (NArg!=0 -> fs.Usage exit 2) | std ExitOnError on rest[1:]; --console --min-release; NO fs.Usage set (stock Go usage) | .
+- `system legacy-routes assign --name n --to acct/app` | system_legacy_routes.go:20 | word (only `assign`; else systemUsage exit 2) | none | std; --console --name --to; no fs.Usage | .
+- `system lifetimes cutover [--no-wait]` | system_lifetimes.go:110 | word (only `cutover`) | none | std; --console --no-wait; no fs.Usage | .
+- `system hosts-used status` | system_hostsused.go:82 | word (only `status`) | none | std; --console; no fs.Usage | .
+- `system box role <box> <role> [--console c]` | runSystemBoxVerb system_roles.go:98 | word: rest[0]=="publish-record" -> host.RunSystemBoxPublishRecord(rest[1:]) (internal/host/boxpublish.go:317; std ExitOnError, NArg must be 0 else usage exit 2); else roleArgs (system_roles.go:80) | positionals: `role` word REQUIRED at rest[0], then `<box>` free, `<role>` free (validated server side; documented default|legacy|platform) | MANUAL: roleArgs allows only 3 positionals plus an optional trailing `--console V` / `-console V` pair (two tokens, nothing else; `--console=V` rejected) | any other shape -> systemUsage, exit 2 | positional-first grammar: NO std flag parse here; flags only at the very end.
+- `system group role <region> <role> [--console c]` | runSystemGroupVerb system_roles.go:115 | roleArgs | same as box | same.
+- `system install-channel [--policy p --identity i]` | host.RunSystemInstallChannel internal/host/installchannel.go:117 | word | none (NArg != 0 -> usage exit 2) | std ExitOnError | --policy and --identity must both be set or neither | root only.
+- `system host-env <write|seed> --deployment d --region r [--aws-region --kms-key --from --group --install]` | hostenv.RunSystemHostEnv internal/hostenv/cli.go:38 -> runHostEnv :60 | word (args[0] in {write,seed} else usage error) | none | PRE-SCAN of raw args for `--group`, `-group`, `--group=...`, `-group=...` (cli.go:39-45) to pick an SSM opener BEFORE the real flag.ContinueOnError parse (output discarded, cli.go:68-79) | any error -> message on stderr, exit 1 (usage errors too, exit 1 not 2) | Hard case (5)-like: a flag sniffed by a parent before the leaf parses it.
+- `system named-units install <file>` | host.RunSystemNamedUnits internal/host/unitops.go:96 | MANUAL: exactly 2 args, args[0]=="install" | `<file>` free path | none | else log.Fatal usage exit 1; root only | .
+- `system runsc-ensure` | host.RunSystemRunscEnsure internal/host/runscensure.go:22 | word | args must be empty (else log.Fatal(execsandbox.ErrConfig)) | none | .
+- `system exec-sandbox-allows-prev <path>` | host.RunSystemExecSandboxAllowsPrev internal/host/execsandboxfloor.go:41 | word | exactly 1, and it must equal the literal `/opt/carlos/carlos.prev` | none | else log.Fatal(ErrConfig) | .
+- `system group-maintenance <permit|revoke|status|apply|rollback | prepare --sha256 hex | help>` | host.RunGroupMaintenance internal/host/group_maintenance_verbs.go:54 (returns an int; runSystem does os.Exit on it) | word, parsed by maintenanceArguments :360: `prepare` takes --sha256 via std flag.ContinueOnError; other verbs require len(args)==1 | enum | help (exactly one arg) -> stdout, exit 0; any bad shape -> help text to stderr, exit 2; runtime failure exit 1 | stdin/stdout/stderr passed in.
+- `system files seed [--host h]` | host.RunSystemFiles internal/host/claimfilesseed_command.go:49, parseFilesSeed :28 | word (args[0]=="seed" else hostbox.ErrUnsupported) | none | std ContinueOnError, output discarded | errors -> log.Printf + os.Exit(1) (2 if incomplete) | .
+- `system guard-arm` | host.RunSystemGuardArm internal/host/guardarm.go:23 | word | none | std ExitOnError, `_ = fs.Parse`; --console --policy --identity --enrollment | root only, missing -> log.Fatal(hostfloor.ErrFloor).
+- `system guard-exec <apply|recover|console <bin> [args...]|edge>` | host.RunSystemGuardExec internal/host/guardexec.go:27 | word-switch on args[0] (guardexec.go:~69-95); `console` takes a candidate path then passes the REST OF ARGV UNPARSED to that binary | enum + free tail | none | bare/unknown -> log.Fatal(hostfloor.ErrFloor) | this verb re-invokes the binary as `system apply [--recover]` or `agent` or <candidate> args: a registry must keep `system apply --recover` spelling valid.
+- `system journal-migrate [--window w]` | host.RunSystemJournalMigrate internal/host/claimjournal_migration.go:34 | word | none (NArg != 0 -> log.Fatal(ErrUnavailable)) | std ExitOnError, `_ = fs.Parse` | root only.
+- `system floor-allows-prev (--root <dir> | <abs> <abs>)` | host.RunSystemFloorAllowsPrev internal/host/movesfloorgate.go:62 | MANUAL: exactly 2 args; args[0]=="--root" or two absolute paths | free | none | else err -> stderr, exit 1.
+- `system db-worker` | dbreads.RunWorker internal/dbreads/worker_linux.go:21 | word | args must be empty (else `db-worker: takes no arguments`, exit 2) | none | non-linux: exit 2.
+
+### update (main.go:231; runUpdate update.go:203)
+- `update [-y]` | update.go:203 | leaf | none, NArg unchecked | std ExitOnError, flagUsage; `-y` only (single dash is the registered name; `--y` also parses) | refuses root/box env | in noHintVerbs.
+
+### vet (main.go:229; vet.Run internal/vet/vet.go:185)
+- `vet --app a --version v [--account sqid] [--boot]` | internal/vet/vet.go:185 | leaf | none, NArg unchecked | std ExitOnError, `_ = fs.Parse`; cliflag.String for --app/-a and --version/-v; --account (default ops account) --boot | missing app/version -> log.Fatal(vetUsage), exit 1; problems -> stderr, exit 1 | in noHintVerbs. Out-of-package: internal/vet registers aliases through the shared cliflag table.
+
+### version (main.go:71-83)
+- `version` / `version target ...` | inline in main.go:71-83 | word-switch (single `if len(args) > 0 && args[0] == "target"`) | - | - | `carlos version` prints `carlos <build>` and nothing else. Any other trailing words/flags (`version -h`, `version foo`) are silently ignored and also print the build. | in noHintVerbs because the Homebrew formula test asserts on its output.
+- `version target [flags] [<semver>]` | runVersionTarget cli.go:3208 | word | `<semver>` OPTIONAL free (0 = print, 1 = set; >1 -> usage->1) | std ExitOnError; --app/-a --account --account-id --console/-d, flagUsage | .
+- This is a nested dispatcher in main.go, not a function; the registry must own it.
+
+======================================================================
+## C. internal/docsite CLI scanner
+
+File: internal/docsite/cliscan.go. API: `func TopLevelCommands(mainFile string) ([]string, error)`.
+What it extracts: parses the single file `mainFile` with go/parser (SkipObjectResolution; NOT type-checked), walks
+every `*ast.SwitchStmt` with ast.Inspect, keeps only switches whose Tag is a bare identifier named exactly `cmd`
+(`switch cmd {`), and for each `CaseClause` collects every expression that is a string BASIC LITERAL (strconv.Unquote'd).
+Filter isCommandWord: non-empty; every rune in a-z or `-`; first rune is not `-`. Duplicates removed; result sorted.
+Consequences: (a) it reads only main.go's `switch cmd`; (b) the pre-switch `if cmd == "__..."` words are invisible
+(also `_` and digits are rejected, so `__x` words could never pass); (c) `-h`/`--help` are dropped, `help` and
+`version` kept; (d) case expressions that are constants/identifiers/function calls are ignored (only literals);
+(e) sub-verbs are not seen (explicit doc comment, and the object-storage plan says so); (f) if `switch cmd` stops being a
+`switch` with tag `cmd` in main.go, it returns an empty slice and the tests fail. The scan is syntactic: renaming the
+variable or moving the dispatch to another file or a map/registry silently yields nothing/too little.
+
+Callers (grep of whole repo):
+- internal/docsite/cli_test.go:14 TestTopLevelCommandsReadsTheDispatch: asserts >= 20 commands, includes ship/promote/deploy/domains/logs/fleets, excludes "-h","--help","".
+- internal/docsite/cli_test.go:67 TestCLICommandsAreDocumented: every returned word needs a heading whose anchor is `Anchor("carlos "+cmd)` on the page slug `cli` (docs/site cli page; `mainFile = "../../main.go"`, cli_test.go:6). The test comment says a bare substring check was rejected on purpose.
+- internal/docsite/fences_test.go:75 TestFencedCarlosCommandsAreReal: the verb after `carlos` in every code fence on the docs site must be one of the returned words.
+- internal/parity/repo_test.go:59 TestParityCLITopLevel (`repoMain = "../../main.go"`): (i) every word MUST be the first word of some CLI member of a parity.tsv row, (ii) every CLI member's first word must be dispatched unless it starts with `__`. Plan docs/superpowers/plans/2026-11-09-parity-guard.md:164 and the spec say "unchanged, both directions, __ words shape-only".
+- Non-callers that read main.go as TEXT: canary_test.go:287 (`os.ReadFile("main.go")`, cuts at the literal `case "canary":` and then at the next `case "`, requires `runCanary(args)` in between and no "not implemented"); approved_moves_copy_test.go:1370 (main.go is in its file list for the copy gate); internal/provision/*_census_test.go entries ({"main.go","main","key-site","lit:instances,lit:sidecars", <sha256>}) pin a hash of main()'s declaration for the write-census, so any change to main() changes that hash and needs a census rebase/envelope update.
+- Prior design notes that already flag this dependency: docs/superpowers/specs/CODEX-FINDINGS-parity-guard.md:42 ("If that fallback replaces main's switch, it also requires updating the documentation scanner"), docs/superpowers/specs/2026-09-01-object-storage-virus-scanning-design.md:616.
+
+Also note: the usage() text in main.go (lines 260-371) is prose, hand-maintained, and not checked against the switch by this scanner; main.go:254 const moveUsageLine / moveUsageWrapped are referenced by approved_moves_copy_test.go copy gate.
+
+======================================================================
+## D. maybeUpdateHint(cmd) (main.go:242; update.go:116)
+
+Placement: the last statement of main() after the switch (main.go, "After a verb that ran to success"). Reached only by
+verbs that RETURN. `help`/`-h`/`--help`, `version`, and every command that ends in os.Exit/log.Fatal never get there in a
+way that matters; `__demo-snapshot` and `__registry-child` `return` earlier so they skip it.
+What it uses `cmd` for: ONLY as a map key: `if noHintVerbs[cmd] || !interactiveTerminal() || !releaseBuild(version.Build) { return }`
+(update.go:117). `args` is not passed. noHintVerbs (update.go:67-72) = {edge, agent, adopt, bootstrap, add, remove, route,
+ops, status, vet, release-keygen, version, help, -h, --help, update, system}. Every other word (including future
+commands and the commands not in that list: instances, canary, devbox, ship, promote ...) is eligible.
+Then it additionally requires: no CARLOS_DEPLOYMENT_BUCKET / CARLOS_DEPLOYMENT_DIR, euid != 0, no CARLOS_NO_UPDATE_CHECK,
+config update_check != "off", and a ~/.carlos/update-check.json cache older than 24h; it then fetches the feed
+(1.5 s) and prints the hint to `stdout` via mutedf. So a registry needs a per-command "suppress update hint" attribute
+that reproduces exactly that set, and keys by the TOP-LEVEL word only (nested paths are not distinguished).
+
+======================================================================
+## Hard cases
+
+### (1) A word that selects different code appears AFTER flags (or flags can precede the word)
+- steering: `latency|off` via `switch fs.Arg(0)` AFTER std flag.Parse: instances_cli.go:944 (parse), :957 (switch). Only flags before the word; the word must be the single positional.
+- store scan enforce: `on|off` is pulled out of args from ANY position BEFORE flag.Parse, last one wins: scan.go:169-196; the value-skip list scan.go:182-185 does not know the `-a` alias or `-d`/`--destination`, so `store scan enforce -a on` consumes `on` as the switch. (Byte-compat hazard.)
+- system demos: verb word first, but `serving` then requires `on|off` as the next token (system_demos.go:35-41), the flags are a manual pairs loop after it (system_demos.go:43-65), and the verb is only validated AFTER the loop (system_demos.go:69-83). `--flag=value` is rejected; every error is the single message systemDemosInvalid (exit 2).
+- system demos reports: word `resolve` only in position 0 of the rest (system_demos.go:164-167), keys accepted as `-k`/`--k` with a value token (system_demos.go:177-189).
+- system box role / system group role: positional-first grammar `role <name> <role>` and then at most `--console V` (system_roles.go:80-93). Not std flags.
+- system antivirus: `runSystemAntivirus(args, verb)` (system.go:719) is given the verb chosen at system.go:709 and then re-switches on it AFTER flags (system.go:731). The earlier brief cited system.go:651/709; in this tree 651 is `switch rest[0]` for `pdf` and 709 for `antivirus`, both BEFORE flags (word-first). The post-flag switch is at 731.
+- system layout: word chosen at system.go:819 before flags; then `if sub == "status"` after flags (system.go:~840). Same FlagSet for all three words.
+- system geoip (system_geoip.go:26): word-first; no post-flag word.
+- move: word first selects the flag SET (move.go:146-176), then std parse; flags BEFORE the verb word are not recognised (`move --host h status` = request with stray positional). Also `move offline <verb>` second word.
+- releases authorize: positional count decides whether the first positional is an app or a version (releases_authorize.go:~38).
+- run: `--` anywhere splits flags from the tenant argv before flag.Parse (run.go:66-69).
+- route, status, restart, protection, ship, release-keygen: behaviour selected by which FLAGS are present (mode by flag, not by word). A word-based registry should leave them as leaves.
+
+### (2) One position can hold either a sub-command word or a free value
+- pipeline: args[0] is a subcommand word {init,set,add,remove,show} OR (in practice) the start of flags for the default `show` (pipeline.go:69-90). No free value, but an unknown first word reaches `show` as a positional and dies there with pipelineUsage (exit 1).
+- releases: args[0] in {retention,authorize} OR flags for the default list (main.go:165-178); a stray word is silently ignored by the list.
+- channels (not m-z but same pattern): main.go:149-160.
+- version: `target` or ignored anything (main.go:71-83).
+- move: args[0] in {status,cut,abort,resolve,offline} OR flags for the implicit `request` (move.go:141-150). Unknown words fall into request and produce "needs --host".
+- skills: args[0] is a free skill NAME (or flags). No sub-commands may be added under `skills`.
+- releases authorize: `<app> <version>` vs `<version>`.
+- promote `<version> [channel]`, rollback `<channel>`, remove `<host>`, services create/rotate/revoke `<name|handle>`, sidecars create/wake/rm/logs `<name>`, secrets set `KEY=value`/unset `KEY`: free values after flags; they never share a position with a word, but they are why "walk words, hand the rest to leaf" must stop at the first non-word.
+- ops: `host` exists only when env CARLOS_HOST_CLAIM is non-blank (hostclaim_cli.go:35-41).
+- system: optional component word `router` (system.go:46-49) that is stripped before the verb.
+- store scan enforce: `on`/`off` mixed with flags.
+
+### (3) Unknown words that do NOT produce a usage error
+- Silently ignored stray positionals (NArg unchecked): version (anything after, including `-h`), releases, releases retention, protection, restart, route, routes, status, update, vet, release-keygen, ratelimit show/set/clear, relay enable/status/disable/adopted/rotate, relay serve, relay keygen, secrets list, secrets genkey, services ls, schedule ls/set/rm/run, sidecars enable/ls, store create/status/grant/rotate, store scan request/status/grant/revoke/sweep/rotate-webhook-key, pipeline init/set/add/remove, ops litestream/restore-verify/hibernate-verify, system update/status/rollback/cancel-activation/apply/antivirus */geoip status|off/layout, and `help <anything>`.
+- Unknown word falling into a default child: pipeline (-> show), releases (-> list), move (-> request, "needs --host"), skills (-> treated as skill name), `version` (prints build).
+- Unknown top-level command: `default:` usage to stderr, exit 2 with no mention of the word (main.go:235).
+- Unknown at sub-level but exit 1 instead of 2 (inconsistent): proof, ratelimit, schedule, sidecars (with message), secrets/services/store/store scan (usage to stderr, exit 1), system managed-fleets unknown word (log.Fatal, exit 1). Exit 2: ops, relay, system*, move, run, flag errors from the flag package.
+- No -h at word level: proof, ratelimit, schedule, sidecars, secrets, services, store treat `-h`/`help` as an unknown word (usage + exit 1; sidecars adds `unknown subcommand "-h"`). Help-exit-0: relay (stdout), ops (stderr, exit 0), system (stderr, exit 0), system pdf/layout/managed-fleets/demos/group-maintenance (see above), flag leaves (ExitOnError, usage on stderr, exit 0), move (-h on a verb only: stdout, exit 0).
+- system antivirus / system geoip unknown verb -> message + exit 2; system seeds-floor / legacy-routes / lifetimes / hosts-used with a wrong word -> bare systemUsage (no message), exit 2.
+
+### (4) Words dispatched via map/slice, not switch
+- `offlineVerbs` slice (move.go:1005, used at move.go:145 with slices.Contains; also iterated by move_test.go:1712): stage, start, seal, flip, open, finish, abort, status.
+- scan.go:182 `takesValue` map of flag spellings (not words) used by enforce.
+- update.go:67 `noHintVerbs` map keyed by top-level cmd.
+- system.go:51-52: the long `case` string list in systemVerb is a switch case list, but it is the only place that decides which words are "system verbs" (the arms in runSystem are a second, separate switch: the two lists must be kept in sync; a verb in the first list but missing in the second falls to `default`).
+- store/relay/secrets/services/sidecars/schedule/ratelimit/proof/pipeline all use real `switch`, no maps.
+- svcrole.Parse and pipelineTemplate (pipeline init --template) validate enum FLAG values via helpers, not dispatch.
+- internal/docsite scanner reads only literal case strings (section C).
+
+### (5) Flags parsed by the parent and passed (or re-synthesised) for children
+- sidecars logs: parses --app --console --account --account-id then builds `[-app A -host H -console C -account X -account-id Y]` and calls runLogs (sidecars_cli.go:~513-521).
+- ship: parent parses the big FlagSet then calls runShipRootfs(fs, rootfsShipOpts{...}) with the same FlagSet for fs.Visit refusals (cli.go:~2503-2520; shipRootfsOnlyRefusal(fs), shipEnvRefusal(fs, ...)). `--env` is refused before anything else.
+- pipeline: every subcommand builds its set via the shared pipelineFlagSet (pipeline.go:~113) whose Usage prints the SHARED pipelineUsage block (so -h on any subcommand explains all).
+- store scan: scanTarget (scan.go:88) builds app/account/console flags into the CALLER's FlagSet, parses, validates, opens the session and resolves account/app; leaves only add their own flags BEFORE calling it (request adds --plaintext/--client-encrypted).
+- ratelimit: ratelimitFlags (ratelimit_cli.go:~111) shared by show/set/clear.
+- system host-env: raw-args scan for `--group`/`-group`/`--group=` BEFORE the real parse (hostenv/cli.go:39-45).
+- system guard-exec: re-execs the candidate binary with a constructed argv (`system apply [--recover]`, `agent`, or user args after `console <bin>`) (guardexec.go:~69-95).
+- move: one parseMoveArgs builds a different flag set per verb (move.go:152-176) and checks cross-flag rules after parse.
+- run: parseRunArgs splits at `--` first.
+- Global/destination: consoleOption (flags.go:39) registers --console AND --destination/-d on each leaf's own FlagSet; the value lands in the package-level destinationFlag read later by loadConfig; there is no global pre-parse of argv (the only os.Args reads are main.go:37/41 and cgroup/shim.go:41-46). So a generic dispatcher must not consume any flag; each leaf still declares them.
+
+### (6) Other things a generic "walk words then hand the rest to the leaf" dispatcher would break
+- Exit codes and output streams differ per level (stdout vs stderr usage, exit 0/1/2) as listed above; every bare/unknown/-h behaviour is part of the contract.
+- Std flag parsing stops at the first non-flag, so positionals-before-flags invocations (`promote 1.2.3 --app x`, `secrets set K=v --app x`, `services create name --role r`, `ship file --app a`, `rollback chan --app a`) already do not work; do not "fix" by interspersing, and do not intersperse in a generic parser either. No leaf in my scope uses an interspersing/reorder helper; the only hand-rolled parsers are ops host resolve (hostclaim_cli.go:52), system demos (system_demos.go:43), system demos reports (system_demos.go:170), roleArgs (system_roles.go:80), floor-allows-prev, named-units, store scan enforce's pre-extraction.
+- Single-dash vs double-dash: Go flag accepts both for every std flag; the manual parsers accept only the exact spellings listed (e.g. ops host resolve takes `--declare-lost` but not `-declare-lost`; demos accepts `--host`/`-host` only as two tokens).
+- Dispatch happens inside main.go bodies for `version`, `channels`, `releases` (not in a function) and inside `maybeUpdateHint` by top-level word.
+- `ops host` is conditional on an environment variable; `ops` falls to `boxops.Run` otherwise.
+- Handlers that never return (os.Exit) skip maybeUpdateHint: move, run, relay serve (SIGTERM path returns), system group-maintenance; handlers that return normally trigger it for any cmd not in noHintVerbs.
+- Pre-switch words (`__demo-snapshot`, `__registry-child`, `__rootfs-check-*`, `__cgexec`, `__cgprobe`) must stay reachable before logging/env scrubbing (cgroup shim runs before rootaws.ScrubEnvironment and before log setup) and must stay invisible to the docsite scanner.
+- Not verified in this pass: exact `route` bare behaviour (cli.go:~855-1507 body) and the per-flag lists of relay adopted/rotate, ratelimit set, sidecars create/wake/rm, store grant/rotate/status beyond what is listed.
diff --git a/docs/superpowers/specs/2026-11-09-cli-registry-design.md b/docs/superpowers/specs/2026-11-09-cli-registry-design.md
new file mode 100644
index 000000000..10be6714d
--- /dev/null
+++ b/docs/superpowers/specs/2026-11-09-cli-registry-design.md
@@ -0,0 +1,713 @@
+# The CLI command registry (slice 4, project 1 of 3)
+
+Status: rev 5, 2026-11-09. Astra round 3 of 3 (`CODEX-FINDINGS-cli-registry-R3.md`):
+READY AFTER FIXES, no P1; its three P2s are applied in rev 5, marked
+**(R3b-N)**. Review closed. Rev 2
+applied the builder check (fresh Sonnet reading spec and code; points
+marked **(builder N)**). Astra round 1 (`CODEX-FINDINGS-cli-registry.md`,
+NOT READY: two P1s in the CLI enumeration family, three P2s) hit stopping
+rule 2, since R3 of the earlier design had a P1 in the same family. Paul
+chose option A, refuse up front (the rule in A0), and ruled on production
+changes (C5). Rev 3 applied that and every round-1 finding, marked
+**(R1-N)**. Astra round 2 (`CODEX-FINDINGS-cli-registry-R2.md`, NOT READY:
+three P1s, one P2) hit rule 2 again on the tripwire; Paul cut the
+tripwire. Rev 4 applies that and the other round-2 fixes, marked
+**(R2-N)**. Slice 4 is the Carloku MCP
+connector for Claude, approved by Paul 2026-11-09 in three projects: (1)
+this registry, (2) the connector (OAuth sign-in, read tools generated from
+the registry, deploy-from-files), (3) change tools and the confirmation
+model. Design only; no product code in this branch.
+
+Round history (the count follows the design, AGENTS.md "Stopping rules"):
+this registry was section A of the slice 3 spec, reviewed by Astra three
+times (`CODEX-FINDINGS-parity-guard.md`, `-R2.md`, `-R3.md`). Round 3 left
+one P1 (R3-1: no argument model) and three P2s against it (R3-2 legacy
+leaves, R3-3 legacy conformance, R3-4 mode qualifiers, the last already
+applied in slice 3). Paul cut the registry to slice 4. This rev is a new
+design that answers R3-1 to R3-3 by construction (section "Earlier
+findings" at the end); its own review budget is three rounds.
+
+Inputs: rev 3 section A (`2ad9b6e4`), the R3 findings, slice 3 as merged
+(`fd68e4ee`: `parity/parity.tsv`, `internal/parity`, `docs/parity.md`,
+`TestParityCLITopLevel` over `docsite.TopLevelCommands`), and a read-only
+audit of every dispatcher, checked in beside this spec:
+`docs/superpowers/notes/2026-11-09-cli-dispatch-audit.md` (cited below as
+"audit A" and "audit B", with its file:line references).
+
+## Why
+
+Project 2 generates connector tools from the CLI, and the parity guard
+should see every CLI command, not only the top-level word. Both need one
+declaration of every command that the CLI really dispatches from. Rev 3
+had that tree but let dispatch consume positional values, so handlers lost
+them and commands whose deciding word follows flags (`steering --app a
+--host h latency`) had no home (R3-1).
+
+## What
+
+1. `internal/clireg`: a tree of command nodes and the one dispatcher the
+ `carlos` binary runs. Words that choose code are nodes. Everything after
+ the last word goes to the leaf unchanged, exactly as today's
+ `runX(args[1:])` hands it on.
+2. An argument model on each leaf: the leaf's own flag registration,
+ moved (not rewritten) into the node, so the flag set the leaf parses
+ with is the flag set the schema is read from; its parse strategy named;
+ and annotations for what a flag set cannot say (positionals, enums,
+ required, secret).
+3. Metadata for the connector on every leaf: effect (read, change,
+ risky), scope (none, account, app, instance, fleet, deployment, box),
+ audience, auth, locality, and whether it may become a tool.
+4. The parity guard's CLI side read from the registry: every leaf path has
+ a row, every row's CLI member is a real path, flag qualifiers name real
+ flags, and the MCP column is filled from the registry.
+5. A compatibility proof: a golden corpus recorded from the binary before
+ the change and replayed after it, plus the rule that no leaf dispatches
+ on a word (A0), held by an AGENTS.md rule and review.
+
+## Goals
+
+- Every existing invocation behaves exactly as today: stdout, stderr and
+ exit code, including flags before positionals, interspersed flags, bare
+ commands, `-h`, unknown words and their exit codes (audit A section 2,
+ audit B "Hard cases").
+- Project 2 can generate a tool schema for a leaf with no hand-written
+ second description: name, summary, typed arguments, required or not,
+ effect, and the flag that carries the account and app.
+- A new command or subcommand cannot land without its parity row, now as
+ a test rather than an AGENTS.md rule.
+
+## Non-goals
+
+- Changing any command's syntax, exit code or help text. The CLI's
+ inconsistencies (exit 1 vs 2 for an unknown word, `-h` as an unknown
+ word in some dispatchers, stray positionals silently ignored) are
+ recorded, not fixed. A later tidy can change them, one listed behaviour
+ at a time.
+- Generating `usage()` or per-command help from the registry. The help
+ text is reviewed copy and stays as written.
+- The connector itself, how a tool call executes, and the confirmation
+ model (projects 2 and 3). This project only declares what they read.
+- The console binary's own command line (`cmd/console`). It is not the
+ `carlos` CLI and has no parity rows.
+
+## Anti-goals
+
+- A second hand-kept list of commands, flags or arguments that can drift
+ from what the CLI parses.
+- Dispatch that consumes or rewrites arguments a handler later needs.
+
+## Constraints
+
+- Census: `internal/clireg` and every dispatcher it replaces are in the
+ root binary (package main, `internal/cgroup`, `internal/host`,
+ `internal/hostenv`, `internal/ops`, `internal/edge`, `internal/vet`,
+ `internal/instanceexec`, `internal/dbreads`). Every build step that
+ touches them runs `make census-card`, writes CLAIMS (class: argument
+ routing; no root-read unit added) and needs the independent reviewer's
+ approval before merge (AGENTS.md "The census"). The reviewer is Astra.
+- `internal/clireg` imports only the standard library and
+ `internal/cliflag`.
+- Tests local to touched packages; CI runs the full suite.
+- Secrets are never entered through the connector (Paul, 2026-11-09).
+ The registry must make that checkable (C4).
+
+## Design
+
+### A. The tree and the walk
+
+0. **The rule: no leaf dispatches on a word (Paul, 2026-11-09, option A;
+ R1-1, R1-2).** A word that selects code is a node, everywhere, raw
+ parsers included. A leaf may compare an argument only against the
+ declared enum values of one of its positionals (a value, A4) or
+ against flag spellings it parses itself (`raw`, B6); never against a
+ word that picks a different behaviour. Every word-first descendant of
+ a hand parser therefore becomes a node (B6 lists them), and only flag
+ and value parsing stays raw. What holds the rule: the walk for every
+ word it dispatches; `Validate` and the projection for the tree; and,
+ for code inside handlers, the AGENTS.md rule (step 1 adds it: "a word
+ that selects code is a `clireg` node; a leaf compares arguments only to
+ its declared enum values, flag spellings or ordinary value checks")
+ with branch and census review. There is no lint: Paul cut it after
+ round 2 **(R2-1)**, since it kept failing on correct code, and this
+ spec claims no mechanical proof for words inside handlers. Words the
+ walk dispatches are fully enumerated by construction.
+
+ **The one exception: box plumbing dispatchers (R2-2, R3b-2).** A
+ dispatcher that runs on a box as root (`Auth: box-root`) or as the
+ `carlos` service user (`Auth: box-service`) and does shared work before
+ it reads its word, or reads its word together with its arguments,
+ stays one `raw` leaf, and its word is an enum positional (A4) rather
+ than a set of nodes, so its order of checks and every error it prints
+ stay as they are, and the census sees no change to root-side code.
+ These are `system guard-exec` (today `floorDisk`, the policy load and
+ its checks run before the unknown-word arm, `guardexec.go:27-70`;
+ enum `apply|recover|console|edge`), `system group-maintenance`
+ (`maintenanceArguments` validates word and arity together and prints
+ its help with exit 2, `group_maintenance_verbs.go:54`), `system files`
+ (`Auth: box-service`: it refuses root and requires the `carlos` user,
+ `claimfilesseed_command.go:79`; signal context and cleanup budget set
+ before the word, `claimfilesseed_command.go:49`), `system host-env` (the `--group`
+ pre-scan, `internal/hostenv/cli.go:38`) and `system named-units`
+ (word and arity in one check, `unitops.go:96`). Their parity rows name
+ the leaf (`system guard-exec`, as `parity.tsv:225` does today) and may
+ qualify by value (`[apply]`). The args step for area 6 checks every
+ other `box-root` dispatcher against this test and adds any it finds.
+
+1. **Node.** `clireg.Node` has `Name`, `Aliases`, `Summary` (one line),
+ `Children []*Node`, `Default` (below), `DefaultOn`, `Fallback`, `Run`,
+ `Args` (section B), `Meta` (section C), `Transparent`, `When` and
+ `NoUpdateHint bool`. A node is a *branch* (has children) or a *leaf*
+ (has `Run`), never both and never neither. A node's ID is its path
+ joined with single spaces (`config destinations add`); aliases never
+ appear in IDs.
+2. **The walk.** `clireg.Dispatch(root, args)` looks at `args[0]` at each
+ branch:
+ - a child's name or alias (and its `When` true): descend, drop that one
+ word, repeat;
+ - otherwise, if the branch has a `Default` and its `DefaultOn` admits
+ this case (`absent`, `flag` for a word starting with `-`, `word` for
+ any other word), run the default leaf with **all of the remaining
+ arguments, unchanged** (the word that did not match included);
+ - otherwise call `Fallback(args, consumed)`: the dispatcher's existing
+ `default:` arm, moved verbatim (its usage text, stream, exit code,
+ its message naming the word, and its handling of `help`, `-h`,
+ `--help`, which may print and return normally with exit 0, as
+ `system`'s does). `consumed` is every word the walk dropped,
+ transparent words included, so a fallback can tell `system router`
+ from bare `system` **(builder 3)**.
+ At a leaf, `Run` receives every remaining argument unchanged. The walk
+ never consumes a flag, a flag value or a positional. This is the whole
+ difference from rev 3 and answers R3-1: no value is taken from the
+ handler, and a word after flags is not a node (A4).
+
+ **Default leaves** **(builder 9).** `Default` is either the name of a
+ child (`canary`'s `deploy`, reachable as a word too) or an *unnamed*
+ leaf reachable only as the default, whose ID is the branch's own ID
+ (`instances`, `channels`, `releases`, `version`). An unnamed default is
+ needed where naming the default would change parsing: a child named
+ `registry` under `instances` would make `instances registry
+ --registry x` parse a flag that today is never reached.
+3. **What `Default` covers, from the audit.** `canary` (any non-verb,
+ including a path, to `deploy`: audit A canary), `instances`, `channels`,
+ `releases`, `pipeline` (`show`), `move` (`request`), `version` (bare
+ print, all three cases), `config destinations` (`list`, on `absent` and
+ `flag` only; an unknown word goes to the fallback's error),
+ `email events` (on `flag`/`absent`/`word` to the non-`push` leaf),
+ `skills` (a leaf with a `name` positional, no children). Each node's
+ `DefaultOn` set is copied from the audit row, and the golden corpus (E)
+ proves it.
+4. **Words after flags are values, not nodes.** A word a leaf reads after
+ parsing its flags (`steering ... latency|off`, `env exec-delivery file|off|inherit`, `instances set-assets
+ <host> on|off`, `instance-exec <role> <iid>`, `store scan enforce
+ on|off`, the post-flag `switch verb` in `system antivirus` and `system
+ layout`) is an enum positional of that leaf (B3). The leaf's code is
+ unchanged. Parity rows that need a row per value use a qualifier
+ (`steering [latency]`), which the guard checks against the declared
+ enum (D3).
+ **`channels digests` (R3b-1)** is the opposite shape: its `on|off`
+ counts only as the first argument, and only those two words are
+ removed before flags are parsed (`channels_digests.go:160`); a
+ trailing `on` is a stray positional and refused. It is a `raw` leaf
+ with `on|off` as an enum positional, its parser unchanged (not
+ `leading`, which lifts any non-flag word). The corpus pins
+ `channels digests on -h`, `channels digests --account-id x on` and an
+ unknown leading word followed by a bad flag.
+5. **Word-first verbs whose handler is shared** (`system antivirus
+ status|enable|disable|rotate-webhook-key`, `system layout
+ status|migrate|revert`) become one child per word, each `Run` a closure
+ passing the word the shared handler already takes. Two spellings of one
+ handler are one child with an alias (`canary ls` alias `list`, `canary
+ rm` alias `delete`, `config destinations ls`/`rm` likewise), since the
+ handler's flag set name is the same for both **(builder 13)**.
+ **Whole-function dispatchers** **(builder 1).** `billing`
+ (`billing_cli.go:44`, inline cases after registering `--console`),
+ `move` (`parseMoveArgs`/`moveMain`, `move.go:138`, which tests call with
+ the verb inside `args`) and `devbox` (`c.run`, word switch plus its
+ exit-code table) cannot hand each word a separate handler without
+ splitting a function. In step 1 each of their leaves is a closure that
+ re-prepends its word and calls the old function unchanged; the old
+ function's word switch is split in that area's args step (until then
+ the switch only ever sees the word the walk already chose).
+ **Thin wrappers stay** **(builder 14).** `RunFleets`, `runDomains`,
+ `RunApps`, `runDB`, `runSystem`, `runCanary` and any other dispatcher a
+ test calls become one-line wrappers, `clireg.Dispatch(subtree, args)`,
+ so the tests keep their entry points.
+6. **Shapes the audit found, and their declaration (marked calls):**
+ - `system router <verb>`: `router` is a *transparent* child
+ (`Transparent: true`): the walk drops it once and continues at the
+ parent's children; `system router` alone and `system router router`
+ reach `system`'s fallback with the same message as today
+ (`systemUnknownVerbMessage`). Transparent nodes have no ID and no
+ row. **Call A6a.**
+ - `ops host` exists only when `CARLOS_HOST_CLAIM` is set: the child has
+ `When func() bool`; when false the walk treats the word as unmatched.
+ `ops`'s other children are `boxops.Run`'s verbs (`litestream`,
+ `restore-verify`, `hibernate-verify`, exported by `internal/ops`), and
+ its fallback is `boxops.Run`'s unknown-verb arm, so `ops host` with
+ the variable unset still prints `unknown verb host` and exits 2.
+ Coverage includes the node regardless. **Call A6b.**
+ - `move offline <verb>`: `offlineVerbs` (`move.go:1005`) is deleted;
+ the eight verbs are `move offline`'s children, and the code that
+ consulted the slice reads the registry's child list.
+ - `system`'s two word lists (`systemVerb`'s case list and
+ `runSystem`'s arms, audit B) become one child list.
+ - `version target`, `releases retention|authorize`, `channels
+ resign|digests` (dispatched inline in main's switch today) become
+ children.
+ - `help`, `-h`, `--help` at the top level: one leaf `help` with aliases
+ `-h`, `--help`, `Audience: customer`, no `Args`, `Tool: never`. It
+ keeps its parity row (`parity/parity.tsv:184`) and its heading
+ (`docs/site/cli.md`, `### carlos help`) **(builder 7)**. Below the top
+ level, help words stay inside each fallback, as today.
+7. **The update hint** **(builder 2).** `noHintVerbs` (`update.go:67`)
+ is deleted. `Dispatch` returns the path it ran, and `main` calls
+ `maybeUpdateHint` unless some node on that path has `NoUpdateHint`.
+ It is set on today's `noHintVerbs` top-level words; on `channels
+ resign`, `channels digests`, `releases retention` and `releases
+ authorize` (today they `return` from `main()` before the hint); and on
+ `__demo-snapshot` and `__registry-child` (same). Handlers that exit
+ still skip it. `canary_test.go:307` (reads `noHintVerbs`) and
+ `update_test.go:83` (calls `maybeUpdateHint("ship")`) move to the path
+ form.
+8. **Refused by `clireg.Validate`** (one negative fixture each): branch
+ and leaf at once, or neither; duplicate name or alias among siblings
+ (counting a transparent child's lifted children); `Default` naming no
+ child; `DefaultOn` empty with `Default` set; a branch with neither
+ `Default` nor `Fallback`; `Audience: internal` on a word that is not
+ `__`-prefixed; a leaf with `Args` but incomplete `Meta` (C1);
+ annotations naming a flag the leaf's flag set does not register (B4).
+ **When it runs** **(builder 6):** in a package-main test
+ (`TestCommandTreeIsValid`), not at `init` and not at dispatch.
+ Building every leaf's flag set reads defaults from the environment and
+ files (`defaultRegistry()`, `cli.go:58`), which must not happen before
+ the shim and the scrub, and costs every invocation. The root is built
+ by `commandRoot()` (a function, `sync.Once`), first called after
+ `ScrubEnvironment`; no package-level `var root`, so code that reads
+ the tree (`move`'s offline verbs) cannot make an initialization cycle.
+9. **The early phase.** `internal/cgroup` replaces its `switch os.Args[1]`
+ with a map `Shims map[string]func([]string) int` (`ShimVerb: runShim`,
+ `ProbeVerb`: a wrapper over `runProbe()`, **builder 15**), built from
+ the existing constants; `RunShimIfRequested` keeps its name, its
+ first-statement position in `main` and its `shimHooked` store, and
+ dispatches from that map. The registry declares the early words from
+ the same map's keys (`internal` leaves whose `Run` panics, since they
+ can never be reached after the early phase). One source, so the
+ enumeration cannot miss a shim word. `__demo-snapshot`,
+ `__registry-child` and `__rootfs-check-*` become ordinary `internal`
+ leaves; they keep running after the environment scrub and error
+ writer, as today.
+10. **Where subtrees live.** Packages outside main export their subtree
+ (`host.SystemCommands() []*clireg.Node`, `vet.Command()`, and so on);
+ package main assembles the root in one file, `commands.go`. `main()`
+ becomes: early phase, `ScrubEnvironment`, error writer, bare-`carlos`
+ check (unchanged), `clireg.Dispatch`, update hint.
+
+### B. The argument model
+
+1. **Moved, not rewritten** **(builder 5).** A leaf's `Args` is:
+ - `Name` (the flag set's name, as today: `"canary ls"`),
+ `ErrorHandling` (`ExitOnError` or `ContinueOnError`), `Output`
+ (`stdout`, `stderr`, or `inv.Out` for leaves whose writer is
+ injected, as `destinationsFlagSet(out, ...)` is) and `Usage` (the
+ header passed to `flagUsage`, or none for leaves with Go's stock
+ usage, such as `system seeds-floor`);
+ - `New func() (bind func(*flag.FlagSet), run func(*Invocation) error)`:
+ called once per dispatch, and once per schema read, it makes the
+ leaf's state fresh (a local struct or closure variables, never
+ package-level, so the projection, the corpus and `t.Parallel` tests
+ cannot share it). `bind` is the leaf's existing registration code
+ moved verbatim (`fs.String`, `appFlag`, `consoleOption`, shared
+ registrars such as `gateFlags`, `ratelimitFlags`,
+ `pipelineFlagSet`'s body), storing the returned pointers in that
+ state; `run` is the rest of today's handler, reading them back.
+ `clireg` creates the flag set with `Name`, `ErrorHandling` and
+ `Output`, sets `fs.Usage` from `Usage`, calls `bind`, parses with the
+ leaf's strategy and calls `run`. `Invocation` carries `FS` (the parsed
+ set, for `flagWasSet`, `fs.Visit`, `applyDestinationFlags`), `Pos`
+ (`fs.Args()`, or the strategy's positionals), `Lead` (the `leading`
+ strategy's lifted word), `Raw`, `Out` and `Err`. Registrars that
+ create their own flag set (`destinationsFlagSet`, `pipelineFlagSet`)
+ split into a set-free `bind` part and the declared `Name`/`Usage`.
+ Side effects of registration stay (`consoleOption` still points `-d`
+ at the package-level `destinationFlag`), and since only the dispatched
+ leaf's `bind` runs in production, nothing else is registered.
+
+ **Errors** **(builder 4).** Today some parents map their children's
+ errors: `RunAuth` prints `carlos auth <word>: <err>` and exits 1, `-h`
+ included (`auth.go:90-109`); `RunConfig` maps `flag.ErrHelp` to 0, a
+ flag error to 2 and others to 1; `billing` maps `ErrHelp` to 0 and
+ others to `log.Fatalf`; `devbox` has its own table
+ (`devbox_cli.go:310-328`); `accounts plan` maps `ErrHelp` to 0. A
+ branch keeps that mapping as `OnError func(path []string, err error)`,
+ moved verbatim, and `clireg` calls the nearest one on the path when
+ `run` (or a `ContinueOnError` parse) returns an error. A branch with no
+ `OnError` and a leaf returning a non-nil error is refused by
+ `Validate`; leaves that exit by themselves (`log.Fatal`) keep doing so.
+ In step 1, before `Args` exist, the same mapping sits in the leaf's
+ `Run` closure (the parent's helper wrapping the old handler).
+2. **Parse strategies are the existing helpers, moved verbatim:** `std`
+ (`fs.Parse`, stops at the first non-flag: the majority, and positionals
+ before flags keep failing as today, audit B (6)); `interspersed`
+ (`parseInterspersed` from `config_cli.go:182`, including its handling
+ of `--`); `leading` (`leadingArg`, `apps_swap.go:91`); `iplast`
+ (`ipLast`, `geo_cmd.go:95`); `raw` (the leaf parses `inv.Raw` itself).
+ The two hand-copied loops in `instances_assets.go` and
+ `instances_pages.go` become `interspersed` only if the builder shows
+ them identical, including `--`; otherwise `raw`. **Call B2.**
+3. **Positionals are annotations:** `Positionals []Positional{Name,
+ Summary, Enum []string, Required, Variadic}`. The leaf still reads
+ `fs.Args()` itself. Free text where meaning depends on other input
+ (`channels resign [<app>] <channel>`, `releases authorize`, `auth
+ default [<url>]`) goes in the positional's `Summary`; such a leaf sets
+ `Meta.Tool` to a refusal unless project 2 writes an explicit mapping.
+4. **Flag annotations** for what a flag set cannot say: `Required
+ []string`, `Enum map[string][]string`, `Secret []string` (C4), `Scope`
+ bindings (C2). Each name must be registered by the leaf's `bind` (A8), so an
+ annotation cannot name a flag that does not exist. Types come from the
+ flag set: `IsBoolFlag`, and `flag.Getter`'s value type for string, int,
+ duration and so on; a custom `flag.Value` without `Getter` is a string.
+ Aliases (`-a`) come from `cliflag.Aliases` and are not separate
+ schema entries. **Repeatable flags (R1-5):** a value type that
+ accumulates (`multiFlag` in `logs.go:48`, used by `logs --field`)
+ implements `clireg.Repeatable` (`Repeatable() bool`); the projection
+ shows it as a list of its element type, and a generated call passes one
+ occurrence per element, none when the list is empty. A test sets such
+ a flag twice through the leaf's own flag set and checks both values
+ survive, so the interface cannot be claimed by a value that overwrites.
+ A custom value that is neither a `Getter` nor `Repeatable` is a single
+ string.
+5. **What the annotations do not promise.** The handler still enforces
+ required and enum rules itself, with today's messages and exit codes.
+ An annotation that is wrong makes a generated tool call fail with the
+ handler's own error; it cannot make the CLI accept or run anything new.
+ The one annotation with a safety role, `Secret`, is checked from the
+ other side (C4). Enum annotations on payload values are schema only;
+ the code that reads them is held by A0's rule and review.
+6. **Raw leaves: flags and values only (A0, R1-1).** A `raw` leaf parses
+ its own flags and values, unchanged, including today's bugs (`store
+ scan enforce -a on`, audit B (1)). It never chooses between
+ subcommands: every word a hand parser used to dispatch on is a node,
+ and the raw leaf is what runs at the end of that path. The hand
+ parsers and the nodes their words become (audit B lines cited):
+ - `system demos` (`system_demos.go:19`): children `status`,
+ `serving`, `takedown`, `takedown-status`, and `reports` (a branch:
+ child `resolve`, and an unnamed default on `absent`/`flag`/`word`
+ for the list). Each leaf runs today's manual flag loop and its
+ after-loop checks, unchanged; `serving`'s `on|off` is an enum
+ positional. Today every error, an unknown verb included, prints
+ `systemDemosInvalid` and exits 2, and `help`/`-h`/`--help` as the
+ only argument prints to stdout and exits 0: `demos`'s fallback does
+ exactly that, and so does each leaf for its own errors, so the order
+ in which a bad verb and a bad flag are noticed cannot show
+ (every case prints the same text and code). The corpus has cases for
+ a bad verb with a bad flag, both orders.
+ - `system box`: children `role` (raw leaf: `roleArgs`, `<box> <role>`
+ then optional `--console V`) and `publish-record` (std leaf);
+ `system group`: child `role`. Fallback: `systemUsage`, exit 2.
+ - `system guard-exec`, `system group-maintenance`, `system files`,
+ `system host-env`, `system named-units`: not split; one raw leaf
+ each with an enum positional (A0's root-run exception, R2-2). The
+ corpus pins `guard-exec` with an unknown word under both
+ configurations (`CARLOS_RELEASE_PUBKEY` unset, and a test key), and
+ the spellings it re-execs (`system apply [--recover]`, `agent`).
+ - `ops host`: child `resolve` (raw leaf, `hostclaim_cli.go:52`).
+ Raw leaves keep ordinary value checks (`args[1] == ""` at
+ `system_demos.go:184`, `instance-stop`'s empty pid at
+ `stop_linux.go:52`): A0 allows them **(R2-1)**.
+ Raw leaves with no words to lift: `system floor-allows-prev`,
+ `instance-control`, `instance-exec` and `instance-exit` (the role is
+ an enum positional), `instance-stop`, `agent`, `edge`, `adopt`
+ (startup work before `fs.Parse`, `agent.go:5643-5671`, **builder
+ 12**), `run` (`--` split), `store scan enforce` (`on|off` is an enum
+ positional), and any other leaf the args step finds doing work before
+ its parse. Raw leaves carry positional and flag annotations as text
+ only and can never become tools (C3). All but `run` and `store scan
+ enforce` are box-local, operator or internal. **Call B6.**
+
+### C. Metadata for the connector
+
+1. **Required on every leaf with `Args`:** `Effect` (`read` | `change` |
+ `risky`), `Scope` (`none` | `account` | `app` | `instance` | `fleet` |
+ `deployment` | `box`), `Audience` (`customer` | `operator` |
+ `box-local` | `internal`), `Auth` (`none` | `console-login` |
+ `operator` | `box-root` | `box-service`, the `carlos` service user on
+ a box), `Locality` (`api`: the command's effect is a
+ console API call; `local`: it reads or writes this machine, such as
+ `config`, `update`, `devbox`, `auth login`; `box`: it runs on a host),
+ `Tool` (C3). Before a leaf's args step (F), only `Audience` is required.
+2. **Scope binding (R2-4).** `Scope` names what carries each part:
+ `account` binds `--account`/`--account-id` (`accountFlags`); `app`,
+ `instance` and `fleet` each bind either a flag (`--app`, `--host`,
+ `--fleet`) or a declared positional, the leading one included (`apps
+ delete <app>` registers no `--app`, `apps.go:243`; `instances set
+ <host>` takes the leading positional, `instances_updates.go:96`).
+ Where a leaf accepts both (`apps set` takes `<app>` or `--app` and
+ refuses two different names, `apps_swap.go:100-114`), the binding names
+ the one form project 2 fills, and the other is listed so the connector
+ never sets both. `Validate` checks each binding names a flag the leaf's
+ `bind` registers or a positional it declares. Project 2 uses the
+ bindings to fill these from the connection's picked accounts and
+ refuse any other.
+3. **`Tool`:** `eligible`, or `never` with a reason. `eligible` requires
+ `Audience: customer`, `Locality: api`, a strategy other than `raw`, no
+ positional whose meaning depends on other input (B3), no required
+ `Secret` flag, and no `Sensitive` mark (C4); `Validate` refuses
+ anything else. Optional `Secret`
+ flags are dropped from the generated schema. The tool name is the ID
+ with spaces as underscores (`apps_set`, `apps_build-probe`), within
+ MCP's 64-character name limit (checked).
+4. **Secrets, at the leaf (R1-4).** `Meta.Sensitive` marks a leaf that
+ reads a secret by any route (`flag`, `positional`, `stdin`, `prompt`)
+ or prints a credential (`prints`), each with a one-line reason. Either
+ makes `Tool: eligible` invalid (C3), whatever its flags say. A
+ regression test names the leaves that must carry it and must be
+ `never`, at least: `secrets set`, `secrets genkey`, `gate set`
+ (password on stdin, `gate_cli.go:119`), `services create` and
+ `services rotate` (print a token, `services.go:284`), `fleets
+ create`, `fleets add-box` and `fleets rotate-token` (box tokens print
+ once), `email credentials create`, `release-keygen`, `proof keygen`,
+ `relay keygen`; the args step for each area adds any others it finds.
+ As a supplementary check, a test lists every leaf whose flag set
+ registers a flag whose name contains `password`, `secret`, `token` or
+ `key` and requires `Secret` on that flag or an explicit `NotSecret`
+ with a reason.
+5. **Effect classification rule.** `read` changes nothing; `risky` is
+ irreversible or loses data (delete, purge, restore over, revoke),
+ changes who can reach or administer something (roles, tokens, gate,
+ protection off, domains detach), moves money (billing, packs) or
+ touches a whole account; `change` is every other write. **Paul,
+ 2026-11-09:** deploying, promoting, rolling back and restarting an
+ app's production are `change` (Claude acts and reports); deletions
+ stay `risky`. A flag or enum value can raise a leaf
+ (`RiskyWhen: {"--yes": ..., "off": ...}`); nothing lowers one.
+
+### D. The parity guard, from the registry
+
+1. **A projection file.** `parity/cli.tsv` holds one line per node that
+ runs (every leaf, named or unnamed default), with ID, audience, effect,
+ scope, tool name, and declared flags and enum values. Nothing outside
+ package main can import the tree **(builder 10)**, so the writer is a
+ package-main test: `TestCLIProjection` fails if the file is stale and
+ rewrites it under `-update`; `make parity-doc` runs `go test -run
+ '^TestCLIProjection$' -update .` before its existing generator. It is
+ the only bridge: `internal/parity` and `internal/docsite` read this
+ file and never import package main. No hidden CLI word writes it.
+2. **Coverage, replacing `TestParityCLITopLevel`:** every non-internal
+ projected ID is some row's CLI member (with or without qualifier);
+ every row's CLI member is a projected ID or an `internal` early word.
+ Below the top level nothing is hand-kept any more. Fixtures: removing a
+ leaf's row fails while its parent's row remains (the R3-2 case);
+ a row naming `apps source delete` fails (the R3-3 case).
+3. **Qualifiers (R3b-3).** A qualifier is split on commas and each
+ component trimmed. A component starting with `-` must name a flag the
+ leaf declares (`[--swap,--swap-concurrency]`); other components are
+ free text, so mixed qualifiers keep working (`env set [--environment,
+ existing bundle]` and `[--environment, new bundle]`,
+ `parity.tsv:51`, stay positive fixtures; a mixed qualifier naming an
+ undeclared flag is the negative one). Flags are checked only once the
+ leaf has `Args`; a single-word qualifier that matches one
+ of the leaf's enum values is checked as that value; other word
+ qualifiers stay free text (slice 3 C2, R3-4).
+4. **The MCP column** is filled from `parity/cli.tsv`: the tool names of
+ the row's eligible CLI members, comma-separated, or empty. The guard
+ fails when it differs. Until project 2 ships, `docs/parity.md` heads
+ the column "MCP tool (planned)".
+5. **Audience and status (R2-3).** The guard checks one line, customer
+ versus outside: a leaf with `Audience: customer` must appear in at
+ least one row with a customer status, and a leaf with an outside
+ audience (`operator`, `box-local`, `internal`) may appear only in rows
+ with outside statuses, any of them. Which outside status a row carries
+ is the row's call, since one leaf's flag-selected modes can differ
+ (`status [--instances,--layout]` and `status [--live]` are `operator`,
+ `parity.tsv:191-192`; `status [--dry-run]` is `box-local`,
+ `parity.tsv:226`; the leaf is `operator`). Those three rows are the
+ positive fixture; a `customer` leaf in only an `operator` row, and an
+ `operator` leaf in a `both` row, are the negative ones. Today's
+ statuses are unchanged.
+
+### E. Compatibility proof
+
+1. **The golden corpus** **(builder 11).** A package-main test,
+ `TestCLIGolden`, derives argv lists from the tree (only package main
+ can read it): for every branch, bare, `help`, `-h`, `--help`, an
+ unknown word and an unknown flag; for every leaf, `-h` and an unknown
+ flag; and for each leaf with `Args`, its own `GoldenArgs` (written by
+ hand in the args step, since only the leaf's author knows which values
+ fail before any I/O): the positional-first, flags-first, interspersed
+ and `--` forms its strategy accepts. Nodes marked `Golden: skip` with a
+ reason (daemons such as `edge`, `agent`, `relay serve`; anything that
+ would touch a box or the terminal) are listed in the file as skipped.
+ Also, for every alias, the same cases spelled with the alias; for
+ every transparent word, the cases with it (`system router ...`,
+ `system router` alone, `system router router`); and for every node
+ with `When`, its cases with the condition true and false (`ops host`
+ with `CARLOS_HOST_CLAIM` set and unset) **(R1-3)**.
+ **Environment (R1-3).** Each case starts from an empty environment and
+ gets exactly: `PATH` (the test's own), `HOME` and the working
+ directory (an empty directory under `$TMPDIR`), `TMPDIR`, `LANG=C`,
+ `HTTP_PROXY`/`HTTPS_PROXY` pointed at a closed local port (any
+ network attempt fails at once and the same way), and the case's own
+ variables (a `When` case's switch). Nothing inherited reaches the
+ binary, so `rootaws`'s scrub alert (`environment.go:59`) and any
+ `CARLOS_*` or `AWS_*` setting cannot change stderr. A case has a
+ 10-second limit, and running past it **fails** the test. The only
+ skips are nodes marked `Golden: skip` with a reason, listed in the
+ file and reviewed with the branch. It records stdout, stderr
+ and exit code, with `log`'s date-time prefix (`^\d{4}/\d\d/\d\d
+ \d\d:\d\d:\d\d `) and the temporary paths normalised, on record and
+ on replay alike.
+2. **Record once, replay always.** `go test -run '^TestCLIGolden$'
+ -record -base <sha> .` extracts the base commit with `git archive`
+ into a directory under `$TMPDIR`, builds it there, runs the cases, and
+ writes `testdata/clireg-golden.tsv`; it removes the directory after.
+ Without `-record` the test replays the file against the current binary
+ (`sharedCarlos`, already built by `main_test.go`). Step 1 records
+ from its merge base; each args step adds its leaves' `GoldenArgs` cases
+ recorded from its own merge base. A step that changes behaviour on
+ purpose re-records and lists each changed line in its PR; project 1
+ itself changes none.
+3. **No word-dispatch lint.** Rev 3's tripwire (E3) is cut (Paul,
+ after round 2; A0).
+
+### F. Migration
+
+The guard covers every path the walk dispatches once the words are in the
+registry (with A0 holding the words inside handlers), so the words go
+in one branch and the arguments follow by area. **Call F0:** no legacy
+adapter, no opaque nodes; this removes R3-2 and R3-3 rather than patching
+them.
+
+- **Step 1, words (one branch, one census card).** The AGENTS.md rule
+ (A0), `internal/clireg`
+ (walk, `Validate`, `Invocation`, strategies, `OnError`), every
+ dispatcher's `switch` turned into nodes (about 50 dispatchers and their
+ nested ones, audit A and B), `Run` on each leaf as
+ `clireg.RawArgs(...)` over the old handler (unchanged, receiving its
+ args, wrapped in the parent's error mapping where one exists), the
+ early phase (A9), `commandRoot()` in `commands.go`, `NoUpdateHint`
+ (A7), the corpus recorded from the merge base and replayed (E1-E2), the
+ raw parsers' words lifted into nodes (B6), `parity/cli.tsv` and the new coverage
+ guard (D2, D5), the docsite move (G), and the parity rows the full
+ coverage newly demands. Built as one task per area so each commit is
+ reviewable; merged once so the guard never has a half state. Only
+ `Audience` is required on leaves here.
+- **Steps 2 to 6, arguments by area** (each one branch and census card):
+ (2) apps, appconfig, env, secrets, features, assets, domains, routes;
+ (3) instances, sidecars, schedule, db, logs, errors, availability,
+ analytics, geo, explain; (4) ship, deploy, canary, promote, rollback,
+ channels, pipeline, releases, version, skills, gate, ratelimit,
+ protection, steering; (5) store, email, relay, services, fleets,
+ accounts, auth, billing, ledger, devbox, config, update; (6) system,
+ ops, move, economics, proof, status, the host, edge, vet and
+ instanceexec subtrees. Each moves registration into `Args.New` (B1),
+ names the strategy, writes annotations, metadata and `GoldenArgs`,
+ splits its area's whole-function dispatchers, and replays the corpus. Customer areas go first because
+ project 2 needs them.
+- **Step 7:** `RawArgs` is allowed only on `raw`-strategy leaves (B6);
+ `Validate` refuses it elsewhere.
+
+### G. Docsite
+
+`docsite.TopLevelCommands` and `cliscan.go` are deleted. Their three
+callers (`internal/docsite/cli_test.go`, `fences_test.go`,
+`internal/parity/repo_test.go`) read the top-level projection from
+`parity/cli.tsv` (non-internal, non-alias top-level names). Step 1's
+corpus of the projection is pinned against today's scanner output in a
+one-off assertion, so the move changes no doc check; the scanner's
+non-vacuity test becomes one on the file (at least 20 commands; `ship`,
+`deploy`, `fleets` present; no `-h`). `canary_test.go`'s string search of
+`main.go` becomes a registry lookup that `canary` is a branch with a
+`deploy` default.
+
+## Calls made (the builder may question any of these)
+
+- **A2/F0:** dispatch consumes words only; no legacy adapter; words
+ migrate in one branch.
+- **A3:** branches with a default keep today's absorbing behaviour exactly,
+ per-case (`DefaultOn`).
+- **A4:** words after flags are enum positionals, not nodes.
+- **A6a, A6b:** `system router` is transparent; `ops host` is conditional.
+- **A9:** shim words enumerated from cgroup's own map.
+- **B1:** registration moves into the node (`Args.New`) rather than being redeclared
+ in a schema DSL, so help output and parsing cannot change.
+- **B2, B6:** hand loops and hand parsers keep their flag and value
+ parsing (`raw`) unless proven identical; their words become nodes (A0).
+- **A0 (R2-2):** root-run dispatchers with shared pre-dispatch work stay
+ one raw leaf with an enum positional; the area-6 args step finds any
+ others.
+- **D5 (R2-3):** the guard checks customer versus outside only; the
+ outside status is the row's call.
+- **C2 (R2-4):** a binding names one flag or positional; where a leaf
+ takes both, the other is listed so the connector never sets both.
+- **C4:** `Sensitive` is a leaf-level mark covering stdin, prompts and
+ printed credentials, with a named regression list.
+- **C3:** tool eligibility is decided in the registry, refused for raw,
+ local, secret-taking and ambiguous-positional leaves.
+- **D1:** one generated projection file is the bridge to `internal/parity`
+ and `internal/docsite`.
+- **E2:** byte-for-byte is checked by replay against the base binary, not
+ argued.
+- Help text, exit-code inconsistencies and silent stray positionals are
+ preserved (Non-goals).
+- From the builder check: `Fallback(args, consumed)` (A2); unnamed
+ default leaves (A2); whole-function dispatchers wrapped in step 1 and
+ split in their args step (A5); the update hint skipped per path (A7);
+ `Validate` in a test and the root built lazily after the scrub (A8);
+ `Args.New` with fresh per-dispatch state and `OnError` per branch
+ (B1); the projection written by a package-main test (D1); hand-written
+ `GoldenArgs` and a closed proxy for the corpus (E1); `help` stays a
+ customer row (A6).
+
+## Paul's rulings (2026-11-09)
+
+1. **Option A after round 1 (stopping rule 2):** refuse up front. No leaf
+ dispatches on a word; every word-first descendant of a raw parser is a
+ node; raw parsing only for flags and values; the AGENTS.md rule and
+ branch and census review hold dispatch inside handlers (A0, B6).
+3. **Option A after round 2 (stopping rule 2 again):** cut the tripwire.
+ Walk-dispatched words stay fully enumerated; payload enums keep their
+ schema annotations (A0, E3). Root-run dispatchers with shared
+ pre-dispatch work stay one raw leaf with an enum positional; audience
+ is checked customer versus outside, per row; scope bindings name a
+ flag or a positional.
+2. **Production changes are `change`:** deploy, promote, rollback and
+ restart of an app's production act and report; deletions stay `risky`
+ (C5).
+
+## Earlier findings, where they went
+
+- **R3-1 (no argument model; P1):** A2 (walk consumes words only; leaf
+ gets all arguments), A4 (post-flag words are enum positionals), B1-B2
+ (values arrive through the leaf's own flag set and strategy), E1
+ (positional-first, flags-first and interspersed fixtures).
+- **R3-2 (legacy leaves without `Run`):** no legacy adapter (F0); every
+ leaf has `Run`; D2's fixture covers a leaf row removed under a kept
+ parent.
+- **R3-3 (string presence is not path conformance):** no declared legacy
+ trees; paths are what the walk dispatches; D2's `apps source delete`
+ fixture.
+- **R3-4 (mode qualifiers):** already in slice 3; D3 adds checking where
+ a qualifier names a flag or enum value.
+- **R3-5 (console scanners):** slice 3, unaffected.
+- **R1-1 (raw leaves dispatch words; P1):** A0 and B6: every word of a
+ hand parser is a node; raw parsing for flags and values only.
+- **R1-2 (lint misses forms, flags manual flag parsers; P1):** the lint
+ is cut (A0, Paul after round 2); the rule is held by AGENTS.md and
+ review.
+- **R1-3 (corpus):** E1: alias, transparent and `When` cases; empty
+ environment plus an explicit list; timeouts fail; reviewed skips only.
+- **R1-4 (secrets):** C3 and C4: leaf-level `Sensitive`, named
+ regression list.
+- **R1-5 (repeatable flags):** B4: `clireg.Repeatable`, checked by
+ setting twice.
+- **R2-1 (tripwire rejects kept value checks; P1):** tripwire cut (A0,
+ E3); B6 notes value checks are allowed.
+- **R2-2 (guard-exec fallback reorders root checks; P1):** A0's root-run
+ exception; B6; corpus cases under both configurations.
+- **R2-3 (one audience vs the status rows; P1):** D5, with today's three
+ status rows as the positive fixture.
+- **R2-4 (positional scope targets):** C2.
+- **Round 3 (READY AFTER FIXES):** R3b-1 `channels digests` kept raw
+ with its leading-only parser (A4); R3b-2 `system files` is
+ `box-service`, not `box-root` (A0, C1); R3b-3 mixed qualifiers checked
+ per component (D3).
diff --git a/docs/superpowers/specs/CODEX-FINDINGS-cli-registry-R2.md b/docs/superpowers/specs/CODEX-FINDINGS-cli-registry-R2.md
new file mode 100644
index 000000000..0259d6c9b
--- /dev/null
+++ b/docs/superpowers/specs/CODEX-FINDINGS-cli-registry-R2.md
@@ -0,0 +1,59 @@
+- **R1-1: Resolved** — B6 now declares the missing raw-parser descendants, including `demos reports resolve`.
+- **R1-2: Partly resolved** — the accepted completeness limitation is explicit, but E3 still rejects preserved value validation.
+- **R1-3: Resolved** — alias, transparent-path and conditional cases, controlled environments, and failing timeouts are specified.
+- **R1-4: Resolved** — leaf-level `Sensitive` metadata and named regression checks cover secret input and credential output.
+- **R1-5: Resolved** — repeatability metadata and accumulation checks address collection-shaped flags.
+
+Reviewed checkout `3df51abac189439d86a62fb2200f6d834f676f88`, with the spec unchanged from `ece49d77`.
+
+1. **P1 — E3/B6: The tripwire still rejects correct, preserved parsers.**
+
+ [E3, lines 514–538](docs/superpowers/specs/2026-11-09-cli-registry-design.md:514) flags argument-derived strings compared with literals. Its permanent exceptions cover positional enums, raw flag spellings and fallback help.
+
+ Existing checks fall outside all three: the reports parser rejects an empty flag value with `args[1] == ""` at [system_demos.go:184](system_demos.go:184); `instance-stop` accepts an empty PID argument at [stop_linux.go:52](internal/instanceexec/stop_linux.go:52). B6 explicitly preserves both parsers.
+
+ **Failure:** Once `pending` is forbidden, the tripwire fails on unchanged value validation. Neither argument is a closed positional enum, and an empty string is not a flag spelling.
+
+ **Fix:** Add a narrowly checked allowance for ordinary value validation, with these two positive fixtures. Keep the separate prohibition on handler-owned command dispatch.
+
+ **Fault family:** Enforcement of the registry as the sole command inventory. This carries R1-2 forward; it concerns false positives, not evasion of the tripwire.
+
+2. **P1 — A2/B6: The specified `guard-exec` fallback changes existing errors and root-side ordering.**
+
+ [B6:373](docs/superpowers/specs/2026-11-09-cli-registry-design.md:373) specifies an immediate `log.Fatal(hostfloor.ErrFloor)` fallback.
+
+ Today, any nonempty argument list first calls `floorDisk`, loads the policy and performs applicable policy checks, before reaching the unknown-word arm: [guardexec.go:27](internal/host/guardexec.go:27), [guardexec.go:70](internal/host/guardexec.go:70).
+
+ **Failure:** With `CARLOS_RELEASE_PUBKEY` unset, `carlos system guard-exec unknown` currently reports the public-key parsing error from [release.go:721](internal/release/release.go:721). The proposed fallback instead reports `hostfloor: authenticated floor required`. With valid configuration, it also skips the preceding policy reads and checks.
+
+ **Fix:** Preserve the common pre-dispatch checks for nonempty unmatched arguments before emitting the existing fallback. Keep the bare-command refusal separate. Add compatibility fixtures for both configuration states and describe the affected root checks explicitly in the census claims.
+
+ **Fault family:** Byte-for-byte compatibility and preservation of root validation order.
+
+3. **P1 — D5/F1: One leaf audience cannot satisfy the existing `status` rows.**
+
+ [D5:468](docs/superpowers/specs/2026-11-09-cli-registry-design.md:468) requires the matching outside status while preserving today’s statuses.
+
+ The same `status` leaf appears in operator rows at [parity.tsv:191](parity/parity.tsv:191) and a box-local row at [parity.tsv:226](parity/parity.tsv:226). These are flag-selected modes of one handler, as verified at [cli.go:3945](cli.go:3945).
+
+ **Failure:** Assigning `Audience: operator` rejects the box-local row; assigning `box-local` rejects the operator rows. Assigning `customer` violates the rule against a customer leaf appearing only in outside rows. Step 1 introduces this guard immediately.
+
+ **Fix:** Specify qualifier-aware audience classification, or permit these distinctions among outside rows while retaining the customer-coverage check. Add the existing three `status` rows as a positive fixture.
+
+ **Fault family:** Agreement between leaf metadata and capability-level parity classification.
+
+4. **P2 — C2: Scope bindings omit positional app and instance targets.**
+
+ [C2:405](docs/superpowers/specs/2026-11-09-cli-registry-design.md:405) binds app scope through `--app` and instance scope through `--host`; only fleet scope explicitly permits a positional binding.
+
+ `apps delete` takes its app positionally and registers no `--app`: [apps.go:243](apps.go:243). `instances set` takes its host through the leading positional or `fs.Arg(0)` and registers no `--host`: [instances_updates.go:96](instances_updates.go:96).
+
+ **Failure:** Correct scope annotations cannot pass the specified flag-existence check for these leaves. Project 2 would need an additional mapping or unnecessarily exclude them.
+
+ **Fix:** Let each scope binding reference either a registered flag or a declared positional, including the leading positional. Validate both forms and their precedence.
+
+ **Fault family:** Faithful argument-schema and target-scope projection.
+
+R1-2’s fault family has recurred in consecutive rounds; stopping rule 2 applies before another fix cycle. No files were edited, subagents spawned, or tests run.
+
+**NOT READY**
\ No newline at end of file
diff --git a/docs/superpowers/specs/CODEX-FINDINGS-cli-registry-R3.md b/docs/superpowers/specs/CODEX-FINDINGS-cli-registry-R3.md
new file mode 100644
index 000000000..5ba794e5a
--- /dev/null
+++ b/docs/superpowers/specs/CODEX-FINDINGS-cli-registry-R3.md
@@ -0,0 +1,40 @@
+- **R2-1: Resolved** — the tripwire is removed; ordinary value validation remains allowed.
+- **R2-2: Resolved** — `guard-exec` stays intact as a raw leaf, preserving its pre-dispatch checks.
+- **R2-3: Resolved** — D5 permits different outside statuses for the same leaf.
+- **R2-4: Resolved** — C2 supports flag and positional scope bindings.
+
+Reviewed `5c9710481620609dc9e5b59bc6906dc7d01704b0`; the spec matches `7e78de46d129c5d570dee6525e42b210bf2d4269`. No P1 findings.
+
+1. **P2 — A4/B2/B6: `channels digests` needs its leading-only enum parser explicitly preserved.**
+
+ [A4:195](docs/superpowers/specs/2026-11-09-cli-registry-design.md:195) describes `on|off` among words read after parsing flags. In fact, [channels_digests.go:160](channels_digests.go:160) removes only a leading `on` or `off`, then parses flags and rejects remaining positionals.
+
+ **Failure scenario:** Treating this as an ordinary post-flag enum rejects the supported leading form or accepts the currently refused trailing form. Generic `leadingArg` also differs: it removes any leading non-flag word, whereas this parser removes only `on|off`.
+
+ **Fix:** Explicitly retain this leaf’s parser as `raw`, with its enum annotation. Pin cases such as `channels digests on -h`, `channels digests --account-id x on`, and an unknown leading word followed by an invalid flag.
+
+ **Fault family:** Byte-for-byte argument-parsing compatibility.
+
+2. **P2 — A0/C1: `system files` is incorrectly classified as root-run.**
+
+ [A0:133](docs/superpowers/specs/2026-11-09-cli-registry-design.md:133) defines the exception through `Auth: box-root` and includes `system files`. However, [claimfilesseed_command.go:79](internal/host/claimfilesseed_command.go:79) requires the effective UID to equal the non-root `carlos` user. Root is refused. Its root capability check happens separately at [line 100](internal/host/claimfilesseed_command.go:100).
+
+ **Failure scenario:** Following the stated classification produces metadata claiming root is the required caller, although that caller cannot execute the operation.
+
+ **Fix:** Retain the explicitly named raw exception and its signal/cleanup ordering, but describe it as delegated box-service plumbing. Represent its actual service-user prerequisite rather than assigning `box-root`.
+
+ **Fault family:** Accurate caller-authority metadata.
+
+3. **P2 — D3: Mixed flag-and-prose qualifiers need an explicit checking rule.**
+
+ [D3:489](docs/superpowers/specs/2026-11-09-cli-registry-design.md:489) distinguishes flag qualifiers from word qualifiers without specifying mixtures. Existing rows contain `--environment, existing bundle` and `--environment, new bundle` at [parity.tsv:51](parity/parity.tsv:51). These are expressly accepted by [rules_test.go:148](internal/parity/rules_test.go:148).
+
+ **Failure scenario:** Classifying the entire qualifier by its initial `--` and checking every comma-separated component as a flag rejects these valid rows. Treating the entire mixture as prose instead leaves its flag reference unchecked.
+
+ **Fix:** Specify checking individual flag-shaped components against declared flags while preserving descriptive components as free text. Keep both existing environment rows as positive fixtures and add a mixed qualifier containing an undeclared flag as a negative fixture.
+
+ **Fault family:** Capability qualifiers preserved while validating flag references.
+
+No files changed, subagents spawned or tests run. These P2s can be fixed without another review round; implementation census obligations remain.
+
+**READY AFTER FIXES**
\ No newline at end of file
diff --git a/docs/superpowers/specs/CODEX-FINDINGS-cli-registry.md b/docs/superpowers/specs/CODEX-FINDINGS-cli-registry.md
new file mode 100644
index 000000000..4291255b0
--- /dev/null
+++ b/docs/superpowers/specs/CODEX-FINDINGS-cli-registry.md
@@ -0,0 +1,65 @@
+- **R3-1: Resolved** — the walk preserves arguments; `Invocation` and the parse strategies cover the three required examples.
+- **R3-2: Resolved** — runnable leaves and explicit leaf coverage replace the contradictory legacy-terminal model.
+- **R3-3: Partly resolved** — ordinary nodes bind paths to dispatch, but raw dispatchers and unchecked temporary exceptions leave gaps.
+
+Reviewed `a28fcfa68ca060884c59a3dbab2e4eb42163ac9e`, round 1.
+
+1. **P1 — B6/D2/F: Raw leaves contradict complete verb-path coverage.**
+
+ [B6](docs/superpowers/specs/2026-11-09-cli-registry-design.md:322) declares `system demos` a raw leaf whose handler remains unchanged. That handler dispatches `reports`, then other verbs, and its reports handler dispatches `resolve`: [system_demos.go:29](system_demos.go:29), [system_demos.go:69](system_demos.go:69), [system_demos.go:164](system_demos.go:164).
+
+ **Failure:** Following B6 projects only `system demos`. D2 then rejects the existing descendant members in [parity.tsv:213](parity/parity.tsv:213). Collapsing that row would instead abandon the promised subcommand coverage. A node cannot also retain those children under A1’s branch-or-leaf rule.
+
+ **Fix:** Separate raw argument parsing from word dispatch. Declare every word-first descendant, including the unnamed default under `reports`, and specify wrappers or shared handlers that preserve the original parsing and error order.
+
+ **Fault family:** Complete CLI enumeration and declaration-to-dispatch agreement.
+
+2. **P1 — E3: The lint misses real dispatch and rejects preserved manual parsing.**
+
+ [E3](docs/superpowers/specs/2026-11-09-cli-registry-design.md:433) detects comparisons of indexed arguments or `Arg()` calls against at least two literals. Existing dispatch uses both a single comparison (`reports`, [system_demos.go:29](system_demos.go:29)) and a local variable copied from arguments (`verb`, [internal/ops/ops.go:33](internal/ops/ops.go:33)). Neither form meets that rule.
+
+ Conversely, the manual flag switch at [system_demos.go:50](system_demos.go:50) matches it. Its literals are flag spellings, not positional enum values, so neither final allowance applies.
+
+ **Failure:** A new subcommand using either missed form can land without a node or parity row. Preserving the manual parser as B6 requires makes the lint fail when `pending` is prohibited. During migration, an unpinned `pending` marker also permits additional cases without checking the registry.
+
+ **Fix:** Specify and test rejection of single-word dispatch, argument-derived locals and dispatch tables. Add a narrowly checked allowance for raw flag parsing. Pin temporary exceptions to their existing cases and bindings so extending one requires registry coverage.
+
+ **Fault family:** Enforcement of the registry as the sole command inventory.
+
+3. **P2 — E1/E2: The corpus omits important paths and is not fully deterministic.**
+
+ [E1](docs/superpowers/specs/2026-11-09-cli-registry-design.md:405) clears every `CARLOS_*` variable, specifies no alias or conditional-node matrix, and converts timeouts into skips.
+
+ **Failure:** `ops host` is never exercised while enabled; its real condition is at [hostclaim_cli.go:35](hostclaim_cli.go:35). Alias and transparent-path regressions can also escape the prescribed cases. A hang can become a skip. Additionally, inherited AWS settings can change stderr before parsing: root emits an alert when scrubbing them at [environment.go:59](internal/rootaws/environment.go:59). Timestamp and path normalization do not remove that difference.
+
+ **Fix:** Require alias and transparent-path cases, both outcomes of every `When`, and an explicit controlled environment for each case. Fail unexpected timeouts; permit only reviewed, predetermined skips.
+
+ **Fault family:** Deterministic and sufficiently complete compatibility evidence.
+
+4. **P2 — C3/C4: The specified checks do not enforce the secret-taking exclusions.**
+
+ [C3/C4](docs/superpowers/specs/2026-11-09-cli-registry-design.md:350) forbid known secret-taking leaves, but validation rejects only required secret flags; the backstop checks flag names and annotations.
+
+ **Failure:** An accidental `eligible` classification for `gate set` passes those checks when its optional `password` flag is correctly annotated and omitted from the schema. The handler still reads a password from stdin: [gate_cli.go:119](gate_cli.go:119), [gate_cli.go:145](gate_cli.go:145). Credential-producing commands can have no suspicious input flag at all; service creation prints its token at [services.go:284](services.go:284).
+
+ **Fix:** Represent sensitive positional/stdin input and credential output at leaf level, make either incompatible with eligibility, and add regression assertions for the explicitly forbidden leaves. Keep the flag-name scan as the supplementary check described.
+
+ **Fault family:** Secrets excluded from connector tools.
+
+5. **P2 — B4: Repeatable flags lose their argument shape.**
+
+ [B4](docs/superpowers/specs/2026-11-09-cli-registry-design.md:307) maps custom values without `Getter` to strings and provides no repeatability annotation.
+
+ `logs --field` uses `multiFlag`, which has only `String` and `Set`: [logs.go:48](logs.go:48), [logs.go:150](logs.go:150).
+
+ **Failure:** A generated schema represents one string and cannot express two independent field filters without an additional handwritten convention, contrary to the schema-generation goal.
+
+ **Fix:** Add checked repeatability metadata or a supported value interface exposing collection shape. Verify that multiple schema values become repeated occurrences while preserving omission and explicit values.
+
+ **Fault family:** Faithful argument-schema projection.
+
+The specified early-phase ordering and `shimHooked` behavior match the current code. Census approval must still assess the implementation; this design review does not establish the blanket “no root-read unit added” claim.
+
+No files changed, subagents spawned, or tests run. Findings 1 and 2 block readiness.
+
+NOT READY
\ No newline at end of file
diff --git a/docs/superpowers/specs/CODEX-REVIEW-BRIEF-cli-registry.md b/docs/superpowers/specs/CODEX-REVIEW-BRIEF-cli-registry.md
new file mode 100644
index 000000000..fbe459576
--- /dev/null
+++ b/docs/superpowers/specs/CODEX-REVIEW-BRIEF-cli-registry.md
@@ -0,0 +1,107 @@
+# Review brief: CLI command registry spec, round 3 of 3
+
+Repo carlos/platform, branch `design-cli-registry`, commit 7e78de46d129c5d570dee6525e42b210bf2d4269.
+Under review: `docs/superpowers/specs/2026-11-09-cli-registry-design.md`.
+Evidence beside it: `docs/superpowers/notes/2026-11-09-cli-dispatch-audit.md`
+(a read-only audit of every dispatcher; verify any line you rely on).
+Authorities (merged on main): `docs/superpowers/specs/2026-11-09-parity-guard-design.md`
+(slice 3, rev 3.1), `parity/`, `internal/parity`, `internal/docsite`,
+AGENTS.md ("Stopping rules", "The census"). Do not review against
+unmerged branches; if this work needs one, say so as a P1 and stop.
+
+You are an independent reviewer. Read the document, then the code it
+names, and check every claim against that code.
+
+## Fixed: do not re-argue
+
+- Paul, 2026-11-09: slice 4 is the Carloku MCP connector in three
+ projects; this is project 1, the registry. Design only.
+- Paul, 2026-11-09 (slice 3): the list of commands comes from a registry
+ the code dispatches from, not from a scanner.
+- Secrets are never entered through the connector.
+- Every existing invocation must keep working byte for byte (stdout,
+ stderr, exit code). Fixing the CLI's inconsistencies is a non-goal.
+- Paul's rulings after rounds 1 and 2 (spec, "Paul's rulings"): refuse
+ up front (A0); the tripwire is CUT; dispatch inside handlers is held by
+ the AGENTS.md rule and review, with no mechanical proof. Do not raise
+ the absence of a lint. Raise only words the walk should dispatch that
+ the spec leaves out of the tree. Root-run dispatchers with shared
+ pre-dispatch work stay one raw leaf with an enum positional (A0). Production deploy,
+ promote, rollback, restart are `change`; deletions `risky`.
+- Out of scope: the connector, how a tool call executes, the confirmation
+ model (projects 2 and 3); `cmd/console`'s own CLI.
+
+## History
+
+This registry was section A of the slice 3 spec, reviewed three times
+(`CODEX-FINDINGS-parity-guard.md`, `-R2.md`, `-R3.md`, all in
+`docs/superpowers/specs/`). R3 left P1 R3-1 (no argument model) and P2s
+R3-2, R3-3 against it; Paul cut the registry from slice 3. This spec is a
+new design; its own budget is three rounds, and this is round 3, the last.
+
+## Round 3
+
+Earlier rounds: `CODEX-FINDINGS-cli-registry.md` (round 1) and
+`CODEX-FINDINGS-cli-registry-R2.md` (round 2) of this design; before
+them, the parity-guard R1-R3 files named under History. First give one
+line per P1 and P2 from round 2: resolved, partly, or not. Carry every unresolved or partly resolved finding forward at its
+current severity, then add new findings. The verdict covers everything
+outstanding, earlier rounds included.
+
+## What to check
+
+1. A2/A4: does a walk that consumes only command words, with every
+ remaining argument passed unchanged, reproduce every dispatcher in the
+ audit, including defaults that absorb unknown words (`DefaultOn`),
+ `system router`, `ops host`, the inline dispatch in main's switch, and
+ the pre-switch words? Name any dispatcher it cannot express.
+2. B1: can `Args.New` (bind + run, fresh state per call) carry a real
+ leaf's registration and handler unchanged, including `consoleOption`'s
+ package-level side effect, shared registrars, `flagWasSet`/`fs.Visit`
+ users, and the parent error mappings (`OnError`)? Try it on
+ `config destinations add`, `apps set` and `steering`.
+3. E1-E3: is the golden corpus deterministic and strong enough to prove
+ byte-for-byte for parse-level behaviour? Does B6 lift every word a hand
+ parser dispatches today (check each against the code), and does
+ lifting them change any output, exit code or root-side order? Is A0's
+ root-run exception list right?
+4. C: is the metadata enough for project 2 to generate a tool schema and
+ enforce account scope, and is C3/C4 sufficient to keep secret-taking
+ leaves from ever becoming tools?
+5. D: does the parity guard become complete over verb paths at step 1's
+ merge, and stay so through steps 2-7? Does D3's qualifier checking
+ break any existing row in `parity/parity.tsv`?
+6. A9 and the census: is the early phase unchanged in order and effect
+ (shim before scrub, `shimHooked`)? Is anything in the migration a
+ root-relevant change beyond argument routing?
+
+## Severity
+
+- **P1**: unsafe, would not compile, a test fails, or it would not work.
+ Blocks merge.
+- **P2**: wrong or missing. Fixed without reopening this review. (The
+ census, and review of any newly changed security, root, termination
+ or production-storage behaviour, still check the fix; see AGENTS.md,
+ "Stopping rules".)
+- **P3**: clarity or polish. Goes on a follow-up list; never a reason for
+ another round.
+
+A P1 states its failure scenario and the evidence (file:line). Do not
+raise a P2 to P1 to keep the review open.
+
+## Output
+
+Findings ranked P1, P2, P3. Each gives the section or task, the problem,
+the evidence (file:line, verified), the failure scenario, a concrete
+fix and the invariant or trust boundary it breaks (that is its fault
+family). End with exactly one verdict (round 3: a NOT READY also says whether
+the P1s share one cause, and whether refusing the case up front or
+cutting the feature would remove them):
+
+- **READY**: no P1 and no P2.
+- **READY AFTER FIXES**: no P1. The listed P2s are fixed without another
+ round.
+- **NOT READY**: one or more P1s, listed.
+
+Do not edit files. Do not spawn Anthropic-model reviewers or subagents of
+your own. Do not run the full test suites.