pi-dev-flow 0.90.0 → 0.91.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 CHANGED
@@ -4,6 +4,22 @@ Format: newest first. `Unreleased` collects what's merged but not yet tagged.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.91.0] - 2026-11-11
8
+
9
+ **Fewer needless questions: the agent turns `--ui` on itself, takes a dev port from a flow already past review, and waits for CI instead of ending its turn.**
10
+
11
+ ### Changed
12
+ - **`--ui` no longer needs your OK; turning it off does.** `--ui` only adds a check (rendered mockups at the plan gate), so the agent now passes it by itself whenever screens change, at start or later at plan. Before, a UI feature started without it had to stop and ask, and a "proceed" you had already given didn't count because it came before the question. Removing the mockup gate is now the step that needs you: `flow start <slug> --no-ui --confirmed` at plan, and aborting a ui feature at plan (which a restart without `--ui` would otherwise use to drop the gate) asks too.
13
+ - **A dev port held by a flow past its review is taken without asking.** `flow verify` asked *Dev port?* (replace or wait) even when the flow holding the port was at pre-release or release, so its deploy had already been verified and nobody was looking at it. It now replaces that deploy and says so in the result. It still asks when the holder is in implement or is re-asking Verified?.
14
+ - **The release stage waits for CI instead of ending the turn.** The release reference now says to keep watching CI inside the turn, never to end it with "I'll keep watching" (nothing wakes the agent after the turn ends), and to re-trigger runs stuck in `queued` for about 15 minutes instead of waiting on them.
15
+
16
+ ## [0.90.1] - 2026-11-11
17
+
18
+ **Docs only: a shorter README and readable docs pages.**
19
+
20
+ ### Changed
21
+ - **Shorter, friendlier docs.** The README is half its old length and covers the essentials. `docs/gates.md` is now an overview plus one short section per gate instead of one giant table. The other docs are tightened, issue numbers have moved out of them, and reflections have their own page (`docs/reflections.md`). The README's doc links now point to GitHub, so they render on npm and pi.dev instead of opening raw markdown.
22
+
7
23
  ## [0.90.0] - 2026-11-10
8
24
 
9
25
  **Operator answers are checked everywhere they are given, docs flows stop being asked for impossible checks, and stage workers get the project's setup.**
package/README.md CHANGED
@@ -2,91 +2,40 @@
2
2
 
3
3
  ![dev-flow stages: plan, implement, pre-release, release, done — with the four operator checkpoints and the tag that publishes to npm](banner.png)
4
4
 
