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,98 @@
1
+ ---
2
+ name: flow-bug-postmortem
3
+ description: "Lessons learned, areas to watch, and offer to save to the knowledge store"
4
+ ---
5
+
6
+ <!-- GENERATED by script/adapter-build.py from plugins/flow/commands/bug/postmortem.md — do not edit; change the plugin file and run the script. -->
7
+
8
+ # `$flow-bug-postmortem`
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
+ **Only for `size` M/L** (optional for S, skip for XS).
22
+
23
+ Goal: capture lessons that prevent recurrence — not to blame anyone.
24
+
25
+ ## 1. Pre-flight
26
+
27
+ 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).**
28
+
29
+ - Read `meta.json` and `00-summary.md`; open in full every previous artifact (`01-context.md` … `06-review.md`) — §2 needs the whole history. (flow-core §5)
30
+ - Require `review` in `phases_done`.
31
+ - `size` `XS` → suggest skipping to `$flow-bug-ship`.
32
+
33
+ ## 2. Work
34
+
35
+ Produce an honest analysis:
36
+
37
+ - **Timeline**: when it was introduced, when it was detected, how long it was active.
38
+ - **Root cause** (already in `03-investigation.md` — copy the summary).
39
+ - **Why tests did not catch it**: a real gap, not excuses.
40
+ - **Why code review did not catch it**: if applicable.
41
+ - **Actionable prevention measures** (not generic ones like "improve tests"), each clearing the bar of flow-core §7 — a postmortem that lists six preventions has written one prevention and five wishes, and `ship`'s skeptic will say so. Each action with an owner and a suggested ticket, and an `F<n>` id — every row here is a `meta.json.followups[]` entry (`kind: "prevention"`, `source: "postmortem"`, flow-core §7). Nothing is asked now; `$flow-bug-ship` triages the whole set at its Close.
42
+ - **Areas with similar risk**: those noted in `03-investigation.md`.
43
+
44
+ ## 3. Output
45
+
46
+ `.claude/work/<TICKET>/99-postmortem.md`:
47
+
48
+ ```markdown
49
+ # Postmortem {TICKET}
50
+
51
+ ## Executive summary
52
+ <3-5 bullets: what happened, impact, cause, fix>
53
+
54
+ ## Timeline
55
+ - <date>: <event>
56
+
57
+ ## Root cause
58
+ <copy from investigation>
59
+
60
+ ## Impact
61
+ - Affected users:
62
+ - Compromised data:
63
+ - Degraded services:
64
+
65
+ ## Why it was not detected earlier
66
+ - Tests:
67
+ - Code review:
68
+ - Monitoring:
69
+
70
+ ## Prevention actions
71
+ | id | Action | Owner | Suggested ticket |
72
+ |----|--------|-------|-----------------|
73
+ | F1 | … | … | … |
74
+
75
+ ## Areas with similar risk (open separate tickets)
76
+ | id | Pattern to audit | Why it matters |
77
+ |----|------------------|----------------|
78
+ | F2 | … | … |
79
+ ```
80
+
81
+ ## 4. Domain knowledge (offer)
82
+
83
+ `knowledge.read_staging` or `knowledge.save` set (with neither, the postmortem itself is the record) →
84
+
85
+ 1. Call `knowledge.read_staging` (empty → the findings recorded in `03-investigation.md`) — the findings staged in `$flow-bug-investigate` are the primary material.
86
+ 2. Review the postmortem for additional "why" items not staged at the time (business decisions, legal constraints, integrations, false model assumptions). The "what" (code, paths) is not saved.
87
+ 3. Combine staging + new findings. Empty or only obvious things → do not insist.
88
+ 4. 1+ relevant findings → ask the user whether to save them. Yes → run the consolidation of flow-core §0, with the right angle (the lesson, not the code). No → do not insist.
89
+
90
+ Neither role set → skip this block silently.
91
+
92
+ ## 5. Close
93
+
94
+ - Update `meta.json`: `phase = "postmortem"`, add to `phases_done`.
95
+ - Overwrite `00-summary.md` whole (≤15 lines, flow-core §5).
96
+ - **Write every prevention action and similar-risk area to `meta.json.followups[]`** (flow-core §7), ids matching the tables above. This is the whole point of the phase: an action that lives only in `99-postmortem.md` is archived with the work and read by nobody, which is how the incident repeats.
97
+ - Suggest `$flow-bug-ship`. Say how many follow-ups it will ask about at its Close — **do not triage them here**: mid-postmortem is the wrong moment to judge what is worth a ticket, and `ship` asks once with the whole set in view.
98
+ - **Autonomy handoff — stops in every mode, `auto` included.** `ship` pushes and opens the MR/PR, a hard gate in every mode: do **not** chain into it; stop here and propose `$flow-bug-ship` with a single `AskUserQuestion` (recommended option by default).
@@ -0,0 +1,190 @@
1
+ ---
2
+ name: flow-bug-review
3
+ description: "Multi-agent code review of the fix before submitting"
4
+ ---
5
+
6
+ <!-- GENERATED by script/adapter-build.py from plugins/flow/commands/bug/review.md — do not edit; change the plugin file and run the script. -->
7
+
8
+ # `$flow-bug-review`
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
+ Mandatory code review of the fix.
22
+
23
+ ## 1. Pre-flight
24
+
25
+ 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: the subagents it launches take `models.agents`; its parallel rounds take `models.workers`.**
26
+
27
+ - Read `meta.json` and `00-summary.md`; open in full only `03-investigation.md` and `04-fix.md` (reviewer context, §2.1) and `05-validation.md` (regression test). (flow-core §5)
28
+ - **A premise left open by `fix` §2.2 is an input to this review, not a note.** Every row of "Premises the fix depends on" whose verdict is `unsettled` enters §5 as an **ambiguous finding** and is named in §7 whether or not that gate opened — in a bug it is usually the claim that the root cause was the whole cause, which is exactly what the regression test cannot prove.
29
+ - Require `fix` in `phases_done`; for `size` ≥ S also require `validate`.
30
+ - `git diff` shows no changes → warn and stop.
31
+
32
+ ## 2. Run the code reviews
33
+
34
+ Scope for every reviewer: the fix against the base (committed + uncommitted working tree).
35
+
36
+ ### 2.0 Resolve review depth (scale to *this diff* and the risk)
37
+ Read `quality.review_depth` from `FLOW.md` (`light` | `proportional` | `full`; empty → `proportional`) and `meta.json.size`. Built-in `code-review` effort ladder: **low < medium < high < xhigh < max** (lower = fewer, higher-confidence findings; higher = broader coverage).
38
+
39
+ **The tier is resolved against the diff in front of you**, per `$flow-feat-review §2.0`: measure the real diff (`git diff --shortstat <git.default_base>...HEAD` plus the working tree), derive its size (≤150 lines → XS · 151-600 → S · 601-1500 → M · >1500 → L), and run on the **lower** of that and `meta.json.size` — a one-file fix inside a bug classified M is an XS review. Every size-gated step here (§4.5, §5) reads that effective size. The sensitive-surface bump applies on top and is never scaled away. **When the measured diff lands within 10% under a threshold that changed the tier** (135-150, 541-600, 1351-1500), say so in one line beside the effective size in §7 — the tier does not change, and it is what makes flow-core §9 checkable after the fact.
40
+
41
+ **Say what the round will run on** (flow-core §1): the skeptics and the completeness check have no agent of their own, so with the fan-out key empty they inherit this thread's model — one line before the first round of 4 or more naming the count and the inheritance, and the same fact on the artifact's `Agent models` line. Name the key (`models.workers`, then `models.agents`), never a model.
42
+
43
+ **The budget is the command's, not the round's.** Read `agents.budget_max` from `FLOW.md` (empty → **12**; `0` = no ceiling) and hold every round below against it (flow-core §6): count before launching, launch what fits, report what the cap dropped. Give-up order when it runs out, from the top: **§5 skeptics**, then **§4.5 completeness check**, then **§2.2 idiom audit**, then **§3 reinforcements**. Never dropped: the built-in `code-review`, the panel the tier selected, and the query duel (§3.5) — if the budget cannot cover those, the budget is misconfigured: say so in one line and run them anyway.
44
+
45
+ **Sensitive surface** = auth/authorization, secrets, payments/billing, personal/sensitive data, a public API/contract shape, a DB migration/schema change — **plus** every glob in `quality.sensitive_paths` from `FLOW.md`. The key is additive: it names what is sensitive in this repo and nowhere in that list, and never narrows it.
46
+
47
+ **A sensitive path is not yet a sensitive diff** (`$flow-feat-review §2.0`): the bump applies when the change touches control flow or the data that reaches a person, a charge or a stored record. A diff on the same file that moves observability alone — log level, channel, message text, a metric, a comment — gets the review its size earned. Mixed diff → it bumps. Record which of the two it was.
48
+
49
+ | Tier | What runs |
50
+ |---|---|
51
+ | `light` (any size) | One reviewer only: built-in `code-review` at **medium** — or `quality.review_skill` alone when it is set. No project panel, no §3 reinforcements, no §5 skeptic fan-out. A sensitive surface upgrades `light` to `proportional` for this review (bump included); record the upgrade. |
52
+ | `proportional` · XS | built-in `code-review` **only**, **medium**. No project panel. |
53
+ | `proportional` · S | built-in `code-review` **high**. Project panel **only if** the diff touches a sensitive surface. |
54
+ | `proportional` · M | built-in `code-review` **high** + project panel. |
55
+ | `proportional` · L | built-in `code-review` **xhigh** + project panel. |
56
+ | `full` (any size) | built-in `code-review` **xhigh** + project panel (pre-0.7 behaviour; no tiering). |
57
+
58
+ - **Sensitive-surface bump** (`proportional`, any size): **raise the built-in effort one tier** (medium→high→xhigh→**max**) and always run the panel — an XS/S security or migration fix escalates regardless of line count.
59
+ - Record in `06-review.md` which tier and effort ran and why.
60
+
61
+ ### 2.1 Launch and consolidate
62
+ Launch the reviewers selected in §2.0 and **consolidate their findings into a single deduplicated report**:
63
+
64
+ 1. **Built-in `code-review`** (the Claude Code one, no prefix), at the effort of §2.0. Single pass over the local diff: correctness + simplification/efficiency.
65
+ 2. **Project panel** (only when §2.0 selected it): skill `quality.review_skill` from FLOW.md, invoked as `<review_skill> branch`. `review_skill` empty and `quality.reviewers` set → launch those agents in parallel as a panel. Both empty → the built-in `code-review` is the whole review. Launch the panel **as defined** — whole roster, no subset, no substitutions; an agent that cannot run goes to §7 `Agents launched` with the reason. **Every brief you write for it — and for the §3 reinforcements — ends with the report contract of flow-core §6** (`agents.report_max_words`, empty → 250; findings only, one line each): an uncapped report is truncated in transit and reads exactly like a reviewer with nothing to say. The built-in `code-review` takes no brief; bound it with the §2.0 tier and hold it to the same fan-out deadline.
66
+
67
+ Deduplicate overlaps (count once). Fix-specific focus beyond generic analysis:
68
+ - The change genuinely resolves the problem from `03-investigation.md`.
69
+ - No expanded scope (hidden refactor) — list any.
70
+ - The regression test from `05-validation.md` covers the case.
71
+
72
+ Pass `03-investigation.md` and `04-fix.md` as context. The root cause and the contracts are truth; any *"why I chose this approach"* prose in `04-fix.md` is a hypothesis to test against the code, never an axiom. Same for your own briefs: a settled decision is context (*"this is decided; what consequences does it have?"*), never a scope exclusion.
73
+
74
+ ## 2.2 Idiom / primitive audit (only if the fix introduces new architectural pieces)
75
+
76
+ Skip unless the fix adds a new service, handler, command/query, interface, or bus/dispatch wiring. Then run the blind idiom check of `$flow-feat-review §5.5`: the `agents.architecture` agent from `FLOW.md` (empty → `Agent general-purpose`) receives **only** the new pieces + their wiring and the project's primitive vocabulary (`FLOW.md` `conventions` plus this work's `meta.json.conventions_candidates[]`, flow-core §8), **without** the fix's justifications. Per piece: does the class do what its name/role promises? Why does it depend on what it depends on (a bus injected only to call another handler, a service dressed as something else, an interface with a single handler consumer)? Is there a simpler, more honest primitive? Findings enter the flow like any other.
77
+
78
+ ## 3. Reinforcements by area
79
+
80
+ Only what §2 does not already cover; skipped under `light`. Launch in parallel if applicable:
81
+
82
+ - A repeated call that leaves the process (external API, HTTP, cache, filesystem) → `agents.performance` agent from FLOW.md (empty → `Agent general-purpose` with a performance role). Ask what **each failed iteration** sets off downstream, not just the happy path. **Queries have their own pass** in §3.5.
83
+ - Workers / dead-letter queue → `agents.queues` agent from FLOW.md to confirm the fix prevents recurrence (empty → `Agent general-purpose` with a messaging role).
84
+
85
+ ## 3.5 Data-access duel (any size, whenever the fix touches a query)
86
+
87
+ Runs when the fix **adds or modifies** a query — raw SQL, the ORM's query language, a query-builder chain, a repository finder, a relation traversed in a loop, an aggregate/count, a bulk write, a migration or index change, or the equivalent against a search engine or key-value store. **Any size, XS included** — a one-line `ORDER BY` or `LIMIT` change has a cost invisible in the diff.
88
+
89
+ Run the mechanics of **`$flow-work-query`**: its **§2 fact sheet** (filter, order **with direction**, bound and whether per key or global, both sides of each join with real types and collations, heavy columns, cardinality with its source, the indexes that actually exist), its **§3 blinded challenger** over the twelve-item checklist with the main agent judging, its **§4 measurement** when the schema cannot settle it, and its **§5 verdict** shape.
90
+
91
+ Fix-specific:
92
+ - **Every modified query carries its base row** — the same query on `git merge-base HEAD <git.default_base>`, measured in the same sandbox with the same seed (`$flow-work-query` §4). This chain already demanded it for slowness bugs; it now applies to any query the fix changes, because a fix that quietly costs 40 ms is a regression whether or not the ticket mentioned speed.
93
+ - **Bug about slowness or timeouts → the duel is the fix's proof**: the base and after rows are the verdict, or the fix is unproven whatever the tests say.
94
+ - A **trick** added under pressure (a cast to align a collation, a hint, a hand-written column order) — checklist item 11 applies in full: it ships with a comment saying why it is there and what removes it, plus the ticket for the root cause, or it does not ship.
95
+ - Verdicts map as findings: **change** blocks, **regressed** blocks unless `03-investigation.md` justifies the trade, **schema / follow-up** → proposed ticket **and a `followups[]` entry** (flow-core §7), **unresolved** recorded literally.
96
+
97
+ ## 4. Over-engineering audit (fit + YAGNI)
98
+
99
+ Review the diff for new defensive mechanisms smuggled in "just in case" (validation, guard, retry, lock, fallback, cache, idempotency, circuit breaker):
100
+
101
+ - Per mechanism: *"What real, present scenario in this project justifies it?"* Verify against the code — can the flow reach that state, or does something already prevent it? If `knowledge.search` is set, query it when it depends on domain rules.
102
+ - A fix is **minimal**: anything not directly attacking the root cause of `03-investigation.md` and not answering a present scenario → Blockers, with a trim proposal.
103
+
104
+ ## 4.5. Completeness check (M/L, no loop)
105
+
106
+ **M/L by effective size (§2.0) only**, **one** check, no loop, and only while the budget covers it: after consolidating §2-§3 — never in parallel with them, since the check's input is what they covered — contrast `git diff --stat <git.default_base>...HEAD` against what was reviewed. Any changed file no reviewer looked at → targeted pass with the applicable reviewer, merge. A small diff (normal for a fix) resolves this in seconds or makes it not apply.
107
+
108
+ ## 5. Adversarial finding verification (parallel fan-out, optional)
109
+
110
+ Same as `$flow-feat-review` §6 — its gate, ceilings and autonomy rule, unchanged. Skipped under `light`. Gate: **effective size** (§2.0) **M or L**, diff **over 150 changed lines**, **≥ 4 ambiguous** findings (resting on an assumption about code outside the diff, a runtime behaviour, or an unverified convention — not defects visible in the diff). **One skeptic per ambiguous finding, in parallel, capped at `agents.fanout_max`** (empty → 4) and at what the budget leaves, refute-by-default. **The cap counts agents, not findings**: group them into that many briefs or leave the remainder unverified and say so — never widen the round because each finding looks cheap. `manual` → offer it with `AskUserQuestion`; `guided`/`auto` → run without asking and note it in the artifact. Refuted findings come off the list into "Discarded by verification" with the reason. Gate closed → say so in one line; skipped and clean are not the same result.
111
+
112
+ ## 6. Quality gates
113
+
114
+ `quality` commands from FLOW.md; empty → auto-discover:
115
+
116
+ ```
117
+ <quality.style_fix>
118
+ <quality.static_analysis>
119
+ <quality.test_one> (regression test)
120
+ ```
121
+
122
+ ## 7. Output
123
+
124
+ Cost line: count every subagent this command launched — reviewers = §2.1 built-in + panel members + §2.2; reinforcements = §3, §3.5 and §4.5 agents; skeptics = §5.
125
+
126
+ `.claude/work/<TICKET>/06-review.md`:
127
+
128
+ ```markdown
129
+ # Fix review {TICKET}
130
+
131
+ ## Summary
132
+ - Review tier: <light | full | proportional — which reviewers ran, at what built-in effort (medium/high/xhigh/max), and why, per §2.0>
133
+ - Agents launched: <ran vs defined — `N/M` of the `review_skill`/`reviewers` roster, naming any that did not run (with the reason) and any substitution; "built-in only" if §2.0 selected no panel>
134
+ - Cost: <n>/<budget_max> subagents launched (<k> reviewers · <m> reinforcements · <s> skeptics), tier <light|proportional|full>
135
+ - Effective size: <diff size (N changed lines) vs `meta.json.size`, which the tier used, and — when the diff landed within 10% under a tier threshold — that fact (§2.0)>
136
+ - Agent models: <the value of `models.workers`/`models.agents` when set; otherwise "inherited from this thread"; agents named in `agents.<role>` keep their own definition's model>
137
+ - Defaults used: <every empty `FLOW.md` key this round resolved with its default — one per line as `key → default` — or "none". In `guided`/`auto` each is also an entry in `meta.json.defaults_used[]` (flow-core §0); in `manual` the phase may offer one of them at its stop.>
138
+ - Skipped for budget: <phases dropped by §2.0's give-up order, or "none">
139
+ - Blockers: N
140
+ - Suggestions: M
141
+
142
+ ## Does the fix actually resolve the bug?
143
+ - Yes / No / Partial — explain
144
+
145
+ ## Is there expanded scope beyond the bug?
146
+ - Yes (list and propose moving to another ticket) / No
147
+
148
+ ## Over-engineering (fit + YAGNI)
149
+ - New defensive mechanisms in the fix: <list, or "none">
150
+ - Without a real scenario to justify them: <list, or "none">
151
+
152
+ ## Data-access duel
153
+ <per §3.5; "no queries touched" if none>
154
+
155
+ | Query (file:line) | New/mod | Bound | Index used / plan | Rows read → returned | vs base | Verdict | Evidence |
156
+ |---|---|---|---|---|---|---|---|
157
+
158
+ - Measured: <realistic data set / dev database / schema only / not measured, and why>
159
+ - Before vs after: <the base row for every modified query; times as `min–max` across 3 runs, and a difference inside the spread reported as "no measurable change", never a percentage>
160
+ - Unresolved: <the question left open, or "none">
161
+ - Schema / follow-up: <predating defects, with the proposed ticket, or "none">
162
+
163
+ ## Is the regression test adequate?
164
+ - Yes / No (what is missing)
165
+
166
+ ## Quality gates
167
+ <per §6 — the commands actually run, each with its result>
168
+ - style_fix: ✅ / ❌
169
+ - static_analysis: ✅ / ❌
170
+ - regression test (`test_one`): ✅ / ❌
171
+
172
+ ## Discarded by adversarial verification
173
+ <only if §5 was run; refuted findings with their reason, or "not applicable">
174
+
175
+ ## Blockers
176
+ 1. [file:line] …
177
+
178
+ ## Suggestions
179
+ 1. …
180
+ ```
181
+
182
+ ## 8. Close
183
+
184
+ - With blockers: `phase` stays where it was (`validate` for size ≥ S, `fix` on XS, where validate never ran). Iterate.
185
+ - Without blockers: `phase = "review"`, add to `phases_done`. Suggest `$flow-bug-postmortem` (M/L) or `$flow-bug-ship` (XS/S).
186
+ - **Record *what* you reviewed**, in the same write: `reviewed_sha` = `git rev-parse HEAD` — `phases_done` says a review happened, the sha says on which tree, and `$flow-bug-ship §0` compares it against what is being pushed. Only when the phase advances: a review that ended in blockers reviewed nothing that stands.
187
+ - **Stage what the review taught** (`knowledge.stage` set; silence by default). Review is where a project teaches the most and, until now, the one phase that never staged — a work with three review rounds and seventeen blockers produced zero knowledge cards because nothing asked for them while they were in context. Candidates are findings about the **domain or the codebase's real behaviour**, not about this diff: a library that does other than its name says, a test disguise that kept the suite green over a live defect, a module rule the reviewers had to cite from its own prose, a measurement. A blocker fixed here is not knowledge; *why it was written wrong* may be. Same evidence rule as `$flow-feat-design` §8 — one line of evidence per finding or it is not staged. One call per finding, one line to the user («Staged N finding(s) for `postmortem`/`ship`»). Never `knowledge.save` here.
188
+ - Overwrite `00-summary.md` whole (≤15 lines, flow-core §5).
189
+ - Stop body (after the flow-core §3 header): the findings that survived and what you did with each, plus the same Cost line as the Summary: "- Cost: <n>/<budget_max> subagents launched (<k> reviewers · <m> reinforcements · <s> skeptics), tier <light|proportional|full>".
190
+ - **Autonomy handoff.** Only without blockers — with blockers, stop in every mode. **M/L**: `manual` → propose `$flow-bug-postmortem` with a single `AskUserQuestion`; `guided`/`auto` → chain into it in this same turn. **XS/S**: the next step is `ship`, which pushes and opens the MR/PR — a hard gate in **every** mode: stop here and propose `$flow-bug-ship` with a single `AskUserQuestion`, never chaining into it.
@@ -0,0 +1,187 @@
1
+ ---
2
+ name: flow-bug-ship
3
+ description: "Commit, push, MR/PR the fix"
4
+ ---
5
+
6
+ <!-- GENERATED by script/adapter-build.py from plugins/flow/commands/bug/ship.md — do not edit; change the plugin file and run the script. -->
7
+
8
+ # `$flow-bug-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
+ Close the bug flow: commit, push, MR/PR. Same mechanics as `$flow-feat-ship`, with two differences:
22
+
23
+ 1. If `99-postmortem.md` exists, **include the link or the executive summary** in the MR/PR description.
24
+ 2. The knowledge-consolidation offer was already made in `$flow-bug-postmortem` — do not ask again here.
25
+
26
+ ## 0. Pre-flight
27
+
28
+ 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).**
29
+
30
+ - Read `meta.json` and `00-summary.md`; open in full only `04-fix.md` (the Brief), `06-review.md` (the verdict), `05-validation.md`, the §"Root cause identified" of `03-investigation.md`, and `99-postmortem.md` if it exists. (flow-core §5)
31
+ - Require `review` in `phases_done`; also `validate` if `size` ≥ S, and `postmortem` if `size` is M or L (the same sizes `$flow-bug-review §8` routes to postmortem — one rule). Missing → refuse and redirect to the missing step.
32
+ - **The review has to be about the tree you are about to push.** Compare `meta.json.reviewed_sha` and `validated_sha` against `git rev-parse HEAD`:
33
+ - **Equal** → continue.
34
+ - **Absent** (a work from before the shas were recorded) → say so in one line, continue; absence is not a mismatch.
35
+ - **Different** → read the delta (`git log --oneline <sha>..HEAD`, `git diff --stat <sha>..HEAD`) and judge it by **what it touches**. Only test files (`tests/`, `test/`, `spec/`, `__tests__/`, `*_test.*`, `*Test.*`, `*.test.*`, `*.spec.*`) or this work's folder under `.claude/work/` → append both shas and the file list to `06-review.md`, continue without asking. **Anything else** → stop and ask in **every** `autonomy.mode`, no exceptions (`AskUserQuestion`): *re-review the delta* (`$flow-bug-review` over `<sha>..HEAD`, the recommended default) · *ship as it stands*, recording in `06-review.md` the two shas and that the user accepted them unreviewed.
36
+
37
+ ## 1. Draft title and description (without sending anything yet)
38
+
39
+ **Important**: `commit-push-pr` is **not** invoked here and nothing is created. Only draft the content to show in §2.
40
+
41
+ ### Title
42
+
43
+ Format: `{PREFIX}{TICKET} Fix <observable symptom, in plain language> [patch]`.
44
+
45
+ **Good**: `{PREFIX}15310 Fix opens counted twice on retry [patch]`
46
+ **Bad**: `{PREFIX}15310 Fix tracking pixel double-counting on retry in PixelOpenedHandler [patch]`
47
+
48
+ Fixes are `[patch]` unless they break a contract — then reconsider whether it is a fix or a versioned feature.
49
+
50
+ `{PREFIX}{TICKET}` in the title is for humans and for trackers that link by convention (Jira, Linear). **On GitHub/GitLab a ticket in the title does NOT link the MR/PR to the issue** — that link lives in the body (below).
51
+
52
+ ### Issue link (in the body — fills the tracker's "Development"/linked panel)
53
+ A fix is a single MR/PR that completes the issue and targets `git.default_base`, so the closing keyword works directly. Add it at the top of the body per `tracker.tool`:
54
+ - **`gh` / `glab`**: `Closes #<N>` (`<N>` = numeric issue id from `meta.json.ticket`) — auto-links + auto-closes on merge.
55
+ - **`acli` (Jira)**: nothing — Jira links via the issue key in the branch name and title prefix.
56
+ - **`linear`**: `Closes <TICKET>` (Linear id).
57
+ - **`none` / empty**: nothing.
58
+
59
+ **Referencing other issues/MRs/PRs in the body**: only the `Closes #<N>` line carries a bare `#<number>` (the **real issue id**). Anywhere else, **never write a bare `#<number>` that is not the real issue** — GitHub/GitLab auto-resolve it to whatever carries that number and append its state (e.g. `#5 (closed)`). Reference an existing MR/PR by **URL**, one that does not exist yet by its **title** in quotes.
60
+
61
+ ### Description
62
+
63
+ **Build the description from the Brief in `04-fix.md`**, not from technical artifacts. No Brief (old fix) → draft one now from the reported symptom.
64
+
65
+ Template (in this order):
66
+
67
+ ```markdown
68
+ ## What stops happening after this fix
69
+ <what the user was observing that they will no longer observe. Symptom language, not code language.>
70
+
71
+ ## What is changed (behavior)
72
+ <1-2 lines in plain language. NOT files.>
73
+
74
+ ## What has NOT been touched
75
+ <bullets from the "What is NOT touched" section of the Brief. Important so the reviewer knows the fix is minimal.>
76
+ <then, if `meta.json.followups[]` has entries still `proposed` or `accepted`: one line each — the neighbouring bug, the similar-risk pattern, the prevention action — with its ticket id when one exists. Omit the block when there are none.>
77
+
78
+ ## Evidence
79
+ <only if `.claude/work/<TICKET>/evidence/` has files and `quality.evidence` is not `off`. The **before** is what `03-investigation.md` captured when the failure was reproduced — the one moment it exists — and the **after** is §2.5 of `05-validation.md`. A bug fix is the change where a before/after pair carries the most: it *is* the argument. Same upload rules as `$flow-feat-ship`. Omit when there is nothing.>
80
+
81
+ ## Steps to reproduce and test
82
+ <from `05-validation.md`:
83
+ 1. Reproduction of the bug before the fix (no longer applies, but documents the case).
84
+ 2. How to verify the behavior is correct after the fix.
85
+ 3. Regression test added and where it is.>
86
+
87
+ ## Pre-deploy (ONLY if `git.predeploy_gate` is active and the fix touches the database)
88
+ SQL to run **manually on the server BEFORE deploying**, all statements in a single block:
89
+ ```sql
90
+ <DDL/indexes/columns/data corrections — all together>
91
+ ```
92
+ ⚠️ **Do not deploy until this SQL has been executed in production.**
93
+
94
+ ## Postmortem (if it exists)
95
+ <if `99-postmortem.md` exists: 3-5 bullet executive summary + link to the artifact in the repo or wiki. The executive summary goes here because it is relevant to non-technical stakeholders; the detail is read separately.>
96
+
97
+ ---
98
+
99
+ <details>
100
+ <summary>Technical details for reviewers</summary>
101
+
102
+ - **Root cause** (from `03-investigation.md` §"Root cause identified"): <one line>.
103
+ - **Fix files**: <from `04-fix.md` "Changes by file">.
104
+ - **Regression test**: `tests/...` (fails before the fix, passes after).
105
+ - **Areas with similar risk** (noted, not fixed here): <from `04-fix.md`>.
106
+
107
+ </details>
108
+ ```
109
+
110
+ Use the sections from `git.request_sections` in FLOW.md if defined; otherwise the template above is the free-form description.
111
+
112
+ Rules:
113
+ - **The bug reviewer is often a PM or support**: the description must let them validate the reported symptom is resolved without reading code.
114
+ - **"What has NOT been touched" is especially important in fixes** — it makes the minimal scope explicit.
115
+ - **`## Pre-deploy` does NOT go inside `<details>`**: it is a deployment gate and must be visible. Only if `git.predeploy_gate` is active and the fix touches DB; otherwise omit it.
116
+ - **Postmortem at the top**: its summary goes in the main description, not in `<details>` — it carries business value.
117
+
118
+ ### Collect the pre-deploy SQL (only if `git.predeploy_gate` active)
119
+ Determine whether the fix modifies the database (migrations, mappings/schema, or changes recorded in the artifacts). If `quality.db_diff` is defined in `FLOW.md`, run it for the pending schema SQL. Collect **all** statements in a **single block** — the same one for the `## Pre-deploy` section and the §3.2 thread. One block / one thread even with multiple statements.
120
+
121
+ ## 2. Show to user and wait for confirmation (REQUIRED)
122
+
123
+ **Never skip this step** — hard gate: the user approves what will be published before anything is created. Print in this exact format:
124
+
125
+ ```
126
+ ─── Preview of {MR or PR, per git.host} (fix) ──────────────────────────────────
127
+ Title: <full title, including [patch]>
128
+ Assigned to: <git.assignee from FLOW.md; empty = unassigned>
129
+ Squash: <git.squash from FLOW.md>
130
+ Target branch: <git.default_base>
131
+ Issue link: <keyword that will appear in the body, e.g. "Closes #123" / "none — Jira links by title prefix">
132
+ Pre-deploy (manual SQL): <"yes — N statements, a blocking thread will be opened" / "not applicable">
133
+
134
+ Description:
135
+ <full description rendered exactly as it will appear in the MR/PR>
136
+ ─────────────────────────────────────────────────────────────────
137
+ ```
138
+
139
+ If there is pre-deploy SQL, ask the user to **explicitly confirm that the block is complete and correct** — it gates the deployment and will run in production.
140
+
141
+ Then ask with `AskUserQuestion` (header: "Create {MR or PR}"):
142
+
143
+ - **Create {MR or PR} with this content** → §3.
144
+ - **Edit before creating** → adjust what the user indicates, return to §2.
145
+ - **Cancel** → stop without creating anything. Do not touch `meta.json`.
146
+
147
+ Do not invoke `commit-push-pr` or push until explicit confirmation.
148
+
149
+ ## 3. Commit, push, and MR/PR creation
150
+
151
+ ### 3.0 Anti-deployment lock (before any push)
152
+
153
+ Same as `$flow-feat-ship` §4.0: `git rev-parse --abbrev-ref HEAD` must not be the main base (master/main), and `@{u}` must not point to `git.default_base`. If it does: `git branch --unset-upstream`, then `git push -u origin HEAD`. In train mode the MR/PR targets the parent branch.
154
+
155
+ ### 3.1 Create MR/PR
156
+
157
+ Only here — with the content approved in §2 — invoke `Skill commit-commands:commit-push-pr` passing **the final title and description**. The skill must not re-ask; if it does, answer with what was confirmed. If it pushes, it uses `git push -u origin HEAD`, never to the main base.
158
+
159
+ Assign to `git.assignee` from FLOW.md (empty → unassigned). Squash per `git.squash`.
160
+
161
+ **Record the URL the moment it exists**: write it into `meta.json` (the `mrs` entry if there is one) and refresh `panel.json` (flow-core §4) right here, before §3.2 and before anything else can fail.
162
+
163
+ ### 3.2 Pre-deploy thread (deployment gate)
164
+ **Only if `git.predeploy_gate` is active and the fix has pre-deploy SQL** (§1). After creating the MR/PR, open **a single resolvable/blocking thread** with all the consolidated SQL, using the host from `git.host`/`git.cli` (GitLab: `glab api ".../merge_requests/<iid>/discussions"`; GitHub: review conversation with required resolution). Body: the SQL block under "Pre-deploy: run this SQL on the server BEFORE deploying" + "Resolve only after running it in production".
165
+
166
+ With an "all threads resolved before merge" policy, the MR/PR cannot be merged or deployed until the SQL is executed and the thread resolved. **One single thread even if there are multiple statements.** Tell the user it is intentionally left open.
167
+
168
+ ### 3.3 Performance comment
169
+
170
+ `$flow-feat-ship` §4.3, unchanged: query rows from `06-review.md` and benchmark rows from
171
+ `05-validation.md`, posted as a comment on the MR/PR, confirmed in every mode, nothing posted when
172
+ nothing was measured. A slowness bug is the case where this comment *is* the proof the fix worked.
173
+
174
+ ## 4. Close
175
+
176
+ - Update `meta.json`: add `ship` to `phases_done`, update `updated_at`. **`phase` becomes `done` only once the MR/PR is confirmed merged** — creating it is not finishing it. Right after §3.1 it is open, so ask once with `AskUserQuestion` whether it has already been merged: **no** (the normal answer) → leave `phase = "ship"`; **yes** → `phase = "done"`. `$flow-work-green` and `$flow-work-respond` work on the open MR/PR; `$flow-work-clean` only sweeps what merged.
177
+ - Refresh `panel.json`: while the MR/PR is open its line is `wait` with the `link`; once merged it is `done`, and only then say there is nothing left here (`mark: "info"`, `style: "ok"`). Drop the `Decision` line either way.
178
+ - Overwrite `00-summary.md` whole (≤15 lines, flow-core §5).
179
+ - **Tracker: move to done.** **Only when this ship set `phase = "done"`** (merge confirmed just above) and `tracker.tool` is not `none`/empty, `tracker.done_cmd` is set, and `meta.json.ticket` is a **real tracker id**: run `tracker.done_cmd` with `{TICKET}` = `meta.json.ticket`. Never on an open MR/PR. If the answer was "not merged", skip silently — the transition belongs to whoever confirms the merge (`$flow-work-clean` reports the branch as merged, and re-running this close is legitimate). Same contract as `$flow-bug-start §4.5`: **best-effort, idempotent, gated** (ask once in `autonomy.mode: manual`; automatic in `guided`/`auto`); failure or already-done ticket → warn and continue, never block. **Leave `tracker.done_cmd` empty on GitHub/GitLab** — `Closes #N` already auto-closes on merge; this is for Jira/Linear-style trackers.
180
+ - Summarize: ticket, MR/PR URL, regression test added.
181
+ - **Cross-repo reminder**: for each `meta.json.related_repos` entry not `done`: *"you've shipped the `<this-repo>` part; `<repo>` still needs: `<scope>` → go there and run `$flow-bug-start <TICKET>` (or `$flow-feat-start`)"*. flow only reminds; this is not a hard gate.
182
+ - **Cross-repo contract handoff**: for each such entry with `contract_handoff: "pending"` — the fix changed a surface that sibling consumes — hand the new shape over as `$flow-feat-ship` §6.3 (publish the **literal** shape to the tracker ticket, mandatory preview in every autonomy mode, then record `published → <location>`; versioned-file fallback when there is no tracker). A bug flow has no §"External contracts": take the literal from the fix itself — the actual key, code, route or event the code now emits — read it off the code, never from memory.
183
+ - **Follow-up triage — `$flow-feat-ship` §6.4, in full and unchanged.** Read `meta.json.followups[]`; nothing `proposed` → skip silently. Otherwise §6.4 step 0 first — **3 or more candidates go to a skeptic** whose job is to refute that each deserves a ticket, and only the strongest `tracker.followup_ask_max` (empty → **2**) reach the user (flow-core §7) — then one batched `AskUserQuestion` (**Do it** / **Not worth it** / **Later**; `decision` entries asked as their question, `tooling` and everything `log`ged never asked), the accepted ones get their tracker issue created (outward-facing → **asks in every mode**), the logged ones their line in `tracker.debt_log`, then one offer to start the first. A bug flow is where the gate earns its keep: the prevention actions `$flow-bug-postmortem` wrote, the neighbouring bugs `$flow-bug-validate` found and the similar-risk patterns `$flow-bug-fix` flagged all land here — half a dozen of them, from one fix, and «similar risk elsewhere» that no skeptic ever read is exactly the entry that turns a closed bug into six open questions. Repeat for anything still `proposed` on the re-run that confirms the merge.
184
+ - **Conventions learned — `$flow-feat-ship` §6.4bis, in full and unchanged.** Read `meta.json.conventions_candidates[]` (flow-core §8); nothing pending → skip silently. Otherwise: drop what `FLOW.md` already says, then one batched `AskUserQuestion` (**Add to FLOW.md** / **Not a rule** / **Later**, or **Replace** when it contradicts a line that is there). Asked in every mode — it edits a file in the tree. A fix is where the corrections land hardest: *«never mock the repository in that layer»*, *«the regression test goes next to the unit test, not in the functional suite»* — said once inside `bug:fix`, and proposed again in the next incident unless they reach the file.
185
+ - **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.
186
+ - Ask whether to archive `.claude/work/<TICKET>/` to `.claude/work/_archive/`.
187
+ - If `meta.json.worktree` is not null, offer `git worktree remove <worktree>` once the MR/PR is merged (`--force` only if the user confirms discarding remaining changes). Not before merge, not without confirmation.