Skip to content

fix(bin): avoid duplicating task text in Herdr safety gates - #11

Merged
Hozzy02 merged 3 commits into
mainfrom
fm/fm-brief-task-token-twice-r2
Sep 21, 2026
Merged

Hozzy02 merged 3 commits into
mainfrom
fm/fm-brief-task-token-twice-r2

Conversation

@Hozzy02

@Hozzy02 Hozzy02 commented Sep 21, 2026

Copy link
Copy Markdown
Owner

Intent

Fix bin/fm-brief.sh so its generated scaffolds contain the {TASK} placeholder token exactly once. The Herdr lifecycle declaration's HARD SAFETY GATE prose contained a literal {TASK} token, so filling every {TASK} (per AGENTS.md section 11) pasted the whole task into the middle of the safety gate; ship and scout scaffolds were affected. Reword it to refer to the task placeholder above without the literal token, preserving the gate meaning (scaffold cannot inspect the task text; regenerate with --herdr-lab). Secondmate charters intentionally keep two placeholders (charter and routing scope), so they are unchanged. Do not edit AGENTS.md. Test through the executable: extend tests/fm-brief.test.sh to generate each variant into its own distinct isolated FM_HOME, assert exactly one {TASK} token in ship/scout output, and fill every {TASK} with a unique marker asserting it appears once with the gate sentence intact; never assert script source bytes. PR must target the fork Hozzy02/firstmate, not upstream kunchenguid/firstmate. Standards: shellcheck via bin/fm-lint.sh; never add an agent name as a commit co-author (no Co-Authored-By footer on any commit).

What Changed

  • Reword the disabled Herdr safety gate so ship and scout scaffolds contain a single {TASK} placeholder without changing the gate’s meaning or --herdr-lab guidance.
  • Add executable regression coverage for every scaffold variant using isolated FM_HOME directories, including filled-marker assertions and the intentional two-placeholder secondmate behavior.

Risk Assessment

✅ Low: The narrowly scoped prose fix preserves the Herdr safety gate, and executable-level coverage enforces the token-count invariant across ship, scout, Herdr-lab, and intentionally distinct secondmate variants.

Testing

The focused executable test passed before and after the test-only correction; end-to-end generation proved all ship/scout variants contain and fill exactly one task placeholder while secondmate retains two, with the Herdr gate intact. CLI transcript and generated-scaffold artifacts were captured; no visual screenshot applies to this non-UI change. Lint was not run because this assigned test phase explicitly prohibits linters and the outer executor owns the lint phase.

Evidence: End-to-end scaffold evidence

Ship and scout variants each contained one placeholder and one filled marker; secondmate retained two. Herdr safety-gate wording and --herdr-lab direction remained intact.

ship-nm: generated_tokens=1 filled_markers=1 home=/var/folders/t1/8htjz3j91cqcfslff4w76zqc0000gn/T/no-mistakes-evidence/01M32BZCHKSXXRW6M9BXJGYZ2N/ship-nm-home
**HARD SAFETY GATE:** this scaffold cannot inspect the task text that replaces the task placeholder above 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.
ship-dp: generated_tokens=1 filled_markers=1 home=/var/folders/t1/8htjz3j91cqcfslff4w76zqc0000gn/T/no-mistakes-evidence/01M32BZCHKSXXRW6M9BXJGYZ2N/ship-dp-home
**HARD SAFETY GATE:** this scaffold cannot inspect the task text that replaces the task placeholder above 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.
ship-lo: generated_tokens=1 filled_markers=1 home=/var/folders/t1/8htjz3j91cqcfslff4w76zqc0000gn/T/no-mistakes-evidence/01M32BZCHKSXXRW6M9BXJGYZ2N/ship-lo-home
**HARD SAFETY GATE:** this scaffold cannot inspect the task text that replaces the task placeholder above 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.
ship-nm-lab: generated_tokens=1 filled_markers=1 home=/var/folders/t1/8htjz3j91cqcfslff4w76zqc0000gn/T/no-mistakes-evidence/01M32BZCHKSXXRW6M9BXJGYZ2N/ship-nm-lab-home
scout: generated_tokens=1 filled_markers=1 home=/var/folders/t1/8htjz3j91cqcfslff4w76zqc0000gn/T/no-mistakes-evidence/01M32BZCHKSXXRW6M9BXJGYZ2N/scout-home
**HARD SAFETY GATE:** this scaffold cannot inspect the task text that replaces the task placeholder above 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.
scout-lab: generated_tokens=1 filled_markers=1 home=/var/folders/t1/8htjz3j91cqcfslff4w76zqc0000gn/T/no-mistakes-evidence/01M32BZCHKSXXRW6M9BXJGYZ2N/scout-lab-home
secondmate: generated_tokens=2 filled_markers=2 home=/var/folders/t1/8htjz3j91cqcfslff4w76zqc0000gn/T/no-mistakes-evidence/01M32BZCHKSXXRW6M9BXJGYZ2N/secondmate-home
Evidence: Filled no-mistakes ship scaffold
You are a crewmate: an autonomous worker agent managed by firstmate. Work on your own; do not wait for a human.

# Task
UNIQUE-FILLED-TASK-ship-nm

# Herdr lifecycle declaration - NOT ENABLED
**HARD SAFETY GATE:** this scaffold cannot inspect the task text that replaces the task placeholder above 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 firstmate, 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/evidence-ship-nm`
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 PR.
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}" >> '/var/folders/t1/8htjz3j91cqcfslff4w76zqc0000gn/T/no-mistakes-evidence/01M32BZCHKSXXRW6M9BXJGYZ2N/ship-nm-home/state/evidence-ship-nm.status'`
   States: working, 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:` 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.
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 apply the configured authority and 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
If `AGENTS.md` or `CLAUDE.md` already exists, or if this task produced durable project-intrinsic knowledge, run `/Users/randalwade/.no-mistakes/worktrees/3a2378ca6c3e/01M32BZCHKSXXRW6M9BXJGYZ2N/bin/fm-ensure-agents-md.sh .` in the worktree.
Record only project knowledge useful to almost every future session.
For anything the codebase already shows, prefer a pointer to the authoritative file, command, or doc over copying the detail.
If you touch a project `AGENTS.md` that lacks `## Maintaining this file`, add that short self-governance section from `/Users/randalwade/.no-mistakes/worktrees/3a2378ca6c3e/01M32BZCHKSXXRW6M9BXJGYZ2N/bin/fm-ensure-agents-md.sh` in the same pass.
Keep it proportionate: skip `AGENTS.md` edits for trivial tasks that produced no durable project knowledge.

# 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 PR.

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 the authority contract in its `AGENTS.md` 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: Filled scout scaffold
You are a crewmate: an autonomous worker agent managed by firstmate. Work on your own; do not wait for a human.

# Task
UNIQUE-FILLED-TASK-scout

# Herdr lifecycle declaration - NOT ENABLED
**HARD SAFETY GATE:** this scaffold cannot inspect the task text that replaces the task placeholder above 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 firstmate, at a detached HEAD on a clean default branch.
This is a SCOUT task: the deliverable is a written report, not a PR.
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 PR.
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}" >> '/var/folders/t1/8htjz3j91cqcfslff4w76zqc0000gn/T/no-mistakes-evidence/01M32BZCHKSXXRW6M9BXJGYZ2N/scout-home/state/evidence-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.
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 `/var/folders/t1/8htjz3j91cqcfslff4w76zqc0000gn/T/no-mistakes-evidence/01M32BZCHKSXXRW6M9BXJGYZ2N/scout-home/data/evidence-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.
Before reporting done, read and follow `/Users/randalwade/.no-mistakes/worktrees/3a2378ca6c3e/01M32BZCHKSXXRW6M9BXJGYZ2N/.agents/skills/decision-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.

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.

  • Inspected git diff d67249367f8d1d843df7ea53d496be20095724d4..8dafd02f4e7fd28961ea7ff2c69dfbaf101ddca7 -- bin/fm-brief.sh tests/fm-brief.test.sh.
  • Ran bash tests/fm-brief.test.sh before and after the focused test correction.
  • Generated seven variants through bin/fm-brief.sh, each with a distinct isolated FM_HOME; replaced every {TASK} with a unique marker and verified counts plus emitted gate wording.
  • Ran git remote -v, inspected changed paths, and searched target-branch commit messages for Co-Authored-By: footers.
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@Hozzy02
Hozzy02 merged commit 41e6101 into main Sep 21, 2026
13 checks passed
@Hozzy02
Hozzy02 deleted the fm/fm-brief-task-token-twice-r2 branch September 26, 2026 00:41
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