flow-workflows 0.101.0 → 0.102.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/adapters/codex/CORE.md +13 -1
  2. package/adapters/codex/skills/flow-bug-review/SKILL.md +1 -0
  3. package/adapters/codex/skills/flow-bug-ship/SKILL.md +3 -3
  4. package/adapters/codex/skills/flow-bug-start/SKILL.md +2 -2
  5. package/adapters/codex/skills/flow-feat-review/SKILL.md +4 -2
  6. package/adapters/codex/skills/flow-feat-ship/SKILL.md +16 -9
  7. package/adapters/codex/skills/flow-feat-start/SKILL.md +2 -2
  8. package/adapters/codex/skills/flow-next/SKILL.md +4 -4
  9. package/adapters/codex/skills/flow-work-clean/SKILL.md +1 -1
  10. package/adapters/codex/skills/flow-work-daily/SKILL.md +2 -2
  11. package/adapters/codex/skills/flow-work-resume/SKILL.md +1 -1
  12. package/adapters/codex/skills/flow-work-run/SKILL.md +2 -2
  13. package/adapters/gemini/CORE.md +13 -1
  14. package/adapters/gemini/commands/flow/bug/review.toml +1 -0
  15. package/adapters/gemini/commands/flow/bug/ship.toml +3 -3
  16. package/adapters/gemini/commands/flow/bug/start.toml +2 -2
  17. package/adapters/gemini/commands/flow/feat/review.toml +4 -2
  18. package/adapters/gemini/commands/flow/feat/ship.toml +16 -9
  19. package/adapters/gemini/commands/flow/feat/start.toml +2 -2
  20. package/adapters/gemini/commands/flow/next.toml +4 -4
  21. package/adapters/gemini/commands/flow/work/clean.toml +1 -1
  22. package/adapters/gemini/commands/flow/work/daily.toml +2 -2
  23. package/adapters/gemini/commands/flow/work/resume.toml +1 -1
  24. package/adapters/gemini/commands/flow/work/run.toml +2 -2
  25. package/adapters/hermes/CORE.md +13 -1
  26. package/adapters/hermes/skills/flow-bug-review/SKILL.md +1 -0
  27. package/adapters/hermes/skills/flow-bug-ship/SKILL.md +3 -3
  28. package/adapters/hermes/skills/flow-bug-start/SKILL.md +2 -2
  29. package/adapters/hermes/skills/flow-feat-review/SKILL.md +4 -2
  30. package/adapters/hermes/skills/flow-feat-ship/SKILL.md +16 -9
  31. package/adapters/hermes/skills/flow-feat-start/SKILL.md +2 -2
  32. package/adapters/hermes/skills/flow-next/SKILL.md +4 -4
  33. package/adapters/hermes/skills/flow-work-clean/SKILL.md +1 -1
  34. package/adapters/hermes/skills/flow-work-daily/SKILL.md +2 -2
  35. package/adapters/hermes/skills/flow-work-resume/SKILL.md +1 -1
  36. package/adapters/hermes/skills/flow-work-run/SKILL.md +2 -2
  37. package/adapters/opencode/CORE.md +13 -1
  38. package/adapters/opencode/commands/flow-bug-review.md +1 -0
  39. package/adapters/opencode/commands/flow-bug-ship.md +3 -3
  40. package/adapters/opencode/commands/flow-bug-start.md +2 -2
  41. package/adapters/opencode/commands/flow-feat-review.md +4 -2
  42. package/adapters/opencode/commands/flow-feat-ship.md +16 -9
  43. package/adapters/opencode/commands/flow-feat-start.md +2 -2
  44. package/adapters/opencode/commands/flow-next.md +4 -4
  45. package/adapters/opencode/commands/flow-work-clean.md +1 -1
  46. package/adapters/opencode/commands/flow-work-daily.md +2 -2
  47. package/adapters/opencode/commands/flow-work-resume.md +1 -1
  48. package/adapters/opencode/commands/flow-work-run.md +2 -2
  49. package/package.json +1 -1
  50. package/plugins/flow/.claude-plugin/plugin.json +1 -1
  51. package/plugins/flow/CHANGELOG.md +32 -0
