flow-workflows 0.99.2 → 0.101.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.
@@ -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.99.2`.** Compare it once, at the start of the session, against
20
+ **This file belongs to flow `0.101.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
@@ -302,14 +302,15 @@ configuration; these orders are the whole interface, and nothing else about the
302
302
  assumed:
303
303
 
304
304
  ```
305
- <cmd> why → start | study | answer | review | pipeline | merged | conflict
306
- <cmd> ticket --json → {number, title, body, comments[{author, at, text}], base, kind}
305
+ <cmd> why → start | study | answer | review | pipeline | merged | conflict | next
306
+ <cmd> ticket --json → {number, title, body, comments[{author, at, text}], base, kind, stack?}
307
307
  <cmd> answer → one option's exact text, or free text; exit 2 = no reply
308
308
  <cmd> events --json → {"comments":[{thread,kind,id,author,at,body,url,path?,line?,owner?}]}
309
309
  | {"sha":…, "failed":[{name,conclusion,url,log_tail}]}
310
310
  | {"conflict":{"base":…, "base_sha":…}}
311
+ | {"part":…, "parts":…, "part_pr":{number,url,branch}|null, "umbrella":{…}}
311
312
  <cmd> ask --question-file F --options-file F [--recommended N] [--free-text] [--gate NAME]
312
- <cmd> publish --title-file F --body-file F [--part N --of M]
313
+ <cmd> publish --title-file F --body-file F [--part N --of M [--stack]]
313
314
  <cmd> blocked --reason-file F
314
315
  <cmd> done [--summary-file F] [--depends-on N]…
315
316
  <cmd> reply --thread ID --body-file F
@@ -330,6 +331,12 @@ assumed:
330
331
  (`$flow-feat-ship`). A publish that updates one already open — `$flow-work-green`,
331
332
  `$flow-work-respond` — carries neither: the MR/PR is already that part, and an orchestrator may
332
333
  refuse a part declared on a run launched for `pipeline`, `conflict` or `review`.
334
+ - **`--stack` goes with every `--part` when `<cmd> ticket --json` says `"stack": true`** — an
335
+ orchestrator that can stack a split's parts says so there, and only there. It then builds the next
336
+ part without waiting for this one to merge: the run ends at `publish` as always, and the next
337
+ launch is `why = next`, with `base` the branch of the part just published (or the umbrella, once
338
+ every part below it is in). `stack` absent or false → no `--stack`, and the next part waits for
339
+ `why = merged` as before.
333
340
  - **Free text travels in files, never on the command line.** Question, options (one per line, the
334
341
  recommended one first), title, body, reason and summary are written into the work folder
335
342
  (`ask-question.md`, `ask-options.md`, `publish-title.md`, `publish-body.md`, `blocked-reason.md`,
@@ -373,7 +380,7 @@ run has.
373
380
  runs the study phases as any run does, and three rules make it stop where it should:
374
381
 
375
382
  - **The door to code.** The first step of `$flow-feat-build` and `$flow-bug-fix` pre-flight, in
376
- `unattended`, re-reads `<cmd> why`: `start`, `answer`, `merged`, `review`, `pipeline` or `conflict` → go on;
383
+ `unattended`, re-reads `<cmd> why`: `start`, `answer`, `merged`, `next`, `review`, `pipeline` or `conflict` → go on;
377
384
  `study` → the study ends here; anything else, or the order failing → `blocked`. Every path from a
378
385
  study to code crosses that door, an answered question that resumes straight into `build`
379
386
  included, so the phases before it carry no clause. The run kind is read there, never stored: the
@@ -420,8 +427,8 @@ person asking for changes, a ticket that already has code — is `$flow-work-run
420
427
  | Criteria that need a person to verify (`validate`) | record — `not-verified-unattended`; every later `ship`, in any mode, lists them in the body under "Not verified — needs a human" |
421
428
  | The query duel needs a database (`review`, `query`) | record — schema-only verdict; never create or seed a database |
422
429
  | "Was it merged?" (`ship` close) | record — not merged; the orchestrator relaunches with `why = merged` when it is |
423
- | The next MR/PR of a train (`ship` close) | record — not started: one MR/PR per unattended run |
424
- | `build` with no startable MR/PR (its `depends_on` not `merged` in `meta.json`) | blocked — the reason names what must merge; an unattended `build` never stacks a branch on another, and never creates a remote branch |
430
+ | The next MR/PR of a train (`ship` close) | record — not started: one MR/PR per unattended run; with `--stack` the orchestrator relaunches with `why = next` |
431
+ | `build` with no startable MR/PR (its `depends_on` not `merged` in `meta.json`) | blocked — the reason names what must merge; an unattended `build` never stacks a branch on another, and never creates a remote branch. **On `why = next`** a dependency `published` counts as met: the orchestrator's `base` already holds it, and the new branch starts there |
425
432
  | The parent of a stacked MR/PR merged — rebase and force-push | blocked — never force-push unattended |
426
433
  | 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 |
427
434
  | 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 |
@@ -523,7 +530,10 @@ only in `unattended` (empty or `ask` → every question stops as above). It appl
523
530
  holds a study a person approved: `done-summary.md` in the work folder (a study run, approved with
524
531
  `why = start`) or `meta.json.handoff` true (a study handed off from elsewhere). Then a question
525
532
  stop in `build`, `fix`, `review`, `validate` or `ship` is not sent, and the run answers it with its
526
- own recommended option, in the same turn:
533
+ own recommended option, in the same turn. So is one in `design`, `plan` or `investigate` once the
534
+ work has crossed the door to code — `05-implementation.md` or `04-fix.md` exists, as when building
535
+ sent the work back to the study: `--study` sets `handoff` at start, before anyone approved anything,
536
+ so before that door the flag proves nothing.
527
537
 
528
538
  1. Write the question and options files as the stop would, and compute its `id` the same way.
529
539
  2. Append one entry to `auto-answers.md` in the work folder — whoever reads it later has not seen
@@ -537,12 +547,13 @@ own recommended option, in the same turn:
537
547
  - [ ] <each other option, in its order>
538
548
  ```
539
549
 
540
- `MR/PR <n>` is this MR/PR's `mrs[]` entry, left out for a work with no `mrs`.
550
+ `MR/PR <n>` is this MR/PR's `mrs[]` entry, left out for a work with no `mrs` — and for a study
551
+ phase run before `plan` wrote them, whose entries go to the first MR/PR the work publishes.
541
552
  3. Apply that option as an orchestrator's answer is applied (above): written where the re-entry
542
553
  table says, with every effect its row names — *Fix them* writes the plan steps and chains into
543
554
  `build` / `fix` — and `{ "key": "unattended:answer:<gate>", "default": "<option>", "id": "<id>",
544
555
  "phase": "<phase>", "head": "<head>", "mr": <n>, "source": "recommended" }` in
545
- `meta.json.defaults_used[]`, so "Which site takes it" reads it as it reads any answer.
556
+ `meta.json.defaults_used[]` — `mr` left out when the heading names none — so "Which site takes it" reads it as it reads any answer.
546
557
  4. `pending` stays `null`: no `ask`, no end of the run. The phase goes on from that site.
547
558
 
548
559
  Still a question stop, as above:
@@ -552,8 +563,23 @@ Still a question stop, as above:
552
563
  - **A third `high_findings` on the same MR/PR** — two `source: "recommended"` answers to that gate
553
564
  with this `mr` already in `defaults_used[]`: two rounds of fixes that left high findings behind
554
565
  are for a person to judge.
555
- - **Outside those five phases** — the study phases, and `respond` and `green`, ask or block as
556
- they always do: a review round answers a reviewer, and the ticket's owner decides that one.
566
+ - **An option that reaches another repository** — taken, it adds a `meta.json.related_repos`
567
+ entry, or changes a contract a sibling repo consumes (a `related_repos` consumer in
568
+ `03-design.md` "External contracts") or published (`01-context.md` "Contracts received"). The
569
+ orchestrator owns this checkout only; widening the work past it is a person's call.
570
+ - **An option that writes a schema object `approved-schema.md` does not list** — a table, column,
571
+ index, constraint or data copy, or any of them when the file does not exist. A `migration`
572
+ question in `build`, `fix` or `review` is this case by construction: one that writes only listed
573
+ objects is never asked (§2, a schema approved with the study), and hard gate 3 asks for whatever
574
+ lies beyond the list. Applying a migration (`validate`) and the pre-deploy SQL (`ship`) write no
575
+ new object, and are answered as before.
576
+ - **A bundled option** — *Apply the recommended response to each* of a `design_challenge` or an
577
+ `investigation_challenge` — is judged response by response: one that falls in either case above
578
+ stops the whole question.
579
+ - **The study phases before the door to code** — the first study run, a `--study` work still
580
+ being studied, a study a person's changes rewound — and **`respond`, `green` and `start`**, in
581
+ every case, ask or block as they always do: a review round answers a reviewer, and the ticket's
582
+ owner decides that one.
557
583
 
558
584
  `ship` puts this MR/PR's entries in the body (its "In every mode" paragraph), so the person who
559
585
  reads the draft sees each question, its options and the one taken, and asks for a change there.
@@ -44,7 +44,7 @@ Implementation phase. Code is written here.
44
44
  before writing against it. Nothing is checked; waiting is the builder's call.
45
45
  - `size` M/L: require both `03-design.md` **and** `04-mr-plan.md`. Plan missing → send to `$flow-feat-plan`; design missing → send to `$flow-feat-design`.
46
46
  - `size` XS/S: may start without a design — ask the user for a 2-3 line note on what will be done and save it as a minimal `03-design.md`. No MR/PR plan (always 1 MR/PR).
47
- - **If `meta.json.mrs` has more than one entry**: pick the **startable** MR/PR — the `pending` one with the **lowest `n` whose `depends_on` are all `merged`**. Dependencies still `pending`/`in_progress` → not startable, even with a low `n`. (No `wave`/`depends_on` — an older plan — → "first pending by `n`".)
47
+ - **If `meta.json.mrs` has more than one entry**: pick the **startable** MR/PR — the `pending` one with the **lowest `n` whose `depends_on` are all `merged`**. Dependencies still `pending`/`in_progress` → not startable, even with a low `n`. **In `unattended` on `why = next`** (a stacked split, flow-core §2.1) a dependency `published` counts as met: `meta.json.base` is that part's branch, so the new branch starts on top of it. (No `wave`/`depends_on` — an older plan — → "first pending by `n`".)
48
48
  - **Parallel siblings**: startable `pending` MRs/PRs in the **same `wave`** with no dependency between them can be built in parallel or as a train. `manual`: let the user choose which to take now (default: lowest `n`); `guided`/`auto`: take the lowest `n`, record the choice. Mark the chosen one `in_progress`.
49
49
  - All `merged` → warn: feature is done, nothing to build (in `unattended`: `done`, the summary saying so).
50
50
  - Some `pending` but **none** startable → start nothing: tell the user which MR/PR must merge to unlock the next wave, and stop. In `unattended`: `blocked`, the reason naming it.
@@ -52,11 +52,13 @@ place it would ask:
52
52
  the work folder.
53
53
  - **"Was it merged?" (§6.1)** → not merged: the entry stays `in_progress` (a work with no `mrs`
54
54
  keeps `phase = "ship"`) until `publish` succeeds, below. **The parent merged first (§6.2.1)** → blocked, never
55
- force-push. **Train continuation (§6.2)** → not started: one MR/PR per unattended run.
55
+ force-push. **Train continuation (§6.2)** → not started: one MR/PR per unattended run (with
56
+ `--stack`, the orchestrator launches the next one as `why = next`).
56
57
  - **At Close**, after `meta.json` and `00-summary.md` are written: commit what is left outside
57
58
  `.claude/work/` so the tree is clean, then the run's closing order — `<cmd> publish --title-file
58
59
  <work>/publish-title.md --body-file <work>/publish-body.md`, plus `--part <n> --of <N>` when
59
- `meta.json.mrs` has more than one entry (`n` this MR/PR's, `N` the number of entries). Exit 0 →
60
+ `meta.json.mrs` has more than one entry (`n` this MR/PR's, `N` the number of entries), and
61
+ `--stack` beside them when `<cmd> ticket --json` says `"stack": true` (flow-core §2.1). Exit 0 →
60
62
  this MR/PR's `mrs[]` entry gets `status: "published"` (a work with no `mrs`: `meta.json.published:
61
63
  true`) — what `$flow-work-run` turns into `merged` when the orchestrator relaunches with
62
64
  `why = merged` — and nothing else runs. The summary and the panel written before it say the work
@@ -70,7 +72,8 @@ where it failed too — and the review findings an orchestrator's answer accepte
70
72
  (`06-review.md` "Answered (unattended)"), one line each. The §3 preview shows that section like
71
73
  any other, and the person reading it is the check the run could not do. Entries of
72
74
  `auto-answers.md` for this MR/PR (`MR/PR <n>` in their heading, or all of them for a work with no
73
- `mrs`) go into the body verbatim under `## Decided without asking` — each question, its options,
75
+ `mrs`) — plus, while no `mrs[]` entry is `published` or `merged`, every entry whose heading names none: a study
76
+ phase answered it before `plan` wrote `mrs` — go into the body verbatim under `## Decided without asking` — each question, its options,
74
77
  the one taken checked (flow-core §2.1, the recommended answer).
75
78
 
76
79
  ## 1. Pre-flight
@@ -36,7 +36,7 @@ of truth, and an argument that disagrees with it is ignored and named in the log
36
36
  other mode a person is the router (`$flow-next`).
37
37
  - `autonomy.orchestrator_cmd` empty → flow-core §2.1: no phase runs.
38
38
  - Run `<cmd> why`. It fails, or prints anything but `start`, `study`, `answer`, `review`,
39
- `pipeline`, `merged` or `conflict` → print what it returned and its stderr in the §3 header and end. No closing order: an
39
+ `pipeline`, `merged`, `conflict` or `next` → print what it returned and its stderr in the §3 header and end. No closing order: an
40
40
  orchestrator that cannot say why it launched the run cannot take one either.
41
41
  - Run `<cmd> ticket --json` and keep `number`, `title`, `base` and `kind` (`kind` absent or `null` → `feat`: the tracker could not tell, so flow decides). `kind` is re-read on every run; only a run that starts the work uses it — once the work exists, its folder says feat or bug.
42
42
  It fails or prints no `number` → `blocked` (flow-core §2.1).
@@ -63,6 +63,8 @@ of truth, and an argument that disagrees with it is ignored and named in the log
63
63
  | `merged` | exists, something published | the entry of `meta.json.mrs` whose `status` is `published` (the only one: one MR/PR per run) becomes `merged`; set `meta.json.base` to the `base` just read (empty → `git.default_base`); the next startable MR/PR → `$flow-feat-build`; none left, or a work with no `mrs` and `published` true (one MR/PR, every bug) → `phase = done` and `done`, the summary naming the ticket as complete |
64
64
  | `merged` | exists, nothing published, its last `mrs[]` entry with a number `merged` | the same merge again: a run that recorded it and then stopped (a block, a crash) is relaunched with the same `why`, since no part was published after it. Nothing to record — the next startable MR/PR → `$flow-feat-build`; none left → `phase = done` and `done`, as the row above |
65
65
  | `merged` | none, or nothing published and nothing merged | `blocked` — nothing of this ticket was published from here |
66
+ | `next` | exists, something published | a stacked split (flow-core §2.1, `--stack`): nothing merged, so every `published` entry stays `published`. Set `meta.json.base` to the `base` just read — the branch of the part published last, or the umbrella — then the next startable MR/PR, a `published` dependency counting as met → `$flow-feat-build`; none left → `done`, the summary saying every part is published and waits to merge |
67
+ | `next` | none, or nothing published | `blocked` — there is no published part to build on |
66
68
  | `review` | exists | `$flow-work-respond` — the threads come from `<cmd> events --json` |
67
69
  | `pipeline` | exists | `$flow-work-green` — the failed jobs come from `<cmd> events --json` |
68
70
  | `conflict` | exists | `$flow-work-green` — the MR/PR conflicts with its base; which base, and where it stands, come from `<cmd> events --json` |
@@ -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.99.2`.** Compare it once, at the start of the session, against
19
+ **This file belongs to flow `0.101.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
@@ -301,14 +301,15 @@ configuration; these orders are the whole interface, and nothing else about the
301
301
  assumed:
302
302
 
303
303
  ```
304
- <cmd> why → start | study | answer | review | pipeline | merged | conflict
305
- <cmd> ticket --json → {number, title, body, comments[{author, at, text}], base, kind}
304
+ <cmd> why → start | study | answer | review | pipeline | merged | conflict | next
305
+ <cmd> ticket --json → {number, title, body, comments[{author, at, text}], base, kind, stack?}
306
306
  <cmd> answer → one option's exact text, or free text; exit 2 = no reply
307
307
  <cmd> events --json → {"comments":[{thread,kind,id,author,at,body,url,path?,line?,owner?}]}
308
308
  | {"sha":…, "failed":[{name,conclusion,url,log_tail}]}
309
309
  | {"conflict":{"base":…, "base_sha":…}}
310
+ | {"part":…, "parts":…, "part_pr":{number,url,branch}|null, "umbrella":{…}}
310
311
  <cmd> ask --question-file F --options-file F [--recommended N] [--free-text] [--gate NAME]
311
- <cmd> publish --title-file F --body-file F [--part N --of M]
312
+ <cmd> publish --title-file F --body-file F [--part N --of M [--stack]]
312
313
  <cmd> blocked --reason-file F
313
314
  <cmd> done [--summary-file F] [--depends-on N]…
314
315
  <cmd> reply --thread ID --body-file F
@@ -329,6 +330,12 @@ assumed:
329
330
  (`/flow:feat:ship`). A publish that updates one already open — `/flow:work:green`,
330
331
  `/flow:work:respond` — carries neither: the MR/PR is already that part, and an orchestrator may
331
332
  refuse a part declared on a run launched for `pipeline`, `conflict` or `review`.
333
+ - **`--stack` goes with every `--part` when `<cmd> ticket --json` says `"stack": true`** — an
334
+ orchestrator that can stack a split's parts says so there, and only there. It then builds the next
335
+ part without waiting for this one to merge: the run ends at `publish` as always, and the next
336
+ launch is `why = next`, with `base` the branch of the part just published (or the umbrella, once
337
+ every part below it is in). `stack` absent or false → no `--stack`, and the next part waits for
338
+ `why = merged` as before.
332
339
  - **Free text travels in files, never on the command line.** Question, options (one per line, the
333
340
  recommended one first), title, body, reason and summary are written into the work folder
334
341
  (`ask-question.md`, `ask-options.md`, `publish-title.md`, `publish-body.md`, `blocked-reason.md`,
@@ -372,7 +379,7 @@ run has.
372
379
  runs the study phases as any run does, and three rules make it stop where it should:
373
380
 
374
381
  - **The door to code.** The first step of `/flow:feat:build` and `/flow:bug:fix` pre-flight, in
375
- `unattended`, re-reads `<cmd> why`: `start`, `answer`, `merged`, `review`, `pipeline` or `conflict` → go on;
382
+ `unattended`, re-reads `<cmd> why`: `start`, `answer`, `merged`, `next`, `review`, `pipeline` or `conflict` → go on;
376
383
  `study` → the study ends here; anything else, or the order failing → `blocked`. Every path from a
377
384
  study to code crosses that door, an answered question that resumes straight into `build`
378
385
  included, so the phases before it carry no clause. The run kind is read there, never stored: the
@@ -419,8 +426,8 @@ person asking for changes, a ticket that already has code — is `/flow:work:run
419
426
  | Criteria that need a person to verify (`validate`) | record — `not-verified-unattended`; every later `ship`, in any mode, lists them in the body under "Not verified — needs a human" |
420
427
  | The query duel needs a database (`review`, `query`) | record — schema-only verdict; never create or seed a database |
421
428
  | "Was it merged?" (`ship` close) | record — not merged; the orchestrator relaunches with `why = merged` when it is |
422
- | The next MR/PR of a train (`ship` close) | record — not started: one MR/PR per unattended run |
423
- | `build` with no startable MR/PR (its `depends_on` not `merged` in `meta.json`) | blocked — the reason names what must merge; an unattended `build` never stacks a branch on another, and never creates a remote branch |
429
+ | The next MR/PR of a train (`ship` close) | record — not started: one MR/PR per unattended run; with `--stack` the orchestrator relaunches with `why = next` |
430
+ | `build` with no startable MR/PR (its `depends_on` not `merged` in `meta.json`) | blocked — the reason names what must merge; an unattended `build` never stacks a branch on another, and never creates a remote branch. **On `why = next`** a dependency `published` counts as met: the orchestrator's `base` already holds it, and the new branch starts there |
424
431
  | The parent of a stacked MR/PR merged — rebase and force-push | blocked — never force-push unattended |
425
432
  | 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 |
426
433
  | 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 |
@@ -522,7 +529,10 @@ only in `unattended` (empty or `ask` → every question stops as above). It appl
522
529
  holds a study a person approved: `done-summary.md` in the work folder (a study run, approved with
523
530
  `why = start`) or `meta.json.handoff` true (a study handed off from elsewhere). Then a question
524
531
  stop in `build`, `fix`, `review`, `validate` or `ship` is not sent, and the run answers it with its
525
- own recommended option, in the same turn:
532
+ own recommended option, in the same turn. So is one in `design`, `plan` or `investigate` once the
533
+ work has crossed the door to code — `05-implementation.md` or `04-fix.md` exists, as when building
534
+ sent the work back to the study: `--study` sets `handoff` at start, before anyone approved anything,
535
+ so before that door the flag proves nothing.
526
536
 
527
537
  1. Write the question and options files as the stop would, and compute its `id` the same way.
528
538
  2. Append one entry to `auto-answers.md` in the work folder — whoever reads it later has not seen
@@ -536,12 +546,13 @@ own recommended option, in the same turn:
536
546
  - [ ] <each other option, in its order>
537
547
  ```
538
548
 
539
- `MR/PR <n>` is this MR/PR's `mrs[]` entry, left out for a work with no `mrs`.
549
+ `MR/PR <n>` is this MR/PR's `mrs[]` entry, left out for a work with no `mrs` — and for a study
550
+ phase run before `plan` wrote them, whose entries go to the first MR/PR the work publishes.
540
551
  3. Apply that option as an orchestrator's answer is applied (above): written where the re-entry
541
552
  table says, with every effect its row names — *Fix them* writes the plan steps and chains into
542
553
  `build` / `fix` — and `{ "key": "unattended:answer:<gate>", "default": "<option>", "id": "<id>",
543
554
  "phase": "<phase>", "head": "<head>", "mr": <n>, "source": "recommended" }` in
544
- `meta.json.defaults_used[]`, so "Which site takes it" reads it as it reads any answer.
555
+ `meta.json.defaults_used[]` — `mr` left out when the heading names none — so "Which site takes it" reads it as it reads any answer.
545
556
  4. `pending` stays `null`: no `ask`, no end of the run. The phase goes on from that site.
546
557
 
547
558
  Still a question stop, as above:
@@ -551,8 +562,23 @@ Still a question stop, as above:
551
562
  - **A third `high_findings` on the same MR/PR** — two `source: "recommended"` answers to that gate
552
563
  with this `mr` already in `defaults_used[]`: two rounds of fixes that left high findings behind
553
564
  are for a person to judge.
554
- - **Outside those five phases** — the study phases, and `respond` and `green`, ask or block as
555
- they always do: a review round answers a reviewer, and the ticket's owner decides that one.
565
+ - **An option that reaches another repository** — taken, it adds a `meta.json.related_repos`
566
+ entry, or changes a contract a sibling repo consumes (a `related_repos` consumer in
567
+ `03-design.md` "External contracts") or published (`01-context.md` "Contracts received"). The
568
+ orchestrator owns this checkout only; widening the work past it is a person's call.
569
+ - **An option that writes a schema object `approved-schema.md` does not list** — a table, column,
570
+ index, constraint or data copy, or any of them when the file does not exist. A `migration`
571
+ question in `build`, `fix` or `review` is this case by construction: one that writes only listed
572
+ objects is never asked (§2, a schema approved with the study), and hard gate 3 asks for whatever
573
+ lies beyond the list. Applying a migration (`validate`) and the pre-deploy SQL (`ship`) write no
574
+ new object, and are answered as before.
575
+ - **A bundled option** — *Apply the recommended response to each* of a `design_challenge` or an
576
+ `investigation_challenge` — is judged response by response: one that falls in either case above
577
+ stops the whole question.
578
+ - **The study phases before the door to code** — the first study run, a `--study` work still
579
+ being studied, a study a person's changes rewound — and **`respond`, `green` and `start`**, in
580
+ every case, ask or block as they always do: a review round answers a reviewer, and the ticket's
581
+ owner decides that one.
556
582
 
557
583
  `ship` puts this MR/PR's entries in the body (its "In every mode" paragraph), so the person who
558
584
  reads the draft sees each question, its options and the one taken, and asks for a change there.
@@ -40,7 +40,7 @@ Implementation phase. Code is written here.
40
40
  before writing against it. Nothing is checked; waiting is the builder's call.
41
41
  - `size` M/L: require both `03-design.md` **and** `04-mr-plan.md`. Plan missing → send to `/flow:feat:plan`; design missing → send to `/flow:feat:design`.
42
42
  - `size` XS/S: may start without a design — ask the user for a 2-3 line note on what will be done and save it as a minimal `03-design.md`. No MR/PR plan (always 1 MR/PR).
43
- - **If `meta.json.mrs` has more than one entry**: pick the **startable** MR/PR — the `pending` one with the **lowest `n` whose `depends_on` are all `merged`**. Dependencies still `pending`/`in_progress` → not startable, even with a low `n`. (No `wave`/`depends_on` — an older plan — → "first pending by `n`".)
43
+ - **If `meta.json.mrs` has more than one entry**: pick the **startable** MR/PR — the `pending` one with the **lowest `n` whose `depends_on` are all `merged`**. Dependencies still `pending`/`in_progress` → not startable, even with a low `n`. **In `unattended` on `why = next`** (a stacked split, flow-core §2.1) a dependency `published` counts as met: `meta.json.base` is that part's branch, so the new branch starts on top of it. (No `wave`/`depends_on` — an older plan — → "first pending by `n`".)
44
44
  - **Parallel siblings**: startable `pending` MRs/PRs in the **same `wave`** with no dependency between them can be built in parallel or as a train. `manual`: let the user choose which to take now (default: lowest `n`); `guided`/`auto`: take the lowest `n`, record the choice. Mark the chosen one `in_progress`.
45
45
  - All `merged` → warn: feature is done, nothing to build (in `unattended`: `done`, the summary saying so).
46
46
  - Some `pending` but **none** startable → start nothing: tell the user which MR/PR must merge to unlock the next wave, and stop. In `unattended`: `blocked`, the reason naming it.
@@ -48,11 +48,13 @@ place it would ask:
48
48
  the work folder.
49
49
  - **"Was it merged?" (§6.1)** → not merged: the entry stays `in_progress` (a work with no `mrs`
50
50
  keeps `phase = "ship"`) until `publish` succeeds, below. **The parent merged first (§6.2.1)** → blocked, never
51
- force-push. **Train continuation (§6.2)** → not started: one MR/PR per unattended run.
51
+ force-push. **Train continuation (§6.2)** → not started: one MR/PR per unattended run (with
52
+ `--stack`, the orchestrator launches the next one as `why = next`).
52
53
  - **At Close**, after `meta.json` and `00-summary.md` are written: commit what is left outside
53
54
  `.claude/work/` so the tree is clean, then the run's closing order — `<cmd> publish --title-file
