@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.
Files changed (67) hide show
  1. package/README.md +91 -64
  2. package/agents/pwk-hazard-reviewer.md +24 -0
  3. package/agents/pwk-smell-reviewer.md +17 -0
  4. package/agents/pwk-spec-reviewer.md +14 -0
  5. package/agents/pwk-tracing-reviewer.md +14 -0
  6. package/docs/developer-usage-guide.md +49 -37
  7. package/docs/lessons.md +13 -0
  8. package/docs/oversight-model.md +19 -9
  9. package/docs/workflow-phases.md +58 -29
  10. package/extensions/workflow-guard.ts +190 -91
  11. package/package.json +19 -3
  12. package/skills/pwk-brainstorming/SKILL.md +60 -0
  13. package/skills/pwk-code-review/SKILL.md +46 -0
  14. package/skills/{diagnose → pwk-diagnose}/SKILL.md +3 -2
  15. package/skills/pwk-executing-tasks/SKILL.md +154 -0
  16. package/skills/pwk-finalizing/SKILL.md +78 -0
  17. package/skills/pwk-status/SKILL.md +28 -0
  18. package/skills/pwk-writing-plans/SKILL.md +83 -0
  19. package/docs/plans/2026-06-03-karpathy-guidelines-ab-comparison.md +0 -166
  20. package/docs/plans/completed/2026-04-11-checkpoint-review-gates-design.md +0 -50
  21. package/docs/plans/completed/2026-04-11-checkpoint-review-gates-implementation.md +0 -98
  22. package/docs/plans/completed/2026-04-11-finalizing-merge-options-design.md +0 -33
  23. package/docs/plans/completed/2026-04-11-finalizing-merge-options-implementation.md +0 -75
  24. package/docs/plans/completed/2026-04-11-workspace-setup-design.md +0 -28
  25. package/docs/plans/completed/2026-04-11-workspace-setup-implementation.md +0 -57
  26. package/docs/plans/completed/2026-04-15-bash-guard-design.md +0 -39
  27. package/docs/plans/completed/2026-04-15-bash-guard-implementation.md +0 -229
  28. package/docs/plans/completed/2026-04-21-workflow-guard-safe-commands-design.md +0 -172
  29. package/docs/plans/completed/2026-04-21-workflow-guard-safe-commands-implementation.md +0 -168
  30. package/docs/plans/completed/2026-04-22-go-readonly-safe-commands-implementation.md +0 -54
  31. package/docs/plans/completed/2026-04-28-executing-tasks-redesign-design.md +0 -171
  32. package/docs/plans/completed/2026-04-28-executing-tasks-redesign-implementation.md +0 -208
  33. package/docs/plans/completed/2026-04-28-executing-tasks-redesign-progress.md +0 -14
  34. package/docs/plans/completed/2026-05-01-incorporate-mattpocock-skills-design.md +0 -154
  35. package/docs/plans/completed/2026-05-01-incorporate-mattpocock-skills-implementation.md +0 -315
  36. package/docs/plans/completed/2026-05-01-incorporate-mattpocock-skills-progress.md +0 -15
  37. package/docs/plans/completed/2026-05-08-checkpoint-gates-design.md +0 -235
  38. package/docs/plans/completed/2026-05-08-checkpoint-gates-implementation.md +0 -83
  39. package/docs/plans/completed/2026-05-08-checkpoint-gates-progress.md +0 -11
  40. package/docs/plans/completed/2026-05-08-lessons-learned-design.md +0 -76
  41. package/docs/plans/completed/2026-05-08-lessons-learned-implementation.md +0 -219
  42. package/docs/plans/completed/2026-05-08-lessons-learned-progress.md +0 -15
  43. package/docs/plans/completed/2026-05-08-migrate-earendil-works-design.md +0 -39
  44. package/docs/plans/completed/2026-05-08-migrate-earendil-works-implementation.md +0 -45
  45. package/docs/plans/completed/2026-05-08-migrate-earendil-works-progress.md +0 -10
  46. package/docs/plans/completed/2026-05-08-worktree-handoff-design.md +0 -118
  47. package/docs/plans/completed/2026-05-08-worktree-handoff-implementation.md +0 -140
  48. package/docs/plans/completed/2026-05-08-worktree-handoff-progress.md +0 -10
  49. package/docs/plans/completed/2026-05-20-generic-lessons-design.md +0 -70
  50. package/docs/plans/completed/2026-05-20-generic-lessons-implementation.md +0 -114
  51. package/docs/plans/completed/2026-05-20-generic-lessons-progress.md +0 -11
  52. package/docs/plans/completed/2026-05-22-agentic-agile-enhancements-design.md +0 -77
  53. package/docs/plans/completed/2026-05-22-agentic-agile-enhancements-implementation.md +0 -473
  54. package/docs/plans/completed/2026-05-25-design-review-split-implementation.md +0 -622
  55. package/docs/plans/completed/2026-05-25-design-review-split-progress.md +0 -16
  56. package/docs/plans/completed/2026-05-25-pr5-improvements-implementation.md +0 -273
  57. package/docs/plans/completed/2026-05-25-pr5-improvements-progress.md +0 -17
  58. package/docs/plans/completed/2026-06-03-add-verify-skill-design.md +0 -51
  59. package/docs/plans/completed/2026-06-03-add-verify-skill-implementation.md +0 -111
  60. package/docs/plans/completed/2026-06-03-add-verify-skill-progress.md +0 -11
  61. package/docs/plans/completed/2026-06-03-verify-skill-design.md +0 -176
  62. package/skills/brainstorming/SKILL.md +0 -48
  63. package/skills/design-review/SKILL.md +0 -113
  64. package/skills/executing-tasks/SKILL.md +0 -350
  65. package/skills/finalizing/SKILL.md +0 -119
  66. package/skills/verify/SKILL.md +0 -170
  67. package/skills/writing-plans/SKILL.md +0 -343
