pi-dev-flow 0.64.4 → 0.64.6

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.6] - 2026-10-26
8
+
9
+ ### Changed
10
+
11
+ - **The changelog writer reviews the branch, not its commit list.** Changelog prose was the one part of the release the agent wrote from nothing but a clause — *update the changelog* — while every real rule was a gate proof (the heading names the version, this branch prepared the entry, folded lines survive verbatim, nothing left under `Unreleased`). Proofs check structure and never granularity, so the entry kept the shape its branch was built from: a change that landed as the fix, its follow-up and the test chasing it read as three near-identical lines — and that entry is also the forge release body, so the noise published verbatim. The pre-release reference now tells the writer to read `git log` *and* `git diff <default>…HEAD` and write the net change in the reader's terms (what was broken, what works now): **one entry per net change, never one per commit**, two lines sharing a subject being the tell to merge them, and work that never reached the reader (reverted mid-branch, dropped on the way, pure moves) getting no line at all. The rule is stated as fold-safe on purpose — the fold proofs guard lines that were already pending under `Unreleased` (another flow's, moved verbatim), never the wording of the entry this flow is writing — and `docs/gates.md` says so where the proofs are documented, so their verbatim discipline is not read as *one line per commit, forever*. `docs/playbook.md` adds the human counterpart: what an entry *is* stays the project's own prose, the gate asks only for the heading and the branch's hand in it. A consistency test locks the clause, the diff step, the one-per-change rule and the fold-safe note into the stage reference.
12
+
13
+ ## [0.64.5] - 2026-10-25
14
+
15
+ ### Fixed
16
+
17
+ - **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.
18
+ - **`.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.
19
+ - **`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.
20
+
21
+ ### Added
22
+
23
+ - **💬 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.
24
+
7
25
  ## [0.64.4] - 2026-10-25
8
26
 
9
27
  ### Added
