The socket protocol is enumerated by hand in four places that must track each other verbatim:
- The 209-case dispatch switch in
Sources/TerminalController.swift (~line 1470)
v2Capabilities() in the same file: a second ~200-entry method-name array with nothing enforcing it matches the switch
- The CLI
CommandDescriptor table in CLI/programa.swift (~line 1319)
- A separate ~1,300-line
subcommandUsage help switch in CLI/programa.swift duplicating per-command knowledge the descriptor table was meant to unify
Both review models (Claude and Codex) independently ranked this the highest-leverage restructuring. A shared CommandSpec catalog (name, params, focus policy, help text) deletes the capabilities array and the usage switch outright and makes CLI/server drift structurally impossible. Same move should absorb the identical 3-line workspace_id/surface_id validation blocks copy-pasted across 22+ v2 handlers.
Explicitly cleared by review: the dispatch switch itself is fine (uniform one-line cases, shared typed param extraction). The problem is the three shadow copies, not the switch.
From the 2026-07-09 nuclear review (10 module reviewers + Codex cross-model pass, disprove-first). Line refs are against the reductive-audit branch (PR #81).
The socket protocol is enumerated by hand in four places that must track each other verbatim:
Sources/TerminalController.swift(~line 1470)v2Capabilities()in the same file: a second ~200-entry method-name array with nothing enforcing it matches the switchCommandDescriptortable inCLI/programa.swift(~line 1319)subcommandUsagehelp switch inCLI/programa.swiftduplicating per-command knowledge the descriptor table was meant to unifyBoth review models (Claude and Codex) independently ranked this the highest-leverage restructuring. A shared
CommandSpeccatalog (name, params, focus policy, help text) deletes the capabilities array and the usage switch outright and makes CLI/server drift structurally impossible. Same move should absorb the identical 3-lineworkspace_id/surface_idvalidation blocks copy-pasted across 22+ v2 handlers.Explicitly cleared by review: the dispatch switch itself is fine (uniform one-line cases, shared typed param extraction). The problem is the three shadow copies, not the switch.
From the 2026-07-09 nuclear review (10 module reviewers + Codex cross-model pass, disprove-first). Line refs are against the
reductive-auditbranch (PR #81).