@tianhai/pi-workflow-kit 0.18.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 +39 -44
  7. package/docs/lessons.md +2 -7
  8. package/docs/oversight-model.md +20 -14
  9. package/docs/workflow-phases.md +64 -30
  10. package/extensions/workflow-guard.ts +194 -92
  11. package/package.json +20 -4
  12. package/skills/pwk-brainstorming/SKILL.md +30 -27
  13. package/skills/pwk-code-review/SKILL.md +46 -0
  14. package/skills/pwk-diagnose/SKILL.md +5 -2
  15. package/skills/pwk-executing-tasks/SKILL.md +92 -328
  16. package/skills/pwk-finalizing/SKILL.md +23 -106
  17. package/skills/pwk-status/SKILL.md +28 -0
  18. package/skills/pwk-writing-plans/SKILL.md +49 -328
  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,166 +0,0 @@
1
- # A/B Comparison: Writing Plans — Karpathy Behavioral Guidelines
2
-
3
- ## Setup
4
- - **Same design doc** (bookmarks: CRUD + search)
5
- - **Same Go project scaffold**
6
- - **Same prompt** (no questions, full plan with concrete code)
7
- - **Variant A** (WITHOUT guidelines): 292-line SKILL.md — original writing-plans skill
8
- - **Variant B** (WITH guidelines): 354-line SKILL.md — with Behavioral Guidelines section appended
9
-
10
- ---
11
-
12
- ## Structural Comparison
13
-
14
- | Dimension | A (Without) | B (With) |
15
- |---|---|---|
16
- | **Total tasks** | 4 | 6 |
17
- | **Lines in plan** | ~1,054 | ~1,019 |
18
- | **New files per plan** | 7 files in Task 1 alone | 1-2 files per task |
19
- | **External dependency** | None (stdlib only) | `github.com/google/uuid` |
20
-
21
- ---
22
-
23
- ## Task Decomposition
24
-
25
- ### A (Without) — 4 tasks
26
- | Task | Scope | Files touched |
27
- |---|---|---|
28
- | 1 | Bookmark + ALL infrastructure (model, store interface, mem store with full CRUD, service, handler, errors, route, tests) | 7 files |
29
- | 2 | Delete bookmark | 3 files |
30
- | 3 | List bookmarks (paginated, cursor) | 3 files |
31
- | 4 | Search bookmarks (keyword + pagination) | 3 files |
32
-
33
- ### B (With) — 6 tasks
34
- | Task | Scope | Files touched |
35
- |---|---|---|
36
- | 1 | Scaffold (go.mod + model only) | 2 files |
37
- | 2 | Bookmark a message (store + handler + test + route) | 4 files |
38
- | 3 | List bookmarks (offset/limit pagination) | 4 files |
39
- | 4 | Remove a bookmark | 4 files |
40
- | 5 | Search bookmarks (keyword) | 4 files |
41
- | 6 | Final wiring + integration lifecycle test | 2 files |
42
-
43
- ---
44
-
45
- ## Detailed Analysis by Guideline
46
-
47
- ### Simplicity First
48
-
49
- **A (Without):** ⚠️ **Overbuilt in Task 1.** Task 1 creates a `BookmarkStore` interface with 4 methods (Create, Delete, ListByUser, SearchByUser) — methods that won't be used until Tasks 2-4. It also creates the full `MemoryStore` implementation with all 4 methods, an `errors.go` file, a `Service` struct, AND the handler — all in a single task. The store interface is the full contract upfront before any task exercises most of it.
50
-
51
- **B (With):** ✅ **Minimal per task.** Task 1 only creates `go.mod` + the `Bookmark` struct. Task 2 introduces `Store` with only `Create`, and `MemStore` with only `Create`. `List` is added to the interface in Task 3, `Delete` in Task 4, `Search` in Task 5 — each method appears when it's needed, not before.
52
-
53
- **Verdict:** Guidelines had a clear positive effect. Plan B builds only what each task needs.
54
-
55
- ### Surgical Changes
56
-
57
- **A (Without):** ⚠️ Task 1 touches 7 files in one go (model, store interface, store mem, errors, service, handler, main.go). The Task 1 description says "create the full vertical slice" which bundles infrastructure that isn't tested yet.
58
-
59
- **B (With):** ✅ Each task touches 1-2 files for new code. Task 1 creates 2 files (go.mod, model.go). Task 2 adds 3 new files + modifies main.go. No task creates more than 4 files.
60
-
61
- **Verdict:** Guidelines had a clear positive effect. Plan B has tighter blast radius per task.
62
-
63
- ### Think Before Coding (surface assumptions)
64
-
65
- **A (Without):** ❌ Silent assumptions throughout:
66
- - Used cursor-based pagination without noting the design just said "paginated" — didn't surface that offset-based vs cursor-based is a choice
67
- - Added `sync.RWMutex` and concurrent safety without the design mentioning concurrency
68
- - Created a `Service` layer between handler and store without justification
69
-
70
- **B (With):** ⚠️ Still has assumptions but more defensible:
71
- - Used offset/limit pagination (simpler, matches "paginated" literally)
72
- - No concurrency concerns added (store uses `sync.Mutex` only, no RWMutex overhead)
73
- - No `Service` layer — handler calls store directly
74
- - Did add `github.com/google/uuid` dependency without asking — minor assumption
75
-
76
- **Verdict:** Marginal positive effect. Plan B is less presumptuous but both plans made assumptions. Neither explicitly surfaced tradeoffs to the user.
77
-
78
- ### Goal-Driven Execution
79
-
80
- **A (Without):** ✅ Good acceptance criteria with Given/When/Then. Has a `checkpoint: test` on 3/4 tasks and `checkpoint: done` on the last task.
81
-
82
- **B (With):** ✅ Good acceptance criteria. Has `checkpoint: test` on 3 tasks, `checkpoint: done` on 1, and no checkpoint on 2 simpler tasks. Added a full lifecycle integration test in Task 6 that wasn't in A.
83
-
84
- **Verdict:** Roughly equivalent. Both plans have strong acceptance criteria (required by the base skill). The lifecycle test in B is a nice bonus that catches integration issues.
85
-
86
- ---
87
-
88
- ## Unrelated Observations (noise, not guidelines)
89
-
90
- | Observation | A (Without) | B (With) |
91
- |---|---|---|
92
- | Pagination style | Cursor-based (more complex) | Offset-based (simpler) |
93
- | External deps | None | `google/uuid` |
94
- | Handler method naming | `Create`, `Delete`, `List`, `Search` | `CreateBookmark`, `DeleteBookmark`, `ListBookmarks`, `SearchBookmarks` |
95
- | Test structure | Single `TestXxx` with `t.Run` subtests | Separate top-level test functions |
96
- | `make([]T, 0, len)` usage | Yes (mem store candidates) | Yes (list handler, search handler) |
97
-
98
- ---
99
-
100
- ## Overall Assessment
101
-
102
- | Guideline | Effect | Evidence |
103
- |---|---|---|
104
- | **Simplicity First** | ✅ Strong positive | B builds incrementally; A front-loads the full store interface |
105
- | **Surgical Changes** | ✅ Positive | B touches fewer files per task (1-4 vs 7 in Task 1) |
106
- | **Think Before Coding** | ⚠️ Marginal | B made fewer silent assumptions but neither surfaced tradeoffs explicitly |
107
- | **Goal-Driven Execution** | ≈ Neutral | Both strong; base skill already enforces acceptance criteria |
108
-
109
- **Bottom line (iteration 1):** The guidelines measurably improved the plan. The biggest win is **Simplicity First** — Plan B's incremental interface growth (adding methods to `Store` as each task needs them) is clearly better than Plan A's upfront full-contract approach. This is exactly the kind of thing "no abstractions for single-use code" catches.
110
-
111
- **Weakness:** Neither plan explicitly called out assumptions or asked clarifying questions — the "Think Before Coding" guideline had the weakest signal. The guidelines alone may not be enough to overcome the model's tendency to fill gaps silently.
112
-
113
- ---
114
-
115
- ## Iteration 2: Revised Guidelines
116
-
117
- ### What changed
118
-
119
- The guidelines were reworked from 4 generic coding rules to 3 planning-specific principles:
120
-
121
- | v1 (Generic) | v2 (Planning-Specific) | Why |
122
- |---|---|---|
123
- | Think Before Coding | **Surface Assumptions** | v1 said "ask" — the agent ignores this when told not to ask. v2 says "annotate in the plan" with a concrete `> **Assumption:** ...` format and examples of what to annotate. |
124
- | Simplicity First | **Build Only What Each Task Needs** | Kept the same core principle but added the specific anti-pattern from the v1 A/B test: "don't define interface methods that no task exercises yet." |
125
- | Surgical Changes | **One Task, One Change** | Reframed from "don't touch adjacent code" to "each task should trace to exactly one user-facing behavior" with a concrete guardrail (max 4 new files). |
126
- | Goal-Driven Execution | *(removed)* | Redundant — the base skill already enforces Given/When/Then acceptance criteria. |
127
-
128
- ### Iteration 2 Plan (v2 guidelines) vs Iteration 1 Plans
129
-
130
- | Dimension | A (No guidelines) | B1 (v1 guidelines) | B2 (v2 guidelines) |
131
- |---|---|---|---|
132
- | **Total tasks** | 4 | 6 | 4 |
133
- | **Max files/task** | 7 (Task 1) | 4 | 4 |
134
- | **Assumptions annotated** | 0 | 0 | **4** (header below) |
135
- | **External deps** | None | `google/uuid` | None |
136
- | **Store interface** | 4 methods upfront in Task 1 | 1 method per task | 1 method per task |
137
- | **Service layer** | Yes (unjustified) | No | No |
138
-
139
- ### The big win: Surface Assumptions
140
-
141
- Plan B2 opens with four explicit assumption annotations:
142
-
143
- ```
144
- > **Assumption:** User identification via X-User-ID request header since
145
- > no auth system exists in the project.
146
-
147
- > **Assumption:** Bookmarks include a Note field so users can annotate
148
- > bookmarks. The design says "search by keyword" but doesn't specify
149
- > the field.
150
-
151
- > **Assumption:** Offset/limit pagination (not cursor-based).
152
-
153
- > **Assumption:** In-memory store behind a Store interface.
154
- ```
155
-
156
- None of the previous plans (A or B1) did this. The v1 "Think Before Coding" guideline was completely invisible in output. The v2 "Surface Assumptions" guideline produced visible, reviewable annotations on the first run.
157
-
158
- ### Iteration 2 Assessment
159
-
160
- | Guideline | v1 Effect | v2 Effect | Improvement |
161
- |---|---|---|---|
162
- | **Surface Assumptions** (was Think Before Coding) | ⚠️ Invisible | ✅ 4 explicit annotations | Complete turnaround — concrete format + examples fixed the weakest signal |
163
- | **Build Only What's Needed** (was Simplicity First) | ✅ Strong | ✅ Strong | Maintained — interface still grows incrementally |
164
- | **One Task, One Change** (was Surgical Changes) | ✅ Positive | ✅ Positive | Maintained — max 4 files/task |
165
-
166
- **Bottom line (iteration 2):** The v2 guidelines fixed the weakest signal from v1. "Surface Assumptions" went from invisible to producing 4 explicit, reviewable annotations. The other two principles maintained their positive effect. The removal of "Goal-Driven Execution" (redundant) reduced noise without losing signal.
@@ -1,50 +0,0 @@
1
- # Checkpoint Review Gates for Task Execution
2
-
3
- ## Problem
4
-
5
- Executing-tasks runs through tasks without pausing. There's no way for the human to review tests before implementation, or review implementation before committing. The TDD labels in plans are advisory, not enforceable. There's no configuration for review gates.
6
-
7
- ## Design
8
-
9
- Add optional `checkpoint` labels to individual tasks in the implementation plan. Executing-tasks pauses at checkpoint boundaries for human review.
10
-
11
- ## Checkpoint labels
12
-
13
- Each task can optionally include a `checkpoint` label:
14
-
15
- - **`checkpoint: test`** — pause after writing the failing test, before implementing
16
- - **`checkpoint: done`** — pause after implementation + tests pass, before committing
17
- - **No label** — auto-advance, no pause
18
-
19
- The label is orthogonal to the TDD scenario. A "new feature" task with `checkpoint: test` means: write failing test → pause → implement → run tests → commit. Without a checkpoint, the same task flows straight through.
20
-
21
- ## Who sets checkpoints
22
-
23
- The agent decides which tasks get checkpoints during plan writing, based on complexity and risk. The user reviews the plan before execution and can add, remove, or change checkpoints.
24
-
25
- ## Changes
26
-
27
- ### writing-plans/SKILL.md
28
-
29
- Add `checkpoint` as an optional field in the task format section, with the two values and the "no label means auto-advance" rule. Update the TDD table to show how checkpoints interact with each scenario. Add guidance for the agent on when to use each checkpoint value.
30
-
31
- ### executing-tasks/SKILL.md
32
-
33
- Update the per-task lifecycle to handle checkpoints:
34
-
35
- - **No checkpoint** — existing flow unchanged
36
- - **`checkpoint: test`** — write failing test → show diff → pause for review → proceed based on human input → implement → run tests → fix if needed → commit
37
- - **`checkpoint: done`** — implement → run tests → fix if needed → show diff → pause for review → proceed based on human input → commit
38
-
39
- The pause is a simple conversation stop — the agent shows what was done and the diff, then waits. The human can say anything: change the test, tweak the implementation, approve, revert, adjust the plan. No rigid menu.
40
-
41
- Pause message format:
42
-
43
- ```
44
- ⏸ Paused at checkpoint: [test|done] for task [N]
45
-
46
- **What was done:** [brief summary]
47
- **Diff:** [show relevant diff]
48
-
49
- Review and let me know how to proceed.
50
- ```
@@ -1,98 +0,0 @@
1
- # Checkpoint Review Gates: Implementation Plan
2
-
3
- ## Tasks
4
-
5
- ### Task 1: Update writing-plans/SKILL.md — add checkpoint field and agent guidance
6
-
7
- **Scenario:** Trivial (docs)
8
-
9
- **File:** `skills/writing-plans/SKILL.md`
10
-
11
- Add a "Checkpoint labels" section after "TDD in the plan" with the optional `checkpoint` field, values, and agent guidance. Also update the TDD table to show how checkpoints interact with each scenario.
12
-
13
- After the "TDD in the plan" section, add:
14
-
15
- ```
16
- ## Checkpoint labels
17
-
18
- Optionally label each task with a `checkpoint` to require human review before proceeding:
19
-
20
- | Checkpoint | When to use | What happens during execution |
21
- |---|---|---|
22
- | *(none)* | Trivial tasks, well-understood changes | Auto-advance, no pause |
23
- | **`checkpoint: test`** | Test design matters (API contracts, edge cases, complex behavior) | Pause after writing the failing test, before implementing |
24
- | **`checkpoint: done`** | Implementation review matters (complex logic, security, performance) | Pause after implementation + tests pass, before committing |
25
-
26
- Use judgment when assigning checkpoints. Prefer `checkpoint: test` for new features with non-obvious test design. Prefer `checkpoint: done` for tasks where the implementation approach is debatable. Most tasks should not need a checkpoint. The user can adjust checkpoints when reviewing the plan.
27
- ```
28
-
29
- Also update the "Task format" section — after the `git commit` bullet, add:
30
-
31
- ```
32
- - Optional `checkpoint: test` or `checkpoint: done` label
33
- ```
34
-
35
- **Commit:** `feat(writing-plans): add checkpoint labels for review gates`
36
-
37
- ### Task 2: Update executing-tasks/SKILL.md — handle checkpoints in per-task lifecycle
38
-
39
- **Scenario:** Trivial (docs)
40
-
41
- **File:** `skills/executing-tasks/SKILL.md`
42
-
43
- Replace the "Per-task lifecycle" section with checkpoint-aware flows. Add a "Checkpoint review" section.
44
-
45
- Replace the existing "Per-task lifecycle" section with:
46
-
47
- ```
48
- ## Per-task lifecycle
49
-
50
- Check each task for a `checkpoint` label and follow the appropriate flow:
51
-
52
- ### No checkpoint (auto-advance)
53
-
54
- 1. **Implement** — write the code as described in the plan
55
- 2. **Run tests** — verify the changes work
56
- 3. **Fix if needed** — if tests fail, debug and fix before moving on
57
- 4. **Commit** — `git add` the relevant files and commit with a clear message
58
-
59
- ### checkpoint: test
60
-
61
- 1. **Write the test** — follow the TDD scenario for the task
62
- 2. **Pause for review** — show what was done and the diff, then wait for human input
63
- 3. **Continue** — implement, run tests, fix if needed
64
- 4. **Commit** — `git add` the relevant files and commit with a clear message
65
-
66
- ### checkpoint: done
67
-
68
- 1. **Implement** — write the code as described in the plan
69
- 2. **Run tests** — verify the changes work
70
- 3. **Fix if needed** — if tests fail, debug and fix before moving on
71
- 4. **Pause for review** — show what was done and the diff, then wait for human input
72
- 5. **Commit** — `git add` the relevant files and commit with a clear message
73
- ```
74
-
75
- After the "TDD discipline" section, add:
76
-
77
- ```
78
- ## Checkpoint review
79
-
80
- When pausing at a checkpoint, present:
81
-
82
- ```
83
- ⏸ Paused at checkpoint: [test|done] for task [N]
84
-
85
- **What was done:** [brief summary]
86
- **Diff:** [show relevant diff]
87
-
88
- Review and let me know how to proceed.
89
- ```
90
-
91
- Wait for the human to respond. They may:
92
- - Approve and continue
93
- - Request changes to the test or implementation
94
- - Ask to revert the task
95
- - Adjust the remaining plan
96
- ```
97
-
98
- **Commit:** `feat(executing-tasks): add checkpoint review gates`
@@ -1,33 +0,0 @@
1
- # Finalizing: Merge Strategy Options
2
-
3
- ## Problem
4
-
5
- The finalizing skill hard-codes "Create PR" as the only shipping option. In practice, small features often don't need a PR — they can be merged directly back to the parent branch.
6
-
7
- ## Design
8
-
9
- Add a merge strategy step after updating documentation. The human chooses one of four options:
10
-
11
- 1. **Create PR** — push and open a PR for external review via `gh pr create`
12
- 2. **Rebase & merge** (recommended) — rebase onto parent, fast-forward merge, push parent, delete feature branch. Preserves per-task commit history linearly.
13
- 3. **Squash & merge** — squash all commits into one on parent, push parent, delete feature branch. Clean single-commit history.
14
- 4. **Merge commit** — merge with `--no-ff`, push parent, delete feature branch. Preserves all commits and branch topology.
15
-
16
- ### Flow for options 2–4 (local merge)
17
-
18
- 1. Detect parent branch (compare `main` vs `master`, fall back to `git show-branch`)
19
- 2. Switch to parent branch and pull latest
20
- 3. Execute the chosen merge strategy:
21
- - Rebase: `git rebase <parent>` on feature branch, then `git merge --ff-only <feature>` on parent
22
- - Squash: `git merge --squash <feature>` on parent, then `git commit`
23
- - Merge commit: `git merge --no-ff <feature>` on parent
24
- 4. Push parent to origin
25
- 5. Delete feature branch locally and remotely
26
-
27
- ### Prompting
28
-
29
- The skill should ask the human which option they prefer, presenting rebase & merge as the default recommendation.
30
-
31
- ## Changes
32
-
33
- - Update `skills/finalizing/SKILL.md` to replace the hard-coded PR step with the 4-option choice.
@@ -1,75 +0,0 @@
1
- # Finalizing: Merge Strategy Options — Implementation Plan
2
-
3
- ## Context
4
-
5
- Replace the hard-coded "Create PR" step in the finalizing skill with a 4-option merge strategy prompt (Create PR, Rebase & merge, Squash & merge, Merge commit).
6
-
7
- Design doc: `docs/plans/2026-04-11-finalizing-merge-options-design.md`
8
-
9
- ---
10
-
11
- ## Task 1 — Replace the PR step with a merge strategy prompt
12
-
13
- **TDD scenario:** Trivial (skill docs, no code to test)
14
-
15
- **File:** `skills/finalizing/SKILL.md`
16
-
17
- Replace step 3 ("Create PR") and step 4 ("Clean up") with the new merge strategy section. Keep steps 1 and 2 unchanged.
18
-
19
- **New content for step 3 onwards:**
20
-
21
- ```markdown
22
- 3. **Choose a merge strategy** — ask the human which option they prefer:
23
-
24
- 1. **Create PR** — push and open a PR for external review:
25
- ```
26
- git push origin <branch>
27
- gh pr create --title "feat: <summary>" --body "<task summary>"
28
- ```
29
-
30
- 2. **Rebase & merge** *(recommended)* — rebase onto parent, fast-forward merge, push parent, delete branch:
31
- ```
32
- parent=$(git show-branch -a 2>/dev/null | grep '\*' | grep -v "$(git branch --show-current)" | head -1 | sed 's/.*\[\(.*\)\].*/\1/' | sed 's/[\^~].*//')
33
- git checkout "$parent" && git pull
34
- git checkout - && git rebase "$parent"
35
- git checkout "$parent" && git merge --ff-only -
36
- git push origin "$parent"
37
- git branch -d - && git push origin --delete -
38
- ```
39
-
40
- 3. **Squash & merge** — squash all commits into one on parent, push parent, delete branch:
41
- ```
42
- parent=$(git show-branch -a 2>/dev/null | grep '\*' | grep -v "$(git branch --show-current)" | head -1 | sed 's/.*\[\(.*\)\].*/\1/' | sed 's/[\^~].*//')
43
- git checkout "$parent" && git pull
44
- git merge --squash -
45
- git commit -m "feat: <summary>"
46
- git push origin "$parent"
47
- git branch -d - && git push origin --delete -
48
- ```
49
-
50
- 4. **Merge commit** — merge with `--no-ff`, push parent, delete branch:
51
- ```
52
- parent=$(git show-branch -a 2>/dev/null | grep '\*' | grep -v "$(git branch --show-current)" | head -1 | sed 's/.*\[\(.*\)\].*/\1/' | sed 's/[\^~].*//')
53
- git checkout "$parent" && git pull
54
- git merge --no-ff -m "Merge branch '<branch>'" -
55
- git push origin "$parent"
56
- git branch -d - && git push origin --delete -
57
- ```
58
-
59
- For options 2–4, confirm the detected parent branch with the human before proceeding.
60
-
61
- 4. **Clean up** — if a worktree was used, remove it:
62
- ```
63
- git worktree remove ../<repo>-<feature-name>
64
- ```
65
- ```
66
-
67
- **Commit:** `feat: add merge strategy options to finalizing skill`
68
-
69
- ---
70
-
71
- ## Done
72
-
73
- The finalizing skill now offers four merge strategies instead of only "Create PR". No code files changed — this is a skill-documentation update only.
74
-
75
- To verify: read `skills/finalizing/SKILL.md` and confirm it contains all four options with correct commands.
@@ -1,28 +0,0 @@
1
- # Workspace Setup: Move Branch Creation to Brainstorming
2
-
3
- ## Problem
4
-
5
- Brainstorming commits the design doc to whatever branch you're on (usually `main`), polluting it. If the idea is scrapped, you have to revert the commit. The implementation branch created later by writing-plans starts from a point after the design commit, which is messy.
6
-
7
- ## Design
8
-
9
- Move branch/worktree creation from writing-plans into brainstorming. The design doc lands on the feature branch from the start, keeping `main` clean.
10
-
11
- ## Changes
12
-
13
- ### brainstorming/SKILL.md
14
-
15
- Step 5 changes from writing + committing the design doc on the current branch to:
16
-
17
- 1. Create a feature branch (`git checkout -b <feature-name>`) or worktree (`git worktree add ../<repo>-<feature-name> -b <feature-name>`) for larger features
18
- 2. Write the design doc to `docs/plans/YYYY-MM-DD-<topic>-design.md`
19
- 3. Single commit on the new branch with the design doc
20
-
21
- Feature name is derived from the topic slug in the design doc filename.
22
-
23
- ### writing-plans/SKILL.md
24
-
25
- - Remove step 2 ("Set up workspace") entirely
26
- - Step 1 expands to verify the feature branch/worktree context created by brainstorming
27
- - Steps renumber: 1→2→3 becomes 1→2
28
- - Fallback path (no design doc, brainstorming was skipped) still creates a branch itself so writing-plans works standalone
@@ -1,57 +0,0 @@
1
- # Workspace Setup: Implementation Plan
2
-
3
- ## Tasks
4
-
5
- ### Task 1: Update brainstorming/SKILL.md — add workspace setup to step 5
6
-
7
- **Scenario:** Trivial (docs)
8
-
9
- Replace step 5 with workspace creation + design doc commit.
10
-
11
- **File:** `skills/brainstorming/SKILL.md`
12
-
13
- Replace:
14
-
15
- ```
16
- 5. **Write the design doc** — save to `docs/plans/YYYY-MM-DD-<topic>-design.md` and commit.
17
- ```
18
-
19
- With:
20
-
21
- ```
22
- 5. **Set up workspace & write the design doc** — create a branch for this work. For larger features, use a git worktree for isolation:
23
- ```
24
- git worktree add ../<repo>-<feature-name> -b <feature-name>
25
- ```
26
- Save the design doc to `docs/plans/YYYY-MM-DD-<topic>-design.md` and commit on the new branch.
27
- ```
28
-
29
- **Commit:** `refactor(brainstorming): move workspace setup into step 5`
30
-
31
- ### Task 2: Update writing-plans/SKILL.md — remove step 2, expand step 1
32
-
33
- **Scenario:** Trivial (docs)
34
-
35
- Remove step 2 ("Set up workspace") entirely. Expand step 1 to verify the feature branch context. Renumber step 3 → 2.
36
-
37
- **File:** `skills/writing-plans/SKILL.md`
38
-
39
- Replace:
40
-
41
- ```
42
- 1. **Check for a design doc** — look for `docs/plans/*-design.md`. If one exists, use it as the basis for the plan. If none exists, ask the user to describe what they want to build, read relevant code, and create the plan directly.
43
- 2. **Set up workspace** — create a branch for this work. For larger features, use a git worktree for isolation:
44
- ```
45
- git worktree add ../<repo>-<feature-name> -b <feature-name>
46
- ```
47
- 3. **Write the implementation plan** — break the design into tasks. Save to `docs/plans/YYYY-MM-DD-<topic>-implementation.md`.
48
- ```
49
-
50
- With:
51
-
52
- ```
53
- 1. **Check for a design doc & workspace** — look for `docs/plans/*-design.md`. If one exists, use it as the basis for the plan. Verify you're on the feature branch (or in its worktree) created during brainstorming. If no design doc exists, ask the user to describe what they want to build, read relevant code, create a branch, and create the plan directly.
54
- 2. **Write the implementation plan** — break the design into tasks. Save to `docs/plans/YYYY-MM-DD-<topic>-implementation.md`.
55
- ```
56
-
57
- **Commit:** `refactor(writing-plans): remove workspace setup, verify branch context`
@@ -1,39 +0,0 @@
1
- # Bash Guard for Workflow Guard Extension
2
-
3
- ## Problem
4
-
5
- `workflow-guard.ts` blocks `write`/`edit` outside `docs/plans/` during brainstorm and plan phases, but ignores `bash` entirely. The LLM can mutate files via bash (e.g. `echo "..." > file.ts`, `sed -i`, `tee`, heredocs).
6
-
7
- ## Design
8
-
9
- Adopt the `isSafeCommand()` approach from [pi-mono plan-mode example](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/examples/extensions/plan-mode/utils.ts).
10
-
11
- ### Approach
12
-
13
- **No changes to `pi.setActiveTools()`** — `write`/`edit` remain active so the existing path-based `tool_call` guard continues to allow writes to `docs/plans/`.
14
-
15
- **Add a bash guard** in the existing `tool_call` handler using `isSafeCommand()`:
16
- - Copy SAFE_PATTERNS and DESTRUCTIVE_PATTERNS from the example's `utils.ts` as-is
17
- - Copy `isSafeCommand()` logic as-is
18
- - In the `tool_call` handler, when phase is set and tool is `bash`, check `isSafeCommand(event.input.command)`
19
- - Block with reason if not safe
20
- - Notify via `ctx.ui.notify()` when blocking
21
-
22
- ### Changes
23
-
24
- 1. **`extensions/workflow-guard.ts`**
25
- - Add `isSafeCommand()` function (copied from example, with DESTRUCTIVE_PATTERNS and SAFE_PATTERNS)
26
- - Extend `tool_call` handler to also intercept `bash` when phase is set
27
- - Check `event.input.command` against `isSafeCommand()`
28
- - Block and notify if unsafe
29
-
30
- 2. **`tests/workflow-guard.test.ts`**
31
- - Add tests for bash guard: safe commands pass, destructive commands blocked, redirects blocked
32
- - Import and test `isSafeCommand` directly (it's a pure function, easy to unit test)
33
-
34
- ### What stays the same
35
-
36
- - Phase detection via `/skill:` commands (no change)
37
- - `write`/`edit` path-based blocking for `docs/plans/` (no change)
38
- - `docs/plans/` write exception (no change)
39
- - No `pi.setActiveTools()` usage