Commit 6c464b1
Extract host-neutral merge + dispatch contract — codex/pi name no merge reference and break at terminalization (#385)
* feat(fo): extract host-neutral merge + dispatch cores; codex/pi gain terminal contract
Re-home the generic first-officer terminal-merge and dispatch ceremony out of the
claude-named references into two host-neutral deferred cores, so codex and pi FOs
reaching terminalization follow a resolving merge/dispatch reference instead of a
dead-end pointer.
- New fo-merge-core.md (Merge-and-Cleanup 1-9, Ship-Local, worktree-removal safety,
Mod-Block Enforcement) + fo-dispatch-core.md (dispatch procedure, reuse contract,
worker resolution, worktree ownership, dispatch adapter, event-loop skeleton).
- Boot-resident core's deferred-module pointers name the two cores directly; each
runtime adapter reduced to a thin seam naming only its host residue.
- claude-fo-merge.md keeps the step-10 TERMINAL_TEARDOWN_BOUNDED teardown
byte-identical (the per-host seam); claude-fo-dispatch.md keeps team creation,
the Agent()/SendMessage handles, registry-desync (#36806), context-budget probe,
reconcile sweep + Backstop.
- codex gains a NEW authored teardown seam (cohort cooperative-shutdown via mailbox;
no TeamDelete/marker); pi repoints step 10 to its existing ## Shutdown.
- AC-1: extend boot_resident_closure_test.go to walk codex/pi and assert each host
names a resolving merge + dispatch reference (RED for codex/pi before, GREEN after).
- AC-2: new fo_core_single_source_test.go — each moved ceremony block lives in a
core XOR in any adapter (copy-paste-into-a-host regression goes RED).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* refactor(fo): lean rework — single core-naming, strip duplicated adapter preambles
Shared-core deferred-module pointers are the sole core-namer; strip the
"host-neutral X lives in fo-X-core.md, read it at [load point]" preamble from
every runtime adapter (claude/codex/pi). Each adapter keeps only its host-specific
part. Drop "seam"/"host-neutral version" jargon for the contract's existing
vocabulary (deferred module/reference, load point, runtime adapter).
Claude lifecycle load 10804 -> 10278 (-526). Marker TERMINAL_TEARDOWN_BOUNDED
byte-identical (a59f79db). Not yet <= 9779 baseline — see stage report.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* test(fo): reframe AC-1 to reachability-via-shared-core; drop AC-2
AC-1 no longer requires each adapter to re-name the cores (that forced the
redundant preamble). Reachability rides on the single core-naming in
first-officer-shared-core.md, which every host loads at boot. New
TestHostNeutralCoresResolveAndCarryCeremony asserts the shared core names each
core + each core resolves on disk + carries its four ceremony anchors. The
closure walk (bootResidentBodies, incl. shared core) keeps the dangling-target
guard. Remove fo_core_single_source_test.go (AC-2) — a transient migration
assurance, not a durable invariant.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* refactor(fo): dedup the Claude id_style/boot-json paragraph into the shared core
The claude-fo-dispatch id_style/boot-json paragraph duplicated the boot-resident
core's ## ID Styles + Startup step 5 + ## FO Write Scope. Replace it with a
one-line pointer; repoint the claude-runtime id-filing reference to the shared
core. The one residual genuine duplication the lean rework left — captain
authorized this dedup; the broad Claude-verbosity trim stays the parallel
token-cleanup proposal's scope.
Claude lifecycle 10278 -> 10213 (-65). Residual +434 over the 9779 baseline is
accepted intrinsic core/adapter split-overhead (per the entity body's token-budget
note). Marker byte-identical (a59f79db); AC-3b fragment audit: 0 MUSTs dropped.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* Revert "refactor(fo): dedup the Claude id_style/boot-json paragraph into the shared core"
This reverts commit 617a674.
* feat(fo): headless gate-stop MUST author the full present-gate review before exit
7e-era contract gap (not a rework regression): Startup step-9's headless bullet
only required "report each entity's stop reason," so a headless -p FO stopping at
a gate:true stage could exit with a terse stop line instead of the reviewable
gate content — model variance flaked TestLiveDefaultHeadlessStopsAtGate
(live_gate_stop_test.go:219 scans for an FO-authored "Gate review:" + "Decision:").
Strengthen the step-9 headless bullet to an unambiguous MUST: at each gate:true
stop the FO MUST author the FULL present-gate review (Skill(present-gate)'s
Gate review:/chosen-direction/checklist/Decision: template, per ## Completion and
Gates) before exiting — the human picks up the headless transcript and decides
from that content. The FO still does NOT resolve the gate headless (only "given
the conn" does).
Claude lifecycle 10278 -> 10403 (+125 for the MUST). Marker byte-identical
(a59f79db). Offline go test ./... + go vet -tags live green; the live behavior
gate re-runs at PR CI (account 429 locally).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* test(live): isolate --plugin-dir from real docs/dev + strong force-team cue
Two pre-existing live-suite reliability bugs the CI surfaced (not contract work).
BUG 1 (wrong-root boot): every claude-live launch passed --plugin-dir=repoRoot,
the real repo whose docs/dev sibling carries live entities. An FO that anchored
git rev-parse --show-toplevel + status --discover on the plugin path (not its
isolated cwd fixture) discovered and drove the REAL docs/dev for 27 min instead of
the /tmp fixture. New livePluginDir() stages an isolated plugin copy
(.claude-plugin/, skills/, agents/) into a temp dir with NO docs/dev sibling, then
git-inits it so a rev-parse from the plugin path resolves to a workflow-free root;
status --discover there yields zero, so the FO falls back to the fixture. Verified
the staged dir has the scaffolding, no docs/dev, and discovers zero. Repointed all
five claude-live --plugin-dir sites (shared runner, full cycle, gate-stop,
residency, zero-discover) — hardens every claude-live scenario, incl. fixing a
latent wrong-root in zero-discover.
BUG 2 (residency/teardown force-team coin): both tests used a soft "run in team
mode" cue that 7e's headless bare-mode determination could decline, so the FO drove
bare (no team, no roster) and red the team-only oracles on correct behavior. New
shared forceTeamModeCue is a strong unambiguous MUST (TeamCreate first, bare mode
NOT acceptable, override the -p bare default) — same prose-lever pattern as the
gate-stop MUST. Used in residency + teardown.
Offline go test ./... + go vet -tags live green. Live behavior re-runs at PR CI
(account 429 locally); BUG-1's fix is deterministic, BUG-2's is the strong lever.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* ensigncycle: strengthen forceTeamModeCue to prohibit fake team name and override dispatch module skip rule
The prior cue ("create a team (TeamCreate) before the first dispatch") was
ambiguous: the FO read the dispatch module's "In single-entity mode, skip
team creation" rule and generated a fake team name string instead of calling
the TeamCreate tool. The new cue explicitly names and overrides that rule,
prohibits inventing a fake team name, and requires calling the TeamCreate
TOOL before any Agent() dispatch.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* ci(live-e2e): default-pin claude-live to Claude Code 2.1.177
2.1.178 stopped surfacing the native TeamCreate/TeamDelete tools in a
headless `claude -p` session even with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1
set (anthropics/claude-code#68721), RED-failing the team-forced live tests
TestLiveStandingResidencyInjectsCommOfficer and TestLiveEnsignCycleTeamTeardown.
2.1.177 is the last version that surfaces them. CI installs Claude unpinned, so
it picked up 2.1.178. Default CLAUDE_VERSION to 2.1.177 while letting a manual
workflow_dispatch claude_version input still override. Unpin when the upstream
regression is fixed.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(dispatch): spawn-standing-all Agent spec must carry description
The Agent tool REQUIRES `description`, but spawnSpec emitted only
subagent_type/name/team_name/model/prompt — so forwarding the spec
verbatim failed with InputValidationError and the standing teammate
(comm-officer) never spawned. This breaks comm-officer injection in
interactive team mode too, so it is mode-independent.
Add Description to spawnSpec (populated `standing teammate: {name}`),
matching dispatch build's envelope field order (subagent_type,
description, name, ...). Regenerated the two affected spec-emit goldens.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* ci(live-e2e): revert claude-live 2.1.177 pin — run latest, go bare under -p
Per the captain's 2026-06-16 determination (go bare under `-p`; team
mode is the interactive path), headless CI installs latest Claude and
runs bare. This reverts the 2.1.177 default pin (8a5f92b) that worked
around 2.1.178 dropping TeamCreate/TeamDelete from headless sessions
(anthropics/claude-code#68721) — that pin propped up the forced-team
headless tests now retired. A manual workflow_dispatch claude_version
input still overrides.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* test(live): retire forced-team headless tests — go bare under -p
Headless `claude -p` cannot sustain team mode: Claude Code 2.1.178
dropped native TeamCreate/TeamDelete from headless sessions
(anthropics/claude-code#68721), and the SDK session races to end_turn
before teammates finish (anthropics/claude-code-action#1124). Forcing
team mode in a headless live test fights the captain's go-bare
determination, so retire the two forced-team tests:
- TestLiveEnsignCycleTeamTeardown (live_teardown_test.go)
- TestLiveStandingResidencyInjectsCommOfficer (live_standing_residency_test.go)
Their bare-mode behavior survives: teardown's bare path == the
team-agnostic TestLiveEnsignCycle; residency's mechanism ==
spawn_standing_all_test.go. The team-only live artifacts (live roster
injection, live teardown marker) are deferred to the terminal/pty
harness task m40mphxan8phr3t3tp03gk89. Offline marker coverage stays in
teardown_grade_watcher_test.go over the sonnet_teamdelete_*.jsonl
fixtures.
Remove both names from the -run regex and delete the now-unused
forceTeamModeCue. go test ./... and go vet -tags live ./... stay green.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 1aae098 commit 6c464b1
21 files changed
Lines changed: 431 additions & 541 deletions
File tree
- .github/workflows
- internal
- contractlint
- dispatch
- testdata/golden
- ensigncycle
- skills/first-officer/references
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
170 | | - | |
171 | | - | |
172 | | - | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
173 | 175 | | |
174 | 176 | | |
175 | 177 | | |
| |||
182 | 184 | | |
183 | 185 | | |
184 | 186 | | |
185 | | - | |
| 187 | + | |
186 | 188 | | |
187 | 189 | | |
188 | 190 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
22 | 40 | | |
23 | 41 | | |
24 | 42 | | |
| |||
155 | 173 | | |
156 | 174 | | |
157 | 175 | | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
259 | 259 | | |
260 | 260 | | |
261 | 261 | | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
262 | 266 | | |
263 | 267 | | |
264 | 268 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
58 | 66 | | |
59 | 67 | | |
60 | 68 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
| 207 | + | |
207 | 208 | | |
208 | 209 | | |
209 | 210 | | |
| |||
223 | 224 | | |
224 | 225 | | |
225 | 226 | | |
226 | | - | |
227 | | - | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
228 | 231 | | |
229 | 232 | | |
| 233 | + | |
230 | 234 | | |
231 | 235 | | |
232 | 236 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
141 | | - | |
| 141 | + | |
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
| |||
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
155 | | - | |
| 155 | + | |
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
| |||
327 | 327 | | |
328 | 328 | | |
329 | 329 | | |
330 | | - | |
| 330 | + | |
331 | 331 | | |
332 | 332 | | |
333 | 333 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
| 97 | + | |
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
120 | | - | |
| 120 | + | |
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| |||
0 commit comments