Skip to content

feat(bin): make PP Brain grounding a repeated, gotcha-aware contract - #24

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

alandomio merged 6 commits into
mainfrom
fm/brief-ppbrain-grounding

Conversation

@alandomio

@alandomio alandomio commented Sep 10, 2026 •

Copy link
Copy Markdown
Owner

Intent

Re-run to completion after the prior runs document step was wrongly skipped instead of approved (a supervisor error, not a code issue). No code changes since the prior run: the branch already carries the complete, reviewed fm/brief-ppbrain-grounding work (Grounding gotcha rule + re-search wording in bin/fm-brief.sh, matching tests/fm-brief.test.sh coverage, and the AGENTS.md wording correction). This run should reach the document gate, and the one remaining out-of-scope finding there (the note: CANDIDATE mechanism restated across AGENTS.md/docs/architecture.md/stow skill) should be accepted via --action approve, not skip, so the step completes rather than being skipped, since the repos own CI check requires review/test/document to each be exactly completed.

What Changed

  • bin/fm-brief.sh: the Grounding section of ship and scout briefs now frames the PP Brain / local-memory search as repeatable rather than one-shot ("searching costs only latency"), and adds a rule that on any obstacle, surprising behavior, or trap the worker checks PP Brain first — citing it if documented, or appending note: CANDIDATE - {finding} if not — while never writing to PP Brain or any shared memory directly. The header comment block is updated to describe the widened contract.
  • bin/fm-brief.sh: the scout brief's Rule 4 states enumeration now includes note, so the state the new Grounding line instructs is actually declared.
  • tests/fm-brief.test.sh: adds assertions covering the repeated-search wording, the gotcha CANDIDATE line, and the direct-write prohibition in both ship and scout briefs, plus the scout note state; the scout "no ship-only contract" guards are re-keyed onto ship-only phrasings now that scout legitimately carries a note: CANDIDATE line. AGENTS.md wording corrected to say a ship or scout brief carries that contract.

🤖 Generated with Claude Code

Risk Assessment

✅ Low: The change is a bounded prose edit to two generated-brief scaffolds plus matching guard tightening, with no executable logic touched; I verified against generated briefs that the ship-only guards now discriminate correctly, the scout brief carries exactly the intended shared clauses, and nothing else in the repo parses the changed lines.

Testing

Ran the single relevant suite (bin/fm-test-run.sh tests/fm-brief.test.sh, 29 assertions, exit 0) and then went past pass/fail to the product surface: generated real ship, scout and secondmate briefs from bin/fm-brief.sh into a throwaway home and captured the emitted markdown, which is the prompt a crewmate agent actually receives. The ship and scout briefs both render the repeated-search clause, the note: CANDIDATE gotcha rule with the never-write-directly prohibition, and note in the Rule 4 states enumeration; the secondmate charter renders no Grounding section and no CANDIDATE mechanism, matching the intended split. Because every assertion in this change is new, I also ran five mutation probes in a /tmp export of the target commit (remove the gotcha line from both scaffolds, from scout only, revert the repeated-search clause, drop note from scout states, and leak the ship-only Rule 4 phrase into the scout heredoc): baseline passes and each mutation fails with its specific message, which empirically closes the round-2 concern about a scout guard that could never fire. AGENTS.md:256 carries the corrected carrier wording. The two comment-only commits have no rendered surface (--help omits the header rationale block), so no screenshot or rendered artifact applies; the generated-brief text is the reviewer-visible artifact here. Worktree left clean and temp sandboxes removed; no failures or flakiness observed.

Evidence: Generated ship brief (full emitted crewmate prompt)

Source: Generated ship brief (full emitted crewmate prompt)

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

# Task
{TASK}

