@tianhai/pi-workflow-kit 1.8.0 โ 2.1.2
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/README.md +16 -20
- package/docs/developer-usage-guide.md +21 -23
- package/docs/oversight-model.md +2 -3
- package/docs/workflow-phases.md +8 -23
- package/extensions/workflow-guard.ts +38 -23
- package/package.json +2 -2
- package/skills/pwk-brainstorming/SKILL.md +51 -16
- package/skills/pwk-diagnose/SKILL.md +1 -1
- package/skills/pwk-executing-tasks/SKILL.md +30 -27
- package/skills/pwk-finalizing/SKILL.md +15 -7
- package/skills/pwk-status/SKILL.md +21 -9
- package/skills/pwk-walkthrough/SKILL.md +55 -0
- package/skills/pwk-writing-plans/SKILL.md +0 -97
package/README.md
CHANGED
|
@@ -50,10 +50,10 @@ Enforces phase-appropriate tool access โ not just guidelines, but hard blocks:
|
|
|
50
50
|
|
|
51
51
|
| Phase | `write` / `edit` | `bash` |
|
|
52
52
|
|-------|:-:|:-:|
|
|
53
|
-
| **
|
|
53
|
+
| **Design** | ๐ Blocked outside `docs/plans/` | ๐ Destructive commands blocked (simple blacklist) |
|
|
54
54
|
| **Execute** / **Code-review** / **Finalize** / **Diagnose** / **Status** | โ
Full access | โ
Full access |
|
|
55
55
|
|
|
56
|
-
The agent can read code and discuss design with you during
|
|
56
|
+
The agent can read code and discuss design with you during the design phase, but it physically cannot modify source files. Bash during gated phases is governed by a simple common-blacklist (a command is allowed unless it matches a destructive pattern), and a short phase reminder is shown once when the gated phase begins so the model self-restricts.
|
|
57
57
|
|
|
58
58
|
Phases transition only when you invoke a skill (`/skill:pwk-brainstorming` โ read-only; `/skill:pwk-executing-tasks` โ unrestricted) โ no message keyword unlocks the guard. Unlocking skills: `pwk-executing-tasks`, `pwk-finalizing`, `pwk-code-review`, `pwk-diagnose` (all need source writes); `pwk-status` deliberately stays gated (read-only orientation). The canonical list is the exported `UNLOCK_SKILLS` in `extensions/workflow-guard.ts`, lint-asserted against the skills by `npm run check`. Need to override it? `/pwk-guard on` forces a read-only lock, `off` disables the guard entirely, `auto` (default) returns to skill-driven phases. The subcommands autocomplete after the command.
|
|
59
59
|
|
|
@@ -62,7 +62,7 @@ Phases transition only when you invoke a skill (`/skill:pwk-brainstorming` โ r
|
|
|
62
62
|
Guide the agent through a disciplined development process:
|
|
63
63
|
|
|
64
64
|
```
|
|
65
|
-
brainstorm โ
|
|
65
|
+
brainstorm โ executing-tasks โ finalizing
|
|
66
66
|
(feature-gate: write feature E2E โ feature-spec โ implement โ review โ ship checkpoint)
|
|
67
67
|
โ
|
|
68
68
|
diagnose (anytime) ยท status (anytime)
|
|
@@ -72,12 +72,12 @@ A **design doc is one PR**; a **requirement is one testable slice within it**. A
|
|
|
72
72
|
|
|
73
73
|
| Phase | Trigger | What Happens |
|
|
74
74
|
|-------|---------|--------------|
|
|
75
|
-
| **Brainstorm** | `/skill:pwk-brainstorming` | Explore approaches, produce a design doc opening with a `## At a glance` digest (plain summary
|
|
76
|
-
| **
|
|
77
|
-
| **Execute** | `/skill:pwk-executing-tasks` | Write the feature E2E (red) โ **checkpoint: feature-spec** โ implement requirements โ feature review โ **ship checkpoint** (execution summary + code digest + coverage table; full diff on request) |
|
|
75
|
+
| **Brainstorm** | `/skill:pwk-brainstorming` | Explore approaches, produce a design doc opening with a `## At a glance` digest (plain summary โ **Key decisions** โ rejected-alternative clauses only for real forks โ โ `| R# | Requirement in one line | Risk |` table) before the `## Requirements` blocks; each requirement block carries its own acceptance criteria + review tags. Interviews in **frontier rounds**: numbered questions each with a recommended answer, facts looked up rather than asked, an assumption gate before the design is presented. On non-trivial topics, requests the logical `codebase-recon` capability; if unavailable or unsafe, performs the `pwk-recon-scout` role inline. |
|
|
76
|
+
| **Execute** | `/skill:pwk-executing-tasks` | Create the feature branch, then: write the feature E2E (red) โ **checkpoint: feature-spec** โ implement the design doc's `### R<n>` requirement blocks โ feature review โ **ship checkpoint** (execution summary + code digest + coverage table; full diff on request) |
|
|
78
77
|
| **Code review** | `/skill:pwk-code-review` | Feature-level (default) or per-requirement: code tracing, spec alignment, code smells (applies fixes), production hazard check. Delegated review uses four tiered logical roles (smell/hazard on a fast model via `/pwk-setup --fast-model`) over a script-assembled review packet when a safe provider is available; otherwise it runs inline. |
|
|
79
78
|
| **Finalize** | `/skill:pwk-finalizing` | Delete consumed plan docs or archive them under `docs/plans/completed/` (discovery always runs excluding docs/plans/completed/, so archived work never resurfaces as in flight โ single source: the `pwk-executing-tasks` glob wording), update README/CHANGELOG, create PR |
|
|
80
79
|
| **Diagnose** | `/skill:pwk-diagnose` | Debugging loop: reproduce โ hypothesise โ instrument โ fix โ cleanup. **Exits the gated phase** (debugging writes tests/instrumentation) |
|
|
80
|
+
| **Walkthrough** | `/skill:pwk-walkthrough` | On demand: generate a detailed, file:line-anchored walkthrough of a shipped feature into `docs/walkthroughs/<topic>.md` (Summary / How it works / Key flows / Gotchas & invariants / Change map); stamped with the commit range, regenerated wholesale, never disposed. **Exits the gated phase** |
|
|
81
81
|
| **Status** | `/skill:pwk-status` | Read-only overview of all active design topics โ phase + progress. Use when resuming or juggling several designs in parallel worktrees. Not a pipeline phase; **does not exit the gated phase**. |
|
|
82
82
|
|
|
83
83
|
## The Workflow in Detail
|
|
@@ -87,16 +87,15 @@ A **design doc is one PR**; a **requirement is one testable slice within it**. A
|
|
|
87
87
|
You control each phase โ the agent never advances on its own. Invoke a skill to move forward:
|
|
88
88
|
|
|
89
89
|
```
|
|
90
|
-
/skill:pwk-brainstorming โ discuss and design
|
|
91
|
-
/skill:pwk-
|
|
92
|
-
/skill:pwk-executing-tasks โ feature-gate flow: E2E-first, implement, review, ship checkpoint
|
|
90
|
+
/skill:pwk-brainstorming โ discuss and design โ the design doc IS the buildable spec
|
|
91
|
+
/skill:pwk-executing-tasks โ feature-gate flow: branch, E2E-first, implement ### R<n> blocks, review, ship checkpoint
|
|
93
92
|
/skill:pwk-code-review โ auto-runs at the feature level inside executing-tasks; also invocable manually for ad-hoc reviews
|
|
94
93
|
/skill:pwk-finalizing โ ship it
|
|
95
94
|
```
|
|
96
95
|
|
|
97
|
-
### Behavioral-Spec
|
|
96
|
+
### Behavioral-Spec Design
|
|
98
97
|
|
|
99
|
-
|
|
98
|
+
The design doc specifies *what*, not *how*. Each `### R<n>:` requirement block gives **acceptance criteria** (Given/When/Then, edge and error cases included) โ no implementation code, no file-by-file recipe, no test-name lists. The executor has full autonomy to choose structure, signatures, and internals. A fine-grained implementation plan invalidates the moment a detail shifts; acceptance criteria survive implementation changes.
|
|
100
99
|
|
|
101
100
|
### Feature-Gate Execution
|
|
102
101
|
|
|
@@ -154,16 +153,13 @@ pi install npm:@tianhai/pi-workflow-kit
|
|
|
154
153
|
> /skill:pwk-brainstorming
|
|
155
154
|
> I want to add OAuth2 login to our API
|
|
156
155
|
|
|
157
|
-
# (agent explores approaches, writes
|
|
156
|
+
# (agent explores approaches, writes the buildable design doc: At a glance,
|
|
157
|
+
# ### R<n> blocks with acceptance criteria + review tags, Feature acceptance E2E)
|
|
158
158
|
# (write/edit are blocked โ your code is safe)
|
|
159
159
|
|
|
160
|
-
> /skill:pwk-writing-plans
|
|
161
|
-
|
|
162
|
-
# (agent turns each Requirement into acceptance criteria + integration tests)
|
|
163
|
-
|
|
164
160
|
> /skill:pwk-executing-tasks
|
|
165
161
|
|
|
166
|
-
# (feature-gate: writes feature E2E โ checkpoint โ implements
|
|
162
|
+
# (feature-gate: creates the branch, writes feature E2E โ checkpoint โ implements the blocks โ checkpoint โ feature review)
|
|
167
163
|
|
|
168
164
|
> /skill:pwk-finalizing
|
|
169
165
|
|
|
@@ -182,15 +178,15 @@ pi install npm:@tianhai/pi-workflow-kit
|
|
|
182
178
|
```
|
|
183
179
|
pi-workflow-kit/
|
|
184
180
|
โโโ extensions/
|
|
185
|
-
โ โโโ workflow-guard.ts # Write blocker during
|
|
181
|
+
โ โโโ workflow-guard.ts # Write blocker during the design phase; destructive-bash blacklist
|
|
186
182
|
โโโ skills/
|
|
187
183
|
โ โโโ pwk-brainstorming/SKILL.md
|
|
188
|
-
โ โโโ pwk-writing-plans/SKILL.md
|
|
189
184
|
โ โโโ pwk-executing-tasks/SKILL.md
|
|
190
185
|
โ โโโ pwk-code-review/SKILL.md
|
|
191
186
|
โ โโโ pwk-finalizing/SKILL.md
|
|
192
187
|
โ โโโ pwk-status/SKILL.md
|
|
193
|
-
โ
|
|
188
|
+
โ โโโ pwk-diagnose/SKILL.md
|
|
189
|
+
โ โโโ pwk-walkthrough/SKILL.md # on-demand explainer; docs/walkthroughs/ output
|
|
194
190
|
โโโ agents/ # canonical role contracts; /pwk-setup copies them to .agents/agents/
|
|
195
191
|
โโโ docs/
|
|
196
192
|
โ โโโ developer-usage-guide.md
|
|
@@ -4,9 +4,9 @@ How to install and use `pi-workflow-kit` with Pi, and how its workflow roles map
|
|
|
4
4
|
|
|
5
5
|
## What you get
|
|
6
6
|
|
|
7
|
-
- **
|
|
7
|
+
- **4 pipeline skills** โ brainstorm โ executing-tasks โ finalizing, with code-review running at the feature level during execution.
|
|
8
8
|
- **2 utility skills** โ diagnose (debugging) and status (multi-topic overview), both on demand.
|
|
9
|
-
- **1 extension** โ hard-blocks source writes during
|
|
9
|
+
- **1 extension** โ hard-blocks source writes during the design phase, and blocks destructive bash via a simple common-blacklist.
|
|
10
10
|
|
|
11
11
|
## Installation
|
|
12
12
|
|
|
@@ -35,7 +35,7 @@ Or in `.pi/settings.json` / `~/.pi/agent/config.json`:
|
|
|
35
35
|
You control each phase by invoking the skill. A design doc is one PR; a requirement is one testable slice within it. A requirement too big for one design doc but shipping as one PR is an **umbrella** โ multiple design docs under one status-free overview, on one branch, finalized once:
|
|
36
36
|
|
|
37
37
|
```
|
|
38
|
-
/skill:pwk-brainstorming โ /skill:pwk-
|
|
38
|
+
/skill:pwk-brainstorming โ /skill:pwk-executing-tasks โ /skill:pwk-finalizing
|
|
39
39
|
```
|
|
40
40
|
|
|
41
41
|
### 1. Brainstorm
|
|
@@ -54,19 +54,9 @@ The command creates `.agents/agents/` and installs the five PWK roles. It preser
|
|
|
54
54
|
|
|
55
55
|
Explore the idea through collaborative dialogue. The agent reads code, asks questions, proposes approaches, and presents the design for your review. Questioning runs in **frontier rounds**: numbered questions each carrying a recommended answer, facts looked up rather than asked, an assumption gate before the design is presented, and a frontier-empty stop rule (nothing left silently assumed). On non-trivial topics with prior art, the skill requests the logical `codebase-recon` capability using the `pwk-recon-scout` role. A compatible host may dispatch that role in a fresh, bounded, read-only worker; otherwise the skill reports `Scout: unavailable` and performs the same five-section recon inline.
|
|
56
56
|
|
|
57
|
-
Outcome: `docs/plans/YYYY-MM-DD-<topic>-design.md` โ descriptive, opening with a `## At a glance` digest for the human (plain-language summary
|
|
57
|
+
Outcome: `docs/plans/YYYY-MM-DD-<topic>-design.md` โ descriptive, opening with a `## At a glance` digest for the human (plain-language summary โ **Key decisions** โ `(rejected: โฆ)` clauses only for real forks โ โ `| R# | Requirement in one line | Risk |` table) immediately before the `## Requirements` blocks. For a too-big requirement, may start an **umbrella** (writes a status-free overview + the first part's design doc). ADRs go to `docs/adr/` (permanent).
|
|
58
58
|
|
|
59
|
-
### 2.
|
|
60
|
-
|
|
61
|
-
```
|
|
62
|
-
/skill:pwk-writing-plans
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
Read the design doc's Requirements and turn each into **acceptance criteria + integration-test cases** โ a behavioral spec (no implementation code). The plan carries a `## Crosswalk` (one row per design requirement); you review a **one-line confirmation** ("Plan covers R1โR<N>; tags: โฆ") โ the full plan is available on request.
|
|
66
|
-
|
|
67
|
-
Outcome: `docs/plans/YYYY-MM-DD-<topic>-implementation.md`.
|
|
68
|
-
|
|
69
|
-
### 3. Execute
|
|
59
|
+
### 2. Execute
|
|
70
60
|
|
|
71
61
|
```
|
|
72
62
|
/skill:pwk-executing-tasks
|
|
@@ -74,7 +64,7 @@ Outcome: `docs/plans/YYYY-MM-DD-<topic>-implementation.md`.
|
|
|
74
64
|
|
|
75
65
|
Implement via the **feature-gate flow** with full autonomy: write the feature-acceptance E2E test (red) โ **checkpoint: feature-spec** โ implement the requirements back-to-back โ feature review โ **ship checkpoint** (full suite + E2E green; you review the execution summary + code digest + coverage table โ full diff on request). After the review passes, the executor writes the code digest into the progress file from the review packet. Two mandatory checkpoints at the feature level. Per-requirement checkpoints/reviews are opt-in (default off).
|
|
76
66
|
|
|
77
|
-
###
|
|
67
|
+
### 3. Code review (feature level)
|
|
78
68
|
|
|
79
69
|
The `pwk-executing-tasks` skill requests the `parallel-review` capability for four logical roles over the whole feature diff: spec alignment, code tracing, code smells, and production hazards. The scope is a script-assembled review packet (diff + acceptance criteria verbatim) handed to every role via a one-liner pointer โ the packet never rides in spawn arguments. The roles are independent, fresh-context, read-only reporters; the main agent collects their results, applies smell fixes itself, runs the tests, and flags other findings for the human. The review runs before the ship checkpoint, so your final approval is fully informed: execution summary, per-requirement coverage table, findings status, full diff on request.
|
|
80
70
|
|
|
@@ -82,7 +72,7 @@ In Pi, `/pwk-setup` installs the canonical role definitions into `.agents/agents
|
|
|
82
72
|
|
|
83
73
|
*Fallback:* if no host/provider can guarantee the requested capabilities, the skill performs the missing recon or review work inline. Other Pi extensions are supported only when they expose the documented capabilities or have a separate adapter; arbitrary extensions are not automatically compatible. See `docs/provider-delegation-contract.md` for the integration contract.
|
|
84
74
|
|
|
85
|
-
###
|
|
75
|
+
### 4. Finalize
|
|
86
76
|
|
|
87
77
|
```
|
|
88
78
|
/skill:pwk-finalizing
|
|
@@ -96,7 +86,15 @@ In Pi, `/pwk-setup` installs the canonical role definitions into `.agents/agents
|
|
|
96
86
|
/skill:pwk-diagnose
|
|
97
87
|
```
|
|
98
88
|
|
|
99
|
-
|
|
89
|
+
### Walkthrough (on demand)
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
/skill:pwk-walkthrough
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Generate a detailed, file:line-anchored walkthrough of a shipped feature or branch into `docs/walkthroughs/<topic>.md` โ Summary / How it works / Key flows / Gotchas & invariants / Change map โ stamped with the commit range, regenerated wholesale on re-run, never disposed. Exits the gated design phase.
|
|
96
|
+
|
|
97
|
+
A debugging loop you invoke when something is broken. Not a pipeline phase. **Invoking it exits the gated design phase** โ diagnosis needs to write failing tests and debug instrumentation. If you only want read-only investigation mid-design, use `pwk-status` or re-lock with `/pwk-guard on`.
|
|
100
98
|
|
|
101
99
|
### Status (on demand)
|
|
102
100
|
|
|
@@ -104,13 +102,13 @@ A debugging loop you invoke when something is broken. Not a pipeline phase. **In
|
|
|
104
102
|
/skill:pwk-status
|
|
105
103
|
```
|
|
106
104
|
|
|
107
|
-
A read-only overview of all active design topics โ which phase each is in and how far along. Use when resuming work or juggling several designs in parallel (e.g. across worktrees) and you're unsure which topic to continue. Not a pipeline phase, and **it does not exit the gated phase** โ it needs no writes, so the
|
|
105
|
+
A read-only overview of all active design topics โ which phase each is in and how far along. Use when resuming work or juggling several designs in parallel (e.g. across worktrees) and you're unsure which topic to continue. Not a pipeline phase, and **it does not exit the gated phase** โ it needs no writes, so the design-phase write boundary stays up.
|
|
108
106
|
|
|
109
107
|
## What the extension does
|
|
110
108
|
|
|
111
109
|
The `workflow-guard` extension registers `/pwk-setup` and watches `write`/`edit` and `bash` tool calls:
|
|
112
110
|
|
|
113
|
-
- **During
|
|
111
|
+
- **During the design phase**: blocks writes outside `docs/plans/`, and blocks destructive bash via a simple common-blacklist (a command is allowed unless it matches a destructive pattern). A short phase reminder is shown once when the gated phase begins so the model self-restricts.
|
|
114
112
|
- **During executing-tasks, code-review, finalizing, diagnose**: no restrictions.
|
|
115
113
|
- **Phases are skill-driven**: the guard follows the skill you invoke โ it never unlocks on message keywords. The exact unlock set is `pwk-executing-tasks`, `pwk-finalizing`, `pwk-code-review`, `pwk-diagnose`; `pwk-status` stays gated. To override, run `/pwk-guard on` (force read-only), `off` (disable), or `auto` (default; skill-driven). Subcommands autocomplete.
|
|
116
114
|
|
|
@@ -125,7 +123,7 @@ Plans specify *what* (acceptance criteria + integration tests); the executor wri
|
|
|
125
123
|
## Tips
|
|
126
124
|
|
|
127
125
|
- Start with brainstorming for anything non-trivial.
|
|
128
|
-
- The
|
|
126
|
+
- The design doc is a behavioral spec, not an implementation recipe โ let the executor choose how.
|
|
129
127
|
- The feature-gate flow has two checkpoints by default (feature-spec + ship): use them to steer the E2E spec and to sign off the finished implementation (digest + coverage, diff on request).
|
|
130
|
-
- **Right-size each requirement at
|
|
131
|
-
- Put all
|
|
128
|
+
- **Right-size each requirement at design time** with the `### Checkpoints` (`none`/`full`/`spec`, default `none`) and `### Review` (`skip`/`parallel`/`inline`, default `skip`) tags โ per-requirement ceremony is opt-in. The always-on feature-level `### Feature review` covers the whole diff. `spec` keeps the cheap spec-correctness gate and drops the complete checkpoint (covered by review), so it requires at least `inline` review. A trivial fix can also use the brainstorming trivial fast-path (one-turn brainstorm, minimal design doc). Production-risk requirements are auto-tagged `### Review: parallel` by `pwk-brainstorming`; the human can override or downgrade before design approval.
|
|
129
|
+
- Put all design artifacts under `docs/plans/`; ADRs under `docs/adr/`.
|
package/docs/oversight-model.md
CHANGED
|
@@ -6,9 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
Skills teach the agent the workflow. There are 5 pipeline skills:
|
|
8
8
|
|
|
9
|
-
- **pwk-brainstorming** โ explore ideas, produce
|
|
10
|
-
- **pwk-
|
|
11
|
-
- **pwk-executing-tasks** โ feature-gate flow: write the feature E2E first, implement the requirements, then one feature-level review before the **ship checkpoint** (execution summary + coverage table presented for approval; full diff on request); two mandatory checkpoints (feature-spec + ship), per-requirement ceremony opt-in
|
|
9
|
+
- **pwk-brainstorming** โ explore ideas, produce the single buildable design doc (each `### R<n>:` block carries its acceptance criteria + review tags) that opens with a `## At a glance` digest for the human (plain-language summary โ **Key decisions** with rejected-alternative clauses only for real forks โ `| R# | Requirement in one line | Risk |` table) immediately before the `## Requirements` blocks. For a requirement too big for one design doc, may start an **umbrella** (multiple design docs under one status-free overview, shipping as one PR). On non-trivial topics, requests the logical `codebase-recon` capability and falls back to the `pwk-recon-scout` role inline when unavailable or unsafe.
|
|
10
|
+
- **pwk-executing-tasks** โ feature-gate flow: write the feature E2E first, implement the design doc's `### R<n>` requirement blocks, then one feature-level review before the **ship checkpoint** (execution summary + coverage table presented for approval; full diff on request); two mandatory checkpoints (feature-spec + ship), per-requirement ceremony opt-in
|
|
12
11
|
- **pwk-code-review** โ the inline reviewer (code tracing, spec alignment, code smells, production hazards). During `pwk-executing-tasks`, the feature-level review requests the `parallel-review` capability for four logical fresh-context, read-only roles; successful reports are retained and missing roles are retried or completed inline. It falls back to inline review when no safe compatible provider exists. The canonical provider contract is documented in `docs/provider-delegation-contract.md`.
|
|
13
12
|
- **pwk-finalizing** โ dispose consumed plan docs (archive or delete; for an umbrella, the overview + every part), curate lessons, update docs, create PR or merge
|
|
14
13
|
|
package/docs/workflow-phases.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# Workflow Phases
|
|
2
2
|
|
|
3
|
-
`pi-workflow-kit` has
|
|
3
|
+
`pi-workflow-kit` has 4 pipeline skills plus 3 utility skills. You invoke each one explicitly with `/skill:`.
|
|
4
4
|
|
|
5
5
|
```
|
|
6
|
-
brainstorm โ
|
|
7
|
-
|
|
6
|
+
brainstorm โ executing-tasks โ finalizing
|
|
7
|
+
(feature-gate: write feature E2E โ โธ feature-spec โ implement requirements โ feature review โ โธ ship)
|
|
8
8
|
```
|
|
9
9
|
|
|
10
|
-
A design doc is one PR; a requirement is one testable slice within it. A requirement too big for one design doc but shipping as one PR is an **umbrella**: multiple design docs under one status-free overview, on one branch, finalized once (`(brainstorm โ
|
|
10
|
+
A design doc is one PR; a requirement is one testable slice within it. A requirement too big for one design doc but shipping as one PR is an **umbrella**: multiple design docs under one status-free overview, on one branch, finalized once (`(brainstorm โ execute) ร N โ finalize`).
|
|
11
11
|
|
|
12
12
|
## brainstorm
|
|
13
13
|
|
|
@@ -16,27 +16,12 @@ A design doc is one PR; a requirement is one testable slice within it. A require
|
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
- Explore requirements and shape the design. Interviews in **frontier rounds**: questions form a dependency tree seeded by a six-dimension checklist; each round asks the full frontier as numbered questions, each with a recommended answer; facts are looked up, only decisions asked; the interview ends when the frontier is empty โ nothing left silently assumed โ and an assumption gate sweeps the draft before the design is presented.
|
|
19
|
-
- Produce `docs/plans/YYYY-MM-DD-<topic>-design.md` โ descriptive,
|
|
19
|
+
- Produce `docs/plans/YYYY-MM-DD-<topic>-design.md` โ descriptive, the **single buildable artifact**: a `## At a glance` digest for the human (2โ4 sentence plain-language summary โ **Key decisions**, one line each: decision + why, a `(rejected: โฆ)` clause only when the fork was real โ a `| R# | Requirement in one line | Risk |` table, one row per requirement) immediately before the `## Requirements` blocks โ one `### R<n>:` block per requirement carrying its one-line behavior, **acceptance criteria** (Given/When/Then incl. edge/error cases) and Checkpoints/Review tags (no test-name lists, no separate plan doc) โ ending with a `## Feature acceptance` section (end-to-end scenarios that prove the requirements compose into the PRD's behavior โ the feature's definition-of-done).
|
|
20
20
|
- May start an **umbrella** for a requirement too big for one design doc (human-approved): writes the status-free `docs/plans/<date>-<umbrella>/overview.md` (each umbrella in its own folder; roster of parts + build order) and the **first** part's `-design.md` beside it. Later parts are brainstormed one by one against the overview + implemented predecessors.
|
|
21
21
|
- ADRs go to `docs/adr/` (permanent, never archived).
|
|
22
22
|
|
|
23
23
|
Write boundary: only `docs/plans/` is writable. Source files are hard-blocked.
|
|
24
24
|
|
|
25
|
-
## writing-plans
|
|
26
|
-
|
|
27
|
-
```
|
|
28
|
-
/skill:pwk-writing-plans
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
- Creates the feature branch first (`git checkout -b <topic>`), so design + plan docs live on the branch, not `main`.
|
|
32
|
-
- Reads the design doc's `## Requirements`; for each, derives **acceptance criteria + integration-test cases** (a behavioral spec, no implementation code), lists requirements in build order (dependencies positioned earlier), and challenges the design when `## Production-risk areas` is present. Emits a `## Crosswalk` (R# โ plan section โ tests) after `## Overview` โ the audit checks every design R# appears exactly once, and the human is shown a **one-line confirmation** ("Plan covers R1โR<N>; tags: โฆ"), not the full plan.
|
|
33
|
-
- For an umbrella part, reads the umbrella folder's `overview.md` to plan one slice (composing with earlier parts' code) and reuses the existing feature branch instead of creating a new one.
|
|
34
|
-
- Derives a **`## Feature acceptance` section** in the plan from the design's Feature acceptance โ the **primary enforced spec**, an end-to-end test the executor gates on first. If the design has none, stops and asks the human to brainstorm one.
|
|
35
|
-
- Tags the plan: per-requirement `### Checkpoints`/`### Review` default to `none`/`skip` (opt-in), plus an always-on feature-level `### Feature review`. Flags only requirements with complex logic, the main part of the feature, or production-risk. Requirements with `### Production-risk notes` are auto-tagged `### Review: parallel` (see `pwk-writing-plans` for the rule).
|
|
36
|
-
- Produce `docs/plans/YYYY-MM-DD-<topic>-implementation.md`.
|
|
37
|
-
|
|
38
|
-
Write boundary: only `docs/plans/` is writable.
|
|
39
|
-
|
|
40
25
|
## executing-tasks
|
|
41
26
|
|
|
42
27
|
```
|
|
@@ -45,7 +30,7 @@ Write boundary: only `docs/plans/` is writable.
|
|
|
45
30
|
|
|
46
31
|
- **Feature-gate flow:** write the feature-acceptance E2E test (red) โ **โธ checkpoint: feature-spec** (human confirms the E2E proves the feature) โ implement the requirements back-to-back with full autonomy (the executor chooses structure/signatures/internals) โ **feature review** (request the `parallel-review` capability for four logical read-only roles when the host supports it; otherwise run `/skill:pwk-code-review` inline โ see [code-review](#code-review)) โ **โธ checkpoint: ship** (full suite + feature E2E green; present the execution summary + code digest + reviewer coverage table; full diff on request).
|
|
47
32
|
- After the review passes, the executor writes a **code digest** into the progress file โ plain-language summary, execution flow, gotchas, key files โ derived from the review packet; it rides the existing disposal globs.
|
|
48
|
-
- Per-requirement checkpoints/reviews are **opt-in** โ they fire only for requirements the
|
|
33
|
+
- Per-requirement checkpoints/reviews are **opt-in** โ they fire only for requirements the design doc tags (default off); see [Proportionality](#proportionality).
|
|
49
34
|
- **Regression check after each commit** โ run the full existing suite to catch cross-requirement regressions immediately. The feature E2E stays red until the last requirement and is gated only at the ship checkpoint (the old integration gate folds into it).
|
|
50
35
|
- Progress tracked in `docs/plans/*-progress.md` (feature phase + requirement checklist).
|
|
51
36
|
|
|
@@ -53,7 +38,7 @@ No write restrictions. All tools available.
|
|
|
53
38
|
|
|
54
39
|
## Proportionality
|
|
55
40
|
|
|
56
|
-
The **feature-gate flow** is the default: write the feature E2E first, implement the requirements, then one feature-level review. Per-requirement ceremony is opt-in โ at
|
|
41
|
+
The **feature-gate flow** is the default: write the feature E2E first, implement the requirements, then one feature-level review. Per-requirement ceremony is opt-in โ at design time the human tags only the requirements that need it:
|
|
57
42
|
|
|
58
43
|
- **Checkpoints** โ `none` (no per-requirement stop, **default**) | `full` (both stops) | `spec` (tests stop only โ cheap spec-correctness gate, implementation covered by review). Test-first is preserved either way: even `none` writes a meaningful test first (red) and implements to green; only the human *stops* are optional. `spec` requires at least `inline` review (never combine with `skip`).
|
|
59
44
|
- **Review** โ `skip` (no per-requirement review, **default**) | `parallel` (four fresh-context reviewers) | `inline` (single `pwk-code-review` pass).
|
|
@@ -91,7 +76,7 @@ No write restrictions.
|
|
|
91
76
|
/skill:pwk-status
|
|
92
77
|
```
|
|
93
78
|
|
|
94
|
-
Read-only overview of all active pipeline topics (phase + progress) when several designs are in flight; an umbrella rolls up under its overview (shipped / in-flight / not-started). Not a pipeline phase โ and it **does not exit the gated phase** (`pwk-status` is read-only; it runs fine under the
|
|
79
|
+
Read-only overview of all active pipeline topics (phase + progress) when several designs are in flight; an umbrella rolls up under its overview (shipped / in-flight / not-started). Not a pipeline phase โ and it **does not exit the gated phase** (`pwk-status` is read-only; it runs fine under the design-phase write block, so the boundary stays up).
|
|
95
80
|
|
|
96
81
|
## diagnose
|
|
97
82
|
|
|
@@ -17,13 +17,13 @@ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
|
17
17
|
/**
|
|
18
18
|
* Workflow Guard extension.
|
|
19
19
|
*
|
|
20
|
-
* Blocks write/edit outside docs/plans/ and destructive bash during
|
|
20
|
+
* Blocks write/edit outside docs/plans/ and destructive bash during the design phase.
|
|
21
21
|
* Bash uses a simple common-blacklist (DESTRUCTIVE_PATTERNS) โ a command is allowed unless it matches
|
|
22
22
|
* a destructive pattern. A short phase reminder is appended after the user's message each turn via
|
|
23
23
|
* before_agent_start. You control phases explicitly via /skill: commands โ no auto-detection, no prompts.
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
-
type Phase = "brainstorm" |
|
|
26
|
+
type Phase = "brainstorm" | null;
|
|
27
27
|
|
|
28
28
|
type DelegationStatus = "completed" | "failed" | "timed-out" | "skipped";
|
|
29
29
|
|
|
@@ -299,13 +299,16 @@ function installRoleFiles(
|
|
|
299
299
|
return { installed, skipped };
|
|
300
300
|
}
|
|
301
301
|
|
|
302
|
-
/** Minimal structural view of the command context the fast-model prompt needs.
|
|
302
|
+
/** Minimal structural view of the command context the fast-model prompt needs.
|
|
303
|
+
* Mirrors pi's ExtensionContext contract: scopedModels carry Model objects
|
|
304
|
+
* (`{ id, name, provider, ... }` โ use `.id`), and `ui.select` takes plain
|
|
305
|
+
* strings and resolves to the chosen string (undefined when cancelled). */
|
|
303
306
|
interface FastModelPromptContext {
|
|
304
307
|
cwd: string;
|
|
305
308
|
hasUI?: boolean;
|
|
306
|
-
scopedModels?: { model?: string }[];
|
|
309
|
+
scopedModels?: readonly { model?: { id?: string } | string }[];
|
|
307
310
|
ui?: {
|
|
308
|
-
select?: (title: string, options:
|
|
311
|
+
select?: (title: string, options: string[]) => Promise<string | undefined>;
|
|
309
312
|
confirm?: (title: string, message: string) => Promise<boolean>;
|
|
310
313
|
};
|
|
311
314
|
}
|
|
@@ -338,19 +341,26 @@ async function promptFastModelChoice(
|
|
|
338
341
|
if (installedHint(ctx.cwd) !== undefined) return undefined;
|
|
339
342
|
const scoped = Array.isArray(ctx.scopedModels) ? ctx.scopedModels : [];
|
|
340
343
|
const models = scoped
|
|
341
|
-
.map((entry) =>
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
344
|
+
.map((entry) => {
|
|
345
|
+
const model = entry?.model;
|
|
346
|
+
if (typeof model === "string") return model; // tolerated for minimal fake contexts
|
|
347
|
+
return typeof model?.id === "string" && model.id.length > 0 ? model.id : undefined;
|
|
348
|
+
})
|
|
349
|
+
.filter((model): model is string => model !== undefined);
|
|
350
|
+
// ui.select renders options verbatim and resolves to the chosen option, which is
|
|
351
|
+
// then written verbatim into role frontmatter โ so options must be bare model ids.
|
|
352
|
+
const unique = [...new Set(models)];
|
|
353
|
+
if (unique.length === 0) return undefined; // nothing to offer: behave like headless
|
|
354
|
+
const choice = await ui.select("Fast-tier model for smell/hazard reviewers (skip = default models)", [
|
|
355
|
+
...unique,
|
|
356
|
+
"skip",
|
|
357
|
+
]);
|
|
348
358
|
if (!choice || choice === "skip") return undefined;
|
|
349
359
|
const allRoles = (await ui.confirm?.("Apply to all four reviewers?", "No = smell+hazard only")) ?? false;
|
|
350
360
|
return { model: choice, allRoles };
|
|
351
361
|
}
|
|
352
362
|
|
|
353
|
-
// Destructive commands blocked in
|
|
363
|
+
// Destructive commands blocked in the design phase (simple common blacklist)
|
|
354
364
|
const DESTRUCTIVE_PATTERNS = [
|
|
355
365
|
/\brm\b/i,
|
|
356
366
|
/\brmdir\b/i,
|
|
@@ -374,7 +384,7 @@ const DESTRUCTIVE_PATTERNS = [
|
|
|
374
384
|
/\bbrew\s+(install|uninstall|upgrade)/i,
|
|
375
385
|
// git add/commit/apply merge files and are blocked below. Plain `git branch`/`checkout`/`switch`
|
|
376
386
|
// only create or move between branches (no source-file changes), so they are intentionally allowed
|
|
377
|
-
// during gated phases โ
|
|
387
|
+
// during gated phases โ executing-tasks creates the feature branch in its pre-flight.
|
|
378
388
|
/\bgit\s+(add|commit|push|pull|merge|rebase|reset|branch\s+-[dD]|stash(?!\s+list)|cherry-pick|revert|tag(?!\s+(-l|--list))|init|clone|apply)/i,
|
|
379
389
|
// Edit-via-bash vectors: in-place editors, patch appliers, find-delete (bypass the write/edit tool block)
|
|
380
390
|
/\bsed\b.*\s-i\b/i,
|
|
@@ -463,24 +473,28 @@ export function isSafeCommand(command: string): boolean {
|
|
|
463
473
|
|
|
464
474
|
const SKILL_TO_PHASE: Record<string, Phase> = {
|
|
465
475
|
"pwk-brainstorming": "brainstorm",
|
|
466
|
-
"pwk-writing-plans": "plan",
|
|
467
476
|
};
|
|
468
477
|
|
|
469
478
|
/** Skills whose invocation exits a gated phase (used by the input handler; exported for tests/
|
|
470
479
|
* skill-lint). Deliberately excludes pwk-status (read-only by design; stays gated). */
|
|
471
|
-
export const UNLOCK_SKILLS = [
|
|
480
|
+
export const UNLOCK_SKILLS = [
|
|
481
|
+
"pwk-executing-tasks",
|
|
482
|
+
"pwk-finalizing",
|
|
483
|
+
"pwk-code-review",
|
|
484
|
+
"pwk-diagnose",
|
|
485
|
+
"pwk-walkthrough",
|
|
486
|
+
] as const;
|
|
472
487
|
|
|
473
488
|
/** Phase-aware reminder appended after the user's message each turn while a gated phase is active.
|
|
474
489
|
* Returned as a message (not a system-prompt change) so it sits at the tail of the request and
|
|
475
490
|
* never invalidates the cached prefix. */
|
|
476
491
|
const PHASE_REMINDERS: Record<Exclude<Phase, null>, string> = {
|
|
477
492
|
brainstorm:
|
|
478
|
-
"[pi-workflow-kit]
|
|
479
|
-
plan: "[pi-workflow-kit] PLAN phase: read-only. No source edits; writes only under docs/plans/. No mutations.",
|
|
493
|
+
"[pi-workflow-kit] DESIGN phase: read-only. No source edits; writes only under docs/plans/. No mutations.",
|
|
480
494
|
};
|
|
481
495
|
|
|
482
496
|
/** Determine if a write/edit to filePath should be blocked during the given phase.
|
|
483
|
-
* Only writes under docs/plans/ are allowed during
|
|
497
|
+
* Only writes under docs/plans/ are allowed during the design phase.
|
|
484
498
|
*/
|
|
485
499
|
export function shouldBlockFilePath(filePath: string, cwd: string): boolean {
|
|
486
500
|
const absolute = resolve(cwd, filePath);
|
|
@@ -643,11 +657,12 @@ export default function (pi: ExtensionAPI) {
|
|
|
643
657
|
return;
|
|
644
658
|
}
|
|
645
659
|
}
|
|
646
|
-
// Phase transitions happen only via skills โ no message keyword unlocks the
|
|
660
|
+
// Phase transitions happen only via skills โ no message keyword unlocks the design phase.
|
|
647
661
|
// Run /skill:pwk-executing-tasks (or another write-needing skill) to leave a gated phase.
|
|
648
662
|
//
|
|
649
|
-
// Unlock list rationale: execute/finalize/code-review/diagnose all need to write
|
|
650
|
-
// (implement, edit review fixes, add [DEBUG-] instrumentation
|
|
663
|
+
// Unlock list rationale: execute/finalize/code-review/diagnose/walkthrough all need to write
|
|
664
|
+
// source or docs outside docs/plans/ (implement, edit review fixes, add [DEBUG-] instrumentation,
|
|
665
|
+
// generate docs/walkthroughs/), so they exit the gate.
|
|
651
666
|
// pwk-status is NOT here on purpose: it is read-only orientation, so it stays inside the
|
|
652
667
|
// gated phase and never drops the write boundary the user is relying on.
|
|
653
668
|
// (Orientation never needs write access; see skills/pwk-status.)
|
|
@@ -712,7 +727,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
712
727
|
return {
|
|
713
728
|
block: true,
|
|
714
729
|
reason: `โ ๏ธ ${label}: Cannot ${event.toolName} to ${filePath}. Only docs/plans/ is writable${
|
|
715
|
-
manual ? " under the manual read-only lock" : " during
|
|
730
|
+
manual ? " under the manual read-only lock" : " during the design phase"
|
|
716
731
|
}.`,
|
|
717
732
|
};
|
|
718
733
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tianhai/pi-workflow-kit",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Enforce structured
|
|
3
|
+
"version": "2.1.2",
|
|
4
|
+
"description": "Enforce structured designโexecuteโfinalize workflow with TDD discipline in AI coding agents",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|
|
7
7
|
"ai-coding-agent",
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: pwk-brainstorming
|
|
3
|
-
description: "Use this before any creative work โ creating features, building components, adding functionality, or modifying behavior. Explores intent and design
|
|
3
|
+
description: "Use this before any creative work โ creating features, building components, adding functionality, or modifying behavior. Explores intent and design, then writes the single buildable design doc (requirements with acceptance criteria + review tags) that pwk-executing-tasks builds from. Use this skill whenever the user describes something they want to build, change, or improve, even if they don't say 'brainstorm' โ phrases like 'I want to add X', 'let's build Y', 'we need a way to Z', or 'help me design' all apply."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Brainstorming
|
|
7
7
|
|
|
8
|
-
Read-only exploration of source code; every file you create or edit goes under `docs/plans/`. (Once an ADR is approved by the human, `docs/adr/` becomes writable too โ ask the user to unlock or run the write.)
|
|
8
|
+
Read-only exploration of source code; every file you create or edit goes under `docs/plans/`. (Once an ADR is approved by the human, `docs/adr/` becomes writable too โ ask the user to unlock or run the write.) The design doc is the **single buildable artifact** โ each requirement carries its own acceptance criteria and review tags, and the executor builds straight from it; nothing is re-derived into a second document later. Source-writing happens in `pwk-executing-tasks`.
|
|
9
9
|
|
|
10
10
|
## Proportionality: trivial vs non-trivial
|
|
11
11
|
|
|
12
12
|
Classify the change at the start.
|
|
13
13
|
|
|
14
|
-
- **Trivial** โ typo or obvious bugfix with no open design questions, config/version bump, single-function change, or anything the human flags as trivial. Skip steps 3โ7; write a **minimal** design doc in one turn (an `In short:` one-liner โ what + why + approach in plain words, a
|
|
14
|
+
- **Trivial** โ typo or obvious bugfix with no open design questions, config/version bump, single-function change, or anything the human flags as trivial. Skip steps 3โ7; write a **minimal** design doc in one turn (an `In short:` one-liner โ what + why + approach in plain words, plus a single `### R1:` requirement block with its criteria and tags, and an optional `## Production-risk areas` line), and hand off to `/skill:pwk-executing-tasks`. The guard still enforces read-only โ trivial compresses the phase to one turn, it doesn't skip it.
|
|
15
15
|
- **Non-trivial** โ open design questions, multiple approaches, cross-module impact, or new behavior. Run the full process below.
|
|
16
16
|
|
|
17
17
|
When unsure, ask: "This looks trivial โ fast-path it, or full brainstorm?" Default to full.
|
|
@@ -20,17 +20,17 @@ When unsure, ask: "This looks trivial โ fast-path it, or full brainstorm?" Def
|
|
|
20
20
|
|
|
21
21
|
**One design doc = one PR; one requirement = one testable slice within it.** Most work is a single design doc.
|
|
22
22
|
|
|
23
|
-
- Within a doc, decompose into **requirements
|
|
23
|
+
- Within a doc, decompose into **requirements** โ one `### R<n>: <name>` block per requirement, each one testable behavior carrying its own acceptance criteria and tags.
|
|
24
24
|
- A requirement too big for one design doc but shipping as a single PR is an **umbrella** โ multiple design docs decomposed under one overview, on one branch, finalized once. See [Umbrella](#umbrella) below.
|
|
25
25
|
|
|
26
26
|
## Umbrella
|
|
27
27
|
|
|
28
|
-
An umbrella splits one large requirement into multiple design docs that ship together as **one PR**. One branch; one `pwk-finalizing` at the end. The split is intra-PR decomposition โ a way to keep each design/
|
|
28
|
+
An umbrella splits one large requirement into multiple design docs that ship together as **one PR**. One branch; one `pwk-finalizing` at the end. The split is intra-PR decomposition โ a way to keep each design/execute cycle small and focused, not a multi-PR strategy.
|
|
29
29
|
|
|
30
30
|
**First brainstorm** (the requirement is too big for one design doc):
|
|
31
31
|
|
|
32
32
|
1. **Propose the split** โ the parts, a one-line scope each, and build order. Get human approval before writing anything beyond discovery.
|
|
33
|
-
2. **Write the overview** โ `docs/plans/<date>-<umbrella>/overview.md`, in the umbrella's own folder (every part doc lives beside it: `<part>-design.md`, `<part>-
|
|
33
|
+
2. **Write the overview** โ `docs/plans/<date>-<umbrella>/overview.md`, in the umbrella's own folder (every part doc lives beside it: `<part>-design.md`, `<part>-progress.md`, `*-review-packet.md`), a **status-free roster**:
|
|
34
34
|
|
|
35
35
|
```markdown
|
|
36
36
|
# Overview: <umbrella>
|
|
@@ -43,16 +43,16 @@ An umbrella splits one large requirement into multiple design docs that ship tog
|
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
Goal, parts with one-line scopes, build order โ **no status column**. No skill mutates the overview between this write and `pwk-finalizing` (which disposes it); part-completion is inferred from each part's own `*-progress.md`.
|
|
46
|
-
3. **Write the first part's** `<part>-design.md` in the same umbrella folder, then hand off to `/skill:pwk-
|
|
46
|
+
3. **Write the first part's** `<part>-design.md` in the same umbrella folder, then hand off to `/skill:pwk-executing-tasks`.
|
|
47
47
|
|
|
48
48
|
**Later parts** โ re-run `/skill:pwk-brainstorming` for the next part. Read the overview for big-picture/roster context (which slice is yours, which siblings exist), then explore the codebase to design your slice **as brainstorm always does** โ prior parts are just implemented code in the repo by then. There is no special "read your predecessors" step; cross-slice decisions that must persist go in an ADR, not the overview.
|
|
49
49
|
|
|
50
|
-
The whole umbrella is one branch and one PR: `pwk-
|
|
50
|
+
The whole umbrella is one branch and one PR: `pwk-executing-tasks` creates the branch in its pre-flight and reuses it for later parts, and suggests the next part (or finalize after the last); `pwk-finalizing` disposes the overview + every part's docs and ships one PR.
|
|
51
51
|
|
|
52
52
|
## Process
|
|
53
53
|
|
|
54
54
|
1. **Check git state** โ `git status` + `git log --oneline -5`. Uncommitted work? Ask the user what to do first.
|
|
55
|
-
2. **Discovery** *(skip in a brand-new repo with no `docs/plans/`)* โ
|
|
55
|
+
2. **Discovery** *(skip in a brand-new repo with no `docs/plans/`)* โ first verify the repo root: run `pwd` (or your shell's equivalent) and `git rev-parse --show-toplevel`; mismatch โ report both paths and stop; never `cd` (a worktree root counts). Then list `docs/plans` recursively, excluding docs/plans/completed/, for `*-design.md` and `overview.md` (each umbrella lives in its own `docs/plans/<date>-<umbrella>/` folder โ archived work is not in flight). Use whatever recurses in your harness; one example: `find docs/plans -name '<suffix>' -not -path '*/completed/*'`; report in-flight topics and any active umbrella. If the new idea continues an existing topic, ask whether to extend it or start fresh. Part of an umbrella? An existing `overview.md` means the split is already decided โ read it for the roster and design this part's `-design.md` against it (see [Umbrella](#umbrella)).
|
|
56
56
|
3. **Understand the idea** โ read only enough code/docs/commits to ground the design. **Check `docs/lessons.md`** โ known constraints may shape it. Ask questions in **frontier rounds**: build a question tree seeded by the dimension checklist, then ask in rounds. The **frontier** is every question whose prerequisites are already settled โ ask the whole frontier in one round; a question whose answer depends on another still-open question waits for a later round. Number each question (`Q1`, `Q2`, โฆ) and attach your recommended answer (`โก๏ธ <recommendation>`) โ the recommendation is your assumption surfaced up front; the human confirms, strikes, or corrects each in one reply. Recompute the frontier after each round of answers. Seed the tree by walking every checklist dimension โ *Goal & scope ยท Data & state ยท Behavior & edge cases ยท Errors & failure ยท Integration ยท Non-functional* โ printing `โ nothing to ask` for groups with no questions (never skip silently). **Facts vs. decisions**: anything answerable from the codebase, docs, or tools is looked up โ recon scout or inline โ never asked of the human; a pending lookup is an unsettled prerequisite that holds only its downstream questions, while the rest of the frontier is asked now. Only decisions are asked. Major approvals stay single-decision โ one question each, never batched: approach selection (step 5), umbrella split, design approval, ADR unlock. The interview ends when the frontier is empty โ every branch visited, nothing left silently assumed โ not when you feel you understand. Then present a short summary and ask: "Should I proceed, or is there more?" The human decides when to move on.
|
|
57
57
|
4. **(skipped on trivial changes)** **Codebase recon** โ for non-trivial topics with prior art, request the hostโs `codebase-recon` capability using the logical `pwk-recon-scout` role. Require a fresh-context, read-only, bounded worker and pass the topic, one-line intent, and repo root. Use the returned 5-section codebase map (Relevant files, Existing patterns, Call sites, Test layout, Gotchas) as the grounding context for the next two steps instead of reading those files inline. The scout is observations only โ no design recommendations. Skip this step on trivial changes (typo, version bump, single-function edit per the proportionality rule). If no compatible capability is available or the provider cannot enforce the requested constraints, report `Scout: unavailable` and do the same recon inline, preserving the five-section map and `file:line` citations; do not silently omit recon.
|
|
58
58
|
5. **Explore approaches** โ propose 2โ3, leading with your recommendation. Sketch the concrete interface (types, signatures, example caller) for each so the comparison is grounded in code, not abstractions.
|
|
@@ -61,13 +61,46 @@ The whole umbrella is one branch and one PR: `pwk-writing-plans` creates the bra
|
|
|
61
61
|
**Assumptions to confirm first** โ before presenting, sweep the drafted design: every assumption it would bake in unconfirmed (business rules, defaults, edge-case resolutions) re-opens as a numbered question carrying your recommended answer; the human confirms, strikes, or corrects each in one reply. An honest empty gate ("no unconfirmed assumptions") when the draft is clean โ never invent items. Hard rule: no business behavior enters the design doc on the agent's assumption. Confirmed facts are woven into the doc's existing sections โ no new template section.
|
|
62
62
|
|
|
63
63
|
Identified a significant architectural decision? Offer an ADR in `docs/adr/`. Only when all three hold: **hard to reverse**, **surprising without context**, **a real trade-off**. Format: title + 1โ3 sentences of context/decision/why. ADRs are permanent institutional memory โ they stay out of archive/rotation forever. (Guard note: `docs/adr/` is outside the writable `docs/plans/`; write it only after the user approves and unlocks.)
|
|
64
|
-
7. **Write the design doc** โ `docs/plans/YYYY-MM-DD-<topic>-design.md`, descriptive (not a task list).
|
|
64
|
+
7. **Write the design doc** โ `docs/plans/YYYY-MM-DD-<topic>-design.md`, descriptive (not a task list). This is the single artifact the executor builds from.
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
**Open with `## At a glance`** โ the human's two-minute digest, immediately before `## Requirements`. It contains (1) a 2โ4 sentence plain-language summary: what is wrong or needed, what will be built, the key approach in plain words; (2) **Key decisions** โ one line each: decision + why, with a `(rejected: <alternative> โ <reason>)` clause only when the fork was real and load-bearing (never manufactured โ no fork, no clause); (3) a table `| R# | Requirement in one line | Risk |` with exactly one row per requirement, where **R# = the requirement's block number in the `## Requirements` section below** โ this ID is what every later digest keys on (progress rows, execution summary, reviewer coverage table). Plain language only: short sentences, no jargon, no Given/When/Then โ those live in the requirement blocks for the executor. An umbrella overview gains no at-a-glance section; its roster already serves that role.
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
Then **`## Requirements`** โ one block per requirement, each one testable behavior:
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
```markdown
|
|
71
|
+
## Requirements
|
|
72
|
+
|
|
73
|
+
### R1: <name>
|
|
74
|
+
<one-line testable behavior โ what the feature produces or changes, through its public interface>
|
|
75
|
+
|
|
76
|
+
**Acceptance criteria** โ Given/When/Then criteria defining "done". Test observable behavior โ what the feature produces or changes through its public interface; not implementation steps. Cover edge and error cases.
|
|
77
|
+
- Given โฆ When โฆ Then โฆ
|
|
78
|
+
- Given โฆ When โฆ Then โฆ (edge case)
|
|
79
|
+
|
|
80
|
+
### Checkpoints: none | full | spec
|
|
81
|
+
### Review: skip | parallel | inline
|
|
82
|
+
|
|
83
|
+
### Production-risk notes
|
|
84
|
+
- <only when the requirement touches a risk area>
|
|
85
|
+
|
|
86
|
+
### R2: <name>
|
|
87
|
+
โฆ
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Block rules:
|
|
91
|
+
|
|
92
|
+
- **No test-name lists.** The criteria are the test spec โ the executor writes and names the actual tests red-green from them, so the doc contains no test-name lists and no R#-to-section mapping tables: the block structure is the map.
|
|
93
|
+
- **Tag every requirement** โ `### Checkpoints` (how many human stops: `none` = no per-requirement stop, the default โ the feature gate covers it; `full` = tests + complete stops; `spec` = tests stop only) and `### Review` (per-requirement review: `skip` = none, the default; `parallel` = four delegated reviewers; `inline` = one `pwk-code-review` pass). Missing tags default to `none` / `skip`. Flag `full` or `spec` only where complex logic or the main part of the feature makes a human look at the slice worth the stop.
|
|
94
|
+
- **Auto-tag rule (this skill is the one source of truth for the auto-tag rule):** a requirement with a non-empty `### Production-risk notes` section gets `### Review: parallel` as the default; requirements without risk notes keep `Review: skip`. The tag is silently applied and editable โ the human can override or downgrade it to `inline` or `skip` at design approval, and `pwk-executing-tasks` honors the edited value. Other skills and the docs link here; they do not restate the rule.
|
|
95
|
+
- **`spec` requires at least `inline` review** โ dropping the complete stop is only safe when review covers implementation quality; never combine `spec` with `Review: skip` (use `Checkpoints: none` instead).
|
|
96
|
+
- **Production-risk notes** โ a requirement touching a production-risk area carries its notes inside the block. Risks involving schema migrations, new dependencies, external APIs, or seed data also get a `## Setup` section (dependencies, migrations, seed data, and how to verify setup worked) between `## Requirements` and `## Feature acceptance`.
|
|
97
|
+
- **Ordering** โ dependencies come earlier in the list; the executor runs blocks in listed order with no dependency graph. Aim for vertical slices that merge cleanly on their own.
|
|
98
|
+
|
|
99
|
+
Then the narrative sections the executor reads as context โ problem, approaches considered, architecture, components, data flow, error handling. **Approaches considered records every real fork and why each loser lost** โ the executor needs the reasoning, and the finalize learning sweep harvests it for ADRs.
|
|
100
|
+
|
|
101
|
+
Touches a production-risk area (DB schema/migrations, auth, external APIs, concurrency/batch, uploads/large data flows, Redis/caching/queues)? Add a brief `## Production-risk areas` **immediately after the last requirement block** โ inside the `### R1 โ ## Feature acceptance` span, so the review packet carries it to reviewers verbatim โ and mirror the risks into each touched block's `### Production-risk notes`. `pwk-code-review` audits it per requirement, and finalize's learning sweep reads it.
|
|
102
|
+
|
|
103
|
+
**End with `## Feature acceptance`** โ one or more end-to-end `Given/When/Then` scenarios proving the requirements *compose* into the feature. This is the feature's definition-of-done; the human approves it as what "the feature works" means. `pwk-executing-tasks` writes it as the E2E test first and runs it as the **primary enforced spec** (the test it gates on first). The section carries the feature-level `### Feature review: parallel | inline` tag โ the one whole-feature review; default `parallel` (thoroughness lives here โ it is the only review in the common case), `inline` for small features. Treat "I can write this scenario" as the green light to finish designing โ if you can't, keep designing because the requirements don't yet compose into a coherent feature. If writing a scenario step would require inventing behavior, that invention goes back through the assumption gate โ it may never be silently written into the scenario; an unwritable step means an unspecified requirement, so keep designing.
|
|
71
104
|
|
|
72
105
|
```markdown
|
|
73
106
|
## Feature acceptance
|
|
@@ -77,9 +110,11 @@ The whole umbrella is one branch and one PR: `pwk-writing-plans` creates the bra
|
|
|
77
110
|
|
|
78
111
|
Example (rate limiting): "Given a new API consumer with no prior usage, When they exceed 100 requests/minute for 3 consecutive minutes, Then they're throttled, a `rate_limited` event is emitted, and further requests return 429."
|
|
79
112
|
|
|
80
|
-
**
|
|
113
|
+
**Audit before finishing:** every requirement block has acceptance criteria and both tags, and each requirement appears **exactly once** โ none dropped, none duplicated. A `## Feature acceptance` section exists as the primary enforced spec. Production-risk areas are reflected in the requirement blocks that touch them.
|
|
114
|
+
|
|
115
|
+
**Splitting large issues:** if the requirement needs more than one design doc, propose an umbrella split (one `<topic>` per part) and get human approval first โ see [Umbrella](#umbrella). On approval, write the status-free overview (`docs/plans/<date>-<umbrella>/overview.md`) and the **first part's** `-design.md` beside it, then hand off to `/skill:pwk-executing-tasks`. Later parts are brainstormed one by one (each re-reading the overview) โ do not write every part's design doc up front.
|
|
81
116
|
|
|
82
|
-
The session stays read-only and uncommitted through brainstorm
|
|
117
|
+
The session stays read-only and uncommitted through brainstorm: branch creation and the design-doc commit happen at the start of `pwk-executing-tasks` (its pre-flight creates the feature branch).
|
|
83
118
|
|
|
84
119
|
## Principles
|
|
85
120
|
|
|
@@ -91,4 +126,4 @@ The session stays read-only and uncommitted through brainstorm and plan: branch
|
|
|
91
126
|
|
|
92
127
|
## After the design
|
|
93
128
|
|
|
94
|
-
Ask: "Ready to
|
|
129
|
+
Ask: "Ready to execute? Run `/skill:pwk-executing-tasks`"
|
|
@@ -7,7 +7,7 @@ description: "Disciplined debugging loop for hard bugs and performance regressio
|
|
|
7
7
|
|
|
8
8
|
A 6-phase debugging discipline. Phase 1 is the skill โ spend disproportionate effort here.
|
|
9
9
|
|
|
10
|
-
Invoking `/skill:pwk-diagnose` **exits the gated
|
|
10
|
+
Invoking `/skill:pwk-diagnose` **exits the gated design phase** (the workflow guard unlocks) โ diagnosis needs to write failing tests and `[DEBUG-โฆ]` instrumentation. If you only wanted read-only investigation, use `/skill:pwk-status` (stays gated) or reinstate the lock with `/pwk-guard on`.
|
|
11
11
|
|
|
12
12
|
## Phase 1 โ Build a feedback loop
|
|
13
13
|
|
|
@@ -1,30 +1,32 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: pwk-executing-tasks
|
|
3
|
-
description: "Implement a
|
|
3
|
+
description: "Implement a design doc via the feature-gate flow: write the feature-acceptance E2E first, implement the ### R<n> requirement blocks back-to-back, then one feature-level review. Run after pwk-brainstorming. Per-requirement checkpoints/reviews are opt-in (default off)."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Executing Tasks
|
|
7
7
|
|
|
8
|
-
Implement the
|
|
8
|
+
Implement the design doc from `docs/plans/*-design.md` via the **feature-gate flow**. The design doc is the single buildable artifact โ its `### R<n>` blocks carry each requirement's acceptance criteria and tags. The criteria define *what*, you decide *how*: structure, signatures, internals are yours.
|
|
9
9
|
|
|
10
|
-
The feature-acceptance E2E test is the primary enforced gate and the primary enforced spec for the feature. The flow is always on: write the E2E first (red), implement the requirements back-to-back, then run the feature review and pause at the **ship checkpoint** โ one fully-informed stop where you present the execution summary and the reviewer coverage table, with the full diff on request. Per-requirement checkpoints and reviews are **opt-in** โ they fire only for requirements the
|
|
10
|
+
The feature-acceptance E2E test is the primary enforced gate and the primary enforced spec for the feature. The flow is always on: write the E2E first (red), implement the requirements back-to-back, then run the feature review and pause at the **ship checkpoint** โ one fully-informed stop where you present the execution summary and the reviewer coverage table, with the full diff on request. Per-requirement checkpoints and reviews are **opt-in** โ they fire only for requirements the design doc tags (default off); the feature gate covers everything else.
|
|
11
|
+
|
|
12
|
+
**Legacy in-flight features** (created before 2.0): a stem-matched `*-implementation.md` routes the old plan flow โ parse its `## Requirement N:` sections instead of ### R<n> blocks; everything else is identical. Discovery covers both suffixes.
|
|
11
13
|
|
|
12
14
|
## Before you start
|
|
13
15
|
|
|
14
16
|
1. **Git state** โ `git status` + `git log --oneline -5`; note uncommitted changes.
|
|
15
|
-
2. **Find the
|
|
16
|
-
3. **Workspace** โ `
|
|
17
|
+
2. **Find the doc** โ first verify the repo root: run `pwd` (or your shell's equivalent) and `git rev-parse --show-toplevel`; mismatch โ report both paths and stop; never `cd` (a worktree root counts). Then list `docs/plans` recursively, excluding docs/plans/completed/, for `*-design.md` and `*-implementation.md` (umbrella docs live in `docs/plans/<date>-<umbrella>/` folders โ archived work is not pending). Use whatever recurses in your harness; one example: `find docs/plans -name '<suffix>' -not -path '*/completed/*'`. A stem-matched legacy `*-implementation.md` wins for that topic (an in-flight 1.x feature โ old flow). If no doc at all, ask the user to run `/skill:pwk-brainstorming` first; if several, ask which. Report one line, e.g. `Found: design "auth" โ feature-gate execute (feature-spec done, implementing 2/5)`. A matching `*-progress.md` means this is a **resume** (see [Resume](#resume)).
|
|
18
|
+
3. **Workspace โ create the feature branch** โ if you're already on a feature branch (not `main`), **reuse** it: a later umbrella part continues on the same umbrella branch. If on `main`, `git checkout -b <topic>` โ the umbrella's `<topic>` if this design doc is one of an overview's parts, else the design doc's `<topic>`. For larger work, offer a worktree (`git worktree add ../<repo>-<topic> <topic>`) and hand off to a new session there so `pwd` is the worktree. Wait for the user's choice.
|
|
17
19
|
|
|
18
20
|
## First run
|
|
19
21
|
|
|
20
|
-
1. **Parse the
|
|
21
|
-
2. **Setup pre-flight** *(only if the
|
|
22
|
-
3. **Create the progress file** `docs/plans/YYYY-MM-DD-<topic>-progress.md` (same dated stem as the
|
|
22
|
+
1. **Parse the design doc** โ read every `### R<n>:` heading and its `### Checkpoints` / `### Review` tags (defaults `none` / `skip`), plus the feature-level `### Feature review` tag in the `## Feature acceptance` section. Requirements run in **listed order** (build order); do not reorder. Read the `## Feature acceptance` section โ it is the E2E you gate on first. (Legacy plan doc: read `## Requirement N:` headings the same way.)
|
|
23
|
+
2. **Setup pre-flight** *(only if the design doc has a `## Setup` section)* โ install dependencies, apply migrations, seed data, then run the existing test suite. **โธ CHECKPOINT: setup** โ present results and wait for approval. Record `setup: done` in the progress-file header so a resume can confirm it rather than assume it.
|
|
24
|
+
3. **Create the progress file** `docs/plans/YYYY-MM-DD-<topic>-progress.md` (same dated stem as the design doc, so `pwk-finalizing`'s glob matches; an umbrella part creates `<part>-progress.md` inside its `docs/plans/<date>-<umbrella>/` folder):
|
|
23
25
|
|
|
24
26
|
```markdown
|
|
25
27
|
# Progress: <topic>
|
|
26
28
|
|
|
27
|
-
|
|
29
|
+
Design: docs/plans/YYYY-MM-DD-<topic>-design.md
|
|
28
30
|
Branch: <branch>
|
|
29
31
|
Started: <ISO timestamp>
|
|
30
32
|
Last updated: <ISO timestamp>
|
|
@@ -52,15 +54,15 @@ The feature-acceptance E2E test is the primary enforced gate and the primary enf
|
|
|
52
54
|
|
|
53
55
|
The `## Code digest` is filled once, at the write point in the ship checkpoint โ never per requirement. Fill rules: plain language, R# anchors where natural, no test names (the execution-summary rule). `### Flow` uses `A -> B -> C` arrow chains. `### Gotchas` lifts real risks from the review findings โ `[ALERT]` only for reviewer-confirmed issues, never invented; with no findings, write `none beyond review findings` and mean it. `### Key files` is capped at 5 pivotal files, one line each: what shifted inside them.
|
|
54
56
|
|
|
55
|
-
`Feature phase` is one of: `e2e-written`, `feature-spec-paused`, `implementing (k/N)`, `reviewing`, `ship-paused`, `done`.
|
|
57
|
+
`Feature phase` is one of: `e2e-written`, `feature-spec-paused`, `implementing (k/N)`, `reviewing`, `ship-paused`, `done`. (A legacy progress file's `Plan:` ref points at its implementation doc โ follow that chain instead.)
|
|
56
58
|
|
|
57
|
-
4. **Commit the
|
|
58
|
-
5. **Write the feature-acceptance E2E test (red).** Read the
|
|
59
|
+
4. **Commit the design docs** โ `git add docs/plans/ && git commit -m "docs: add design doc"`.
|
|
60
|
+
5. **Write the feature-acceptance E2E test (red).** Read the design doc's `## Feature acceptance` section and encode it as a real test file; run it; confirm it **fails** (it must โ little or none of the feature exists yet). If it passes immediately, the behavior may already exist or the test is wrong โ investigate before proceeding.
|
|
59
61
|
6. **โธ CHECKPOINT: feature-spec** โ set `Feature phase: feature-spec-paused`, lead with 1โ2 plain-language lines stating **what the E2E proves** ("this test proves that โฆ"), then present the E2E test + failing output, and wait. This is where the human confirms the E2E actually proves the feature (the definition of done). **request changes** โ revise, re-run, re-present.
|
|
60
62
|
|
|
61
63
|
## Resume
|
|
62
64
|
|
|
63
|
-
Read the progress file's `Feature phase
|
|
65
|
+
Read the progress file's `Feature phase` (match the line โ e.g. `grep -m1 '^Feature phase:' <file>`), the Requirements table (the first row whose Done cell is not `โ
` routes the next requirement โ `โฌ`, `๐`, and blank all mean not-done), and the Execution summary rows (how prior parts were built); read from the top through the end of `## Execution summary` and stop โ the sections after it (deviation-records, review reports, code digest) carry nothing the resume needs:
|
|
64
66
|
- `e2e-written` โ write the E2E if not yet present, then present the **feature-spec** checkpoint.
|
|
65
67
|
- `feature-spec-paused` โ re-present the feature-spec checkpoint and wait.
|
|
66
68
|
- `implementing (k/N)` โ continue the next not-yet-โ
requirement.
|
|
@@ -72,22 +74,22 @@ Read the progress file's `Feature phase`:
|
|
|
72
74
|
|
|
73
75
|
Update the matching requirement row directly (not via pattern matching that could corrupt the table). Update `Last updated` and `Feature phase` on every change. The `Per-req ceremony` column records a requirement's tagged checkpoint/review status when it has one (e.g. `โธ tests`, `๐ inline`); leave `โ` for default (`none`/`skip`) requirements.
|
|
74
76
|
|
|
75
|
-
**Execution summary rows are written in the same step as marking a requirement โ
** โ never retrofitted at the end. "How it was built" = one or two plain sentences: what it does now + the approach actually taken; file names sparingly; **no test names, no code** (the human reads this at the ship checkpoint โ big picture only). If the implementation departs from the
|
|
77
|
+
**Execution summary rows are written in the same step as marking a requirement โ
** โ never retrofitted at the end. "How it was built" = one or two plain sentences: what it does now + the approach actually taken; file names sparingly; **no test names, no code** (the human reads this at the ship checkpoint โ big picture only). If the implementation departs from the design, fill the Deviated? column **at deviation time** (when the departure happens), with a one-line why โ it is a log, not a stop. A departure that **reverses or alters a design decision** gets a **deviation decision-record**: a short paragraph (what changed, why, what was rejected) written into the progress file while the knowledge is fresh โ mechanical deviations keep the one-liner. `pwk-finalizing`'s learning sweep harvests these records for ADRs before the docs are disposed.
|
|
76
78
|
|
|
77
79
|
## Implement phase (after feature-spec is approved)
|
|
78
80
|
|
|
79
81
|
Set `Feature phase: implementing (0/N)` and work the requirements in listed order. For each:
|
|
80
82
|
|
|
81
83
|
1. **Mark the requirement ๐** (Done column) and read its `### Checkpoints` / `### Review` tags.
|
|
82
|
-
2. **Write a meaningful test (red), then implement (green)** โ TDD discipline. Encode the requirement's acceptance criteria as a real test through the public interface; run it; confirm it fails; implement to green. Skip the per-slice test only when the slice has no independent observable behavior (the feature E2E covers it). Follow the meaningful-test rules: (1) **Test observable behavior** โ assert on what the feature produces or changes (a return value, persisted/updated data, an emitted event, an HTTP response) through its public interface; these assertions keep passing as the implementation changes. (2) **Write a per-slice test when the slice has its own observable behavior** โ when a slice is pure config or a trivial extraction, the feature E2E covers it and a per-slice test is unnecessary. (Mirrored in `pwk-
|
|
83
|
-
3. **โธ per-requirement checkpoint** *(fires only when the tag says so โ opt-in)* โ if `### Checkpoints: full` or `spec`, stop and present per the tag (`full` = after tests and after complete; `spec` =
|
|
84
|
+
2. **Write a meaningful test (red), then implement (green)** โ TDD discipline. Encode the requirement's acceptance criteria as a real test through the public interface; run it; confirm it fails; implement to green. Skip the per-slice test only when the slice has no independent observable behavior (the feature E2E covers it). Follow the meaningful-test rules: (1) **Test observable behavior** โ assert on what the feature produces or changes (a return value, persisted/updated data, an emitted event, an HTTP response) through its public interface; these assertions keep passing as the implementation changes. (2) **Write a per-slice test when the slice has its own observable behavior** โ when a slice is pure config or a trivial extraction, the feature E2E covers it and a per-slice test is unnecessary. (Mirrored in `pwk-brainstorming` and `docs/lessons.md`.)
|
|
85
|
+
3. **โธ per-requirement checkpoint** *(fires only when the tag says so โ opt-in)* โ if `### Checkpoints: full` or `spec`, stop and present per the tag (`full` = after tests and after complete; `spec` = tests only). With the default `none`, show the redโgreen inline and proceed.
|
|
84
86
|
4. **Regression check after each commit** โ run the **full existing suite**. This is what catches cross-requirement regressions (a later requirement breaking an earlier one's test). The **feature E2E stays red until the last requirement lands**; you may run it to watch the failure point advance, but it is gated only at the ship checkpoint โ never expect it green per-commit.
|
|
85
87
|
5. **Learn.** Caught a repeat mistake? Append a **generic** rule to `docs/lessons.md` (strip domain specifics).
|
|
86
88
|
6. **Commit** the requirement with a clear message; mark its row โ
and write its execution-summary row in the same step; advance `Feature phase: implementing (k/N)`.
|
|
87
89
|
|
|
88
90
|
### Per-requirement review (opt-in)
|
|
89
91
|
|
|
90
|
-
If the requirement's `### Review` tag is `parallel` or `inline` (default `skip`), review that slice now โ same mechanics as the [feature review](#feature-review), with a requirement-scoped packet: the same recipe limited to the commits and criteria
|
|
92
|
+
If the requirement's `### Review` tag is `parallel` or `inline` (default `skip`), review that slice now โ same mechanics as the [feature review](#feature-review), with a requirement-scoped packet: the same recipe limited to the commits and criteria of that requirement, written to `docs/plans/<dated-stem>-review-packet-r<N>.md` (requirement-suffixed, so per-requirement packets never overwrite the feature packet or each other). With `skip`, no per-requirement review; the feature-level review covers it.
|
|
91
93
|
|
|
92
94
|
`Checkpoints: spec` requires at least `inline` review โ dropping the complete checkpoint is only safe when review covers implementation quality; never combine `spec` with `Review: skip` (use `Checkpoints: none` instead).
|
|
93
95
|
|
|
@@ -103,8 +105,8 @@ When a per-requirement checkpoint fires it is a **hard stop**:
|
|
|
103
105
|
When every requirement's Done column is โ
:
|
|
104
106
|
|
|
105
107
|
1. **Run the FULL test suite** โ a failure means one requirement regressed another; fix it now, in execute context.
|
|
106
|
-
2. **Run the feature-acceptance E2E** โ the test you wrote at the start. It must be **green** now that all requirements have landed. If it is still red, a requirement is missing or wrong โ fix it before proceeding. (If the
|
|
107
|
-
3. **Run the feature review** (below) per the
|
|
108
|
+
2. **Run the feature-acceptance E2E** โ the test you wrote at the start. It must be **green** now that all requirements have landed. If it is still red, a requirement is missing or wrong โ fix it before proceeding. (If the design declared no feature E2E โ a pure refactor โ gate on the full suite staying green instead.)
|
|
109
|
+
3. **Run the feature review** (below) per the design's `### Feature review` tag โ set `Feature phase: reviewing` first, so a mid-review resume routes into this step instead of the implement loop. The review runs **before** your final approval, so the pause is fully informed. Apply smell fixes yourself and re-green (full suite + E2E) before pausing.
|
|
108
110
|
4. **Write the code digest** into the progress file โ the review has succeeded, findings are fixed, and the code is final: read the packet's `## Commits`, `## Changed files`, and `## Diff` sections and fill the progress file's `## Code digest` (template above) per the fill rules. If the packet is stale or missing, re-run the recipe before writing. A resumed `Feature phase: reviewing` that completes lands on this same write point before the checkpoint is assembled. Written once โ never rewritten per requirement, never a gate: it explains the change, it does not block shipping.
|
|
109
111
|
5. **Set `Feature phase: ship-paused`** and **โธ CHECKPOINT: ship** โ present, in this order:
|
|
110
112
|
- a green-gates line: full suite green, feature E2E green;
|
|
@@ -122,12 +124,12 @@ The old "integration gate" is gone โ the feature E2E at the ship checkpoint *i
|
|
|
122
124
|
|
|
123
125
|
## Feature review
|
|
124
126
|
|
|
125
|
-
This is step 3 of the [ship checkpoint](#ship-checkpoint-feature-complete--review-merged): it runs **before** the final human approval, so the pause is fully informed. Run **one** review over the **whole feature diff**, driven by the
|
|
127
|
+
This is step 3 of the [ship checkpoint](#ship-checkpoint-feature-complete--review-merged): it runs **before** the final human approval, so the pause is fully informed. Run **one** review over the **whole feature diff**, driven by the design doc's `### Feature review` tag. This is the single thorough review โ per-requirement reviews, if any, only saw slices in isolation.
|
|
126
128
|
|
|
127
129
|
**Assemble the review packet first** โ once, by script, so that no packet byte passes through model output (spawn arguments are model output; file reads are not). If commits land while the review is in flight, re-run the recipe before spawning any replacement role so the packet matches HEAD:
|
|
128
130
|
|
|
129
131
|
```bash
|
|
130
|
-
PACKET="<
|
|
132
|
+
PACKET="<design doc's directory>/<design doc's stem>-review-packet.md" # beside the design doc โ flat topic: docs/plans/<dated-stem>-review-packet.md; umbrella part: inside the docs/plans/<date>-<umbrella>/ folder
|
|
131
133
|
{
|
|
132
134
|
echo "# Review packet: <topic> โ feature review"
|
|
133
135
|
echo
|
|
@@ -137,14 +139,15 @@ PACKET="<plan doc's directory>/<plan doc's stem>-review-packet.md" # beside th
|
|
|
137
139
|
echo "## Changed files"
|
|
138
140
|
git diff --stat <merge-base>...HEAD
|
|
139
141
|
echo
|
|
140
|
-
echo "## Acceptance criteria (verbatim from the
|
|
141
|
-
sed -n '
|
|
142
|
+
echo "## Acceptance criteria (verbatim from the design doc)"
|
|
143
|
+
sed -n '/^### R1/,/^## Feature acceptance/p' <design-doc path> | sed '/^## Feature acceptance/,$d'
|
|
144
|
+
# legacy plan doc (stem-matched -implementation.md): sed -n '/^## Requirement 1/,/^## Feature acceptance/p' instead of the ### R1 span
|
|
142
145
|
echo
|
|
143
146
|
echo "## Feature acceptance (verbatim)"
|
|
144
|
-
sed -n '/^## Feature acceptance/,/^### Feature review/p' <
|
|
147
|
+
sed -n '/^## Feature acceptance/,/^### Feature review/p' <design-doc path> | sed '/^### Feature review/,$d'
|
|
145
148
|
echo
|
|
146
149
|
echo "## Production-risk notes (verbatim, if any)"
|
|
147
|
-
sed -
|
|
150
|
+
sed -nE '/^### Production-risk notes/,/^(## |### R[0-9])/p' <design-doc path> | sed -E '/^(## |### R[0-9])/d'
|
|
148
151
|
echo
|
|
149
152
|
echo "## Diff"
|
|
150
153
|
git diff <merge-base>...HEAD
|
|
@@ -160,10 +163,10 @@ On success, continue assembling the ship checkpoint; once the human approves it,
|
|
|
160
163
|
|
|
161
164
|
## Tags reference
|
|
162
165
|
|
|
163
|
-
The
|
|
166
|
+
The design doc tags each requirement and the feature level:
|
|
164
167
|
|
|
165
168
|
- **`### Checkpoints: none | full | spec`** โ per-requirement human stops. `none` (default) = no per-requirement stop; `full` = tests + complete; `spec` = tests only.
|
|
166
|
-
- **`### Review: skip | parallel | inline`** โ per-requirement review. `skip` (default) = none; `parallel` = four reviewers; `inline` = one `pwk-code-review` pass. The auto-tag default for requirements with non-empty `### Production-risk notes` is `parallel` (see `pwk-
|
|
169
|
+
- **`### Review: skip | parallel | inline`** โ per-requirement review. `skip` (default) = none; `parallel` = four reviewers; `inline` = one `pwk-code-review` pass. The auto-tag default for requirements with non-empty `### Production-risk notes` is `parallel` (see `pwk-brainstorming` for the rule).
|
|
167
170
|
- **`### Feature review: parallel | inline`** โ the one whole-feature review (always present). Default `parallel`; `inline` for small features.
|
|
168
171
|
|
|
169
172
|
## User override commands
|
|
@@ -10,7 +10,8 @@ Ship the completed work.
|
|
|
10
10
|
## Pre-finalization checks
|
|
11
11
|
|
|
12
12
|
1. **Run the FULL test suite** โ every test must pass, and only a green suite ships. Resume spans sessions; re-run the suite yourself rather than trust the previous session's ending state. Anything failing โ send the user back to `/skill:pwk-executing-tasks`.
|
|
13
|
-
2.
|
|
13
|
+
2. **Verify the repo root** โ run `pwd` (or your shell's equivalent) and `git rev-parse --show-toplevel`; mismatch โ report both paths and stop; never `cd` (a worktree root counts). Then:
|
|
14
|
+
3. Read **every** relevant progress file โ for an umbrella that's each part's progress file โ discovered by listing `docs/plans` recursively for `*-progress.md`, excluding docs/plans/completed/ (umbrella docs live in `docs/plans/<date>-<umbrella>/` folders โ archived parts are already shipped). Use whatever recurses in your harness; one example: `find docs/plans -name '*-progress.md' -not -path '*/completed/*'`. Match the `Feature phase:` line (e.g. `grep -m1 '^Feature phase:' <file>`) and read only the matching โ/โญ verdict rows in the Requirements table (e.g. `grep 'โ' <file>` / `grep 'โญ' <file>` โ rows with reasons); the sections after the tables carry nothing the gate needs. For a standalone design doc, the one:
|
|
14
15
|
- **Any `โ failed`** (in any part) โ **block**. Present counts and reasons; continue only when the user sends the task back to executing-tasks, or explicitly types `--force-failed` to acknowledge shipping with incomplete requirements.
|
|
15
16
|
- **Only `โญ skipped`** โ warn and confirm ("Requirement N was skipped. Continue, or go back?").
|
|
16
17
|
- **`Feature phase` must be `done`** in every progress file โ any other value (`e2e-written`, `feature-spec-paused`, `implementing (k/N)`, `reviewing`, `ship-paused`, or a legacy `feature-complete-paused` from before the ship gate) means the feature is still in flight: the ship checkpoint has not been approved. Send the user back to `/skill:pwk-executing-tasks` instead of finalizing.
|
|
@@ -19,10 +20,15 @@ Ship the completed work.
|
|
|
19
20
|
|
|
20
21
|
1. **Derive the topic set** โ
|
|
21
22
|
- **Umbrella** (a `docs/plans/**/overview.md` exists โ excluding docs/plans/completed/, so an archived umbrella is never the one being finalized): read its roster; the set is every part's `<topic>`. The umbrella folder is disposed too.
|
|
22
|
-
- **Standalone**: progress file โ `
|
|
23
|
+
- **Standalone**: progress file โ `Design:` ref โ design-doc filename โ `<topic>`. One topic. (Legacy progress file: `Plan:` ref โ the implementation doc's `Design:` ref โ design doc.)
|
|
23
24
|
|
|
24
25
|
Ambiguous with several designs in flight? Ask.
|
|
25
|
-
2. **
|
|
26
|
+
2. **Run the learning sweep โ before any disposal command.** The planning docs are about to be destroyed; extract the durable knowledge first, while its container still exists. Read the design doc's At-a-glance key-decision bullets **and its `Approaches considered` section** (the full forks with their reasoning), the progress file's `Deviated?` entries (including any deviation decision-records), and the Code digest's `[ALERT]` entries. Then:
|
|
27
|
+
- **Offer an ADR** (in `docs/adr/`) for each item that passes the three gates โ **hard to reverse**, **surprising without context**, **a real trade-off** โ informed by how the decision actually played out during execution, not just how it looked at design time.
|
|
28
|
+
- **Append generic rules** to `docs/lessons.md` (strip domain specifics).
|
|
29
|
+
- Both outputs are **honest-empty**: most features qualify for nothing โ say so and move on; never manufacture. When an item passes the gates but the recorded material is too thin to draft a credible ADR, **ask the human rather than fabricating** context โ the human was there.
|
|
30
|
+
- The sweep is file-based by necessity: executing and finalizing usually run in fresh sessions with no memory of the brainstorm conversation โ everything the sweep needs must already be on disk.
|
|
31
|
+
3. **Dispose of consumed plan docs โ ask archive or delete** โ for **every topic** in the set, dispose its `-design.md`, `-implementation.md` (legacy โ a 2.0 feature has none; the glob harmlessly no-ops), `-progress.md` (matched by the exact dated topic slug so similarly-named plans for other topics survive); for an umbrella, dispose the whole `docs/plans/<date>-<umbrella>/` folder โ overview + every part โ as one unit. Standalone topics keep the per-file paths. The digest sections (`## At a glance`, `## Execution summary`) live inside their host docs and ride the same globs โ no separate disposal. Each path is matched with the `????-??-??-` prefix. Present both options and let the human choose:
|
|
26
32
|
|
|
27
33
|
- **Delete (default)** โ code + tests are the source of truth; removing the scaffold prevents stale plan docs from misleading future sessions:
|
|
28
34
|
|
|
@@ -55,9 +61,9 @@ Ship the completed work.
|
|
|
55
61
|
```
|
|
56
62
|
|
|
57
63
|
The `????-??-??-` glob enforces the dated filename; a bare `*<topic>*` would over-match unrelated docs (e.g. topic `auth` would also hit `feature-auth-redesign-design.md`). Verify with `ls docs/plans/` before and after. `rm -f` and each `mv โฆ || true` handle missing files. Both paths commit the disposal so the shipped branch is clean. Neither path touches `docs/adr/`, `docs/lessons.md`, `CHANGELOG.md`, or `README.md` โ those are permanent.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
64
|
+
4. **Curate lessons (Agile Scrum Master hat)** โ if `docs/lessons.md` exists: add missed lessons, generalize domain-specific rules into generic patterns, de-duplicate, categorize, retire stale rules. None exists but lessons were learned? Create it. (The learning sweep above feeds this; curation then shapes the whole file.)
|
|
65
|
+
5. **Update documentation** โ if the API or surface changed: `README.md`, `CHANGELOG.md`, any inline docs. Bump the package version (major for breaking changes).
|
|
66
|
+
6. **Choose a merge strategy** โ ask the human:
|
|
61
67
|
|
|
62
68
|
1. **Create PR** โ `git push origin <branch>` then `gh pr create`.
|
|
63
69
|
2. **Rebase & merge** *(recommended)* โ rebase onto parent, `--ff-only` merge, push parent, delete branch.
|
|
@@ -65,10 +71,12 @@ Ship the completed work.
|
|
|
65
71
|
4. **Merge commit** โ `--no-ff` merge, push parent, delete branch.
|
|
66
72
|
|
|
67
73
|
For 2โ4, confirm the detected parent branch before proceeding.
|
|
68
|
-
|
|
74
|
+
7. **Clean up** โ remove the worktree if one was used: `git worktree remove ../<repo>-<topic>`.
|
|
69
75
|
|
|
70
76
|
## Principles
|
|
71
77
|
|
|
78
|
+
- The learning sweep runs before disposal and touches only `docs/adr/` and `docs/lessons.md` โ the two permanent stores.
|
|
79
|
+
|
|
72
80
|
- Dispose of the active work's artifacts only (archive or delete, the human's choice) โ for a standalone design doc its three docs; for an umbrella its overview plus every part's docs. Unrelated topics stay in `docs/plans/`.
|
|
73
81
|
- ADRs are permanent institutional memory โ they stay out of archive/rotation forever.
|
|
74
82
|
- Bump the package version if this is a published change (major for breaking changes).
|
|
@@ -5,21 +5,33 @@ description: "Show all active pipeline topics and their phase/progress. Use when
|
|
|
5
5
|
|
|
6
6
|
# Status
|
|
7
7
|
|
|
8
|
-
Report on in-flight pipelines in this working tree (a worktree has its own `docs/plans/`, so run status in each). Read-only. This skill **does not unlock the guard** โ it needs no writes, so it runs fine inside the
|
|
8
|
+
Report on in-flight pipelines in this working tree (a worktree has its own `docs/plans/`, so run status in each). Read-only. This skill **does not unlock the guard** โ it needs no writes, so it runs fine inside the design read-only phase. If you want source edits after a status check, invoke the skill for the next phase yourself (the guard follows the skill).
|
|
9
9
|
|
|
10
10
|
## Process
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
0. **Verify the root** โ run `pwd` (or your shell's equivalent) and `git rev-parse --show-toplevel`; if they differ, report both paths and stop โ tell the user to restart the session at the repo root; never `cd` (a worktree root counts).
|
|
13
|
+
1. **Discover** โ List `docs/plans` recursively, excluding docs/plans/completed/, one list per suffix: `*-design.md`, `*-implementation.md` (legacy โ a 2.0 feature has no implementation doc; discovery covers both suffixes), `*-progress.md`, `overview.md` (umbrella docs live in `docs/plans/<date>-<umbrella>/` folders โ archived topics are not in flight) โ this working tree only. Use whatever recurses in your harness; one example: `find docs/plans -name '<suffix>' -not -path '*/completed/*'`.
|
|
14
|
+
2. **State per topic/part โ extract, never ingest.** For each progress file take the `Feature phase:` line by matching it (e.g. `grep -m1 '^Feature phase:' <file>` โ wherever the template puts it); the body (execution summary, review reports, code digest) carries nothing status needs, and neither do design docs. Map the line to the displayed state:
|
|
15
|
+
- `done` โ **`done`** โ terminal, never shown as in-flight; append the tally as `N/N` when wanted โ the Requirements-table row count (e.g. `grep -c '^| [0-9]' <file>`); at `done` every row is complete
|
|
16
|
+
- `implementing (k/N)` โ `execute k/N` (the tally rides on the line itself โ no extra read)
|
|
17
|
+
- `e2e-written`, `feature-spec-paused` โ `feature-spec`
|
|
18
|
+
- `reviewing`, legacy `feature-complete-paused` โ `review`
|
|
19
|
+
- `ship-paused` โ `ship-paused`
|
|
20
|
+
- no progress file, only `*-design.md` โ `design` โ next: `/skill:pwk-executing-tasks`
|
|
21
|
+
- roster-only (named in the overview, no artifacts) โ `not started`
|
|
22
|
+
- no parseable `Feature phase` line โ `execute` (with tally if parseable).
|
|
23
|
+
|
|
24
|
+
A legacy 1.x topic (`*-implementation.md` stem-matched) uses the same phase-line inference on its progress file.
|
|
25
|
+
3. **Group by umbrella** โ for each umbrella `overview.md` (read it โ it is status-free and tiny), take its **parts** roster and roll the parts up by state (the overview carries no status): done parts, in-flight parts (design, execute, feature-spec, review, ship-paused), not-started parts. Print one roll-up line โ `<umbrella> (umbrella): n done ยท n in-flight ยท n not-started` โ and when every part is `done` append `โ all parts done, ready for /skill:pwk-finalizing`. A `done` standalone topic gets the same hint. Once the umbrella finalizes, its folder โ overview included โ is disposed, so it no longer appears here. Topics not part of an overview print flat.
|
|
15
26
|
4. Print a compact table, grouped under any umbrellas, e.g.:
|
|
16
27
|
|
|
17
|
-
```
|
|
18
|
-
payments-revamp (umbrella): 2 in-flight ยท 1 not-started
|
|
19
|
-
payments-core
|
|
20
|
-
payments-ui
|
|
28
|
+
```text
|
|
29
|
+
payments-revamp (umbrella): 1 done ยท 2 in-flight ยท 1 not-started
|
|
30
|
+
payments-core done 3/3
|
|
31
|
+
payments-ui execute 1/2
|
|
32
|
+
payments-review review โ
|
|
21
33
|
payments-webhooks not started
|
|
22
|
-
auth
|
|
34
|
+
auth ship-paused โ ready for /skill:pwk-finalizing
|
|
23
35
|
```
|
|
24
36
|
|
|
25
37
|
If nothing, suggest `/skill:pwk-brainstorming`.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pwk-walkthrough
|
|
3
|
+
description: "Generate a detailed, file-referenced walkthrough of a shipped feature or branch โ Summary / How it works / Key flows / Gotchas & invariants / Change map โ written to docs/walkthroughs/<topic>.md. Use when the user asks to 'explain this feature', 'walk me through the code', 'how does X work', wants an implementation deep-dive beyond the code digest, or needs an onboarding doc for existing code. On demand only; regeneration overwrites wholesale."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Walkthrough
|
|
7
|
+
|
|
8
|
+
Explain a shipped feature in code-level detail, for a human reading with the files open.
|
|
9
|
+
|
|
10
|
+
**Not a pipeline phase** โ never auto-run, never blocks anything. The skill is generated on demand and invoking it exits any gated design phase (it writes outside `docs/plans/`).
|
|
11
|
+
|
|
12
|
+
Five sections, always: Summary / How it works / Key flows / Gotchas & invariants / Change map.
|
|
13
|
+
|
|
14
|
+
## Contract
|
|
15
|
+
|
|
16
|
+
- **On demand only.** Someone asks (or finalize suggests it as an optional follow-up); it never runs unprompted.
|
|
17
|
+
- **Generated from code, not memory**: the branch diff (`<merge-base>...HEAD` โ an unshipped branch is allowed, stamped at HEAD) plus the code as it exists now. Surviving artifacts (ADRs in `docs/adr/`, `docs/lessons.md`, an archived plan under `docs/plans/completed/`) are optional inputs โ planning docs are usually gone by the time anyone asks, by design.
|
|
18
|
+
- **Output**: `docs/walkthroughs/<topic>.md`, **stamped with the commit range** it describes.
|
|
19
|
+
- **Regeneration overwrites wholesale.** The file is a generated cache of an explanation, never hand-edited; a re-run replaces it end to end. It is **never disposed** โ finalize's globs do not touch `docs/walkthroughs/`.
|
|
20
|
+
- **No diff found?** Refuse with a clear reason ("no commits on this branch", "no feature matches <topic>") rather than inventing content.
|
|
21
|
+
|
|
22
|
+
## Process
|
|
23
|
+
|
|
24
|
+
1. **Identify the range** โ topic or branch from the user; merge-base against the parent branch. Report the range and commit list in one line.
|
|
25
|
+
2. **Read the code** โ changed files first (`git diff --stat`), then each file's current state around the changed regions. Follow the call graph outward until every entry point in the diff is explained.
|
|
26
|
+
3. **Write `docs/walkthroughs/<topic>.md`**:
|
|
27
|
+
|
|
28
|
+
```markdown
|
|
29
|
+
# Walkthrough: <topic>
|
|
30
|
+
|
|
31
|
+
Generated from <merge-base>..<HEAD> โ file references are valid at that range.
|
|
32
|
+
|
|
33
|
+
## Summary
|
|
34
|
+
2โ4 sentences: what this feature does and what changed.
|
|
35
|
+
|
|
36
|
+
## How it works
|
|
37
|
+
One subsection per component: responsibility + mechanism.
|
|
38
|
+
|
|
39
|
+
## Key flows
|
|
40
|
+
Execution/data movement as arrow chains (A -> B -> C), anchored per step.
|
|
41
|
+
|
|
42
|
+
## Gotchas & invariants
|
|
43
|
+
Edge cases, implicit assumptions, ordering constraints.
|
|
44
|
+
|
|
45
|
+
## Change map
|
|
46
|
+
Where to touch the code for common edits, one line each.
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
4. **Anchor everything** โ every claim in every section cites a concrete `file:line` reference (valid at the stamped range). The doc must be detailed enough to follow with the files open: no file reference, no claim.
|
|
50
|
+
5. **Present** โ the walkthrough path plus a one-paragraph plain summary; offer regeneration when the code changes.
|
|
51
|
+
|
|
52
|
+
## Principles
|
|
53
|
+
|
|
54
|
+
- A cache of an explanation, not a curated document โ regenerate, never edit.
|
|
55
|
+
- Depth over brevity inside the five sections; nothing outside them.
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: pwk-writing-plans
|
|
3
|
-
description: "Turn a design doc's requirements into a behavioral spec โ acceptance criteria + integration tests per requirement. Use after pwk-brainstorming, before pwk-executing-tasks. Use when the user says 'let's plan', 'write a plan', 'break this down', or after a brainstorm when ready to move to implementation."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Writing Plans
|
|
7
|
-
|
|
8
|
-
Turn the design doc's requirements into a **behavioral spec** the executor implements against.
|
|
9
|
-
|
|
10
|
-
One design doc = one plan = one PR. The plan lists **all** the design's requirements in build order; the executor builds them one at a time.
|
|
11
|
-
|
|
12
|
-
The executor runs the **feature-gate flow**: it writes the feature-acceptance E2E first, implements the requirements back-to-back, then runs one feature-level review. Per-requirement checkpoints/reviews happen only for requirements you tag (default off) โ so tag only the slices that genuinely need a human stop or a focused review.
|
|
13
|
-
|
|
14
|
-
Your writes go into `docs/plans/` and nowhere else. Source code and configuration get written later, in `pwk-executing-tasks` โ this phase produces the document the executor builds from.
|
|
15
|
-
|
|
16
|
-
## Process
|
|
17
|
-
|
|
18
|
-
1. **Find the design doc** โ glob `docs/plans/**/*-design.md` (recursive โ umbrella docs live in `docs/plans/<date>-<umbrella>/` folders, excluding docs/plans/completed/ โ archived designs are not plannable). If none, ask the user to run `/skill:pwk-brainstorming` first; if several, ask which. **Read `docs/lessons.md`** if it exists โ known patterns belong in the acceptance criteria. **Umbrella part?** If a `docs/plans/**/overview.md` exists (excluding docs/plans/completed/ โ an archived umbrella is never the umbrella being planned) and this design is one of its roster parts, read the overview for the umbrella goal + roster โ plan this part as one slice, composing with what earlier parts already established in the code. Note the umbrella in the plan's Overview so the executor inherits the context.
|
|
19
|
-
2. **Create or reuse the feature branch** โ if you're already on a feature branch (not `main`), **reuse** it: a later umbrella part continues on the same umbrella branch. Otherwise `git checkout -b <topic>` โ the umbrella's `<topic>` if this is part of an overview, else the design doc's `<topic>` (branch creation is allowed in the plan phase). Design + plan docs live on this branch, committed at the start of `pwk-executing-tasks`.
|
|
20
|
-
3. **Read the `## Requirements` list** โ the plan covers **all** of them. If the design has none, derive requirements from its described behaviors and confirm with the human before proceeding. A requirement whose testable acceptance criteria cannot be derived without inventing behavior is bounced back to `/skill:pwk-brainstorming` naming the specific gap โ never plan on an assumption.
|
|
21
|
-
4. **Write the plan** โ for each requirement:
|
|
22
|
-
- **Crosswalk** โ immediately after `## Overview`, emit `## Crosswalk`: a table `| R# | Plan section | Tests |` with one row per design requirement (R# = the design's numbering from its at-a-glance `## Requirements` list; Tests = that requirement's test names from the plan). Placement is load-bearing: the crosswalk sits strictly before `## Requirement 1` (between `## Overview` and `## Setup`, if present) so the review-packet sed spans (`## Requirement 1` โ `## Feature acceptance` โ `### Feature review`) stay untouched.
|
|
23
|
-
- **Acceptance criteria** โ `Given/When/Then` behavioral statements defining "done". Write observable behaviors, not implementation steps; cover edge and error cases.
|
|
24
|
-
- **Integration tests** โ test name + what each asserts. This is the spec the executor writes tests from.
|
|
25
|
-
- **Meaningful tests** โ write acceptance criteria and tests as observable behavior: (1) **Test observable behavior** โ assert on what the feature produces or changes (a return value, persisted/updated data, an emitted event, an HTTP response) through its public interface; these assertions keep passing as the implementation changes. (2) **Write a per-slice test when the slice has its own observable behavior** โ when a slice is pure config or a trivial extraction, the feature E2E covers it and a per-slice test is unnecessary.
|
|
26
|
-
- **`### Checkpoints: none | full | spec`** โ how many human stops. `none` = no per-requirement stop (default โ the feature gate covers it); `full` = tests + complete stops; `spec` = tests stop only. Flag a requirement `full` or `spec` when it contains complex logic or is the main part of the feature โ where a human look at the slice is worth the stop.
|
|
27
|
-
- **`### Review: skip | parallel | inline`** โ `skip` = no per-requirement review (default โ the feature-level review covers it); `parallel` = four reviewers via delegated parallel roles; `inline` = one `pwk-code-review` pass. The auto-tag bullet below is the single source of truth for risky-requirement tagging.
|
|
28
|
-
- **`### Feature review: parallel | inline`** โ one review over the **whole feature diff**, always present (the single thorough pass). `parallel` (default โ thoroughness lives here, since it is the only review in the common case); `inline` for small features.
|
|
29
|
-
- Tag every requirement โ missing tags default to `none` / `skip`. **`spec` requires at least `inline` review** โ dropping the complete checkpoint is only safe when review covers implementation quality; never combine `spec` with `Review: skip` (use `Checkpoints: none` instead).
|
|
30
|
-
- **Production-risk notes** โ carry forward the design's `## Production-risk areas`, if any.
|
|
31
|
-
- **Auto-tag risky requirements with `### Review: parallel`** โ when a requirement has a non-empty `### Production-risk notes` section, emit `### Review: parallel` as the default. Requirements without risk notes keep the existing default (`### Review: skip`). The tag is silently applied; the human can override or downgrade it to `inline` or `skip` during plan review before approval, and `pwk-executing-tasks` honors the edited value. This is the one source of truth for the auto-tag rule โ `pwk-executing-tasks` and the docs link to it here, they do not restate the rule.
|
|
32
|
-
- **Challenge the design first** *(if production-risk areas exist)* โ stress-test the design against the flagged risks before writing criteria. If a risk invalidates a design choice, stop and return to `/skill:pwk-brainstorming` rather than planning around a flawed design.
|
|
33
|
-
- **Ordering** โ dependencies come **earlier** in the list; the executor runs in listed order with no dependency graph. Aim for vertical slices that merge cleanly on their own.
|
|
34
|
-
|
|
35
|
-
Save to `docs/plans/YYYY-MM-DD-<topic>-implementation.md` (an umbrella part saves into its umbrella folder as `<part>-implementation.md`):
|
|
36
|
-
|
|
37
|
-
```markdown
|
|
38
|
-
# Implementation Plan: <topic>
|
|
39
|
-
|
|
40
|
-
## Overview
|
|
41
|
-
Design: docs/plans/YYYY-MM-DD-<topic>-design.md
|
|
42
|
-
Umbrella: docs/plans/<date>-<umbrella>/overview.md *(umbrella part only โ else omit)*
|
|
43
|
-
|
|
44
|
-
## Crosswalk
|
|
45
|
-
|
|
46
|
-
| R# | Plan section | Tests |
|
|
47
|
-
|----|--------------|-------|
|
|
48
|
-
| 1 | Requirement 1: <name> | `<test name> โฆ` |
|
|
49
|
-
|
|
50
|
-
## Requirement 1: <name>
|
|
51
|
-
|
|
52
|
-
### Acceptance criteria
|
|
53
|
-
- Given โฆ When โฆ Then โฆ
|
|
54
|
-
- Given โฆ When โฆ Then โฆ (edge cases)
|
|
55
|
-
|
|
56
|
-
### Integration tests
|
|
57
|
-
- `should <behavior>` โ asserts <observable outcome>
|
|
58
|
-
- `should <error case>` โ asserts <failure outcome>
|
|
59
|
-
|
|
60
|
-
### Checkpoints: none | full | spec
|
|
61
|
-
### Review: skip | parallel | inline
|
|
62
|
-
|
|
63
|
-
### Production-risk notes
|
|
64
|
-
- <from the design's Production-risk areas, if any>
|
|
65
|
-
|
|
66
|
-
## Requirement 2: <name>
|
|
67
|
-
โฆ
|
|
68
|
-
|
|
69
|
-
## Feature acceptance
|
|
70
|
-
The **primary enforced spec** โ the definition of done for the feature, and the test the executor gates on first. Derived from the design doc: one end-to-end test exercising the requirements *together*. Make it concrete โ a named test + the assertion that proves the composed behavior:
|
|
71
|
-
- `should <the PRD's end-to-end claim>` โ Given <starting state>, When <trigger>, Then <composed outcome across requirements>.
|
|
72
|
-
### Feature review: parallel | inline
|
|
73
|
-
One review over the whole feature diff (always). Default `parallel`; `inline` for small features.
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
**If the design has no `## Feature acceptance` section**, stop and ask the human to run `/skill:pwk-brainstorming` to add one โ the feature's definition-of-done is missing. (A trivial single-requirement design may fold the scenario into that requirement's criteria; note it and skip the separate section.)
|
|
77
|
-
|
|
78
|
-
**If `## Production-risk areas` flagged** schema migrations, new dependencies, external APIs, or seed data, emit a `## Setup` section between `## Overview` and `## Requirement 1` (dependencies, migrations, seed data, and how to verify setup worked).
|
|
79
|
-
|
|
80
|
-
5. **Audit before presenting:**
|
|
81
|
-
- Every requirement has criteria **and** matching tests, a checkpoint tag, a review tag.
|
|
82
|
-
- The `## Crosswalk` covers every design requirement R# exactly once โ none dropped, none duplicated.
|
|
83
|
-
- No `spec` + `skip` combination.
|
|
84
|
-
- A `## Feature acceptance` section exists as the primary enforced spec (or the trivial-fold note).
|
|
85
|
-
- A feature-level `### Feature review` tag is present.
|
|
86
|
-
- Per-requirement tags default to `none` / `skip`; only requirements with complex logic, the main part of the feature, or production-risk are flagged heavier.
|
|
87
|
-
- Production-risk areas from the design are reflected.
|
|
88
|
-
6. **Workspace isolation** โ you're on the `<topic>` branch. For larger work, offer a worktree (`git worktree add ../<repo>-<topic> <topic>`) and hand off to a new session there so `pwd` is the worktree. Wait for the user's choice.
|
|
89
|
-
7. **Present the plan** โ the human reads a **one-line confirmation**, not the full plan: `Plan covers R1โR<N>; tags: <non-default tags>` plus the feature-acceptance test name. The full plan is available on request. Wait for approval. On approval, hand off: "Ready to execute? Run `/skill:pwk-executing-tasks`" (running it is what exits the gated plan phase).
|
|
90
|
-
|
|
91
|
-
## What belongs in the plan โ and what stays out
|
|
92
|
-
|
|
93
|
-
The plan carries: observable behavior (acceptance criteria), the test names + assertions that prove it, and per-requirement tags. Everything about implementation *how* โ code, signatures, file-by-file breakdowns, micro-task decomposition โ stays with the executor, which picks structure against the spec. That's the division that keeps the plan stable when a detail shifts mid-implementation.
|
|
94
|
-
|
|
95
|
-
## After the plan
|
|
96
|
-
|
|
97
|
-
Ask: "Ready to execute? Run `/skill:pwk-executing-tasks`"
|