flow-workflows 0.62.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 (142) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +320 -0
  3. package/adapters/README.md +128 -0
  4. package/adapters/codex/AGENTS.md +82 -0
  5. package/adapters/codex/CORE.md +522 -0
  6. package/adapters/codex/PRIMITIVES.md +64 -0
  7. package/adapters/codex/README.md +126 -0
  8. package/adapters/codex/config.snippet.toml +88 -0
  9. package/adapters/codex/skills/flow-bug-fix/SKILL.md +171 -0
  10. package/adapters/codex/skills/flow-bug-investigate/SKILL.md +216 -0
  11. package/adapters/codex/skills/flow-bug-postmortem/SKILL.md +98 -0
  12. package/adapters/codex/skills/flow-bug-review/SKILL.md +190 -0
  13. package/adapters/codex/skills/flow-bug-ship/SKILL.md +187 -0
  14. package/adapters/codex/skills/flow-bug-start/SKILL.md +212 -0
  15. package/adapters/codex/skills/flow-bug-validate/SKILL.md +99 -0
  16. package/adapters/codex/skills/flow-doctor/SKILL.md +254 -0
  17. package/adapters/codex/skills/flow-feat-build/SKILL.md +350 -0
  18. package/adapters/codex/skills/flow-feat-design/SKILL.md +399 -0
  19. package/adapters/codex/skills/flow-feat-plan/SKILL.md +165 -0
  20. package/adapters/codex/skills/flow-feat-review/SKILL.md +350 -0
  21. package/adapters/codex/skills/flow-feat-ship/SKILL.md +417 -0
  22. package/adapters/codex/skills/flow-feat-start/SKILL.md +289 -0
  23. package/adapters/codex/skills/flow-feat-validate/SKILL.md +216 -0
  24. package/adapters/codex/skills/flow-init/SKILL.md +153 -0
  25. package/adapters/codex/skills/flow-news/SKILL.md +57 -0
  26. package/adapters/codex/skills/flow-next/SKILL.md +55 -0
  27. package/adapters/codex/skills/flow-work-README/SKILL.md +247 -0
  28. package/adapters/codex/skills/flow-work-abandon/SKILL.md +103 -0
  29. package/adapters/codex/skills/flow-work-clean/SKILL.md +228 -0
  30. package/adapters/codex/skills/flow-work-daily/SKILL.md +114 -0
  31. package/adapters/codex/skills/flow-work-green/SKILL.md +162 -0
  32. package/adapters/codex/skills/flow-work-query/SKILL.md +169 -0
  33. package/adapters/codex/skills/flow-work-respond/SKILL.md +176 -0
  34. package/adapters/codex/skills/flow-work-resume/SKILL.md +123 -0
  35. package/adapters/codex/skills/flow-work-status/SKILL.md +127 -0
  36. package/adapters/codex/skills/flow-work-try/SKILL.md +94 -0
  37. package/adapters/codex/skills/flow-work-watch/SKILL.md +223 -0
  38. package/adapters/gemini/CORE.md +521 -0
  39. package/adapters/gemini/PRIMITIVES.md +117 -0
  40. package/adapters/gemini/README.md +149 -0
  41. package/adapters/gemini/commands/flow/bug/fix.toml +168 -0
  42. package/adapters/gemini/commands/flow/bug/investigate.toml +213 -0
  43. package/adapters/gemini/commands/flow/bug/postmortem.toml +95 -0
  44. package/adapters/gemini/commands/flow/bug/review.toml +187 -0
  45. package/adapters/gemini/commands/flow/bug/ship.toml +184 -0
  46. package/adapters/gemini/commands/flow/bug/start.toml +209 -0
  47. package/adapters/gemini/commands/flow/bug/validate.toml +96 -0
  48. package/adapters/gemini/commands/flow/doctor.toml +251 -0
  49. package/adapters/gemini/commands/flow/feat/build.toml +347 -0
  50. package/adapters/gemini/commands/flow/feat/design.toml +396 -0
  51. package/adapters/gemini/commands/flow/feat/plan.toml +162 -0
  52. package/adapters/gemini/commands/flow/feat/review.toml +347 -0
  53. package/adapters/gemini/commands/flow/feat/ship.toml +414 -0
  54. package/adapters/gemini/commands/flow/feat/start.toml +286 -0
  55. package/adapters/gemini/commands/flow/feat/validate.toml +213 -0
  56. package/adapters/gemini/commands/flow/init.toml +150 -0
  57. package/adapters/gemini/commands/flow/news.toml +54 -0
  58. package/adapters/gemini/commands/flow/next.toml +52 -0
  59. package/adapters/gemini/commands/flow/work/README.toml +244 -0
  60. package/adapters/gemini/commands/flow/work/abandon.toml +100 -0
  61. package/adapters/gemini/commands/flow/work/clean.toml +225 -0
  62. package/adapters/gemini/commands/flow/work/daily.toml +111 -0
  63. package/adapters/gemini/commands/flow/work/green.toml +159 -0
  64. package/adapters/gemini/commands/flow/work/query.toml +166 -0
  65. package/adapters/gemini/commands/flow/work/respond.toml +173 -0
  66. package/adapters/gemini/commands/flow/work/resume.toml +120 -0
  67. package/adapters/gemini/commands/flow/work/status.toml +124 -0
  68. package/adapters/gemini/commands/flow/work/try.toml +91 -0
  69. package/adapters/gemini/commands/flow/work/watch.toml +220 -0
  70. package/adapters/gemini/settings.snippet.json +11 -0
  71. package/adapters/hermes/CORE.md +522 -0
  72. package/adapters/hermes/PRIMITIVES.md +86 -0
  73. package/adapters/hermes/README.md +145 -0
  74. package/adapters/hermes/config.snippet.yaml +63 -0
  75. package/adapters/hermes/skills/flow-bug-fix/SKILL.md +171 -0
  76. package/adapters/hermes/skills/flow-bug-investigate/SKILL.md +216 -0
  77. package/adapters/hermes/skills/flow-bug-postmortem/SKILL.md +98 -0
  78. package/adapters/hermes/skills/flow-bug-review/SKILL.md +190 -0
  79. package/adapters/hermes/skills/flow-bug-ship/SKILL.md +187 -0
  80. package/adapters/hermes/skills/flow-bug-start/SKILL.md +212 -0
  81. package/adapters/hermes/skills/flow-bug-validate/SKILL.md +99 -0
  82. package/adapters/hermes/skills/flow-doctor/SKILL.md +254 -0
  83. package/adapters/hermes/skills/flow-feat-build/SKILL.md +350 -0
  84. package/adapters/hermes/skills/flow-feat-design/SKILL.md +399 -0
  85. package/adapters/hermes/skills/flow-feat-plan/SKILL.md +165 -0
  86. package/adapters/hermes/skills/flow-feat-review/SKILL.md +350 -0
  87. package/adapters/hermes/skills/flow-feat-ship/SKILL.md +417 -0
  88. package/adapters/hermes/skills/flow-feat-start/SKILL.md +289 -0
  89. package/adapters/hermes/skills/flow-feat-validate/SKILL.md +216 -0
  90. package/adapters/hermes/skills/flow-init/SKILL.md +153 -0
  91. package/adapters/hermes/skills/flow-news/SKILL.md +57 -0
  92. package/adapters/hermes/skills/flow-next/SKILL.md +55 -0
  93. package/adapters/hermes/skills/flow-work-README/SKILL.md +247 -0
  94. package/adapters/hermes/skills/flow-work-abandon/SKILL.md +103 -0
  95. package/adapters/hermes/skills/flow-work-clean/SKILL.md +228 -0
  96. package/adapters/hermes/skills/flow-work-daily/SKILL.md +114 -0
  97. package/adapters/hermes/skills/flow-work-green/SKILL.md +162 -0
  98. package/adapters/hermes/skills/flow-work-query/SKILL.md +169 -0
  99. package/adapters/hermes/skills/flow-work-respond/SKILL.md +176 -0
  100. package/adapters/hermes/skills/flow-work-resume/SKILL.md +123 -0
  101. package/adapters/hermes/skills/flow-work-status/SKILL.md +127 -0
  102. package/adapters/hermes/skills/flow-work-try/SKILL.md +94 -0
  103. package/adapters/hermes/skills/flow-work-watch/SKILL.md +223 -0
  104. package/adapters/install.sh +99 -0
  105. package/adapters/opencode/CORE.md +521 -0
  106. package/adapters/opencode/PRIMITIVES.md +118 -0
  107. package/adapters/opencode/README.md +113 -0
  108. package/adapters/opencode/commands/flow-bug-fix.md +169 -0
  109. package/adapters/opencode/commands/flow-bug-investigate.md +214 -0
  110. package/adapters/opencode/commands/flow-bug-postmortem.md +96 -0
  111. package/adapters/opencode/commands/flow-bug-review.md +188 -0
  112. package/adapters/opencode/commands/flow-bug-ship.md +185 -0
  113. package/adapters/opencode/commands/flow-bug-start.md +210 -0
  114. package/adapters/opencode/commands/flow-bug-validate.md +97 -0
  115. package/adapters/opencode/commands/flow-doctor.md +252 -0
  116. package/adapters/opencode/commands/flow-feat-build.md +348 -0
  117. package/adapters/opencode/commands/flow-feat-design.md +397 -0
  118. package/adapters/opencode/commands/flow-feat-plan.md +163 -0
  119. package/adapters/opencode/commands/flow-feat-review.md +348 -0
  120. package/adapters/opencode/commands/flow-feat-ship.md +415 -0
  121. package/adapters/opencode/commands/flow-feat-start.md +287 -0
  122. package/adapters/opencode/commands/flow-feat-validate.md +214 -0
  123. package/adapters/opencode/commands/flow-init.md +151 -0
  124. package/adapters/opencode/commands/flow-news.md +55 -0
  125. package/adapters/opencode/commands/flow-next.md +53 -0
  126. package/adapters/opencode/commands/flow-work-README.md +245 -0
  127. package/adapters/opencode/commands/flow-work-abandon.md +101 -0
  128. package/adapters/opencode/commands/flow-work-clean.md +226 -0
  129. package/adapters/opencode/commands/flow-work-daily.md +112 -0
  130. package/adapters/opencode/commands/flow-work-green.md +160 -0
  131. package/adapters/opencode/commands/flow-work-query.md +167 -0
  132. package/adapters/opencode/commands/flow-work-respond.md +174 -0
  133. package/adapters/opencode/commands/flow-work-resume.md +121 -0
  134. package/adapters/opencode/commands/flow-work-status.md +125 -0
  135. package/adapters/opencode/commands/flow-work-try.md +92 -0
  136. package/adapters/opencode/commands/flow-work-watch.md +221 -0
  137. package/adapters/opencode/opencode.json +8 -0
  138. package/bin/cli.mjs +222 -0
  139. package/package.json +43 -0
  140. package/plugins/flow/.claude-plugin/plugin.json +21 -0
  141. package/plugins/flow/CHANGELOG.md +1744 -0
  142. package/plugins/flow/examples/FLOW.template.md +324 -0
