Skip to content

feat(bin): opt-in spawn base from the primary checkout for local-only work - #7352

Merged
kunchenguid merged 5 commits into
kunchenguid:mainfrom
mikeastwoody:fm/fm-pool-base-opt-in
Oct 28, 2026
Merged

kunchenguid merged 5 commits into
kunchenguid:mainfrom
mikeastwoody:fm/fm-pool-base-opt-in

Conversation

@mikeastwoody

@mikeastwoody mikeastwoody commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Supersedes #3812

This supersedes #3812, which made every home start a fresh local-only ship or scout worktree from the primary checkout's default branch.
The triage on #3812 classified that as a new-default contract change: it replaced the specified, test-covered rule that a fresh pooled slot resets to origin/<default> without an opt-in gate, which does not fit the principle that authority is explicit and never inferred.
This version keeps that rule as the default and moves the new base behind the explicit, default-off config/spawn-base-primary-checkout presence flag, following the existing config/<flag> pattern.
With the flag absent, spawn, review, and promotion follow exactly the old paths, and the existing tests run unmodified.
Compared with #3812, the review anchor and the shared mode predicate sit behind the same flag, the promotion wording is new, and the always-on behind-count notes are dropped.

The problem it addresses: on a local-only project, origin/<default> stays at the last push while work lands on the primary checkout's default branch through bin/fm-merge-local.sh, so fresh tasks started hundreds of commits behind (400 to 854 commits, as measured in #3812) and loaded the project's instruction files from that stale tree.

What Changed

  • bin/fm-spawn.sh: adds an off-by-default config/spawn-base-primary-checkout flag. When a home sets it, a fresh local-only ship, or a scout spawned without --base-branch, resets its pooled worktree to the primary checkout's <default> if that branch strictly contains origin's tip. The commit is read from the shared object store, so nothing extra is fetched. Publishing modes (no-mistakes, direct-PR) and named base branches keep origin's tip, and if the two branches have diverged the spawn prints a note with both counts and also uses origin's tip. A new shared helper, fm_mode_publishes in bin/fm-dod-lib.sh, decides which modes publish.
  • bin/fm-review-diff.sh: when the flag is set, a remote-backed local-only ship or scout with no recorded base is reviewed against whichever of the local <default> and origin/<default> has the later merge base with the branch. If both merge bases are the same, or they are unrelated, it uses the local <default>. It prints notes when the local <default> already contains the branch and when the merge bases are unrelated. Publishing modes still review against origin/<default>.
  • bin/fm-promote.sh: when the flag is set and a scout without a named base is promoted to a publishing mode, the scout is now told to start again from a copy of origin's default branch instead of the primary checkout's. The flag is documented in docs/configuration.md, docs/architecture.md and the operational-home-layout skill. New tests cover the spawn base, the review anchor and the promotion wording.

Risk Assessment

✅ Low: Every new path sits behind a default-off presence flag. Without it, spawn, review and promotion behave byte-for-byte as before. With it, the base and anchor rules were traced through the leading, trailing, diverged, rebased, landed and named-base cases and gave the correct base each time, and the merge with current main is clean.

Testing

I built a disposable lab home with a private tmux server, a treehouse pool inside the lab, a throwaway project with a lab-private origin, and real Claude Code workers. A real worker plus fm-merge-local.sh landed a CLAUDE.md change locally, leaving origin one commit behind; this is the state the change targets. I then ran the real fm-spawn.sh, fm-review-diff.sh and fm-promote.sh with the flag absent and present. Without the flag, a local-only ship and a scout still start at origin's tip and their workers boot with STALE-ORIGIN-v1. With the flag, a local-only ship and a scout start at the primary's main and their workers boot with FRESH-LOCAL-v2. No-mistakes and direct-PR ships, a named base branch, and a diverged primary all keep origin's tip; the diverged case prints a note counting both sides. With the flag, review anchors on local main for local-only work and on origin/main for no-mistakes work, so each diff shows only the task's own file. With the flag, promoting a scout to no-mistakes tells the worker to return to origin's default branch; without the flag, and for a named base, the original wording is unchanged. All 14 live scenarios passed, the lab was fully torn down, and the three targeted suites (spawn-pool-base-freshen, review-diff, task-delivery) passed. This is a CLI-only change, so the evidence is transcripts and worker pane captures rather than screenshots.

  • Live validation: ✅ go - 14 of 14 scenarios driven live against the product
