@tianhai/pi-workflow-kit 0.5.1 → 0.6.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 +44 -494
- package/docs/developer-usage-guide.md +41 -401
- package/docs/oversight-model.md +13 -34
- package/docs/workflow-phases.md +32 -46
- package/extensions/workflow-guard.ts +67 -0
- package/package.json +3 -7
- package/skills/brainstorming/SKILL.md +16 -59
- package/skills/executing-tasks/SKILL.md +26 -227
- package/skills/finalizing/SKILL.md +33 -0
- package/skills/writing-plans/SKILL.md +23 -132
- package/ROADMAP.md +0 -16
- package/agents/code-reviewer.md +0 -18
- package/agents/config.ts +0 -5
- package/agents/implementer.md +0 -26
- package/agents/spec-reviewer.md +0 -13
- package/agents/worker.md +0 -17
- package/docs/plans/completed/2026-04-09-cleanup-legacy-state-and-enforce-think-phases-design.md +0 -56
- package/docs/plans/completed/2026-04-09-cleanup-legacy-state-and-enforce-think-phases-implementation.md +0 -196
- package/docs/plans/completed/2026-04-09-workflow-next-autocomplete-design.md +0 -185
- package/docs/plans/completed/2026-04-09-workflow-next-autocomplete-implementation.md +0 -334
- package/docs/plans/completed/2026-04-09-workflow-next-handoff-state-design.md +0 -251
- package/docs/plans/completed/2026-04-09-workflow-next-handoff-state-implementation.md +0 -253
- package/extensions/constants.ts +0 -15
- package/extensions/lib/logging.ts +0 -138
- package/extensions/plan-tracker.ts +0 -502
- package/extensions/subagent/agents.ts +0 -144
- package/extensions/subagent/concurrency.ts +0 -52
- package/extensions/subagent/env.ts +0 -47
- package/extensions/subagent/index.ts +0 -1181
- package/extensions/subagent/lifecycle.ts +0 -25
- package/extensions/subagent/timeout.ts +0 -13
- package/extensions/workflow-monitor/debug-monitor.ts +0 -98
- package/extensions/workflow-monitor/git.ts +0 -31
- package/extensions/workflow-monitor/heuristics.ts +0 -58
- package/extensions/workflow-monitor/investigation.ts +0 -52
- package/extensions/workflow-monitor/reference-tool.ts +0 -42
- package/extensions/workflow-monitor/skip-confirmation.ts +0 -19
- package/extensions/workflow-monitor/tdd-monitor.ts +0 -137
- package/extensions/workflow-monitor/test-runner.ts +0 -37
- package/extensions/workflow-monitor/verification-monitor.ts +0 -61
- package/extensions/workflow-monitor/warnings.ts +0 -81
- package/extensions/workflow-monitor/workflow-handler.ts +0 -358
- package/extensions/workflow-monitor/workflow-next-completions.ts +0 -68
- package/extensions/workflow-monitor/workflow-next-state.ts +0 -112
- package/extensions/workflow-monitor/workflow-tracker.ts +0 -253
- package/extensions/workflow-monitor/workflow-transitions.ts +0 -55
- package/extensions/workflow-monitor.ts +0 -872
- package/skills/dispatching-parallel-agents/SKILL.md +0 -194
- package/skills/receiving-code-review/SKILL.md +0 -196
- package/skills/systematic-debugging/SKILL.md +0 -170
- package/skills/systematic-debugging/condition-based-waiting-example.ts +0 -158
- package/skills/systematic-debugging/condition-based-waiting.md +0 -115
- package/skills/systematic-debugging/defense-in-depth.md +0 -122
- package/skills/systematic-debugging/find-polluter.sh +0 -63
- package/skills/systematic-debugging/reference/rationalizations.md +0 -61
- package/skills/systematic-debugging/root-cause-tracing.md +0 -169
- package/skills/test-driven-development/SKILL.md +0 -266
- package/skills/test-driven-development/reference/examples.md +0 -101
- package/skills/test-driven-development/reference/rationalizations.md +0 -67
- package/skills/test-driven-development/reference/when-stuck.md +0 -33
- package/skills/test-driven-development/testing-anti-patterns.md +0 -299
- package/skills/using-git-worktrees/SKILL.md +0 -231
|
@@ -1,462 +1,102 @@
|
|
|
1
1
|
# Developer Usage Guide
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
How to install and use `pi-workflow-kit` with the Pi coding agent.
|
|
4
4
|
|
|
5
|
-
## What
|
|
5
|
+
## What you get
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
- **Skills** — markdown instructions the agent can invoke with `/skill:<name>`
|
|
10
|
-
- **Extensions** — runtime behavior that tracks workflow state, warns about process mistakes, and adds tools such as `plan_tracker` and `subagent`
|
|
11
|
-
|
|
12
|
-
The intended workflow is:
|
|
13
|
-
|
|
14
|
-
```text
|
|
15
|
-
brainstorm → plan → execute → finalize
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
Inside **execute**, each task follows this lifecycle:
|
|
19
|
-
|
|
20
|
-
```text
|
|
21
|
-
define → approve → execute → verify → review → fix
|
|
22
|
-
```
|
|
7
|
+
- **4 skills** that guide the agent through a structured workflow
|
|
8
|
+
- **1 extension** that hard-blocks source writes during brainstorm and plan phases
|
|
23
9
|
|
|
24
10
|
## Installation
|
|
25
11
|
|
|
26
|
-
###
|
|
12
|
+
### From npm
|
|
27
13
|
|
|
28
14
|
```bash
|
|
29
15
|
pi install npm:@tianhai/pi-workflow-kit
|
|
30
16
|
```
|
|
31
17
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
### Option 2: Install from the maintained git repo
|
|
18
|
+
### From your own repo
|
|
35
19
|
|
|
36
20
|
```bash
|
|
37
|
-
pi install git:github.com
|
|
21
|
+
pi install git:github.com/<your-user>/pi-workflow-kit.git
|
|
38
22
|
```
|
|
39
23
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
### Option 3: Install from **your own maintained repo or fork**
|
|
43
|
-
|
|
44
|
-
If you are maintaining your own repo, install from that repo directly:
|
|
45
|
-
|
|
46
|
-
```bash
|
|
47
|
-
pi install git:github.com/yinloo-ola/pi-workflow-kit.git
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
For a different fork/repo, use:
|
|
51
|
-
|
|
52
|
-
```bash
|
|
53
|
-
pi install git:github.com/<your-user>/<your-repo>.git
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
Examples:
|
|
57
|
-
|
|
58
|
-
```bash
|
|
59
|
-
pi install git:github.com/acme/pi-workflow-kit.git
|
|
60
|
-
pi install git:github.com/yinloo-ola/pi-workflow-kit.git
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
This is the best option when:
|
|
64
|
-
- you have customized the skills or extensions
|
|
65
|
-
- you want full control over updates
|
|
66
|
-
- you do not plan to track upstream releases closely
|
|
67
|
-
|
|
68
|
-
### Option 4: Add your repo to Pi config
|
|
69
|
-
|
|
70
|
-
Project-level `.pi/settings.json` or global `~/.pi/agent/config.json`:
|
|
71
|
-
|
|
72
|
-
```json
|
|
73
|
-
{
|
|
74
|
-
"packages": ["git:github.com/yinloo-ola/pi-workflow-kit.git"]
|
|
75
|
-
}
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
If you prefer npm instead, you can still use:
|
|
24
|
+
Or in `.pi/settings.json` / `~/.pi/agent/config.json`:
|
|
79
25
|
|
|
80
26
|
```json
|
|
81
27
|
{
|
|
82
|
-
"packages": ["
|
|
28
|
+
"packages": ["git:github.com/<your-user>/pi-workflow-kit.git"]
|
|
83
29
|
}
|
|
84
30
|
```
|
|
85
31
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
## What activates automatically
|
|
89
|
-
|
|
90
|
-
After installation, Pi loads:
|
|
91
|
-
|
|
92
|
-
### Skills
|
|
93
|
-
- `brainstorming`
|
|
94
|
-
- `writing-plans`
|
|
95
|
-
- `executing-tasks`
|
|
96
|
-
- `test-driven-development`
|
|
97
|
-
- `systematic-debugging`
|
|
98
|
-
- `using-git-worktrees`
|
|
99
|
-
- `dispatching-parallel-agents`
|
|
100
|
-
- `receiving-code-review`
|
|
32
|
+
## The workflow
|
|
101
33
|
|
|
102
|
-
|
|
103
|
-
- **workflow-monitor**
|
|
104
|
-
- **plan-tracker**
|
|
105
|
-
- **subagent**
|
|
34
|
+
You control each phase by invoking the skill:
|
|
106
35
|
|
|
107
|
-
You do not need to enable these manually.
|
|
108
|
-
|
|
109
|
-
## Core commands and tools
|
|
110
|
-
|
|
111
|
-
### Skill invocation
|
|
112
|
-
|
|
113
|
-
Invoke skills directly in the Pi session:
|
|
114
|
-
|
|
115
|
-
```text
|
|
116
|
-
/skill:brainstorming
|
|
117
|
-
/skill:writing-plans
|
|
118
|
-
/skill:executing-tasks
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
### Workflow handoff
|
|
122
|
-
|
|
123
|
-
Start a fresh session for the next phase. `/workflow-next` enforces immediate-next-only transitions and preserves prior completed workflow history (phases, artifacts, prompted flags) across the handoff:
|
|
124
|
-
|
|
125
|
-
```text
|
|
126
|
-
/workflow-next plan docs/plans/2026-04-09-feature-design.md
|
|
127
|
-
/workflow-next execute docs/plans/2026-04-09-feature-implementation.md
|
|
128
|
-
/workflow-next finalize docs/plans/2026-04-09-feature-implementation.md
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
### Plan tracking
|
|
132
|
-
|
|
133
|
-
Track execution progress:
|
|
134
|
-
|
|
135
|
-
```ts
|
|
136
|
-
plan_tracker({
|
|
137
|
-
action: "init",
|
|
138
|
-
tasks: [
|
|
139
|
-
{ name: "Implement endpoint", type: "code" },
|
|
140
|
-
{ name: "Update README", type: "non-code" },
|
|
141
|
-
],
|
|
142
|
-
})
|
|
143
|
-
|
|
144
|
-
plan_tracker({ action: "update", index: 0, phase: "define" })
|
|
145
|
-
plan_tracker({ action: "update", index: 0, phase: "approve" })
|
|
146
|
-
plan_tracker({ action: "update", index: 0, phase: "execute", attempts: 1 })
|
|
147
|
-
plan_tracker({ action: "update", index: 0, phase: "verify" })
|
|
148
|
-
plan_tracker({ action: "update", index: 0, phase: "review" })
|
|
149
|
-
plan_tracker({ action: "update", index: 0, status: "complete" })
|
|
150
36
|
```
|
|
151
|
-
|
|
152
|
-
### Subagent dispatch
|
|
153
|
-
|
|
154
|
-
Use bundled agents through the `subagent` tool.
|
|
155
|
-
|
|
156
|
-
Bundled agents require:
|
|
157
|
-
|
|
158
|
-
```ts
|
|
159
|
-
agentScope: "both"
|
|
37
|
+
/skill:brainstorming → /skill:writing-plans → /skill:executing-tasks → /skill:finalizing
|
|
160
38
|
```
|
|
161
39
|
|
|
162
|
-
|
|
40
|
+
### 1. Brainstorm
|
|
163
41
|
|
|
164
|
-
```ts
|
|
165
|
-
subagent({
|
|
166
|
-
agent: "code-reviewer",
|
|
167
|
-
task: "Review Task 2 implementation against the plan and tests",
|
|
168
|
-
agentScope: "both",
|
|
169
|
-
})
|
|
170
42
|
```
|
|
171
|
-
|
|
172
|
-
## Recommended developer workflow
|
|
173
|
-
|
|
174
|
-
## 1. Brainstorm
|
|
175
|
-
|
|
176
|
-
Use this when you have an idea, request, or rough spec.
|
|
177
|
-
|
|
178
|
-
```text
|
|
179
43
|
/skill:brainstorming
|
|
180
44
|
```
|
|
181
45
|
|
|
182
|
-
|
|
183
|
-
- a clarified design
|
|
184
|
-
- a design artifact in `docs/plans/`
|
|
185
|
-
- optional worktree/branch setup
|
|
186
|
-
|
|
187
|
-
Good time to use:
|
|
188
|
-
- `/skill:using-git-worktrees` for larger changes or isolated work
|
|
189
|
-
|
|
190
|
-
## 2. Write the implementation plan
|
|
191
|
-
|
|
192
|
-
Use:
|
|
193
|
-
|
|
194
|
-
```text
|
|
195
|
-
/skill:writing-plans
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
The implementation plan should be saved under:
|
|
199
|
-
|
|
200
|
-
```text
|
|
201
|
-
docs/plans/YYYY-MM-DD-<feature>-implementation.md
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
### Plan authoring rules
|
|
205
|
-
|
|
206
|
-
Each task should include:
|
|
207
|
-
- a task title
|
|
208
|
-
- `**Type:** code` or `**Type:** non-code`
|
|
209
|
-
- exact file paths
|
|
210
|
-
- concrete implementation steps
|
|
211
|
-
- for code tasks: TDD steps and test commands
|
|
212
|
-
- for non-code tasks: explicit acceptance criteria
|
|
46
|
+
Explore the idea through collaborative dialogue. The agent reads code, asks questions one at a time, proposes 2-3 approaches, and presents the design in sections for your review.
|
|
213
47
|
|
|
214
|
-
|
|
48
|
+
Outcome: `docs/plans/YYYY-MM-DD-<topic>-design.md`
|
|
215
49
|
|
|
216
|
-
|
|
50
|
+
### 2. Plan
|
|
217
51
|
|
|
218
|
-
```md
|
|
219
|
-
### Task 1: Add retry logic
|
|
220
|
-
|
|
221
|
-
**Type:** code
|
|
222
|
-
**TDD scenario:** New feature — full TDD cycle
|
|
223
|
-
|
|
224
|
-
**Files:**
|
|
225
|
-
- Modify: `src/retry.ts`
|
|
226
|
-
- Test: `tests/retry.test.ts`
|
|
227
52
|
```
|
|
228
|
-
|
|
229
|
-
Non-code task:
|
|
230
|
-
|
|
231
|
-
```md
|
|
232
|
-
### Task 2: Update docs
|
|
233
|
-
|
|
234
|
-
**Type:** non-code
|
|
235
|
-
|
|
236
|
-
**Files:**
|
|
237
|
-
- Modify: `README.md`
|
|
238
|
-
- Modify: `docs/architecture.md`
|
|
239
|
-
|
|
240
|
-
**Acceptance criteria:**
|
|
241
|
-
- README describes the new API accurately
|
|
242
|
-
- Architecture doc reflects the new flow
|
|
243
|
-
- Terminology matches the codebase
|
|
53
|
+
/skill:writing-plans
|
|
244
54
|
```
|
|
245
55
|
|
|
246
|
-
|
|
56
|
+
Read the design doc and break it into bite-sized tasks with exact file paths, complete code, and TDD scenarios. Optionally set up a branch or worktree.
|
|
247
57
|
|
|
248
|
-
|
|
58
|
+
Outcome: `docs/plans/YYYY-MM-DD-<topic>-implementation.md`
|
|
249
59
|
|
|
250
|
-
|
|
251
|
-
/skill:executing-tasks
|
|
252
|
-
```
|
|
60
|
+
### 3. Execute
|
|
253
61
|
|
|
254
|
-
At the start of execution, the agent should:
|
|
255
|
-
1. read the plan
|
|
256
|
-
2. extract tasks and task types
|
|
257
|
-
3. initialize `plan_tracker`
|
|
258
|
-
|
|
259
|
-
Example:
|
|
260
|
-
|
|
261
|
-
```ts
|
|
262
|
-
plan_tracker({
|
|
263
|
-
action: "init",
|
|
264
|
-
tasks: [
|
|
265
|
-
{ name: "Add retry logic", type: "code" },
|
|
266
|
-
{ name: "Update docs", type: "non-code" },
|
|
267
|
-
],
|
|
268
|
-
})
|
|
269
62
|
```
|
|
270
|
-
|
|
271
|
-
## Per-task lifecycle during execution
|
|
272
|
-
|
|
273
|
-
For each task:
|
|
274
|
-
|
|
275
|
-
1. **define**
|
|
276
|
-
- code task: define/write tests
|
|
277
|
-
- non-code task: define/refine acceptance criteria
|
|
278
|
-
2. **approve**
|
|
279
|
-
- human approves tests or acceptance criteria
|
|
280
|
-
3. **execute**
|
|
281
|
-
- implement the task
|
|
282
|
-
- bounded retries
|
|
283
|
-
4. **verify**
|
|
284
|
-
- rerun checks and report pass/fail
|
|
285
|
-
5. **review**
|
|
286
|
-
- subagent review + human sign-off
|
|
287
|
-
6. **fix**
|
|
288
|
-
- address review issues and re-enter verify/review
|
|
289
|
-
|
|
290
|
-
### Important behavior
|
|
291
|
-
|
|
292
|
-
- **Code tasks** follow TDD guidance
|
|
293
|
-
- **Non-code tasks** use acceptance criteria instead of TDD
|
|
294
|
-
- The plan tracker widget shows task progress in the TUI
|
|
295
|
-
- When all tasks reach a terminal state, the workflow can move into **finalize**
|
|
296
|
-
|
|
297
|
-
## 4. Finalize
|
|
298
|
-
|
|
299
|
-
Use:
|
|
300
|
-
|
|
301
|
-
```text
|
|
302
63
|
/skill:executing-tasks
|
|
303
64
|
```
|
|
304
65
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
```text
|
|
308
|
-
/workflow-next finalize docs/plans/2026-04-09-feature-implementation.md
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
Finalize typically includes:
|
|
312
|
-
- holistic review
|
|
313
|
-
- PR preparation
|
|
314
|
-
- doc updates
|
|
315
|
-
- archive planning docs
|
|
316
|
-
- cleanup of worktree/branch if needed
|
|
317
|
-
|
|
318
|
-
## What the extensions do while you work
|
|
319
|
-
|
|
320
|
-
### Workflow Monitor
|
|
321
|
-
|
|
322
|
-
The workflow monitor runs in the background and helps keep the agent aligned.
|
|
323
|
-
|
|
324
|
-
It can:
|
|
325
|
-
- track the current global phase
|
|
326
|
-
- prompt at workflow boundaries
|
|
327
|
-
- warn when source is written before tests
|
|
328
|
-
- warn when fixing starts without investigation after failures
|
|
329
|
-
- warn on commit/push/PR creation without recent passing verification
|
|
330
|
-
- remind the agent to confirm branch/worktree before the first write
|
|
66
|
+
Implement the plan task-by-task. Each task: implement → run tests → fix if needed → commit.
|
|
331
67
|
|
|
332
|
-
###
|
|
68
|
+
### 4. Finalize
|
|
333
69
|
|
|
334
|
-
The plan tracker stores execution state outside the prompt and shows it in the TUI.
|
|
335
|
-
|
|
336
|
-
It tracks:
|
|
337
|
-
- task name
|
|
338
|
-
- task type
|
|
339
|
-
- task status
|
|
340
|
-
- task phase
|
|
341
|
-
- execute attempts
|
|
342
|
-
- fix attempts
|
|
343
|
-
|
|
344
|
-
### Subagent
|
|
345
|
-
|
|
346
|
-
The subagent extension lets the main agent delegate focused work to isolated helper agents.
|
|
347
|
-
|
|
348
|
-
Bundled agents include:
|
|
349
|
-
- `implementer`
|
|
350
|
-
- `worker`
|
|
351
|
-
- `code-reviewer`
|
|
352
|
-
- `spec-reviewer`
|
|
353
|
-
|
|
354
|
-
## Practical examples
|
|
355
|
-
|
|
356
|
-
### Example: Start a new feature
|
|
357
|
-
|
|
358
|
-
```text
|
|
359
|
-
/skill:brainstorming
|
|
360
70
|
```
|
|
361
|
-
|
|
362
|
-
Then:
|
|
363
|
-
|
|
364
|
-
```text
|
|
365
|
-
/skill:writing-plans
|
|
366
|
-
```
|
|
367
|
-
|
|
368
|
-
Then:
|
|
369
|
-
|
|
370
|
-
```text
|
|
371
|
-
/skill:executing-tasks
|
|
372
|
-
```
|
|
373
|
-
|
|
374
|
-
### Example: Ask for code review during execution
|
|
375
|
-
|
|
376
|
-
```ts
|
|
377
|
-
subagent({
|
|
378
|
-
agent: "code-reviewer",
|
|
379
|
-
task: "Review Task 3 implementation for correctness, edge cases, and test coverage",
|
|
380
|
-
agentScope: "both",
|
|
381
|
-
})
|
|
382
|
-
```
|
|
383
|
-
|
|
384
|
-
### Example: Move to a fresh execute session
|
|
385
|
-
|
|
386
|
-
```text
|
|
387
|
-
/workflow-next execute docs/plans/2026-04-09-my-feature-implementation.md
|
|
71
|
+
/skill:finalizing
|
|
388
72
|
```
|
|
389
73
|
|
|
390
|
-
|
|
74
|
+
Archive plan docs, update CHANGELOG/README, create PR, clean up worktree.
|
|
391
75
|
|
|
392
|
-
|
|
393
|
-
/workflow-next finalize docs/plans/2026-04-09-my-feature-implementation.md
|
|
394
|
-
```
|
|
76
|
+
## What the extension does
|
|
395
77
|
|
|
396
|
-
|
|
78
|
+
The `workflow-guard` extension watches `write` and `edit` tool calls:
|
|
397
79
|
|
|
398
|
-
|
|
80
|
+
- **During brainstorm and plan**: blocks writes outside `docs/plans/`. The agent can read code and use bash, but cannot modify source files.
|
|
81
|
+
- **During execute and finalize**: no restrictions. All tools available.
|
|
399
82
|
|
|
400
|
-
|
|
401
|
-
@tianhai/pi-workflow-kit
|
|
402
|
-
```
|
|
83
|
+
No configuration needed. It activates automatically after install.
|
|
403
84
|
|
|
404
|
-
|
|
85
|
+
## TDD guidance
|
|
405
86
|
|
|
406
|
-
|
|
407
|
-
npm run check
|
|
408
|
-
npm version patch
|
|
409
|
-
git push origin main --follow-tags
|
|
410
|
-
```
|
|
87
|
+
The plan labels each task with a TDD scenario:
|
|
411
88
|
|
|
412
|
-
|
|
89
|
+
| Scenario | When | Rule |
|
|
90
|
+
|----------|------|------|
|
|
91
|
+
| New feature | Adding new behavior | Write failing test → implement → pass |
|
|
92
|
+
| Modifying tested code | Changing existing behavior | Run existing tests first → modify → verify |
|
|
93
|
+
| Trivial | Config, docs, naming | Use judgment |
|
|
413
94
|
|
|
414
|
-
|
|
415
|
-
pi install npm:@tianhai/pi-workflow-kit
|
|
416
|
-
```
|
|
95
|
+
This is guidance in the skill instructions, not runtime enforcement.
|
|
417
96
|
|
|
418
|
-
##
|
|
97
|
+
## Tips
|
|
419
98
|
|
|
420
|
-
- Start with
|
|
421
|
-
- Use
|
|
99
|
+
- Start with brainstorming for anything non-trivial
|
|
100
|
+
- Use writing-plans before touching code for multi-step work
|
|
422
101
|
- Put all plan artifacts under `docs/plans/`
|
|
423
|
-
-
|
|
424
|
-
- Use `code` for implementation/test work and `non-code` for docs/process tasks
|
|
425
|
-
- Let `plan_tracker` reflect the real lifecycle instead of keeping state only in chat
|
|
426
|
-
- Use `subagent(..., agentScope: "both")` when you want bundled agents
|
|
427
|
-
- Treat workflow monitor warnings as signals to correct process, not as noise
|
|
428
|
-
- Use `/workflow-next` when handing off between sequential workflow phases
|
|
429
|
-
|
|
430
|
-
## Common mistakes to avoid
|
|
431
|
-
|
|
432
|
-
- Starting execution without an implementation plan
|
|
433
|
-
- Initializing `plan_tracker` with task names only when your plan contains non-code tasks
|
|
434
|
-
- Forgetting `agentScope: "both"` for bundled subagents
|
|
435
|
-
- Treating verify/review as global phases instead of per-task steps inside execute
|
|
436
|
-
- Writing files outside `docs/plans/` during brainstorm/plan unless you intentionally advance phases
|
|
437
|
-
- Claiming work is done without running verification checks
|
|
438
|
-
|
|
439
|
-
## Migration note
|
|
440
|
-
|
|
441
|
-
If you previously installed `@yinlootan/pi-superpowers-plus`, replace it with `@tianhai/pi-workflow-kit`:
|
|
442
|
-
|
|
443
|
-
```json
|
|
444
|
-
{
|
|
445
|
-
"packages": ["npm:@tianhai/pi-workflow-kit"]
|
|
446
|
-
}
|
|
447
|
-
```
|
|
448
|
-
|
|
449
|
-
The rebrand keeps runtime names stable, so existing usage still centers on:
|
|
450
|
-
- `plan_tracker`
|
|
451
|
-
- `workflow_reference`
|
|
452
|
-
- `/workflow-next`
|
|
453
|
-
- `/workflow-reset`
|
|
454
|
-
- the existing skill names
|
|
455
|
-
|
|
456
|
-
## Where to look next
|
|
457
|
-
|
|
458
|
-
- `README.md`
|
|
459
|
-
- `docs/oversight-model.md`
|
|
460
|
-
- `docs/workflow-phases.md`
|
|
461
|
-
- `skills/writing-plans/SKILL.md`
|
|
462
|
-
- `skills/executing-tasks/SKILL.md`
|
|
102
|
+
- During execute, the agent handles code review feedback by verifying criticism before implementing
|
package/docs/oversight-model.md
CHANGED
|
@@ -1,49 +1,28 @@
|
|
|
1
1
|
# Oversight Model
|
|
2
2
|
|
|
3
|
-
`pi-workflow-kit` combines **skills** and **
|
|
3
|
+
`pi-workflow-kit` combines **skills** and **one extension**.
|
|
4
4
|
|
|
5
5
|
## Skills
|
|
6
6
|
|
|
7
|
-
Skills teach the agent the
|
|
7
|
+
Skills teach the agent the workflow. There are 4:
|
|
8
8
|
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
9
|
+
- **brainstorming** — explore ideas, produce a design doc
|
|
10
|
+
- **writing-plans** — break design into TDD tasks
|
|
11
|
+
- **executing-tasks** — implement tasks, handle code review
|
|
12
|
+
- **finalizing** — archive docs, create PR
|
|
13
13
|
|
|
14
14
|
They explain *what* to do and *when* to do it.
|
|
15
15
|
|
|
16
|
-
##
|
|
16
|
+
## Extension
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
The `workflow-guard` extension enforces one rule:
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
- **plan-tracker** stores per-task execution state, including task type, phase, and attempt counts
|
|
22
|
-
- **subagent** runs isolated helper agents for implementation and review work
|
|
20
|
+
> During brainstorm and plan phases, `write` and `edit` are **hard-blocked** outside `docs/plans/`.
|
|
23
21
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
The package is intentionally **warning-first**.
|
|
27
|
-
|
|
28
|
-
- TDD violations are injected into tool results as warnings
|
|
29
|
-
- Debug guardrails escalate after repeated failing cycles
|
|
30
|
-
- Verification checks warn on `git commit`, `git push`, and `gh pr create` when passing tests have not been run recently
|
|
31
|
-
- During brainstorm and plan, writes outside `docs/plans/` trigger process warnings and may escalate to an interactive stop in the TUI
|
|
32
|
-
|
|
33
|
-
In interactive sessions, repeated violations can trigger a human decision prompt.
|
|
22
|
+
The agent can still use `read` and `bash` for investigation. It literally cannot call `write` or `edit` on source files — the tools are blocked at the extension level.
|
|
34
23
|
|
|
35
|
-
##
|
|
36
|
-
|
|
37
|
-
Global workflow phases:
|
|
38
|
-
|
|
39
|
-
```text
|
|
40
|
-
brainstorm → plan → execute → finalize
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
Inside **execute**, each task follows the per-task lifecycle tracked by `plan_tracker`:
|
|
24
|
+
## Enforcement style
|
|
44
25
|
|
|
45
|
-
|
|
46
|
-
define → approve → execute → verify → review → fix
|
|
47
|
-
```
|
|
26
|
+
Hard block for write boundaries. No warnings, no escalation, no prompts. Either the tool call is allowed or it's blocked.
|
|
48
27
|
|
|
49
|
-
|
|
28
|
+
TDD, debugging, and code review are guidance in the skill instructions, not runtime-enforced.
|
package/docs/workflow-phases.md
CHANGED
|
@@ -1,71 +1,57 @@
|
|
|
1
1
|
# Workflow Phases
|
|
2
2
|
|
|
3
|
-
`pi-workflow-kit`
|
|
3
|
+
`pi-workflow-kit` has 4 phases. You invoke each one explicitly with `/skill:`.
|
|
4
4
|
|
|
5
|
-
```
|
|
5
|
+
```
|
|
6
6
|
brainstorm → plan → execute → finalize
|
|
7
7
|
```
|
|
8
8
|
|
|
9
9
|
## brainstorm
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
```
|
|
12
|
+
/skill:brainstorming
|
|
13
|
+
```
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
- produce a design artifact under `docs/plans/`
|
|
15
|
+
- Explore requirements and shape the design
|
|
16
|
+
- Ask questions one at a time, propose approaches
|
|
17
|
+
- Produce `docs/plans/YYYY-MM-DD-<topic>-design.md`
|
|
17
18
|
|
|
18
|
-
Write boundary:
|
|
19
|
-
- allowed: `docs/plans/`
|
|
20
|
-
- discouraged elsewhere; runtime warnings may be injected
|
|
19
|
+
Write boundary: only `docs/plans/` is writable. Source files are hard-blocked.
|
|
21
20
|
|
|
22
21
|
## plan
|
|
23
22
|
|
|
24
|
-
|
|
23
|
+
```
|
|
24
|
+
/skill:writing-plans
|
|
25
|
+
```
|
|
25
26
|
|
|
26
|
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
27
|
+
- Read the design doc
|
|
28
|
+
- Break into bite-sized tasks with TDD scenarios
|
|
29
|
+
- Optionally set up a branch or worktree
|
|
30
|
+
- Produce `docs/plans/YYYY-MM-DD-<topic>-implementation.md`
|
|
30
31
|
|
|
31
|
-
Write boundary:
|
|
32
|
-
- allowed: `docs/plans/`
|
|
33
|
-
- discouraged elsewhere; runtime warnings may be injected
|
|
32
|
+
Write boundary: only `docs/plans/` is writable. Source files are hard-blocked.
|
|
34
33
|
|
|
35
34
|
## execute
|
|
36
35
|
|
|
37
|
-
|
|
36
|
+
```
|
|
37
|
+
/skill:executing-tasks
|
|
38
|
+
```
|
|
38
39
|
|
|
39
|
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
- track per-task phase and attempt counts
|
|
40
|
+
- Read the implementation plan
|
|
41
|
+
- Implement tasks one at a time: implement → test → fix → commit
|
|
42
|
+
- Handle code review feedback by verifying criticism before implementing
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
- `define`
|
|
46
|
-
- `approve`
|
|
47
|
-
- `execute`
|
|
48
|
-
- `verify`
|
|
49
|
-
- `review`
|
|
50
|
-
- `fix`
|
|
51
|
-
- terminal states: `complete`, `blocked`
|
|
44
|
+
No write restrictions. All tools available.
|
|
52
45
|
|
|
53
46
|
## finalize
|
|
54
47
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
- perform holistic review
|
|
59
|
-
- prepare PR / push / cleanup
|
|
60
|
-
- archive planning docs
|
|
61
|
-
- update README / CHANGELOG / other documentation when needed
|
|
62
|
-
|
|
63
|
-
## Detection signals
|
|
48
|
+
```
|
|
49
|
+
/skill:finalizing
|
|
50
|
+
```
|
|
64
51
|
|
|
65
|
-
|
|
52
|
+
- Archive plan docs to `docs/plans/completed/`
|
|
53
|
+
- Update CHANGELOG, README if needed
|
|
54
|
+
- Create PR
|
|
55
|
+
- Clean up worktree if one was used
|
|
66
56
|
|
|
67
|
-
|
|
68
|
-
- writes to `docs/plans/*-design.md` and `docs/plans/*-implementation.md`
|
|
69
|
-
- `plan_tracker` initialization to enter execute
|
|
70
|
-
- all tracked tasks reaching terminal state to mark execute complete
|
|
71
|
-
- boundary-prompt acceptance to enter finalize
|
|
57
|
+
No write restrictions. All tools available.
|