package/docs/gates.md CHANGED
@@ -16,7 +16,7 @@ so it needs no `--confirmed`.
16
16
  | `check` | records all tier-1 checks | — (runs every `flow-check`/test/health from project.md `## implement`); a `--docs` feature runs none of them and says `docs mode: project commands skipped` — a docs flow builds nothing, so a fresh checkout must not read as a failed deploy (#96) |
17
17
  | `health` | records a check | — (runs `seedData` + the health command, retrying up to `healthWait` seconds; app must be up locally with real data) |
18
18
  | `verify [--yolo]` | implement → pre-release | all tier-1 checks green — a check with no passing record is **run by the gate itself** (`checks ran at the gate (test)`) rather than refused and pointed at `flow check`, since entering the stage or editing the worktree is what cleared it — and so is a record whose worktree fingerprint differs from the tree now (`stale record(s) rerun after a worktree change: …`): a change made through bash fires no edit-tool hook, the fingerprint is what notices the tree moved — and a failure there prints the run output, **the feature branch holds at least one commit** (verify refuses a branch with nothing committed — the checks describe the working tree, so an uncommitted state has never been recorded — and prints `commits: N ahead of <default>, M uncommitted path(s)` with what it ran; uncommitted paths are reported, never gated), build (if configured) green, `dev` deploy (if configured) runs first so you can review the running app **and the health probe (if configured) re-runs against what it just deployed, retrying every 2s up to `healthWait` seconds** (a failing probe refuses the gate and reports how many attempts it took: the `flow check` PASS predates the deploy, and a service that needs seconds after its container starts is not a broken deploy; with no probe the output says `health: none configured`), tier-2 checklist (ui-only items excluded for non-UI features) confirmed as a set; a `--docs` feature runs none of it (`docs mode: project commands skipped`) and only asks you; **one question** — or `--confirmed`; `--yolo --confirmed` = you answered 'yolo' at Verified? — answers it and pre-confirms the rest |
19
- | `release [--yolo|--no-version|--no-fold-check]` | pre-release → release | checks re-greened after the prep edits; with `versioning.file`: the manifest version parses and is **not tagged yet** (the bump must be ahead of the last release); with `release.changelog` the gate **proves the entry mechanically** (#97): a **heading names the version** (prose that mentions it, or a `1.2.0-beta` section when releasing `1.2.0`, is not an entry), **this branch touched the file** (an inherited changelog is not release prep), **every entry that was pending before the release survives inside the new section** — compared on normalized lines, so re-indenting a fold is free while rewording or deleting one is refused by naming the line — and **nothing is left under `Unreleased`**. The pending baseline is the newest tag's changelog (what actually shipped), else the branch's merge base; when neither resolves, the two git-dependent proofs are skipped **with a printed advisory** rather than refusing a legal release for a topology reason, and the content proofs (the heading, its body) always run; tier-2 `## pre-release` checklist confirmed; the manifest version it validates is **stamped as the release's version of record** (`release-done` publishes that, whatever the checkouts say later); **one question** (Release?) — or `--confirmed`; `--no-version` (your call at Release?) ships this flow as **merge + changelog** — the bump/tag requirements and the tag checks at `release-done` are skipped for it, but the branch must still add its **own line under `Unreleased`** (editing an older section releases nothing) and it rides there until the next versioned release folds it (default: versioned); `--no-fold-check` is the operator-granted escape from the line-level fold proofs — one flow, stamped in the gate output, the heading and touched proofs stay; **stale session build** (loaded build behind the checkout): the gate prints both builds, lists what shipped between them (those proofs will not run this release) and folds *update (/reload, then re-run) or proceed with the old release?* into the Release? question — the operator's word, recorded in the release output, **never a block**: publishing under an older gate is a legitimate choice (hotfix, offline reload) |
19
+ | `release [--yolo|--no-version|--no-fold-check]` | pre-release → release | checks re-greened after the prep edits; with `versioning.file`: the manifest version parses and is **not tagged yet** (the bump must be ahead of the last release); with `release.changelog` the gate **proves the entry mechanically** (#97): a **heading names the version** (prose that mentions it, or a `1.2.0-beta` section when releasing `1.2.0`, is not an entry), **this branch touched the file** (an inherited changelog is not release prep), **every entry that was pending before the release survives inside the new section** — compared on normalized lines, so re-indenting a fold is free while rewording or deleting one is refused by naming the line — and **nothing is left under `Unreleased`**. The proofs guard the **baseline's** pending lines — they do not freeze the wording of the entry this flow writes, so a branch that landed as several iteration commits is free to state its result as one entry (see the changelog-writer rule in the pre-release reference). The pending baseline is the newest tag's changelog (what actually shipped), else the branch's merge base; when neither resolves, the two git-dependent proofs are skipped **with a printed advisory** rather than refusing a legal release for a topology reason, and the content proofs (the heading, its body) always run; tier-2 `## pre-release` checklist confirmed; the manifest version it validates is **stamped as the release's version of record** (`release-done` publishes that, whatever the checkouts say later); **one question** (Release?) — or `--confirmed`; `--no-version` (your call at Release?) ships this flow as **merge + changelog** — the bump/tag requirements and the tag checks at `release-done` are skipped for it, but the branch must still add its **own line under `Unreleased`** (editing an older section releases nothing) and it rides there until the next versioned release folds it (default: versioned); `--no-fold-check` is the operator-granted escape from the line-level fold proofs — one flow, stamped in the gate output, the heading and touched proofs stay; **stale session build** (loaded build behind the checkout): the gate prints both builds, lists what shipped between them (those proofs will not run this release) and folds *update (/reload, then re-run) or proceed with the old release?* into the Release? question — the operator's word, recorded in the release output, **never a block**: publishing under an older gate is a legitimate choice (hotfix, offline reload) |
20
20
  | `release-done` | records the release (the stage stays `release`) | **no question — the Release? answer covered the publication**; verify approval; the version published is the one `release` **stamped** from the manifest it validated (a main checkout still behind cannot republish the previous version), and it must not be older than the newest matching tag **on origin** (tag lists come from `git ls-remote`, so an unfetched clone does not decide what exists; when an origin exists but cannot be asked (offline, no ssh agent) **both release gates refuse** rather than answering with local tags); with `versioning.file`: that tag exists, is reachable from the default branch **and is on origin** (a local-only tag is not a release); with `release.artifact`: the published-artifact check runs (`{version}`/`{tag}` placeholders — the line it prints names the version it verified; skip once with `--no-artifact-check`, operator-instructed only) · creates the forge release from the tag, its body **the `release.changelog` entry for that version** — the changelog is the source of truth, and the tag's annotation stands in only when the changelog has no entry for the version, else nothing (and it says why — a body that is really a shell error is dropped, never shipped) — `gh` for GitHub, `glab` for GitLab) and then **proves the release exists**: it asks the forge (`gh release view <tag>` / `glab release view <tag>`) and refuses when nothing is there, because #51, #60 and #63 were three ways of ending `release recorded as complete` with nothing published — and when the changelog was the body it **reads the stored body back** and refuses a mismatch, so the release page and the changelog cannot drift (#97; normalized before comparing, skipped with a printed note on another forge). Skipping is deliberate and loud — `--no-release-create`, `release.releases = false` or `forge = self` each print that no forge release was created, and the view check is skipped for them; **with a `merge` policy** it also proves the merge that shipped matches it — branch ancestry plus what the forge says (`gh pr view` / `glab api`), so a squash under `merge = merge` (or a merge commit under `merge = squash`) refuses the release record, while a shape it cannot see prints an advisory instead (#97's split: an invisible topology never blocks a legal release); when the release went out on a stale build the operator acknowledged at the release gate, it prints that acknowledgement in place of the after-the-fact version-skew warning, and that warning prints the session vs disk version pair plus the duplicate-copy note when a second copy is registered (#117) |
21
21
  | `finish [--yolo] [slug]` | release → done (removes worktree + branch, deletes `.dev-flow/<slug>/`, and deletes `origin/<branch>` **only** when its merged state is verified — ancestor of the default branch or a merged PR/MR via `gh`/`glab`; unverifiable branches stay with a note) | a release is recorded (`release-done` ran), the main checkout is clean **and** pushed to `origin/<default>`, and the worktree has no uncommitted changes; when the clean checkout trails `origin/<default>` the gate **fast-forwards local main** as it closes out (never a merge — anything that cannot fast-forward prints the operator's exact `git pull --ff-only` command); **one question** (Finish? — mentions unmerged-looking commits with the playbook's `merge` policy in mind, and warns when the forge release create failed at `release-done` and no retry succeeded) — or `--confirmed`; under `merge = merge`, commits that never reached the default branch are a **policy violation**: `yolo` does not answer it, only your explicit answer does; to abandon an unreleased feature use `abort` |
22
22
  | `reflect ["<note>"|list|tidy|move <n> --plugin|--playbook]` | — | `reflect "<note>"` queues a suggestion in `reflections.md` (never gates; gate flags such as `--confirmed` are ignored, they never become part of the note). `--playbook` / `--plugin` files it in that section — the agent knows what its own note is about, so the wording guess is the fallback, and the echoed line prints the reason it landed where it did (`"gate" names dev-flow itself`, `playbook or project wording`, `nothing plugin-shaped in the note …`); a note is filed under **one** section, never both. `reflect list` numbers the open items with their section; `reflect move <n> --plugin|--playbook` re-files one of them. `reflect tidy` drops the closed (`- [x]`) items — the preamble and open items stay verbatim and a `## section` heading left empty goes with its items; every surface that queues or reviews reflections (`reflect "<note>"`, bare `reflect`, `doctor`) nudges with the closed count when the checked-off pile grows. Bare `reflect` prints the full **session-reflection protocol** for the agent (from the `/flow reflect` bar it additionally wakes the model, so the protocol executes immediately): review the whole session log, re-check every open item against the current playbook and **newer dev-flow versions** (`npm view pi-dev-flow version` vs the running version — dev-flow ships from npm; recommend `pi install npm:pi-dev-flow` + `/reload`, the operator performs updates), dedupe new findings against the open ones, then report playbook vs plugin items to the operator and ask whether to fix now — plugin items: search upstream issues first (`gh issue list --repo <upstream> --state all --search …`; an author-addressed match is reported back, no match → `gh issue create` with a detailed description and a suggested fix), playbook items: `flow doctor` routes each to the docs flow that implements it |
@@ -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
@@ -92,7 +92,15 @@ otherwise; confirm the number before tagging” live — the agent sees them at
92
92
  `flow release` / `flow release-done` hard-check the manifest side (bumped past the last tag, then
93
93
  manifest↔tag agreement) and the changelog side (a heading for the version, an entry this branch
94
94
  prepared, and every entry that was pending before the release folded into it — see
95
- [gates.md](gates.md)). `## global` holds
95
+ [gates.md](gates.md)).
96
+ What an entry **is** stays the agent's stage convention, not a gate matter: the changelog records the
97
+ net change of a branch, not its commit history — a feature that landed through several iteration
98
+ commits is one entry telling the final state, and the fold proofs (which guard only lines already
99
+ pending under `Unreleased`) never stand in the way of merging your own lines. Say it differently
100
+ here if your project wants that (per-sprint grouping, issue numbers, a strict Keep-a-Changelog
101
+ vocabulary).
102
+
103
+ `## global` holds
96
104
  `defaultBranch`, `branchPattern`, `worktreeDir`, `mainHook`, `mockupGlobs`, `bashTimeout = require`
97
105
  (default: every shell call must state its own timeout) `| inject`, `release.review`,
98
106
  `release.changelog` (default `CHANGELOG.md`; set it empty to opt out), `release.releases` and `release.artifact = <cmd>` (verify the published artifact — image registry probe etc. — before release-done completes); the implement stage takes `setup`/`test`/`build`/`run`/`seedData`/`health`/
@@ -132,10 +140,11 @@ needs to know which one the release contains. Three things read the key:
132
140
  in chat, re-runs with `--merge=<style> --confirmed`, and the answer is inserted as a single line under
133
141
  `## release` (validated before the write, `.bak` kept, committed as a playbook chore when the playbook is
134
142
  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
143
+ - **the guard enforces it where the decision is made** — `gh pr merge <n> --squash` against `merge = merge` is
136
144
  blocked outright, and a merge that carries no style flag (so the forge default decides) needs your
137
145
  confirmation; a local `git merge --squash` only ever confirms, because merging main into a branch is
138
- ordinary work.
146
+ ordinary work. Spell the PR number **before** the flag: `gh pr merge --merge main` reads `main` as the
147
+ PR selector ("no pull requests found for main") and never merges anything.
139
148
  - **`release-done` proves what actually landed** matched the policy (branch ancestry plus what the forge
140
149
  reports), and `flow finish` says whether commits missing from the default branch are expected (squash,
141
150
  rebase) or a violation (merge — where `yolo` does not answer for you). A shape dev-flow cannot see —
@@ -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;
package/package.json CHANGED
@@ -1,62 +1,62 @@
1
1
  {
2
- "name": "pi-dev-flow",
3
- "version": "0.64.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
- "type": "module",
6
- "keywords": [
7
- "pi-package",
8
- "pi",
9
- "pi-coding-agent",
10
- "extension",
11
- "workflow",
12
- "dev-flow",
13
- "spec",
14
- "plan",
15
- "release",
16
- "semver",
17
- "changelog",
18
- "git-worktree",
19
- "guardrails"
20
- ],
21
- "license": "MIT",
22
- "repository": "https://github.com/dmarchevsky/pi-dev-flow",
23
- "engines": {
24
- "node": ">=22.19.0"
25
- },
26
- "files": [
27
- "extensions/",
28
- "src/",
29
- "skills/",
30
- "docs/",
31
- "banner.svg",
32
- "banner.png",
33
- "README.md",
34
- "CHANGELOG.md",
35
- "LICENSE"
36
- ],
37
- "pi": {
38
- "extensions": [
39
- "./extensions/dev-flow.ts"
40
- ],
41
- "skills": [
42
- "./skills"
43
- ],
44
- "image": "./banner.png"
45
- },
46
- "peerDependencies": {
47
- "@earendil-works/pi-ai": "*",
48
- "@earendil-works/pi-coding-agent": "*",
49
- "@earendil-works/pi-tui": "*"
50
- },
51
- "devDependencies": {
52
- "@earendil-works/pi-ai": "*",
53
- "@earendil-works/pi-coding-agent": "*",
54
- "@earendil-works/pi-tui": "*",
55
- "@types/node": "^22.0.0",
56
- "typescript": "^7.0.2"
57
- },
58
- "scripts": {
59
- "build": "tsc --noEmit",
60
- "test": "node --test"
61
- }
2
+ "name": "pi-dev-flow",
3
+ "version": "0.64.6",
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
+ "type": "module",
6
+ "keywords": [
7
+ "pi-package",
8
+ "pi",
9
+ "pi-coding-agent",
10
+ "extension",
11
+ "workflow",
12
+ "dev-flow",
13
+ "spec",
14
+ "plan",
15
+ "release",
16
+ "semver",
17
+ "changelog",
18
+ "git-worktree",
19
+ "guardrails"
20
+ ],
21
+ "license": "MIT",
22
+ "repository": "https://github.com/dmarchevsky/pi-dev-flow",
23
+ "engines": {
24
+ "node": ">=22.19.0"
25
+ },
26
+ "files": [
27
+ "extensions/",
28
+ "src/",
29
+ "skills/",
30
+ "docs/",
31
+ "banner.svg",
32
+ "banner.png",
33
+ "README.md",
34
+ "CHANGELOG.md",
35
+ "LICENSE"
36
+ ],
37
+ "pi": {
38
+ "extensions": [
39
+ "./extensions/dev-flow.ts"
40
+ ],
41
+ "skills": [
42
+ "./skills"
43
+ ],
44
+ "image": "./banner.png"
45
+ },
46
+ "peerDependencies": {
47
+ "@earendil-works/pi-ai": "*",
48
+ "@earendil-works/pi-coding-agent": "*",
49
+ "@earendil-works/pi-tui": "*"
50
+ },
51
+ "devDependencies": {
52
+ "@earendil-works/pi-ai": "*",
53
+ "@earendil-works/pi-coding-agent": "*",
54
+ "@earendil-works/pi-tui": "*",
55
+ "@types/node": "^22.0.0",
56
+ "typescript": "^7.0.2"
57
+ },
58
+ "scripts": {
59
+ "build": "tsc --noEmit",
60
+ "test": "node --test"
61
+ }
62
62
  }
@@ -16,7 +16,19 @@ invent one mid-release. Sequence:
16
16
  2. Update documentation to reflect the change.
17
17
  3. Update the changelog and bump the manifest to the exact version you will
18
18
  tag — manifest, changelog and tag must agree; commit the prep on the feature
19
- branch. A versioned release **folds the `Unreleased` section** (entries
19
+ branch. **The changelog writer reviews the branch, not its commit list**:
20
+ read `git log <default>..HEAD` *and* `git diff <default>…HEAD` first and
21
+ write the entry from the net change the branch delivers, in the reader's
22
+ terms (what was broken, what works now) — this entry is also the forge
23
+ release body, so it publishes verbatim. **One entry per net change, never
24
+ one per commit:** a feature that needed iteration commits (the fix, its
25
+ follow-up, the test that chases it) is **one** line telling the final state;
26
+ two lines sharing a subject are the tell to merge them. Work that never
27
+ reached the reader — reverted mid-branch, dropped on the way, pure moves —
28
+ gets no line. Consolidating your own entry is fold-safe: the fold proofs
29
+ below guard lines that were already pending under `Unreleased` (another
30
+ flow's), which you move verbatim; your own prose is yours until the heading
31
+ ships. A versioned release **folds the `Unreleased` section** (entries
20
32
  `--no-version` flows left there) under the new version heading: the gate
21
33
  refuses while entries remain, refuses a fold that **drops or rewrites** one
22
34
  (move the lines as they are and reword afterwards in a follow-up), and
@@ -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`
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 {