flow-workflows 0.95.0 → 0.96.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 (39) hide show
  1. package/adapters/codex/CORE.md +45 -4
  2. package/adapters/codex/skills/flow-bug-fix/SKILL.md +3 -1
  3. package/adapters/codex/skills/flow-bug-validate/SKILL.md +1 -1
  4. package/adapters/codex/skills/flow-feat-build/SKILL.md +3 -1
  5. package/adapters/codex/skills/flow-feat-design/SKILL.md +1 -1
  6. package/adapters/codex/skills/flow-feat-review/SKILL.md +4 -2
  7. package/adapters/codex/skills/flow-feat-validate/SKILL.md +1 -1
  8. package/adapters/codex/skills/flow-work-handoff/SKILL.md +13 -0
  9. package/adapters/codex/skills/flow-work-run/SKILL.md +7 -0
  10. package/adapters/gemini/CORE.md +45 -4
  11. package/adapters/gemini/commands/flow/bug/fix.toml +3 -1
  12. package/adapters/gemini/commands/flow/bug/validate.toml +1 -1
  13. package/adapters/gemini/commands/flow/feat/build.toml +3 -1
  14. package/adapters/gemini/commands/flow/feat/design.toml +1 -1
  15. package/adapters/gemini/commands/flow/feat/review.toml +4 -2
  16. package/adapters/gemini/commands/flow/feat/validate.toml +1 -1
  17. package/adapters/gemini/commands/flow/work/handoff.toml +13 -0
  18. package/adapters/gemini/commands/flow/work/run.toml +7 -0
  19. package/adapters/hermes/CORE.md +45 -4
  20. package/adapters/hermes/skills/flow-bug-fix/SKILL.md +3 -1
  21. package/adapters/hermes/skills/flow-bug-validate/SKILL.md +1 -1
  22. package/adapters/hermes/skills/flow-feat-build/SKILL.md +3 -1
  23. package/adapters/hermes/skills/flow-feat-design/SKILL.md +1 -1
  24. package/adapters/hermes/skills/flow-feat-review/SKILL.md +4 -2
  25. package/adapters/hermes/skills/flow-feat-validate/SKILL.md +1 -1
  26. package/adapters/hermes/skills/flow-work-handoff/SKILL.md +13 -0
  27. package/adapters/hermes/skills/flow-work-run/SKILL.md +7 -0
  28. package/adapters/opencode/CORE.md +45 -4
  29. package/adapters/opencode/commands/flow-bug-fix.md +3 -1
  30. package/adapters/opencode/commands/flow-bug-validate.md +1 -1
  31. package/adapters/opencode/commands/flow-feat-build.md +3 -1
  32. package/adapters/opencode/commands/flow-feat-design.md +1 -1
  33. package/adapters/opencode/commands/flow-feat-review.md +4 -2
  34. package/adapters/opencode/commands/flow-feat-validate.md +1 -1
  35. package/adapters/opencode/commands/flow-work-handoff.md +13 -0
  36. package/adapters/opencode/commands/flow-work-run.md +7 -0
  37. package/package.json +1 -1
  38. package/plugins/flow/.claude-plugin/plugin.json +1 -1
  39. package/plugins/flow/CHANGELOG.md +36 -0
@@ -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.95.0`.** Compare it once, at the start of the session, against
20
+ **This file belongs to flow `0.96.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
@@ -225,7 +225,8 @@ the value someone wrote in the FLOW config, or it is not in effect.
225
225
  each one resolves as §2.1's table says — never approved in silence):
226
226
  1. Any push or MR/PR creation (all of `ship`).
227
227
  2. Creating or switching a branch when the base is ambiguous (not on a clean main, or a possible train/stacked branch).
228
- 3. DB schema changes or migrations.
228
+ 3. DB schema changes or migrations — writing one a schema approved with the study already lists is
229
+ not asked again (below); applying one always is.
229
230
  4. A `review` that surfaced high-severity findings — never chain into `ship` on those.
230
231
  5. The business brief written before touching code (`build`, `fix`).
231
232
 
@@ -262,6 +263,30 @@ studies a ticket there goes on to build it — unless the orchestrator launched
262
263
  (§2.1), which stops at the door to code. With `autonomy.mode: auto`, a `--study` work runs on its
263
264
  own up to the push.
264
265
 
266
+ **A schema approved with the study.** A study that changes the schema says so literally: the
267
+ `## Schema changes` section of the `flow-study` block (`$flow-work-handoff` §5) lists, one line
268
+ each and by name, every table, column, index, constraint and data copy its migrations create,
269
+ alter or drop — from `03-design.md` "Data model", the intended fix of `03-investigation.md` for a
270
+ bug — or says `none`. Approving the study approves that list, and the approval is a file in the
271
+ work folder, `approved-schema.md`: a first line saying where it was approved (`Approved at
272
+ handoff, <date>` · `Approved with the study run, <date>`), then the section verbatim. Two places
273
+ write it and nothing else does — the handoff push answered **Push — schema approved**
274
+ (`$flow-work-handoff` §4), and `$flow-work-run` §2 when the orchestrator approves a study run with
275
+ `why = start`. Then, in every mode:
276
+
277
+ - **Writing** a migration — in `build`, in `fix`, or for a fix a review asks for — whose every
278
+ object created, altered or dropped is on that list is not asked: write it, add
279
+ `{ "key": "study:approved-schema", "default": "<the objects it writes>", "phase": "<phase>" }` to
280
+ `meta.json.defaults_used[]`, and one line under "Decisions made during implementation" naming
281
+ `approved-schema.md`.
282
+ - **Anything the list does not name** — one more column, an index, a drop, a type beyond what its
283
+ line says — is hard gate 3 as always, and the question names what lies beyond the list, so the
284
+ person decides on the difference alone.
285
+ - **Applying** a migration (`validate`) and the pre-deploy SQL (`ship`) are asked as before: the
286
+ study approved what the schema becomes, not when a database changes.
287
+ - A study revision (`$flow-work-run` §2) moves `approved-schema.md` aside with the rest of the
288
+ study; the new summary is approved anew.
289
+
265
290
  ### 2.1 `unattended` — where a person would have been asked
266
291
 
267
292
  No person is there to answer a question in this mode. A question tool — `AskUserQuestion`, OpenCode's `question`,
@@ -373,7 +398,7 @@ person asking for changes, a ticket that already has code — is `$flow-work-run
373
398
  | Business brief before code (`build`, `fix`) | record — the brief is written to the phase artifact, marked `recorded (unattended)`, and travels in the MR/PR body |
374
399
  | The door to code in a study run (`build`, `fix` pre-flight) | done — `done-summary.md`, the study as `$flow-work-handoff` §5 writes it for the ticket, and one `--depends-on` per `meta.json.ticket_deps` entry |
375
400
  | Push and MR/PR creation (`ship`) | `publish` — the run commits on its own branch, writes title and body, and hands them over; the orchestrator pushes and opens the draft |
376
- | 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` |
401
+ | 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) |
377
402
  | `review` with blockers or high-severity findings | question `high_findings` |
378
403
  | `validate` with a red suite or a criterion `unproven` | blocked — the phase does not advance and does not chain. **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 → 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". Short of all three — a failure the base does not reproduce, a base that cannot be run, a test this diff touched — blocked |
379
404
  | A product decision (§7 `decision`) | question `decision` |
