Repository navigation
feat(bin): make PP Brain grounding a repeated, gotcha-aware contract - #24
Merged
Merged
Conversation
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]>
…in fm-brief header comment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 appendingnote: 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 includesnote, 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 scoutnotestate; the scout "no ship-only contract" guards are re-keyed onto ship-only phrasings now that scout legitimately carries anote: CANDIDATEline.AGENTS.mdwording 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, thenote: CANDIDATEgotcha rule with the never-write-directly prohibition, andnotein 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, dropnotefrom 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 (--helpomits 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)
Evidence: Generated scout brief (full emitted crewmate prompt)
Source: Generated scout brief (full emitted crewmate prompt)
Evidence: Generated secondmate charter (no Grounding section, as intended)
Source: Generated secondmate charter (no Grounding section, as intended)
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_knowledgewith bothqueryandpromptpopulated - 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# Tasksection 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 appendnote: 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# Tasksection 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 appendnote: 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: 0Evidence: 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=1Evidence: Targeted test run output
Source: Targeted test run output
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.3sGenerated real end-user briefs into a throwaway FM_HOME:FM_HOME=<tmp> FM_PROJECTS_OVERRIDE=<tmp>/projects bin/fm-brief.sh ev-ship demo-proj --mode no-mistakes,... ev-scout demo-proj --scout,FM_SECONDMATE_CHARTER='sample domain' ... ev-second demo-proj --secondmate, then inspected each emitted brief.md Grounding section andStates:lineMutation probe: removed theWhen you hit an obstacle...gotcha line from both scaffolds → suite fails withship brief Grounding section did not require checking PP Brain for gotchas before working around themMutation probe: removed the gotcha line from the SCOUT scaffold only → suite fails withscout brief Grounding section did not require checking PP Brain for gotchas before working around themMutation probe: reverted the repeated-search clause to the old one-shot wording → suite fails withship brief Grounding section did not frame search as repeatable, not one-shotMutation probe: droppednotefrom the scout Rule 4 states enumeration → suite fails on the scout states-list assertionMutation probe: leaked the ship-only Rule 4 phrasefirstmate promotes them, and you must never write to PP Braininto the scout scaffold → suite fails withscout brief duplicated the ship-only Rule 4 CANDIDATE durable-findings paragraph(proves the round-2 replacement guard is no longer vacuous)Baseline control probe: unmutatedfde237dexport →bash tests/fm-brief.test.shexit 0bin/fm-brief.sh --help— confirmed the corrected header rationale comments are maintainer-only and not part of the user-visible help outputsed -n 250,258p AGENTS.md— confirmed the correcteda ship or scout briefcarrier wording at line 256git status --porcelain— worktree clean after testing; /tmp mutation and brief sandboxes removeddocs/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. Thenote: 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.