Skip to content

feat(bin): check the no-mistakes --intent string before the run starts - #6

Merged
zakna merged 9 commits into
mainfrom
fm/fm-intent-publication-scrub-o1
Sep 27, 2026
Merged

zakna merged 9 commits into
mainfrom
fm/fm-intent-publication-scrub-o1

Conversation

@zakna

@zakna zakna commented Sep 26, 2026 •

Copy link
Copy Markdown
Owner

Intent

Keep captain quotes and worker instructions out of the PR body composed from --intent, and check the composed string before the run starts.
Sources: data/dotagents-239-retro-s1/report.md rows 4 and 5, data/unraid-43-retro-s1/report.md section 3.4 and row 2, data/ha-71-retro-s1/report.md section 4, data/ha-72-retro-s1/report.md section 3.4.
The no-mistakes pipeline composes the PR body from the --intent string, so sentences from the brief's Captain's intent (a captain quote, second-person worker instructions) were published in dotagents PR 245 for 11 minutes before a manual edit; in unraid PR 61 the run passed three forbidden block headings and three of four "the user" attributions that were Firstmate spec; ha PR 71's body opened with the fleet-level sentence, and the ha-72 retro shows the leak also covers firstmate build framing in paragraph 2 of the intent (checks green, no run exists), not only the captain sentence.
Refs # was also added by a later edit instead of at creation.
Change bin/fm-dod-lib.sh (and the brief template if needed) so the passed intent keeps the specification but strips quotes and worker-directed sentences, so the composed body carries the issue reference at creation, and add a check before the run starts that rejects speaker labels and any sentence outside the authorized intent section.

What Changed

  • Added bin/fm-intent-check.sh, backed by new fm_intent_check/fm_intent_scrub functions in bin/fm-dod-lib.sh. check rejects an --intent file that contains speaker labels, direct address (such as an opening please or you must), quotes attributed to a speaker, or fleet terms the repository's own tracked files don't use. It also rejects any sentence outside the brief's authorized intent section, and requires a Refs #<n> for every issue of the repo's github.com origin that the brief links. scrub prints the authorized words and appends any missing Refs line. Scrub doesn't strip or reword refused lines: when it finds one, it prints nothing, names each refused line on stderr and exits 1. Fenced code, indented examples and inline code are exempt from every rule except the authorized-section rule. A later captain wording can be allowed with --captain-words <file> and resolved report or PR substance with --resolved <file>.
  • The no-mistakes section of the Definition of done now passes the task's data directory through fm_dod_block from fm-brief.sh and fm-promote.sh. It tells workers to run scrub, then check on the exact string before starting the run, and to pass that string unchanged only if the check passes. When a line is refused, workers ask firstmate to reword the brief's intent or stop, rather than dropping the line themselves. The launch overlay says the same.
  • Added tests/fm-intent-check.test.sh and a row for the new script in docs/scripts.md. The Gerrit/plain comparison in tests/fm-task-delivery.test.sh now normalizes task ids, because the embedded check command names each task's data directory.

Risk Assessment

⚠️ Medium: The new pre-run check is well bounded and runs only when a worker invokes it. Scrub refuses rather than drops: it keeps a Refs line the brief names and never removes a specification sentence, and on any refused line it prints nothing, names the line, and exits 1 so the intent wording is corrected before the run. The heuristics can still refuse a legitimate sentence, which stops the run rather than changing what is published.

Testing

I ran the focused intent-check test file (all 13 pass). I then drove the real CLI end to end in a disposable lab home: fm-brief.sh scaffolded a no-mistakes brief, and I filled it with the leak patterns from the dotagents, unraid and ha retros. Scrub and check were run from a throwaway project repo with a github.com origin, and the transcript and driver script are saved in the evidence directory. Every scenario behaved as intended: - Leaked lines were refused by line number with exit 1 and nothing was printed. - A clean specification came out unchanged with Refs #43 added, and passed the check. - A missing Refs line, an invented reference, Firstmate spec content and speaker labels were all refused. - The launch overlay replaces the brief as the source and repeats the rule never to drop or reword a refused sentence. This is a CLI-only change, so there is no visual artifact. The lab home and repo were removed afterwards.

  • Live validation: ✅ go - 6 of 7 scenarios driven live against the product
