flow-workflows 0.106.0 → 0.108.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/adapters/codex/CORE.md +52 -2
  2. package/adapters/codex/skills/flow-bug-review/SKILL.md +1 -1
  3. package/adapters/codex/skills/flow-bug-ship/SKILL.md +3 -0
  4. package/adapters/codex/skills/flow-bug-validate/SKILL.md +1 -1
  5. package/adapters/codex/skills/flow-feat-build/SKILL.md +6 -3
  6. package/adapters/codex/skills/flow-feat-review/SKILL.md +1 -1
  7. package/adapters/codex/skills/flow-feat-ship/SKILL.md +8 -4
  8. package/adapters/codex/skills/flow-feat-validate/SKILL.md +5 -2
  9. package/adapters/codex/skills/flow-work-README/SKILL.md +1 -1
  10. package/adapters/codex/skills/flow-work-green/SKILL.md +11 -7
  11. package/adapters/codex/skills/flow-work-respond/SKILL.md +6 -1
  12. package/adapters/gemini/CORE.md +52 -2
  13. package/adapters/gemini/commands/flow/bug/review.toml +1 -1
  14. package/adapters/gemini/commands/flow/bug/ship.toml +3 -0
  15. package/adapters/gemini/commands/flow/bug/validate.toml +1 -1
  16. package/adapters/gemini/commands/flow/feat/build.toml +6 -3
  17. package/adapters/gemini/commands/flow/feat/review.toml +1 -1
  18. package/adapters/gemini/commands/flow/feat/ship.toml +8 -4
  19. package/adapters/gemini/commands/flow/feat/validate.toml +5 -2
  20. package/adapters/gemini/commands/flow/work/README.toml +1 -1
  21. package/adapters/gemini/commands/flow/work/green.toml +11 -7
  22. package/adapters/gemini/commands/flow/work/respond.toml +6 -1
  23. package/adapters/hermes/CORE.md +52 -2
  24. package/adapters/hermes/skills/flow-bug-review/SKILL.md +1 -1
  25. package/adapters/hermes/skills/flow-bug-ship/SKILL.md +3 -0
  26. package/adapters/hermes/skills/flow-bug-validate/SKILL.md +1 -1
  27. package/adapters/hermes/skills/flow-feat-build/SKILL.md +6 -3
  28. package/adapters/hermes/skills/flow-feat-review/SKILL.md +1 -1
  29. package/adapters/hermes/skills/flow-feat-ship/SKILL.md +8 -4
  30. package/adapters/hermes/skills/flow-feat-validate/SKILL.md +5 -2
  31. package/adapters/hermes/skills/flow-work-README/SKILL.md +1 -1
  32. package/adapters/hermes/skills/flow-work-green/SKILL.md +11 -7
  33. package/adapters/hermes/skills/flow-work-respond/SKILL.md +6 -1
  34. package/adapters/opencode/CORE.md +52 -2
  35. package/adapters/opencode/commands/flow-bug-review.md +1 -1
  36. package/adapters/opencode/commands/flow-bug-ship.md +3 -0
  37. package/adapters/opencode/commands/flow-bug-validate.md +1 -1
  38. package/adapters/opencode/commands/flow-feat-build.md +6 -3
  39. package/adapters/opencode/commands/flow-feat-review.md +1 -1
  40. package/adapters/opencode/commands/flow-feat-ship.md +8 -4
  41. package/adapters/opencode/commands/flow-feat-validate.md +5 -2
  42. package/adapters/opencode/commands/flow-work-README.md +1 -1
  43. package/adapters/opencode/commands/flow-work-green.md +11 -7
  44. package/adapters/opencode/commands/flow-work-respond.md +6 -1
  45. package/bin/cli.mjs +223 -41
  46. package/package.json +1 -1
  47. package/plugins/flow/.claude-plugin/plugin.json +1 -1
  48. package/plugins/flow/CHANGELOG.md +41 -0
