@tianhai/pi-workflow-kit 0.17.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +91 -64
- package/agents/pwk-hazard-reviewer.md +24 -0
- package/agents/pwk-smell-reviewer.md +17 -0
- package/agents/pwk-spec-reviewer.md +14 -0
- package/agents/pwk-tracing-reviewer.md +14 -0
- package/docs/developer-usage-guide.md +49 -37
- package/docs/lessons.md +13 -0
- package/docs/oversight-model.md +19 -9
- package/docs/workflow-phases.md +58 -29
- package/extensions/workflow-guard.ts +190 -91
- package/package.json +19 -3
- package/skills/pwk-brainstorming/SKILL.md +60 -0
- package/skills/pwk-code-review/SKILL.md +46 -0
- package/skills/{diagnose → pwk-diagnose}/SKILL.md +3 -2
- package/skills/pwk-executing-tasks/SKILL.md +154 -0
- package/skills/pwk-finalizing/SKILL.md +78 -0
- package/skills/pwk-status/SKILL.md +28 -0
- package/skills/pwk-writing-plans/SKILL.md +83 -0
- package/docs/plans/2026-06-03-karpathy-guidelines-ab-comparison.md +0 -166
- package/docs/plans/completed/2026-04-11-checkpoint-review-gates-design.md +0 -50
- package/docs/plans/completed/2026-04-11-checkpoint-review-gates-implementation.md +0 -98
- package/docs/plans/completed/2026-04-11-finalizing-merge-options-design.md +0 -33
- package/docs/plans/completed/2026-04-11-finalizing-merge-options-implementation.md +0 -75
- package/docs/plans/completed/2026-04-11-workspace-setup-design.md +0 -28
- package/docs/plans/completed/2026-04-11-workspace-setup-implementation.md +0 -57
- package/docs/plans/completed/2026-04-15-bash-guard-design.md +0 -39
- package/docs/plans/completed/2026-04-15-bash-guard-implementation.md +0 -229
- package/docs/plans/completed/2026-04-21-workflow-guard-safe-commands-design.md +0 -172
- package/docs/plans/completed/2026-04-21-workflow-guard-safe-commands-implementation.md +0 -168
- package/docs/plans/completed/2026-04-22-go-readonly-safe-commands-implementation.md +0 -54
- package/docs/plans/completed/2026-04-28-executing-tasks-redesign-design.md +0 -171
- package/docs/plans/completed/2026-04-28-executing-tasks-redesign-implementation.md +0 -208
- package/docs/plans/completed/2026-04-28-executing-tasks-redesign-progress.md +0 -14
- package/docs/plans/completed/2026-05-01-incorporate-mattpocock-skills-design.md +0 -154
- package/docs/plans/completed/2026-05-01-incorporate-mattpocock-skills-implementation.md +0 -315
- package/docs/plans/completed/2026-05-01-incorporate-mattpocock-skills-progress.md +0 -15
- package/docs/plans/completed/2026-05-08-checkpoint-gates-design.md +0 -235
- package/docs/plans/completed/2026-05-08-checkpoint-gates-implementation.md +0 -83
- package/docs/plans/completed/2026-05-08-checkpoint-gates-progress.md +0 -11
- package/docs/plans/completed/2026-05-08-lessons-learned-design.md +0 -76
- package/docs/plans/completed/2026-05-08-lessons-learned-implementation.md +0 -219
- package/docs/plans/completed/2026-05-08-lessons-learned-progress.md +0 -15
- package/docs/plans/completed/2026-05-08-migrate-earendil-works-design.md +0 -39
- package/docs/plans/completed/2026-05-08-migrate-earendil-works-implementation.md +0 -45
- package/docs/plans/completed/2026-05-08-migrate-earendil-works-progress.md +0 -10
- package/docs/plans/completed/2026-05-08-worktree-handoff-design.md +0 -118
- package/docs/plans/completed/2026-05-08-worktree-handoff-implementation.md +0 -140
- package/docs/plans/completed/2026-05-08-worktree-handoff-progress.md +0 -10
- package/docs/plans/completed/2026-05-20-generic-lessons-design.md +0 -70
- package/docs/plans/completed/2026-05-20-generic-lessons-implementation.md +0 -114
- package/docs/plans/completed/2026-05-20-generic-lessons-progress.md +0 -11
- package/docs/plans/completed/2026-05-22-agentic-agile-enhancements-design.md +0 -77
- package/docs/plans/completed/2026-05-22-agentic-agile-enhancements-implementation.md +0 -473
- package/docs/plans/completed/2026-05-25-design-review-split-implementation.md +0 -622
- package/docs/plans/completed/2026-05-25-design-review-split-progress.md +0 -16
- package/docs/plans/completed/2026-05-25-pr5-improvements-implementation.md +0 -273
- package/docs/plans/completed/2026-05-25-pr5-improvements-progress.md +0 -17
- package/docs/plans/completed/2026-06-03-add-verify-skill-design.md +0 -51
- package/docs/plans/completed/2026-06-03-add-verify-skill-implementation.md +0 -111
- package/docs/plans/completed/2026-06-03-add-verify-skill-progress.md +0 -11
- package/docs/plans/completed/2026-06-03-verify-skill-design.md +0 -176
- package/skills/brainstorming/SKILL.md +0 -48
- package/skills/design-review/SKILL.md +0 -113
- package/skills/executing-tasks/SKILL.md +0 -350
- package/skills/finalizing/SKILL.md +0 -119
- package/skills/verify/SKILL.md +0 -170
- package/skills/writing-plans/SKILL.md +0 -343
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: brainstorming
|
|
3
|
-
description: "Use this before any creative work — creating features, building components, adding functionality, or modifying behavior. Explores intent and design before implementation. Use this skill whenever the user describes something they want to build, change, or improve, even if they don't say 'brainstorm' — phrases like 'I want to add X', 'let's build Y', 'we need a way to Z', or 'help me design' all apply."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Brainstorming
|
|
7
|
-
|
|
8
|
-
Read-only exploration. You may **not** edit or create any files except under `docs/plans/`.
|
|
9
|
-
|
|
10
|
-
## Process
|
|
11
|
-
|
|
12
|
-
1. **Check git state** — run `git status` and `git log --oneline -5`. If there's uncommitted work, ask the user what to do with it first.
|
|
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.
|
|
16
|
-
|
|
17
|
-
When a significant architectural decision is identified, offer to write a lightweight ADR to `docs/plans/adr/`. Only write an ADR when all three are true:
|
|
18
|
-
|
|
19
|
-
1. **Hard to reverse** — changing your mind later has meaningful cost
|
|
20
|
-
2. **Surprising without context** — a future reader will wonder "why?"
|
|
21
|
-
3. **A real trade-off** — there were genuine alternatives
|
|
22
|
-
|
|
23
|
-
ADR format — a title and 1-3 sentences covering context, decision, and why:
|
|
24
|
-
|
|
25
|
-
```markdown
|
|
26
|
-
# <Short title of the decision>
|
|
27
|
-
|
|
28
|
-
<1-3 sentences: context, decision, and why.>
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
ADRs live under `docs/plans/adr/` and are archived during finalizing alongside the design doc.
|
|
32
|
-
|
|
33
|
-
For non-trivial designs, note any areas that may need production-risk review (database schema changes, authentication or authorization, external API integrations, concurrency or batch processing, file uploads or large data flows, Redis/caching/message queues). You don't need to audit them here — just flag them for the design-review stage.
|
|
34
|
-
|
|
35
|
-
For trivial changes (config, naming, simple field additions), note "Simple change — no design review needed" in the design doc.
|
|
36
|
-
5. **Write the design doc** — save it to `docs/plans/YYYY-MM-DD-<topic>-design.md`. Organize features as end-to-end slices (each slice delivers one observable behavior through all relevant layers) so the planning phase can decompose them directly into tasks. Branch creation, committing, and workspace setup are handled by `/skill:executing-tasks`.
|
|
37
|
-
|
|
38
|
-
## Principles
|
|
39
|
-
|
|
40
|
-
- One question at a time
|
|
41
|
-
- YAGNI — remove unnecessary features
|
|
42
|
-
- Design for testability
|
|
43
|
-
- Always explore alternatives before settling
|
|
44
|
-
|
|
45
|
-
## After the design
|
|
46
|
-
|
|
47
|
-
- **Non-trivial design**: Ask: "Design looks good. Run `/skill:design-review` to check for production risks before planning."
|
|
48
|
-
- **Trivial change**: Ask: "Simple change — skip design review. Ready to plan? Run `/skill:writing-plans`"
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: design-review
|
|
3
|
-
description: "Audit a design doc for production risks — security, scalability, fault tolerance, and operational hazards. Use after brainstorming for non-trivial designs, or when you want to stress-test a design for production readiness."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Design Review
|
|
7
|
-
|
|
8
|
-
Read-only exploration of the design doc. You **may** edit the design doc to append review findings. You may **not** edit source code or configuration.
|
|
9
|
-
|
|
10
|
-
## Process
|
|
11
|
-
|
|
12
|
-
1. **Find the design doc** — look for `docs/plans/*-design.md`. If none exists, say "No design doc found. Run `/skill:brainstorming` first." and stop.
|
|
13
|
-
|
|
14
|
-
2. **Check triviality** — if the design doc notes "Simple change — no design review needed", append a brief section:
|
|
15
|
-
|
|
16
|
-
```markdown
|
|
17
|
-
## Architectural Review
|
|
18
|
-
|
|
19
|
-
**Status**: Skipped — trivial change. No high-risk operations detected.
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
Then say: "Ready to plan? Run `/skill:writing-plans`" and stop.
|
|
23
|
-
|
|
24
|
-
3. **Read the design doc in full** — understand the architecture, data flow, components, and error handling proposed.
|
|
25
|
-
|
|
26
|
-
4. **🏛️ Architectural Pillars Review** — evaluate the design against the 6 Pillars of Production-Grade Design:
|
|
27
|
-
|
|
28
|
-
1. **Robustness & Fault Tolerance**: How expected failures are handled, subsystem isolation, graceful degradation.
|
|
29
|
-
2. **Atomicity & Consistency**: Database transactions, state rollback on error, endpoint idempotency.
|
|
30
|
-
3. **Security & Access Control**: Input validation/sanitization, authorization checks at the boundary.
|
|
31
|
-
4. **Scalability & Performance**: Connection pooling, closing resource leaks, preventing N+1 queries.
|
|
32
|
-
5. **Backwards Compatibility**: Schema migration safety, zero-downtime deployment, API versioning.
|
|
33
|
-
6. **Testability**: Injection seams for external dependencies (APIs, system clocks, randomizers) to keep tests 100% deterministic.
|
|
34
|
-
|
|
35
|
-
For each pillar, write a 1-2 sentence assessment. Flag any concerns.
|
|
36
|
-
|
|
37
|
-
5. **⚠️ High-Risk Hazard Audit** — evaluate the design against the 8 High-Risk Production Hazards. For each hazard, write either `[SAFE]` (with a 1-sentence justification) or `[TRIGGERED]` (detailing the mitigation):
|
|
38
|
-
|
|
39
|
-
1. **Unbounded Redis Deletions / Operations**: Multi-key deletion or scans (e.g. `KEYS` or raw `SCAN` loops) that block single-threaded performance.
|
|
40
|
-
2. **In-Memory OOM Loops**: Fetching complete database datasets into server memory (e.g., raw `select *`) to filter, sort, or map in runtime heap.
|
|
41
|
-
3. **Unbounded Concurrency Spikes**: Running concurrent network requests (e.g. unthrottled `Promise.all`) without strict batch limits.
|
|
42
|
-
4. **Missing High-Frequency Indexes**: Running queries on unindexed columns, forcing expensive table-scans under load.
|
|
43
|
-
5. **Nested/Long-Running Transactions**: Holding database connections and locks open while awaiting slow external HTTP, disk, or cryptographic tasks.
|
|
44
|
-
6. **Unrestricted Uploads & Temp Flooding**: Writing uploaded data directly to local temporary paths without validation limits or explicit `finally` cleanup blocks.
|
|
45
|
-
7. **Raw Query String Interpolation**: Merging raw variables into SQL queries or shell command inputs (susceptible to injection).
|
|
46
|
-
8. **Silent Swallowing Loops**: Background workers or cron tasks silently catching and suppressing exceptions without logging, back-offs, or alerts.
|
|
47
|
-
|
|
48
|
-
6. **🔍 Socratic Risk Discovery** — put on your **SRE Hat** and audit the proposed logic against 3 heuristics to identify novel or domain-specific risks:
|
|
49
|
-
|
|
50
|
-
- **The "Scale to 100x" Heuristic**: If this operation is run 100x/sec or on 100k items, what breaks? (Memory, CPU, Disk I/O, sockets, database connection limits).
|
|
51
|
-
- **The "Hostile World" Heuristic**: If a malicious actor has complete control over these inputs (headers, payloads, IDs), how can they exploit, crash, or extract data?
|
|
52
|
-
- **The "Silent Error" Heuristic**: If this downstream dependency or query hangs or fails silently, how does our server react? Is there a timeout, a back-off, or logging?
|
|
53
|
-
|
|
54
|
-
For each heuristic, note any risks discovered. If a risk overlaps with a triggered hazard, cross-reference it.
|
|
55
|
-
|
|
56
|
-
7. **Present findings** — show the full review to the user. For each triggered hazard or Socratic risk, propose a concrete mitigation. Wait for user feedback and incorporate changes.
|
|
57
|
-
|
|
58
|
-
8. **Append to design doc** — add a `## Architectural Review` section to the design doc. Two cases:
|
|
59
|
-
|
|
60
|
-
**All clear** (no hazards triggered, no Socratic risks):
|
|
61
|
-
```markdown
|
|
62
|
-
## Architectural Review
|
|
63
|
-
|
|
64
|
-
**Status**: ✅ No high-risk hazards detected.
|
|
65
|
-
|
|
66
|
-
**Pillars reviewed**: All 6 — no concerns.
|
|
67
|
-
**Hazards audited**: All 8 [SAFE].
|
|
68
|
-
**Socratic risks**: None identified.
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
**Hazards or risks found**:
|
|
72
|
-
```markdown
|
|
73
|
-
## Architectural Review
|
|
74
|
-
|
|
75
|
-
**Status**: ⚠️ High-risk operations detected — see mitigations below.
|
|
76
|
-
|
|
77
|
-
### Pillar Assessments
|
|
78
|
-
- **Robustness**: [assessment]
|
|
79
|
-
- **Atomicity**: [assessment]
|
|
80
|
-
- **Security**: [assessment]
|
|
81
|
-
- **Scalability**: [assessment]
|
|
82
|
-
- **Backwards Compatibility**: [assessment]
|
|
83
|
-
- **Testability**: [assessment]
|
|
84
|
-
|
|
85
|
-
### Hazard Audit
|
|
86
|
-
- 1. Unbounded Redis: [SAFE / TRIGGERED — mitigation]
|
|
87
|
-
- 2. In-Memory OOM: [SAFE / TRIGGERED — mitigation]
|
|
88
|
-
- 3. Unbounded Concurrency: [SAFE / TRIGGERED — mitigation]
|
|
89
|
-
- 4. Missing Indexes: [SAFE / TRIGGERED — mitigation]
|
|
90
|
-
- 5. Long-Running Transactions: [SAFE / TRIGGERED — mitigation]
|
|
91
|
-
- 6. Unrestricted Uploads: [SAFE / TRIGGERED — mitigation]
|
|
92
|
-
- 7. Query Interpolation: [SAFE / TRIGGERED — mitigation]
|
|
93
|
-
- 8. Silent Swallowing: [SAFE / TRIGGERED — mitigation]
|
|
94
|
-
|
|
95
|
-
### ⚠️ High-Risk Operations & Mitigations
|
|
96
|
-
[Detailed mitigation for each TRIGGERED hazard and Socratic risk]
|
|
97
|
-
|
|
98
|
-
### Socratic Risks
|
|
99
|
-
- **Scale to 100x**: [finding or "none identified"]
|
|
100
|
-
- **Hostile World**: [finding or "none identified"]
|
|
101
|
-
- **Silent Error**: [finding or "none identified"]
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
## Principles
|
|
105
|
-
|
|
106
|
-
- Be specific — every `[TRIGGERED]` hazard must include a concrete mitigation, not just "be careful"
|
|
107
|
-
- Be honest — if the design is risky and the risk can't be mitigated easily, say so
|
|
108
|
-
- Be proportional — a simple CRUD endpoint doesn't need the same depth as a batch processing pipeline
|
|
109
|
-
- Don't redesign — flag risks and propose mitigations, but the design owner decides
|
|
110
|
-
|
|
111
|
-
## After the review
|
|
112
|
-
|
|
113
|
-
Ask: "Ready to plan? Run `/skill:writing-plans`"
|
|
@@ -1,350 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: executing-tasks
|
|
3
|
-
description: "Use this to implement an approved plan task-by-task. Run after writing-plans, before finalizing."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Executing Tasks
|
|
7
|
-
|
|
8
|
-
Implement the plan from `docs/plans/*-implementation.md` task by task, with file-based progress tracking and session-aware context management.
|
|
9
|
-
|
|
10
|
-
## Before you start
|
|
11
|
-
|
|
12
|
-
1. **Check git state** — run `git status` and `git log --oneline -5`. Note any uncommitted changes.
|
|
13
|
-
2. **Find the plan** — look for `docs/plans/*-implementation.md`. If none exist, say "No implementation plan found. Run `/skill:writing-plans` first." and stop. If multiple exist, ask the user which one to execute.
|
|
14
|
-
3. **Check for existing progress** — look for `docs/plans/*-progress.md`. If one exists matching the plan, this is a **resume** (see [Resume](#resume)). If not, this is a **first run** (see [First run](#first-run)).
|
|
15
|
-
|
|
16
|
-
## First run
|
|
17
|
-
|
|
18
|
-
1. **Parse the implementation plan** — read the plan and extract all `## Task N:` headings. Build the progress table with all tasks as `⬜ pending`.
|
|
19
|
-
2. **Suggest workspace isolation** — if the user isn't already on a feature branch or worktree, present the options:
|
|
20
|
-
|
|
21
|
-
- **Branch** (smaller changes):
|
|
22
|
-
```
|
|
23
|
-
git checkout -b <feature-name>
|
|
24
|
-
```
|
|
25
|
-
- **Worktree** (larger features, keeps main clean):
|
|
26
|
-
```
|
|
27
|
-
git worktree add ../<repo>-<feature-name> -b <feature-name>
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
Derive `<feature-name>` from the plan doc (e.g. `docs/plans/2026-04-16-auth-design.md` → `auth`). Ask the user which they prefer, then wait for confirmation before proceeding.
|
|
31
|
-
|
|
32
|
-
3. **If worktree was chosen — hand off to new session:**
|
|
33
|
-
|
|
34
|
-
a. Ensure the worktree's `docs/plans/` directory exists:
|
|
35
|
-
```
|
|
36
|
-
mkdir -p <worktree>/docs/plans
|
|
37
|
-
mkdir -p <worktree>/docs/plans/adr
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
b. Move plan docs into the worktree:
|
|
41
|
-
```
|
|
42
|
-
mv docs/plans/*-design.md <worktree>/docs/plans/ 2>/dev/null || true
|
|
43
|
-
mv docs/plans/*-implementation.md <worktree>/docs/plans/ 2>/dev/null || true
|
|
44
|
-
mv docs/plans/*-progress.md <worktree>/docs/plans/ 2>/dev/null || true
|
|
45
|
-
mv docs/plans/adr/*.md <worktree>/docs/plans/adr/ 2>/dev/null || true
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
c. Commit the removal on the current branch (if any plan docs were committed):
|
|
49
|
-
```
|
|
50
|
-
git rm docs/plans/*-design.md docs/plans/*-implementation.md docs/plans/*-progress.md 2>/dev/null || true
|
|
51
|
-
git rm -r docs/plans/adr/ 2>/dev/null || true
|
|
52
|
-
git commit -m "chore: move plan docs to worktree for <feature-name>"
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
d. Stop and show the user:
|
|
56
|
-
```
|
|
57
|
-
✅ Worktree created at ../<repo>-<feature-name>
|
|
58
|
-
📄 Plan docs moved to the worktree.
|
|
59
|
-
|
|
60
|
-
To continue, start a new session there:
|
|
61
|
-
cd ../<repo>-<feature-name> && pi
|
|
62
|
-
|
|
63
|
-
Then run: /skill:executing-tasks
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
e. **Create the progress file** in the worktree — save to `<worktree>/docs/plans/<plan-name>-progress.md`:
|
|
67
|
-
|
|
68
|
-
```markdown
|
|
69
|
-
# Progress: <topic>
|
|
70
|
-
|
|
71
|
-
Plan: docs/plans/YYYY-MM-DD-<topic>-implementation.md
|
|
72
|
-
Branch: <feature-name>
|
|
73
|
-
Started: <ISO timestamp>
|
|
74
|
-
Last updated: <ISO timestamp>
|
|
75
|
-
|
|
76
|
-
| # | Status | Task | Commit |
|
|
77
|
-
|---|--------|------|--------|
|
|
78
|
-
| 1 | ⬜ pending | Task description (preserve checkpoint labels) | — |
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
This ensures the new session in the worktree will detect the progress file and resume correctly.
|
|
82
|
-
|
|
83
|
-
f. **Do not proceed with task execution.** The session ends here.
|
|
84
|
-
|
|
85
|
-
4. **If branch was chosen — continue with execution:**
|
|
86
|
-
|
|
87
|
-
a. **Create the progress file** — save to `docs/plans/<plan-name>-progress.md` (replace `-implementation` with `-progress` in the plan filename):
|
|
88
|
-
|
|
89
|
-
```markdown
|
|
90
|
-
# Progress: <topic>
|
|
91
|
-
|
|
92
|
-
Plan: docs/plans/YYYY-MM-DD-<topic>-implementation.md
|
|
93
|
-
Branch: <actual branch name>
|
|
94
|
-
Started: <ISO timestamp>
|
|
95
|
-
Last updated: <ISO timestamp>
|
|
96
|
-
|
|
97
|
-
| # | Status | Task | Commit |
|
|
98
|
-
|---|--------|------|--------|
|
|
99
|
-
| 1 | ⬜ pending | Task description (preserve checkpoint labels) | — |
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
Use the actual branch name — whether it's the original branch or a new one from the isolation step.
|
|
103
|
-
|
|
104
|
-
b. **Commit the plan docs** — if `docs/plans/` has uncommitted files, commit them on the new branch:
|
|
105
|
-
```
|
|
106
|
-
git add docs/plans/ && git commit -m "docs: add design and implementation plan"
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
c. **Begin task execution** — start with task 1 (see [Per-task execution](#per-task-execution)).
|
|
110
|
-
|
|
111
|
-
## Resume
|
|
112
|
-
|
|
113
|
-
1. **Read the progress file** — find the first task with status `⬜ pending`, `❌ failed`, or `🔄 in-progress`.
|
|
114
|
-
2. **Handle in-progress task** — if a task is `🔄 in-progress` (mid-task crash):
|
|
115
|
-
- Check `git log --oneline` since the last `✅ done` task's commit
|
|
116
|
-
- If commits exist: ask the user — "Task N was in progress and commits were made. Continue from here, or reset it to pending?"
|
|
117
|
-
- If no commits: restart the task (reset to `🔄 in-progress` and begin)
|
|
118
|
-
3. **Handle failed task** — if a task is `❌ failed`:
|
|
119
|
-
- Show the failure reason from the progress file
|
|
120
|
-
- Ask: "Retry, skip, or abort?"
|
|
121
|
-
4. **Handle pending task** — proceed normally
|
|
122
|
-
5. **All done** — if no `⬜ pending` or `❌ failed` tasks remain, show summary and suggest `/skill:finalizing`
|
|
123
|
-
6. **Begin task execution** — proceed from the identified task
|
|
124
|
-
|
|
125
|
-
## Progress file
|
|
126
|
-
|
|
127
|
-
**Path:** `docs/plans/<plan-name>-progress.md`
|
|
128
|
-
|
|
129
|
-
**Status values:**
|
|
130
|
-
|
|
131
|
-
| Status | Meaning |
|
|
132
|
-
|--------|---------|
|
|
133
|
-
| `⬜ pending` | Not started |
|
|
134
|
-
| `🔄 in-progress` | Currently executing plan steps |
|
|
135
|
-
| `⏸ test-review` | Paused at checkpoint: test, waiting for human approval |
|
|
136
|
-
| `⏸ done-review` | Paused at checkpoint: done, waiting for human approval |
|
|
137
|
-
| `✅ done` | Committed successfully |
|
|
138
|
-
| `❌ failed` | Could not complete (append `Failed: <reason>`) |
|
|
139
|
-
| `⏭ skipped` | User chose to skip |
|
|
140
|
-
|
|
141
|
-
**Update rules:**
|
|
142
|
-
- Mark `🔄 in-progress` immediately when starting a task
|
|
143
|
-
- Mark `⏸ test-review` or `⏸ done-review` when the agent reaches a `⏸ CHECKPOINT` gate in the plan — this must happen BEFORE any `git add` or `git commit`
|
|
144
|
-
- Can only return to `🔄 in-progress` after the human explicitly says "approve"
|
|
145
|
-
- Mark `✅ done` + record commit hash only after successful `git commit`
|
|
146
|
-
- Cannot go from `🔄 in-progress` → `✅ done` if the task has a checkpoint — must go through the review status first
|
|
147
|
-
- `git add` and `git commit` happen AFTER human approval, never before
|
|
148
|
-
- Mark `❌ failed` + append reason when the agent can't proceed after retrying
|
|
149
|
-
- Mark `⏭ skipped` when the user says "skip"
|
|
150
|
-
- Update `Last updated` timestamp on every change
|
|
151
|
-
- Preserve checkpoint labels in the task description column
|
|
152
|
-
|
|
153
|
-
## Per-task execution
|
|
154
|
-
|
|
155
|
-
For each task:
|
|
156
|
-
|
|
157
|
-
1. **Mark in-progress** — update the progress file: `🔄 in-progress`
|
|
158
|
-
2. **Read the plan** — read the plan's overview section (everything before `## Task 1:`). Skim all `## Task N:` headings for dependency awareness. Then read the current task's body in full. **Read `docs/lessons.md` if it exists** — follow all rules listed there while working on this task.
|
|
159
|
-
3. **Execute the plan steps** — follow each numbered step in the task body, in order. As you work, shift your cognitive focus through three frames:
|
|
160
|
-
|
|
161
|
-
**QA Test frame** (when writing/running tests): Focus entirely on translating the task's `Given/When/Then` Acceptance Criteria into precise failing tests. Before running tests, verify the test environment is sandboxed — no real database connections, API calls, or live services. External dependencies must be mocked or stubbed. Ensure the test environment is isolated (e.g., `NODE_ENV=test`, `GO_ENV=test`, or equivalent for your stack).
|
|
162
|
-
|
|
163
|
-
**Pragmatic Developer frame** (when implementing): Focus on the simplest possible code to make the tests green. Do not over-engineer or add code for future requirements. Keep complexity to a bare minimum.
|
|
164
|
-
|
|
165
|
-
**Senior Refactoring frame** (when refactoring): Evaluate the craftsmanship of the code. Check for:
|
|
166
|
-
- **Shallow modules** — is the interface nearly as complex as the implementation? Can complexity be hidden behind a simpler interface?
|
|
167
|
-
- **Deletion test** — if you deleted this module, would complexity vanish (pass-through) or reappear across callers (earning its keep)?
|
|
168
|
-
- **Duplication** — extract repeated patterns
|
|
169
|
-
- **Seam discipline** — don't introduce abstraction unless something actually varies across it. One adapter = hypothetical seam. Two adapters = real seam
|
|
170
|
-
|
|
171
|
-
Run tests after each refactor step. Never refactor while tests are failing.
|
|
172
|
-
|
|
173
|
-
Stop at any `⏸ CHECKPOINT` gate (see [Checkpoint gates](#checkpoint-gates--when-the-plan-says-stop)).
|
|
174
|
-
4. **Verify against task description** — re-read the task from the plan. Does the implementation satisfy every requirement listed? If not, fix before proceeding.
|
|
175
|
-
5. **Learn from mistakes** — if you caught yourself making a mistake during this task that you've made before or that would apply to future tasks, append a rule to `docs/lessons.md`. Only add rules that would change future behavior. If the file doesn't exist, create it with the standard format (see below).
|
|
176
|
-
|
|
177
|
-
Before writing, apply the **generalization test**: would this rule apply equally to a completely different feature or domain in this repo? If not, rewrite it — strip out specific service names, entity types, and domain concepts, and express the underlying pattern instead. If you can't express a generic form, don't write the rule.
|
|
178
|
-
|
|
179
|
-
❌ **Domain-specific** (only survives this sprint):
|
|
180
|
-
> "Always validate `userId` before calling `UserProfile.Get`"
|
|
181
|
-
|
|
182
|
-
✅ **Generic** (applies across the whole repo):
|
|
183
|
-
> "Always validate required ID fields at the service boundary — missing IDs should return 400, not 500"
|
|
184
|
-
6. **Commit** — after all steps are done (no checkpoint gates remain in the task), `git add` the relevant files and commit with a clear message.
|
|
185
|
-
7. **Update progress** — mark `✅ done` + record the commit hash.
|
|
186
|
-
8. **Suggest session break if needed** — after completing ~3-5 tasks since the last break, suggest:
|
|
187
|
-
```
|
|
188
|
-
✅ Tasks N-M done (commits: abc, def)
|
|
189
|
-
Progress: X/Y tasks done
|
|
190
|
-
⏭ Next: Task [N+1] — [description]
|
|
191
|
-
💡 Context is building up. For clean context on remaining tasks:
|
|
192
|
-
/new then /skill:executing-tasks
|
|
193
|
-
(or just say "continue" to keep going here)
|
|
194
|
-
```
|
|
195
|
-
Also suggest at checkpoint review pauses when multiple tasks have been completed since the last break. Respect the user's choice if they say "continue".
|
|
196
|
-
9. **Loop** — go back to step 1 for the next `⬜ pending` task, or see [After all tasks](#after-all-tasks) if none remain.
|
|
197
|
-
|
|
198
|
-
### `docs/lessons.md` format
|
|
199
|
-
|
|
200
|
-
```markdown
|
|
201
|
-
# Lessons Learned
|
|
202
|
-
|
|
203
|
-
<!--
|
|
204
|
-
Agent: read this at the start of each task during executing-tasks.
|
|
205
|
-
Follow every rule. Add new rules when you catch yourself making repeat mistakes.
|
|
206
|
-
Rules must be generic patterns applicable to any domain or feature — not specific to one service, entity, or use case.
|
|
207
|
-
Retire rules that no longer apply during finalizing.
|
|
208
|
-
-->
|
|
209
|
-
|
|
210
|
-
## Rules
|
|
211
|
-
|
|
212
|
-
- <new rule here>
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
When adding a new rule during execution, always append it under `## Rules`. The categorization into specific headers (e.g., `## Tool Usage`, `## Testing Patterns`) is done during finalizing — never during execution.
|
|
216
|
-
|
|
217
|
-
### Checkpoint gates — when the plan says STOP
|
|
218
|
-
|
|
219
|
-
The plan marks certain steps with `⏸ **CHECKPOINT: test**` or `⏸ **CHECKPOINT: done**`. These are hard stop points. When you reach one:
|
|
220
|
-
|
|
221
|
-
1. **Stop executing immediately.** Do not proceed to the next step in the task. Do not pass go.
|
|
222
|
-
2. **Do NOT run `git add` or `git commit`.** The code stays uncommitted until the human approves.
|
|
223
|
-
3. Update the progress file to `⏸ test-review` or `⏸ done-review`.
|
|
224
|
-
4. Present the checkpoint review (see below).
|
|
225
|
-
5. **Wait for the human to respond.** Do not continue executing steps, do not commit, do not move to the next task.
|
|
226
|
-
6. On approval, update progress back to `🔄 in-progress` and continue with the next step in the task.
|
|
227
|
-
|
|
228
|
-
The whole point of checkpoints is that the human reviews code at critical moments before the agent proceeds further. If you skip past a checkpoint without waiting, you defeat this purpose.
|
|
229
|
-
|
|
230
|
-
| Checkpoint type | What the agent has done at this point | What needs human approval |
|
|
231
|
-
|---|---|---|
|
|
232
|
-
| `checkpoint: test` | Written failing tests, confirmed they fail | The test design — are the right things being tested? |
|
|
233
|
-
| `checkpoint: done` | Implemented, refactored, written lessons | The implementation approach, the refactoring choices |
|
|
234
|
-
|
|
235
|
-
**For `checkpoint: test`:** Only the test file should exist at this point. No implementation code yet. The human reviews the test to confirm the right behavior is being specified.
|
|
236
|
-
|
|
237
|
-
**For `checkpoint: done`:** All code changes are made but NOT committed. Run `git diff` (not `git diff --cached` — nothing should be staged) to show the human what changed. The human reviews before anything is committed.
|
|
238
|
-
|
|
239
|
-
## Checkpoint review
|
|
240
|
-
|
|
241
|
-
When you hit a checkpoint gate, present a review to the human and **stop all execution** until they respond.
|
|
242
|
-
|
|
243
|
-
### At `checkpoint: test`
|
|
244
|
-
|
|
245
|
-
You have written the failing tests and confirmed they fail. No implementation code exists yet.
|
|
246
|
-
|
|
247
|
-
Present:
|
|
248
|
-
```
|
|
249
|
-
⏸ Paused at checkpoint: test for task [N]
|
|
250
|
-
|
|
251
|
-
**Test file:** `path/to/test.ts`
|
|
252
|
-
|
|
253
|
-
**Test code:**
|
|
254
|
-
[show the full test code]
|
|
255
|
-
|
|
256
|
-
**Test results:** [paste the failing test output showing which tests fail and why]
|
|
257
|
-
|
|
258
|
-
**What this validates:** [summarize the behavior these tests specify]
|
|
259
|
-
**Next step after approval:** Write the implementation to make these tests pass
|
|
260
|
-
|
|
261
|
-
What would you like to do?
|
|
262
|
-
- **approve** — I'll implement to make these tests pass
|
|
263
|
-
- **request changes** — tell me what to change in the tests
|
|
264
|
-
- **revert** — undo this task and go back to pending
|
|
265
|
-
- **skip** — skip this task entirely
|
|
266
|
-
- **stop** — pause here, resume later with /skill:executing-tasks
|
|
267
|
-
- **status** — show the full progress table
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
### At `checkpoint: done`
|
|
271
|
-
|
|
272
|
-
You have implemented the code, run the refactor step, and written any lessons. Nothing is committed yet.
|
|
273
|
-
|
|
274
|
-
Present:
|
|
275
|
-
```
|
|
276
|
-
⏸ Paused at checkpoint: done for task [N]
|
|
277
|
-
|
|
278
|
-
**What was done:** [brief summary — what feature/fix was implemented]
|
|
279
|
-
|
|
280
|
-
**Test results:** [run tests now, paste the passing output]
|
|
281
|
-
|
|
282
|
-
**Diff:** [run `git diff` — the unstaged changes are what this task produced]
|
|
283
|
-
[paste the full diff]
|
|
284
|
-
|
|
285
|
-
**Refactoring done:** [what changed during refactor, or "none needed — [reason]"]
|
|
286
|
-
**Lessons learned:** [new rule added to docs/lessons.md, or "none"]
|
|
287
|
-
**Next step after approval:** git add, commit, and move to next task
|
|
288
|
-
|
|
289
|
-
What would you like to do?
|
|
290
|
-
- **approve** — I'll commit and move to the next task
|
|
291
|
-
- **request changes** — tell me what to change, I'll update and re-present
|
|
292
|
-
- **revert** — undo this task and go back to pending
|
|
293
|
-
- **skip** — skip this task entirely
|
|
294
|
-
- **stop** — pause here, resume later with /skill:executing-tasks
|
|
295
|
-
- **status** — show the full progress table
|
|
296
|
-
```
|
|
297
|
-
|
|
298
|
-
**Do not commit before the human approves.** The diff you show at `checkpoint: done` is the uncommitted work. If the human requests changes, make the edits, re-run tests, and re-present the updated diff at the same checkpoint. Repeat until they say "approve".
|
|
299
|
-
|
|
300
|
-
Only after approval: `git add` the relevant files, commit, and mark the task `✅ done`.
|
|
301
|
-
|
|
302
|
-
## Progress file updates
|
|
303
|
-
|
|
304
|
-
Update the progress file by reading it, modifying the relevant row's status and commit hash, and writing it back. Target the specific task row — do not use pattern-matching approaches (e.g. sed) that could corrupt the table.
|
|
305
|
-
|
|
306
|
-
Update `Last updated` timestamp on every change.
|
|
307
|
-
|
|
308
|
-
## User override commands
|
|
309
|
-
|
|
310
|
-
The user can issue these commands at any time during execution:
|
|
311
|
-
|
|
312
|
-
| User says | Agent does |
|
|
313
|
-
|-----------|-----------|
|
|
314
|
-
| `skip` | Mark current task `⏭ skipped`, move to next |
|
|
315
|
-
| `status` | Show the progress table |
|
|
316
|
-
| `stop` | Mark current task back to `⬜ pending`, suggest `/new` |
|
|
317
|
-
| `retry` | Re-read current task section, start over |
|
|
318
|
-
|
|
319
|
-
## Receiving code review
|
|
320
|
-
|
|
321
|
-
When the user shares code review feedback (outside of a checkpoint pause):
|
|
322
|
-
|
|
323
|
-
1. **Verify the criticism** — read the relevant code. Is the feedback accurate?
|
|
324
|
-
2. **Evaluate the suggestion** — is the proposed fix the right approach? Consider alternatives.
|
|
325
|
-
3. **Implement or push back** — if valid, fix it, re-run tests, and amend the commit. If not, explain why with evidence from the codebase.
|
|
326
|
-
4. **Don't blindly implement** — every suggestion should be verified against the code before accepting.
|
|
327
|
-
|
|
328
|
-
## If you're stuck
|
|
329
|
-
|
|
330
|
-
1. Re-read the current task section from the plan — you may have drifted from the spec
|
|
331
|
-
2. Check git log — recent commits may reveal context
|
|
332
|
-
3. Ask the user — it's better to clarify than to guess wrong
|
|
333
|
-
4. If still stuck after asking, mark the task `❌ failed` with the reason in the progress file and move to the next task
|
|
334
|
-
5. **Check `docs/lessons.md`** — a previous lesson may be relevant to your current problem.
|
|
335
|
-
|
|
336
|
-
## After all tasks
|
|
337
|
-
|
|
338
|
-
When no `⬜ pending` or `❌ failed` tasks remain, show a summary:
|
|
339
|
-
|
|
340
|
-
```
|
|
341
|
-
✅ All tasks complete!
|
|
342
|
-
|
|
343
|
-
| # | Status | Task |
|
|
344
|
-
|---|--------|------|
|
|
345
|
-
| 1 | ✅ done | Create User model |
|
|
346
|
-
| 2 | ✅ done | Write User model tests |
|
|
347
|
-
| 3 | ⏭ skipped | Add auth middleware |
|
|
348
|
-
|
|
349
|
-
Ready to ship? Run `/skill:finalizing`
|
|
350
|
-
```
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: finalizing
|
|
3
|
-
description: "Use this after all tasks are complete to clean up, document, and ship the work."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Finalizing
|
|
7
|
-
|
|
8
|
-
Ship the completed work.
|
|
9
|
-
|
|
10
|
-
## Pre-finalization checks
|
|
11
|
-
|
|
12
|
-
### Check for skipped tasks
|
|
13
|
-
|
|
14
|
-
Before archiving, if a progress file exists (`docs/plans/*-progress.md`), read it and check for any `⏭ skipped` tasks. If found, warn:
|
|
15
|
-
|
|
16
|
-
```
|
|
17
|
-
⚠️ Tasks 4 and 7 were skipped. Continue with finalizing, or go back?
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
Wait for the user to confirm before proceeding.
|
|
21
|
-
|
|
22
|
-
## Process
|
|
23
|
-
|
|
24
|
-
1. **Move planning docs** — archive the design, implementation, progress docs, and ADRs (if any), then commit:
|
|
25
|
-
```
|
|
26
|
-
mkdir -p docs/plans/completed
|
|
27
|
-
mkdir -p docs/plans/completed/adr
|
|
28
|
-
mv docs/plans/*-design.md docs/plans/completed/ 2>/dev/null || true
|
|
29
|
-
mv docs/plans/*-implementation.md docs/plans/completed/ 2>/dev/null || true
|
|
30
|
-
mv docs/plans/*-progress.md docs/plans/completed/ 2>/dev/null || true
|
|
31
|
-
mv docs/plans/adr/*.md docs/plans/completed/adr/ 2>/dev/null || true
|
|
32
|
-
rmdir docs/plans/adr 2>/dev/null || true
|
|
33
|
-
git add docs/plans/ && git commit -m "chore: archive planning docs"
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
Each `mv` gracefully handles the case where no matching files exist (e.g., if the user skipped straight from brainstorm to finalize without executing tasks).
|
|
37
|
-
|
|
38
|
-
2. **Review & Polish Lessons (Agile Scrum Master Hat)** — if `docs/lessons.md` exists, put on your **Agile Scrum Master Hat** to curate and optimize it for future sprints:
|
|
39
|
-
- **Add missed lessons** — capture any lessons from this session that weren't written during execution
|
|
40
|
-
- **Generalize domain-specific rules** — if a rule names a specific service, entity, or feature, either rewrite it as a generic pattern or remove it if no generic form exists
|
|
41
|
-
- **De-duplicate** — combine overlapping or redundant rules into single, sharper entries
|
|
42
|
-
- **Categorize** — group the rules under clear, structured markdown headers (e.g., `## Tool Usage`, `## Testing Patterns`, `## Architecture Rules`) to make the document highly scannable for future sessions. Keep the `## Rules` section as the append target for new entries during execution — categorization moves rules out of `## Rules` into the appropriate category headers.
|
|
43
|
-
- **Retire stale rules** — remove bullets that no longer apply
|
|
44
|
-
- If no changes are needed, leave it as-is
|
|
45
|
-
|
|
46
|
-
If `docs/lessons.md` doesn't exist but lessons were learned this session, create it with the standard format:
|
|
47
|
-
|
|
48
|
-
```markdown
|
|
49
|
-
# Lessons Learned
|
|
50
|
-
|
|
51
|
-
<!--
|
|
52
|
-
Agent: read this at the start of each task during executing-tasks.
|
|
53
|
-
Follow every rule. Add new rules when you catch yourself making repeat mistakes.
|
|
54
|
-
Rules must be generic patterns applicable to any domain or feature — not specific to one service, entity, or use case.
|
|
55
|
-
Retire rules that no longer apply during finalizing.
|
|
56
|
-
-->
|
|
57
|
-
|
|
58
|
-
## Rules
|
|
59
|
-
|
|
60
|
-
- <rule 1>
|
|
61
|
-
- <rule 2>
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
3. **Update documentation** — if the API or surface changed:
|
|
65
|
-
- Update README.md
|
|
66
|
-
- Update CHANGELOG.md
|
|
67
|
-
- Update any inline docs
|
|
68
|
-
|
|
69
|
-
4. **Choose a merge strategy** — ask the human which option they prefer:
|
|
70
|
-
|
|
71
|
-
1. **Create PR** — push and open a PR for external review:
|
|
72
|
-
```
|
|
73
|
-
git push origin <branch>
|
|
74
|
-
gh pr create --title "feat: <summary>" --body "<task summary>"
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
Use the progress file to generate the summary. Convert the task table to a bulleted list:
|
|
78
|
-
```
|
|
79
|
-
- ✅ Create User model
|
|
80
|
-
- ✅ Write User model tests
|
|
81
|
-
- ⏭ Add auth middleware (skipped)
|
|
82
|
-
- ✅ Add login endpoint
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
2. **Rebase & merge** *(recommended)* — rebase onto parent, fast-forward merge, push parent, delete branch:
|
|
86
|
-
```
|
|
87
|
-
parent=$(git show-branch -a 2>/dev/null | grep '\*' | grep -v "$(git branch --show-current)" | head -1 | sed 's/.*\[\(.*\)\].*/\1/' | sed 's/[\^~].*//')
|
|
88
|
-
git checkout "$parent" && git pull
|
|
89
|
-
git checkout - && git rebase "$parent"
|
|
90
|
-
git checkout "$parent" && git merge --ff-only -
|
|
91
|
-
git push origin "$parent"
|
|
92
|
-
git branch -d - && git push origin --delete -
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
3. **Squash & merge** — squash all commits into one on parent, push parent, delete branch:
|
|
96
|
-
```
|
|
97
|
-
parent=$(git show-branch -a 2>/dev/null | grep '\*' | grep -v "$(git branch --show-current)" | head -1 | sed 's/.*\[\(.*\)\].*/\1/' | sed 's/[\^~].*//')
|
|
98
|
-
git checkout "$parent" && git pull
|
|
99
|
-
git merge --squash -
|
|
100
|
-
git commit -m "feat: <summary>"
|
|
101
|
-
git push origin "$parent"
|
|
102
|
-
git branch -d - && git push origin --delete -
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
4. **Merge commit** — merge with `--no-ff`, push parent, delete branch:
|
|
106
|
-
```
|
|
107
|
-
parent=$(git show-branch -a 2>/dev/null | grep '\*' | grep -v "$(git branch --show-current)" | head -1 | sed 's/.*\[\(.*\)\].*/\1/' | sed 's/[\^~].*//')
|
|
108
|
-
git checkout "$parent" && git pull
|
|
109
|
-
git checkout - && git merge --no-ff -m "Merge branch '<branch>'" -
|
|
110
|
-
git push origin "$parent"
|
|
111
|
-
git branch -d - && git push origin --delete -
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
For options 2–4, confirm the detected parent branch with the human before proceeding.
|
|
115
|
-
|
|
116
|
-
5. **Clean up** — if a worktree was used, remove it:
|
|
117
|
-
```
|
|
118
|
-
git worktree remove ../<repo>-<feature-name>
|
|
119
|
-
```
|