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
@@ -66,10 +66,14 @@ place it would ask:
66
66
 
67
67
  **In every mode**, criteria `07-validation.md` marks `not-verified-unattended` go into the body under
68
68
  `## Not verified — needs a human`, with what to do for each — and so do the tests the suite left red
69
- because they also fail on the base (`unattended:validate-red-base`): each name, and the base sha
70
- where it failed too — and the suspect flakes the run advanced past (`unattended:validate-flaky`), one line each:
71
- `` `<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
72
- (`06-review.md` "Answered (unattended)"), one line each. The §3 preview shows that section like
69
+ because they also fail on the base (`unattended:validate-red-base`): each name, the base sha
70
+ 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:
71
+ `` `<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
72
+ (`06-review.md` "Answered (unattended)"), one line each. A test outside the change that this
73
+ MR/PR repaired because its cause was identified (flow-core §11) — a repair step of a validate round,
74
+ or of `green`/`respond` — goes under `## Also fixed`, one line each:
75
+ `` `<test>` — <cause>; <what changed> ``, so the reviewer sees why a test this change did not need
76
+ was touched. The §3 preview shows that section like
73
77
  any other, and the person reading it is the check the run could not do. Entries of
74
78
  `auto-answers.md` for this MR/PR (`MR/PR <n>` in their heading, or all of them for a work with no
75
79
  `mrs`) — plus, while no `mrs[]` entry is `published` or `merged`, every entry whose heading names none: a study
@@ -231,13 +231,16 @@ Write `.claude/work/<TICKET>/07-validation.md`:
231
231
  failing tests on the base the way they went red on HEAD — the whole suite, three runs on each side
232
232
  for a test that is red in the suite and green on its own — and write each name, its result there,
233
233
  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
234
- exception — it is a red suite. Tests red once in HEAD's three runs, never on the base, outside the
234
+ exception — it is a red suite. **Before a test takes the exception or the flake record, its cause
235
+ is looked for** (flow-core §11, a red test outside the change): identified → it is not excused, it
236
+ becomes a step of the repair round below, named with its cause, fixed in its own commit and listed
237
+ under `## Also fixed` by `ship`. Tests red once in HEAD's three runs, never on the base, outside the
235
238
  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,
236
239
  five more whole-suite runs on HEAD decide — nothing red in them → `unattended:validate-flaky`, the
237
240
  counts under "Suite results", and the phase advances. Short of it, the red suite gets a repair round (the same row):
238
241
  the failing tests become unticked steps of this MR/PR's plan, `phase = build`, and the run
239
242
  chains into `/flow-feat-build`, then review and this phase again. Rounds go on while each lowers
240
243
  the red count, three at most; one that does not, or a third still red → `blocked`, naming the
241
- tests still red.
244
+ tests still red and, for each, what a person does next.
242
245
 
243
246
  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.
@@ -161,7 +161,7 @@ This system **orchestrates** the project's existing sub-agents and skills (it do
161
161
  ```
162
162
 
163
163
  - **`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.
164
- - **`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.
164
+ - **`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.
165
165
  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.
166
166
  - **`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.
167
167
  - **`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.
@@ -41,7 +41,7 @@ Read `~/.claude/flow/CORE.opencode.md` first (shared rules: `FLOW.md` step 0, mo
41
41
  2. Creating/switching a branch, or DB schema changes/migrations, if a fix requires them.
42
42
  3. **Re-triggering a pipeline or job on the remote** (CI resources; outward action).
43
43
  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).
44
- 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.
44
+ 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.
45
45
 
46
46
  **In `unattended`** (flow-core §2.1) — launched by `/flow-work-run` on `why = pipeline` or
47
47
  `why = conflict` — this command never touches the forge. Gate 5 holds exactly as written; the
@@ -55,8 +55,10 @@ others resolve this way:
55
55
  conflicts with `base`, which the orchestrator left in the checkout as `origin/<base>` at
56
56
  `base_sha`. That is the only blocker of the round — category C, nothing to triage. `origin/<base>`
57
57
  missing or not at `base_sha` → `blocked`: the run would merge a base nobody named.
