Skip to content

feat(bin): add a firstmate-filled recall section to crewmate briefs - #25

Merged
alandomio merged 2 commits into
mainfrom
fm/fm-brief-grounding
Sep 10, 2026
Merged

alandomio merged 2 commits into
mainfrom
fm/fm-brief-grounding

Conversation

@alandomio

Copy link
Copy Markdown
Owner

Intent

Add a firstmate-authored grounding section to the crewmate brief scaffold generated by bin/fm-brief.sh, so the knowledge firstmate already holds is consulted when the shape of a task is decided (branch, delivery mode, scope - chosen by firstmate while writing the brief), not after the task is finished.

Rationale: the /retrospective skill's Step 1 pre-flight recall runs at session end where it cannot change finished work; three consecutive KILL-CRITERION ledger rows show recall changed work only via data/learnings.md loaded at session start. The scaffold's existing # Grounding section instructs the crewmate to ground itself, but a crewmate cannot correct a decision made before it existed. Receipt: GOP-275 (unauthenticated SQL injection) was put on branch php8 while the captain deploys test; the fix merged and the hole stayed open. The knowledge that would have raised "which branch reaches the environment where this fix must take effect?" was already in the store.

Requirements: a new section in the scaffold, filled by firstmate before dispatch, clearly distinct from the crewmate-facing # Grounding, with two parts: (1) what we already know - what recall returned, quoted not summarised; (2) what it changed about this brief - one sentence. "Nothing" must be a first-class, explicitly allowed answer for part 2, stated in the scaffold text itself, because a fabricated grounding line launders a guess as evidence. Do not build a query-runner or wire in a specific memory tool; which sources exist is not this task's business. Load firstmate-coding-guidelines; follow bin/ and AGENTS.md conventions. Keep the always-loaded AGENTS.md contract concise (one sentence if one will do; prefer amending an existing sentence over appending a rule). Do not weaken or reword any existing scaffold safety property - the worktree-isolation assertion and the status protocol stay exactly as they are. Never echo/copy/log/commit GEMINI_API_KEY.

Acceptance: newly generated brief contains the section, visibly distinct from the crewmate's grounding, text making clear firstmate fills it and that "nothing" is valid for part 2; existing generated sections unchanged; enforcement decision implemented and reasoning stated in the PR; tests covering the new scaffold output; bin/fm-lint.sh and bin/fm-doc-audience-check.sh clean.

Decisions made (deliberate, not mistakes):

  • Section "# Firstmate recall - written by firstmate before dispatch" sits between # Task and # Grounding in ship and scout briefs, with placeholders {RECALL_FOUND: ...} and {RECALL_CHANGED: ...} whose inline text is firstmate-facing guidance removed on fill; worker-visible framing says "Nothing" is an honest answer, not an omission. The example is deliberately generic (release vs develop), not GOPlanner-specific, because this is a shared template.
  • Enforcement: bin/fm-spawn.sh refuses a fresh ship or scout spawn while either placeholder remains, before any endpoint exists, naming the placeholder. It checks only that each was replaced, never the content, so an honest "Nothing" is the cheapest way past it (a content check would teach pasting noise). A brief with the section deliberately deleted is not refused or warned about (deletion is a visible deliberate act; a warning would fire on every hand-written test/fixture brief). --relaunch skips the check so recovery of an existing task is never blocked. Secondmate charters skip it.
  • Scope: ship and scout only. Ship fixes branch/mode/scope; a scout's question framing is a shape decision and scouts promote in place to ship. A secondmate charter is a standing routing scope; its task-shape decisions happen when the secondmate writes its own crewmate briefs, which carry the section - same reasoning as the existing Grounding omission.
  • AGENTS.md: section 11's existing {TASK} sentence amended to also cover filling the recall placeholders; no new rule appended; section 7 untouched.
  • The live opt-in cmux composer test now fills the recall placeholders so it is not refused; fm-task-delivery.test.sh gains the spawn-refusal test beside the existing delivery-mismatch refusal test.
  • No agent co-author trailer on commits (repo rule).