@@ -48,7 +48,7 @@ Read `~/.claude/flow/CORE.hermes.md` first (shared rules: `FLOW.md` step 0, mode
48
48
  - **The review has to be about the tree you are about to push — `/flow-feat-ship` §1, in full and unchanged**, including its four newer cases: `reviewed_sha` is the revision the reviewers *read* (`/flow-bug-review` §1.5 froze it), so `fixed_sha` set alongside an equal sha is a mismatch and not a match; a dirty tree at this end is named and asked about rather than passed over; and a `reviewed_sha` that no longer resolves is reported, then treated as absent. Compare `meta.json.reviewed_sha` and `validated_sha` against `git rev-parse HEAD`:
49
49
  - **Equal** (and no `fixed_sha`, over a clean tree) → continue.
50
50
  - **Absent** (a work from before the shas were recorded) → say so in one line, continue; absence is not a mismatch.
51
- - **Different** → read the delta (`git log --oneline <sha>..HEAD`, `git diff --stat <sha>..HEAD`) and judge it by **what it touches**. Only test files (`tests/`, `test/`, `spec/`, `__tests__/`, `*_test.*`, `*Test.*`, `*.test.*`, `*.spec.*`) or this work's folder under `.claude/work/` → append both shas and the file list to `06-review.md`, continue without asking. **Anything else** → stop and ask in **every** `autonomy.mode`, no exceptions (`AskUserQuestion`): *re-review the delta* (`/flow-bug-review`, the recommended default — its §1.5 takes `reviewed_sha` as the base, so the delta is both what it reads and what sets its tier) · *ship as it stands*, recording in `06-review.md` the two shas and that the user accepted them unreviewed.
51
+ - **Different** → read the delta (`git log --oneline <sha>..HEAD`, `git diff --stat <sha>..HEAD`) and judge it by **what it touches**. Only test files (`tests/`, `test/`, `spec/`, `__tests__/`, `*_test.*`, `*Test.*`, `*.test.*`, `*.spec.*`) or this work's folder under `.claude/work/` → append both shas and the file list to `06-review.md`, continue without asking. **Anything else** → stop and ask in **every** `autonomy.mode`, no exceptions (`AskUserQuestion`): *re-review the delta* (`/flow-bug-review`, the recommended default — its §1.5 takes `reviewed_sha` as the base, so the delta is both what it reads and what sets its tier) · *ship as it stands*, recording in `06-review.md` the two shas and that the user accepted them unreviewed. Its own question, never a line of the §2 MR/PR preview; a delta that adds or modifies a query or a schema object names it in the question, as `/flow-feat-ship` §1 says.
52
52
 
53
53
  ## 1. Draft title and description (without sending anything yet)
54
54
 
@@ -185,8 +185,8 @@ With an "all threads resolved before merge" policy, the MR/PR cannot be merged o
185
185
 
186
186
  ### 3.3 Performance comment
187
187
 
188
- `/flow-feat-ship` §4.3, unchanged: query rows from `06-review.md` — a modified query that was not
189
- measured included, as `not measured (<reason>)` — and benchmark rows from `05-validation.md`,
188
+ `/flow-feat-ship` §4.3, unchanged: query and schema rows from `06-review.md` — added and modified
189
+ queries alike, one that was not measured included, as `not measured (<reason>)` — and benchmark rows from `05-validation.md`,
190
190
  posted as comments anchored on the changed lines of the MR/PR, confirmed in every mode. A slowness bug is the case where this comment *is* the proof the fix worked.
191
191
 
192
192
  ## 4. Close
@@ -49,7 +49,7 @@ Read `~/.claude/flow/CORE.hermes.md` first (shared rules: `FLOW.md` step 0, mode
49
49
 
50
50
  - Verify you are in the correct repo.
51
51
  - **Determine the mode** from `$ARGUMENTS` (`--study` already taken out): non-empty → *ticket mode* (identifier = `$ARGUMENTS`); empty → *ticket-less mode* (identifier = the slug resolved in §1.5).
52
- - Once the identifier is known, check whether the work already exists: ticket mode → glob `.claude/work/<TICKET>/` and `.claude/work/<TICKET>-*/` for a `meta.json` whose `ticket` equals `<TICKET>`; ticket-less → `.claude/work/<slug>/meta.json`, right after §1.5.2 decides the slug. If one exists, suggest `/flow-work-resume`.
52
+ - Once the identifier is known, check whether the work already exists: in both work-folder locations (flow-core §0); ticket mode → glob `.claude/work/<TICKET>/` and `.claude/work/<TICKET>-*/` for a `meta.json` whose `ticket` equals `<TICKET>`; ticket-less → `.claude/work/<slug>/meta.json`, right after §1.5.2 decides the slug. If one exists, suggest `/flow-work-resume`.
53
53
  - This command **creates** `00-summary.md` (§4); there is nothing to read yet.
54
54
 
55
55
  **Work directory naming.** The work lives in `.claude/work/<work-dir>/`. `meta.json.ticket` stays the **pure identifier** (the real ticket id, or the slug in ticket-less local-only) — it feeds the tracker view, the issue link and `{TICKET}` in the branch. The directory name adds a slug:
@@ -158,7 +158,7 @@ The `Closes #N` in the body (`/flow-bug-ship §1`) is **ignored when the MR/PR t
158
158
 
159
159
  ## 4. Write artifacts
160
160
 
161
- Create the work directory per §0: `.claude/work/<TICKET>-<slug>/` in ticket mode, `.claude/work/<slug>/` in ticket-less local-only mode.
161
+ Create the work directory where flow-core §0 puts a new one (the main checkout, unless it tracks `.claude/work/`) per §0: `.claude/work/<TICKET>-<slug>/` in ticket mode, `.claude/work/<slug>/` in ticket-less local-only mode.
162
162
 
163
163
  `<work-dir>/meta.json`:
164
164
  ```json
@@ -212,7 +212,9 @@ Judging rules: **no number, no win** (unresolved is recorded unresolved, never s
212
212
 
213
213
  **A modified query is judged against its own past, not only against its rivals.** For every query the diff *changes* (as opposed to adds), the duel carries the **base row** — the same query on `git merge-base HEAD <git.default_base>`, measured in the same sandbox with the same seed (`/flow-work-query` §4). Without it the table cannot say whether this diff made things better or worse, which is the one thing a reviewer wants from it.
214
214
 
215
- **A modified query with no plan behind its verdict is recorded `ok (plan not measured)` — and says what would measure it (`data.explain_cmd`, a data set) — never a bare `ok`.** Ship publishes that row on the MR/PR (`/flow-feat-ship` §4.3); a reviewer who finds a plain "ok" and no number has no way to know nobody looked.
215
+ **A query with no plan behind its verdict — added or modified — is recorded `ok (plan not measured)` — and says what would measure it (`data.explain_cmd`, a data set) — never a bare `ok`.** Ship publishes that row on the MR/PR (`/flow-feat-ship` §4.3); a reviewer who finds a plain "ok" and no number has no way to know nobody looked.
216
+
217
+ **This round's own fixes are diff too.** A fix applied after the round — a blocker's, a suggestion's, or a scope the user widened when a finding asked — that adds or modifies a query or a schema object runs this section on it before §9, on the tree that holds the fix. "No queries touched" is written only when neither the candidate nor the fixes touched one; a query that entered with a fix and was judged by reading it ("indexed unique key, LIMIT 1") is `ok (plan not measured)`, never an `ok`, and ship publishes it as such.
216
218
 
217
219
  Verdicts as findings: **change** = blocker, through §6; **regressed** = blocker unless `03-design.md` justifies the trade, in which case it is stated and published; **schema / follow-up** → proposed ticket in the output **and a `followups[]` entry** (flow-core §7); **unresolved** → recorded literally with the open question (as §3.5). A `change` verdict resting on a measured plan is already confirmed — no §6 skeptic.
218
220
 
@@ -336,7 +338,7 @@ Write `.claude/work/<TICKET>/06-review.md`. The `Cost:` line of `## Summary` is
336
338
  <the phases §2.0b's give-up order dropped because the budget ran out, one line each with what was not looked at, or "none">
337
339
 
338
340
  ## Data-access duel
339
- <one row per query added or modified by the diff, per §3.6; "no queries touched" if none, or "renames only" when the change did not alter filter/order/bound/joins/columns>
341
+ <one row per query added or modified by the diff or by this round's fixes, and per schema change, per §3.6; "no queries touched" if none, or "renames only" when the change did not alter filter/order/bound/joins/columns>
340
342
 
341
343
  | Query (file:line) | New/mod | Bound | Index used / plan | Rows read → returned | vs base | Verdict | Evidence |
342
344
  |---|---|---|---|---|---|---|---|
@@ -88,7 +88,7 @@ the one taken checked (flow-core §2.1, the recommended answer).
88
88
  - **Absent** (work started before the shas were recorded) → say so in one line and continue. Absence is not a mismatch.
89
89
  - **Different** → read the delta (`git log --oneline <sha>..HEAD`, `git diff --stat <sha>..HEAD`) and judge it by **what it touches**, never by size. When `fixed_sha` is set, say in the same line that part of this delta is the review's own fixes: the user is judging what the reviewers never read, and where it came from is the first thing they need.
90
90
  - Only test files (`tests/`, `test/`, `spec/`, `__tests__/`, `*_test.*`, `*Test.*`, `*.test.*`, `*.spec.*`) and this work's own folder under `.claude/work/` → append both shas and the file list to `06-review.md`, continue **without asking** (a test written by `validate` after the review is the normal order).
91
- - **Anything else** → stop and ask, in **every** `autonomy.mode`, with a single `AskUserQuestion`: *re-review the delta* (`/flow-feat-review`, recommended default — §1.5 resolves `reviewed_sha` as its base, so it reads the delta and nothing else, and resolves the tier on the delta too) · *ship it as it stands*, which first appends to `06-review.md` the two shas, the files, and that the user accepted them unreviewed. Never resolve this one silently.
91
+ - **Anything else** → stop and ask, in **every** `autonomy.mode`, with a single `AskUserQuestion`: *re-review the delta* (`/flow-feat-review`, recommended default — §1.5 resolves `reviewed_sha` as its base, so it reads the delta and nothing else, and resolves the tier on the delta too) · *ship it as it stands*, which first appends to `06-review.md` the two shas, the files, and that the user accepted them unreviewed. Never resolve this one silently, and never fold it into the §3 description preview as a line to accept with the MR/PR: it is a question of its own, asked before §2 drafts anything. **A delta that adds or modifies a query or a schema object** says so in the question, by name: re-reviewing it is what puts it through the data-access duel (`/flow-feat-review` §3.6) and onto the performance comment (§4.3); shipping as it stands leaves that query out of both, and the appended line in `06-review.md` names it as unmeasured.
92
92
  - Check for blocking TODO/FIXME added on this branch (`git diff --unified=0 <git.default_base>...HEAD | grep -E '^\+.*(TODO|FIXME)'`). If any, list them and ask whether to continue.
93
93
 
94
94
  ## 2. Draft title and description (without sending anything yet)
@@ -246,20 +246,26 @@ Thread body: the SQL block under "Pre-deploy: run this SQL on the server BEFORE
246
246
 
247
247
  With the repo policy "all threads resolved before merge", the MR/PR cannot merge until the SQL is executed and the thread **resolved**. **One single thread even with multiple statements.** Tell the user it is left open on purpose.
248
248
 
249
- ### 4.3 Performance comment (every modified query, measured or not)
249
+ ### 4.3 Performance comment (every query or table the diff touches, measured or not)
250
250
 
251
- Post one when `06-review.md` §"Data-access duel" has a row for a **modified** query — **whatever its
252
- verdict, measured or not** — or `07-validation.md` §3.7 has benchmark rows. New queries only, or
253
- renames and reformats only, and nothing benchmarked → post nothing.
251
+ Post one when `06-review.md` §"Data-access duel" has a row for a query the diff **adds or modifies**,
252
+ or for a **schema change** (a table created or altered, an index added or dropped) — **whatever its
253
+ verdict, measured or not** — or `07-validation.md` §3.7 has benchmark rows. Renames and reformats
254
+ only, and nothing benchmarked → post nothing.
254
255
 
255
- **A modified query that was never measured is the case this comment exists for.** Silence reads as
256
+ **An added query has no past, not no plan.** Its comment carries the plan on the branch alone, the
257
+ `base` row reading `new`. A new table carries its DDL with the indexes it was created with, and the
258
+ plan of every query in the diff that reads it — a table nobody queries yet says so in one line. The
259
+ row is anchored to the migration's changed lines, the queries' rows to theirs.
260
+
261
+ **A query that was never measured is the case this comment exists for.** Silence reads as
256
262
  "nothing to see"; a reviewer cannot tell a query that was measured and is fine from one that nobody
257
263
  looked at. The row says `not measured (<reason>)` and what would settle it (`data.explain_cmd`, a
258
264
  data set, the entry point to run), so the reviewer knows what was *not* checked.
259
265
 
260
266
  **Where it goes: on the query, not under the title.** One **inline thread anchored to the changed
261
267
  lines of that query in the MR/PR diff** (a resolvable GitLab discussion with a `position`; a GitHub
262
- review comment on `path` + `line`), one per modified query. The entry-point rows anchor to the entry
268
+ review comment on `path` + `line`), one per query or schema change. The entry-point rows anchor to the entry
263
269
  point's changed line the same way. Anchoring fails (the line is not in the diff, the forge refuses
264
270
  the position) → a general MR/PR comment that names the file and line, and say so. A general comment
