pi-dev-flow 0.57.1 → 0.58.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,17 @@ Format: newest first. `Unreleased` collects what's merged but not yet tagged.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.58.0] - 2026-10-23
8
+
9
+ ### Added
10
+
11
+ - **Bundled review skills — dev-flow now ships its own code review, no companion plugin needed.** `/flow-review` reviews a change (default: the bound flow's branch diff against the default branch, plus uncommitted work) as a read-only senior-engineer report — correct, safe, holds under load, tested, fast, lean — judged also against the feature's `plan/plan.md`; every finding must carry a concrete triggering case (refute-before-report), grouped Must fix / Should fix / Nice to have, with a verdict and a `Not checked:` line. `/flow-audit` audits the whole repo in the same style: map first, expected-load assessment, at most 20 ranked findings, changes nothing.
12
+ - **Built-in implement-stage senior discipline**: when the playbook sets no `prose.implement`, the stage guidance injected each turn now carries a compact writing-discipline block (smallest complete change, no speculative abstraction, finish what your change breaks, failing-first test for risky logic, `shortcut:` markers for deliberate deferrals); operator prose still replaces it wholesale. The injected line names its source (`project.md` vs `dev-flow default`).
13
+
14
+ ### Changed
15
+
16
+ - The pre-release review step defaults to `/flow-review` (was `/ponytail-review` — dev-flow no longer assumes the ponytail plugin; `release.review` remains operator-settable). The review rules adapt ponytail, obra/superpowers and jwilger/pi-development-system (all MIT), credited in the skill files.
17
+
7
18
  ## [0.57.1] - 2026-10-23
8
19
 
9
20
  ### Removed
package/README.md CHANGED
@@ -147,6 +147,22 @@ review over the whole exchange before `Finish?`, so friction it noticed but neve
147
147
  Fold, fix or drop them — but leaving them is the one option that lets the same friction come back next
148
148
  feature.
149
149
 
150
+ ### Reviews and senior discipline, built in
151
+
152
+ No companion plugin to install: dev-flow ships its own review skills. **`/flow-review`**
153
+ reviews a change — by default the bound flow's branch diff against the default branch, plus
154
+ uncommitted work — read against its `plan/plan.md` and its callers, not just the diff: every
155
+ finding needs a concrete triggering case (refuted findings are dropped), grouped Must fix /
156
+ Should fix / Nice to have, ending in a verdict and an honest `Not checked:` line. It is the
157
+ pre-release review step (`release.review` in `project.md` stays yours to set). **`/flow-audit`**
158
+ audits the whole repo in the same style: map first, judge against the load the project actually
159
+ expects, at most 20 ranked findings, changes nothing. And while a flow writes code, the
160
+ implement stage injects a compact senior-discipline guidance — smallest complete change, no
161
+ speculative abstraction, finish what your change breaks, a failing-first test for risky logic —
162
+ your playbook's `prose.implement` replaces it wholesale whenever you write your own. (The review
163
+ rules adapt ponytail, obra/superpowers and pi-development-system — all MIT, credited in the
164
+ skill files.)
165
+
150
166
  ## What is enforced
151
167
 
152
168
  While a feature is active, every tool call passes a guard:
@@ -13,7 +13,7 @@ While a feature is active, the extension intercepts every tool call:
13
13
  - **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.
14
14
  - **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. By default the call is therefore **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. It applies to every session that loads the package, flow-bound or not (a session with no playbook has no way to opt out).
