pi-dev-flow 0.72.0 → 0.74.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +51 -0
- package/README.md +5 -3
- package/docs/gates.md +4 -4
- package/docs/guardrails.md +6 -4
- package/docs/headless.md +3 -4
- package/docs/playbook.md +8 -16
- package/extensions/dev-flow.ts +416 -1138
- package/package.json +1 -1
- package/skills/dev-flow/SKILL.md +4 -9
- package/skills/dev-flow/references/finish.md +3 -7
- package/skills/dev-flow/references/implement.md +28 -47
- package/skills/dev-flow/references/plan.md +0 -4
- package/skills/dev-flow/references/pre-release.md +1 -6
- package/skills/dev-flow/references/reflect.md +1 -6
- package/skills/dev-flow/references/release.md +3 -1
- package/skills/dev-flow/references/start.md +3 -15
- package/src/core.ts +168 -1014
- package/src/projectmd.ts +20 -40
- package/src/timeouts.ts +2 -2
- package/docs/stage-agent.md +0 -227
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,57 @@ Format: newest first. `Unreleased` collects what's merged but not yet tagged.
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.74.0] - 2026-11-03
|
|
8
|
+
|
|
9
|
+
**Audit: gaps closed, dead code out.** A full read of the extension, core and playbook parser after 0.73.0's reset.
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
- `flow approve --yolo` and `flow release --no-version` now take effect only after the operator answers the checkpoint. Before, a refused or headless call still saved yolo/no-version, so it applied to the next gate.
|
|
13
|
+
- A session opened inside a feature worktree now drives the main checkout's flow. Before, `flow` gates, the footer, the context injection, compaction and claims read the worktree's own `.dev-flow/`; only the guards resolved the main checkout.
|
|
14
|
+
- `flow health` now runs a `flow-check health` block (it used to require `health =`). The health probe inside `flow check` now seeds first and retries within `healthWait`, the same probe verify runs.
|
|
15
|
+
- A `health =` key plus a `flow-check health` block no longer produce two `health` checks.
|
|
16
|
+
- The drafted mockup checklist item is now `(ui)`-only, so non-UI features no longer have to confirm it.
|
|
17
|
+
- Aborting a plan-stage feature that has a written plan now needs the operator's word (`--confirmed`, or a dialog).
|
|
18
|
+
|
|
19
|
+
### Removed
|
|
20
|
+
- The unreachable `done` stage. `flow finish` deletes the state, so nothing ever wrote it.
|
|
21
|
+
- Legacy compatibility:
|
|
22
|
+
- the `project.json` refusal and doctor finding;
|
|
23
|
+
- the `.current` cleanup;
|
|
24
|
+
- the `github` / `release.github` alias for `releases`;
|
|
25
|
+
- `release.*` keys under `## global` (use `## release` / `## pre-release`);
|
|
26
|
+
- inline `(plugin)` markers in flat `reflections.md` files;
|
|
27
|
+
- release-done re-reading the manifest for flows approved before the release gate recorded their version.
|
|
28
|
+
- Re-running `flow init` on an existing playbook no longer offers to regenerate it. It always refused for a hand-edited file anyway, and now it prints the doctor's findings.
|
|
29
|
+
- An edit-tool write in a worktree no longer wipes recorded checks on the spot. The worktree fingerprint at verify/release is the single staleness check, and it already catches bash edits.
|
|
30
|
+
- An auto-compaction no longer queues a `reflections.md` item.
|
|
31
|
+
|
|
32
|
+
### Changed
|
|
33
|
+
- Repeated git, forge and registry probes now go through shared helpers.
|
|
34
|
+
- `flow help` is shorter.
|
|
35
|
+
- The checkout guard sees a branch behind leading flags (`git checkout -f feat/x`) and ignores paths after `--`.
|
|
36
|
+
|
|
37
|
+
## [0.73.0] - 2026-11-03
|
|
38
|
+
|
|
39
|
+
**Back to a simple worktree flow.** 0.67–0.72 grew a worker system (about 1.9k source lines) on top of a flow that was meant to be simple. A real session (`audit-hardening`: 6 h of implement across 9 workers and 4 verify rounds, then a release the flow could not close) showed that machinery costing more than it saved. This release starts again from 0.66.0, keeps the fixes from that range that are not about workers, and adds one small optional worker.
|
|
40
|
+
|
|
41
|
+
### Removed
|
|
42
|
+
- `flow_stage` ops `run`, `verify` and `reflect`, as they were: the verify PASS stamp and its tree/HEAD/plan fingerprints, the delegation ledger and **required delegation** (verify no longer asks who wrote a commit; the driver may edit its worktree again), worker lineage/family listing, the live card, footer beat, grace steer, budget clamp and tree snapshots, `stage-sessions/` transcripts.log, and `docs/stage-agent.md`.
|
|
43
|
+
|
|
44
|
+
### Added
|
|
45
|
+
- **`flow_stage` (optional, slim).** `op: "implement"` (stage implement): a fresh pi session in the worktree with read/bash/edit/write edits and commits one slice. `op: "review"` (implement or pre-release): a fresh read-only reviewer returns findings and `verdict: PASS|FAIL`. This verdict is **advice, no gate depends on it**. The tool briefs the facts itself (absolute plan path in the main checkout, commits so far, uncommitted paths, project checks), so `note` is just the slice. A worker whose turn ends in prose is nudged to continue (up to twice), and an implement run ends with `flow check` plus the new commits. One wall-clock budget (default 60/30 min).
|
|
46
|
+
- **`release.preflight = <cmd>`**: `flow release` runs it in the worktree before anything ships (e.g. `docker build .`); a failure refuses the gate. In `audit-hardening` the tag-triggered image build broke twice after tagging.
|
|
47
|
+
|
|
48
|
+
### Changed
|
|
49
|
+
- **Shipping waits for `flow release`.** For a bound feature before the release stage, `git tag <name>`, tag pushes, `gh pr merge` / `glab mr merge` and `gh|glab release create` are refused ("run flow release first"). Shipping by hand at pre-release left `flow release` refusing "already tagged" and the flow unable to close. The skill now says yolo never skips a gate.
|
|
50
|
+
- **A feature worktree keeps its branch**: `git checkout -b` / `git switch -c` inside one is refused; an unrelated fix is its own `--patch` flow.
|
|
51
|
+
- **`--ui` is operator-granted** (`--confirmed`), like `--patch`/`--docs`: it adds a rendered-mockup requirement to the plan gate.
|
|
52
|
+
- **`bashTimeout` defaults to `inject`.** The class default timeout was always armed; refusing a call that did not state it cost about 35 wasted turns in one session. `bashTimeout = require` keeps the old behaviour.
|
|
53
|
+
|
|
54
|
+
### Kept from 0.67–0.72
|
|
55
|
+
- A session inside a feature worktree is judged by the **main checkout's** `.dev-flow/` (fixes "no active flow" on every edit/write in a worktree).
|
|
56
|
+
- The release gate proves a clean worktree (gh#131); the release recipe merges only once CI is green (gh#134); doctor treats an aborted feature as a designed state (gh#138).
|
|
57
|
+
|
|
7
58
|
## [0.72.0] - 2026-11-03
|
|
8
59
|
|
|
9
60
|
- **The implement stage must be worked, not just driven.** A session could always judge its own implement work too small to delegate and author it inline — `flow verify` proved the tree, never who wrote it. Now a normal feature's verify refuses unless every commit the branch holds falls inside a `flow_stage` worker's recorded run window: each finished worker appends its window to a dev-flow-owned `stage-sessions/delegations.log` (a session cannot sign its own proof — the ledger is refused to edit/write tools and counted as state tampering in bash), and an after-the-fact amend or rebase surfaces as an uncovered sha no write guard could ever see. While a normal feature is at implement, its own worktree is closed to its driver's edit/write tools and open to the worker that was sent to do it; the injected implement hint, the playbook and the skill no longer offer the inline escape. `--docs` and `--patch` — the operator-granted inline modes — are exempt, and there is no flag or yolo path around the rule. Heads-up for flows already at implement when you upgrade: their existing commits precede any ledger, so their next `flow verify` refuses — delegate a worker that finishes (or redoes) the work.
|
package/README.md
CHANGED
|
@@ -182,7 +182,10 @@ expects, at most 20 ranked findings, changes nothing. The operative sibling **`/
|
|
|
182
182
|
makes the cuts audit and review only name: dead code, no-op subsystems, duplication,
|
|
183
183
|
speculative layers — removed in a risk-ascending order, one verified commit per cut, green
|
|
184
184
|
tests as contract, and a structural-vs-cheap self-audit so the diff shrank because the system
|
|
185
|
-
got smaller, not because comments got deleted.
|
|
185
|
+
got smaller, not because comments got deleted. For a big implement slice the session can hand
|
|
186
|
+
the work to **`flow_stage`**: a fresh pi session in the worktree that edits, commits and reports,
|
|
187
|
+
or a fresh read-only reviewer (`op: "review"`) whose PASS/FAIL is advice, not a gate. Both are
|
|
188
|
+
optional, and the plan path, commits and checks are briefed automatically. And while a flow writes code, the
|
|
186
189
|
implement stage injects a compact senior-discipline guidance — smallest complete change, no
|
|
187
190
|
speculative abstraction, finish what your change breaks, a failing-first test for risky logic —
|
|
188
191
|
your playbook's `prose.implement` replaces it wholesale whenever you write your own. (The review
|
|
@@ -214,7 +217,7 @@ While a feature is active, every tool call passes a guard:
|
|
|
214
217
|
sanctioned overwrite keeps a `.bak`;
|
|
215
218
|
- your own `deny` / `confirm` / `protect` / `forbid` rules run on every command and path, ahead of
|
|
216
219
|
dev-flow's verdicts, with the reason you wrote;
|
|
217
|
-
- a shell call
|
|
220
|
+
- a shell call with no timeout gets its class default armed silently, and a bash command named `flow` is refused (there is no
|
|
218
221
|
CLI — gates live in the session).
|
|
219
222
|
|
|
220
223
|
→ [Guardrails](docs/guardrails.md) — the full list, and [what this is *not*](docs/guardrails.md#limitations-deliberate-v1).
|
|
@@ -244,6 +247,5 @@ shipped feature checks off the item it was picked from.
|
|
|
244
247
|
| [docs/gates.md](docs/gates.md) | every gate and flag, what makes each refuse |
|
|
245
248
|
| [docs/guardrails.md](docs/guardrails.md) | everything enforced, and the deliberate limits |
|
|
246
249
|
| [docs/concurrency.md](docs/concurrency.md) | several agents, one repo: bindings, claims, attribution |
|
|
247
|
-
| [docs/stage-agent.md](docs/stage-agent.md) | `flow_stage`: run a heavy stage in a disposable worker session — nested under the driver in pi's picker |
|
|
248
250
|
| [docs/headless.md](docs/headless.md) | driving a session from a bot/UI/queue: `NEEDS-OPERATOR`, `--json` surfaces |
|
|
249
251
|
| [docs/development.md](docs/development.md) | hacking on dev-flow itself: tests, self-hosting, `/reload` |
|
package/docs/gates.md
CHANGED
|
@@ -9,19 +9,19 @@ so it needs no `--confirmed`.
|
|
|
9
9
|
|
|
10
10
|
| Gate | Advances | Refuses unless |
|
|
11
11
|
|---|---|---|
|
|
12
|
-
| `start <slug> [--ui
|
|
12
|
+
| `start <slug> [--ui|--patch|--docs --confirmed] [--merge=squash\|merge\|rebase\|any] [--check-upstream]` | → plan | slug is new (binds the session); `--ui` and the relaxed modes are operator-granted in chat, anchored by `--confirmed` (`--ui` = the plan gate demands rendered mockups); `--patch` = chore release, no plan document, every gate unchanged; `--docs` = docs-only, no plan document and no tier-1 checks (worktree and release intact). Start prints the dev-flow build and stamps it into the feature state (`flow status` shows `flow=<ver>`), warns when **this session runs an older build than the checkout** (`--check-upstream` also asks npm for the published one), prints the playbook gaps `flow doctor` would report — and **refuses while the playbook has no `merge` policy**: it names the question (squash / merge / rebase / any), the style its own history suggests, and the re-run `--merge=<style> --confirmed`, which writes the answer into `## release` (single-line insert, validated, `.bak` kept, committed as a playbook chore only when the playbook is the only dirty path) and never asks again |
|
|
13
13
|
| `use <slug>` | — (binds this session to a feature) | slug unfinished — the binding is persisted to disk as a claim (`flow version` lists every dev-flow copy registered in the process, and a copy whose in-memory bindings never saw the bind attributes commands from the claim, so a two-sources setup does not misjudge your git) |
|
|
14
14
|
| `approve [--yolo]` | plan → implement (creates worktree + branch) | `plan/plan.md` exists **by name** (a separate pre-plan/direction file does not open the gate — a preliminary direction belongs inside plan.md); if `--ui`, rendered mockup screenshots (per `mockupGlobs`, default `*.png`) exist under `plan/` — headless chromium renders embedded in plan.md, and the gate opens plan.md to prove it: every image file under `plan/` must appear in an embed (``, case-insensitive) and every `mockups/<screen>.html` must carry an embedded `<screen>-<width>.` shot; **one question** — or `--confirmed` after you answered in chat; **yolo** (your chat answer at **any** checkpoint question) → run that gate with `--yolo --confirmed` (`approve`/`verify`/`release`/`finish`): that question is answered and every later one (Verified?/Release?/Finish?) is pre-confirmed — the agent then runs the remaining gates back to back, honoring guidance attached to the yolo word (e.g. "yolo, create a patch version release") — checks and guardrails stay fully enforced. `commands.setup` runs in the worktree and is retried until it succeeds once (a worktree left behind by a failed setup is set up on the next `approve`, never silently reused); a `--docs` feature runs no project command at all and says `setup skipped (docs mode)` |
|
|
15
15
|
| `test` | records a check | — (runs the `test` command/check, records pass/fail) |
|
|
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
|
-
| `verify [--yolo]` | implement → pre-release |
|
|
19
|
-
| `release [--yolo|--no-version|--no-fold-check]` | pre-release → release | checks re-greened after the prep edits; **the worktree holds no uncommitted paths** (gh#131: a merge ships the branch, not the working tree — an uncommitted fix at this gate is a fix that never ships; the refusal lists the paths, and the approved line prints `commits: N ahead of <default>, M uncommitted path(s)` like verify's); 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) |
|
|
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`); with **no `dev` command but a `health` probe configured the gate live-re-probes the app before asking** (`health: live re-probe PASS` — a killed server refuses with `live probe FAILED`, because process death dirties no worktree fingerprint and a green record alone cannot prove liveness: start the app and rerun), 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; `release.preflight` (when set) passes in the worktree — the build the tag will trigger, proven before anything ships; **the worktree holds no uncommitted paths** (gh#131: a merge ships the branch, not the working tree — an uncommitted fix at this gate is a fix that never ships; the refusal lists the paths, and the approved line prints `commits: N ahead of <default>, M uncommitted path(s)` like verify's); 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 (the refusal lists the paths, not just the count — gh#131); 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 |
|
|
23
23
|
| `roadmap [add "<feature>" \| pick <n> <slug> \| done <n> \| tidy]` | — | manages `.dev-flow/roadmap.md`, the gitignored backlog of future features (`- [ ]` checklist): bare prints the numbered open items, `add` appends one, `pick <n> <slug>` stamps open item n with `(slug)` so `flow start <slug>` can take it — **`finish` checks the stamped item off when that feature ships**; `done <n>` checks off by hand (items shipped outside a flow), `tidy` drops the checked lines. Never gates; the open count is surfaced in `status` and session context |
|
|
24
|
-
| `doctor ["<issue note>"]` | — | read-only findings: playbook drift, dead commands/scripts, untracked playbook, ghost feature dirs, orphan worktrees/branches
|
|
24
|
+
| `doctor ["<issue note>"]` | — | read-only findings: playbook drift, dead commands/scripts, untracked playbook, ghost feature dirs, orphan worktrees/branches — the state of an **aborted** feature is never a finding (its worktree cleanup is by design — gh#138) — **plus a review of every open reflection, each routed to the flow that should fix it** (playbook item → docs flow; plugin item → upstream issue, or a patch/normal flow inside the dev-flow repo) — every item is labelled from the `## section` it is filed under (the file is the record, so the table cannot disagree with it) and items sitting outside both sections are named rather than silently bucketed. It writes nothing and asks nothing, safe for agents and CI at any stage; the agent investigates, you confirm, the routed flow implements. `doctor "<note>"` prints an investigation brief and a fix route for a fresh observation, including the section it would be filed under and why |
|
|
25
25
|
| `status [slug]` / `abort [slug]` | — | — |
|
|
26
26
|
| `help` (`--help`, `-h`) | — | — (prints the gate help — answerable in any repo, at any stage, with no `.dev-flow/`) |
|
|
27
27
|
| `version [--check-upstream]` | — | — (prints dev-flow's **own** version and the directory it was loaded from — which copy this session runs, this checkout vs an installed `pi-dev-flow`; when the checkout has moved past the build this session loaded it says so and names both, because the gates execute the loaded code — `/reload` to run the newer one; `--check-upstream` adds the published npm version; answerable in any repo, at any stage, with no `.dev-flow/`) |
|
package/docs/guardrails.md
CHANGED
|
@@ -6,14 +6,16 @@ While a feature is active, the extension intercepts every tool call:
|
|
|
6
6
|
|
|
7
7
|
- **Nothing on main, ever** (until release): `git commit` on the default branch is blocked at every stage except `release` — where release chores commit in the main checkout (prefixed `DEV_FLOW_ALLOW_MAIN=1` for the hook) — and except one chore that needs no flow: a commit whose **only** change in the checkout is `.dev-flow/project.md`, because tracking the operator's playbook is setup, not feature work (any other dirty path closes that lane). pushes are judged by the ref they write — only pushing *to* the default branch (or a bare push while on it) requires stage `release`, so tag pushes and feature-branch pushes pass from any stage; `git merge` onto the default branch also requires stage `release`. Plus the standalone pre-commit hook for commits made outside Pi.
|
|
8
8
|
- **No code before an approved plan**: at stage `plan`, edits are confined to `.dev-flow/<slug>/` — the session's **own** feature directory, so one session cannot write another feature's plan and have its gate rubber-stamp what it never wrote.
|
|
9
|
-
- **Work stays in the worktree**: at stages `implement` and `pre-release`, edits are confined to that feature's worktree — judged per-path by the owning feature, so one session can never write into another session's worktree or into the main checkout. A throwaway **outside** the checkout is not feature work and stays free at every stage (the OS temp dir, e.g. a one-off rewrite script): both sides are realpath'd, so a symlink out of the temp dir is still judged as the repo path it writes, and a repository that merely lives under the temp dir (a test repo) keeps the stage rules.
|
|
9
|
+
- **Work stays in the worktree**: at stages `implement` and `pre-release`, edits are confined to that feature's worktree — judged per-path by the owning feature, so one session can never write into another session's worktree or into the main checkout. A throwaway **outside** the checkout is not feature work and stays free at every stage (the OS temp dir, e.g. a one-off rewrite script): both sides are realpath'd, so a symlink out of the temp dir is still judged as the repo path it writes, and a repository that merely lives under the temp dir (a test repo) keeps the stage rules.
|
|
10
|
+
- **Shipping waits for `flow release`**: while a bound feature is at `plan`, `implement` or `pre-release`, cutting or pushing a tag (`git tag <name>`, `git push --tags`, `refs/tags/…`), merging its PR (`gh pr merge`, `glab mr merge`) and creating a forge release (`gh|glab release create`) are refused with "run flow release first". Shipping by hand first left `flow release` unable to record the release ("already tagged") and the flow unable to close. Reads (`git tag -l`, `gh pr view`) and opening the PR at pre-release are unaffected.
|
|
11
|
+
- **A feature worktree keeps its branch**: creating a branch inside a feature worktree (`git checkout -b`, `git switch -c`) is refused. An unrelated fix is its own flow (`flow start <slug> --patch --confirmed`), not a side branch in someone's worktree. A session whose cwd is a feature worktree is judged by the **main checkout's** `.dev-flow/` state, which is where the features live.
|
|
10
12
|
- **Flow by default**: in a repo with `.dev-flow/`, an unbound session cannot touch source files at all — every request goes through `flow start`/`flow use`; there is no bypass. `flow start` refuses when the main checkout isn't on the default branch, worktrees are always created from the default branch, and the agent cannot check feature branches out in the main checkout.
|
|
11
|
-
- **Gates can't be skipped**: flow state is untouchable by the agent (edit tool and bash) — writing `state.json
|
|
13
|
+
- **Gates can't be skipped**: flow state is untouchable by the agent (edit tool and bash) — writing `state.json` or `claim.json`, moving either away, or deleting a feature directory or the whole `.dev-flow/` folder all block, at a relative **or an absolute** path (an absolute path names the same folder); the `project.md` playbook is operator-owned — the main-checkout copy is blocked for the agent outright, and only a **docs or patch flow's** worktree copy may be edited (normal features route playbook changes to their own flow); every sanctioned playbook overwrite keeps the previous file as `project.md.bak`; every recorded check carries a fingerprint of the worktree it ran against (paths, uncommitted diff, HEAD) — an edit-tool change clears the records at once, and any other write (`sed -i`, a formatter, codegen through bash) is caught at the gate itself, which reruns what went stale and says so; edit/write paths are judged by realpath, so a symlink out of the worktree cannot launder a confined write.
|
|
12
14
|
- **Your project's own rules**: every `deny`/`confirm`/`protect`/`forbid` rule from the `flow-guard` block in project.md `## global` runs on every bash command and every edit/write path — in every stage and binding, ahead of dev-flow's own verdicts. A block always carries the reason you wrote.
|
|
13
15
|
- **The rules reach the agent, they are not left in a file it may never read**: pi advertises a skill and loads it only if the model chooses to, so the ground rules of the dev-flow skill are injected into every session once (and again after a compaction that summarized them away), and each stage's turn names the one playbook file that stage needs. The guards enforce the same discipline either way — this is what makes the agent follow it without being stuck.
|
|
14
16
|
- **A forced push asks the operator**: `git push` carrying `--force`, `--force-with-lease…` or `-f` is confirmed before it runs — a rewritten branch is history CI and other sessions already have. The one spelling that answers for it is the prefix the refusal prints (`DEV_FLOW_ALLOW_REWRITE=1 git push -f …`), the same "the operator said so" contract as `DEV_FLOW_ALLOW_MAIN`. Local history rewrites (`git filter-branch --force`) are not pushes and stay free, so a project never needs a blunt flag-only deny of its own.
|
|
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)
|
|
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
|
|
17
|
+
- **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) every shell call without one therefore gets the class default armed silently (30s quick inspection · 120s local git and unknown · 180s network · 300s containers/services · 900s builds/tests/installs · 1,200s watchers like `gh run watch`), and absurd explicit values clamp to 1,800s. A project that wants the timeout visible on every call line sets `bashTimeout = require` in `## global` — then a call without one is refused, naming the value it would have armed (each refusal costs a turn, which is why it is no longer the default). Uninitiated folders hear nothing at all: without the playbook dev-flow enforces no rules.
|
|
18
|
+
- **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.
|
|
17
19
|
- 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
20
|
- **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
21
|
|
package/docs/headless.md
CHANGED
|
@@ -35,10 +35,9 @@ The contract a headless driver (a session with no UI) relies on:
|
|
|
35
35
|
`dev` deploy (runs are killed past 15 min) and re-probes health with `healthWait` retries.
|
|
36
36
|
A remote timeout must be minutes, not seconds — the gate prints progress lines while it
|
|
37
37
|
runs.
|
|
38
|
-
- **Edits
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
rerun records the tree has outgrown (`stale record(s) rerun after a worktree change: …`).
|
|
38
|
+
- **Edits make checks stale.** Every check carries a fingerprint of the worktree it ran against
|
|
39
|
+
(edit-tool writes, `sed -i`, a formatter, codegen alike), and verify/release rerun records the
|
|
40
|
+
tree has outgrown (`stale record(s) rerun after a worktree change: …`).
|
|
42
41
|
Re-running `flow check` before `verify` after the last edit is still the tidy order; the gate no
|
|
43
42
|
longer trusts a stale PASS if you skip it.
|
|
44
43
|
- **Version skew.** Gates execute the dev-flow build the session loaded at start; `flow version`
|
package/docs/playbook.md
CHANGED
|
@@ -9,11 +9,6 @@ in a repo that ignores the folder is a deliberate one-off:
|
|
|
9
9
|
env prefix is for dev-flow's `pre-commit` hook, which allows a main commit whose only change is the
|
|
10
10
|
playbook.
|
|
11
11
|
|
|
12
|
-
Inside, each `.dev-flow/<slug>/` folder holds one feature's whole world — its state, its `plan/`,
|
|
13
|
-
its worktree. The plan lives in the *folder*, not the worktree, on purpose: a plan must exist (and
|
|
14
|
-
stay amendable through implement) before the worktree exists at all — the worktree is created only
|
|
15
|
-
when `approve` runs.
|
|
16
|
-
|
|
17
12
|
It is **committed to git**; you edit it (the agent is blocked from writing the main-checkout copy
|
|
18
13
|
and may edit it only inside a docs/patch flow's worktree, or apply it through `flow init --write`
|
|
19
14
|
on your word, which validates). Content is organized per stage
|
|
@@ -22,9 +17,9 @@ executable checks and hard safety rules:
|
|
|
22
17
|
|
|
23
18
|
| Tier | Notation | Enforcement |
|
|
24
19
|
|---|---|---|
|
|
25
|
-
| 1 — executable | ` ```flow` (`key = value`) config blocks; ` ```flow-check <name>` command blocks | gates run every check, record pass/fail
|
|
20
|
+
| 1 — executable | ` ```flow` (`key = value`) config blocks; ` ```flow-check <name>` command blocks | gates run every check, record pass/fail against a worktree fingerprint, a changed tree makes them stale — hard |
|
|
26
21
|
| 1 — guard | ` ```flow-guard ` (`deny`/`confirm`/`protect`/`forbid`) rules in `## global` | enforced on every bash command and every edit/write path, at every stage — hard block or operator confirmation |
|
|
27
|
-
| 2 — checklist | `- [ ] item` lines (`- [ ] (ui) item` = only for `--ui` features) | gate confirms cover them as a set (hashed
|
|
22
|
+
| 2 — checklist | `- [ ] item` lines (`- [ ] (ui) item` = only for `--ui` features) | gate confirms cover them as a set (hashed: changing the items asks again); `(ui)` items never appear for non-UI features |
|
|
28
23
|
| 3 — prose | any other text | injected to the agent when its stage begins — advisory |
|
|
29
24
|
|
|
30
25
|
Example `## implement` section:
|
|
@@ -106,9 +101,9 @@ here if your project wants that (per-sprint grouping, issue numbers, a strict Ke
|
|
|
106
101
|
vocabulary).
|
|
107
102
|
|
|
108
103
|
`## global` holds
|
|
109
|
-
`defaultBranch`, `branchPattern`, `worktreeDir`, `mainHook`, `mockupGlobs`, `bashTimeout =
|
|
110
|
-
(default: every shell call
|
|
111
|
-
`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`/
|
|
104
|
+
`defaultBranch`, `branchPattern`, `worktreeDir`, `mainHook`, `mockupGlobs`, `bashTimeout = inject`
|
|
105
|
+
(default: the class timeout is armed silently on every shell call) `| require` (refuse calls that do not state one), `release.review`,
|
|
106
|
+
`release.changelog` (default `CHANGELOG.md`; set it empty to opt out), `release.releases`, `release.preflight = <cmd>` (run in the worktree by `flow release` before anything ships — e.g. `docker build .`, so the build the tag triggers is proven first; a failure refuses the gate) 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`/
|
|
112
107
|
`dev`. Of those, `setup` runs once inside a freshly created worktree at `approve` (where `cp .env` +
|
|
113
108
|
`npm install` belong — a failing setup fails the gate), and `run` is advisory: the agent starts the app
|
|
114
109
|
with it for the running-and-healthy walk, dev-flow never runs it itself. `dev` is the dev deploy run by
|
|
@@ -126,8 +121,7 @@ gate prints `health: none configured` and `flow doctor` flags the combination. T
|
|
|
126
121
|
`forge = github | gitlab | self` — the release machinery's target; when unset it is detected from the
|
|
127
122
|
`origin` URL at the moment of use (GitHub gets `gh`, GitLab gets `glab`, self-hosted stays forge-neutral:
|
|
128
123
|
no automatic release creation, merge proof by ancestry only), and `release.releases = false` skips
|
|
129
|
-
automatic release creation entirely
|
|
130
|
-
A leftover `project.json` is no longer read — the doctor tells you to fold it in and delete it.
|
|
124
|
+
automatic release creation entirely.
|
|
131
125
|
|
|
132
126
|
### The merge policy (`merge = squash | merge | rebase | any`)
|
|
133
127
|
|
|
@@ -167,10 +161,8 @@ the agent asks you each question, fills the draft and writes your answers back v
|
|
|
167
161
|
interactive init may also confirm the draft with you on the spot and write it then); **existing file** → doctor mode (drift, dead commands/scripts,
|
|
168
162
|
unparseable manifest, dual configs, **ghost feature dirs** (a `.dev-flow/<slug>/` whose `state.json`
|
|
169
163
|
is gone — it offers to delete those, on your confirm, and says so instead when no UI is present) —
|
|
170
|
-
it never runs your commands)
|
|
171
|
-
|
|
172
|
-
checklist items, hand-set keys): it prints the findings and the lines it would drop instead of
|
|
173
|
-
overwriting them. `--force` remains the deliberate overwrite — with your word (`--confirmed`, or one
|
|
164
|
+
it never runs your commands). It prints the findings and never regenerates your file — a draft
|
|
165
|
+
cannot reproduce your prose, checklist items and hand-set keys. `--force` is the deliberate overwrite — with your word (`--confirmed`, or one
|
|
174
166
|
confirm dialog) and a `project.md.bak` of what was there. At any time
|
|
175
167
|
you can just edit `.dev-flow/project.md` yourself — the next `flow init` (doctor) validates and
|
|
176
168
|
flags problems, and `flow doctor` runs the same probes on demand without offering to change
|