@tianhai/pi-workflow-kit 0.18.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 (71) hide show
  1. package/README.md +79 -62
  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 +38 -44
  7. package/docs/lessons.md +2 -7
  8. package/docs/oversight-model.md +18 -14
  9. package/docs/workflow-phases.md +52 -29
  10. package/extensions/workflow-guard.ts +190 -92
  11. package/package.json +18 -3
  12. package/skills/pwk-brainstorming/SKILL.md +19 -18
  13. package/skills/pwk-code-review/SKILL.md +46 -0
  14. package/skills/pwk-diagnose/SKILL.md +2 -1
  15. package/skills/pwk-executing-tasks/SKILL.md +102 -328
  16. package/skills/pwk-finalizing/SKILL.md +36 -84
  17. package/skills/pwk-status/SKILL.md +28 -0
  18. package/skills/pwk-writing-plans/SKILL.md +50 -325
  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/docs/plans/completed/2026-06-09-code-review-fixes-implementation.md +0 -74
  63. package/docs/plans/completed/2026-06-09-code-review-fixes-progress.md +0 -14
  64. package/docs/plans/completed/2026-06-09-incremental-workflow-and-rename-design.md +0 -186
  65. package/docs/plans/completed/2026-06-09-incremental-workflow-and-rename-implementation.md +0 -675
  66. package/docs/plans/completed/2026-06-09-incremental-workflow-and-rename-progress.md +0 -18
  67. package/docs/plans/completed/2026-06-09-incremental-workflow-and-rename-verification-report.md +0 -81
  68. package/docs/plans/completed/2026-06-09-verification-fixes-implementation.md +0 -69
  69. package/docs/plans/completed/2026-06-09-verification-fixes-progress.md +0 -14
  70. package/skills/pwk-design-review/SKILL.md +0 -115
  71. package/skills/pwk-verify/SKILL.md +0 -170
