@tianhai/pi-workflow-kit 0.17.1 → 1.0.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 +91 -64
- 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 +49 -37
- package/docs/lessons.md +13 -0
- package/docs/oversight-model.md +19 -9
- package/docs/workflow-phases.md +58 -29
- package/extensions/workflow-guard.ts +190 -91
- package/package.json +19 -3
- package/skills/pwk-brainstorming/SKILL.md +60 -0
- package/skills/pwk-code-review/SKILL.md +46 -0
- package/skills/{diagnose → pwk-diagnose}/SKILL.md +3 -2
- package/skills/pwk-executing-tasks/SKILL.md +154 -0
- package/skills/pwk-finalizing/SKILL.md +78 -0
- package/skills/pwk-status/SKILL.md +28 -0
- package/skills/pwk-writing-plans/SKILL.md +83 -0
- 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/skills/brainstorming/SKILL.md +0 -48
- package/skills/design-review/SKILL.md +0 -113
- package/skills/executing-tasks/SKILL.md +0 -350
- package/skills/finalizing/SKILL.md +0 -119
- package/skills/verify/SKILL.md +0 -170
- package/skills/writing-plans/SKILL.md +0 -343
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,28 +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** | 🔒 Blocked outside `docs/plans/` | 🔒
|
|
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 |
|
|
33
41
|
|
|
34
|
-
The agent can read code and discuss design with you during brainstorm/plan, but it physically cannot modify source files
|
|
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.
|
|
43
|
+
|
|
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. 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
|
+
```
|
|
56
|
+
|
|
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.
|
|
43
58
|
|
|
44
59
|
| Phase | Trigger | What Happens |
|
|
45
60
|
|-------|---------|--------------|
|
|
46
|
-
| **Brainstorm** | `/skill:brainstorming` | Explore approaches,
|
|
47
|
-
| **
|
|
48
|
-
| **
|
|
49
|
-
| **
|
|
50
|
-
| **
|
|
51
|
-
| **
|
|
52
|
-
| **
|
|
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 |
|
|
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. |
|
|
53
68
|
|
|
54
69
|
## The Workflow in Detail
|
|
55
70
|
|
|
@@ -57,51 +72,61 @@ brainstorm → design-review → plan → execute → verify → finalize
|
|
|
57
72
|
|
|
58
73
|
You control each phase — the agent never advances on its own. Invoke a skill to move forward:
|
|
59
74
|
|
|
60
|
-
|
|
61
|
-
/skill:
|
|
62
|
-
/skill:writing-plans →
|
|
63
|
-
/skill:executing-tasks → implement with
|
|
64
|
-
/skill:
|
|
65
|
-
/skill:finalizing
|
|
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
|
|
80
|
+
/skill:pwk-finalizing → ship it
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Behavioral-Spec Planning
|
|
84
|
+
|
|
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.
|
|
66
86
|
|
|
67
|
-
###
|
|
87
|
+
### Test-First per Requirement
|
|
68
88
|
|
|
69
|
-
Each
|
|
89
|
+
Each requirement is implemented test-first:
|
|
70
90
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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
|
|
76
96
|
|
|
77
97
|
### Lessons Learned
|
|
78
98
|
|
|
79
|
-
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.
|
|
80
100
|
|
|
81
101
|
```
|
|
82
102
|
brainstorm → reads lessons (design context)
|
|
83
|
-
plan → reads lessons (
|
|
84
|
-
execute → reads lessons per
|
|
85
|
-
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
|
|
86
106
|
```
|
|
87
107
|
|
|
88
108
|
Rules are simple imperative bullets:
|
|
89
109
|
|
|
90
|
-
- After completing each
|
|
110
|
+
- After completing each requirement, run `make lint && make fmt` before committing
|
|
91
111
|
- Never import `testify` in this project
|
|
92
112
|
- Always check for existing test helpers before writing new ones
|
|
93
113
|
|
|
94
|
-
No configuration needed — the file
|
|
114
|
+
No configuration needed — the file ships with starter rules and grows as the agent learns.
|
|
95
115
|
|
|
96
|
-
###
|
|
116
|
+
### Two Mandatory Checkpoints per Requirement
|
|
97
117
|
|
|
98
|
-
|
|
118
|
+
Each requirement has **two hard human-review gates** (not optional):
|
|
99
119
|
|
|
100
|
-
| Checkpoint |
|
|
120
|
+
| Checkpoint | What's done | What you review |
|
|
101
121
|
|---|---|---|
|
|
102
|
-
|
|
|
103
|
-
|
|
|
104
|
-
|
|
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.
|
|
105
130
|
|
|
106
131
|
## Quick Start
|
|
107
132
|
|
|
@@ -110,36 +135,30 @@ Optionally label tasks with a `checkpoint` to pause for human review. At each ch
|
|
|
110
135
|
pi install npm:@tianhai/pi-workflow-kit
|
|
111
136
|
|
|
112
137
|
# Start a new feature
|
|
113
|
-
> /skill:brainstorming
|
|
138
|
+
> /skill:pwk-brainstorming
|
|
114
139
|
> I want to add OAuth2 login to our API
|
|
115
140
|
|
|
116
|
-
# (agent explores approaches, writes design doc)
|
|
141
|
+
# (agent explores approaches, writes a design doc with a Requirements list)
|
|
117
142
|
# (write/edit are blocked — your code is safe)
|
|
118
143
|
|
|
119
|
-
> /skill:
|
|
120
|
-
|
|
121
|
-
# (agent audits for security, scalability, fault tolerance)
|
|
122
|
-
# (trivial changes can skip this step)
|
|
144
|
+
> /skill:pwk-writing-plans
|
|
123
145
|
|
|
124
|
-
|
|
146
|
+
# (agent turns each Requirement into acceptance criteria + integration tests)
|
|
125
147
|
|
|
126
|
-
|
|
127
|
-
> /skill:executing-tasks
|
|
148
|
+
> /skill:pwk-executing-tasks
|
|
128
149
|
|
|
129
|
-
# (
|
|
130
|
-
> /skill:verify
|
|
150
|
+
# (per requirement: writes tests → checkpoint → implements → checkpoint → code-review)
|
|
131
151
|
|
|
132
|
-
|
|
133
|
-
> /skill:finalizing
|
|
152
|
+
> /skill:pwk-finalizing
|
|
134
153
|
|
|
135
|
-
# (agent
|
|
154
|
+
# (agent deletes consumed plan docs, curates lessons, creates PR)
|
|
136
155
|
```
|
|
137
156
|
|
|
138
157
|
## Why?
|
|
139
158
|
|
|
140
159
|
- **AI agents skip design.** Left unchecked, they jump to code and over-engineer. This forces a think-first workflow.
|
|
141
|
-
- **
|
|
142
|
-
- **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.
|
|
143
162
|
- **Enforced, not suggested.** Hard blocks mean the agent can't ignore the rules — not even accidentally.
|
|
144
163
|
|
|
145
164
|
## Project
|
|
@@ -147,15 +166,23 @@ pi install npm:@tianhai/pi-workflow-kit
|
|
|
147
166
|
```
|
|
148
167
|
pi-workflow-kit/
|
|
149
168
|
├── extensions/
|
|
150
|
-
│ └── workflow-guard.ts # Write blocker during brainstorm/plan
|
|
169
|
+
│ └── workflow-guard.ts # Write blocker during brainstorm/plan; destructive-bash blacklist
|
|
151
170
|
├── skills/
|
|
152
|
-
│ ├── brainstorming/SKILL.md
|
|
153
|
-
│ ├──
|
|
154
|
-
│ ├──
|
|
155
|
-
│ ├──
|
|
156
|
-
│ ├──
|
|
157
|
-
│ ├──
|
|
158
|
-
│ └── diagnose/SKILL.md
|
|
171
|
+
│ ├── pwk-brainstorming/SKILL.md
|
|
172
|
+
│ ├── pwk-writing-plans/SKILL.md
|
|
173
|
+
│ ├── pwk-executing-tasks/SKILL.md
|
|
174
|
+
│ ├── pwk-code-review/SKILL.md
|
|
175
|
+
│ ├── pwk-finalizing/SKILL.md
|
|
176
|
+
│ ├── pwk-status/SKILL.md
|
|
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)
|
|
159
186
|
├── tests/
|
|
160
187
|
│ └── workflow-guard.test.ts
|
|
161
188
|
├── package.json
|
|
@@ -170,4 +197,4 @@ npm test
|
|
|
170
197
|
|
|
171
198
|
## License
|
|
172
199
|
|
|
173
|
-
[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,8 +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
|
-
- **
|
|
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.
|
|
9
10
|
|
|
10
11
|
## Installation
|
|
11
12
|
|
|
@@ -31,82 +32,93 @@ Or in `.pi/settings.json` / `~/.pi/agent/config.json`:
|
|
|
31
32
|
|
|
32
33
|
## The workflow
|
|
33
34
|
|
|
34
|
-
You control each phase by invoking the skill:
|
|
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:
|
|
35
36
|
|
|
36
37
|
```
|
|
37
|
-
/skill:brainstorming → /skill:writing-plans → /skill:executing-tasks → /skill:finalizing
|
|
38
|
+
/skill:pwk-brainstorming → /skill:pwk-writing-plans → /skill:pwk-executing-tasks → /skill:pwk-finalizing
|
|
38
39
|
```
|
|
39
40
|
|
|
40
41
|
### 1. Brainstorm
|
|
41
42
|
|
|
42
43
|
```
|
|
43
|
-
/skill:brainstorming
|
|
44
|
+
/skill:pwk-brainstorming
|
|
44
45
|
```
|
|
45
46
|
|
|
46
|
-
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.
|
|
47
48
|
|
|
48
|
-
Outcome: `docs/plans/YYYY-MM-DD-<topic>-design.md`
|
|
49
|
-
|
|
50
|
-
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).
|
|
51
50
|
|
|
52
51
|
### 2. Plan
|
|
53
52
|
|
|
54
53
|
```
|
|
55
|
-
/skill:writing-plans
|
|
54
|
+
/skill:pwk-writing-plans
|
|
56
55
|
```
|
|
57
56
|
|
|
58
|
-
Read the design doc and
|
|
57
|
+
Read the design doc's Requirements and turn each into **acceptance criteria + integration-test cases** — a behavioral spec (no implementation code).
|
|
59
58
|
|
|
60
|
-
Outcome: `docs/plans/YYYY-MM-DD-<topic>-implementation.md
|
|
59
|
+
Outcome: `docs/plans/YYYY-MM-DD-<topic>-implementation.md`.
|
|
61
60
|
|
|
62
61
|
### 3. Execute
|
|
63
62
|
|
|
64
63
|
```
|
|
65
|
-
/skill:executing-tasks
|
|
64
|
+
/skill:pwk-executing-tasks
|
|
66
65
|
```
|
|
67
66
|
|
|
68
|
-
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.
|
|
68
|
+
|
|
69
|
+
### 4. Code review (per requirement)
|
|
70
|
+
|
|
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`.
|
|
72
|
+
|
|
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:
|
|
69
74
|
|
|
70
|
-
|
|
75
|
+
```bash
|
|
76
|
+
pi install npm:pi-subagents
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### 5. Finalize
|
|
71
80
|
|
|
72
81
|
```
|
|
73
|
-
/skill:finalizing
|
|
82
|
+
/skill:pwk-finalizing
|
|
74
83
|
```
|
|
75
84
|
|
|
76
|
-
|
|
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.
|
|
77
86
|
|
|
78
|
-
###
|
|
87
|
+
### Diagnose (on demand)
|
|
79
88
|
|
|
80
89
|
```
|
|
81
|
-
/skill:diagnose
|
|
90
|
+
/skill:pwk-diagnose
|
|
82
91
|
```
|
|
83
92
|
|
|
84
|
-
A
|
|
93
|
+
A debugging loop you invoke when something is broken. Not a pipeline phase.
|
|
85
94
|
|
|
86
|
-
|
|
95
|
+
### Status (on demand)
|
|
87
96
|
|
|
88
|
-
|
|
97
|
+
```
|
|
98
|
+
/skill:pwk-status
|
|
99
|
+
```
|
|
89
100
|
|
|
90
|
-
-
|
|
91
|
-
- **During execute and finalize**: no restrictions. All tools available.
|
|
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.
|
|
92
102
|
|
|
93
|
-
|
|
103
|
+
## What the extension does
|
|
94
104
|
|
|
95
|
-
|
|
105
|
+
The `workflow-guard` extension watches `write`/`edit` and `bash` tool calls:
|
|
96
106
|
|
|
97
|
-
|
|
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**: no restrictions.
|
|
109
|
+
- **Phases are skill-driven**: the guard follows the skill you invoke — it never unlocks on message keywords. To override, run `/pwk-guard on` (force read-only), `off` (disable), or `auto` (default; skill-driven). Subcommands autocomplete.
|
|
110
|
+
|
|
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.
|
|
112
|
+
|
|
113
|
+
No configuration needed. It activates automatically after install.
|
|
98
114
|
|
|
99
|
-
|
|
100
|
-
|----------|------|------|
|
|
101
|
-
| New feature | Adding new behavior | Write failing test → implement → pass |
|
|
102
|
-
| Modifying tested code | Changing existing behavior | Run existing tests first → modify → verify |
|
|
103
|
-
| Trivial | Config, docs, naming | Use judgment |
|
|
115
|
+
## Test-first discipline
|
|
104
116
|
|
|
105
|
-
|
|
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.
|
|
106
118
|
|
|
107
119
|
## Tips
|
|
108
120
|
|
|
109
|
-
- Start with brainstorming for anything non-trivial
|
|
110
|
-
-
|
|
111
|
-
-
|
|
112
|
-
-
|
|
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: use them to steer test design and implementation.
|
|
124
|
+
- Put all plan artifacts under `docs/plans/`; ADRs under `docs/adr/`.
|
package/docs/lessons.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Lessons Learned
|
|
2
|
+
|
|
3
|
+
<!--
|
|
4
|
+
Agent: read this during brainstorm (design), writing-plans (acceptance criteria + tests), executing-tasks (per requirement), and finalizing (curation).
|
|
5
|
+
Follow every rule. Add new rules when you catch yourself making repeat mistakes.
|
|
6
|
+
Rules must be generic patterns applicable to any domain or feature — not specific to one service, entity, or use case.
|
|
7
|
+
Retire rules that no longer apply during finalizing.
|
|
8
|
+
-->
|
|
9
|
+
|
|
10
|
+
## Cross-Skill Consistency
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## Documentation
|
package/docs/oversight-model.md
CHANGED
|
@@ -4,14 +4,20 @@
|
|
|
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
|
-
- **brainstorming** — explore ideas, produce a design doc
|
|
10
|
-
- **writing-plans** —
|
|
11
|
-
- **executing-tasks** — implement
|
|
12
|
-
- **
|
|
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
|
-
|
|
15
|
+
Plus 2 on-demand skills:
|
|
16
|
+
|
|
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
|
+
|
|
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.
|
|
15
21
|
|
|
16
22
|
## Extension
|
|
17
23
|
|
|
@@ -19,10 +25,14 @@ The `workflow-guard` extension enforces one rule:
|
|
|
19
25
|
|
|
20
26
|
> During brainstorm and plan phases, `write` and `edit` are **hard-blocked** outside `docs/plans/`.
|
|
21
27
|
|
|
22
|
-
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, and finalizing, nothing is restricted.
|
|
31
|
+
|
|
32
|
+
Phases follow the skill you invoke — there is no message-keyword unlock. `/pwk-guard on|off|auto` manually overrides the guard (`on` = force read-only lock, `off` = disabled, `auto` = skill-driven, the default); subcommands autocomplete.
|
|
23
33
|
|
|
24
34
|
## Enforcement style
|
|
25
35
|
|
|
26
|
-
Hard block for write boundaries. No warnings, no escalation, no prompts. Either the tool call is allowed or it's blocked.
|
|
36
|
+
Hard block for write boundaries during gated phases. No warnings, no escalation, no prompts. Either the tool call is allowed or it's blocked.
|
|
27
37
|
|
|
28
|
-
TDD, debugging, and code review are guidance in the skill instructions, not runtime-enforced.
|
|
38
|
+
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.
|