Scenario Result Live Evidence
Flag absent: a fresh local-only ship on a project whose primary main has landed work locally still starts at origin's frozen tip (unchanged default) ✅ pass live Transcript section S1: worker HEAD e4566b5 = origin/main while primary main = c73bf9f; worker reported 'booted with STALE-ORIGIN-v1'; no base note printed
Flag absent: a fresh scout still starts at origin's tip ✅ pass live Transcript section S1b: lab-scout2 HEAD e4566b5; worker reported STALE-ORIGIN-v1
Flag present: a fresh local-only ship starts from the primary checkout's main and its worker boots with the locally landed instructions ✅ pass live Transcript section S2: worker HEAD c73bf9f = primary main (origin e4566b5); pane shows 'done: booted with FRESH-LOCAL-v2'
Flag present: a scout spawned without --base-branch starts from the primary checkout's main ✅ pass live Transcript section S3: lab-scout HEAD c73bf9f; worker reported FRESH-LOCAL-v2
Flag present (adversarial): no-mistakes and direct-PR ships keep origin's tip ✅ pass live Transcript section S4: lab-nm and lab-dpr HEAD e4566b5 = origin/main despite primary c73bf9f; both workers reported STALE-ORIGIN-v1
Flag present (adversarial): a primary that has diverged from origin keeps origin's tip and prints a note ✅ pass live Transcript section S5: note 'main in the primary checkout has diverged from origin/main (ahead by 1, behind by 1); starting from origin's tip'; worker HEAD bbda8ab = new origin tip and contains forge-…
Flag present (adversarial): a scout with a named --base-branch starts from origin's copy even when the local branch of that name is ahead ✅ pass live Transcript section S6: worker HEAD 79fd75e == origin/feature/hub (yes), == local feature/hub 7b57a8d (no)
Flag present: review of a local-only ship planted on primary main anchors on local main and shows only the task's own work ✅ pass live Transcript review section R1: 'diff base: main', stat lists only farewell_lab-optin.py (not the landed CLAUDE.md commit)
Flag present: review of a no-mistakes ship stays anchored on origin/main ✅ pass live Transcript review section R2: 'diff base: origin/main', stat lists only farewell_lab-nm.py
Flag present: a local-only ship planted on origin's tip before the opt-in is still reviewed as only its own work ✅ pass live Transcript review section R4: lab-default 'diff base: main', stat lists only own_work.py
Flag absent: review keeps the pre-change origin/main anchor ✅ pass live Transcript review section R3: 'diff base: origin/main' (and so includes the landed CLAUDE.md commit, which is why the opt-in review reads the flag)
Flag present: promoting a scout to no-mistakes tells the worker to return to origin's default branch rather than the primary checkout's ✅ pass live Transcript promotion section P1: ship-instructions line 11 'Return to a clean copy of origin's default branch rather than the primary checkout's, which can carry commits origin has never received'
Flag absent: promotion wording is unchanged ✅ pass live Transcript promotion section P2: ship-instructions line 11 'Return to a clean default-branch base'
Flag present (adversarial): promoting a named-base scout keeps the named-base wording ✅ pass live Transcript promotion section P3: ship-instructions line 11 'Return to a clean copy of the base branch feature/hub'
Evidence: Live lab transcript: spawn, review and promote with the flag on and off, plus worker boot panes

Source: Live lab transcript: spawn, review and promote with the flag on and off, plus worker boot panes

# Live lab: opt-in config/spawn-base-primary-checkout

Disposable lab home created with bin/fm-lab-home.sh, a private tmux server (TMUX_TMPDIR in the lab), TREEHOUSE_ROOT inside the lab, a throwaway project 'demo' with a lab-private bare origin, and real Claude Code crewmates (sonnet, low effort).
Every command below is the real firstmate script run from the change's worktree with FM_HOME=<lab home>.
The project's CLAUDE.md carries 'Instruction marker: STALE-ORIGIN-v1' on origin; a real worker changed it to FRESH-LOCAL-v2 and bin/fm-merge-local.sh landed that on the primary checkout's main, so origin stayed frozen one commit behind.
Each probe worker was told to report, without reading any file, the marker from the instructions it loaded at launch.

## Setup: a real local landing (flag absent)
`` `
$ FM_HOME=$LAB bin/fm-spawn.sh lab-land $LAB/projects/demo --mode local-only --yolo on --harness claude --model sonnet --effort low
spawned lab-land harness=claude kind=ship mode=local-only yolo=on window=firstmate:fm-lab-land worktree=/private/tmp/fmpb.nefE3r/treehouse/.treehouse/demo-989807/1/demo
exit=0
--- base facts for lab-land
primary checkout main : e4566b5 (seed demo)
origin/main (fetched) : e4566b5
worker worktree       : /private/tmp/fmpb.nefE3r/treehouse/.treehouse/demo-989807/1/demo
worker HEAD           : e4566b5 (seed demo) branch=HEAD
worker CLAUDE.md      : Instruction marker: STALE-ORIGIN-v1
$ FM_HOME=$LAB bin/fm-merge-local.sh lab-land
merged fm/lab-land into local main (e4566b5 -> c73bf9f) in /private/tmp/fmpb.nefE3r/home/projects/demo
exit=0
primary main : c73bf9f Update instruction marker to FRESH-LOCAL-v2
origin main  : e4566b5
primary CLAUDE.md: Instruction marker: FRESH-LOCAL-v2
commits primary main is ahead of origin: 1
`` `

## S1: flag absent, local-only ship starts from origin tip (unchanged default)
`` `
$ FM_HOME=$LAB bin/fm-spawn.sh lab-default $LAB/projects/demo --mode local-only --yolo on --harness claude --model sonnet --effort low
WARNING: watcher still down (same stale episode; last beat: never, grace 300s) - full banner already printed this episode.
spawned lab-default harness=claude kind=ship mode=local-only yolo=on window=firstmate:fm-lab-default worktree=/private/tmp/fmpb.nefE3r/treehouse/.treehouse/demo-989807/2/demo
exit=0
--- base facts for lab-default
primary checkout main : c73bf9f (Update instruction marker to FRESH-LOCAL-v2)
origin/main (fetched) : e4566b5
worker worktree       : /private/tmp/fmpb.nefE3r/treehouse/.treehouse/demo-989807/2/demo
worker HEAD           : e4566b5 (seed demo) branch=HEAD
worker CLAUDE.md      : Instruction marker: STALE-ORIGIN-v1
worker status: done [at=1793192549]: booted with STALE-ORIGIN-v1
`` `