What Changed

  • bin/fm-brief.sh now puts a new # Firstmate recall - written by firstmate before dispatch section into ship and scout briefs, between # Task and the crewmate's own # Grounding. The section has two placeholders: {RECALL_FOUND: firstmate - ...} holds what firstmate's recall returned, quoted rather than summarised. {RECALL_CHANGED: firstmate - ...} holds one sentence on which shape decision it changed (project, base branch, delivery mode or scope). The text tells the crewmate that firstmate filled the section. It also says "Nothing" is an honest answer and a first-class one for the second part, and that no change should be invented to fill the line. Secondmate charters leave the section out, for the same reason they leave out Grounding. The scaffold's "scaffolded:" message now lists the recall placeholders too. The other generated sections are unchanged, including the worktree-isolation assertion and the status protocol.
  • Enforcement is in bin/fm-spawn.sh. A fresh ship or scout spawn is refused while either placeholder is still in its unfilled scaffold form ({RECALL_FOUND: firstmate - / {RECALL_CHANGED: firstmate - ). The error names the placeholder and says "Nothing" is valid, and the refusal happens before any endpoint or task metadata exists. The reasoning:
    • The check only confirms each placeholder was replaced, never what with. That keeps an honest "Nothing" the cheapest way through; a content check would teach people to paste in noise.
    • A bare {RECALL_FOUND} mentioned in a filled brief doesn't trip it.
    • A brief with the section deliberately deleted is allowed. Deleting it is a visible choice, and a warning would fire on every hand-written or fixture brief.
    • --relaunch skips the check, so recovering an existing task is never blocked. Secondmate charters skip it too.
  • AGENTS.md §11: the existing {TASK} sentence now also covers filling the recall placeholders, with "nothing" allowed as an answer; no new rule was added. tests/fm-brief.test.sh checks that the section and its wording are present, that it sits in Task → recall → Grounding order, and that secondmate charters don't have it. tests/fm-task-delivery.test.sh checks that spawns are refused while the ship or scout placeholders are unfilled or half-filled, that "Nothing" gets through, and that a mention of the bare tokens isn't treated as unfilled. The opt-in live cmux composer test now fills the recall placeholders so it isn't refused.

🤖 Generated with Claude Code

Risk Assessment

✅ Low: The change adds one templated brief section and one early, content-agnostic spawn refusal. The refusal uses the existing exit-and-trap path, is skipped for relaunch and secondmate, runs in a separate process per batch pair, and has no automated caller that would now be refused; last round's narrowing fix matches the scaffold's exact prefix and has a test that would fail against the old check.

Testing

I ran the two suites holding the new tests (fm-brief, fm-task-delivery) and three related suites that scaffold briefs or exercise spawn and relaunch paths (tangle-guard, secondmate-safety, control-relaunch); all passed. I also checked the behaviour end to end and saved evidence files: a base-vs-head diff of generated briefs showing the recall section is the only change and nothing existing was removed; a sandboxed fm-brief.sh -> fm-spawn.sh transcript showing unfilled ship and scout briefs refused with the placeholder named and no task record written, "Nothing" and bare-token briefs getting past the check; and a relaunch probe showing --relaunch is not held by unfilled placeholders. Nothing failed, and the worktree is clean. bin/fm-lint.sh and bin/fm-doc-audience-check.sh were not run because this phase excludes linters and static checks. The change has no UI, so there are no screenshots; the CLI transcripts and generated briefs are the user-facing surface.

Evidence: Generated ship/scout brief diff, base vs head (additions only; existing sections unchanged)

Source: Generated ship/scout brief diff, base vs head (additions only; existing sections unchanged)

# Generated brief diff: base b82fc57 vs head 5dd9597 (FM_HOME and FM_ROOT paths normalised)

## ship
--- base/ship-brief.md
+++ head/ship-brief.md
@@ -3,6 +3,17 @@
 # Task
 {TASK}
 
+# Firstmate recall - written by firstmate before dispatch
+Firstmate filled this section, not you, while choosing this task's shape - project, base branch, delivery mode, and scope - before you existed.
+It is separate from your own `# Grounding` below: that is your search, this is the record of firstmate's, and if yours contradicts it, say so in the status line Grounding asks for.
+"Nothing" in either part is an honest answer, not an omission.
+
+What firstmate already knows:
+{RECALL_FOUND: firstmate - quote verbatim, never summarise, what your recall returned on this subject, or write "Nothing relevant" and name what you searched.}
+
+What it changed about this brief:
+{RECALL_CHANGED: firstmate - one sentence naming the shape decision it changed, such as "for this reason the base branch is `release`, the one that deploys, and not `develop`", or write "Nothing". Nothing is a first-class answer: never invent a change to fill this line, because a fabricated grounding line launders a guess as evidence.}
+
 # Grounding
 Before your first substantive action, search PP Brain (`search_knowledge` with both `query` and `prompt` populated - one alone kills two of six retrieval paths) and the local memory store for prior decisions, refuted approaches, and known traps on this subject.
 Treat the `# Task` section above as firstmate's assembly of that context, a starting point rather than a substitute.

## scout
--- base/scout-brief.md
+++ head/scout-brief.md
@@ -3,6 +3,17 @@
 # Task
 {TASK}
 
+# Firstmate recall - written by firstmate before dispatch
+Firstmate filled this section, not you, while choosing this task's shape - project, base branch, delivery mode, and scope - before you existed.
+It is separate from your own `# Grounding` below: that is your search, this is the record of firstmate's, and if yours contradicts it, say so in the status line Grounding asks for.
+"Nothing" in either part is an honest answer, not an omission.
+
+What firstmate already knows:
+{RECALL_FOUND: firstmate - quote verbatim, never summarise, what your recall returned on this subject, or write "Nothing relevant" and name what you searched.}
+
+What it changed about this brief:
+{RECALL_CHANGED: firstmate - one sentence naming the shape decision it changed, such as "for this reason the base branch is `release`, the one that deploys, and not `develop`", or write "Nothing". Nothing is a first-class answer: never invent a change to fill this line, because a fabricated grounding line launders a guess as evidence.}
+
 # Grounding
 Before your first substantive action, search PP Brain (`search_knowledge` with both `query` and `prompt` populated - one alone kills two of six retrieval paths) and the local memory store for prior decisions, refuted approaches, and known traps on this subject.
 Treat the `# Task` section above as firstmate's assembly of that context, a starting point rather than a substitute.
Evidence: Newly generated ship brief (placeholders unfilled)

Source: Newly generated ship brief (placeholders unfilled)

You are a crewmate: an autonomous worker agent managed by firstmate. Work on your own; do not wait for a human.

# Task
{TASK}

# Firstmate recall - written by firstmate before dispatch
Firstmate filled this section, not you, while choosing this task's shape - project, base branch, delivery mode, and scope - before you existed.
It is separate from your own `# Grounding` below: that is your search, this is the record of firstmate's, and if yours contradicts it, say so in the status line Grounding asks for.
"Nothing" in either part is an honest answer, not an omission.

What firstmate already knows:
{RECALL_FOUND: firstmate - quote verbatim, never summarise, what your recall returned on this subject, or write "Nothing relevant" and name what you searched.}

What it changed about this brief:
{RECALL_CHANGED: firstmate - one sentence naming the shape decision it changed, such as "for this reason the base branch is `release`, the one that deploys, and not `develop`", or write "Nothing". Nothing is a first-class answer: never invent a change to fill this line, because a fabricated grounding line launders a guess as evidence.}

# Grounding
Before your first substantive action, search PP Brain (`search_knowledge` with both `query` and `prompt` populated - one alone kills two of six retrieval paths) and the local memory store for prior decisions, refuted approaches, and known traps on this subject.
Treat the `# Task` section above as firstmate's assembly of that context, a starting point rather than a substitute.
Report what you found and what it changed in your next status line, or state plainly that both were silent.
If the session-start banner reports `pp-brain: auth_missing`, or anything else suggests PP Brain is unauthenticated, treat that alone as a known false positive: make ONE real `search_knowledge` call before acting on it.
Only a failing live call is evidence - never stop, and never proceed without org context, on the banner alone.
If that live call genuinely fails, append `blocked: <server> unreachable (confirmed by a live call, not the startup banner)` to the status file and stop; firstmate will help.

# Herdr lifecycle declaration - NOT ENABLED
**HARD SAFETY GATE:** this scaffold cannot inspect the task text that replaces `{TASK}` later.
If the task will start, stop, delete, restart, profile, or otherwise drive Herdr lifecycle behavior, stop and regenerate the brief with `--herdr-lab` before dispatch.
Do not add Herdr lifecycle commands to this unguarded brief by hand.

# Setup
You are in a disposable git worktree of some-proj, at a detached HEAD on a clean default branch.

**Verify isolation before anything else.** Run `pwd -P` and `git rev-parse --show-toplevel`; both must resolve to the disposable task worktree you were launched in, such as a treehouse pool path or an Orca-managed worktree, not the primary checkout firstmate operates from.
The path check is authoritative: `git rev-parse --git-dir` and `git rev-parse --git-common-dir` can help inspect the repo, but they do not prove you are outside the primary checkout.
If the top-level path is the primary checkout or not the worktree you were launched in, STOP - do not branch or commit here - append `blocked: launched in primary checkout, not an isolated worktree` to the status file and stop.

1. First action: create your branch: `git checkout -b fm/demo-ship`
2. Run `no-mistakes doctor`; if it reports the repo is not initialized here, run `no-mistakes init`.

# Rules
1. Never push to the default branch. Never merge a pull/merge request.
2. Stay inside this worktree; modify nothing outside it.
3. This project's forge could not be determined from its git remote; run `git remote -v` to check, then use gh-axi for GitHub or glab for GitLab. chrome-devtools-axi remains available for browser operations.
4. Report status by appending one line:
   `echo "{state}: {one short line}" >> 'FM_HOME/state/demo-ship.status'`
   States: working, note, needs-decision, blocked, paused, done, failed.
   Each append wakes firstmate, so report sparingly: only phase changes a supervisor
   would act on (setup done, bug reproduced, fix implemented, validation passed) and the
   needs-decision/blocked/paused/done/failed states. No step-by-step FYI progress lines;
   firstmate reads your pane for that.
   A mid-task `working:` or `note:` line (including setup complete) is nonterminal: do not end the
   turn after it; continue the same stage until a defined `done:` gate under Definition of done.
   Use `paused: {why}` - distinct from `blocked:` - ONLY when you are deliberately idling on a
   known external wait you expect to clear on its own (an upstream release, a rate-limit reset,
   a scheduled window): firstmate then leaves your idle pane alone and rechecks it on a long
   cadence instead of treating it as a possible wedge. Use `blocked:` when you are stuck and need help. If a declared wait concerns an open PR/MR under review, describe it as awaiting a colleague's approval, never the captain's merge decision - the captain cannot approve their own pull/merge request.
   When you discover a durable finding (knowledge-store drift, a ticket whose real state differs
   from this brief, verified behavior of a tool, a trap the next worker would hit), append it as
   `note: CANDIDATE - {finding}` rather than acting on it yourself: you record candidates, only
   firstmate promotes them, and you must never write to PP Brain or any shared memory directly.
   Every `note:` line reaches firstmate: the next status drain presents it whatever its wording.
   But `note:` is not yet covered by the supervision wedge guards that protect `working:`,
   `resolved:` and `captain-held:`, so while a note whose prose happens to match a legacy
   captain-relevant free-text pattern is your last line, wedge detection for your pane can be
   suppressed. That gap lives in those guards, not in note wording, and is tracked separately.
   Before the FIRST `done:` or `failed:` line you write, send at least one `working:` status
   that carries real substance (a finding, a decision, a completed stage) - never end a task on
   a single `done:` line with nothing reported before it.
   That first substantive line must also declare which of this task's prescribed project-specific
   skills or procedures you invoked, and which prescribed ones you did not and why; if the Task
   section prescribed none, say so explicitly - never leave that line silent on which you actually used.
5. If you hit the same obstacle twice, append `blocked: {why}` and stop; firstmate will help.
6. If a decision belongs above the implementation worker (product choices, destructive actions, ask-user findings),
   append `needs-decision: {summary of options}` and stop. Firstmate will reply with the decision.
   A decision or blocker you opened stays open until a `resolved` line carrying its exact key lands; a later `done:` or `working:` line never closes it, even when the answer is what started that work.
   Firstmate's reply normally writes that closing line at answer time; when a blocker or wait clears WITHOUT a firstmate reply, append `resolved: {how it cleared}` yourself (same `[key=<slug>]` if you opened it with one) as you resume.
7. Never stop, restart, or update the shared `no-mistakes` daemon - it is one instance serving
   every lane/home, so restarting it kills other lanes' in-flight pipeline runs. On ANY no-mistakes
   daemon error, append `blocked: {the daemon error}` and stop; only firstmate manages the daemon.

# Project memory
Never write to this project's `AGENTS.md` or `CLAUDE.md`; only firstmate writes it, and only on the captain's explicit confirmation.
If this task produced durable project-intrinsic knowledge, raise it as a `note: CANDIDATE - {finding}` status line (Rule 4) instead of touching the file yourself.

# Definition of done
Delivery contract: mode=no-mistakes
The task is complete only when committed on your branch.
When you believe it is complete, append `done: {summary}` to the status file and stop.
Firstmate will then instruct you to run /no-mistakes to validate and ship a pull/merge request.

You drive no-mistakes by responding to its gates, not by implementing fixes.
Follow the guidance no-mistakes itself provides for the mechanics: it loads when you invoke /no-mistakes, and `no-mistakes axi run --help` plus the `help` lines in each `axi` response are authoritative and version-matched to the installed binary.
When starting no-mistakes, make `--intent` preserve all relevant content from this brief's `# Task` section plus every later accepted Firstmate requirement, clarification, constraint, exclusion, and supersession, carrying only each requirement's current accepted form; retain direct requirements instead of substituting a diff summary, and exclude generic operational, status, delivery, and other scaffold boilerplate unless it is task-specific.
Do not hand-edit, commit, or fix findings yourself while a run is active - the pipeline applies every fix.

Two firstmate-specific rules layer on top of that guidance:
- ask-user findings are never yours to answer: escalate to firstmate (rule 6) and stop.
  Firstmate applies `ask-user-authority` and obtains any required captain decision.
  When the decision comes back, feed it to the gate with `no-mistakes axi respond` and let the pipeline apply it - do not route the question to "the user" or implement the fix yourself.
- Avoid `--yes`: it would silently bypass firstmate's authority check and any required captain escalation.

After /no-mistakes reports CI green (the CI-ready return point - do not wait for it to keep monitoring in the background until merge), append `done: PR/MR {url} checks green` and stop. You are finished.
Evidence: Newly generated scout brief (placeholders unfilled)

Source: Newly generated scout brief (placeholders unfilled)

You are a crewmate: an autonomous worker agent managed by firstmate. Work on your own; do not wait for a human.

# Task
{TASK}

# Firstmate recall - written by firstmate before dispatch
Firstmate filled this section, not you, while choosing this task's shape - project, base branch, delivery mode, and scope - before you existed.
It is separate from your own `# Grounding` below: that is your search, this is the record of firstmate's, and if yours contradicts it, say so in the status line Grounding asks for.
"Nothing" in either part is an honest answer, not an omission.

What firstmate already knows:
{RECALL_FOUND: firstmate - quote verbatim, never summarise, what your recall returned on this subject, or write "Nothing relevant" and name what you searched.}

What it changed about this brief:
{RECALL_CHANGED: firstmate - one sentence naming the shape decision it changed, such as "for this reason the base branch is `release`, the one that deploys, and not `develop`", or write "Nothing". Nothing is a first-class answer: never invent a change to fill this line, because a fabricated grounding line launders a guess as evidence.}

# Grounding
Before your first substantive action, search PP Brain (`search_knowledge` with both `query` and `prompt` populated - one alone kills two of six retrieval paths) and the local memory store for prior decisions, refuted approaches, and known traps on this subject.
Treat the `# Task` section above as firstmate's assembly of that context, a starting point rather than a substitute.
Report what you found and what it changed in your next status line, or state plainly that both were silent.

# Herdr lifecycle declaration - NOT ENABLED
**HARD SAFETY GATE:** this scaffold cannot inspect the task text that replaces `{TASK}` later.
If the task will start, stop, delete, restart, profile, or otherwise drive Herdr lifecycle behavior, stop and regenerate the brief with `--herdr-lab` before dispatch.
Do not add Herdr lifecycle commands to this unguarded brief by hand.

# Setup
You are in a disposable git worktree of some-proj, at a detached HEAD on a clean default branch.
This is a SCOUT task: the deliverable is a written report, not a pull/merge request.
The worktree is your laboratory - install, run, edit, and make scratch commits freely; all of it is discarded at teardown.
The report is the only thing that survives, so anything worth keeping must be in it.

# Rules
1. Never push to any remote and never open a pull/merge request.
2. Stay inside this worktree; the only files you may write outside it are the report and the status file below.
3. This project's forge could not be determined from its git remote; run `git remote -v` to check, then use gh-axi for GitHub or glab for GitLab. chrome-devtools-axi remains available for browser operations.
4. Report status by appending one line:
   `echo "{state}: {one short line}" >> 'FM_HOME/state/demo-scout.status'`
   States: working, needs-decision, blocked, paused, done, failed.
   Each append wakes firstmate, so report sparingly: only phase changes a supervisor
   would act on and the needs-decision/blocked/paused/done/failed states. No step-by-step
   FYI progress lines; firstmate reads your pane for that.
   Use `paused: {why}` - distinct from `blocked:` - ONLY when you are deliberately idling on a
   known external wait you expect to clear on its own (an upstream release, a rate-limit reset):
   firstmate then leaves your idle pane alone and rechecks it on a long cadence instead of
   treating it as a possible wedge. Use `blocked:` when you are stuck and need help.
   The first status line you send, whatever its state, must also declare which of this task's
   prescribed project-specific skills or procedures you invoked, and which prescribed ones you
   did not and why; if the Task section prescribed none, say so explicitly - never leave that
   line silent on which you actually used.
5. If you hit the same obstacle twice, append `blocked: {why}` and stop; firstmate will help.
6. If a decision belongs to a human (product choices, destructive actions),
   append `needs-decision: {summary of options}` and stop. Firstmate will reply with the decision.
   A decision or blocker you opened stays open until a `resolved` line carrying its exact key lands; a later `done:` or `working:` line never closes it, even when the answer is what started that work.
   Firstmate's reply normally writes that closing line at answer time; when a blocker or wait clears WITHOUT a firstmate reply, append `resolved: {how it cleared}` yourself (same `[key=<slug>]` if you opened it with one) as you resume.
7. Never stop, restart, or update the shared `no-mistakes` daemon - it is one instance serving
   every lane/home, so restarting it kills other lanes' in-flight pipeline runs. On ANY no-mistakes
   daemon error, append `blocked: {the daemon error}` and stop; only firstmate manages the daemon.

# Definition of done
Write your findings to `FM_HOME/data/demo-scout/report.md`.
The report must stand alone: what you did, what you found, the evidence (commands run, output, file:line references), and what you recommend.
If your deliverable is a visual artifact the captain will review and iterate on, you may host the Lavish review loop yourself (poll, revise, re-serve, staying alive) instead of handing it back to firstmate.
Before reporting done, read and follow `FM_ROOT/.agents/skills/captain-hold-lifecycle/SKILL.md` and pass its shared completion gate for the report and any visual review.
When the report is complete, append `done: {one-line conclusion}` to the status file and stop.
If your findings reveal work that should ship (e.g. you reproduced a bug and the fix is clear), say so in the report; firstmate may promote this task in place, and you would then receive mode-specific ship instructions as a follow-up message.
Evidence: fm-brief.sh -> fm-spawn.sh recall enforcement CLI transcript

Source: fm-brief.sh -> fm-spawn.sh recall enforcement CLI transcript

# fm-brief.sh -> fm-spawn.sh recall enforcement transcript
# sandbox FM_HOME, fake tmux that exits 1 (so nothing is ever launched), FM_GATE_REFUSE_BYPASS=1 exactly as tests/lib.sh sets for the suite

$ fm-brief.sh demo-ship proj --mode no-mistakes
scaffolded: $TMP/home/data/demo-ship/brief.md (ship, mode=no-mistakes; replace {TASK}, {RECALL_FOUND}, {RECALL_CHANGED})

$ fm-spawn.sh demo-ship $PROJ claude --mode no-mistakes --yolo off   # only {TASK} filled
error: $TMP/home/data/demo-ship/brief.md still carries its unfilled {RECALL_FOUND} placeholder; fill the firstmate recall section with what you consulted before fixing this task's shape and what it changed ("Nothing" is a valid answer), then spawn again
[exit=1]
[task meta written: no]

$ fm-spawn.sh demo-ship ...   # RECALL_FOUND filled, RECALL_CHANGED still unfilled
error: $TMP/home/data/demo-ship/brief.md still carries its unfilled {RECALL_CHANGED} placeholder; fill the firstmate recall section with what you consulted before fixing this task's shape and what it changed ("Nothing" is a valid answer), then spawn again
[exit=1]
[task meta written: no]

$ fm-spawn.sh demo-ship ...   # both parts answered with Nothing: clears the recall check, then stops later at the refusing fake tmux

[exit=1]

--- filled recall section as the worker receives it:
# Firstmate recall - written by firstmate before dispatch
Firstmate filled this section, not you, while choosing this task's shape - project, base branch, delivery mode, and scope - before you existed.
It is separate from your own `# Grounding` below: that is your search, this is the record of firstmate's, and if yours contradicts it, say so in the status line Grounding asks for.
"Nothing" in either part is an honest answer, not an omission.

What firstmate already knows:
Nothing relevant; searched data/learnings.md for "sample".

What it changed about this brief:
Nothing.

# Grounding

$ fm-spawn.sh demo-mention ...   # both parts filled; Task text mentions the bare {RECALL_FOUND}/{RECALL_CHANGED} tokens

[exit=1]

$ fm-spawn.sh demo-scout $PROJ claude --scout   # scout brief, recall unfilled
error: $TMP/home/data/demo-scout/brief.md still carries its unfilled {RECALL_FOUND} placeholder; fill the firstmate recall section with what you consulted before fixing this task's shape and what it changed ("Nothing" is a valid answer), then spawn again
[exit=1]
[task meta written: no]

$ fm-spawn.sh demo-scout --relaunch   # same unfilled brief; relaunch is not held by the recall check
error: --relaunch needs an existing task record; no $TMP/home/state/demo-scout.meta
[exit=1]
Evidence: Relaunch is not held by an unfilled recall section

Source: Relaunch is not held by an unfilled recall section

--- fm-spawn.sh rl90 --relaunch --harness claude (brief still carries both unfilled recall placeholders)
spawned rl90 harness=claude kind=ship mode=no-mistakes yolo=off window=fmses:fm-rl90 worktree=$TMP/recallprobe-27297/wt
[exit=0]
ok - probe: fm-spawn --relaunch is not held by an unfilled firstmate recall section
Evidence: Spawn refusal for an unfilled ship brief
$ fm-spawn.sh demo-ship $PROJ claude --mode no-mistakes --yolo off # only {TASK} filled
error: $TMP/home/data/demo-ship/brief.md still carries its unfilled {RECALL_FOUND} placeholder; fill the firstmate recall section with what you consulted before fixing this task's shape and what it changed ("Nothing" is a valid answer), then spawn again
[exit=1]
[task meta written: no]

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 1 issue found → auto-fixed ✅
  • ⚠️ bin/fm-spawn.sh:1708 - The recall refusal runs grep -qF &#39;{RECALL_FOUND&#39; / &#39;{RECALL_CHANGED&#39; over the whole brief, not just the scaffold's placeholder form, so it also refuses a brief that only mentions the token. Concrete path: firstmate works on its own repo (for example a --no-projects secondmate's crews, or a follow-up to this feature). It writes a Task such as "rename the {RECALL_FOUND} placeholder in bin/fm-brief.sh", or it follows the section's own instruction to quote recall verbatim and the quoted memory names the token. Both recall parts are properly filled, yet fm-spawn exits 1 with "still carries its unfilled {RECALL_FOUND} placeholder". The only way past is to obfuscate the task or the quote, which contradicts the "quote verbatim" requirement. The scaffold always emits the placeholder as {RECALL_FOUND: / {RECALL_CHANGED: (colon, then the firstmate guidance). Matching that colon form (e.g. &#39;{RECALL_FOUND:&#39;) keeps the "was it replaced" check intact without catching prose or backticked mentions of {RECALL_FOUND}. The new test's perl s/\{RECALL_FOUND:[^}]*\}/.../ fills and the live cmux test's regex already key on that colon form.

🔧 Fix: Narrow recall placeholder check to scaffold's unfilled prefix form
✅ Re-checked - no issues remain.

✅ **Test** - passed

✅ No issues found.

  • bash tests/fm-brief.test.sh (includes the new test_firstmate_recall_section) - exit 0
  • bash tests/fm-task-delivery.test.sh (includes the new test_spawn_refuses_an_unfilled_recall_section, including the bare-token case from review round 1) - exit 0
  • bash tests/fm-tangle-guard.test.sh (scaffolds a ship brief with fm-brief.sh, then spawns it) - exit 0
  • bash tests/fm-secondmate-safety.test.sh (brief scaffolds plus secondmate charter spawns, which skip the check) - exit 0
  • bash tests/fm-control-relaunch.test.sh (the relaunch path the check exempts) - exit 0
  • Manual: rendered ship and scout briefs from base b82fc57 (git archive) and HEAD, normalised FM_HOME/FM_ROOT, and diffed them - only additions, no removed or reworded lines
  • Manual CLI transcript in a sandbox FM_HOME with a fake tmux that exits 1 and FM_GATE_REFUSE_BYPASS=1, the same bypass tests/lib.sh sets: fm-brief.sh scaffold -> fm-spawn.sh refused unfilled {RECALL_FOUND}, then {RECALL_CHANGED}, with no .meta written; a scout brief was refused the same way; after a Nothing fill it got past the check
  • Manual: a filled brief whose Task mentions the bare {RECALL_FOUND}/{RECALL_CHANGED} tokens reached tmux new-window (logged by the fake tmux), so it passed the recall check
  • Manual relaunch probe: a throwaway copy of fm-control-relaunch.test.sh under /tmp, with one appended case using a real fm-brief.sh brief that still has both placeholders unfilled; fm-spawn.sh rl90 --relaunch --harness claude exited 0 and launched the replacement
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

Alan Domio added 2 commits September 11, 2026 00:20
Branch, delivery mode, and scope are fixed by firstmate while it writes the
brief, before the worker exists, so the worker's own Grounding section can
never correct them. Ship and scout scaffolds now carry a firstmate recall
section between Task and Grounding: what recall returned, quoted, and what it
changed about the brief, where "Nothing" is an explicit first-class answer.

fm-spawn.sh refuses a fresh ship or scout spawn while either recall
placeholder remains, checking only that each was replaced, never with what;
relaunch and secondmate charters skip the check. AGENTS.md section 11's
placeholder sentence is amended to cover the new placeholders.
@alandomio
alandomio merged commit 4a6429b into main Sep 10, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant