@tianhai/pi-workflow-kit 0.18.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +79 -62
- package/agents/pwk-hazard-reviewer.md +24 -0
- package/agents/pwk-smell-reviewer.md +17 -0
- package/agents/pwk-spec-reviewer.md +14 -0
- package/agents/pwk-tracing-reviewer.md +14 -0
- package/docs/developer-usage-guide.md +39 -44
- package/docs/lessons.md +2 -7
- package/docs/oversight-model.md +20 -14
- package/docs/workflow-phases.md +64 -30
- package/extensions/workflow-guard.ts +194 -92
- package/package.json +20 -4
- package/skills/pwk-brainstorming/SKILL.md +30 -27
- package/skills/pwk-code-review/SKILL.md +46 -0
- package/skills/pwk-diagnose/SKILL.md +5 -2
- package/skills/pwk-executing-tasks/SKILL.md +92 -328
- package/skills/pwk-finalizing/SKILL.md +23 -106
- package/skills/pwk-status/SKILL.md +28 -0
- package/skills/pwk-writing-plans/SKILL.md +49 -328
- package/docs/plans/2026-06-03-karpathy-guidelines-ab-comparison.md +0 -166
- package/docs/plans/completed/2026-04-11-checkpoint-review-gates-design.md +0 -50
- package/docs/plans/completed/2026-04-11-checkpoint-review-gates-implementation.md +0 -98
- package/docs/plans/completed/2026-04-11-finalizing-merge-options-design.md +0 -33
- package/docs/plans/completed/2026-04-11-finalizing-merge-options-implementation.md +0 -75
- package/docs/plans/completed/2026-04-11-workspace-setup-design.md +0 -28
- package/docs/plans/completed/2026-04-11-workspace-setup-implementation.md +0 -57
- package/docs/plans/completed/2026-04-15-bash-guard-design.md +0 -39
- package/docs/plans/completed/2026-04-15-bash-guard-implementation.md +0 -229
- package/docs/plans/completed/2026-04-21-workflow-guard-safe-commands-design.md +0 -172
- package/docs/plans/completed/2026-04-21-workflow-guard-safe-commands-implementation.md +0 -168
- package/docs/plans/completed/2026-04-22-go-readonly-safe-commands-implementation.md +0 -54
- package/docs/plans/completed/2026-04-28-executing-tasks-redesign-design.md +0 -171
- package/docs/plans/completed/2026-04-28-executing-tasks-redesign-implementation.md +0 -208
- package/docs/plans/completed/2026-04-28-executing-tasks-redesign-progress.md +0 -14
- package/docs/plans/completed/2026-05-01-incorporate-mattpocock-skills-design.md +0 -154
- package/docs/plans/completed/2026-05-01-incorporate-mattpocock-skills-implementation.md +0 -315
- package/docs/plans/completed/2026-05-01-incorporate-mattpocock-skills-progress.md +0 -15
- package/docs/plans/completed/2026-05-08-checkpoint-gates-design.md +0 -235
- package/docs/plans/completed/2026-05-08-checkpoint-gates-implementation.md +0 -83
- package/docs/plans/completed/2026-05-08-checkpoint-gates-progress.md +0 -11
- package/docs/plans/completed/2026-05-08-lessons-learned-design.md +0 -76
- package/docs/plans/completed/2026-05-08-lessons-learned-implementation.md +0 -219
- package/docs/plans/completed/2026-05-08-lessons-learned-progress.md +0 -15
- package/docs/plans/completed/2026-05-08-migrate-earendil-works-design.md +0 -39
- package/docs/plans/completed/2026-05-08-migrate-earendil-works-implementation.md +0 -45
- package/docs/plans/completed/2026-05-08-migrate-earendil-works-progress.md +0 -10
- package/docs/plans/completed/2026-05-08-worktree-handoff-design.md +0 -118
- package/docs/plans/completed/2026-05-08-worktree-handoff-implementation.md +0 -140
- package/docs/plans/completed/2026-05-08-worktree-handoff-progress.md +0 -10
- package/docs/plans/completed/2026-05-20-generic-lessons-design.md +0 -70
- package/docs/plans/completed/2026-05-20-generic-lessons-implementation.md +0 -114
- package/docs/plans/completed/2026-05-20-generic-lessons-progress.md +0 -11
- package/docs/plans/completed/2026-05-22-agentic-agile-enhancements-design.md +0 -77
- package/docs/plans/completed/2026-05-22-agentic-agile-enhancements-implementation.md +0 -473
- package/docs/plans/completed/2026-05-25-design-review-split-implementation.md +0 -622
- package/docs/plans/completed/2026-05-25-design-review-split-progress.md +0 -16
- package/docs/plans/completed/2026-05-25-pr5-improvements-implementation.md +0 -273
- package/docs/plans/completed/2026-05-25-pr5-improvements-progress.md +0 -17
- package/docs/plans/completed/2026-06-03-add-verify-skill-design.md +0 -51
- package/docs/plans/completed/2026-06-03-add-verify-skill-implementation.md +0 -111
- package/docs/plans/completed/2026-06-03-add-verify-skill-progress.md +0 -11
- package/docs/plans/completed/2026-06-03-verify-skill-design.md +0 -176
- package/docs/plans/completed/2026-06-09-code-review-fixes-implementation.md +0 -74
- package/docs/plans/completed/2026-06-09-code-review-fixes-progress.md +0 -14
- package/docs/plans/completed/2026-06-09-incremental-workflow-and-rename-design.md +0 -186
- package/docs/plans/completed/2026-06-09-incremental-workflow-and-rename-implementation.md +0 -675
- package/docs/plans/completed/2026-06-09-incremental-workflow-and-rename-progress.md +0 -18
- package/docs/plans/completed/2026-06-09-incremental-workflow-and-rename-verification-report.md +0 -81
- package/docs/plans/completed/2026-06-09-verification-fixes-implementation.md +0 -69
- package/docs/plans/completed/2026-06-09-verification-fixes-progress.md +0 -14
- package/skills/pwk-design-review/SKILL.md +0 -115
- package/skills/pwk-verify/SKILL.md +0 -170
|
@@ -5,55 +5,58 @@ description: "Use this before any creative work — creating features, building
|
|
|
5
5
|
|
|
6
6
|
# Brainstorming
|
|
7
7
|
|
|
8
|
-
Read-only exploration
|
|
8
|
+
Read-only exploration of source code; every file you create or edit goes under `docs/plans/`. (Once an ADR is approved by the human, `docs/adr/` becomes writable too — ask the user to unlock or run the write.) Planning produces the document the executor builds from; source-writing happens in later phases.
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Proportionality: trivial vs non-trivial
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
2. **Understand the idea** — read existing code, docs, and recent commits. Grep for related functionality, check package.json/dependencies and module structure. **Check `docs/lessons.md`** if it exists — known constraints and patterns may affect the design. Read only what's necessary to ground the design — don't read the entire codebase. Ask questions to refine the idea. Prefer multiple choice when possible. After each question, check: can you clearly articulate (a) what the user wants to build, (b) why, and (c) key constraints? If yes, present your understanding as a short summary and ask: "Should I proceed with this, or is there more to add?" The human decides when to move on.
|
|
14
|
-
3. **Explore approaches** — propose 2-3 approaches. For each approach, sketch the concrete interface (types, method signatures, example caller code) so the comparison is grounded in actual code, not abstract descriptions. Lead with your recommendation.
|
|
15
|
-
4. **Present the design** — break it into focused sections. Each section should be one screen of reading. Present each section to the human and wait for approval before continuing. Cover: architecture, components, data flow, error handling, testing. On feedback, incorporate it and re-present the revised section.
|
|
12
|
+
Classify the change at the start.
|
|
16
13
|
|
|
17
|
-
|
|
14
|
+
- **Trivial** — typo or obvious bugfix with no open design questions, config/version bump, single-function change, or anything the human flags as trivial. Skip steps 3–5; write a **minimal** design doc in one turn (one-line context, a `## Requirements` list with the single requirement, optional `## Production-risk areas` line), and hand off to `/skill:pwk-writing-plans`. The guard still enforces read-only — trivial compresses the phase to one turn, it doesn't skip it.
|
|
15
|
+
- **Non-trivial** — open design questions, multiple approaches, cross-module impact, or new behavior. Run the full process below.
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
2. **Surprising without context** — a future reader will wonder "why?"
|
|
21
|
-
3. **A real trade-off** — there were genuine alternatives
|
|
17
|
+
When unsure, ask: "This looks trivial — fast-path it, or full brainstorm?" Default to full.
|
|
22
18
|
|
|
23
|
-
|
|
19
|
+
## Granularity
|
|
24
20
|
|
|
25
|
-
|
|
26
|
-
# <Short title of the decision>
|
|
21
|
+
**One design doc = one PR; one requirement = one testable slice within it.**
|
|
27
22
|
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
- Split into **multiple design docs** only when each part could ship as its own PR (independently reviewable and mergeable). Each runs its own plan → execute → finalize pipeline.
|
|
24
|
+
- Within a doc, decompose into **requirements**, each one testable behavior. Decision rule: could this part be reviewed and merged on its own? Yes → separate design doc. No → one doc, multiple requirements. Most work is a single doc; splitting is opt-in.
|
|
25
|
+
|
|
26
|
+
## Process
|
|
27
|
+
|
|
28
|
+
1. **Check git state** — `git status` + `git log --oneline -5`. Uncommitted work? Ask the user what to do first.
|
|
29
|
+
2. **Discovery** *(skip in a brand-new repo with no `docs/plans/`)* — glob `docs/plans/*-design.md`; report in-flight topics. If the new idea continues an existing topic, ask whether to extend it or start fresh.
|
|
30
|
+
3. **Understand the idea** — read only enough code/docs/commits to ground the design. **Check `docs/lessons.md`** — known constraints may shape it. Ask questions one at a time, prefer multiple choice. Once you can articulate what/why/constraints, present a short summary and ask: "Should I proceed, or is there more?" The human decides when to move on.
|
|
31
|
+
4. **Explore approaches** — propose 2–3, leading with your recommendation. Sketch the concrete interface (types, signatures, example caller) for each so the comparison is grounded in code, not abstractions.
|
|
32
|
+
5. **Present the design** in one pass, organized into sections (architecture, components, data flow, error handling, testing) — the human comments on any section; re-present only revised sections.
|
|
33
|
+
|
|
34
|
+
Identified a significant architectural decision? Offer an ADR in `docs/adr/`. Only when all three hold: **hard to reverse**, **surprising without context**, **a real trade-off**. Format: title + 1–3 sentences of context/decision/why. ADRs are permanent institutional memory — they stay out of archive/rotation forever. (Guard note: `docs/adr/` is outside the writable `docs/plans/`; write it only after the user approves and unlocks.)
|
|
35
|
+
6. **Write the design doc** — `docs/plans/YYYY-MM-DD-<topic>-design.md`, descriptive (not a task list). **Open with `## Requirements`** — one testable behavior each; `pwk-writing-plans` derives acceptance criteria and tests from these. Then: problem, approaches considered, architecture, components, data flow, error handling, testing.
|
|
30
36
|
|
|
31
|
-
|
|
37
|
+
Touches a production-risk area (DB schema/migrations, auth, external APIs, concurrency/batch, uploads/large data flows, Redis/caching/queues)? Add a brief `## Production-risk areas` — `pwk-writing-plans` carries it into the plan and `pwk-code-review` audits it per requirement.
|
|
32
38
|
|
|
33
|
-
|
|
39
|
+
**End with `## Feature acceptance`** — one or more end-to-end `Given/When/Then` scenarios proving the requirements *compose* into the feature. This is the feature's definition-of-done; the human approves it as what "the feature works" means. `pwk-writing-plans` derives a feature-level test from it; `pwk-executing-tasks` runs it at the integration gate. Treat "I can write this scenario" as the green light to finish designing — if you can't, keep designing because the requirements don't yet compose into a coherent feature.
|
|
34
40
|
|
|
35
|
-
Table format:
|
|
36
41
|
```markdown
|
|
37
|
-
##
|
|
42
|
+
## Feature acceptance
|
|
38
43
|
|
|
39
|
-
|
|
40
|
-
|---|---------|--------|---------------------|
|
|
41
|
-
| 1 | Feature name | ⬜ pending | What the user can do when this is complete |
|
|
44
|
+
- Given <starting state>, When <trigger>, Then <end-to-end outcome the feature promises>.
|
|
42
45
|
```
|
|
43
46
|
|
|
44
|
-
|
|
47
|
+
Example (rate limiting): "Given a new API consumer with no prior usage, When they exceed 100 requests/minute for 3 consecutive minutes, Then they're throttled, a `rate_limited` event is emitted, and further requests return 429."
|
|
45
48
|
|
|
46
|
-
|
|
49
|
+
**Splitting large issues:** propose multiple design docs (one `<topic>` per sub-issue) and get human approval first — see [Granularity](#granularity). Each runs its own pipeline.
|
|
47
50
|
|
|
48
|
-
|
|
51
|
+
The session stays read-only and uncommitted through brainstorm and plan: branch creation happens at the end of `/skill:pwk-writing-plans`; plan docs are committed at the start of `pwk-executing-tasks`.
|
|
49
52
|
|
|
50
53
|
## Principles
|
|
51
54
|
|
|
52
55
|
- One question at a time
|
|
53
56
|
- YAGNI — remove unnecessary features
|
|
54
57
|
- Design for testability
|
|
55
|
-
-
|
|
58
|
+
- Explore alternatives before settling
|
|
56
59
|
|
|
57
60
|
## After the design
|
|
58
61
|
|
|
59
|
-
Ask: "Ready to plan? Run `/skill:pwk-writing-plans`"
|
|
62
|
+
Ask: "Ready to plan? Run `/skill:pwk-writing-plans`"
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pwk-code-review
|
|
3
|
+
description: "Review a completed requirement's code — trace the logic, check spec alignment against the acceptance criteria, fix code smells, and run a production hazard check. Runs after each requirement in pwk-executing-tasks. Unlocked: may edit code to apply smell fixes."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Code Review
|
|
7
|
+
|
|
8
|
+
Review the code just implemented for a requirement. **Unlocked** — you may edit code to apply smell fixes; flag everything else as a follow-up.
|
|
9
|
+
|
|
10
|
+
## Process
|
|
11
|
+
|
|
12
|
+
1. **Identify the scope** — the requirement just completed (from the progress file / most recent commit). Read its acceptance criteria and integration tests from the plan doc. Run `git log --oneline -5` and `git diff` to see exactly what changed for this requirement.
|
|
13
|
+
|
|
14
|
+
2. **🔍 Code tracing** — trace the new/changed code paths end-to-end against the integration tests. For each path: does data flow correctly from entry to the asserted outcome? Note any branch the tests don't exercise, any dead branch, any path where the trace breaks.
|
|
15
|
+
|
|
16
|
+
3. **📐 Spec alignment** — for each acceptance criterion, point to the code and the test that satisfy it. A criterion with no covering code or no test is a **gap**. Code that does more than the criteria specify is **scope creep** — flag it.
|
|
17
|
+
|
|
18
|
+
4. **🧹 Code smells — fix these directly:**
|
|
19
|
+
- Shallow modules (interface nearly as complex as the implementation)
|
|
20
|
+
- Duplication
|
|
21
|
+
- Missing seams / premature abstraction
|
|
22
|
+
- Poor naming, magic values, dead code
|
|
23
|
+
Apply the fix, re-run the integration tests (must stay green), and commit. If a smell needs a refactor large enough to risk the requirement, **flag** it instead of applying.
|
|
24
|
+
|
|
25
|
+
5. **⚠️ Production hazard check** — audit the changed code against the high-risk hazards. For each, write `[SAFE]` (1-line justification) or `[TRIGGERED]` (concrete mitigation):
|
|
26
|
+
1. **Unbounded operations** — multi-key deletions/scans (`KEYS`, raw `SCAN` loops), or full-table loads filtered in memory.
|
|
27
|
+
2. **Missing indexes** — hot queries on unindexed columns (table scans under load).
|
|
28
|
+
3. **Unbounded concurrency** — unthrottled fan-out (`Promise.all` without batch limits).
|
|
29
|
+
4. **Long-running transactions** — holding DB connections/locks across slow external calls.
|
|
30
|
+
5. **Query/command interpolation** — raw variables merged into SQL or shell (injection).
|
|
31
|
+
6. **Unrestricted uploads / temp flooding** — uploads to local temp without limits or `finally` cleanup.
|
|
32
|
+
7. **Silent swallowing loops** — background workers catching and suppressing exceptions without logging/back-off.
|
|
33
|
+
Also check the design's `## Production-risk areas`, if any.
|
|
34
|
+
|
|
35
|
+
6. **Report** — summarize: tracing findings, spec gaps, smells fixed (with commits), hazards `[TRIGGERED]`. Non-trivial findings become follow-up items — the user decides whether to address now or defer.
|
|
36
|
+
7. **Mark done** — update the requirement's progress-file row from `🔎 review` to `✅ done`. Done means reviewed, not just committed.
|
|
37
|
+
|
|
38
|
+
## Principles
|
|
39
|
+
|
|
40
|
+
- **Tracing and spec alignment are the core** — they catch what tests miss: untested branches, missing criteria, scope creep.
|
|
41
|
+
- **Fix smells in place; flag everything else.** Keep the review scoped — the goal is polish on the requirement that just landed, not a redesign pass.
|
|
42
|
+
- **Be proportional** — a one-function change doesn't need the depth of a batch pipeline. When this skill runs as the inline path because the plan tagged the requirement `Review: inline`, that was a deliberate call at plan time — keep the review focused and don't second-guess the tag.
|
|
43
|
+
|
|
44
|
+
## After the review
|
|
45
|
+
|
|
46
|
+
Return to `/skill:pwk-executing-tasks` for the next requirement, or `/skill:pwk-finalizing` if all requirements are done.
|
|
@@ -7,6 +7,8 @@ description: "Disciplined debugging loop for hard bugs and performance regressio
|
|
|
7
7
|
|
|
8
8
|
A 6-phase debugging discipline. Phase 1 is the skill — spend disproportionate effort here.
|
|
9
9
|
|
|
10
|
+
Invoking `/skill:pwk-diagnose` **exits the gated brainstorm/plan phase** (the workflow guard unlocks) — diagnosis needs to write failing tests and `[DEBUG-…]` instrumentation. If you only wanted read-only investigation, use `/skill:pwk-status` (stays gated) or reinstate the lock with `/pwk-guard on`.
|
|
11
|
+
|
|
10
12
|
## Phase 1 — Build a feedback loop
|
|
11
13
|
|
|
12
14
|
Create a fast, deterministic, agent-runnable pass/fail signal for the bug before doing anything else. Try in this order: failing test, curl script, CLI invocation, headless browser script.
|
|
@@ -19,7 +21,7 @@ The loop must produce the failure mode the **user** described — not a nearby b
|
|
|
19
21
|
|
|
20
22
|
If you genuinely cannot build a loop, stop and say so. List what you tried. Ask for access to a reproducing environment or a captured artifact.
|
|
21
23
|
|
|
22
|
-
|
|
24
|
+
Hold at Phase 1 until you have a loop you believe in. Everything downstream — hypotheses, instrumentation, the fix — depends on that loop actually reproducing the user's symptom.
|
|
23
25
|
|
|
24
26
|
## Phase 2 — Reproduce
|
|
25
27
|
|
|
@@ -53,4 +55,5 @@ Required before declaring done:
|
|
|
53
55
|
- Regression test passes (or absence of seam is documented)
|
|
54
56
|
- All `[DEBUG-...]` instrumentation removed
|
|
55
57
|
- Ask: what would have prevented this bug?
|
|
56
|
-
- If the
|
|
58
|
+
- If the answer is a repeatable pattern, append a **generic** rule to `docs/lessons.md` (strip domain specifics) so future sessions catch it early.
|
|
59
|
+
- If the bug was caused by an architectural problem (no good test seam, tangled callers, hidden coupling), suggest writing an ADR to `docs/adr/` capturing that insight
|