@tianhai/pi-workflow-kit 0.18.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +79 -62
- package/agents/pwk-hazard-reviewer.md +24 -0
- package/agents/pwk-smell-reviewer.md +17 -0
- package/agents/pwk-spec-reviewer.md +14 -0
- package/agents/pwk-tracing-reviewer.md +14 -0
- package/docs/developer-usage-guide.md +39 -44
- package/docs/lessons.md +2 -7
- package/docs/oversight-model.md +20 -14
- package/docs/workflow-phases.md +64 -30
- package/extensions/workflow-guard.ts +194 -92
- package/package.json +20 -4
- package/skills/pwk-brainstorming/SKILL.md +30 -27
- package/skills/pwk-code-review/SKILL.md +46 -0
- package/skills/pwk-diagnose/SKILL.md +5 -2
- package/skills/pwk-executing-tasks/SKILL.md +92 -328
- package/skills/pwk-finalizing/SKILL.md +23 -106
- package/skills/pwk-status/SKILL.md +28 -0
- package/skills/pwk-writing-plans/SKILL.md +49 -328
- package/docs/plans/2026-06-03-karpathy-guidelines-ab-comparison.md +0 -166
- package/docs/plans/completed/2026-04-11-checkpoint-review-gates-design.md +0 -50
- package/docs/plans/completed/2026-04-11-checkpoint-review-gates-implementation.md +0 -98
- package/docs/plans/completed/2026-04-11-finalizing-merge-options-design.md +0 -33
- package/docs/plans/completed/2026-04-11-finalizing-merge-options-implementation.md +0 -75
- package/docs/plans/completed/2026-04-11-workspace-setup-design.md +0 -28
- package/docs/plans/completed/2026-04-11-workspace-setup-implementation.md +0 -57
- package/docs/plans/completed/2026-04-15-bash-guard-design.md +0 -39
- package/docs/plans/completed/2026-04-15-bash-guard-implementation.md +0 -229
- package/docs/plans/completed/2026-04-21-workflow-guard-safe-commands-design.md +0 -172
- package/docs/plans/completed/2026-04-21-workflow-guard-safe-commands-implementation.md +0 -168
- package/docs/plans/completed/2026-04-22-go-readonly-safe-commands-implementation.md +0 -54
- package/docs/plans/completed/2026-04-28-executing-tasks-redesign-design.md +0 -171
- package/docs/plans/completed/2026-04-28-executing-tasks-redesign-implementation.md +0 -208
- package/docs/plans/completed/2026-04-28-executing-tasks-redesign-progress.md +0 -14
- package/docs/plans/completed/2026-05-01-incorporate-mattpocock-skills-design.md +0 -154
- package/docs/plans/completed/2026-05-01-incorporate-mattpocock-skills-implementation.md +0 -315
- package/docs/plans/completed/2026-05-01-incorporate-mattpocock-skills-progress.md +0 -15
- package/docs/plans/completed/2026-05-08-checkpoint-gates-design.md +0 -235
- package/docs/plans/completed/2026-05-08-checkpoint-gates-implementation.md +0 -83
- package/docs/plans/completed/2026-05-08-checkpoint-gates-progress.md +0 -11
- package/docs/plans/completed/2026-05-08-lessons-learned-design.md +0 -76
- package/docs/plans/completed/2026-05-08-lessons-learned-implementation.md +0 -219
- package/docs/plans/completed/2026-05-08-lessons-learned-progress.md +0 -15
- package/docs/plans/completed/2026-05-08-migrate-earendil-works-design.md +0 -39
- package/docs/plans/completed/2026-05-08-migrate-earendil-works-implementation.md +0 -45
- package/docs/plans/completed/2026-05-08-migrate-earendil-works-progress.md +0 -10
- package/docs/plans/completed/2026-05-08-worktree-handoff-design.md +0 -118
- package/docs/plans/completed/2026-05-08-worktree-handoff-implementation.md +0 -140
- package/docs/plans/completed/2026-05-08-worktree-handoff-progress.md +0 -10
- package/docs/plans/completed/2026-05-20-generic-lessons-design.md +0 -70
- package/docs/plans/completed/2026-05-20-generic-lessons-implementation.md +0 -114
- package/docs/plans/completed/2026-05-20-generic-lessons-progress.md +0 -11
- package/docs/plans/completed/2026-05-22-agentic-agile-enhancements-design.md +0 -77
- package/docs/plans/completed/2026-05-22-agentic-agile-enhancements-implementation.md +0 -473
- package/docs/plans/completed/2026-05-25-design-review-split-implementation.md +0 -622
- package/docs/plans/completed/2026-05-25-design-review-split-progress.md +0 -16
- package/docs/plans/completed/2026-05-25-pr5-improvements-implementation.md +0 -273
- package/docs/plans/completed/2026-05-25-pr5-improvements-progress.md +0 -17
- package/docs/plans/completed/2026-06-03-add-verify-skill-design.md +0 -51
- package/docs/plans/completed/2026-06-03-add-verify-skill-implementation.md +0 -111
- package/docs/plans/completed/2026-06-03-add-verify-skill-progress.md +0 -11
- package/docs/plans/completed/2026-06-03-verify-skill-design.md +0 -176
- package/docs/plans/completed/2026-06-09-code-review-fixes-implementation.md +0 -74
- package/docs/plans/completed/2026-06-09-code-review-fixes-progress.md +0 -14
- package/docs/plans/completed/2026-06-09-incremental-workflow-and-rename-design.md +0 -186
- package/docs/plans/completed/2026-06-09-incremental-workflow-and-rename-implementation.md +0 -675
- package/docs/plans/completed/2026-06-09-incremental-workflow-and-rename-progress.md +0 -18
- package/docs/plans/completed/2026-06-09-incremental-workflow-and-rename-verification-report.md +0 -81
- package/docs/plans/completed/2026-06-09-verification-fixes-implementation.md +0 -69
- package/docs/plans/completed/2026-06-09-verification-fixes-progress.md +0 -14
- package/skills/pwk-design-review/SKILL.md +0 -115
- package/skills/pwk-verify/SKILL.md +0 -170
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# pi-workflow-kit
|
|
2
2
|
|
|
3
|
-
> Stop AI agents from rushing to code. Enforce a structured brainstorm→plan→execute→
|
|
3
|
+
> Stop AI agents from rushing to code. Enforce a structured brainstorm→plan→execute→finalize workflow with test-first discipline and per-requirement code review.
|
|
4
4
|
|
|
5
5
|
AI coding agents tend to skip design and jump straight into implementation, producing over-engineered or misaligned code. **pi-workflow-kit** solves this by hard-blocking write operations during brainstorm and planning phases — the agent *literally cannot modify your source files* until you approve the design.
|
|
6
6
|
|
|
@@ -20,6 +20,14 @@ No setup needed — skills and guards activate automatically after install.
|
|
|
20
20
|
pi -e npm:@tianhai/pi-workflow-kit
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
+
**Optional — parallel code review.** Per-requirement review can run four specialized reviewers in parallel via the `subagent` tool. Install [`pi-subagents`](https://pi.dev/packages/pi-subagents) to enable it:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pi install npm:pi-subagents
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The four reviewers (`pwk-spec-reviewer`, `pwk-tracing-reviewer`, `pwk-smell-reviewer`, `pwk-hazard-reviewer`) ship with this kit as **package agents** — `pi-subagents` discovers them automatically, no extra setup. Without `pi-subagents`, `pwk-executing-tasks` falls back to inline `/skill:pwk-code-review`.
|
|
30
|
+
|
|
23
31
|
## What You Get
|
|
24
32
|
|
|
25
33
|
### 🛡️ Workflow Guard (extension)
|
|
@@ -28,30 +36,35 @@ Enforces phase-appropriate tool access — not just guidelines, but hard blocks:
|
|
|
28
36
|
|
|
29
37
|
| Phase | `write` / `edit` | `bash` |
|
|
30
38
|
|-------|:-:|:-:|
|
|
31
|
-
| **Brainstorm** / **Plan**
|
|
32
|
-
| **Execute** / **Finalize** | ✅ Full access | ✅ Full access |
|
|
39
|
+
| **Brainstorm** / **Plan** | 🔒 Blocked outside `docs/plans/` | 🔒 Destructive commands blocked (simple blacklist) |
|
|
40
|
+
| **Execute** / **Code-review** / **Finalize** / **Diagnose** / **Status** | ✅ Full access | ✅ Full access |
|
|
41
|
+
|
|
42
|
+
The agent can read code and discuss design with you during brainstorm/plan, 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.
|
|
33
43
|
|
|
34
|
-
|
|
44
|
+
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.
|
|
35
45
|
|
|
36
46
|
### 🧠 7 Workflow Skills
|
|
37
47
|
|
|
38
48
|
Guide the agent through a disciplined development process:
|
|
39
49
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
50
|
+
```
|
|
51
|
+
brainstorm → writing-plans → executing-tasks → finalizing
|
|
52
|
+
(per requirement: tests → checkpoint → implement → checkpoint → code-review)
|
|
53
|
+
↕
|
|
54
|
+
diagnose (anytime) · status (anytime)
|
|
55
|
+
```
|
|
43
56
|
|
|
44
|
-
For multi-
|
|
57
|
+
A **design doc is one PR**; a **requirement is one testable slice within it**. For multi-design work (a large issue split into several design docs — each its own PR), run the pipeline once per design doc.
|
|
45
58
|
|
|
46
59
|
| Phase | Trigger | What Happens |
|
|
47
60
|
|-------|---------|--------------|
|
|
48
|
-
| **Brainstorm** | `/skill:pwk-brainstorming` | Explore approaches,
|
|
49
|
-
| **
|
|
50
|
-
| **
|
|
51
|
-
| **
|
|
52
|
-
| **
|
|
53
|
-
| **
|
|
54
|
-
| **
|
|
61
|
+
| **Brainstorm** | `/skill:pwk-brainstorming` | Explore approaches, produce a design doc with a `## Requirements` list |
|
|
62
|
+
| **Plan** | `/skill:pwk-writing-plans` | Turn each requirement into **acceptance criteria + integration tests** — a behavioral spec (no implementation code) |
|
|
63
|
+
| **Execute** | `/skill:pwk-executing-tasks` | Per requirement: write tests (red) → **checkpoint: tests** → implement (green) → **checkpoint: complete** → code-review |
|
|
64
|
+
| **Code review** | `/skill:pwk-code-review` | Per requirement: code tracing, spec alignment, code smells (applies fixes), production hazard check |
|
|
65
|
+
| **Finalize** | `/skill:pwk-finalizing` | Delete consumed plan docs, update README/CHANGELOG, create PR |
|
|
66
|
+
| **Diagnose** | `/skill:pwk-diagnose` | Debugging loop: reproduce → hypothesise → instrument → fix → cleanup. **Exits the gated phase** (debugging writes tests/instrumentation) |
|
|
67
|
+
| **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**. |
|
|
55
68
|
|
|
56
69
|
## The Workflow in Detail
|
|
57
70
|
|
|
@@ -59,63 +72,61 @@ For multi-feature designs, the plan→execute loop repeats per feature.
|
|
|
59
72
|
|
|
60
73
|
You control each phase — the agent never advances on its own. Invoke a skill to move forward:
|
|
61
74
|
|
|
62
|
-
|
|
63
|
-
/skill:pwk-
|
|
64
|
-
/skill:pwk-
|
|
65
|
-
/skill:pwk-executing-tasks → implement with
|
|
66
|
-
/skill:pwk-
|
|
75
|
+
```
|
|
76
|
+
/skill:pwk-brainstorming → discuss and design (lists Requirements)
|
|
77
|
+
/skill:pwk-writing-plans → turn each Requirement into acceptance criteria + integration tests
|
|
78
|
+
/skill:pwk-executing-tasks → implement per requirement with two mandatory checkpoints
|
|
79
|
+
/skill:pwk-code-review → auto-runs per-requirement inside executing-tasks; also invocable manually for ad-hoc reviews
|
|
67
80
|
/skill:pwk-finalizing → ship it
|
|
81
|
+
```
|
|
68
82
|
|
|
69
|
-
###
|
|
70
|
-
|
|
71
|
-
Design docs include a `## Features` table that tracks each feature's status:
|
|
72
|
-
|
|
73
|
-
| # | Feature | Status | Notes |
|
|
74
|
-
|---|---------|--------|-------|
|
|
75
|
-
| 1 | User signup | ✅ done | |
|
|
76
|
-
| 2 | Email verification | 🔄 planned | Plan: docs/plans/...-email-verification-implementation.md |
|
|
77
|
-
| 3 | Password reset | ⬜ pending | |
|
|
83
|
+
### Behavioral-Spec Planning
|
|
78
84
|
|
|
79
|
-
|
|
85
|
+
Plans specify *what*, not *how*. For each requirement, the plan gives **acceptance criteria + integration-test cases** — no implementation code, no file-by-file recipe. The executor has full autonomy to choose structure, signatures, and internals. A fine-grained implementation plan invalidates the moment a detail shifts; acceptance criteria + integration tests survive implementation changes.
|
|
80
86
|
|
|
81
|
-
###
|
|
87
|
+
### Test-First per Requirement
|
|
82
88
|
|
|
83
|
-
Each
|
|
89
|
+
Each requirement is implemented test-first:
|
|
84
90
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
91
|
+
1. Write the integration tests (red)
|
|
92
|
+
2. ⏸ **checkpoint: tests** — you review the test design
|
|
93
|
+
3. Implement to green (full autonomy)
|
|
94
|
+
4. ⏸ **checkpoint: complete** — you review the implementation
|
|
95
|
+
5. Commit → code review
|
|
90
96
|
|
|
91
97
|
### Lessons Learned
|
|
92
98
|
|
|
93
|
-
A persistent rules file (`docs/lessons.md`) helps the agent learn from repeat mistakes across sessions. When the agent catches itself making the same error
|
|
99
|
+
A persistent rules file (`docs/lessons.md`) helps the agent learn from repeat mistakes across sessions. When the agent catches itself making the same error, it writes a generic rule immediately. Future sessions (even after `/new`) pick it up automatically.
|
|
94
100
|
|
|
95
101
|
```
|
|
96
102
|
brainstorm → reads lessons (design context)
|
|
97
|
-
plan → reads lessons (
|
|
98
|
-
execute → reads lessons per
|
|
99
|
-
finalize → reviews and retires stale rules
|
|
103
|
+
plan → reads lessons (acceptance criteria / tests)
|
|
104
|
+
execute → reads lessons per requirement, writes new ones on repeat mistakes
|
|
105
|
+
finalize → reviews, generalizes, and retires stale rules
|
|
100
106
|
```
|
|
101
107
|
|
|
102
108
|
Rules are simple imperative bullets:
|
|
103
109
|
|
|
104
|
-
- After completing each
|
|
110
|
+
- After completing each requirement, run `make lint && make fmt` before committing
|
|
105
111
|
- Never import `testify` in this project
|
|
106
112
|
- Always check for existing test helpers before writing new ones
|
|
107
113
|
|
|
108
|
-
No configuration needed — the file
|
|
114
|
+
No configuration needed — the file ships with starter rules and grows as the agent learns.
|
|
109
115
|
|
|
110
|
-
###
|
|
116
|
+
### Two Mandatory Checkpoints per Requirement
|
|
111
117
|
|
|
112
|
-
|
|
118
|
+
Each requirement has **two hard human-review gates** (not optional):
|
|
113
119
|
|
|
114
|
-
| Checkpoint |
|
|
120
|
+
| Checkpoint | What's done | What you review |
|
|
115
121
|
|---|---|---|
|
|
116
|
-
|
|
|
117
|
-
|
|
|
118
|
-
|
|
122
|
+
| **tests** | Integration tests written, confirmed failing | Are the right behaviors being specified? |
|
|
123
|
+
| **complete** | Implemented, tests green, refactored | Is the implementation correct before committing? |
|
|
124
|
+
|
|
125
|
+
The agent stops and waits at each — approve, request changes, or send it back.
|
|
126
|
+
|
|
127
|
+
### Before You Ship: the Integration Gate
|
|
128
|
+
|
|
129
|
+
Per-requirement review checks each diff in isolation. Before finalizing, the agent runs an **integration gate**: the **full test suite** (not just the last requirement's) must pass, and it confirms the requirements compose into the feature the design described. Finalize re-runs the full suite too — it never ships a red suite, even across resumed sessions.
|
|
119
130
|
|
|
120
131
|
## Quick Start
|
|
121
132
|
|
|
@@ -127,29 +138,27 @@ pi install npm:@tianhai/pi-workflow-kit
|
|
|
127
138
|
> /skill:pwk-brainstorming
|
|
128
139
|
> I want to add OAuth2 login to our API
|
|
129
140
|
|
|
130
|
-
# (agent explores approaches, writes design doc with
|
|
141
|
+
# (agent explores approaches, writes a design doc with a Requirements list)
|
|
131
142
|
# (write/edit are blocked — your code is safe)
|
|
132
143
|
|
|
133
144
|
> /skill:pwk-writing-plans
|
|
134
145
|
|
|
135
|
-
# (agent
|
|
136
|
-
|
|
146
|
+
# (agent turns each Requirement into acceptance criteria + integration tests)
|
|
147
|
+
|
|
137
148
|
> /skill:pwk-executing-tasks
|
|
138
149
|
|
|
139
|
-
# (
|
|
140
|
-
> /skill:pwk-verify
|
|
150
|
+
# (per requirement: writes tests → checkpoint → implements → checkpoint → code-review)
|
|
141
151
|
|
|
142
|
-
# (agent runs security, optimization, and traceability reviews on implemented code)
|
|
143
152
|
> /skill:pwk-finalizing
|
|
144
153
|
|
|
145
|
-
# (agent
|
|
154
|
+
# (agent deletes consumed plan docs, curates lessons, creates PR)
|
|
146
155
|
```
|
|
147
156
|
|
|
148
157
|
## Why?
|
|
149
158
|
|
|
150
159
|
- **AI agents skip design.** Left unchecked, they jump to code and over-engineer. This forces a think-first workflow.
|
|
151
|
-
- **
|
|
152
|
-
- **You stay in control.**
|
|
160
|
+
- **Specs beat recipes.** Plans are behavioral specs (acceptance criteria + tests), not implementation recipes — they don't invalidate when details change.
|
|
161
|
+
- **You stay in control.** Two mandatory checkpoints per requirement let you approve test design and implementation before the agent commits.
|
|
153
162
|
- **Enforced, not suggested.** Hard blocks mean the agent can't ignore the rules — not even accidentally.
|
|
154
163
|
|
|
155
164
|
## Project
|
|
@@ -157,15 +166,23 @@ pi install npm:@tianhai/pi-workflow-kit
|
|
|
157
166
|
```
|
|
158
167
|
pi-workflow-kit/
|
|
159
168
|
├── extensions/
|
|
160
|
-
│ └── workflow-guard.ts # Write blocker during brainstorm/plan
|
|
169
|
+
│ └── workflow-guard.ts # Write blocker during brainstorm/plan; destructive-bash blacklist
|
|
161
170
|
├── skills/
|
|
162
171
|
│ ├── pwk-brainstorming/SKILL.md
|
|
163
|
-
│ ├── pwk-design-review/SKILL.md
|
|
164
172
|
│ ├── pwk-writing-plans/SKILL.md
|
|
165
173
|
│ ├── pwk-executing-tasks/SKILL.md
|
|
166
|
-
│ ├── pwk-
|
|
174
|
+
│ ├── pwk-code-review/SKILL.md
|
|
167
175
|
│ ├── pwk-finalizing/SKILL.md
|
|
176
|
+
│ ├── pwk-status/SKILL.md
|
|
168
177
|
│ └── pwk-diagnose/SKILL.md
|
|
178
|
+
├── agents/ # package agents for parallel code-review (discovered by pi-subagents)
|
|
179
|
+
├── docs/
|
|
180
|
+
│ ├── developer-usage-guide.md
|
|
181
|
+
│ ├── workflow-phases.md
|
|
182
|
+
│ ├── oversight-model.md
|
|
183
|
+
│ ├── lessons.md
|
|
184
|
+
│ ├── adr/ # permanent architectural decisions (never archived)
|
|
185
|
+
│ └── plans/ # active design/plan/progress docs (deleted after finalization)
|
|
169
186
|
├── tests/
|
|
170
187
|
│ └── workflow-guard.test.ts
|
|
171
188
|
├── package.json
|
|
@@ -180,4 +197,4 @@ npm test
|
|
|
180
197
|
|
|
181
198
|
## License
|
|
182
199
|
|
|
183
|
-
[MIT](LICENSE)
|
|
200
|
+
[MIT](LICENSE)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pwk-hazard-reviewer
|
|
3
|
+
description: Production-hazard reviewer — audits for unbounded ops, missing indexes, unbounded concurrency, long transactions, injection, silent swallowing loops. Read-only reporter.
|
|
4
|
+
tools: read, grep, find, ls, bash
|
|
5
|
+
systemPromptMode: replace
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# PWK Hazard Reviewer
|
|
9
|
+
|
|
10
|
+
You are a production-hazards reviewer. Execute the task instructions below faithfully using read-only tools (`read`, `grep`, `find`, `bash`). **Report findings only — do NOT modify files.** Flag hazards and non-trivial issues for the main agent / human to decide.
|
|
11
|
+
|
|
12
|
+
## Checklist — audit each changed file
|
|
13
|
+
|
|
14
|
+
For each item below, write `[SAFE]` (1-line justification) or `[TRIGGERED]` (concrete mitigation):
|
|
15
|
+
|
|
16
|
+
1. **Unbounded operations** — multi-key deletions/scans (`KEYS`, raw `SCAN` loops), full-table loads filtered in memory
|
|
17
|
+
2. **Missing indexes** — hot queries on unindexed columns (table scans under load)
|
|
18
|
+
3. **Unbounded concurrency** — unthrottled fan-out (`Promise.all` without batch limits)
|
|
19
|
+
4. **Long-running transactions** — holding DB connections/locks across slow external calls
|
|
20
|
+
5. **Query/command interpolation** — raw variables merged into SQL or shell (injection)
|
|
21
|
+
6. **Unrestricted uploads / temp flooding** — uploads to local temp without limits or `finally` cleanup
|
|
22
|
+
7. **Silent swallowing loops** — background workers catching/suppressing exceptions without logging/back-off
|
|
23
|
+
|
|
24
|
+
Also check the design doc's `## Production-risk areas`, if any.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pwk-smell-reviewer
|
|
3
|
+
description: Code-smell reviewer — flags shallow modules, duplication, missing seams, premature abstraction, poor naming, magic values, dead code. Read-only reporter.
|
|
4
|
+
tools: read, grep, find, ls, bash
|
|
5
|
+
systemPromptMode: replace
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# PWK Smell Reviewer
|
|
9
|
+
|
|
10
|
+
You are a code-smell reviewer. Execute the task instructions below faithfully using read-only tools (`read`, `grep`, `find`, `bash`). **Report findings only — do NOT modify files.** Flag only: smells that require large refactors risky to the requirement; everything else is for the main agent to fix.
|
|
11
|
+
|
|
12
|
+
## Checklist — report what you find
|
|
13
|
+
|
|
14
|
+
- Shallow modules (interface nearly as complex as implementation)
|
|
15
|
+
- Duplication
|
|
16
|
+
- Missing seams / premature abstraction
|
|
17
|
+
- Poor naming, magic values, dead code
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pwk-spec-reviewer
|
|
3
|
+
description: Spec-alignment reviewer — checks each acceptance criterion has covering code and tests; flags gaps and scope creep. Read-only reporter.
|
|
4
|
+
tools: read, grep, find, ls, bash
|
|
5
|
+
systemPromptMode: replace
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# PWK Spec Reviewer
|
|
9
|
+
|
|
10
|
+
You are a spec-alignment reviewer. Execute the task instructions below faithfully using read-only tools (`read`, `grep`, `find`, `bash`). **Report findings only — do NOT modify files.**
|
|
11
|
+
|
|
12
|
+
## Checklist
|
|
13
|
+
|
|
14
|
+
For each acceptance criterion, point to the code and the test that satisfy it. A criterion with no covering code or no test is a **gap**. Code that does more than the criteria specify is **scope creep** — flag it.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pwk-tracing-reviewer
|
|
3
|
+
description: Code-tracing reviewer — traces new/changed paths end-to-end against tests; flags untested branches, dead branches, and broken traces. Read-only reporter.
|
|
4
|
+
tools: read, grep, find, ls, bash
|
|
5
|
+
systemPromptMode: replace
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# PWK Trace Reviewer
|
|
9
|
+
|
|
10
|
+
You are a code-tracing reviewer. Execute the task instructions below faithfully using read-only tools (`read`, `grep`, `find`, `bash`). **Report findings only — do NOT modify files.**
|
|
11
|
+
|
|
12
|
+
## Checklist
|
|
13
|
+
|
|
14
|
+
Trace the new/changed code paths end-to-end against the integration tests. For each path: does data flow correctly from entry to the asserted outcome? Note any branch the tests don't exercise, any dead branch, any path where the trace breaks.
|
|
@@ -4,9 +4,9 @@ How to install and use `pi-workflow-kit` with the Pi coding agent.
|
|
|
4
4
|
|
|
5
5
|
## What you get
|
|
6
6
|
|
|
7
|
-
- **
|
|
8
|
-
- **
|
|
9
|
-
- **1 extension**
|
|
7
|
+
- **5 pipeline skills** — brainstorm → writing-plans → executing-tasks → finalizing, with code-review running per requirement during execution.
|
|
8
|
+
- **2 utility skills** — diagnose (debugging) and status (multi-topic overview), both on demand.
|
|
9
|
+
- **1 extension** — hard-blocks source writes during brainstorm and writing-plans, and blocks destructive bash via a simple common-blacklist.
|
|
10
10
|
|
|
11
11
|
## Installation
|
|
12
12
|
|
|
@@ -32,10 +32,10 @@ Or in `.pi/settings.json` / `~/.pi/agent/config.json`:
|
|
|
32
32
|
|
|
33
33
|
## The workflow
|
|
34
34
|
|
|
35
|
-
You control each phase by invoking the skill. For multi-
|
|
35
|
+
You control each phase by invoking the skill. A design doc is one PR; a requirement is one testable slice within it. For multi-design work (a large issue split), run the pipeline once per design doc:
|
|
36
36
|
|
|
37
37
|
```
|
|
38
|
-
/skill:pwk-brainstorming → /skill:pwk-writing-plans → /skill:pwk-executing-tasks →
|
|
38
|
+
/skill:pwk-brainstorming → /skill:pwk-writing-plans → /skill:pwk-executing-tasks → /skill:pwk-finalizing
|
|
39
39
|
```
|
|
40
40
|
|
|
41
41
|
### 1. Brainstorm
|
|
@@ -44,11 +44,9 @@ You control each phase by invoking the skill. For multi-feature designs, the pla
|
|
|
44
44
|
/skill:pwk-brainstorming
|
|
45
45
|
```
|
|
46
46
|
|
|
47
|
-
Explore the idea through collaborative dialogue. The agent reads code, asks questions
|
|
47
|
+
Explore the idea through collaborative dialogue. The agent reads code, asks questions, proposes approaches, and presents the design for your review.
|
|
48
48
|
|
|
49
|
-
Outcome: `docs/plans/YYYY-MM-DD-<topic>-design.md` with a `##
|
|
50
|
-
|
|
51
|
-
Optionally writes ADRs to `docs/plans/adr/` for significant architectural decisions.
|
|
49
|
+
Outcome: `docs/plans/YYYY-MM-DD-<topic>-design.md` — descriptive, opening with a `## Requirements` list. May split a large issue into multiple design docs. ADRs go to `docs/adr/` (permanent).
|
|
52
50
|
|
|
53
51
|
### 2. Plan
|
|
54
52
|
|
|
@@ -56,9 +54,9 @@ Optionally writes ADRs to `docs/plans/adr/` for significant architectural decisi
|
|
|
56
54
|
/skill:pwk-writing-plans
|
|
57
55
|
```
|
|
58
56
|
|
|
59
|
-
Read the design doc's
|
|
57
|
+
Read the design doc's Requirements and turn each into **acceptance criteria + integration-test cases** — a behavioral spec (no implementation code).
|
|
60
58
|
|
|
61
|
-
Outcome: `docs/plans/YYYY-MM-DD-<topic
|
|
59
|
+
Outcome: `docs/plans/YYYY-MM-DD-<topic>-implementation.md`.
|
|
62
60
|
|
|
63
61
|
### 3. Execute
|
|
64
62
|
|
|
@@ -66,65 +64,62 @@ Outcome: `docs/plans/YYYY-MM-DD-<topic>-<feature-name>-implementation.md`
|
|
|
66
64
|
/skill:pwk-executing-tasks
|
|
67
65
|
```
|
|
68
66
|
|
|
69
|
-
Implement
|
|
67
|
+
Implement requirement-by-requirement with **full autonomy**: write the integration tests (red) → **checkpoint: tests** → implement to green → **checkpoint: complete** → commit → code-review. Two mandatory human checkpoints per requirement. After all requirements, an **integration gate** runs the full suite and confirms the requirements compose into the feature before finalize.
|
|
70
68
|
|
|
71
|
-
### 4.
|
|
69
|
+
### 4. Code review (per requirement)
|
|
72
70
|
|
|
73
|
-
|
|
74
|
-
/skill:pwk-finalizing
|
|
75
|
-
```
|
|
71
|
+
The `pwk-executing-tasks` skill invokes the `subagent` tool automatically (programmatic, not user-driven). Four specialized reviewers launch in parallel — each reviewing from a different dimension (spec gaps & scope creep, end-to-end code tracing, code smells, production hazards). The reviewers ship as **package agents** (`agents/pwk-*.md`, declared via the `pi-subagents.agents` manifest key) and are discovered natively by the optional **`pi-subagents`** package — no copy step. All report findings only; no agent edits files or produces commits. The main agent collects results, applies smell fixes itself, runs integration tests after each fix, then updates progress to `✅ done`.
|
|
76
72
|
|
|
77
|
-
|
|
73
|
+
*Fallback:* if `pi-subagents` is not installed (so the `subagent` tool is unavailable), the skill falls back to inline `/skill:pwk-code-review` as before. Install it to enable parallel review:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
pi install npm:pi-subagents
|
|
77
|
+
```
|
|
78
78
|
|
|
79
|
-
### 5.
|
|
79
|
+
### 5. Finalize
|
|
80
80
|
|
|
81
81
|
```
|
|
82
|
-
/skill:pwk-
|
|
82
|
+
/skill:pwk-finalizing
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
**Pre-check: run the full test suite** — never ship a red suite (resume spans sessions). Then delete consumed plan docs (code + tests are the source of truth), curate lessons, update CHANGELOG/README, create PR or merge.
|
|
86
86
|
|
|
87
|
-
###
|
|
87
|
+
### Diagnose (on demand)
|
|
88
88
|
|
|
89
89
|
```
|
|
90
|
-
/skill:pwk-
|
|
90
|
+
/skill:pwk-diagnose
|
|
91
91
|
```
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
A debugging loop you invoke when something is broken. Not a pipeline phase. **Invoking it exits the gated brainstorm/plan 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`.
|
|
94
94
|
|
|
95
|
-
###
|
|
95
|
+
### Status (on demand)
|
|
96
96
|
|
|
97
97
|
```
|
|
98
|
-
/skill:pwk-
|
|
98
|
+
/skill:pwk-status
|
|
99
99
|
```
|
|
100
100
|
|
|
101
|
-
A
|
|
101
|
+
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 brainstorm/plan write boundary stays up.
|
|
102
102
|
|
|
103
103
|
## What the extension does
|
|
104
104
|
|
|
105
|
-
The `workflow-guard` extension watches `write` and `
|
|
105
|
+
The `workflow-guard` extension watches `write`/`edit` and `bash` tool calls:
|
|
106
106
|
|
|
107
|
-
- **During brainstorm and
|
|
108
|
-
- **During
|
|
109
|
-
- **
|
|
107
|
+
- **During brainstorm and writing-plans**: 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.
|
|
108
|
+
- **During executing-tasks, code-review, finalizing, diagnose**: no restrictions.
|
|
109
|
+
- **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.
|
|
110
110
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
## TDD guidance
|
|
111
|
+
The destructive blacklist covers common file-mutating vectors (redirects, `tee`, `cp`/`mv`/`touch`/`rm`, `git commit`/`apply`, `npm install`, in-place editors like `sed -i`/`perl -i`, `patch`, `find -delete`). Exotic vectors (interpreter escapes like `node -e`, `python -c`, `| bash`) rely on the phase reminder — the guard is advisory, not a security boundary.
|
|
114
112
|
|
|
115
|
-
|
|
113
|
+
No configuration needed. It activates automatically after install.
|
|
116
114
|
|
|
117
|
-
|
|
118
|
-
|----------|------|------|
|
|
119
|
-
| New feature | Adding new behavior | Write failing test → implement → pass |
|
|
120
|
-
| Modifying tested code | Changing existing behavior | Run existing tests first → modify → verify |
|
|
121
|
-
| Trivial | Config, docs, naming | Use judgment |
|
|
115
|
+
## Test-first discipline
|
|
122
116
|
|
|
123
|
-
|
|
117
|
+
Plans specify *what* (acceptance criteria + integration tests); the executor writes the tests first (red), then implements to green. This keeps the spec stable — implementation details can change without invalidating the plan.
|
|
124
118
|
|
|
125
119
|
## Tips
|
|
126
120
|
|
|
127
|
-
- Start with brainstorming for anything non-trivial
|
|
128
|
-
-
|
|
129
|
-
-
|
|
130
|
-
-
|
|
121
|
+
- Start with brainstorming for anything non-trivial.
|
|
122
|
+
- The plan is a behavioral spec, not an implementation recipe — let the executor choose how.
|
|
123
|
+
- Each requirement has two mandatory checkpoints by default: use them to steer test design and implementation.
|
|
124
|
+
- **Right-size each requirement at plan time** with the `### Checkpoints` (`full`/`spec`/`none`) and `### Review` (`parallel`/`inline`/`skip`) tags — defaults are conservative (`full` + `parallel`), so behavior is unchanged unless you opt in. `spec` keeps the cheap spec-correctness gate and drops the complete checkpoint (covered by review), so it's the lowest-iteration option that doesn't sacrifice quality — but it requires at least `inline` review. A trivial fix can also use the brainstorming trivial fast-path (one-turn brainstorm, minimal design doc).
|
|
125
|
+
- Put all plan artifacts under `docs/plans/`; ADRs under `docs/adr/`.
|
package/docs/lessons.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Lessons Learned
|
|
2
2
|
|
|
3
3
|
<!--
|
|
4
|
-
Agent: read this
|
|
4
|
+
Agent: read this during brainstorm (design), writing-plans (acceptance criteria + tests), executing-tasks (per requirement), and finalizing (curation).
|
|
5
5
|
Follow every rule. Add new rules when you catch yourself making repeat mistakes.
|
|
6
6
|
Rules must be generic patterns applicable to any domain or feature — not specific to one service, entity, or use case.
|
|
7
7
|
Retire rules that no longer apply during finalizing.
|
|
@@ -9,10 +9,5 @@ Retire rules that no longer apply during finalizing.
|
|
|
9
9
|
|
|
10
10
|
## Cross-Skill Consistency
|
|
11
11
|
|
|
12
|
-
- When adding instructions that reference artifacts from another skill (e.g., "extract metadata from plan doc"), always add a guard for when that artifact doesn't exist — not all workflows use all artifacts
|
|
13
|
-
- When reordering instructions within a step, verify all conditional branches still reference the correct context (e.g., hazard checks that say "this feature" must run after feature identification)
|
|
14
12
|
|
|
15
|
-
## Documentation
|
|
16
|
-
|
|
17
|
-
- When adding a new phase to an extension, update ALL comments and error messages — stale comments in one place create confusion about the actual behavior
|
|
18
|
-
- When renaming skills with a prefix, check for `/skill:` references in prose and code blocks separately — backtick-enclosed references in code examples may use a different pattern than prose references
|
|
13
|
+
## Documentation
|
package/docs/oversight-model.md
CHANGED
|
@@ -4,31 +4,37 @@
|
|
|
4
4
|
|
|
5
5
|
## Skills
|
|
6
6
|
|
|
7
|
-
Skills teach the agent the workflow. There are
|
|
7
|
+
Skills teach the agent the workflow. There are 5 pipeline skills:
|
|
8
8
|
|
|
9
|
-
- **pwk-brainstorming** — explore ideas, produce a design doc with a
|
|
10
|
-
- **pwk-writing-plans** —
|
|
11
|
-
- **pwk-executing-tasks** — implement
|
|
12
|
-
- **pwk-
|
|
9
|
+
- **pwk-brainstorming** — explore ideas, produce a descriptive design doc that opens with a `## Requirements` list
|
|
10
|
+
- **pwk-writing-plans** — turn each requirement into acceptance criteria + integration-test cases (a behavioral spec, no implementation code)
|
|
11
|
+
- **pwk-executing-tasks** — implement requirement-by-requirement, test-first, with two mandatory human checkpoints per requirement
|
|
12
|
+
- **pwk-code-review** — the inline reviewer (code tracing, spec alignment, code smells, production hazards). During `pwk-executing-tasks`, per-requirement review instead runs **four specialized reviewers in parallel** via the `subagent` tool, each from a fresh context (spec gaps & scope creep, tracing, smells, hazards). These ship as package agents (`agents/pwk-*.md`) discovered natively by the optional **`pi-subagents`** package; all report findings only — fixes are applied by the executing-tasks main agent. Falls back to inline `/skill:pwk-code-review` when `pi-subagents` is not installed.
|
|
13
|
+
- **pwk-finalizing** — delete consumed plan docs, curate lessons, update docs, create PR or merge
|
|
13
14
|
|
|
14
|
-
Plus
|
|
15
|
+
Plus 2 on-demand skills:
|
|
15
16
|
|
|
16
|
-
- **pwk-
|
|
17
|
-
- **pwk-
|
|
18
|
-
- **pwk-diagnose** — 6-phase debugging loop
|
|
17
|
+
- **pwk-status** — read-only overview of all active design topics (phase + progress), for resuming or juggling parallel designs
|
|
18
|
+
- **pwk-diagnose** — 6-phase debugging loop, invoked anytime something is broken
|
|
19
19
|
|
|
20
|
-
They explain *what* to do and *when* to do it.
|
|
20
|
+
They explain *what* to do and *when* to do it. Phase control is manual — you invoke each skill with `/skill:`; the agent never advances on its own.
|
|
21
21
|
|
|
22
22
|
## Extension
|
|
23
23
|
|
|
24
24
|
The `workflow-guard` extension enforces one rule:
|
|
25
25
|
|
|
26
|
-
> During brainstorm
|
|
26
|
+
> During brainstorm and plan phases, `write` and `edit` are **hard-blocked** outside `docs/plans/`.
|
|
27
27
|
|
|
28
|
-
The agent can still use `read` and `bash` for investigation.
|
|
28
|
+
The agent can still use `read` and `bash` for investigation. During those gated phases, `bash` is governed by a simple destructive-command blacklist (`rm`, `>`, `git commit`, `npm install`, in-place editors, etc.) — 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.
|
|
29
|
+
|
|
30
|
+
During executing-tasks, code-review, finalizing, **and diagnose**, nothing is restricted (diagnosis needs to write failing tests and debug instrumentation, so it exits the gate). `pwk-status` stays inside the gate.
|
|
31
|
+
|
|
32
|
+
Reviewer-agent checklists live only in `agents/pwk-*-reviewer.md` (single source of truth); `pwk-executing-tasks` passes each reviewer just the requirement scope + diff and names the agent.
|
|
33
|
+
|
|
34
|
+
Phases follow the skill you invoke — there is no message-keyword unlock. Invoking `/skill:pwk-executing-tasks`, `pwk-finalizing`, `pwk-code-review`, or `pwk-diagnose` exits the gated phase (those skills write source); `pwk-status` deliberately does **not** (read-only orientation). `/pwk-guard on|off|auto` manually overrides the guard.
|
|
29
35
|
|
|
30
36
|
## Enforcement style
|
|
31
37
|
|
|
32
|
-
Hard block for write boundaries. No warnings, no escalation, no prompts. Either the tool call is allowed or it's blocked.
|
|
38
|
+
Hard block for write boundaries during gated phases. No warnings, no escalation, no prompts. Either the tool call is allowed or it's blocked. The unlock list is hard-coded in the extension and verified by `tests/skill-lint.mjs` against the skills' claims, so a skill that promises "read-only" can't silently unlock.
|
|
33
39
|
|
|
34
|
-
TDD, debugging, and code review are guidance in the skill instructions, not runtime-enforced.
|
|
40
|
+
TDD, checkpoints, debugging, and code review are guidance in the skill instructions, not runtime-enforced. The bash blacklist covers common destructive vectors only; exotic escapes (interpreter one-liners, piped shells) rely on the phase reminder — the guard is advisory, not a security boundary.
|