## S1b: flag absent, scout starts from origin tip (unchanged default)
`` `
$ FM_HOME=$LAB bin/fm-spawn.sh lab-scout2 $LAB/projects/demo --scout --harness claude --model sonnet --effort low
WARNING: watcher still down (same stale episode; last beat: never, grace 300s) - full banner already printed this episode.
spawned lab-scout2 harness=claude kind=scout window=firstmate:fm-lab-scout2 worktree=/private/tmp/fmpb.nefE3r/treehouse/.treehouse/demo-989807/7/demo
exit=0
--- base facts for lab-scout2
primary checkout main : c73bf9f (Update instruction marker to FRESH-LOCAL-v2)
origin/main (fetched) : e4566b5
worker worktree       : /private/tmp/fmpb.nefE3r/treehouse/.treehouse/demo-989807/7/demo
worker HEAD           : e4566b5 (seed demo) branch=HEAD
worker CLAUDE.md      : Instruction marker: STALE-ORIGIN-v1
worker status: done [at=1793192683]: done: booted with STALE-ORIGIN-v1
`` `

## S2: flag present, local-only ship starts from the primary checkout main
`` `
$ touch $LAB/config/spawn-base-primary-checkout
$ FM_HOME=$LAB bin/fm-spawn.sh lab-optin $LAB/projects/demo --mode local-only --yolo on --harness claude --model sonnet --effort low
WARNING: watcher still down (same stale episode; last beat: never, grace 300s) - full banner already printed this episode.
spawned lab-optin harness=claude kind=ship mode=local-only yolo=on window=firstmate:fm-lab-optin worktree=/private/tmp/fmpb.nefE3r/treehouse/.treehouse/demo-989807/3/demo
exit=0
--- base facts for lab-optin
primary checkout main : c73bf9f (Update instruction marker to FRESH-LOCAL-v2)
origin/main (fetched) : e4566b5
worker worktree       : /private/tmp/fmpb.nefE3r/treehouse/.treehouse/demo-989807/3/demo
worker HEAD           : c73bf9f (Update instruction marker to FRESH-LOCAL-v2) branch=HEAD
worker CLAUDE.md      : Instruction marker: FRESH-LOCAL-v2
worker status: done [at=1793192570]: booted with FRESH-LOCAL-v2
`` `

## S3: flag present, scout without --base-branch starts from the primary checkout main
`` `
$ FM_HOME=$LAB bin/fm-spawn.sh lab-scout $LAB/projects/demo --scout --harness claude --model sonnet --effort low
WARNING: watcher still down (same stale episode; last beat: never, grace 300s) - full banner already printed this episode.
spawned lab-scout harness=claude kind=scout window=firstmate:fm-lab-scout worktree=/private/tmp/fmpb.nefE3r/treehouse/.treehouse/demo-989807/4/demo
exit=0
--- base facts for lab-scout
primary checkout main : c73bf9f (Update instruction marker to FRESH-LOCAL-v2)
origin/main (fetched) : e4566b5
worker worktree       : /private/tmp/fmpb.nefE3r/treehouse/.treehouse/demo-989807/4/demo
worker HEAD           : c73bf9f (Update instruction marker to FRESH-LOCAL-v2) branch=HEAD
worker CLAUDE.md      : Instruction marker: FRESH-LOCAL-v2
worker status: done [at=1793192599]: done: booted with FRESH-LOCAL-v2
`` `

## S4: flag present, no-mistakes and direct-PR ships keep origin tip
`` `
$ FM_HOME=$LAB bin/fm-spawn.sh lab-nm $LAB/projects/demo --mode no-mistakes --yolo off --harness claude --model sonnet --effort low
WARNING: watcher still down (same stale episode; last beat: never, grace 300s) - full banner already printed this episode.
spawned lab-nm harness=claude kind=ship mode=no-mistakes yolo=off window=firstmate:fm-lab-nm worktree=/private/tmp/fmpb.nefE3r/treehouse/.treehouse/demo-989807/5/demo
exit=0
--- base facts for lab-nm
primary checkout main : c73bf9f (Update instruction marker to FRESH-LOCAL-v2)
origin/main (fetched) : e4566b5
worker worktree       : /private/tmp/fmpb.nefE3r/treehouse/.treehouse/demo-989807/5/demo
worker HEAD           : e4566b5 (seed demo) branch=HEAD
worker CLAUDE.md      : Instruction marker: STALE-ORIGIN-v1
worker status: done [at=1793192607]: booted with STALE-ORIGIN-v1

$ FM_HOME=$LAB bin/fm-spawn.sh lab-dpr $LAB/projects/demo --mode direct-PR --yolo off --harness claude --model sonnet --effort low
WARNING: watcher still down (same stale episode; last beat: never, grace 300s) - full banner already printed this episode.
spawned lab-dpr harness=claude kind=ship mode=direct-PR yolo=off window=firstmate:fm-lab-dpr worktree=/private/tmp/fmpb.nefE3r/treehouse/.treehouse/demo-989807/6/demo
exit=0
--- base facts for lab-dpr
primary checkout main : c73bf9f (Update instruction marker to FRESH-LOCAL-v2)
origin/main (fetched) : e4566b5
worker worktree       : /private/tmp/fmpb.nefE3r/treehouse/.treehouse/demo-989807/6/demo
worker HEAD           : e4566b5 (seed demo) branch=HEAD
worker CLAUDE.md      : Instruction marker: STALE-ORIGIN-v1
worker status: done [at=1793192621]: booted with STALE-ORIGIN-v1
`` `