58
- - **§3** — triage as written, recorded in `09-ci.md`. **K** (flaky / infra) → `blocked` with the
59
- evidence: the run has no rerun order, and the orchestrator owns reruns and the red-round limit.
58
+ - **§3** — triage as written, recorded in `09-ci.md`. **K** (flaky / infra) → when the round
59
+ changed no code, `blocked` with the evidence and a one-line reason starting `rerun CI: <job>[,
60
+ <job>…]` (flow-core §11): the run has no rerun order, and the orchestrator owns reruns and the
61
+ red-round limit; when the round changed code, its `publish` reruns CI anyway.
60
62
  **C** (conflict, behind base) on `why = pipeline`, and anything needing a rebase or force-push →
61
63
  `blocked`: the orchestrator brings the base in, and relaunches with `why = conflict` when it
62
64
  conflicts. A **human** blocker → `blocked`, naming who. **S** → fixed within
@@ -136,12 +138,14 @@ Categories:
136
138
  | **L — lint / style / format** | formatter or linter job red | mechanical auto-fix with `quality.style_fix` (or the repo's formatter) |
137
139
  | **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) |
138
140
  | **Y — type / build / compile** | type-check (`static_analysis`) or build broke | fix the code/types |
139
- | **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 |
141
+ | **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 |
140
142
  | **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 |
141
143
  | **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 |
142
144
  | **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 |
143
145
 
144
- **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.
146
+ **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.
147
+
148
+ **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.
145
149
 
146
150
  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.
147
151
 
@@ -164,9 +168,9 @@ Only **base-integration**, **auto-fix** and **code-fix**:
164
168
 