54
55
  <work>/publish-title.md --body-file <work>/publish-body.md`, plus `--part <n> --of <N>` when
55
- `meta.json.mrs` has more than one entry (`n` this MR/PR's, `N` the number of entries). Exit 0 →
56
+ `meta.json.mrs` has more than one entry (`n` this MR/PR's, `N` the number of entries), and
57
+ `--stack` beside them when `<cmd> ticket --json` says `"stack": true` (flow-core §2.1). Exit 0 →
56
58
  this MR/PR's `mrs[]` entry gets `status: "published"` (a work with no `mrs`: `meta.json.published:
57
59
  true`) — what `/flow:work:run` turns into `merged` when the orchestrator relaunches with
58
60
  `why = merged` — and nothing else runs. The summary and the panel written before it say the work
@@ -66,7 +68,8 @@ where it failed too — and the review findings an orchestrator's answer accepte
66
68
  (`06-review.md` "Answered (unattended)"), one line each. The §3 preview shows that section like
67
69
  any other, and the person reading it is the check the run could not do. Entries of
68
70
  `auto-answers.md` for this MR/PR (`MR/PR <n>` in their heading, or all of them for a work with no
69
- `mrs`) go into the body verbatim under `## Decided without asking` — each question, its options,
71
+ `mrs`) — plus, while no `mrs[]` entry is `published` or `merged`, every entry whose heading names none: a study
72
+ phase answered it before `plan` wrote `mrs` — go into the body verbatim under `## Decided without asking` — each question, its options,
70
73
  the one taken checked (flow-core §2.1, the recommended answer).
71
74
 
72
75
  ## 1. Pre-flight
@@ -32,7 +32,7 @@ of truth, and an argument that disagrees with it is ignored and named in the log
32
32
  other mode a person is the router (`/flow:next`).
33
33
  - `autonomy.orchestrator_cmd` empty → flow-core §2.1: no phase runs.
34
34
  - Run `<cmd> why`. It fails, or prints anything but `start`, `study`, `answer`, `review`,
35
- `pipeline`, `merged` or `conflict` → print what it returned and its stderr in the §3 header and end. No closing order: an
35
+ `pipeline`, `merged`, `conflict` or `next` → print what it returned and its stderr in the §3 header and end. No closing order: an
36
36
  orchestrator that cannot say why it launched the run cannot take one either.
37
37
  - Run `<cmd> ticket --json` and keep `number`, `title`, `base` and `kind` (`kind` absent or `null` → `feat`: the tracker could not tell, so flow decides). `kind` is re-read on every run; only a run that starts the work uses it — once the work exists, its folder says feat or bug.
38
38
  It fails or prints no `number` → `blocked` (flow-core §2.1).
@@ -59,6 +59,8 @@ of truth, and an argument that disagrees with it is ignored and named in the log
59
59
  | `merged` | exists, something published | the entry of `meta.json.mrs` whose `status` is `published` (the only one: one MR/PR per run) becomes `merged`; set `meta.json.base` to the `base` just read (empty → `git.default_base`); the next startable MR/PR → `/flow:feat:build`; none left, or a work with no `mrs` and `published` true (one MR/PR, every bug) → `phase = done` and `done`, the summary naming the ticket as complete |
60
60
  | `merged` | exists, nothing published, its last `mrs[]` entry with a number `merged` | the same merge again: a run that recorded it and then stopped (a block, a crash) is relaunched with the same `why`, since no part was published after it. Nothing to record — the next startable MR/PR → `/flow:feat:build`; none left → `phase = done` and `done`, as the row above |
61
61
  | `merged` | none, or nothing published and nothing merged | `blocked` — nothing of this ticket was published from here |
62
+ | `next` | exists, something published | a stacked split (flow-core §2.1, `--stack`): nothing merged, so every `published` entry stays `published`. Set `meta.json.base` to the `base` just read — the branch of the part published last, or the umbrella — then the next startable MR/PR, a `published` dependency counting as met → `/flow:feat:build`; none left → `done`, the summary saying every part is published and waits to merge |
63
+ | `next` | none, or nothing published | `blocked` — there is no published part to build on |
62
64
  | `review` | exists | `/flow:work:respond` — the threads come from `<cmd> events --json` |
63
65
  | `pipeline` | exists | `/flow:work:green` — the failed jobs come from `<cmd> events --json` |
64
66
  | `conflict` | exists | `/flow:work:green` — the MR/PR conflicts with its base; which base, and where it stands, come from `<cmd> events --json` |
@@ -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.99.2`.** Compare it once, at the start of the session, against
20
+ **This file belongs to flow `0.101.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
@@ -302,14 +302,15 @@ configuration; these orders are the whole interface, and nothing else about the
302
302
  assumed:
303
303
 
304
304
  ```
305
- <cmd> why → start | study | answer | review | pipeline | merged | conflict
306
- <cmd> ticket --json → {number, title, body, comments[{author, at, text}], base, kind}
305
+ <cmd> why → start | study | answer | review | pipeline | merged | conflict | next
306
+ <cmd> ticket --json → {number, title, body, comments[{author, at, text}], base, kind, stack?}
307
307
  <cmd> answer → one option's exact text, or free text; exit 2 = no reply
308
308
  <cmd> events --json → {"comments":[{thread,kind,id,author,at,body,url,path?,line?,owner?}]}
309
309
  | {"sha":…, "failed":[{name,conclusion,url,log_tail}]}
310
310
  | {"conflict":{"base":…, "base_sha":…}}
311
+ | {"part":…, "parts":…, "part_pr":{number,url,branch}|null, "umbrella":{…}}
311
312
  <cmd> ask --question-file F --options-file F [--recommended N] [--free-text] [--gate NAME]
312
- <cmd> publish --title-file F --body-file F [--part N --of M]
313
+ <cmd> publish --title-file F --body-file F [--part N --of M [--stack]]
313
314
  <cmd> blocked --reason-file F
314
315
  <cmd> done [--summary-file F] [--depends-on N]…
315
316
  <cmd> reply --thread ID --body-file F
@@ -330,6 +331,12 @@ assumed:
330
331
  (`/flow-feat-ship`). A publish that updates one already open — `/flow-work-green`,
331
332
  `/flow-work-respond` — carries neither: the MR/PR is already that part, and an orchestrator may
332
333
  refuse a part declared on a run launched for `pipeline`, `conflict` or `review`.
334
+ - **`--stack` goes with every `--part` when `<cmd> ticket --json` says `"stack": true`** — an
335
+ orchestrator that can stack a split's parts says so there, and only there. It then builds the next
336
+ part without waiting for this one to merge: the run ends at `publish` as always, and the next
337
+ launch is `why = next`, with `base` the branch of the part just published (or the umbrella, once
338
+ every part below it is in). `stack` absent or false → no `--stack`, and the next part waits for
339
+ `why = merged` as before.
333
340
  - **Free text travels in files, never on the command line.** Question, options (one per line, the
334
341
  recommended one first), title, body, reason and summary are written into the work folder
335
342
  (`ask-question.md`, `ask-options.md`, `publish-title.md`, `publish-body.md`, `blocked-reason.md`,
@@ -373,7 +380,7 @@ run has.
373
380
  runs the study phases as any run does, and three rules make it stop where it should:
374
381
 
375
382
  - **The door to code.** The first step of `/flow-feat-build` and `/flow-bug-fix` pre-flight, in
376
- `unattended`, re-reads `<cmd> why`: `start`, `answer`, `merged`, `review`, `pipeline` or `conflict` → go on;
383
+ `unattended`, re-reads `<cmd> why`: `start`, `answer`, `merged`, `next`, `review`, `pipeline` or `conflict` → go on;
377
384
  `study` → the study ends here; anything else, or the order failing → `blocked`. Every path from a
378
385
  study to code crosses that door, an answered question that resumes straight into `build`
379
386
  included, so the phases before it carry no clause. The run kind is read there, never stored: the
@@ -420,8 +427,8 @@ person asking for changes, a ticket that already has code — is `/flow-work-run
420
427
  | Criteria that need a person to verify (`validate`) | record — `not-verified-unattended`; every later `ship`, in any mode, lists them in the body under "Not verified — needs a human" |
421
428
  | The query duel needs a database (`review`, `query`) | record — schema-only verdict; never create or seed a database |
422
429
  | "Was it merged?" (`ship` close) | record — not merged; the orchestrator relaunches with `why = merged` when it is |
423
- | The next MR/PR of a train (`ship` close) | record — not started: one MR/PR per unattended run |
424
- | `build` with no startable MR/PR (its `depends_on` not `merged` in `meta.json`) | blocked — the reason names what must merge; an unattended `build` never stacks a branch on another, and never creates a remote branch |
430
+ | The next MR/PR of a train (`ship` close) | record — not started: one MR/PR per unattended run; with `--stack` the orchestrator relaunches with `why = next` |
431
+ | `build` with no startable MR/PR (its `depends_on` not `merged` in `meta.json`) | blocked — the reason names what must merge; an unattended `build` never stacks a branch on another, and never creates a remote branch. **On `why = next`** a dependency `published` counts as met: the orchestrator's `base` already holds it, and the new branch starts there |
425
432
  | The parent of a stacked MR/PR merged — rebase and force-push | blocked — never force-push unattended |
426
433
  | 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 |
427
434
  | 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 |
@@ -523,7 +530,10 @@ only in `unattended` (empty or `ask` → every question stops as above). It appl
523
530
  holds a study a person approved: `done-summary.md` in the work folder (a study run, approved with
524
531
  `why = start`) or `meta.json.handoff` true (a study handed off from elsewhere). Then a question
525
532
  stop in `build`, `fix`, `review`, `validate` or `ship` is not sent, and the run answers it with its
526
- own recommended option, in the same turn:
533
+ own recommended option, in the same turn. So is one in `design`, `plan` or `investigate` once the
534
+ work has crossed the door to code — `05-implementation.md` or `04-fix.md` exists, as when building
535
+ sent the work back to the study: `--study` sets `handoff` at start, before anyone approved anything,
536
+ so before that door the flag proves nothing.
527
537
 
528
538
  1. Write the question and options files as the stop would, and compute its `id` the same way.
529
539
  2. Append one entry to `auto-answers.md` in the work folder — whoever reads it later has not seen
@@ -537,12 +547,13 @@ own recommended option, in the same turn:
537
547
  - [ ] <each other option, in its order>
538
548
  ```
539
549
 
540
- `MR/PR <n>` is this MR/PR's `mrs[]` entry, left out for a work with no `mrs`.
550
+ `MR/PR <n>` is this MR/PR's `mrs[]` entry, left out for a work with no `mrs` — and for a study
551
+ phase run before `plan` wrote them, whose entries go to the first MR/PR the work publishes.
541
552
  3. Apply that option as an orchestrator's answer is applied (above): written where the re-entry
542
553
  table says, with every effect its row names — *Fix them* writes the plan steps and chains into
543
554
  `build` / `fix` — and `{ "key": "unattended:answer:<gate>", "default": "<option>", "id": "<id>",
544
555
  "phase": "<phase>", "head": "<head>", "mr": <n>, "source": "recommended" }` in
545
- `meta.json.defaults_used[]`, so "Which site takes it" reads it as it reads any answer.
556
+ `meta.json.defaults_used[]` — `mr` left out when the heading names none — so "Which site takes it" reads it as it reads any answer.
546
557
  4. `pending` stays `null`: no `ask`, no end of the run. The phase goes on from that site.
547
558
 
548
559
  Still a question stop, as above:
@@ -552,8 +563,23 @@ Still a question stop, as above:
552
563
  - **A third `high_findings` on the same MR/PR** — two `source: "recommended"` answers to that gate
553
564
  with this `mr` already in `defaults_used[]`: two rounds of fixes that left high findings behind
554
565
  are for a person to judge.
555
- - **Outside those five phases** — the study phases, and `respond` and `green`, ask or block as
556
- they always do: a review round answers a reviewer, and the ticket's owner decides that one.
566
+ - **An option that reaches another repository** — taken, it adds a `meta.json.related_repos`
567
+ entry, or changes a contract a sibling repo consumes (a `related_repos` consumer in
568
+ `03-design.md` "External contracts") or published (`01-context.md` "Contracts received"). The
569
+ orchestrator owns this checkout only; widening the work past it is a person's call.
570
+ - **An option that writes a schema object `approved-schema.md` does not list** — a table, column,
571
+ index, constraint or data copy, or any of them when the file does not exist. A `migration`
572
+ question in `build`, `fix` or `review` is this case by construction: one that writes only listed
573
+ objects is never asked (§2, a schema approved with the study), and hard gate 3 asks for whatever
574
+ lies beyond the list. Applying a migration (`validate`) and the pre-deploy SQL (`ship`) write no
575
+ new object, and are answered as before.
576
+ - **A bundled option** — *Apply the recommended response to each* of a `design_challenge` or an
577
+ `investigation_challenge` — is judged response by response: one that falls in either case above
578
+ stops the whole question.
579
+ - **The study phases before the door to code** — the first study run, a `--study` work still
580
+ being studied, a study a person's changes rewound — and **`respond`, `green` and `start`**, in
581
+ every case, ask or block as they always do: a review round answers a reviewer, and the ticket's
582
+ owner decides that one.
557
583
 
558
584
  `ship` puts this MR/PR's entries in the body (its "In every mode" paragraph), so the person who
559
585
  reads the draft sees each question, its options and the one taken, and asks for a change there.
@@ -44,7 +44,7 @@ Implementation phase. Code is written here.
44
44
  before writing against it. Nothing is checked; waiting is the builder's call.
45
45
  - `size` M/L: require both `03-design.md` **and** `04-mr-plan.md`. Plan missing → send to `/flow-feat-plan`; design missing → send to `/flow-feat-design`.
46
46
  - `size` XS/S: may start without a design — ask the user for a 2-3 line note on what will be done and save it as a minimal `03-design.md`. No MR/PR plan (always 1 MR/PR).
47
- - **If `meta.json.mrs` has more than one entry**: pick the **startable** MR/PR — the `pending` one with the **lowest `n` whose `depends_on` are all `merged`**. Dependencies still `pending`/`in_progress` → not startable, even with a low `n`. (No `wave`/`depends_on` — an older plan — → "first pending by `n`".)
47
+ - **If `meta.json.mrs` has more than one entry**: pick the **startable** MR/PR — the `pending` one with the **lowest `n` whose `depends_on` are all `merged`**. Dependencies still `pending`/`in_progress` → not startable, even with a low `n`. **In `unattended` on `why = next`** (a stacked split, flow-core §2.1) a dependency `published` counts as met: `meta.json.base` is that part's branch, so the new branch starts on top of it. (No `wave`/`depends_on` — an older plan — → "first pending by `n`".)
48
48
  - **Parallel siblings**: startable `pending` MRs/PRs in the **same `wave`** with no dependency between them can be built in parallel or as a train. `manual`: let the user choose which to take now (default: lowest `n`); `guided`/`auto`: take the lowest `n`, record the choice. Mark the chosen one `in_progress`.
49
49
  - All `merged` → warn: feature is done, nothing to build (in `unattended`: `done`, the summary saying so).
50
50
  - Some `pending` but **none** startable → start nothing: tell the user which MR/PR must merge to unlock the next wave, and stop. In `unattended`: `blocked`, the reason naming it.
@@ -52,11 +52,13 @@ place it would ask:
52
52
  the work folder.
53
53
  - **"Was it merged?" (§6.1)** → not merged: the entry stays `in_progress` (a work with no `mrs`
54
54
  keeps `phase = "ship"`) until `publish` succeeds, below. **The parent merged first (§6.2.1)** → blocked, never
55
- force-push. **Train continuation (§6.2)** → not started: one MR/PR per unattended run.
55
+ force-push. **Train continuation (§6.2)** → not started: one MR/PR per unattended run (with
56
+ `--stack`, the orchestrator launches the next one as `why = next`).
56
57
  - **At Close**, after `meta.json` and `00-summary.md` are written: commit what is left outside
57
58
  `.claude/work/` so the tree is clean, then the run's closing order — `<cmd> publish --title-file
58
59
  <work>/publish-title.md --body-file <work>/publish-body.md`, plus `--part <n> --of <N>` when
59
- `meta.json.mrs` has more than one entry (`n` this MR/PR's, `N` the number of entries). Exit 0 →
60
+ `meta.json.mrs` has more than one entry (`n` this MR/PR's, `N` the number of entries), and
61
+ `--stack` beside them when `<cmd> ticket --json` says `"stack": true` (flow-core §2.1). Exit 0 →
60
62
  this MR/PR's `mrs[]` entry gets `status: "published"` (a work with no `mrs`: `meta.json.published:
61
63
  true`) — what `/flow-work-run` turns into `merged` when the orchestrator relaunches with
62
64
  `why = merged` — and nothing else runs. The summary and the panel written before it say the work
@@ -70,7 +72,8 @@ where it failed too — and the review findings an orchestrator's answer accepte
70
72
  (`06-review.md` "Answered (unattended)"), one line each. The §3 preview shows that section like
71
73
  any other, and the person reading it is the check the run could not do. Entries of
72
74
  `auto-answers.md` for this MR/PR (`MR/PR <n>` in their heading, or all of them for a work with no
73
- `mrs`) go into the body verbatim under `## Decided without asking` — each question, its options,
75
+ `mrs`) — plus, while no `mrs[]` entry is `published` or `merged`, every entry whose heading names none: a study
76
+ phase answered it before `plan` wrote `mrs` — go into the body verbatim under `## Decided without asking` — each question, its options,
74
77
  the one taken checked (flow-core §2.1, the recommended answer).
75
78
 
76
79
  ## 1. Pre-flight
@@ -36,7 +36,7 @@ of truth, and an argument that disagrees with it is ignored and named in the log
36
36
  other mode a person is the router (`/flow-next`).
37
37
  - `autonomy.orchestrator_cmd` empty → flow-core §2.1: no phase runs.
38
38
  - Run `<cmd> why`. It fails, or prints anything but `start`, `study`, `answer`, `review`,
39
- `pipeline`, `merged` or `conflict` → print what it returned and its stderr in the §3 header and end. No closing order: an
39
+ `pipeline`, `merged`, `conflict` or `next` → print what it returned and its stderr in the §3 header and end. No closing order: an
40
40
  orchestrator that cannot say why it launched the run cannot take one either.
41
41
  - Run `<cmd> ticket --json` and keep `number`, `title`, `base` and `kind` (`kind` absent or `null` → `feat`: the tracker could not tell, so flow decides). `kind` is re-read on every run; only a run that starts the work uses it — once the work exists, its folder says feat or bug.
42
42
  It fails or prints no `number` → `blocked` (flow-core §2.1).
@@ -63,6 +63,8 @@ of truth, and an argument that disagrees with it is ignored and named in the log
63
63
  | `merged` | exists, something published | the entry of `meta.json.mrs` whose `status` is `published` (the only one: one MR/PR per run) becomes `merged`; set `meta.json.base` to the `base` just read (empty → `git.default_base`); the next startable MR/PR → `/flow-feat-build`; none left, or a work with no `mrs` and `published` true (one MR/PR, every bug) → `phase = done` and `done`, the summary naming the ticket as complete |
64
64
  | `merged` | exists, nothing published, its last `mrs[]` entry with a number `merged` | the same merge again: a run that recorded it and then stopped (a block, a crash) is relaunched with the same `why`, since no part was published after it. Nothing to record — the next startable MR/PR → `/flow-feat-build`; none left → `phase = done` and `done`, as the row above |
65
65
  | `merged` | none, or nothing published and nothing merged | `blocked` — nothing of this ticket was published from here |
66
+ | `next` | exists, something published | a stacked split (flow-core §2.1, `--stack`): nothing merged, so every `published` entry stays `published`. Set `meta.json.base` to the `base` just read — the branch of the part published last, or the umbrella — then the next startable MR/PR, a `published` dependency counting as met → `/flow-feat-build`; none left → `done`, the summary saying every part is published and waits to merge |
67
+ | `next` | none, or nothing published | `blocked` — there is no published part to build on |
66
68
  | `review` | exists | `/flow-work-respond` — the threads come from `<cmd> events --json` |
67
69
  | `pipeline` | exists | `/flow-work-green` — the failed jobs come from `<cmd> events --json` |
68
70
  | `conflict` | exists | `/flow-work-green` — the MR/PR conflicts with its base; which base, and where it stands, come from `<cmd> events --json` |
@@ -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.99.2`.** Compare it once, at the start of the session, against
19
+ **This file belongs to flow `0.101.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
@@ -301,14 +301,15 @@ configuration; these orders are the whole interface, and nothing else about the
301
301
  assumed:
302
302
 
303
303
  ```
304
- <cmd> why → start | study | answer | review | pipeline | merged | conflict
305
- <cmd> ticket --json → {number, title, body, comments[{author, at, text}], base, kind}
304
+ <cmd> why → start | study | answer | review | pipeline | merged | conflict | next
305
+ <cmd> ticket --json → {number, title, body, comments[{author, at, text}], base, kind, stack?}
306
306
  <cmd> answer → one option's exact text, or free text; exit 2 = no reply
307
307
  <cmd> events --json → {"comments":[{thread,kind,id,author,at,body,url,path?,line?,owner?}]}
308
308
  | {"sha":…, "failed":[{name,conclusion,url,log_tail}]}
309
309
  | {"conflict":{"base":…, "base_sha":…}}
310
+ | {"part":…, "parts":…, "part_pr":{number,url,branch}|null, "umbrella":{…}}
310
311
  <cmd> ask --question-file F --options-file F [--recommended N] [--free-text] [--gate NAME]
311
- <cmd> publish --title-file F --body-file F [--part N --of M]
312
+ <cmd> publish --title-file F --body-file F [--part N --of M [--stack]]
312
313
  <cmd> blocked --reason-file F
313
314
  <cmd> done [--summary-file F] [--depends-on N]…
314
315
  <cmd> reply --thread ID --body-file F
@@ -329,6 +330,12 @@ assumed:
329
330
  (`/flow-feat-ship`). A publish that updates one already open — `/flow-work-green`,
330
331
  `/flow-work-respond` — carries neither: the MR/PR is already that part, and an orchestrator may
331
332
  refuse a part declared on a run launched for `pipeline`, `conflict` or `review`.
333
+ - **`--stack` goes with every `--part` when `<cmd> ticket --json` says `"stack": true`** — an
334
+ orchestrator that can stack a split's parts says so there, and only there. It then builds the next
335
+ part without waiting for this one to merge: the run ends at `publish` as always, and the next
336
+ launch is `why = next`, with `base` the branch of the part just published (or the umbrella, once
337
+ every part below it is in). `stack` absent or false → no `--stack`, and the next part waits for
338
+ `why = merged` as before.
332
339
  - **Free text travels in files, never on the command line.** Question, options (one per line, the
333
340
  recommended one first), title, body, reason and summary are written into the work folder
334
341
  (`ask-question.md`, `ask-options.md`, `publish-title.md`, `publish-body.md`, `blocked-reason.md`,
@@ -372,7 +379,7 @@ run has.
372
379
  runs the study phases as any run does, and three rules make it stop where it should:
373
380
 
374
381
  - **The door to code.** The first step of `/flow-feat-build` and `/flow-bug-fix` pre-flight, in
375
- `unattended`, re-reads `<cmd> why`: `start`, `answer`, `merged`, `review`, `pipeline` or `conflict` → go on;
382
+ `unattended`, re-reads `<cmd> why`: `start`, `answer`, `merged`, `next`, `review`, `pipeline` or `conflict` → go on;
376
383
  `study` → the study ends here; anything else, or the order failing → `blocked`. Every path from a
377
384
  study to code crosses that door, an answered question that resumes straight into `build`
378
385
  included, so the phases before it carry no clause. The run kind is read there, never stored: the
@@ -419,8 +426,8 @@ person asking for changes, a ticket that already has code — is `/flow-work-run
419
426
  | Criteria that need a person to verify (`validate`) | record — `not-verified-unattended`; every later `ship`, in any mode, lists them in the body under "Not verified — needs a human" |
420
427
  | The query duel needs a database (`review`, `query`) | record — schema-only verdict; never create or seed a database |
421
428
  | "Was it merged?" (`ship` close) | record — not merged; the orchestrator relaunches with `why = merged` when it is |
422
- | The next MR/PR of a train (`ship` close) | record — not started: one MR/PR per unattended run |
423
- | `build` with no startable MR/PR (its `depends_on` not `merged` in `meta.json`) | blocked — the reason names what must merge; an unattended `build` never stacks a branch on another, and never creates a remote branch |
429
+ | The next MR/PR of a train (`ship` close) | record — not started: one MR/PR per unattended run; with `--stack` the orchestrator relaunches with `why = next` |
430
+ | `build` with no startable MR/PR (its `depends_on` not `merged` in `meta.json`) | blocked — the reason names what must merge; an unattended `build` never stacks a branch on another, and never creates a remote branch. **On `why = next`** a dependency `published` counts as met: the orchestrator's `base` already holds it, and the new branch starts there |
424
431
  | The parent of a stacked MR/PR merged — rebase and force-push | blocked — never force-push unattended |
425
432
  | 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 |
426
433
  | 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 |
@@ -522,7 +529,10 @@ only in `unattended` (empty or `ask` → every question stops as above). It appl
522
529
  holds a study a person approved: `done-summary.md` in the work folder (a study run, approved with
523
530
  `why = start`) or `meta.json.handoff` true (a study handed off from elsewhere). Then a question
524
531
  stop in `build`, `fix`, `review`, `validate` or `ship` is not sent, and the run answers it with its
525
- own recommended option, in the same turn:
532
+ own recommended option, in the same turn. So is one in `design`, `plan` or `investigate` once the
533
+ work has crossed the door to code — `05-implementation.md` or `04-fix.md` exists, as when building
534
+ sent the work back to the study: `--study` sets `handoff` at start, before anyone approved anything,
535
+ so before that door the flag proves nothing.
526
536
 
527
537
  1. Write the question and options files as the stop would, and compute its `id` the same way.
528
538
  2. Append one entry to `auto-answers.md` in the work folder — whoever reads it later has not seen
@@ -536,12 +546,13 @@ own recommended option, in the same turn:
536
546
  - [ ] <each other option, in its order>
537
547
  ```
538
548
 
539
- `MR/PR <n>` is this MR/PR's `mrs[]` entry, left out for a work with no `mrs`.
549
+ `MR/PR <n>` is this MR/PR's `mrs[]` entry, left out for a work with no `mrs` — and for a study
550
+ phase run before `plan` wrote them, whose entries go to the first MR/PR the work publishes.
540
551
  3. Apply that option as an orchestrator's answer is applied (above): written where the re-entry
541
552
  table says, with every effect its row names — *Fix them* writes the plan steps and chains into
542
553
  `build` / `fix` — and `{ "key": "unattended:answer:<gate>", "default": "<option>", "id": "<id>",
543
554
  "phase": "<phase>", "head": "<head>", "mr": <n>, "source": "recommended" }` in
544
- `meta.json.defaults_used[]`, so "Which site takes it" reads it as it reads any answer.
555
+ `meta.json.defaults_used[]` — `mr` left out when the heading names none — so "Which site takes it" reads it as it reads any answer.
545
556
  4. `pending` stays `null`: no `ask`, no end of the run. The phase goes on from that site.
546
557
 
547
558
  Still a question stop, as above:
@@ -551,8 +562,23 @@ Still a question stop, as above:
551
562
  - **A third `high_findings` on the same MR/PR** — two `source: "recommended"` answers to that gate
552
563
  with this `mr` already in `defaults_used[]`: two rounds of fixes that left high findings behind
553
564
  are for a person to judge.
554
- - **Outside those five phases** — the study phases, and `respond` and `green`, ask or block as
555
- they always do: a review round answers a reviewer, and the ticket's owner decides that one.
565
+ - **An option that reaches another repository** — taken, it adds a `meta.json.related_repos`
566
+ entry, or changes a contract a sibling repo consumes (a `related_repos` consumer in
567
+ `03-design.md` "External contracts") or published (`01-context.md` "Contracts received"). The
568
+ orchestrator owns this checkout only; widening the work past it is a person's call.
569
+ - **An option that writes a schema object `approved-schema.md` does not list** — a table, column,
570
+ index, constraint or data copy, or any of them when the file does not exist. A `migration`
571
+ question in `build`, `fix` or `review` is this case by construction: one that writes only listed
572
+ objects is never asked (§2, a schema approved with the study), and hard gate 3 asks for whatever
573
+ lies beyond the list. Applying a migration (`validate`) and the pre-deploy SQL (`ship`) write no
574
+ new object, and are answered as before.
575
+ - **A bundled option** — *Apply the recommended response to each* of a `design_challenge` or an
576
+ `investigation_challenge` — is judged response by response: one that falls in either case above
577
+ stops the whole question.
578
+ - **The study phases before the door to code** — the first study run, a `--study` work still
579
+ being studied, a study a person's changes rewound — and **`respond`, `green` and `start`**, in
580
+ every case, ask or block as they always do: a review round answers a reviewer, and the ticket's
581
+ owner decides that one.
556
582
 
557
583
  `ship` puts this MR/PR's entries in the body (its "In every mode" paragraph), so the person who
558
584
  reads the draft sees each question, its options and the one taken, and asks for a change there.
@@ -42,7 +42,7 @@ Implementation phase. Code is written here.
42
42
  before writing against it. Nothing is checked; waiting is the builder's call.
43
43
  - `size` M/L: require both `03-design.md` **and** `04-mr-plan.md`. Plan missing → send to `/flow-feat-plan`; design missing → send to `/flow-feat-design`.
44
44
  - `size` XS/S: may start without a design — ask the user for a 2-3 line note on what will be done and save it as a minimal `03-design.md`. No MR/PR plan (always 1 MR/PR).
45
- - **If `meta.json.mrs` has more than one entry**: pick the **startable** MR/PR — the `pending` one with the **lowest `n` whose `depends_on` are all `merged`**. Dependencies still `pending`/`in_progress` → not startable, even with a low `n`. (No `wave`/`depends_on` — an older plan — → "first pending by `n`".)
45
+ - **If `meta.json.mrs` has more than one entry**: pick the **startable** MR/PR — the `pending` one with the **lowest `n` whose `depends_on` are all `merged`**. Dependencies still `pending`/`in_progress` → not startable, even with a low `n`. **In `unattended` on `why = next`** (a stacked split, flow-core §2.1) a dependency `published` counts as met: `meta.json.base` is that part's branch, so the new branch starts on top of it. (No `wave`/`depends_on` — an older plan — → "first pending by `n`".)
46
46
  - **Parallel siblings**: startable `pending` MRs/PRs in the **same `wave`** with no dependency between them can be built in parallel or as a train. `manual`: let the user choose which to take now (default: lowest `n`); `guided`/`auto`: take the lowest `n`, record the choice. Mark the chosen one `in_progress`.
47
47
  - All `merged` → warn: feature is done, nothing to build (in `unattended`: `done`, the summary saying so).
48
48
  - Some `pending` but **none** startable → start nothing: tell the user which MR/PR must merge to unlock the next wave, and stop. In `unattended`: `blocked`, the reason naming it.
@@ -50,11 +50,13 @@ place it would ask:
50
50
  the work folder.
51
51
  - **"Was it merged?" (§6.1)** → not merged: the entry stays `in_progress` (a work with no `mrs`
52
52
  keeps `phase = "ship"`) until `publish` succeeds, below. **The parent merged first (§6.2.1)** → blocked, never
53
- force-push. **Train continuation (§6.2)** → not started: one MR/PR per unattended run.
53
+ force-push. **Train continuation (§6.2)** → not started: one MR/PR per unattended run (with
54
+ `--stack`, the orchestrator launches the next one as `why = next`).
54
55
  - **At Close**, after `meta.json` and `00-summary.md` are written: commit what is left outside
55
56
  `.claude/work/` so the tree is clean, then the run's closing order — `<cmd> publish --title-file
56
57
  <work>/publish-title.md --body-file <work>/publish-body.md`, plus `--part <n> --of <N>` when
57
- `meta.json.mrs` has more than one entry (`n` this MR/PR's, `N` the number of entries). Exit 0 →
58
+ `meta.json.mrs` has more than one entry (`n` this MR/PR's, `N` the number of entries), and
59
+ `--stack` beside them when `<cmd> ticket --json` says `"stack": true` (flow-core §2.1). Exit 0 →
58
60
  this MR/PR's `mrs[]` entry gets `status: "published"` (a work with no `mrs`: `meta.json.published:
59
61
  true`) — what `/flow-work-run` turns into `merged` when the orchestrator relaunches with
60
62
  `why = merged` — and nothing else runs. The summary and the panel written before it say the work
@@ -68,7 +70,8 @@ where it failed too — and the review findings an orchestrator's answer accepte
68
70
  (`06-review.md` "Answered (unattended)"), one line each. The §3 preview shows that section like
69
71
  any other, and the person reading it is the check the run could not do. Entries of
70
72
  `auto-answers.md` for this MR/PR (`MR/PR <n>` in their heading, or all of them for a work with no
71
- `mrs`) go into the body verbatim under `## Decided without asking` — each question, its options,
73
+ `mrs`) — plus, while no `mrs[]` entry is `published` or `merged`, every entry whose heading names none: a study
74
+ phase answered it before `plan` wrote `mrs` — go into the body verbatim under `## Decided without asking` — each question, its options,
72
75
  the one taken checked (flow-core §2.1, the recommended answer).
73
76
 
74
77
  ## 1. Pre-flight
@@ -34,7 +34,7 @@ of truth, and an argument that disagrees with it is ignored and named in the log
34
34
  other mode a person is the router (`/flow-next`).
35
35
  - `autonomy.orchestrator_cmd` empty → flow-core §2.1: no phase runs.
36
36
  - Run `<cmd> why`. It fails, or prints anything but `start`, `study`, `answer`, `review`,
37
- `pipeline`, `merged` or `conflict` → print what it returned and its stderr in the §3 header and end. No closing order: an
37
+ `pipeline`, `merged`, `conflict` or `next` → print what it returned and its stderr in the §3 header and end. No closing order: an
38
38
  orchestrator that cannot say why it launched the run cannot take one either.
39
39
  - Run `<cmd> ticket --json` and keep `number`, `title`, `base` and `kind` (`kind` absent or `null` → `feat`: the tracker could not tell, so flow decides). `kind` is re-read on every run; only a run that starts the work uses it — once the work exists, its folder says feat or bug.
40
40
  It fails or prints no `number` → `blocked` (flow-core §2.1).
@@ -61,6 +61,8 @@ of truth, and an argument that disagrees with it is ignored and named in the log
61
61
  | `merged` | exists, something published | the entry of `meta.json.mrs` whose `status` is `published` (the only one: one MR/PR per run) becomes `merged`; set `meta.json.base` to the `base` just read (empty → `git.default_base`); the next startable MR/PR → `/flow-feat-build`; none left, or a work with no `mrs` and `published` true (one MR/PR, every bug) → `phase = done` and `done`, the summary naming the ticket as complete |
62
62
  | `merged` | exists, nothing published, its last `mrs[]` entry with a number `merged` | the same merge again: a run that recorded it and then stopped (a block, a crash) is relaunched with the same `why`, since no part was published after it. Nothing to record — the next startable MR/PR → `/flow-feat-build`; none left → `phase = done` and `done`, as the row above |
63
63
  | `merged` | none, or nothing published and nothing merged | `blocked` — nothing of this ticket was published from here |
64
+ | `next` | exists, something published | a stacked split (flow-core §2.1, `--stack`): nothing merged, so every `published` entry stays `published`. Set `meta.json.base` to the `base` just read — the branch of the part published last, or the umbrella — then the next startable MR/PR, a `published` dependency counting as met → `/flow-feat-build`; none left → `done`, the summary saying every part is published and waits to merge |
65
+ | `next` | none, or nothing published | `blocked` — there is no published part to build on |
64
66
  | `review` | exists | `/flow-work-respond` — the threads come from `<cmd> events --json` |
65
67
  | `pipeline` | exists | `/flow-work-green` — the failed jobs come from `<cmd> events --json` |
66
68
  | `conflict` | exists | `/flow-work-green` — the MR/PR conflicts with its base; which base, and where it stands, come from `<cmd> events --json` |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flow-workflows",
3
- "version": "0.99.2",
3
+ "version": "0.101.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.99.2",
6
+ "version": "0.101.0",
7
7
  "author": {
8
8
  "name": "Alberto Vioque",
9
9
  "email": "mashware@gmail.com"
@@ -5,6 +5,40 @@ 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.101.0 — An approved study answers its own design questions too · 2026-10-25
9
+
10
+ **In short**
11
+ - **`after_study: recommended` now reaches `design`, `plan` and `investigate`** — once the work has
12
+ crossed the door to code (`05-implementation.md` or `04-fix.md` exists) and building sent it back
13
+ to the study. Before that door nothing changes: `--study` sets `handoff` at start, before anyone
14
+ approved anything.
15
+ - **Still a person's call, in every phase the rule covers:** a recommended option that adds
16
+ another repository or changes a sibling's contract, and one that writes a schema object
17
+ `approved-schema.md` does not list. A `migration` question in `build`, `fix` or `review` for an
18
+ unlisted object now stops — the recommended answer used to take it past hard gate 3.
19
+ - **A bundled challenge answer is judged response by response:** one that widens the work stops
20
+ the whole question.
21
+ - **Answers given before `plan` wrote `mrs`** go into the draft MR/PR under `## Decided without
22
+ asking` while no part is published yet.
23
+
24
+ A study approved with "take the recommended option" still stopped at every design question a gap
25
+ in the build sent it back to, and the answer — always the recommended one — came hours later on a
26
+ cold relaunch.
27
+
28
+ ## v0.100.0 — An unattended split builds every part without waiting for merges · 2026-10-23
29
+
30
+ **In short**
31
+ - **`publish --part … --stack` when the orchestrator offers it.** `<cmd> ticket --json` saying
32
+ `"stack": true` means the orchestrator can stack a split's parts: `ship` passes `--stack` with
33
+ every part, and the next part no longer waits for the previous one to merge.
34
+ - **`/flow:work:run` routes `why = next`.** Nothing merged: the published parts stay `published`,
35
+ `meta.json.base` becomes the part published last (or the umbrella), and the next startable MR/PR
36
+ is built on it — a `published` dependency counts as met on this route only.
37
+ - **Without `stack` nothing changes:** the next part waits for `why = merged`, as before.
38
+
39
+ An unattended split used to stop after each part until a person merged it, so a split ticket left
40
+ to run overnight was one part long in the morning.
41
+
8
42
  ## v0.99.2 — A failure is called pre-existing only under the same load · 2026-10-22
9
43
 
10
44
  **In short**
@@ -129,10 +129,12 @@ How much the flow advances on its own vs. stopping to ask you.
129
129
  # the run's one closing order (`ask`, `publish`, `blocked`, `done`). Read only
130
130
  # in that mode. The orders: flow-core §2.1.
131
131
  - `after_study:` # `ask` (default) | `recommended`. Read only in `unattended`, once the work holds an approved study.
132
- # ask — a question in build/fix/review/validate/ship ends the run with `ask`.
132
+ # ask — a question in build/fix/review/validate/ship ends the run with `ask`,
133
+ # and so does one in design/plan/investigate once building began.
133
134
  # recommended — the run takes the recommended option itself and goes on; the draft
134
135
  # MR/PR lists each question with its options, the one taken checked.
135
- # Questions with no recommended option, and a third high-findings round, still ask.
136
+ # Questions with no recommended option, a third high-findings round, and an option
137
+ # that reaches another repo or a schema object the study did not list, still ask.
136
138
 
137
139
  ## quality
138
140
  Repo commands for quality gates, whatever the stack — `make test`, `./gradlew test`, `dotnet test`,