265
271
  is the fallback, never the default: a number a reviewer meets on the line they are reading is read;
@@ -294,8 +300,9 @@ no measurable change, not a percentage.
294
300
  plan command for it — `EXPLAIN`, never `EXPLAIN ANALYZE` on a write — in a code block, so the
295
301
  author can run it on production or a replica and answer in the thread. This is a complement to the
296
302
  sandbox measurement, never a substitute: the flow does not touch production.
297
- - **Memory is the entry point's, not the query's.** A modified query also gets the entry-point row
298
- that exercises it, through `quality.bench_cmd` on both sides (`/flow-*-validate` §3.7). No
303
+ - **Memory is the entry point's, not the query's.** A query the diff adds or modifies also gets the
304
+ entry-point row that exercises it, through `quality.bench_cmd` on both sides — the branch alone
305
+ for an added one (`/flow-*-validate` §3.7). No
299
306
  `bench_cmd` → the entry-point row says `not measured (no quality.bench_cmd)`; never an estimate.
300
307
  - **Verdicts**: `improved` · `no measurable change` · `regressed` · `not measured (<reason>)`.
301
308
  - **A `regressed` row is a review blocker** unless `03-design.md` justifies the trade — in which
@@ -56,7 +56,7 @@ its reason file in a `mktemp -d` directory (flow-core §2.1).
56
56
  step's default. This command **creates** `00-summary.md` (§6) instead of reading it (flow-core §5).
57
57
  - No recognizable project structure → warn and stop.
58
58
  - **Determine the mode** (`--study` already taken out): `$ARGUMENTS` non-empty → *ticket mode* (identifier = `$ARGUMENTS`); empty → *ticket-less* (identifier = the §2.5 slug).
59
- - Once the identifier is known, check the work does not exist: ticket mode → glob `.claude/work/<TICKET>/` and `.claude/work/<TICKET>-*/` for a `meta.json` whose `ticket` equals `<TICKET>`; ticket-less → `.claude/work/<slug>/meta.json`, right after the slug is decided in §2.5. Exists → do not overwrite; warn and suggest `/flow-work-resume`.
59
+ - Once the identifier is known, check the work does not exist: in both work-folder locations (flow-core §0); ticket mode → glob `.claude/work/<TICKET>/` and `.claude/work/<TICKET>-*/` for a `meta.json` whose `ticket` equals `<TICKET>`; ticket-less → `.claude/work/<slug>/meta.json`, right after the slug is decided in §2.5. Exists → do not overwrite; warn and suggest `/flow-work-resume`.
60
60
 
61
61
  **Work directory naming.** Work lives in `.claude/work/<work-dir>/`. `meta.json.ticket` stays the **pure identifier** (real ticket id, or the slug in ticket-less local-only) — it feeds the tracker view, the issue link and `{TICKET}`. The directory adds a slug:
62
62
  - **ticket mode** → `<TICKET>-<slug>`; `<slug>` = short English kebab-case (≤5 words) from the ticket title, the **same** slug as the branch (§5).
@@ -232,7 +232,7 @@ Best-effort: failure (branch already on remote, permissions, older `gh`) → **w
232
232
 
233
233
  ## 6. Write artifacts
234
234
 
235
- Create the work directory per §1: `.claude/work/<TICKET>-<slug>/` (ticket mode) or `.claude/work/<slug>/` (ticket-less local-only).
235
+ Create the work directory where flow-core §0 puts a new one (the main checkout, unless it tracks `.claude/work/`) per §1: `.claude/work/<TICKET>-<slug>/` (ticket mode) or `.claude/work/<slug>/` (ticket-less local-only).
236
236
 
237
237
  ### `meta.json`