165
169
  - **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`.
166
170
  - **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".
167
- - **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.
171
+ - **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.
168
172
  - **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.
169
- - **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.
173
+ - **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.
170
174
 
171
175
  ### 5.C Integrate the base and resolve conflicts (category C)
172
176
 
@@ -99,7 +99,10 @@ back through it, and the hard gates above resolve this way:
99
99
  - **The one closing order**, after the WIP commit (flow-core §2.1): code changed this round →
100
100
  `publish` with the work's `publish-title.md` / `publish-body.md` (updated when the round changed
101
101
  what they say, and naming any thread whose reply failed) and no `--part/--of` — the MR/PR is
102
- already open (flow-core §2.1) — so the commits the replies name reach the branch; no code changed and every reply went
102
+ already open (flow-core §2.1) — so the commits the replies name reach the branch (and the push reruns CI, so a
103
+ failure nobody could explain needs nothing more); no code changed, every reply went out and a
104
+ thread carried a CI failure neither reproduced nor explained (§3) → `blocked`, its one-line reason
105
+ starting `rerun CI: <job>[, <job>…]` (flow-core §11); no code changed and every reply went
103
106
  out → `done`, the summary listing the threads answered; no code changed and a reply failed →
104
107
  `blocked`, naming those threads.
105
108
 
@@ -148,6 +151,8 @@ Categories:
148
151
  | **F — obsolete/done** | Already addressed, or no longer applies | reply pointing to where |
149
152
  | **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 |
150
153
 
154
+ **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".
155
+
151
156
  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.
152
157
 
153
158
  ## 4. Agree the response per thread (the debate)
package/bin/cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import { cpSync, existsSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync, statSync, writeFileSync } from 'node:fs'
2
+ import { cpSync, existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from 'node:fs'
3
3
  import { homedir } from 'node:os'
4
- import { dirname, join } from 'node:path'
4
+ import { dirname, join, resolve } from 'node:path'
5
5
  import { fileURLToPath } from 'node:url'
6
6
  import { execFileSync, spawn } from 'node:child_process'
7
7
 
@@ -1160,52 +1160,228 @@ function cost(argv) {
1160
1160
  console.log()
1161
1161
  console.log('These are the harness\'s own client-side estimates and can differ from a bill.')
1162
1162
  console.log('Phases with no row did not measure anything — absence here is not zero.')
1163
+ console.log('Which reviewer found what, across every work: `flow yield`.')
1164
+ }
1163
1165
 
1164
- findingsByOrigin(meta)
1166
+ // --- yield -----------------------------------------------------------------------------
1167
+ // Whether each review pass still earns what it costs, across every work a repo has kept —
1168
+ // live and archived, in this checkout and in the main one, over as many repos as are named.
1169
+ // `meta.json.review_findings[]` has carried an origin per source since the rows were added;
1170
+ // what it never had is a reader that counts across works, so the twenty-review rule had
1171
+ // nothing to count. The origins were written by hand and drifted (`builtin`, `code-review`,
1172
+ // `cli:tests`, `§5.5`…): they are mapped here, on read, and every spelling that was not
1173
+ // already canonical is printed with what it was read as, so a wrong mapping is visible.
1174
+
1175
+ const RETIRE_AFTER = 20
1176
+ const ACCEPTED = new Set(['fixed', 'open', 'deferred'])
1177
+ const SECTION_ORIGINS = {
1178
+ '§3.5': 'sweep', sweep: 'sweep',
1179
+ '§3.6': 'query-duel', 'query-duel': 'query-duel',
1180
+ '§4': 'yagni', yagni: 'yagni',
1181
+ '§5': 'contract', contract: 'contract', 'contract-verifier': 'contract',
1182
+ '§5.5': 'idiom', idiom: 'idiom', 'idiom-audit': 'idiom',
1183
+ }
1184
+ const BUILT_IN = new Set(['built-in', 'builtin', 'builtin-code-review', 'code-review'])
1185
+ const LEGACY_SEVERITY = {
1186
+ blocker: 'blocker', high: 'blocker',
1187
+ major: 'major', medium: 'major',
1188
+ minor: 'minor', low: 'minor', suggestion: 'minor',
1189
+ nit: 'nit',
1165
1190
  }
1166
1191
 
1167
- // What the money was spent ON. A review runs the built-in, a panel, and four specialised
1168
- // passes — roughly 1 800 words of a 5 683-word command — every one of them added after a real
1169
- // defect got through, and not one able to show it still earns its cost. The only argument
1170
- // available was an opinion, and opinions about this converge on whoever spoke last.
1171
- function findingsByOrigin(meta) {
1172
- const rows = Array.isArray(meta.review_findings) ? meta.review_findings : []
1173
- console.log()
1174
- if (!rows.length) {
1175
- console.log('No findings recorded by origin yet. `flow review --record` writes one row per')
1176
- console.log('finding per source, and the agentic panel records the same at §9 of review.')
1177
- return
1192
+ // A panel role is whatever the repo named it; only the spelling noise is folded: a prefix
1193
+ // saying which path ran it, case and spaces, and the suffixes an agent's file name adds.
1194
+ function panelRole(raw) {
1195
+ let r = raw.toLowerCase().trim().replace(/\s+/g, '-')
1196
+ r = r.replace(/-(reviewer|hunter|verifier|audit)$/, '').replace(/-round\d+$/, '')
1197
+ if (r === 'testing') r = 'tests'
1198
+ if (r === 'redteam') r = 'red-team'
1199
+ if (/^silent(-failures?)?$/.test(r)) r = 'silent-failure'
1200
+ if (r === 'code-simplifier') r = 'simplify'
1201
+ return `panel:${r}`
1202
+ }
1203
+
1204
+ function canonicalOrigin(raw) {
1205
+ const o = String(raw ?? '').trim()
1206
+ if (!o) return 'unknown'
1207
+ if (o.startsWith('reinforcement:')) return o.toLowerCase()
1208
+ const bare = o.replace(/^(§panel:|cli-panel:|cli:|panel:)/, '')
1209
+ if (BUILT_IN.has(bare)) return 'built-in'
1210
+ if (SECTION_ORIGINS[bare]) return SECTION_ORIGINS[bare]
1211
+ return panelRole(bare)
1212
+ }
1213
+
1214
+ // Every work folder a repo holds: its `.claude/work` here and in the main checkout, live and
1215
+ // `_archive/`, each meta.json read once however many of those paths lead to it.
1216
+ // `seen` is shared across every repo of one call: a worktree and its main checkout, or the
1217
+ // same path named twice, lead to the same folders and must count them once.
1218
+ function worksOf(repo, seen) {
1219
+ const roots = new Set([join(repo, '.claude', 'work'), join(mainCheckout(repo), '.claude', 'work')])
1220
+ const works = []
1221
+ for (const root of roots) {
1222
+ for (const dir of [root, join(root, '_archive')]) {
1223
+ let entries = []
1224
+ try { entries = readdirSync(dir, { withFileTypes: true }) } catch { continue }
1225
+ for (const e of entries) {
1226
+ if (!e.isDirectory() || (dir === root && e.name === '_archive')) continue
1227
+ const p = join(dir, e.name, 'meta.json')
1228
+ let real
1229
+ try { real = realpathSync(p) } catch { continue }
1230
+ if (seen.has(real)) continue
1231
+ seen.add(real)
1232
+ try { works.push({ path: join(dir, e.name), meta: JSON.parse(readFileSync(p, 'utf8')) }) } catch {}
1233
+ }
1234
+ }
1235
+ }
1236
+ return works
1237
+ }
1238
+
1239
+ // The rule is judged per size because the review itself is: the panel rarely runs below M,
1240
+ // so XS and S are pooled or neither would ever reach twenty rounds.
1241
+ function sizeBucket(size) {
1242
+ const s = String(size ?? '').toUpperCase()
1243
+ return s === 'XS' || s === 'S' ? 'XS+S' : s === 'M' || s === 'L' ? s : 'unknown size'
1244
+ }
1245
+
1246
+ function yieldOf(argv) {
1247
+ const repos = (argv.length ? argv : ['.']).map((a) => {
1248
+ const top = git(['rev-parse', '--show-toplevel'], resolve(a)).trim()
1249
+ if (!top) { console.error(`flow yield: \`${a}\` is not a git checkout`); process.exit(1) }
1250
+ return top
1251
+ })
1252
+
1253
+ // bucket → origin → counters; rounds are (work, round) keys so a round counts once.
1254
+ const table = new Map()
1255
+ const spellings = new Map()
1256
+ let rounds = 0, rows = 0, works = 0
1257
+ const seen = new Set()
1258
+ const cell = (bucket, origin) => {
1259
+ if (!table.has(bucket)) table.set(bucket, new Map())
1260
+ const t = table.get(bucket)
1261
+ if (!t.has(origin)) t.set(origin, { rounds: new Set(), findings: 0, unique: 0, accepted: 0, agents: null })
1262
+ return t.get(origin)
1178
1263
  }
