flow-workflows 0.116.1 → 0.118.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/adapters/codex/CORE.md +45 -9
  2. package/adapters/codex/skills/flow-bug-investigate/SKILL.md +1 -1
  3. package/adapters/codex/skills/flow-bug-start/SKILL.md +5 -5
  4. package/adapters/codex/skills/flow-doctor/SKILL.md +1 -1
  5. package/adapters/codex/skills/flow-feat-start/SKILL.md +5 -5
  6. package/adapters/codex/skills/flow-work-README/SKILL.md +1 -1
  7. package/adapters/codex/skills/flow-work-abandon/SKILL.md +1 -1
  8. package/adapters/codex/skills/flow-work-handoff/SKILL.md +57 -7
  9. package/adapters/codex/skills/flow-work-resume/SKILL.md +1 -1
  10. package/adapters/codex/skills/flow-work-run/SKILL.md +3 -2
  11. package/adapters/codex/skills/flow-work-watch/SKILL.md +1 -1
  12. package/adapters/gemini/CORE.md +45 -9
  13. package/adapters/gemini/commands/flow/bug/investigate.toml +1 -1
  14. package/adapters/gemini/commands/flow/bug/start.toml +5 -5
  15. package/adapters/gemini/commands/flow/doctor.toml +1 -1
  16. package/adapters/gemini/commands/flow/feat/start.toml +5 -5
  17. package/adapters/gemini/commands/flow/work/README.toml +1 -1
  18. package/adapters/gemini/commands/flow/work/abandon.toml +1 -1
  19. package/adapters/gemini/commands/flow/work/handoff.toml +57 -7
  20. package/adapters/gemini/commands/flow/work/resume.toml +1 -1
  21. package/adapters/gemini/commands/flow/work/run.toml +3 -2
  22. package/adapters/gemini/commands/flow/work/watch.toml +1 -1
  23. package/adapters/hermes/CORE.md +45 -9
  24. package/adapters/hermes/skills/flow-bug-investigate/SKILL.md +1 -1
  25. package/adapters/hermes/skills/flow-bug-start/SKILL.md +5 -5
  26. package/adapters/hermes/skills/flow-doctor/SKILL.md +1 -1
  27. package/adapters/hermes/skills/flow-feat-start/SKILL.md +5 -5
  28. package/adapters/hermes/skills/flow-work-README/SKILL.md +1 -1
  29. package/adapters/hermes/skills/flow-work-abandon/SKILL.md +1 -1
  30. package/adapters/hermes/skills/flow-work-handoff/SKILL.md +57 -7
  31. package/adapters/hermes/skills/flow-work-resume/SKILL.md +1 -1
  32. package/adapters/hermes/skills/flow-work-run/SKILL.md +3 -2
  33. package/adapters/hermes/skills/flow-work-watch/SKILL.md +1 -1
  34. package/adapters/opencode/CORE.md +45 -9
  35. package/adapters/opencode/commands/flow-bug-investigate.md +1 -1
  36. package/adapters/opencode/commands/flow-bug-start.md +5 -5
  37. package/adapters/opencode/commands/flow-doctor.md +1 -1
  38. package/adapters/opencode/commands/flow-feat-start.md +5 -5
  39. package/adapters/opencode/commands/flow-work-README.md +1 -1
  40. package/adapters/opencode/commands/flow-work-abandon.md +1 -1
  41. package/adapters/opencode/commands/flow-work-handoff.md +57 -7
  42. package/adapters/opencode/commands/flow-work-resume.md +1 -1
  43. package/adapters/opencode/commands/flow-work-run.md +3 -2
  44. package/adapters/opencode/commands/flow-work-watch.md +1 -1
  45. package/bin/cli.mjs +55 -17
  46. package/package.json +1 -1
  47. package/plugins/flow/.claude-plugin/plugin.json +1 -1
  48. package/plugins/flow/CHANGELOG.md +38 -0
  49. package/plugins/flow/examples/FLOW.template.md +1 -1
@@ -51,8 +51,8 @@ its reason file in a `mktemp -d` directory (flow-core §2.1).
51
51
  - Read the effective FLOW configuration per flow-core §0; no FLOW layer present → each
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
- - **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: 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`.
54
+ - **Determine the mode** (`--study` already taken out): `{{args}}` non-empty → *ticket mode* (identifier = the canonical ticket of `{{args}}`, flow-core §0 — `#54`, `owner/repo#54` or this repository's issue URL is `54`; anything else as typed — and one that cannot name a branch or a folder (`[A-Za-z0-9][A-Za-z0-9._-]*`: another repository's reference, a PR/MR, a space inside) → refuse in one line, before any branch or folder exists); empty → *ticket-less* (identifier = the §2.5 slug).
55
+ - Once the identifier is known, check the work does not exist: in both work-folder locations (flow-core §0); ticket mode → every `meta.json` in those folders (`_archive/` excluded) whose `ticket`, put in the same canonical form, equals `<TICKET>` — never narrowed by folder name first: a work stored as `#54` lives in `#54-<slug>/` and is the work for `54`; 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).
@@ -64,7 +64,7 @@ Derive the slug **once** — after the title is known (§2), or in §2.5.2 — a
64
64
 
65
65
  **In parallel**:
66
66
 
67
- 1. **Tracker** *(ticket mode only)*: `tracker.tool` not `none` → read the ticket with `tracker.view_cmd` (`{TICKET}` substituted): title, description, acceptance criteria. **Read it whole, comment thread included — §2.1.** `tool` `none`/empty or command fails → ask the user to paste the ticket and continue. Ticket-less → skip; §2.5 supplies title/description/criteria.
67
+ 1. **Tracker** *(ticket mode only)*: `tracker.tool` not `none` → read the ticket with `tracker.view_cmd` (`{TICKET}` = the canonical identifier of §1, never `{{args}}` as typed): title, description, acceptance criteria. **Read it whole, comment thread included — §2.1.** `tool` `none`/empty or command fails → ask the user to paste the ticket and continue. Ticket-less → skip; §2.5 supplies title/description/criteria.
68
68
  2. **Knowledge search**: `knowledge.search` set → `knowledge.search` with the ticket title and keywords. No answer in 2 s or failure → continue without it.
69
69
  3. **Git**: check you are on a clean branch. Uncommitted changes → warn, do not block.
70
70
 
@@ -114,7 +114,7 @@ An **outward-facing action → always ask, in every autonomy mode** (like the MR
114
114
  - `glab` → `glab issue create --title "<title>" --description "<summary + criteria + repos affected>"`
115
115
  - `acli` (Jira) / `linear` → the tool's create command; if unclear, ask the user to create it and paste the id.
116
116
 
117
- Capture the returned id. **From here the run is in ticket mode**: identifier = that id, work dir = `.claude/work/<id>/`, branch naming uses the real id (so §5.5 applies). Creation fails → warn, fall back to local-only with the slug.
117
+ Capture the returned id in canonical form (flow-core §0 — the number of the URL `gh`/`glab` print). **From here the run is in ticket mode**: identifier = that id, work dir = `.claude/work/<id>/`, branch naming uses the real id (so §5.5 applies). Creation fails → warn, fall back to local-only with the slug.
118
118
  - **No** → local-only: identifier stays the slug, no issue created (by hand or a later `start`).
119
119
  - `tracker.tool` `none`/empty → skip the offer; local-only with the slug.
120
120
 
@@ -237,7 +237,7 @@ Create the work directory where flow-core §0 puts a new one (the main checkout,
237
237
  ### `meta.json`
238
238
  ```json
239
239
  {
240
- "ticket": "<identifier: {{args}} in ticket mode; the slug or created issue id in ticket-less mode>",
240
+ "ticket": "<identifier: the canonical ticket of {{args}} in ticket mode; the slug or created issue id in ticket-less mode>",
241
241
  "slug": "<the §1/§2.5.2 kebab-case slug; equals `ticket` in ticket-less local-only>",
242
242
  "type": "feat",
243
243
  "title": "<ticket title>",
@@ -160,7 +160,7 @@ This system **orchestrates** the project's existing sub-agents and skills (it do
160
160
 
161
161
  - **`candidate_sha` / `reviewed_sha` / `fixed_sha` / `validated_sha`**: which code each verdict is about. `candidate_sha` is written by `review` in its **pre-flight** (§1.5) — the revision it froze before reading anything, `git rev-parse HEAD` over a clean tree and `git stash create` over a dirty one, anchored at `refs/flow/candidate/<TICKET>` so nothing collects it. The other three are written at `## Close`, **only when the phase actually advances**, work-level and in the current `mrs[]` entry: `reviewed_sha` is the candidate that was actually read, `fixed_sha` is `HEAD` after that round's own fixes (empty when it applied none), `validated_sha` is where the suite went green.
162
162
  - **`review_findings[]`**: one row per finding, after the review's dedup — `{ round, mr?, sources, severity, file, outcome }`, no finding text (that stays in `06-review.md`). `sources` lists every origin that raised it, from a closed list (`built-in` · `panel:<role>` · `reinforcement:<area>` · `sweep` · `query-duel` · `yagni` · `contract` · `idiom`); `outcome` is `fixed` · `open` · `rejected` · `discarded` · `deferred`. The same round writes one `cost[]` entry with `round`, `tier`, `effective_size` and `agents` — every pass it launched, findings or not. Only `flow record-review --file` writes them — once per round, the CLI panel's roles included — and it refuses any value outside those lists, or a source that is not among the round's `agents`: six weeks of hand-written origins had produced ~65 spellings. Rows from before that, `{ round, origin, severity, file, discarded_by_skeptic }` one per source, stay as they are. It exists so a pass can be retired on evidence: `flow yield [<repo-path>…]` reads every work those repos hold — live and `_archive/`, here and in the main checkout — and reports per origin and per size how many rounds each ran, how many findings it contributed, how many **only** it raised, and how many of those were acted on (for the older rows: not refuted by a skeptic) — and a finding three sources raised says nothing about any of them, which is why dedup keeps every source rather than the first. The rule was written down before the data arrived: no unique accepted finding across twenty rounds at a size (XS and S pooled) and the pass comes out of the command at that size.
163
- - **`escape`** (bug works only): `{ work, ticket, commit, file, size }` — the reviewed work the root-cause commit belongs to, written by `flow escape` at `bug:investigate`'s Close, and only when the commit sits inside exactly one work's reviewed range (merge history) or carries the number of exactly one reviewed MR/PR (squash). `flow yield` prints `escapes: <n>` under the table of that work's size: what a lighter review at that size has already let through.
163
+ - **`escape`** (bug works only): `{ work, ticket, commit, file, size }` — the reviewed work the root-cause commit belongs to, written by `flow escape` at `bug:investigate`'s Close, and only when the commit sits inside exactly one work's reviewed range (merge history) or names exactly one reviewed MR/PR (squash) — in its own message, or in the GitLab merge that carried it in. `flow yield` prints `escapes: <n>` under the table of that work's size: what a lighter review at that size has already let through.
164
164
  Two fields for the review because they are two facts. `reviewed_sha` used to be `git rev-parse HEAD` at the end of the phase, which by then held the round's own fixes — so `ship` compared a sha against itself and reported a match over code no reviewer had read. Read by `ship` at pre-flight against `HEAD`: a delta of test files and this work's own folder passes with a note in `06-review.md`; anything else stops and asks in every autonomy mode. Empty is not a mismatch; `fixed_sha` set with `reviewed_sha == HEAD` is one. `review` also reads `reviewed_sha` back as **its own base** on a re-review, so the second round reads the delta instead of the whole branch.
165
165
  - **`respond_rounds`**: rounds of `/flow:work:respond` on an MR/PR. `/flow:work:respond §1` reads it against `quality.respond_max_rounds` (empty = 3) and refuses the round that would exceed it, handing the open threads back to the user.
166
166
  - **`roadmap`**: the roadmap item this work delivers (flow-core §10). Linked at `/flow:feat:start §3.7`, marked in progress / done by `/flow:feat:ship` inside the MR/PR, shown by `next`/`daily`/`resume` — which also flag an item the code delivered but the file still does not mark. `null` with no roadmap, no link, or a bug. With the project plan on (flow-core §10.1) it may also carry `milestone` and `deliverable` — the plan's ids for the deliverable whose ticket cell names this work's ticket — which the panel copies so the board hangs this console from it; absent when the ticket is in no row.
@@ -22,7 +22,7 @@ Clean closure for works that will not reach the base branch: a feature discarded
22
22
 
23
23
  ## 1. Pre-flight
24
24
 
25
- - Locate the active `meta.json` by current branch; not found → ask the user for the ticket.
25
+ - Locate the active `meta.json` by current branch; not found → ask the user for the ticket, and find the `meta.json` whose `ticket`, canonical too, equals it (flow-core §0, the ticket).
26
26
  - `phase` already `done` → do not abandon: notify and stop (finished works are archived, not abandoned).
27
27
  - Read `meta.json` and `00-summary.md`; open the existing artifacts in full only where the summary does not say what was done (missing summary → read the artifacts).
28
28
 
@@ -28,10 +28,12 @@ ticket for the people who review it.
28
28
 
29
29
  - Effective FLOW configuration per flow-core §0. `autonomy.mode: unattended` → refuse in one line:
30
30
  an unattended run never pushes (flow-core §2.1); handing off is a person's step.
31
- - Locate the active `meta.json` by current branch; not found → ask the user for the ticket.
31
+ - Locate the active `meta.json` by current branch; not found → ask the user for the ticket, and find the `meta.json` whose `ticket`, canonical too, equals it (flow-core §0, the ticket).
32
32
  - `git.handoff_branch` empty → refuse, naming the key and an example
33
33
  (`git.handoff_branch: study/{TICKET}`): where the study goes is the receiver's convention, never
34
- flow's guess. `{TICKET}` = `meta.json.ticket`.
34
+ flow's guess. `{TICKET}` is the canonical ticket (flow-core §0, the ticket) that §3's resolve
35
+ block prints from `meta.json.ticket` — never `meta.json.ticket` as stored: a work started from
36
+ `#54` or from the issue's URL still goes to `study/54`.
35
37
  - `origin` not configured → refuse; there is nowhere to push.
36
38
 
37
39
  ## 2. Is the study finished?
@@ -62,15 +64,60 @@ work included) and the working tree are never read into it nor written to, and a
62
64
  **Each block below is one shell call, run as it stands** — a harness need not keep variables from
63
65
  one call to the next, so every block sets its own. Replace each `@…@` with its literal value first:
64
66
  `@WORK@` the work folder relative to the repository root (`.claude/work/<work-dir>`, no trailing
65
- slash), `@BRANCH@` the resolved `git.handoff_branch`, `@TICKET@` `meta.json.ticket`, `@COMMIT@` the
66
- sha the build block printed. A value holding a `'` cannot go inside those quotes: refuse it and
67
- say which.
67
+ slash), `@BRANCH@` and `@TICKET@` the values after `branch=` and `ticket=` in what the resolve
68
+ block printed — `study/54`, never `branch=study/54` —, `@COMMIT@` the sha the build block printed. A value holding a `'` — `@STORED@` and `@PATTERN@` below included — cannot go inside those quotes:
69
+ refuse it and say which.
70
+
71
+ First, where the study goes. `@STORED@` is `meta.json.ticket` as stored, `@PATTERN@`
72
+ `git.handoff_branch` as written, `{TICKET}` and all:
73
+
74
+ ```bash handoff-resolve
75
+ STORED='@STORED@'; PATTERN='@PATTERN@'
76
+ t=$(printf '%s' "$STORED" | sed 's/^[[:space:]]*//; s/[[:space:]]*$//')
77
+ lc=$(printf '%s' "$t" | tr 'A-Z' 'a-z')
78
+ o=$(git config --get remote.origin.url | tr 'A-Z' 'a-z')
79
+ case "$o" in
80
+ *://*) here=$(printf '%s' "$o" | sed -E 's|^[a-z+]+://||; s|^[^@/]*@||; s|^([^/]+):[0-9]+/|\\1/|') ;;
81
+ *) here=$(printf '%s' "$o" | sed -E 's|^[^@/]*@||; s|:|/|') ;;
82
+ esac
83
+ here=$(printf '%s' "$here" | sed -E 's|/+$||; s|\\.git$||; s|^www\\.||')
84
+ n=
85
+ case "$lc" in
86
+ '#'*) n=${lc#'#'} ;;
87
+ *://*|*/issues/*|*/work_items/*)
88
+ u=$(printf '%s' "$lc" | sed -E 's|^[a-z+]+://||; s|^[^@/]*@||; s|^([^/]+):[0-9]+/|\\1/|; s|^www\\.||; s|[?#].*$||; s|/+$||')
89
+ case "${here%%/*}" in *.*)
90
+ case "${u#"$here"/}" in issues/*/*|-/issues/*/*|-/work_items/*/*) ;;
91
+ issues/*|-/issues/*|-/work_items/*) n=${u##*/} ;; esac ;; esac ;;
92
+ */*'#'*) [ "${lc%'#'*}" = "${here#*/}" ] && n=${lc##*'#'} ;;
93
+ esac
94
+ [ -n "$n" ] || case "$lc" in *[!0-9]*) ;; *) n=$lc ;; esac
95
+ case "$n" in ''|*[!0-9]*) ;; *) n=$(printf '%s' "$n" | sed 's/^0*//'); t=${n:-0} ;; esac
96
+ case "$t" in [A-Za-z0-9]*) ;; *) echo "not a ticket id: $STORED"; exit 1 ;; esac
97
+ case "$t" in *[!A-Za-z0-9._-]*) echo "not a ticket id: $STORED"; exit 1 ;; esac
98
+ branch=$(printf '%s' "$PATTERN" | sed "s|{TICKET}|$t|g")
99
+ case "$branch" in *'{'*|*'}'*) echo "git.handoff_branch has a placeholder other than {TICKET}: $PATTERN"; exit 1 ;; esac
100
+ git check-ref-format --branch "$branch" >/dev/null 2>&1 || { echo "not a branch name: $branch"; exit 1; }
101
+ echo "ticket=$t"; echo "branch=$branch"
102
+ ```
68
103
 
69
- First, the branch must not exist on `origin` — a second push would need a force, and this command
104
+ It turns a reference to this repository's issue into its number and keeps anything else as typed
105
+ (flow-core §0, the ticket). `origin`'s host is compared too; when it is an SSH alias with no dot in
106
+ it (`github-work`, `gh`), no URL can be matched against it and only `#N` and `owner/repo#N` are
107
+ read as this repository's. A refusal stops the command, quoting its
108
+ line: a pull or merge request, another repository's issue, an id with a space or a shell character
109
+ inside, a placeholder other than `{TICKET}`. The way on, for a mistyped id, is to correct
110
+ `meta.json.ticket` and hand off again; a study whose ticket really is **another repository's
111
+ issue** (a sibling repo's work, a fork whose issues live upstream) has no branch this command can
112
+ name — say so, and leave where it goes to the person: never rewrite it as an issue of this
113
+ repository, whose `Closes` would then close the wrong one.
114
+
115
+ Then the branch must not exist on `origin` — a second push would need a force, and this command
70
116
  never forces:
71
117
 
72
118
  ```bash handoff-check
73
119
  BRANCH='@BRANCH@'
120
+ case "$BRANCH" in ''|branch=*) echo "not a resolved branch: $BRANCH"; exit 1 ;; esac
74
121
  git ls-remote --exit-code origin "refs/heads/$BRANCH" >/dev/null; echo "rc=$?"
75
122
  ```
76
123
 
@@ -80,6 +127,7 @@ continue. Anything else → stop and say why (no network, no access). Then build
80
127
 
81
128
  ```bash handoff-build
82
129
  WORK='@WORK@'; TICKET='@TICKET@'
130
+ case "$TICKET" in ''|ticket=*) echo "not a resolved ticket: $TICKET"; exit 1 ;; esac
83
131
  cd "$(git rev-parse --show-toplevel)" || exit 1
84
132
  [ -d "$WORK" ] || { echo "no such folder: $WORK"; exit 1; }
85
133
  tmp=$(mktemp -d) || exit 1
@@ -116,6 +164,7 @@ before writing the first line of it.
116
164
 
117
165
  ```bash handoff-push
118
166
  BRANCH='@BRANCH@'; COMMIT='@COMMIT@'
167
+ case "$BRANCH" in ''|branch=*) echo "not a resolved branch: $BRANCH"; exit 1 ;; esac
119
168
  case "$COMMIT" in ''|*[!0-9a-f]*) echo "not a commit sha: $COMMIT"; exit 1 ;; esac
120
169
  git cat-file -e "$COMMIT^{commit}" || exit 1
121
170
  git push origin "$COMMIT:refs/heads/$BRANCH"
@@ -182,7 +231,8 @@ the ticket read it there, never in the work folder; the receiver does not parse
182
231
 
183
232
  ## 6. Close
184
233
 
185
- Report following flow-core §3: the branch and the commit, the file count, whether the ticket
234
+ Report following flow-core §3: the exact remote branch (`origin/<branch>`, as the resolve block
235
+ printed it) and the commit, the file count, whether the ticket
186
236
  summary was written. Refresh the panel: a `Now` line saying the study was handed off, no `Decision`
187
237
  line. `meta.json` gains nothing — the branch on `origin` is the record, and the §3 refusal reads it.
