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,417 @@
1
+ ---
2
+ name: flow-feat-ship
3
+ description: "Commit, push, MR/PR, and offer to save domain knowledge"
4
+ ---
5
+
6
+ <!-- GENERATED by script/adapter-build.py from plugins/flow/commands/feat/ship.md — do not edit; change the plugin file and run the script. -->
7
+
8
+ # `$flow-feat-ship`
9
+
10
+ > **codex adapter — how the Claude Code primitives named below map here.**
11
+ > - `AskUserQuestion` → ask in plain text with numbered options and wait for the reply.
12
+ > - `Agent <role>` / `Agent general-purpose` / subagents → the subagent declared under `[agents.<name>]` in `~/.codex/config.toml`; the name comes from `agents.<role>` in `FLOW.md`, empty → do it in this context.
13
+ > - Parallel fan-out → several subagents in one response, capped at `agents.fanout_max` (empty → 4); `agents.fanout_tool` is Claude Code-only, ignore it.
14
+ > - `ScheduleWakeup` / `Monitor` / `/loop` → not available in-session: run one cycle, persist state in `monitor.md`, let the user schedule `codex exec "<command>"` with cron or Codex automations.
15
+ > - `TaskCreate` → a markdown checklist in the phase artifact.
16
+ > - `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`).
17
+ > - `/model <value>` → the `--model` flag at launch (or `/model` if your Codex version has it).
18
+ > - `knowledge.*` roles → whatever tools `FLOW.md` names there; an MCP tool keeps its name, its server is declared under `[mcp_servers.<name>]` in `config.toml` (see `config.snippet.toml`).
19
+ > - `$ARGUMENTS` → whatever the user typed after the skill name, empty if nothing — Codex substitutes nothing, so read it off their message.
20
+
21
+ Read `~/.claude/flow/CORE.codex.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: this command runs with the model it was launched with (no `models` key).**
22
+
23
+ Closes the feature: commit, push, MR/PR (assigned per `git.assignee`, squash per `git.squash`, sections per `git.request_sections`) and an optional offer to consolidate knowledge.
24
+
25
+ ## 1. Pre-flight
26
+
27
+ - Read `meta.json` and `00-summary.md`; open in full only the `Brief MR/PR #N` of `05-implementation.md`, the `## Summary`/blockers of `06-review.md` and `07-validation.md`. (flow-core §5)
28
+ - Require `review` in `phases_done`; for `size` other than `XS`, also require `validate`. **In a multi-MR/PR work** (`meta.json.mrs` has >1 entry) check the **current `in_progress` MR/PR's** own `phases_done` (its `mrs[]` entry), NOT the work-level list — a previous MR/PR's `review`/`validate` does **not** satisfy this gate.
29
+ - Not met → refuse and send the user to the missing step (multi-MR/PR: `$flow-feat-review` or `$flow-feat-validate` **for this MR/PR**).
30
+ - **The review has to be about the tree you are about to push.** Compare `meta.json.reviewed_sha` and `validated_sha` (this MR/PR's `mrs[]` entry in a multi-MR/PR work) against `git rev-parse HEAD`:
31
+ - **Equal** → continue, nothing to report.
32
+ - **Absent** (work started before the shas were recorded) → say so in one line and continue. Absence is not a mismatch.
33
+ - **Different** → read the delta (`git log --oneline <sha>..HEAD`, `git diff --stat <sha>..HEAD`) and judge it by **what it touches**, never by size.
34
+ - Only test files (`tests/`, `test/`, `spec/`, `__tests__/`, `*_test.*`, `*Test.*`, `*.test.*`, `*.spec.*`) and this work's own folder under `.claude/work/` → append both shas and the file list to `06-review.md`, continue **without asking** (a test written by `validate` after the review is the normal order).
35
+ - **Anything else** → stop and ask, in **every** `autonomy.mode`, with a single `AskUserQuestion`: *re-review the delta* (`$flow-feat-review`, recommended default — it reads `<sha>..HEAD`, not the whole branch) · *ship it as it stands*, which first appends to `06-review.md` the two shas, the files, and that the user accepted them unreviewed. Never resolve this one silently.
36
+ - Check for blocking TODO/FIXME added on this branch (`git diff --unified=0 <git.default_base>...HEAD | grep -E '^\+.*(TODO|FIXME)'`). If any, list them and ask whether to continue.
37
+
38
+ ## 2. Draft title and description (without sending anything yet)
39
+
40
+ **Important**: in this step **do not** push or create anything. Only draft the MR/PR content to show the user in §3.
41
+
42
+ ### Title
43
+
44
+ Format: `<TICKET> <what it does for the user, in behavioral language> [patch|minor|major]`.
45
+
46
+ **Good**: `<TICKET> List opens for a tracked email via API [minor]`
47
+ **Bad**: `<TICKET> Add GET /orders/{id}/items endpoint with cursor pagination [minor]`
48
+
49
+ - `git.squash` `true` → the title becomes the final commit message; commit message and title coincide.
50
+ - The `<TICKET>` in the title is for humans and trackers that link by convention (Jira, Linear). **On GitHub/GitLab a ticket in the title does NOT link the MR/PR to the issue** — the formal link lives in the body, see below.
51
+
52
+ ### Issue link (in the body — this is what fills the tracker's "Development"/linked panel)
53
+
54
+ Decide first whether **this** MR/PR *completes* the issue: it does when, after it, `meta.json.mrs` has **no** remaining `pending`/`in_progress` entries (or there is a single MR/PR). Otherwise it is an **intermediate** train MR/PR. Then, per `tracker.tool`:
55
+
56
+ - **`gh` / `glab`**: link line at the top of the body.
57
+ - Completing MR/PR → `Closes #<N>` (auto-links + auto-closes on merge to the default branch).
58
+ - Intermediate MR/PR → `Part of #<N>` (references without closing).
59
+ - `<N>` = the numeric issue id from `meta.json.ticket`.
60
+ - **GitHub train caveat**: for a stacked MR/PR (target = parent branch) GitHub **ignores** `Closes`/`Part of` for panel/auto-close — the Development-panel link comes from the **linked branch** created in `$flow-feat-start §5.5`. Keep the `Part of #<N>` line for human context.
61
+ - **`acli` (Jira)**: **add nothing** — Jira links via the issue key in branch name and title prefix.
62
+ - **`linear`**: `Closes <TICKET>` (Linear id, e.g. `ENG-123`) on the completing MR/PR; nothing on intermediates.
63
+ - **`none` / empty**: nothing to link.
64
+
65
+ ### Referencing other MRs/PRs of the plan in the body (never `#<n>`)
66
+
67
+ When the body mentions **another MR/PR of the delivery plan**, **never write `#<n>`** with `<n>` the plan order from `meta.json.mrs` — GitHub/GitLab auto-link it to whatever issue/PR carries that number (`#5 (closed)`).
68
+
69
+ - **MR/PR already created** → its **URL** (`meta.json.mrs[].url`); the platform expands it to title and real id (`!42` on GitLab).
70
+ - **MR/PR not created yet** (`pending`) → its **title** in quotes, e.g. «Load-test infra» (not opened yet).
71
+
72
+ Does **not** apply to the issue-link line (`Closes #<N>` / `Part of #<N>`): there `<N>` is the **real issue id** from `meta.json.ticket`.
73
+
74
+ ### Description
75
+
76
+ **Build the description from the `Brief MR/PR #N` in `05-implementation.md`**, not from the technical design. No Brief (older work) → draft one now from what was actually built.
77
+
78
+ `git.request_sections` defined in `FLOW.md` → structure the description with those sections in that order. Empty → default template:
79
+
80
+ ```markdown
81
+ ## Purpose
82
+ <2-3 bullets: what problem it solves / what need it covers. Why this MR/PR matters. Business language, NOT technical.>
83
+
84
+ ## What changes for the user / system
85
+ <3-5 bullets taken from the "After this MR/PR..." in the Brief. What a reviewer without technical context can understand.>
86
+
87
+ ## What is NOT included
88
+ <bullets taken from "This MR/PR does NOT include..." in the Brief. Important so the reviewer knows what to leave out of scope.>
89
+ <then, if `meta.json.followups[]` has entries still `proposed` or `accepted`: one line each — what was consciously deferred and why, with the ticket id when one exists. A reviewer cannot weigh the diff against what the author chose not to do unless it is written here. Omit the block entirely when there are none.>
90
+
91
+ ## Evidence
92
+ <only if `.claude/work/<TICKET>/evidence/` has files for the criteria of **this** MR/PR (a train filters to the current `mrs[]` entry, not the whole work) and `quality.evidence` is not `off`. One entry per criterion: the criterion in one line, then its before/after pair, or the single after when there is no before. Non-visual evidence (a response body, a log excerpt) goes in a short fenced block instead of an image. Omit the whole section when there is nothing — never an empty header.>
93
+
94
+ ## Steps to test it
95
+ <taken from `07-validation.md` (flow reproduction) and `01-context.md` (acceptance criteria). Numbered, actionable: "1. Log in as X, 2. Go to Y, 3. Verify Z".>
96
+
97
+ ## Pre-deploy (ONLY if `git.predeploy_gate` is active and the branch touches the database)
98
+ SQL to run **manually on the server BEFORE deploying**, all statements in a single block:
99
+ ```sql
100
+ <DDL/indexes/columns/data migrations that are not automatic — all together>
101
+ ```
102
+ ⚠️ **Do not deploy until this SQL has been executed in production.**
103
+
104
+ ## MR/PR in multi-delivery plan (only if applicable)
105
+ <if `meta.json.mrs` has >1 entry: state which one this is (e.g. "MR/PR 2 of 4 in the delivery plan"), then list the already-created previous ones by their **URL** (the platform renders each one's title + real id) and the still-pending ones by their **title** in quotes. **Never use `#<n>`** — see the reference rule above. Example: "MR/PR 2 of 4. Previous: <url-of-first-MR>. Pending: «<title of the third>», «<title of the fourth>» (not opened yet).">
106
+
107
+ ---
108
+
109
+ <details>
110
+ <summary>Technical details for reviewers</summary>
111
+
112
+ - **Modules/layers touched**: <from `05-implementation.md`>
113
+ - **Migrations**: <yes/no, online/offline>
114
+ - **New domain events**: <list or "none">
115
+ - **New / modified endpoints**: <short list>
116
+ - **Relevant design decisions** (see `03-design.md` for full detail): <2-3 key points from the ADR-light>
117
+
118
+ </details>
119
+ ```
120
+
121
+ Rules:
122
+ - **Evidence is uploaded, never linked by path.** `.claude/work/` is git-ignored in most repos, so a path renders as broken text for everyone but you. Attach the files to the forge so they render inline: `gh` has no image-upload command — use the API-backed route your host supports, or paste into the description preview; `glab` uploads to the project. **Neither available → do not drop the section**: keep it as a table of criterion → evidence file, and say plainly in the stop that the images could not be attached and how to add them by hand.
123
+ - **`git.request_sections` wins.** With custom sections defined, `Evidence` appears only if the user listed it. With the default template, it appears whenever there is evidence and is omitted entirely when there is none.
124
+ - **The technical block goes in a collapsed `<details>`.**
125
+ - **The `## Pre-deploy` section does NOT go in `<details>`**: it is a deployment gate, it must be visible. Only if `git.predeploy_gate` is active and the branch touches the DB; otherwise omit it.
126
+ - **Do not copy bullets from `03-design.md` literally** into the main body — the MR/PR talks about behavior the user notices, not layers.
127
+ - **If the brief contradicts the diff**, the diff wins; warn the user (the brief was wrong, or the build deviated).
128
+
129
+ ### Collect the pre-deploy SQL (only if `git.predeploy_gate` active)
130
+ Determine whether the branch modifies the database (migrations, mappings/schema, or changes recorded in `03-design.md`/`05-implementation.md`). If `quality.db_diff` is defined in `FLOW.md`, run it to see the pending schema SQL. Consolidate **all** statements to run manually before deploying into **one single block** — the same block goes in `## Pre-deploy` and in the §4.2 thread. **One block / one thread**, however many modifications.
131
+
132
+ ## 3. Show the user and wait for confirmation (MANDATORY)
133
+
134
+ **Never skip this step, even when the content seems obvious.** Hard gate in every mode.
135
+
136
+ Print to the user in this exact format:
137
+
138
+ ```
139
+ ─── Preview of <MR or PR, per git.host> ───────────────────────────────
140
+ Title: <full title, including [patch|minor|major]>
141
+ Assigned to: <git.assignee from FLOW.md; if empty: "unassigned">
142
+ Squash on merge: <git.squash from FLOW.md>
143
+ Target branch: <git.default_base from FLOW.md, or the parent branch in train mode>
144
+ Issue link: <keyword that will appear in the body, e.g. "Closes #123" / "Part of #123 (intermediate train PR)" / "none — Jira links by title prefix">
145
+ Pre-deploy (manual SQL): <"yes — N statements, a blocking thread will be opened" / "not applicable">
146
+
147
+ Description:
148
+ <full description rendered exactly as it will appear in the MR/PR>
149
+ ─────────────────────────────────────────────────────────────────
150
+ ```
151
+
152
+ If there is pre-deploy SQL, ask the user to **explicitly confirm that the block is complete and correct** — it will be executed in production.
153
+
154
+ Then ask with `AskUserQuestion` (header: "Create <MR or PR>"):
155
+
156
+ - **Create with this content** → invoke §4.
157
+ - **Edit before creating** → user says what to change (title, a section, both); adjust and return to §3 with the new preview.
158
+ - **Cancel** → stop without creating anything. Do not touch `meta.json`. The user can return to `$flow-feat-ship` later.
159
+
160
+ Do not push or invoke any creation command until the user has responded "Create with this content".
161
+
162
+ ## 4. Commit, push, and MR/PR creation
163
+
164
+ ### 4.0 Anti-deploy lock (before any push)
165
+ Verify, and **block** if anything fails:
166
+ ```bash
167
+ git rev-parse --abbrev-ref HEAD # must NOT be master/main
168
+ git rev-parse --abbrev-ref --symbolic-full-name @{u} 2>/dev/null # must NOT be the base branch
169
+ ```
170
+ - HEAD is master/main → stop and warn. Never push from the main branch.
171
+ - Upstream is `<git.default_base>` (branch created without `--no-track`) → **do not push resolving the upstream**. Fix with `git branch --unset-upstream`, then `git push -u origin HEAD`.
172
+ - Train mode (`stacked_on` ≠ null) → the MR/PR must target that parent branch, not the main base.
173
+
174
+ ### 4.1 Create MR/PR
175
+ Only here — with the content approved in §3 — invoke `Skill commit-commands:commit-push-pr` passing **the final title and description**. The skill must not re-ask for the content; if it does, answer with what was confirmed. Any push it does must be `git push -u origin HEAD` (own branch), never to the base branch.
176
+
177
+ - `git.assignee` not empty → assign to that user. `git.squash` `true` → enable squash-before-merge.
178
+ - `commit-push-pr` skill unavailable → commit and push manually and create the MR/PR with the `git.cli` CLI from `FLOW.md` — always with the content confirmed in §3.
179
+
180
+ **Record the URL the moment it exists**: write it into this MR/PR's `meta.json.mrs` entry and refresh `panel.json` right here, before §4.2 and before anything else can fail.
181
+
182
+ ### 4.2 Pre-deploy thread (deployment gate)
183
+ **Only if `git.predeploy_gate` is active and the branch has pre-deploy SQL** (§2). After creating the MR/PR, open **a single resolvable/blocking thread** with **all** the consolidated SQL, using the `git.host`/`git.cli` host:
184
+ - **GitLab**: `glab api "projects/<repo-url-encoded>/merge_requests/<iid>/discussions" -f body="..."` (resolvable thread).
185
+ - **GitHub**: a review conversation that requires resolution before merging ("require conversation resolution" policy).
186
+
187
+ Thread body: the SQL block under "Pre-deploy: run this SQL on the server BEFORE deploying" + "Resolve this thread only after having executed it in production."
188
+
189
+ With the repo policy "all threads resolved before merge", the MR/PR cannot merge until the SQL is executed and the thread **resolved**. **One single thread even with multiple statements.** Tell the user it is left open on purpose.
190
+
191
+ ### 4.3 Performance comment (only when there are numbers)
192
+
193
+ `06-review.md` §"Data-access duel" has rows for modified queries, or `07-validation.md` §3.7 has
194
+ benchmark rows → post them as a **comment** on the MR/PR just created (`gh pr comment` /
195
+ `glab mr note`). Nothing measured → post nothing; an empty performance comment is noise.
196
+
197
+ A comment, not a description section, because it is **re-posted on every push that changes a
198
+ measured path** (`$flow-work-green`, `$flow-work-respond`), and a description rewritten each round
199
+ loses what the numbers were two rounds ago. The history is the point.
200
+
201
+ ```markdown
202
+ ## Performance — base `<sha>` → `<sha>`
203
+
204
+ | Query | Rows read | Time (min–max, 3 runs) | Verdict |
205
+ |---|---|---|---|
206
+ | `FooRepository::findBar()` | 41k → 750 | 120–131 ms → 8–9 ms | improved |
207
+
208
+ | Entry point | Time | Peak memory | Verdict |
209
+ |---|---|---|---|
210
+ | `GET /campaigns` | 210–224 ms → 88–95 ms | 42 MB → 30 MB | improved |
211
+
212
+ Measured on <data set>, <n> runs each. A difference inside the run-to-run spread is reported as
213
+ no measurable change, not a percentage.
214
+ ```
215
+
216
+ - **Verdicts**: `improved` · `no measurable change` · `regressed` · `not measured (<reason>)`.
217
+ - **A `regressed` row is a review blocker** unless `03-design.md` justifies the trade — in which
218
+ case the justification goes in the comment, in one line, next to the row.
219
+ - Posting to the forge is outward-facing: show the comment and confirm with `AskUserQuestion`
220
+ **in every `autonomy.mode`**, exactly like the description preview in §3.
221
+
222
+ ## 5. Domain knowledge (offer)
223
+
224
+ Only if `knowledge.read_staging` or `knowledge.save` is set; neither → skip without notifying (the artifacts already hold the findings). **Only if there is something non-obvious worth saving** (silence-by-default):
225
+
226
+ 1. **Read the staging accumulated during the branch**: `knowledge.read_staging` (empty → what the artifacts recorded) — what `$flow-feat-design` (and other phases) already staged. Main material.
227
+ 2. **Review** `03-design.md`, `05-implementation.md`, `06-review.md` for "why" findings (domain decisions, legal constraints, integrations, business motivations) **not staged at the time**. The "what" (code, paths) is NOT saved.
228
+ 3. **Combine staging + new findings** into a short list. Empty or only code-derivable → do not insist.
229
+ 4. 1+ relevant findings → ask the user whether to consolidate. Yes → run the consolidation of flow-core §0 (`read_staging`, then one decision and one `knowledge.save` per finding). No → do not insist.
230
+
231
+ ## 6. Close
232
+
233
+ ### 6.1 Update `meta.json` per scenario
234
+
235
+ **A) The MR/PR was created (and merged, if the flow reached that)** (normal case):
236
+ - **No `mrs` or only 1**: add `ship` to `phases_done`, update `updated_at`. `phase = "done"` **only if the user confirms it was actually merged** — one `AskUserQuestion` (same question as the multi-delivery case; right after §3 the MR/PR is open and the normal answer is no). Not merged → leave `phase = "ship"`: `$flow-work-green` and `$flow-work-respond` operate on the open MR/PR and `$flow-work-clean` only sweeps what merged.
237
+ - **Multi-delivery build**: record the current MR/PR's `url` in its `meta.json.mrs` entry. `status` = `merged` **only if the user confirms it was actually merged**; otherwise keep `in_progress` — **the train does not require the current MR/PR to be merged to proceed**. Still `pending` entries → leave `phase = "build"` and go to §6.2. All entries `merged`/`closed`/`superseded` → `phase = "done"`.
238
+
239
+ **B) The MR/PR was closed without merge** (rejected, discarded by reviewers):
240
+ - Mark the current entry `closed` with a `note` explaining the reason.
241
+ - Ask the user: retry with a different approach (`$flow-feat-build`) or consider the feature unviable (`$flow-work-abandon`)? Do not decide alone.
242
+
243
+ **C) The plan changed and this MR/PR is no longer needed**:
244
+ - Mark the entry `superseded` with `note` pointing to the new MR/PR.
245
+
246
+ In every scenario:
247
+ - **A merged badge is not the tree.** Whenever the user confirms a merge, verify the content actually reached the base before recording it — mandatory when the entry has `stacked_on` set, cheap enough to be worth it always:
248
+
249
+ ```bash
250
+ git fetch --prune origin
251
+ git ls-tree -r origin/<git.default_base> --name-only -- <a path this MR/PR creates>
252
+ ```
253
+
254
+ Nothing back → the content is **not** on the base whatever the forge says (see §6.2.1). Do not mark the entry `merged`: leave it `in_progress` with a `note`, tell the user in one line, and recover it with a fresh MR/PR against `git.default_base` before the train moves on.
255
+ - Refresh `panel.json` from the updated `meta.json`. A shipped-but-open MR/PR is a `wait` line carrying its `link`; it becomes `done` only when confirmed merged. When this ship sets `phase = "done"`, say so in plain words (`mark: "info"` with `style: "ok"`: nothing left here) and drop the `Decision` line.
256
+ - Overwrite `00-summary.md` whole (≤15 lines, flow-core §5).
257
+
258
+ ### 6.1.1 Tracker: move to done
259
+
260
+ **Only when this ship sets `phase = "done"`** (single MR/PR merged, or the last of a train — never on an intermediate train MR/PR), and only if `tracker.tool` is not `none`/empty, `tracker.done_cmd` is set, and `meta.json.ticket` is a **real tracker id**. `phase = "done"` already implies the completing MR/PR was confirmed merged — this fires at genuine completion, not at the archive prompt in §6.3.
261
+
262
+ Run `tracker.done_cmd` substituting `{TICKET}` = `meta.json.ticket`. Same contract as `$flow-feat-start §6.5`: **best-effort, idempotent, gated** (`autonomy.mode: manual` → ask once before running; `guided`/`auto` → run automatically). Failure or already-done ticket → warn in one line and continue, never block. **On GitHub/GitLab leave `tracker.done_cmd` empty** — `Closes #N` in the body (§2) already auto-closes on merge; this step is for trackers that do not transition from git (Jira, Linear).
263
+
264
+ ### 6.2 Train continuation (only if `meta.json.mrs` still has `pending` entries)
265
+
266
+ A train builds the next MR/PR **without waiting for the current one to merge**. Do not stop here to wait for the merge. What happens next follows `autonomy.mode` alone: `manual` → ask; `guided`/`auto` → continue and record it. There is no key for this.
267
+
268
+ First identify the **next startable MR/PR**: the `pending` one with the lowest `n` whose `depends_on` are all `merged` (same rule as `$flow-feat-build §1`). Then its **base branch**:
269
+
270
+ - **Depends on the current MR/PR** (`depends_on` includes the current `n`) → real train: base = the current branch (stacked).
271
+ - **Parallel sibling** (does not depend on the current MR/PR) → **not** part of this train: base = `git.default_base`, `stacked_on` = null. Never stack an independent MR/PR on an unrelated branch.
272
+
273
+ Then act on `autonomy.mode`:
274
+
275
+ - **`manual`**: `AskUserQuestion` — "Continue now with the next MR/PR (#\<n\> «\<title\>»), based on \<its base branch per the rule above\>?". **No** → stop, leave `phase = "build"` and recommend `$flow-feat-build`. **Yes** → as below.
276
+ - **`guided`/`auto`**: continue automatically; record the decision in the artifact, **do not prompt** — not "shall I start #\<n\>?", and never "shall I wait for #\<n-1\> to merge?" (see the never-ask list in flow-core §2). A user who would rather wait for the merge answers *no* in `manual`, or stops after this `ship`.
277
+
278
+ To continue (both `manual`→yes and `guided`/`auto`):
279
+ 1. Create the next branch per `$flow-feat-start §5` with the **base chosen above** (explicit base, `--no-track`, worktree per `git.worktree`) and, for `tracker.tool: gh`, the linked-branch step `$flow-feat-start §5.5` (same base). Train (depends on the current one) → record `stacked_on` = current branch in `meta.json`; parallel sibling → `stacked_on` = null.
280
+ 2. Leave `phase = "build"` (`$flow-feat-build §1` picks the next `pending` MR/PR and marks it `in_progress`).
281
+ 3. Chain into `$flow-feat-build`.
282
+
283
+ This continuation is **not** a hard gate: a stacked branch on an explicit, unambiguous parent is safe, and creating MR/PR #\<n+1\> in its own `$flow-feat-ship` will still stop and ask. Never hold the train back solely to wait for a merge.
284
+
285
+ ### 6.2.1 The parent merged first — re-target the child, or it merges nowhere
286
+
287
+ A stacked MR/PR targets **its parent branch**, not `git.default_base`. When the parent is merged first — and a **squash** merge above all — the child's target stops being an ancestor of the base branch, and merging the child then lands its content **nowhere**: the forge marks it merged and `git.default_base` never receives a line of it. Measured: a child merged 34 seconds after its parent was squash-merged; a whole decision-record entry and its guard were missing from `main`, and nothing surfaced it until somebody read the tree.
288
+
289
+ **Prevention, whenever this work has a stacked MR/PR open** (a `meta.json.mrs[]` entry with a `url` and `stacked_on` not null) — check at this Close and again at every `$flow-work-resume`:
290
+
291
+ ```bash
292
+ git fetch --prune origin
293
+ git branch -r --contains "origin/<parent branch>" | grep -q "origin/<git.default_base>" # parent still an ancestor?
294
+ ```
295
+
296
+ - **Parent still open** → say it in one line: the child merges first, or is re-targeted before the parent goes in. Never leave the order to chance when both are mergeable.
297
+ - **Parent no longer an ancestor** (merged, squashed, or its branch deleted) and the child **still open** → **hard gate** (a rebase and a force-push, in every autonomy mode). Re-target and replay: `gh pr edit <n> --base <git.default_base>` (or `glab mr update <iid> --target-branch <git.default_base>`), then `git rebase --onto "origin/<git.default_base>" "<old parent>" "<child branch>"` and force-push per the repo's rules. One MR/PR is kept, review history included.
298
+
299
+ **Re-target before the parent merges, not after — the window closes.** Merging the parent with `--delete-branch` deletes the child's target branch, and the forge then **auto-closes the child**; a closed PR cannot be re-targeted, so what was a one-command fix becomes a new MR/PR and a lost review thread. And when `gh pr edit --base` fails (`exit 1`, a GraphQL error about Projects classic — it happens on repos with the classic projects field), re-target through the REST API instead, with the MR/PR **open** (on a closed one it answers 422):
300
+
301
+ ```bash
302
+ gh api -X PATCH "repos/<owner>/<repo>/pulls/<n>" -f base=<git.default_base>
303
+ ```
304
+ - **Parent no longer an ancestor and the child already merged into it** → the content is lost to the base, not to git. Recover it as a fresh MR/PR against `git.default_base` (`git cherry-pick` the child's commits, or re-apply its tree), mark the old entry `superseded` with a `note` pointing at the new one, and tell the user plainly what was missing from the base and for how long.
305
+
306
+ ### 6.3 Summary and cleanup
307
+
308
+ Report **following the stop header** (flow-core §3): ticket, MR/PR URL, changed files, added tests. In a multi-delivery work the `Plan:` line is **mandatory** and lists **every** entry with its real state — shipped with URL, reviewed but not pushed, pending — read from `meta.json.mrs`.
309
+
310
+ **Cross-repo reminder**: if `meta.json.related_repos` has any entry not `done`, call it out explicitly now. For each: *"you've shipped the `<this-repo>` part; `<repo>` still needs: `<scope>` → go there and run `$flow-feat-start <TICKET>` (or `$flow-bug-start`)"*. flow never touches or scans the other repo; not a hard gate.
311
+
312
+ **Cross-repo contract handoff**: for each `related_repos` entry not `done` **and** with `contract_handoff: "pending"`, when `03-design.md` §"External contracts" is not "none". `03-design.md` lives under git-ignored `.claude/work/`, so the literal contracts never reach the other repo on their own; only `scope` does.
313
+
314
+ 1. **Select what crosses.** Only the contracts *that sibling consumes* ("Known consumer" points at it). "Known consumer" blank → ask the user which contracts that repo consumes; never publish all. Copy them **verbatim** from `03-design.md` (same rule as `$flow-feat-build` §2.0bis — a paraphrased contract is a new contract). Acceptance criteria, the ADR-light and "Internal behavioral contracts" do **not** cross.
315
+ 2. **Where.** A comment on the tracker ticket — the anchor both sides share (`$flow-feat-start` §3.5 sends the sibling to the *same* ticket; `$flow-feat-start` §2.1 and `$flow-bug-start` §1.1 read the comment thread). Requires `tracker.tool` not `none`/empty and `meta.json.ticket` a real tracker id. **Fallback** (no tracker, or local-only ticket): write the block to a **versioned** file in this repo (`docs/contracts/<TICKET>.md` or where `conventions` puts docs — never under `.claude/work/`) and name that path in the reminder.
316
+ 3. **Preview, always.** Show the exact comment text and ask with `AskUserQuestion` (publish / edit / skip) **in every `autonomy.mode`, no exceptions** — same rule as §3. Never publish unreviewed prose into a shared tracker.
317
+ 4. **Record it.** On publish, set that entry's `contract_handoff` to `published → <ticket comment url or file path>`. On skip, leave it `pending` — the reminder fires again next ship, by design. Failure to post → warn in one line, leave `pending`, never block the ship.
318
+
319
+ Still "notes and reminds": the contract goes to the tracker or to this repo, never into the sibling's working tree. Not a hard gate — a skipped handoff never stops a merged MR/PR from closing out.
320
+
321
+ ### 6.4 Follow-up triage — decide once, now that the work is done
322
+
323
+ Read `meta.json.followups[]` (flow-core §7). **No entries with `status: "proposed"` → skip this
324
+ section entirely and say nothing.** This is the only place the flow asks about deferred work: the
325
+ phases that parked it asked nothing, deliberately.
326
+
327
+ 0. **Sort them before showing them — the skeptic gate (flow-core §7).** Count the `proposed`
328
+ entries, excluding `decision` (asked as their own question) and `tooling` (already destined for
329
+ the debt log, never asked).
330
+ - **3 or more** → one skeptic round before anything reaches the user: group them into at most
331
+ `agents.fanout_max` briefs (flow-core §6 ceilings apply; `agents.budget_max` already spent by
332
+ this run → skip the round, say so in one line and apply the bar yourself) with the prompt of
333
+ flow-core §7, burden of proof on the entry. Each comes back `ticket`, `log` or `drop`. `drop` → `declined` with the skeptic's reason in `note`, and it
334
+ is never mentioned again. `log` → step 4b, no question.
335
+ - **Fewer than 3** → no agent. Apply the bar of flow-core §7 yourself, in one line each: no named
336
+ subject, or a path needing a conjunction nobody has seen → `declined`; real but nobody's next
337
+ task → 4b.
338
+ - Then **keep only the strongest `tracker.followup_ask_max`** (FLOW.md, empty → **2**; `0` →
339
+ nothing is asked and everything is logged). Anything above that ceiling goes to 4b, and the
340
+ result says how many and where — never a seven-title list, never «N are waiting for triage».
341
+ 1. **Present the survivors together.** One `AskUserQuestion`, **one batch**, at most
342
+ `followup_ask_max` entries, each entry's `title` and `why` as the whole prompt — the user does
343
+ not reopen `05-implementation.md` to answer. Options per entry: **Do it** · **Not worth it** ·
344
+ **Later**. Outside that ceiling, and outside the skeptic: **`decision` entries are asked as their
345
+ product question**, the options being the answers on the table — never *do it / not worth it*.
346
+ **`tooling` entries are not asked at all** — they go straight to 4b (flow-core §7).
347
+ 2. **Not worth it** → `status: "declined"`, the reason in `note` if the user gave one. Never asked
348
+ again, in this work or any later one.
349
+ 3. **Later** → stays `proposed`. `$flow-work-status`, `$flow-work-daily` and `$flow-next` surface it
350
+ until it is decided; nothing else happens now.
351
+ 4. **Do it** → `status: "accepted"`, then **create the tracker issue**, exactly as
352
+ `$flow-feat-start` §2.5.4 creates one from a ticket-less draft — the tool's native command
353
+ (`gh issue create`, `glab issue create`, `acli`, `linear`), best-effort, id captured into
354
+ `ticket`. Body: the `title`, the `why`, and a link back to this MR/PR and to `meta.json.ticket`.
355
+ `tracker.tool` `none`/empty or creation fails → warn in one line, leave `ticket: null` and the
356
+ entry `accepted`; the record survives either way.
357
+ **Creating an issue is outward-facing: this asks in every `autonomy.mode`, `auto` included.**
358
+ 4b. **Logged** — `tooling`, a skeptic's `log`, or anything past the `followup_ask_max` ceiling →
359
+ `status: "logged"` and one line appended to the **debt log**:
360
+ `tracker.debt_log` from FLOW.md, empty → `docs/DEBT.md`, created with a two-line header on first
361
+ use. The line: `- <date> · <ticket> · <title> — <why>`. Commit it on the work branch; pushing it
362
+ is a push like any other (flow-core §2, gate 1) — offer it in the same breath as the survey's
363
+ result, one question, and a declined push leaves the commit local for the next one. No issue is
364
+ opened and nothing else is asked: it is a file on the branch, for whoever next works on the
365
+ machinery.
366
+ 4c. **A `decision` answered** → write the answer into the artifact that owns it (the brief, the
367
+ ADR-light) and set the entry `done` with the answer in `note`. When the answer changes code that
368
+ has already shipped, that is the moment a real follow-up is born: record it as `out-of-scope` with
369
+ the answer as its `why`, and it takes the normal path above.
370
+ 5. **Offer to start one, once.** Any entry now `accepted` → a single `AskUserQuestion`: start the
371
+ first one here (`$flow-feat-start <ticket>`, or `$flow-bug-start` when the action is itself a
372
+ fix)? On yes, the new work records `meta.json.origin` pointing back at this work and this entry,
373
+ and this entry becomes `in_progress` with `work` naming the new folder. On no, nothing changes.
374
+ Never chain into a `start` without this confirmation.
375
+
376
+ **On a re-run that confirms the merge**, repeat this for whatever is still `proposed` — a decision
377
+ deferred with **Later** is meant to come back, and this is when it does.
378
+
379
+ - **Close the follow-up that started this work.** `meta.json.origin` set and this ship moved `phase` to `done` → open the originating work's `meta.json` (live folder or `_archive/`) and set that `followups[]` entry to `status: "done"`. Best-effort: the originating folder is gone or unreadable → warn in one line and continue, never block. Without this the entry stays `in_progress` forever and `status`/`daily` keep reporting work that is finished.
380
+
381
+ ### 6.4bis Conventions learned — offer them to `FLOW.md`, once
382
+
383
+ Read `meta.json.conventions_candidates[]` (flow-core §8). **No entries with `status` unset or
384
+ `"proposed"` → skip this section entirely and say nothing.**
385
+
386
+ 1. **Drop what is already there.** Compare each `text` with the current `conventions` (and with the
387
+ `quality` key when `target` names one). Already said, in any wording → silently `declined`,
388
+ `note: "already in FLOW.md"`. Nobody is asked to confirm a rule they wrote.
389
+ 2. **Ask about the rest in one batch** — one `AskUserQuestion`, at most 4 entries, the `text` as the
390
+ whole prompt with the phase and the stop it came from underneath. Options: **Add to FLOW.md** ·
391
+ **Not a rule** · **Later**. A candidate that *contradicts* an existing line replaces the first
392
+ option with **Replace**, showing both lines, the current one first. More than 4 candidates → ask
393
+ about the 4 most recent and leave the rest `proposed`, saying how many, in one line.
394
+ 3. **This is asked in every mode**, `auto` included: it edits a file in the tree. It is not a team
395
+ decision — the FLOW config is personal — so it is one question, never a negotiation.
396
+ 4. **Add / Replace** → append a `conventions` line to the base `FLOW.md`. For a `quality.<key>`,
397
+ update the file its effective value came from, or the base when it was absent; otherwise an
398
+ overlay would immediately hide the correction. Show the old value and source in the result.
399
+ Then `status: "added"`. **Not a rule** → `declined`, never offered again in any work.
400
+ **Later** → stays `proposed` and is offered again by the next `ship` of a work that has it.
401
+ 5. **One line on screen**: how many rules were added and where, never a list of the texts —
402
+ the user has just read them in the question.
403
+
404
+ ### 6.4ter Defaults that were used (one line, no question)
405
+
406
+ `meta.json.defaults_used[]` non-empty → **one line** in the Close: how many empty `FLOW.md` keys this
407
+ work resolved with their default, and that `$flow-doctor` lists which ones and prints the line to
408
+ paste. Never a list here, and never a question: in `guided`/`auto` not asking is the contract
409
+ (flow-core §0, §2), and in `manual` the phases already offered what they were allowed to offer.
410
+
411
+ ### 6.5 Archive and cleanup
412
+
413
+ Only if `phase = "done"`:
414
+ - Ask whether to keep `.claude/work/<TICKET>/` or archive it (move to `.claude/work/_archive/`).
415
+ - If `meta.json.worktree` is not null, offer to remove the worktree (from the main checkout) with `git worktree remove <worktree>` (`--force` only if it still has changes the user confirms discarding). Never without confirmation, never if the MR/PR is not yet merged.
416
+
417
+ On a **train MR/PR** neither offer fires (`phase` is not `done`; the branch is the base of the next one). When shipping an intermediate MR/PR whose predecessor has since merged, say so in one line and point at `$flow-work-clean`, which sweeps the whole backlog at once. Mention it once per work, not per MR/PR.