@tianhai/pi-workflow-kit 0.4.1

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.
Files changed (54) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +509 -0
  3. package/ROADMAP.md +16 -0
  4. package/agents/code-reviewer.md +18 -0
  5. package/agents/config.ts +5 -0
  6. package/agents/implementer.md +26 -0
  7. package/agents/spec-reviewer.md +13 -0
  8. package/agents/worker.md +17 -0
  9. package/banner.jpg +0 -0
  10. package/docs/developer-usage-guide.md +463 -0
  11. package/docs/oversight-model.md +49 -0
  12. package/docs/workflow-phases.md +71 -0
  13. package/extensions/constants.ts +9 -0
  14. package/extensions/lib/logging.ts +138 -0
  15. package/extensions/plan-tracker.ts +496 -0
  16. package/extensions/subagent/agents.ts +144 -0
  17. package/extensions/subagent/concurrency.ts +52 -0
  18. package/extensions/subagent/env.ts +47 -0
  19. package/extensions/subagent/index.ts +1116 -0
  20. package/extensions/subagent/lifecycle.ts +25 -0
  21. package/extensions/subagent/timeout.ts +13 -0
  22. package/extensions/workflow-monitor/debug-monitor.ts +98 -0
  23. package/extensions/workflow-monitor/git.ts +31 -0
  24. package/extensions/workflow-monitor/heuristics.ts +58 -0
  25. package/extensions/workflow-monitor/investigation.ts +52 -0
  26. package/extensions/workflow-monitor/reference-tool.ts +42 -0
  27. package/extensions/workflow-monitor/skip-confirmation.ts +19 -0
  28. package/extensions/workflow-monitor/tdd-monitor.ts +137 -0
  29. package/extensions/workflow-monitor/test-runner.ts +37 -0
  30. package/extensions/workflow-monitor/verification-monitor.ts +61 -0
  31. package/extensions/workflow-monitor/warnings.ts +81 -0
  32. package/extensions/workflow-monitor/workflow-handler.ts +358 -0
  33. package/extensions/workflow-monitor/workflow-tracker.ts +231 -0
  34. package/extensions/workflow-monitor/workflow-transitions.ts +55 -0
  35. package/extensions/workflow-monitor.ts +885 -0
  36. package/package.json +49 -0
  37. package/skills/brainstorming/SKILL.md +70 -0
  38. package/skills/dispatching-parallel-agents/SKILL.md +194 -0
  39. package/skills/executing-tasks/SKILL.md +247 -0
  40. package/skills/receiving-code-review/SKILL.md +196 -0
  41. package/skills/systematic-debugging/SKILL.md +170 -0
  42. package/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
  43. package/skills/systematic-debugging/condition-based-waiting.md +115 -0
  44. package/skills/systematic-debugging/defense-in-depth.md +122 -0
  45. package/skills/systematic-debugging/find-polluter.sh +63 -0
  46. package/skills/systematic-debugging/reference/rationalizations.md +61 -0
  47. package/skills/systematic-debugging/root-cause-tracing.md +169 -0
  48. package/skills/test-driven-development/SKILL.md +266 -0
  49. package/skills/test-driven-development/reference/examples.md +101 -0
  50. package/skills/test-driven-development/reference/rationalizations.md +67 -0
  51. package/skills/test-driven-development/reference/when-stuck.md +33 -0
  52. package/skills/test-driven-development/testing-anti-patterns.md +299 -0
  53. package/skills/using-git-worktrees/SKILL.md +231 -0
  54. package/skills/writing-plans/SKILL.md +149 -0
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 coctostan
4
+ Copyright (c) 2025 Jesse Vincent (original skill content from obra/superpowers)
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,509 @@
1
+ # pi-workflow-kit
2
+
3
+ ![pi-workflow-kit banner](banner-plus.jpg)
4
+
5
+ Structured workflow skills and active enforcement extensions for [pi](https://github.com/badlogic/pi-mono).
6
+
7
+ Your coding agent doesn't just know the rules - it follows them. Skills teach the agent *what* to do (brainstorm before building, write tests before code, verify before claiming done). Extensions reinforce that workflow in real time with warnings, prompts, state tracking, and shipping-time verification checks.
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
+ ```
38
+
39
+ ### From a git repository
40
+
41
+ ```bash
42
+ pi install git:github.com/yinloo-ola/pi-workflow-kit.git
43
+ ```
44
+
45
+ ### From **your own maintained repo or fork**
46
+
47
+ If you want to maintain your own version of this package, install directly from your repository instead of the upstream one. For this repo, the maintained git install target is:
48
+
49
+ ```bash
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
+ ```
58
+
59
+ Examples:
60
+
61
+ ```bash
62
+ pi install git:github.com/acme/pi-workflow-kit.git
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`](https://github.com/coctostan/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
+ }
117
+ ```
118
+
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
+ ## The Workflow
146
+
147
+ The skills guide the agent through a consistent development cycle:
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:
236
+ ```
237
+ /workflow-next plan docs/plans/2026-02-10-my-feature-design.md
238
+ /workflow-next execute docs/plans/2026-02-11-my-feature-implementation.md
239
+ /workflow-next finalize
240
+ ```
241
+
242
+ Valid phases: `brainstorm`, `plan`, `execute`, `finalize`.
243
+
244
+ #### Reference Tool
245
+
246
+ Serves detailed guidance on demand, keeping skill files lean while making reference content available when the agent needs it:
247
+
248
+ ```
249
+ workflow_reference({ topic: "tdd-rationalizations" }) - Why order matters, excuse table
250
+ workflow_reference({ topic: "tdd-examples" }) - Good/bad code examples, bug fix walkthrough
251
+ workflow_reference({ topic: "tdd-when-stuck" }) - Blocker solutions, verification checklist
252
+ workflow_reference({ topic: "tdd-anti-patterns" }) - Mock pitfalls, test-only methods
253
+ workflow_reference({ topic: "debug-rationalizations" }) - Why investigation-first matters
254
+ workflow_reference({ topic: "debug-tracing" }) - Root cause tracing technique
255
+ workflow_reference({ topic: "debug-defense-in-depth" }) - Multi-layer validation after fix
256
+ workflow_reference({ topic: "debug-condition-waiting" }) - Replace timeouts with conditions
257
+ ```
258
+
259
+ ### Task Tracker
260
+
261
+ The `plan_tracker` tool stores task state in the session and shows progress in the TUI:
262
+
263
+ ```
264
+ Tasks: ✓✓→○○ (2/5) Update docs 📋 — verify
265
+ ```
266
+
267
+ ```
268
+ plan_tracker({
269
+ action: "init",
270
+ tasks: [
271
+ { name: "Task 1: Setup", type: "code" },
272
+ { name: "Task 2: Docs", type: "non-code" },
273
+ ],
274
+ })
275
+ plan_tracker({ action: "update", index: 0, status: "complete" })
276
+ plan_tracker({ action: "update", index: 1, phase: "execute", attempts: 1 })
277
+ plan_tracker({ action: "update", index: 1, phase: "fix", attempts: 1 })
278
+ plan_tracker({ action: "status" })
279
+ plan_tracker({ action: "clear" })
280
+ ```
281
+
282
+ ## How Skills and Extensions Work Together
283
+
284
+ Skills are markdown files the agent reads to learn *what* to do. Extensions are TypeScript modules that *enforce* the discipline in real time.
285
+
286
+ | Agent Behavior | Skill (teaches) | Extension (enforces) |
287
+ |---|---|---|
288
+ | Write test before code | `test-driven-development` (three-scenario) | TDD monitor warns on violation (advisory) |
289
+ | Investigate before fixing | `systematic-debugging` | Debug monitor warns on fix-without-investigation |
290
+ | Follow per-task lifecycle | `executing-tasks` | Plan tracker tracks per-task phase and attempts |
291
+ | Follow workflow phases | All skills cross-reference each other | Workflow tracker detects phases, prompts at boundaries |
292
+ The orchestrating agent's enforcement is advisory (warnings injected into tool results).
293
+
294
+ ## Subagent Dispatch
295
+
296
+ A bundled `subagent` tool lets the orchestrating agent spawn isolated subprocess agents for implementation and review tasks. No external dependencies required.
297
+
298
+ ### Bundled Agents
299
+
300
+ | Agent | Purpose | Tools | Extensions |
301
+ |-------|---------|-------|------------|
302
+ | `implementer` | Strict TDD implementation | read, write, edit, bash, plan_tracker, workflow_reference | workflow-monitor, plan-tracker |
303
+ | `worker` | General-purpose task execution | read, write, edit, bash, plan_tracker, workflow_reference | workflow-monitor, plan-tracker |
304
+ | `code-reviewer` | Production readiness review | read, bash, find, grep, ls | — |
305
+ | `spec-reviewer` | Plan/spec compliance check | read, bash, find, grep, ls | — |
306
+
307
+ Agent definitions live in `agents/*.md` and use YAML frontmatter to declare tools, model, extensions, and a system prompt body.
308
+
309
+ ### Single Agent
310
+
311
+ ```ts
312
+ subagent({
313
+ agent: "implementer",
314
+ task: "Implement the retry logic per docs/plans/retry-plan.md Task 3",
315
+ agentScope: "both",
316
+ })
317
+ ```
318
+
319
+ ### Parallel Tasks
320
+
321
+ ```ts
322
+ subagent({
323
+ tasks: [
324
+ { agent: "worker", task: "Fix failing test in auth.test.ts" },
325
+ { agent: "worker", task: "Fix failing test in cache.test.ts" },
326
+ ],
327
+ })
328
+ ```
329
+
330
+ ### Structured Results
331
+
332
+ Single-agent results include:
333
+ - `filesChanged` — list of files written/edited
334
+ - `testsRan` — whether any test commands were executed
335
+ - `status` — `"completed"` or `"failed"`
336
+
337
+ ### Custom Agents
338
+
339
+ Add `.md` files to a `.pi/agents/` directory in your project. They override bundled agents of the same name when `agentScope` includes project agents. Frontmatter fields:
340
+
341
+ ```yaml
342
+ ---
343
+ name: my-agent
344
+ description: What this agent does
345
+ tools: read, write, edit, bash
346
+ model: claude-sonnet-4-5
347
+ extensions: ../extensions/my-guard.ts
348
+ ---
349
+
350
+ System prompt body here.
351
+ ```
352
+
353
+ ## Compared to Superpowers
354
+
355
+ Based on [Superpowers](https://github.com/obra/superpowers) by Jesse Vincent, ported to pi as [pi-superpowers](https://github.com/coctostan/pi-superpowers), then extended with active enforcement.
356
+
357
+ | | [Superpowers](https://github.com/obra/superpowers) | [pi-superpowers](https://github.com/coctostan/pi-superpowers) | **pi-workflow-kit** |
358
+ |---|---|---|---|
359
+ | **Platform** | Claude Code | pi | pi |
360
+ | **Skills** | 8 workflow skills | Same 12 skills (pi port) → now 8 skills (simplified workflow) | **8 skills** (simplified: 4-phase workflow with unified executing-tasks) |
361
+ | **TDD enforcement** | Skill tells agent the rules | Skill tells agent the rules | Extension *watches* and injects warnings |
362
+ | **TDD widget** | — | — | TUI: RED → GREEN → REFACTOR |
363
+ | **Debug enforcement** | Manual discipline | Manual discipline | Extension escalates after repeated failures |
364
+ | **Verification gating** | — | — | Warns and gates commit/push/PR flows until tests pass |
365
+ | **Workflow tracking** | — | — | Phase strip, boundary prompts, `/workflow-next` |
366
+ | **Subagent dispatch** | — | — | Bundled `subagent` tool + 4 agent definitions |
367
+ | **TDD in subagents** | — | — | Three-scenario TDD instructions in agent profiles + prompt templates + runtime warnings |
368
+ | **Structured results** | — | — | filesChanged, testsRan per agent |
369
+ | **Reference content** | Everything in SKILL.md | Everything in SKILL.md | Inline guidance + on-demand `workflow_reference` tool for extended detail |
370
+ | **Task tracker** | — | — | `plan_tracker` tool with TUI progress widget |
371
+
372
+ ## Architecture
373
+
374
+ ```
375
+ pi-workflow-kit/
376
+ ├── agents/ # Bundled agent definitions + shared config
377
+ │ ├── implementer.md # Strict TDD implementation agent
378
+ │ ├── worker.md # General-purpose task agent
379
+ │ ├── code-reviewer.md # Production readiness reviewer
380
+ │ ├── spec-reviewer.md # Plan/spec compliance reviewer
381
+ │ └── config.ts # Shared bundled-agent defaults
382
+ ├── docs/ # Repo documentation referenced by README
383
+ ├── extensions/
384
+ │ ├── lib/
385
+ │ │ └── logging.ts # File-based diagnostic logger
386
+ │ ├── plan-tracker.ts # Task tracking tool + TUI widget
387
+ │ ├── workflow-monitor.ts # Extension entry point (event wiring)
388
+ │ ├── workflow-monitor/
389
+ │ │ ├── tdd-monitor.ts # TDD phase state machine
390
+ │ │ ├── debug-monitor.ts # Debug mode escalation
391
+ │ │ ├── verification-monitor.ts # Commit/push/PR checks
392
+ │ │ ├── workflow-tracker.ts # Workflow phase tracking + skill resolution
393
+ │ │ ├── workflow-transitions.ts # Phase boundary prompt definitions
394
+ │ │ ├── workflow-handler.ts # Testable core logic (combines monitors)
395
+ │ │ ├── heuristics.ts # File classification (test vs source)
396
+ │ │ ├── test-runner.ts # Test command/result detection
397
+ │ │ ├── investigation.ts # Investigation signal detection
398
+ │ │ ├── git.ts # Git branch/SHA detection (branch safety)
399
+ │ │ ├── warnings.ts # Violation warning content
400
+ │ │ ├── skip-confirmation.ts # Phase-skip confirmation logic
401
+ │ │ └── reference-tool.ts # On-demand reference loading
402
+ │ └── subagent/
403
+ │ ├── index.ts # Subagent tool registration + execution
404
+ │ ├── agents.ts # Agent discovery + frontmatter parsing
405
+ │ ├── concurrency.ts # Parallelism limits
406
+ │ ├── env.ts # Subprocess environment shaping
407
+ │ ├── lifecycle.ts # Child-process cleanup tracking
408
+ │ └── timeout.ts # Timeout resolution
409
+ ├── skills/ # 8 workflow skills
410
+ │ ├── brainstorming/
411
+ │ ├── writing-plans/
412
+ │ ├── executing-tasks/
413
+ │ ├── test-driven-development/
414
+ │ ├── systematic-debugging/
415
+ │ ├── receiving-code-review/
416
+ │ ├── dispatching-parallel-agents/
417
+ │ └── using-git-worktrees/
418
+ └── tests/ # 434 tests across 42 files
419
+ ```
420
+
421
+ ## Development
422
+
423
+ ```bash
424
+ npm test # Run all tests
425
+ npx vitest run tests/extension/workflow-monitor/tdd-monitor.test.ts # Run one file
426
+ ```
427
+
428
+ ## Publishing releases
429
+
430
+ Package name:
431
+
432
+ ```text
433
+ @tianhai/pi-workflow-kit
434
+ ```
435
+
436
+ Publish the rebranded package as:
437
+
438
+ ```bash
439
+ npm publish --access public
440
+ ```
441
+
442
+ Typical release flow:
443
+
444
+ ```bash
445
+ npm run check
446
+ npm version patch
447
+ git push origin main --follow-tags
448
+ ```
449
+
450
+ ### Release checklist
451
+
452
+ - [ ] `package.json` has the correct name: `@tianhai/pi-workflow-kit`
453
+ - [ ] `repository.url` points to `https://github.com/yinloo-ola/pi-workflow-kit.git`
454
+ - [ ] `npm run check` passes locally
455
+ - [ ] `npm pack --dry-run` shows the expected files
456
+ - [ ] you are logged into npm with an account that can publish the package
457
+ - [ ] npm trusted publishing is configured for this GitHub repo, or you are publishing manually
458
+ - [ ] the version bump matches the release scope (`patch`, `minor`, or `major`)
459
+ - [ ] the git tag created by `npm version` is pushed with `--follow-tags`
460
+ - [ ] install instructions in the README still match the package name
461
+
462
+ ### Manual publish
463
+
464
+ ```bash
465
+ npm run check
466
+ npm pack --dry-run
467
+ npm publish --access public
468
+ ```
469
+
470
+ ### GitHub Actions publish
471
+
472
+ If GitHub trusted publishing is configured for this repo, pushing a `v*` tag will trigger `.github/workflows/publish.yml`.
473
+
474
+ ```bash
475
+ npm run check
476
+ npm version patch
477
+ git push origin main --follow-tags
478
+ ```
479
+
480
+ Users should then install with:
481
+
482
+ ```bash
483
+ pi install npm:@tianhai/pi-workflow-kit
484
+ ```
485
+
486
+ ## Attribution
487
+
488
+ Skill content adapted from [Superpowers](https://github.com/obra/superpowers) by Jesse Vincent (MIT). This package builds on [pi-superpowers](https://github.com/coctostan/pi-superpowers) with active enforcement extensions, leaner skill files, on-demand reference content, and workflow tracking.
489
+
490
+ ## Migration from `@yinlootan/pi-superpowers-plus`
491
+
492
+ Replace the old package name with:
493
+
494
+ ```json
495
+ {
496
+ "packages": ["npm:@tianhai/pi-workflow-kit"]
497
+ }
498
+ ```
499
+
500
+ Runtime contracts remain unchanged in this rebrand:
501
+ - `plan_tracker`
502
+ - `workflow_reference`
503
+ - `/workflow-next`
504
+ - `/workflow-reset`
505
+ - existing skill names
506
+
507
+ ## License
508
+
509
+ MIT - see [LICENSE](LICENSE) for details.
package/ROADMAP.md ADDED
@@ -0,0 +1,16 @@
1
+ # Roadmap
2
+
3
+ Short-term priorities for `pi-workflow-kit`:
4
+
5
+ - keep the simplified 4-phase workflow coherent across skills, extensions, and docs
6
+ - improve `executing-tasks` ergonomics for real feature delivery
7
+ - continue tightening workflow-monitor tests around phase transitions and handoffs
8
+ - improve README and reference docs so package behavior is easy to trust
9
+ - expand examples for non-code tasks and finalize flows
10
+
11
+ Longer-term possibilities:
12
+
13
+ - richer plan parsing helpers for typed task extraction
14
+ - deeper TUI support for active-task detail
15
+ - more bundled subagents for targeted review and maintenance tasks
16
+ - optional reporting/export of workflow state
@@ -0,0 +1,18 @@
1
+ ---
2
+ name: code-reviewer
3
+ description: "Production readiness review: quality, security, testing (read-only)"
4
+ tools: read, bash, find, grep, ls
5
+ ---
6
+
7
+ You are a code quality reviewer.
8
+
9
+ Review for:
10
+ - correctness, error handling
11
+ - maintainability
12
+ - security and footguns
13
+ - test coverage quality
14
+
15
+ Return:
16
+ - Strengths
17
+ - Issues (Critical/Important/Minor)
18
+ - Clear verdict (ready or not)
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Canonical model configuration for bundled agents.
3
+ * Change this one constant to update the default model for all bundled agents.
4
+ */
5
+ export const DEFAULT_MODEL = "claude-sonnet-4-5";
@@ -0,0 +1,26 @@
1
+ ---
2
+ name: implementer
3
+ description: Implement tasks via TDD and commit small changes
4
+ tools: read, write, edit, bash, plan_tracker, workflow_reference
5
+ extensions: ../extensions/workflow-monitor, ../extensions/plan-tracker
6
+ ---
7
+
8
+ You are an implementation subagent.
9
+
10
+ ## TDD Approach
11
+
12
+ Determine which scenario applies before writing code:
13
+
14
+ **New files / new features:** Full TDD. Write a failing test first, verify it fails, implement minimal code to pass, refactor.
15
+
16
+ **Modifying code with existing tests:** Run existing tests first to confirm green. Make your change. Run tests again. If the change isn't covered by existing tests, add a test. If it is, you're done.
17
+
18
+ **Trivial changes (typo, config, rename):** Use judgment. Run relevant tests after if they exist.
19
+
20
+ **If you see a ⚠️ TDD warning:** Pause. Consider which scenario applies. If existing tests cover your change, run them and proceed. If not, write a test first.
21
+
22
+ ## Rules
23
+ - Keep changes minimal and scoped to the task.
24
+ - Run the narrowest test(s) first, then the full suite when appropriate.
25
+ - Commit when the task's tests pass.
26
+ - Report: what changed, tests run, files changed, any concerns.
@@ -0,0 +1,13 @@
1
+ ---
2
+ name: spec-reviewer
3
+ description: Verify implementation matches the plan/spec (read-only)
4
+ tools: read, bash, find, grep, ls
5
+ ---
6
+
7
+ You are a spec compliance reviewer.
8
+
9
+ Check the implementation against the provided requirements.
10
+ - Identify missing requirements.
11
+ - Identify scope creep / unrequested changes.
12
+ - Point to exact files/lines and provide concrete fixes.
13
+ Return a clear verdict: ✅ compliant / ❌ not compliant.
@@ -0,0 +1,17 @@
1
+ ---
2
+ name: worker
3
+ description: General-purpose worker for isolated tasks
4
+ tools: read, write, edit, bash, plan_tracker, workflow_reference
5
+ extensions: ../extensions/workflow-monitor, ../extensions/plan-tracker
6
+ ---
7
+
8
+ You are a general-purpose subagent. Follow the task exactly.
9
+
10
+ ## TDD (when changing production code)
11
+
12
+ - New files: write a failing test first, then implement.
13
+ - Modifying existing code: run existing tests first, make your change, run again. Add tests if not covered.
14
+ - Trivial changes: run relevant tests after if they exist.
15
+ - If you see a ⚠️ TDD warning, pause and decide which scenario applies before proceeding.
16
+
17
+ Prefer small, test-backed changes.
package/banner.jpg ADDED
Binary file