@@ -394,6 +419,7 @@ person asking for changes, a ticket that already has code — is `$flow-work-run
394
419
  | An approved study's branch (`run`, `why = start`, no build or fix begun) | record — fast-forwarded to its base when it holds no commit of its own (`$flow-work-run` §2); the base unreadable or the fast-forward failing → blocked. Not integrating: nothing of the run's is merged |
395
420
  | Integrating the base into the MR/PR's branch (`green`) | on `why = conflict`, record — `git merge origin/<base>` as the orchestrator left it, never rebase, each conflict resolved on its merits (`$flow-work-green` §5.C); on any other `why`, blocked — the orchestrator brings the base in |
396
421
  | Any offer about the work's own bookkeeping — a tracker issue, the first `KNOWLEDGE.md` or a knowledge save, a FLOW convention, an agent lesson or a saved specialist, the follow-up survey, carrying files over from the main checkout, a contract handoff, archiving the work | record — `Later`; nothing written outside the work folder |
422
+ | A wait — a suite, a quality gate, anything run in the background (`validate`, `review`) | in the turn, on its condition, with a deadline (§6.5) — never a supervisor, never a fixed-length sleep, never ending the turn to be woken |
397
423
  | A step the command cannot complete (a red suite it cannot fix, a tool missing, auth failing, the same check failing a second time) | blocked |
398
424
  | Anything `auto` already decides on its own (size, flow mechanics, WIP commits, the next command) | as `auto` |
399
425
 
@@ -802,7 +828,7 @@ merge now. Delegating that judgement is how a pipeline ends up declared green by
802
828
  cheapest to ask, which is the one thing `$flow-work-green` exists to forbid. Delegate the waiting
803
829
  and the evidence; the verdict stays here.
804
830
 
805
- **Then end the turn.** Dispatching a supervisor and staying in a poll loop of your own pays both
831
+ **Then end the turn** — except in `unattended`, below. Dispatching a supervisor and staying in a poll loop of your own pays both
806
832
  bills and saves nothing. What wakes you is whatever the harness offers — a background task that
807
833
  re-invokes you when it finishes, a scheduled wake-up, a message back to this thread; where it offers
808
834
  none, the supervisor's evidence file is read at your next stop, and **you say that** rather than
@@ -819,6 +845,21 @@ moving.
819
845
  than to run — the brief, the round trip and the report are the whole of the saving. And anything you
820
846
  must *react to* mid-wait is not a wait at all: it is the work, and it stays here.
821
847
 
848
+ **In `unattended`, the wait stays in the turn** (§2.1). Nobody can bring back a run whose turn
849
+ ended, and whether a headless harness re-invokes a run when its background task finishes is not
850
+ something the run can count on. So no supervisor and no ending the turn: the wait is sat through
851
+ here, on the condition it waits for, with a deadline —
852
+
853
+ - **In the foreground**, when the command fits the harness's own limit for one call.
854
+ - **Otherwise launched with its exit code written to a file**, then waited on by a loop that checks
855
+ for that file every few seconds and stops at the deadline — one tool call per stretch, each under
856
+ that same limit, repeated until the file appears or the deadline passes. The loop runs inside the
857
+ call, so its cycles cost nothing on this thread.
858
+ - **Never a fixed-length sleep.** A guessed duration pays the whole sleep when the suite finished in
859
+ a fraction of it, and wakes before the suite when the guess is short.
860
+
861
+ The deadline reached with nothing back → `blocked`, naming the command and how long it ran.
862
+
822
863
  ### 6.6 — Which agent a role resolves to
823
864
 
824
865
  **The harness already tells you which agents are installed**, each with a line on what it is for,
@@ -75,7 +75,9 @@ In `unattended` (flow-core §2.1) nobody is there to answer: write the brief, ma
75
75
  `recorded (unattended)` under its heading, record the site in `meta.json.defaults_used[]`, and fix.
76
76
  The gate's purpose moves to the draft MR/PR, whose body carries the brief for the person who reads it.
77
77
  **A schema change or migration is still a question** (`migration`): before writing the first line
78
- of one → the question stop, end the run. The orchestrator's answer re-enters here
78
+ of one → the question stop, end the run — unless `approved-schema.md` lists every object it
79
+ creates, alters or drops (flow-core §2, a schema approved with the study): then write it, record
80
+ it there, do not stop. The orchestrator's answer re-enters here
79
81
  exactly as `$flow-feat-build §2` says, with `04-fix.md` for `05-implementation.md` and
80
82
  `$flow-bug-validate` as the phase it chains into after a review's *Fix them* (`$flow-bug-review`
81
83
  for XS, which has no validate).
@@ -41,7 +41,7 @@ Read `~/.claude/flow/CORE.codex.md` first (shared rules: `FLOW.md` step 0, model
41
41
 
42
42
  Then:
43
43
  1. Run only that test with `quality.test_one` from FLOW.md; it must pass.
44
- 2. Run the full suite with `quality.test` to rule out collateral regressions (in the background if slow; measured in tens of minutes → delegate it as a wait to a supervisor subagent on `models.supervisors`, flow-core §6.5 — it returns the exit code and the failing output, and the reading of them stays here).
44
+ 2. Run the full suite with `quality.test` to rule out collateral regressions (in the background if slow — in `unattended`, waited on in this turn, flow-core §6.5; otherwise, measured in tens of minutes → delegate it as a wait to a supervisor subagent on `models.supervisors`, flow-core §6.5 — it returns the exit code and the failing output, and the reading of them stays here).
45
45
  3. DB touched → verify the schema has no unexpected differences (`quality.db_update` or the FLOW.md equivalent, if defined; in `unattended` it is never run without an answer — a schema difference to apply is question
46
46
  `migration`, flow-core §2.1; the orchestrator's *Apply it* relaunches this phase, this site takes the
47
47
  answer just applied and runs it, and `05-validation.md` names that answer beside the migration).
@@ -82,7 +82,9 @@ In `unattended` (flow-core §2.1) nobody is there to answer: write the brief, ma
82
82
  `recorded (unattended)` under its heading, record the site in `meta.json.defaults_used[]`, and build.
83
83
  The gate's purpose moves to the draft MR/PR, whose body carries the brief for the person who reads it.
84
84
  **A schema change or migration is still a question** (`migration`): before writing the first line
85
- of one → the question stop, end the run. The orchestrator's answer re-enters here
85
+ of one → the question stop, end the run — unless `approved-schema.md` lists every object it
86
+ creates, alters or drops (flow-core §2, a schema approved with the study): then write it, record
87
+ it there, do not stop. The orchestrator's answer re-enters here
86
88
  (flow-core §2.1): the brief, the contracts and the plan are already written — keep them — and the
87
89
  MR/PR is the one already `in_progress`, not a new pick. *Write it and continue* → the first unticked
88
90
  step, the migration included · *Change the design first* → `blocked`. A plan step marked approved
@@ -228,7 +228,7 @@ Consolidate outputs into `.claude/work/<TICKET>/03-design.md`:
228
228
 
229
229
  ## Data model
230
230
  - New / modified entities: <for each new one, indicate "no equivalent found" or "knowingly duplicated because...">
231
- - Migrations:
231
+ - Migrations: <each table, column, index, constraint and data copy created, altered or dropped, by name — approving the study approves exactly this list (flow-core §2, a schema approved with the study)>
232
232
  - Indexes:
233
233
 
234
234
  ### Access paths
@@ -302,7 +302,7 @@ Not run for XS/S, small diffs, or fewer than 4 ambiguous findings. When skipped,
302
302
 
303
303
  Read `quality.*` from `FLOW.md`. Empty → auto-discover equivalent commands (Makefile, npm/composer scripts, Gradle, dotnet, Xcode, Flutter…) and note what you use.
304
304
 
305
- Launch in parallel (background if slow):
305
+ Launch in parallel (background if slow; in `unattended`, waited on in this turn, flow-core §6.5):
306
306
  - `quality.style_fix`
307
307
  - `quality.static_analysis`
308
308
  - `quality.test_one` (if there are new tests, with the appropriate filter)
@@ -403,4 +403,6 @@ Write `.claude/work/<TICKET>/06-review.md`. The `Cost:` line of `## Summary` is
403
403
  unticked step under this MR/PR's plan in `05-implementation.md` (`04-fix.md` for a bug), leaves
404
404
  `phase = build` (`fix`), and chains into `$flow-feat-build` (`$flow-bug-fix`), which builds those
405
405
  steps and chains back here — a bug through `$flow-bug-validate` first, as its order has it. A migration one of this round's fixes needs is question `migration`
406
- asked here — after `high_findings`, in its own stop — and answered the same way (flow-core §2.1).
406
+ asked here — after `high_findings`, in its own stop — and answered the same way (flow-core §2.1),
407
+ unless `approved-schema.md` lists every object it writes (flow-core §2): then it is an ordinary
408
+ step, and build writes it without asking.
@@ -46,7 +46,7 @@ One of the three below writes and two of them read, so they do not all go at onc
46
46
 
47
47
  **A green suite is not a performance result** — a tiny fixture database proves a query's **rows**, never its **plan**. If `$flow-feat-review §3.6` left any query verdict `unresolved`, or an acceptance criterion concerns speed or volume: run the measurement of **`$flow-work-query §4`** with the volumes in `data.volumes` (or a data set shaped like them — the distribution matters more than the total), record plan and timings, and gate on the result. No `data.*` configuration and the criterion cannot be measured → it is `unproven` with the reason, never silently `proven`.
48
48
 
49
- 3. **Full suite**: run `quality.test` from `FLOW.md` in the background; if empty, auto-discover the project's test command and note what you use. **A suite measured in tens of minutes is a wait, not a step**: hand it to a supervisor subagent on `models.supervisors` (flow-core §6.5) — it runs it, times out, and brings back the exit code plus the failing tests' output, never a reading of whether those failures matter. Short suites stay here; delegating ninety seconds costs more than running them. A repo with more than one suite chains them in that one key (`make test && make test-frontend`); when it does not and the diff touches a suite the key misses, run that one too and say so in one line.
49
+ 3. **Full suite**: run `quality.test` from `FLOW.md` in the background (in `unattended`, waited on in this turn, flow-core §6.5); if empty, auto-discover the project's test command and note what you use. **A suite measured in tens of minutes is a wait, not a step**: hand it to a supervisor subagent on `models.supervisors` (flow-core §6.5) — it runs it, times out, and brings back the exit code plus the failing tests' output, never a reading of whether those failures matter. Short suites stay here; delegating ninety seconds costs more than running them. A repo with more than one suite chains them in that one key (`make test && make test-frontend`); when it does not and the diff touches a suite the key misses, run that one too and say so in one line.
50
50
 
51
51
  ## 3. Criteria coverage (S and larger)
52
52
 
@@ -108,6 +108,15 @@ Show the branch, the remote and the file list the build printed — every path,
108
108
  ask with `AskUserQuestion` **in every `autonomy.mode`**: a push leaves the machine (flow-core §2).
109
109
  **Push** · **Cancel**. Nothing between the list and the question (flow-core §3).
110
110
 
111
+ **A study that changes the schema** — its `## Schema changes` section (§5) is not `none` — shows
112
+ that section too, under the file list, and the same question carries the approval: **Push — schema
113
+ approved** · **Push — build asks first** · **Cancel**. Whoever builds it can ask no one about what
114
+ the person here already read. *Push — schema approved* → write `approved-schema.md` in the work
115
+ folder (flow-core §2, a schema approved with the study: `Approved at handoff, <date>`, then the
116
+ section verbatim), run the build block again, check its file list is the one shown plus that file,
117
+ and push that commit. *Push — build asks first* → push as it stands: build will ask `migration`
118
+ before writing the first line of it.
119
+
111
120
  ```bash handoff-push
112
121
  BRANCH='@BRANCH@'; COMMIT='@COMMIT@'
113
122
  case "$COMMIT" in ''|*[!0-9a-f]*) echo "not a commit sha: $COMMIT"; exit 1 ;; esac
@@ -144,6 +153,7 @@ the ticket read it there, never in the work folder; the receiver does not parse
144
153
  ## Acceptance criteria
145
154
  ## Design in brief
146
155
  ## MR/PR plan
156
+ ## Schema changes
147
157
  ## Risks
148
158
  <!-- end flow-study -->
149
159
  ```
@@ -152,6 +162,9 @@ the ticket read it there, never in the work folder; the receiver does not parse
152
162
  entry and its why — `Depends on #253: <why>` — so whoever approves the study sees what it waits
153
163
  for; an unattended study's `done-summary.md` is this block, so it carries them too. The plan
154
164
  lists each MR/PR with what it covers and what it waits on; a bug's plan is its single fix.