@@ -1,39 +0,0 @@
1
- # Migrate from @mariozechner to @earendil-works
2
-
3
- ## Context
4
-
5
- pi has moved from `@mariozechner` to `@earendil-works` on GitHub and npm. The old `@mariozechner/pi-coding-agent@0.73.1` is deprecated. This package has two unused peer deps (`pi-ai`, `pi-tui`) that should be cleaned up.
6
-
7
- ## Changes
8
-
9
- ### 1. `extensions/workflow-guard.ts` — update import
10
-
11
- ```diff
12
- -import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
13
- +import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
14
- ```
15
-
16
- ### 2. `package.json` — update peerDependencies
17
-
18
- ```diff
19
- "peerDependencies": {
20
- - "@mariozechner/pi-ai": "*",
21
- - "@mariozechner/pi-coding-agent": "*",
22
- - "@mariozechner/pi-tui": "*",
23
- + "@earendil-works/pi-coding-agent": "*",
24
- "@sinclair/typebox": "*"
25
- },
26
- ```
27
-
28
- - Rename `pi-coding-agent` to `@earendil-works/pi-coding-agent`
29
- - Remove `@mariozechner/pi-ai` (unused)
30
- - Remove `@mariozechner/pi-tui` (unused)
31
-
32
- ## Verification
33
-
34
- - `ExtensionAPI` is exported identically from both old and new packages (same export map, same `.d.ts` path)
35
- - No other imports from `@mariozechner/*` exist in the codebase
36
-
37
- ## Impact
38
-
39
- Users on old `@mariozechner/pi-coding-agent` will get a peer dependency resolution error — they must update pi. The old package is explicitly deprecated pointing to the new one.
@@ -1,45 +0,0 @@
1
- # Implementation Plan: Migrate from @mariozechner to @earendil-works
2
-
3
- ## Task 1: Update package scope and clean up peer dependencies
4
-
5
- <!-- tdd: trivial -->
6
- <!-- checkpoint: done -->
7
-
8
- Migrate the sole import and peerDependencies from `@mariozechner/*` to `@earendil-works/pi-coding-agent`, dropping the two unused deps (`pi-ai`, `pi-tui`).
9
-
10
- ### Files to modify
11
-
12
- 1. **`extensions/workflow-guard.ts`** — line 2:
13
-
14
- ```diff
15
- -import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
16
- +import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
17
- ```
18
-
19
- 2. **`package.json`** — `peerDependencies`:
20
-
21
- ```diff
22
- "peerDependencies": {
23
- - "@mariozechner/pi-ai": "*",
24
- - "@mariozechner/pi-coding-agent": "*",
25
- - "@mariozechner/pi-tui": "*",
26
- + "@earendil-works/pi-coding-agent": "*",
27
- "@sinclair/typebox": "*"
28
- },
29
- ```
30
-
31
- ### Verify
32
-
33
- ```bash
34
- grep -r "@mariozechner" extensions/ package.json
35
- # Expected: no output
36
-
37
- npm run check
38
- # Expected: passes (lint + tests)
39
- ```
40
-
41
- ### Commit
42
-
43
- ```
44
- chore: migrate from @mariozechner to @earendil-works, drop unused peer deps
45
- ```
@@ -1,10 +0,0 @@
1
- # Progress: Migrate from @mariozechner to @earendil-works
2
-
3
- Plan: docs/plans/2026-05-08-migrate-earendil-works-implementation.md
4
- Branch: migrate-earendil-works
5
- Started: 2026-05-08T00:00:00Z
6
- Last updated: 2026-05-08T00:02:00Z
7
-
8
- | # | Status | Task | Commit |
9
- |---|--------|------|--------|
10
- | 1 | ✅ done | Update package scope and clean up peer dependencies (checkpoint: done) | 0a29af0 |
@@ -1,118 +0,0 @@
1
- # Worktree Handoff: Stop & Restart in New Directory
2
-
3
- ## Problem
4
-
5
- When the user asks the agent to create a worktree during `executing-tasks`, the agent creates the worktree on disk but continues running in the original directory. All subsequent file operations, git commands, and task execution happen in the wrong place.
6
-
7
- Pi sessions are tied to their working directory — the agent cannot `cd` or spawn a sub-session in a different directory.
8
-
9
- ## Root cause
10
-
11
- The `executing-tasks` skill creates the worktree (step 2) then continues executing tasks in the original directory instead of stopping and handing off to a new session.
12
-
13
- ## Solution
14
-
15
- When the user chooses worktree isolation in `executing-tasks`, the agent:
16
-
17
- 1. Creates the worktree
18
- 2. Moves all plan docs into the worktree
19
- 3. Commits the removal on the current branch
20
- 4. Stops and tells the user to restart in the worktree
21
-
22
- The new session in the worktree finds the plan docs and continues seamlessly.
23
-
24
- ## Changes
25
-
26
- ### `skills/executing-tasks/SKILL.md`
27
-
28
- Replace step 2 ("Suggest workspace isolation") with a "Create & handoff" pattern for worktrees:
29
-
30
- ```
31
- 2. **Suggest workspace isolation** — if the user isn't already on a feature branch or worktree, present the options:
32
-
33
- - **Branch** (smaller changes):
34
- ```
35
- git checkout -b <feature-name>
36
- ```
37
-
38
- - **Worktree** (larger features, keeps main clean):
39
- ```
40
- git worktree add ../<repo>-<feature-name> -b <feature-name>
41
- ```
42
-
43
- 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.
44
-
45
- 3. **If worktree was chosen — hand off to new session:**
46
-
47
- a. Move plan docs into the worktree:
48
- ```
49
- mv docs/plans/*-design.md docs/plans/*-implementation.md docs/plans/*-progress.md <worktree>/docs/plans/ 2>/dev/null || true
50
- mv docs/plans/adr/*.md <worktree>/docs/plans/adr/ 2>/dev/null || true
51
- ```
52
-
53
- b. Commit the removal on the current branch (if files were committed):
54
- ```
55
- git rm docs/plans/*-design.md docs/plans/*-implementation.md docs/plans/*-progress.md 2>/dev/null || true
56
- git rm -r docs/plans/adr/ 2>/dev/null || true
57
- git commit -m "chore: move plan docs to worktree for <feature-name>"
58
- ```
59
-
60
- c. Stop and show the user:
61
- ```
62
- ✅ Worktree created at ../<repo>-<feature-name>
63
- 📄 Plan docs moved to the worktree.
64
-
65
- To continue, start a new session there:
66
- cd ../<repo>-<feature-name> && pi
67
-
68
- Then run: /skill:executing-tasks
69
- ```
70
-
71
- d. **Do not proceed with task execution.** The session ends here.
72
- ```
73
-
74
- Remove the current step 3–4 numbering (progress file, commit plan docs) and renumber to account for the new handoff step. The "First run" flow becomes:
75
-
76
- 1. Parse the implementation plan
77
- 2. Suggest workspace isolation (branch or worktree)
78
- 3. **If branch:** create progress file, commit plan docs, begin execution (existing flow)
79
- 4. **If worktree:** move docs, commit removal, stop with handoff message (new flow)
80
-
81
- ### No changes to other skills
82
-
83
- - `brainstorming` — read-only phase, no isolation needed
84
- - `writing-plans` — read-only phase, no isolation needed
85
- - `finalizing` — already handles worktree cleanup (`git worktree remove`)
86
-
87
- ## User experience
88
-
89
- ### Branch isolation (unchanged)
90
-
91
- ```
92
- Agent: Would you like branch or worktree isolation?
93
- User: branch
94
- Agent: [creates branch, creates progress file, begins executing tasks]
95
- ```
96
-
97
- ### Worktree isolation (new)
98
-
99
- ```
100
- Agent: Would you like branch or worktree isolation?
101
- User: worktree
102
- Agent: ✅ Worktree created at ../my-repo-auth
103
- 📄 Plan docs moved to the worktree.
104
-
105
- To continue, start a new session there:
106
- cd ../my-repo-auth && pi
107
-
108
- Then run: /skill:executing-tasks
109
- ```
110
-
111
- User opens a new terminal, runs the commands, and the new session picks up where the old one left off.
112
-
113
- ## Edge cases
114
-
115
- - **No plan docs exist yet** — just create the worktree, don't try to move files
116
- - **Partial progress (some tasks done)** — progress file is moved, preserving state
117
- - **Uncommitted plan docs** — `mv` removes them, no `git rm` needed; commit only if they were previously committed
118
- - **Other uncommitted changes on current branch** — only touch plan docs, leave everything else untouched
@@ -1,140 +0,0 @@
1
- # Implementation Plan: Worktree Handoff
2
-
3
- ## Overview
4
-
5
- Modify `skills/executing-tasks/SKILL.md` so that when the user chooses worktree isolation, the agent moves plan docs to the worktree, commits the removal, and stops with a handoff message instead of continuing execution in the wrong directory.
6
-
7
- **Design doc:** `docs/plans/2026-05-08-worktree-handoff-design.md`
8
-
9
- ---
10
-
11
- ## Task 1: Add worktree handoff flow to executing-tasks
12
-
13
- <!-- tdd: trivial -->
14
- <!-- checkpoint: none -->
15
-
16
- Modify the "First run" section of `skills/executing-tasks/SKILL.md`. After the workspace isolation prompt (step 2), add a branching path: if the user chose worktree, move docs and stop; if branch, continue with existing flow.
17
-
18
- ### File: `skills/executing-tasks/SKILL.md`
19
-
20
- Replace the current steps 2–5 in the "First run" section:
21
-
22
- ```markdown
23
- 2. **Suggest workspace isolation** — if the user isn't already on a feature branch or worktree, present the options:
24
-
25
- - **Branch** (smaller changes):
26
- ```
27
- git checkout -b <feature-name>
28
- ```
29
- - **Worktree** (larger features, keeps main clean):
30
- ```
31
- git worktree add ../<repo>-<feature-name> -b <feature-name>
32
- ```
33
-
34
- 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.
35
-
36
- 3. **Create the progress file** — save to `docs/plans/<plan-name>-progress.md` (replace `-implementation` with `-progress` in the plan filename):
37
-
38
- ```markdown
39
- # Progress: <topic>
40
-
41
- Plan: docs/plans/YYYY-MM-DD-<topic>-implementation.md
42
- Branch: <actual branch name>
43
- Started: <ISO timestamp>
44
- Last updated: <ISO timestamp>
45
-
46
- | # | Status | Task | Commit |
47
- |---|--------|------|--------|
48
- | 1 | ⬜ pending | Task description (preserve checkpoint labels) | — |
49
- ```
50
-
51
- Use the actual branch name — whether it's the original branch or a new one from the isolation step.
52
-
53
- 4. **Commit the plan docs** — if `docs/plans/` has uncommitted files, commit them on the new branch:
54
- ```
55
- git add docs/plans/ && git commit -m "docs: add design and implementation plan"
56
- ```
57
-
58
- 5. **Begin task execution** — start with task 1 (see [Per-task execution](#per-task-execution)).
59
- ```
60
-
61
- With:
62
-
63
- ```markdown
64
- 2. **Suggest workspace isolation** — if the user isn't already on a feature branch or worktree, present the options:
65
-
66
- - **Branch** (smaller changes):
67
- ```
68
- git checkout -b <feature-name>
69
- ```
70
- - **Worktree** (larger features, keeps main clean):
71
- ```
72
- git worktree add ../<repo>-<feature-name> -b <feature-name>
73
- ```
74
-
75
- 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.
76
-
77
- 3. **If worktree was chosen — hand off to new session:**
78
-
79
- a. Ensure the worktree's `docs/plans/` directory exists:
80
- ```
81
- mkdir -p <worktree>/docs/plans
82
- mkdir -p <worktree>/docs/plans/adr
83
- ```
84
-
85
- b. Move plan docs into the worktree:
86
- ```
87
- mv docs/plans/*-design.md <worktree>/docs/plans/ 2>/dev/null || true
88
- mv docs/plans/*-implementation.md <worktree>/docs/plans/ 2>/dev/null || true
89
- mv docs/plans/*-progress.md <worktree>/docs/plans/ 2>/dev/null || true
90
- mv docs/plans/adr/*.md <worktree>/docs/plans/adr/ 2>/dev/null || true
91
- ```
92
-
93
- c. Commit the removal on the current branch (if any plan docs were committed):
94
- ```
95
- git rm docs/plans/*-design.md docs/plans/*-implementation.md docs/plans/*-progress.md 2>/dev/null || true
96
- git rm -r docs/plans/adr/ 2>/dev/null || true
97
- git commit -m "chore: move plan docs to worktree for <feature-name>"
98
- ```
99
-
100
- d. Stop and show the user:
101
- ```
102
- ✅ Worktree created at ../<repo>-<feature-name>
103
- 📄 Plan docs moved to the worktree.
104
-
105
- To continue, start a new session there:
106
- cd ../<repo>-<feature-name> && pi
107
-
108
- Then run: /skill:executing-tasks
109
- ```
110
-
111
- e. **Do not proceed with task execution.** The session ends here.
112
-
113
- 4. **If branch was chosen — continue with execution:**
114
-
115
- a. **Create the progress file** — save to `docs/plans/<plan-name>-progress.md` (replace `-implementation` with `-progress` in the plan filename):
116
-
117
- ```markdown
118
- # Progress: <topic>
119
-
120
- Plan: docs/plans/YYYY-MM-DD-<topic>-implementation.md
121
- Branch: <actual branch name>
122
- Started: <ISO timestamp>
123
- Last updated: <ISO timestamp>
124
-
125
- | # | Status | Task | Commit |
126
- |---|--------|------|--------|
127
- | 1 | ⬜ pending | Task description (preserve checkpoint labels) | — |
128
- ```
129
-
130
- Use the actual branch name — whether it's the original branch or a new one from the isolation step.
131
-
132
- b. **Commit the plan docs** — if `docs/plans/` has uncommitted files, commit them on the new branch:
133
- ```
134
- git add docs/plans/ && git commit -m "docs: add design and implementation plan"
135
- ```
136
-
137
- c. **Begin task execution** — start with task 1 (see [Per-task execution](#per-task execution)).
138
- ```
139
-
140
- **Commit:** `feat(executing-tasks): add worktree handoff with plan doc migration`
@@ -1,10 +0,0 @@
1
- # Progress: Worktree Handoff
2
-
3
- Plan: docs/plans/2026-05-08-worktree-handoff-implementation.md
4
- Branch: main
5
- Started: 2026-05-08T00:00:00Z
6
- Last updated: 2026-05-08T00:00:00Z
7
-
8
- | # | Status | Task | Commit |
9
- |---|--------|------|--------|
10
- | 1 | ✅ done | Add worktree handoff flow to executing-tasks | 2ce48e7 |
@@ -1,70 +0,0 @@
1
- # Design: Enforce Generic Lessons in `docs/lessons.md`
2
-
3
- ## Problem
4
-
5
- During `executing-tasks`, the agent writes lessons to `docs/lessons.md` scoped to the task at hand. In a monorepo, this produces domain-specific rules that are only useful within one feature or sprint — for example:
6
-
7
- > "Always validate `userId` before calling `UserProfile.Get`"
8
-
9
- The real lesson — applicable across any domain — would be:
10
-
11
- > "Always validate required ID fields at the service boundary — missing IDs should return 400, not 500"
12
-
13
- Domain-specific rules decay immediately after the feature is done and pollute the lessons file for future work.
14
-
15
- ## Goal
16
-
17
- Rules in `docs/lessons.md` should be generic patterns applicable to any domain or feature in the repo, not instances of a pattern tied to one service or entity.
18
-
19
- ## Affected files
20
-
21
- - `skills/executing-tasks/SKILL.md`
22
- - `skills/finalizing/SKILL.md`
23
-
24
- ## Changes
25
-
26
- ### 1. `executing-tasks` — Step 6 "Learn from mistakes"
27
-
28
- Add a **generalization test** after "Only add rules that would change future behavior."
29
-
30
- ```
31
- Before writing, apply the **generalization test**: would this rule apply equally to a
32
- completely different feature or domain in this repo? If not, rewrite it — strip out
33
- specific service names, entity types, and domain concepts, and express the underlying
34
- pattern instead. If you can't express a generic form, don't write the rule.
35
-
36
- ❌ Domain-specific (only survives this sprint):
37
- "Always validate `userId` before calling `UserProfile.Get`"
38
-
39
- ✅ Generic (applies across the whole repo):
40
- "Always validate required ID fields at the service boundary — missing IDs should
41
- return 400, not 500"
42
- ```
43
-
44
- ### 2. `executing-tasks` — `docs/lessons.md` format template comment
45
-
46
- Add one line to the comment block so the constraint is visible every time the agent opens the file:
47
-
48
- ```
49
- Rules must be generic patterns applicable to any domain or feature — not specific to
50
- one service, entity, or use case.
51
- ```
52
-
53
- ### 3. `finalizing` — Step 2 "Review lessons learned"
54
-
55
- Add a generalization audit bullet between "Add any lessons..." and "Retire rules...":
56
-
57
- ```
58
- - Generalize domain-specific rules — if a rule names a specific service, entity, or
59
- feature, either rewrite it as a generic pattern or remove it if no generic form exists
60
- ```
61
-
62
- ### 4. `finalizing` — `docs/lessons.md` format template comment
63
-
64
- Same addition as change 2 — keep both template definitions consistent.
65
-
66
- ## Slice summary
67
-
68
- One end-to-end slice:
69
-
70
- > **Lessons stay generic** — at write-time (executing-tasks step 6) the agent is required to generalize before writing; the file's own comment reinforces the constraint; at finalization the agent audits and cleans up anything that slipped through.
@@ -1,114 +0,0 @@
1
- # Implementation Plan: Enforce Generic Lessons in `docs/lessons.md`
2
-
3
- Design: docs/plans/2026-05-20-generic-lessons-design.md
4
-
5
- Two skill files need four text edits total. No tests (markdown-only changes). Both
6
- tasks are trivial — exact old/new text is specified so the executor can apply them
7
- without guessing.
8
-
9
- ---
10
-
11
- ## Task 1: Add generalization test + update format comment in `executing-tasks`
12
-
13
- <!-- tdd: trivial -->
14
-
15
- File: `skills/executing-tasks/SKILL.md`
16
-
17
- Two edits in one file:
18
-
19
- ### Edit A — Step 6 "Learn from mistakes"
20
-
21
- Replace:
22
- ```
23
- 6. **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).
24
- ```
25
-
26
- With:
27
- ```
28
- 6. **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).
29
-
30
- 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.
31
-
32
- ❌ **Domain-specific** (only survives this sprint):
33
- > "Always validate `userId` before calling `UserProfile.Get`"
34
-
35
- ✅ **Generic** (applies across the whole repo):
36
- > "Always validate required ID fields at the service boundary — missing IDs should return 400, not 500"
37
- ```
38
-
39
- ### Edit B — `docs/lessons.md` format template comment
40
-
41
- Replace:
42
- ```
43
- <!--
44
- Agent: read this at the start of each task during executing-tasks.
45
- Follow every rule. Add new rules when you catch yourself making repeat mistakes.
46
- Retire rules that no longer apply during finalizing.
47
- -->
48
- ```
49
-
50
- With:
51
- ```
52
- <!--
53
- Agent: read this at the start of each task during executing-tasks.
54
- Follow every rule. Add new rules when you catch yourself making repeat mistakes.
55
- Rules must be generic patterns applicable to any domain or feature — not specific to one service, entity, or use case.
56
- Retire rules that no longer apply during finalizing.
57
- -->
58
- ```
59
-
60
- Steps:
61
- 1. Apply Edit A to `skills/executing-tasks/SKILL.md`
62
- 2. Apply Edit B to `skills/executing-tasks/SKILL.md`
63
- 3. Verify: open the file and confirm both edits are present and the surrounding text is intact
64
-
65
- ---
66
-
67
- ## Task 2: Add generalization audit bullet + update format comment in `finalizing`
68
-
69
- <!-- tdd: trivial -->
70
-
71
- File: `skills/finalizing/SKILL.md`
72
-
73
- Two edits in one file:
74
-
75
- ### Edit A — Step 2 "Review lessons learned"
76
-
77
- Replace:
78
- ```
79
- - Add any lessons from this session that were missed during execution
80
- - Retire rules that no longer apply (remove the bullet)
81
- ```
82
-
83
- With:
84
- ```
85
- - Add any lessons from this session that were missed during execution
86
- - **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
87
- - Retire rules that no longer apply (remove the bullet)
88
- ```
89
-
90
- ### Edit B — `docs/lessons.md` format template comment
91
-
92
- Replace:
93
- ```
94
- <!--
95
- Agent: read this at the start of each task during executing-tasks.
96
- Follow every rule. Add new rules when you catch yourself making repeat mistakes.
97
- Retire rules that no longer apply during finalizing.
98
- -->
99
- ```
100
-
101
- With:
102
- ```
103
- <!--
104
- Agent: read this at the start of each task during executing-tasks.
105
- Follow every rule. Add new rules when you catch yourself making repeat mistakes.
106
- Rules must be generic patterns applicable to any domain or feature — not specific to one service, entity, or use case.
107
- Retire rules that no longer apply during finalizing.
108
- -->
109
- ```
110
-
111
- Steps:
112
- 1. Apply Edit A to `skills/finalizing/SKILL.md`
113
- 2. Apply Edit B to `skills/finalizing/SKILL.md`
114
- 3. Verify: open the file and confirm both edits are present and the surrounding text is intact
@@ -1,11 +0,0 @@
1
- # Progress: generic-lessons
2
-
3
- Plan: docs/plans/2026-05-20-generic-lessons-implementation.md
4
- Branch: generic-lessons
5
- Started: 2026-05-20T00:00:00Z
6
- Last updated: 2026-05-20T00:00:00Z
7
-
8
- | # | Status | Task | Commit |
9
- |---|--------|------|--------|
10
- | 1 | ✅ done | Add generalization test + update format comment in `executing-tasks` | 96010f7 |
11
- | 2 | ✅ done | Add generalization audit bullet + update format comment in `finalizing` | 72f088d |
@@ -1,77 +0,0 @@
1
- # Design: Agentic Agile & Architectural Rigor Enhancements
2
-
3
- Enforcing rigorous Agile engineering discipline within `pi-workflow-kit` by introducing Behavioral Acceptance Criteria, Cognitive Persona Shifts, automated Lessons Curation, strict Multi-Pillar Architectural Reviews, and High-Risk Operation Safeguards.
4
-
5
- ## Context & Objectives
6
- Based on industry standards and modern agentic development templates (such as Microsoft's Agentic Agile model), autonomous coding agents succeed most when operating under tight behavioral boundaries, specialized cognitive roles, and continuous retro/learning loops.
7
-
8
- We are enhancing `pi-workflow-kit` by mapping out distinct engineering "Hats" and rigorous check-gates directly into our existing phase-based skills without adding repository clutter or introducing flaky external file lookups:
9
- 1. **The QA Engineer Hat** (in `writing-plans`): Defines rigid, testable `Given/When/Then` Acceptance Criteria for both happy and edge paths during planning.
10
- 2. **The Pragmatic Developer & Senior Refactorer Hats** (in `executing-tasks`): Guides the execution loop through clear cognitive phases (Green Light → Polish / Software Craftsmanship).
11
- 3. **The Agile Scrum Master Hat** (in `finalizing`): Cleans up, de-duplicates, and categorizes persistent lessons to prevent context-bloat and maximize the utility of future sprints.
12
- 4. **Architectural Review & Audit Gates**: Formally audits both the design (brainstorming) and the plan (writing-plans) against the 6 core pillars of production-grade software (Robustness, Atomicity, Security, Scalability, Compatibility, and Testability) before allowing the agent to move forward.
13
- 5. **High-Risk Operation Safeguards**: Auto-detects critical execution hazards (unbounded Redis scans, in-memory OOM loops, unthrottled concurrency, long-running transactions, etc.) and mandates strict mitigation steps and verification checkpoints.
14
-
15
- ---
16
-
17
- ## Architecture & Detailed Design
18
-
19
- Because agent workspaces default tool execution and file-reading relative to the user's project directory, external files bundled in NPM global modules are not reliably reachable. Therefore, all guidelines are **inlined directly within the respective `SKILL.md` prompts**. This guarantees 100% reliability, zero repository pollution, and zero runtime performance overhead.
20
-
21
- ### Slice 1: Multi-Pillar Design Review & Risk Detection (`brainstorming`)
22
- Before concluding a brainstorm and generating a design doc, the agent must put on its **Architect Hat** and evaluate the proposed system against the **6 Pillars of Production-Grade Design**:
23
- 1. **Robustness & Fault Tolerance**: How expected failures are handled, subsystem isolation, and graceful degradation.
24
- 2. **Atomicity & Consistency**: Database transactions, state rollback on error, and endpoint idempotency.
25
- 3. **Security & Access Control**: Input validation/sanitization and authorization checks at the boundary.
26
- 4. **Scalability & Performance**: Connection pooling, closing resource leaks, and preventing N+1 queries.
27
- 5. **Backwards Compatibility**: Schema migration safety, zero-downtime deployment, and API versioning.
28
- 6. **Testability**: Injection seams for external dependencies (APIs, system clocks, randomizers) to keep tests 100% deterministic.
29
-
30
- #### ⚠️ High-Risk Hazard Auditing
31
- The agent must proactively audit the design for the **8 High-Risk Production Hazards**:
32
- 1. **Unbounded Redis Deletions / Operations**: Multi-key deletion or scans (e.g. `KEYS` or raw `SCAN` loops) that block single-threaded performance.
33
- 2. **In-Memory OOM Loops**: Fetching complete database datasets into server memory (e.g., raw `select *`) to filter, sort, or map in runtime heap.
34
- 3. **Unbounded Concurrency Spikes**: Running concurrent network requests (e.g. unthrottled `Promise.all`) without strict batch limits (e.g., `p-limit`).
35
- 4. **Missing High-Frequency Indexes**: Running queries on unindexed columns, forcing expensive table-scans under load.
36
- 5. **Nested/Long-Running Transactions**: Holding database connections and locks open while awaiting slow external HTTP, disk, or cryptographic tasks.
37
- 6. **Unrestricted Uploads & Temp Flooding**: Writing uploaded data directly to local temporary paths without validation limits or explicit `finally` cleanup blocks.
38
- 7. **Raw Query String Interpolation**: Merging raw variables into SQL queries or shell command inputs (susceptible to injection).
39
- 8. **Silent Swallowing loops**: Background workers or cron tasks silently catching and suppressing exceptions without logging, back-offs, or alerts.
40
-
41
- #### 🔍 Discovering Unknown & Contextual Risks (Socratic Heuristics)
42
- To identify novel or domain-specific risks that fall outside the standard checklist, the agent must put on its **SRE Hat** and audit the proposed logic against the **3 Socratic Heuristics**:
43
- * **The "Scale to 100x" Heuristic (Resource Exhaustion)**: If this operation is run 100x/sec or on 100k items, what breaks? (Memory, CPU, Disk I/O, sockets, database connection limits).
44
- * **The "Hostile World" Heuristic (Security & Malice)**: If a malicious actor has complete control over these inputs (headers, payloads, IDs), how can they exploit, crash, or extract data?
45
- * **The "Silent Error" Heuristic (Observability & Partitioning)**: If this downstream dependency or query hangs or fails silently, how does our server react? Is there a timeout, a back-off, or logging?
46
-
47
- If any of the standard hazards or Socratic risks are identified, the design document **must** include a dedicated `⚠️ High-Risk Operations & Mitigations` section detailing the exact safety protocols applied.
48
-
49
- ### Slice 2: Behavioral Acceptance Criteria & Plan Audit (`writing-plans`)
50
- The planning process is enhanced to mandate behavior-driven specifications and an automated plan verification step.
51
-
52
- - **Role**: QA Engineer Hat.
53
- - **Specification Format**: Mandatory `Given/When/Then` blocks covering the Happy Path and Edge/Error Paths.
54
- - **Plan Acceptance Audit**: Before presenting the plan to the user, the agent must verify:
55
- - Every task is a complete vertical slice.
56
- - Sizing is correct (no monolithic tasks).
57
- - Checkpoint gates are placed on the most critical/risky tasks.
58
- - **Risk Enforcement**: Any task containing any of the **8 High-Risk Hazards** or **Socratic Heuristics risks** is strictly required to have a mandatory `checkpoint: done` gate and explicit verification guidelines.
59
-
60
- ### Slice 3: Cognitive Persona Shifts (`executing-tasks`)
61
- The implementation execution loop is updated to divide the cognitive workload of a single task into three distinct phases.
62
-
63
- - **Phase 1: QA Test Phase**: Translate the Given/When/Then specs into failing test cases.
64
- - **Phase 2: Pragmatic Developer Phase**: Implement the simplest, raw code to green the tests.
65
- - **Phase 3: Senior Refactoring Phase**: Refactor and polish using software craftsmanship principles (Shallow Modules, Deletion Test, Duplication, Seam Discipline).
66
-
67
- ### Slice 4: Lessons Curation & Caching (`finalizing`)
68
- The finalizing phase is upgraded to run a structured retrospective on our persistent learning files.
69
-
70
- - **Role**: Agile Scrum Master Hat.
71
- - **Curating Rules**: De-duplicate, validate against the Generalization Test, and categorize rules under distinct headers (e.g., `# Tool Usage`, `# Testing Patterns`, `# Architecture Rules`).
72
-
73
- ---
74
-
75
- ## Verification & Testing Plan
76
- - **Manual Verification**: Run a mock `/skill:writing-plans` and `/skill:executing-tasks` to verify the generated implementation plan matches our QA template and the task-running agent correctly segments its progress through the three cognitive hats.
77
- - **Automated Tests**: Confirm existing Vitest suites run successfully without side-effects.