15
15
  - **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`.
16
- - 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 (`/ponytail-review`) → fixes → docs → changelog/version bump; release — PR → merge → tag → `release-done`.
16
+ - 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`) and `/flow-audit` (the whole repo) — and injects a built-in senior-discipline guidance at implement stage unless the playbook sets its own `prose.implement`.
17
17
  - **Status bar**: while the session **is bound** to a feature the pi footer 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 nothing when nothing is in flight; a session binds only via `flow start`/`flow use`, never by opening. `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
18
 
19
19
  ## Limitations (deliberate, v1)
@@ -93,6 +93,7 @@ import {
93
93
  roadmapTidy,
94
94
  shouldSelfCompact,
95
95
  shouldTakeOverCompaction,
96
+ stageGuidance,
96
97
  stateTamper,
97
98
  statusFor,
98
99
  statusJson,
@@ -1868,7 +1869,8 @@ export default function devFlow(pi: ExtensionAPI) {
1868
1869
  }
1869
1870
  const guidance: string[] = [];
1870
1871
  if (state.yolo) guidance.push("YOLO mode: the operator pre-confirmed every gate question from here on (Verified?/Release?/Finish?) — run the remaining gates (verify → release → release-done → finish) back to back without stopping to ask; guidance the operator attached to the yolo word (e.g. patch bump, no tag) is a binding directive for the chain; checks and guardrails stay fully enforced.");
1871
- if (cfg.prose[state.stage]) guidance.push(`Stage guidance (project.md): ${cfg.prose[state.stage]}`);
1872
+ const prose = stageGuidance(cfg, state.stage);
1873
+ if (prose) guidance.push(`Stage guidance (${prose.source}): ${prose.text}`);
1872
1874
  const pend = checklistPending(cfg, state, state.stage);
1873
1875
  if (pend) guidance.push(`Tier-2 checklist NOT yet confirmed (${pend} item(s)): ${applicableItems(cfg, state, state.stage).map((i) => i.text).join(" | ")}${state.stage === "release" ? " — release-stage items close with the operator's Finish? answer; no earlier gate records them" : ""}`);
1874
1876
  const refl = readReflections(ctx.cwd);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-dev-flow",
3
- "version": "0.57.1",
3
+ "version": "0.58.0",
4
4
  "description": "Enforced feature workflow for Pi: plan → implement → pre-release → release, gated checkpoints, self-improvement reflections, one git worktree per feature, changelog + publish as part of the release",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -179,7 +179,9 @@ worktrees are theirs (attribution guards judge every path by its owning
179
179
  feature).
180
180
 
181
181
  1. Implement per the approved plan with project conventions and the **stage
182
- guidance injected at stage start** (tier-3 prose). Commit in the worktree
182
+ guidance injected at stage start** (tier-3 prose — your playbook's
183
+ `prose.implement`, or dev-flow's built-in senior-discipline guidance when
184
+ the playbook sets none). Commit in the worktree
183
185
  **as you go** — small reviewable commits; a twelve-file monolith saved for
184
186
  the end faces review blind and is not crash-safe. The gate enforces the
185
187
  habit: `flow verify` refuses while the branch holds **no commit** (checks
@@ -240,7 +242,7 @@ and tags are `versioning.pattern` rendered from it — one number everywhere. If
240
242
  `versioning.file` is unset, stop and clarify the scheme with the user; never
241
243
  invent one mid-release. Sequence:
242
244
 
243
- 1. `/ponytail-review` the change; fix every **must-have** and **should-have**
245
+ 1. `/flow-review` the change; fix every **Must fix** and **Should fix**
244
246
  finding; `flow test` again if code changed.
245
247
  2. Update documentation to reflect the change.
246
248
  3. Update the changelog and bump the manifest to the exact version you will
@@ -0,0 +1,96 @@
1
+ ---
2
+ name: flow-audit
3
+ description: >
4
+ Read-only quality audit of a whole repo (or a named subtree): bugs, security
5
+ holes, what breaks under real load, risky code without tests, slow paths,
6
+ and what to delete/merge/split. Ranked report, changes nothing. Use for
7
+ "audit this codebase", "review the whole project", "find bloat",
8
+ "what can I delete".
9
+ ---
10
+
11
+ # flow-audit
12
+
13
+ Audit the repo like the senior engineer who just inherited it and will be
14
+ paged when it breaks. Order of importance: **correct, safe, holds under load,
15
+ tested, fast, lean.** One-shot report; change no files, mutate no git state.
16
+
17
+ ## 1. Map first
18
+
19
+ - Audit what the operator names: a folder, a package, a subsystem. Nothing
20
+ named: the whole repo.
21
+ - Read the README, build and deploy config, the dependency list, the entry
22
+ points (main, routes, handlers, jobs, CLI) and the tests.
23
+ - Find the expected load: one person on a script, or many users and
24
+ processes at once. Judge scale against that; say which load you assumed.
25
+ - Trace the main flows end to end — input from users, money, auth, data
26
+ writes, background jobs, anything shared between processes. Read those
27
+ paths fully.
28
+ - Big repo: go deep where a mistake costs the most, not file by file, and
29
+ name the parts you did not read.
30
+
31
+ ## 2. Look for
32
+
33
+ 1. **Bug:** wrong result, crash, missed edge (empty, zero, last item,
34
+ rounding, time zones), callers that disagree with what a function
35
+ returns, the same rule implemented differently in two places.
36
+ 2. **Risk:** injection, weak randomness, secrets in code, missing checks on
37
+ user input; data loss (swallowed errors, writes in the wrong order, no
38
+ transaction).
39
+ 3. **Scale:** check-then-write races, the same work redone by every process,
40
+ unbounded growth, a query per item, O(n²) on real input, per-process
41
+ state that must be shared.
42
+ 4. **Missing test:** risky logic with no test that fails when it breaks.
43
+ One good test, not coverage.
44
+ 5. **Speed:** big slowdowns are findings; small wins are suggestions.
45
+ 6. **Lean:** delete (dead code, unused options/flags/config, speculative
46
+ features), reuse (two helpers doing one job — keep one, name the path),
47
+ stdlib/platform/installed-dep doing it already, yagni (interface with one
48
+ implementation, pass-through wrapper), merge (near-copies), split (one
49
+ function or class doing unrelated jobs — split by job, never by line
50
+ count).
51
+
52
+ ## 3. Refute before you report
53
+
54
+ - Every finding needs a concrete case: "this input or situation leads to
55
+ this wrong result". **No case, no finding.**
56
+ - Before calling code unused, grep the whole tree — tests, fixtures, config,
57
+ dynamic and string references included.
58
+ - Try to refute each finding first (a guard, a covering test, a type); drop
59
+ what refutes, report near-refutes with the missing evidence named.
60
+ - A `shortcut: <limit>, <upgrade>` comment naming its ceiling is a decision,
61
+ not a finding — unless the expected load already crosses it.
62
+ - Propose the smallest fix; prefer fixes that delete. No style taste, no
63
+ "consider…", no vague worries.
64
+
65
+ ## 4. Output
66
+
67
+ Plain English, short sentences; explain a technical term on first use.
68
+
69
+ Start with `What this repo does:` (two or three sentences) and the load you
70
+ assumed. Then findings in three groups, most important first, skip empty:
71
+
72
+ - **Must fix:** bug, security, data loss, breaks at the expected load.
73
+ - **Should fix:** risky code without a test, real slowness, duplication,
74
+ code that should not exist.
75
+ - **Nice to have:** small speed-ups, shorter forms.
76
+
77
+ **At most 20 findings**, numbered across groups ("fix 2 and 5"); if smaller
78
+ ones were left out, say how many. Each finding, all four parts:
79
+
80
+ 2. **Orders land on the wrong day** (`billing/close_day.py:40-52`)
81
+ - **What:** at midnight the job closes the day using the UTC server clock.
82
+ - **Problem:** an order placed 00:30 Berlin time bills on the day before.
83
+ - **Fix:** compute the day once in the shop's zone:
84
+ `datetime.now(ZoneInfo("Europe/Berlin")).date()`.
85
+ - **If skipped:** late orders show the wrong date; accounting fixes by hand.
86
+
87
+ End with **`Verdict:`** one line (healthy, or what to fix first),
88
+ `Lean: -<N> lines, -<M> dependencies possible.` when lean findings exist,
89
+ and `Not checked:` the parts you did not read or could not run.
90
+
91
+ Nothing found: `What this repo does:`, then `Healthy. Nothing to fix.` and
92
+ one line on what you checked.
93
+
94
+ ---
95
+ _Adapted for dev-flow from: DietrichGebert/ponytail (MIT),
96
+ jwilger/pi-development-system reviewer (MIT)._
@@ -0,0 +1,103 @@
1
+ ---
2
+ name: flow-review
3
+ description: >
4
+ Read-only senior-engineer review of a change before it ships: correct, safe,
5
+ holds under load, tested, fast, lean — judged also against the flow's plan.
6
+ Report only, changes no code. Use for "review this", "code review", "is this
7
+ ready to ship?", and as the dev-flow pre-release review step. Default target:
8
+ the bound flow's branch diff against the default branch.
9
+ argument-hint: "[ref | base..head | file...]"
10
+ ---
11
+
12
+ # flow-review
13
+
14
+ Review a change like the senior engineer who gets paged when it breaks.
15
+ Order of importance: **correct, safe, holds under load, tested, fast, lean.**
16
+ Read the connected code, not only the diff. This is a report the operator
17
+ asked for: give it in full. Change no files, mutate no git state.
18
+
19
+ ## 1. Pick the target
20
+
21
+ - What the operator names: a ref, a `base..head` range, or files.
22
+ - Nothing named and the session is bound to a dev-flow feature
23
+ (`[dev-flow] this session is bound to: <slug>`): review the **whole feature**
24
+ — `git diff $(git merge-base origin/<default> HEAD)` plus the uncommitted
25
+ worktree changes (run `flow status` for the worktree and default branch).
26
+ - Otherwise: uncommitted/staged changes; if none, the last commit.
27
+
28
+ ## 2. Understand first
29
+
30
+ - Read the diff, then what it touches: callers of every changed function,
31
+ what it calls, the tests, the README.
32
+ - **Plan check:** if a flow is bound and `.dev-flow/<slug>/plan/plan.md`
33
+ exists, read it. Judge the diff against the plan: missing planned parts and
34
+ unexplained deviations are findings; if the plan itself is what is wrong,
35
+ say so — that is the operator's call, not the branch's defect.
36
+ - Trace the real flow: where data enters, what is stored, what leaves.
37
+ - Find the expected load (README, deploy config): one person on a script, or
38
+ many users at once. Judge scale against that; name the load you assumed.
39
+
40
+ ## 3. Look for
41
+
42
+ 1. **Bug:** wrong result, crash, missed edge (empty, zero, last item,
43
+ rounding, time zones), a caller broken by the change, a fix in one caller
44
+ while the shared function stays broken.
45
+ 2. **Risk:** injection, weak randomness, secrets, missing checks on user
46
+ input; data loss (swallowed errors, writes in the wrong order, no transaction).
47
+ 3. **Scale:** check-then-write races, per-process state that must be shared,
48
+ unbounded growth, a query per item, O(n²) on real input.
49
+ 4. **Missing test:** risky new logic (branch, parser, money, security, data
50
+ writes, bug fix) with no test that fails when it breaks. One good test,
51
+ not coverage.
52
+ 5. **Speed:** big slowdowns are findings; small wins are suggestions.
53
+ 6. **Lean:** delete (dead code, speculative features), reuse (name the
54
+ existing helper's path), stdlib/installed-dep doing it already, yagni
55
+ (abstraction with one implementation, config nobody sets), merge
56
+ (near-copies), split (one function doing unrelated jobs).
57
+
58
+ ## 4. Refute before you report
59
+
60
+ - Every finding needs a concrete case: "this input or situation leads to this
61
+ wrong result". **No case, no finding.**
62
+ - Re-read the lines and try to refute it first — a covering test, a nearby
63
+ guard, a type that rules the case out. A refuted case is dropped; a
64
+ near-refute is reported with the missing evidence named.
65
+ - A `shortcut: <limit>, <upgrade>` comment that names its ceiling is a
66
+ decision, not a finding — unless the expected load already crosses it.
67
+ - Propose the smallest fix; prefer fixes that delete. Never add layers,
68
+ frameworks or config the problem does not need.
69
+ - No style taste, no "consider…", no vague worries. Never review code you
70
+ did not read.
71
+
72
+ ## 5. Output
73
+
74
+ Plain English, short sentences; the reader may have never seen this code.
75
+
76
+ Start with `What this change does:` (two or three sentences), then findings
77
+ in three groups, skip empty ones:
78
+
79
+ - **Must fix:** bug, security, data loss, breaks at the expected load.
80
+ - **Should fix:** risky code without a test, real slowness, duplication,
81
+ code that should not exist, a plan deviation nobody explained.
82
+ - **Nice to have:** small speed-ups, shorter forms.
83
+
84
+ Number across all groups ("fix 2 and 5"). Each finding, all four parts:
85
+
86
+ 2. **Orders land on the wrong day** (`billing/close_day.py:40-52`)
87
+ - **What:** at midnight the job closes the day using the UTC server clock.
88
+ - **Problem:** an order placed 00:30 Berlin time bills on the day before.
89
+ - **Fix:** compute the day once in the shop's zone:
90
+ `datetime.now(ZoneInfo("Europe/Berlin")).date()`.
91
+ - **If skipped:** late orders show the wrong date; accounting fixes by hand.
92
+
93
+ End with **`Verdict: Ship.`** or **`Verdict: fix 1 and 3 first.`**, plus
94
+ `Lean: -<N> lines possible.` when lean findings exist and `Not checked:`
95
+ one line when something mattered and you could not check it. Acknowledge
96
+ what is genuinely good — only if it is.
97
+
98
+ Nothing found: `What this change does:`, then `Looks good. Ship.` and one
99
+ line on what you checked.
100
+
101
+ ---
102
+ _Adapted for dev-flow from: DietrichGebert/ponytail (MIT), obra/superpowers
103
+ requesting-code-review (MIT), jwilger/pi-development-system reviewer (MIT)._
package/src/core.ts CHANGED
@@ -115,12 +115,32 @@ export const DEFAULTS: Config = {
115
115
  prose: {},
116
116
  versioning: { pattern: "v{version}" },
117
117
  healthWait: 30,
118
- release: { review: "/ponytail-review", changelog: "CHANGELOG.md", releases: true },
118
+ release: { review: "/flow-review", changelog: "CHANGELOG.md", releases: true },
119
119
  mainHook: true,
120
120
  bashTimeout: "require",
121
121
  guard: { deny: [], confirm: [], protect: [], forbid: [] },
122
122
  };
123
123
 
124
+ /**
125
+ * Built-in tier-3 guidance for stages with no `prose.<stage>` in project.md.
126
+ * Operator prose replaces it (never appends) — a project that wants its own
127
+ * implement guidance just sets prose.implement. Implement-only: this is the
128
+ * writing discipline for where flows write code; it stays out of plan/release
129
+ * turns. Senior-engineer discipline adapted from ponytail (MIT, DietrichGebert).
130
+ */
131
+ export const DEFAULT_STAGE_GUIDANCE: Partial<Record<Stage, string>> = {
132
+ implement:
133
+ "Smallest complete change wins: skip what nobody asked for (name it in one line); reuse this repo's helpers before writing new ones; stdlib and installed deps before new code; one readable line over fifty. No speculative abstraction, wrapper, option or config — deletion beats addition, keep the structure the codebase has. Finish everything your change touches: the callers, tests and fixtures it breaks. A bug fix goes to the root cause in the shared code, after grepping every caller. New non-trivial logic (a branch, a loop, a parser, money, security) leaves one small failing-first test. A deliberate shortcut gets a `shortcut: <limit>, <upgrade>` comment. Never cut: validation at trust boundaries, error handling that prevents data loss, security, anything the operator asked for.",
134
+ };
135
+
136
+ /** Tier-3 stage guidance with provenance: operator prose (project.md) wins,
137
+ * else the built-in default (dev-flow). Undefined when neither exists. */
138
+ export function stageGuidance(cfg: Config, stage: Stage): { text: string; source: "project.md" | "dev-flow default" } | undefined {
139
+ if (cfg.prose[stage]) return { text: cfg.prose[stage], source: "project.md" };
140
+ const text = DEFAULT_STAGE_GUIDANCE[stage];
141
+ return text ? { text, source: "dev-flow default" } : undefined;
142
+ }
143
+
124
144
  /** Build a Config from DEFAULTS + a partial overrides object (tests, drafts — the persisted
125
145
  * source is project.md alone; the legacy project.json loader is gone). */
126
146
  export function buildConfig(raw: unknown): Config {