5
- An enforced feature workflow for [Pi](https://pi.dev), shipped as a pi package. You say what you
6
- want; an agent builds it; **the harness — not the agent's good manners — decides whether a stage
7
- may advance.** One feature at a time, five stages, and four questions asked of you —
8
- `plan → implement → pre-release → release → done`, mapped out under [How you work it](#how-you-work-it).
9
-
10
- ## The idea
11
-
12
- **Every feature starts as a spec.** `flow start <slug>` opens a feature: a folder under
13
- `.dev-flow/<slug>/` where the agent researches and writes a plan — problem, approach, files to
14
- touch, test strategy, risks — plus rendered screenshots for anything user-visible. Until you approve
15
- it, the agent cannot edit code anywhere else in the repo. That is the whole "does it actually plan?"
16
- question, answered by the harness instead of by trust.
17
-
18
- **A bound session is self-identifying.** `flow start` (and `flow use`) renames the Pi session after
19
- the flow slug, so the session picker always tells you which feature each session holds.
20
-
21
- **Stages end in gates, not vibes.** Each stage has one exit gate that refuses until its criteria
22
- hold: your plan file exists; every command your playbook names as a check passes; the app really
23
- starts, with real data, and answers a health probe **after** a real deploy; changelog and version
24
- manifest agree and the version is ahead of the last tag; the release is tagged and on the remote.
25
- Gates read state that the agent is blocked from writing, so a step cannot be quietly skipped — and
26
- each gate asks you exactly **one** question.
27
-
28
- The flow itself ships with the plugin; a project carries only a `.dev-flow/` folder — state files,
29
- plans and worktrees, nothing the plugin needs to run.
30
-
31
- **Git stays clean by construction.** Nothing commits to the default branch while a feature is in
32
- flight: work happens in its own git worktree and branch (`feat/<slug>`), so your checkout keeps
33
- moving while a feature is under way. Publishing has one order — PR → merge → annotated tag → forge
34
- release — and only in the release stage does dev-flow let git touch main again. A `pre-commit` hook
35
- covers commits made outside Pi.
36
-
37
- **Many features at once.** One Pi session = one feature = one worktree, and a repo can host as many
38
- as you want in parallel. A write inside worktree X is judged by X's stage whoever made it, so
39
- sessions cannot dirty each other's branches or borrow each other's approvals. [More here.](docs/concurrency.md)
40
-
41
- **It learns from friction.** Every time the agent hits something that cost it a step — a playbook
42
- command that no longer exists, a guard that refused the wrong thing, a gate that forced a detour — it
43
- writes the observation down in `.dev-flow/reflections.md` instead of just working around it. Those
44
- notes are advisory and never gate anything, but they are how your playbook stops drifting: you review
45
- them with `flow doctor` and decide what to fix. [More here.](docs/playbook.md)
5
+ A feature workflow for [Pi](https://pi.dev) that the agent can't skip. You describe a feature, the
6
+ agent builds it, and **the harness, not the agent, decides when a stage is done.** Each feature goes
7
+ `plan → implement → pre-release → release → done`, and you answer one question at each checkpoint.
8
+
9
+ - **Plan first.** The agent writes a spec and can't touch code until you approve it.
10
+ - **Real gates.** Each stage ends in a check: tests pass, the app deploys and is healthy, the
11
+ changelog and version agree, the tag is on the remote.
12
+ - **Clean git.** Each feature gets its own worktree and branch. Nothing lands on main until release.
13
+ - **Parallel features.** One Pi session per feature, as many at once as you like.
14
+ - **It learns.** When something gets in the agent's way, it leaves you a note so you can fix your
15
+ setup.
46
16
 
47
17
  ## Install
48
18
 
49
19
  ```bash
50
- pi install npm:pi-dev-flow # a published release
51
- pi install git:github.com/dmarchevsky/pi-dev-flow # or from git — pin a ref with @v0.49.1
52
- pi install ./pi-dev-flow # or a local checkout
20
+ pi install npm:pi-dev-flow # from npm
21
+ pi install git:github.com/dmarchevsky/pi-dev-flow # or from git (pin with @vX.Y.Z)
53
22
  ```
54
23
 
55
- Later releases arrive with `pi update --extensions` (an npm install reconciles to the newest version);
56
- then `/reload` — a running session keeps the code it loaded at startup. Two sources at once (a project
57
- `git:` pin beside the global `npm:` package) load two copies — pi dedupes extensions by path, not by
58
- package — so keep the one you actually update from. **The newest copy judges alone:** every copy's
59
- guard hooks check which registered version is highest, and a stale duplicate answers nothing — the
60
- most in-package removal can be, because Node cannot unload a loaded module and pi cannot unregister
61
- its hooks. Only a host restart drops stale code; `/reload` re-binds session state, it never swaps
62
- code. `flow version` lists every dev-flow copy registered in the process and names the copy serving
63
- the call, and the on-disk session claim keeps the guard of a copy that never served
64
- a flow call attributing your commands correctly.
65
-
66
- Until `flow init` writes the playbook (`.dev-flow/project.md`), dev-flow says nothing in a repo — no
67
- injections, no guards, no footer: the playbook is the opt-in. A stray `.dev-flow/` without it keeps
68
- the folder dormant.
24
+ Then run **`/flow init`** once in each project. It reads your repo (branch, forge, package manager,
25
+ test/build commands, version file, CI) and writes **`.dev-flow/project.md`**: your playbook. Each
26
+ question shows what it detected, so "keep these" usually answers it. It also installs a `pre-commit`
27
+ hook that blocks direct commits to main.
69
28
 
70
- Then, once per project repo, `/flow init`. It reads the repo (default branch and forge from git,
71
- package manager, test/build/run conventions, version manifest) and writes **`.dev-flow/project.md`
72
- — your playbook**: the commands that count as checks, the manual checklist, the version and tag
73
- convention, how a merged PR lands (`merge = squash | merge | rebase`), and any hard safety rules of your
74
- own. It also reads lint/typecheck scripts, CI workflows, Makefiles, Docker files, secrets on disk and your existing
75
- tags. Every question shows what was detected and why it matters, so "keep these" answers most of
76
- them. Your answers land as targeted edits (`flow init --answers key=value …`), previewed as a diff
77
- before anything is written. It asks about everything detection could not decide (self-hosted forge?
78
- Docker artifacts? what "healthy" means?) and installs a `pre-commit` hook that blocks direct main
79
- commits (or prints the lines for husky/lefthook when they own the hooks). Run `/flow init` again later and it becomes a **doctor**: drift in
80
- your playbook, dead commands, config problems — it never rewrites your hand edits without asking.
81
- The flow is completely inert in repos with no `.dev-flow/`.
29
+ dev-flow does nothing in a repo until you run `/flow init`. Run it again later to check your
30
+ playbook for drift.
82
31
 
83
- → [The playbook](docs/playbook.md) — what goes in `project.md`, the three tiers, your own guard rules.
32
+ **Updating:** `pi update --extensions`, then `/reload` in running sessions. A running session keeps
33
+ the code it started with, and `flow version` tells you when it's behind.
84
34
 
85
- ## How you work it
35
+ ## How it works
86
36
 
87
- You are not a command runner. You ask for a feature and then answer four words — say *"sessions
88
- expire silently, add sliding renewal and a test"* and it becomes the feature `session-renewal`,
89
- walking five stages with a gate between each:
37
+ Ask for a feature in plain words, for example *"sessions expire silently, add sliding renewal and
38
+ a test"*. It becomes the feature `session-renewal`:
90
39
 
91
40
  ```
92
41
  you ask for a feature
@@ -94,185 +43,100 @@ walking five stages with a gate between each:
94
43
  ┌────────▼────────┐
95
44
  │ plan │ spec (+ mockups) in .dev-flow/<slug>/plan/
96
45
  └────────┬────────┘
97
- Approve? · refuses without the written plan (and renders for UI work)
46
+ Approve?
98
47
  ┌────────▼────────┐
99
- │ implement │ code + tests, only inside the feature worktree
48
+ │ implement │ code + tests, in the feature's own worktree
100
49
  └────────┬────────┘
101
- Verified? · refuses until checks are green and the deployed app is healthy
50
+ Verified? · checks green, app deployed and healthy
102
51
  ┌────────▼────────┐
103
- │ pre-release │ review, docs, changelog entry, version bump
52
+ │ pre-release │ review, docs, changelog, version bump
104
53
  └────────┬────────┘
105
- Release? · refuses unless the version passes the last tag and the changelog agrees
106
- (answers itself when only that prep changed since Verified?)
54
+ Release? · usually answers itself when only release prep changed
107
55
  ┌────────▼────────┐
108
- │ release │ PR → merge → annotated tag → release notes
56
+ │ release │ PR → merge → tag → release notes
109
57
  └────────┬────────┘
110
- Finish? · refuses until the release is recorded and main is clean and pushed
58
+ Finish?
111
59
  ┌────────▼────────┐
112
60
  │ done │ worktree, branch and feature folder removed
113
61
  └─────────────────┘
114
62
  ```
115
63
 
116
- | Stage | What the agent does | It asks you |
64
+ | Stage | The agent | You answer |
117
65
  |---|---|---|
118
- | **plan** | reads the code, asks its clarifying questions, writes the spec to `.dev-flow/session-renewal/plan/plan.md` | **Approve?** — the plan is right, build it |
119
- | **implement** | works in a fresh worktree on `feat/session-renewal`, commits in small steps, runs your `test` command to green, walks the manual checks with you | **Verified?** — after you used it running; with it, the release call: a patch, minor or major release, or merge unreleased |
120
- | **pre-release** | review and fixes, docs, changelog, the bump you chose, checks re-run; shows the PR summary and the version it tags | **Release?** — only when something beyond that prep changed since Verified? (set `ask = always` under `## release` to be asked every time) |
121
- | **release** | PR → merge → annotated tag → release notes; only here may git touch main | **Finish?** — clean up, we're done |
122
- | **done** | removes the worktree, branch and `.dev-flow/session-renewal/` | — |
123
-
124
- Three or four answers from you; everything between them was the agent's problem and your playbook's gates. If
125
- the feature grows mid-flight it is folded into this one (the plan gains an `Added mid-stage:` line and
126
- checks re-run); a *different* problem waits for the next flow — one feature, one plan, one PR.
127
-
128
- Your answers at a checkpoint:
66
+ | **plan** | reads the code, asks questions, writes `plan/plan.md` | **Approve?** — build it |
67
+ | **implement** | works on `feat/<slug>`, commits in small steps, gets the checks green | **Verified?** — you tried it; also pick patch / minor / major, or merge unreleased |
68
+ | **pre-release** | reviews, fixes, updates docs and changelog, bumps the version | **Release?** — only asked if something beyond release prep changed |
69
+ | **release** | opens the PR, merges, tags, publishes release notes | **Finish?** — clean up |
129
70
 
130
- - **yes** — or **no**, with the reason. The agent fixes it and asks again; that loop is free.
131
- - **yolo** — answers this checkpoint *and* pre-confirms the rest, so the remaining gates run back to
132
- back with every check still enforced. Attach your wishes to the word: *"yolo, patch bump"*,
133
- *"yolo, no tag"*. Release? is asked anyway when commits landed after Verified?, or always when
134
- the playbook sets `yolo = until-release` under `## release`.
135
- - **merge unreleased** (the release call at Verified?, or a change of mind at Release?) — merge and
136
- changelog land, no bump or tag; the next versioned release folds your `Unreleased` entry under its
137
- heading. A patch/minor/major call is turned into a number when the release runs, so a parallel flow
138
- that ships first just moves yours to the next one.
71
+ ### Your answers
139
72
 
140
- Two things you grant rather than run: a **mode** when the agent proposes one (`normal` is the
141
- default; `--patch` for a small change you intend to ship now, `--docs` for docs-only work — both skip
142
- the written plan), and a **`/reload`** whenever dev-flow itself was updated — a running session keeps
143
- the code it loaded at startup, and `flow version` tells you when it is behind. Updating or installing
144
- the plugin, and running git outside Pi when one of your `confirm` rules fires with no UI to ask you,
145
- are the only things dev-flow cannot do for you.
73
+ - **yes**, or **no** with a reason. The agent fixes it and asks again.
74
+ - **yolo**: yes to this question and to all the remaining ones. Every check still runs. You can add
75
+ wishes: *"yolo, patch bump"*.
76
+ - **merge unreleased**: merge with a changelog entry, but no version bump or tag. The next release
77
+ picks it up.
146
78
 
147
- Nothing here trusts the agent in either direction: a checkpoint gate refuses if you never answered
148
- (its refusal begins `NEEDS-OPERATOR Approve?`), and the agent is told never to ask *you* to type a
149
- `flow` command — gate results show you facts and the one question waiting on you, never the command
150
- behind it, and an answer that slips one in gets corrected on the next run. `/flow …` is your manual override — for when the session is stuck, wrong, or
151
- claiming a gate result it never produced. → [Gate reference](docs/gates.md)
79
+ For small work the agent may suggest a lighter **mode**: `--patch` for a quick fix with no written
80
+ plan, or `--docs` for docs-only changes with no build checks.
152
81
 
153
- ### Reflections: the agent's notes to you
82
+ You never need to type `flow` commands. `/flow …` is there as a manual override when a session gets
83
+ stuck. See the [gate reference](https://github.com/dmarchevsky/pi-dev-flow/blob/main/docs/gates.md).
154
84
 
155
- When something costs the agent a step — a playbook command that stopped existing, a guard that
156
- refused the wrong thing, a gate that forced a detour, a rough edge in dev-flow itself — it does not
157
- just work around it. It parks a one-line note in `.dev-flow/reflections.md` — your project's queue — under **playbook**
158
- (the fix lives in `project.md`, a docs flow) or **code** (the fix touches your code, a patch flow):
159
- `flow reflect --playbook|--code "<note>"`. Feedback about **dev-flow itself never lands in your
160
- project**: `flow reflect --plugin "<note>"` prints the recipe for a GitHub issue on the dev-flow repo
161
- (search first, then `gh issue create`), filed on your word. A note queued without a flag lands on a
162
- keyword guess the printed line explains (`flow reflect list` numbers the queue, `flow reflect move
163
- <n> --code` re-files one). The open count surfaces in `flow status` and `flow doctor`.
164
-
165
- **At finish, a separate reviewer reflects on the session.** `flow finish` runs it before it removes
166
- anything (the worktree, `.dev-flow/<slug>/` and the session binding are still there), stops for your
167
- answer, and cleans up on the re-run; only your explicit `--no-reflect` skips it. The worker (also
168
- callable earlier as `flow_stage` op `reflect`) is a fresh
169
- read-only pi session that reads the whole driving transcript *and every worker's*, re-checks the
170
- open items, dedupes against them and the upstream issues, and returns a numbered list — each
171
- finding classified docs / code / plugin with a **fold or drop** recommendation. You answer per item
172
- (`fold 1,3 drop 2`): fold records a docs/code row or files the plugin issue, drop records nothing.
173
-
174
- The nudges are timed, not constant. *Fix the open reflections now?* is suggested only when an item
175
- recurred this session, has waited 14 days, three playbook items can share one docs flow, or a code
176
- item waits while you are between flows — at finish, in an unbound session, in `flow doctor`, never
177
- mid-feature. *Tidy* is suggested once the closed pile is real (5 closed, more closed than open, or a
178
- month-old closed item).
179
-
180
- With a GitHub remote, `flow doctor` and `flow reflect list` also **fold in the open GitHub issues**
181
- — external submissions land on GitHub while the queue lives in `reflections.md`, so both surfaces
182
- show one deduplicated view: a local item an open issue already covers carries `⟷ gh#120`, the rest
183
- list below as upstream rows, and a near-duplicate is flagged (`~ gh#NNN may duplicate`) but never
184
- auto-merged. The fold is display-only — upstream items close on GitHub, local items check off in
185
- the file, never both. No GitHub remote shows nothing; missing or failing `gh` is one skip line, and
186
- `DEV_FLOW_NO_ISSUES=1` turns the fold off.
187
-
188
- They never gate anything, and the fix is never the agent's call alone. You ask it to go through them
189
- — usually with `flow doctor`, which reviews each open item and routes it: a playbook item becomes a
190
- small docs flow that edits `project.md` through the flow (so the change is committed and reviewed like
191
- any other), a code item a patch flow. Leaving them is the one option that lets the same friction come
192
- back next feature — which is exactly what the *recurred* nudge catches.
193
-
194
- ### Reviews and senior discipline, built in
195
-
196
- No companion plugin to install: dev-flow ships its own review skills. **`/flow-review`**
197
- reviews a change — by default the bound flow's branch diff against the default branch, plus
198
- uncommitted work — read against its `plan/plan.md` and its callers, not just the diff: every
199
- finding needs a concrete triggering case (refuted findings are dropped), grouped Must fix /
200
- Should fix / Nice to have, ending in a verdict and an honest `Not checked:` line. It is the
201
- pre-release review step (`release.review` in `project.md` stays yours to set). **`/flow-audit`**
202
- audits the whole repo in the same style: map first, judge against the load the project actually
203
- expects, at most 20 ranked findings, changes nothing. The operative sibling **`/flow-simplify`**
204
- makes the cuts audit and review only name: dead code, no-op subsystems, duplication,
205
- speculative layers — removed in a risk-ascending order, one verified commit per cut, green
206
- tests as contract, and a structural-vs-cheap self-audit so the diff shrank because the system
207
- got smaller, not because comments got deleted. For a big implement slice the session can hand
208
- the work to **`flow_stage`**: a fresh pi session in the worktree that edits, commits and reports,
209
- or a fresh read-only reviewer (`op: "review"`) whose PASS/FAIL is advice, not a gate, or the
210
- end-of-session reflection (`op: "reflect"`, see Reflections). All are optional, and the plan path, commits and checks are briefed automatically. In pi-web a worker also
211
- shows up in the session's Agents menu as a subagent, its final status on the row and its report in
212
- the opened transcript. And while a flow writes code, the
213
- implement stage injects a compact senior-discipline guidance — smallest complete change, no
214
- speculative abstraction, finish what your change breaks, a failing-first test for risky logic —
215
- your playbook's `prose.implement` replaces it wholesale whenever you write your own. (The review
216
- rules adapt ponytail, obra/superpowers and pi-development-system — all MIT, credited in the
217
- skill files; `/flow-simplify` adapts goal-sloc (MIT), addyosmani/agent-skills (MIT) and
218
- Anthropic's code-simplifier plugin (Apache-2.0).)
85
+ ## What is enforced
219
86
 
220
- ## The playbook the agent always has
87
+ While a feature is in flight, every tool call goes through a guard:
221
88
 
222
- Pi lists a skill's name and description and loads the file only if the model chooses to read it —
223
- and a session that never read the playbook is the one that guesses at a gate, then argues with the
224
- guard. So dev-flow injects what must never be missing: the ground rules of `skills/dev-flow/SKILL.md`
225
- (the flow tool is the only invocation, checkpoints are words in chat, binds are explicit, the
226
- playbook and state files are read-only) land in the session once, roughly a thousand tokens, and a
227
- compaction that summarizes them away brings them back exactly once. The per-stage detail — mockup harness,
228
- release sequence, reflection protocol — stays on disk, and each stage's turn names the one file to
229
- read. Nothing to configure; reloads, resumed and forked sessions do not pay for it twice.
89
+ - no commit, merge or push to main before the release stage (plus a git hook for work outside Pi);
90
+ - during plan, the agent can only write in its own feature folder; after that, only in its own
91
+ worktree;
92
+ - outside a flow, the agent can't edit source at all;
93
+ - flow state and your playbook are off limits to the agent, so gates can't be faked;
94
+ - your own `deny` / `confirm` / `protect` / `forbid` rules run on every command and path;
95
+ - shell calls without a timeout get a sensible default, so nothing hangs forever.
230
96
 
231
- ## What is enforced
97
+ More detail, and what this deliberately is *not*, is in
98
+ [Guardrails](https://github.com/dmarchevsky/pi-dev-flow/blob/main/docs/guardrails.md).
232
99
 
233
- While a feature is active, every tool call passes a guard:
100
+ ## Also built in
234
101
 
235
- - no commit, merge or push to the default branch outside the release stage (plus a git hook for work outside Pi);
236
- - at plan stage the agent can only write inside its own feature folder;
237
- - at implement/pre-release it can only write inside its own worktree;
238
- - with a `.dev-flow/` present, an unbound session cannot edit source at all — everything goes through the flow
239
- (a path git ignores, such as a per-machine secrets file, stays writable: it can never reach a commit);
240
- - `.dev-flow/*/state.json` is unwritable by the agent, so gates cannot be skipped or forged;
241
- - `project.md` is yours: the agent cannot write it (except inside a docs/patch flow), and every
242
- sanctioned overwrite keeps a `.bak`;
243
- - your own `deny` / `confirm` / `protect` / `forbid` rules run on every command and path, ahead of
244
- dev-flow's verdicts, with the reason you wrote;
245
- - a shell call with no timeout gets its class default armed silently, and a bash command named `flow` is refused (there is no
246
- CLI — gates live in the session).
247
-
248
- → [Guardrails](docs/guardrails.md) — the full list, and [what this is *not*](docs/guardrails.md#limitations-deliberate-v1).
102
+ - **Reflections.** When something costs the agent a step, it notes it in
103
+ `.dev-flow/reflections.md`. At finish, a separate reviewer reads the session and suggests what to
104
+ keep. [More](https://github.com/dmarchevsky/pi-dev-flow/blob/main/docs/reflections.md)
105
+ - **`/flow-review`** reviews a change against its plan. **`/flow-audit`** audits the whole repo.
106
+ **`/flow-simplify`** removes dead and duplicated code, one verified commit at a time.
107
+ - **`flow_stage` workers.** The agent can hand big chunks of work, or a second-opinion review, to a
108
+ fresh Pi session.
109
+ - **A roadmap.** `.dev-flow/roadmap.md` is a backlog of future features. `flow start <slug>` can
110
+ pick one up.
249
111
 
250
112
  ## Where things live
251
113
 
252
114
  ```
253
115
  .dev-flow/
254
- project.md your playbook — the only committed file here
255
- reflections.md this project's suggestion queue for you (advisory; plugin feedback goes upstream)
256
- roadmap.md your backlog of future features (advisory)
116
+ project.md your playbook (the only committed file here)
117
+ reflections.md the agent's notes to you
118
+ roadmap.md your backlog of future features
257
119
  <slug>/
258
- plan/plan.md the spec you approve (embeds the mockup renders)
259
- plan/mockups/ mockup HTML + screenshots ← UI features
260
- worktree/ the feature's git worktree ← all the work
261
- state.json stage, approvals, checks (agent cannot write)
120
+ plan/plan.md the spec you approve
121
+ plan/mockups/ mockups and screenshots (UI features)
122
+ worktree/ the feature's git worktree
123
+ state.json stage, approvals, checks (the agent can't write it)
262
124
  ```
263
125
 
264
- `roadmap.md` is your backlog of future features (`flow roadmap add / pick / done`), also advisory — a
265
- shipped feature checks off the item it was picked from. A new feature that comes up mid-flow is parked
266
- there as a spin-off (`flow roadmap add "<title>" --slug=<slug> --brief=<notes>`); `flow start <slug>`
267
- later seeds its plan from the brief.
268
-
269
- ## Documentation
126
+ ## Docs
270
127
 
271
- | Doc | For |
128
+ | Doc | What's in it |
272
129
  |---|---|
273
- | [docs/playbook.md](docs/playbook.md) | writing `project.md`: checks, checklist, prose, guard rules, `flow init`/`doctor` |
274
- | [docs/gates.md](docs/gates.md) | every gate and flag, what makes each refuse |
275
- | [docs/guardrails.md](docs/guardrails.md) | everything enforced, and the deliberate limits |
276
- | [docs/concurrency.md](docs/concurrency.md) | several agents, one repo: bindings, claims, attribution |
277
- | [docs/headless.md](docs/headless.md) | driving a session from a bot/UI/queue: `NEEDS-OPERATOR`, `--json` surfaces |
278
- | [docs/development.md](docs/development.md) | hacking on dev-flow itself: tests, self-hosting, `/reload` |
130
+ | [Playbook](https://github.com/dmarchevsky/pi-dev-flow/blob/main/docs/playbook.md) | writing `project.md`: checks, checklists, guard rules, `flow init` |
131
+ | [Gates](https://github.com/dmarchevsky/pi-dev-flow/blob/main/docs/gates.md) | every gate, its flags, and why it refuses |
132
+ | [Guardrails](https://github.com/dmarchevsky/pi-dev-flow/blob/main/docs/guardrails.md) | everything enforced, and the deliberate limits |
133
+ | [Reflections](https://github.com/dmarchevsky/pi-dev-flow/blob/main/docs/reflections.md) | the agent's notes, the closing review, nudges |
134
+ | [Concurrency](https://github.com/dmarchevsky/pi-dev-flow/blob/main/docs/concurrency.md) | several sessions in one repo |
135
+ | [Headless](https://github.com/dmarchevsky/pi-dev-flow/blob/main/docs/headless.md) | driving dev-flow from a bot, web UI or queue |
136
+ | [Development](https://github.com/dmarchevsky/pi-dev-flow/blob/main/docs/development.md) | working on dev-flow itself |
137
+
138
+ ## Credits
139
+
140
+ The review skills adapt ideas from ponytail, obra/superpowers and pi-development-system (MIT).
141
+ `/flow-simplify` adapts goal-sloc (MIT), addyosmani/agent-skills (MIT) and Anthropic's
142
+ code-simplifier plugin (Apache-2.0). Details are in each skill file. dev-flow itself is MIT.
@@ -1,50 +1,56 @@
1
- # Concurrency: one session, one feature
2
-
3
- How several agents work one repo at the same time without stepping on each other.
4
-
5
- **One pi session = one feature** (flow + branch + worktree). A repo can host any number of
6
- features, worked by separate sessions in parallel — that is the supported shape, not an edge
7
- case. The binding lives with the session (persisted via session entries, restored on
8
- resume/fork), so nothing is repo-global — and the session carries its feature's name: `flow start`
9
- and `flow use` rename the pi session to the slug (overwriting any previous name), so the session
10
- picker always says which feature a session holds. A session binds **explicitly, never automatically**:
11
- `flow start` binds its own feature, `flow use <slug>` takes one over — even the lone unfinished
12
- feature waits to be claimed. Every bind leaves a claim (`claim.json`, session + pid),
13
- and the gates honor the claim too — `flow abort` included, so the verb that erases a feature cannot
14
- erase one a live session is working. The claim file is as guarded as `state.json`: neither the write
15
- tools nor bash may change or delete it — a lock is not unlocked by whoever it locks out.
16
- passing another session's slug to `flow approve`/`verify`/`finish` is refused until you take over,
17
- or two sessions quietly overwrite one state file. `flow use <slug>` switches, and ambiguous sessions must
18
- bind or pass explicit slugs. With nothing unfinished and no binding, the session must start a
19
- flow — work does not happen outside the flow.
20
-
21
- **A claim dies with its session, not with its process.** Hosts like pi-web run many sessions inside
22
- one long-lived Node process, so the pid on a claim says nothing about whether its holder still
23
- exists — `session_shutdown` releases the dead session's binding and every claim it held, and a
24
- restored session (reload, resume, fork) reclaims what its own branch history says it holds. A claim
25
- key names the identity it came from: `sid:<session id>` when pi provides one, `cwd:<directory>`
26
- when the host hands out none — and in that second case every session in that directory shares one
27
- binding, so `flow status` prints the key and says so instead of leaving a shared binding to be
28
- guessed from a path. Dev-flow keeps no per-process session state beyond that keyed map, released on
29
- shutdown; the one other process-wide cache (`compile()` in `src/core.ts`) holds flag-less regexes,
30
- which carry no mutable state to leak between sessions.
31
- **One dev stack, several flows.** A dev deploy is machine state, not branch state, so `flow verify`
32
- keeps a small registry (`.dev-flow/dev-ports.json`: port → slug, commit, time) and `flow status` prints
33
- it (`dev: port 8090 → <slug> @ <sha>`). Before deploying, verify checks whether its port was last
34
- deployed by **another live flow**. If so it does not deploy: it returns `NEEDS-OPERATOR Dev port?` with
35
- who holds the port (stage, commit, age), the available RAM and free disk against the playbook's
36
- `instanceMem` / `instanceDisk`, and the options — run alongside on the next free port
37
- (`flow verify --port=<n>`), replace that deploy (`--replace`), or wait. Running alongside is offered
38
- only when the playbook allows it (`parallelDev` is not `no`, `dev`/`health` read `$DEV_FLOW_PORT`) and
39
- the resources fit. `--port=<n>` and `--replace` are the operator's answer, so they bind like
40
- `--confirmed` (gh#203): a re-run carrying either before the operator has sent a message since
41
- `Dev port?` was asked is refused. A finished or aborted flow holds no port. `flow finish` stops a flow's
42
- non-default-port instance with `devDown`.
43
-
44
- **The review is of the tree that ships.** Parallel flows release while others are still implementing,
45
- so `flow verify` rebases a branch that fell behind the default branch before it deploys for review,
46
- and `flow verify --confirmed` refuses if the default branch moved again before the answer.
47
-
48
- Enforcement is by attribution: a write inside worktree X is judged
49
- by X's own feature stage no matter which session touches it; main-checkout code stays closed
50
- while your bound feature is in `plan`/`implement` and while any feature is unbound-and-ambiguous.
1
+ # Concurrency: several sessions, one repo
2
+
3
+ **One Pi session = one feature = one branch and worktree.** A repo can have as many features in
4
+ flight as you like, each in its own session. This is the normal way to use dev-flow, not an edge
5
+ case.
6
+
7
+ ## Binding
8
+
9
+ - A session binds to a feature only when you say so: `flow start <slug>` for a new one, or
10
+ `flow use <slug>` for an existing one. Even a lone unfinished feature waits to be claimed.
11
+ - Binding renames the session after the slug, so the session picker shows which feature it holds.
12
+ - The binding survives reload, resume and fork.
13
+ - With nothing bound and nothing unfinished, the session has to start a flow. Work doesn't happen
14
+ outside a flow.
15
+
16
+ ## Claims
17
+
18
+ - Each bind writes a claim (`claim.json`). Gates, including `flow abort`, refuse a feature that
19
+ another live session has claimed. `flow use <slug>` takes it over explicitly.
20
+ - The agent can't edit or delete a claim, just like `state.json`.
21
+ - **A claim ends with its session, not its process.** Hosts like pi-web run many sessions in one
22
+ process. So dev-flow releases a session's claims when that session shuts down, and a resumed
23
+ session reclaims what it held.
24
+ - If the host gives sessions no id, all sessions in a directory share one binding.
25
+ `flow status` says so.
26
+
27
+ ## Who may write where
28
+
29
+ A write inside worktree X is judged by X's own stage, whichever session makes it. Sessions can't
30
+ dirty each other's branches or borrow each other's approvals. The main checkout's code stays closed
31
+ while your feature is at plan or implement.
32
+
33
+ ## Sharing one dev stack
34
+
35
+ A dev deploy is machine state, not branch state, so `flow verify` keeps a small registry in
36
+ `.dev-flow/dev-ports.json` (port → slug, commit, time). `flow status` shows it.
37
+
38
+ If the flow holding your port is already past its **Verified?** (at pre-release or release, and not
39
+ re-asking it), nobody is reviewing that deploy, so verify replaces it and says so. If the holder is
40
+ still being reviewed or still in implement, verify doesn't deploy. Instead it asks
41
+ **Dev port?**, showing who holds the port and how much RAM and disk are free, and offers:
42
+
43
+ - **run alongside** on the next free port (`--port=<n>`). This needs `parallelDev` not set to `no`,
44
+ `dev`/`health` using `$DEV_FLOW_PORT`, and enough resources;
45
+ - **replace** that deploy (`--replace`);
46
+ - **wait**.
47
+
48
+ `--port` and `--replace` count as your answer, so the agent can only use them after you reply.
49
+ Finished and aborted flows hold no port. `flow finish` stops an extra-port instance with `devDown`.
50
+ Playbook setup is in [playbook → Dev port](playbook.md#dev-port-and-parallel-flows).
51
+
52
+ ## Reviewing what will ship
53
+
54
+ Parallel flows release while others are still working. So `flow verify` rebases a branch that fell
55
+ behind main before deploying it for your review. `flow verify --confirmed` refuses if main moved
56
+ again before you answered.