## S5: flag present, primary diverged from origin (forge-only push): note + origin tip
`` `
$ FM_HOME=$LAB bin/fm-spawn.sh lab-div $LAB/projects/demo --mode local-only --yolo on --harness claude --model sonnet --effort low
WARNING: watcher still down (same stale episode; last beat: never, grace 300s) - full banner already printed this episode.
note: pooled worktree '/private/tmp/fmpb.nefE3r/treehouse/.treehouse/demo-989807/8/demo': main in the primary checkout has diverged from origin/main (ahead by 1, behind by 1); starting from origin's tip
spawned lab-div harness=claude kind=ship mode=local-only yolo=on window=firstmate:fm-lab-div worktree=/private/tmp/fmpb.nefE3r/treehouse/.treehouse/demo-989807/8/demo
exit=0
--- base facts for lab-div
primary checkout main : c73bf9f (Update instruction marker to FRESH-LOCAL-v2)
origin/main (fetched) : bbda8ab
worker worktree       : /private/tmp/fmpb

... [4497 bytes truncated] ...

 stale episode; last beat: never, grace 300s) - full banner already printed this episode.
promoted lab-base to ship mode=no-mistakes yolo=off (teardown protection restored)
wrote ship instructions for mode=no-mistakes: /private/tmp/fmpb.nefE3r/home/data/lab-base/ship-instructions.md
next: FM_HOME=/private/tmp/fmpb.nefE3r/home bin/fm-send.sh fm-lab-base "$(cat /private/tmp/fmpb.nefE3r/home/data/lab-base/ship-instructions.md)"
exit=0
11:3. Return to a clean copy of the base branch `feature/hub`, then create your branch: `git checkout -b fm/lab-base --`.
`` `

## Worker panes (boot evidence)
\### lab-default
`` `
 ▐▛███▛█   Claude Code v2.1.312
▝▜██████▀  Sonnet 5.5 with low effort · Claude Max
 ▝▝   ▝▝   /private/tmp/fmpb.nefE3r/treehouse/.treehouse/demo-989807/2/demo
❯ : Firstmate operational input waiting: read '/private/tmp/fmpb.nefE3r/home/state/operational-inbox/1793192536-e3a118cc8c9a24f3.msg' and handle its contents as Firstmate operational input.
  Read 1 file, ran 1 shell command
⏺ done: booted with STALE-ORIGIN-v1
✻ Baked for 12s · done 2:02 PM
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯ 
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  Sonnet 5.5 demo/HEAD ░░░░░6% 13s +0-0 2026-10-28 14:02
  ⏵⏵ auto mode on (shift+tab to cycle)
`` `
\### lab-optin
`` `
 ▐▛███▛█   Claude Code v2.1.312
▝▜██████▀  Sonnet 5.5 with low effort · Claude Max
 ▝▝   ▝▝   /private/tmp/fmpb.nefE3r/treehouse/.treehouse/demo-989807/3/demo
❯ : Firstmate operational input waiting: read '/private/tmp/fmpb.nefE3r/home/state/operational-inbox/1793192561-b44cfb644e02ef60.msg' and handle its contents as Firstmate operational input.
  Read 1 file, ran 1 shell command
⏺ done: booted with FRESH-LOCAL-v2
✻ Sautéed for 8s · done 2:02 PM
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯ 
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  Sonnet 5.5 demo/HEAD ░░░░░6% 9s +0-0 2026-10-28 14:02
  ⏵⏵ auto mode on (shift+tab to cycle)
`` `
\### lab-nm
`` `
 ▐▛███▛█   Claude Code v2.1.312
▝▜██████▀  Sonnet 5.5 with low effort · Claude Max
 ▝▝   ▝▝   /private/tmp/fmpb.nefE3r/treehouse/.treehouse/demo-989807/5/demo
❯ : Firstmate operational input waiting: read '/private/tmp/fmpb.nefE3r/home/state/operational-inbox/1793192594-6db694a6580d5d3a.msg' and handle its contents as Firstmate operational input.
  Read 1 file, ran 1 shell command
⏺ done: booted with STALE-ORIGIN-v1
✻ Brewed for 11s · done 2:03 PM
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯ 
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  Sonnet 5.5 demo/HEAD ░░░░░7% 12s +0-0 2026-10-28 14:03
  ⏵⏵ auto mode on (shift+tab to cycle)
`` `
\### lab-div
`` `
 ▐▛███▛█   Claude Code v2.1.312
▝▜██████▀  Sonnet 5.5 with low effort · Claude Max
 ▝▝   ▝▝   /private/tmp/fmpb.nefE3r/treehouse/.treehouse/demo-989807/8/demo
❯ : Firstmate operational input waiting: read '/private/tmp/fmpb.nefE3r/home/state/operational-inbox/1793192680-483a72d49ea5fae7.msg' and handle its contents as Firstmate operational input.
  Read 1 file, ran 1 shell command
⏺ I appended the status line done: booted with STALE-ORIGIN-v1 to /private/tmp/fmpb.nefE3r/home/state/lab-div.status. The marker came from the CLAUDE.md loaded into my context at launch.
  I didn't read any project files, run git, create the branch or commit, because the spec ruled those out. The worktree is untouched.
✻ Crunched for 8s · done 2:04 PM
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯ 
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  Sonnet 5.5 demo/HEAD ░░░░░6% 9s +0-0 2026-10-28 14:04
`` `
Evidence: Lab driver: brief and backlog scaffolding