238
238
  ```json
@@ -28,9 +28,9 @@ runs a phase on its own and never advances `meta.json`.
28
28
  1. Identify the active harness. Does `FLOW.md`, the context file `FLOW_CONTEXT` selects, or the
29
29
  active `FLOW.<harness>.md` exist (flow-core §0)? An inactive harness's overlay, or a context file
30
30
  no variable selects, does not configure this session.
31
- 2. `git branch --show-current`, and whether `.claude/work/*/meta.json` has a `branch` equal to it (also check `worktree` entries, and `.claude/work/_archive/` is ignored).
32
- 3. `.claude/work/` — how many open works, and their `phase` (from `meta.json`; read `00-summary.md` when present, never the full artifacts).
33
- 3b. `followups[]` across those works **and** `.claude/work/_archive/*/meta.json`: any entry `accepted` with no `work` started (flow-core §7).
31
+ 2. The work for this branch (flow-core §0): the work folders here **and** in the main checkout, matched by `branch`, `mrs[].branch` or `worktree`. From a linked worktree the folders are usually only in the main checkout — reading `.claude/work/` here alone finds nothing.
32
+ 3. Those work folders — how many open works, in which worktree each is checked out (`git worktree list`), and their `phase` (from `meta.json`; read `00-summary.md` when present, never the full artifacts).
33
+ 3b. `followups[]` across those works **and** their `_archive/*/meta.json`: any entry `accepted` with no `work` started (flow-core §7).
34
34
  4. Is the working tree dirty (`git status --porcelain`)?
35
35
 
36
36
  ## 2. Route
@@ -39,7 +39,7 @@ runs a phase on its own and never advances `meta.json`.
39
39
  |---|---|---|
40
40
  | No FLOW layer present | "This repo is not configured for flow on this harness yet." One line on what the FLOW config is (personal config, auto-detected). | `/flow-init` |
41
41
  | A work matches the current branch | Its stop header (flow-core §3: ticket · size · phase · MR #n of N) and the next phase for its size. | `/flow-work-resume` |
42
- | No match, but open works exist | Count, and the two most recently updated with their phase. | `/flow-work-daily`, or `/flow-feat-start` / `/flow-bug-start` if the user said what they want to do |
42
+ | No match, but open works exist | Count, and the two most recently updated with their phase — and the worktree each lives in, so the answer to "where were we" is a `cd`. | `/flow-work-daily`, or `/flow-feat-start` / `/flow-bug-start` if the user said what they want to do |
43
43
  | No works at all, but an accepted follow-up is waiting | "Nothing in flight — but `<TICKET>` F1 was accepted and never started: `<title>`." | `/flow-feat-start <ticket>` (or `/flow-bug-start`) for that follow-up · `/flow-feat-start` for something else |
44
44
  | No works at all | "Nothing in flight." | `/flow-feat-start <TICKET>` (or with no ticket, from the conversation) · `/flow-bug-start <TICKET>` |
45
45
 
@@ -68,7 +68,7 @@ Three lists, gathered in one pass:
68
68
 
69
69
  - **Worktrees** — `git worktree list --porcelain` → path + branch per entry. Skip the first (the main checkout).
70
70
  - **Local branches** — `git for-each-ref --format='%(refname:short)|%(upstream:short)|%(upstream:track)' refs/heads/`.
71
- - **Work folders** — `ls -1 .claude/work/` (ignore `_archive`), reading each `meta.json` for `ticket`, `branch`, `phase`, `worktree`, `mrs[]`.
71
+ - **Work folders** — both locations of flow-core §0 (here and the main checkout; ignore `_archive`), reading each `meta.json` for `ticket`, `branch`, `phase`, `worktree`, `mrs[]`.
72
72
 
73
73
  Two strays caught in the same sweep:
74
74
 
@@ -42,8 +42,8 @@ Every *mine* below — your MRs/PRs, your threads, your tickets — is the **aut
42
42
 
43
43
  ## 1. Local layer (always — the base of the briefing)
44
44
 
45
- - `git branch --show-current` → the **active** work.
46
- - `ls -1 .claude/work/` (ignore `_archive`); read each `meta.json` (folders are `<TICKET>-<slug>`, `<slug>` for ticket-less works, or just `<TICKET>` for older ones — identify each by `meta.json.ticket`, not the folder name). Read `00-summary.md` per work when it exists and take the recap from it (`Next:` line, what is pending) instead of every artifact (flow-core §5); missing → the most recent artifact(s) (`NN-*.md`) and `meta.notes`, not re-derived from code.
45
+ - The work for this branch (flow-core §0) → the **active** work. From the main checkout on the base branch there is none — that is not "nothing in flight".
46
+ - Every work folder in both locations of flow-core §0, here and the main checkout (ignore `_archive`); read each `meta.json`. Name the worktree a work is checked out in (`git worktree list`) next to it, so the user knows where to `cd` (folders are `<TICKET>-<slug>`, `<slug>` for ticket-less works, or just `<TICKET>` for older ones — identify each by `meta.json.ticket`, not the folder name). Read `00-summary.md` per work when it exists and take the recap from it (`Next:` line, what is pending) instead of every artifact (flow-core §5); missing → the most recent artifact(s) (`NN-*.md`) and `meta.notes`, not re-derived from code.
47
47
  - **"Last session" boundary**: the marker from §7 if present; otherwise the most recent commit date and the newest `updated_at` across works.
48
48
  - Order works by `updated_at` (most recent first); the first is the *"what were we on?"* answer.
49
49
  - Repo pulse: `git log --oneline --since="<last-session boundary>"` (fallback `-10`) and `git status --short` for uncommitted changes.
@@ -31,7 +31,7 @@ reads where the run got to, not how the run continues.
31
31
  ## 1. Detection
32
32
 
33
33
  - `git branch --show-current`.
34
- - Search `.claude/work/` for the `meta.json` whose `branch` matches.
34
+ - Find the work for this branch (flow-core §0: both work-folder locations, `branch`, `mrs[].branch` or `worktree`).
35
35
  - None found → ask the user for the ticket or whether to start a new one.
36
36
  - `meta.json.worktree` non-null and the current directory is not that worktree → tell the user the work lives in a worktree and to `cd <worktree>` before continuing; run the repo-state checks below from there (`git -C <worktree> …`).
37
37
 
@@ -40,8 +40,8 @@ of truth, and an argument that disagrees with it is ignored and named in the log
40
40
  orchestrator that cannot say why it launched the run cannot take one either.
41
41
  - Run `<cmd> ticket --json` and keep `number`, `title`, `base` and `kind` (`kind` absent or `null` → `feat`: the tracker could not tell, so flow decides). `kind` is re-read on every run; only a run that starts the work uses it — once the work exists, its folder says feat or bug.
42
42
  It fails or prints no `number` → `blocked` (flow-core §2.1).
43
- - Find the work: the `meta.json` under `.claude/work/` whose `ticket` equals `number` (archive
44
- excluded). None is not an error — it is the "none" of the table below.
43
+ - Find the work: the `meta.json` in the work folders (flow-core §0 — here and in the main
44
+ checkout) whose `ticket` equals `number` (archive excluded). None is not an error — it is the "none" of the table below.
45
45
 
46
46
  ## 2. Route
47
47
 
@@ -16,7 +16,7 @@ Every `/flow-*` command assumes these rules. They are stated once, here, so a co
16
16
  carries what is specific to its phase. Read this once per session; a command that says "load
17
17
  `flow-core`" means this file.
18
18
 
19
- **This file belongs to flow `0.101.0`.** Compare it once, at the start of the session, against
19
+ **This file belongs to flow `0.102.1`.** Compare it once, at the start of the session, against
20
20
  `version` in `~/.claude/flow/.claude-plugin/plugin.json`. The two differing means the session
21
21
  is running a **mixture** — the commands from one copy of the plugin, these shared rules from another
22
22
  — which is exactly what happens when a branch or a release candidate is loaded over an installed
@@ -88,6 +88,18 @@ a command relies on is simply absent in that session, and nothing else will repo
88
88
  base branch — and goes out in no MR/PR at all. So a phase writing a tracked file writes it
89
89
  **here**, in the directory it is running in, and `/flow-feat-ship §5.5` is what catches the
90
90
  tools that could not be told.
91
+ - **`.claude/work/` lives where the config does, and every command looks in both places.** It is
92
+ git-ignored in most repos, so it exists only in the main checkout: `start` writes it there, and
93
+ from a linked worktree a bare `.claude/work/` finds no works at all — `next` says "nothing in
94
+ flight" about a work that is in flight, and a phase reports the work missing. So **the work
95
+ folders are the union of `.claude/work/` here and in the main checkout** (located as above,
96
+ deduplicated when they are the same directory); a listing reads both, and a work is read and
97
+ written in the folder where it was found. A new work folder goes in the main checkout, unless
98
+ that checkout tracks `.claude/work/` — then it belongs to the branch and goes here.
99
+ **"The work for this branch"** — what every "load `meta.json` by current branch" means — is the
100
+ `meta.json` in those folders (`_archive/` excluded) whose `branch` or any `mrs[].branch` equals
101
+ `git branch --show-current`, or whose `worktree` equals `git rev-parse --show-toplevel`. The
102
+ SessionStart hook matches the same way.
91
103
  - **A fenced block in a FLOW file is an example, and an example is not configuration.** These
92
104
  files are prose with keys in them, and the rule that decides what a key *is* — a `- key:` line
93
105
  under a `## section` — knows nothing about triple backticks. So a block written to be pasted
@@ -139,6 +139,7 @@ Fix-specific:
139
139
  - **Every modified query carries its base row** — the same query on `git merge-base HEAD <git.default_base>`, measured in the same sandbox with the same seed (`/flow-work-query` §4). This chain already demanded it for slowness bugs; it now applies to any query the fix changes, because a fix that quietly costs 40 ms is a regression whether or not the ticket mentioned speed.
140
140
  - **Bug about slowness or timeouts → the duel is the fix's proof**: the base and after rows are the verdict, or the fix is unproven whatever the tests say.
141
141
  - A **trick** added under pressure (a cast to align a collation, a hint, a hand-written column order) — checklist item 11 applies in full: it ships with a comment saying why it is there and what removes it, plus the ticket for the root cause, or it does not ship.
142
+ - **This round's own fixes are diff too** — `/flow-feat-review` §3.6, unchanged: a fix applied after the round that adds or modifies a query (a scope the user widened included) is dueled before §8, and "no queries touched" is written only when neither the candidate nor the fixes touched one.
142
143
  - Verdicts map as findings: **change** blocks, **regressed** blocks unless `03-investigation.md` justifies the trade, **schema / follow-up** → proposed ticket **and a `followups[]` entry** (flow-core §7), **unresolved** recorded literally.
143
144
 
144
145
  ## 4. Over-engineering audit (fit + YAGNI)
@@ -46,7 +46,7 @@ Read `~/.claude/flow/CORE.opencode.md` first (shared rules: `FLOW.md` step 0, mo
46
46
  - **The review has to be about the tree you are about to push — `/flow-feat-ship` §1, in full and unchanged**, including its four newer cases: `reviewed_sha` is the revision the reviewers *read* (`/flow-bug-review` §1.5 froze it), so `fixed_sha` set alongside an equal sha is a mismatch and not a match; a dirty tree at this end is named and asked about rather than passed over; and a `reviewed_sha` that no longer resolves is reported, then treated as absent. Compare `meta.json.reviewed_sha` and `validated_sha` against `git rev-parse HEAD`:
47
47
  - **Equal** (and no `fixed_sha`, over a clean tree) → continue.
48
48
  - **Absent** (a work from before the shas were recorded) → say so in one line, continue; absence is not a mismatch.
49
- - **Different** → read the delta (`git log --oneline <sha>..HEAD`, `git diff --stat <sha>..HEAD`) and judge it by **what it touches**. Only test files (`tests/`, `test/`, `spec/`, `__tests__/`, `*_test.*`, `*Test.*`, `*.test.*`, `*.spec.*`) or this work's folder under `.claude/work/` → append both shas and the file list to `06-review.md`, continue without asking. **Anything else** → stop and ask in **every** `autonomy.mode`, no exceptions (`AskUserQuestion`): *re-review the delta* (`/flow-bug-review`, the recommended default — its §1.5 takes `reviewed_sha` as the base, so the delta is both what it reads and what sets its tier) · *ship as it stands*, recording in `06-review.md` the two shas and that the user accepted them unreviewed.
49
+ - **Different** → read the delta (`git log --oneline <sha>..HEAD`, `git diff --stat <sha>..HEAD`) and judge it by **what it touches**. Only test files (`tests/`, `test/`, `spec/`, `__tests__/`, `*_test.*`, `*Test.*`, `*.test.*`, `*.spec.*`) or this work's folder under `.claude/work/` → append both shas and the file list to `06-review.md`, continue without asking. **Anything else** → stop and ask in **every** `autonomy.mode`, no exceptions (`AskUserQuestion`): *re-review the delta* (`/flow-bug-review`, the recommended default — its §1.5 takes `reviewed_sha` as the base, so the delta is both what it reads and what sets its tier) · *ship as it stands*, recording in `06-review.md` the two shas and that the user accepted them unreviewed. Its own question, never a line of the §2 MR/PR preview; a delta that adds or modifies a query or a schema object names it in the question, as `/flow-feat-ship` §1 says.
50
50
 
51
51
  ## 1. Draft title and description (without sending anything yet)
52
52
 
@@ -183,8 +183,8 @@ With an "all threads resolved before merge" policy, the MR/PR cannot be merged o
183
183
 
184
184
  ### 3.3 Performance comment
185
185
 
186
- `/flow-feat-ship` §4.3, unchanged: query rows from `06-review.md` — a modified query that was not
187
- measured included, as `not measured (<reason>)` — and benchmark rows from `05-validation.md`,
186
+ `/flow-feat-ship` §4.3, unchanged: query and schema rows from `06-review.md` — added and modified
187
+ queries alike, one that was not measured included, as `not measured (<reason>)` — and benchmark rows from `05-validation.md`,
188
188
  posted as comments anchored on the changed lines of the MR/PR, confirmed in every mode. A slowness bug is the case where this comment *is* the proof the fix worked.
189
189
 
190
190
  ## 4. Close
@@ -47,7 +47,7 @@ Read `~/.claude/flow/CORE.opencode.md` first (shared rules: `FLOW.md` step 0, mo
47
47
 
48
48
  - Verify you are in the correct repo.
49
49
  - **Determine the mode** from `$ARGUMENTS` (`--study` already taken out): non-empty → *ticket mode* (identifier = `$ARGUMENTS`); empty → *ticket-less mode* (identifier = the slug resolved in §1.5).
50
- - Once the identifier is known, check whether the work already exists: ticket mode → glob `.claude/work/<TICKET>/` and `.claude/work/<TICKET>-*/` for a `meta.json` whose `ticket` equals `<TICKET>`; ticket-less → `.claude/work/<slug>/meta.json`, right after §1.5.2 decides the slug. If one exists, suggest `/flow-work-resume`.
50
+ - Once the identifier is known, check whether the work already exists: in both work-folder locations (flow-core §0); ticket mode → glob `.claude/work/<TICKET>/` and `.claude/work/<TICKET>-*/` for a `meta.json` whose `ticket` equals `<TICKET>`; ticket-less → `.claude/work/<slug>/meta.json`, right after §1.5.2 decides the slug. If one exists, suggest `/flow-work-resume`.
51
51
  - This command **creates** `00-summary.md` (§4); there is nothing to read yet.
52
52
 
53
53
  **Work directory naming.** The work lives in `.claude/work/<work-dir>/`. `meta.json.ticket` stays the **pure identifier** (the real ticket id, or the slug in ticket-less local-only) — it feeds the tracker view, the issue link and `{TICKET}` in the branch. The directory name adds a slug:
@@ -156,7 +156,7 @@ The `Closes #N` in the body (`/flow-bug-ship §1`) is **ignored when the MR/PR t
156
156
 