# 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; searching costs only latency, so search again whenever a new obstacle or subject comes up rather than treating this as one-shot.
Treat the `# Task` section above as firstmate's assembly of that context, a starting point rather than a substitute.
When you hit an obstacle, surprising behavior, or trap, check PP Brain before working around it - cite it if documented, or append `note: CANDIDATE - {finding}` if it is not; never write to PP Brain or any shared memory directly, only firstmate promotes candidates.
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 demo-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/ev-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 request.
2. Stay inside this worktree; modify nothing outside it.
3. Use gh-axi for GitHub operations and chrome-devtools-axi for browser operations.
4. Report status by appending one line:
   `echo "{state}: {one short line}" >> '/tmp/fm-brief-evidence.eEHc2A/state/ev-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 under review, describe it as awaiting a colleague's approval, never the captain's merge decision - the captain cannot approve their own pull 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 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 {url} checks green` and stop. You are finished.
Evidence: Generated scout brief (full emitted crewmate prompt)

Source: Generated scout brief (full emitted crewmate prompt)

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

# Task
{TASK}

# 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; searching costs only latency, so search again whenever a new obstacle or subject comes up rather than treating this as one-shot.
Treat the `# Task` section above as firstmate's assembly of that context, a starting point rather than a substitute.
When you hit an obstacle, surprising behavior, or trap, check PP Brain before working around it - cite it if documented, or append `note: CANDIDATE - {finding}` if it is not; never write to PP Brain or any shared memory directly, only firstmate promotes candidates.
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 demo-proj, at a detached HEAD on a clean default branch.
This is a SCOUT task: the deliverable is a written report, not a pull 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 request.
2. Stay inside this worktree; the only files you may write outside it are the report and the status file below.
3. Use gh-axi for GitHub operations and chrome-devtools-axi for browser operations.
4. Report status by appending one line:
   `echo "{state}: {one short line}" >> '/tmp/fm-brief-evidence.eEHc2A/state/ev-scout.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 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 `/tmp/fm-brief-evidence.eEHc2A/data/ev-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 `~/.no-mistakes/worktrees/38493c8a7325/01M256VWSRNARNFSS0E47XHPF4/.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: Generated secondmate charter (no Grounding section, as intended)

Source: Generated secondmate charter (no Grounding section, as intended)

You are a persistent second mate managed by the main firstmate. Work on your own; do not wait for a human.

# Charter
sample domain

# Routing scope
sample domain

# Project clones
- demo-proj

# Operating model
You are in an isolated firstmate home. The local `AGENTS.md` is your job description, and your local `data/`, `state/`, `config/`, and `projects/` dirs are yours to operate.
The projects above are local clones for work you supervise; they are not an exclusive ownership claim.
Delegate project work to your own crewmates with the normal firstmate lifecycle: brief, spawn, status, watcher, steer, teardown, and recovery.
Do not invent a second delegation system.
You do not generate your own work.
Act only on tasks the main firstmate routes to you.
Never start a survey, audit, or "find improvements" sweep on your own initiative; that is not your job and it is unwanted.

# Requests from the main firstmate
You are a firstmate in your own home, so an incoming message reaches you in your own chat.
You must distinguish who it is from, because the answer goes to a different place.
A request relayed to you by the main firstmate is tagged with a leading `[fm-from-firstmate]` marker followed by an invisible system separator; this marker is untypable, so a human never produces it.
When a message carries that marker, do the work, then respond via the STATUS/ESCALATION path below, never only in this chat: the main firstmate does not read your chat, so a chat-only reply is lost.
Marked requests also carry a privacy-safe `corr=<id>` token after the marker; include that exact token in your parent status reply (or in the status pointer to a detailed doc) so the parent can correlate the answer.
Optional helper: `bin/fm-secondmate-report.sh` can append a correlated status line for you, but a plain `echo` that includes the same `corr=<id>` is equally valid - do not depend on the helper being present.
For a terse result, a status line is the whole answer.
For a detailed answer (an investigation, a plan, an audit), write it to a doc under your home's `data/` and append a status line that points to that doc - the scout-report pattern - so the main firstmate is woken and can read it.
Before treating an investigation or visual review as complete, load `captain-hold-lifecycle` from this home's `.agents/skills/` and pass its shared completion gate.
A message with NO marker is the captain typing directly into your pane: treat it as authoritative captain intervention and stay conversational exactly as you would for any captain message; do not force it onto the status path.

# Escalation to main firstmate
Handle routine work yourself.
Report only true captain-relevant outcomes or a declared external wait by appending one line:
   `echo "{state}: {one short line}" >> '/tmp/fm-brief-evidence.eEHc2A/state/ev-second.status'`
States: working, needs-decision, blocked, paused, done, failed.
Use `paused: {why}` (distinct from `blocked:`) only when your domain is deliberately idling on a known external wait you expect to clear on its own; use `blocked:` when you are stuck and need firstmate to act.
Use this only for material phase changes, a captain decision, a real blocker, a failure, or work ready for review.
This is also how you return the answer to a marked from-firstmate request above.
A marked request requires one correlated answer after the work; it does not require a separate receipt or start acknowledgement.
Never append `working:` merely to acknowledge receipt or announce that a marked request has started.
When a routed-work phase has a supervisor-actionable material change worth reporting under the rule above, give that reported phase a stable key.
If its first reportable event is `working [key=<work-slug>]: {material phase}`, use the same key on its later `paused`, `done`, `failed`, `needs-decision`, or `blocked` event so the earlier working phase is superseded.
When a keyed phase ends without another reportable state, append `resolved [key=<work-slug>]: {why it is no longer active}`.
`resolved` separately closes an escalated decision or blocker, and only a `resolved` line carrying that decision's exact key closes it: a later `done` or `working` event never does, even when the answer is what started that work.
The main firstmate's answer normally writes that closing line at answer time; when a blocker or wait clears WITHOUT an answer from the main firstmate, append `resolved: {how it cleared}` yourself (keyed with `[key=<slug>]` if you opened it with one) as your domain resumes.
Routine internal supervision, heartbeats, retries, and crewmate churn stay inside your own home and must not touch that status file.

# Definition of done
You are persistent by default. Do not exit just because your queue is empty.
On startup and restart, run normal firstmate bootstrap and recovery through `bin/fm-session-start.sh` for your own home, but only to RECONCILE work that is already yours: in-flight crewmates, tracked backlog items, and durable watches recorded in this home.
When you have no assigned or in-flight work after that reconciliation, go idle and wait silently for the main firstmate to route you a task.
An empty queue is a healthy resting state, not a cue to invent work: never spawn a survey, audit, or any self-directed "find work" task on your own initiative.
If this charter cannot be carried out, append `blocked: {why}` or `failed: {why}` to the main status file and stop.
Evidence: Grounding surfaces side by side across the three brief kinds

Source: Grounding surfaces side by side across the three brief kinds

########## ship ########## # 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; searching costs only latency, so search again whenever a new obstacle or subject comes up rather than treating this as one-shot. Treat the # Task section above as firstmate's assembly of that context, a starting point rather than a substitute. When you hit an obstacle, surprising behavior, or trap, check PP Brain before working around it - cite it if documented, or append note: CANDIDATE - {finding} if it is not; never write to PP Brain or any shared memory directly, only firstmate promotes candidates. Report what you found and what it changed in your next status line, or state plainly that both were silent. [... ship-only auth-banner / degraded-mode lines ...] 36: States: working, note, needs-decision, blocked, paused, done, failed. ########## scout ########## # Grounding Before your first substantive action, search PP Brain (...) and the local memory store for prior decisions, refuted approaches, and known traps on this subject; searching costs only latency, so search again whenever a new obstacle or subject comes up rather than treating this as one-shot. Treat the # Task section above as firstmate's assembly of that context, a starting point rather than a substitute. When you hit an obstacle, surprising behavior, or trap, check PP Brain before working around it - cite it if documented, or append note: CANDIDATE - {finding} if it is not; never write to PP Brain or any shared memory directly, only firstmate promotes candidates. Report what you found and what it changed in your next status line, or state plainly that both were silent. 29: States: working, note, needs-decision, blocked, paused, done, failed. ########## secondmate ########## 37:States: working, needs-decision, blocked, paused, done, failed. # Grounding sections: 0 note: CANDIDATE occurrences: 0

Generated brief Grounding surfaces (bin/fm-brief.sh at fde237d)
Command: FM_HOME=<tmp> FM_PROJECTS_OVERRIDE=<tmp>/projects bin/fm-brief.sh <id> demo-proj [--mode no-mistakes | --scout | --secondmate]

########## ship ##########
# 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; searching costs only latency, so search again whenever a new obstacle or subject comes up rather than treating this as one-shot.
Treat the `# Task` section above as firstmate's assembly of that context, a starting point rather than a substitute.
When you hit an obstacle, surprising behavior, or trap, check PP Brain before working around it - cite it if documented, or append `note: CANDIDATE - {finding}` if it is not; never write to PP Brain or any shared memory directly, only firstmate promotes candidates.
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.

36:   States: working, note, needs-decision, blocked, paused, done, failed.

########## scout ##########
# 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; searching costs only latency, so search again whenever a new obstacle or subject comes up rather than treating this as one-shot.
Treat the `# Task` section above as firstmate's assembly of that context, a starting point rather than a substitute.
When you hit an obstacle, surprising behavior, or trap, check PP Brain before working around it - cite it if documented, or append `note: CANDIDATE - {finding}` if it is not; never write to PP Brain or any shared memory directly, only firstmate promotes candidates.
Report what you found and what it changed in your next status line, or state plainly that both were silent.

29:   States: working, note, needs-decision, blocked, paused, done, failed.

########## second ##########
37:States: working, needs-decision, blocked, paused, done, failed.

########## secondmate charter Grounding presence ##########
# Grounding sections: 0
note: CANDIDATE occurrences: 0
Evidence: Mutation probes proving each new assertion fires

Source: Mutation probes proving each new assertion fires

===== PROBE: baseline, no mutation (expect exit=0) ===== exit=0 ===== PROBE: gotcha line removed from both Grounding sections ===== not ok - ship brief Grounding section did not require checking PP Brain for gotchas before working around them exit=1 ===== PROBE: repeated-search clause reverted to one-shot wording ===== not ok - ship brief Grounding section did not frame search as repeatable, not one-shot exit=1 ===== PROBE: note dropped from the scout Rule 4 states enumeration ===== not ok - scout brief did not render the configured pause verb in its states list exit=1 ===== PROBE: ship-only Rule 4 CANDIDATE paragraph phrase leaked into the scout scaffold ===== not ok - scout brief duplicated the ship-only Rule 4 CANDIDATE durable-findings paragraph exit=1 ===== PROBE: gotcha line removed from the SCOUT scaffold only (ship keeps it) ===== not ok - scout brief Grounding section did not require checking PP Brain for gotchas before working around them exit=1