165
+ `## Schema changes` lists, one line each and by name, every table, column, index, constraint and
166
+ data copy the study's migrations create, alter or drop (flow-core §2, a schema approved with the
167
+ study), or says `none` — it is what approving the study approves, so nothing there is prose.
155
168
  - **The new body**: the body read above with the block between the two markers replaced — or, with
156
169
  no markers yet, the block appended after a blank line. Then, for each `meta.json.ticket_deps`
157
170
  entry (`$flow-feat-design` §5.1) whose line is not already a line of that body — same text,
@@ -107,6 +107,13 @@ record `{ "key": "unattended:base-caught-up", "default": "<old short sha> → <n
107
107
  ancestor → it holds commits a previous run made: leave it as it is — bringing the base into work in
108
108
  progress is the orchestrator's (flow-core §2.1).
109
109
 
110
+ **On `start`, an approved study run approves its schema** — only while no build or fix has begun,
111
+ `done-summary.md` exists (the summary a person approved) and `approved-schema.md` does not. Its
112
+ `## Schema changes` section names something → write `approved-schema.md` (flow-core §2, a schema
113
+ approved with the study: `Approved with the study run, <date>`, then the section verbatim) and
114
+ record `{ "key": "unattended:schema-approved", "default": "<n> object(s)", "phase": "run" }`. The
115
+ section says `none`, or is missing → nothing is written, and build asks as it always did.
116
+
110
117
  **A person's changes to a study, on `study`** (flow-core §2.1: they rewind it). The work's branch
111
118
  first, as above. `<work>/study-revision.md` holds the reply, as the row above wrote it. Each step
112
119
  can be run again: a run that dies part-way is finished by the next relaunch, whatever it serves.
@@ -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.95.0`.** Compare it once, at the start of the session, against
19
+ **This file belongs to flow `0.96.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
@@ -224,7 +224,8 @@ the value someone wrote in the FLOW config, or it is not in effect.
224
224
  each one resolves as §2.1's table says — never approved in silence):
225
225
  1. Any push or MR/PR creation (all of `ship`).
226
226
  2. Creating or switching a branch when the base is ambiguous (not on a clean main, or a possible train/stacked branch).
227
- 3. DB schema changes or migrations.
227
+ 3. DB schema changes or migrations — writing one a schema approved with the study already lists is
228
+ not asked again (below); applying one always is.
228
229
  4. A `review` that surfaced high-severity findings — never chain into `ship` on those.
229
230
  5. The business brief written before touching code (`build`, `fix`).
230
231
 
@@ -261,6 +262,30 @@ studies a ticket there goes on to build it — unless the orchestrator launched
261
262
  (§2.1), which stops at the door to code. With `autonomy.mode: auto`, a `--study` work runs on its
262
263
  own up to the push.
263
264
 
265
+ **A schema approved with the study.** A study that changes the schema says so literally: the
266
+ `## Schema changes` section of the `flow-study` block (`/flow:work:handoff` §5) lists, one line
267
+ each and by name, every table, column, index, constraint and data copy its migrations create,
268
+ alter or drop — from `03-design.md` "Data model", the intended fix of `03-investigation.md` for a
269
+ bug — or says `none`. Approving the study approves that list, and the approval is a file in the
270
+ work folder, `approved-schema.md`: a first line saying where it was approved (`Approved at
271
+ handoff, <date>` · `Approved with the study run, <date>`), then the section verbatim. Two places
272
+ write it and nothing else does — the handoff push answered **Push — schema approved**
273
+ (`/flow:work:handoff` §4), and `/flow:work:run` §2 when the orchestrator approves a study run with
274
+ `why = start`. Then, in every mode:
275
+
276
+ - **Writing** a migration — in `build`, in `fix`, or for a fix a review asks for — whose every
277
+ object created, altered or dropped is on that list is not asked: write it, add
278
+ `{ "key": "study:approved-schema", "default": "<the objects it writes>", "phase": "<phase>" }` to
279
+ `meta.json.defaults_used[]`, and one line under "Decisions made during implementation" naming
280
+ `approved-schema.md`.
281
+ - **Anything the list does not name** — one more column, an index, a drop, a type beyond what its
282
+ line says — is hard gate 3 as always, and the question names what lies beyond the list, so the
283
+ person decides on the difference alone.
284
+ - **Applying** a migration (`validate`) and the pre-deploy SQL (`ship`) are asked as before: the
285
+ study approved what the schema becomes, not when a database changes.
286
+ - A study revision (`/flow:work:run` §2) moves `approved-schema.md` aside with the rest of the
287
+ study; the new summary is approved anew.
288
+
264
289
  ### 2.1 `unattended` — where a person would have been asked
265
290
 
266
291
  No person is there to answer a question in this mode. A question tool — `AskUserQuestion`, OpenCode's `question`,
@@ -372,7 +397,7 @@ person asking for changes, a ticket that already has code — is `/flow:work:run
372
397
  | Business brief before code (`build`, `fix`) | record — the brief is written to the phase artifact, marked `recorded (unattended)`, and travels in the MR/PR body |
373
398
  | The door to code in a study run (`build`, `fix` pre-flight) | done — `done-summary.md`, the study as `/flow:work:handoff` §5 writes it for the ticket, and one `--depends-on` per `meta.json.ticket_deps` entry |
374
399
  | Push and MR/PR creation (`ship`) | `publish` — the run commits on its own branch, writes title and body, and hands them over; the orchestrator pushes and opens the draft |
375
- | 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` |
400
+ | 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) |
376
401
  | `review` with blockers or high-severity findings | question `high_findings` |
377
402
  | `validate` with a red suite or a criterion `unproven` | blocked — the phase does not advance and does not chain. **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 → 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". Short of all three — a failure the base does not reproduce, a base that cannot be run, a test this diff touched — blocked |
378
403
  | A product decision (§7 `decision`) | question `decision` |
@@ -393,6 +418,7 @@ person asking for changes, a ticket that already has code — is `/flow:work:run
393
418
  | An approved study's branch (`run`, `why = start`, no build or fix begun) | record — fast-forwarded to its base when it holds no commit of its own (`/flow:work:run` §2); the base unreadable or the fast-forward failing → blocked. Not integrating: nothing of the run's is merged |
394
419
  | Integrating the base into the MR/PR's branch (`green`) | on `why = conflict`, record — `git merge origin/<base>` as the orchestrator left it, never rebase, each conflict resolved on its merits (`/flow:work:green` §5.C); on any other `why`, blocked — the orchestrator brings the base in |
395
420
  | Any offer about the work's own bookkeeping — a tracker issue, the first `KNOWLEDGE.md` or a knowledge save, a FLOW convention, an agent lesson or a saved specialist, the follow-up survey, carrying files over from the main checkout, a contract handoff, archiving the work | record — `Later`; nothing written outside the work folder |
421
+ | A wait — a suite, a quality gate, anything run in the background (`validate`, `review`) | in the turn, on its condition, with a deadline (§6.5) — never a supervisor, never a fixed-length sleep, never ending the turn to be woken |
396
422
  | A step the command cannot complete (a red suite it cannot fix, a tool missing, auth failing, the same check failing a second time) | blocked |
397
423
  | Anything `auto` already decides on its own (size, flow mechanics, WIP commits, the next command) | as `auto` |
398
424
 
@@ -801,7 +827,7 @@ merge now. Delegating that judgement is how a pipeline ends up declared green by
801
827
  cheapest to ask, which is the one thing `/flow:work:green` exists to forbid. Delegate the waiting
802
828
  and the evidence; the verdict stays here.
803
829
 
804
- **Then end the turn.** Dispatching a supervisor and staying in a poll loop of your own pays both
830
+ **Then end the turn** — except in `unattended`, below. Dispatching a supervisor and staying in a poll loop of your own pays both
805
831
  bills and saves nothing. What wakes you is whatever the harness offers — a background task that
806
832
  re-invokes you when it finishes, a scheduled wake-up, a message back to this thread; where it offers
807
833
  none, the supervisor's evidence file is read at your next stop, and **you say that** rather than
@@ -818,6 +844,21 @@ moving.
818
844
  than to run — the brief, the round trip and the report are the whole of the saving. And anything you
819
845
  must *react to* mid-wait is not a wait at all: it is the work, and it stays here.
820
846
 
847
+ **In `unattended`, the wait stays in the turn** (§2.1). Nobody can bring back a run whose turn
848
+ ended, and whether a headless harness re-invokes a run when its background task finishes is not
849
+ something the run can count on. So no supervisor and no ending the turn: the wait is sat through
850
+ here, on the condition it waits for, with a deadline —
851
+
852
+ - **In the foreground**, when the command fits the harness's own limit for one call.
853
+ - **Otherwise launched with its exit code written to a file**, then waited on by a loop that checks
854
+ for that file every few seconds and stops at the deadline — one tool call per stretch, each under
855
+ that same limit, repeated until the file appears or the deadline passes. The loop runs inside the
856
+ call, so its cycles cost nothing on this thread.
857
+ - **Never a fixed-length sleep.** A guessed duration pays the whole sleep when the suite finished in
858
+ a fraction of it, and wakes before the suite when the guess is short.
859
+
860
+ The deadline reached with nothing back → `blocked`, naming the command and how long it ran.
861
+
821
862
  ### 6.6 — Which agent a role resolves to
822
863
 
823
864
  **The harness already tells you which agents are installed**, each with a line on what it is for,
@@ -71,7 +71,9 @@ In `unattended` (flow-core §2.1) nobody is there to answer: write the brief, ma
71
71
  `recorded (unattended)` under its heading, record the site in `meta.json.defaults_used[]`, and fix.
72
72
  The gate's purpose moves to the draft MR/PR, whose body carries the brief for the person who reads it.
73
73
  **A schema change or migration is still a question** (`migration`): before writing the first line
74
- of one → the question stop, end the run. The orchestrator's answer re-enters here
74
+ of one → the question stop, end the run — unless `approved-schema.md` lists every object it
75
+ creates, alters or drops (flow-core §2, a schema approved with the study): then write it, record
76
+ it there, do not stop. The orchestrator's answer re-enters here
75
77
  exactly as `/flow:feat:build §2` says, with `04-fix.md` for `05-implementation.md` and
76
78
  `/flow:bug:validate` as the phase it chains into after a review's *Fix them* (`/flow:bug:review`
77
79
  for XS, which has no validate).
@@ -37,7 +37,7 @@ Read `~/.claude/flow/CORE.gemini.md` first (shared rules: `FLOW.md` step 0, mode
37
37
 
38
38
  Then:
39
39
  1. Run only that test with `quality.test_one` from FLOW.md; it must pass.
40
- 2. Run the full suite with `quality.test` to rule out collateral regressions (in the background if slow; measured in tens of minutes → delegate it as a wait to a supervisor subagent on `models.supervisors`, flow-core §6.5 — it returns the exit code and the failing output, and the reading of them stays here).
40
+ 2. Run the full suite with `quality.test` to rule out collateral regressions (in the background if slow — in `unattended`, waited on in this turn, flow-core §6.5; otherwise, measured in tens of minutes → delegate it as a wait to a supervisor subagent on `models.supervisors`, flow-core §6.5 — it returns the exit code and the failing output, and the reading of them stays here).
41
41
  3. DB touched → verify the schema has no unexpected differences (`quality.db_update` or the FLOW.md equivalent, if defined; in `unattended` it is never run without an answer — a schema difference to apply is question
42
42
  `migration`, flow-core §2.1; the orchestrator's *Apply it* relaunches this phase, this site takes the
43
43
  answer just applied and runs it, and `05-validation.md` names that answer beside the migration).
@@ -78,7 +78,9 @@ In `unattended` (flow-core §2.1) nobody is there to answer: write the brief, ma
78
78
  `recorded (unattended)` under its heading, record the site in `meta.json.defaults_used[]`, and build.
79
79
  The gate's purpose moves to the draft MR/PR, whose body carries the brief for the person who reads it.
80
80
  **A schema change or migration is still a question** (`migration`): before writing the first line
81
- of one → the question stop, end the run. The orchestrator's answer re-enters here
81
+ of one → the question stop, end the run — unless `approved-schema.md` lists every object it
82
+ creates, alters or drops (flow-core §2, a schema approved with the study): then write it, record
83
+ it there, do not stop. The orchestrator's answer re-enters here
82
84
  (flow-core §2.1): the brief, the contracts and the plan are already written — keep them — and the
83
85
  MR/PR is the one already `in_progress`, not a new pick. *Write it and continue* → the first unticked
84
86
  step, the migration included · *Change the design first* → `blocked`. A plan step marked approved
@@ -224,7 +224,7 @@ Consolidate outputs into `.claude/work/<TICKET>/03-design.md`:
224
224
 
225
225
  ## Data model
226
226
  - New / modified entities: <for each new one, indicate "no equivalent found" or "knowingly duplicated because...">
227
- - Migrations:
227
+ - Migrations: <each table, column, index, constraint and data copy created, altered or dropped, by name — approving the study approves exactly this list (flow-core §2, a schema approved with the study)>
228
228
  - Indexes:
229
229
 
230
230
  ### Access paths
@@ -298,7 +298,7 @@ Not run for XS/S, small diffs, or fewer than 4 ambiguous findings. When skipped,
298
298
 
299
299
  Read `quality.*` from `FLOW.md`. Empty → auto-discover equivalent commands (Makefile, npm/composer scripts, Gradle, dotnet, Xcode, Flutter…) and note what you use.
300
300
 
301
- Launch in parallel (background if slow):
301
+ Launch in parallel (background if slow; in `unattended`, waited on in this turn, flow-core §6.5):
302
302
  - `quality.style_fix`
303
303
  - `quality.static_analysis`
304
304
  - `quality.test_one` (if there are new tests, with the appropriate filter)
@@ -399,5 +399,7 @@ Write `.claude/work/<TICKET>/06-review.md`. The `Cost:` line of `## Summary` is
399
399
  unticked step under this MR/PR's plan in `05-implementation.md` (`04-fix.md` for a bug), leaves
400
400
  `phase = build` (`fix`), and chains into `/flow:feat:build` (`/flow:bug:fix`), which builds those
401
401
  steps and chains back here — a bug through `/flow:bug:validate` first, as its order has it. A migration one of this round's fixes needs is question `migration`
402
- asked here — after `high_findings`, in its own stop — and answered the same way (flow-core §2.1).
402
+ asked here — after `high_findings`, in its own stop — and answered the same way (flow-core §2.1),
403
+ unless `approved-schema.md` lists every object it writes (flow-core §2): then it is an ordinary
404
+ step, and build writes it without asking.
403
405
  """
@@ -42,7 +42,7 @@ One of the three below writes and two of them read, so they do not all go at onc
42
42
 
43
43
  **A green suite is not a performance result** — a tiny fixture database proves a query's **rows**, never its **plan**. If `/flow:feat:review §3.6` left any query verdict `unresolved`, or an acceptance criterion concerns speed or volume: run the measurement of **`/flow:work:query §4`** with the volumes in `data.volumes` (or a data set shaped like them — the distribution matters more than the total), record plan and timings, and gate on the result. No `data.*` configuration and the criterion cannot be measured → it is `unproven` with the reason, never silently `proven`.
44
44
 
45
- 3. **Full suite**: run `quality.test` from `FLOW.md` in the background; if empty, auto-discover the project's test command and note what you use. **A suite measured in tens of minutes is a wait, not a step**: hand it to a supervisor subagent on `models.supervisors` (flow-core §6.5) — it runs it, times out, and brings back the exit code plus the failing tests' output, never a reading of whether those failures matter. Short suites stay here; delegating ninety seconds costs more than running them. A repo with more than one suite chains them in that one key (`make test && make test-frontend`); when it does not and the diff touches a suite the key misses, run that one too and say so in one line.
45
+ 3. **Full suite**: run `quality.test` from `FLOW.md` in the background (in `unattended`, waited on in this turn, flow-core §6.5); if empty, auto-discover the project's test command and note what you use. **A suite measured in tens of minutes is a wait, not a step**: hand it to a supervisor subagent on `models.supervisors` (flow-core §6.5) — it runs it, times out, and brings back the exit code plus the failing tests' output, never a reading of whether those failures matter. Short suites stay here; delegating ninety seconds costs more than running them. A repo with more than one suite chains them in that one key (`make test && make test-frontend`); when it does not and the diff touches a suite the key misses, run that one too and say so in one line.
46
46
 
47
47
  ## 3. Criteria coverage (S and larger)
48
48
 
@@ -104,6 +104,15 @@ Show the branch, the remote and the file list the build printed — every path,
104
104
  ask with `AskUserQuestion` **in every `autonomy.mode`**: a push leaves the machine (flow-core §2).
105
105
  **Push** · **Cancel**. Nothing between the list and the question (flow-core §3).
106
106
 
107
+ **A study that changes the schema** — its `## Schema changes` section (§5) is not `none` — shows
108
+ that section too, under the file list, and the same question carries the approval: **Push — schema
109
+ approved** · **Push — build asks first** · **Cancel**. Whoever builds it can ask no one about what
110
+ the person here already read. *Push — schema approved* → write `approved-schema.md` in the work
111
+ folder (flow-core §2, a schema approved with the study: `Approved at handoff, <date>`, then the
112
+ section verbatim), run the build block again, check its file list is the one shown plus that file,
113
+ and push that commit. *Push — build asks first* → push as it stands: build will ask `migration`
114
+ before writing the first line of it.
115
+
107
116
  ```bash handoff-push
108
117
  BRANCH='@BRANCH@'; COMMIT='@COMMIT@'
109
118
  case "$COMMIT" in ''|*[!0-9a-f]*) echo "not a commit sha: $COMMIT"; exit 1 ;; esac
@@ -140,6 +149,7 @@ the ticket read it there, never in the work folder; the receiver does not parse
140
149
  ## Acceptance criteria
141
150
  ## Design in brief
142
151
  ## MR/PR plan
152
+ ## Schema changes
143
153
  ## Risks
144
154
  <!-- end flow-study -->
145
155
  ```
@@ -148,6 +158,9 @@ the ticket read it there, never in the work folder; the receiver does not parse
148
158
  entry and its why — `Depends on #253: <why>` — so whoever approves the study sees what it waits
149
159
  for; an unattended study's `done-summary.md` is this block, so it carries them too. The plan
150
160
  lists each MR/PR with what it covers and what it waits on; a bug's plan is its single fix.
161
+ `## Schema changes` lists, one line each and by name, every table, column, index, constraint and
162
+ data copy the study's migrations create, alter or drop (flow-core §2, a schema approved with the
163
+ study), or says `none` — it is what approving the study approves, so nothing there is prose.
151
164
  - **The new body**: the body read above with the block between the two markers replaced — or, with
152
165
  no markers yet, the block appended after a blank line. Then, for each `meta.json.ticket_deps`
153
166
  entry (`/flow:feat:design` §5.1) whose line is not already a line of that body — same text,
@@ -103,6 +103,13 @@ record `{ "key": "unattended:base-caught-up", "default": "<old short sha> → <n
103
103
  ancestor → it holds commits a previous run made: leave it as it is — bringing the base into work in
104
104
  progress is the orchestrator's (flow-core §2.1).
105
105
 
106
+ **On `start`, an approved study run approves its schema** — only while no build or fix has begun,
107
+ `done-summary.md` exists (the summary a person approved) and `approved-schema.md` does not. Its
108
+ `## Schema changes` section names something → write `approved-schema.md` (flow-core §2, a schema
109
+ approved with the study: `Approved with the study run, <date>`, then the section verbatim) and
110
+ record `{ "key": "unattended:schema-approved", "default": "<n> object(s)", "phase": "run" }`. The
111
+ section says `none`, or is missing → nothing is written, and build asks as it always did.
112
+
106
113
  **A person's changes to a study, on `study`** (flow-core §2.1: they rewind it). The work's branch
107
114
  first, as above. `<work>/study-revision.md` holds the reply, as the row above wrote it. Each step
108
115
  can be run again: a run that dies part-way is finished by the next relaunch, whatever it serves.
@@ -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.95.0`.** Compare it once, at the start of the session, against
20
+ **This file belongs to flow `0.96.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
@@ -225,7 +225,8 @@ the value someone wrote in the FLOW config, or it is not in effect.
225
225
  each one resolves as §2.1's table says — never approved in silence):
226
226
  1. Any push or MR/PR creation (all of `ship`).
227
227
  2. Creating or switching a branch when the base is ambiguous (not on a clean main, or a possible train/stacked branch).
228
- 3. DB schema changes or migrations.
228
+ 3. DB schema changes or migrations — writing one a schema approved with the study already lists is
229
+ not asked again (below); applying one always is.
229
230
  4. A `review` that surfaced high-severity findings — never chain into `ship` on those.
230
231
  5. The business brief written before touching code (`build`, `fix`).
231
232
 
@@ -262,6 +263,30 @@ studies a ticket there goes on to build it — unless the orchestrator launched
262
263
  (§2.1), which stops at the door to code. With `autonomy.mode: auto`, a `--study` work runs on its
263
264
  own up to the push.
264
265
 
266
+ **A schema approved with the study.** A study that changes the schema says so literally: the
267
+ `## Schema changes` section of the `flow-study` block (`/flow-work-handoff` §5) lists, one line
268
+ each and by name, every table, column, index, constraint and data copy its migrations create,
269
+ alter or drop — from `03-design.md` "Data model", the intended fix of `03-investigation.md` for a
270
+ bug — or says `none`. Approving the study approves that list, and the approval is a file in the
271
+ work folder, `approved-schema.md`: a first line saying where it was approved (`Approved at
272
+ handoff, <date>` · `Approved with the study run, <date>`), then the section verbatim. Two places
273
+ write it and nothing else does — the handoff push answered **Push — schema approved**
274
+ (`/flow-work-handoff` §4), and `/flow-work-run` §2 when the orchestrator approves a study run with
275
+ `why = start`. Then, in every mode:
276
+
277
+ - **Writing** a migration — in `build`, in `fix`, or for a fix a review asks for — whose every
278
+ object created, altered or dropped is on that list is not asked: write it, add
279
+ `{ "key": "study:approved-schema", "default": "<the objects it writes>", "phase": "<phase>" }` to
280
+ `meta.json.defaults_used[]`, and one line under "Decisions made during implementation" naming
281
+ `approved-schema.md`.
282
+ - **Anything the list does not name** — one more column, an index, a drop, a type beyond what its
283
+ line says — is hard gate 3 as always, and the question names what lies beyond the list, so the
284
+ person decides on the difference alone.
285
+ - **Applying** a migration (`validate`) and the pre-deploy SQL (`ship`) are asked as before: the
286
+ study approved what the schema becomes, not when a database changes.
287
+ - A study revision (`/flow-work-run` §2) moves `approved-schema.md` aside with the rest of the
288
+ study; the new summary is approved anew.
289
+
265
290
  ### 2.1 `unattended` — where a person would have been asked
266
291
 
267
292
  No person is there to answer a question in this mode. A question tool — `AskUserQuestion`, OpenCode's `question`,
@@ -373,7 +398,7 @@ person asking for changes, a ticket that already has code — is `/flow-work-run
373
398
  | Business brief before code (`build`, `fix`) | record — the brief is written to the phase artifact, marked `recorded (unattended)`, and travels in the MR/PR body |
374
399
  | The door to code in a study run (`build`, `fix` pre-flight) | done — `done-summary.md`, the study as `/flow-work-handoff` §5 writes it for the ticket, and one `--depends-on` per `meta.json.ticket_deps` entry |
375
400
  | Push and MR/PR creation (`ship`) | `publish` — the run commits on its own branch, writes title and body, and hands them over; the orchestrator pushes and opens the draft |
376
- | 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` |
401
+ | 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) |
377
402
  | `review` with blockers or high-severity findings | question `high_findings` |
378
403
  | `validate` with a red suite or a criterion `unproven` | blocked — the phase does not advance and does not chain. **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 → 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". Short of all three — a failure the base does not reproduce, a base that cannot be run, a test this diff touched — blocked |
379
404
  | A product decision (§7 `decision`) | question `decision` |
@@ -394,6 +419,7 @@ person asking for changes, a ticket that already has code — is `/flow-work-run
394
419
  | An approved study's branch (`run`, `why = start`, no build or fix begun) | record — fast-forwarded to its base when it holds no commit of its own (`/flow-work-run` §2); the base unreadable or the fast-forward failing → blocked. Not integrating: nothing of the run's is merged |
395
420
  | Integrating the base into the MR/PR's branch (`green`) | on `why = conflict`, record — `git merge origin/<base>` as the orchestrator left it, never rebase, each conflict resolved on its merits (`/flow-work-green` §5.C); on any other `why`, blocked — the orchestrator brings the base in |
396
421
  | Any offer about the work's own bookkeeping — a tracker issue, the first `KNOWLEDGE.md` or a knowledge save, a FLOW convention, an agent lesson or a saved specialist, the follow-up survey, carrying files over from the main checkout, a contract handoff, archiving the work | record — `Later`; nothing written outside the work folder |
422
+ | A wait — a suite, a quality gate, anything run in the background (`validate`, `review`) | in the turn, on its condition, with a deadline (§6.5) — never a supervisor, never a fixed-length sleep, never ending the turn to be woken |
397
423
  | A step the command cannot complete (a red suite it cannot fix, a tool missing, auth failing, the same check failing a second time) | blocked |
398
424
  | Anything `auto` already decides on its own (size, flow mechanics, WIP commits, the next command) | as `auto` |
399
425
 
@@ -802,7 +828,7 @@ merge now. Delegating that judgement is how a pipeline ends up declared green by
802
828
  cheapest to ask, which is the one thing `/flow-work-green` exists to forbid. Delegate the waiting
803
829
  and the evidence; the verdict stays here.
804
830
 
805
- **Then end the turn.** Dispatching a supervisor and staying in a poll loop of your own pays both
831
+ **Then end the turn** — except in `unattended`, below. Dispatching a supervisor and staying in a poll loop of your own pays both
806
832
  bills and saves nothing. What wakes you is whatever the harness offers — a background task that
807
833
  re-invokes you when it finishes, a scheduled wake-up, a message back to this thread; where it offers
808
834
  none, the supervisor's evidence file is read at your next stop, and **you say that** rather than
@@ -819,6 +845,21 @@ moving.
819
845
  than to run — the brief, the round trip and the report are the whole of the saving. And anything you
820
846
  must *react to* mid-wait is not a wait at all: it is the work, and it stays here.
821
847
 
848
+ **In `unattended`, the wait stays in the turn** (§2.1). Nobody can bring back a run whose turn
849
+ ended, and whether a headless harness re-invokes a run when its background task finishes is not
850
+ something the run can count on. So no supervisor and no ending the turn: the wait is sat through
851
+ here, on the condition it waits for, with a deadline —
852
+
853
+ - **In the foreground**, when the command fits the harness's own limit for one call.
854
+ - **Otherwise launched with its exit code written to a file**, then waited on by a loop that checks
855
+ for that file every few seconds and stops at the deadline — one tool call per stretch, each under
856
+ that same limit, repeated until the file appears or the deadline passes. The loop runs inside the
857
+ call, so its cycles cost nothing on this thread.
858
+ - **Never a fixed-length sleep.** A guessed duration pays the whole sleep when the suite finished in
859
+ a fraction of it, and wakes before the suite when the guess is short.
860
+
861
+ The deadline reached with nothing back → `blocked`, naming the command and how long it ran.
862
+
822
863
  ### 6.6 — Which agent a role resolves to
823
864
 
824
865
  **The harness already tells you which agents are installed**, each with a line on what it is for,
@@ -75,7 +75,9 @@ In `unattended` (flow-core §2.1) nobody is there to answer: write the brief, ma
75
75
  `recorded (unattended)` under its heading, record the site in `meta.json.defaults_used[]`, and fix.
76
76
  The gate's purpose moves to the draft MR/PR, whose body carries the brief for the person who reads it.
77
77
  **A schema change or migration is still a question** (`migration`): before writing the first line
78
- of one → the question stop, end the run. The orchestrator's answer re-enters here
78
+ of one → the question stop, end the run — unless `approved-schema.md` lists every object it
79
+ creates, alters or drops (flow-core §2, a schema approved with the study): then write it, record
80
+ it there, do not stop. The orchestrator's answer re-enters here
79
81
  exactly as `/flow-feat-build §2` says, with `04-fix.md` for `05-implementation.md` and
80
82
  `/flow-bug-validate` as the phase it chains into after a review's *Fix them* (`/flow-bug-review`
81
83
  for XS, which has no validate).
@@ -41,7 +41,7 @@ Read `~/.claude/flow/CORE.hermes.md` first (shared rules: `FLOW.md` step 0, mode
41
41
 
42
42
  Then:
43
43
  1. Run only that test with `quality.test_one` from FLOW.md; it must pass.
44
- 2. Run the full suite with `quality.test` to rule out collateral regressions (in the background if slow; measured in tens of minutes → delegate it as a wait to a supervisor subagent on `models.supervisors`, flow-core §6.5 — it returns the exit code and the failing output, and the reading of them stays here).
44
+ 2. Run the full suite with `quality.test` to rule out collateral regressions (in the background if slow — in `unattended`, waited on in this turn, flow-core §6.5; otherwise, measured in tens of minutes → delegate it as a wait to a supervisor subagent on `models.supervisors`, flow-core §6.5 — it returns the exit code and the failing output, and the reading of them stays here).
45
45
  3. DB touched → verify the schema has no unexpected differences (`quality.db_update` or the FLOW.md equivalent, if defined; in `unattended` it is never run without an answer — a schema difference to apply is question
46
46
  `migration`, flow-core §2.1; the orchestrator's *Apply it* relaunches this phase, this site takes the
47
47
  answer just applied and runs it, and `05-validation.md` names that answer beside the migration).
@@ -82,7 +82,9 @@ In `unattended` (flow-core §2.1) nobody is there to answer: write the brief, ma
82
82
  `recorded (unattended)` under its heading, record the site in `meta.json.defaults_used[]`, and build.
83
83
  The gate's purpose moves to the draft MR/PR, whose body carries the brief for the person who reads it.
84
84
  **A schema change or migration is still a question** (`migration`): before writing the first line
85
- of one → the question stop, end the run. The orchestrator's answer re-enters here
85
+ of one → the question stop, end the run — unless `approved-schema.md` lists every object it
86
+ creates, alters or drops (flow-core §2, a schema approved with the study): then write it, record
87
+ it there, do not stop. The orchestrator's answer re-enters here
86
88
  (flow-core §2.1): the brief, the contracts and the plan are already written — keep them — and the
87
89
  MR/PR is the one already `in_progress`, not a new pick. *Write it and continue* → the first unticked
88
90
  step, the migration included · *Change the design first* → `blocked`. A plan step marked approved
@@ -228,7 +228,7 @@ Consolidate outputs into `.claude/work/<TICKET>/03-design.md`:
228
228
 
229
229
  ## Data model
230
230
  - New / modified entities: <for each new one, indicate "no equivalent found" or "knowingly duplicated because...">
231
- - Migrations:
231
+ - Migrations: <each table, column, index, constraint and data copy created, altered or dropped, by name — approving the study approves exactly this list (flow-core §2, a schema approved with the study)>
232
232
  - Indexes:
233
233
 
234
234
  ### Access paths
@@ -302,7 +302,7 @@ Not run for XS/S, small diffs, or fewer than 4 ambiguous findings. When skipped,
302
302
 
303
303
  Read `quality.*` from `FLOW.md`. Empty → auto-discover equivalent commands (Makefile, npm/composer scripts, Gradle, dotnet, Xcode, Flutter…) and note what you use.
304
304
 
305
- Launch in parallel (background if slow):
305
+ Launch in parallel (background if slow; in `unattended`, waited on in this turn, flow-core §6.5):
306
306
  - `quality.style_fix`
307
307
  - `quality.static_analysis`
308
308
  - `quality.test_one` (if there are new tests, with the appropriate filter)
@@ -403,4 +403,6 @@ Write `.claude/work/<TICKET>/06-review.md`. The `Cost:` line of `## Summary` is
403
403
  unticked step under this MR/PR's plan in `05-implementation.md` (`04-fix.md` for a bug), leaves
404
404
  `phase = build` (`fix`), and chains into `/flow-feat-build` (`/flow-bug-fix`), which builds those
405
405
  steps and chains back here — a bug through `/flow-bug-validate` first, as its order has it. A migration one of this round's fixes needs is question `migration`
406
- asked here — after `high_findings`, in its own stop — and answered the same way (flow-core §2.1).
406
+ asked here — after `high_findings`, in its own stop — and answered the same way (flow-core §2.1),
407
+ unless `approved-schema.md` lists every object it writes (flow-core §2): then it is an ordinary
408
+ step, and build writes it without asking.
@@ -46,7 +46,7 @@ One of the three below writes and two of them read, so they do not all go at onc
46
46
 
47
47
  **A green suite is not a performance result** — a tiny fixture database proves a query's **rows**, never its **plan**. If `/flow-feat-review §3.6` left any query verdict `unresolved`, or an acceptance criterion concerns speed or volume: run the measurement of **`/flow-work-query §4`** with the volumes in `data.volumes` (or a data set shaped like them — the distribution matters more than the total), record plan and timings, and gate on the result. No `data.*` configuration and the criterion cannot be measured → it is `unproven` with the reason, never silently `proven`.
48
48
 
49
- 3. **Full suite**: run `quality.test` from `FLOW.md` in the background; if empty, auto-discover the project's test command and note what you use. **A suite measured in tens of minutes is a wait, not a step**: hand it to a supervisor subagent on `models.supervisors` (flow-core §6.5) — it runs it, times out, and brings back the exit code plus the failing tests' output, never a reading of whether those failures matter. Short suites stay here; delegating ninety seconds costs more than running them. A repo with more than one suite chains them in that one key (`make test && make test-frontend`); when it does not and the diff touches a suite the key misses, run that one too and say so in one line.
49
+ 3. **Full suite**: run `quality.test` from `FLOW.md` in the background (in `unattended`, waited on in this turn, flow-core §6.5); if empty, auto-discover the project's test command and note what you use. **A suite measured in tens of minutes is a wait, not a step**: hand it to a supervisor subagent on `models.supervisors` (flow-core §6.5) — it runs it, times out, and brings back the exit code plus the failing tests' output, never a reading of whether those failures matter. Short suites stay here; delegating ninety seconds costs more than running them. A repo with more than one suite chains them in that one key (`make test && make test-frontend`); when it does not and the diff touches a suite the key misses, run that one too and say so in one line.
50
50
 
51
51
  ## 3. Criteria coverage (S and larger)
52
52
 
@@ -108,6 +108,15 @@ Show the branch, the remote and the file list the build printed — every path,
108
108
  ask with `AskUserQuestion` **in every `autonomy.mode`**: a push leaves the machine (flow-core §2).
109
109
  **Push** · **Cancel**. Nothing between the list and the question (flow-core §3).
110
110
 
111
+ **A study that changes the schema** — its `## Schema changes` section (§5) is not `none` — shows
112
+ that section too, under the file list, and the same question carries the approval: **Push — schema
113
+ approved** · **Push — build asks first** · **Cancel**. Whoever builds it can ask no one about what
114
+ the person here already read. *Push — schema approved* → write `approved-schema.md` in the work
115
+ folder (flow-core §2, a schema approved with the study: `Approved at handoff, <date>`, then the
116
+ section verbatim), run the build block again, check its file list is the one shown plus that file,
117
+ and push that commit. *Push — build asks first* → push as it stands: build will ask `migration`
118
+ before writing the first line of it.
119
+
111
120
  ```bash handoff-push
112
121
  BRANCH='@BRANCH@'; COMMIT='@COMMIT@'
113
122
  case "$COMMIT" in ''|*[!0-9a-f]*) echo "not a commit sha: $COMMIT"; exit 1 ;; esac
@@ -144,6 +153,7 @@ the ticket read it there, never in the work folder; the receiver does not parse
144
153
  ## Acceptance criteria
145
154
  ## Design in brief
146
155
  ## MR/PR plan
156
+ ## Schema changes
147
157
  ## Risks
148
158
  <!-- end flow-study -->
149
159
  ```
@@ -152,6 +162,9 @@ the ticket read it there, never in the work folder; the receiver does not parse
152
162
  entry and its why — `Depends on #253: <why>` — so whoever approves the study sees what it waits
153
163
  for; an unattended study's `done-summary.md` is this block, so it carries them too. The plan
154
164
  lists each MR/PR with what it covers and what it waits on; a bug's plan is its single fix.
165
+ `## Schema changes` lists, one line each and by name, every table, column, index, constraint and
166
+ data copy the study's migrations create, alter or drop (flow-core §2, a schema approved with the
167
+ study), or says `none` — it is what approving the study approves, so nothing there is prose.
155
168
  - **The new body**: the body read above with the block between the two markers replaced — or, with
156
169
  no markers yet, the block appended after a blank line. Then, for each `meta.json.ticket_deps`
157
170
  entry (`/flow-feat-design` §5.1) whose line is not already a line of that body — same text,
@@ -107,6 +107,13 @@ record `{ "key": "unattended:base-caught-up", "default": "<old short sha> → <n
107
107
  ancestor → it holds commits a previous run made: leave it as it is — bringing the base into work in
108
108
  progress is the orchestrator's (flow-core §2.1).
109
109
 
110
+ **On `start`, an approved study run approves its schema** — only while no build or fix has begun,
111
+ `done-summary.md` exists (the summary a person approved) and `approved-schema.md` does not. Its
112
+ `## Schema changes` section names something → write `approved-schema.md` (flow-core §2, a schema
113
+ approved with the study: `Approved with the study run, <date>`, then the section verbatim) and
114
+ record `{ "key": "unattended:schema-approved", "default": "<n> object(s)", "phase": "run" }`. The
115
+ section says `none`, or is missing → nothing is written, and build asks as it always did.
116
+
110
117
  **A person's changes to a study, on `study`** (flow-core §2.1: they rewind it). The work's branch
111
118
  first, as above. `<work>/study-revision.md` holds the reply, as the row above wrote it. Each step
112
119
  can be run again: a run that dies part-way is finished by the next relaunch, whatever it serves.
@@ -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.95.0`.** Compare it once, at the start of the session, against
19
+ **This file belongs to flow `0.96.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
@@ -224,7 +224,8 @@ the value someone wrote in the FLOW config, or it is not in effect.
224
224
  each one resolves as §2.1's table says — never approved in silence):
225
225
  1. Any push or MR/PR creation (all of `ship`).
226
226
  2. Creating or switching a branch when the base is ambiguous (not on a clean main, or a possible train/stacked branch).
227
- 3. DB schema changes or migrations.
227
+ 3. DB schema changes or migrations — writing one a schema approved with the study already lists is
228
+ not asked again (below); applying one always is.
228
229
  4. A `review` that surfaced high-severity findings — never chain into `ship` on those.
229
230
  5. The business brief written before touching code (`build`, `fix`).
230
231
 
@@ -261,6 +262,30 @@ studies a ticket there goes on to build it — unless the orchestrator launched
261
262
  (§2.1), which stops at the door to code. With `autonomy.mode: auto`, a `--study` work runs on its
262
263
  own up to the push.
263
264
 
265
+ **A schema approved with the study.** A study that changes the schema says so literally: the
266
+ `## Schema changes` section of the `flow-study` block (`/flow-work-handoff` §5) lists, one line
267
+ each and by name, every table, column, index, constraint and data copy its migrations create,
268
+ alter or drop — from `03-design.md` "Data model", the intended fix of `03-investigation.md` for a
269
+ bug — or says `none`. Approving the study approves that list, and the approval is a file in the
270
+ work folder, `approved-schema.md`: a first line saying where it was approved (`Approved at
271
+ handoff, <date>` · `Approved with the study run, <date>`), then the section verbatim. Two places
272
+ write it and nothing else does — the handoff push answered **Push — schema approved**
273
+ (`/flow-work-handoff` §4), and `/flow-work-run` §2 when the orchestrator approves a study run with
274
+ `why = start`. Then, in every mode:
275
+
276
+ - **Writing** a migration — in `build`, in `fix`, or for a fix a review asks for — whose every
277
+ object created, altered or dropped is on that list is not asked: write it, add
278
+ `{ "key": "study:approved-schema", "default": "<the objects it writes>", "phase": "<phase>" }` to
279
+ `meta.json.defaults_used[]`, and one line under "Decisions made during implementation" naming
280
+ `approved-schema.md`.
281
+ - **Anything the list does not name** — one more column, an index, a drop, a type beyond what its
282
+ line says — is hard gate 3 as always, and the question names what lies beyond the list, so the
283
+ person decides on the difference alone.
284
+ - **Applying** a migration (`validate`) and the pre-deploy SQL (`ship`) are asked as before: the
285
+ study approved what the schema becomes, not when a database changes.
286
+ - A study revision (`/flow-work-run` §2) moves `approved-schema.md` aside with the rest of the
287
+ study; the new summary is approved anew.
288
+
264
289
  ### 2.1 `unattended` — where a person would have been asked
265
290
 
266
291
  No person is there to answer a question in this mode. A question tool — `AskUserQuestion`, OpenCode's `question`,
@@ -372,7 +397,7 @@ person asking for changes, a ticket that already has code — is `/flow-work-run
372
397
  | Business brief before code (`build`, `fix`) | record — the brief is written to the phase artifact, marked `recorded (unattended)`, and travels in the MR/PR body |
373
398
  | The door to code in a study run (`build`, `fix` pre-flight) | done — `done-summary.md`, the study as `/flow-work-handoff` §5 writes it for the ticket, and one `--depends-on` per `meta.json.ticket_deps` entry |
374
399
  | Push and MR/PR creation (`ship`) | `publish` — the run commits on its own branch, writes title and body, and hands them over; the orchestrator pushes and opens the draft |
375
- | 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` |
400
+ | 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) |
376
401
  | `review` with blockers or high-severity findings | question `high_findings` |
377
402
  | `validate` with a red suite or a criterion `unproven` | blocked — the phase does not advance and does not chain. **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 → 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". Short of all three — a failure the base does not reproduce, a base that cannot be run, a test this diff touched — blocked |
378
403
  | A product decision (§7 `decision`) | question `decision` |
@@ -393,6 +418,7 @@ person asking for changes, a ticket that already has code — is `/flow-work-run
393
418
  | An approved study's branch (`run`, `why = start`, no build or fix begun) | record — fast-forwarded to its base when it holds no commit of its own (`/flow-work-run` §2); the base unreadable or the fast-forward failing → blocked. Not integrating: nothing of the run's is merged |
394
419
  | Integrating the base into the MR/PR's branch (`green`) | on `why = conflict`, record — `git merge origin/<base>` as the orchestrator left it, never rebase, each conflict resolved on its merits (`/flow-work-green` §5.C); on any other `why`, blocked — the orchestrator brings the base in |
395
420
  | Any offer about the work's own bookkeeping — a tracker issue, the first `KNOWLEDGE.md` or a knowledge save, a FLOW convention, an agent lesson or a saved specialist, the follow-up survey, carrying files over from the main checkout, a contract handoff, archiving the work | record — `Later`; nothing written outside the work folder |
421
+ | A wait — a suite, a quality gate, anything run in the background (`validate`, `review`) | in the turn, on its condition, with a deadline (§6.5) — never a supervisor, never a fixed-length sleep, never ending the turn to be woken |
396
422
  | A step the command cannot complete (a red suite it cannot fix, a tool missing, auth failing, the same check failing a second time) | blocked |
397
423
  | Anything `auto` already decides on its own (size, flow mechanics, WIP commits, the next command) | as `auto` |
398
424
 
@@ -801,7 +827,7 @@ merge now. Delegating that judgement is how a pipeline ends up declared green by
801
827
  cheapest to ask, which is the one thing `/flow-work-green` exists to forbid. Delegate the waiting
802
828
  and the evidence; the verdict stays here.
803
829
 
804
- **Then end the turn.** Dispatching a supervisor and staying in a poll loop of your own pays both
830
+ **Then end the turn** — except in `unattended`, below. Dispatching a supervisor and staying in a poll loop of your own pays both
805
831
  bills and saves nothing. What wakes you is whatever the harness offers — a background task that
806
832
  re-invokes you when it finishes, a scheduled wake-up, a message back to this thread; where it offers
807
833
  none, the supervisor's evidence file is read at your next stop, and **you say that** rather than
@@ -818,6 +844,21 @@ moving.
818
844
  than to run — the brief, the round trip and the report are the whole of the saving. And anything you
819
845
  must *react to* mid-wait is not a wait at all: it is the work, and it stays here.
820
846
 
847
+ **In `unattended`, the wait stays in the turn** (§2.1). Nobody can bring back a run whose turn
848
+ ended, and whether a headless harness re-invokes a run when its background task finishes is not
849
+ something the run can count on. So no supervisor and no ending the turn: the wait is sat through
850
+ here, on the condition it waits for, with a deadline —
851
+
852
+ - **In the foreground**, when the command fits the harness's own limit for one call.
853
+ - **Otherwise launched with its exit code written to a file**, then waited on by a loop that checks
854
+ for that file every few seconds and stops at the deadline — one tool call per stretch, each under
855
+ that same limit, repeated until the file appears or the deadline passes. The loop runs inside the
856
+ call, so its cycles cost nothing on this thread.
857
+ - **Never a fixed-length sleep.** A guessed duration pays the whole sleep when the suite finished in
858
+ a fraction of it, and wakes before the suite when the guess is short.
859
+
860
+ The deadline reached with nothing back → `blocked`, naming the command and how long it ran.
861
+
821
862
  ### 6.6 — Which agent a role resolves to
822
863
 
823
864
  **The harness already tells you which agents are installed**, each with a line on what it is for,
@@ -73,7 +73,9 @@ In `unattended` (flow-core §2.1) nobody is there to answer: write the brief, ma
73
73
  `recorded (unattended)` under its heading, record the site in `meta.json.defaults_used[]`, and fix.
74
74
  The gate's purpose moves to the draft MR/PR, whose body carries the brief for the person who reads it.
75
75
  **A schema change or migration is still a question** (`migration`): before writing the first line
76
- of one → the question stop, end the run. The orchestrator's answer re-enters here
76
+ of one → the question stop, end the run — unless `approved-schema.md` lists every object it
77
+ creates, alters or drops (flow-core §2, a schema approved with the study): then write it, record
78
+ it there, do not stop. The orchestrator's answer re-enters here
77
79
  exactly as `/flow-feat-build §2` says, with `04-fix.md` for `05-implementation.md` and
78
80
  `/flow-bug-validate` as the phase it chains into after a review's *Fix them* (`/flow-bug-review`
79
81
  for XS, which has no validate).
@@ -39,7 +39,7 @@ Read `~/.claude/flow/CORE.opencode.md` first (shared rules: `FLOW.md` step 0, mo
39
39
 
40
40
  Then:
41
41
  1. Run only that test with `quality.test_one` from FLOW.md; it must pass.
42
- 2. Run the full suite with `quality.test` to rule out collateral regressions (in the background if slow; measured in tens of minutes → delegate it as a wait to a supervisor subagent on `models.supervisors`, flow-core §6.5 — it returns the exit code and the failing output, and the reading of them stays here).
42
+ 2. Run the full suite with `quality.test` to rule out collateral regressions (in the background if slow — in `unattended`, waited on in this turn, flow-core §6.5; otherwise, measured in tens of minutes → delegate it as a wait to a supervisor subagent on `models.supervisors`, flow-core §6.5 — it returns the exit code and the failing output, and the reading of them stays here).
43
43
  3. DB touched → verify the schema has no unexpected differences (`quality.db_update` or the FLOW.md equivalent, if defined; in `unattended` it is never run without an answer — a schema difference to apply is question
44
44
  `migration`, flow-core §2.1; the orchestrator's *Apply it* relaunches this phase, this site takes the
45
45
  answer just applied and runs it, and `05-validation.md` names that answer beside the migration).
@@ -80,7 +80,9 @@ In `unattended` (flow-core §2.1) nobody is there to answer: write the brief, ma
80
80
  `recorded (unattended)` under its heading, record the site in `meta.json.defaults_used[]`, and build.
81
81
  The gate's purpose moves to the draft MR/PR, whose body carries the brief for the person who reads it.
82
82
  **A schema change or migration is still a question** (`migration`): before writing the first line
83
- of one → the question stop, end the run. The orchestrator's answer re-enters here
83
+ of one → the question stop, end the run — unless `approved-schema.md` lists every object it
84
+ creates, alters or drops (flow-core §2, a schema approved with the study): then write it, record
85
+ it there, do not stop. The orchestrator's answer re-enters here
84
86
  (flow-core §2.1): the brief, the contracts and the plan are already written — keep them — and the
85
87
  MR/PR is the one already `in_progress`, not a new pick. *Write it and continue* → the first unticked
86
88
  step, the migration included · *Change the design first* → `blocked`. A plan step marked approved
@@ -226,7 +226,7 @@ Consolidate outputs into `.claude/work/<TICKET>/03-design.md`:
226
226
 
227
227
  ## Data model
228
228
  - New / modified entities: <for each new one, indicate "no equivalent found" or "knowingly duplicated because...">
229
- - Migrations:
229
+ - Migrations: <each table, column, index, constraint and data copy created, altered or dropped, by name — approving the study approves exactly this list (flow-core §2, a schema approved with the study)>
230
230
  - Indexes:
231
231
 
232
232
  ### Access paths
@@ -300,7 +300,7 @@ Not run for XS/S, small diffs, or fewer than 4 ambiguous findings. When skipped,
300
300
 
301
301
  Read `quality.*` from `FLOW.md`. Empty → auto-discover equivalent commands (Makefile, npm/composer scripts, Gradle, dotnet, Xcode, Flutter…) and note what you use.
302
302
 
303
- Launch in parallel (background if slow):
303
+ Launch in parallel (background if slow; in `unattended`, waited on in this turn, flow-core §6.5):
304
304
  - `quality.style_fix`
305
305
  - `quality.static_analysis`
306
306
  - `quality.test_one` (if there are new tests, with the appropriate filter)
@@ -401,4 +401,6 @@ Write `.claude/work/<TICKET>/06-review.md`. The `Cost:` line of `## Summary` is
401
401
  unticked step under this MR/PR's plan in `05-implementation.md` (`04-fix.md` for a bug), leaves
402
402
  `phase = build` (`fix`), and chains into `/flow-feat-build` (`/flow-bug-fix`), which builds those
403
403
  steps and chains back here — a bug through `/flow-bug-validate` first, as its order has it. A migration one of this round's fixes needs is question `migration`
404
- asked here — after `high_findings`, in its own stop — and answered the same way (flow-core §2.1).
404
+ asked here — after `high_findings`, in its own stop — and answered the same way (flow-core §2.1),
405
+ unless `approved-schema.md` lists every object it writes (flow-core §2): then it is an ordinary
406
+ step, and build writes it without asking.
@@ -44,7 +44,7 @@ One of the three below writes and two of them read, so they do not all go at onc
44
44
 
45
45
  **A green suite is not a performance result** — a tiny fixture database proves a query's **rows**, never its **plan**. If `/flow-feat-review §3.6` left any query verdict `unresolved`, or an acceptance criterion concerns speed or volume: run the measurement of **`/flow-work-query §4`** with the volumes in `data.volumes` (or a data set shaped like them — the distribution matters more than the total), record plan and timings, and gate on the result. No `data.*` configuration and the criterion cannot be measured → it is `unproven` with the reason, never silently `proven`.
46
46
 
47
- 3. **Full suite**: run `quality.test` from `FLOW.md` in the background; if empty, auto-discover the project's test command and note what you use. **A suite measured in tens of minutes is a wait, not a step**: hand it to a supervisor subagent on `models.supervisors` (flow-core §6.5) — it runs it, times out, and brings back the exit code plus the failing tests' output, never a reading of whether those failures matter. Short suites stay here; delegating ninety seconds costs more than running them. A repo with more than one suite chains them in that one key (`make test && make test-frontend`); when it does not and the diff touches a suite the key misses, run that one too and say so in one line.
47
+ 3. **Full suite**: run `quality.test` from `FLOW.md` in the background (in `unattended`, waited on in this turn, flow-core §6.5); if empty, auto-discover the project's test command and note what you use. **A suite measured in tens of minutes is a wait, not a step**: hand it to a supervisor subagent on `models.supervisors` (flow-core §6.5) — it runs it, times out, and brings back the exit code plus the failing tests' output, never a reading of whether those failures matter. Short suites stay here; delegating ninety seconds costs more than running them. A repo with more than one suite chains them in that one key (`make test && make test-frontend`); when it does not and the diff touches a suite the key misses, run that one too and say so in one line.
48
48
 
49
49
  ## 3. Criteria coverage (S and larger)
50
50
 
@@ -106,6 +106,15 @@ Show the branch, the remote and the file list the build printed — every path,
106
106
  ask with `AskUserQuestion` **in every `autonomy.mode`**: a push leaves the machine (flow-core §2).
107
107
  **Push** · **Cancel**. Nothing between the list and the question (flow-core §3).
108
108
 
109
+ **A study that changes the schema** — its `## Schema changes` section (§5) is not `none` — shows
110
+ that section too, under the file list, and the same question carries the approval: **Push — schema
111
+ approved** · **Push — build asks first** · **Cancel**. Whoever builds it can ask no one about what
112
+ the person here already read. *Push — schema approved* → write `approved-schema.md` in the work
113
+ folder (flow-core §2, a schema approved with the study: `Approved at handoff, <date>`, then the
114
+ section verbatim), run the build block again, check its file list is the one shown plus that file,
115
+ and push that commit. *Push — build asks first* → push as it stands: build will ask `migration`
116
+ before writing the first line of it.
117
+
109
118
  ```bash handoff-push
110
119
  BRANCH='@BRANCH@'; COMMIT='@COMMIT@'
111
120
  case "$COMMIT" in ''|*[!0-9a-f]*) echo "not a commit sha: $COMMIT"; exit 1 ;; esac
@@ -142,6 +151,7 @@ the ticket read it there, never in the work folder; the receiver does not parse
142
151
  ## Acceptance criteria
143
152
  ## Design in brief
144
153
  ## MR/PR plan
154
+ ## Schema changes
145
155
  ## Risks
146
156
  <!-- end flow-study -->
147
157
  ```
@@ -150,6 +160,9 @@ the ticket read it there, never in the work folder; the receiver does not parse
150
160
  entry and its why — `Depends on #253: <why>` — so whoever approves the study sees what it waits
151
161
  for; an unattended study's `done-summary.md` is this block, so it carries them too. The plan
152
162
  lists each MR/PR with what it covers and what it waits on; a bug's plan is its single fix.
163
+ `## Schema changes` lists, one line each and by name, every table, column, index, constraint and
164
+ data copy the study's migrations create, alter or drop (flow-core §2, a schema approved with the
165
+ study), or says `none` — it is what approving the study approves, so nothing there is prose.
153
166
  - **The new body**: the body read above with the block between the two markers replaced — or, with
154
167
  no markers yet, the block appended after a blank line. Then, for each `meta.json.ticket_deps`
155
168
  entry (`/flow-feat-design` §5.1) whose line is not already a line of that body — same text,
@@ -105,6 +105,13 @@ record `{ "key": "unattended:base-caught-up", "default": "<old short sha> → <n
105
105
  ancestor → it holds commits a previous run made: leave it as it is — bringing the base into work in
106
106
  progress is the orchestrator's (flow-core §2.1).
107
107
 
108
+ **On `start`, an approved study run approves its schema** — only while no build or fix has begun,
109
+ `done-summary.md` exists (the summary a person approved) and `approved-schema.md` does not. Its
110
+ `## Schema changes` section names something → write `approved-schema.md` (flow-core §2, a schema
111
+ approved with the study: `Approved with the study run, <date>`, then the section verbatim) and
112
+ record `{ "key": "unattended:schema-approved", "default": "<n> object(s)", "phase": "run" }`. The
113
+ section says `none`, or is missing → nothing is written, and build asks as it always did.
114
+
108
115
  **A person's changes to a study, on `study`** (flow-core §2.1: they rewind it). The work's branch
109
116
  first, as above. `<work>/study-revision.md` holds the reply, as the row above wrote it. Each step
110
117
  can be run again: a run that dies part-way is finished by the next relaunch, whatever it serves.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flow-workflows",
3
- "version": "0.95.0",
3
+ "version": "0.96.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.95.0",
6
+ "version": "0.96.0",
7
7
  "author": {
8
8
  "name": "Alberto Vioque",
9
9
  "email": "mashware@gmail.com"
@@ -5,6 +5,42 @@ 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.96.0 — A schema approved with the study is not asked again at build · 2026-10-20
9
+
10
+ **In short**
11
+ - **A study that changes the schema now lists it, object by object.** The study summary — the one
12
+ a handoff writes to the ticket and a study run sends to the orchestrator — gains
13
+ `## Schema changes`: every table, column, index, constraint and data copy, by name, or `none`.
14
+ - **Approving the study approves that list.** The handoff push question offers **Push — schema
15
+ approved**; a study run approved with `why = start` takes its list from the summary. Either way
16
+ the approval is written to `approved-schema.md` in the work folder.
17
+ - **Build no longer asks for a migration that is on the list.** It writes it and records it. One
18
+ more column, an index or a drop the list does not name is still the `migration` question, which
19
+ now names only what lies beyond the list.
20
+ - **Applying a migration and the pre-deploy SQL are still asked.** The study approved what the
21
+ schema becomes, not when a database changes.
22
+
23
+ An unattended build stopped before writing a migration the study had already designed in full and
24
+ a person had already approved, and the question repeated that design almost word for word. Nothing
25
+ recorded the approval in a form build could check. A study revision moves the approval aside with
26
+ the rest of the study, so a changed study is approved again. Closes #206.
27
+
28
+ ## v0.95.1 — An unattended run waits for its tests instead of sleeping a guess · 2026-10-15
29
+
30
+ **In short**
31
+ - **In `unattended`, a wait happens in the turn.** A suite or a quality gate run in the background
32
+ is waited on by a loop that ends when it finishes, with a deadline. No supervisor, and the turn
33
+ does not end to be woken.
34
+ - **Never a fixed-length sleep.** Unattended runs were guessing one — seven minutes for a suite
35
+ that took three — and losing up to half an hour per run.
36
+ - Nothing changes outside `unattended`.
37
+
38
+ The rule for waits told every run to hand the wait off and end the turn, trusting the harness to
39
+ wake it. A headless run cannot rely on that, so the model kept itself alive with a sleep of its
40
+ own choosing. flow-core §6.5 now says how an unattended run waits, the §2.1 table names the case,
41
+ and `validate` and `review` point to it where they launch something in the background. The
42
+ deadline reached with nothing back ends the run as `blocked`.
43
+
8
44
  ## v0.95.0 — One repo can study some works for handoff and build others here · 2026-10-15
9
45
 
10
46
  **In short**