@@ -39,7 +39,7 @@ Read `~/.claude/flow/CORE.gemini.md` first (shared rules: `FLOW.md` step 0, mode
39
39
  2. Creating/switching a branch, or DB schema changes/migrations, if a fix requires them.
40
40
  3. **Re-triggering a pipeline or job on the remote** (CI resources; outward action).
41
41
  4. **Integrating the base branch** — any `git merge`/`git rebase` of `git.default_base` into the branch, and any history rewrite or force-push it implies (§5.C).
42
- 5. **Green-washing — NEVER, in any mode:** no rerun of a failed check hoping it passes; never disable, skip, `@skip`/`xit`, loosen a threshold, or delete a test/lint rule to force green; never resolve a conflict by blindly taking one side (`--ours`/`--theirs`, `checkout --theirs`, discarding the base's changes) — resolve by understanding both sides.
42
+ 5. **Green-washing — NEVER, in any mode:** no rerun of a failed check hoping it passes; never disable, skip, `@skip`/`xit`, loosen a threshold, or delete a test/lint rule to force green; never resolve a conflict by blindly taking one side (`--ours`/`--theirs`, `checkout --theirs`, discarding the base's changes) — resolve by understanding both sides. A fragile test rewritten to assert on the same result, as flow-core §11 allows, is not loosening it.
43
43
 
44
44
  **In `unattended`** (flow-core §2.1) — launched by `/flow:work:run` on `why = pipeline` or
45
45
  `why = conflict` — this command never touches the forge. Gate 5 holds exactly as written; the
@@ -53,8 +53,10 @@ others resolve this way:
53
53
  conflicts with `base`, which the orchestrator left in the checkout as `origin/<base>` at
54
54
  `base_sha`. That is the only blocker of the round — category C, nothing to triage. `origin/<base>`
55
55
  missing or not at `base_sha` → `blocked`: the run would merge a base nobody named.
56
- - **§3** — triage as written, recorded in `09-ci.md`. **K** (flaky / infra) → `blocked` with the
57
- evidence: the run has no rerun order, and the orchestrator owns reruns and the red-round limit.
56
+ - **§3** — triage as written, recorded in `09-ci.md`. **K** (flaky / infra) → when the round
57
+ changed no code, `blocked` with the evidence and a one-line reason starting `rerun CI: <job>[,
58
+ <job>…]` (flow-core §11): the run has no rerun order, and the orchestrator owns reruns and the
59
+ red-round limit; when the round changed code, its `publish` reruns CI anyway.
58
60
  **C** (conflict, behind base) on `why = pipeline`, and anything needing a rebase or force-push →
59
61
  `blocked`: the orchestrator brings the base in, and relaunches with `why = conflict` when it
60
62
  conflicts. A **human** blocker → `blocked`, naming who. **S** → fixed within
@@ -134,12 +136,14 @@ Categories:
134
136
  | **L — lint / style / format** | formatter or linter job red | mechanical auto-fix with `quality.style_fix` (or the repo's formatter) |
135
137
  | **T — test failure** | a unit/integration/functional/frontend test failed | **root-cause fix**: real regression → fix the code; behavior changed *on purpose* → update the test to the new contract (justified from the design) |
136
138
  | **Y — type / build / compile** | type-check (`static_analysis`) or build broke | fix the code/types |
137
- | **K — flaky / infra** | non-deterministic or CI-environment failure **not** caused by this diff (timeout, network, cache, runner) | do **not** green-wash; identify the evidence, propose a **confirmed** rerun (hard gate), and flag the flake |
139
+ | **K — flaky / infra** | non-deterministic or CI-environment failure **not** caused by this diff (timeout, network, cache, runner) **whose cause in the test or the code was looked for and not identified** (flow-core §11) | do **not** green-wash; identify the evidence, propose a **confirmed** rerun (hard gate), and flag the flake |
138
140
  | **S — quality gate / scope** | coverage threshold, security scan, a lint rule newly hitting legacy code | judgment call: fix within scope, or defer/config with justification — never touch unrelated code just to appease a gate without confirming |
139
141
  | **C — conflict / branch behind base** | the branch conflicts with `git.default_base`, or the host requires it updated before merging | integrate the base into the branch and **resolve each conflict on its merits** (§5.C) — hard gate before touching git history |
140
142
  | **H — human blocker** | draft/WIP, approvals missing, unresolved review threads, a required reviewer or check that only a person can clear | **not this command's job**: name it, say exactly what is needed and from whom, and route it (threads → `/flow:work:respond`; draft → offer to mark ready; approvals → the reviewers). Never work around it |
141
143
 
142
- **Root cause, not symptom.** Find *why* the check is red before changing anything. Never weaken what a test checks, never silence a type error with a blanket cast/ignore, never mark a real failure as flaky. A "fix" that hides the failure is not a fix — surface it.
144
+ **A test this diff did not touch is still this command's.** A red test that looks flaky is diagnosed before it is called K (flow-core §11): read its log tail and its code; a fragility identified there — it counts timer ticks, depends on order, reads another test's leftovers — or a cause in the code is **T**, fixed in this round even when it does not go red locally, in its own commit `Fix fragile test <name>: <cause>`, and the line for `## Also fixed` goes to the MR/PR description with the push (`publish-body.md` in `unattended`). Only a cause not identified stays K.
145
+
146
+ **Root cause, not symptom.** Find *why* the check is red before changing anything. Never weaken what a test checks (a flow-core §11 rewrite onto the same result is not weakening), never silence a type error with a blanket cast/ignore, never mark a real failure as flaky. A "fix" that hides the failure is not a fix — surface it.
143
147
 
144
148
  Present a **triage table**: `blocker → kind → category → probable cause (log or merge verdict) → proposed action`, **C** and **H** rows first (a conflict makes the pipeline result provisional — CI reruns on a different tree after integrating the base). In `manual`, let the user re-categorize any row (especially T-vs-K) before proceeding.
145
149
 
@@ -162,9 +166,9 @@ Only **base-integration**, **auto-fix** and **code-fix**:
162
166
 
163
167
  - **Design-invalidation first.** A test failure that shows the *design* was wrong → do not patch the test into agreement; update `03-design.md` **before** editing; if large, route back through `/flow:feat:build` / `/flow:bug:fix`.
164
168
  - **Delegate the edits** to the expert sub-agents (FLOW.md `agents`); the conductor stays on judgment. Repo conventions plus the **comment discipline** of `/flow:feat:build` — comments only for a non-obvious *why*, never a ticket ID or "for MR #N".
165
- - **Reproduce and verify locally — the tight loop.** Before pushing, re-run the failing check locally: L/style → `quality.style_fix`; T → `quality.test` (or `quality.test_one` scoped to the failing test); Y → `quality.static_analysis`. Empty command → auto-discover. Not reproducible locally (environment-only job) → say so, push and let CI re-verify (§6), stating that verification is remote.
169
+ - **Reproduce and verify locally — the tight loop.** Before pushing, re-run the failing check locally: L/style → `quality.style_fix`; T → `quality.test` (or `quality.test_one` scoped to the failing test); Y → `quality.static_analysis`. Empty command → auto-discover. Not reproducible locally (environment-only job) → say so, push and let CI re-verify (§6), stating that verification is remote. A fragile test fixed by flow-core §11 is checked with its forced reproduction when there is one, then pushed the same way.
166
170
  - **Re-run the review gate for non-trivial code-fixes.** More than a mechanical tweak → `quality.review_skill` (or built-in `code-review` if empty) on this round's diff before pushing. Pass the diagnosis as context, never as a scope exclusion (*"the cause was X"*, not *"skip X"*). High-severity findings block the push until addressed.
167
- - **Commits follow `autonomy.mode`.** After editing, **always** report a summary (files, lines, which job each edit turns green). `manual` → the user decides to commit or inspect first; do **not** `git commit` on your own. `guided`/`auto` → commit the round yourself, go straight to the §6 push gate (do not ask twice for one round). The push is a hard gate in **every** mode.
171
+ - **Commits follow `autonomy.mode`.** After editing, **always** report a summary (files, lines, which job each edit turns green). `manual` → the user decides to commit or inspect first; do **not** `git commit` on your own. `guided`/`auto` → commit the round yourself, go straight to the §6 push gate (do not ask twice for one round). A fragile-test repair (flow-core §11) is split into its own commit in every mode, and the round's summary names it as *also fixes fragile test `<name>`: <cause>*. The push is a hard gate in **every** mode.
168
172
 
169
173
  ### 5.C Integrate the base and resolve conflicts (category C)
170
174
 
@@ -97,7 +97,10 @@ back through it, and the hard gates above resolve this way:
97
97
  - **The one closing order**, after the WIP commit (flow-core §2.1): code changed this round →
98
98
  `publish` with the work's `publish-title.md` / `publish-body.md` (updated when the round changed
99
99
  what they say, and naming any thread whose reply failed) and no `--part/--of` — the MR/PR is
100
- already open (flow-core §2.1) — so the commits the replies name reach the branch; no code changed and every reply went
100
+ already open (flow-core §2.1) — so the commits the replies name reach the branch (and the push reruns CI, so a
101
+ failure nobody could explain needs nothing more); no code changed, every reply went out and a
102
+ thread carried a CI failure neither reproduced nor explained (§3) → `blocked`, its one-line reason
103
+ starting `rerun CI: <job>[, <job>…]` (flow-core §11); no code changed and every reply went
101
104
  out → `done`, the summary listing the threads answered; no code changed and a reply failed →
102
105
  `blocked`, naming those threads.
103
106
 
@@ -146,6 +149,8 @@ Categories:
146
149
  | **F — obsolete/done** | Already addressed, or no longer applies | reply pointing to where |
147
150
  | **G — data / performance objection** | The reviewer says a query is slow, unbounded, unindexed, or proposes a different query | **measure first** (§4.G), then reply with the plan |
148
151
 
152
+ **A thread that carries a CI failure** — a person pasted a failing job's log or a red test's output — is a **C** about that test, not an **A** to answer: reproduce it with `quality.test_one`; red → fix it on its merits, through flow-core §11 when the test is outside this diff. Not red here → diagnose it from the pasted log and the test's code (flow-core §11): a fragility identified (it counts timer ticks, depends on order, reads another test's leftovers) or a cause in the code → fix it in its own commit `Fix fragile test <name>: <cause>`, and the reply names that commit and the cause, and the line for `## Also fixed` goes to the MR/PR description with the push (`publish-body.md` in `unattended`). Neither → change nothing for it; the reply says it did not reproduce, that no cause was found in the test or the code, and what the person does next (*rerun CI; if it fails again, …*) — never a bare "not reproduced".
153
+
149
154
  Present a **triage table** to the user: `thread → location → category → proposed action → one-line rationale` — the map for the rest of the command. In `manual` mode, let the user re-categorize any row before proceeding.
150
155
 
151
156
  ## 4. Agree the response per thread (the debate)
@@ -17,7 +17,7 @@ Every `/flow-*` command assumes these rules. They are stated once, here, so a co
17
17
  carries what is specific to its phase. Read this once per session; a command that says "load
18
18
  `flow-core`" means this file.
19
19
 
20
- **This file belongs to flow `0.106.0`.** Compare it once, at the start of the session, against
20
+ **This file belongs to flow `0.108.0`.** Compare it once, at the start of the session, against
21
21
  `version` in `~/.claude/flow/.claude-plugin/plugin.json`. The two differing means the session
22
22
  is running a **mixture** — the commands from one copy of the plugin, these shared rules from another
23
23
  — which is exactly what happens when a branch or a release candidate is loaded over an installed
@@ -449,7 +449,7 @@ person asking for changes, a ticket that already has code — is `/flow-work-run
449
449
  | Writing a DB schema change, index or migration — in any phase, a review's own fixes included — or applying one (`validate`) | question `migration`, before the first line of it is written or run — except in `respond` and `green`, where it is blocked: a schema change agreed after the MR/PR exists goes back through `build`. Writing one whose every object `approved-schema.md` lists is not asked (§2, a schema approved with the study) |
450
450
  | `review` with blockers or high-severity findings | question `high_findings` |
451
451
  | `validate` with a criterion `unproven` | blocked — the phase does not advance and does not chain |
452
- | `validate` with a red suite | **One exception, and it is measured, never judged**: every failing test also fails, under the same name, on the base (`git merge-base HEAD <git.default_base>`, run in a detached worktree), none of them lives in a file this diff touches, and none is the test that proves an acceptance criterion. **The base runs the way HEAD went red**: the same command (the whole suite when the whole suite went red, never the failing file alone), and a test that is red in the whole suite but green on its own is load- or order-dependent, so one run on each side proves nothing — run the whole suite three times on HEAD and three on the base, and write each side's red count and that test's duration in every run. Red on the base as often as on HEAD → the exception holds: record `{"key":"unattended:validate-red-base","default":"<n> red on HEAD and on base <short sha>: <test names>","phase":"validate"}` and advance; `ship` lists those tests under "Not verified — needs a human". Green on the base and red on HEAD, even once in three → this diff made it, whatever a single base run said (a suspect flake, below, gets five more runs first); its repair step says so, with both sides' counts and how much slower the failing runs were, and the fix is what this diff adds under concurrency (a lock, a pool, a timer, a background loop), never a longer timeout or a retry. **A suspect flake is measured again before it is blamed**: a test red in exactly one of HEAD's three runs (the run that first went red is not one of them), in none of the base's, in a file this diff does not touch, green when run on its own, and not the test that proves an acceptance criterion. When at least one test is red in HEAD's three runs and every such test is one, run the whole suite five more times on HEAD — not on the base, whose three runs already said 0 — and write each run's red tests and the suspects' durations. Nothing red in any of the five → record `{"key":"unattended:validate-flaky","default":"<test name>: red 1/3 then 0/5 on HEAD, 0/3 on base <short sha>","phase":"validate"}` per test and advance; `ship` lists them under "Not verified — needs a human". Anything red in the five, or a red test that is not a suspect → this diff made it, and the repair rounds below follow: every red test, suspects included, goes to the repair rounds and counts in their `<n>`. The five runs are only ever more runs: a test is never rerun alone in their place, retried, skipped or loosened. Short of the exception and of a flake that held, **repair rounds while they make progress, at most three per MR/PR**: each round is a heading under this MR/PR's plan (`05-implementation.md` / `04-fix.md`), `### Red suite at validate (unattended), round <k>: <n> red`. No such heading yet, or the last one's `<n>` above the count red now and `<k>` below 3 → write the next heading with one unticked step per failing test (its name and the first line of its failure), each ending *fix the code, or update an assertion whose expected value this MR/PR's design or fix changed — never delete, skip or loosen a test*; record `{"key":"unattended:validate-red-loop","default":"round <k>, <n> red: <test names>","phase":"validate"}`, leave `phase = build` (`fix`) and chain into `/flow-feat-build` (`/flow-bug-fix`) — whose steps then run through the phases that follow it as always, review and validate included. A review of that round treats a test the round deleted, skipped or loosened as a blocker. A round that did not lower the count, or a third round still red → blocked, naming the tests still red and the count each round left |
452
+ | `validate` with a red suite | **One exception, and it is measured, never judged**: every failing test also fails, under the same name, on the base (`git merge-base HEAD <git.default_base>`, run in a detached worktree), none of them lives in a file this diff touches, and none is the test that proves an acceptance criterion. **The base runs the way HEAD went red**: the same command (the whole suite when the whole suite went red, never the failing file alone), and a test that is red in the whole suite but green on its own is load- or order-dependent, so one run on each side proves nothing — run the whole suite three times on HEAD and three on the base, and write each side's red count and that test's duration in every run. **Before either record below, the cause is looked for** (§11, a red test outside the change): a test that would take the base exception or the flake record and whose cause §11 identifies is not excused — it goes to the repair rounds below, its step naming the cause, and counts in their `<n>`; only a test whose cause is not identified takes a record, and **a pass that sends any test to a repair round writes no record at all** — the others are measured again at the next validate, so the pass has one ending. Red on the base as often as on HEAD → the exception holds: record `{"key":"unattended:validate-red-base","default":"<n> red on HEAD and on base <short sha>: <test names>","phase":"validate"}` and advance; `ship` lists those tests under "Not verified — needs a human". Green on the base and red on HEAD, even once in three → this diff made it, whatever a single base run said (a suspect flake, below, gets five more runs first); its repair step says so, with both sides' counts and how much slower the failing runs were, and the fix is what this diff adds under concurrency (a lock, a pool, a timer, a background loop), never a longer timeout or a retry — unless §11 finds the fragility in the test itself (it counts ticks the diff's extra load now delays): then the test is the step, fixed as §11 says. **A suspect flake is measured again before it is blamed**: a test red in exactly one of HEAD's three runs (the run that first went red is not one of them), in none of the base's, in a file this diff does not touch, green when run on its own, and not the test that proves an acceptance criterion. When at least one test is red in HEAD's three runs and every such test is one, run the whole suite five more times on HEAD — not on the base, whose three runs already said 0 — and write each run's red tests and the suspects' durations. Nothing red in any of the five → record `{"key":"unattended:validate-flaky","default":"<test name>: red 1/3 then 0/5 on HEAD, 0/3 on base <short sha>","phase":"validate"}` per test and advance; `ship` lists them under "Not verified — needs a human". Anything red in the five, or a red test that is not a suspect → this diff made it, and the repair rounds below follow: every red test, suspects included, goes to the repair rounds and counts in their `<n>`. The five runs are only ever more runs: a test is never rerun alone in their place, retried, skipped or loosened. Short of the exception and of a flake that held, **repair rounds while they make progress, at most three per MR/PR**: each round is a heading under this MR/PR's plan (`05-implementation.md` / `04-fix.md`), `### Red suite at validate (unattended), round <k>: <n> red`. No such heading yet, or the last one's `<n>` above the count red now and `<k>` below 3 → write the next heading with one unticked step per failing test (its name and the first line of its failure), each ending *fix the code, or update an assertion whose expected value this MR/PR's design or fix changed, or — for a test §11 found fragile — make it assert on the result it meant to prove; never delete, skip, retry or loosen a test, and never lengthen a timeout*; record `{"key":"unattended:validate-red-loop","default":"round <k>, <n> red: <test names>","phase":"validate"}`, leave `phase = build` (`fix`) and chain into `/flow-feat-build` (`/flow-bug-fix`) — whose steps then run through the phases that follow it as always, review and validate included. A review of that round treats a test the round deleted, skipped or loosened as a blocker; a fragile test rewritten to assert on the same result, as §11 allows, is not loosened. A round that did not lower the count, or a third round still red → blocked, naming the tests still red, the count each round left and, for each, what a person does next |
453
453
  | A product decision (§7 `decision`) | question `decision` |
454
454
  | Clarifying questions on the ticket (`start`) | question `clarify` — after the branch and the work folder exist, with the questions also written to `01-context.md` |
455
455
  | An unanswered high-severity challenge (`design`, `investigate`) | question `design_challenge` / `investigation_challenge` |
@@ -1432,3 +1432,53 @@ before and after:
1432
1432
 
1433
1433
  Bugs do not link: a bug repairs something already delivered, and the roadmap tracks what is still to
1434
1434
  deliver. A bug that *is* a roadmap item is started as a feature.
1435
+
1436
+ ## 11. A red test outside the change — find the cause before it is excused
1437
+
1438
+ A test this diff did not touch goes red, and every path flow has for it — the base exception and the
1439
+ flake record of `validate` (§2.1), a rerun in `green`, "not reproduced" in `respond` — hands it to a
1440
+ person. When flow can see why the test is red, handing it over is the wrong answer: the MR/PR has to
1441
+ go green to merge, so the fix is in scope whether or not the diff touched that test.
1442
+
1443
+ **Look for the cause first.** Read the test and the code it drives, and name the mechanism. Typical
1444
+ causes in the test: it asserts on **how many times** something ran (timer ticks, calls, retries)
1445
+ inside a wall-clock window instead of on what came out — when the count *is* the behaviour (retries, calls made), the count stays and the clock is what gets fixed (a fake or injected time source); it depends on the order tests run in; it
1446
+ reads state another test left behind (a shared fixture, a global, a file, a port); it sleeps and
1447
+ hopes. Typical causes in the code: a race, an await missing, a resource not released.
1448
+
1449
+ **Identified means evidence, not a story.** A cause is identified only when the diagnosis names it at
1450
+ `file:line` **and** either (a) a forced reproduction turns the test red on purpose — stall the timer,
1451
+ reorder the run, leave the shared state dirty, load the machine — or (b) the mechanism is in the
1452
+ assertion itself, plain to read (it counts ticks in a time window, it expects an order nobody
1453
+ guarantees). A plausible guess with neither is **not identified**, and is never acted on.
1454
+
1455
+ **Identified → a repair step in this MR/PR**, aimed where the cause is:
1456
+
1457
+ - **In the test** → the test is rewritten to prove the **same behaviour by its result**, not by its
1458
+ timing or its order. That is not loosening it: the assertion keeps its subject and gets a sturdier
1459
+ witness. Never delete, skip, retry or loosen it, and never lengthen a timeout or a sleep — each one
1460
+ hides the cause instead of removing it. Where (a) applied, the forced reproduction passes after the
1461
+ fix.
1462
+ - **In the code** → the step fixes the code; the test stays as it is.
1463
+ - **Proved by the whole suite**, never by `quality.test_one` alone — an order- or load-dependent test already passes on its own — plus the forced reproduction where (a) applied.
1464
+ - A fragile test in a file this diff touches is repaired the same way: it never had the exception to lose.
1465
+ - **Its own commit** — `Fix fragile test <name>: <cause in one line>` — never folded into another
1466
+ step's or round's commit, so a reviewer reads it alone.
1467
+ - **The MR/PR body says so**, under `## Also fixed`: `` `<test>` — <cause>; <what changed> `` —
1468
+ written by `ship` for a repair made before it (`/flow-feat-ship`, `/flow-bug-ship`); a repair made
1469
+ by `green` or `respond` on an MR/PR already open adds the line itself: to `publish-body.md` in
1470
+ `unattended`, otherwise to the MR/PR description with the push, shown at the push gate.
1471
+
1472
+ **Not identified → the path that already exists** (the base exception, the flake record, a rerun,
1473
+ `blocked`), and whatever that path leaves red says, in the slot it already has — the stop's
1474
+ `I need:`, the `blocked` reason, the "what to do" of a line under `## Not verified — needs a human` —
1475
+ **what the person does next**, in one plain line: *rerun CI; if `<test>` fails again, its cause is
1476
+ not in this change — open a ticket for it*, never only that the test is red.
1477
+
1478
+ **A CI failure that does not reproduce here** (`green`, or a CI log a person pasted into a review
1479
+ thread for `respond`) is diagnosed the same way, from its log and the test's code: a fragility
1480
+ identified → fix it as above and push it, even though it would not go red locally. Neither
1481
+ reproduced nor identified → change nothing for it and say so. In `unattended` that run ends with
1482
+ its usual closing order when it changed code (`publish`: the push reruns CI anyway); when it changed
1483
+ nothing, it ends `blocked`, its one-line reason starting `rerun CI: <job>[, <job>…]` — not
1484
+ reproduced, no cause found — so the orchestrator knows a rerun is all that is left.
@@ -236,7 +236,7 @@ Cost line: count every subagent this command launched — reviewers = §2.1 buil
236
236
  - With blockers: `phase` stays where it was (`validate` for size ≥ S, `fix` on XS, where validate never ran). Iterate.
237
237
  - Without blockers: `phase = "review"`, add to `phases_done`. Suggest `/flow-bug-postmortem` (M/L) or `/flow-bug-ship` (XS/S).
238
238
  - **Record *what* you reviewed, and separately what you changed after reading it** — `/flow-feat-review` §9, unchanged: `reviewed_sha` = the **candidate** of §1.5 (the revision the reviewers read, never `git rev-parse HEAD`, which by now holds this round's own fixes), and `fixed_sha` = `git rev-parse HEAD` after those fixes, empty when the round applied none. `phases_done` says a review happened; these two say on which tree and what moved afterwards, and `/flow-bug-ship §0` reads both against what is being pushed. Only when the phase advances: a review that ended in blockers reviewed nothing that stands.
239
- - **Record which pass found what** — `/flow-feat-review §9`, unchanged: one `meta.json.review_findings[]` entry per finding **per source** (`{ round, origin, severity, file, discarded_by_skeptic }`, no finding text), written by `flow review --record` when the CLI ran the panel and by this Close when the agentic panel did. `flow cost` reads them back per origin, and the retirement rule is the same: a pass with no exclusive surviving finding across twenty reviews comes out of the command.
239
+ - **Record which pass found what** — `/flow-feat-review §9`, unchanged: one `meta.json.review_findings[]` entry per finding **per source** (`{ round, origin, severity, file, discarded_by_skeptic }`, no finding text), written by `flow review --record` when the CLI ran the panel and by this Close when the agentic panel did. `flow yield` reads them back across works and repos, and the retirement rule is the same: a pass with no unique accepted finding across twenty rounds at a size comes out of the command at that size.
240
240
  - **Record what the agents missed** — `/flow-feat-review §9`, unchanged: surviving findings in a category a panel member or named `agents.<role>` owns and did not report → `meta.json.agent_lessons[]` rows (flow-core §6.7), asking nothing. A fix is where this pays most: the defect already reached production once, and the reviewer that owns its category let it.
241
241
  - **Stage what the review taught** (`knowledge.stage` set; silence by default). Review is where a project teaches the most, and this is the only moment its findings are in context. Candidates are findings about the **domain or the codebase's real behaviour**, not about this diff: a library that does other than its name says, a test disguise that kept the suite green over a live defect, a module rule the reviewers had to cite from its own prose, a measurement. A blocker fixed here is not knowledge; *why it was written wrong* may be. Same evidence rule as `/flow-feat-design` §8 — one line of evidence per finding or it is not staged. One call per finding, one line to the user («Staged N finding(s) for `postmortem`/`ship`»). Never `knowledge.save` here.
242
242
  - Overwrite `00-summary.md` whole (≤15 lines, flow-core §5).
@@ -91,6 +91,9 @@ Template (in this order):
91
91
  <bullets from the "What is NOT touched" section of the Brief. Important so the reviewer knows the fix is minimal.>
92
92
  <then, if `meta.json.followups[]` has entries still `proposed` or `accepted`: one line each — the neighbouring bug, the similar-risk pattern, the prevention action — with its ticket id when one exists. Omit the block when there are none.>
93
93
 
94
+ ## Also fixed
95
+ <only when a test outside this fix went red and was repaired because its cause was identified (flow-core §11): one line each, `` `<test>` — <cause>; <what changed> ``. Omit the section otherwise.>
96
+
94
97
  ## Evidence
95
98
  <only if `.claude/work/<TICKET>/evidence/` has files and `quality.evidence` is not `off`. The **before** is what `03-investigation.md` captured when the failure was reproduced — the one moment it exists — and the **after** is §2.5 of `05-validation.md`. A bug fix is the change where a before/after pair carries the most: it *is* the argument. Same upload rules as `/flow-feat-ship`. Omit when there is nothing.>
96
99
 
@@ -97,7 +97,7 @@ this is the same gate as a red test.
97
97
 
98
98
  ## 5. Close
99
99
 
100
- - Red test, regressions, **or the original symptom still reproducible in §2.5** → `phase` stays at `fix`; the user iterates. A red gate stops in every mode except `unattended`, where flow-core §2.1 decides: every failing test also red on the base → its exception advances (the reproduction test lives in a file this diff touches, so it never qualifies); when every test red in HEAD's three runs is a suspect flake — red once in HEAD's three runs, never on the base, outside the files this diff touches, green on their own — those tests get that row's five more HEAD runs, their counts written in `05-validation.md`, and nothing red in them advances with `unattended:validate-flaky` (the reproduction test never qualifies here either); otherwise a repair round of that row — the failing tests become unticked steps of `04-fix.md`'s plan, `phase = fix`, chain into `/flow-bug-fix`, which chains back here; rounds go on while each lowers the red count, three at most, and one that does not, or a third still red → `blocked`, naming the tests still red. The original symptom still reproducible in §2.5 is not a failing test: `blocked`, naming it.
100
+ - Red test, regressions, **or the original symptom still reproducible in §2.5** → `phase` stays at `fix`; the user iterates. A red gate stops in every mode except `unattended`, where flow-core §2.1 decides — and before any test is excused there, its cause is looked for (flow-core §11): identified → a repair step, its own commit, never an exception or a flake record. Every failing test also red on the base → its exception advances (the reproduction test lives in a file this diff touches, so it never qualifies); when every test red in HEAD's three runs is a suspect flake — red once in HEAD's three runs, never on the base, outside the files this diff touches, green on their own — those tests get that row's five more HEAD runs, their counts written in `05-validation.md`, and nothing red in them advances with `unattended:validate-flaky` (the reproduction test never qualifies here either); otherwise a repair round of that row — the failing tests become unticked steps of `04-fix.md`'s plan, `phase = fix`, chain into `/flow-bug-fix`, which chains back here; rounds go on while each lowers the red count, three at most, and one that does not, or a third still red → `blocked`, naming the tests still red and, for each, what a person does next. The original symptom still reproducible in §2.5 is not a failing test: `blocked`, naming it.
101
101
  - Green → `phase = "validate"`, add to `phases_done`; in the same write record `validated_sha` = `git rev-parse HEAD` — the tree the regression test passed on, which `/flow-bug-ship §0` reads. Suggest `/flow-bug-review`.
102
102
  - **Other bugs detected become `followups[]` entries** (flow-core §7) when they clear its bar — a reproducible symptom with someone who suffers it, not «this looks fragile» — per the output template.
103
103
  - **Stage what the validation taught** (`knowledge.stage` set; silence by default): a mutation that stayed green, a disguise the scenario wore, a fixture that could not produce the case — findings about how this codebase is tested, not about this diff. Same rule and evidence line as the review's Close.
@@ -94,9 +94,12 @@ there → it is a question like any other.
94
94
  Chained from a review's `high_findings` *Fix them* → the findings are unticked steps at the end of
95
95
  this MR/PR's plan: build them in order, then chain into `/flow-feat-review`. Chained from a red
96
96
  suite at validate (flow-core §2.1) → the same, under the plan's latest `### Red suite at validate
97
- (unattended), round <k>` heading: one step per failing test, and a test reaches green by fixing the code or by an
98
- assertion this MR/PR's design changed — never by deleting, skipping or loosening it. Run each
99
- step's test with `quality.test_one` before ticking it.
97
+ (unattended), round <k>` heading: one step per failing test, and a test reaches green by fixing the code, by an
98
+ assertion this MR/PR's design changed, or — a step naming a fragile test's cause (flow-core §11) —
99
+ by making it assert on the result it meant to prove, in its own commit `Fix fragile test <name>:
100
+ <cause>`; never by deleting, skipping, retrying or loosening it, or by a longer timeout. Run each
101
+ step's test with `quality.test_one` before ticking it — and a §11 step with the whole suite plus its
102
+ forced reproduction, since an order- or load-dependent test already passes on its own.
100
103
 
101
104
  **The brief travels inside the question** (flow-core §3): the user reads it in the prompt they are answering, never by opening `05-implementation.md`. Write the file, run whatever you need, and *then* open the gate — **nothing runs between the brief and the question**, because a tool call after it is what lets a terminal fold the brief into one collapsed line, and the gate is answered blind. Options:
102
105
  - **Yes, proceed** → start building.
@@ -388,7 +388,7 @@ Write `.claude/work/<TICKET>/06-review.md`. The `Cost:` line of `## Summary` is
388
388
  - `reviewed_sha` = **the candidate of §1.5**, the revision the reviewers actually read. Not `git rev-parse HEAD`, which by then holds this round's own fixes — code no reviewer saw, recorded as reviewed, and `ship` finding it equal to `HEAD` every time.
389
389
  - `fixed_sha` = `git rev-parse HEAD` after this round's fixes, or **empty** when the round applied none. Two fields because they are two facts.
390
390
  - `phases_done` says a review *happened*; these say which tree, and `/flow-feat-ship §1` reads both before pushing. Written whenever the phase advances, never when it does not: a review that ended in blockers reviewed nothing that stands.
391
- - **Record which pass found what**, in the same write: `meta.json.review_findings[]`, one entry per finding **per source** — `{ round, origin, severity, file, discarded_by_skeptic }`, and no finding text, which stays in the artifact. `flow review --record` writes these itself when the CLI ran the panel; when the agentic panel ran, write them here from the origins §2.1 carried. `flow cost` reads them back per origin: how many findings each pass contributed, how many only it raised, and how many of those survived §6. That last number is the only evidence a pass is still earning its words.
391
+ - **Record which pass found what**, in the same write: `meta.json.review_findings[]`, one entry per finding **per source** — `{ round, origin, severity, file, discarded_by_skeptic }`, and no finding text, which stays in the artifact. `flow review --record` writes these itself when the CLI ran the panel; when the agentic panel ran, write them here from the origins §2.1 carried. `flow yield` reads them back across every work and repo, per origin and per size: rounds run, findings, how many only that pass raised, how many of those were acted on, and the agents it took (where the round recorded them). That unique-accepted number is the only evidence a pass is still earning its words, and `yield` marks a pass that ran twenty rounds at a size without one.
392
392
  - **Stage what the review taught** (`knowledge.stage` set; silence by default). Review is where a project teaches the most, and this is the only moment its findings are in context. Candidates are findings about the **domain or the codebase's real behaviour**, not about this diff: a library that does other than its name says, a test disguise that kept the suite green over a live defect, a module rule the reviewers had to cite from its own prose, a measurement. A blocker fixed here is not knowledge; *why it was written wrong* may be. Same evidence rule as `/flow-feat-design` §8 — one line of evidence per finding or it is not staged. One call per finding, one line to the user («Staged N finding(s) for `ship`»). Never `knowledge.save` here.
393
393
  - Overwrite `00-summary.md` whole (≤15 lines, flow-core §5).
394
394
  - **Record what the agents missed** (flow-core §6.7, `agents.learn` not `off`; asking nothing): for each finding that survived, the panel member or named `agents.<role>` whose category it falls in and who did not report it, and the delegated `build` agent whose code it sits in → one `meta.json.agent_lessons[]` row each, only when the lesson passes the §6.7 test. The origins §2.1 carried are what make this possible — a finding with no origin teaches nobody.
@@ -68,10 +68,14 @@ place it would ask:
68
68
 
69
69
  **In every mode**, criteria `07-validation.md` marks `not-verified-unattended` go into the body under
70
70
  `## Not verified — needs a human`, with what to do for each — and so do the tests the suite left red
71
- because they also fail on the base (`unattended:validate-red-base`): each name, and the base sha
72
- where it failed too — and the suspect flakes the run advanced past (`unattended:validate-flaky`), one line each:
73
- `` `<test>` — intermittent: red 1/3 then 0/5 on HEAD, 0/3 on base `<sha>`; not in a file this change touches `` — and the review findings an orchestrator's answer accepted unfixed
74
- (`06-review.md` "Answered (unattended)"), one line each. The §3 preview shows that section like
71
+ because they also fail on the base (`unattended:validate-red-base`): each name, the base sha
72
+ where it failed too, and what the person does next (flow-core §11) — and the suspect flakes the run advanced past (`unattended:validate-flaky`), one line each:
73
+ `` `<test>` — intermittent: red 1/3 then 0/5 on HEAD, 0/3 on base `<sha>`; not in a file this change touches; rerun CI, and if it fails again open a ticket for it `` — and the review findings an orchestrator's answer accepted unfixed
74
+ (`06-review.md` "Answered (unattended)"), one line each. A test outside the change that this
75
+ MR/PR repaired because its cause was identified (flow-core §11) — a repair step of a validate round,
76
+ or of `green`/`respond` — goes under `## Also fixed`, one line each:
77
+ `` `<test>` — <cause>; <what changed> ``, so the reviewer sees why a test this change did not need
78
+ was touched. The §3 preview shows that section like
75
79
  any other, and the person reading it is the check the run could not do. Entries of
76
80
  `auto-answers.md` for this MR/PR (`MR/PR <n>` in their heading, or all of them for a work with no
77
81
  `mrs`) — plus, while no `mrs[]` entry is `published` or `merged`, every entry whose heading names none: a study
@@ -233,13 +233,16 @@ Write `.claude/work/<TICKET>/07-validation.md`:
233
233
  failing tests on the base the way they went red on HEAD — the whole suite, three runs on each side
234
234
  for a test that is red in the suite and green on its own — and write each name, its result there,
235
235
  the run counts and the base sha under "Suite results" in `07-validation.md`. Calling a failure "pre-existing" without that run is not the
236
- exception — it is a red suite. Tests red once in HEAD's three runs, never on the base, outside the
236
+ exception — it is a red suite. **Before a test takes the exception or the flake record, its cause
237
+ is looked for** (flow-core §11, a red test outside the change): identified → it is not excused, it
238
+ becomes a step of the repair round below, named with its cause, fixed in its own commit and listed
239
+ under `## Also fixed` by `ship`. Tests red once in HEAD's three runs, never on the base, outside the
237
240
  files this diff touches, green on their own and proving no criterion are suspect flakes: when every test red in HEAD's three runs is one,
238
241
  five more whole-suite runs on HEAD decide — nothing red in them → `unattended:validate-flaky`, the
239
242
  counts under "Suite results", and the phase advances. Short of it, the red suite gets a repair round (the same row):
240
243
  the failing tests become unticked steps of this MR/PR's plan, `phase = build`, and the run
241
244
  chains into `/flow-feat-build`, then review and this phase again. Rounds go on while each lowers
242
245
  the red count, three at most; one that does not, or a third still red → `blocked`, naming the
243
- tests still red.
246
+ tests still red and, for each, what a person does next.
244
247
 
245
248
  In `guided`/`auto` this is, together with the brief in `/flow-feat-build §2`, **the only stop of the whole MR/PR** — everything between them ran without a person. It carries the **full stop header** and the body answers, in this order: what is green, what this MR/PR proves and what it does not, and what shipping it takes. Assume the user has read none of the build and review.
@@ -163,7 +163,7 @@ This system **orchestrates** the project's existing sub-agents and skills (it do
163
163
  ```
164
164
 
165
165
  - **`candidate_sha` / `reviewed_sha` / `fixed_sha` / `validated_sha`**: which code each verdict is about. `candidate_sha` is written by `review` in its **pre-flight** (§1.5) — the revision it froze before reading anything, `git rev-parse HEAD` over a clean tree and `git stash create` over a dirty one, anchored at `refs/flow/candidate/<TICKET>` so nothing collects it. The other three are written at `## Close`, **only when the phase actually advances**, work-level and in the current `mrs[]` entry: `reviewed_sha` is the candidate that was actually read, `fixed_sha` is `HEAD` after that round's own fixes (empty when it applied none), `validated_sha` is where the suite went green.
166
- - **`review_findings[]`**: one entry per finding **per source** — `{ round, origin, severity, file, discarded_by_skeptic }`, no finding text (that stays in `06-review.md`). Written at `review`'s Close, and by `flow review --record` when the CLI ran the panel. `origin` is `built-in`, a panel role, or the pass that raised it. It exists so a pass can be retired on evidence: `flow cost` reports per origin how many findings each contributed, how many **only** it raised, and how many of those survived §6 — and a finding three sources raised says nothing about any of them, which is why dedup keeps every source rather than the first. The rule was written down before the data arrived: no exclusive surviving finding across twenty reviews and the pass comes out of the command.
166
+ - **`review_findings[]`**: one entry per finding **per source** — `{ round, origin, severity, file, discarded_by_skeptic }`, no finding text (that stays in `06-review.md`). Written at `review`'s Close, and by `flow review --record` when the CLI ran the panel. `origin` is `built-in`, a panel role, or the pass that raised it. It exists so a pass can be retired on evidence: `flow yield [<repo-path>…]` reads every work those repos hold — live and `_archive/`, here and in the main checkout — and reports per origin and per size how many rounds each ran, how many findings it contributed, how many **only** it raised, and how many of those were acted on (for rows written before findings carried an outcome: not refuted by a skeptic) — and a finding three sources raised says nothing about any of them, which is why dedup keeps every source rather than the first. Old spellings of an origin (`builtin`, `cli:tests`, `§5.5`) are mapped on read and listed. The rule was written down before the data arrived: no unique accepted finding across twenty rounds at a size (XS and S pooled) and the pass comes out of the command at that size.
167
167
  Two fields for the review because they are two facts. `reviewed_sha` used to be `git rev-parse HEAD` at the end of the phase, which by then held the round's own fixes — so `ship` compared a sha against itself and reported a match over code no reviewer had read. Read by `ship` at pre-flight against `HEAD`: a delta of test files and this work's own folder passes with a note in `06-review.md`; anything else stops and asks in every autonomy mode. Empty is not a mismatch; `fixed_sha` set with `reviewed_sha == HEAD` is one. `review` also reads `reviewed_sha` back as **its own base** on a re-review, so the second round reads the delta instead of the whole branch.
168
168
  - **`respond_rounds`**: rounds of `/flow-work-respond` on an MR/PR. `/flow-work-respond §1` reads it against `quality.respond_max_rounds` (empty = 3) and refuses the round that would exceed it, handing the open threads back to the user.
169
169
  - **`roadmap`**: the roadmap item this work delivers (flow-core §10). Linked at `/flow-feat-start §3.7`, marked in progress / done by `/flow-feat-ship` inside the MR/PR, shown by `next`/`daily`/`resume` — which also flag an item the code delivered but the file still does not mark. `null` with no roadmap, no link, or a bug.
@@ -43,7 +43,7 @@ Read `~/.claude/flow/CORE.hermes.md` first (shared rules: `FLOW.md` step 0, mode
43
43
  2. Creating/switching a branch, or DB schema changes/migrations, if a fix requires them.
44
44
  3. **Re-triggering a pipeline or job on the remote** (CI resources; outward action).
45
45
  4. **Integrating the base branch** — any `git merge`/`git rebase` of `git.default_base` into the branch, and any history rewrite or force-push it implies (§5.C).
46
- 5. **Green-washing — NEVER, in any mode:** no rerun of a failed check hoping it passes; never disable, skip, `@skip`/`xit`, loosen a threshold, or delete a test/lint rule to force green; never resolve a conflict by blindly taking one side (`--ours`/`--theirs`, `checkout --theirs`, discarding the base's changes) — resolve by understanding both sides.
46
+ 5. **Green-washing — NEVER, in any mode:** no rerun of a failed check hoping it passes; never disable, skip, `@skip`/`xit`, loosen a threshold, or delete a test/lint rule to force green; never resolve a conflict by blindly taking one side (`--ours`/`--theirs`, `checkout --theirs`, discarding the base's changes) — resolve by understanding both sides. A fragile test rewritten to assert on the same result, as flow-core §11 allows, is not loosening it.
47
47
 
48
48
  **In `unattended`** (flow-core §2.1) — launched by `/flow-work-run` on `why = pipeline` or
49
49
  `why = conflict` — this command never touches the forge. Gate 5 holds exactly as written; the
@@ -57,8 +57,10 @@ others resolve this way:
57
57
  conflicts with `base`, which the orchestrator left in the checkout as `origin/<base>` at
58
58
  `base_sha`. That is the only blocker of the round — category C, nothing to triage. `origin/<base>`
59
59
  missing or not at `base_sha` → `blocked`: the run would merge a base nobody named.
60
- - **§3** — triage as written, recorded in `09-ci.md`. **K** (flaky / infra) → `blocked` with the
61
- evidence: the run has no rerun order, and the orchestrator owns reruns and the red-round limit.
60
+ - **§3** — triage as written, recorded in `09-ci.md`. **K** (flaky / infra) → when the round
61
+ changed no code, `blocked` with the evidence and a one-line reason starting `rerun CI: <job>[,
62
+ <job>…]` (flow-core §11): the run has no rerun order, and the orchestrator owns reruns and the
63
+ red-round limit; when the round changed code, its `publish` reruns CI anyway.
62
64
  **C** (conflict, behind base) on `why = pipeline`, and anything needing a rebase or force-push →
63
65
  `blocked`: the orchestrator brings the base in, and relaunches with `why = conflict` when it
64
66
  conflicts. A **human** blocker → `blocked`, naming who. **S** → fixed within
@@ -138,12 +140,14 @@ Categories:
138
140
  | **L — lint / style / format** | formatter or linter job red | mechanical auto-fix with `quality.style_fix` (or the repo's formatter) |
139
141
  | **T — test failure** | a unit/integration/functional/frontend test failed | **root-cause fix**: real regression → fix the code; behavior changed *on purpose* → update the test to the new contract (justified from the design) |
140
142
  | **Y — type / build / compile** | type-check (`static_analysis`) or build broke | fix the code/types |
141
- | **K — flaky / infra** | non-deterministic or CI-environment failure **not** caused by this diff (timeout, network, cache, runner) | do **not** green-wash; identify the evidence, propose a **confirmed** rerun (hard gate), and flag the flake |
143
+ | **K — flaky / infra** | non-deterministic or CI-environment failure **not** caused by this diff (timeout, network, cache, runner) **whose cause in the test or the code was looked for and not identified** (flow-core §11) | do **not** green-wash; identify the evidence, propose a **confirmed** rerun (hard gate), and flag the flake |
142
144
  | **S — quality gate / scope** | coverage threshold, security scan, a lint rule newly hitting legacy code | judgment call: fix within scope, or defer/config with justification — never touch unrelated code just to appease a gate without confirming |
143
145
  | **C — conflict / branch behind base** | the branch conflicts with `git.default_base`, or the host requires it updated before merging | integrate the base into the branch and **resolve each conflict on its merits** (§5.C) — hard gate before touching git history |
144
146
  | **H — human blocker** | draft/WIP, approvals missing, unresolved review threads, a required reviewer or check that only a person can clear | **not this command's job**: name it, say exactly what is needed and from whom, and route it (threads → `/flow-work-respond`; draft → offer to mark ready; approvals → the reviewers). Never work around it |
145
147
 
146
- **Root cause, not symptom.** Find *why* the check is red before changing anything. Never weaken what a test checks, never silence a type error with a blanket cast/ignore, never mark a real failure as flaky. A "fix" that hides the failure is not a fix — surface it.
148
+ **A test this diff did not touch is still this command's.** A red test that looks flaky is diagnosed before it is called K (flow-core §11): read its log tail and its code; a fragility identified there — it counts timer ticks, depends on order, reads another test's leftovers — or a cause in the code is **T**, fixed in this round even when it does not go red locally, in its own commit `Fix fragile test <name>: <cause>`, and the line for `## Also fixed` goes to the MR/PR description with the push (`publish-body.md` in `unattended`). Only a cause not identified stays K.
149
+
150
+ **Root cause, not symptom.** Find *why* the check is red before changing anything. Never weaken what a test checks (a flow-core §11 rewrite onto the same result is not weakening), never silence a type error with a blanket cast/ignore, never mark a real failure as flaky. A "fix" that hides the failure is not a fix — surface it.
147
151
 
148
152
  Present a **triage table**: `blocker → kind → category → probable cause (log or merge verdict) → proposed action`, **C** and **H** rows first (a conflict makes the pipeline result provisional — CI reruns on a different tree after integrating the base). In `manual`, let the user re-categorize any row (especially T-vs-K) before proceeding.
149
153
 
@@ -166,9 +170,9 @@ Only **base-integration**, **auto-fix** and **code-fix**:
166
170
 
167
171
  - **Design-invalidation first.** A test failure that shows the *design* was wrong → do not patch the test into agreement; update `03-design.md` **before** editing; if large, route back through `/flow-feat-build` / `/flow-bug-fix`.
168
172
  - **Delegate the edits** to the expert sub-agents (FLOW.md `agents`); the conductor stays on judgment. Repo conventions plus the **comment discipline** of `/flow-feat-build` — comments only for a non-obvious *why*, never a ticket ID or "for MR #N".
169
- - **Reproduce and verify locally — the tight loop.** Before pushing, re-run the failing check locally: L/style → `quality.style_fix`; T → `quality.test` (or `quality.test_one` scoped to the failing test); Y → `quality.static_analysis`. Empty command → auto-discover. Not reproducible locally (environment-only job) → say so, push and let CI re-verify (§6), stating that verification is remote.
173
+ - **Reproduce and verify locally — the tight loop.** Before pushing, re-run the failing check locally: L/style → `quality.style_fix`; T → `quality.test` (or `quality.test_one` scoped to the failing test); Y → `quality.static_analysis`. Empty command → auto-discover. Not reproducible locally (environment-only job) → say so, push and let CI re-verify (§6), stating that verification is remote. A fragile test fixed by flow-core §11 is checked with its forced reproduction when there is one, then pushed the same way.
170
174
  - **Re-run the review gate for non-trivial code-fixes.** More than a mechanical tweak → `quality.review_skill` (or built-in `code-review` if empty) on this round's diff before pushing. Pass the diagnosis as context, never as a scope exclusion (*"the cause was X"*, not *"skip X"*). High-severity findings block the push until addressed.
171
- - **Commits follow `autonomy.mode`.** After editing, **always** report a summary (files, lines, which job each edit turns green). `manual` → the user decides to commit or inspect first; do **not** `git commit` on your own. `guided`/`auto` → commit the round yourself, go straight to the §6 push gate (do not ask twice for one round). The push is a hard gate in **every** mode.
175
+ - **Commits follow `autonomy.mode`.** After editing, **always** report a summary (files, lines, which job each edit turns green). `manual` → the user decides to commit or inspect first; do **not** `git commit` on your own. `guided`/`auto` → commit the round yourself, go straight to the §6 push gate (do not ask twice for one round). A fragile-test repair (flow-core §11) is split into its own commit in every mode, and the round's summary names it as *also fixes fragile test `<name>`: <cause>*. The push is a hard gate in **every** mode.
172
176
 
173
177
  ### 5.C Integrate the base and resolve conflicts (category C)
174
178
 
@@ -101,7 +101,10 @@ back through it, and the hard gates above resolve this way:
101
101
  - **The one closing order**, after the WIP commit (flow-core §2.1): code changed this round →
102
102
  `publish` with the work's `publish-title.md` / `publish-body.md` (updated when the round changed
103
103
  what they say, and naming any thread whose reply failed) and no `--part/--of` — the MR/PR is
104
- already open (flow-core §2.1) — so the commits the replies name reach the branch; no code changed and every reply went
104
+ already open (flow-core §2.1) — so the commits the replies name reach the branch (and the push reruns CI, so a
105
+ failure nobody could explain needs nothing more); no code changed, every reply went out and a
106
+ thread carried a CI failure neither reproduced nor explained (§3) → `blocked`, its one-line reason
107
+ starting `rerun CI: <job>[, <job>…]` (flow-core §11); no code changed and every reply went
105
108
  out → `done`, the summary listing the threads answered; no code changed and a reply failed →
106
109
  `blocked`, naming those threads.
107
110
 
@@ -150,6 +153,8 @@ Categories:
150
153
  | **F — obsolete/done** | Already addressed, or no longer applies | reply pointing to where |
151
154
  | **G — data / performance objection** | The reviewer says a query is slow, unbounded, unindexed, or proposes a different query | **measure first** (§4.G), then reply with the plan |
152
155
 
156
+ **A thread that carries a CI failure** — a person pasted a failing job's log or a red test's output — is a **C** about that test, not an **A** to answer: reproduce it with `quality.test_one`; red → fix it on its merits, through flow-core §11 when the test is outside this diff. Not red here → diagnose it from the pasted log and the test's code (flow-core §11): a fragility identified (it counts timer ticks, depends on order, reads another test's leftovers) or a cause in the code → fix it in its own commit `Fix fragile test <name>: <cause>`, and the reply names that commit and the cause, and the line for `## Also fixed` goes to the MR/PR description with the push (`publish-body.md` in `unattended`). Neither → change nothing for it; the reply says it did not reproduce, that no cause was found in the test or the code, and what the person does next (*rerun CI; if it fails again, …*) — never a bare "not reproduced".
157
+
153
158
  Present a **triage table** to the user: `thread → location → category → proposed action → one-line rationale` — the map for the rest of the command. In `manual` mode, let the user re-categorize any row before proceeding.
154
159
 
155
160
  ## 4. Agree the response per thread (the debate)
@@ -16,7 +16,7 @@ Every `/flow-*` command assumes these rules. They are stated once, here, so a co
16
16
  carries what is specific to its phase. Read this once per session; a command that says "load
17
17
  `flow-core`" means this file.
18
18
 
19
- **This file belongs to flow `0.106.0`.** Compare it once, at the start of the session, against
19
+ **This file belongs to flow `0.108.0`.** Compare it once, at the start of the session, against
20
20
  `version` in `~/.claude/flow/.claude-plugin/plugin.json`. The two differing means the session
21
21
  is running a **mixture** — the commands from one copy of the plugin, these shared rules from another
22
22
  — which is exactly what happens when a branch or a release candidate is loaded over an installed
@@ -448,7 +448,7 @@ person asking for changes, a ticket that already has code — is `/flow-work-run
448
448
  | Writing a DB schema change, index or migration — in any phase, a review's own fixes included — or applying one (`validate`) | question `migration`, before the first line of it is written or run — except in `respond` and `green`, where it is blocked: a schema change agreed after the MR/PR exists goes back through `build`. Writing one whose every object `approved-schema.md` lists is not asked (§2, a schema approved with the study) |
449
449
  | `review` with blockers or high-severity findings | question `high_findings` |
450
450
  | `validate` with a criterion `unproven` | blocked — the phase does not advance and does not chain |
451
- | `validate` with a red suite | **One exception, and it is measured, never judged**: every failing test also fails, under the same name, on the base (`git merge-base HEAD <git.default_base>`, run in a detached worktree), none of them lives in a file this diff touches, and none is the test that proves an acceptance criterion. **The base runs the way HEAD went red**: the same command (the whole suite when the whole suite went red, never the failing file alone), and a test that is red in the whole suite but green on its own is load- or order-dependent, so one run on each side proves nothing — run the whole suite three times on HEAD and three on the base, and write each side's red count and that test's duration in every run. Red on the base as often as on HEAD → the exception holds: record `{"key":"unattended:validate-red-base","default":"<n> red on HEAD and on base <short sha>: <test names>","phase":"validate"}` and advance; `ship` lists those tests under "Not verified — needs a human". Green on the base and red on HEAD, even once in three → this diff made it, whatever a single base run said (a suspect flake, below, gets five more runs first); its repair step says so, with both sides' counts and how much slower the failing runs were, and the fix is what this diff adds under concurrency (a lock, a pool, a timer, a background loop), never a longer timeout or a retry. **A suspect flake is measured again before it is blamed**: a test red in exactly one of HEAD's three runs (the run that first went red is not one of them), in none of the base's, in a file this diff does not touch, green when run on its own, and not the test that proves an acceptance criterion. When at least one test is red in HEAD's three runs and every such test is one, run the whole suite five more times on HEAD — not on the base, whose three runs already said 0 — and write each run's red tests and the suspects' durations. Nothing red in any of the five → record `{"key":"unattended:validate-flaky","default":"<test name>: red 1/3 then 0/5 on HEAD, 0/3 on base <short sha>","phase":"validate"}` per test and advance; `ship` lists them under "Not verified — needs a human". Anything red in the five, or a red test that is not a suspect → this diff made it, and the repair rounds below follow: every red test, suspects included, goes to the repair rounds and counts in their `<n>`. The five runs are only ever more runs: a test is never rerun alone in their place, retried, skipped or loosened. Short of the exception and of a flake that held, **repair rounds while they make progress, at most three per MR/PR**: each round is a heading under this MR/PR's plan (`05-implementation.md` / `04-fix.md`), `### Red suite at validate (unattended), round <k>: <n> red`. No such heading yet, or the last one's `<n>` above the count red now and `<k>` below 3 → write the next heading with one unticked step per failing test (its name and the first line of its failure), each ending *fix the code, or update an assertion whose expected value this MR/PR's design or fix changed — never delete, skip or loosen a test*; record `{"key":"unattended:validate-red-loop","default":"round <k>, <n> red: <test names>","phase":"validate"}`, leave `phase = build` (`fix`) and chain into `/flow-feat-build` (`/flow-bug-fix`) — whose steps then run through the phases that follow it as always, review and validate included. A review of that round treats a test the round deleted, skipped or loosened as a blocker. A round that did not lower the count, or a third round still red → blocked, naming the tests still red and the count each round left |
451
+ | `validate` with a red suite | **One exception, and it is measured, never judged**: every failing test also fails, under the same name, on the base (`git merge-base HEAD <git.default_base>`, run in a detached worktree), none of them lives in a file this diff touches, and none is the test that proves an acceptance criterion. **The base runs the way HEAD went red**: the same command (the whole suite when the whole suite went red, never the failing file alone), and a test that is red in the whole suite but green on its own is load- or order-dependent, so one run on each side proves nothing — run the whole suite three times on HEAD and three on the base, and write each side's red count and that test's duration in every run. **Before either record below, the cause is looked for** (§11, a red test outside the change): a test that would take the base exception or the flake record and whose cause §11 identifies is not excused — it goes to the repair rounds below, its step naming the cause, and counts in their `<n>`; only a test whose cause is not identified takes a record, and **a pass that sends any test to a repair round writes no record at all** — the others are measured again at the next validate, so the pass has one ending. Red on the base as often as on HEAD → the exception holds: record `{"key":"unattended:validate-red-base","default":"<n> red on HEAD and on base <short sha>: <test names>","phase":"validate"}` and advance; `ship` lists those tests under "Not verified — needs a human". Green on the base and red on HEAD, even once in three → this diff made it, whatever a single base run said (a suspect flake, below, gets five more runs first); its repair step says so, with both sides' counts and how much slower the failing runs were, and the fix is what this diff adds under concurrency (a lock, a pool, a timer, a background loop), never a longer timeout or a retry — unless §11 finds the fragility in the test itself (it counts ticks the diff's extra load now delays): then the test is the step, fixed as §11 says. **A suspect flake is measured again before it is blamed**: a test red in exactly one of HEAD's three runs (the run that first went red is not one of them), in none of the base's, in a file this diff does not touch, green when run on its own, and not the test that proves an acceptance criterion. When at least one test is red in HEAD's three runs and every such test is one, run the whole suite five more times on HEAD — not on the base, whose three runs already said 0 — and write each run's red tests and the suspects' durations. Nothing red in any of the five → record `{"key":"unattended:validate-flaky","default":"<test name>: red 1/3 then 0/5 on HEAD, 0/3 on base <short sha>","phase":"validate"}` per test and advance; `ship` lists them under "Not verified — needs a human". Anything red in the five, or a red test that is not a suspect → this diff made it, and the repair rounds below follow: every red test, suspects included, goes to the repair rounds and counts in their `<n>`. The five runs are only ever more runs: a test is never rerun alone in their place, retried, skipped or loosened. Short of the exception and of a flake that held, **repair rounds while they make progress, at most three per MR/PR**: each round is a heading under this MR/PR's plan (`05-implementation.md` / `04-fix.md`), `### Red suite at validate (unattended), round <k>: <n> red`. No such heading yet, or the last one's `<n>` above the count red now and `<k>` below 3 → write the next heading with one unticked step per failing test (its name and the first line of its failure), each ending *fix the code, or update an assertion whose expected value this MR/PR's design or fix changed, or — for a test §11 found fragile — make it assert on the result it meant to prove; never delete, skip, retry or loosen a test, and never lengthen a timeout*; record `{"key":"unattended:validate-red-loop","default":"round <k>, <n> red: <test names>","phase":"validate"}`, leave `phase = build` (`fix`) and chain into `/flow-feat-build` (`/flow-bug-fix`) — whose steps then run through the phases that follow it as always, review and validate included. A review of that round treats a test the round deleted, skipped or loosened as a blocker; a fragile test rewritten to assert on the same result, as §11 allows, is not loosened. A round that did not lower the count, or a third round still red → blocked, naming the tests still red, the count each round left and, for each, what a person does next |
452
452
  | A product decision (§7 `decision`) | question `decision` |
453
453
  | Clarifying questions on the ticket (`start`) | question `clarify` — after the branch and the work folder exist, with the questions also written to `01-context.md` |
454
454
  | An unanswered high-severity challenge (`design`, `investigate`) | question `design_challenge` / `investigation_challenge` |
@@ -1431,3 +1431,53 @@ before and after:
1431
1431
 
1432
1432
  Bugs do not link: a bug repairs something already delivered, and the roadmap tracks what is still to
1433
1433
  deliver. A bug that *is* a roadmap item is started as a feature.
1434
+
1435
+ ## 11. A red test outside the change — find the cause before it is excused
1436
+
1437
+ A test this diff did not touch goes red, and every path flow has for it — the base exception and the
1438
+ flake record of `validate` (§2.1), a rerun in `green`, "not reproduced" in `respond` — hands it to a
1439
+ person. When flow can see why the test is red, handing it over is the wrong answer: the MR/PR has to
1440
+ go green to merge, so the fix is in scope whether or not the diff touched that test.
1441
+
1442
+ **Look for the cause first.** Read the test and the code it drives, and name the mechanism. Typical
1443
+ causes in the test: it asserts on **how many times** something ran (timer ticks, calls, retries)
1444
+ inside a wall-clock window instead of on what came out — when the count *is* the behaviour (retries, calls made), the count stays and the clock is what gets fixed (a fake or injected time source); it depends on the order tests run in; it
1445
+ reads state another test left behind (a shared fixture, a global, a file, a port); it sleeps and
1446
+ hopes. Typical causes in the code: a race, an await missing, a resource not released.
1447
+
1448
+ **Identified means evidence, not a story.** A cause is identified only when the diagnosis names it at
1449
+ `file:line` **and** either (a) a forced reproduction turns the test red on purpose — stall the timer,
1450
+ reorder the run, leave the shared state dirty, load the machine — or (b) the mechanism is in the
1451
+ assertion itself, plain to read (it counts ticks in a time window, it expects an order nobody
1452
+ guarantees). A plausible guess with neither is **not identified**, and is never acted on.
1453
+
1454
+ **Identified → a repair step in this MR/PR**, aimed where the cause is:
1455
+
1456
+ - **In the test** → the test is rewritten to prove the **same behaviour by its result**, not by its
1457
+ timing or its order. That is not loosening it: the assertion keeps its subject and gets a sturdier
1458
+ witness. Never delete, skip, retry or loosen it, and never lengthen a timeout or a sleep — each one
1459
+ hides the cause instead of removing it. Where (a) applied, the forced reproduction passes after the
1460
+ fix.
1461
+ - **In the code** → the step fixes the code; the test stays as it is.
1462
+ - **Proved by the whole suite**, never by `quality.test_one` alone — an order- or load-dependent test already passes on its own — plus the forced reproduction where (a) applied.
1463
+ - A fragile test in a file this diff touches is repaired the same way: it never had the exception to lose.
1464
+ - **Its own commit** — `Fix fragile test <name>: <cause in one line>` — never folded into another
1465
+ step's or round's commit, so a reviewer reads it alone.
1466
+ - **The MR/PR body says so**, under `## Also fixed`: `` `<test>` — <cause>; <what changed> `` —
1467
+ written by `ship` for a repair made before it (`/flow-feat-ship`, `/flow-bug-ship`); a repair made
1468
+ by `green` or `respond` on an MR/PR already open adds the line itself: to `publish-body.md` in
1469
+ `unattended`, otherwise to the MR/PR description with the push, shown at the push gate.
1470
+
1471
+ **Not identified → the path that already exists** (the base exception, the flake record, a rerun,
1472
+ `blocked`), and whatever that path leaves red says, in the slot it already has — the stop's
1473
+ `I need:`, the `blocked` reason, the "what to do" of a line under `## Not verified — needs a human` —
1474
+ **what the person does next**, in one plain line: *rerun CI; if `<test>` fails again, its cause is
1475
+ not in this change — open a ticket for it*, never only that the test is red.
1476
+
1477
+ **A CI failure that does not reproduce here** (`green`, or a CI log a person pasted into a review
1478
+ thread for `respond`) is diagnosed the same way, from its log and the test's code: a fragility
1479
+ identified → fix it as above and push it, even though it would not go red locally. Neither
1480
+ reproduced nor identified → change nothing for it and say so. In `unattended` that run ends with
1481
+ its usual closing order when it changed code (`publish`: the push reruns CI anyway); when it changed
1482
+ nothing, it ends `blocked`, its one-line reason starting `rerun CI: <job>[, <job>…]` — not
1483
+ reproduced, no cause found — so the orchestrator knows a rerun is all that is left.
@@ -234,7 +234,7 @@ Cost line: count every subagent this command launched — reviewers = §2.1 buil
234
234
  - With blockers: `phase` stays where it was (`validate` for size ≥ S, `fix` on XS, where validate never ran). Iterate.
235
235
  - Without blockers: `phase = "review"`, add to `phases_done`. Suggest `/flow-bug-postmortem` (M/L) or `/flow-bug-ship` (XS/S).
236
236
  - **Record *what* you reviewed, and separately what you changed after reading it** — `/flow-feat-review` §9, unchanged: `reviewed_sha` = the **candidate** of §1.5 (the revision the reviewers read, never `git rev-parse HEAD`, which by now holds this round's own fixes), and `fixed_sha` = `git rev-parse HEAD` after those fixes, empty when the round applied none. `phases_done` says a review happened; these two say on which tree and what moved afterwards, and `/flow-bug-ship §0` reads both against what is being pushed. Only when the phase advances: a review that ended in blockers reviewed nothing that stands.
237
- - **Record which pass found what** — `/flow-feat-review §9`, unchanged: one `meta.json.review_findings[]` entry per finding **per source** (`{ round, origin, severity, file, discarded_by_skeptic }`, no finding text), written by `flow review --record` when the CLI ran the panel and by this Close when the agentic panel did. `flow cost` reads them back per origin, and the retirement rule is the same: a pass with no exclusive surviving finding across twenty reviews comes out of the command.
237
+ - **Record which pass found what** — `/flow-feat-review §9`, unchanged: one `meta.json.review_findings[]` entry per finding **per source** (`{ round, origin, severity, file, discarded_by_skeptic }`, no finding text), written by `flow review --record` when the CLI ran the panel and by this Close when the agentic panel did. `flow yield` reads them back across works and repos, and the retirement rule is the same: a pass with no unique accepted finding across twenty rounds at a size comes out of the command at that size.
238
238
  - **Record what the agents missed** — `/flow-feat-review §9`, unchanged: surviving findings in a category a panel member or named `agents.<role>` owns and did not report → `meta.json.agent_lessons[]` rows (flow-core §6.7), asking nothing. A fix is where this pays most: the defect already reached production once, and the reviewer that owns its category let it.
239
239
  - **Stage what the review taught** (`knowledge.stage` set; silence by default). Review is where a project teaches the most, and this is the only moment its findings are in context. Candidates are findings about the **domain or the codebase's real behaviour**, not about this diff: a library that does other than its name says, a test disguise that kept the suite green over a live defect, a module rule the reviewers had to cite from its own prose, a measurement. A blocker fixed here is not knowledge; *why it was written wrong* may be. Same evidence rule as `/flow-feat-design` §8 — one line of evidence per finding or it is not staged. One call per finding, one line to the user («Staged N finding(s) for `postmortem`/`ship`»). Never `knowledge.save` here.
240
240
  - Overwrite `00-summary.md` whole (≤15 lines, flow-core §5).
@@ -89,6 +89,9 @@ Template (in this order):
89
89
  <bullets from the "What is NOT touched" section of the Brief. Important so the reviewer knows the fix is minimal.>
90
90
  <then, if `meta.json.followups[]` has entries still `proposed` or `accepted`: one line each — the neighbouring bug, the similar-risk pattern, the prevention action — with its ticket id when one exists. Omit the block when there are none.>
91
91
 
92
+ ## Also fixed
93
+ <only when a test outside this fix went red and was repaired because its cause was identified (flow-core §11): one line each, `` `<test>` — <cause>; <what changed> ``. Omit the section otherwise.>
94
+
92
95
  ## Evidence
93
96
  <only if `.claude/work/<TICKET>/evidence/` has files and `quality.evidence` is not `off`. The **before** is what `03-investigation.md` captured when the failure was reproduced — the one moment it exists — and the **after** is §2.5 of `05-validation.md`. A bug fix is the change where a before/after pair carries the most: it *is* the argument. Same upload rules as `/flow-feat-ship`. Omit when there is nothing.>
94
97
 
@@ -95,7 +95,7 @@ this is the same gate as a red test.
95
95
 
96
96
  ## 5. Close
97
97
 
98
- - Red test, regressions, **or the original symptom still reproducible in §2.5** → `phase` stays at `fix`; the user iterates. A red gate stops in every mode except `unattended`, where flow-core §2.1 decides: every failing test also red on the base → its exception advances (the reproduction test lives in a file this diff touches, so it never qualifies); when every test red in HEAD's three runs is a suspect flake — red once in HEAD's three runs, never on the base, outside the files this diff touches, green on their own — those tests get that row's five more HEAD runs, their counts written in `05-validation.md`, and nothing red in them advances with `unattended:validate-flaky` (the reproduction test never qualifies here either); otherwise a repair round of that row — the failing tests become unticked steps of `04-fix.md`'s plan, `phase = fix`, chain into `/flow-bug-fix`, which chains back here; rounds go on while each lowers the red count, three at most, and one that does not, or a third still red → `blocked`, naming the tests still red. The original symptom still reproducible in §2.5 is not a failing test: `blocked`, naming it.
98
+ - Red test, regressions, **or the original symptom still reproducible in §2.5** → `phase` stays at `fix`; the user iterates. A red gate stops in every mode except `unattended`, where flow-core §2.1 decides — and before any test is excused there, its cause is looked for (flow-core §11): identified → a repair step, its own commit, never an exception or a flake record. Every failing test also red on the base → its exception advances (the reproduction test lives in a file this diff touches, so it never qualifies); when every test red in HEAD's three runs is a suspect flake — red once in HEAD's three runs, never on the base, outside the files this diff touches, green on their own — those tests get that row's five more HEAD runs, their counts written in `05-validation.md`, and nothing red in them advances with `unattended:validate-flaky` (the reproduction test never qualifies here either); otherwise a repair round of that row — the failing tests become unticked steps of `04-fix.md`'s plan, `phase = fix`, chain into `/flow-bug-fix`, which chains back here; rounds go on while each lowers the red count, three at most, and one that does not, or a third still red → `blocked`, naming the tests still red and, for each, what a person does next. The original symptom still reproducible in §2.5 is not a failing test: `blocked`, naming it.
99
99
  - Green → `phase = "validate"`, add to `phases_done`; in the same write record `validated_sha` = `git rev-parse HEAD` — the tree the regression test passed on, which `/flow-bug-ship §0` reads. Suggest `/flow-bug-review`.
100
100
  - **Other bugs detected become `followups[]` entries** (flow-core §7) when they clear its bar — a reproducible symptom with someone who suffers it, not «this looks fragile» — per the output template.
101
101
  - **Stage what the validation taught** (`knowledge.stage` set; silence by default): a mutation that stayed green, a disguise the scenario wore, a fixture that could not produce the case — findings about how this codebase is tested, not about this diff. Same rule and evidence line as the review's Close.
@@ -92,9 +92,12 @@ there → it is a question like any other.
92
92
  Chained from a review's `high_findings` *Fix them* → the findings are unticked steps at the end of
93
93
  this MR/PR's plan: build them in order, then chain into `/flow-feat-review`. Chained from a red
94
94
  suite at validate (flow-core §2.1) → the same, under the plan's latest `### Red suite at validate
95
- (unattended), round <k>` heading: one step per failing test, and a test reaches green by fixing the code or by an
96
- assertion this MR/PR's design changed — never by deleting, skipping or loosening it. Run each
97
- step's test with `quality.test_one` before ticking it.
95
+ (unattended), round <k>` heading: one step per failing test, and a test reaches green by fixing the code, by an
96
+ assertion this MR/PR's design changed, or — a step naming a fragile test's cause (flow-core §11) —
97
+ by making it assert on the result it meant to prove, in its own commit `Fix fragile test <name>:
98
+ <cause>`; never by deleting, skipping, retrying or loosening it, or by a longer timeout. Run each
99
+ step's test with `quality.test_one` before ticking it — and a §11 step with the whole suite plus its
100
+ forced reproduction, since an order- or load-dependent test already passes on its own.
98
101
 
99
102
  **The brief travels inside the question** (flow-core §3): the user reads it in the prompt they are answering, never by opening `05-implementation.md`. Write the file, run whatever you need, and *then* open the gate — **nothing runs between the brief and the question**, because a tool call after it is what lets a terminal fold the brief into one collapsed line, and the gate is answered blind. Options:
100
103
  - **Yes, proceed** → start building.
@@ -386,7 +386,7 @@ Write `.claude/work/<TICKET>/06-review.md`. The `Cost:` line of `## Summary` is
386
386
  - `reviewed_sha` = **the candidate of §1.5**, the revision the reviewers actually read. Not `git rev-parse HEAD`, which by then holds this round's own fixes — code no reviewer saw, recorded as reviewed, and `ship` finding it equal to `HEAD` every time.
387
387
  - `fixed_sha` = `git rev-parse HEAD` after this round's fixes, or **empty** when the round applied none. Two fields because they are two facts.
388
388
  - `phases_done` says a review *happened*; these say which tree, and `/flow-feat-ship §1` reads both before pushing. Written whenever the phase advances, never when it does not: a review that ended in blockers reviewed nothing that stands.
389
- - **Record which pass found what**, in the same write: `meta.json.review_findings[]`, one entry per finding **per source** — `{ round, origin, severity, file, discarded_by_skeptic }`, and no finding text, which stays in the artifact. `flow review --record` writes these itself when the CLI ran the panel; when the agentic panel ran, write them here from the origins §2.1 carried. `flow cost` reads them back per origin: how many findings each pass contributed, how many only it raised, and how many of those survived §6. That last number is the only evidence a pass is still earning its words.
389
+ - **Record which pass found what**, in the same write: `meta.json.review_findings[]`, one entry per finding **per source** — `{ round, origin, severity, file, discarded_by_skeptic }`, and no finding text, which stays in the artifact. `flow review --record` writes these itself when the CLI ran the panel; when the agentic panel ran, write them here from the origins §2.1 carried. `flow yield` reads them back across every work and repo, per origin and per size: rounds run, findings, how many only that pass raised, how many of those were acted on, and the agents it took (where the round recorded them). That unique-accepted number is the only evidence a pass is still earning its words, and `yield` marks a pass that ran twenty rounds at a size without one.
390
390
  - **Stage what the review taught** (`knowledge.stage` set; silence by default). Review is where a project teaches the most, and this is the only moment its findings are in context. Candidates are findings about the **domain or the codebase's real behaviour**, not about this diff: a library that does other than its name says, a test disguise that kept the suite green over a live defect, a module rule the reviewers had to cite from its own prose, a measurement. A blocker fixed here is not knowledge; *why it was written wrong* may be. Same evidence rule as `/flow-feat-design` §8 — one line of evidence per finding or it is not staged. One call per finding, one line to the user («Staged N finding(s) for `ship`»). Never `knowledge.save` here.
391
391
  - Overwrite `00-summary.md` whole (≤15 lines, flow-core §5).
392
392
  - **Record what the agents missed** (flow-core §6.7, `agents.learn` not `off`; asking nothing): for each finding that survived, the panel member or named `agents.<role>` whose category it falls in and who did not report it, and the delegated `build` agent whose code it sits in → one `meta.json.agent_lessons[]` row each, only when the lesson passes the §6.7 test. The origins §2.1 carried are what make this possible — a finding with no origin teaches nobody.