@@ -0,0 +1,396 @@
1
+ # GENERATED by script/adapter-build.py from plugins/flow/commands/feat/design.md — do not edit; change the plugin file and run the script.
2
+ description = "Design the technical solution (architecture, DB, APIs, risks) before touching code"
3
+
4
+ prompt = """
5
+ # `/flow:feat:design`
6
+
7
+ > **gemini adapter — how the Claude Code primitives named below map here.**
8
+ > - `AskUserQuestion` → ask in plain text with numbered options and wait for the reply.
9
+ > - `Agent <role>` / `Agent general-purpose` / subagents → `@<name>` from `.gemini/agents/`; the name comes from `agents.<role>` in `FLOW.md`, empty or absent → do it in this context.
10
+ > - Parallel fan-out → several `@name` in one turn (sequential in this context if none are configured), capped at `agents.fanout_max` (empty → 4); `agents.fanout_tool` is Claude Code-only, ignore it.
11
+ > - `ScheduleWakeup` / `Monitor` / `/loop` → not available in-session: run one cycle, persist state in `monitor.md`, let the user schedule `gemini -p "<command>"` with cron.
12
+ > - `TaskCreate` → a markdown checklist in the phase artifact.
13
+ > - `Skill commit-commands:commit-push-pr` → `git add` · `git commit` · `git push -u origin HEAD` · the `git.cli` CLI (`gh pr create` / `glab mr create`).
14
+ > - `/model <value>` → the `--model` flag at launch.
15
+ > - `knowledge.*` roles → whatever tools `FLOW.md` names there; an MCP tool keeps its name, its server is declared under `mcpServers` in `settings.json` (see `settings.snippet.json`).
16
+
17
+ Read `~/.claude/flow/CORE.gemini.md` first (shared rules: `FLOW.md` step 0, models, autonomy modes and hard gates, how a stop reads, `panel.json`, `00-summary.md`) — skip if you already read it in this session. **Models: the subagents it launches take `models.agents`; its parallel rounds take `models.workers`.**
18
+
19
+ Technical design phase. **Still no production code is written.** Opens the option space first (M/L), then designs the approach that was chosen. Output: a plan the next step executes.
20
+
21
+ ## 1. Pre-flight
22
+
23
+ - Load `meta.json` by current branch. Missing → ask the user to start with `/flow:feat:start`.
24
+ - Read `meta.json` and `00-summary.md`; open in full only `01-context.md` (ticket, decisions, contracts received), and `02-brainstorm.md` when a work started before v0.53.0 has one — its options are §1.5's output, already done. (flow-core §5)
25
+ - `size` is `XS` → suggest jumping to `/flow:feat:build` and stop unless the user insists.
26
+
27
+ ## 1.5 Approaches — open the option space first (M/L)
28
+
29
+ Design that starts from the first idea is design that never had a second one. **M and L run this
30
+ section; XS and S skip it** and go straight to §2 — the cost does not pay on a change whose shape is
31
+ obvious.
32
+
33
+ *(This was the `feat:brainstorm` command until v0.53.0: a command whose whole output only this one ever
34
+ read.)*
35
+
36
+ **No code, and no design yet.** The output of this section is a ranked set of options and one chosen
37
+ approach; §3 onwards designs *that* approach.
38
+
39
+ ### 1.5.1 Focused knowledge query
40
+
41
+ `knowledge.search` set → 2-3 parallel queries on the **concept or pattern** the feature covers, not
42
+ its title (`/flow:feat:start` already queried that): tracking → `"tracking deduplication"`,
43
+ `"hash collision"`; payments → `"trial expiration"`, `"plan downgrade flow"`; an integration →
44
+ `"attachment handler"`, `"tax rules integration"`. Two seconds, then continue regardless. Hits go
45
+ under "Additional domain context" in §5's template.
46
+
47
+ ### 1.5.2 Panel or single agent?
48
+
49
+ - **M or L**, in `manual`: offer the **parallel approach panel** with `AskUserQuestion` ("Generate
50
+ options with a parallel multi-agent panel? Higher token cost, less single-line-of-thought bias.").
51
+ Accepted → §1.5.3; declined → §1.5.4. In `guided`/`auto` **do not ask** — flow mechanics: take the
52
+ panel, note it in one line of `03-design.md`, go to §1.5.3.
53
+ - Declined, or the user insisted on running this on S → §1.5.4.
54
+
55
+ ### 1.5.3 Approach panel (parallel fan-out — LLM-council pattern)
56
+
57
+ **Launch the advisors as parallel subagents** — one per lens, single round, each blind to the others
58
+ (LLM-council: independent advisors, then a chairman synthesises; a **cross-critique** round in
59
+ between for **L** only).
60
+
61
+ **How wide the fan-out goes** — `agents.fanout_max` from `FLOW.md` (empty → **4**): never more than
62
+ that in one round, and never more than `agents.budget_max` (empty → **12**) across this whole
63
+ command run (flow-core §6); a round that does not fit is truncated and the truncation reported
64
+ (`3/4`). With `models.workers` and `models.agents` empty, a round of 4 or more inherits this thread's
65
+ model — say so in one line before launching, naming the key and never a model (flow-core §1).
66
+
67
+ | Size | Rounds |
68
+ |---|---|
69
+ | M | Advisors → you synthesise |
70
+ | L | Advisors → cross-critique → you synthesise |
71
+
72
+ **You are the chairman.** Round 1 (and round 2 on L) are subagents; the synthesis and the ranking are
73
+ yours, never a subagent's — you hold the work's context and you write `03-design.md`.
74
+
75
+ **Round 1 — advisors (parallel, blind to each other).** One subagent per lens, up to `fanout_max`.
76
+ M → the first three lenses; L → add `operations`, and also on a sensitive surface (authentication or
77
+ authorization, payments, personal data, a public contract, a migration):
78
+
79
+ | Lens | Brief |
80
+ |---|---|
81
+ | `minimum` | The **smallest** approach that solves the declared use case, nothing more (strict MVP) |
82
+ | `reuse` | The approach that **most reuses** existing pieces in the affected module or its neighbours |
83
+ | `reframe` | **Challenge the premise**: what if the problem is solved without building what was asked, or somewhere else? |
84
+ | `operations` | The most production-solid approach (observability, integration failure, data at scale) |
85
+
86
+ Each advisor gets this brief, with its lens substituted:
87
+
88
+ > Propose ONE approach to solve ticket `<TICKET>`, from this lens: `<lens brief>`. Read
89
+ > `.claude/work/<TICKET>/01-context.md` for context and the effective FLOW configuration (base plus
90
+ > active harness overlay) for project conventions. Do not
91
+ > write code. Be specific about real modules and layers of this project. Report: name, what it is
92
+ > (one sentence), modules/layers affected, main risk, and why it could be a bad idea. Under 250 words.
93
+
94
+ **Round 2 — cross-critique (L only, parallel).** Each advisor receives the full set and attacks the
95
+ *others* from its own lens:
96
+
97
+ > You are the "`<lens>`" advisor. These are the approaches proposed for `<TICKET>`: `<the round-1
98
+ > set>`. Read `.claude/work/<TICKET>/01-context.md`. From your lens (`<lens brief>`), critique the
99
+ > OTHER approaches — not your own. For each one name its single biggest flaw for THIS project, or
100
+ > "none". Then say which is strongest and which weakest, and why. Be concrete and grounded in the
101
+ > project; do not invent flaws to fill space.
102
+
103
+ **Round 3 — you synthesise.** Rank the approaches best to worst *for this case* (project fit and
104
+ simplicity, not generic merit), weighing the fatal flaws the critique surfaced. State explicitly
105
+ where the advisors **agreed** and where they **disagreed** — the disagreement is the useful part.
106
+
107
+ `agents.fanout_tool` set → run the rounds through that tool instead of plain parallel subagents; the
108
+ rounds, the briefs and the ceiling do not change.
109
+
110
+ **A subagent that comes back empty is asked once for its answer and then dropped, never relaunched**
111
+ (flow-core §6 — an empty result is as often a truncated report as an advisor with nothing to say):
112
+ synthesise from those that answered and record `N/M`. An empty critique round → rank from the
113
+ approaches alone.
114
+
115
+ ### 1.5.4 Single agent (the S case, or a declined panel)
116
+
117
+ Launch a `general-purpose` subagent with this short, self-contained brief:
118
+
119
+ > Generate 3-5 distinct approaches to solve `<title>` following the project conventions (see
120
+ > the effective FLOW configuration and `.claude/work/<TICKET>/01-context.md`). For each: a
121
+ > one-sentence description,
122
+ > modules/layers affected, main risk, and why it could be a bad idea. Do not write code. Report in
123
+ > markdown, under 400 words.
124
+
125
+ A sensitive domain (payments, authentication, tracking) → launch **in parallel** a second
126
+ `general-purpose` subagent focused on what can go wrong in that domain.
127
+
128
+ ### 1.5.5 Choose, and ask what the options surfaced
129
+
130
+ - Write the ranked set into `03-design.md` under "## Approaches considered" (§5's template), each
131
+ with what it is, the modules it touches, its main risk and why it could be a bad idea. Panel run →
132
+ prefix the recommendation with one line of *"Panel consensus / disagreement"*.
133
+ - **New questions the options surfaced** that `/flow:feat:start` did not catch (*"does this only
134
+ apply to paid plans?"*, *"what happens if the user already has N of these?"*) → ask them now with
135
+ `AskUserQuestion`, before designing. Answers go under "Decisions clarified while choosing the
136
+ approach".
137
+ - **Choosing is a genuine decision point**: `manual` and `guided` ask which approach to design; in
138
+ `auto`, take the recommended one and **record the choice and the reason** in `meta.json.notes`.
139
+ - **Is the size still correct?** Much simpler or more complex than assumed → propose reclassifying
140
+ (`AskUserQuestion`) with the new estimate and one line of justification; §7 does this again at the
141
+ end of the design, on what the design actually turned out to be.
142
+
143
+
144
+
145
+ ## 2. Focused knowledge query
146
+
147
+ - `knowledge.search` is set → before the inventory, call `knowledge.search` with 2-4 parallel queries on the **affected module** and the **integrations** the design touches (uncovers legal constraints, integration assumptions, historical couplings).
148
+ - Timeout 2 s; on failure continue. Relevant hits go under "Additional domain context" (§5 template).
149
+ - `false` or empty → skip without notifying.
150
+
151
+ ## 3. Prior inventory (reuse before creating)
152
+
153
+ **Before** launching the design subagents, list what the feature needs that **already exists** in code or DB. Launch an `Agent` with `subagent_type: Explore`:
154
+
155
+ > For feature `<title>` (see `.claude/work/<TICKET>/01-context.md`), search the repo for related pieces that already exist and could be reused: domain entities, value objects, repositories, services, events, columns or tables, CQRS commands/queries, and similar endpoints. Do not propose design — only list what is found with one line each and its location. If the feature mentions concepts like `<concept1>`, `<concept2>`, search for those specifically.
156
+
157
+ Save the result at the top of `03-design.md` under "## What already exists". Design subagents read it and propose new pieces only when nothing equivalent exists; a knowing duplicate must be justified.
158
+
159
+ ## 4. Work
160
+
161
+ 1. Load the project's skills (`FLOW.md` section `conventions`).
162
+ 2. Launch **in parallel** by feature/project type. Agent = `agents.<role>` from `FLOW.md`; empty → `Agent general-purpose` with the role in the prompt.
163
+
164
+ | When | Agent | Task |
165
+ |---|---|---|
166
+ | **Always** | `agents.architecture` | Module where it lives; new/modified entities and value objects; CQRS commands/queries (if applicable); events; repositories. |
167
+ | Touches DB | `agents.persistence` | Mappings, migrations, indexes, entity manager. **Fills the "Access paths" table** (§5): for every read/write — filter, order **with direction**, bound (per key or global), expected rows per key, and **the index that supports it**, checked against today's schema, not assumed. An access path with no index is a decision taken here in writing, not a review discovery. |
168
+ | Touches API/HTTP | `agents.api` | Endpoint, DTO, route, security, response format (planning only). |
169
+ | Critical performance / hot paths | `agents.performance` | Anticipate N+1, repeated out-of-process calls, load risks. |
170
+ | Security (auth, payments, sensitive data) | `agents.security` | Threats and mitigations for the proposed design. |
171
+
172
+ 3. Each subagent receives `01-context.md`, the chosen approach from §1.5 and "What already exists", and every brief ends with the report contract of flow-core §6 (`agents.report_max_words`, empty → 250) — a design proposal long enough for the harness to truncate reaches you as an agent that proposed nothing. Explicit brief instructions:
173
+ - **Before proposing a new entity/column/repository/service, check whether something from the inventory works.** Knowing duplicate → justify in the decision table.
174
+ - **Do not add defensive mechanisms "just in case".** Every validation, guard, retry, lock, fallback or cache carries the **real and present** scenario that requires it, with evidence (a knowledge finding, a file, a known traffic pattern). Hypothetical, or already prevented by the system → **do not propose it**. Solve today's ticket (YAGNI).
175
+
176
+ ## 5. Output
177
+
178
+ Consolidate outputs into `.claude/work/<TICKET>/03-design.md`:
179
+
180
+ ```markdown
181
+ # Design <TICKET>
182
+
183
+ ## Approaches considered
184
+ <M/L only, from §1.5: one block per option — what it is, modules/layers affected, main risk, why it could be a bad idea — then the ranking, the "Panel consensus / disagreement" line when the panel ran, the chosen approach and why. XS/S: "not run at this size".>
185
+
186
+ ## Decisions clarified while choosing the approach
187
+ <the questions §1.5.5 asked and their answers, or omit>
188
+
189
+ ## Additional domain context
190
+ <hits from the focused search_knowledge in §2, or "no findings">
191
+
192
+ ## What already exists (inventory)
193
+ <list of reusable pieces located in §3, or "nothing equivalent found">
194
+
195
+ ## Executive summary
196
+ <3-5 bullets of the chosen solution>
197
+
198
+ ## Acceptance criteria
199
+ <The WHAT: observable, verifiable conditions that must hold for the feature to be "done", distinct from the design's HOW. The feature is done **iff** every criterion holds. Each criterion gets a stable ID (`AC1`, `AC2`, …), is written given/when/then or as a clear assertion, and uses the **literal** values from "External contracts" / "Internal behavioral contracts" below for its concrete result — never prose like "works correctly". Proportional to size: XS/S → a couple of criteria covering what the ticket asks today, no hypothetical futures; M/L → one per distinct observable behavior. Do not manufacture criteria to fill space — the same restraint as the challenger.>
200
+
201
+ | ID | Given / When / Then (or clear assertion) | Proof |
202
+ |----|------------------------------------------|-------|
203
+ | AC1 | Given <state>, when <action>, then <observable result with literal value> | test \\| manual |
204
+ | AC2 | … | … |
205
+
206
+ `Proof` is a hint at how the criterion will be demonstrated in the validate phase: `test` (an automated test can prove it) or `manual` (UI / end-to-end flow verified together with the user). It is a hint, not a commitment — validate builds the real criterion→test mapping and gates against it.
207
+
208
+ ## Modules/layers affected
209
+ - <module/layer> — <what changes>
210
+
211
+ ## Data model
212
+ - New / modified entities: <for each new one, indicate "no equivalent found" or "knowingly duplicated because...">
213
+ - Migrations:
214
+ - Indexes:
215
+
216
+ ### Access paths
217
+ <one row per read or write the feature needs; "N/A — no data access" if it needs none. Fill it from the schema that exists today, and mark as `new` any index the design is asking for. This table is what `/flow:feat:review §3.6` tries the finished query against.>
218
+
219
+ | Access | Filter | Order (with direction) | Bound | Rows per key (source) | Index that supports it |
220
+ |---|---|---|---|---|---|
221
+ | latest downloads per mail | `mail_hash IN (batch of ≤50)` | `created_at DESC` | 15 **per key** | p50 3, worst 3k (`data.volumes`) | `(mail_hash, created_at)` — exists |
222
+ | … | … | … | … | … | … |
223
+
224
+ - **Bounds that are per key** never come from a global limit — say here which shape will carry it (one query per key, a union of per-key subqueries, a window function), and leave the choice to be measured in build/review rather than settled by preference now.
225
+ - **Joins across tables**: state the type, length and charset/collation of **both** key columns when they are not obviously identical. A mismatch there silently costs the index, and it is invisible to every test.
226
+
227
+ ## CQRS / Commands and Queries (if applicable)
228
+ - Commands:
229
+ - Queries:
230
+ - Handlers:
231
+ - Published events:
232
+
233
+ ## API / HTTP (if applicable)
234
+ - Endpoint:
235
+ - DTO:
236
+ - Security:
237
+
238
+ ## Identified risks
239
+ <one line each, `F<n>` in front of any risk this design records but does **not** mitigate — those become `meta.json.followups[]` entries (`kind: "risk"`, `source: "design"`, flow-core §7). A risk the design *does* handle needs no id: say where it is handled. Until now this section was written here and read by nothing.>
240
+ - Performance:
241
+ - Security:
242
+ - Compatibility:
243
+ - Online migrations:
244
+
245
+ ## External contracts
246
+ <If this change touches a surface consumed from outside (another repo, another module, a deployed client, a worker, a migration referenced by name, a metric/dashboard, a domain event, an HTTP route), declare **each contract as a literal** here, not in prose. Any contract left in prose is ambiguous and will be a source of failures at build time. If there is no external surface, write "none" and move on.
247
+
248
+ **Contracts received from another repo are not re-decided here.** If `01-context.md` has a `## Contracts received` section (`/flow:feat:start` §3.6), copy those contracts into this section **as-is** and mark them `received from <repo>`. They are an input to the design, not an output of it: the other side may already be merged or deployed against them. If one looks wrong, raise it with that side — do not quietly design a better version, because the result is two repos shipping two contracts for one ticket, and the disagreement surfaces at integration instead of here.>
249
+
250
+ ### Contract N: <short description — e.g. "HTTP 402 quota_exceeded">
251
+ - **Type**: HTTP response body | header | route | domain event | DB column | metric | other.
252
+ - **Literal shape** (copyable format, not a description):
253
+ ```json
254
+ {"error":{"code":"quota_exceeded","message":"...","details":{"upgrade_url":"https://..."}}}
255
+ ```
256
+ or
257
+ ```
258
+ Header: X-Tracking-Id: <uuid>
259
+ Route: POST /api/internal/v1/resource:action
260
+ Event: ResourceWasCreated { resourceId, createdAt, userHash }
261
+ Metric: resource.created — tags: [plan, status]
262
+ ```
263
+ - **Known consumer**: <consumer name + path where it reads this contract, if known. If the consumer is one of the repos in `meta.json.related_repos`, **name it exactly as that entry's `repo`** — `/flow:feat:ship` §6.3 uses this field to decide which contracts to hand over to which sibling, so an unnamed consumer means the handoff has to fall back to asking the user.>
264
+ - **Pattern deviation**: <if this contract does NOT follow how other similar controllers/events/etc. in the repo do it, ANNOUNCE it explicitly here: "the other controllers return X, this one does NOT follow that pattern, it returns Y because Z">.
265
+
266
+ ### Contract N+1: …
267
+
268
+ ## Internal behavioral contracts
269
+ <Same anti-ambiguity rigor as "External contracts", applied to behavior with **no** external surface: a domain rule, a service's pre/postconditions, a calculation's expected outputs, a state transition. Express each as a concrete, **checkable** statement — literal inputs → literal outputs, or an exact invariant — never prose like "calculates the discount correctly". Each one should map directly to an acceptance criterion above (it is what gives that criterion its literal teeth). If the change has no non-trivial internal behavior (pure wiring, a rename), write "none" and move on — do not invent rules to fill space.>
270
+
271
+ - **Rule / postcondition**: <e.g. "discount(plan=pro, seats=5) → 15% off; discount(plan=free, *) → 0%">
272
+ - **Invariant**: <e.g. "after assignTo(user), ticket.assignee == user AND ticket.status != 'unassigned'">
273
+ - **Edge / boundary**: <e.g. "empty input list → returns 0, does not throw">
274
+
275
+ ## Defensive mechanisms and their justification
276
+ <One row per validation, guard, retry, lock, fallback, cache, idempotency, queue, or flag the design introduces. If you cannot name a REAL and PRESENT scenario that justifies it, the piece is unnecessary — remove it from the design.>
277
+
278
+ | Mechanism | Real scenario that justifies it (with evidence) | Needed now? |
279
+ |-----------|--------------------------------------------------|-------------|
280
+ | <e.g. lock on X> | <e.g. "two workers consume the same queue, see supervisor config"> | yes |
281
+ | <e.g. retry on API Y> | <if "just in case" with no scenario → OUT> | — |
282
+
283
+ ## Implementation plan (order)
284
+ 1. …
285
+ 2. …
286
+
287
+ ## Planned tests
288
+ <Map each planned test to the acceptance criteria it proves (AC ids). A test that proves no criterion and guards no contract is a candidate to cut. Criteria marked `manual` above need no automated test here — they are verified with the user in `/flow:feat:validate`.>
289
+ - Unit:
290
+ - Integration:
291
+ - Functional:
292
+
293
+ ## Decisions (ADR-light)
294
+ | Decision | Discarded alternative | Why |
295
+ |----------|-----------------------|-----|
296
+
297
+ ## Design challenges
298
+ <filled in by §6 with the challenger table>
299
+ ```
300
+
301
+ **"Acceptance criteria"**: start from the provisional list in `01-context.md` (pinned from the ticket in `/flow:feat:start`), fold in the clarifications and the internal/external contracts decided here, and promote it to the canonical enumerated list `/flow:feat:validate` gates against — observable, verifiable, proportional to size.
302
+
303
+ ## 6. Design challenge (challenger)
304
+
305
+ Before closing, **challenge the design** with an `Agent general-purpose` and this self-contained brief:
306
+
307
+ > You are the critical reviewer of the design in `.claude/work/<TICKET>/03-design.md`. **Do not propose implementation.** Challenge the plan from 4 angles. The **first is the most important** and looks for the opposite of the others — it looks for what is UNNECESSARY.
308
+ >
309
+ > 1. **Fit and need (dominant angle — look for what is unnecessary)**: review every defensive mechanism in the design (validation, guard, retry, lock, fallback, cache, idempotency, queue, flag). For each one ask:
310
+ > - **Can that scenario actually happen in this project?** Do not assume — verify: query `knowledge.search` and look at the relevant code. If the system already prevents that scenario (an upstream validates first, a constraint blocks it, the flow does not allow that state, the external integration already guarantees it), the protection is **unnecessary** → finding "this is unnecessary".
311
+ > - **Is it needed now, for what the ticket asks (YAGNI)?** If it solves a hypothetical future problem instead of today's → finding "this is unnecessary, it is YAGNI".
312
+ > - Be concrete about the why: "X is unnecessary because in this project Y always happens first, see `<file>`/`<knowledge finding>`".
313
+ > 2. **Fragile assumptions** (look for what is missing): what beliefs in the design might not hold? What is each one, how could it fail, what would happen? **But before flagging it, confirm the failure is possible in the project** — do not invent theoretical fragilities.
314
+ > 3. **Simplification**: is there a simpler way to achieve the same? Is any piece redundant with "What already exists"?
315
+ > 4. **Production operation**: rollback, observability, online migrations, cross-effects with workers/caches/queues. Only what truly applies to this change.
316
+ > 5. **Decision idiom (audit the "Decisions (ADR-light)" table)**: for each row `Decision | Discarded alternative | Why`:
317
+ > - **False dichotomy**: the row frames the choice as exactly two options (A vs B). Is there an **option C** that was not considered? Name it (e.g. *"use the bus vs couple to the concrete class"* ignores *"expose a service behind an interface"*). If the decision is binary, suspect a missing third path.
318
+ > - **Rationale smell**: is the "Why" a *verifiable reason* or a *manual-sounding phrase* (*"respects bounded contexts"*, *"for consistency"*, *"follows the pattern"*)? If it cannot be checked against a concrete constraint in this project, flag it — it must be made concrete, or marked as a claim to re-verify against the code in review.
319
+ > - **Primitive fit**: does each chosen primitive match its job by name and role (a Query that only reads, a Command that mutates state or emits events)? A primitive doing the opposite of its name is a design smell.
320
+ >
321
+ > Read `01-context.md` for the business goal. Output: markdown table `| Angle | Finding | Type (unnecessary/missing/idiom) | Severity |` with severities `high`/`medium`/`low`. Under 550 words. Do not invent problems to fill space — if an angle has no findings, say "no findings". It is perfectly valid (and desirable) for the result to say "the design is tight, nothing unnecessary or missing".
322
+
323
+ **Sensitive domain** (payments, authentication, personal data, usage/tracking counters) → launch **in parallel** a second `Agent general-purpose`:
324
+
325
+ > Challenge the design from the <domain> angle: what abuse cases are possible? What consistency guarantees are needed that the current design does not provide? What decisions may have regulatory or support consequences? Same table format.
326
+
327
+ Consolidate findings at the end of `03-design.md` under:
328
+
329
+ ```markdown
330
+ ## Design challenges
331
+
332
+ | Angle | Finding | Type | Severity | Response |
333
+ |-------|---------|------|----------|----------|
334
+ | Fit/need | … | unnecessary | high | <empty at first — user fills in> |
335
+ | Assumption | … | missing | medium | … |
336
+ | Decision idiom | … | idiom | high | … |
337
+ | Operation | … | missing | low | … |
338
+ ```
339
+
340
+ **`high` severity without a response** → show the findings and ask with `AskUserQuestion`. Options by type:
341
+
342
+ | Type | Options |
343
+ |---|---|
344
+ | **unnecessary** (fit/YAGNI) | **Cut it** (remove the piece — default) · **Keep and justify** (fill "Response" with the real scenario; if none can be named, it is unnecessary). |
345
+ | **missing** (assumption/operation) | **Reopen §1.5 or the design** to incorporate it · **Assume and document** (fill "Response" with the conscious assumption — `"We assume X because Y"`). |
346
+ | **idiom** (false dichotomy / rationale smell / primitive mismatch) | **Adopt the third option or correct the primitive** (update the ADR row and the affected plan — default when option C is clearly better) · **Keep and make the "Why" concrete** (replace the manual-sounding phrase with a checkable reason; if you cannot, the decision is not justified). Never leave a textbook phrase as rationale. |
347
+
348
+ - Do not advance to close with unresolved high severities. Medium and low stay on record for code review.
349
+ - **A challenger that returns "nothing unnecessary or missing, the design is tight" is a good result, not a failure** — do not force findings.
350
+
351
+ ## 7. Is the size still correct?
352
+
353
+ If what `03-design.md` reveals (migrations, cross-module, integrations) does not fit `meta.json.size`:
354
+
355
+ - Propose reclassifying (`AskUserQuestion`).
356
+ - Confirmed → update `meta.json.size`, note in `meta.json.notes`.
357
+ - **Consequences**: M → L activates the full flow; M → S removes `/flow:feat:plan` from the path. Explicitly inform the user of the flow change.
358
+
359
+ ## 7.5 Cross-repo scope (refine)
360
+
361
+ - If `## Modules/layers affected` points at another repo (consumer, client, shared contract), **add or update `meta.json.related_repos`** (`{ "repo", "scope", "status": "pending", "contract_handoff" }`); drop a repo listed at `start` that turns out not to be needed. flow only records it — the reminder fires at `/flow:feat:ship`.
362
+ - Set `contract_handoff` per entry now that contracts exist: `pending` if any contract in §"External contracts" names that repo as consumer; `none` if the sibling's work touches nothing declared here (UI-only change, independent migration). `pending` is what makes `/flow:feat:ship` §6.3 offer the handoff — never leave `none` on a repo that consumes a contract.
363
+
364
+ ## 8. Domain findings staging
365
+
366
+ `knowledge.stage` is set → review the ADR-light table and the challenges for **non-obvious domain decisions** a future reader could not deduce from the code, e.g.:
367
+
368
+ - "We decided not to use X because the external integration only guarantees Y under Z."
369
+ - "We coupled A with B because legal/fiscal requirements demand that..."
370
+ - "The handler is intentionally non-idempotent because the domain allows it and simplifies the flow."
371
+
372
+ **Evidence before staging.** Every finding carries one line of **evidence** (what you checked, against what), recorded with it in the call. An unverified finding is worse than none — it will be believed.
373
+
374
+ - **Claims about what the code does** → verify against `git.default_base` from `FLOW.md` — not your working branch, **never a train/integration branch** (siblings' changes would look like the baseline).
375
+ - **Claims about generated output** (ORM query, serialized payload, rendered template, resolved config) → verify against the output **actually produced**: dump it, log it, execute it. Never predict from the builder.
376
+
377
+ No evidence line → **do not stage it**: tell the user it did not survive verification and move on.
378
+
379
+ **Silence by default**: nothing non-obvious → do not ask. 1+ findings with a clear signal →
380
+
381
+ - Call `knowledge.stage` with the finding, its evidence line, and the context. One call per finding.
382
+ - Inform briefly: "Staged X domain finding(s) to consolidate in `/flow:feat:ship`".
383
+
384
+ Never invoke `knowledge.save` here — the final save is in `/flow:feat:ship` after `knowledge.read_staging`. `knowledge.stage` empty → the findings stay in `03-design.md` (ADR-light and challenges), nothing else to do.
385
+
386
+ ## 9. Close
387
+
388
+ - Update `meta.json`: `phase = "design"`, add to `phases_done`.
389
+ - Overwrite `00-summary.md` whole (≤15 lines, flow-core §5).
390
+ - **Confirm the acceptance criteria** within the design review: present the enumerated list. If every criterion is unambiguous and verifiable, the review covers them — no separate prompt. `AskUserQuestion` **only** when a criterion is ambiguous, not verifiable, or one is likely missing for today's ticket (same restraint as the challenger). Apply the user's edits to `03-design.md` before advancing.
391
+ - **In `manual`/`guided`**, ask the user to review the design; edit the artifact on requested changes before advancing. **In `auto`, do not ask** — record it as accepted per the handoff below. Not an unconditional stop.
392
+ - Next step by size:
393
+ - **XS / S**: suggest `/flow:feat:build` (1 single MR/PR, no planned split).
394
+ - **M / L**: suggest `/flow:feat:plan` to split the work into independently mergeable MRs/PRs before implementing.
395
+ - **Autonomy handoff.** Design review is a genuine decision point: `manual` and `guided` ask for it before advancing. `auto` records the design as accepted in the artifact and **chains into the command for the size** in this same turn. `manual` proposes that command with a single `AskUserQuestion` (recommended option by default), never a written suggestion. Unresolved `high`-severity findings (§6) stop the flow in **every** mode — do not chain over them.
396
+ """
@@ -0,0 +1,162 @@
1
+ # GENERATED by script/adapter-build.py from plugins/flow/commands/feat/plan.md — do not edit; change the plugin file and run the script.
2
+ description = "Split the work into small, independently mergeable MRs/PRs before implementing"
3
+
4
+ prompt = """
5
+ # `/flow:feat:plan`
6
+
7
+ > **gemini adapter — how the Claude Code primitives named below map here.**
8
+ > - `AskUserQuestion` → ask in plain text with numbered options and wait for the reply.
9
+ > - `Agent <role>` / `Agent general-purpose` / subagents → `@<name>` from `.gemini/agents/`; the name comes from `agents.<role>` in `FLOW.md`, empty or absent → do it in this context.
10
+ > - Parallel fan-out → several `@name` in one turn (sequential in this context if none are configured), capped at `agents.fanout_max` (empty → 4); `agents.fanout_tool` is Claude Code-only, ignore it.
11
+ > - `ScheduleWakeup` / `Monitor` / `/loop` → not available in-session: run one cycle, persist state in `monitor.md`, let the user schedule `gemini -p "<command>"` with cron.
12
+ > - `TaskCreate` → a markdown checklist in the phase artifact.
13
+ > - `Skill commit-commands:commit-push-pr` → `git add` · `git commit` · `git push -u origin HEAD` · the `git.cli` CLI (`gh pr create` / `glab mr create`).
14
+ > - `/model <value>` → the `--model` flag at launch.
15
+ > - `knowledge.*` roles → whatever tools `FLOW.md` names there; an MCP tool keeps its name, its server is declared under `mcpServers` in `settings.json` (see `settings.snippet.json`).
16
+
17
+ Read `~/.claude/flow/CORE.gemini.md` first (shared rules: `FLOW.md` step 0, models, autonomy modes and hard gates, how a stop reads, `panel.json`, `00-summary.md`) — skip if you already read it in this session. **Models: the subagents it launches take `models.agents`.**
18
+
19
+ Delivery planning phase. **No code is written.** Splits the feature into MRs/PRs that can each live on the main branch even if the subsequent ones never land.
20
+
21
+ ## 1. Pre-flight
22
+
23
+ - Load `meta.json` by current branch. Missing → send the user to `/flow:feat:start`.
24
+ - Require `design` in `phases_done`. Missing → send to `/flow:feat:design` and stop.
25
+ - Read `meta.json` and `00-summary.md`; open in full only `03-design.md`. (flow-core §5)
26
+ - **`size` `XS` or `S`** → warn that this phase does not apply (always 1 MR/PR), add `"plan:skipped"` to `phases_done`, suggest `/flow:feat:build`. Stop.
27
+
28
+ ## 2. Work
29
+
30
+ Load the project convention skills (`FLOW.md` section `conventions`).
31
+
32
+ **YAGNI filter before splitting**: plan only what `03-design.md` has validated as necessary. A MR/PR (or part of one) dedicated to a **hypothetical future problem** or to a scenario that **cannot happen in this project** is not a deliverable: mark it "out of scope — idea for a separate ticket", **append it to `meta.json.followups[]`** (`kind: "out-of-scope"`, `source: "plan"`, flow-core §7) and notify the user. Said in the chat and nowhere else, it is lost with the session — this is the one deferral in the flow that used to leave no trace at all. If the design let in unnecessary pieces, return to `/flow:feat:design` to trim them before planning.
33
+
34
+ Launch a subagent with this brief (self-contained):
35
+
36
+ > Read `.claude/work/<TICKET>/03-design.md`. Propose how to split the implementation into **independently mergeable MRs/PRs**: each one must be able to live on its own on the main branch without breaking anything even if the subsequent ones never land. Think about feature flags, temporary dead code, schema backwards-compatibility, multi-step online migrations, stable event contracts. **Do not create MRs/PRs dedicated to hypothetical future problems or to defenses against scenarios the project already prevents — split only what is necessary for what the ticket asks for today (YAGNI).**
37
+ >
38
+ > **Independently mergeable is a test of viability, not a reason to split.** Given enough scaffolding — a flag, a nullable column, temporarily dead code — almost any slice passes it, so on its own it almost never says no. A slice earns an MR/PR of its own only when at least one of these holds:
39
+ >
40
+ > 1. **It repairs something broken today**, and bundling it would put that fix behind a feature's review and release.
41
+ > 2. **It closes a ticket that stands on its own**, delivering value with no reference to this work.
42
+ > 3. **It is enabling**: two or more later slices depend on it and can then proceed in parallel.
43
+ > 4. **The two halves are asymmetric**: one order leaves the main branch strictly safer than today, the reverse ships a visibly half-built product.
44
+ >
45
+ > None of the four holds → it is *part of* another MR/PR, not one of its own. Say which of the four each MR/PR you propose is claiming.
46
+ >
47
+ > **Minimise waves, not MR/PR size.** A second MR/PR inside a wave that already exists is cheap. A further wave is not: it costs another full merge, pipeline and rebase round, and everything downstream waits for it. When a split adds a wave, what needs justifying is the wave, not the slice.
48
+ >
49
+ > Then build the **dependency graph** (which MR/PR needs another one merged or deployed before it can start) and **sort it topologically into execution waves**: wave 1 = everything with no unmet dependency (can start immediately, in parallel); wave 2 = everything unlocked once wave 1 is in; and so on. **Number the MRs/PRs following that wave order** — the lowest numbers to wave 1, then wave 2, etc. — so that **every MR/PR's dependencies have a strictly lower number than itself** (`#1` is always a legitimate starting point, never "start at #5"). Within a wave (parallel, no dependency between them) the order is free; number them consecutively. **The number is the execution order, not a grouping by feature area** — do not number by "Part A / Part B" and then reorder in prose.
50
+ >
51
+ > **Merge test — run it before you return the table.** For every pair of MRs/PRs in the **same wave**, and for every direct link `#a → #b` where `#b` is the *only* thing depending on `#a`, state what is lost by merging the two into one. If the only answer is "they close different tickets" — one MR/PR can close several — or "the first has no product value of its own, it is scaffolding for the second", **merge them**. Report the pairs you merged and the pairs you kept apart, each with its reason; "no pair was worth evaluating" is not an answer, name the pairs you looked at.
52
+ >
53
+ > Return a table with: **`n`** (final number = execution order), **`wave`**, **`depends_on`** (list of the `n` it needs merged first; empty if it can start immediately), what it includes, standalone-mergeable (yes/no + how it is guaranteed), what it unlocks for the next one, risk if it stays alone on the main branch indefinitely, **`lines_est`** (approximate lines, sum of added + modified) and **`files_est`** (approximate files it touches). Estimates are **soft** — they serve as a thermometer during build, not as a contract. If the correct answer is "1 single MR/PR", justify it and return that. Under 600 words.
54
+
55
+ Payments, authentication or sensitive data → launch **in parallel** the `agents.security` agent from `FLOW.md` (or `Agent general-purpose` if empty) with the brief: "For each proposed MR/PR in the delivery plan, identify whether it opens a security exposure window while the subsequent ones are not yet merged (e.g. new endpoint without the final check, column without final constraint). Only actionable findings."
56
+
57
+ ## 3. Output
58
+
59
+ Consolidate in `.claude/work/<TICKET>/04-mr-plan.md`:
60
+
61
+ ```markdown
62
+ # Delivery plan <TICKET>
63
+
64
+ ## Summary
65
+ - Number of MRs/PRs: N
66
+ - Split justification (1-2 lines):
67
+
68
+ ## Execution order (waves)
69
+ The number of each MR/PR **is** its execution order: a lower number never depends on a higher one, so `#1` is always a valid starting point.
70
+ - **Wave 1** (start now, in parallel): #1, #2
71
+ - **Wave 2** (after #1 is merged/deployed): #3, #4
72
+ - **Wave 3** (after #3): #5
73
+
74
+ MRs/PRs in the same wave with no dependency between them can be built in parallel (or as a train). There is no "start at #5" — if something can start first, it is numbered first.
75
+
76
+ ## MRs/PRs
77
+
78
+ ### #1: <short title>
79
+ - **Wave**: N — **depends on**: #a, #b (or "nothing — can start immediately").
80
+ - **Includes**: bullets of what changes.
81
+ - **Why it is its own MR/PR**: which of the four criteria it claims (repairs something broken today · closes a standalone ticket · enabling for two or more · asymmetric halves) and in one line how. The only entry exempt is the one that would remain if nothing had been split.
82
+ - **Standalone-mergeable**: yes / no — how it is guaranteed (flag, nullable column, unused code, etc.).
83
+ - **Unlocks**: what the next one can do.
84
+ - **Risk if it stays alone on the main branch**: …
85
+ - **Estimated size**: XS / S / M.
86
+ - **`lines_est`**: ~N lines (added + modified).
87
+ - **`files_est`**: ~N files.
88
+
89
+ ### #2: …
90
+
91
+ ## Dependencies between MRs/PRs
92
+ <simple graph in bullets: #3 depends on migration from #1, etc. This graph is what produced the waves and the numbering above — keep them consistent.>
93
+
94
+ ## Merge test
95
+ <one line per pair evaluated — every pair inside a wave, and every `#a → #b` where #b is #a's only dependent: what merging them would lose, and whether they were merged. Pairs merged here never appear as separate entries above; this section is the record that they were considered. If the plan is a single MR/PR, write "not applicable".>
96
+
97
+ ## Plan risks
98
+ - Online migrations:
99
+ - Compatibility with deployed clients:
100
+ - New domain events:
101
+ - Introduced feature flags (and when to remove them):
102
+
103
+ ## Decision: one or several MRs/PRs?
104
+ <if 1: justification. If several: why this split and not another>
105
+ ```
106
+
107
+ A plan of 1 single MR/PR keeps the same artifact with that single entry and its justification. Never force artificial splitting.
108
+
109
+ ## 4. Register in `meta.json`
110
+
111
+ Add the `mrs` array with the agreed plan:
112
+
113
+ ```json
114
+ "mrs": [
115
+ { "n": 1, "title": "…", "size": "S", "status": "pending", "phases_done": [], "wave": 1, "depends_on": [], "lines_est": 120, "files_est": 6 },
116
+ { "n": 2, "title": "…", "size": "M", "status": "pending", "phases_done": [], "wave": 2, "depends_on": [1], "lines_est": 350, "files_est": 14 }
117
+ ]
118
+ ```
119
+
120
+ - `n` = execution order (topological): `depends_on` only ever references a **lower** `n`; `wave` groups MRs/PRs that can run in parallel. `/flow:feat:build §1` reads `depends_on` to pick the next **startable** MR/PR and to say which can go in parallel — keep both accurate whenever the plan is edited or renumbered.
121
+ - **`phases_done`** starts `[]` in every seeded entry: it tracks `build`/`review`/`validate` **for that MR/PR specifically**, so the gates in `/flow:feat:review §1`, `/flow:feat:validate §1` and `/flow:feat:ship §1` judge *this* MR/PR — a sibling's review never satisfies a new MR/PR's gate.
122
+ - Estimates are **indicative**, not contractual. `/flow:feat:build` uses them as a thermometer: real work over `lines_est` +50% or `files_est + 2` triggers the "cut or continue" question (see §2.3 in build). **A thermometer is not a target** (flow-core §9): an estimate is never met by deleting comments, tests or blank lines, by compressing readable code, or by cutting where the piece is not coherent — the overrun is recorded instead, and a diff shaped to fit a number is the one case where these estimates lie to the phases downstream.
123
+
124
+ Valid statuses:
125
+
126
+ | Status | Meaning |
127
+ |--------|---------|
128
+ | `pending` | Not yet started. |
129
+ | `in_progress` | Build/review/validate for this MR/PR is in progress. |
130
+ | `merged` | MR/PR merged to the main branch. |
131
+ | `closed` | MR/PR closed without merge (rejected, discarded). Requires `note` with reason. |
132
+ | `superseded` | Replaced by a later MR/PR (the plan was rethought). Requires `note` pointing to the replacement. |
133
+
134
+ `/flow:feat:build` moves `pending` → `in_progress`. `/flow:feat:ship` moves `in_progress` → `merged` when it confirms the merge, or to `closed` if discarded. Splitting rethought after a build → return to `/flow:feat:plan`, mark the old entry `superseded`, add the new ones.
135
+
136
+ ### Cross-repo entries
137
+
138
+ A slice landing in **another repo** is not one of *this* repo's `mrs`: record it in `meta.json.related_repos` (`{ "repo", "scope", "status": "pending" }`) so `/flow:feat:ship` reminds you to open the work there. Keep `mrs` to this repo's MRs/PRs.
139
+
140
+ ## 5. Is the size still correct?
141
+
142
+ - Really just 1 small MR/PR (≤ 50 lines, no migrations) → reclassify to `S` and notify.
143
+ - 5+ large MRs/PRs → consider upgrading to `L`.
144
+ - **More than 3 waves** → the chain, not the size, is what the user pays for. Re-run the merge test over the links that produce the extra waves before accepting the plan, and if they survive it, say in one line which dependency makes the chain unavoidable. A plan that answers "these are all small" to a count that looks high has answered the wrong question: the count that hurts is the waves.
145
+ - Confirm with `AskUserQuestion` before changing `meta.json.size`.
146
+
147
+ ## 6. Close
148
+
149
+ - Update `meta.json`: `phase = "plan"`, add `plan` to `phases_done`.
150
+ - Overwrite `00-summary.md` whole (≤15 lines, flow-core §5).
151
+ - Refresh `panel.json`: from here on it carries one line per `mrs[]` entry. Nothing is merged or open yet, so every entry carries `mark: "pending"`, the not-yet-started ones collapsed into a single `#a–#z` line, and **no heading over the train** — `mark` states each entry's real state (schema in `/flow:work:README`).
152
+ - **Show the plan the way it will be executed**, not just as a list: print the wave line first, then the table:
153
+
154
+ ```
155
+ Wave 1: #1 ∥ #2 (in parallel, start now) → Wave 2: #3 → Wave 3: #4 ∥ #5 ∥ #6 ∥ #7
156
+ ```
157
+
158
+ `∥` = no dependency between them, can be built in parallel or as a train; `→` = the next wave waits for the previous one to merge. Then the table with `#`, wave, `depends_on`, title and estimate. One line for the split rationale, and — when any pair was merged — one line saying how many were and what they would have cost (`merged #a into #b: would have been a wave of its own`). Nothing else — risks and discarded alternatives live in the artifact.
159
+ - Changes requested → edit the artifact and `meta.json.mrs` before advancing.
160
+ - Suggest `/flow:feat:build` to start the first MR/PR.
161
+ - **Autonomy handoff.** Approving the split is a genuine decision point: in `manual` and `guided` ask before advancing. In `auto`, record the plan as accepted in `04-mr-plan.md` and **chain into `/flow:feat:build` automatically** in this same turn. In `manual`, propose it with a single `AskUserQuestion`.
162
+ """