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
@@ -17,7 +17,7 @@ Every `$flow-*` command assumes these rules. They are stated once, here, so a co
17
17
  carries what is specific to its phase. Read this once per session; a command that says "load
18
18
  `flow-core`" means this file.
19
19
 
20
- **This file belongs to flow `0.101.0`.** Compare it once, at the start of the session, against
20
+ **This file belongs to flow `0.102.1`.** Compare it once, at the start of the session, against
21
21
  `version` in `~/.claude/flow/.claude-plugin/plugin.json`. The two differing means the session
22
22
  is running a **mixture** — the commands from one copy of the plugin, these shared rules from another
23
23
  — which is exactly what happens when a branch or a release candidate is loaded over an installed
@@ -89,6 +89,18 @@ a command relies on is simply absent in that session, and nothing else will repo
89
89
  base branch — and goes out in no MR/PR at all. So a phase writing a tracked file writes it
90
90
  **here**, in the directory it is running in, and `$flow-feat-ship §5.5` is what catches the
91
91
  tools that could not be told.
92
+ - **`.claude/work/` lives where the config does, and every command looks in both places.** It is
93
+ git-ignored in most repos, so it exists only in the main checkout: `start` writes it there, and
94
+ from a linked worktree a bare `.claude/work/` finds no works at all — `next` says "nothing in
95
+ flight" about a work that is in flight, and a phase reports the work missing. So **the work
96
+ folders are the union of `.claude/work/` here and in the main checkout** (located as above,
97
+ deduplicated when they are the same directory); a listing reads both, and a work is read and
98
+ written in the folder where it was found. A new work folder goes in the main checkout, unless
99
+ that checkout tracks `.claude/work/` — then it belongs to the branch and goes here.
100
+ **"The work for this branch"** — what every "load `meta.json` by current branch" means — is the
101
+ `meta.json` in those folders (`_archive/` excluded) whose `branch` or any `mrs[].branch` equals
102
+ `git branch --show-current`, or whose `worktree` equals `git rev-parse --show-toplevel`. The
103
+ SessionStart hook matches the same way.
92
104
  - **A fenced block in a FLOW file is an example, and an example is not configuration.** These
93
105
  files are prose with keys in them, and the rule that decides what a key *is* — a `- key:` line
94
106
  under a `## section` — knows nothing about triple backticks. So a block written to be pasted
@@ -141,6 +141,7 @@ Fix-specific:
141
141
  - **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.
142
142
  - **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.
143
143
  - 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.
144
+ - **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.
144
145
  - 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.
145
146
 
146
147
  ## 4. Over-engineering audit (fit + YAGNI)
