pi-dev-flow 0.96.0 → 0.97.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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,25 @@ Format: newest first. `Unreleased` collects what's merged but not yet tagged.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.97.0] - 2026-11-23
8
+
9
+ **A standard flow asks two questions, Approve? and Verified?, and runs the rest to done. Release? answers itself over docs and test commits and a stale build. Finish files the closing reflection's own fold/drop recommendations and does release-stage items as work. Dev port? is asked only while another flow's deploy is under review.**
10
+
11
+ ### Changed
12
+ - **A standard flow asks two questions: Approve? and Verified?** The rest runs to done unless something new comes up. Measured over ~50 real flows, the operator also answered Release? most of the time, "fold as suggested" at nearly every fold/drop list, and Finish? in chat.
13
+ - **Verified? is the release word.** Release? (`ask = on-change`) now also answers itself when the only commits after Verified? are docs (`docs/`, README, CHANGELOG) or tests, and the release output names those commits. `yolo = until-release` now holds back only a standing yolo, not a Verified? the operator gave themselves. A session running an older dev-flow build is a note on the release output instead of a question. Release? is still asked for a code change after Verified?, a major bump the playbook made, and `ask = always`.
14
+ - **Finish files the closing reflection's own fold/drop recommendations** instead of asking. A fold records a note, or counts a recurrence on the row it duplicates. A drop records nothing. The output lists each one with how to undo it. A plugin finding outside the dev-flow repo is named for the operator to file upstream, never filed by the gate. `finish = always` asks fold/drop as before.
15
+ - **Release-stage checklist items are work, not a question.** The first `flow finish` stops once to list them, to be done from the main checkout. The next `flow finish` closes out, and Finish? then answers itself.
16
+ - **Dev port? is asked only while another flow's deploy is under review and running alongside is not possible.** A holder that isn't waiting on its Verified? is replaced with a note, as one past Verified? already was. A holder under review gets a second instance next to it on the next free port when `parallelDev = yes` and the measured RAM and disk fit.
17
+ - **Skill rules:** a bare "continue", "proceed", "ok" or "yes" at a pending checkpoint is its answer. Never ask before `flow start`. Never pre-ask Release? or Finish?: run the gate, which asks only when something is open.
18
+
19
+ ## [0.96.1] - 2026-11-23
20
+
21
+ **A fold flow (started with `--reflections`) always merges unreleased with no release call, and finishes without the closing reflection.**
22
+
23
+ ### Changed
24
+ - **A fold flow merges unreleased and skips the closing reflection.** A flow started with `--reflections` (the start `flow reflect plan` prints) fixes reflection notes. On a versioned project it now always merges unreleased: Approve? asks no release call, the entry goes under Unreleased, and `--version=<kind>` or `flow bump <kind>` is refused. `flow finish` no longer runs the closing reflection on it, whatever the friction or `reflect = always`, so a clean fold flow's Finish? answers itself. `flow doctor` and the "fix the open reflections now?" nudge point at `flow reflect plan` instead of a bare `flow start … --docs|--patch`, so every fold flow is linked to the notes it closes.
25
+
7
26
  ## [0.96.0] - 2026-11-23
8
27
 
9
28
  **The release call is a kind of bump (patch, minor, major or unreleased) made at Approve?, changeable until the tag; the tag takes the number the merge commit's version file carries. Also: lettuce-style versions order and bump by their x.y.z part, and a tag-push run no longer counts as the merge commit's CI.**
@@ -35,9 +35,11 @@ while your feature is at plan or implement.
35
35
  A dev deploy is machine state, not branch state, so `flow verify` keeps a small registry in
36
36
  `.dev-flow/dev-ports.json` (port → slug, commit, time). `flow status` shows it.
37
37
 
38
- If the flow holding your port is already past its **Verified?** (at pre-release or release, and not
39
- re-asking it), nobody is reviewing that deploy, so verify replaces it and says so. If the holder is
40
- still being reviewed or still in implement, verify doesn't deploy. Instead it asks
38
+ If the flow holding your port isn't waiting on its **Verified?** (it's past it, still in implement,
39
+ or gone), nobody is reviewing that deploy, so verify replaces it and says so; the holder's own
40
+ verify redeploys before it asks you. If the holder is under review and the playbook says
41
+ `parallelDev = yes`, verify runs alongside on the next free port by itself, as long as a second
42
+ instance fits the measured RAM and disk. Otherwise verify doesn't deploy. Instead it asks
41
43
  **Dev port?**, showing who holds the port and how much RAM and disk are free, and offers:
42
44
 
43
45
  - **run alongside** on the next free port (`--port=<n>`). This needs `parallelDev` not set to `no`,
package/docs/gates.md CHANGED
@@ -69,7 +69,7 @@ kept. Only the kind of step is recorded, never a number: the number is counted f
69
69
  when the release runs, so a flow that released first moves yours along instead of colliding with it.
70
70
  No later gate asks the call again. You can change it at any point until the tag is cut: say so,
71
71
  and the agent runs `flow bump <patch|minor|major|none> --confirmed`, or passes
72
- `--version=<kind>` / `--no-version` on a confirmed `verify` or `release` call. A flow approved by an
72
+ `--version=<kind>` / `--no-version` on a confirmed `verify` or `release` call. A fold flow — one started with `--reflections`, as `flow reflect plan` prints it — is never asked the call: on a versioned project it always merges unreleased, and `--version=<kind>` or `flow bump <kind>` is refused. A flow approved by an
73
73
  older dev-flow, with no call on record, is asked at Verified? instead.
74
74
 
75
75
  ## test, check, health
@@ -90,9 +90,10 @@ Run without `--confirmed`, it deploys for your review:
90
90
 
91
91
  1. Fetches, and rebases the branch if main moved ahead. Conflicts or uncommitted tracked edits
92
92
  refuse, and the branch is left untouched.
93
- 2. Checks the dev port. If another flow that is past its Verified? holds it, verify takes it over
94
- and says so. If one still under review holds it, it asks **Dev port?**: run alongside on
95
- another port, replace that deploy, or wait. See [concurrency](concurrency.md).
93
+ 2. Checks the dev port. If the flow holding it isn't waiting on its Verified?, nobody is reviewing
94
+ that deploy, so verify takes it over and says so. If it is under review, verify runs alongside on
95
+ the next free port when `parallelDev = yes` and a second instance fits; otherwise it asks
96
+ **Dev port?**: replace that deploy, or wait. See [concurrency](concurrency.md).
96
97
  3. Runs the checks (re-running any that are stale or missing), the build, the `dev` deploy, and then
97
98
  the health probe against what it just deployed.
98
99
  4. Asks **Verified?**
@@ -146,17 +147,21 @@ Proves the branch is ready to ship:
146
147
  - **No re-verify is waiting.** When `flow verify` at pre-release asked Verified? again, the answer
147
148
  has to be recorded (`flow verify --confirmed`) before the release ships under it.
148
149
 
149
- **Release? often answers itself** (`ask = on-change`, the default). That happens when your call is
150
- on record and only release prep (bump, changelog) changed since Verified?. A `--confirmed` given before the gate asked doesn't count where a question carries news you haven't
150
+ **Release? usually answers itself** (`ask = on-change`, the default): your Verified? is the release
151
+ word. That happens when your call is on record and only release prep (bump, changelog), docs
152
+ (`docs/`, README, CHANGELOG) or tests changed since Verified?; the output names any docs/test commit
153
+ that rode under it. A `--confirmed` given before the gate asked doesn't count where a question carries news you haven't
151
154
  seen (commits after Verified? on a yolo flow, or a stale build): the gate asks first. A yolo held back
152
155
  only by `yolo = until-release` is asked like any flow, so your chat answer stands on the first call.
153
156
 
154
157
  It still asks when:
155
- - code changed after Verified?;
156
- - the session runs an old build (proceeding is allowed, and it says what you'd miss);
157
- - the playbook sets `yolo = until-release`;
158
+ - code changed after Verified? (a CI fix, a late review fix: news you haven't seen);
159
+ - a standing yolo reaches it and the playbook sets `yolo = until-release` (a Verified? you gave yourself is not held back);
158
160
  - it's a major bump the playbook made rather than you.
159
161
 
162
+ A session running an older dev-flow build than the install is a note on the release output, not a
163
+ question: it names both builds and what didn't run, and `/reload` picks up the newer one.
164
+
160
165
  Set `ask = always` in `## release` to be asked every time.
161
166
 
162
167
  Escape hatches, used only on your word: `--no-fold-check` skips the line-level changelog check, and
@@ -220,7 +225,10 @@ call it.
220
225
  items, it stops and lists them.
221
226
  2. Runs the after-merge checks (`flow-check` blocks under `## release`) from the main checkout. A red
222
227
  one stops finish and removes nothing.
223
- 3. Runs the **closing reflection** (see [reflections](reflections.md)) and waits for your fold/drop.
228
+ 3. Runs the **closing reflection** (see [reflections](reflections.md)) and files the reviewer's own
229
+ fold/drop recommendations: a fold becomes a note (or a recurrence on the note it duplicates), a
230
+ drop records nothing. The output lists each with how to undo it. dev-flow feedback for upstream is
231
+ named for you, never filed by the gate. `finish = always` asks fold/drop as before.
224
232
  4. Cleans up, on `--confirmed` or when Finish? answers itself: removes the worktree, the branch and `.dev-flow/<slug>/`. It deletes
225
233
  the remote branch only once it's proven merged. If local main is just behind origin, it
226
234
  fast-forwards it.
@@ -232,10 +240,11 @@ Playbook commits from `flow init --track` are only noted: they reach origin thro
232
240
  never a direct push. Under `merge = merge`, commits missing from main are a policy violation that
233
241
  yolo can't answer.
234
242
 
235
- **Finish? answers itself on a clean flow** (`finish = on-change`, the default): the release is
236
- recorded, the flow had no friction so no reflection ran, no `## release` checklist item is open, and
237
- no forge release was skipped. It still asks when any of those is open, and always with
238
- `finish = always` in `## release`.
243
+ **Finish? answers itself** (`finish = on-change`, the default) once the release is recorded, the
244
+ closing reflection was skipped or filed, and no forge release was skipped. `## release` checklist
245
+ items are work, not a question: the first `finish` stops once and lists them (run from the main
246
+ checkout), and the next `finish` closes out. It still asks when a forge release was skipped or the
247
+ reflection's report didn't parse, and always with `finish = always` in `## release`.
239
248
 
240
249
  To drop an unreleased feature, use `flow abort` instead.
241
250
 
@@ -269,7 +278,6 @@ Answering **yolo** at any checkpoint runs that gate with `--yolo --confirmed`. T
269
278
  question and pre-confirms the rest, so the agent runs the remaining gates back to back, following
270
279
  any wishes you added ("yolo, patch bump"). Every check and guard still applies. Yolo never answers:
271
280
  - the re-verify at pre-release;
272
- - Release? when code changed after Verified?, when the playbook sets `yolo = until-release`, or
273
- when the session runs an older build than the install;
281
+ - Release? when code changed after Verified?, or when the playbook sets `yolo = until-release`;
274
282
  - a `merge = merge` policy violation at finish;
275
283
  - skipping the closing reflection.
@@ -43,14 +43,18 @@ transcript and every worker's. It checks the findings against the open notes and
43
43
  issues, then gives you a numbered list. Each finding is marked docs, code or plugin, with a
44
44
  suggestion to **fold** (keep) or **drop** it.
45
45
 
46
- You answer per item, for example `fold 1,3 drop 2`. Folding records a note, or files the issue for a
47
- plugin finding. Dropping records nothing.
46
+ Finish files the reviewer's own recommendation for each finding, without asking: a fold records a
47
+ note (or counts a recurrence on the note it duplicates), a drop records nothing. The output lists
48
+ each one with how to undo it (`flow reflect done <id> "dropped"`, or `flow reflect --playbook|--code
49
+ "<note>"` to keep a drop). A plugin finding outside the dev-flow repo is an upstream issue, which is
50
+ public, so it's named for you to file and never filed by the gate. Set `finish = always` in
51
+ `## release` to answer fold/drop yourself, for example `fold 1,3 drop 2`.
48
52
 
49
53
  The review is skipped when the flow ran into no friction: no guard block, no gate refusing for a
50
54
  process reason (wrong stage, a missing plan, a proof that doesn't hold), no gate refusing twice in a
51
55
  row, no code change after Verified?, and no `--note`. A failing test or build is not friction by
52
56
  itself: finding it is what the checks are for. Set `reflect = always` in the playbook's `## release` section to run it every time. Only
53
- your explicit `--no-reflect` skips it; *yolo* doesn't.
57
+ your explicit `--no-reflect` skips it; *yolo* doesn't. A fold flow (started with `--reflections`) never runs it: it fixes notes, it doesn't review for new ones.
54
58
 
55
59
  ## Nudges
56
60
 
@@ -281,7 +281,7 @@ export default function devFlow(pi: ExtensionAPI) {
281
281
  /** Driver sessions with a worker running right now — one worker per session at a time. */
282
282
  const runningWorkers = new Set<string>();
283
283
 
284
- type WorkerResult = { content: { type: "text"; text: string }[]; details: { op: WorkerOp; outcome: string; verdict: string | null; commits: number; findings?: number; recorded?: boolean } | undefined; isError?: boolean };
284
+ type WorkerResult = { content: { type: "text"; text: string }[]; details: { op: WorkerOp; outcome: string; verdict: string | null; commits: number; findings?: number; recorded?: boolean; report?: ReturnType<typeof parseReflectReport> | null } | undefined; isError?: boolean };
285
285
 
286
286
  /** One fresh-session worker run for a bound flow — the body of flow_stage, shared with flow finish,
287
287
  * which runs the closing reflection itself before it removes anything (the worker reads the session
@@ -513,7 +513,7 @@ export default function devFlow(pi: ExtensionAPI) {
513
513
  if (nudges.tidy) parts.push(`${nudges.tidy} — offer it after the fold/drop answer.`);
514
514
  if (newCommits.trim() || dirty !== statusBefore) parts.push("note: the reflect worker changed the tree — inspect the change; it was told to write nothing");
515
515
  parts.push(`transcript: ${transcript || "(unknown)"}`);
516
- return { content: [{ type: "text", text: parts.join("\n\n") }], details: { op: wop, outcome, verdict: null, commits: 0, findings: reflected?.findings.length ?? 0, recorded: report.found } };
516
+ return { content: [{ type: "text", text: parts.join("\n\n") }], details: { op: wop, outcome, verdict: null, commits: 0, findings: reflected?.findings.length ?? 0, recorded: report.found, report: rows ? reflected : null } };
517
517
  }
518
518
  parts.push(
519
519
  report.found ? `REPORT:\n${report.body.slice(0, 6000)}` : modelError ? deadModelNote : `no REPORT — last words:\n${report.body}`,
@@ -544,7 +544,7 @@ export default function devFlow(pi: ExtensionAPI) {
544
544
  const finishReflectHook = (id: string, ctx: ExtensionContext, root: string, signal?: AbortSignal, onUpdate?: (u: { content: { type: "text"; text: string }[]; details: unknown }) => void): FlowHooks => ({
545
545
  reflect: async (st, note) => {
546
546
  const r = await runStageWorker({ id, wop: "reflect", st, root, key: sessionKey(ctx), note, label: "finish reflection", signal, onUpdate, ctx });
547
- return { text: r.content.map((c) => c.text).join("\n"), recorded: !!r.details?.recorded, findings: r.details?.findings ?? 0, failed: !!r.isError };
547
+ return { text: r.content.map((c) => c.text).join("\n"), recorded: !!r.details?.recorded, findings: r.details?.findings ?? 0, failed: !!r.isError, report: r.details?.report ?? undefined };
548
548
  },
549
549
  });
550
550
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-dev-flow",
3
- "version": "0.96.0",
3
+ "version": "0.97.0",
4
4
  "description": "Enforced feature workflow for Pi: plan → implement → pre-release → release, gated checkpoints, self-improvement reflections, one git worktree per feature, changelog + publish as part of the release",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -19,10 +19,10 @@ criteria hold. Call it with an args array — `["start", "dark-mode"]`,
19
19
  - **The flow tool is the only invocation.** There is no `flow` shell command —
20
20
  never bash, `npx` or a path.
21
21
  - **You run the gates; the operator says words.** Never ask the operator to
22
- type a `flow` or `/flow` command. A checkpoint is one word asked in plain
22
+ type a `flow` or `/flow` command. A checkpoint is one word asked in
23
23
  chat — **Approve? / Verified? / Release? / Finish?** — mentioning that
24
- *yolo* is an answer, then stop. Their word (or a clear equivalent) in chat →
25
- run that gate with `--confirmed`. A structured question tool is not chat;
24
+ *yolo* is an answer, then stop. Their word (or an equivalent, even "ok") in chat →
25
+ run that gate with `--confirmed`; never re-ask. A structured question tool is not chat;
26
26
  never infer the answer — the flow tool refuses a `--confirmed` with no
27
27
  operator message since the gate asked. A gate returning `NEEDS-OPERATOR <Question?>` means:
28
28
  ask exactly that, in chat. `/flow` is the operator's own override; mention it
@@ -8,33 +8,41 @@ unbinds the session — so anything that needs them runs first.
8
8
  1. **`flow finish [--note="<friction the operator mentioned>"]`**
9
9
  - Published by hand and not recorded yet → it runs the release record
10
10
  first (no question).
11
- - **Closing reflection** — while none is recorded, a read-only worker
11
+ - **Closing reflection** — skipped on a fold flow (started with
12
+ `--reflections`: it fixes reflections, it doesn't review for new ones).
13
+ Otherwise, while none is recorded, a read-only worker
12
14
  reviews this session's transcript and every worker transcript, dedupes
13
15
  against `.dev-flow/reflections.md` and upstream issues, and returns
14
16
  numbered findings, each **docs** / **code** / **plugin** with a **fold**
15
- or **drop** recommendation. Finish then stops.
17
+ or **drop** recommendation. Finish files those recommendations itself
18
+ (a fold is a note or a recurrence on the row it duplicates; a drop
19
+ records nothing) and goes on — no fold/drop question. Relay the list it
20
+ prints, with its undo line. A plugin finding outside the dev-flow repo
21
+ is listed for the operator to file upstream on their word — never file
22
+ it yourself.
16
23
  - A flow with **no friction** (no guard block, no process refusal, no gate
17
24
  stuck twice in a row, no `--note`) skips the worker, unless the playbook
18
25
  says `reflect = always`. A red test or build is not friction.
19
26
  - Worker failed or died → the gate says so and nothing is removed: re-run, or review inline (bare `flow
20
27
  reflect` prints the protocol). Only the operator's explicit word skips
21
28
  it: `flow finish --no-reflect --confirmed` — yolo never does.
22
- 2. **Findings → ask fold or drop** per item — one plain line each — with
23
- your recommendation (`fold
24
- 1,3 drop 2` is a fine answer), and stop. That answer **is** Finish?.
25
- 3. **Apply it**: fold docs → `flow reflect --playbook "<note>"`; fold code →
26
- `flow reflect --code "<note>"`; fold plugin → `flow reflect --plugin
27
- "<note>"` prints the upstream recipe — search first, then `gh issue create`
28
- and report the URL. Plugin findings never go into `reflections.md`. Open
29
- items the reviewer found fixed → propose checking them off.
30
- 4. **`flow finish --confirmed`** without asking again. Nothing found → ask
31
- **Finish?** first.
32
- - **A clean flow needs no question**: no friction, no open release-stage
33
- item, nothing skipped → the first `flow finish` closes the feature and
34
- says Finish? answered itself (`finish = always` in the playbook asks
35
- every time). Report it; do not ask afterwards.
29
+ - `finish = always` in the playbook, or a report whose rows did not parse →
30
+ the gate asks **Fold or drop?** / **Finish?** as before: ask it, apply the
31
+ answer (`flow reflect --playbook|--code "<note>"`, `--same r<id>`,
32
+ `--plugin` prints the upstream recipe), then `flow finish --confirmed`.
33
+ 2. **Release-stage checklist items** (`- [ ]` under `## release`) are work:
34
+ the first `flow finish` stops once (`release-stage work —`, not a
35
+ question) and lists them. Do each from the main checkout, then run `flow
36
+ finish` again — no question to ask; report what each showed.
36
37
  - A red after-merge check (`flow-check` under `## release`, run from the
37
38
  main checkout) stops finish with its output: fix, re-run.
39
+ 3. **Never ask Finish? before calling the gate.** Run `flow finish` as soon
40
+ as the release is recorded; it answers Finish? itself when nothing is left
41
+ open, and returns `NEEDS-OPERATOR Finish?` only when something is (a
42
+ skipped forge release, `finish = always`). Report it; do not ask
43
+ afterwards.
44
+ 4. Open items the reviewer found fixed are listed as proposals — check them
45
+ off only on the operator's word (`flow reflect done r<id> "<where>"`).
38
46
  5. Offer the printed suggestions (`⚑ fix the open reflections now?`, `↻ N
39
47
  closed reflection(s)`) in one line each; never start a fix flow without
40
48
  the operator's word.
@@ -59,6 +59,7 @@ No code edits before approval. Reads are always allowed.
59
59
  `--no-version` (yolo → add `--yolo`); without the call the gate refuses and keeps nothing.
60
60
  The call is not asked again. The operator can change it at any later point until the tag: `flow bump
61
61
  <patch|minor|major|none> --confirmed`, or `--version=<kind>` / `--no-version` on a confirmed verify or release call.
62
+ A fold flow — one started with `--reflections`, as `flow reflect plan` prints it — carries no call: on a versioned project it always merges unreleased, and `--version=<kind>` or `flow bump <kind>` is refused.
62
63
 
63
64
  Approval creates the worktree and branch and runs `commands.setup` there; a
64
65
  failing setup fails the gate and the next approve retries it. `(ui)` playbook
@@ -52,21 +52,22 @@ and settle the scheme with the operator; never invent one.
52
52
  6. **Run `flow release` before asking anything.** Never ask Release? in
53
53
  chat ahead of the call: the gate did not see that question, and when it
54
54
  needs the word it asks again, so the operator answers twice. By default (`ask = on-change`) it answers
55
- Release? itself when the release call is on record and only the prep
56
- landed since Verified? — say in a few lines what the PR delivers (the
55
+ Release? itself when the release call is on record and only the prep,
56
+ docs or tests landed since Verified? — the operator's Verified? is the
57
+ release word. Say in a few lines what the PR delivers (the
57
58
  changelog entry usually is that) and the version, and carry on with the
58
59
  release stage.
59
60
  7. **It returned `NEEDS-OPERATOR Release?`** (it says why: code after
60
- Verified?, no call on record, a stale build, `yolo = until-release`, a
61
- major bump, or the playbook's `ask = always`) → **ask Release? and
61
+ Verified?, no call on record, a standing yolo under `yolo =
62
+ until-release`, a major bump, or the playbook's `ask = always`) → **ask Release? and
62
63
  stop**, with the same summary and the version. Report opening:
63
64
  **🔍 pre-release · `<slug>`** (the gate's stage line; the version field
64
65
  reads `pending` until decided — never invent a bump or a no-version
65
66
  decision). Answer → `flow release --confirmed`.
66
67
  - Standing yolo → run `flow release` bare, without asking. It still returns
67
- `NEEDS-OPERATOR Release?` when commits landed after Verified?, the
68
- playbook says `yolo = until-release`, or the session build is stale —
69
- then ask. A `--confirmed` passed before the gate asked is not an answer
68
+ `NEEDS-OPERATOR Release?` when commits landed after Verified? or the
69
+ playbook says `yolo = until-release` — then ask. A stale session build is
70
+ a note in the output, never a question. A `--confirmed` passed before the gate asked is not an answer
70
71
  there: the gate asks first. Never carry the standing yolo onto the call
71
72
  as `--yolo`: the operator's answer is `flow release --confirmed`.
72
73
  - Operator ships **without a version** → `flow release --no-version
@@ -8,8 +8,8 @@ friction only, never the same issue twice. `.dev-flow/reflections.md` holds
8
8
 
9
9
  | Command | Files under | Fixed by |
10
10
  | --- | --- | --- |
11
- | `flow reflect --playbook "<note>"` | `## playbook` (fix lives in `project.md`) | a docs flow: `flow start fold-<topic> --docs` |
12
- | `flow reflect --code "<note>"` | `## code` (this project's code, maybe the playbook) | a patch flow: `flow start fix-<topic> --patch` (normal when bigger) |
11
+ | `flow reflect --playbook "<note>"` | `## playbook` (fix lives in `project.md`) | a docs fold flow: the `--reflections` start `flow reflect plan` prints |
12
+ | `flow reflect --code "<note>"` | `## code` (this project's code, maybe the playbook) | a patch fold flow: the `--reflections` start `flow reflect plan` prints (normal when bigger) |
13
13
  | `flow reflect --plugin "<note>"` | nothing — prints the upstream recipe | a GitHub issue, filed only on the operator's word |
14
14
 
15
15
  - `--plugin`: search first (`gh issue list --repo <dev-flow repo> --state all
@@ -46,7 +46,10 @@ rows it fixes: `flow start fix-<topic> --patch --reflections=r3,r7`. Fix them
46
46
  on the branch, and run `flow reflect defer <id> "<why>"` for any linked row
47
47
  the flow won't fix. `finish` closes the others as fixed by the flow, so never
48
48
  check linked rows off by hand. Rows not linked to a flow are closed with
49
- `flow reflect done <id> "<what>"`. Never edit `reflections.md`.
49
+ `flow reflect done <id> "<what>"`. Never edit `reflections.md`. A fold flow
50
+ always merges unreleased on a versioned project (no release call at
51
+ Approve?, the entry goes under Unreleased) and finishes without a closing
52
+ reflection.
50
53
 
51
54
  **GitHub issues** fold into `flow doctor` / `reflect list` when the repo has a
52
55
  GitHub remote: a local row an open issue covers shows `⟷ gh#NNN` (check it off
@@ -57,5 +57,5 @@ git (merge, tag, push on the default branch) is allowed only in this stage.
57
57
  - `release.artifact` set and CI publishes from the tag: the record step waits
58
58
  for that CI (up to 15 min) — no hand-run `gh run watch`.
59
59
  - After-merge work: `flow-check` blocks under `## release` are run by
60
- `flow finish` from the main checkout; `- [ ]` items there close with the
61
- Finish? answer.
60
+ `flow finish` from the main checkout; `- [ ]` items there are work — the
61
+ first `flow finish` stops once to list them, the next one closes out.
@@ -35,6 +35,8 @@ knobs · merge-policy state.
35
35
  adds the mockup gate, so don't ask. Turning it **off** is the operator's:
36
36
  `flow start <slug> --no-ui --confirmed` at plan, after they say so, and
37
37
  aborting a ui feature at plan asks the same.
38
+ - **Never ask before `flow start`**: starting only creates the plan stage;
39
+ the operator's first word is Approve?.
38
40
  - **A mode is a proposal, not a grant**: pass `--patch` or `--docs` on the
39
41
  start call when the work fits (no `--confirmed`, no question). The
40
42
  operator grants it with their **Approve?** answer — say the mode and why
package/src/core.ts CHANGED
@@ -71,6 +71,7 @@ export interface FlowState {
71
71
  reflectedAt?: string; // a reflect worker reported for this flow — finish runs one first while this is unset (only --no-reflect --confirmed skips it)
72
72
  devPort?: number; // the port the operator chose for this flow's dev deploy when the default was held by another flow — finish stops it (devDown)
73
73
  friction?: number; // process refusals, a gate refusing twice in a row, guard blocks and post-Verified? code changes this feature hit (isFriction; a red check alone is not one) — finish skips the closing reflection at 0 (playbook reflect = on-friction)
74
+ reflectApplied?: boolean; // finish filed the closing reflection's own fold/drop recommendations (no question) — like reflectQuiet, nothing is left open for Finish?
74
75
  reflectQuiet?: boolean; // finish skipped the closing reflection because the flow had no friction — with nothing else open, Finish? answers itself (release.finish = on-change)
75
76
  reviewDeploy?: { wt: string; slot: string; at: string }; // the tree (checkFingerprint) and dev slot `flow verify` deployed for the operator's review — a --confirmed over the same tree does not build and deploy it a second time
76
77
  review?: FlowReview; // the review step ran (worker or inline) or the operator skipped it — flow verify (before Verified?) and flow release refuse without one (gh#233)
@@ -612,6 +613,13 @@ export function releaseCallQuestion(now: string | null, file: string, docs?: boo
612
613
  };
613
614
  }
614
615
 
616
+ /** A fold flow — one started with `--reflections`, fixing reflection rows — always merges unreleased: the fix rides
617
+ * under Unreleased until the next versioned release. Null when `choice` is allowed. */
618
+ export function foldCallError(state: FlowState, choice: string | null | undefined): string | null {
619
+ if (!state.reflections?.length || !choice || choice === "unreleased") return null;
620
+ return `a fold flow (linked reflections ${state.reflections.map((r) => `r${r.id}`).join(", ")}) always merges unreleased — the fix rides under Unreleased until the next versioned release`;
621
+ }
622
+
615
623
  /** Does `manifest` carry the operator's release call? `newest` is the newest tagged release, `base` the manifest the
616
624
  * branch started from. Null when it does; otherwise what to fix, with the number the call means today. */
617
625
  export function releaseCallProof(choice: string, manifest: string | null, newest: string | null, base: string | null, file: string): { error: string; want?: string } | null {
@@ -751,6 +759,13 @@ export function prepFiles(cfg: Config): Set<string> {
751
759
  return new Set([cfg.versioning.file, cfg.release.changelog, cfg.versioning.file === "package.json" ? "package-lock.json" : ""].filter(Boolean) as string[]);
752
760
  }
753
761
 
762
+ /** A path that ships no behaviour an operator's look at the running app could have judged: docs and tests. A
763
+ * commit touching only these after Verified? rides under that word (named in the release output) instead of
764
+ * asking Release? again. Markdown outside docs/ is not here: a skill or prompt file is product in some repos. */
765
+ export function nonBehaviourPath(f: string): boolean {
766
+ return /^docs\//.test(f) || /^(README|CONTRIBUTING|CHANGELOG)(\.[a-z]+)?$/i.test(f) || /(^|\/)(test|tests|__tests__|spec)\//.test(f) || /\.(test|spec)\.[a-z0-9]+$/i.test(f);
767
+ }
768
+
754
769
  /** True when every changed path is a release-prep file (and something changed): the bump and the changelog
755
770
  * entry land after the checks by design, and re-running the whole suite over them proves nothing new. */
756
771
  export function prepOnlyChange(cfg: Config, changed: string[]): boolean {
@@ -2282,8 +2297,8 @@ export interface ReflectionRoute {
2282
2297
  route: string;
2283
2298
  }
2284
2299
 
2285
- const DOCS_ROUTE = "docs flow (flow start fold-<topic> --docs) — project.md edits only pass its worktree";
2286
- const CODE_ROUTE = "patch flow (flow start fix-<topic> --patch), normal flow when bigger";
2300
+ const DOCS_ROUTE = "docs flow (flow reflect plan prints its --reflections start) — project.md edits only pass its worktree";
2301
+ const CODE_ROUTE = "patch flow (flow reflect plan prints its --reflections start), normal flow when bigger";
2287
2302
 
2288
2303
  export function reflectionRoutes(items: ReflectItem[], selfRepo: boolean): ReflectionRoute[] {
2289
2304
  return items.map((it) => {
@@ -2454,8 +2469,8 @@ export function reflectionNudges(text: string, today: string, opts: { recurred?:
2454
2469
  if (code && opts.between) why.push("between flows");
2455
2470
  let fix: string | null = null;
2456
2471
  if (open.length && why.length) {
2457
- const split = [docs ? `${docs} playbook item(s) → one docs flow (flow start fold-<topic> --docs)` : "", code ? `${code} code item(s) → patch flow (flow start fix-<topic> --patch)` : ""].filter(Boolean).join("; ");
2458
- fix = `⚑ fix the open reflections now? (${why.join(", ")}) — ${split}; flow reflect plan groups them into flows`;
2472
+ const split = [docs ? `${docs} playbook item(s) → one docs flow` : "", code ? `${code} code item(s) → patch flow(s)` : ""].filter(Boolean).join("; ");
2473
+ fix = `⚑ fix the open reflections now? (${why.join(", ")}) — ${split}; flow reflect plan groups them into flows and prints each start command`;
2459
2474
  }
2460
2475
  const closedLines = text.split("\n").filter(isDoneItem);
2461
2476
  const closed = closedLines.length;
@@ -2687,7 +2702,7 @@ function stageHint(state: FlowState, cfg: Config): string {
2687
2702
  return `${review}fix must/should${state.docs ? "" : " (a fix that changes behaviour: flow verify redeploys and re-asks Verified? over it)"}, update docs${prep ? `, ${prep}` : ""}; show the PR summary, version and changelog, then run flow release${gateAsks}`;
2688
2703
  }
2689
2704
  case "release":
2690
- if (state.approvals.release) return `release recorded — commit and push any release chores in the main checkout (DEV_FLOW_ALLOW_MAIN=1 for the pre-commit hook), then flow finish (closing reflection first; its fold/drop answer is Finish?)`;
2705
+ if (state.approvals.release) return `release recorded — commit and push any release chores in the main checkout (DEV_FLOW_ALLOW_MAIN=1 for the pre-commit hook), then run flow finish right away — do not ask Finish? first: it runs the closing reflection, files its suggestions and closes out, and asks only when something is left open`;
2691
2706
  if (state.publish) return `flow release publishes (push, PR, CI wait, merge${state.noVersion ? "" : ", tag"}) and records the release — re-run it after a "publish stopped" or "publish waiting" result; then flow finish`;
2692
2707
  return `publish: push the branch, open the PR, merge once CI is green (gh pr checks <n> --watch)${mergeHintFor(cfg)}${state.noVersion ? " — unversioned: no bump, no tag" : ", push the annotated tag"}; then flow finish records the release and closes out`;
2693
2708
  }
@@ -131,8 +131,10 @@ export async function devSlotCheck(o: GateCtx, state: FlowState): Promise<RunRes
131
131
  // the holder's review is over — it is past Verified? (pre-release or release) and not re-asking it, or it is
132
132
  // gone: nobody is looking at that deploy, so taking the port asks nobody (lettuce rail-avatar-size-28 asked
133
133
  // replace-or-wait over a flow that had already merged)
134
- if (!other || ((other.stage === "pre-release" || other.stage === "release") && other.pendingAsk !== "Verified?"))
135
- return { note: `dev: replaced ${slot.slug}'s deploy on ${portLabel(port)} — ${other ? `it is at ${other.stage}, past its Verified?` : "that flow is gone"}, so nobody was reviewing it` };
134
+ // The same holds for a holder that is not waiting on its Verified?: only that question puts a person in front
135
+ // of the deploy — the holder's own verify redeploys before it asks again.
136
+ if (!other || other.pendingAsk !== "Verified?")
137
+ return { note: `dev: replaced ${slot.slug}'s deploy on ${portLabel(port)} — ${other ? `it is at ${other.stage}, not waiting on its Verified?` : "that flow is gone"}, so nobody was reviewing it` };
136
138
  const taken = new Set(Object.keys(reg).map(Number).filter(Number.isFinite));
137
139
  const nextPort = port !== undefined ? await nextFreePort(port, taken) : null;
138
140
  const mem = memAvailable();
@@ -142,6 +144,12 @@ export async function devSlotCheck(o: GateCtx, state: FlowState): Promise<RunRes
142
144
  `RAM available ${mem !== null ? formatSize(mem) : "unknown"}${cfg.instanceMem !== undefined ? ` (one instance needs ${formatSize(cfg.instanceMem)})` : ""}`,
143
145
  `disk free ${disk !== null ? formatSize(disk) : "unknown"}${cfg.instanceDisk !== undefined ? ` (one instance needs ${formatSize(cfg.instanceDisk)})` : ""}`,
144
146
  ].join(", ");
147
+ // under review, and a second instance is known to fit: run alongside — nothing of the other flow is touched
148
+ if (side.ok && cfg.parallelDev === true && nextPort !== null) {
149
+ state.devPort = nextPort;
150
+ writeState(root, state);
151
+ return { note: `dev: ${portLabel(port)} is serving ${slot.slug} under review — deployed alongside on port ${nextPort} (parallelDev = yes)` };
152
+ }
145
153
  const caveat = side.ok
146
154
  ? cfg.parallelDev === undefined
147
155
  ? " The playbook does not say whether two instances can share this machine (parallelDev = yes|no) — tell the operator that when you ask."
@@ -1,7 +1,7 @@
1
1
  /** dev-flow runtime — The gate runner and the gates that do not ship anything. Moved out of extensions/dev-flow.ts as is (exports added). */
2
2
  import { copyFileSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
3
3
  import path from "node:path";
4
- import { skipsChecks, approveGate, versionArg, playbookVersionChoice, releaseCallQuestion, describeVersionChoice, applicableItems, appendRoadmapItem, checklistHash, claimBlocks, doneItemCount, detectForge, gateHelpJson, healthProbe, parseMergeStyle, investigationBrief, pluginVersion, reflectProtocol, reflectUnfiledCount, reflectionNudges, reflectionRoutes, listFiles, needsOperator, newState, nextHint, openChecklistItems, releaseGate, roadmapDone, roadmapDrop, roadmapOpenCount, roadmapOpenRows, roadmapBriefFor, roadmapPick, roadmapTidy, statusJson, subst, sq, featureTmpDir, foreignWorktreeLinks, validSlug, verifyGate, STAGE_EMOJI, type ReflectTarget, type Config, type FlowState, parseRowIds, DF_GITIGNORE } from "../core.ts";
4
+ import { type ReflectFinding, type ReflectOpenCheck, foldCallError, skipsChecks, approveGate, versionArg, playbookVersionChoice, releaseCallQuestion, describeVersionChoice, applicableItems, appendRoadmapItem, checklistHash, claimBlocks, doneItemCount, detectForge, gateHelpJson, healthProbe, parseMergeStyle, investigationBrief, pluginVersion, reflectProtocol, reflectUnfiledCount, reflectionNudges, reflectionRoutes, listFiles, needsOperator, newState, nextHint, openChecklistItems, releaseGate, roadmapDone, roadmapDrop, roadmapOpenCount, roadmapOpenRows, roadmapBriefFor, roadmapPick, roadmapTidy, statusJson, subst, sq, featureTmpDir, foreignWorktreeLinks, validSlug, verifyGate, STAGE_EMOJI, type ReflectTarget, type Config, type FlowState, parseRowIds, DF_GITIGNORE } from "../core.ts";
5
5
  import { applyAnswers, buildDraft, doctorFindings, ghostFeatureDirs, ghostInfo, lineDiff, loadProject, mdDigest, parseAnswers, parseProjectMd } from "../projectmd.ts";
6
6
  import { linkedTag } from "../fold.ts";
7
7
  import { detectProject } from "../detect.ts";
@@ -14,7 +14,7 @@ import { gateFinish, gateRelease, gateReleaseDone, gateVerify } from "./ship.ts"
14
14
 
15
15
  /** What a gate may need from the extension closure: finish runs the closing reflection worker itself. */
16
16
  export interface FlowHooks {
17
- reflect?: (state: FlowState, note: string) => Promise<{ text: string; recorded: boolean; findings: number; failed: boolean }>;
17
+ reflect?: (state: FlowState, note: string) => Promise<{ text: string; recorded: boolean; findings: number; failed: boolean; report?: { findings: ReflectFinding[]; open: ReflectOpenCheck[] } }>;
18
18
  }
19
19
 
20
20
  /** Write `.dev-flow/.gitignore` when it is missing; true when it did. Best effort — never fails a gate. */
@@ -412,8 +412,13 @@ export async function gateStart(o: GateCtx): Promise<RunResult> {
412
412
  const state = newState(slugArg, flag("ui"), flag("patch"), flag("docs"), loadedVersion() ?? undefined);
413
413
  if (linked.length) {
414
414
  state.reflections = linked;
415
+ // a fold flow fixes rows: on a versioned project it always merges unreleased, so no release call is asked
416
+ if (cfg.versioning.file) {
417
+ state.versionChoice = "unreleased";
418
+ state.noVersion = true;
419
+ }
415
420
  const rows = readReflections(root).filter((i) => linked.some((l) => l.id === i.n));
416
- notes.push(`linked reflections (finish closes each as fixed by this flow; one it does not fix: flow reflect defer <id> "<why>"):\n${rows.map((i) => ` r${i.n}. ${i.line.replace(/^- \[ \] /, "").replace(/^\[r\d+\]\s*/, "")}`).join("\n")}`);
421
+ notes.push(`linked reflections (finish closes each as fixed by this flow; one it does not fix: flow reflect defer <id> "<why>"):\n${rows.map((i) => ` r${i.n}. ${i.line.replace(/^- \[ \] /, "").replace(/^\[r\d+\]\s*/, "")}`).join("\n")}\nfold flow: it merges unreleased (entry under Unreleased, no bump, no tag — no release call is asked) and finishes without a closing reflection`);
417
422
  }
418
423
  const planDir = path.join(featDir(root, slugArg), "plan");
419
424
  if (ghost) notes.push(gi!.plan ? `adopted ghost .dev-flow/${slugArg}/ — its plan/ (${listFiles(planDir).join(", ") || "empty"}) is this feature's draft` : `adopted ghost .dev-flow/${slugArg}/ — kept ${gi!.entries.join(", ") || "nothing (it was empty)"}`);
@@ -451,6 +456,8 @@ export async function gateApprove(o: GateCtx): Promise<RunResult> {
451
456
  // the release call is made here, with the plan: only the kind of step is recorded, never a number
452
457
  const relArg = versionArg(flagValue(o.rest, "version"), flag("no-version"));
453
458
  if ("error" in relArg) return { text: `plan gate FAILED:\n- ${relArg.error}`, isError: true };
459
+ const foldErr = foldCallError(state!, relArg.choice);
460
+ if (foldErr) return { text: `plan gate FAILED:\n- ${foldErr}`, isError: true };
454
461
  const call = relArg.choice ?? state!.versionChoice ?? playbookVersionChoice(cfg);
455
462
  const callQ = cfg.versioning.file && !call ? releaseCallQuestion(manifestAt(root, cfg.versioning.file), cfg.versioning.file, state!.docs) : null;
456
463
  if (relArg.choice && relArg.choice !== "unreleased" && !cfg.versioning.file) return { text: "plan gate FAILED:\n- --version needs a version file to bump: the playbook sets none (versionFile under ## release)", isError: true };
@@ -528,6 +535,8 @@ export async function gateBump(o: GateCtx): Promise<RunResult> {
528
535
  const { state, err } = needState(root, sess, slug);
529
536
  if (err) return err;
530
537
  const choice = arg.choice!;
538
+ const foldErr = foldCallError(state!, choice);
539
+ if (foldErr) return { text: `bump FAILED:\n- ${foldErr}`, isError: true };
531
540
  if (!cfg.versioning.file && choice !== "unreleased") return { text: "bump FAILED:\n- the playbook sets no version file (versionFile under ## release), so there is nothing to bump — set one first", isError: true };
532
541
  if (state!.publish?.tag || state!.approvals.release) return { text: `bump FAILED:\n- ${state!.publish?.tag ?? "the release"} is already ${state!.publish?.tag ? "tagged" : "recorded"} — the call cannot change after the tag`, isError: true };
533
542
  const was = state!.versionChoice;
@@ -79,8 +79,9 @@ export function grantRecord(args: readonly string[], key: string, users: number
79
79
 
80
80
  /** A refusal that is the work failing, not the process: a red test, a broken build, a deploy that did not come up. */
81
81
  const WORK_FAILURE = /check run at the gate failed|\bbuild FAILED\b|dev deploy FAILED|probe FAILED|served-build check FAILED|after-merge check "[^"]*" failed|has not passed|publish stopped — PR #\d+ checks failed/;
82
- /** The release gate still waiting on CI: re-running it is the instruction, never a sign the agent is stuck. */
83
- const WAITING = /(?:^|\n)publish waiting —/;
82
+ /** The release gate still waiting on CI, or finish handing over the release-stage items: re-running it is the
83
+ * instruction, never a sign the agent is stuck. */
84
+ const WAITING = /(?:^|\n)(?:publish waiting|release-stage work) —/;
84
85
  /** `flow check|test|health` reporting a red run — the answer those tools exist to give. A refusal from them that
85
86
  * is not a run (nothing configured, no feature bound) stays friction. */
86
87
  const RED_RUN = /^(?:tier-1 checks:|test: FAIL|health: FAIL)/;
@@ -1,7 +1,7 @@
1
1
  /** dev-flow runtime — Reflections and the upstream issue fold. Moved out of extensions/dev-flow.ts as is (exports added). */
2
2
  import { existsSync, readFileSync, writeFileSync } from "node:fs";
3
3
  import path from "node:path";
4
- import { ensureReflectIds as ensureReflectIdsFor, appendReflection, doneItemCount, githubSlug, pluginVersion, guessReflectSections, reflectItems, reflectMove, reflectDone, reflectRow, reflectLegacyPluginCount, reflectionNudges, pluginIssueRecipe, reflectionLine, reflectionsTidy, openChecklistItems, parseRowIds, reflectSame, reflectReopen, closedRowsBySection, archiveAppend, archiveTake, reflectFixPlan, rowId, type ReflectTarget, type ReflectItem, type ReflectSection, type FlowState } from "../core.ts";
4
+ import { ensureReflectIds as ensureReflectIdsFor, appendReflection, doneItemCount, githubSlug, pluginVersion, guessReflectSections, reflectItems, reflectMove, reflectDone, reflectRow, reflectLegacyPluginCount, reflectionNudges, pluginIssueRecipe, reflectionLine, reflectionsTidy, openChecklistItems, parseRowIds, reflectSame, reflectReopen, closedRowsBySection, archiveAppend, archiveTake, reflectFixPlan, rowId, shortFindingNote, type ReflectFinding, type ReflectOpenCheck, type ReflectTarget, type ReflectItem, type ReflectSection, type FlowState } from "../core.ts";
5
5
  import { dedupeReflections, linkedTag, parseGhIssues, similarNote, type FoldResult, type GhIssue } from "../fold.ts";
6
6
  import { dfDir, now, originUrl, readState, writeState, readReflectArchive, readReflections, readReflectionsText, reflectArchiveFile, sh } from "./base.ts";
7
7
  import { type RunResult, type Session } from "./checks.ts";
@@ -107,6 +107,54 @@ export function reflectDeferNote(root: string, sess: Session, args: string[]): R
107
107
  return { text: `reflect: r${id} deferred by ${sess.slug} — it stays open (${why}); finish closes the rest of the linked rows as fixed` };
108
108
  }
109
109
 
110
+ /** finish's closing reflection, settled without a question: the reviewer's own fold/drop recommendation is
111
+ * applied — a fold is recorded (a recurrence on the row its dup names), a drop records nothing — and the lines
112
+ * say what happened and how to undo it. A plugin fold outside the dev-flow repo is an upstream issue, which is
113
+ * public: it is named for the operator, never filed from here. */
114
+ export async function applyReflectFindings(root: string, sess: Session, report: { findings: ReflectFinding[]; open: ReflectOpenCheck[] }): Promise<string[]> {
115
+ const self = isSelfRepo(root);
116
+ const out: string[] = [];
117
+ const upstream: string[] = [];
118
+ for (const f of report.findings) {
119
+ const short = shortFindingNote(f.note);
120
+ if (f.rec === "drop") {
121
+ out.push(` ${f.n}. dropped: ${short}`);
122
+ continue;
123
+ }
124
+ const dupRow = /^r(\d+)$/i.exec(f.dup.trim());
125
+ if (dupRow) {
126
+ const same = reflectSameNote(root, sess, [`r${dupRow[1]}`, f.evidence]);
127
+ if (!same.isError) {
128
+ out.push(` ${f.n}. folded as a recurrence of r${dupRow[1]}: ${short}`);
129
+ continue;
130
+ }
131
+ }
132
+ if (/^gh#\d+$/i.test(f.dup.trim())) {
133
+ out.push(` ${f.n}. already filed as ${f.dup.trim()}: ${short}`);
134
+ continue;
135
+ }
136
+ if (f.kind === "plugin" && !self) {
137
+ upstream.push(` ${f.n}. ${short}`);
138
+ continue;
139
+ }
140
+ const r = await reflectNote(root, sess, [f.note], f.kind === "docs" ? "playbook" : "code", f.evidence);
141
+ const id = /reflected as (r\d+)/.exec(r.text)?.[1] ?? /as (r\d+)/.exec(r.text)?.[1];
142
+ out.push(` ${f.n}. folded${id ? ` as ${id}` : ""} (${f.kind === "docs" ? "playbook" : "code"}): ${short}`);
143
+ }
144
+ for (const o of report.open) {
145
+ if (o.status === "recurred") {
146
+ const same = reflectSameNote(root, sess, [`r${o.n}`, o.reason]);
147
+ if (!same.isError) out.push(` r${o.n} seen again: ${shortFindingNote(o.reason)}`);
148
+ } else if (o.status === "fixed") out.push(` r${o.n} looks fixed${o.reason ? ` (${shortFindingNote(o.reason)})` : ""} — close it on the operator's word: flow reflect done r${o.n} "<where>"`);
149
+ }
150
+ if (!out.length && !upstream.length) return ["closing reflection: nothing new to fold."];
151
+ return [
152
+ `closing reflection — the reviewer's recommendations were applied (no question; to undo a fold: flow reflect done <id> "dropped"; to keep a drop: flow reflect --playbook|--code "<note>"):`,
153
+ ...out,
154
+ ...(upstream.length ? [" dev-flow feedback to file upstream on the operator's word (flow reflect --plugin \"<note>\" prints the recipe):", ...upstream] : []),
155
+ ];
156
+ }
157
+
110
158
  /** Close the rows a flow was linked to and did not defer — finish's half of the link. Returns the ids closed. */
111
159
  export function closeLinkedReflections(root: string, state: FlowState, prNote: string): number[] {
112
160
  const linked = (state.reflections ?? []).filter((r) => !r.deferred);
@@ -1,13 +1,13 @@
1
1
  /** dev-flow runtime — The gates that ship: verify, release, release-done, finish. Moved out of extensions/dev-flow.ts as is (exports added). */
2
2
  import { existsSync, readFileSync, rmSync, writeFileSync } from "node:fs";
3
3
  import path from "node:path";
4
- import { skipsChecks, applicableItems, changelogVersionsBetween, normalizeReleaseBody, pendingEntryLines, pickReleaseNotes, checklistHash, checklistPending, cmpVersions, freshenChecks, healthProbe, mergeShapeProof, preReleaseGate, reflectionNudges, conflictMarkerLines, isReleaseOnly, looksLikeShellError, needsOperator, newestTaggedVersion, nextHint, releaseGate, parseVersion, roadmapDoneForSlug, sq, tagNotesCommand, verifyGate, versionTagGate, servedBuildMatches, prepFiles, versionArg, playbookVersionChoice, describeVersionChoice, majorBump, releaseCallQuestion, releaseCallProof, cmpRelease, versionCore, resolvedDevEnv, reviewOwed, localDefaultAhead, failTail, operatorDirt } from "../core.ts";
4
+ import { foldCallError, nonBehaviourPath, skipsChecks, applicableItems, changelogVersionsBetween, normalizeReleaseBody, pendingEntryLines, pickReleaseNotes, checklistHash, checklistPending, cmpVersions, freshenChecks, healthProbe, mergeShapeProof, preReleaseGate, reflectionNudges, conflictMarkerLines, isReleaseOnly, looksLikeShellError, needsOperator, newestTaggedVersion, nextHint, releaseGate, parseVersion, roadmapDoneForSlug, sq, tagNotesCommand, verifyGate, versionTagGate, servedBuildMatches, prepFiles, versionArg, playbookVersionChoice, describeVersionChoice, majorBump, releaseCallQuestion, releaseCallProof, cmpRelease, versionCore, resolvedDevEnv, reviewOwed, localDefaultAhead, failTail, operatorDirt } from "../core.ts";
5
5
  import type { Config, FlowState } from "../core.ts";
6
6
  import { AGENT_MARK } from "../present.ts";
7
7
  import { manifestAt, recordReleaseCall, refreshDocsCode, buildSkew, copyWarning, currentBranch, featDir, flagValue, forgeMergeStyle, forgeOf, gateCwd, mergeBase, needState, now, originUrl, readReflectionsText, readRoadmap, readState, releaseTags, roadmapFile, sh, tail, worktreeAbs, writeState } from "./base.ts";
8
8
  import { type RunResult, ago, releaseDevSlot, keepThroughPrep, branchState, catchUp, describeBranchState, devEnv, devPortOf, devSlotCheck, healthRerunsAfterDeploy, pendingChecks, probeHealth, readDevPorts, runChecks, slotKey, triedNote, unreleasedOnMain, worktreeFingerprint, writeDevPorts } from "./checks.ts";
9
9
  import { type GateCtx, markPendingAsk } from "./gates.ts";
10
- import { closeLinkedReflections } from "./reflect.ts";
10
+ import { applyReflectFindings, closeLinkedReflections } from "./reflect.ts";
11
11
  import { gatePublishes, prBodyOwed, publishRelease } from "./publish.ts";
12
12
 
13
13
  /** The release call, asked with Verified? only for a flow approved before Approve? carried it — null when the
@@ -25,6 +25,8 @@ export async function gateVerify(o: GateCtx): Promise<RunResult> {
25
25
  // the release call is made at Approve?; a --version/--no-version on the Verified? answer changes it (or makes it, for an older flow)
26
26
  const verArg = versionArg(flagValue(o.rest, "version"), flag("no-version"));
27
27
  if ("error" in verArg) return { text: `verify gate FAILED:\n- ${verArg.error}`, isError: true };
28
+ const foldErr = foldCallError(state!, verArg.choice);
29
+ if (foldErr) return { text: `verify gate FAILED:\n- ${foldErr}`, isError: true };
28
30
  // the operator reviews the tree that ships: catch up with the default branch before anything runs
29
31
  const caught = state!.stage === "implement" ? await catchUp(root, state!, cfg, flag("confirmed")) : { note: "" };
30
32
  if ("text" in caught) return caught;
@@ -226,6 +228,8 @@ export async function gateRelease(o: GateCtx): Promise<RunResult> {
226
228
  // call before the tag, a resumed publish included
227
229
  const relArg = versionArg(flagValue(o.rest, "version"), flag("no-version"));
228
230
  if ("error" in relArg) return { text: `release gate FAILED:\n- ${relArg.error}`, isError: true };
231
+ const foldErr = foldCallError(state!, relArg.choice);
232
+ if (foldErr) return { text: `release gate FAILED:\n- ${foldErr}`, isError: true };
229
233
  if (state!.stage === "release" && state!.approvals["pre-release"]) {
230
234
  if (state!.approvals.release) return { text: `release already recorded.\n${AGENT_MARK}next: ${nextHint(state!, cfg)}` };
231
235
  let callNote = "";
@@ -370,22 +374,17 @@ export async function gateRelease(o: GateCtx): Promise<RunResult> {
370
374
  // truly behind, not merely different: a session whose loaded build is NEWER than the checkout's manifest
371
375
  // has every proof the checkout would run, and asking about it would be noise.
372
376
  const stale = !!behind && !!selfBuild.version && cmpVersions(behind, selfBuild.version) < 0;
373
- let staleAsk = "";
374
377
  let staleNote = "";
375
378
  if (stale) {
376
379
  const clPath = path.join(selfBuild.dir, "CHANGELOG.md");
377
380
  const missing = existsSync(clPath) && selfBuild.version ? changelogVersionsBetween(readFileSync(clPath, "utf8"), behind, selfBuild.version) : [];
378
- staleAsk =
379
- ` This session runs dev-flow ${behind}, ${selfBuild.label} ships ${selfBuild.version ?? "?"} — gate proofs shipped between the two will NOT run. ` +
380
- (missing.length
381
- ? `Shipped since ${behind}: ${missing.slice(0, 8).join(", ")}${missing.length > 8 ? ` …(${missing.length} total)` : ""} — see ${clPath}. `
382
- : `What shipped between them is not readable from the checkout's CHANGELOG.md — read it before deciding. `) +
383
- `Update (/reload, then re-run flow release on the current build) or proceed with the old release?`;
384
- staleNote = `released under dev-flow ${behind} (${selfBuild.label} ${selfBuild.version ?? "?"}) — the operator was asked update-or-proceed and chose to proceed; proofs newer than ${behind} did not run`;
381
+ // advisory, never a question: the operator chose the build when they loaded the session, and /reload is theirs
382
+ staleNote = `released under dev-flow ${behind} (${selfBuild.label} ships ${selfBuild.version ?? "?"}) — proofs newer than ${behind} did not run${missing.length ? ` (shipped since: ${missing.slice(0, 8).join(", ")}${missing.length > 8 ? ` …(${missing.length} total)` : ""})` : ""}; /reload picks up the newer build for the next flow`;
385
383
  }
386
384
  // #162: Verified? was answered over one tree; commits after it ship under that word unless someone says
387
385
  // so. A warning, never a refusal — doc-only moves after verify are normal; the operator decides.
388
386
  let postVerify = "";
387
+ let quietAfterVerify = "";
389
388
  let unverifiedChange = false;
390
389
  if (state!.verifiedHead) {
391
390
  // gh#180: upstream work merged in after the verdict was approved on its own branch — only the branch's
@@ -406,7 +405,10 @@ export async function gateRelease(o: GateCtx): Promise<RunResult> {
406
405
  const prepSet = prepFiles(cfg);
407
406
  const isPrep = (c: { files: string[] }) => (!!cfg.versioning.file && c.files.includes(cfg.versioning.file)) || (c.files.length > 0 && c.files.every((f) => prepSet.has(f)));
408
407
  const prep = commits.filter(isPrep);
409
- const changed = commits.filter((c) => !isPrep(c));
408
+ // docs and tests ship no behaviour the operator's look could have caught: they ride under the verdict, named
409
+ const quiet = commits.filter((c) => !isPrep(c) && c.files.length > 0 && c.files.every(nonBehaviourPath));
410
+ const changed = commits.filter((c) => !isPrep(c) && !quiet.includes(c));
411
+ if (quiet.length) quietAfterVerify = `${quiet.length} docs/test-only commit(s) after Verified? (${quiet.map((c) => c.line.split(" ")[0]).join(", ")}) ride under it`;
410
412
  // changed code shipping under an earlier word is friction the closing reflection should look at
411
413
  unverifiedChange = changed.length > 0;
412
414
  if (changed.length)
@@ -426,9 +428,7 @@ export async function gateRelease(o: GateCtx): Promise<RunResult> {
426
428
  ? "the playbook sets yolo = until-release: a yolo given earlier never answers Release? — ask it"
427
429
  : postVerify
428
430
  ? "a yolo given earlier does not cover commits that landed after Verified? — ask Release? with them named"
429
- : stale
430
- ? "a yolo given earlier does not choose to release under an older dev-flow build — ask Release? with the update-or-proceed question"
431
- : "";
431
+ : "";
432
432
  // gh#206: a yolo held back only by the playbook's until-release knob carries nothing new for the operator
433
433
  // to weigh — it just means "Release? is asked like on any flow". Their chat answer (a plain --confirmed)
434
434
  // stands on the first call, as it does on a flow without yolo; asking first made them repeat a word already
@@ -440,8 +440,8 @@ export async function gateRelease(o: GateCtx): Promise<RunResult> {
440
440
  // this session after that point lets the flag stand, and only a true replay is asked first.
441
441
  const vm = state!.verifiedAtMessage;
442
442
  const spokeSinceVerify = !!vm && vm.key === sess.key && typeof sess.operatorMessages === "number" && sess.operatorMessages > vm.users;
443
- const untilReleaseOnly = cfg.release.yolo === "until-release" && !postVerify && !stale;
444
- const mustAskFirst = (!!holdWhy && !(untilReleaseOnly && (!flag("yolo") || spokeSinceVerify))) || stale;
443
+ const untilReleaseOnly = cfg.release.yolo === "until-release" && !postVerify;
444
+ const mustAskFirst = !!holdWhy && !(untilReleaseOnly && (!flag("yolo") || spokeSinceVerify));
445
445
  const confirmed = flag("confirmed") && !(mustAskFirst && !ui.hasUI && state!.pendingAsk !== "Release?");
446
446
  const yoloHeld = confirmed ? "" : holdWhy;
447
447
  // gh#198: release.ask = on-change — Release? answers itself when it would only re-confirm Verified?: the call
@@ -457,23 +457,19 @@ export async function gateRelease(o: GateCtx): Promise<RunResult> {
457
457
  ? `the release call changes (${state!.versionChoice ?? "none"} → ${relArg.choice}) — changing it is the operator's word`
458
458
  : postVerify
459
459
  ? "commits beyond release prep landed after Verified?"
460
- : stale
461
- ? "the session build is behind the checkout"
462
- : cfg.release.yolo === "until-release"
463
- ? "the playbook sets yolo = until-release"
464
- : choice === "next" && newest && manifestVer && majorBump(newest, manifestVer)
460
+ : choice === "next" && newest && manifestVer && majorBump(newest, manifestVer)
465
461
  ? `${newest} → ${manifestVer} is a major bump — the playbook's versioned call does not choose that`
466
462
  : "";
467
463
  const auto = onChange && !askWhy;
468
- let audit = confirmed ? " (confirmed by operator instruction)" : auto ? ` (auto-answered: release.ask = on-change — ${describeVersionChoice(choice ?? "next", state!.versionFrom)} is the call on record, and only release prep landed since Verified?)` : state!.yolo ? " (yolo: pre-confirmed)" : "";
464
+ let audit = confirmed ? " (confirmed by operator instruction)" : auto ? ` (auto-answered: release.ask = on-change — ${describeVersionChoice(choice ?? "next", state!.versionFrom)} is the call on record, and only release prep${quietAfterVerify ? ", docs or tests" : ""} landed since Verified?)` : state!.yolo ? " (yolo: pre-confirmed)" : "";
469
465
  const askPending = !auto && !confirmed && (!state!.yolo || !!yoloHeld);
470
466
  if (askPending) {
471
467
  markPendingAsk(root, state!, "Release?");
472
468
  if (!ui.hasUI) {
473
469
  const callAsk = cfg.versioning.file && !choice ? " — also ask the release call: a patch, minor or major release, or merge unreleased (no bump, no tag)?" : "";
474
- return { text: needsOperator(`ready to publish${yoloHeld ? ` (${yoloHeld})` : ""}${askWhy ? ` (asked: ${askWhy})` : ""}${stale ? ` — also: ${staleAsk}` : ""}${postVerify ? ` — ${postVerify}` : ""}${callAsk}`, "Release?", `re-run with --confirmed once the operator answered 'Release?' in chat${stale ? " (and the stale-build question)" : ""}${callAsk ? " (add --version=patch|minor|major or --no-version for their release call)" : ""}`), isError: true };
470
+ return { text: needsOperator(`ready to publish${yoloHeld ? ` (${yoloHeld})` : ""}${askWhy ? ` (asked: ${askWhy})` : ""}${postVerify ? ` — ${postVerify}` : ""}${callAsk}`, "Release?", `re-run with --confirmed once the operator answered 'Release?' in chat${callAsk ? " (add --version=patch|minor|major or --no-version for their release call)" : ""}`), isError: true };
475
471
  }
476
- const ok = await ui.confirm("Enter release", `Release ${state!.slug}${manifestVer ? ` v${manifestVer}` : ""}${noVersion ? " (unversioned — merge + changelog entry only: no bump, no tag for this flow)" : ""}? Publishing starts: PR, merge${noVersion ? "" : ", tag"} — release-done afterwards needs no further answer.${staleAsk ? `\n\n${staleAsk}` : ""}${postVerify ? `\n\n${postVerify}` : ""}${yoloHeld ? `\n\n(${yoloHeld})` : ""}`);
472
+ const ok = await ui.confirm("Enter release", `Release ${state!.slug}${manifestVer ? ` v${manifestVer}` : ""}${noVersion ? " (unversioned — merge + changelog entry only: no bump, no tag for this flow)" : ""}? Publishing starts: PR, merge${noVersion ? "" : ", tag"} — release-done afterwards needs no further answer.${staleNote ? `\n\n${staleNote}` : ""}${postVerify ? `\n\n${postVerify}` : ""}${yoloHeld ? `\n\n(${yoloHeld})` : ""}`);
477
473
  if (!ok) {
478
474
  delete state!.pendingAsk;
479
475
  writeState(root, state!);
@@ -507,7 +503,7 @@ export async function gateRelease(o: GateCtx): Promise<RunResult> {
507
503
  if (selfPublish) state!.publish = {};
508
504
  else delete state!.publish;
509
505
  writeState(root, state!);
510
- const approved = `release approved${audit}${state!.noVersion ? " — unversioned: no bump or tag; your changelog entry rides under Unreleased until the next versioned release folds it" : ""} — entering release stage.${manifestVer ? ` Version ${manifestVer}.` : ""}${checksNote}${foldNote}${staleNote ? ` ${staleNote}.` : ""}${postVerify ? ` Warning: ${postVerify}.` : ""}\n${describeBranchState(branchProof, cfg.defaultBranch)}`;
506
+ const approved = `release approved${audit}${state!.noVersion ? " — unversioned: no bump or tag; your changelog entry rides under Unreleased until the next versioned release folds it" : ""} — entering release stage.${manifestVer ? ` Version ${manifestVer}.` : ""}${checksNote}${foldNote}${staleNote ? ` ${staleNote}.` : ""}${postVerify ? ` Warning: ${postVerify}.` : ""}${quietAfterVerify ? ` ${quietAfterVerify}.` : ""}\n${describeBranchState(branchProof, cfg.defaultBranch)}`;
511
507
  if (selfPublish) return publishAndRecord(o, state!, approved);
512
508
  return { text: `${approved}\n${AGENT_MARK}next: ${nextHint(state!, cfg)}` };
513
509
  }
@@ -713,7 +709,7 @@ export async function gateReleaseDone(o: GateCtx): Promise<RunResult> {
713
709
  const tailNote = [
714
710
  // a session that shipped from behind: the code it runs is not the code the checkout just released
715
711
  state!.staleBuild
716
- ? `stale build acknowledged at release gate: this session ran dev-flow ${state!.staleBuild} — proofs newer than it did not run.`
712
+ ? `stale build noted at the release gate: this session ran dev-flow ${state!.staleBuild} — proofs newer than it did not run.`
717
713
  : skew.behind
718
714
  // #117: the pair (session vs what the disk ships) makes the warning actionable where it prints;
719
715
  // a second registered copy is what made the skew confusing on the report — name it too
@@ -741,15 +737,6 @@ export async function gateFinish(o: GateCtx): Promise<RunResult> {
741
737
  // gh#205: release-stage items (a post-merge build, a deploy check from the default branch) are work done after
742
738
  // the merge. A separate release-done names them while the worktree still stands; folded into finish, one
743
739
  // call recorded the release and removed everything, so an unversioned flow never saw them. Stop once here.
744
- const cur = readState(o.root, state.slug) ?? state;
745
- if (checklistPending(o.cfg, cur, "release")) {
746
- markPendingAsk(o.root, cur, "Finish?");
747
- const items = applicableItems(o.cfg, cur, "release").map((i) => `"${i.text}"`).join(" | ");
748
- return {
749
- text: `${recorded}\n\n${needsOperator(`release recorded — nothing was removed yet: the release-stage checklist (## release in .dev-flow/project.md) is still open: ${items}`, "Finish?", `do each release-stage item now (they run after the merge, from ${o.cfg.defaultBranch} — not the worktree), tell the operator what each showed, then ask Finish? and run flow finish --confirmed when they answer`)}`,
750
- isError: true,
751
- };
752
- }
753
740
  const fin = await gateFinishCore(o);
754
741
  return { ...fin, text: `${recorded}\n\n${fin.text}` };
755
742
  }
@@ -849,23 +836,37 @@ export async function gateFinishCore(o: GateCtx): Promise<RunResult> {
849
836
  // yolo works uniformly at every gate: at Finish? nothing later remains to pre-confirm, the flag just answers this one
850
837
  const yoloWord = takeYoloWord(state!);
851
838
  if (yoloWord) return { text: yoloWord, isError: true };
839
+ // gh#205: release-stage items are work done after the merge, from the main checkout — stop once so it is done
840
+ // while the worktree still stands. It is work, not a question: the next finish goes on (finish = always asks).
841
+ const relItems = applicableItems(cfg, state!, "release");
842
+ if (checklistPending(cfg, state!, "release") && cfg.release.finish !== "always") {
843
+ state!.confirmations = { ...state!.confirmations, release: { hash: checklistHash(relItems), at: now() } };
844
+ writeState(root, state!);
845
+ return {
846
+ text: `release-stage work — the release is recorded and nothing was removed yet: the release-stage checklist (## release in .dev-flow/project.md) is work to do now, from ${cfg.defaultBranch} (the main checkout, not the worktree): ${relItems.map((i) => `"${i.text}"`).join(" | ")}\n${AGENT_MARK}next: do each item, then run flow finish again — no question to ask; say in your report what each showed`,
847
+ isError: true,
848
+ };
849
+ }
852
850
  // The closing reflection runs here, before anything is removed: the worker reads this session's
853
851
  // transcripts and .dev-flow/<slug>/tmp, and finish is about to drop that folder and the binding — a
854
852
  // reflection asked for after finish has nothing bound to run against. Only the operator's explicit
855
853
  // --no-reflect skips it; yolo never does (it answers checkpoints, it does not waive the review).
856
- const skipReflect = flag("no-reflect");
854
+ // a fold flow fixes reflections; it does not review for new ones — it never runs the closing reflection
855
+ const fold = !!state!.reflections?.length;
856
+ const skipReflect = flag("no-reflect") && !fold;
857
857
  if (skipReflect && !flag("confirmed")) return { text: "--no-reflect is the operator's word — ask them whether to skip the closing reflection, then re-run with --no-reflect --confirmed", isError: true };
858
858
  // a flow that never hit a refusal, a guard block or a change shipped after Verified?, with no friction note
859
859
  // from the operator, has nothing
860
860
  // for the reflection worker to find — skip the worker run unless the playbook says reflect = always
861
861
  const note = flagValue(o.rest, "note") ?? "";
862
- const quiet = !state!.reflectedAt && !skipReflect && cfg.release.reflect !== "always" && !(state!.friction ?? 0) && !note.trim();
862
+ const quiet = !state!.reflectedAt && !skipReflect && (fold || (cfg.release.reflect !== "always" && !(state!.friction ?? 0) && !note.trim()));
863
863
  if (quiet) {
864
864
  state!.reflectedAt = now();
865
865
  state!.reflectQuiet = true;
866
866
  writeState(root, state!);
867
867
  }
868
- const quietNote = quiet ? " closing reflection skipped: no refusals, guard blocks or unverified changes this flow (playbook reflect = always runs it anyway)." : "";
868
+ const quietNote = quiet && fold ? " closing reflection skipped: a fold flow (it fixes reflections, it does not review for new ones)." : quiet ? " closing reflection skipped: no refusals, guard blocks or unverified changes this flow (playbook reflect = always runs it anyway)." : "";
869
+ let appliedLines: string[] = [];
869
870
  if (!state!.reflectedAt && !skipReflect) {
870
871
  const skipHint = "or — only on the operator's explicit word — flow finish --no-reflect --confirmed";
871
872
  if (!o.hooks.reflect) return { text: `finish: no reflection recorded for ${state!.slug} and no reflect worker available here — run flow_stage(op: "reflect") first, ${skipHint}`, isError: true };
@@ -881,12 +882,20 @@ export async function gateFinishCore(o: GateCtx): Promise<RunResult> {
881
882
  const cur = readState(root, state!.slug) ?? state!; // the worker stamped reflectedAt on disk
882
883
  if (!r.recorded)
883
884
  return { text: `finish: the closing reflection did not report — nothing was removed.\n\n${r.text}\n\nNext: re-run flow finish to retry, or review inline (bare flow reflect prints the protocol) and then flow_stage(op: "reflect"), ${skipHint}.`, isError: true };
884
- if (!r.findings) {
885
+ // the reviewer's own fold/drop recommendation is applied, and reported with how to undo it: the operator
886
+ // answered "fold as suggested" to nearly every list. finish = always, or rows that did not parse, still ask.
887
+ if (r.report && cfg.release.finish !== "always") {
888
+ appliedLines = await applyReflectFindings(root, sess, r.report);
889
+ Object.assign(state!, readState(root, state!.slug) ?? cur);
890
+ state!.reflectApplied = true;
891
+ writeState(root, state!);
892
+ } else if (!r.findings) {
885
893
  markPendingAsk(root, cur, "Finish?");
886
894
  return { text: needsOperator(`the closing reflection found nothing new to fold — nothing was removed yet; on your word the worktree, branch and .dev-flow/${state!.slug}/ go.\n\n${r.text}`, "Finish?", "ask the operator Finish? and run flow finish --confirmed when they answer"), isError: true };
895
+ } else {
896
+ markPendingAsk(root, cur, "Fold or drop?");
897
+ return { text: needsOperator(`the closing reflection has findings — nothing was removed yet; your fold/drop answer also finishes the feature.\n\n${r.text}`, "Fold or drop?", `the fold/drop answer is the Finish? answer: apply it, then run flow finish --confirmed without asking again — the worktree, branch and .dev-flow/${state!.slug}/ go on that run`), isError: true };
887
898
  }
888
- markPendingAsk(root, cur, "Fold or drop?");
889
- return { text: needsOperator(`the closing reflection has findings — nothing was removed yet; your fold/drop answer also finishes the feature.\n\n${r.text}`, "Fold or drop?", `the fold/drop answer is the Finish? answer: apply it, then run flow finish --confirmed without asking again — the worktree, branch and .dev-flow/${state!.slug}/ go on that run`), isError: true };
890
899
  }
891
900
  const reflectSkipNote = skipReflect && !state!.reflectedAt ? ` Reflection skipped on the operator's word — nothing re-checked this session or the open reflections.` : "";
892
901
  // Finish? answers itself on a clean flow (release.finish = on-change, the default): the release is recorded,
@@ -894,7 +903,7 @@ export async function gateFinishCore(o: GateCtx): Promise<RunResult> {
894
903
  // the question had no decision left in it. Anything open (a reflection that ran, release-stage items, a
895
904
  // forge release that failed, a skipped reflection) still asks.
896
905
  const openReleaseItems = checklistPending(cfg, state!, "release");
897
- const autoFinish = cfg.release.finish !== "always" && !flag("confirmed") && !state!.yolo && !!state!.reflectQuiet && !openReleaseItems && !forgeSkipNote && !skipReflect;
906
+ const autoFinish = cfg.release.finish !== "always" && !flag("confirmed") && !state!.yolo && (!!state!.reflectQuiet || !!state!.reflectApplied) && !openReleaseItems && !forgeSkipNote && !skipReflect;
898
907
  const autoNote = autoFinish ? " Finish? answered itself (finish = on-change): the release is recorded, nothing was skipped and nothing is open." : "";
899
908
  const askPending = !flag("confirmed") && !state!.yolo && !autoFinish;
900
909
  if (askPending) {
@@ -959,5 +968,5 @@ export async function gateFinishCore(o: GateCtx): Promise<RunResult> {
959
968
  // finish is the moment between flows: name the fix / tidy suggestion when a rule fires, nothing otherwise
960
969
  const nudge = reflectionNudges(readReflectionsText(root), now().slice(0, 10), { between: true });
961
970
  const nudgeNote = [nudge.fix, nudge.tidy].filter(Boolean).map((n) => ` ${n} — offer it to the operator.`).join("");
962
- return { text: `feature ${state!.slug} done — ${closeNote}${remoteNote}; .dev-flow/${state!.slug}/ removed.${devDownNote}${roadmapNote}${reflNote}${forgeSkipNote}${reflectSkipNote}${quietNote}${releaseChecksNote}${autoNote}${syncNote}${nudgeNote} Re-read flow status before reporting open flows — a sibling feature may have finished while this session ran.` };
971
+ return { text: `feature ${state!.slug} done — ${closeNote}${remoteNote}; .dev-flow/${state!.slug}/ removed.${devDownNote}${roadmapNote}${reflNote}${forgeSkipNote}${reflectSkipNote}${quietNote}${releaseChecksNote}${autoNote}${syncNote}${nudgeNote}${appliedLines.length ? `\n${appliedLines.join("\n")}\n` : ""} Re-read flow status before reporting open flows — a sibling feature may have finished while this session ran.` };
963
972
  }