pi-dev-flow 0.64.3 → 0.64.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,24 @@ Format: newest first. `Unreleased` collects what's merged but not yet tagged.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.64.5] - 2026-10-25
8
+
9
+ ### Fixed
10
+
11
+ - **A heredoc body is an argument's prose, not a command.** `bashSegments` splits on newlines outside quotes, so every line of `git commit -F - <<'MSG' … MSG` was judged as its own command: a commit message whose line began with `flow status` was refused with *there is no "flow" shell command*, and one that named `.dev-flow/<slug>/state.json` tripped the state-tamper block. `stripHeredocBodies` now blanks heredoc bodies (line count kept, so segment order survives) before the split, which every guard inherits — flow invocation, state/playbook tamper, project deny rules, git parsing, merge style and force-push detection. A head that executes its argument (`sh`, `node`, `python`…) is never masked: a heredoc fed to an interpreter really runs, and prose-is-argument is a rule about data, not a licence to unsee code. Unterminated bodies are left judged — masking less is the safe direction.
12
+ - **`.dev-flow/` is no longer a free write area for an unbound session.** The write guard allowed anything under `.dev-flow/`, and the folder gitignores everything, so an unbound session could park arbitrary files there (`.dev-flow/COMMUNICATION-PLAN.md` was one) — a folder whose whole purpose is flow state doubled as untracked scratch space. Only the two advisory files the agent owns (`reflections.md`, `roadmap.md`) stay writable with no binding; anything else in the folder is refused, and the refusal names the writable pair. A bound session keeps the folder exactly as it had it — the flow-owned paths inside it were, and stay, refused by their own rules.
13
+ - **`gh pr merge --merge main` merges nothing, so every hint now spells `gh pr merge <n> --merge`.** A positional after the style flag is read by gh as the PR selector ("no pull requests found for main"), which turned the form the release reference and the release-stage hint showed into a silent no-op at the one step of the release. The skill's release reference, the merge-policy section of `docs/playbook.md` and `nextHint` all put the number first and say why the order matters.
14
+
15
+ ### Added
16
+
17
+ - **💬 in the footer while the operator's word is outstanding.** The legend already said 💬 means "operator, your turn" (stage lines open with it); the footer never did, so a flow parked on an unanswered checkpoint looked exactly like one with nothing pending. A gate that tells the agent to go ask now records the word it wants (`FlowState.pendingAsk`), the footer renders `🔨 slug 💬`, and `flow status` prints `💬 Approve?` — set for a chat question or an interactive dialog alike, cleared when the word arrives or the answer comes back no, and dropped when another session takes the feature over (the question belonged to whoever asked it). An unbound session shows the same pre-flow glyph: `💬 no flows`, `💬 N flow(s) open` — an unbound session is parked on the operator by definition, so `⧖` leaves the legend. Presentation only: no gate, guard or verdict reads the field.
18
+
19
+ ## [0.64.4] - 2026-10-25
20
+
21
+ ### Added
22
+
23
+ - **Stage reports: a uniform output contract for every gate message, carried by the skill itself.** A gate message is now a stage line (the statusbar's own stage glyph 💬 pre-flow / 📝 / 🔨 / 🔍 / 🚀 / 🏁 + slug + `·`-separated decision fields with provenance marks `✓` operator, `✓playbook`/`✓detected` rule, `~` agent-assumed, `?` pending) plus an event title and `Done:`/`Next steps:` blocks — operator verbs in italics (recommended one bold italic), never gate commands, recommended first, *yolo* last, plain "or say what to do differently" closing line. The norm lives in the `SKILL.md` ground rules (budget raised 4000→4500 with the reason noted), each stage reference file names its own fields, the stage-context injection carries a one-line reminder, and `docs/playbook.md` holds the human long form with the worked example — so every repo gets the protocol without writing playbook prose. A consistency test locks the clause, the markers, and every stage file's glyph.
24
+
7
25
  ## [0.64.3] - 2026-10-25
8
26
 
9
27
  ### Changed
@@ -15,7 +15,7 @@ While a feature is active, the extension intercepts every tool call:
15
15
  - **Shell calls can't hang forever**: pi kills a shell command only when the model passed a `timeout` — it omits one in ~75% of calls, so a `gh` waiting on a prompt or a dead `curl` froze sessions for hours. In an initiated repo (`.dev-flow/project.md` exists) the call is therefore by default **refused** until the model states one (`bashTimeout = require`): the refusal names the exact value the class table would have armed, so the retry is a one-token fix and the call line in the transcript shows the timeout that is actually running. The injected class default (30s quick inspection · 120s local git and unknown · 180s network · 300s containers/services · 900s builds/tests/installs · 1,200s watchers like `gh run watch`) stays armed underneath either way, and absurd explicit values clamp to 1,800s. A project that would rather not nag sets `bashTimeout = inject` in `## global` — then the default is armed silently and the call passes. Uninitiated folders hear nothing at all: without the playbook dev-flow enforces no rules.
16
16
  - **Compact-aware**: dev-flow paces compaction the way pi counts it: the self-compaction trigger uses the *effective* `reserveTokens` (settings and per-model overrides, not the built-in default) and is checked at every turn end, not only when a run settles. When pi force-compacts on its threshold anyway — the chat-only states (open tier-2 dialog, plan discussion not yet in `plan/`) refuse to self-compact by design — dev-flow takes the compaction over and redoes it with flow-aware summary instructions (overflow recovery keeps pi's compact-and-retry and is left alone). Auto-compaction turned off in settings is honored; a note about any compaction dev-flow could not shape still lands in `reflections.md`.
17
17
  - The active stage is injected into the model's context every turn; the bundled `dev-flow` skill is the agent's playbook, including the recommended sequences: pre-release — review (`/flow-review`) → fixes → docs → changelog/version bump; release — PR → merge → tag → `release-done`. The package also bundles the review skills themselves — `/flow-review` (a change, read against its `plan/plan.md`), `/flow-audit` (the whole repo) and `/flow-simplify` (the operative cut: deletes dead and duplicated code, one verified commit at a time) — and injects a built-in senior-discipline guidance at implement stage unless the playbook sets its own `prose.implement`.
18
- - **Status bar**: an initiated repo (`.dev-flow/project.md` exists) always carries the dev-flow footer; while the session **is bound** to a feature it shows `<stage glyph> <slug>` plus mode markers — stages 📝 plan, 🔨 implement, 🔍 pre-release, 🚀 release; markers ⚡ patch, 📚 docs, 🎱 yolo, and `⚠️` while a check of the bound feature fails (emoji render in their own color, so the footer carries no theme coloring). An **unbound** session never sees a slug — it shows `⧖ N flow(s) open` (unfinished-feature count only, no warning marker) or `⧖ no flows` when nothing is in flight; a session binds only via `flow start`/`flow use`, never by opening. The footer repaints at session start, at the start of every agent run (the earliest a late-attaching web client is listening) and after every gate; an uninitiated folder gets no footer at all. `flow status` is the spelled-out surface: `stage=implement`, the per-feature mode tags (`[ui]`, `[yolo]`, `[no-version]`) and the `flow=<ver>` stamp of the build that started the feature.
18
+ - **Status bar**: an initiated repo (`.dev-flow/project.md` exists) always carries the dev-flow footer; while the session **is bound** to a feature it shows `<stage glyph> <slug>` plus mode markers — stages 📝 plan, 🔨 implement, 🔍 pre-release, 🚀 release; markers ⚡ patch, 📚 docs, 🎱 yolo, `💬` while a checkpoint (Approve?/Verified?/Release?/Finish?) still waits on the operator's word — the legend's "operator, your turn" glyph, the same one stage lines open with — and `⚠️` while a check of the bound feature fails (emoji render in their own color, so the footer carries no theme coloring). An **unbound** session never sees a slug — it shows `💬 N flow(s) open` (unfinished-feature count only, no warning marker) or `💬 no flows` when nothing is in flight: the pre-flow glyph, because an unbound session is parked on the operator by definition; a session binds only via `flow start`/`flow use`, never by opening. The footer repaints at session start, at the start of every agent run (the earliest a late-attaching web client is listening) and after every gate; an uninitiated folder gets no footer at all. `flow status` is the spelled-out surface: `stage=implement`, the per-feature mode tags (`[ui]`, `[yolo]`, `[no-version]`), the `💬 <word>` marker of a checkpoint the operator has not answered, and the `flow=<ver>` stamp of the build that started the feature.
19
19
 
20
20
  ## Limitations (deliberate, v1)
21
21
 
package/docs/playbook.md CHANGED
@@ -132,10 +132,11 @@ needs to know which one the release contains. Three things read the key:
132
132
  in chat, re-runs with `--merge=<style> --confirmed`, and the answer is inserted as a single line under
133
133
  `## release` (validated before the write, `.bak` kept, committed as a playbook chore when the playbook is
134
134
  the only dirty path). `any` is the explicit opt-out: no policy, no asking.
135
- - **the guard enforces it where the decision is made** — `gh pr merge --squash` against `merge = merge` is
135
+ - **the guard enforces it where the decision is made** — `gh pr merge <n> --squash` against `merge = merge` is
136
136
  blocked outright, and a merge that carries no style flag (so the forge default decides) needs your
137
137
  confirmation; a local `git merge --squash` only ever confirms, because merging main into a branch is
138
- ordinary work.
138
+ ordinary work. Spell the PR number **before** the flag: `gh pr merge --merge main` reads `main` as the
139
+ PR selector ("no pull requests found for main") and never merges anything.
139
140
  - **`release-done` proves what actually landed** matched the policy (branch ancestry plus what the forge
140
141
  reports), and `flow finish` says whether commits missing from the default branch are expected (squash,
141
142
  rebase) or a violation (merge — where `yolo` does not answer for you). A shape dev-flow cannot see —
@@ -174,43 +175,60 @@ Future features have their own file: `.dev-flow/roadmap.md`, a gitignored backlo
174
175
  manages (add / pick → `flow start` / done / tidy) — a picked item is checked off by `finish` when
175
176
  its feature ships, and it never gates either.
176
177
 
177
- ### Structured stage reports (a prose convention, not a gate)
178
-
179
- The gates enforce *state*; how the agent *talks* about that state at each stage is a tier-3 convention —
180
- type `prose.implement`-style guidance into the stage sections and every session inherits it. The contract
181
- this repo runs on has two fixed shapes, both **plain markdown inline lines — never fenced** (a code block
182
- renders monospace with a horizontal scrollbar in web UIs; fences stay for diffs and command output).
183
-
184
- **The stage line.** Every stage report opens with one inline line: a `◆` marker, the stage and slug, then
185
- the *decision record* as `·`-separated `key value` pairs with backticked values. The core — stage · slug ·
186
- mode (+ grant mark: `✓` operator-granted, `?` proposed) · ui — repeats at every stage; stage-specific
187
- fields append:
188
-
189
- | Stage | Fields after the core | Example |
190
- |---|---|---|
191
- | pre-flow | mode proposal + why, detected knob defaults, merge-policy state | **◆ pre-flow · new work** — mode `normal` (proposed: touches behavior) · ui on · forge `github` ✓ · merge policy **missing** |
192
- | plan | plan.md status, mockups `rendered/total`, open questions | **◆ plan · `dark-mode`** — `normal` ✓ · ui on · plan `created` · mockups `3/3` · open questions `0` |
193
- | implement | commits `N ahead, M uncommitted`, tier-1, tier-2, deploy/health, branch@sha | **◆ implement · `dark-mode`** — `normal` ✓ · ui on · commits `2 ahead, 0 uncommitted` · tier-1 `5/5` · deploy `health PASS` · `feat/dark-mode@a1b2c3` |
194
- | pre-release | **version decision** — `pending` / `bump <patch\|minor\|major> → vX.Y.Z (pending your word)` / `no-version [your word]` — tag, changelog, fold, review tally, merge style | **◆ pre-release · `dark-mode`** — `normal` ✓ · ui on · version **`bump minor → 0.56.0 (pending your word)`** · tag `v0.56.0` · changelog `ready` · review `0 must / 0 should` · merge `merge` |
195
- | release | PR + state, merge style used, tag state, artifact proof, forge release state (one line per step — this stage has no checkpoint) | **◆ release · `dark-mode`** — PR `#131 merged` · merge `--merge (playbook)` · tag `v0.56.0 pushed` · artifact `npm view OK` · forge release `created` |
196
- | finish | release recorded, main state, unmerged commits, reflections open, release-checklist open | **◆ finish · `dark-mode`** — release `recorded` · main `clean, pushed` · unmerged `0` · reflections `2 open` |
197
-
198
- A decision that was *not* made is recorded as `pending` — never left unstated, never silently invented
199
- (a version bump needs the operator's word; `no-version` too).
200
-
201
- **The checkpoint.** Exactly one per stage, as a plain chat message (a structured-question tool is
202
- not chat and never licenses `--confirmed`), three markdown bullets and the single verb, **yolo** named
203
- as an available answer:
204
-
205
- > **CHECKPOINT — Release?**
206
- > - **context** — checks green; manifest ahead of last tag; `Unreleased` folded.
207
- > - **options** — *release* → bump minor 0.56.0, tag `v0.56.0`, forge release · *no-version* → merge only, entry rides under `Unreleased` · *edit* — what to change · *yolo* → release with the parameters above, remaining gates run back to back
208
- > - **recommend** — *release* — user-facing feature, minor per playbook semver
178
+ ### Structured stage reports (a convention, not a gate)
179
+
180
+ The gates enforce *state*; how the agent *talks* about that state is presentation. The norm lives in
181
+ the skill itself — the **Stage reports** clause in `SKILL.md` ground rules, echoed by the
182
+ `Stage reports:` line in every stage-context injection — so every repo using dev-flow gets the same
183
+ output protocol without writing a word of playbook prose. This is the human explanation of it.
184
+
185
+ One gate message = **stage line** + event title + **`Done:`** / **`Next steps:`** blocks, all plain
186
+ markdown, **never fenced** (a fenced block renders monospace with a horizontal scrollbar in web UIs;
187
+ fences stay for diffs and command output).
188
+
189
+ **The stage line** *is* the decision record — one copy of every fact. It opens with the statusbar's
190
+ own stage glyph (the footer is the legend: 💬 pre-flow "operator, your turn" · 📝 plan · 🔨 implement
191
+ · 🔍 pre-release · 🚀 release · 🏁 finish), then `slug — key value` pairs separated by `·`, with the
192
+ mode glyphs after the slug as in the footer (⚡ patch · 📚 docs · 🎱 yolo). Every value carries a
193
+ provenance mark:
194
+
195
+ | mark | meaning |
196
+ |---|---|
197
+ | `✓` | operator-decided |
198
+ | `✓playbook` / `✓detected` | decided by a rule or auto-detection |
199
+ | `~` | agent-assumed — vetoable; flips to `✓` when the stage's verb is given |
200
+ | `?` | pending the operator's word |
201
+
202
+ A decision not made reads `pending` — never left unstated, never silently invented (a version bump
203
+ needs the operator's word; `no-version` too). Per-stage fields after the core (stage · slug · mode ·
204
+ ui): plan status and mockups; commits `N ahead, M uncommitted`, tier-1, deploy/health, `branch@sha`;
205
+ the version decision (`bump <level> → vX.Y.Z ~`) with tag/changelog/fold/review/merge-style beside
206
+ it; PR/tag/artifact/forge proofs at 🚀 (stage lines only there — that stage asks nothing); release-
207
+ recorded / main-state / unmerged / reflections at 🏁.
208
+
209
+ **The checkpoint** closes exactly one message per stage (the operator's verb stays a plain-chat word
210
+ — a structured-question tool is not chat). Event title, then the labels **`Done:`** and
211
+ **`Next steps:`** standing alone on their own lines. `Done:` names the review surface — paths, SHAs,
212
+ counts, not vibes. `Next steps:` lists the operator's verbs in italics (the recommended one
213
+ ***bold italic***, and no line needs a "(recommended)" tag when the styling carries it) and **never
214
+ gate commands** (the agent runs those): recommended first, then alternatives, then *yolo* last with
215
+ what it pre-confirms, then the plain closing line "or say what to do differently". Example:
216
+
217
+ > **🔍 pre-release · `dark-mode`** — `normal` ✓ · ui `on ✓` · version **`bump minor → 0.56.0 ~`** · tag `v0.56.0 ~` · changelog `ready ~` · merge `merge ✓playbook`
209
218
  >
210
- > Answer in chat: **Release?** (or yolo)
211
-
212
- After each gate that advances a stage, one short echo line confirms the new state before new work
213
- (`▶ stage: implement — 2 commits ahead, tier-1 5/5`). Mid-stage additions amend `plan.md` with an
214
- `**Added mid-stage:**` line instead of opening a second checkpoint — the verb count stays one per
215
- stage. The contract is advisory like all tier-3 prose: gates refuse what gates refuse regardless of
216
- how neatly the report is formatted.
219
+ > **Release prep done**
220
+ >
221
+ > **Done:**
222
+ > review 0 must / 0 should; CHANGELOG `## [0.56.0]` folded from `Unreleased`; manifest bumped
223
+ >
224
+ > **Next steps:**
225
+ > - ***Release*** → tag `v0.56.0`, forge release — locks the `~` fields
226
+ > - *No-version* → merge only, entry rides under `Unreleased`
227
+ > - *Yolo* → release with these parameters, remaining gates back to back
228
+ > - or say what to do differently — bump level, changelog wording
229
+
230
+ Mid-stage (non-checkpoint) reports are the stage line plus a short body — no `Next steps:` block —
231
+ and mid-stage scope additions amend `plan.md` with an `**Added mid-stage:**` line instead of opening
232
+ a second checkpoint. Like all tier-3 prose this is advisory: gates refuse what gates refuse no matter
233
+ how the report is formatted. A project can still set `prose.<stage>` for its own stage guidance —
234
+ that replaces the built-in guidance text but the Stage reports rule keeps applying.
@@ -832,6 +832,20 @@ async function runFlow(args: string[], root: string, ui: Ui, sess: Session): Pro
832
832
  return { text: `unknown subcommand "${sub}" — ${GATE_HELP}`, isError: true };
833
833
  }
834
834
  }