1179
- const rounds = new Set(rows.map((r) => r.round)).size
1180
- // A finding is identified by where it is, not by its text — the text lives in the artifact.
1181
- const key = (r) => `${r.round}::${r.severity}::${r.file}`
1182
- const sources = new Map()
1183
- for (const r of rows) {
1184
- if (!sources.has(key(r))) sources.set(key(r), new Set())
1185
- sources.get(key(r)).add(r.origin)
1264
+ const read = (raw) => {
1265
+ const c = canonicalOrigin(raw)
1266
+ if (raw !== c) {
1267
+ if (!spellings.has(c)) spellings.set(c, new Set())
1268
+ spellings.get(c).add(String(raw))
1269
+ }
1270
+ return c
1186
1271
  }
1187
- const per = new Map()
1188
- for (const r of rows) {
1189
- const e = per.get(r.origin) ?? { total: 0, exclusive: 0, survived: 0 }
1190
- e.total += 1
1191
- if (sources.get(key(r)).size === 1) {
1192
- e.exclusive += 1
1193
- if (!r.discarded_by_skeptic) e.survived += 1
1272
+
1273
+ for (const repo of repos) {
1274
+ for (const { path, meta } of worksOf(repo, seen)) {
1275
+ const found = Array.isArray(meta.review_findings) ? meta.review_findings : []
1276
+ const costs = (Array.isArray(meta.cost) ? meta.cost : []).filter((e) => e?.phase === 'review' && e.round != null)
1277
+ if (!found.length && !costs.length) continue
1278
+ works += 1
1279
+ const sizeFor = (mr, round) => {
1280
+ const entry = costs.find((e) => e.round === round && e.effective_size && (e.mr ?? null) === (mr ?? null))
1281
+ if (entry) return entry.effective_size
1282
+ const part = Array.isArray(meta.mrs) && mr != null ? meta.mrs.find((m) => m?.n === mr) : null
1283
+ return part?.size ?? meta.size
1284
+ }
1285
+ const roundsHere = new Set()
1286
+
1287
+ // A round that recorded what it launched says which passes ran, findings or not.
1288
+ for (const e of costs) {
1289
+ roundsHere.add(e.round)
1290
+ for (const [raw, n] of Object.entries(e.agents ?? {})) {
1291
+ if (!(Number(n) > 0)) continue
1292
+ const c = cell(sizeBucket(e.effective_size ?? sizeFor(e.mr, e.round)), read(raw))
1293
+ c.rounds.add(`${path}#${e.round}`)
1294
+ c.agents = (c.agents ?? 0) + Number(n)
1295
+ }
1296
+ }
1297
+
1298
+ // Legacy rows are one per source; the same finding is the same (round, severity, file).
1299
+ const legacy = found.filter((r) => !Array.isArray(r.sources))
1300
+ const keyOf = (r) => `${r.round}::${LEGACY_SEVERITY[r.severity] ?? 'unrated'}::${r.file ?? ''}`
1301
+ const sourcesOf = new Map()
1302
+ for (const r of legacy) {
1303
+ if (r.count != null) continue
1304
+ const k = keyOf(r)
1305
+ if (!sourcesOf.has(k)) sourcesOf.set(k, new Set())
1306
+ String(r.origin ?? '').split('+').forEach((o) => sourcesOf.get(k).add(canonicalOrigin(o)))
1307
+ }
1308
+ for (const r of legacy) {
1309
+ rows += 1
1310
+ roundsHere.add(r.round)
1311
+ const bucket = sizeBucket(sizeFor(r.mr, r.round))
1312
+ const accepted = !r.discarded_by_skeptic && !['declined', 'discarded'].includes(r.severity)
1313
+ for (const origin of new Set(String(r.origin ?? '').split('+').map(read))) {
1314
+ const c = cell(bucket, origin)
1315
+ // A row that only carries a count says how many, never which: they are findings,
1316
+ // and nothing can say whether another source had them too — so the round they sit in
1317
+ // is not one this origin can be judged on either.
1318
+ if (r.count != null) { c.findings += Number(r.count) || 0; continue }
1319
+ c.rounds.add(`${path}#${r.round}`)
1320
+ c.findings += 1
1321
+ if (sourcesOf.get(keyOf(r)).size === 1) {
1322
+ c.unique += 1
1323
+ if (accepted) c.accepted += 1
1324
+ }
1325
+ }
1326
+ }
1327
+
1328
+ for (const r of found.filter((x) => Array.isArray(x.sources))) {
1329
+ rows += 1
1330
+ roundsHere.add(r.round)
1331
+ const bucket = sizeBucket(sizeFor(r.mr, r.round))
1332
+ const sources = new Set(r.sources.map(read))
1333
+ for (const o of sources) {
1334
+ const c = cell(bucket, o)
1335
+ c.rounds.add(`${path}#${r.round}`)
1336
+ c.findings += 1
1337
+ if (sources.size === 1) {
1338
+ c.unique += 1
1339
+ if (ACCEPTED.has(r.outcome)) c.accepted += 1
1340
+ }
1341
+ }
1342
+ }
1343
+ rounds += roundsHere.size
1194
1344
  }
1195
- per.set(r.origin, e)
1196
1345
  }
1197
- console.log(`## Findings by origin — ${rows.length} row(s) over ${rounds} round(s)`)
1346
+
1347
+ console.log(`# Review yield — ${repos.join(' · ')}`)
1198
1348
  console.log()
1199
- console.log('| origin | findings | only this one | and survived §6 |')
1200
- console.log('|---|---|---|---|')
1201
- for (const [origin, e] of [...per.entries()].sort((a, b) => b[1].survived - a[1].survived)) {
1202
- console.log(`| ${origin} | ${e.total} | ${e.exclusive} | ${e.survived} |`)
1349
+ if (!table.size) {
1350
+ console.log('No review rounds recorded in the works these checkouts hold')
1351
+ console.log(`(${repos.map((r) => join(r, '.claude', 'work')).join(', ')}, archive included).`)
1352
+ return
1353
+ }
1354
+ console.log(`${works} work(s), ${rounds} review round(s), ${rows} finding row(s).`)
1355
+ for (const bucket of ['XS+S', 'M', 'L', 'unknown size']) {
1356
+ const t = table.get(bucket)
1357
+ if (!t) continue
1358
+ console.log()
1359
+ console.log(`## ${bucket}`)
1360
+ console.log()
1361
+ console.log('| origin | rounds | findings | unique | unique accepted | agents | verdict |')
1362
+ console.log('|---|---|---|---|---|---|---|')
1363
+ const sorted = [...t.entries()].sort((a, b) => b[1].accepted - a[1].accepted || b[1].findings - a[1].findings)
1364
+ for (const [origin, c] of sorted) {
1365
+ const n = c.rounds.size
1366
+ const verdict = n < RETIRE_AFTER ? `too few rounds (${n}/${RETIRE_AFTER})`
1367
+ : c.accepted === 0 ? `retire at ${bucket}` : 'keep'
1368
+ console.log(`| ${origin} | ${n} | ${c.findings} | ${c.unique} | ${c.accepted} | ${c.agents ?? '—'} | ${verdict} |`)
1369
+ }
1203
1370
  }
1204
1371
  console.log()
1205
- console.log('"only this one" is the column that decides anything: a finding three sources')
1206
- console.log('raised says nothing about any of them. A pass contributing no exclusive surviving')
1207
- console.log('finding across twenty reviews is removed from the command — the rule is written')
1208
- console.log('down before the data arrives so it cannot be argued backwards later.')
1372
+ console.log('"unique accepted" decides: a finding only this origin raised and that was acted on.')
1373
+ console.log(`An origin that ran ${RETIRE_AFTER}+ rounds at a size with none is retired at that size.`)
1374
+ console.log('Re-run it when the model changes — a pass that stopped paying may pay again, and back.')
1375
+ console.log('Rows written before findings carried an outcome count "accepted" as "not refuted by a')
1376
+ console.log('skeptic", and a round they record counts only for the origins with a row in it, so')
1377
+ console.log('"rounds" is a lower bound there and "agents" is unknown (—). Those rows carry no MR/PR')
1378
+ console.log('number either, so a split work\'s legacy rows count at the size of the whole work.')
1379
+ if (spellings.size) {
1380
+ console.log()
1381
+ console.log('## Spellings read as')
1382
+ console.log()
1383
+ for (const [c, raws] of [...spellings.entries()].sort()) console.log(`- ${c} ← ${[...raws].sort().join(', ')}`)
1384
+ }
1209
1385
  }
1210
1386
 
1211
1387
  function usage() {
@@ -1218,6 +1394,7 @@ function usage() {
1218
1394
  npx flow-workflows tier [--base <ref>] [--rev <ref>] [--harness <name>]
1219
1395
  npx flow-workflows review [--out <file>] [--record] [same options as bundle]
1220
1396
  npx flow-workflows cost
1397
+ npx flow-workflows yield [<repo-path>…]
1221
1398
 
1222
1399
  Harnesses: ${Object.keys(HARNESSES).join(' · ')}
1223
1400
  "project" installs into the current repo instead of your user folder.
@@ -1267,9 +1444,13 @@ Claude Code, Codex CLI and zcode have their own marketplaces:
1267
1444
  "cost" prints what each phase of this branch's work actually reported spending, from
1268
1445
  what --record wrote into meta.json. A harness that reports no figure is recorded as
1269
1446
  "not reported": a headcount of subagents is not a cost, and neither is a guess.
1270
- It also breaks the round's findings down by origin — which reviewer or pass raised
1271
- each one, how many only it raised, and how many of those survived verification. That
1272
- last column is the only evidence a pass is still earning the words it costs.
1447
+
1448
+ "yield" reads every work of the repos named (default: this one) — live and archived,
1449
+ here and in the main checkout — and prints, per reviewer or pass and per size, the
1450
+ rounds it ran, the findings it raised, how many only it raised, how many of those were
1451
+ acted on, and the agents it took. One that ran 20+ rounds at a size with no unique
1452
+ accepted finding is marked "retire" there; XS and S are pooled, since the panel rarely
1453
+ runs below M. Old spellings of an origin are mapped and listed with what they became.
1273
1454
 
1274
1455
  Updating: re-run the install command — it sweeps the previous version first.
1275
1456
  Docs: https://github.com/mashware/flow-workflows`)
@@ -1280,6 +1461,7 @@ const [cmd, tool, scope] = process.argv.slice(2)
1280
1461
  if (cmd === 'bundle') bundle(process.argv.slice(3))
1281
1462
  else if (cmd === 'tier') tier(process.argv.slice(3))
1282
1463
  else if (cmd === 'cost') cost(process.argv.slice(3))
1464
+ else if (cmd === 'yield') yieldOf(process.argv.slice(3))
1283
1465
  else if (cmd === 'review') review(process.argv.slice(3)).catch((e) => { console.error(`flow review: ${e.message}`); process.exit(1) })
1284
1466
  else if (cmd === 'check') check()
1285
1467
  else if (cmd === 'install' && tool === 'claude') claude()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flow-workflows",
3
- "version": "0.106.0",
3
+ "version": "0.108.0",
4
4
  "description": "Guided feat/bug workflows (start→ship), post-deploy monitoring and multi-agent code review, stack-agnostic. Each repo uses a shared FLOW.md plus optional harness overlay.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -3,7 +3,7 @@
3
3
  "name": "flow",
4
4
  "displayName": "Flow — guided dev workflows",
5
5
  "description": "Guided feat/bug workflows (start→ship), post-deploy monitoring and multi-agent code review, stack-agnostic. Each repo uses a shared FLOW.md plus optional harness overlay.",
6
- "version": "0.106.0",
6
+ "version": "0.108.0",
7
7
  "author": {
8
8
  "name": "Alberto Vioque",
9
9
  "email": "mashware@gmail.com"
@@ -5,6 +5,47 @@ plugin and is what `/flow:news` reads to show you what changed since your previo
5
5
 
6
6
  The canonical, richest notes live in the [GitHub Releases](https://github.com/mashware/flow-workflows/releases).
7
7
 
8
+ ## v0.108.0 — You can see which review passes still find what nothing else finds · 2026-11-04
9
+
10
+ **In short**
11
+ - **`npx flow-workflows yield [<repo>…]` counts every review your repos kept.** It reads live and archived works,
12
+ in the checkout you run it from and in the main one, across as many repos as you name.
13
+ - **Per reviewer or pass, and per change size**, it shows the rounds it ran, the findings it raised, how many only
14
+ it raised, how many of those were acted on, and the agents it took.
15
+ Rows recorded so far carry no outcome and no agent count: for them "acted on" means "not refuted by a skeptic",
16
+ the agents column shows `—`, and `yield` says so under its tables.
17
+ - **A verdict per row.** A pass that ran 20 rounds at a size without one finding of its own that was acted on is
18
+ marked `retire at <size>`. Under 20 rounds, it says how many it has. XS and S count together, because the panel
19
+ rarely runs below M.
20
+ - **Old spellings count as the pass they are.** `builtin`, `code-review`, `cli:tests` and `§5.5` were all written by
21
+ hand. They are folded on read, and the output lists each spelling with what it was read as.
22
+ - **`flow cost` is back to spend only.** Its per-origin table moved to `yield`, where it spans works.
23
+
24
+ Every review has recorded which pass raised each finding since v0.66.0, but only one work at a time could be read.
25
+ So the rule "no finding of its own across twenty reviews, and the pass comes out" had nothing to count. On the
26
+ three repos using flow today that is 131 rounds and about 1 100 rows (#234).
27
+
28
+ ## v0.107.0 — A red test outside the change gets fixed when flow can see why · 2026-11-03
29
+
30
+ **In short**
31
+ - **A red test the change did not touch is diagnosed before it is excused.** flow reads the test and the code it
32
+ drives and names the cause: it counts timer ticks instead of checking the result, it depends on the order tests
33
+ run in, it reads what another test left behind, or the code has a race.
34
+ - **A cause it can prove gets fixed in the same MR/PR.** The test keeps checking the same behaviour, by its result
35
+ rather than its timing. It is never deleted, skipped, retried or loosened, and no timeout gets longer. The fix
36
+ goes in its own commit, and the MR/PR description lists it under `## Also fixed`.
37
+ - **"Proved" means evidence.** The cause is named at `file:line`, and either a forced reproduction turns the test
38
+ red on purpose or the fragility is plain in the assertion. A plausible guess is not acted on.
39
+ - **A CI failure pasted into a review no longer ends at "not reproduced".** `respond` and `green` diagnose it from
40
+ the log. If they find the fragility, they fix it and push. If not, the reply says so and tells the person what to
41
+ do next. An unattended run that changed nothing ends `blocked` with a reason starting `rerun CI:`.
42
+ - **When the cause is not found, the old path still applies**: the base exception, the flake record, or a rerun.
43
+ Each test it leaves red now says what the person does next.
44
+
45
+ Until now, an unattended `validate` let a red test through when it was also red on the base or looked flaky. The
46
+ MR/PR went out red with the test under "Not verified — needs a human", even when the run could see why it failed.
47
+ In one case the test counted timer ticks, so a 180 ms stall failed it (#232).
48
+
8
49
  ## v0.106.0 — The knowledge a work learned ships in its own MR/PR · 2026-11-02
9
50
 
10
51
  **In short**