@@ -48,7 +48,7 @@ Read `~/.claude/flow/CORE.codex.md` first (shared rules: `FLOW.md` step 0, model
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.codex.md` first (shared rules: `FLOW.md` step 0, model
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
@@ -137,6 +137,7 @@ Fix-specific:
137
137
  - **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.
138
138
  - **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.
139
139
  - 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.
140
+ - **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.
140
141
  - 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.
141
142
 
142
143
  ## 4. Over-engineering audit (fit + YAGNI)
@@ -44,7 +44,7 @@ Read `~/.claude/flow/CORE.gemini.md` first (shared rules: `FLOW.md` step 0, mode
44
44
  - **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`:
45
45
  - **Equal** (and no `fixed_sha`, over a clean tree) → continue.
46
46
  - **Absent** (a work from before the shas were recorded) → say so in one line, continue; absence is not a mismatch.
47
- - **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.
47
+ - **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.
48
48
 
49
49
  ## 1. Draft title and description (without sending anything yet)
50
50
 
@@ -181,8 +181,8 @@ With an "all threads resolved before merge" policy, the MR/PR cannot be merged o
181
181
 
182
182
  ### 3.3 Performance comment
183
183
 
184
- `/flow:feat:ship` §4.3, unchanged: query rows from `06-review.md` — a modified query that was not
185
- measured included, as `not measured (<reason>)` — and benchmark rows from `05-validation.md`,
184
+ `/flow:feat:ship` §4.3, unchanged: query and schema rows from `06-review.md` — added and modified
185
+ queries alike, one that was not measured included, as `not measured (<reason>)` — and benchmark rows from `05-validation.md`,
186
186
  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.
187
187
 
188
188
  ## 4. Close
@@ -45,7 +45,7 @@ Read `~/.claude/flow/CORE.gemini.md` first (shared rules: `FLOW.md` step 0, mode
45
45
 
46
46
  - Verify you are in the correct repo.
47
47
  - **Determine the mode** from `{{args}}` (`--study` already taken out): non-empty → *ticket mode* (identifier = `{{args}}`); empty → *ticket-less mode* (identifier = the slug resolved in §1.5).
48
- - 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`.
48
+ - 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`.
49
49
  - This command **creates** `00-summary.md` (§4); there is nothing to read yet.
50
50
 
51
51
  **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:
@@ -154,7 +154,7 @@ The `Closes #N` in the body (`/flow:bug:ship §1`) is **ignored when the MR/PR t
154
154
 
155
155
  ## 4. Write artifacts
156
156
 
157
- Create the work directory per §0: `.claude/work/<TICKET>-<slug>/` in ticket mode, `.claude/work/<slug>/` in ticket-less local-only mode.
157
+ 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.
158
158
 
159
159
  `<work-dir>/meta.json`:
160
160
  ```json
@@ -208,7 +208,9 @@ Judging rules: **no number, no win** (unresolved is recorded unresolved, never s
208
208
 
209
209
  **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.
210
210
 
211
- **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.
211
+ **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.
212
+
213
+ **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.
212
214
 
213
215
  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.
214
216
 
@@ -332,7 +334,7 @@ Write `.claude/work/<TICKET>/06-review.md`. The `Cost:` line of `## Summary` is
332
334
  <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">
333
335
 
334
336
  ## Data-access duel
335
- <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>
337
+ <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>
336
338
 
337
339
  | Query (file:line) | New/mod | Bound | Index used / plan | Rows read → returned | vs base | Verdict | Evidence |
338
340
  |---|---|---|---|---|---|---|---|
@@ -84,7 +84,7 @@ the one taken checked (flow-core §2.1, the recommended answer).
84
84
  - **Absent** (work started before the shas were recorded) → say so in one line and continue. Absence is not a mismatch.
85
85
  - **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.
86
86
  - 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).
87
- - **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.
87
+ - **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.
88
88
  - 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.
89
89
 
90
90
  ## 2. Draft title and description (without sending anything yet)
@@ -242,20 +242,26 @@ Thread body: the SQL block under "Pre-deploy: run this SQL on the server BEFORE
242
242
 
243
243
  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.
244
244
 
245
- ### 4.3 Performance comment (every modified query, measured or not)
245
+ ### 4.3 Performance comment (every query or table the diff touches, measured or not)
246
246
 
247
- Post one when `06-review.md` §"Data-access duel" has a row for a **modified** query — **whatever its
248
- verdict, measured or not** — or `07-validation.md` §3.7 has benchmark rows. New queries only, or
249
- renames and reformats only, and nothing benchmarked → post nothing.
247
+ Post one when `06-review.md` §"Data-access duel" has a row for a query the diff **adds or modifies**,
248
+ or for a **schema change** (a table created or altered, an index added or dropped) — **whatever its
249
+ verdict, measured or not** — or `07-validation.md` §3.7 has benchmark rows. Renames and reformats
250
+ only, and nothing benchmarked → post nothing.
250
251
 
251
- **A modified query that was never measured is the case this comment exists for.** Silence reads as
252
+ **An added query has no past, not no plan.** Its comment carries the plan on the branch alone, the
253
+ `base` row reading `new`. A new table carries its DDL with the indexes it was created with, and the
254
+ plan of every query in the diff that reads it — a table nobody queries yet says so in one line. The
255
+ row is anchored to the migration's changed lines, the queries' rows to theirs.
256
+
257
+ **A query that was never measured is the case this comment exists for.** Silence reads as
252
258
  "nothing to see"; a reviewer cannot tell a query that was measured and is fine from one that nobody
253
259
  looked at. The row says `not measured (<reason>)` and what would settle it (`data.explain_cmd`, a
254
260
  data set, the entry point to run), so the reviewer knows what was *not* checked.
255
261
 
256
262
  **Where it goes: on the query, not under the title.** One **inline thread anchored to the changed
257
263
  lines of that query in the MR/PR diff** (a resolvable GitLab discussion with a `position`; a GitHub
258
- review comment on `path` + `line`), one per modified query. The entry-point rows anchor to the entry
264
+ review comment on `path` + `line`), one per query or schema change. The entry-point rows anchor to the entry
259
265
  point's changed line the same way. Anchoring fails (the line is not in the diff, the forge refuses
260
266
  the position) → a general MR/PR comment that names the file and line, and say so. A general comment