835
+ /** Records the checkpoint word a gate asked for and has not been given: the footer shows 💬 (“operator,
836
+ * your turn”, the legend in docs/playbook.md) while a session is parked on an answer. Presentation only —
837
+ * no verdict reads it — and the same gate clears it when the word arrives (or when the answer is no and the
838
+ * turn returns to the agent). */
839
+ function markPendingAsk(root: string, state: FlowState, word: string): void {
840
+ state.pendingAsk = word;
841
+ writeState(root, state);
842
+ }
843
+
844
+ /** The pending checkpoint is answered either way — the 💬 leaves the footer with it. */
845
+ function clearPendingAsk(state: FlowState): void {
846
+ delete state.pendingAsk;
847
+ }
848
+
835
849
  async function gateVerify(o: GateCtx): Promise<RunResult> {
836
850
  const { root, ui, sess, cfg, flag, slugArg, takeYoloWord } = o;
837
851
  const { state, err } = needState(root, sess, slugArg);
@@ -898,17 +912,26 @@ async function gateVerify(o: GateCtx): Promise<RunResult> {
898
912
  const yoloWord = takeYoloWord(state!);
899
913
  if (yoloWord) return { text: yoloWord, isError: true };
900
914
  const audit = flag("confirmed") ? " (confirmed by operator instruction)" : state!.yolo ? " (yolo: pre-confirmed)" : "";
901
- if (!flag("confirmed") && !state!.yolo) {
915
+ const askPending = !flag("confirmed") && !state!.yolo;
916
+ if (askPending) {
917
+ markPendingAsk(root, state!, "Verified?"); // pending however it is asked — a chat question or a dialog
902
918
  // these commands already ran — say so even on the way out
903
- if (!ui.hasUI) return { text: `${needsOperator("verification needs the operator: confirm interactively, or re-run with --confirmed once the operator answered in chat.", "Verified?")}\n${ran}`, isError: true };
919
+ if (!ui.hasUI) {
920
+ return { text: `${needsOperator("verification needs the operator: confirm interactively, or re-run with --confirmed once the operator answered in chat.", "Verified?")}\n${ran}`, isError: true };
921
+ }
904
922
  const ok = await ui.confirm("Operator verification", `Verified? All checks green${cfg.commands.dev && !state!.docs ? `; dev deploy is up for review (${cfg.commands.dev})` : ""} \u2014 does it work?`);
905
- if (!ok) return { text: "verification declined — stay in implement and fix what failed" };
923
+ if (!ok) {
924
+ clearPendingAsk(state!);
925
+ writeState(root, state!);
926
+ return { text: "verification declined — stay in implement and fix what failed" };
927
+ }
906
928
  }
907
929
  state!.confirmations = { ...state!.confirmations, implement: { hash: checklistHash(items), at: now() } };
908
930
  const final = verifyGate(state!, cfg, branch);
909
931
  if (final.length) return { text: `verify gate FAILED:\n- ${final.join("\n- ")}`, isError: true };
910
932
  state!.approvals.verify = now();
911
933
  state!.stage = "pre-release";
934
+ clearPendingAsk(state!);
912
935
  writeState(root, state!);
913
936
  return { text: `verified${audit} — entering pre-release stage.\n${ran}\n${nextHint(state!, cfg)}` };
914
937
  }
@@ -992,10 +1015,18 @@ async function gateRelease(o: GateCtx): Promise<RunResult> {
992
1015
  staleNote = `released under dev-flow ${behind} (${selfBuild.label} ${selfBuild.version ?? "?"}) by operator choice — proofs newer than ${behind} did not run`;
993
1016
  }
994
1017
  const audit = flag("confirmed") ? " (confirmed by operator instruction)" : state!.yolo ? " (yolo: pre-confirmed)" : "";
995
- if (!flag("confirmed") && !state!.yolo) {
996
- if (!ui.hasUI) return { text: needsOperator(`release confirmation needs the operator: confirm interactively, or re-run with --confirmed once the operator answered 'Release?' in chat${stale ? ` — the operator must also answer the stale-build question: ${staleAsk}` : ""}`, "Release?"), isError: true };
1018
+ const askPending = !flag("confirmed") && !state!.yolo;
1019
+ if (askPending) {
1020
+ markPendingAsk(root, state!, "Release?");
1021
+ if (!ui.hasUI) {
1022
+ return { text: needsOperator(`release confirmation needs the operator: confirm interactively, or re-run with --confirmed once the operator answered 'Release?' in chat${stale ? ` — the operator must also answer the stale-build question: ${staleAsk}` : ""}`, "Release?"), isError: true };
1023
+ }
997
1024
  const ok = await ui.confirm("Enter release", `Release ${state!.slug}${manifestVer ? ` v${manifestVer}` : ""}${state!.noVersion ? " (unversioned — merge + changelog entry only: no bump, no tag for this flow)" : ""}? Publishing starts: PR, merge${state!.noVersion ? "" : ", tag"} — release-done afterwards needs no further answer.${staleAsk ? `\n\n${staleAsk}` : ""}`);
998
- if (!ok) return { text: "release declined — keep preparing in pre-release" };
1025
+ if (!ok) {
1026
+ clearPendingAsk(state!);
1027
+ writeState(root, state!);
1028
+ return { text: "release declined — keep preparing in pre-release" };
1029
+ }
999
1030
  }
1000
1031
  state!.confirmations = { ...state!.confirmations, "pre-release": { hash: checklistHash(items), at: now() } };
1001
1032
  state!.approvals["pre-release"] = now();
@@ -1012,6 +1043,7 @@ async function gateRelease(o: GateCtx): Promise<RunResult> {
1012
1043
  // re-read a checkout that may still be behind (#52)
1013
1044
  if (!state!.noVersion && manifestVer) state!.releaseVersion = manifestVer;
1014
1045
  if (stale) state!.staleBuild = `${behind} (${selfBuild.label} ${selfBuild.version ?? "?"})`;
1046
+ clearPendingAsk(state!);
1015
1047
  writeState(root, state!);
1016
1048
  return { text: `release approved${audit}${state!.noVersion ? " — unversioned: no bump or tag; your changelog entry rides under Unreleased until the next versioned release folds it" : ""} — entering release stage.${manifestVer ? ` Version ${manifestVer}.` : ""}${foldNote}${staleNote ? ` ${staleNote}.` : ""}\n${nextHint(state!, cfg)}` };
1017
1049
  }
@@ -1229,8 +1261,10 @@ async function gateFinish(o: GateCtx): Promise<RunResult> {
1229
1261
  : ` ${assess.unmerged.length} commit(s) in ${state!.worktree} are not on ${cfg.defaultBranch} (squash merge?)`;
1230
1262
  // under a merge-commit policy this is a violation, not a routine cleanup note: yolo does not
1231
1263
  // answer it, only the operator does
1232
- if (policy === "merge" && measurable && !flag("confirmed"))
1264
+ if (policy === "merge" && measurable && !flag("confirmed")) {
1265
+ markPendingAsk(root, state!, "Merge policy violation?");
1233
1266
  return { text: needsOperator(`the playbook says merge = merge, but ${assess.unmerged.length} commit(s) of ${state!.slug} are not on ${cfg.defaultBranch} — the PR landed as a squash or a rebase. Ask the operator how to proceed, then re-run with --confirmed`, "Merge policy violation?"), isError: true };
1267
+ }
1234
1268
  }
1235
1269
  }
1236
1270
  // a forge release that failed at release-done is still the operator's call — but they must see it before the state vanishes (#63)
@@ -1239,10 +1273,18 @@ async function gateFinish(o: GateCtx): Promise<RunResult> {
1239
1273
  // yolo works uniformly at every gate: at Finish? nothing later remains to pre-confirm, the flag just answers this one
1240
1274
  const yoloWord = takeYoloWord(state!);
1241
1275
  if (yoloWord) return { text: yoloWord, isError: true };
1242
- if (!flag("confirmed") && !state!.yolo) {
1243
- if (!ui.hasUI) return { text: needsOperator(`finish needs the operator: ask them Finish? in chat, then re-run with --confirmed (or run /flow finish interactively)${forgeSkipNote}`, "Finish?"), isError: true };
1276
+ const askPending = !flag("confirmed") && !state!.yolo;
1277
+ if (askPending) {
1278
+ markPendingAsk(root, state!, "Finish?");
1279
+ if (!ui.hasUI) {
1280
+ return { text: needsOperator(`finish needs the operator: ask them Finish? in chat, then re-run with --confirmed (or run /flow finish interactively)${forgeSkipNote}`, "Finish?"), isError: true };
1281
+ }
1244
1282
  const ok = await ui.confirm("Finish feature", `Finish ${state!.slug}?${unmergedNote}${forgeSkipNote} Removes worktree, branch ${state!.branch || "-"} and .dev-flow/${state!.slug}/.`);
1245
- if (!ok) return { text: "finish declined" };
1283
+ if (!ok) {
1284
+ clearPendingAsk(state!);
1285
+ writeState(root, state!);
1286
+ return { text: "finish declined" };
1287
+ }
1246
1288
  }
1247
1289
  if (wt && existsSync(wt)) {
1248
1290
  const rm = await sh(`git worktree remove ${sq(wt)} && git branch -D ${sq(state!.branch)}`, root);
@@ -1504,8 +1546,12 @@ async function gateApprove(o: GateCtx): Promise<RunResult> {
1504
1546
  const planItems = applicableItems(cfg, state!, "plan");
1505
1547
  if (flag("yolo")) state!.yolo = true; // operator's word at Approve? — every later gate question is pre-confirmed; checks and guardrails stay
1506
1548
  const audit = flag("confirmed") ? " (confirmed by operator instruction)" : "";
1507
- if (!flag("confirmed")) {
1508
- if (!ui.hasUI) return { text: needsOperator("plan approval needs the operator: approve interactively, or re-run with --confirmed once the operator answered in chat", "Approve?"), isError: true };
1549
+ const askPending = !flag("confirmed");
1550
+ if (askPending) {
1551
+ markPendingAsk(root, state!, "Approve?");
1552
+ if (!ui.hasUI) {
1553
+ return { text: needsOperator("plan approval needs the operator: approve interactively, or re-run with --confirmed once the operator answered in chat", "Approve?"), isError: true };
1554
+ }
1509
1555
  const ok = await ui.confirm("Approve plan", `Approve ${state!.slug}${state!.ui ? " (UI)" : ""}${state!.patch ? " (patch)" : state!.docs ? " (docs)" : ""}? Creates the worktree.${flag("yolo") ? " YOLO: all later gate questions (Verified?/Release?/Finish?) are pre-confirmed — checks and guardrails stay in place." : ""}`);
1510
1556
  if (!ok) return { text: "approval declined — keep iterating on the plan" };
1511
1557
  }
@@ -1536,6 +1582,7 @@ async function gateApprove(o: GateCtx): Promise<RunResult> {
1536
1582
  state!.worktree = wtRel;
1537
1583
  state!.stage = "implement";
1538
1584
  state!.approvals.plan = now();
1585
+ clearPendingAsk(state!);
1539
1586
  writeState(root, state!);
1540
1587
  return { text: `plan approved${audit}${state!.yolo ? " — yolo: later gate questions pre-confirmed" : ""}; worktree ${wtRel} on branch ${branch}.${setupNote}\n${nextHint(state!, cfg)}` };
1541
1588
  }
@@ -1565,7 +1612,7 @@ async function gateStatus(o: GateCtx): Promise<RunResult> {
1565
1612
  const st = readState(root, s);
1566
1613
  if (!st) return [];
1567
1614
  return [
1568
- `${s === cur ? "→" : " "} ${s}: stage=${st.stage}${st.ui ? " [ui]" : ""}${st.yolo ? " [yolo]" : ""}${st.noVersion ? " [no-version]" : ""} branch=${st.branch || "-"} worktree=${st.worktree || "-"}${st.flowVersion ? ` flow=${st.flowVersion}` : ""}`,
1615
+ `${s === cur ? "→" : " "} ${s}: stage=${st.stage}${st.ui ? " [ui]" : ""}${st.yolo ? " [yolo]" : ""}${st.noVersion ? " [no-version]" : ""}${st.pendingAsk ? ` 💬 ${st.pendingAsk}` : ""} branch=${st.branch || "-"} worktree=${st.worktree || "-"}${st.flowVersion ? ` flow=${st.flowVersion}` : ""}`,
1569
1616
  ` approvals: ${Object.keys(st.approvals).join(", ") || "none"} | checks: ${Object.entries(st.checks).map(([k, v]) => `${k}:${v.ok ? "ok" : "FAILED"}`).join(", ") || "none"}${st.confirmations?.implement ? " | checklist: confirmed" : ""}`,
1570
1617
  ` next: ${nextHint(st, cfg)}`,
1571
1618
  ];
@@ -1753,6 +1800,12 @@ async function gateUse(o: GateCtx): Promise<RunResult> {
1753
1800
  const takeover = claimBlocks(prior, sess.key) ? ` — taken over from live session (pid ${prior!.pid})` : "";
1754
1801
  sess.bind(slugArg);
1755
1802
  sess.rename(slugArg);
1803
+ // a checkpoint that was still unanswered belongs to whoever asked; a session taking the feature over
1804
+ // must not inherit a 💬 for a question it never posed
1805
+ if (st.pendingAsk) {
1806
+ clearPendingAsk(st);
1807
+ writeState(root, st);
1808
+ }
1756
1809
  return { text: `this session is now bound to ${slugArg} (stage ${st.stage})${st.worktree ? ` — work in its worktree: ${st.worktree} (branch ${st.branch})` : ""}; session renamed to ${slugArg}${takeover}` };
1757
1810
  }
1758
1811
 
@@ -1814,7 +1867,7 @@ function tail(out: string, n = 15): string {
1814
1867
  // ------------------------------------------------------------------ extension
1815
1868
 
1816
1869
  /** Compact footer: bound flow = stage glyph, slug, mode markers, ⚠️ on its failing checks; unbound = the
1817
- * unfinished-flow count, or `⧖ no flows` — an initiated repo always carries the footer. An uninitiated
1870
+ * unfinished-flow count, or `💬 no flows` — an initiated repo always carries the footer. An uninitiated
1818
1871
  * folder gets nothing: the status is cleared. Pure read — rendering never binds or claims anything. */
1819
1872
  function refreshStatus(ctx: ExtensionContext): void {
1820
1873
  if (!ctx.hasUI) return;
@@ -2193,6 +2246,7 @@ export default function devFlow(pi: ExtensionAPI) {
2193
2246
  if (ref) guidance.push(`Stage playbook: read ${path.join(SKILL_DIR, ref)} before gate work in this stage.`);
2194
2247
  const prose = stageGuidance(cfg, state.stage);
2195
2248
  if (prose) guidance.push(`Stage guidance (${prose.source}): ${prose.text}`);
2249
+ guidance.push("Stage reports: open every report with the stage line (statusbar glyph + slug + provenance-marked decision fields); close a checkpoint with an event title and `Done:` / `Next steps:` on own lines — italic verbs, recommended first, yolo last. See Stage reports in the ground rules.");
2196
2250
  const pend = checklistPending(cfg, state, state.stage);
2197
2251
  if (pend) guidance.push(`Tier-2 checklist NOT yet confirmed (${pend} item(s)): ${applicableItems(cfg, state, state.stage).map((i) => i.text).join(" | ")}${state.stage === "release" ? " — release-stage items close with the operator's Finish? answer; no earlier gate records them" : ""}`);
2198
2252
  const refl = readReflections(ctx.cwd);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-dev-flow",
3
- "version": "0.64.3",
3
+ "version": "0.64.5",
4
4
  "description": "Enforced feature workflow for Pi: plan → implement → pre-release → release, gated checkpoints, self-improvement reflections, one git worktree per feature, changelog + publish as part of the release",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -33,6 +33,13 @@ Ground rules:
33
33
  when the session is demonstrably wrong, stuck, or claiming a gate result it
34
34
  never ran (and `/reload` when `flow version` says this session runs an older
35
35
  build).
36
+ - **Stage reports** — a gate message = a **stage line** (statusbar glyph 💬 pre-flow / 📝 / 🔨 / 🔍 / 🚀 / 🏁
37
+ + slug + `·`-separated decision fields, provenance-marked `✓` operator · `✓playbook`/`✓detected` rule
38
+ · `~` agent-assumed · `?` pending; never fenced; undecided reads `pending`, never invented) + event
39
+ title + **`Done:`**/**`Next steps:`** on own lines: verbs italic (***bold italic*** = recommended),
40
+ no gate commands; recommended first, *yolo* last, plain closing line
41
+ "or say what to do differently". Long form: docs/playbook.md;
42
+ per-stage fields: the stage reference file.
36
43
  - **yolo** at any checkpoint → run that gate `--yolo --confirmed`; every later
37
44
  checkpoint is pre-confirmed — run the remaining gates back to back without
38
45
  asking, honoring guidance attached to the word ("yolo, create a patch
@@ -14,6 +14,9 @@ the session context goes with it. Run the end-of-session reflection (bare
14
14
  `flow doctor`, drop = discard them. The answer replaces **Finish?** — act
15
15
  on it, then run `flow finish --confirmed` without asking again;
16
16
  - nothing parked → ask the operator **Finish?** → `flow finish --confirmed`.
17
+ Checkpoint report: stage line **🏁 finish · `<slug>`** — release recorded ·
18
+ main state · unmerged count · reflections open · release-checklist open,
19
+ then `Done:`/`Next steps:` per the Stage reports rule.
17
20
 
18
21
  The question covers the whole cleanup and mentions any commits that look
19
22
  unmerged. `flow finish [slug]`:
@@ -36,7 +36,9 @@ feature).
36
36
  container starts is not a failed deploy; say so rather than declaring a
37
37
  healthy deploy broken. Walk the **tier-2 checklist** (`- [ ]`) with the
38
38
  operator honestly — it cannot be scripted. Then ask **Verified?** →
39
- `flow verify --confirmed`. Fixes = iterate and re-verify; that loop is
39
+ `flow verify --confirmed`. Checkpoint report: stage line **🔨 implement ·
40
+ `<slug>`** — commits `N ahead, M uncommitted` · tier-1 · tier-2 · deploy/
41
+ health · `branch@sha`, then `Done:`/`Next steps:` per the Stage reports rule. Fixes = iterate and re-verify; that loop is
40
42
  free.
41
43
 
42
44
  `flow verify` re-runs build, runs the `dev` deploy when configured (the
@@ -46,7 +46,9 @@
46
46
  via DOM/code and move on — screenshots are a spot-check, not a test loop.
47
47
  5. Tell the user the plan is ready and **stop** — one word: **Approve?**
48
48
  Answered → `flow approve --confirmed` (yolo → `flow approve --yolo
49
- --confirmed`).
49
+ --confirmed`). Checkpoint report: stage line **📝 plan · `<slug>`** — mode ·
50
+ ui · plan status · mockups `rendered/total` · open questions, then
51
+ `Done:`/`Next steps:` per the Stage reports rule.
50
52
 
51
53
  Approval creates the worktree and branch, running `commands.setup` inside when
52
54
  configured — a failing setup fails the gate and the next `approve` **retries**
@@ -25,7 +25,11 @@ invent one mid-release. Sequence:
25
25
  4. `flow check` — the prep edits invalidated the implement checks; the release
26
26
  gate demands them green again.
27
27
  5. State what the PR will contain, present version and changelog entry,
28
- **stop** — **Release?** → `flow release --confirmed`. The gate re-checks
28
+ **stop** — **Release?** → `flow release --confirmed`. Checkpoint report:
29
+ stage line **🔍 pre-release · `<slug>`** — version decision (`pending` /
30
+ `bump <level> → vX.Y.Z ~` / `no-version ✓`) · tag · changelog · fold ·
31
+ review tally · merge style, then `Done:`/`Next steps:` per the Stage
32
+ reports rule. The gate re-checks
29
33
  tier-1, requires the manifest **ahead of the last tag**, a changelog
30
34
  **heading** naming that version (a mention in prose is not an entry) and that
31
35
  this branch prepared the entry. Operator ships this flow **without
@@ -9,8 +9,10 @@ here) — this stage publishes; the preparation happened in pre-release. Run in
9
9
  the worktree unless noted:
10
10
 
11
11
  1. Commit everything, push the feature branch, open the PR, wait for the merge
12
- (`gh pr merge` or ask the user) — with the **playbook's merge style spelled out**
13
- (`gh pr merge --squash` under `merge = squash`): the guard blocks a style that contradicts the
12
+ (`gh pr merge <n> --merge` or ask the user) — with the **playbook's merge style spelled out**
13
+ (`gh pr merge <n> --squash` under `merge = squash`), and **the PR number before the flag**: a bare
14
+ `gh pr merge --merge main` makes gh read `main` as the PR selector ("no pull requests found for
15
+ main"). The guard blocks a style that contradicts the
14
16
  playbook and asks the operator about a merge with no style flag, so let the playbook decide rather
15
17
  than the forge default. Merge without `--delete-branch`: it fails when
16
18
  the default branch is checked out in the main worktree, and `flow finish`
@@ -26,7 +28,10 @@ the worktree unless noted:
26
28
  `Unreleased` until the next versioned release folds it), `release-done`
27
29
  asks nothing version-side.
28
30
  3. `flow release-done` — **no question** (the Release? answer covered the
29
- publication). It re-verifies (tag on the default branch, on origin, artifact
31
+ publication). Reporting at this stage is stage lines only, one per step —
32
+ **🚀 release · `<slug>`** — PR + state · merge style used · tag state ·
33
+ artifact · forge release (all values `✓` — the Release? verb locked them);
34
+ no `Done:`/`Next steps:` block, nothing is asked. It re-verifies (tag on the default branch, on origin, artifact
30
35
  when configured) against **the version the release gate stamped** — never a
31
36
  re-read from a checkout that may be behind — and refuses anything older than
32
37
  the newest matching tag on origin (lists come from `git ls-remote`, so an
@@ -35,7 +35,9 @@ operator how a merged PR should land on the default branch — `squash`, `merge`
35
35
  or `any` (no policy) — with the suggestion the refusal read off their own history, then re-run
36
36
  `flow start <slug> --merge=<style> --confirmed`. The gate writes the answer into `## release` (single-line
37
37
  insert, validated, `.bak` kept) and never asks again. Never pick the style yourself and never write
38
- `project.md` by hand to get rid of the question.
38
+ `project.md` by hand to get rid of the question. Pre-flow reports open with **💬 pre-flow · new work** —
39
+ mode proposal + why · detected knobs · merge-policy state (💬 = "operator, your turn": a grant or
40
+ answer is pending).
39
41
 
40
42
 
41
43
  ---
package/src/core.ts CHANGED
@@ -46,6 +46,7 @@ export interface FlowState {
46
46
  releaseVersion?: string; // the manifest version the release gate approved — release-done publishes this, not whatever a checkout says later (#52)
47
47
  forgeReleaseSkipped?: string; // a gh/glab release create that failed: release-done says so, finish names it so the missing forge release cannot slip past (#63)
48
48
  staleBuild?: string; // release ran under an older dev-flow than the checkout by operator choice ("<loaded> (checkout <disk>)"); release-done repeats the acknowledgement
49
+ pendingAsk?: string; // the checkpoint word a gate asked for and has not been given ("Approve?", "Verified?", …) — presentation only (💬 in the footer), it never gates
49
50
  }
50
51
 
51
52
  /** Tier-2 item: operator prose; uiOnly items ("(ui)" in project.md) apply only to --ui features. */
@@ -865,6 +866,9 @@ const DF_ANYWHERE = /\.dev-flow\b/;
865
866
  * plan/mockups path), are not "the folder". The leading boundary takes `/` too: an absolute path names
866
867
  * the same folder, and absolute paths are the shape the harness hands the agent. */
867
868
  const DF_FOLDER = /(?:^|[\s'"/])\.dev-flow(?:\/(?!project\.md$|roadmap\.md$|reflections\.md$|\.gitignore$)[\w.-]+)?(?=$|[\s'"])/;
869
+ /** The advisory files under `.dev-flow/` the agent owns (the reflection queue and the roadmap backlog):
870
+ * writable with no flow bound — they are suggestions, not state — unlike everything else in the folder. */
871
+ export const DF_ADVISORY_FILES = new Set(["reflections.md", "roadmap.md"]);
868
872
  // write tools that can overwrite a file. A bare `>` is deliberately absent: the redirect target is
869
873
  // checked on its own, and testing for any `>` here refused every segment that merely mentioned an
870
874
  // owned path while redirecting elsewhere (`gh pr create … 2>&1`).
@@ -1042,18 +1046,93 @@ function quotesBalanced(command: string): boolean {
1042
1046
  return q === null;
1043
1047
  }
1044
1048
 
1049
+ /** A heredoc redirector at the end of a word: `<<EOF`, `<<'EOF'`, `<<-MSG`, `<<- 'SQL'`. `2>file` and `<<<`
1050
+ * are not heredocs; neither is the shift in `$((1<<2))` — the lookbehind refuses a word character or `(` in
1051
+ * front of the second `<`, and a word character or quote in front of the first. */
1052
+ const HEREDOC_OP = /(?<![\w(<])<<(-)?(['"]?)([A-Za-z_][\w]*)\2\s*$/;
1053
+
1054
+ /** Blank the body of every heredoc, keeping the line count. A heredoc body is an argument's prose exactly
1055
+ * like a quoted string — `git commit -F - <<'MSG' … flow approve … MSG` carries no invocation — but the
1056
+ * body lines are unquoted, so the newline split read each of them as its own command and a commit message
1057
+ * that started a line with `flow …` was refused as an invocation. A head that execs its argument is not
1058
+ * masked: a heredoc fed to `sh`/`node`/`python` really executes, and prose-is-argument is a rule about
1059
+ * data, not a licence to unsee code. Unterminated bodies are left alone (fail toward judging more).
1060
+ * shortcut: a heredoc whose redirector sits on a continuation line takes the head of that line, so a
1061
+ * re-exec head written on the line above keeps its body judged — again the safe direction. */
1062
+ export function stripHeredocBodies(command: string): string[] {
1063
+ const lines = command.split("\n");
1064
+ const out = lines.slice();
1065
+ const skip = new Set<number>(); // redirector lines, so a nested opener inside a body is never parsed
1066
+ let i = 0;
1067
+ while (i < lines.length) {
1068
+ const line = lines[i];
1069
+ if (skip.has(i) || line.trim() === "") {
1070
+ i++;
1071
+ continue;
1072
+ }
1073
+ const m = line.match(HEREDOC_OP);
1074
+ if (!m || REEXEC_HEADS.has(heredocHead(line))) {
1075
+ i++;
1076
+ continue;
1077
+ }
1078
+ const term = m[3];
1079
+ const tab = !!m[1];
1080
+ const stops: number[] = [];
1081
+ let j = i + 1;
1082
+ let terminated = false;
1083
+ while (j < lines.length) {
1084
+ const t = tab ? lines[j].trimStart() : lines[j];
1085
+ if (t === term) {
1086
+ terminated = true;
1087
+ break;
1088
+ }
1089
+ const inner = skip.has(j) ? null : lines[j].match(HEREDOC_OP);
1090
+ if (inner && !REEXEC_HEADS.has(heredocHead(lines[j]))) {
1091
+ // a nested heredoc: its body is data for the data — skip past its terminator unparsed
1092
+ const it = inner[3];
1093
+ let k = j + 1;
1094
+ for (; k < lines.length && lines[k] !== it; k++) skip.add(k);
1095
+ if (k < lines.length) {
1096
+ skip.add(k);
1097
+ j = k + 1;
1098
+ continue;
1099
+ }
1100
+ }
1101
+ stops.push(j);
1102
+ j++;
1103
+ }
1104
+ if (!terminated) {
1105
+ i++;
1106
+ continue; // an unterminated body is left for the guard to judge — masking less is the safe direction
1107
+ }
1108
+ for (const l of stops) out[l] = "";
1109
+ out[i] = line.replace(HEREDOC_OP, " ");
1110
+ skip.add(i);
1111
+ i = j + 1;
1112
+ }
1113
+ return out;
1114
+ }
1115
+
1116
+ /** The head a heredoc redirector belongs to: the first word of its line, env-prefixes and a `dir/` path
1117
+ * ignored (`/usr/bin/git commit -F - <<'MSG'`), so REEXEC_HEADS reads the verb and not the path. */
1118
+ function heredocHead(line: string): string {
1119
+ return segHead(line.replace(/^(?:\w+=\S*\s+)+/, "")).replace(/\S*\/$/, "");
1120
+ }
1121
+
1045
1122
  /** Split on shell separators — but only outside quotes. Text inside quotes is an argument's prose, not a
1046
1123
  * command: a gh --body that discusses a commit is one segment, not five. Unbalanced quoting keeps the plain
1047
1124
  * split, so a stray quote cannot be used to hide a real command. The same split the git guard uses, so
1048
- * `cd … &&`, `;`, pipes and `&` each judge on their own. */
1125
+ * `cd … &&`, `;`, pipes and `&` each judge on their own. Heredoc bodies are stripped first (see
1126
+ * stripHeredocBodies) — a `git commit -F - <<'MSG'` message is an argument, not five commands. */
1049
1127
  export function bashSegments(command: string): string[] {
1050
- if (!quotesBalanced(command)) return command.split(/[\n;|&]+/).map((s) => s.trim()).filter(Boolean);
1128
+ const src = stripHeredocBodies(command).join("\n");
1129
+ if (!quotesBalanced(src)) return src.split(/[\n;|&]+/).map((s) => s.trim()).filter(Boolean);
1051
1130
  const out: string[] = [];
1052
1131
  let cur = "";
1053
1132
  let q: string | null = null;
1054
- for (let i = 0; i < command.length; i++) {
1055
- const c = command[i];
1056
- const esc = i > 0 && command[i - 1] === "\\" && q !== "'";
1133
+ for (let i = 0; i < src.length; i++) {
1134
+ const c = src[i];
1135
+ const esc = i > 0 && src[i - 1] === "\\" && q !== "'";
1057
1136
  if (!esc && (c === '"' || c === "'")) q = q === null ? c : q === c ? null : q;
1058
1137
  if (q === null && /[\n;|&]/.test(c)) {
1059
1138
  if (cur.trim()) out.push(cur.trim());
@@ -1224,7 +1303,15 @@ export function writeGuard(o: { abs: string; dfDir: string; features: FeatureRef
1224
1303
  // feature's plan and that feature's approval gate then rubber-stamps text it never wrote.
1225
1304
  if (bound?.state.stage === "plan" && !within(abs, path.join(dfDir, bound.state.slug)))
1226
1305
  return `bound feature ${bound.state.slug} is in plan — write only inside its own .dev-flow/${bound.state.slug}/`;
1227
- if (within(abs, dfDir)) return null;
1306
+ if (within(abs, dfDir)) {
1307
+ // `.dev-flow/` is not a free write area: it gitignores everything, so the blanket allow let an unbound
1308
+ // session drop arbitrary files there (.dev-flow/COMMUNICATION-PLAN.md was one) — a folder whose whole
1309
+ // point is flow state must not double as an untracked scratch dir. Only the two advisory files the
1310
+ // agent owns stay writable with no binding; project.md is refused above, state/claim.json too.
1311
+ if (DF_ADVISORY_FILES.has(path.relative(dfDir, abs))) return null;
1312
+ if (!bound) return `.dev-flow/ holds flow state — an unbound session may write only its advisory files there (.dev-flow/reflections.md, .dev-flow/roadmap.md); bind with flow start <slug> or flow use <slug>, and a throwaway script goes outside the repo (under $TMPDIR)`;
1313
+ return null;
1314
+ }
1228
1315
  if (bound) {
1229
1316
  if (bound.state.stage === "implement" || bound.state.stage === "pre-release")
1230
1317
  return `bound feature ${o.boundSlug} is at ${bound.state.stage} — edit its worktree (${bound.state.worktree}), not the main checkout; a throwaway script goes outside the repo (under $TMPDIR)`;
@@ -1272,20 +1359,24 @@ export const STAGE_EMOJI: Record<Stage, string> = { plan: "📝", implement: "
1272
1359
 
1273
1360
  export function statusCompact(state: FlowState): { text: string; failed: boolean } {
1274
1361
  const failed = Object.values(state.checks).some((c) => !c.ok);
1275
- return { text: `${STAGE_EMOJI[state.stage]} ${state.slug}${state.patch ? " ⚡" : state.docs ? " 📚" : ""}${state.yolo ? " 🎱" : ""}`, failed };
1362
+ // 💬 is the legend's "operator, your turn" (docs/playbook.md stage lines): a bound flow whose checkpoint
1363
+ // is unanswered is parked on the operator, and the footer is the only thing they see.
1364
+ return { text: `${STAGE_EMOJI[state.stage]} ${state.slug}${state.patch ? " ⚡" : state.docs ? " 📚" : ""}${state.yolo ? " 🎱" : ""}${state.pendingAsk ? " 💬" : ""}`, failed };
1276
1365
  }
1277
1366
 
1278
1367
  /** Footer decision for any session in an initiated repo: a bound feature renders as statusCompact, its ⚠️
1279
1368
  * from its own failing checks only; an unbound session shows the count of unfinished features — never a
1280
1369
  * slug, so a fresh session is never shown (or made to feel bound to) a feature it did not take with flow
1281
- * use — and `⧖ no flows` when nothing is in flight: dev-flow initiated means a footer always present. */
1370
+ * use — and `💬 no flows` when nothing is in flight: dev-flow initiated means a footer always present.
1371
+ * 💬 is the legend's "operator, your turn": an unbound session is parked on the operator by definition (an
1372
+ * answer to start, or nothing to do until they say), so the pre-flow glyph is the honest one there too. */
1282
1373
  export function statusFor(bound: FlowState | null, openCount: number): { text: string } {
1283
1374
  if (bound && bound.stage !== "done") {
1284
1375
  const { text, failed } = statusCompact(bound);
1285
1376
  return { text: failed ? `${text} ⚠️` : text };
1286
1377
  }
1287
- if (openCount < 1) return { text: "⧖ no flows" };
1288
- return { text: `⧖ ${openCount} flow${openCount === 1 ? "" : "s"} open` };
1378
+ if (openCount < 1) return { text: "💬 no flows" };
1379
+ return { text: `💬 ${openCount} flow${openCount === 1 ? "" : "s"} open` };
1289
1380
  }
1290
1381
 
1291
1382
  /** `- [ ]` checklist items of a markdown document (reflections.md and roadmap.md share the format). */
@@ -1670,7 +1761,7 @@ export function compactionReflectionLine(slug: string, stage: Stage, reason: str
1670
1761
  /** The playbook's merge style spelled for a hint: "" when the project has no policy. */
1671
1762
  function mergeHintFor(cfg: Config): string {
1672
1763
  const m = cfg.release.merge;
1673
- return m && m !== "any" ? ` (the playbook says merge = ${m} — gh pr merge --${m === "merge" ? "merge" : m})` : "";
1764
+ return m && m !== "any" ? ` (the playbook says merge = ${m} — gh pr merge <n> --${m === "merge" ? "merge" : m}, number before the flag: a trailing one reads as the PR selector)` : "";
1674
1765
  }
1675
1766
 
1676
1767
  export function nextHint(state: FlowState, cfg: Config): string {