Skip to content

Commit 45239b8

Browse files
committed
Size-adaptive red-team at /implement Phase 3 (folded into 3.1.0)
Phase 3 now sizes the red-team half like /plan sizes work: a single-file (or trivial, no new logic) diff runs one red-team mode: both; a multi-file or cross-cutting diff splits into parallel mode: bugs + mode: cleanup with the cleanup run report-only, so the parallel gate stays read-only. review-impl runs alongside in every case. No new red-team mode added. validate.sh section 18 locks the invariant (mode literals + report-only, matched loosely). Also: tracker-schema.md tracker-commit note reconciled with the README, section 14 title corrected to 510, README qualifier aligned. Dogfooded via devloop: review-plan PASS-WITH-WARNINGS (5 findings folded into the plan); Phase 3 split gate (dogfooding this very feature) = review-impl PASS-WITH-WARNINGS + red-team mode:bugs (1 CONFIRMED bucket- overlap, fixed) + red-team mode:cleanup report-only (WARNs addressed); holistic release review SHIP-WITH-FIXES (all applied). Folded into 3.1.0 per maintainer; manifests unchanged.
1 parent de9ea30 commit 45239b8

5 files changed

Lines changed: 95 additions & 13 deletions

File tree

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,22 @@ resolves in the user's project) and gives trackers a stable home outside
5454
`skills/implement/project-configs/` (engineering) layout, and
5555
`validate.sh` now checks the examples in a single section (the former
5656
duplicate example-config check is removed).
57+
- **`/implement` Phase 3 sizes the `red-team` half by diff size**, the
58+
same way `/plan` sizes work (its Trivial / Small / Medium+ / Large
59+
table). A single-file change (or a trivial one with no new logic) runs
60+
one `red-team` in `mode: both`, unchanged from before. A broader,
61+
multi-file or cross-cutting diff (`/plan` Medium+ and Large) splits the
62+
`red-team` half into parallel `mode: bugs` and `mode: cleanup` runs so
63+
neither family crowds the other out. `review-impl` runs alongside in
64+
every case. Because `red-team` in `mode: cleanup` can apply fixes, the
65+
split invokes the `cleanup` run report-only, so all three concurrent
66+
agents only report and the parallel gate stays read-only. No new
67+
`red-team` mode was added; report-only is an invocation instruction
68+
inside `cleanup` mode.
69+
- **`validate.sh` section 18** asserts the Phase 3 spawn stays
70+
size-adaptive (it names the `mode: both`, `mode: bugs`, `mode: cleanup`,
71+
and `report-only` markers), so a future edit can't silently revert to
72+
the fixed single-agent gate.
5773

5874
### Migration
5975
- **Move in-flight trackers.** Trackers previously written under `docs/`

README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ the same across projects and harnesses.
7171
overlap: `review-impl` defers correctness, robustness, standards, and
7272
cleanup to `red-team`. A bug that faithfully implements a flawed plan
7373
is caught only by `red-team`; a correct-but-off-spec change only by
74-
`review-impl`.
74+
`review-impl`. On a large, multi-file diff the `red-team` half fans
75+
into a focused bugs pass and a focused cleanup pass in parallel; on a
76+
small diff it stays a single `both` pass (see below).
7577
- **The bug hunter is recall-biased, then verified.** `red-team`
7678
surfaces candidate defects freely (conservative reviewers
7779
under-report), then runs a verify pass that keeps only
@@ -140,14 +142,23 @@ It takes a mode:
140142
| Mode | What it does |
141143
|---|---|
142144
| `bugs` | correctness angles only, then verify + sweep |
143-
| `cleanup` | quality angles only, the tidy pass; can apply fixes |
145+
| `cleanup` | quality angles only, the tidy pass; can apply fixes (report-only when run as a gate) |
144146
| `both` *(default)* | everything |
145147

146148
```
147149
Use the red-team agent in mode: both to review the changed files
148150
Use the red-team agent in mode: cleanup to tidy the changed files
149151
```
150152

153+
**Size-adaptive at the `/implement` gate.** Phase 3 sizes the diff the
154+
same way `/plan` sizes work: a single-file change (or a trivial one with
155+
no new logic) runs one `red-team` in `mode: both`; a multi-file or
156+
cross-cutting diff splits
157+
the `red-team` half into parallel `mode: bugs` and `mode: cleanup` runs so
158+
neither family crowds the other out. At the gate the `cleanup` run is
159+
invoked report-only, so the whole review stays read-only and safe to run
160+
alongside `review-impl`.
161+
151162
## Install
152163

153164
**Claude Code.** Install from the marketplace:

skills/implement/SKILL.md

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -254,29 +254,53 @@ are available:
254254
`complete` (see Phase 1.3), is a **blocked feature**: do not treat it as
255255
complete or trigger this gate, stop and surface it to the user.
256256

257-
**GATE: All chunks complete triggers parallel review.** Spawn two
258-
independent agents in a single message so they run concurrently. Both
259-
are read-only (`red-team` in `both` mode reports; it does not apply),
260-
so concurrent runs are safe:
257+
**GATE: All chunks complete triggers parallel review.** Spawn the review
258+
agents in a single message so they run concurrently. They are read-only
259+
(`review-impl` and `red-team` in `bugs`/`both`, plus `cleanup` when
260+
invoked report-only, all report; none apply), so concurrent runs are
261+
safe:
261262