261
267
  is the fallback, never the default: a number a reviewer meets on the line they are reading is read;
@@ -290,8 +296,9 @@ no measurable change, not a percentage.
290
296
  plan command for it — `EXPLAIN`, never `EXPLAIN ANALYZE` on a write — in a code block, so the
291
297
  author can run it on production or a replica and answer in the thread. This is a complement to the
292
298
  sandbox measurement, never a substitute: the flow does not touch production.
293
- - **Memory is the entry point's, not the query's.** A modified query also gets the entry-point row
294
- that exercises it, through `quality.bench_cmd` on both sides (`/flow:*:validate` §3.7). No
299
+ - **Memory is the entry point's, not the query's.** A query the diff adds or modifies also gets the
300
+ entry-point row that exercises it, through `quality.bench_cmd` on both sides — the branch alone
301
+ for an added one (`/flow:*:validate` §3.7). No
295
302
  `bench_cmd` → the entry-point row says `not measured (no quality.bench_cmd)`; never an estimate.
296
303
  - **Verdicts**: `improved` · `no measurable change` · `regressed` · `not measured (<reason>)`.
297
304
  - **A `regressed` row is a review blocker** unless `03-design.md` justifies the trade — in which
@@ -52,7 +52,7 @@ its reason file in a `mktemp -d` directory (flow-core §2.1).
52
52
  step's default. This command **creates** `00-summary.md` (§6) instead of reading it (flow-core §5).
53
53
  - No recognizable project structure → warn and stop.
54
54
  - **Determine the mode** (`--study` already taken out): `{{args}}` non-empty → *ticket mode* (identifier = `{{args}}`); empty → *ticket-less* (identifier = the §2.5 slug).
55
- - 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`.
55
+ - 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`.
56
56
 
57
57
  **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:
58
58
  - **ticket mode** → `<TICKET>-<slug>`; `<slug>` = short English kebab-case (≤5 words) from the ticket title, the **same** slug as the branch (§5).
@@ -228,7 +228,7 @@ Best-effort: failure (branch already on remote, permissions, older `gh`) → **w
228
228
 
229
229
  ## 6. Write artifacts
230
230
 
231
- Create the work directory per §1: `.claude/work/<TICKET>-<slug>/` (ticket mode) or `.claude/work/<slug>/` (ticket-less local-only).
231
+ 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).
232
232
 
233
233
  ### `meta.json`
234
234
  ```json
@@ -24,9 +24,9 @@ runs a phase on its own and never advances `meta.json`.
24
24
  1. Identify the active harness. Does `FLOW.md`, the context file `FLOW_CONTEXT` selects, or the
25
25
  active `FLOW.<harness>.md` exist (flow-core §0)? An inactive harness's overlay, or a context file
26
26
  no variable selects, does not configure this session.
27
- 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).
28
- 3. `.claude/work/` — how many open works, and their `phase` (from `meta.json`; read `00-summary.md` when present, never the full artifacts).
29
- 3b. `followups[]` across those works **and** `.claude/work/_archive/*/meta.json`: any entry `accepted` with no `work` started (flow-core §7).
27
+ 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.
28
+ 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).
29
+ 3b. `followups[]` across those works **and** their `_archive/*/meta.json`: any entry `accepted` with no `work` started (flow-core §7).
30
30
  4. Is the working tree dirty (`git status --porcelain`)?
31
31
 
32
32
  ## 2. Route
@@ -35,7 +35,7 @@ runs a phase on its own and never advances `meta.json`.
35
35
  |---|---|---|
36
36
  | 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` |
37
37
  | 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` |
38
- | 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 |
38
+ | 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 |
39
39
  | 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 |
40
40
  | No works at all | "Nothing in flight." | `/flow:feat:start <TICKET>` (or with no ticket, from the conversation) · `/flow:bug:start <TICKET>` |
41
41
 
@@ -64,7 +64,7 @@ Three lists, gathered in one pass:
64
64
 
65
65
  - **Worktrees** — `git worktree list --porcelain` → path + branch per entry. Skip the first (the main checkout).
66
66
  - **Local branches** — `git for-each-ref --format='%(refname:short)|%(upstream:short)|%(upstream:track)' refs/heads/`.
67
- - **Work folders** — `ls -1 .claude/work/` (ignore `_archive`), reading each `meta.json` for `ticket`, `branch`, `phase`, `worktree`, `mrs[]`.
67
+ - **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[]`.
68
68
 
69
69
  Two strays caught in the same sweep:
70
70
 
@@ -38,8 +38,8 @@ Every *mine* below — your MRs/PRs, your threads, your tickets — is the **aut
38
38
 
39
39
  ## 1. Local layer (always — the base of the briefing)
40
40
 
41
- - `git branch --show-current` → the **active** work.
42
- - `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.
41
+ - 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".
42
+ - 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.
43
43
  - **"Last session" boundary**: the marker from §7 if present; otherwise the most recent commit date and the newest `updated_at` across works.
44
44
  - Order works by `updated_at` (most recent first); the first is the *"what were we on?"* answer.
45
45
  - Repo pulse: `git log --oneline --since="<last-session boundary>"` (fallback `-10`) and `git status --short` for uncommitted changes.
@@ -27,7 +27,7 @@ reads where the run got to, not how the run continues.
27
27
  ## 1. Detection
28
28
 
29
29
  - `git branch --show-current`.
30
- - Search `.claude/work/` for the `meta.json` whose `branch` matches.
30
+ - Find the work for this branch (flow-core §0: both work-folder locations, `branch`, `mrs[].branch` or `worktree`).
31
31
  - None found → ask the user for the ticket or whether to start a new one.
32
32
  - `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> …`).
33
33
 
@@ -36,8 +36,8 @@ of truth, and an argument that disagrees with it is ignored and named in the log
36
36
  orchestrator that cannot say why it launched the run cannot take one either.
37
37
  - 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.
38
38
  It fails or prints no `number` → `blocked` (flow-core §2.1).
39
- - Find the work: the `meta.json` under `.claude/work/` whose `ticket` equals `number` (archive
40
- excluded). None is not an error — it is the "none" of the table below.
39
+ - Find the work: the `meta.json` in the work folders (flow-core §0 — here and in the main
40
+ checkout) whose `ticket` equals `number` (archive excluded). None is not an error — it is the "none" of the table below.
41
41
 
42
42
  ## 2. Route
43
43
 
@@ -17,7 +17,7 @@ Every `/flow-*` command assumes these rules. They are stated once, here, so a co
17
17
  carries what is specific to its phase. Read this once per session; a command that says "load
18
18
  `flow-core`" means this file.
19
19
 
20
- **This file belongs to flow `0.101.0`.** Compare it once, at the start of the session, against
20
+ **This file belongs to flow `0.102.1`.** Compare it once, at the start of the session, against
21
21
  `version` in `~/.claude/flow/.claude-plugin/plugin.json`. The two differing means the session
22
22
  is running a **mixture** — the commands from one copy of the plugin, these shared rules from another
23
23
  — which is exactly what happens when a branch or a release candidate is loaded over an installed
@@ -89,6 +89,18 @@ a command relies on is simply absent in that session, and nothing else will repo
89
89
  base branch — and goes out in no MR/PR at all. So a phase writing a tracked file writes it
90
90
  **here**, in the directory it is running in, and `/flow-feat-ship §5.5` is what catches the
91
91
  tools that could not be told.
92
+ - **`.claude/work/` lives where the config does, and every command looks in both places.** It is
93
+ git-ignored in most repos, so it exists only in the main checkout: `start` writes it there, and
94
+ from a linked worktree a bare `.claude/work/` finds no works at all — `next` says "nothing in
95
+ flight" about a work that is in flight, and a phase reports the work missing. So **the work
96
+ folders are the union of `.claude/work/` here and in the main checkout** (located as above,
97
+ deduplicated when they are the same directory); a listing reads both, and a work is read and
98
+ written in the folder where it was found. A new work folder goes in the main checkout, unless
99
+ that checkout tracks `.claude/work/` — then it belongs to the branch and goes here.
100
+ **"The work for this branch"** — what every "load `meta.json` by current branch" means — is the
101
+ `meta.json` in those folders (`_archive/` excluded) whose `branch` or any `mrs[].branch` equals
102
+ `git branch --show-current`, or whose `worktree` equals `git rev-parse --show-toplevel`. The
103
+ SessionStart hook matches the same way.
92
104
  - **A fenced block in a FLOW file is an example, and an example is not configuration.** These
93
105
  files are prose with keys in them, and the rule that decides what a key *is* — a `- key:` line
94
106
  under a `## section` — knows nothing about triple backticks. So a block written to be pasted
@@ -141,6 +141,7 @@ Fix-specific:
141
141
  - **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.
142
142
  - **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.
143
143
  - 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.
144
+ - **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.
144
145
  - 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.
145
146
 
146
147
  ## 4. Over-engineering audit (fit + YAGNI)