Source: Lab driver: brief and backlog scaffolding

#!/usr/bin/env bash
# scaffold.sh <id> <task-text> <spec-text> <brief-args...>
. /private/tmp/fmpb.nefE3r/driver/env.sh
id=$1 task=$2 spec=$3; shift 3
(cd "$LAB" && lab_run "$WT/bin/fm-brief.sh" "$id" demo "$@") >/dev/null || { echo "brief failed" >&2; exit 1; }
TASK_TEXT="$task" SPEC_TEXT="$spec" python3 - "$LAB/data/$id/brief.md" <<'PY' || exit 1
import os, sys
p = sys.argv[1]
t = open(p, encoding="utf-8").read()
t = t.replace("{TASK}", os.environ["TASK_TEXT"], 1).replace("{FIRSTMATE_SPEC}", os.environ["SPEC_TEXT"], 1)
open(p, "w", encoding="utf-8").write(t)
PY
kind=ship; case " $* " in *" --scout "*) kind=scout ;; esac
(cd "$LAB" && lab_run "$WT/bin/fm-tasks-axi.sh" add "$id" "lab $id" --kind "$kind" --repo demo) >/dev/null || { echo "tasks add failed" >&2; exit 1; }
echo "scaffolded $id ($kind)"
Evidence: Lab driver: real fm-spawn.sh invocation and base facts

Source: Lab driver: real fm-spawn.sh invocation and base facts

#!/usr/bin/env bash
# spawn.sh <id> <spawn-args...>  -> runs the real fm-spawn.sh in the lab and records base facts
. /private/tmp/fmpb.nefE3r/driver/env.sh
id=$1; shift
echo "\$ FM_HOME=\$LAB bin/fm-spawn.sh $id \$LAB/projects/demo $*"
out=$(cd "$LAB" && lab_run "$WT/bin/fm-spawn.sh" "$id" "$LAB/projects/demo" "$@" 2>&1); rc=$?
printf '%s\n' "$out"
echo "exit=$rc"
wt=$(sed -n 's/^worktree=//p' "$LAB/state/$id.meta" 2>/dev/null | tail -1)
P="$LAB/projects/demo"
echo "--- base facts for $id"
echo "primary checkout main : $(git -C "$P" rev-parse --short main) ($(git -C "$P" log -1 --format=%s main))"
echo "origin/main (fetched) : $(git -C "$P" ls-remote origin refs/heads/main | cut -c1-7)"
if [ -n "$wt" ]; then
  echo "worker worktree       : $wt"
  echo "worker HEAD           : $(git -C "$wt" rev-parse --short HEAD) ($(git -C "$wt" log -1 --format=%s HEAD)) branch=$(git -C "$wt" rev-parse --abbrev-ref HEAD)"
  echo "worker CLAUDE.md      : $(grep 'Instruction marker' "$wt/CLAUDE.md" 2>/dev/null)"
