carlos / platform Public

spec: CLI registry rev 4, round 2 fixes and tripwire cut

Root-run dispatchers stay one raw leaf with an enum positional; audience
checked customer vs outside per row; scope binds a flag or positional.
Round 3 brief.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 7e78de46d129c5d570dee6525e42b210bf2d4269 parent 3fef4d7
2 files changed, +120 −99
  • docs/superpowers/specs/2026-11-09-cli-registry-design.md +101 −82
  • docs/superpowers/specs/CODEX-REVIEW-BRIEF-cli-registry.md +19 −17

Intent

Human

<paseo-system version="1" kind="agent-message" source-agent-id="55f1f6a4-252a-4d89-af7b-a8a460b2b81d" message-id="ab396649-23d2-4866-af0b-bfff2fa92b24"> Coordinator (Paul&apos;s session): Paul chose A: cut the tripwire (AGENTS.md rule + branch/census review hold handler-internal dispatch; walk-dispatched words stay fully enumerated; payload enums keep schema annotations). Apply your proposed fixes for guard-exec (one raw leaf with a declared enum positional, root-side order byte-for-byte, same for other root-run dispatchers with shared pre-dispatch work), status (audience per parity row, with today&apos;s three status rows as the fixture) and the P2 (scope bindings name a flag or declared positional). Then Astra round 3, the last. If it finds another P1, stop and report; otherwise apply its P2s, push, and report. </paseo-system>

diff --git a/docs/superpowers/specs/2026-11-09-cli-registry-design.md b/docs/superpowers/specs/2026-11-09-cli-registry-design.md
index ecb670b87..fb622746c 100644
--- a/docs/superpowers/specs/2026-11-09-cli-registry-design.md
+++ b/docs/superpowers/specs/2026-11-09-cli-registry-design.md
@@ -1,13 +1,16 @@
# The CLI command registry (slice 4, project 1 of 3)
-Status: rev 3, 2026-11-09, for review (Astra round 2 of 3). Rev 2
+Status: rev 4, 2026-11-09, for review (Astra round 3 of 3, the last). 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 applies that and every round-1 finding, marked
-**(R1-N)**. Slice 4 is the Carloku MCP
+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
@@ -57,7 +60,7 @@ them and commands whose deciding word follows flags (`steering --app a
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), with a tripwire test that catches its common breaches.
+ on a word (A0), held by an AGENTS.md rule and review.
## Goals
@@ -121,10 +124,30 @@ them and commands whose deciding word follows flags (`steering --app a
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 or flag spellings") with branch and census
- review. The lint (E3) is a tripwire that catches the common forms
- early. It is not a proof of completeness, and this spec no longer
- claims one.
+ 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: root-run dispatchers (R2-2).** A dispatcher that
+ runs as root on a box (`Auth: box-root`) 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`
+ (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`,
@@ -192,8 +215,8 @@ them and commands whose deciding word follows flags (`steering --app a
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 carries `// clireg:pending <ID>` (E3) and is split
- in that area's args step.
+ 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)`,
@@ -347,8 +370,8 @@ them and commands whose deciding word follows flags (`steering --app a
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). The enum annotations on payload switches are checked
- against the code by the lint (E3).
+ 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
@@ -370,18 +393,16 @@ them and commands whose deciding word follows flags (`steering --app a
- `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`: children `apply`, `recover`, `edge`, and
- `console` (raw leaf: `<bin>` then a tail passed on unparsed).
- Fallback: `log.Fatal(hostfloor.ErrFloor)`. The spellings it re-execs
- (`system apply [--recover]`, `agent`) stay valid; the corpus pins
- them.
- - `system group-maintenance`: children `permit`, `revoke`, `status`,
- `apply`, `rollback`, `prepare`; fallback prints help to stderr, exit
- 2, and `help` alone to stdout, exit 0 (`group_maintenance_verbs.go`).
- - `system host-env`: children `write`, `seed` (raw: the `--group`
- pre-scan stays in each leaf); `system named-units`: child `install`
- (raw: exactly one `<file>`); `system files`: child `seed`.
+ - `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`
@@ -402,11 +423,19 @@ them and commands whose deciding word follows flags (`steering --app 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.** `Scope` names the flags that carry it: `account`
- binds `--account`/`--account-id` (`accountFlags`), `app` adds `--app`,
- `instance` adds `--host`, `fleet` binds the fleet positional or flag.
- The binding is checked against the flag set (B4). Project 2 uses it to
- fill these from the connection's picked accounts and refuse any other.
+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
@@ -465,10 +494,18 @@ them and commands whose deciding word follows flags (`steering --app a
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.** A row whose CLI members are all `operator`,
- `box-local` or `internal` must carry the matching outside status, and a
- `customer` leaf cannot sit only in an outside row. Today's statuses are
- unchanged.
+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
@@ -511,38 +548,8 @@ them and commands whose deciding word follows flags (`steering --app a
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. **The word-dispatch tripwire (A0; R1-2).** `TestWordsDispatchTripwire`
- parses the root binary's non-test Go files and flags a comparison of an
- *argument-derived string* against a string literal, in a `switch`
- (any number of cases), an `if`/`else if` chain (one comparison is
- enough), or a map or slice lookup keyed by it (`slices.Contains`, a
- `map[string]...` index). Argument-derived means: an element of a
- `[]string` parameter or of `fs.Args()`/`fs.Arg(n)`/`inv.Pos`, or a
- local assigned from one, followed through plain assignments within the
- function. It does not follow values through calls or struct fields;
- that is where it stops being a proof, and A0 says so. A flagged
- statement passes only with one marker on the line above:
- - `// clireg:enum <node ID> <positional>`: its literals equal that
- positional's declared `Enum`;
- - `// clireg:flags`: in a `raw` leaf only, and every literal starts
- with `-` (manual flag spellings such as `system_demos.go:50`);
- - `// clireg:help`: in a fallback only, literals within `help`, `-h`,
- `--help`;
- - `// clireg:pending <node ID> <lit>,<lit>,...` **(builder 1, 8)**:
- the literals are pinned, so the statement fails when a case is added
- or changed; allowed only until that node's args step. In step 1 every
- payload switch the audit lists (about 37 in package main,
- `runSteering`'s at `instances_cli.go:957` among them) and every
- whole-function dispatcher (A5) carries it; each args step turns its
- area's markers into `clireg:enum` or removes the switch, and step 7
- refuses `pending`.
- A switch on a word the walk passed in through a child's closure
- (`switch verb` in `runSystemAntivirus`) is not argument-derived and is
- not flagged: that word was dispatched by the walk. Fixtures, one each:
- a single-literal `if args[0] == "x"`, a local copied from `args[0]`,
- a `slices.Contains(words, args[0])`, a `map[string]func` lookup, a
- `pending` marker whose switch gained a case, and a `clireg:flags`
- marker on a literal without `-`.
+3. **No word-dispatch lint.** Rev 3's tripwire (E3) is cut (Paul,
+ after round 2; A0).
### F. Migration
@@ -561,8 +568,7 @@ them.
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
- tripwire with `pending` markers (E3), the raw parsers' words lifted
- into nodes (B6), `parity/cli.tsv` and the new coverage
+ 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
@@ -577,11 +583,10 @@ them.
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, converts its `pending`
- markers, and replays the corpus. Customer areas go first because
+ 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, and the tripwire refuses `pending`.
+ `Validate` refuses it elsewhere.
### G. Docsite
@@ -609,9 +614,13 @@ non-vacuity test becomes one on the file (at least 20 commands; `ship`,
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).
-- **E3:** the tripwire follows locals by plain assignment only; values
- passed through calls or struct fields are left to the AGENTS.md rule and
- review (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,
@@ -628,16 +637,21 @@ non-vacuity test becomes one on the file (at least 20 commands; `ship`,
`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); `pending` lint
- markers until each args step (E3); `help` stays a customer row (A6).
+ `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 lint is a tripwire,
- not a completeness proof; the AGENTS.md rule and branch and census
- review hold dispatch inside handlers (A0, B6, E3).
+ 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).
@@ -659,14 +673,19 @@ non-vacuity test becomes one on the file (at least 20 commands; `ship`,
- **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):** A0 (the
- lint is a tripwire, the rule is held by AGENTS.md and review) and E3
- (single comparisons, locals, map and slice lookups flagged;
- `clireg:flags` for manual flag spellings; `pending` pinned to its
- literals; fixtures).
+- **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.
diff --git a/docs/superpowers/specs/CODEX-REVIEW-BRIEF-cli-registry.md b/docs/superpowers/specs/CODEX-REVIEW-BRIEF-cli-registry.md
index c75d168de..cbd8f3a27 100644
--- a/docs/superpowers/specs/CODEX-REVIEW-BRIEF-cli-registry.md
+++ b/docs/superpowers/specs/CODEX-REVIEW-BRIEF-cli-registry.md
@@ -1,6 +1,6 @@
-# Review brief: CLI command registry spec, round 2 of 3
+# Review brief: CLI command registry spec, round 3 of 3
-Repo carlos/platform, branch `design-cli-registry`, commit ece49d77c4cd08a077128ae37cb89ef5da05a517.
+Repo carlos/platform, branch `design-cli-registry`, commit COMMIT_SHA.
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).
@@ -21,12 +21,12 @@ names, and check every claim against that code.
- 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 round 1 (spec, "Paul's rulings"): option A,
- refuse up front (A0): the tripwire (E3) is NOT a completeness proof;
- dispatch inside handlers is held by the AGENTS.md rule and review. Do
- not raise "the tripwire can be evaded" as a finding; raise only words a
- handler dispatches today that the spec leaves out of the tree, or a
- tripwire rule that would fail on correct code. Production deploy,
+- 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.
@@ -37,14 +37,14 @@ 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 2.
+new design; its own budget is three rounds, and this is round 3, the last.
-## Round 2
+## Round 3
-Earlier rounds: `CODEX-FINDINGS-cli-registry.md` (round 1 of this
-design); before it, the parity-guard R1-R3 files named under History.
-First give one line per P1 and P2 from round 1: resolved, partly, or
-not. Carry every unresolved or partly resolved finding forward at its
+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.
@@ -63,8 +63,8 @@ outstanding, earlier rounds included.
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 or exit code? Would the E3 tripwire
- fail on correct code the spec keeps?
+ 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?
@@ -94,7 +94,9 @@ raise a P2 to P1 to keep the review open.
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:
+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