157
157
  ## 4. Write artifacts
158
158
 
159
- Create the work directory per §0: `.claude/work/<TICKET>-<slug>/` in ticket mode, `.claude/work/<slug>/` in ticket-less local-only mode.
159
+ Create the work directory where flow-core §0 puts a new one (the main checkout, unless it tracks `.claude/work/`) per §0: `.claude/work/<TICKET>-<slug>/` in ticket mode, `.claude/work/<slug>/` in ticket-less local-only mode.
160
160
 
161
161
  `<work-dir>/meta.json`:
162
162
  ```json
@@ -210,7 +210,9 @@ Judging rules: **no number, no win** (unresolved is recorded unresolved, never s
210
210
 
211
211
  **A modified query is judged against its own past, not only against its rivals.** For every query the diff *changes* (as opposed to adds), the duel carries the **base row** — the same query on `git merge-base HEAD <git.default_base>`, measured in the same sandbox with the same seed (`/flow-work-query` §4). Without it the table cannot say whether this diff made things better or worse, which is the one thing a reviewer wants from it.
212
212
 
213
- **A modified query with no plan behind its verdict is recorded `ok (plan not measured)` — and says what would measure it (`data.explain_cmd`, a data set) — never a bare `ok`.** Ship publishes that row on the MR/PR (`/flow-feat-ship` §4.3); a reviewer who finds a plain "ok" and no number has no way to know nobody looked.
213
+ **A query with no plan behind its verdict — added or modified — is recorded `ok (plan not measured)` — and says what would measure it (`data.explain_cmd`, a data set) — never a bare `ok`.** Ship publishes that row on the MR/PR (`/flow-feat-ship` §4.3); a reviewer who finds a plain "ok" and no number has no way to know nobody looked.
214
+
215
+ **This round's own fixes are diff too.** A fix applied after the round — a blocker's, a suggestion's, or a scope the user widened when a finding asked — that adds or modifies a query or a schema object runs this section on it before §9, on the tree that holds the fix. "No queries touched" is written only when neither the candidate nor the fixes touched one; a query that entered with a fix and was judged by reading it ("indexed unique key, LIMIT 1") is `ok (plan not measured)`, never an `ok`, and ship publishes it as such.
214
216
 
215
217
  Verdicts as findings: **change** = blocker, through §6; **regressed** = blocker unless `03-design.md` justifies the trade, in which case it is stated and published; **schema / follow-up** → proposed ticket in the output **and a `followups[]` entry** (flow-core §7); **unresolved** → recorded literally with the open question (as §3.5). A `change` verdict resting on a measured plan is already confirmed — no §6 skeptic.
216
218
 
@@ -334,7 +336,7 @@ Write `.claude/work/<TICKET>/06-review.md`. The `Cost:` line of `## Summary` is
334
336
  <the phases §2.0b's give-up order dropped because the budget ran out, one line each with what was not looked at, or "none">
