@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
package/README.md
CHANGED
|
@@ -1,533 +1,83 @@
|
|
|
1
1
|
# pi-workflow-kit
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Structured workflow skills and enforcement for [pi](https://github.com/badlogic/pi-mono).
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## What You Get
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
**4 workflow skills** that guide the agent through a structured development process:
|
|
8
8
|
|
|
9
|
-
## What You Get When You Install This
|
|
10
|
-
|
|
11
|
-
**8 workflow skills** that guide the agent through a structured development process - from brainstorming ideas through shipping code.
|
|
12
|
-
|
|
13
|
-
**3 extensions** that run silently in the background:
|
|
14
|
-
- **Workflow Monitor** — warns on TDD violations, tracks debug cycles, gates commits on verification, tracks workflow phase, and serves reference content on demand.
|
|
15
|
-
- **Subagent** — registers a `subagent` tool for dispatching implementation and review work to isolated subprocess agents, with bundled agent definitions and structured results.
|
|
16
|
-
- **Task Tracker** — tracks per-task progress, type, phase, and attempt counts with a TUI widget.
|
|
17
|
-
|
|
18
|
-
**After installation**:
|
|
19
|
-
- Any time the agent writes a source file without a failing test, it gets a warning injected into the tool result.
|
|
20
|
-
- Any time it tries to `git commit` / `git push` / `gh pr create` without passing tests, it gets a verification warning and, in interactive finalize flows, may be gated for confirmation.
|
|
21
|
-
- During **Brainstorm**/**Plan**, writes outside `docs/plans/` trigger a process warning and may escalate to an interactive stop.
|
|
22
|
-
- On the first tool output of a session (inside a git repo), the agent is shown the **current git branch (or detached HEAD short SHA)**.
|
|
23
|
-
- On the first write/edit of a session (inside a git repo), the agent is warned to **confirm it's on the correct branch/worktree** before continuing.
|
|
24
|
-
|
|
25
|
-
The agent sees these warnings as part of its normal tool output - no configuration needed.
|
|
26
|
-
|
|
27
|
-
More detail:
|
|
28
|
-
- [`docs/oversight-model.md`](docs/oversight-model.md) — how skills + runtime enforcement work together, and how warnings escalate
|
|
29
|
-
- [`docs/workflow-phases.md`](docs/workflow-phases.md) — what each workflow phase permits (especially thinking-phase write boundaries)
|
|
30
|
-
|
|
31
|
-
## Install
|
|
32
|
-
|
|
33
|
-
### From npm
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
pi install npm:@tianhai/pi-workflow-kit
|
|
37
9
|
```
|
|
38
|
-
|
|
39
|
-
### From a git repository
|
|
40
|
-
|
|
41
|
-
```bash
|
|
42
|
-
pi install git:github.com/yinloo-ola/pi-workflow-kit.git
|
|
10
|
+
brainstorm → plan → execute → finalize
|
|
43
11
|
```
|
|
44
12
|
|
|
45
|
-
|
|
13
|
+
**1 extension** that enforces the rules:
|
|
46
14
|
|
|
47
|
-
|
|
15
|
+
- During brainstorming and planning, `write` and `edit` are **hard-blocked** outside `docs/plans/`. The agent can only read code and discuss the design with you — it literally cannot modify source files.
|
|
16
|
+
- `bash` stays available for investigation (`grep`, `find`, `git log`, etc.).
|
|
48
17
|
|
|
49
|
-
|
|
50
|
-
pi install git:github.com/yinloo-ola/pi-workflow-kit.git
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
For a different fork/repo, use:
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
pi install git:github.com/<your-user>/<your-repo>.git
|
|
57
|
-
```
|
|
18
|
+
No configuration required. Skills and extensions activate automatically after install.
|
|
58
19
|
|
|
59
|
-
|
|
20
|
+
## Install
|
|
60
21
|
|
|
61
22
|
```bash
|
|
62
|
-
pi install
|
|
63
|
-
pi install git:github.com/yinloo-ola/pi-workflow-kit.git
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
You can also point Pi config at your repo instead of the npm package.
|
|
67
|
-
|
|
68
|
-
Project-level `.pi/settings.json` or global `~/.pi/agent/config.json`:
|
|
69
|
-
|
|
70
|
-
```json
|
|
71
|
-
{
|
|
72
|
-
"packages": ["git:github.com/yinloo-ola/pi-workflow-kit.git"]
|
|
73
|
-
}
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
Use this when:
|
|
77
|
-
- you maintain custom skills/extensions in your own repo
|
|
78
|
-
- you do not want to depend on upstream releases
|
|
79
|
-
- you want your team to install the exact version you control
|
|
80
|
-
|
|
81
|
-
No configuration required after install. Skills and extensions activate automatically.
|
|
82
|
-
|
|
83
|
-
## Support
|
|
84
|
-
|
|
85
|
-
- Questions / support: https://github.com/yinloo-ola/pi-workflow-kit/discussions
|
|
86
|
-
- Bugs: https://github.com/yinloo-ola/pi-workflow-kit/issues/new/choose
|
|
87
|
-
- Feature requests: https://github.com/yinloo-ola/pi-workflow-kit/issues/new/choose
|
|
88
|
-
- Roadmap: [`ROADMAP.md`](ROADMAP.md)
|
|
89
|
-
- Contributing: [`CONTRIBUTING.md`](CONTRIBUTING.md)
|
|
90
|
-
|
|
91
|
-
## Upgrading from `pi-superpowers`
|
|
92
|
-
|
|
93
|
-
If you're currently using `pi-superpowers`, `@tianhai/pi-workflow-kit` is intended as a drop-in upgrade: you keep the same skill names and workflow, but you also get **active, runtime enforcement** via extensions.
|
|
94
|
-
|
|
95
|
-
### What stays the same
|
|
96
|
-
- The same core workflow skills (e.g. `/skill:brainstorming`, `/skill:writing-plans`, `/skill:executing-tasks`, etc.)
|
|
97
|
-
- The same "structured workflow" idea and phase order
|
|
98
|
-
|
|
99
|
-
### What's new in `pi-workflow-kit`
|
|
100
|
-
- **Workflow Monitor extension** that observes tool calls/results and injects warnings directly into output
|
|
101
|
-
- **TDD discipline warnings** when writing source code without a failing test (advisory, not blocking)
|
|
102
|
-
- **Three-scenario TDD model** — new feature (full TDD), modifying tested code (run existing tests), trivial change (judgment) — applied consistently across skills, agent profiles, and plan templates
|
|
103
|
-
- **Debug enforcement** escalation after failing tests activate investigation-first mode
|
|
104
|
-
- **Verification gating** for `git commit` / `git push` / `gh pr create` until passing tests are run (suppressed during active plan execution)
|
|
105
|
-
- **Workflow tracking + boundary prompts** (and `/workflow-next` handoff)
|
|
106
|
-
- **Branch safety reminders** (first tool result shows current branch/SHA; first write/edit warns to confirm branch/worktree)
|
|
107
|
-
- **Finalize reminder prefill** (docs + learnings)
|
|
108
|
-
- **Task Tracker tool** (`plan_tracker`) for typed task lists + TUI progress
|
|
109
|
-
|
|
110
|
-
### Migration
|
|
111
|
-
Replace `pi-superpowers` with `@tianhai/pi-workflow-kit` in your config:
|
|
112
|
-
|
|
113
|
-
```json
|
|
114
|
-
{
|
|
115
|
-
"packages": ["npm:@tianhai/pi-workflow-kit"]
|
|
116
|
-
}
|
|
23
|
+
pi install npm:@tianhai/pi-workflow-kit
|
|
117
24
|
```
|
|
118
25
|
|
|
119
|
-
Notes:
|
|
120
|
-
- If you keep both packages enabled, you may get duplicate/competing skill guidance.
|
|
121
|
-
- `pi-workflow-kit` is more "opinionated" at runtime: it will inject warnings into tool output and may gate shipping commands until verification has passed.
|
|
122
|
-
|
|
123
|
-
### How the skills differ (leveraging pi)
|
|
124
|
-
|
|
125
|
-
`pi-workflow-kit` uses pi's runtime capabilities alongside skill content:
|
|
126
|
-
- **Extensions** enforce behavior *while you work* (TDD/Debug/Verification monitors, branch safety notices) — runtime warnings complement inline skill guidance.
|
|
127
|
-
- **Three-scenario TDD** — skills, agent profiles, and plan templates all use the same model: new feature (full TDD), modifying tested code (run existing tests), trivial change (use judgment). Runtime warnings are advisory nudges, not hard blocks.
|
|
128
|
-
- The **TUI** shows state (workflow/TDD) and prompts at boundaries.
|
|
129
|
-
- Tools like **`plan_tracker`** store execution state outside the prompt.
|
|
130
|
-
- **`workflow_reference`** provides extended detail on demand, keeping skill files focused while making deep guidance available when the agent needs it.
|
|
131
|
-
|
|
132
|
-
The workflow has been simplified to **4 phases** with **8 skills**. The `executing-tasks` skill replaces 5 separate execution-phase skills with a unified per-task lifecycle.
|
|
133
|
-
|
|
134
|
-
| Skill | Size (KB) | Note |
|
|
135
|
-
|---|---:|---|
|
|
136
|
-
| `brainstorming` | 2.9 | Unchanged |
|
|
137
|
-
| `dispatching-parallel-agents` | 6.1 | Unchanged |
|
|
138
|
-
| `executing-tasks` | 6.7 | **New** — replaces 5 skills |
|
|
139
|
-
| `receiving-code-review` | 5.8 | Unchanged |
|
|
140
|
-
| `systematic-debugging` | 7.2 | Unchanged |
|
|
141
|
-
| `test-driven-development` | 8.1 | Unchanged |
|
|
142
|
-
| `using-git-worktrees` | 6.1 | Unchanged |
|
|
143
|
-
| `writing-plans` | 3.8 | Updated — added task type + acceptance criteria |
|
|
144
|
-
|
|
145
26
|
## The Workflow
|
|
146
27
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
```
|
|
150
|
-
Brainstorm → Plan → Execute → Finalize
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
| Phase | Skill | What Happens |
|
|
154
|
-
|-------|-------|--------------|
|
|
155
|
-
| **Brainstorm** | `/skill:brainstorming` | Refines your idea into a design document via Socratic dialogue |
|
|
156
|
-
| **Plan** | `/skill:writing-plans` | Breaks the design into bite-sized TDD tasks with exact file paths and code |
|
|
157
|
-
| **Execute** | `/skill:executing-tasks` | Per-task lifecycle: define → approve → execute → verify → review → fix |
|
|
158
|
-
| **Finalize** | `/skill:executing-tasks` | PR, archive planning docs, update repo docs, clean up |
|
|
159
|
-
|
|
160
|
-
The **workflow tracker** shows progress in the TUI status bar as the agent moves through phases:
|
|
161
|
-
|
|
162
|
-
```
|
|
163
|
-
-brainstorm → ✓plan → [execute] → finalize
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
Phases are detected automatically from skill invocations, artifact writes under `docs/plans/`, `plan_tracker` initialization, and completion of all tracked tasks. At phase boundaries, the agent is prompted (once) with options to continue, start a fresh session, skip, or discuss.
|
|
167
|
-
|
|
168
|
-
### Supporting Skills
|
|
169
|
-
|
|
170
|
-
These skills are used within the main workflow as needed:
|
|
171
|
-
|
|
172
|
-
| Skill | When It's Used |
|
|
173
|
-
|-------|---------------|
|
|
174
|
-
| `/skill:test-driven-development` | During execution - enforced by the TDD monitor |
|
|
175
|
-
| `/skill:systematic-debugging` | When tests fail repeatedly - enforced by the debug monitor |
|
|
176
|
-
| `/skill:using-git-worktrees` | Before execution - creates isolated branch workspace |
|
|
177
|
-
| `/skill:dispatching-parallel-agents` | When multiple independent problems need solving concurrently |
|
|
178
|
-
| `/skill:receiving-code-review` | When acting on review feedback - prevents blind agreement |
|
|
179
|
-
|
|
180
|
-
## Extensions
|
|
181
|
-
|
|
182
|
-
### Workflow Monitor
|
|
183
|
-
|
|
184
|
-
Runs in the background observing every tool call and result. Zero configuration.
|
|
185
|
-
|
|
186
|
-
#### TDD Enforcement
|
|
187
|
-
|
|
188
|
-
Detects when the agent writes production code without a failing test and injects a warning into the tool result. The warning is advisory — a nudge to consider whether a test is needed, not a hard block. The agent's skill instructions and agent profiles include three-scenario TDD guidance (new feature → full TDD, modifying tested code → run existing tests, trivial change → use judgment).
|
|
189
|
-
|
|
190
|
-
**Tracks the TDD cycle:** RED → GREEN → REFACTOR → idle. Resets on `git commit`.
|
|
191
|
-
|
|
192
|
-
**TUI widget** shows the current phase, color-coded:
|
|
193
|
-
```
|
|
194
|
-
TDD: RED (red)
|
|
195
|
-
TDD: GREEN (green)
|
|
196
|
-
TDD: REFACTOR (accent)
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
#### Debug Enforcement
|
|
200
|
-
|
|
201
|
-
Activates after a **non-TDD failing test run** and switches the agent into investigation-first mode. When active:
|
|
202
|
-
- Warns if the agent writes a fix without reading code first (investigation required)
|
|
203
|
-
- Counts fix attempts and escalates warnings at 3+
|
|
204
|
-
- Resets on test pass or commit
|
|
205
|
-
|
|
206
|
-
#### Verification Gating
|
|
207
|
-
|
|
208
|
-
Warns on `git commit`, `git push`, and `gh pr create` when the agent hasn't run passing tests. Requires a fresh passing test run before shipping. Automatically clears after successful verification. During active plan execution, verification prompts are suppressed to avoid disrupting flow.
|
|
209
|
-
|
|
210
|
-
#### Branch Safety (informational)
|
|
211
|
-
|
|
212
|
-
Inside a git repo, the workflow monitor also tries to prevent "oops I just edited main" mistakes:
|
|
213
|
-
- On the **first tool result** of a session, it injects `📌 Current branch: <branch-or-sha>`.
|
|
214
|
-
- On the **first write/edit** of a session, it injects a warning reminding the agent to confirm the branch/worktree with the user.
|
|
215
|
-
|
|
216
|
-
Outside a git repo, it stays silent.
|
|
217
|
-
|
|
218
|
-
#### Workflow Tracker
|
|
219
|
-
|
|
220
|
-
Tracks which workflow phase the agent is in and shows a phase strip in the TUI widget. Detection signals:
|
|
221
|
-
- Skill invocations (`/skill:brainstorming`, `/skill:writing-plans`, etc.)
|
|
222
|
-
- Artifact writes under `docs/plans/` (`*-design.md` → brainstorm, `*-implementation.md` → plan)
|
|
223
|
-
- `plan_tracker` init calls → execute phase
|
|
224
|
-
- all tracked tasks reaching a terminal state (`complete` or `blocked`) → execution-complete boundary
|
|
225
|
-
- accepting the execution-complete handoff → finalize phase
|
|
226
|
-
|
|
227
|
-
At phase boundaries, prompts the agent once (non-enforcing) with options:
|
|
228
|
-
1. **Next step** - continue in the current session
|
|
229
|
-
2. **Fresh session** - hand off to a new session via `/workflow-next`
|
|
230
|
-
3. **Skip** - skip the next phase
|
|
231
|
-
4. **Discuss** - keep chatting
|
|
232
|
-
|
|
233
|
-
When transitioning into **finalize**, the monitor pre-fills the editor with a reminder to consider documentation updates and to capture learnings before merging/shipping.
|
|
234
|
-
|
|
235
|
-
The `/workflow-next` command starts a new session with artifact context and enforces immediate-next-only handoff:
|
|
236
|
-
|
|
237
|
-
```
|
|
238
|
-
/workflow-next plan docs/plans/2026-02-10-my-feature-design.md
|
|
239
|
-
/workflow-next execute docs/plans/2026-02-11-my-feature-implementation.md
|
|
240
|
-
/workflow-next finalize
|
|
241
|
-
```
|
|
242
|
-
|
|
243
|
-
Valid phases: `brainstorm`, `plan`, `execute`, `finalize`.
|
|
244
|
-
|
|
245
|
-
Handoff rules:
|
|
246
|
-
- Only the **immediate next** phase is allowed (e.g. `plan → execute`, `execute → finalize`).
|
|
247
|
-
- The current phase must be **complete** before handing off.
|
|
248
|
-
- Same-phase, backward, and direct-jump transitions are rejected.
|
|
249
|
-
- Prior completed phases, artifacts, and prompted flags are **preserved** in the new session.
|
|
250
|
-
- TDD, debug, and verification state start **fresh** in the new session.
|
|
251
|
-
|
|
252
|
-
#### Reference Tool
|
|
253
|
-
|
|
254
|
-
Serves detailed guidance on demand, keeping skill files lean while making reference content available when the agent needs it:
|
|
255
|
-
|
|
256
|
-
```
|
|
257
|
-
workflow_reference({ topic: "tdd-rationalizations" }) - Why order matters, excuse table
|
|
258
|
-
workflow_reference({ topic: "tdd-examples" }) - Good/bad code examples, bug fix walkthrough
|
|
259
|
-
workflow_reference({ topic: "tdd-when-stuck" }) - Blocker solutions, verification checklist
|
|
260
|
-
workflow_reference({ topic: "tdd-anti-patterns" }) - Mock pitfalls, test-only methods
|
|
261
|
-
workflow_reference({ topic: "debug-rationalizations" }) - Why investigation-first matters
|
|
262
|
-
workflow_reference({ topic: "debug-tracing" }) - Root cause tracing technique
|
|
263
|
-
workflow_reference({ topic: "debug-defense-in-depth" }) - Multi-layer validation after fix
|
|
264
|
-
workflow_reference({ topic: "debug-condition-waiting" }) - Replace timeouts with conditions
|
|
265
|
-
```
|
|
266
|
-
|
|
267
|
-
### Task Tracker
|
|
268
|
-
|
|
269
|
-
The `plan_tracker` tool stores task state in the session and shows progress in the TUI:
|
|
270
|
-
|
|
271
|
-
```
|
|
272
|
-
Tasks: ✓✓→○○ (2/5) Update docs 📋 — verify
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
```
|
|
276
|
-
plan_tracker({
|
|
277
|
-
action: "init",
|
|
278
|
-
tasks: [
|
|
279
|
-
{ name: "Task 1: Setup", type: "code" },
|
|
280
|
-
{ name: "Task 2: Docs", type: "non-code" },
|
|
281
|
-
],
|
|
282
|
-
})
|
|
283
|
-
plan_tracker({ action: "update", index: 0, status: "complete" })
|
|
284
|
-
plan_tracker({ action: "update", index: 1, phase: "execute", attempts: 1 })
|
|
285
|
-
plan_tracker({ action: "update", index: 1, phase: "fix", attempts: 1 })
|
|
286
|
-
plan_tracker({ action: "status" })
|
|
287
|
-
plan_tracker({ action: "clear" })
|
|
288
|
-
```
|
|
289
|
-
|
|
290
|
-
## How Skills and Extensions Work Together
|
|
291
|
-
|
|
292
|
-
Skills are markdown files the agent reads to learn *what* to do. Extensions are TypeScript modules that *enforce* the discipline in real time.
|
|
293
|
-
|
|
294
|
-
| Agent Behavior | Skill (teaches) | Extension (enforces) |
|
|
295
|
-
|---|---|---|
|
|
296
|
-
| Write test before code | `test-driven-development` (three-scenario) | TDD monitor warns on violation (advisory) |
|
|
297
|
-
| Investigate before fixing | `systematic-debugging` | Debug monitor warns on fix-without-investigation |
|
|
298
|
-
| Follow per-task lifecycle | `executing-tasks` | Plan tracker tracks per-task phase and attempts |
|
|
299
|
-
| Follow workflow phases | All skills cross-reference each other | Workflow tracker detects phases, prompts at boundaries |
|
|
300
|
-
The orchestrating agent's enforcement is advisory (warnings injected into tool results).
|
|
301
|
-
|
|
302
|
-
## Subagent Dispatch
|
|
303
|
-
|
|
304
|
-
A bundled `subagent` tool lets the orchestrating agent spawn isolated subprocess agents for implementation and review tasks. No external dependencies required.
|
|
305
|
-
|
|
306
|
-
### Bundled Agents
|
|
307
|
-
|
|
308
|
-
| Agent | Purpose | Tools | Extensions |
|
|
309
|
-
|-------|---------|-------|------------|
|
|
310
|
-
| `implementer` | Strict TDD implementation | read, write, edit, bash, plan_tracker, workflow_reference | workflow-monitor, plan-tracker |
|
|
311
|
-
| `worker` | General-purpose task execution | read, write, edit, bash, plan_tracker, workflow_reference | workflow-monitor, plan-tracker |
|
|
312
|
-
| `code-reviewer` | Production readiness review | read, bash, find, grep, ls | — |
|
|
313
|
-
| `spec-reviewer` | Plan/spec compliance check | read, bash, find, grep, ls | — |
|
|
314
|
-
|
|
315
|
-
Agent definitions live in `agents/*.md` and use YAML frontmatter to declare tools, model, extensions, and a system prompt body.
|
|
316
|
-
|
|
317
|
-
### Model Selection Precedence
|
|
318
|
-
|
|
319
|
-
When the `subagent` tool launches a child `pi` process, it resolves the model in this order:
|
|
320
|
-
|
|
321
|
-
1. Agent frontmatter `model:`
|
|
322
|
-
2. The parent session's current provider + model
|
|
323
|
-
3. Bundled fallback `DEFAULT_MODEL`
|
|
324
|
-
|
|
325
|
-
If a subagent inherits the parent session model, Pi passes both `--provider` and `--model` to the child process to avoid ambiguous cross-provider lookups.
|
|
326
|
-
|
|
327
|
-
### Single Agent
|
|
328
|
-
|
|
329
|
-
```ts
|
|
330
|
-
subagent({
|
|
331
|
-
agent: "implementer",
|
|
332
|
-
task: "Implement the retry logic per docs/plans/retry-plan.md Task 3",
|
|
333
|
-
agentScope: "both",
|
|
334
|
-
})
|
|
335
|
-
```
|
|
336
|
-
|
|
337
|
-
### Parallel Tasks
|
|
338
|
-
|
|
339
|
-
```ts
|
|
340
|
-
subagent({
|
|
341
|
-
tasks: [
|
|
342
|
-
{ agent: "worker", task: "Fix failing test in auth.test.ts" },
|
|
343
|
-
{ agent: "worker", task: "Fix failing test in cache.test.ts" },
|
|
344
|
-
],
|
|
345
|
-
})
|
|
346
|
-
```
|
|
347
|
-
|
|
348
|
-
### Structured Results
|
|
349
|
-
|
|
350
|
-
Single-agent results include:
|
|
351
|
-
- `filesChanged` — list of files written/edited
|
|
352
|
-
- `testsRan` — whether any test commands were executed
|
|
353
|
-
- `status` — `"completed"` or `"failed"`
|
|
354
|
-
|
|
355
|
-
### Custom Agents
|
|
28
|
+
You control each phase explicitly by invoking the skill:
|
|
356
29
|
|
|
357
|
-
|
|
30
|
+
| Phase | Command | What Happens |
|
|
31
|
+
|-------|---------|--------------|
|
|
32
|
+
| **Brainstorm** | `/skill:brainstorming` | Refine your idea into a design doc via collaborative dialogue |
|
|
33
|
+
| **Plan** | `/skill:writing-plans` | Break the design into bite-sized TDD tasks with exact file paths and code |
|
|
34
|
+
| **Execute** | `/skill:executing-tasks` | Implement the plan task-by-task with TDD discipline |
|
|
35
|
+
| **Finalize** | `/skill:finalizing` | Archive plan docs, update README/CHANGELOG, create PR |
|
|
358
36
|
|
|
359
|
-
|
|
360
|
-
---
|
|
361
|
-
name: my-agent
|
|
362
|
-
description: What this agent does
|
|
363
|
-
tools: read, write, edit, bash
|
|
364
|
-
model: claude-sonnet-4-5
|
|
365
|
-
extensions: ../extensions/my-guard.ts
|
|
366
|
-
---
|
|
37
|
+
During brainstorm and plan, the extension blocks `write`/`edit` outside `docs/plans/`. During execute and finalize, all tools are available.
|
|
367
38
|
|
|
368
|
-
|
|
369
|
-
```
|
|
370
|
-
|
|
371
|
-
If `model:` is omitted, the agent will inherit the parent session's current model when available, and only fall back to the bundled default if there is no active session model.
|
|
372
|
-
|
|
373
|
-
### Troubleshooting
|
|
39
|
+
### Skills
|
|
374
40
|
|
|
375
|
-
|
|
41
|
+
| Skill | Lines | Description |
|
|
42
|
+
|-------|------:|-------------|
|
|
43
|
+
| `brainstorming` | ~30 | Explore the idea, propose approaches, write design doc |
|
|
44
|
+
| `writing-plans` | ~35 | Break design into tasks with TDD scenarios, set up branch/worktree |
|
|
45
|
+
| `executing-tasks` | ~40 | Implement tasks with TDD discipline, handle code review |
|
|
46
|
+
| `finalizing` | ~20 | Archive docs, update changelog, create PR, clean up |
|
|
376
47
|
|
|
377
|
-
|
|
48
|
+
### TDD Three-Scenario Model
|
|
378
49
|
|
|
379
|
-
|
|
50
|
+
The plan labels each task with its TDD scenario:
|
|
380
51
|
|
|
381
|
-
|
|
|
382
|
-
|
|
383
|
-
|
|
|
384
|
-
|
|
|
385
|
-
|
|
|
386
|
-
| **TDD widget** | — | — | TUI: RED → GREEN → REFACTOR |
|
|
387
|
-
| **Debug enforcement** | Manual discipline | Manual discipline | Extension escalates after repeated failures |
|
|
388
|
-
| **Verification gating** | — | — | Warns and gates commit/push/PR flows until tests pass |
|
|
389
|
-
| **Workflow tracking** | — | — | Phase strip, boundary prompts, `/workflow-next` |
|
|
390
|
-
| **Subagent dispatch** | — | — | Bundled `subagent` tool + 4 agent definitions |
|
|
391
|
-
| **TDD in subagents** | — | — | Three-scenario TDD instructions in agent profiles + prompt templates + runtime warnings |
|
|
392
|
-
| **Structured results** | — | — | filesChanged, testsRan per agent |
|
|
393
|
-
| **Reference content** | Everything in SKILL.md | Everything in SKILL.md | Inline guidance + on-demand `workflow_reference` tool for extended detail |
|
|
394
|
-
| **Task tracker** | — | — | `plan_tracker` tool with TUI progress widget |
|
|
52
|
+
| Scenario | When | Rule |
|
|
53
|
+
|----------|------|------|
|
|
54
|
+
| New feature | Adding new behavior | Write failing test → implement → pass |
|
|
55
|
+
| Modifying tested code | Changing existing behavior | Run existing tests first → modify → verify |
|
|
56
|
+
| Trivial | Config, docs, naming | Use judgment |
|
|
395
57
|
|
|
396
58
|
## Architecture
|
|
397
59
|
|
|
398
60
|
```
|
|
399
61
|
pi-workflow-kit/
|
|
400
|
-
├── agents/ # Bundled agent definitions + shared config
|
|
401
|
-
│ ├── implementer.md # Strict TDD implementation agent
|
|
402
|
-
│ ├── worker.md # General-purpose task agent
|
|
403
|
-
│ ├── code-reviewer.md # Production readiness reviewer
|
|
404
|
-
│ ├── spec-reviewer.md # Plan/spec compliance reviewer
|
|
405
|
-
│ └── config.ts # Shared bundled-agent defaults
|
|
406
|
-
├── docs/ # Repo documentation referenced by README
|
|
407
62
|
├── extensions/
|
|
408
|
-
│
|
|
409
|
-
|
|
410
|
-
│ ├──
|
|
411
|
-
│ ├──
|
|
412
|
-
│ ├──
|
|
413
|
-
│
|
|
414
|
-
|
|
415
|
-
│
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
│ │ ├── workflow-handler.ts # Testable core logic (combines monitors)
|
|
419
|
-
│ │ ├── heuristics.ts # File classification (test vs source)
|
|
420
|
-
│ │ ├── test-runner.ts # Test command/result detection
|
|
421
|
-
│ │ ├── investigation.ts # Investigation signal detection
|
|
422
|
-
│ │ ├── git.ts # Git branch/SHA detection (branch safety)
|
|
423
|
-
│ │ ├── warnings.ts # Violation warning content
|
|
424
|
-
│ │ ├── skip-confirmation.ts # Phase-skip confirmation logic
|
|
425
|
-
│ │ └── reference-tool.ts # On-demand reference loading
|
|
426
|
-
│ └── subagent/
|
|
427
|
-
│ ├── index.ts # Subagent tool registration + execution
|
|
428
|
-
│ ├── agents.ts # Agent discovery + frontmatter parsing
|
|
429
|
-
│ ├── concurrency.ts # Parallelism limits
|
|
430
|
-
│ ├── env.ts # Subprocess environment shaping
|
|
431
|
-
│ ├── lifecycle.ts # Child-process cleanup tracking
|
|
432
|
-
│ └── timeout.ts # Timeout resolution
|
|
433
|
-
├── skills/ # 8 workflow skills
|
|
434
|
-
│ ├── brainstorming/
|
|
435
|
-
│ ├── writing-plans/
|
|
436
|
-
│ ├── executing-tasks/
|
|
437
|
-
│ ├── test-driven-development/
|
|
438
|
-
│ ├── systematic-debugging/
|
|
439
|
-
│ ├── receiving-code-review/
|
|
440
|
-
│ ├── dispatching-parallel-agents/
|
|
441
|
-
│ └── using-git-worktrees/
|
|
442
|
-
└── tests/ # 434 tests across 42 files
|
|
63
|
+
│ └── workflow-guard.ts # Write blocker during brainstorm/plan
|
|
64
|
+
├── skills/
|
|
65
|
+
│ ├── brainstorming/SKILL.md
|
|
66
|
+
│ ├── writing-plans/SKILL.md
|
|
67
|
+
│ ├── executing-tasks/SKILL.md
|
|
68
|
+
│ └── finalizing/SKILL.md
|
|
69
|
+
├── tests/
|
|
70
|
+
│ └── workflow-guard.test.ts
|
|
71
|
+
├── package.json
|
|
72
|
+
└── README.md
|
|
443
73
|
```
|
|
444
74
|
|
|
445
75
|
## Development
|
|
446
76
|
|
|
447
77
|
```bash
|
|
448
|
-
npm test
|
|
449
|
-
npx vitest run tests/extension/workflow-monitor/tdd-monitor.test.ts # Run one file
|
|
450
|
-
```
|
|
451
|
-
|
|
452
|
-
## Publishing releases
|
|
453
|
-
|
|
454
|
-
Package name:
|
|
455
|
-
|
|
456
|
-
```text
|
|
457
|
-
@tianhai/pi-workflow-kit
|
|
458
|
-
```
|
|
459
|
-
|
|
460
|
-
Publish the rebranded package as:
|
|
461
|
-
|
|
462
|
-
```bash
|
|
463
|
-
npm publish --access public
|
|
464
|
-
```
|
|
465
|
-
|
|
466
|
-
Typical release flow:
|
|
467
|
-
|
|
468
|
-
```bash
|
|
469
|
-
npm run check
|
|
470
|
-
npm version patch
|
|
471
|
-
git push origin main --follow-tags
|
|
472
|
-
```
|
|
473
|
-
|
|
474
|
-
### Release checklist
|
|
475
|
-
|
|
476
|
-
- [ ] `package.json` has the correct name: `@tianhai/pi-workflow-kit`
|
|
477
|
-
- [ ] `repository.url` points to `https://github.com/yinloo-ola/pi-workflow-kit.git`
|
|
478
|
-
- [ ] `npm run check` passes locally
|
|
479
|
-
- [ ] `npm pack --dry-run` shows the expected files
|
|
480
|
-
- [ ] you are logged into npm with an account that can publish the package
|
|
481
|
-
- [ ] npm trusted publishing is configured for this GitHub repo, or you are publishing manually
|
|
482
|
-
- [ ] the version bump matches the release scope (`patch`, `minor`, or `major`)
|
|
483
|
-
- [ ] the git tag created by `npm version` is pushed with `--follow-tags`
|
|
484
|
-
- [ ] install instructions in the README still match the package name
|
|
485
|
-
|
|
486
|
-
### Manual publish
|
|
487
|
-
|
|
488
|
-
```bash
|
|
489
|
-
npm run check
|
|
490
|
-
npm pack --dry-run
|
|
491
|
-
npm publish --access public
|
|
492
|
-
```
|
|
493
|
-
|
|
494
|
-
### GitHub Actions publish
|
|
495
|
-
|
|
496
|
-
If GitHub trusted publishing is configured for this repo, pushing a `v*` tag will trigger `.github/workflows/publish.yml`.
|
|
497
|
-
|
|
498
|
-
```bash
|
|
499
|
-
npm run check
|
|
500
|
-
npm version patch
|
|
501
|
-
git push origin main --follow-tags
|
|
78
|
+
npm test
|
|
502
79
|
```
|
|
503
80
|
|
|
504
|
-
Users should then install with:
|
|
505
|
-
|
|
506
|
-
```bash
|
|
507
|
-
pi install npm:@tianhai/pi-workflow-kit
|
|
508
|
-
```
|
|
509
|
-
|
|
510
|
-
## Attribution
|
|
511
|
-
|
|
512
|
-
Skill content adapted from [Superpowers](https://github.com/obra/superpowers) by Jesse Vincent (MIT). This package builds on `pi-superpowers` with active enforcement extensions, leaner skill files, on-demand reference content, and workflow tracking.
|
|
513
|
-
|
|
514
|
-
## Migration from `@yinlootan/pi-superpowers-plus`
|
|
515
|
-
|
|
516
|
-
Replace the old package name with:
|
|
517
|
-
|
|
518
|
-
```json
|
|
519
|
-
{
|
|
520
|
-
"packages": ["npm:@tianhai/pi-workflow-kit"]
|
|
521
|
-
}
|
|
522
|
-
```
|
|
523
|
-
|
|
524
|
-
Runtime contracts remain unchanged in this rebrand:
|
|
525
|
-
- `plan_tracker`
|
|
526
|
-
- `workflow_reference`
|
|
527
|
-
- `/workflow-next`
|
|
528
|
-
- `/workflow-reset`
|
|
529
|
-
- existing skill names
|
|
530
|
-
|
|
531
81
|
## License
|
|
532
82
|
|
|
533
|
-
MIT
|
|
83
|
+
MIT
|