Scenario Result Live Evidence
A no-mistakes brief scaffolded by fm-brief.sh tells the worker to scrub, then check the --intent file, and never to drop or reword a refused line ✅ pass live live-intent-check.log (Definition of done lines 105/107/109)
Scrub on a Captain's intent that contains a captain label, a captain quote, a worker instruction and fleet framing prints nothing, names each refused line and exits 1 ✅ pass live live-intent-check.log Scenario A
Scrub on a clean specification keeps every sentence (including 'so you can see drift' and a Markdown link) and adds 'Refs #43' at creation; check accepts that output ✅ pass live live-intent-check.log Scenario B
Check refuses a composed intent that is missing the Refs line for a linked issue of this repository ✅ pass live live-intent-check.log Scenario C
Adversarial: check refuses a Firstmate spec sentence, a '## Firstmate spec' heading, a 'User:' speaker label and an invented 'Refs #99', each named by line ✅ pass live live-intent-check.log Scenario D
When launch-brief.md has the overlay, it becomes the authorized source: words outside it are refused, and the overlay repeats the never-drop rule ✅ pass live live-intent-check.log Scenario E
A real no-mistakes pipeline run publishes a PR body free of leaks that carries Refs at creation ⏸️ untested no Running a real worker and a no-mistakes pipeline would open an actual PR on a forge. That would need a lab GitHub repo, pushed credentials, and authority to start another pipeline, which this gate pha…
Evidence: Live CLI transcript (scenarios A-E)

Source: Live CLI transcript (scenarios A-E)


$ fm-brief.sh intent-live-a1 rackfan --mode no-mistakes
[exit 0]
--- Definition of done lines naming the check:
105:From this repository, run `~/.no-mistakes/worktrees/0b1ab7dd6182/01M3DK1AVVH1ZRM0271HKTG6N1/bin/fm-intent-check.sh scrub $LAB/data/intent-live-a1` to print the authorized words with a `Refs #<n>` last line for each issue of this repository the brief links and the words do not already reference; never add a reference the brief does not name.
107:Write the exact string you will pass to a file, run `~/.no-mistakes/worktrees/0b1ab7dd6182/01M3DK1AVVH1ZRM0271HKTG6N1/bin/fm-intent-check.sh check $LAB/data/intent-live-a1 <file>`, and pass that file's content unchanged only when the check passes.
109:When scrub or the check refuses a line, never drop or reword it yourself: ask firstmate to edit the brief's intent wording, or stop; never start the run with a refused string.

=== Scenario A: leaky Captain's intent (dotagents/unraid/ha retro patterns) ===
## Captain's intent
Captain: make the fan quieter at night, see https://github.com/acme/rackfan/issues/43.
The captain said "yes implement it".
You must rebase your branch before starting.
Checks are green and no run exists yet, so the crewmate should start the pipeline.
Keep the curve below 30 percent after 22:00.

## Firstmate spec
When starting no-mistakes, pass `--intent` as only this brief's `## Captain's intent` subsection body, not its heading, plus any later words the captain actually said.
Preserve the actual words without adding speaker labels or direct address; the subsection heading supplies provenance outside the pipeline input.
For a legacy brief with no such subsection, include only words on lines marked `[captain] `, excluding that metadata prefix; never copy its mixed `# Task` wholesale.
If it has no provenance-marked captain words, stop and ask firstmate instead of starting no-mistakes.
Do not include `## Firstmate spec`, later Firstmate build constraints, or your own decisions and tradeoffs.

$ ~/.no-mistakes/worktrees/0b1ab7dd6182/01M3DK1AVVH1ZRM0271HKTG6N1/bin/fm-intent-check.sh scrub /var/folders/hk/lxr6ppq904ng8dxkxskjs5180000gn/T//fm-lab.EvASWH/data/intent-live-a1
intent-scrub: line 1: speaker label: Captain: make the fan quieter at night, see https://github.com/acme/rackfan/issues/43.
intent-scrub: line 2: quote: The captain said "yes implement it".
intent-scrub: line 3: direct address: You must rebase your branch before starting.
intent-scrub: line 4: fleet vocabulary "crewmate": Checks are green and no run exists yet, so the crewmate should start the pipeline.
[exit 1]

=== Scenario B: clean specification; scrub adds Refs at creation; check passes ===

$ ~/.no-mistakes/worktrees/0b1ab7dd6182/01M3DK1AVVH1ZRM0271HKTG6N1/bin/fm-intent-check.sh scrub $D > intent.txt
[exit 0]
--- intent.txt:
Make the fan quieter at night, as described in https://github.com/acme/rackfan/issues/43.
Keep the curve below 30 percent after 22:00.
Show the temperature so you can see drift.
[Fan docs](https://example.com/fan) describe the night curve.

Refs #43

$ ~/.no-mistakes/worktrees/0b1ab7dd6182/01M3DK1AVVH1ZRM0271HKTG6N1/bin/fm-intent-check.sh check /var/folders/hk/lxr6ppq904ng8dxkxskjs5180000gn/T//fm-lab.EvASWH/data/intent-live-a1 /var/folders/hk/lxr6ppq904ng8dxkxskjs5180000gn/T//fm-lab.EvASWH/intent.txt
[exit 0]

=== Scenario C: composed string drops the Refs line ===

$ ~/.no-mistakes/worktrees/0b1ab7dd6182/01M3DK1AVVH1ZRM0271HKTG6N1/bin/fm-intent-check.sh check /var/folders/hk/lxr6ppq904ng8dxkxskjs5180000gn/T//fm-lab.EvASWH/data/intent-live-a1 /var/folders/hk/lxr6ppq904ng8dxkxskjs5180000gn/T//fm-lab.EvASWH/norefs.txt
intent-check: missing reference: add "Refs #43" as the last line
[exit 1]

=== Scenario D: composed string adds Firstmate spec / framing / label / invented ref ===
Make the fan quieter at night, as described in https://github.com/acme/rackfan/issues/43.
Keep the curve below 30 percent after 22:00.
Show the temperature so you can see drift.
[Fan docs](https://example.com/fan) describe the night curve.

Refs #43
Refactor the PWM module first.
## Firstmate spec
User: ship it tonight.
Refs #99

$ ~/.no-mistakes/worktrees/0b1ab7dd6182/01M3DK1AVVH1ZRM0271HKTG6N1/bin/fm-intent-check.sh check /var/folders/hk/lxr6ppq904ng8dxkxskjs5180000gn/T//fm-lab.EvASWH/data/intent-live-a1 /var/folders/hk/lxr6ppq904ng8dxkxskjs5180000gn/T//fm-lab.EvASWH/bad.txt
intent-check: line 7: outside the authorized intent: Refactor the PWM module first.
intent-check: line 8: fleet vocabulary "firstmate": ## Firstmate spec
intent-check: line 9: speaker label: User: ship it tonight.
intent-check: line 10: reference not named by the brief: #99: Refs #99
[exit 1]

=== Scenario E: launch overlay (as fm-spawn renders it) is the source and repeats the no-drop rule ===
139:The string you pass must pass the Definition of done's intent check unchanged: never drop or reword a sentence it refuses, but ask firstmate to edit the brief's intent wording, or stop.

$ ~/.no-mistakes/worktrees/0b1ab7dd6182/01M3DK1AVVH1ZRM0271HKTG6N1/bin/fm-intent-check.sh check /var/folders/hk/lxr6ppq904ng8dxkxskjs5180000gn/T//fm-lab.EvASWH/data/intent-live-a1 /var/folders/hk/lxr6ppq904ng8dxkxskjs5180000gn/T//fm-lab.EvASWH/intent.txt
intent-check: line 1: outside the authorized intent: Make the fan quieter at night, as described in https://github.com/acme/rackfan/issues/43.
intent-check: line 3: outside the authorized intent: Show the temperature so you can see drift.
intent-check: line 4: outside the authorized intent: [Fan docs](https://example.com/fan) describe the night curve.
[exit 1]

$ ~/.no-mistakes/worktrees/0b1ab7dd6182/01M3DK1AVVH1ZRM0271HKTG6N1/bin/fm-intent-check.sh check /var/folders/hk/lxr6ppq904ng8dxkxskjs5180000gn/T//fm-lab.EvASWH/data/intent-live-a1 /var/folders/hk/lxr6ppq904ng8dxkxskjs5180000gn/T//fm-lab.EvASWH/ov.txt
intent-check: missing reference: add "Refs #43" as the last line
[exit 1]

(lab removed)
Evidence: Live driver script

Source: Live driver script

#!/usr/bin/env bash
# Live driver: scaffold a real no-mistakes brief in a disposable lab home, fill it
# with retro leak patterns, and run bin/fm-intent-check.sh from a project repo.
set -u
WT=$1
LAB=$(mktemp -d "${TMPDIR:-/tmp}/fm-lab.XXXXXX"); rmdir "$LAB"
"$WT/bin/fm-lab-home.sh" create "$LAB" >/dev/null
REPO=$(mktemp -d "${TMPDIR:-/tmp}/fm-lab-repo.XXXXXX")
git init -q "$REPO"; printf 'Fan controller for the rack.\n' > "$REPO/README.md"
git -C "$REPO" add README.md; git -C "$REPO" -c user.name=t -c user.email=t@e commit -q -m init
git -C "$REPO" remote add origin https://github.com/acme/rackfan.git
ID=intent-live-a1; D="$LAB/data/$ID"; CHECK="$WT/bin/fm-intent-check.sh"
say() { printf '\n$ %s\n' "$*"; }
run() { say "$*"; (cd "$REPO" && env FM_HOME="$LAB" "$@"); echo "[exit $?]"; }
fill() {  # <intent> <spec>
  python3 - "$D/brief.md" "$1" "$2" <<'PY'
import sys; p,i,s=sys.argv[1:]; t=open(p).read()
t=t.replace("{TASK}",i,1).replace("{FIRSTMATE_SPEC}",s,1); open(p,"w").write(t)
PY
}
say "fm-brief.sh $ID rackfan --mode no-mistakes"
env -u NO_MISTAKES_GATE FM_HOME="$LAB" "$WT/bin/fm-brief.sh" "$ID" rackfan --mode no-mistakes >/dev/null; echo "[exit $?]"
echo "--- Definition of done lines naming the check:"; grep -n "fm-intent-check\|never drop or reword" "$D/brief.md" | sed "s#$LAB#\$LAB#g"
cp "$D/brief.md" "$D/brief.template"

echo; echo "=== Scenario A: leaky Captain's intent (dotagents/unraid/ha retro patterns) ==="
fill 'Captain: make the fan quieter at night, see https://github.com/acme/rackfan/issues/43.
The captain said "yes implement it".
You must rebase your branch before starting.
Checks are green and no run exists yet, so the crewmate should start the pipeline.
Keep the curve below 30 percent after 22:00.' 'Refactor the PWM module first. Use a table-driven test.'
cat "$D/brief.md" | sed -n "/## Captain's intent/,/## Firstmate spec/p"
run "$CHECK" scrub "$D"

echo; echo "=== Scenario B: clean specification; scrub adds Refs at creation; check passes ==="
cp "$D/brief.template" "$D/brief.md"
fill 'Make the fan quieter at night, as described in https://github.com/acme/rackfan/issues/43.
Keep the curve below 30 percent after 22:00.
Show the temperature so you can see drift.
[Fan docs](https://example.com/fan) describe the night curve.' 'Refactor the PWM module first. Use a table-driven test.'
say "$CHECK scrub \$D > intent.txt"; (cd "$REPO" && FM_HOME="$LAB" "$CHECK" scrub "$D" > "$LAB/intent.txt"); echo "[exit $?]"; echo "--- intent.txt:"; cat "$LAB/intent.txt"
run "$CHECK" check "$D" "$LAB/intent.txt"

echo; echo "=== Scenario C: composed string drops the Refs line ==="
grep -v '^Refs' "$LAB/intent.txt" > "$LAB/norefs.txt"
run "$CHECK" check "$D" "$LAB/norefs.txt"

echo; echo "=== Scenario D: composed string adds Firstmate spec / framing / label / invented ref ==="
{ cat "$LAB/intent.txt"; printf 'Refactor the PWM module first.\n## Firstmate spec\nUser: ship it tonight.\nRefs #99\n'; } > "$LAB/bad.txt"
cat "$LAB/bad.txt"
run "$CHECK" check "$D" "$LAB/bad.txt"

echo; echo "=== Scenario E: launch overlay (as fm-spawn renders it) is the source and repeats the no-drop rule ==="
( . "$WT/bin/fm-dod-lib.sh"; { cat "$D/brief.md"; fm_brief_intent_overlay 'Keep the curve below 30 percent after 22:00.'; } > "$D/launch-brief.md" )
grep -n "never drop or reword" "$D/launch-brief.md" | tail -1
run "$CHECK" check "$D" "$LAB/intent.txt"
printf 'Keep the curve below 30 percent after 22:00.\n' > "$LAB/ov.txt"
run "$CHECK" check "$D" "$LAB/ov.txt"
rm -rf "$LAB" "$REPO"; echo; echo "(lab removed)"
Evidence: Scrub refusing a leaky intent
intent-scrub: line 1: speaker label: Captain: make the fan quieter at night, see https://github.com/acme/rackfan/issues/43.
intent-scrub: line 2: quote: The captain said "yes implement it".
intent-scrub: line 3: direct address: You must rebase your branch before starting.
intent-scrub: line 4: fleet vocabulary "crewmate": Checks are green and no run exists yet, so the crewmate should start the pipeline.
[exit 1]

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 1 warning
  • 🚨 bin/fm-dod-lib.sh:503 - fm_intent_scrub passes an empty mentioned set to fm_intent_scan, so any Refs #&lt;n&gt; line in the captain's authorized words is marked "reference not named by the brief" and removed. Scrub then adds back only the issues the brief links by full github.com URL. Repro: a brief whose authorized section is 'Make the fan quieter at night.\nRefs test: pass Pi 1.1's getToolRenderers lookup to HTML export renderer fixtures #43' makes scrub print only the first sentence and drop the reference. check then accepts that output (exit 0), because test: pass Pi 1.1's getToolRenderers lookup to HTML export renderer fixtures #43 is not a URL-linked issue and so is not in need. The composed body loses the issue reference, which contradicts the intent's requirement that "the composed body carries the issue reference at creation". The worker is told to pass scrub's output, so this happens on the documented path. Fix: in fm_intent_scrub, compute mentioned from the source exactly as fm_intent_check does (line 489) and pass it to the scan. Also consider keeping a Refs line the brief names rather than re-deriving it.
  • ⚠️ bin/fm-dod-lib.sh:406 - The refusal heuristics strip real specification sentences as well as worker-directed ones. Any sentence containing the word 'you'/'your' counts as direct address, for example the product requirement 'Show the temperature so you can see drift'. Any sentence using a fleet term the target repo does not already use is also refused, for example 'the user', 'supervisor', 'fleet' or 'status file' in a spec about user-facing behavior. Scrub removes these silently apart from a stderr note, and the worker is told to pass scrub's output. This conflicts with the intent's requirement that the passed intent "keeps the specification but strips quotes and worker-directed sentences". Decide whether scrub should refuse instead of silently dropping, or whether the heuristics should be narrowed.

🔧 Fix applied.
4 issues (1 error, 3 warnings) still open:

  • 🚨 bin/fm-dod-lib.sh:503 - fm_intent_scrub passes an empty mentioned set to fm_intent_scan, so any Refs #&lt;n&gt; line in the captain's authorized words is marked "reference not named by the brief" and removed. Scrub then adds back only the issues the brief links by full github.com URL. Repro: a brief whose authorized section is 'Make the fan quieter at night.\nRefs test: pass Pi 1.1's getToolRenderers lookup to HTML export renderer fixtures #43' makes scrub print only the first sentence and drop the reference. check then accepts that output (exit 0), because test: pass Pi 1.1's getToolRenderers lookup to HTML export renderer fixtures #43 is not a URL-linked issue and so is not in need. The composed body loses the issue reference, which contradicts the intent's requirement that "the composed body carries the issue reference at creation". The worker is told to pass scrub's output, so this happens on the documented path. Fix: in fm_intent_scrub, compute mentioned from the source exactly as fm_intent_check does (line 489) and pass it to the scan. Also consider keeping a Refs line the brief names rather than re-deriving it.
  • ⚠️ bin/fm-dod-lib.sh:406 - The refusal heuristics strip real specification sentences as well as worker-directed ones. Any sentence containing the word 'you'/'your' counts as direct address, for example the product requirement 'Show the temperature so you can see drift'. Any sentence using a fleet term the target repo does not already use is also refused, for example 'the user', 'supervisor', 'fleet' or 'status file' in a spec about user-facing behavior. Scrub removes these silently apart from a stderr note, and the worker is told to pass scrub's output. This conflicts with the intent's requirement that the passed intent "keeps the specification but strips quotes and worker-directed sentences". Decide whether scrub should refuse instead of silently dropping, or whether the heuristics should be narrowed.
  • ⚠️ bin/fm-dod-lib.sh:504 - Issue numbers are compared without their repository, so a Refs line can point to the wrong issue and still pass. fm_intent_mentioned (bin/fm-dod-lib.sh:504) collects the digits from every #n, /issues/n and /pull/n anywhere in the source, including URLs to other repositories. Round 1 made scrub use this same set (the fix for review-1), so check and scrub now share the gap. Repro: the brief contains 'See https://github.com/other/repo/issues/7 for background.' A worker who writes 'Refs fix(bin): read producer output whole before early returns to stop broken-pipe stderr lines #42, fix(skills): file a declined finding's author note durably before cleanup #7' passes the check (known[7] is set), and the PR body then references acme/widgets#7, an issue the brief never named. This breaks the documented rule 'refuses a reference the brief does not name'. Sibling site: the Refs-unit parser at bin/fm-dod-lib.sh:428-431 reduces a URL reference to its trailing number (sub(/^.*\//, &#34;&#34;, num)). So 'Refs https://github.com/other/repo/issues/42&#39; both counts as known and satisfies the required need[42] for this repository's fix(bin): read producer output whole before early returns to stop broken-pipe stderr lines #42. Fix: build known only from bare #n mentions plus /issues|pull/n URLs whose owner/repo matches the origin slug (reuse the slug logic in fm_intent_linked_issues). Refuse, or at least do not count, URL-form Refs entries that point at another repository.
  • ⚠️ bin/fm-dod-lib.sh:405 - The bracket form of the speaker-label rule, t ~ /^\[[a-z][a-z&#39; -]*\]/, matches any sentence that starts with a Markdown link or a checked task-list item. Examples: 'Fan docs describe the night curve.' and '- [x] Keep the column order.' Scrub drops these specification sentences, logging only to stderr, and check refuses them as 'speaker label'. This goes against the intent requirement that the passed intent 'keeps the specification'. Legacy [captain] markers are already stripped by fm_brief_marked_captain_words before this text is scanned. So the rule only needs to catch a real bracketed speaker tag. Narrow it so that it does not match when the bracket is followed by ( or [, or when the tag is the single-character task box [x]. Alternatively, restrict it to the same speaker names the colon form lists.

🔧 Fix applied.
6 issues (2 errors, 4 warnings) still open:

  • 🚨 bin/fm-dod-lib.sh:503 - fm_intent_scrub passes an empty mentioned set to fm_intent_scan, so any Refs #&lt;n&gt; line in the captain's authorized words is marked "reference not named by the brief" and removed. Scrub then adds back only the issues the brief links by full github.com URL. Repro: a brief whose authorized section is 'Make the fan quieter at night.\nRefs test: pass Pi 1.1's getToolRenderers lookup to HTML export renderer fixtures #43' makes scrub print only the first sentence and drop the reference. check then accepts that output (exit 0), because test: pass Pi 1.1's getToolRenderers lookup to HTML export renderer fixtures #43 is not a URL-linked issue and so is not in need. The composed body loses the issue reference, which contradicts the intent's requirement that "the composed body carries the issue reference at creation". The worker is told to pass scrub's output, so this happens on the documented path. Fix: in fm_intent_scrub, compute mentioned from the source exactly as fm_intent_check does (line 489) and pass it to the scan. Also consider keeping a Refs line the brief names rather than re-deriving it.
  • ⚠️ bin/fm-dod-lib.sh:406 - The refusal heuristics strip real specification sentences as well as worker-directed ones. Any sentence containing the word 'you'/'your' counts as direct address, for example the product requirement 'Show the temperature so you can see drift'. Any sentence using a fleet term the target repo does not already use is also refused, for example 'the user', 'supervisor', 'fleet' or 'status file' in a spec about user-facing behavior. Scrub removes these silently apart from a stderr note, and the worker is told to pass scrub's output. This conflicts with the intent's requirement that the passed intent "keeps the specification but strips quotes and worker-directed sentences". Decide whether scrub should refuse instead of silently dropping, or whether the heuristics should be narrowed.
  • ⚠️ bin/fm-dod-lib.sh:504 - Issue numbers are compared without their repository, so a Refs line can point to the wrong issue and still pass. fm_intent_mentioned (bin/fm-dod-lib.sh:504) collects the digits from every #n, /issues/n and /pull/n anywhere in the source, including URLs to other repositories. Round 1 made scrub use this same set (the fix for review-1), so check and scrub now share the gap. Repro: the brief contains 'See https://github.com/other/repo/issues/7 for background.' A worker who writes 'Refs fix(bin): read producer output whole before early returns to stop broken-pipe stderr lines #42, fix(skills): file a declined finding's author note durably before cleanup #7' passes the check (known[7] is set), and the PR body then references acme/widgets#7, an issue the brief never named. This breaks the documented rule 'refuses a reference the brief does not name'. Sibling site: the Refs-unit parser at bin/fm-dod-lib.sh:428-431 reduces a URL reference to its trailing number (sub(/^.*\//, &#34;&#34;, num)). So 'Refs https://github.com/other/repo/issues/42&#39; both counts as known and satisfies the required need[42] for this repository's fix(bin): read producer output whole before early returns to stop broken-pipe stderr lines #42. Fix: build known only from bare #n mentions plus /issues|pull/n URLs whose owner/repo matches the origin slug (reuse the slug logic in fm_intent_linked_issues). Refuse, or at least do not count, URL-form Refs entries that point at another repository.
  • ⚠️ bin/fm-dod-lib.sh:405 - The bracket form of the speaker-label rule, t ~ /^\[[a-z][a-z&#39; -]*\]/, matches any sentence that starts with a Markdown link or a checked task-list item. Examples: 'Fan docs describe the night curve.' and '- [x] Keep the column order.' Scrub drops these specification sentences, logging only to stderr, and check refuses them as 'speaker label'. This goes against the intent requirement that the passed intent 'keeps the specification'. Legacy [captain] markers are already stripped by fm_brief_marked_captain_words before this text is scanned. So the rule only needs to catch a real bracketed speaker tag. Narrow it so that it does not match when the bracket is followed by ( or [, or when the tag is the single-character task box [x]. Alternatively, restrict it to the same speaker names the colon form lists.
  • 🚨 bin/fm-dod-lib.sh:237 - The launch overlay still tells the worker to drop refused sentences. It says to use the authorized words "less every sentence the Definition of done's intent check refuses". The overlay is appended after the Definition of done in launch-brief.md and declares that it "supersedes every earlier brief instruction about constructing --intent". So on the normal no-mistakes launch path it overrides the round-2 Definition of done rule "never drop or reword it yourself: ask firstmate to edit the brief's intent wording, or stop" (bin/fm-dod-lib.sh:592). A worker whose scrub refuses one line will read the overlay as permission to delete that sentence and pass the rest. That is the silent drop the user's review-2 decision forbids. This line came from the original commit, and the round-2 fix updated the Definition of done and the header but missed it. Fix: reword the overlay to say the string must pass the Definition of done's intent check unchanged, and that a refused line goes back to firstmate or the worker stops.
  • ⚠️ bin/fm-dod-lib.sh:406 - The direct-address rule implements a narrower form than the user's review-2 instruction. The instruction was to flag sentences that "contain ... 'captain'". The round-2 code flags only a vocative captain (^captain, or , captain,) and otherwise relies on the fleet-vocabulary list, which is skipped when the repository's tracked files already use the word 'captain'. In such a repository, for example the test fixture repository or firstmate itself, 'The captain wants exports in UTF-8.' passes the check and reaches the PR body. Following the instruction literally would also refuse the fixture's 'Pin the captain dependency list.', which the test asserts must pass. Decide whether any 'captain' should be refused regardless of repository vocabulary, as instructed, or whether the vocative-plus-vocabulary form is acceptable.

🔧 Fix applied.
1 warning still open:

  • ⚠️ bin/fm-dod-lib.sh:406 - The direct-address rule implements a narrower form than the user's review-2 instruction. The instruction was to flag sentences that "contain ... 'captain'". The round-2 code flags only a vocative captain (^captain, or , captain,) and otherwise relies on the fleet-vocabulary list, which is skipped when the repository's tracked files already use the word 'captain'. In such a repository, for example the test fixture repository or firstmate itself, 'The captain wants exports in UTF-8.' passes the check and reaches the PR body. Following the instruction literally would also refuse the fixture's 'Pin the captain dependency list.', which the test asserts must pass. Decide whether any 'captain' should be refused regardless of repository vocabulary, as instructed, or whether the vocative-plus-vocabulary form is acceptable.
✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 6 of 7 scenarios driven live against the product
Scenario Result Live Evidence
A no-mistakes brief scaffolded by fm-brief.sh tells the worker to scrub, then check the --intent file, and never to drop or reword a refused line ✅ pass live live-intent-check.log (Definition of done lines 105/107/109)
Scrub on a Captain's intent that contains a captain label, a captain quote, a worker instruction and fleet framing prints nothing, names each refused line and exits 1 ✅ pass live live-intent-check.log Scenario A
Scrub on a clean specification keeps every sentence (including 'so you can see drift' and a Markdown link) and adds 'Refs #43' at creation; check accepts that output ✅ pass live live-intent-check.log Scenario B
Check refuses a composed intent that is missing the Refs line for a linked issue of this repository ✅ pass live live-intent-check.log Scenario C
Adversarial: check refuses a Firstmate spec sentence, a '## Firstmate spec' heading, a 'User:' speaker label and an invented 'Refs #99', each named by line ✅ pass live live-intent-check.log Scenario D
When launch-brief.md has the overlay, it becomes the authorized source: words outside it are refused, and the overlay repeats the never-drop rule ✅ pass live live-intent-check.log Scenario E
A real no-mistakes pipeline run publishes a PR body free of leaks that carries Refs at creation ⏸️ untested no Running a real worker and a no-mistakes pipeline would open an actual PR on a forge. That would need a lab GitHub repo, pushed credentials, and authority to start another pipeline, which this gate pha…
  • bash tests/fm-intent-check.test.sh (13 focused behavior tests, all ok)
  • bin/fm-lab-home.sh create $LAB then FM_HOME=$LAB bin/fm-brief.sh intent-live-a1 rackfan --mode no-mistakes, then read the Definition of done lines that name the scrub and check commands and the no-drop rule
  • Scenario A: filled Captain's intent with retro leak patterns and ran fm-intent-check.sh scrub $D from a project repo with a github.com origin
  • Scenario B: filled a clean spec with an issue URL, second-person product wording and a Markdown link; ran scrub &gt; intent.txt then check $D intent.txt
  • Scenario C: check on the scrub output with the Refs line removed
  • Scenario D: check on a composed string with an added Firstmate spec sentence, a ## Firstmate spec heading, a User: label and an invented Refs #99
  • Scenario E: rendered launch-brief.md with the real fm_brief_intent_overlay, confirmed the task dir resolves to it and that the overlay repeats the never-drop rule
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

Copilot AI lite review requested due to automatic review settings September 26, 2026 01:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Critical authorization and reference-filtering issues remain, and generated paths need shell quoting.

Review effort: Lite
Findings: None

What changed in this PR

Adds pre-run validation and scrubbing for no-mistakes --intent strings before PR body creation.

Changes:

  • Added intent checking, scrubbing, and reference validation.
  • Integrated the contract into briefs and promotions.
  • Added tests and CLI documentation.
File Description
tests/​fm-task-delivery.test.sh Normalizes task-specific command paths.
tests/​fm-intent-check.test.sh Adds intent behavior coverage.
docs/​scripts.md Documents the new CLI.
bin/​fm-promote.sh Applies the intent contract during promotion.
bin/​fm-intent-check.sh Exposes check and scrub commands.
bin/​fm-dod-lib.sh Implements intent rules and worker instructions.
bin/​fm-brief.sh Includes validation requirements in new briefs.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

The pipeline publishes --intent as the pull request body. Add
fm-intent-check.sh (rules in fm-dod-lib.sh) to refuse speaker labels,
direct address, attributed quotes, foreign fleet terms, and sentences
outside the authorized words, to require Refs #<n> for linked issues,
and to scrub the authorized words into a passing starting string.
The no-mistakes Definition of done now tells the worker to run it.
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.

2 participants