335
337
 
336
338
  ## Data-access duel
337
- <one row per query added or modified by the diff, per §3.6; "no queries touched" if none, or "renames only" when the change did not alter filter/order/bound/joins/columns>
339
+ <one row per query added or modified by the diff or by this round's fixes, and per schema change, per §3.6; "no queries touched" if none, or "renames only" when the change did not alter filter/order/bound/joins/columns>
338
340
 
339
341
  | Query (file:line) | New/mod | Bound | Index used / plan | Rows read → returned | vs base | Verdict | Evidence |
340
342
  |---|---|---|---|---|---|---|---|
@@ -86,7 +86,7 @@ the one taken checked (flow-core §2.1, the recommended answer).
86
86
  - **Absent** (work started before the shas were recorded) → say so in one line and continue. Absence is not a mismatch.
87
87
  - **Different** → read the delta (`git log --oneline <sha>..HEAD`, `git diff --stat <sha>..HEAD`) and judge it by **what it touches**, never by size. When `fixed_sha` is set, say in the same line that part of this delta is the review's own fixes: the user is judging what the reviewers never read, and where it came from is the first thing they need.
88
88
  - Only test files (`tests/`, `test/`, `spec/`, `__tests__/`, `*_test.*`, `*Test.*`, `*.test.*`, `*.spec.*`) and this work's own folder under `.claude/work/` → append both shas and the file list to `06-review.md`, continue **without asking** (a test written by `validate` after the review is the normal order).
89
- - **Anything else** → stop and ask, in **every** `autonomy.mode`, with a single `AskUserQuestion`: *re-review the delta* (`/flow-feat-review`, recommended default — §1.5 resolves `reviewed_sha` as its base, so it reads the delta and nothing else, and resolves the tier on the delta too) · *ship it as it stands*, which first appends to `06-review.md` the two shas, the files, and that the user accepted them unreviewed. Never resolve this one silently.
89
+ - **Anything else** → stop and ask, in **every** `autonomy.mode`, with a single `AskUserQuestion`: *re-review the delta* (`/flow-feat-review`, recommended default — §1.5 resolves `reviewed_sha` as its base, so it reads the delta and nothing else, and resolves the tier on the delta too) · *ship it as it stands*, which first appends to `06-review.md` the two shas, the files, and that the user accepted them unreviewed. Never resolve this one silently, and never fold it into the §3 description preview as a line to accept with the MR/PR: it is a question of its own, asked before §2 drafts anything. **A delta that adds or modifies a query or a schema object** says so in the question, by name: re-reviewing it is what puts it through the data-access duel (`/flow-feat-review` §3.6) and onto the performance comment (§4.3); shipping as it stands leaves that query out of both, and the appended line in `06-review.md` names it as unmeasured.
90
90
  - Check for blocking TODO/FIXME added on this branch (`git diff --unified=0 <git.default_base>...HEAD | grep -E '^\+.*(TODO|FIXME)'`). If any, list them and ask whether to continue.
91
91
 
92
92
  ## 2. Draft title and description (without sending anything yet)
@@ -244,20 +244,26 @@ Thread body: the SQL block under "Pre-deploy: run this SQL on the server BEFORE
244
244
 
245
245
  With the repo policy "all threads resolved before merge", the MR/PR cannot merge until the SQL is executed and the thread **resolved**. **One single thread even with multiple statements.** Tell the user it is left open on purpose.
246
246
 
247
- ### 4.3 Performance comment (every modified query, measured or not)
247
+ ### 4.3 Performance comment (every query or table the diff touches, measured or not)
248
248
 
249
- Post one when `06-review.md` §"Data-access duel" has a row for a **modified** query — **whatever its
250
- verdict, measured or not** — or `07-validation.md` §3.7 has benchmark rows. New queries only, or
251
- renames and reformats only, and nothing benchmarked → post nothing.
249
+ Post one when `06-review.md` §"Data-access duel" has a row for a query the diff **adds or modifies**,
250
+ or for a **schema change** (a table created or altered, an index added or dropped) — **whatever its
251
+ verdict, measured or not** — or `07-validation.md` §3.7 has benchmark rows. Renames and reformats
252
+ only, and nothing benchmarked → post nothing.
252
253
 
253
- **A modified query that was never measured is the case this comment exists for.** Silence reads as
254
+ **An added query has no past, not no plan.** Its comment carries the plan on the branch alone, the
255
+ `base` row reading `new`. A new table carries its DDL with the indexes it was created with, and the
256
+ plan of every query in the diff that reads it — a table nobody queries yet says so in one line. The
257
+ row is anchored to the migration's changed lines, the queries' rows to theirs.
258
+
259
+ **A query that was never measured is the case this comment exists for.** Silence reads as
254
260
  "nothing to see"; a reviewer cannot tell a query that was measured and is fine from one that nobody