fi
Evidence: Worker boot markers per task
lab-default (no flag, local-only) booted with STALE-ORIGIN-v1
lab-scout2 (no flag, scout) booted with STALE-ORIGIN-v1
lab-optin (flag, local-only) booted with FRESH-LOCAL-v2
lab-scout (flag, scout) booted with FRESH-LOCAL-v2
lab-nm (flag, no-mistakes) booted with STALE-ORIGIN-v1
lab-dpr (flag, direct-PR) booted with STALE-ORIGIN-v1
lab-div (flag, diverged) booted with STALE-ORIGIN-v1 (HEAD = origin forge-only tip)
Evidence: Review anchor with and without the flag
flag ON lab-optin (local-only): diff base: main -> farewell_lab-optin.py only
flag ON lab-nm (no-mistakes): diff base: origin/main -> farewell_lab-nm.py only
flag OFF lab-optin: diff base: origin/main -> CLAUDE.md + farewell_lab-optin.py (pre-change anchor)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 14 of 14 scenarios driven live against the product
Scenario Result Live Evidence
Flag absent: a fresh local-only ship on a project whose primary main has landed work locally still starts at origin's frozen tip (unchanged default) ✅ pass live Transcript section S1: worker HEAD e4566b5 = origin/main while primary main = c73bf9f; worker reported 'booted with STALE-ORIGIN-v1'; no base note printed
Flag absent: a fresh scout still starts at origin's tip ✅ pass live Transcript section S1b: lab-scout2 HEAD e4566b5; worker reported STALE-ORIGIN-v1
Flag present: a fresh local-only ship starts from the primary checkout's main and its worker boots with the locally landed instructions ✅ pass live Transcript section S2: worker HEAD c73bf9f = primary main (origin e4566b5); pane shows 'done: booted with FRESH-LOCAL-v2'
Flag present: a scout spawned without --base-branch starts from the primary checkout's main ✅ pass live Transcript section S3: lab-scout HEAD c73bf9f; worker reported FRESH-LOCAL-v2
Flag present (adversarial): no-mistakes and direct-PR ships keep origin's tip ✅ pass live Transcript section S4: lab-nm and lab-dpr HEAD e4566b5 = origin/main despite primary c73bf9f; both workers reported STALE-ORIGIN-v1
Flag present (adversarial): a primary that has diverged from origin keeps origin's tip and prints a note ✅ pass live Transcript section S5: note 'main in the primary checkout has diverged from origin/main (ahead by 1, behind by 1); starting from origin's tip'; worker HEAD bbda8ab = new origin tip and contains forge-…
Flag present (adversarial): a scout with a named --base-branch starts from origin's copy even when the local branch of that name is ahead ✅ pass live Transcript section S6: worker HEAD 79fd75e == origin/feature/hub (yes), == local feature/hub 7b57a8d (no)
Flag present: review of a local-only ship planted on primary main anchors on local main and shows only the task's own work ✅ pass live Transcript review section R1: 'diff base: main', stat lists only farewell_lab-optin.py (not the landed CLAUDE.md commit)
Flag present: review of a no-mistakes ship stays anchored on origin/main ✅ pass live Transcript review section R2: 'diff base: origin/main', stat lists only farewell_lab-nm.py
Flag present: a local-only ship planted on origin's tip before the opt-in is still reviewed as only its own work ✅ pass live Transcript review section R4: lab-default 'diff base: main', stat lists only own_work.py
Flag absent: review keeps the pre-change origin/main anchor ✅ pass live Transcript review section R3: 'diff base: origin/main' (and so includes the landed CLAUDE.md commit, which is why the opt-in review reads the flag)
Flag present: promoting a scout to no-mistakes tells the worker to return to origin's default branch rather than the primary checkout's ✅ pass live Transcript promotion section P1: ship-instructions line 11 'Return to a clean copy of origin's default branch rather than the primary checkout's, which can carry commits origin has never received'
Flag absent: promotion wording is unchanged ✅ pass live Transcript promotion section P2: ship-instructions line 11 'Return to a clean default-branch base'
Flag present (adversarial): promoting a named-base scout keeps the named-base wording ✅ pass live Transcript promotion section P3: ship-instructions line 11 'Return to a clean copy of the base branch feature/hub'
  • Lab setup: bin/fm-lab-home.sh create plus a private tmux server, with TREEHOUSE_ROOT and a throwaway project demo (lab-private bare origin) inside the lab; Claude Code workers ran on sonnet at low effort
  • Setup landing: the lab-land worker edited CLAUDE.md, then FM_HOME=$LAB bin/fm-merge-local.sh lab-land moved local main from e4566b5 to c73bf9f while origin stayed at e4566b5
  • S1: bin/fm-spawn.sh lab-default demo --mode local-only --yolo on with no flag
  • S1b: bin/fm-spawn.sh lab-scout2 demo --scout with no flag
  • S2: touch config/spawn-base-primary-checkout, then bin/fm-spawn.sh lab-optin demo --mode local-only --yolo on
  • S3: bin/fm-spawn.sh lab-scout demo --scout with the flag
  • S4: bin/fm-spawn.sh lab-nm demo --mode no-mistakes --yolo off and bin/fm-spawn.sh lab-dpr demo --mode direct-PR --yolo off with the flag
  • S5: forge-only commit pushed to origin, then bin/fm-spawn.sh lab-div demo --mode local-only --yolo on with the flag
  • S6: origin/feature/hub plus a local feature/hub one commit ahead, then bin/fm-spawn.sh lab-base demo --scout --base-branch feature/hub with the flag
  • Each probe worker was asked, without reading any file, which CLAUDE.md marker it loaded at boot (read from its status line and pane)
  • R1/R2/R4: bin/fm-review-diff.sh lab-optin|lab-nm|lab-default --stat with the flag, after each task committed its own file
  • R3: bin/fm-review-diff.sh lab-optin --stat with the flag temporarily removed
  • P1: bin/fm-promote.sh lab-scout --mode no-mistakes --yolo off with the flag
  • P2: bin/fm-promote.sh lab-scout2 --mode no-mistakes --yolo off without the flag
  • P3: bin/fm-promote.sh lab-base --mode no-mistakes --yolo off with the flag, named base
  • Teardown: lab tmux kill-server; checked no lab processes survived; removed the lab's /tmp/fm-<id> task temp dirs and the 10 lab project entries in ~/.claude.json (atomic replace, same method as fm-live-lab.sh down); fm-lab-home.sh teardown; rm -rf the lab root; checked ~/.treehouse was unchanged and the worktree was clean
  • bash tests/fm-spawn-pool-base-freshen.test.sh (exit 0)
  • bash tests/fm-review-diff.test.sh (exit 0)
  • bash tests/fm-task-delivery.test.sh (exit 0)
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