Evidence: mutation probes against tests/fm-brief.test.sh at commit fde237d
Each probe mutates bin/fm-brief.sh, runs the suite, then reverts.

===== PROBE: baseline, no mutation (expect exit=0) =====
exit=0

===== PROBE: gotcha line removed from both Grounding sections =====
not ok - ship brief Grounding section did not require checking PP Brain for gotchas before working around them
exit=1

===== PROBE: repeated-search clause reverted to one-shot wording =====
not ok - ship brief Grounding section did not frame search as repeatable, not one-shot
exit=1

425:   States: working, needs-decision, blocked, $PAUSED_VERB, done, failed.
557:   States: working, note, needs-decision, blocked, $PAUSED_VERB, done, failed.
===== PROBE: note dropped from the scout Rule 4 states enumeration =====
not ok - scout brief did not render the configured pause verb in its states list
exit=1

===== PROBE: ship-only Rule 4 CANDIDATE paragraph phrase leaked into the scout scaffold =====
not ok - scout brief duplicated the ship-only Rule 4 CANDIDATE durable-findings paragraph
exit=1

===== PROBE: gotcha line removed from the SCOUT scaffold only (ship keeps it) =====
not ok - scout brief Grounding section did not require checking PP Brain for gotchas before working around them
exit=1
Evidence: Targeted test run output

