pi-dev-flow 0.94.3 → 0.95.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,32 @@ Format: newest first. `Unreleased` collects what's merged but not yet tagged.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.95.0] - 2026-11-20
8
+
9
+ **Reflections are tied to the flow that fixes them: `flow start --reflections` links rows and `finish` closes them, rows have ids that never change, `tidy` archives and `reopen` undoes, repeats count on their row, evidence is kept, and `flow reflect plan` groups the open rows into flows. Also: a long reflection keeps what it found when it runs out of time, `flow release` checks for merge conflicts before waiting on CI, a fresh clone no longer blocks `finish`, and a docs flow that edits code runs the checks.**
10
+
11
+ ### Changed
12
+ - **A flow states which reflections it fixes, and `finish` closes them.** `flow start <slug> --reflections=r3,r7` links rows to the flow, and its hints carry them until finish. `finish` then closes each one as fixed by the flow, noting the PR. A row the flow won't fix is `flow reflect defer <id> "<why>"`: it stays open with the reason on it. Before this, a flow that fixed 30 code reflections shipped with all 30 still open. Closing them by hand afterwards hit the wrong rows, and the agent misreported its progress twice.
13
+ - **Reflections have stable ids.** Every row gets an id, `[r42]`, the first time the ledger is read. Ids are never reused, and `list`, `done`, `move`, the reflect worker's brief and doctor all use them. A tidy or move in any session can no longer shift the row a number points to (gh#263, where a batch `done` closed seven wrong rows).
14
+ - **`tidy` archives instead of deleting, and `flow reflect reopen <id>` undoes a mistaken close.** Closed rows move to `.dev-flow/reflections-archive.md` with their `— fixed:` note. `reopen` brings a row back from the ledger or the archive, and keeps its history on the row.
15
+ - **A recurrence counts on its row.** `flow reflect --same <id> "<evidence>"` adds `· seen again <date> <slug>: <evidence>` to the row. `list` and `plan` show the hit count. Finish's fold/drop instructions now use `--same` for a finding the worker marked as a duplicate, instead of filing a fourth copy of the same defect.
16
+ - **Reflections keep their evidence.** `flow reflect … --evidence="<file:line>"` stores the transcript line the reflect worker cited. A fold flow can re-check a claim before turning it into a rule; one fold's review failed on rules written from paraphrases.
17
+ - **`flow reflect plan` groups the open rows into flows.** Code rows that share a file or code name form a group, and the playbook rows form one docs flow. Groups are ranked by hit count, and each comes with the `flow start … --reflections=` command that links its rows. The "fix the open reflections now?" nudge points at it.
18
+
19
+ ### Fixed
20
+ - **A docs flow whose diff reaches code runs the checks.** `--docs` skipped every check whatever the branch changed, and a playbook fold that also edited `scripts/harness.ts` and `scripts/verify.ts` shipped with no checks. The gates now read the branch's changed paths. Anything that isn't documentation (markdown, plain text, license files or images) puts the checks back for that flow: `flow check` runs them and names the paths, and `verify` and `release` require them green. A docs-only diff keeps the docs contract.
21
+ - **The release gate names the version as written.** The fold-the-Unreleased refusal printed `vv0.46.2-…`. Its two version refusals now also give the unversioned way out (`flow release --no-version`, on the operator's word) when no release call is recorded or the flow is a docs flow. Before, they only offered the versioned repair.
22
+ - **A gate no longer says "nothing bound" while the context shows the binding.** The per-turn context and the guards fall back to the session's claim when the in-memory binding is gone; the gates did not. Gates now resolve the bound flow the same way, and the binding is restored.
23
+ - **A fresh clone no longer makes `flow finish` refuse on other flows' state.** `.dev-flow/.gitignore` was never tracked, because it ignores itself. A re-clone brought `project.md` back without it, so every feature folder under `.dev-flow/` showed up as untracked. In ollamaMQ, two flows' `finish` each refused on "uncommitted changes" that were the two flows' own folders. Four changes:
24
+ - Any gate now recreates the file if it's missing, and says so.
25
+ - `flow init --track` commits the file together with the playbook.
26
+ - `flow doctor` reports the file when it isn't tracked.
27
+ - `finish`'s clean-checkout check ignores dev-flow's own folder, except the playbook.
28
+
29
+ The bash guard's playbook-chore exception now also covers committing the ignore file. Because the file ignores itself, it has to be added with `git add -f` in one call and committed in the next.
30
+ - **`flow release` finds a merge conflict before the push and the CI wait (gh#259).** The gate pushed the branch, opened the PR and waited for CI to go green, and only then did `gh pr merge` report the conflict, which was there from the start. Parallel flows collide on the changelog and version file all the time. The gate now fetches the default branch and runs `git merge-tree` before pushing. On a conflict it names the files, pushes nothing, and says how to resolve. Once the PR is open, GitHub's own `mergeable` check runs before the wait, because the default branch can move after the local check. A re-run picks up from where it stopped.
31
+ - **A long flow's reflection is no longer cut off with nothing to show (gh#252).** Every reflection got 20 minutes and every review 30, whatever the size. Three closing reflections ran out of time in one day, the salvage step returned nothing, and `flow finish` removed nothing. The default limit now grows with the work. A reflection gets 5 more minutes for every 250 KB of transcript past the first 250 KB, up to 60. A review gets 10 more minutes for every 500 changed lines past the first 500, up to 90. An explicit `budgetMin` still wins. Review and reflect workers now get the wrap-up warning at 60% instead of 75%: the warning only arrives between turns, and a worker spends minutes on one long thinking turn. Before the salvage request, the queued warning is now cleared and the worker's thinking level is lowered, so the 3 minutes go to writing the report. If the salvage still returns nothing, the finding rows the reflection already wrote are shown as a partial report.
32
+
7
33
  ## [0.94.3] - 2026-11-19
8
34
 
9
35
  **Fold or drop? shows the findings you're answering about: a short list, folds grouped by plugin, playbook and code, then the drops.**
@@ -24,10 +24,15 @@ dev-flow repo, filed only when you say so.
24
24
  | `flow reflect --code "<note>"` | adds a code note |
25
25
  | `flow reflect --plugin "<note>"` | prints how to file a dev-flow issue (search first, then `gh issue create`); writes nothing |
26
26
  | `flow reflect "<note>"` | guesses the section from the wording and says why |
27
- | `flow reflect list` | numbers the open notes |
28
- | `flow reflect move <n> --code` | moves a note to the other section |
29
- | `flow reflect done <n> "<what>"` | checks a note off as fixed. `done 3,4,7 "<what>"` closes several at once; one bad number closes none. |
30
- | `flow reflect tidy` | removes the checked-off notes |
27
+ | `flow reflect --code "<note>" --evidence="<file:line>"` | adds a note with the transcript line that shows it |
28
+ | `flow reflect list` | lists the open notes by id (`r<n>`). An id never changes and is never reused. |
29
+ | `flow reflect plan` | groups the open notes into flows, most-hit first, each with its start command |
30
+ | `flow reflect --same <id> "<evidence>"` | counts a recurrence on an existing note instead of adding a copy |
31
+ | `flow reflect move <id> --code` | moves a note to the other section |
32
+ | `flow reflect done <id> "<what>"` | checks a note off as fixed. `done r3,r4,r7 "<what>"` closes several at once; one bad id closes none. |
33
+ | `flow reflect reopen <id> "<why>"` | reopens a note closed by mistake, from the archive too |
34
+ | `flow reflect tidy` | moves the checked-off notes to `reflections-archive.md` |
35
+ | `flow start <slug> --reflections=r3,r7` | links notes to the flow that fixes them. `finish` closes them, except any the flow left open with `flow reflect defer <id> "<why>"`. |
31
36
 
32
37
  `flow status` and `flow doctor` show how many notes are open.
33
38
 
@@ -19,12 +19,12 @@
19
19
  * The stage logic lives in src/core.ts (unit-tested), the runtime in src/runtime/; this file is pi wiring.
20
20
  * Inactive (fully pass-through) in repos without a .dev-flow/ directory.
21
21
  */
22
- import { existsSync, mkdirSync, rmSync } from "node:fs";
22
+ import { existsSync, mkdirSync, rmSync, statSync } from "node:fs";
23
23
  import path from "node:path";
24
24
  import { Type } from "typebox";
25
25
  import { compact, defineTool, isToolCallEventType, type AgentSession, type ExtensionContext } from "@earendil-works/pi-coding-agent";
26
26
  import { type ExtensionAPI, type ToolCallEvent, type ToolCallEventResult, type TurnEndEvent, type TurnEndEventResult } from "@earendil-works/pi-coding-agent";
27
- import { ALLOW_REWRITE, applicableItems, openItemsNote, bashFlowGuard, checklistPending, checkoutInvocation, claimBlocks, featureBranchPrefix, FLOW_SHELL_HINT, flowShellInvocation, forcePushInvocation, freshenChecks, gitInvocation, guardBash, guardPath, mergeStyleInvocation, parsePushRefs, playbookTamper, playbookOnlyChange, pluginVersion, reflectionNudges, buildReflectBrief, parseReflectReport, renderReflectFindings, childSessionFiles, workerSteer, WORKER_STEER_AT, WORKER_SALVAGE, WORKER_SALVAGE_MS, WORKER_NUDGE_READONLY, stageReference, needsOperator, NEEDS_OPERATOR, nextHint, roadmapOpenCount, shouldTakeOverCompaction, stageGuidance, stateTamper, statusFor, sq, featureTmpDir, compactionStateBlock, withTmpDir, widgetLines, chipLabel, writeGuard, buildWorkerBrief, clampBudgetMin, parseWorkerReport, workerTurnError, hollowStop, hollowStopNote, workerOpError, WORKER_NUDGE, WORKER_NUDGES, releaseOrderInvocation, worktreeWorkGuard, flowArgsShapeError, type WorkerOp, type FlowState, type PushRef } from "../src/core.ts";
27
+ import { ALLOW_REWRITE, applicableItems, openItemsNote, bashFlowGuard, checklistPending, checkoutInvocation, claimBlocks, featureBranchPrefix, FLOW_SHELL_HINT, flowShellInvocation, forcePushInvocation, freshenChecks, gitInvocation, guardBash, guardPath, mergeStyleInvocation, parsePushRefs, playbookTamper, playbookOnlyChange, pluginVersion, reflectionNudges, buildReflectBrief, parseReflectReport, renderReflectFindings, childSessionFiles, workerSteer, workerSteerAt, recoverReflectRows, assistantTexts, WORKER_SALVAGE, WORKER_SALVAGE_MS, WORKER_NUDGE_READONLY, stageReference, needsOperator, NEEDS_OPERATOR, nextHint, roadmapOpenCount, shouldTakeOverCompaction, stageGuidance, stateTamper, statusFor, sq, featureTmpDir, compactionStateBlock, withTmpDir, widgetLines, chipLabel, writeGuard, buildWorkerBrief, clampBudgetMin, parseWorkerReport, workerTurnError, hollowStop, hollowStopNote, workerOpError, WORKER_NUDGE, WORKER_NUDGES, releaseOrderInvocation, worktreeWorkGuard, flowArgsShapeError, type WorkerOp, type FlowState, type PushRef } from "../src/core.ts";
28
28
  import { loadProject } from "../src/projectmd.ts";
29
29
  import { bashTimeout, requireTimeout, timeoutClass } from "../src/timeouts.ts";
30
30
  import { AGENT_MARK, operatorCommandAsks, operatorCommandCorrection, viewHeader, askLine, type GateView } from "../src/present.ts";
@@ -117,6 +117,11 @@ export default function devFlow(pi: ExtensionAPI) {
117
117
 
118
118
  const sessFor = (ctx: ExtensionContext, root: string): Session => {
119
119
  const key = sessionKey(ctx);
120
+ // the same resolution the per-turn context and the guards use (the binding, else this session's claim): a
121
+ // binding lost from memory while the claim still names this session made the context say "bound to X"
122
+ // and the next gate say "nothing bound" — one round trip spent inside Release?
123
+ const claimed = bindings.get(key) ? null : boundFeature(root, key)?.slug ?? null;
124
+ if (claimed) bindings.set(key, claimed);
120
125
  return {
121
126
  key,
122
127
  slug: bindings.get(key) ?? null,
@@ -304,7 +309,20 @@ export default function devFlow(pi: ExtensionAPI) {
304
309
  if (runningWorkers.has(key)) return err("a worker is already running for this session — wait for it to return");
305
310
  runningWorkers.add(key);
306
311
  const cfg = loadProject(dfDir(root)).cfg;
307
- const budgetMin = clampBudgetMin(params.budgetMin, wop);
312
+ let lineage: { id?: string; file?: string; dir?: string } = {};
313
+ try { lineage = { id: ctx.sessionManager.getSessionId(), file: ctx.sessionManager.getSessionFile() ?? undefined, dir: ctx.sessionManager.getSessionDir() ?? undefined }; } catch { /* unbacked driver: the worker is unlinked */ }
314
+ const children = wop === "reflect" && lineage.file ? childSessionFiles(lineage.file, sessionHeaders(lineage.dir)) : [];
315
+ // gh#252: the default budget grows with what the worker has to read — never a measurement failure
316
+ const sizeOf = (f: string) => { try { return statSync(f).size; } catch { return 0; } };
317
+ const diffLines = async () => {
318
+ if (wop !== "review") return undefined;
319
+ const r = await sh(`git diff --shortstat ${sq(cfg.defaultBranch)}...HEAD`, work);
320
+ return r.ok ? [...r.out.matchAll(/(\d+) (?:insertion|deletion)/g)].reduce((n, m) => n + Number(m[1]), 0) : undefined;
321
+ };
322
+ const budgetMin = clampBudgetMin(params.budgetMin, wop, {
323
+ transcriptBytes: wop === "reflect" ? [lineage.file, ...children.map((c) => c.file)].reduce((n, f) => n + (f ? sizeOf(f) : 0), 0) : undefined,
324
+ diffLines: await diffLines(),
325
+ });
308
326
  const glyph = wop === "implement" ? "🔨" : wop === "review" ? "🔍" : "🪞";
309
327
  const name = workerName(glyph, st.slug, wop, params.label);
310
328
  const started = Date.now();
@@ -312,8 +330,6 @@ export default function devFlow(pi: ExtensionAPI) {
312
330
  const headBefore = (await git("git rev-parse HEAD")).trim();
313
331
  // the reflect worker runs in the main checkout, which may already carry the operator's edits
314
332
  const statusBefore = wop === "reflect" ? (await git("git status --short")).trim() : "";
315
- let lineage: { id?: string; file?: string; dir?: string } = {};
316
- try { lineage = { id: ctx.sessionManager.getSessionId(), file: ctx.sessionManager.getSessionFile() ?? undefined, dir: ctx.sessionManager.getSessionDir() ?? undefined }; } catch { /* unbacked driver: the worker is unlinked */ }
317
333
  const selfRepo = isSelfRepo(root);
318
334
  // gh#216: the brief is built before the worker's try/finally — a throw here used to leave this session
319
335
  // marked as running a worker forever and hand the caller nothing
@@ -323,7 +339,6 @@ export default function devFlow(pi: ExtensionAPI) {
323
339
  const items = readReflections(root);
324
340
  const fold = await foldView(root, items);
325
341
  const upstream = await pluginUpstream(root);
326
- const children = lineage.file ? childSessionFiles(lineage.file, sessionHeaders(lineage.dir)) : [];
327
342
  return buildReflectBrief({
328
343
  slug: st.slug, root, today: now().slice(0, 10),
329
344
  driverFile: lineage.file ?? null,
@@ -367,6 +382,7 @@ export default function devFlow(pi: ExtensionAPI) {
367
382
  let timedOut = false;
368
383
  let steered = false;
369
384
  let salvaged = false;
385
+ let recovered = false;
370
386
  let crash: string | null = null;
371
387
  let nudges = 0;
372
388
  let report = parseWorkerReport("");
@@ -379,7 +395,7 @@ export default function devFlow(pi: ExtensionAPI) {
379
395
  const softTimer = setTimeout(() => {
380
396
  steered = true;
381
397
  try { void Promise.resolve(child?.steer(workerSteer(wop, budgetMin))).catch(() => {}); } catch { /* the hard cut follows */ }
382
- }, workerTiming.softMs ?? Math.round(hardMs * WORKER_STEER_AT));
398
+ }, workerTiming.softMs ?? Math.round(hardMs * workerSteerAt(wop)));
383
399
  const timer = setTimeout(() => { timedOut = true; abortChild(); }, hardMs);
384
400
  signal?.addEventListener("abort", abortChild);
385
401
  let unsub: (() => void) | undefined;
@@ -412,6 +428,10 @@ export default function devFlow(pi: ExtensionAPI) {
412
428
  // an aborted reflection otherwise loses every finding it had already made
413
429
  if (!report.found && !modelError && timedOut && !signal?.aborted) {
414
430
  salvaged = true;
431
+ // gh#252: the steer still queued from before the cut rode into the salvage turn, and the grace went
432
+ // on thinking — drop the queue and the thinking, so the turn is spent writing the rows
433
+ try { child.clearQueue?.(); } catch { /* nothing queued */ }
434
+ try { child.setThinkingLevel?.("minimal"); } catch { /* a model without thinking levels */ }
415
435
  const grace = setTimeout(abortChild, workerTiming.graceMs ?? WORKER_SALVAGE_MS);
416
436
  try {
417
437
  await child.prompt(WORKER_SALVAGE);
@@ -421,6 +441,11 @@ export default function devFlow(pi: ExtensionAPI) {
421
441
  } finally {
422
442
  clearTimeout(grace);
423
443
  }
444
+ // the last fallback: finding rows the reflection already wrote, in any of its messages
445
+ if (!report.found && wop === "reflect") {
446
+ const rows = recoverReflectRows(assistantTexts((child as { messages?: unknown[] }).messages ?? []));
447
+ if (rows) { report = { found: true, body: rows, verdict: null }; recovered = true; }
448
+ }
424
449
  }
425
450
  } catch (e) {
426
451
  crash = e instanceof Error ? e.message : String(e);
@@ -441,7 +466,7 @@ export default function devFlow(pi: ExtensionAPI) {
441
466
  : modelError
442
467
  ? modelLine
443
468
  : timedOut
444
- ? `interrupted at the ${budgetMin}-min budget${steered ? " (steered to wrap up at " + Math.round(WORKER_STEER_AT * 100) + "%)" : ""}${report.found ? " — REPORT salvaged after the cut, treat it as partial" : salvaged ? " — the salvage prompt got no REPORT either" : ""}`
469
+ ? `interrupted at the ${budgetMin}-min budget${steered ? " (steered to wrap up at " + Math.round(workerSteerAt(wop) * 100) + "%)" : ""}${recovered ? " — the salvage prompt got no REPORT; the finding rows it had already written are shown, treat them as partial" : report.found ? " — REPORT salvaged after the cut, treat it as partial" : salvaged ? " — the salvage prompt got no REPORT either" : ""}`
445
470
  : report.found
446
471
  ? `reported${steered ? " (after the wrap-up steer)" : ""}`
447
472
  : `ended without REPORT after ${nudges} nudge(s)`;
@@ -482,7 +507,7 @@ export default function devFlow(pi: ExtensionAPI) {
482
507
  const nudges = reflectionNudges(readReflectionsText(root), now().slice(0, 10), { recurred });
483
508
  parts.push(
484
509
  "Next: show the operator the fold/drop list above as it stands — suggested folds grouped by plugin, playbook and code, then the drops, one short line each — and ask for one answer (the suggested 'fold … drop …' line is fine) — then STOP until they answer. " +
485
- `Fold docs → flow reflect --playbook "<note>"; fold code → flow reflect --code "<note>"; fold plugin → ${selfRepo ? 'flow reflect --code "<note>" (this is the dev-flow repo)' : 'flow reflect --plugin "<note>" prints the upstream recipe (dedupe search, then gh issue create — the fold answer is the confirmation; never a reflections.md row)'}; drop → record nothing. Open items re-checked as fixed → propose checking them off.`,
510
+ `Fold docs → flow reflect --playbook "<note>" --evidence="<its evidence>"; fold code → flow reflect --code "<note>" --evidence="<its evidence>"; a fold whose dup names an open row (r<id>) → flow reflect --same r<id> "<its evidence>" (a recurrence counts on that row, never a new one); fold plugin → ${selfRepo ? 'flow reflect --code "<note>" (this is the dev-flow repo)' : 'flow reflect --plugin "<note>" prints the upstream recipe (dedupe search, then gh issue create — the fold answer is the confirmation; never a reflections.md row)'}; drop → record nothing. Open items re-checked as fixed → propose checking them off (flow reflect done r<id> "<where it was fixed>"); recurred → flow reflect --same r<id> "<evidence>".`,
486
511
  );
487
512
  if (nudges.fix) parts.push(`${nudges.fix} — offer it after the fold/drop answer.`);
488
513
  if (nudges.tidy) parts.push(`${nudges.tidy} — offer it after the fold/drop answer.`);
@@ -533,7 +558,7 @@ export default function devFlow(pi: ExtensionAPI) {
533
558
  op: Type.String({ description: '"implement" (a worker edits + commits a slice), "review" (read-only reviewer, findings + verdict) or "reflect" (read-only reviewer of the session transcripts, reflection findings + fold/drop recommendations)' }),
534
559
  note: Type.String({ description: "The slice: what to do and anything from this conversation the worker must know (operator answers, decisions). Facts (plan path, commits, checks) are added for you." }),
535
560
  label: Type.Optional(Type.String({ description: "A few words naming this delegation, shown in the worker's session name." })),
536
- budgetMin: Type.Optional(Type.Number({ description: "Wall-clock budget in minutes (5-180; default 60 implement, 30 review, 20 reflect). Past it the worker is interrupted." })),
561
+ budgetMin: Type.Optional(Type.Number({ description: "Wall-clock budget in minutes (5-180). Default 60 implement; 30 review, +10 per 500 changed lines past 500 (up to 90); 20 reflect, +5 per 250 KB of transcript past 250 KB (up to 60). Past it the worker is interrupted." })),
537
562
  }),
538
563
  execute: async (id, params, signal, onUpdate, ctx) => {
539
564
  const err = (text: string) => ({ content: [{ type: "text" as const, text }], details: undefined, isError: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-dev-flow",
3
- "version": "0.94.3",
3
+ "version": "0.95.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": [
@@ -96,5 +96,7 @@ wiring before Verified?.
96
96
  - One worker at a time; read each diff before briefing the next; slice along
97
97
  plan steps. A worker that fails or stalls → take the slice inline. A
98
98
  `model failed: stopReason=error` means the provider is down, not slow.
99
- - Budget (`budgetMin`; default 60 implement, 30 review, 20 reflect): steered
100
- to wrap up at 75%, asked once for its report when cut.
99
+ - Budget (`budgetMin`; default 60 implement, 30 review, 20 reflect; review
100
+ and reflect grow with the diff and the transcripts, up to 90 and 60):
101
+ steered to wrap up at 75% (implement) or 60% (review, reflect), asked once
102
+ for its report when cut; a reflection's rows already written survive a cut.
@@ -17,12 +17,20 @@ friction only, never the same issue twice. `.dev-flow/reflections.md` holds
17
17
  re-filed. Body ends `— reflection from <slug> <date>`. In the dev-flow repo
18
18
  itself, plugin feedback is code.
19
19
  - No flag → the wording decides and the printed line says why.
20
- - `flow reflect list` numbers the queue; `flow reflect move <n>
21
- --playbook|--code` re-files; `flow reflect done <n>[,<n>…] ["<what fixed it>"]`
22
- checks one off; `flow reflect tidy` drops closed items. The numbers are
23
- row numbers: checking items off leaves the others' numbers alone, so a
24
- batch of `done` calls read off one `list` is safe; after `move` or `tidy`,
25
- list again.
20
+ - Every row has an id, `r<n>`. It never changes and is never reused, so
21
+ ids read off one `list` stay valid after any done, move or tidy, from this
22
+ session or another.
23
+ - `flow reflect list` prints the queue by id; `flow reflect move <id>
24
+ --playbook|--code` re-files; `flow reflect done <id>[,<id>…] ["<what fixed
25
+ it>"]` checks rows off; `flow reflect tidy` moves closed rows to
26
+ `reflections-archive.md`; `flow reflect reopen <id> ["<why>"]` brings back
27
+ one closed by mistake, from the archive too.
28
+ - A finding the reflect worker marks `dup: r<id>` is a recurrence:
29
+ `flow reflect --same <id> "<evidence>"` counts it on that row. Never file it
30
+ again as a new row.
31
+ - File a finding with its evidence: `flow reflect --code "<note>"
32
+ --evidence="<transcript file:line>"`. Whoever fixes it re-checks the claim
33
+ there before writing a rule from it.
26
34
  - `flow doctor "<observation>"` prints an investigation brief without queueing.
27
35
  - The end-of-session reflection runs at finish (see [finish.md](finish.md)).
28
36
 
@@ -31,10 +39,14 @@ reflections now?` (an item recurred, is ≥ 14 days old, ≥ 3 playbook items, o
31
39
  a code item between flows). It surfaces at finish, unbound, and in `flow
32
40
  doctor` — never mid-feature. One line; the operator decides.
33
41
 
34
- **Folding items in** on the operator's word: investigate, propose, confirm,
35
- open the routed flow and apply it there (`project.md` is editable only in a
36
- docs/patch worktree), then `flow reflect done <n> "<what>"` once merged (`done 3,4,7 "<what>"`
37
- closes a batch) — never by editing `reflections.md`.
42
+ **Folding items in** on the operator's word: `flow reflect plan` groups the
43
+ open rows into flows (shared files make a group; playbook rows are one docs
44
+ flow), most-hit first, each with its start command. Start the flow with the
45
+ rows it fixes: `flow start fix-<topic> --patch --reflections=r3,r7`. Fix them
46
+ on the branch, and run `flow reflect defer <id> "<why>"` for any linked row
47
+ the flow won't fix. `finish` closes the others as fixed by the flow, so never
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`.
38
50
 
39
51
  **GitHub issues** fold into `flow doctor` / `reflect list` when the repo has a
40
52
  GitHub remote: a local row an open issue covers shows `⟷ gh#NNN` (check it off