Skip to content

fix(bin): stop fm-brief.sh directing workers to write AGENTS.md or a nonexistent skill - #17

Merged
alandomio merged 2 commits into
mainfrom
fm/fm-brief-generatore
Sep 6, 2026
Merged

alandomio merged 2 commits into
mainfrom
fm/fm-brief-generatore

Conversation

@alandomio

Copy link
Copy Markdown
Owner

Intent

Fix two defects in bin/fm-brief.sh, the generator for every crewmate brief this fleet produces.

Defect 1: the generated ship brief's Project memory section told workers to run fm-ensure-agents-md.sh and write to a project's AGENTS.md/CLAUDE.md. The captain set a standing rule today (2026-09-06): workers must NEVER write to a project's AGENTS.md - only firstmate writes it, and only on the captain's explicit confirmation. This caused real damage: AGENTS.md was the only conflicting file on four separate branches today because every worker was appending to it, and one merge was resolved by committing both sides with conflict markers left in (now on php8, 848 lines where 700 are an unresolved conflict). Fix: remove the write instruction, replace it with the opposite - the worker never touches AGENTS.md/CLAUDE.md, and durable project knowledge is instead raised as a 'note: CANDIDATE - {finding}' status line (the existing Rule 4 / AGENTS.md section 6 candidate mechanism - cross-reference it, do not restate its contract, per the one-owner rule in firstmate-coding-guidelines). Also fixed the header comment (was lines 59-62) that described the same wrong behavior, since nothing else was allowed to still imply the worker owns that file.

Defect 2: lines 458 and 497 instructed the worker to write the PR/MR description using an 'mr-description' skill that does not exist anywhere in the repo (verified: not in .agents/skills/, not anywhere else, not in the skill list workers actually see). Independently reported by two different workers on two different tasks today. Decision: remove the reference rather than create the skill (out of this task's scope) - removing is the honest choice per the task instructions. Also fixed a now-stale 'Three firstmate-specific rules' count in the no-mistakes DOD prose that needed to become 'Two' once the mr-description bullet was removed.

Explicitly out of scope: AGENTS.md itself currently contradicts the captain's new standing rule in its own section 1/6 language (section 1 says a crewmate creates/updates a project's AGENTS.md via fm-ensure-agents-md.sh). That contradiction is a separate fix for whoever owns AGENTS.md - this task was scoped strictly to bin/fm-brief.sh and its test coverage, not to reconciling AGENTS.md's own text.

Done means: a brief generated for a ship task contains no instruction to write AGENTS.md and no reference to a non-existent skill. Verified via before/after diffs of generated briefs (no-mistakes and direct-PR modes) rather than just describing the change. Updated the two existing tests that covered the old (buggy) wording: test_mr_description_skill_required_for_pr_modes (renamed to test_mr_description_skill_not_referenced) and test_ship_project_memory_wording, so they assert the new contract instead of the old one. Ran bin/fm-lint.sh (shellcheck 0.11.0 + actionlint 1.7.12, both pinned) clean, and the full fm-brief.test.sh suite (29 checks) plus spot-checked fm-tangle-guard, fm-secondmate-safety, and fm-ask-user-authority tests that also exercise fm-brief.sh - no regressions.

What Changed

  • bin/fm-brief.sh: replaced the ship-task project-memory section's instruction to run fm-ensure-agents-md.sh and write a project's AGENTS.md/CLAUDE.md with a rule forbidding worker writes to those files, routing durable findings through the existing note: CANDIDATE - {finding} status line (Rule 4) instead; updated the matching header comment; removed both references to the non-existent mr-description skill (direct-PR and no-mistakes brief templates) and updated the now-stale "Three firstmate-specific rules" DOD prose to "Two".
  • docs/architecture.md: updated "Project memory belongs to projects" and "Operational memory routing" sections to describe the new candidate-note routing instead of direct crewmate writes to AGENTS.md.
  • .agents/skills/stow/SKILL.md: updated the approved-destinations and routing guidance to reflect that project-intrinsic knowledge is raised as a candidate note for firstmate to route and write, rather than committed directly by a crewmate via fm-ensure-agents-md.sh.
  • tests/fm-brief.test.sh: renamed test_mr_description_skill_required_for_pr_modes to test_mr_description_skill_not_referenced and rewrote it to assert no generated brief references mr-description; rewrote test_ship_project_memory_wording to assert the new forbid-write/candidate-note contract instead of the old AGENTS.md-authoring-bar assertions.

Risk Assessment

✅ Low: The change is a small, well-scoped text fix in bin/fm-brief.sh that removes the two identified defects (AGENTS.md write instruction and non-existent mr-description skill reference) cleanly with no dangling references, correctly updates the "Two firstmate-specific rules" count, cross-references the pre-existing Rule 4/CANDIDATE mechanism instead of restating it, and updates the two affected tests to assert the new contract by exercising the generated brief.md output (the legitimate generated-artifact interface, not source-content grepping).

Testing

All targeted automated tests pass (29-check fm-brief suite plus three related suites, no regressions), and manual before/after diffs of actual generated ship briefs in both delivery modes confirm end-to-end that the AGENTS.md-write instruction and the non-existent mr-description skill reference are gone, replaced by the note: CANDIDATE routing per the user's intent.

Evidence: Diff of generated no-mistakes-mode brief.md (base vs. target fm-brief.sh)

Source: Diff of generated no-mistakes-mode brief.md (base vs. target fm-brief.sh)

--- /tmp/brief-evidence/base/no-mistakes.md	2026-09-06 16:34:57.560280978 +0200
+++ /tmp/brief-evidence/after/no-mistakes.md	2026-09-06 16:34:36.760559556 +0200
@@ -31,7 +31,7 @@
 2. Stay inside this worktree; modify nothing outside it.
 3. This project's forge could not be determined from its git remote; run `git remote -v` to check, then use gh-axi for GitHub or glab for GitLab. chrome-devtools-axi remains available for browser operations.
 4. Report status by appending one line:
-   `echo "{state}: {one short line}" >> '/tmp/brief-evidence/base-home-no-mistakes/state/brief-no-mistakes.status'`
+   `echo "{state}: {one short line}" >> '/tmp/brief-evidence/after-home-no-mistakes/state/brief-no-mistakes.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
@@ -65,11 +65,8 @@
    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 `/tmp/brief-evidence/base-repo/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 `/tmp/brief-evidence/base-repo/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.
+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
@@ -82,11 +79,10 @@
 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.
 
-Three firstmate-specific rules layer on top of that guidance:
+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.
-- Write the PR/MR description, and any later revision to it (including a review-fix revision), with the `mr-description` skill.
 
 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/MR {url} checks green` and stop. You are finished.
Evidence: Diff of generated direct-PR-mode brief.md (base vs. target fm-brief.sh)

Source: Diff of generated direct-PR-mode brief.md (base vs. target fm-brief.sh)

--- /tmp/brief-evidence/base/direct-PR.md	2026-09-06 16:34:57.582049292 +0200
+++ /tmp/brief-evidence/after/direct-PR.md	2026-09-06 16:34:36.781253070 +0200
@@ -30,7 +30,7 @@
 2. Stay inside this worktree; modify nothing outside it.
 3. This project's forge could not be determined from its git remote; run `git remote -v` to check, then use gh-axi for GitHub or glab for GitLab. chrome-devtools-axi remains available for browser operations.
 4. Report status by appending one line:
-   `echo "{state}: {one short line}" >> '/tmp/brief-evidence/base-home-direct-PR/state/brief-direct-PR.status'`
+   `echo "{state}: {one short line}" >> '/tmp/brief-evidence/after-home-direct-PR/state/brief-direct-PR.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
@@ -64,16 +64,12 @@
    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 `/tmp/brief-evidence/base-repo/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 `/tmp/brief-evidence/base-repo/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.
+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=direct-PR
 This task ships **direct-PR**: you raise the pull/merge request yourself, without the no-mistakes pipeline.
 The task is complete only when committed on your branch.
 When it is implemented and committed, push your branch and open a pull/merge request with gh-axi (GitHub) or glab (GitLab) - confirm this project's forge with `git remote -v` before choosing, then append `done: PR/MR {url}` to the status file and stop.
-Write the PR/MR description, and any later revision to it, with the `mr-description` skill.
 Do NOT run /no-mistakes. The configured merge authority decides whether to merge the pull/merge request; firstmate relays the outcome.

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.

  • bash tests/fm-brief.test.sh (29/29 pass)
  • bash tests/fm-tangle-guard.test.sh (pass, no regressions)
  • bash tests/fm-secondmate-safety.test.sh (pass, no regressions)
  • bash tests/fm-ask-user-authority.test.sh (pass, no regressions)
  • Manually generated brief.md for --mode no-mistakes and --mode direct-PR using both the base commit's (27159321) and target commit's (0a8a3ae) fm-brief.sh, then diffed each pair to confirm the AGENTS.md-write instruction, fm-ensure-agents-md.sh reference, and mr-description skill reference are removed, replaced by the note: CANDIDATE routing and 'Two firstmate-specific rules' wording
✅ **Document** - passed

✅ No issues found.

🔧 **Lint** - 1 issue found → auto-fixed ✅
  • ⚠️ linter found issues (exit code 1)

🔧 Fix: Install actionlint 1.7.12 locally so fm-lint.sh passes clean
✅ Re-checked - no issues remain.

✅ **Push** - passed

✅ No issues found.

Alan Domio and others added 2 commits September 6, 2026 16:29
…r a fake skill

The captain set a standing rule today: workers never write a project's
AGENTS.md, only firstmate does, and only on explicit confirmation. Every
worker was appending to it instead, and one conflicted merge landed on php8
with unresolved markers left in. The generator's project-memory section now
forbids the write and points at the existing note: CANDIDATE routing
mechanism (Rule 4) instead of restating it.

Also drops the `mr-description` skill instruction from the direct-PR and
no-mistakes definitions of done: no such skill exists anywhere in the repo,
and two workers independently hit the fake instruction today.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019YN6JkYC7wgfTy5ReiM5P9
@alandomio
alandomio merged commit da0e670 into main Sep 6, 2026
13 checks passed
alandomio pushed a commit that referenced this pull request Sep 26, 2026
… skill

The direct-PR and no-mistakes definitions of done ordered every ship worker
to write the PR/MR description with ~/.claude/skills/mr-description, a skill
that exists nowhere, so every worker hit a dead reference. fc4f0bf (#19)
reintroduced the line that da0e670 (#17) had already removed.

The worker now writes the description itself, keeps the no-trailer and
no-orchestration-vocabulary rule, and is still told to create the PR/MR
without waiting for confirmation on a step the brief already authorizes.
The test now pins the new wording in both forge vocabularies and asserts
no generated brief names mr-description, guarding against a third return.
alandomio added a commit that referenced this pull request Sep 26, 2026
… skill (#35)

The direct-PR and no-mistakes definitions of done ordered every ship worker
to write the PR/MR description with ~/.claude/skills/mr-description, a skill
that exists nowhere, so every worker hit a dead reference. fc4f0bf (#19)
reintroduced the line that da0e670 (#17) had already removed.

The worker now writes the description itself, keeps the no-trailer and
no-orchestration-vocabulary rule, and is still told to create the PR/MR
without waiting for confirmation on a step the brief already authorizes.
The test now pins the new wording in both forge vocabularies and asserts
no generated brief names mr-description, guarding against a third return.

Co-authored-by: Alan Domio <[email protected]>
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