188
238
  """
@@ -28,7 +28,7 @@ reads where the run got to, not how the run continues.
28
28
 
29
29
  - `git branch --show-current`.
30
30
  - Find the work for this branch (flow-core §0: both work-folder locations, `branch`, `mrs[].branch` or `worktree`).
31
- - None found → ask the user for the ticket or whether to start a new one.
31
+ - None found → ask the user for the ticket or whether to start a new one; a ticket given finds the `meta.json` whose `ticket`, canonical too, equals it (flow-core §0, the ticket) — never a folder-name glob.
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
 
34
34
  ## 2. Recap
@@ -23,7 +23,7 @@ Read `~/.claude/flow/CORE.gemini.md` first (shared rules: `FLOW.md` step 0, auto
23
23
  The command an orchestrator puts in its launch line, for every run of every ticket. It does no work
24
24
  of its own: it asks the orchestrator why this run exists and hands the run to the phase that
25
25
  answers it. `{{args}}` is the ticket, optional — the orchestrator's `ticket` order is the source
26
- of truth, and an argument that disagrees with it is ignored and named in the log.
26
+ of truth, and an argument whose canonical form (flow-core §0, the ticket) disagrees with it is ignored and named in the log.
27
27
 
28
28
  ## 1. Pre-flight
29
29
 
@@ -37,7 +37,8 @@ of truth, and an argument that disagrees with it is ignored and named in the log
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
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.
40
+ checkout) whose `ticket`, put in canonical form (flow-core §0, the ticket), equals `number`
41
+ (archive excluded) — a work stored as `#54` is the work for `54`. None is not an error — it is the "none" of the table below.
41
42
 
42
43
  ## 2. Route
43
44
 
@@ -41,7 +41,7 @@ If `knowledge.search` is set, call `knowledge.search` with the ticket name befor
41
41
 
42
42
  ## 1. Pre-flight and T0
43
43
 
44
- - Resolve the ticket from `{{args}}`. A work in `.claude/work/` (glob `<TICKET>/` and `<TICKET>-*/`, or match `meta.json.ticket`) → read its `meta.json` **as a hint, not as truth**.
44
+ - Resolve the ticket from `{{args}}`, in canonical form (flow-core §0). A work in `.claude/work/` (a `meta.json` whose `ticket`, canonical too, equals it) → read its `meta.json` **as a hint, not as truth**.
45
45
  - **Confirm WHAT is being deployed — never assume it from `meta.json`** (several MR/PRs per ticket; stale artifacts). Cross-reference the **actual deploy event** (e.g. `get_change_stories`) and recent merges; any ambiguity → `AskUserQuestion` which MR/PR or commit is deploying. The surface (§2) is scoped to **that** change.
46
46
  - **When to start.** When the code **is live in production**, not at merge. Launched right after the merge → **wait for the deploy yourself**:
47
47
  - Check whether the new version is live (`observability.deploy_detect`; empty → `get_change_stories` or other deploy indicators).
@@ -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.116.1`.** Compare it once, at the start of the session, against
20
+ **This file belongs to flow `0.118.0`.** 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
@@ -101,6 +101,23 @@ a command relies on is simply absent in that session, and nothing else will repo
101
101
  `meta.json` in those folders (`_archive/` excluded) whose `branch` or any `mrs[].branch` equals
102
102
  `git branch --show-current`, or whose `worktree` equals `git rev-parse --show-toplevel`. The
103
103
  SessionStart hook matches the same way.
104
+ - **The ticket has one form, and `meta.json.ticket` holds it.** A person types an issue however it
105
+ comes to hand — `54`, `#54`, `owner/repo#54`, the issue's URL — and every `{TICKET}` downstream
106
+ (a branch, a handoff branch, `Closes #<N>`, a tracker command, the unattended run's lookup by
107
+ `number`) needs one value. **A reference to an issue of this repository** — the one `origin`
108
+ names, host and path compared without case — **is its bare number**, leading zeros dropped (a
109
+ bare `054` too):
110
+ `#054`, `owner/repo#54`, `…/issues/54`, `…/-/issues/54` and `…/-/work_items/54` all become `54`,
111
+ whatever `tracker.tool` says. **Anything else is kept as typed**, only its ends trimmed: a slug,
112
+ a Jira or Linear key (`MT-123`), a free-form id, another repository's reference. Where a value
113
+ meets a shell or names a branch it must match `[A-Za-z0-9][A-Za-z0-9._-]*` — the rule
114
+ `ticket_deps` already applies — so a pull or merge request (`/pull/54`, `!54`), another
115
+ repository's reference or an id with a space inside is refused there — by `start` before a
116
+ branch or folder exists, by the handoff before a push — never stripped into something else. `start` stores this form (an issue it creates included: the number of the URL
117
+ the tracker prints); every lookup by a ticket — `start`'s duplicate check, `/flow-work-run`, a
118
+ ticket typed to `resume` or `watch`, a roadmap row's ticket cell (§10.1) — compares canonical forms on both sides, and
119
+ `/flow-work-handoff`'s resolve block canonicalises whatever `meta.json` holds, so a work stored
120
+ as `#54` is still found and still handed off to `…/54`.
104
121
  - **A fenced block in a FLOW file is an example, and an example is not configuration.** These
105
122
  files are prose with keys in them, and the rule that decides what a key *is* — a `- key:` line
106
123
  under a `## section` — knows nothing about triple backticks. So a block written to be pasted
@@ -716,8 +733,13 @@ user answers the harness's question tool (`AskUserQuestion`, Codex's `request_us
716
733
  input holds a `decision`, the hook copies the input aside as answered (`panel-answered.json`) and
717
734
  renders: while the input is still that copy, its `decision` and `wait` claim nobody. Your input is
718
735
  never rewritten — the next one you write is newer than the answer and asks again. A question left
719
- unanswered, rejected or timed out changes nothing. The hook cannot reach
720
- the terminal's MCP tools, which is what `panel.publish_cmd` is for (§4.2).
736
+ unanswered, rejected or timed out changes nothing. That render reaches `panel.json` and
737
+ `panel.publish_cmd` only — a terminal holding the pane over its MCP reads neither (§4.2) — so under
738
+ Claude Code the hook also prints, after the answer, a reminder addressed to you: where the panel
739
+ goes over the terminal's MCP or to the control-room card, republish now, without the `decision`. That republish is yours (§4.4 e). On a branch that names no work — a session
740
+ in the main checkout driving a sibling worktree — the reminder names no work and nothing is copied:
741
+ every session there reports the same checkout and branch, and the hook cannot tell whose work is
742
+ whose.
721
743
 
722
744
  **The CLI unavailable** — no network for npx, a sandbox that blocks it, a non-zero exit with no
723
745
  document — → write the §4.1 document yourself, once, by its rules, and say so at the next stop:
@@ -735,11 +757,11 @@ instead of it.
735
757
 
736
758
  **Look for the tools before you conclude they are missing**, once per session, in pre-flight. A
737
759
  harness namespaces an MCP server's tools, so what you are looking for is a tool whose name *ends* in
738
- `panel_set` — `mcp__panel__panel_set` on Claude Code, another prefix elsewhere. It may also be
760
+ `panel_set` — `mcp__ivy__panel_set` on Claude Code inside an Ivy pane, another prefix elsewhere. It may also be
739
761
  **deferred**: listed by name with no schema, uncallable until you load it, and indistinguishable from
740
762
  absent unless you read that list. A deferred tool is a tool that is there; load the schemas and
741
- publish. A tool that answers that this console is not one of its panes → the file is the transport
742
- for the rest of the session.
763
+ publish. A `panel_get` that answers is the proof that the channel works; a tool that answers that
764
+ this console is not one of its panes → the file is the transport for the rest of the session.
743
765
 
744
766
  ### 4.1 The document — what the CLI prints, and what you write when it cannot
745
767
 
@@ -806,6 +828,17 @@ writes it, and drops it from a document it read back with `panel_get` before pub
806
828
  - **A hook cannot call these tools.** Where the reader is a terminal like this one, the person sets
807
829
  `panel.publish_cmd`, in a git-ignored FLOW file, to whatever command that terminal offers for
808
830
  publishing a document from a shell; the CLI pipes every render into it, the hook's included.
831
+ A terminal may still refuse that shell publication while the agent holds the pane: then the
832
+ agent is the only party that can clear a claim, and the hook's reminder after an answer (§4) is
833
+ what tells it to.
834
+ - **The rest of the terminal's MCP — what flow does with it.** `plan_set` / `plan_get` publish the
835
+ roadmap as the project's plan (§10.1); `plan_retire` is the person's. `panel_retire` is never
836
+ called: it removes the document and its `done` — the closing signal the person reads when they
837
+ come back — and also closes the auxiliary consoles of the connection, and the terminal admits it
838
+ only from the connection that holds the pane, as the end of that session, not of a work.
839
+ `split_open` / `split_read` / `split_close` are never called: flow delegates to subagents, whose
840
+ results come back as files it can read, never to consoles beside the pane, whose handle stops
841
+ answering the moment the person types into them.
809
842
  - **Optional — buttons at a stop.** At a stop parked on the user, `actions` (up to 8) paint a button
810
843
  whose command is written into this pane's program on one click — this very session's prompt. Add
811
844
  them to the printed document before `panel_set`: `{"label": "Approve the design", "send":
@@ -826,8 +859,11 @@ halfway is not shown as finished. When the stretch will outlast the ~30 min stal
826
859
  `meta.json`; (e) **the moment a question is answered or a gate is cleared** — before you resume the
827
860
  work: drop `decision` from the input, move `now` on, render. A panel still asking what the user
828
861
  already answered is worse than one that never asked. Where the hook runs, an answer
829
- given through the question tool already did it; a question asked in prose, or a gate cleared
830
- another way, did not; (f) **each plan step that lands** — tick it in
862
+ given through the question tool already rendered the files of the work your branch names (on a
863
+ branch that names none, nothing — §4) — but over the terminal's MCP the claim goes only when you
864
+ republish, so that republish is **the first call after the answer**, before any
865
+ work (the hook's output says so under Claude Code). A question asked in prose, or a gate cleared
866
+ another way, rendered nothing; (f) **each plan step that lands** — tick it in
831
867
  the phase artifact, move `now` on, render without `--forge`. Where the plugin's hook runs, the tick
832
868
  and the input change already rendered it; publish over the tools anyway when they are there.
833
869
 
@@ -1597,7 +1633,7 @@ file again — each publication is the file it was read from, never a merge of s
1597
1633
  document and `repo` the checkout the file was read from.
1598
1634
 
1599
1635
  **Where this console works.** The same moment, from a work's checkout (`start`, `ship`): the rows
1600
- whose ticket cell names `meta.json.ticket` decide it. One row → write its milestone's `id` and the
1636
+ whose ticket cell names `meta.json.ticket`, both in canonical form (§0, the ticket), decide it. One row → write its milestone's `id` and the
1601
1637
  row's `id` into `meta.json.roadmap` as `milestone` and `deliverable`; several → the one
1602
1638
  `meta.json.roadmap.item` names, else `milestone` alone when they share one, else neither. No row →
1603
1639
  neither, and remove them if an earlier publication wrote them: the panel then carries no place, and
@@ -231,7 +231,7 @@ If `knowledge.stage` is set and the root cause reveals a **non-obvious "why"** a
231
231
  ## 8. Close
232
232
 
233
233
  - Update `meta.json`: `phase = "investigate"`, add to `phases_done`.
234
- - **Did a flow review let it through?** With a suspected commit named under "Evidence", run `npx flow-workflows@<version> escape <commit> --file <the file the root cause is in>` from the work's checkout (`<version>` = this plugin's own, from `~/.claude/flow/.claude-plugin/plugin.json`). It records `meta.json.escape` only when the commit sits inside exactly one work's reviewed range, or carries the number of exactly one reviewed MR/PR; anything less it says and records nowhere. Copy its line under "Why tests/CI did not catch it". No suspected commit, or the CLI unavailable → say so there in one line; never write `escape` by hand. Asks nothing: it is a reading, and `flow yield` is what counts it.
234
+ - **Did a flow review let it through?** With a suspected commit named under "Evidence", run `npx flow-workflows@<version> escape <commit> --file <the file the root cause is in>` from the work's checkout (`<version>` = this plugin's own, from `~/.claude/flow/.claude-plugin/plugin.json`). It records `meta.json.escape` only when the commit sits inside exactly one work's reviewed range, or names exactly one reviewed MR/PR — itself, or through the merge that carried it in; anything less it says and records nowhere. Copy its line under "Why tests/CI did not catch it". No suspected commit, or the CLI unavailable → say so there in one line; never write `escape` by hand. Asks nothing: it is a reading, and `flow yield` is what counts it.
235
235
  - Overwrite `00-summary.md` whole (≤15 lines, flow-core §5).
236
236
  - Suggest `/flow-bug-fix` — `meta.json.handoff` set and not `unattended` → `/flow-work-handoff` in its place, **Hand off the study** recommended and **Build here** second where it asks (flow-core §2, a study made for handoff).
237
237
  - **Autonomy handoff** (`autonomy.mode`, flow-core §2): `manual` → propose `/flow-bug-fix` with a single `AskUserQuestion`, invoke it only on confirmation; `guided`/`auto` → chain into it in this same turn. Either way: `meta.json.handoff` set and not `unattended` → `/flow-work-handoff` in its place, **Hand off the study** recommended and **Build here** second where it asks (flow-core §2, a study made for handoff).
@@ -48,8 +48,8 @@ Read `~/.claude/flow/CORE.hermes.md` first (shared rules: `FLOW.md` step 0, mode
48
48
  **In `unattended`, before this phase's first step, read flow-core §2.1 whole — from its heading to the next section, unless it is already in your context whole; having read parts of it does not count** — the orchestrator command, the question stop and the way its answer comes back are all in it, and a phase that reads only part of it skips them.
49
49
 
50
50
  - Verify you are in the correct repo.
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: 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
+ - **Determine the mode** from `$ARGUMENTS` (`--study` already taken out): non-empty → *ticket mode* (identifier = the canonical ticket of `$ARGUMENTS`, flow-core §0 — `#54`, `owner/repo#54` or this repository's issue URL is `54`; anything else as typed — and one that cannot name a branch or a folder (`[A-Za-z0-9][A-Za-z0-9._-]*`: another repository's reference, a PR/MR, a space inside) → refuse in one line, before any branch or folder exists); empty → *ticket-less mode* (identifier = the slug resolved in §1.5).
52
+ - Once the identifier is known, check whether the work already exists: in both work-folder locations (flow-core §0); ticket mode → every `meta.json` in those folders (`_archive/` excluded) whose `ticket`, put in the same canonical form, equals `<TICKET>` — never narrowed by folder name first: a work stored as `#54` lives in `#54-<slug>/` and is the work for `54`; 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:
@@ -62,7 +62,7 @@ Derive the slug **once** — after the symptom is known (§1), or in §1.5.2 —
62
62
 
63
63
  In parallel:
64
64
 
65
- 1. **Tracker** *(ticket mode only)*: read it with `tracker.view_cmd` from FLOW.md (`{TICKET}` = `$ARGUMENTS`). **Read it whole, comment thread included — §1.1.** If `tool:none` or the key is missing, ask the user for symptom, severity and environment. **Ticket-less mode: skip — §1.5 is the source of symptom/severity/environment.**
65
+ 1. **Tracker** *(ticket mode only)*: read it with `tracker.view_cmd` from FLOW.md (`{TICKET}` = the canonical identifier of §0, never `$ARGUMENTS` as typed). **Read it whole, comment thread included — §1.1.** If `tool:none` or the key is missing, ask the user for symptom, severity and environment. **Ticket-less mode: skip — §1.5 is the source of symptom/severity/environment.**
66
66
  2. **Knowledge search** (if `knowledge.search` is set): `knowledge.search` with keywords from the symptom — detect previous postmortems in the same area.
67
67
  3. **Observability**, if the incident is recent and you have clues (service, trace, log): the MCP tools of `observability.platform` from FLOW.md. Do not force it.
68
68
  4. **Git**: check clean branch and commit base.
@@ -108,7 +108,7 @@ Show the draft to the user and let them confirm or adjust **before writing anyth
108
108
  Creating a tracker issue is an **outward-facing action → always ask, in every autonomy mode** (never automatic):
109
109
 
110
110
  - If `tracker.tool` is not `none`, ask with `AskUserQuestion` whether to create the real issue from this draft.
111
- - **Yes** → the tool's native command, best-effort (`gh issue create`, `glab issue create`, the `acli`/`linear` create command; if unclear, ask the user to create it and paste the id). If §1.5.1 found **repos affected**, include them in the body under a short "Repos affected" heading. Capture the id. **From here the run is in ticket mode**: identifier = that id, work dir `.claude/work/<id>/`, branch named from the real id. If creation fails, warn and fall back to local-only with the slug.
111
+ - **Yes** → the tool's native command, best-effort (`gh issue create`, `glab issue create`, the `acli`/`linear` create command; if unclear, ask the user to create it and paste the id). If §1.5.1 found **repos affected**, include them in the body under a short "Repos affected" heading. Capture the id in canonical form (flow-core §0 — the number of the URL `gh`/`glab` print). **From here the run is in ticket mode**: identifier = that id, work dir `.claude/work/<id>/`, branch named from the real id. If creation fails, warn and fall back to local-only with the slug.
112
112
  - **No** → local-only: identifier stays the slug, no issue created.
113
113
  - If `tracker.tool` is `none` or empty, skip the offer and proceed local-only with the slug.
114
114
 
@@ -163,7 +163,7 @@ Create the work directory where flow-core §0 puts a new one (the main checkout,
163
163
  `<work-dir>/meta.json`:
164
164
  ```json
165
165
  {
166
- "ticket": "<identifier: $ARGUMENTS in ticket mode; the slug or created issue id in ticket-less mode>",
166
+ "ticket": "<identifier: the canonical ticket of $ARGUMENTS in ticket mode; the slug or created issue id in ticket-less mode>",
167
167
  "slug": "<the §0/§1.5.2 kebab-case slug; equals `ticket` in ticket-less local-only>",
168
168
  "type": "bug",
169
169
  "title": "<symptom from tracker, or synthesized in §1.5>",
@@ -225,7 +225,7 @@ refuse) · **degraded** (it runs, quietly worse than the config promises), plus
225
225
  `.agents/agents`, or a plugin. Report each missing name and that it falls back per flow-core §6.6 — the installed agent
226
226
  that fits, else `general-purpose` (a skill: skipped) — a panel missing agents reviews less and still reports a clean pass.
227
227
  - Harness cannot set a model per subagent → note that every `models.*` value degrades to inheritance.
228
- - **Where the live panel will go this session** (flow-core §4): a tool whose name ends in `panel_set` / `panel_patch` — namespaced by the harness (`mcp__panel__panel_set` on Claude Code) and possibly **deferred**, which reads as absent until the list of deferred tools is checked → the terminal draws the panel; genuinely absent → `panel.json` is the transport. Either way the panel CLI writes `panel.json`; with `panel.publish_cmd` set, one line with its value and the file it came from — a fault when that file is tracked by git, where the CLI refuses to run it. Neither is a fault — one line naming the tools as they are actually called here, or saying the file is the transport. With `roadmap.path` written out, one more line: whether a tool ending in `plan_set` is there, so the roadmap reaches the terminal's board as the project's plan (flow-core §10.1) — absent is not a fault either.
228
+ - **Where the live panel will go this session** (flow-core §4): a tool whose name ends in `panel_set` / `panel_patch` — namespaced by the harness (`mcp__ivy__panel_set` on Claude Code inside an Ivy pane) and possibly **deferred**, which reads as absent until the list of deferred tools is checked. Found → call its `panel_get` once: it answers (a document, or nothing published yet) → the channel works and the terminal draws the panel, said as *"panel: <server> answers for this console"*; it says this console is not one of its panes → `panel.json` is the transport, said so; any other error (a channel still starting, a timeout) → a fault, with the error: the panel falls back to `panel.json` until the channel answers. Genuinely absent → `panel.json` is the transport. Either way the panel CLI writes `panel.json`; with `panel.publish_cmd` set, one line with its value and the file it came from — a fault when that file is tracked by git, where the CLI refuses to run it. Neither is a fault — one line naming the tools as they are actually called here, or saying the file is the transport. With `roadmap.path` written out, one more line: whether a tool ending in `plan_set` is there, so the roadmap reaches the terminal's board as the project's plan (flow-core §10.1) — absent is not a fault either.
229
229
  - **The artifact mirror** (flow-core §4.6) — `panel.artifact` empty and the artifact tools here → one information line, not a fault: *control room off — `/flow-init room` turns it on*. Set: one line with its value and the file it came from; whether a tool whose name ends in `ArtifactData` is here (deferred counts); and, when it is, whether a `list` of collection `works` (limit 1) on that URL answers — a read, never a write. Tool present → also name the rule that keeps every card update from asking — `ArtifactData` (as the harness calls it) under `permissions.allow` — and its cost in the same line: it lets any session write to the data of any of your artifacts without asking, not only this page's; without it, each card update is approved by hand. The value coming from any file but `FLOW.claude.md` → a fault: the URL is one person's page, and a committed `FLOW.md` hands it to every teammate, whose writes it refuses. Key set and no tool → *off in this harness*, not a fault. The read failing → the error, as a fault. The read answering → also the page's version (`flow-room-page`, through an Artifact `read`) against the plugin's example: older or absent → one information line, *control room page out of date — the next card write republishes it*, not a fault.
230
230
 
231
231
  ### 2.3 Knowledge sources
@@ -55,8 +55,8 @@ its reason file in a `mktemp -d` directory (flow-core §2.1).
55
55
  - Read the effective FLOW configuration per flow-core §0; no FLOW layer present → each
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
- - **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: 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
+ - **Determine the mode** (`--study` already taken out): `$ARGUMENTS` non-empty → *ticket mode* (identifier = the canonical ticket of `$ARGUMENTS`, flow-core §0 — `#54`, `owner/repo#54` or this repository's issue URL is `54`; anything else as typed — and one that cannot name a branch or a folder (`[A-Za-z0-9][A-Za-z0-9._-]*`: another repository's reference, a PR/MR, a space inside) → refuse in one line, before any branch or folder exists); empty → *ticket-less* (identifier = the §2.5 slug).
59
+ - Once the identifier is known, check the work does not exist: in both work-folder locations (flow-core §0); ticket mode → every `meta.json` in those folders (`_archive/` excluded) whose `ticket`, put in the same canonical form, equals `<TICKET>` — never narrowed by folder name first: a work stored as `#54` lives in `#54-<slug>/` and is the work for `54`; 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).
@@ -68,7 +68,7 @@ Derive the slug **once** — after the title is known (§2), or in §2.5.2 — a
68
68
 
69
69
  **In parallel**:
70
70
 
71
- 1. **Tracker** *(ticket mode only)*: `tracker.tool` not `none` → read the ticket with `tracker.view_cmd` (`{TICKET}` substituted): title, description, acceptance criteria. **Read it whole, comment thread included — §2.1.** `tool` `none`/empty or command fails → ask the user to paste the ticket and continue. Ticket-less → skip; §2.5 supplies title/description/criteria.
71
+ 1. **Tracker** *(ticket mode only)*: `tracker.tool` not `none` → read the ticket with `tracker.view_cmd` (`{TICKET}` = the canonical identifier of §1, never `$ARGUMENTS` as typed): title, description, acceptance criteria. **Read it whole, comment thread included — §2.1.** `tool` `none`/empty or command fails → ask the user to paste the ticket and continue. Ticket-less → skip; §2.5 supplies title/description/criteria.
72
72
  2. **Knowledge search**: `knowledge.search` set → `knowledge.search` with the ticket title and keywords. No answer in 2 s or failure → continue without it.
73
73
  3. **Git**: check you are on a clean branch. Uncommitted changes → warn, do not block.
74
74
 
@@ -118,7 +118,7 @@ An **outward-facing action → always ask, in every autonomy mode** (like the MR
118
118
  - `glab` → `glab issue create --title "<title>" --description "<summary + criteria + repos affected>"`
119
119
  - `acli` (Jira) / `linear` → the tool's create command; if unclear, ask the user to create it and paste the id.
120
120
 
121
- Capture the returned id. **From here the run is in ticket mode**: identifier = that id, work dir = `.claude/work/<id>/`, branch naming uses the real id (so §5.5 applies). Creation fails → warn, fall back to local-only with the slug.
121
+ Capture the returned id in canonical form (flow-core §0 — the number of the URL `gh`/`glab` print). **From here the run is in ticket mode**: identifier = that id, work dir = `.claude/work/<id>/`, branch naming uses the real id (so §5.5 applies). Creation fails → warn, fall back to local-only with the slug.
122
122
  - **No** → local-only: identifier stays the slug, no issue created (by hand or a later `start`).
123
123
  - `tracker.tool` `none`/empty → skip the offer; local-only with the slug.
124
124
 
@@ -241,7 +241,7 @@ Create the work directory where flow-core §0 puts a new one (the main checkout,
241
241
  ### `meta.json`
242
242
  ```json
243
243
  {
244
- "ticket": "<identifier: $ARGUMENTS in ticket mode; the slug or created issue id in ticket-less mode>",
244
+ "ticket": "<identifier: the canonical ticket of $ARGUMENTS in ticket mode; the slug or created issue id in ticket-less mode>",
245
245
  "slug": "<the §1/§2.5.2 kebab-case slug; equals `ticket` in ticket-less local-only>",
246
246
  "type": "feat",
247
247
  "title": "<ticket title>",
@@ -164,7 +164,7 @@ This system **orchestrates** the project's existing sub-agents and skills (it do
164
164
 
165
165
  - **`candidate_sha` / `reviewed_sha` / `fixed_sha` / `validated_sha`**: which code each verdict is about. `candidate_sha` is written by `review` in its **pre-flight** (§1.5) — the revision it froze before reading anything, `git rev-parse HEAD` over a clean tree and `git stash create` over a dirty one, anchored at `refs/flow/candidate/<TICKET>` so nothing collects it. The other three are written at `## Close`, **only when the phase actually advances**, work-level and in the current `mrs[]` entry: `reviewed_sha` is the candidate that was actually read, `fixed_sha` is `HEAD` after that round's own fixes (empty when it applied none), `validated_sha` is where the suite went green.
166
166
  - **`review_findings[]`**: one row per finding, after the review's dedup — `{ round, mr?, sources, severity, file, outcome }`, no finding text (that stays in `06-review.md`). `sources` lists every origin that raised it, from a closed list (`built-in` · `panel:<role>` · `reinforcement:<area>` · `sweep` · `query-duel` · `yagni` · `contract` · `idiom`); `outcome` is `fixed` · `open` · `rejected` · `discarded` · `deferred`. The same round writes one `cost[]` entry with `round`, `tier`, `effective_size` and `agents` — every pass it launched, findings or not. Only `flow record-review --file` writes them — once per round, the CLI panel's roles included — and it refuses any value outside those lists, or a source that is not among the round's `agents`: six weeks of hand-written origins had produced ~65 spellings. Rows from before that, `{ round, origin, severity, file, discarded_by_skeptic }` one per source, stay as they are. It exists so a pass can be retired on evidence: `flow yield [<repo-path>…]` reads every work those repos hold — live and `_archive/`, here and in the main checkout — and reports per origin and per size how many rounds each ran, how many findings it contributed, how many **only** it raised, and how many of those were acted on (for the older rows: not refuted by a skeptic) — and a finding three sources raised says nothing about any of them, which is why dedup keeps every source rather than the first. The rule was written down before the data arrived: no unique accepted finding across twenty rounds at a size (XS and S pooled) and the pass comes out of the command at that size.
167
- - **`escape`** (bug works only): `{ work, ticket, commit, file, size }` — the reviewed work the root-cause commit belongs to, written by `flow escape` at `bug:investigate`'s Close, and only when the commit sits inside exactly one work's reviewed range (merge history) or carries the number of exactly one reviewed MR/PR (squash). `flow yield` prints `escapes: <n>` under the table of that work's size: what a lighter review at that size has already let through.
167
+ - **`escape`** (bug works only): `{ work, ticket, commit, file, size }` — the reviewed work the root-cause commit belongs to, written by `flow escape` at `bug:investigate`'s Close, and only when the commit sits inside exactly one work's reviewed range (merge history) or names exactly one reviewed MR/PR (squash) — in its own message, or in the GitLab merge that carried it in. `flow yield` prints `escapes: <n>` under the table of that work's size: what a lighter review at that size has already let through.
168
168
  Two fields for the review because they are two facts. `reviewed_sha` used to be `git rev-parse HEAD` at the end of the phase, which by then held the round's own fixes — so `ship` compared a sha against itself and reported a match over code no reviewer had read. Read by `ship` at pre-flight against `HEAD`: a delta of test files and this work's own folder passes with a note in `06-review.md`; anything else stops and asks in every autonomy mode. Empty is not a mismatch; `fixed_sha` set with `reviewed_sha == HEAD` is one. `review` also reads `reviewed_sha` back as **its own base** on a re-review, so the second round reads the delta instead of the whole branch.
169
169
  - **`respond_rounds`**: rounds of `/flow-work-respond` on an MR/PR. `/flow-work-respond §1` reads it against `quality.respond_max_rounds` (empty = 3) and refuses the round that would exceed it, handing the open threads back to the user.
170
170
  - **`roadmap`**: the roadmap item this work delivers (flow-core §10). Linked at `/flow-feat-start §3.7`, marked in progress / done by `/flow-feat-ship` inside the MR/PR, shown by `next`/`daily`/`resume` — which also flag an item the code delivered but the file still does not mark. `null` with no roadmap, no link, or a bug. With the project plan on (flow-core §10.1) it may also carry `milestone` and `deliverable` — the plan's ids for the deliverable whose ticket cell names this work's ticket — which the panel copies so the board hangs this console from it; absent when the ticket is in no row.
@@ -26,7 +26,7 @@ Clean closure for works that will not reach the base branch: a feature discarded
26
26
 
27
27
  ## 1. Pre-flight
28
28
 
29
- - Locate the active `meta.json` by current branch; not found → ask the user for the ticket.
29
+ - Locate the active `meta.json` by current branch; not found → ask the user for the ticket, and find the `meta.json` whose `ticket`, canonical too, equals it (flow-core §0, the ticket).
30
30
  - `phase` already `done` → do not abandon: notify and stop (finished works are archived, not abandoned).
31
31
  - Read `meta.json` and `00-summary.md`; open the existing artifacts in full only where the summary does not say what was done (missing summary → read the artifacts).
32
32
 
@@ -32,10 +32,12 @@ ticket for the people who review it.
32
32
 
33
33
  - Effective FLOW configuration per flow-core §0. `autonomy.mode: unattended` → refuse in one line:
34
34
  an unattended run never pushes (flow-core §2.1); handing off is a person's step.
35
- - Locate the active `meta.json` by current branch; not found → ask the user for the ticket.
35
+ - Locate the active `meta.json` by current branch; not found → ask the user for the ticket, and find the `meta.json` whose `ticket`, canonical too, equals it (flow-core §0, the ticket).
36
36
  - `git.handoff_branch` empty → refuse, naming the key and an example
37
37
  (`git.handoff_branch: study/{TICKET}`): where the study goes is the receiver's convention, never
38
- flow's guess. `{TICKET}` = `meta.json.ticket`.
38
+ flow's guess. `{TICKET}` is the canonical ticket (flow-core §0, the ticket) that §3's resolve
39
+ block prints from `meta.json.ticket` — never `meta.json.ticket` as stored: a work started from
40
+ `#54` or from the issue's URL still goes to `study/54`.
39
41
  - `origin` not configured → refuse; there is nowhere to push.
40
42
 
41
43
  ## 2. Is the study finished?
@@ -66,15 +68,60 @@ work included) and the working tree are never read into it nor written to, and a
66
68
  **Each block below is one shell call, run as it stands** — a harness need not keep variables from
67
69
  one call to the next, so every block sets its own. Replace each `@…@` with its literal value first:
68
70
  `@WORK@` the work folder relative to the repository root (`.claude/work/<work-dir>`, no trailing
69
- slash), `@BRANCH@` the resolved `git.handoff_branch`, `@TICKET@` `meta.json.ticket`, `@COMMIT@` the
70
- sha the build block printed. A value holding a `'` cannot go inside those quotes: refuse it and
71
- say which.
71
+ slash), `@BRANCH@` and `@TICKET@` the values after `branch=` and `ticket=` in what the resolve
72
+ block printed — `study/54`, never `branch=study/54` —, `@COMMIT@` the sha the build block printed. A value holding a `'` — `@STORED@` and `@PATTERN@` below included — cannot go inside those quotes:
73
+ refuse it and say which.
74
+
75
+ First, where the study goes. `@STORED@` is `meta.json.ticket` as stored, `@PATTERN@`
76
+ `git.handoff_branch` as written, `{TICKET}` and all:
77
+
78
+ ```bash handoff-resolve
79
+ STORED='@STORED@'; PATTERN='@PATTERN@'
80
+ t=$(printf '%s' "$STORED" | sed 's/^[[:space:]]*//; s/[[:space:]]*$//')
81
+ lc=$(printf '%s' "$t" | tr 'A-Z' 'a-z')
82
+ o=$(git config --get remote.origin.url | tr 'A-Z' 'a-z')
83
+ case "$o" in
84
+ *://*) here=$(printf '%s' "$o" | sed -E 's|^[a-z+]+://||; s|^[^@/]*@||; s|^([^/]+):[0-9]+/|\1/|') ;;
85
+ *) here=$(printf '%s' "$o" | sed -E 's|^[^@/]*@||; s|:|/|') ;;
86
+ esac
87
+ here=$(printf '%s' "$here" | sed -E 's|/+$||; s|\.git$||; s|^www\.||')
88
+ n=
89
+ case "$lc" in
90
+ '#'*) n=${lc#'#'} ;;
91
+ *://*|*/issues/*|*/work_items/*)
92
+ u=$(printf '%s' "$lc" | sed -E 's|^[a-z+]+://||; s|^[^@/]*@||; s|^([^/]+):[0-9]+/|\1/|; s|^www\.||; s|[?#].*$||; s|/+$||')
93
+ case "${here%%/*}" in *.*)
94
+ case "${u#"$here"/}" in issues/*/*|-/issues/*/*|-/work_items/*/*) ;;
95
+ issues/*|-/issues/*|-/work_items/*) n=${u##*/} ;; esac ;; esac ;;
96
+ */*'#'*) [ "${lc%'#'*}" = "${here#*/}" ] && n=${lc##*'#'} ;;
97
+ esac
98
+ [ -n "$n" ] || case "$lc" in *[!0-9]*) ;; *) n=$lc ;; esac
99
+ case "$n" in ''|*[!0-9]*) ;; *) n=$(printf '%s' "$n" | sed 's/^0*//'); t=${n:-0} ;; esac
100
+ case "$t" in [A-Za-z0-9]*) ;; *) echo "not a ticket id: $STORED"; exit 1 ;; esac
101
+ case "$t" in *[!A-Za-z0-9._-]*) echo "not a ticket id: $STORED"; exit 1 ;; esac
102
+ branch=$(printf '%s' "$PATTERN" | sed "s|{TICKET}|$t|g")
103
+ case "$branch" in *'{'*|*'}'*) echo "git.handoff_branch has a placeholder other than {TICKET}: $PATTERN"; exit 1 ;; esac
104
+ git check-ref-format --branch "$branch" >/dev/null 2>&1 || { echo "not a branch name: $branch"; exit 1; }
105
+ echo "ticket=$t"; echo "branch=$branch"
106
+ ```
72
107
 
73
- First, the branch must not exist on `origin` — a second push would need a force, and this command
108
+ It turns a reference to this repository's issue into its number and keeps anything else as typed
109
+ (flow-core §0, the ticket). `origin`'s host is compared too; when it is an SSH alias with no dot in
110
+ it (`github-work`, `gh`), no URL can be matched against it and only `#N` and `owner/repo#N` are
111
+ read as this repository's. A refusal stops the command, quoting its
112
+ line: a pull or merge request, another repository's issue, an id with a space or a shell character
113
+ inside, a placeholder other than `{TICKET}`. The way on, for a mistyped id, is to correct
114
+ `meta.json.ticket` and hand off again; a study whose ticket really is **another repository's
115
+ issue** (a sibling repo's work, a fork whose issues live upstream) has no branch this command can
116
+ name — say so, and leave where it goes to the person: never rewrite it as an issue of this
117
+ repository, whose `Closes` would then close the wrong one.
118
+
119
+ Then the branch must not exist on `origin` — a second push would need a force, and this command
74
120
  never forces:
75
121
 
76
122
  ```bash handoff-check
77
123
  BRANCH='@BRANCH@'
124
+ case "$BRANCH" in ''|branch=*) echo "not a resolved branch: $BRANCH"; exit 1 ;; esac
78
125
  git ls-remote --exit-code origin "refs/heads/$BRANCH" >/dev/null; echo "rc=$?"
79
126
  ```
80
127
 
@@ -84,6 +131,7 @@ continue. Anything else → stop and say why (no network, no access). Then build
84
131
 
85
132
  ```bash handoff-build
86
133
  WORK='@WORK@'; TICKET='@TICKET@'
134
+ case "$TICKET" in ''|ticket=*) echo "not a resolved ticket: $TICKET"; exit 1 ;; esac
87
135
  cd "$(git rev-parse --show-toplevel)" || exit 1
88
136
  [ -d "$WORK" ] || { echo "no such folder: $WORK"; exit 1; }
89
137
  tmp=$(mktemp -d) || exit 1
@@ -120,6 +168,7 @@ before writing the first line of it.
120
168
 
121
169
  ```bash handoff-push
122
170
  BRANCH='@BRANCH@'; COMMIT='@COMMIT@'
171
+ case "$BRANCH" in ''|branch=*) echo "not a resolved branch: $BRANCH"; exit 1 ;; esac
123
172
  case "$COMMIT" in ''|*[!0-9a-f]*) echo "not a commit sha: $COMMIT"; exit 1 ;; esac
124
173
  git cat-file -e "$COMMIT^{commit}" || exit 1
125
174
  git push origin "$COMMIT:refs/heads/$BRANCH"
@@ -186,6 +235,7 @@ the ticket read it there, never in the work folder; the receiver does not parse
186
235
 
187
236
  ## 6. Close
188
237
 
189
- Report following flow-core §3: the branch and the commit, the file count, whether the ticket
238
+ Report following flow-core §3: the exact remote branch (`origin/<branch>`, as the resolve block
239
+ printed it) and the commit, the file count, whether the ticket
190
240
  summary was written. Refresh the panel: a `Now` line saying the study was handed off, no `Decision`
191
241
  line. `meta.json` gains nothing — the branch on `origin` is the record, and the §3 refusal reads it.
@@ -32,7 +32,7 @@ reads where the run got to, not how the run continues.
32
32
 
33
33
  - `git branch --show-current`.
34
34
  - Find the work for this branch (flow-core §0: both work-folder locations, `branch`, `mrs[].branch` or `worktree`).
35
- - None found → ask the user for the ticket or whether to start a new one.
35
+ - None found → ask the user for the ticket or whether to start a new one; a ticket given finds the `meta.json` whose `ticket`, canonical too, equals it (flow-core §0, the ticket) — never a folder-name glob.
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
 
38
38
  ## 2. Recap