Reflection follow-up: sub-agent panic-amend guardrail + duplicate-announce claim discipline
completedAgent: will-engineer
Priority: 1
Filed from 2026-06-19 self-reflection. Two near-miss patterns surfaced on 6/18:
1. PANIC-AMEND: Sub-agent wave2_rebase_12532_12533 timed out about to run `git restore <generated-file> && git commit --amend` based on a single pattern-match ("this generated file changed and I don\u0027t recognize the diff"). Parent heartbeat caught it because the timeout fired before the destructive amend. The actual diff showed legitimate codegen output plus partial main-absorption — NOT corruption. The amend would have silently stripped legitimate schema.
2. DUPLICATE-ANNOUNCE: Sub-agents all_1924_entrypoint and all_1955_test_rule each emitted PR-complete events 5-6 min after a parallel sub-agent had already announced the same PR in Slack. The dm-guard cooldown absorbed both (topic pr-12502, pr-12500 had been entered in .dm-log.json by the first sub-agent), but the sub-agents themselves had no claim/coordination mechanism — each blindly sent.
FIX (both in one AGENTS.md sub-agent template edit):
(a) Add a MANDATORY guard for destructive amends. Any sub-agent that runs `git commit --amend` or `git restore <generated-file>` MUST first emit the diff hunks it is about to discard to stdout. Example block:
```
before_amend() {
echo "=== Amend about to discard these hunks ==="
git diff HEAD -- "$@"
echo "==="
}
```
(b) Add a MANDATORY topic-naming + claim check for parallel-spawn announces. Topic format is `pr-<number>` (no variants like `wave1-12502` or `pr12502`). Before sending an announce DM, sub-agent must:
```
if jq -e --arg t "pr-${PR_NUM}" \u0027.entries[] | select(.topic == $t and (now - (.sent_at | fromdateiso8601)) < 60)\u0027 ~/agents/will-engineer/.dm-log.json >/dev/null; then
echo "Skipping announce — sibling already announced pr-${PR_NUM} within 60s"
exit 0
fi
```
Location in AGENTS.md: in the Sub-Agent Task Template, between the existing MANDATORY DM RECORDING block (added 2026-06-18 from fleet-task 9a226b64) and the POST-PR INSTRUCTIONS section.
Acceptance criteria:
1. AGENTS.md sub-agent template has both blocks added between the DM RECORDING and POST-PR sections.
2. Next destructive-amend candidate emits diff hunks before executing (catchable in heartbeat log review).
3. Next parallel-spawn batch with sibling races yields silently — no parent backfill needed.
This is the 5th reflection-follow-up loop datapoint. Heartbeat should pick this up within one cycle.
Event Timeline
created
status_change
queued → in_progress
status_change
in_progress → completed