Add pre-open self-review checklist for sub-agent PR dispatches to HEARTBEAT.md
completedAgent: slava-agent
Priority: 2
From 2026-06-12 self-reflection. Atomic HEARTBEAT.md edit. Workspace-internal (no PR).
ADD a new doctrine section to ~/agents/slava-agent/HEARTBEAT.md titled "Pre-open self-review checklist for sub-agent PR dispatches" with this text:
---
**Rule:** Before any sub-agent OPENS a PR (not when pushing to an existing PR), the sub-agent must run a pre-open self-review checklist. If any of the 5 steps fails, do NOT open the PR — fix locally first.
1. `yarn lint` on the touched files (or package).
2. `yarn tsc --noEmit` on the touched package.
3. Targeted `jest` run on the touched test files.
4. `git diff main...HEAD` self-read for obvious issues (logging left enabled, console.log, TODO without owner, dead code).
5. Verify reviewer-recommended modules exist on main — `grep -r <target-module-path> $(git rev-parse --show-toplevel)/<domain>` for any `@/`-aliased imports that look like they could be stale (especially after rebase or barrel-import refactors).
If all 5 pass: open the PR. If any fails: fix the failure, re-run the failing step until clean, then proceed.
**Distinguished from state-machine whack-a-mole:** This rule applies to *initial PR open*. The 3-rounds-then-state-coverage rule (`9c9c390a` 06-09) applies to *re-review whack-a-mole on a stateful component*. They are different doctrines for different failure shapes.
**Case study (2026-06-12):** PR #12060 (BOLT-1244 Leap device mapping) opened 06-10T14:42Z; went through 4 rounds of distinct sequential reviewer findings over 11 hours:
- Round 1 (10:22Z): initial Cursor + CodeRabbit findings.
- Round 2 (10:36Z): CodeRabbit nitpick on validation order (`reserve leapMeterId before validation`).
- Round 3 (14:01Z): Cursor on `multiple_battery_devices` semantics (counts DOW links, not distinct batteries).
- Round 4 (21:33Z): CodeRabbit re-review nits.
Each round addressed a DIFFERENT code path. None were state-machine whack-a-mole. All four could plausibly have been caught by a thorough pre-open self-review pass: lint + tsc + targeted tests + diff self-read + module-path sanity check. The cost of 4 reviewer rounds + Slava merge gate is hours of wall-clock; the pre-open checklist is ~3-5 minutes.
---
ATOMIC STEPS:
1. Read current HEARTBEAT.md.
2. Locate the sub-agent dispatch doctrine area.
3. Insert the new section.
4. Verify the edit is clean.
5. PATCH this fleet-task to completed with the new HEARTBEAT.md line count and the section heading.
Event Timeline
created
status_change
queued → completed