…ndings

A fresh pooled task worktree is reset to origin/<default>. A local-only
project lands work on the primary checkout's default branch through
fm-merge-local.sh and never pushes, so that ref stays frozen at the last
push and every fresh task starts behind work already landed, loading the
project's instruction files from the stale tree. The always-on fix proposed
in kunchenguid#3812 replaced the specified origin-only refresh for every home; this
rework keeps that rule as the default and moves the new base behind an
explicit, default-off presence flag, following the existing config/<flag>
pattern.

With config/spawn-base-primary-checkout present:
- fm-spawn.sh starts a fresh local-only ship, or a scout without
  --base-branch, from the primary checkout's <default> when it strictly
  contains origin's tip. Publishing modes and named base branches keep
  origin's tip, because that work is delivered against origin. A diverged
  primary keeps origin's tip and prints a note counting both sides. The
  commit is read from the local object store, so nothing extra is fetched,
  and the clean-slot refusal still runs first.
- fm-review-diff.sh anchors a remote-backed task without base_branch= on the
  branch it delivers to: publishing modes stay on origin/<default>, while a
  local-only ship or a scout is compared against whichever of the local
  <default> and origin/<default> meets the branch later, so the review shows
  the task's own work instead of every locally landed commit.
- fm-promote.sh tells a scout promoted to a publishing mode to return to
  origin's default branch, because in this home the scout may have started
  from the primary checkout's branch, whose unpushed commits would otherwise
  be published with the work.

fm-dod-lib.sh gains fm_mode_publishes as the one predicate those three
readers share. Without the flag every path is unchanged: the spawn resets
to origin's tip, the review anchors on origin/<default>, and promotion keeps
its wording; the existing tests run unmodified. Treehouse 3 (verified on
3.1.3) already hands a slot out at whichever of the local and remote default
branch is further ahead, so with the flag the refresh keeps that slot where
Treehouse put it for a local landing instead of rewinding it, and a project
without origin is untouched as before.

Supersedes kunchenguid#3812.
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thank you @mikeastwoody! Letting a local-landing home start fresh local-only ships and scouts from the work it has already landed, without letting unpushed commits leak into anything that publishes, is a thoughtful change.

Contract-class: opt-in (my own read of the tip vs main). Every new branch in bin/fm-spawn.sh, bin/fm-review-diff.sh and bin/fm-promote.sh sits behind [ -e "$CONFIG/spawn-base-primary-checkout" ]. Without the flag the spawn resets to the same target as before, the review anchor stays origin/<default>, and promotion keeps its wording. fm_mode_publishes is a pure helper. Publishing modes, a named base, and a diverged primary all keep origin's tip.

VISION: one-interface / authority (an explicit per-home flag the captain creates, with safe fallbacks) / scripts (a deterministic ancestry check) / restart (no new state) / spine (publishing work stays anchored on origin) / vendor / scope: all align.

Live: go, 9 of 10. The one untested scenario, worker boot, was blocked only by Codex's own folder-trust prompt. The base and review behavior it would have shown is covered by the slot HEAD and AGENTS.md evidence.

CI: I approved the first-time fork CI and Require no-mistakes runs after the diff review (scripts, docs and tests only, no workflow changes). If they come back green and the PR is still mergeable, this can go in on the opt-in path.

Resolve two add/add conflicts where main and this branch each appended a
new config flag at the same place: the config listing in the
operational-home-layout skill and the flag sections in
docs/configuration.md. Both sides are kept, main's wedge flags first and
config/spawn-base-primary-checkout after them.
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate:

Thank you @mikeastwoody for bringing this up to date with main.

What changed since my 2026-10-15 stamp: the head is now 48271eae, a merge of main 83b70ef4 into cd80108f. I checked the merge. The lines this PR adds and removes against main are identical to the original cd80108f change. The only conflict was the list of config flags in the skill and docs, and you kept both sides there. Nothing touches .github, and I have no security concerns.

Where it stands:

  • Contract-class: opt-in (my own read, unchanged). Every new path in bin/fm-spawn.sh, bin/fm-review-diff.sh and bin/fm-promote.sh sits behind config/spawn-base-primary-checkout. With the flag absent, spawn, review and promotion behave exactly as before.
  • VISION: One captain aligns · Authority aligns (an explicit per-home flag the captain creates, with safe fallbacks) · Scripts aligns · Restart aligns · Delegation aligns · Vendor aligns · Scope aligns.
  • CI: CI and Require no-mistakes on this head were waiting for fork workflow approval. I approved both this pass (CI 39680356327, Require no-mistakes 39680356067).
  • One ask (waiting on you): the no-mistakes attestation in the body still points at cd80108f, not at the new merge head 48271eae, so Require no-mistakes won't bind this head. When you get a chance, could you re-raise it with git push no-mistakes so the attestation matches the current head? There's no need to re-run the live lab unless the pipeline asks for it. Your 9-of-10 evidence still covers the same change.

Once the attestation matches and CI is green, this is an opt-in auto-merge candidate.

Resolve three conflicts with main:

- The config listing in the operational-home-layout skill and the flag
  sections in docs/configuration.md, where main and this branch each
  appended a new config flag at the same place. Both sides are kept,
  main's entries first and config/spawn-base-primary-checkout after them.
- freshen_spawn_worktree_base in bin/fm-spawn.sh, where main now returns 2
  for a slot that is not clean and skips the shared call for the T3 Code
  backend. The function keeps main's return codes and this branch's
  <project> <mode> arguments, and the shared call keeps main's t3code
  exclusion with this branch's arguments.

Main's new T3 Code spawn path calls freshen_spawn_worktree_base on its
leased slot, so that call now passes the same <project> <mode> arguments.
Without them an opted-in home would keep origin's tip for a T3 Code
local-only ship or scout, unlike every other backend.
@mikeastwoody mikeastwoody changed the title feat(bin): add opt-in config/spawn-base-primary-checkout for local landings feat(bin): opt-in spawn base from the primary checkout for local-only work Oct 28, 2026
@greptile-apps

greptile-apps Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; both previous findings are addressed.

Reviews (2) · Last reviewed commit: "no-mistakes(ci): The Greptile Review che..." · Reviewed by Greptile

Comment thread bin/fm-promote.sh Resolved
…ngs, not on a broken build or test. I fixed both as the user directed, and the tests and lint pass. ci-1 (bin/fm-promote.sh): promotion must name origin's default branch only when spawn could actually have started the scout from the primary checkout. Spawn does that only when the project has an origin remote and is recorded on the task. Before this fix, the opt-in flag alone made promotion to no-mistakes or direct-PR say "copy of origin's default branch...", even on a project with no origin. - The new wording now also requires a recorded project (`[ -n "$PROMOTE_PROJECT" ]`) whose `git remote get-url origin` succeeds. That is the same check bin/fm-review-diff.sh already makes. The empty-project guard is needed because `git -C ""` would run in the current directory. Otherwise the existing "default-branch base" wording stays. - The three places that read the flag now agree: spawn, review-diff and promote. - I updated the header and inline comments in fm-promote.sh, and the promote line in docs/configuration.md, to say this applies only to a project with an origin remote. - Test: `test_promote_names_origin_for_a_publishing_mode_in_an_opted_in_home` in tests/fm-task-delivery.test.sh now records a real `project=` with a registry entry, and covers flag on/off × origin/none × direct-PR/no-mistakes/local-only. Only flag on + origin + a publishing mode gets the new wording. The named-base case is unchanged. - Before the fix, the test fails with "not ok - flag on, remote none, direct-PR: the promotion changed the default-branch wording". With the fix, it passes. ci-2 (tests/fm-spawn-pool-base-freshen.test.sh): with the flag set, both publishing modes must start from origin's tip and print no divergence note. - The opted-in spawn test now covers no-mistakes as well as direct-PR, local-only and scout. - The expectations no longer single out direct-PR. Both publishing modes now expect origin's tip, no "note: pooled worktree", and a review anchored at the slot's start, in the leading, diverged and trailing cases. Verification: - `bash tests/fm-task-delivery.test.sh`: exit 0. - `bash tests/fm-spawn-pool-base-freshen.test.sh`: exit 0. - `bin/fm-lint.sh` on the three changed shell files: exit 0 (ShellCheck 0.11.0, pinned, with extended analysis)
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thank you @mikeastwoody for re-raising this through no-mistakes and fixing both Greptile findings.

What changed since my 2026-10-21 stamp: the head is now 9ffc3357. It merges current main, drops the change-relative doc wording, and makes promotion name origin's default branch only when the project is recorded and has an origin remote. That is now the same check spawn and review-diff make. I read the full diff against main 417cec2f. Every new path in bin/fm-spawn.sh, bin/fm-review-diff.sh and bin/fm-promote.sh is still behind config/spawn-base-primary-checkout. The reset only moves to a commit that strictly contains origin's tip, and nothing touches .github. I have no security concerns.

Where it stands:

  • Contract-class: opt-in (my own read, unchanged). With the flag absent, spawn, review and promotion behave exactly as before.
  • VISION: One captain aligns · Authority aligns (an explicit per-home flag, with safe fallbacks for publishing modes, named bases and diverged primaries) · Scripts aligns (deterministic ancestry check) · Restart aligns (no new state) · Delegation aligns (published work stays anchored on origin) · Vendor aligns (git-only) · Scope aligns.
  • No-mistakes: the attestation now binds 9ffc3357. Thank you, that was the one open ask.
  • CI: the CI and Require no-mistakes runs on this head were waiting for fork workflow approval. I approved them this pass (CI 40698338862, Require no-mistakes 40698339504 and 40699325856). GitHub Actions is backlogged right now, so they may sit queued for a while.

Nothing is needed from you right now. This is waiting on CI. If it goes green on this head and stays mergeable, it can land as opt-in on a later pass.

@kunchenguid
kunchenguid merged commit 821409b into kunchenguid:main Oct 28, 2026
22 checks passed
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: this is merged. Thank you @mikeastwoody — really appreciate you taking the time on this.

It landed as opt-in (nothing changes unless a home creates config/spawn-base-primary-checkout), with all 21 checks green and the no-mistakes attestation on 9ffc3357.