Source: Targeted test run output

FM_TEST_BEGIN 2026-09-10T08:33:18Z tests/fm-brief.test.sh family=pure-contract-unit expected_gate_skip=none
ok - fm-brief.sh: bash -n succeeds
/var/folders/tc/hhm5872n2ql638k7y8nh5nd40000gn/T//fm-brief.1IJSbi/heredoc-in-substitution.sh:2
ok - fm-brief.sh: no heredoc is nested inside a command substitution (Bash 3.2 parse-safe)
ok - fm-brief.sh: --help renders the complete header
ok - fm-brief.sh: no-mistakes/direct-PR/local-only briefs generate cleanly
ok - fm-brief.sh: ship --mode is required and closed-set validated
ok - fm-brief.sh: the explicit ship mode wins over the registered posture
ok - fm-brief.sh: --yolo and scout/secondmate --mode are refused, never silently dropped
ok - fm-brief.sh: faster paths use configured authority without stacked review
ok - fm-brief.sh: no generated brief orders the non-existent mr-description skill
ok - fm-brief.sh: no-mistakes DOD keeps its apostrophe prose, now parse-safe
ok - fm-brief.sh: ship project-memory wording forbids the worker from writing AGENTS.md
ok - fm-brief.sh: --herdr-lab emits the complete hard safety contract
ok - fm-brief.sh: --herdr-lab uses its quoted Firstmate-owned helper path
ok - fm-brief.sh: ship and scout scaffolds make omitted Herdr intent fail-visible
ok - fm-brief.sh: Herdr lab contract covers scouts and rejects secondmate misuse
ok - fm-brief.sh: --no-projects scaffolds a project-less charter and guards misuse
ok - fm-brief.sh: marked requests avoid generic acknowledgements and preserve material reporting
ok - fm-brief.sh: relative directory inputs ignore CDPATH, render stable absolute charter paths, or fail loudly
ok - fm-brief.sh: custom pause verb renders in every scaffold
ok - fm-brief.sh: investigation and visual-review completions load the shared decision policy
ok - fm-brief.sh: ship and scout briefs require Brain/memory grounding with reported outcome; secondmate charter does not duplicate it
ok - fm-brief.sh: ship and scout briefs require declaring prescribed skills/procedures invoked and not invoked in the first status line; secondmate charter does not duplicate it
ok - fm-brief.sh: ship briefs carry the worker-operating contracts and keep a terminal done: line; scout/secondmate do not duplicate them
ok - fm-brief: scout and secondmate code paths still scaffold well-formed briefs
ok - fm-brief.sh: brief vocabulary matches the project's actual forge
ok - fm-brief.sh: a bare .github directory alone never declares GitHub
ok - fm-brief.sh: all three repo-argument spellings resolve the same clone's forge
ok - fm-brief.sh: a project dir that is not its own clone root resolves unknown
ok - fm-brief.sh: forge detection honors FM_PROJECTS_OVERRIDE
FM_TEST_END 2026-09-10T08:33:26Z tests/fm-brief.test.sh exit=0 duration_ms=7396 gate_skip=false
FM_TEST_SUMMARY total=1 failed=0 skipped_gate=0 duration_ms=7480
FM_TEST_SUMMARY_FAMILY family=pure-contract-unit count=1 duration_ms=7396 failed=0
FM_TEST_SLOWEST rank=1 script=tests/fm-brief.test.sh duration_ms=7396

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.

  • bin/fm-test-run.sh tests/fm-brief.test.sh — 29 assertions, exit 0, duration ~6.3s
  • Generated real end-user briefs into a throwaway FM_HOME: FM_HOME=&lt;tmp&gt; FM_PROJECTS_OVERRIDE=&lt;tmp&gt;/projects bin/fm-brief.sh ev-ship demo-proj --mode no-mistakes, ... ev-scout demo-proj --scout, FM_SECONDMATE_CHARTER=&#39;sample domain&#39; ... ev-second demo-proj --secondmate, then inspected each emitted brief.md Grounding section and States: line
  • Mutation probe: removed the When you hit an obstacle... gotcha line from both scaffolds → suite fails with ship brief Grounding section did not require checking PP Brain for gotchas before working around them
  • Mutation probe: removed the gotcha line from the SCOUT scaffold only → suite fails with scout brief Grounding section did not require checking PP Brain for gotchas before working around them
  • Mutation probe: reverted the repeated-search clause to the old one-shot wording → suite fails with ship brief Grounding section did not frame search as repeatable, not one-shot
  • Mutation probe: dropped note from the scout Rule 4 states enumeration → suite fails on the scout states-list assertion
  • Mutation probe: leaked the ship-only Rule 4 phrase firstmate promotes them, and you must never write to PP Brain into the scout scaffold → suite fails with scout brief duplicated the ship-only Rule 4 CANDIDATE durable-findings paragraph (proves the round-2 replacement guard is no longer vacuous)
  • Baseline control probe: unmutated fde237d export → bash tests/fm-brief.test.sh exit 0
  • bin/fm-brief.sh --help — confirmed the corrected header rationale comments are maintainer-only and not part of the user-visible help output
  • sed -n 250,258p AGENTS.md — confirmed the corrected a ship or scout brief carrier wording at line 256
  • git status --porcelain — worktree clean after testing; /tmp mutation and brief sandboxes removed