255
261
  looked at. The row says `not measured (<reason>)` and what would settle it (`data.explain_cmd`, a
256
262
  data set, the entry point to run), so the reviewer knows what was *not* checked.
257
263
 
258
264
  **Where it goes: on the query, not under the title.** One **inline thread anchored to the changed
259
265
  lines of that query in the MR/PR diff** (a resolvable GitLab discussion with a `position`; a GitHub
260
- review comment on `path` + `line`), one per modified query. The entry-point rows anchor to the entry
266
+ review comment on `path` + `line`), one per query or schema change. The entry-point rows anchor to the entry
261
267
  point's changed line the same way. Anchoring fails (the line is not in the diff, the forge refuses
262
268
  the position) → a general MR/PR comment that names the file and line, and say so. A general comment
263
269
  is the fallback, never the default: a number a reviewer meets on the line they are reading is read;
@@ -292,8 +298,9 @@ no measurable change, not a percentage.
292
298
  plan command for it — `EXPLAIN`, never `EXPLAIN ANALYZE` on a write — in a code block, so the
293
299
  author can run it on production or a replica and answer in the thread. This is a complement to the
294
300
  sandbox measurement, never a substitute: the flow does not touch production.
295
- - **Memory is the entry point's, not the query's.** A modified query also gets the entry-point row
296
- that exercises it, through `quality.bench_cmd` on both sides (`/flow-*-validate` §3.7). No
301
+ - **Memory is the entry point's, not the query's.** A query the diff adds or modifies also gets the
302
+ entry-point row that exercises it, through `quality.bench_cmd` on both sides — the branch alone
303
+ for an added one (`/flow-*-validate` §3.7). No
297
304
  `bench_cmd` → the entry-point row says `not measured (no quality.bench_cmd)`; never an estimate.
298
305
  - **Verdicts**: `improved` · `no measurable change` · `regressed` · `not measured (<reason>)`.
299
306
  - **A `regressed` row is a review blocker** unless `03-design.md` justifies the trade — in which
@@ -54,7 +54,7 @@ its reason file in a `mktemp -d` directory (flow-core §2.1).
54
54
  step's default. This command **creates** `00-summary.md` (§6) instead of reading it (flow-core §5).
55
55
  - No recognizable project structure → warn and stop.
56
56
  - **Determine the mode** (`--study` already taken out): `$ARGUMENTS` non-empty → *ticket mode* (identifier = `$ARGUMENTS`); empty → *ticket-less* (identifier = the §2.5 slug).
57
- - Once the identifier is known, check the work does not exist: ticket mode → glob `.claude/work/<TICKET>/` and `.claude/work/<TICKET>-*/` for a `meta.json` whose `ticket` equals `<TICKET>`; ticket-less → `.claude/work/<slug>/meta.json`, right after the slug is decided in §2.5. Exists → do not overwrite; warn and suggest `/flow-work-resume`.
57
+ - Once the identifier is known, check the work does not exist: in both work-folder locations (flow-core §0); ticket mode → glob `.claude/work/<TICKET>/` and `.claude/work/<TICKET>-*/` for a `meta.json` whose `ticket` equals `<TICKET>`; ticket-less → `.claude/work/<slug>/meta.json`, right after the slug is decided in §2.5. Exists → do not overwrite; warn and suggest `/flow-work-resume`.
58
58
 
59
59
  **Work directory naming.** Work lives in `.claude/work/<work-dir>/`. `meta.json.ticket` stays the **pure identifier** (real ticket id, or the slug in ticket-less local-only) — it feeds the tracker view, the issue link and `{TICKET}`. The directory adds a slug:
60
60
  - **ticket mode** → `<TICKET>-<slug>`; `<slug>` = short English kebab-case (≤5 words) from the ticket title, the **same** slug as the branch (§5).
@@ -230,7 +230,7 @@ Best-effort: failure (branch already on remote, permissions, older `gh`) → **w
230
230
 
231
231
  ## 6. Write artifacts
232
232
 
233
- Create the work directory per §1: `.claude/work/<TICKET>-<slug>/` (ticket mode) or `.claude/work/<slug>/` (ticket-less local-only).
233
+ Create the work directory where flow-core §0 puts a new one (the main checkout, unless it tracks `.claude/work/`) per §1: `.claude/work/<TICKET>-<slug>/` (ticket mode) or `.claude/work/<slug>/` (ticket-less local-only).
234
234
 
235
235
  ### `meta.json`