@@ -1,76 +0,0 @@
1
- # Lessons Learned
2
-
3
- Date: 2026-05-08
4
-
5
- ## Problem
6
-
7
- During task execution, the AI agent repeatedly makes the same project-specific mistakes — e.g., forgetting to run `make lint && make fmt` in Go projects, ignoring test helper conventions, or violating code style rules. These mistakes persist across sessions because there's no persistent memory the agent reads at the start of each task.
8
-
9
- ## Solution
10
-
11
- A flat rules file (`docs/lessons.md`) that the agent reads before each task and writes to when it catches repeat mistakes. Integrated into the existing 4 workflow skills.
12
-
13
- ## File: `docs/lessons.md`
14
-
15
- Created automatically when the first lesson is written. Never archived or moved.
16
-
17
- ```markdown
18
- # Lessons Learned
19
-
20
- <!--
21
- Agent: read this at the start of each task during executing-tasks.
22
- Follow every rule. Add new rules when you catch yourself making repeat mistakes.
23
- Retire rules that no longer apply during finalizing.
24
- -->
25
-
26
- ## Rules
27
-
28
- - After completing each task in a Go project, run `make lint && make fmt` before committing
29
- ```
30
-
31
- ### Rules for the agent
32
-
33
- - Each rule is a single bullet under `## Rules`
34
- - Write rules as imperative commands ("do X", "never Y", "always Z before W")
35
- - A rule is only added when it would **change future behavior** — not one-off errors
36
- - Rules can be removed (retired) during finalizing if they no longer apply
37
-
38
- ## Data flow
39
-
40
- ```
41
- brainstorming ──── reads lessons (context for design)
42
-
43
- writing-plans ──── reads lessons (informs task breakdown)
44
-
45
- executing-tasks ── reads lessons at start of EACH task
46
- │ appends new lessons when catching repeat mistakes
47
-
48
- finalizing ─────── reviews session for missed lessons
49
- retires stale rules
50
- ```
51
-
52
- Lessons are persisted to disk as soon as they're learned, so `/new` sessions don't lose them.
53
-
54
- ## Skill changes
55
-
56
- ### executing-tasks (3 changes)
57
-
58
- 1. **Per-task execution, step 2** — add bullet: "Read `docs/lessons.md` if it exists — follow all rules listed there while working on this task."
59
- 2. **New step between step 9 (refactor) and step 10 (checkpoint: done)** — "Learn from mistakes: if you caught yourself making a repeat mistake, append a rule to `docs/lessons.md`. Only add rules that would change future behavior."
60
- 3. **"If you're stuck" section** — add at end: "Check `docs/lessons.md` — a previous lesson may be relevant."
61
-
62
- ### finalizing (1 change)
63
-
64
- Add a new step before "Update documentation": "Review `docs/lessons.md` if it exists — add missed lessons, retire stale rules. Create it if lessons were learned but the file doesn't exist yet."
65
-
66
- ### brainstorming (1 change)
67
-
68
- Step 2 (understand the idea) — add after checking package.json/dependencies: "Check `docs/lessons.md` if it exists — known constraints and patterns may affect the design."
69
-
70
- ### writing-plans (1 change)
71
-
72
- Step 1 (check for a design doc) — add after reading relevant code: "Read `docs/lessons.md` if it exists — incorporate known patterns into the task breakdown."
73
-
74
- ## Slice
75
-
76
- Single slice: all 5 skill changes + file format convention. No new skills, extensions, or config.
@@ -1,219 +0,0 @@
1
- # Implementation Plan: Lessons Learned
2
-
3
- Design: `docs/plans/2026-05-08-lessons-learned-design.md`
4
-
5
- ## Overview
6
-
7
- Add a `docs/lessons.md` rules file that the agent reads at natural points in the workflow and writes to when it catches repeat mistakes. Changes are purely instructional — edits to 4 SKILL.md files plus documentation updates.
8
-
9
- No TypeScript code changes. No new extensions or skills. The existing `workflow-guard.ts` already allows writes to `docs/` during execute/finalize phases (it only blocks outside `docs/plans/` during brainstorm/plan). Since `docs/lessons.md` is at `docs/` level (not inside `docs/plans/`), it won't interfere with archiving.
10
-
11
- ---
12
-
13
- ## Task 1: Add lessons-learned read step to executing-tasks skill
14
-
15
- <!-- tdd: trivial -->
16
- <!-- checkpoint: done -->
17
-
18
- **File:** `skills/executing-tasks/SKILL.md`
19
-
20
- **Change 1** — In "Per-task execution", step 2, add a new bullet after the existing ones:
21
-
22
- ```
23
- - **Read `docs/lessons.md` if it exists** — follow all rules listed there while working on this task.
24
- ```
25
-
26
- The full step 2 should become:
27
-
28
- ```markdown
29
- 2. **Read the plan selectively** — 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.
30
- ```
31
-
32
- **Change 2** — In "Per-task execution", insert a new step between step 9 (Refactor if needed) and step 10 (checkpoint: done). The new step becomes step 10, and all subsequent steps renumber by 1 (step 10→11, 11→12, 12→13, 13→14, 14→15):
33
-
34
- ```markdown
35
- 10. **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). Do not add one-off errors or things you self-corrected immediately.
36
-
37
- **`docs/lessons.md` format:**
38
- ```markdown
39
- # Lessons Learned
40
-
41
- <!--
42
- Agent: read this at the start of each task during executing-tasks.
43
- Follow every rule. Add new rules when you catch yourself making repeat mistakes.
44
- Retire rules that no longer apply during finalizing.
45
- -->
46
-
47
- ## Rules
48
-
49
- - <new rule here>
50
- ```
51
- ```
52
-
53
- **Change 3** — In "If you're stuck" section, add a new item at the end:
54
-
55
- ```markdown
56
- 5. **Check `docs/lessons.md`** — a previous lesson may be relevant to your current problem.
57
- ```
58
-
59
- Renumber the existing item 4 to 5 if needed (it's currently the last item).
60
-
61
- **Command:**
62
- ```
63
- git add skills/executing-tasks/SKILL.md
64
- git commit -m "feat(executing-tasks): read and write lessons learned per task"
65
- ```
66
-
67
- ---
68
-
69
- ## Task 2: Add lessons-learned review step to finalizing skill
70
-
71
- <!-- tdd: trivial -->
72
- <!-- checkpoint: none -->
73
-
74
- **File:** `skills/finalizing/SKILL.md`
75
-
76
- Insert a new step between the existing step 1 (Move planning docs) and step 2 (Update documentation). The new step becomes step 2, and existing steps 2-4 renumber to 3-5:
77
-
78
- ```markdown
79
- 2. **Review lessons learned** — if `docs/lessons.md` exists, review it:
80
- - Add any lessons from this session that were missed during execution
81
- - Retire rules that no longer apply (remove the bullet)
82
- - If no changes are needed, leave it as-is
83
-
84
- If `docs/lessons.md` doesn't exist but lessons were learned this session, create it with the standard format:
85
-
86
- ```markdown
87
- # Lessons Learned
88
-
89
- <!--
90
- Agent: read this at the start of each task during executing-tasks.
91
- Follow every rule. Add new rules when you catch yourself making repeat mistakes.
92
- Retire rules that no longer apply during finalizing.
93
- -->
94
-
95
- ## Rules
96
-
97
- - <rule 1>
98
- - <rule 2>
99
- ```
100
- ```
101
-
102
- **Command:**
103
- ```
104
- git add skills/finalizing/SKILL.md
105
- git commit -m "feat(finalizing): review and update lessons learned"
106
- ```
107
-
108
- ---
109
-
110
- ## Task 3: Add lessons-learned read step to brainstorming skill
111
-
112
- <!-- tdd: trivial -->
113
- <!-- checkpoint: none -->
114
-
115
- **File:** `skills/brainstorming/SKILL.md`
116
-
117
- In step 2 (Understand the idea), add a new bullet after "check package.json/dependencies and module structure":
118
-
119
- ```markdown
120
- - **Check `docs/lessons.md`** if it exists — known constraints and patterns may affect the design.
121
- ```
122
-
123
- The full relevant part of step 2 should become:
124
-
125
- ```markdown
126
- 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.
127
- ```
128
-
129
- **Command:**
130
- ```
131
- git add skills/brainstorming/SKILL.md
132
- git commit -m "feat(brainstorming): read lessons learned for design context"
133
- ```
134
-
135
- ---
136
-
137
- ## Task 4: Add lessons-learned read step to writing-plans skill
138
-
139
- <!-- tdd: trivial -->
140
- <!-- checkpoint: none -->
141
-
142
- **File:** `skills/writing-plans/SKILL.md`
143
-
144
- In step 1 (Check for a design doc), add a new sentence after "If no design doc exists, ask the user to describe what they want to build and read relevant code.":
145
-
146
- ```markdown
147
- **Read `docs/lessons.md`** if it exists — incorporate known patterns into the task breakdown (e.g., if a lesson says "always run lint before commit," include that in relevant task instructions).
148
- ```
149
-
150
- **Command:**
151
- ```
152
- git add skills/writing-plans/SKILL.md
153
- git commit -m "feat(writing-plans): read lessons learned for task breakdown"
154
- ```
155
-
156
- ---
157
-
158
- ## Task 5: Update README.md with lessons-learned feature documentation
159
-
160
- <!-- tdd: trivial -->
161
- <!-- checkpoint: done -->
162
-
163
- **File:** `README.md`
164
-
165
- Add a new section after "TDD Three-Scenario Model" and before "Checkpoint Review Gates":
166
-
167
- ```markdown
168
- ### Lessons Learned
169
-
170
- A persistent rules file (`docs/lessons.md`) helps the agent learn from repeat mistakes across sessions. When the agent catches itself making the same error — like forgetting to run `make lint` — it writes a rule immediately. Future sessions (even after `/new`) pick it up automatically.
171
-
172
- ```
173
- brainstorm → reads lessons (design context)
174
- plan → reads lessons (task breakdown)
175
- execute → reads lessons per task, writes new ones on repeat mistakes
176
- finalize → reviews and retires stale rules
177
- ```
178
-
179
- Rules are simple imperative bullets:
180
-
181
- - After completing each task, run `make lint && make fmt` before committing
182
- - Never import `testify` in this project
183
- - Always check for existing test helpers before writing new ones
184
-
185
- No configuration needed — the file is created automatically when the first lesson is written.
186
- ```
187
-
188
- **Command:**
189
- ```
190
- git add README.md
191
- git commit -m "docs: add lessons-learned section to README"
192
- ```
193
-
194
- ---
195
-
196
- ## Task 6: Update CHANGELOG.md
197
-
198
- <!-- tdd: trivial -->
199
- <!-- checkpoint: none -->
200
-
201
- **File:** `CHANGELOG.md`
202
-
203
- Add a new entry at the top (after the header):
204
-
205
- ```markdown
206
- ## [0.13.0] - 2026-05-08
207
-
208
- ### Added
209
-
210
- - Lessons learned: persistent rules file (`docs/lessons.md`) read at every workflow phase and written to when the agent catches repeat mistakes. Survives `/new` sessions.
211
- ```
212
-
213
- Bump version in `package.json` from `0.12.0` to `0.13.0`.
214
-
215
- **Command:**
216
- ```
217
- git add CHANGELOG.md package.json
218
- git commit -m "chore: bump version to 0.13.0"
219
- ```
@@ -1,15 +0,0 @@
1
- # Progress: Lessons Learned
2
-
3
- Plan: docs/plans/2026-05-08-lessons-learned-implementation.md
4
- Branch: lessons-learned
5
- Started: 2026-05-08T04:21:50Z
6
- Last updated: 2026-05-08T04:27:15Z
7
-
8
- | # | Status | Task | Commit |
9
- |---|--------|------|--------|
10
- | 1 | ✅ done | Add lessons-learned read step to executing-tasks skill | 0ad24d6 |
11
- | 2 | ✅ done | Add lessons-learned review step to finalizing skill | 7ac8097 |
12
- | 3 | ✅ done | Add lessons-learned read step to brainstorming skill | 7cb69fe |
13
- | 4 | ✅ done | Add lessons-learned read step to writing-plans skill | ed0aab7 |
14
- | 5 | ✅ done | Update README.md with lessons-learned feature documentation | d16e407 |
15
- | 6 | ✅ done | Update CHANGELOG.md | 2525662 |
@@ -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 |