⚠️ **Document** - 1 info
  • ℹ️ docs/architecture.md:309 - Out-of-scope consolidation worth a follow-up, not a defect introduced by this change, and previously left in place by an explicit decision. The note: CANDIDATE - {finding} mechanism is restated in full on four surfaces: AGENTS.md:256 (the declared owner), docs/architecture.md:309, docs/architecture.md:317, and .agents/skills/stow/SKILL.md:157 and :198. This change again had to touch only the owner sentence (AGENTS.md:256, now 'a ship or scout brief'), which is correct placement — but it also left docs/architecture.md:309 under-inclusive in the same way the owner was: it still says 'Ship briefs forbid crewmates from writing those files directly', while a generated scout brief now carries that same prohibition via the Grounding clause at bin/fm-brief.sh:408. docs/architecture.md's own section already closes with 'The full ownership rule ... is owned by AGENTS.md', so its two copies are self-acknowledged duplicates that could be reduced to that pointer, and the stow skill's two copies could cite the owner rather than restate the contract. Reducing them is a multi-surface prose edit unrelated to the Grounding change under review, and the corresponding round-1 document finding was not selected for fixing, so I did not implement it here. Recommend a dedicated follow-up that reduces the three non-owner surfaces to pointers; until then the next brief-carrier or promotion-flow change must be hand-applied to four places.
✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

Alan Domio and others added 6 commits September 10, 2026 09:13
Ship and scout briefs now frame the Grounding search as repeatable
(latency is the only cost) and require checking PP Brain before working
around any obstacle, citing it when documented or filing a note:
CANDIDATE when PP Brain is silent on it.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@alandomio alandomio changed the title feat(bin): make PP Brain grounding a standing contract in ship and scout briefs feat(bin): make PP Brain grounding a repeated, gotcha-aware contract Sep 10, 2026
@alandomio
alandomio merged commit aa7ff56 into main Sep 10, 2026
13 of 14 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