236
236
  ```json
@@ -26,9 +26,9 @@ runs a phase on its own and never advances `meta.json`.
26
26
  1. Identify the active harness. Does `FLOW.md`, the context file `FLOW_CONTEXT` selects, or the
27
27
  active `FLOW.<harness>.md` exist (flow-core §0)? An inactive harness's overlay, or a context file
28
28
  no variable selects, does not configure this session.
29
- 2. `git branch --show-current`, and whether `.claude/work/*/meta.json` has a `branch` equal to it (also check `worktree` entries, and `.claude/work/_archive/` is ignored).
30
- 3. `.claude/work/` — how many open works, and their `phase` (from `meta.json`; read `00-summary.md` when present, never the full artifacts).
31
- 3b. `followups[]` across those works **and** `.claude/work/_archive/*/meta.json`: any entry `accepted` with no `work` started (flow-core §7).
29
+ 2. The work for this branch (flow-core §0): the work folders here **and** in the main checkout, matched by `branch`, `mrs[].branch` or `worktree`. From a linked worktree the folders are usually only in the main checkout — reading `.claude/work/` here alone finds nothing.
30
+ 3. Those work folders — how many open works, in which worktree each is checked out (`git worktree list`), and their `phase` (from `meta.json`; read `00-summary.md` when present, never the full artifacts).
31
+ 3b. `followups[]` across those works **and** their `_archive/*/meta.json`: any entry `accepted` with no `work` started (flow-core §7).
32
32
  4. Is the working tree dirty (`git status --porcelain`)?
33
33
 
34
34
  ## 2. Route
@@ -37,7 +37,7 @@ runs a phase on its own and never advances `meta.json`.
37
37
  |---|---|---|
38
38
  | No FLOW layer present | "This repo is not configured for flow on this harness yet." One line on what the FLOW config is (personal config, auto-detected). | `/flow-init` |
39
39
  | A work matches the current branch | Its stop header (flow-core §3: ticket · size · phase · MR #n of N) and the next phase for its size. | `/flow-work-resume` |
40
- | No match, but open works exist | Count, and the two most recently updated with their phase. | `/flow-work-daily`, or `/flow-feat-start` / `/flow-bug-start` if the user said what they want to do |
40
+ | No match, but open works exist | Count, and the two most recently updated with their phase — and the worktree each lives in, so the answer to "where were we" is a `cd`. | `/flow-work-daily`, or `/flow-feat-start` / `/flow-bug-start` if the user said what they want to do |
41
41
  | No works at all, but an accepted follow-up is waiting | "Nothing in flight — but `<TICKET>` F1 was accepted and never started: `<title>`." | `/flow-feat-start <ticket>` (or `/flow-bug-start`) for that follow-up · `/flow-feat-start` for something else |
42
42
  | No works at all | "Nothing in flight." | `/flow-feat-start <TICKET>` (or with no ticket, from the conversation) · `/flow-bug-start <TICKET>` |
43
43
 
@@ -66,7 +66,7 @@ Three lists, gathered in one pass:
66
66
 
67
67
  - **Worktrees** — `git worktree list --porcelain` → path + branch per entry. Skip the first (the main checkout).
68
68
  - **Local branches** — `git for-each-ref --format='%(refname:short)|%(upstream:short)|%(upstream:track)' refs/heads/`.
69
- - **Work folders** — `ls -1 .claude/work/` (ignore `_archive`), reading each `meta.json` for `ticket`, `branch`, `phase`, `worktree`, `mrs[]`.
69
+ - **Work folders** — both locations of flow-core §0 (here and the main checkout; ignore `_archive`), reading each `meta.json` for `ticket`, `branch`, `phase`, `worktree`, `mrs[]`.
70
70
 
71
71
  Two strays caught in the same sweep:
72
72
 
@@ -40,8 +40,8 @@ Every *mine* below — your MRs/PRs, your threads, your tickets — is the **aut
40
40
 
41
41
  ## 1. Local layer (always — the base of the briefing)
42
42
 
43
- - `git branch --show-current` → the **active** work.
44
- - `ls -1 .claude/work/` (ignore `_archive`); read each `meta.json` (folders are `<TICKET>-<slug>`, `<slug>` for ticket-less works, or just `<TICKET>` for older ones — identify each by `meta.json.ticket`, not the folder name). Read `00-summary.md` per work when it exists and take the recap from it (`Next:` line, what is pending) instead of every artifact (flow-core §5); missing → the most recent artifact(s) (`NN-*.md`) and `meta.notes`, not re-derived from code.
43
+ - The work for this branch (flow-core §0) → the **active** work. From the main checkout on the base branch there is none — that is not "nothing in flight".
44
+ - Every work folder in both locations of flow-core §0, here and the main checkout (ignore `_archive`); read each `meta.json`. Name the worktree a work is checked out in (`git worktree list`) next to it, so the user knows where to `cd` (folders are `<TICKET>-<slug>`, `<slug>` for ticket-less works, or just `<TICKET>` for older ones — identify each by `meta.json.ticket`, not the folder name). Read `00-summary.md` per work when it exists and take the recap from it (`Next:` line, what is pending) instead of every artifact (flow-core §5); missing → the most recent artifact(s) (`NN-*.md`) and `meta.notes`, not re-derived from code.
45
45
  - **"Last session" boundary**: the marker from §7 if present; otherwise the most recent commit date and the newest `updated_at` across works.
46
46
  - Order works by `updated_at` (most recent first); the first is the *"what were we on?"* answer.
47
47
  - Repo pulse: `git log --oneline --since="<last-session boundary>"` (fallback `-10`) and `git status --short` for uncommitted changes.
@@ -29,7 +29,7 @@ reads where the run got to, not how the run continues.
29
29
  ## 1. Detection
30
30
 
31
31
  - `git branch --show-current`.
32
- - Search `.claude/work/` for the `meta.json` whose `branch` matches.
32
+ - Find the work for this branch (flow-core §0: both work-folder locations, `branch`, `mrs[].branch` or `worktree`).
33
33
  - None found → ask the user for the ticket or whether to start a new one.
34
34
  - `meta.json.worktree` non-null and the current directory is not that worktree → tell the user the work lives in a worktree and to `cd <worktree>` before continuing; run the repo-state checks below from there (`git -C <worktree> …`).
35
35
 
@@ -38,8 +38,8 @@ of truth, and an argument that disagrees with it is ignored and named in the log
38
38
  orchestrator that cannot say why it launched the run cannot take one either.
39
39
  - Run `<cmd> ticket --json` and keep `number`, `title`, `base` and `kind` (`kind` absent or `null` → `feat`: the tracker could not tell, so flow decides). `kind` is re-read on every run; only a run that starts the work uses it — once the work exists, its folder says feat or bug.
40
40
  It fails or prints no `number` → `blocked` (flow-core §2.1).
41
- - Find the work: the `meta.json` under `.claude/work/` whose `ticket` equals `number` (archive
42
- excluded). None is not an error — it is the "none" of the table below.
41
+ - Find the work: the `meta.json` in the work folders (flow-core §0 — here and in the main
42
+ checkout) whose `ticket` equals `number` (archive excluded). None is not an error — it is the "none" of the table below.
43
43
 
44
44
  ## 2. Route
45
45
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flow-workflows",
3
- "version": "0.101.0",
3
+ "version": "0.102.1",
4
4
  "description": "Guided feat/bug workflows (start→ship), post-deploy monitoring and multi-agent code review, stack-agnostic. Each repo uses a shared FLOW.md plus optional harness overlay.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -3,7 +3,7 @@
3
3
  "name": "flow",
4
4
  "displayName": "Flow — guided dev workflows",
5
5
  "description": "Guided feat/bug workflows (start→ship), post-deploy monitoring and multi-agent code review, stack-agnostic. Each repo uses a shared FLOW.md plus optional harness overlay.",
6
- "version": "0.101.0",
6
+ "version": "0.102.1",
7
7
  "author": {
8
8
  "name": "Alberto Vioque",
9
9
  "email": "mashware@gmail.com"
@@ -5,6 +5,38 @@ plugin and is what `/flow:news` reads to show you what changed since your previo
5
5
 
6
6
  The canonical, richest notes live in the [GitHub Releases](https://github.com/mashware/flow-workflows/releases).
7
7
 
8
+ ## v0.102.1 — From a worktree, flow finds the work it is in · 2026-10-29
9
+
10
+ **In short**
11
+ - **`next`, `daily` and `resume` see your works from inside a worktree.** Before, they said
12
+ "nothing in flight" there, because the work folders only exist in the main checkout.
13
+ - **From the main checkout they say which worktree each work lives in**, so "where were we" is
14
+ answered with a `cd`, not with silence.
15
+ - **Every phase finds its work the same way** — by branch, by any MR branch of a train, or by the
16
+ worktree it was created in — the way the session-start header already did.
17
+
18
+ `.claude/work/` is git-ignored in most repos, so `start` writes it in the main checkout and it never
19
+ reaches a linked worktree. The session-start hook looked in both places; the commands looked only
20
+ where they stood. So the session opened with the right header and `next` contradicted it.
21
+
22
+ ## v0.102.0 — A query that entered after the review still reaches the MR with its plan · 2026-10-28
23
+
24
+ **In short**
25
+ - **New queries and new tables get the performance comment too.** Before, only a *modified* query
26
+ did: a new query ships with its plan on the branch (base row `new`), a new table with its DDL,
27
+ its indexes and the plan of the queries that read it.
28
+ - **The review duels its own fixes.** A blocker fixed in the round, or a scope widened when a
29
+ finding asked, that adds a query is tried on its plan before the review closes. "No queries
30
+ touched" now means none in the candidate *and* none in the fixes.
31
+ - **Ship asks the re-review question on its own.** Code the reviewers never read is a separate
32
+ question, never a line inside the MR/PR preview, and when that code adds a query or a schema
33
+ object the question names it: shipping as it stands leaves it unmeasured, and says so.
34
+
35
+ A bug fix widened its scope after a review finding and added a query that checked who owned the
36
+ record. The review had already written "no queries touched", the query was judged by reading it,
37
+ and ship folded "these lines were only reviewed by me" into the MR preview — so no plan was ever
38
+ taken and no comment was posted.
39
+
8
40
  ## v0.101.0 — An approved study answers its own design questions too · 2026-10-25
9
41
 
10
42
  **In short**