262263
1. **`review-impl` agent**, the conformance gate. Verifies plan match,
263264
acceptance criteria met with quoted test evidence, test quality, and
264265
regression against the tracker. Answers "does the implementation match
265266
what was planned, and does the suite prove it?" It does **not** hunt
266267
correctness bugs, robustness gaps, standards violations, or cleanup,
267268
that is `red-team`'s territory, so the two no longer overlap.
268-
2. **`red-team` agent** (`mode: both`), adversarial diff reviewer.
269-
Hunts correctness bugs (5 angles) and flags cleanup (reuse,
270-
simplification, efficiency, altitude), verifies each finding
271-
(recall-biased), then sweeps for gaps. Answers "what is wrong or
272-
wasteful in this diff, regardless of the plan?"
269+
2. **`red-team` agent**, adversarial diff reviewer. Hunts correctness
270+
bugs (5 angles) and flags cleanup (reuse, simplification, efficiency,
271+
altitude), verifies each finding (recall-biased), then sweeps for gaps.
272+
Answers "what is wrong or wasteful in this diff, regardless of the
273+
plan?"
274+
275+
**Size the red-team half** the same way `/plan` sizes work (its Trivial /
276+
Small / Medium+ / Large table), by the set of files touched across the
277+
completed chunks:
278+
279+
- **Small diff** (a single-file change, or a trivial one with no new
280+
logic, matching `/plan`'s Small row): one `red-team` in `mode: both`.
281+
- **Large diff** (broader: multiple files or cross-cutting, i.e. `/plan`
282+
Medium+ and Large): split the red-team half into `mode: bugs` and
283+
`mode: cleanup` run in parallel, so neither family crowds the other
284+
out. Invoke the `cleanup` agent **report-only** (it can otherwise apply
285+
fixes), which keeps the whole gate read-only.
286+
287+
Small diff (default):
273288

274289
```
275290
In parallel:
276291
- Use the review-impl agent to review implementation against [path to tracker]
277292
- Use the red-team agent in mode: both to review the changed files (pass the tracker path)
278293
```
279294

295+
Large diff (split the red-team half):
296+
297+
```
298+
In parallel:
299+
- Use the review-impl agent to review implementation against [path to tracker]
300+
- Use the red-team agent in mode: bugs to review the changed files (pass the tracker path)
301+
- Use the red-team agent in mode: cleanup to review the changed files, report only (pass the tracker path)
302+
```
303+
280304
Complementary by design: `review-impl` checks conformance to intent
281305
(conservative, PASS when the plan is met); `red-team` checks correctness
282306
independent of intent (recall-biased, surfaces everything, then

skills/plan/references/tracker-schema.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# JSON Tracker Schema
22

33
The tracker file is the single source of truth for feature implementation progress.
4-
It is a local working file - not committed to version control.
4+
It is a working file; commit it for cross-machine resumability or
5+
gitignore it, your call.
56

67
Write it **atomically** (write a temp file, then rename over the old one) so a
78
crash mid-write cannot corrupt the single source of truth.

validate.sh

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ check_skill_frontmatter "$plan_skill" "Plan SKILL.md"
531531
check_skill_frontmatter "$spec_skill" "Spec SKILL.md"
532532

533533
# ─────────────────────────────────────────────
534-
section "14. SKILL.md files are under 500 lines"
534+
section "14. SKILL.md files are under 510 lines"
535535
# ─────────────────────────────────────────────
536536

537537
for skill_file in "$implement_skill" "$plan_skill" "$spec_skill"; do
@@ -639,6 +639,36 @@ for agent in agents/review-plan.md agents/review-impl.md agents/red-team.md; do
639639
fi
640640
done
641641

642+
# ─────────────────────────────────────────────
643+
section "18. Phase 3 red-team spawn is size-adaptive"
644+
# ─────────────────────────────────────────────
645+
646+
# /implement Phase 3 sizes the diff and either runs one red-team in
647+
# mode: both (small diff) or splits into parallel mode: bugs +
648+
# mode: cleanup (report-only) on a large diff. Guard the invariant so a
649+
# future edit can't silently revert to the fixed single-agent gate or
650+
# drop the report-only instruction that keeps the split read-only.
651+
# The three mode literals prove both paths are documented: mode: both
652+
# (small diff) plus mode: bugs and mode: cleanup (the large-diff split).
653+
# mode: bugs is unique to the split, so a revert to the fixed single-agent
654+
# gate drops it and this fires.
655+
for token in "mode: both" "mode: bugs" "mode: cleanup"; do
656+
if grep -qi "$token" "$implement_skill"; then
657+
pass "implement SKILL.md Phase 3 names the size-adaptive marker: \"$token\""
658+
else
659+
fail "implement SKILL.md Phase 3 is missing the size-adaptive marker: \"$token\" (the red-team spawn must document small -> mode: both vs large -> parallel mode: bugs + mode: cleanup)"
660+
fi
661+
done
662+
# The split cleanup agent must be invoked report-only so the gate stays
663+
# read-only. Match loosely (hyphen or space) so a benign reword does not
664+
# spuriously fail; the invariant is the report-only instruction, not its
665+
# spelling.
666+
if grep -Eqi "report[- ]only" "$implement_skill"; then
667+
pass "implement SKILL.md invokes the split cleanup agent report-only"
668+
else
669+
fail "implement SKILL.md Phase 3 must invoke the large-diff cleanup agent report-only (keeps the parallel gate read-only)"
670+
fi
671+
642672
# ─────────────────────────────────────────────
643673
# Summary
644674
# ─────────────────────────────────────────────

0 commit comments

Comments
 (0)