Skip to content

fm-brief's Herdr safety gate quotes {TASK}, so filling the brief with a global replace corrupts the gate #2575

Closed

Description

@geniusgordon

The trap

bin/fm-brief.sh tells firstmate to "replace every {TASK} placeholder". The scaffold's own
Herdr safety gate then quotes that placeholder in prose:

**HARD SAFETY GATE:** this scaffold cannot inspect the task text that replaces `{TASK}` later.

So a global replace - the literal instruction - substitutes the entire task body into the middle
of the safety gate's sentence. The result reads as a second, garbled copy of the task and the
safety gate's meaning is destroyed.

Hit on 2026-08-18 filling a ship brief. Caught only because the task body appeared twice in a
heading scan; nothing in the tooling flags it.

Why it matters

The corrupted text IS a safety contract. AGENTS.md section 11 calls the scaffold "a safety
contract, not a suggestion", and this one specifically exists because the scaffold cannot see the
task text. A silent corruption of that sentence is the one failure the gate was written to
prevent.

It also scales badly: the longer the task body, the less obvious the corruption, because the
duplicate is buried far from the heading.

Suggested fix

Pick either, but pick one:

  1. Make the placeholder unique. Use a distinct token for the fillable slot, for example
    {TASK_BODY}, and leave the prose reference as {TASK}. A global replace then cannot reach
    the safety gate.
  2. Do not quote the placeholder in prose. Reword the gate to "the task text filled in above",
    so there is nothing for a replace to hit.

Option 1 is preferable: it keeps the gate's wording precise about what it cannot inspect.

A third, weaker option is a validation pass in fm-brief.sh that refuses a brief whose task body
appears more than once. That catches the symptom rather than removing the trap, and it cannot
distinguish a legitimate repetition.

Activity

  1. kunchenguid commented on Aug 21, 2026

    @kunchenguid
    Owner

    Speaking as Kun's firstmate:

    Confirmed on current main: bin/fm-brief.sh still tells firstmate to replace every {TASK}, and the Herdr HARD SAFETY GATE still quotes {TASK} in prose (line 294) next to the fillable slot (line 306). A global replace corrupts the safety contract.

    Marking ready-for-pr.

  2. added
    ready-for-pr
    on Aug 21, 2026
  3. kunchenguid commented on Aug 21, 2026

    @kunchenguid
    Owner

    Speaking as Kun's firstmate:

    Confirmed on current main: this is still a real safety-gate corruption.

    VISION

    • The scaffold is a safety contract, not a suggestion (AGENTS.md section 11): aligns. Inspected bin/fm-brief.sh lines 292-296: the unguarded Herdr section still quotes {TASK} in the HARD SAFETY GATE sentence. The fillable slot is the same token ({TASK} at the Task heading, ship and scout). AGENTS.md section 11 still says to replace every {TASK} placeholder, so a global replace is the documented fill method and it silently destroys the gate.
    • Scripts own the mechanics / strengthen a refusal path: aligns. This is a deterministic placeholder collision, not judgment. A corrupted gate is the failure the sentence exists to prevent.
    • Authority is explicit and never inferred: aligns. The gate exists because the scaffold cannot see the later task text; substituting that text into the gate falsifies the contract.

    tests/fm-brief.test.sh only asserts that {TASK} is present. It does not assert that the Herdr gate survives a global replace. No competing PR found. Preferred fix is a distinct fill token (e.g. {TASK_BODY}) so the gate can keep naming {TASK} in prose, plus a regression that fills a body containing the gate words and checks the gate sentence is unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-for-pr

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions