@tianhai/pi-workflow-kit 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -494
- package/docs/developer-usage-guide.md +41 -401
- package/docs/oversight-model.md +13 -34
- package/docs/workflow-phases.md +32 -46
- package/extensions/workflow-guard.ts +67 -0
- package/package.json +3 -7
- package/skills/brainstorming/SKILL.md +16 -59
- package/skills/executing-tasks/SKILL.md +26 -227
- package/skills/finalizing/SKILL.md +33 -0
- package/skills/writing-plans/SKILL.md +23 -132
- package/ROADMAP.md +0 -16
- package/agents/code-reviewer.md +0 -18
- package/agents/config.ts +0 -5
- package/agents/implementer.md +0 -26
- package/agents/spec-reviewer.md +0 -13
- package/agents/worker.md +0 -17
- package/docs/plans/completed/2026-04-09-cleanup-legacy-state-and-enforce-think-phases-design.md +0 -56
- package/docs/plans/completed/2026-04-09-cleanup-legacy-state-and-enforce-think-phases-implementation.md +0 -196
- package/docs/plans/completed/2026-04-09-workflow-next-autocomplete-design.md +0 -185
- package/docs/plans/completed/2026-04-09-workflow-next-autocomplete-implementation.md +0 -334
- package/docs/plans/completed/2026-04-09-workflow-next-handoff-state-design.md +0 -251
- package/docs/plans/completed/2026-04-09-workflow-next-handoff-state-implementation.md +0 -253
- package/extensions/constants.ts +0 -15
- package/extensions/lib/logging.ts +0 -138
- package/extensions/plan-tracker.ts +0 -502
- package/extensions/subagent/agents.ts +0 -144
- package/extensions/subagent/concurrency.ts +0 -52
- package/extensions/subagent/env.ts +0 -47
- package/extensions/subagent/index.ts +0 -1181
- package/extensions/subagent/lifecycle.ts +0 -25
- package/extensions/subagent/timeout.ts +0 -13
- package/extensions/workflow-monitor/debug-monitor.ts +0 -98
- package/extensions/workflow-monitor/git.ts +0 -31
- package/extensions/workflow-monitor/heuristics.ts +0 -58
- package/extensions/workflow-monitor/investigation.ts +0 -52
- package/extensions/workflow-monitor/reference-tool.ts +0 -42
- package/extensions/workflow-monitor/skip-confirmation.ts +0 -19
- package/extensions/workflow-monitor/tdd-monitor.ts +0 -137
- package/extensions/workflow-monitor/test-runner.ts +0 -37
- package/extensions/workflow-monitor/verification-monitor.ts +0 -61
- package/extensions/workflow-monitor/warnings.ts +0 -81
- package/extensions/workflow-monitor/workflow-handler.ts +0 -358
- package/extensions/workflow-monitor/workflow-next-completions.ts +0 -68
- package/extensions/workflow-monitor/workflow-next-state.ts +0 -112
- package/extensions/workflow-monitor/workflow-tracker.ts +0 -253
- package/extensions/workflow-monitor/workflow-transitions.ts +0 -55
- package/extensions/workflow-monitor.ts +0 -872
- package/skills/dispatching-parallel-agents/SKILL.md +0 -194
- package/skills/receiving-code-review/SKILL.md +0 -196
- package/skills/systematic-debugging/SKILL.md +0 -170
- package/skills/systematic-debugging/condition-based-waiting-example.ts +0 -158
- package/skills/systematic-debugging/condition-based-waiting.md +0 -115
- package/skills/systematic-debugging/defense-in-depth.md +0 -122
- package/skills/systematic-debugging/find-polluter.sh +0 -63
- package/skills/systematic-debugging/reference/rationalizations.md +0 -61
- package/skills/systematic-debugging/root-cause-tracing.md +0 -169
- package/skills/test-driven-development/SKILL.md +0 -266
- package/skills/test-driven-development/reference/examples.md +0 -101
- package/skills/test-driven-development/reference/rationalizations.md +0 -67
- package/skills/test-driven-development/reference/when-stuck.md +0 -33
- package/skills/test-driven-development/testing-anti-patterns.md +0 -299
- package/skills/using-git-worktrees/SKILL.md +0 -231
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Workflow Guard extension.
|
|
5
|
+
*
|
|
6
|
+
* Blocks write/edit outside docs/plans/ during brainstorm and plan phases.
|
|
7
|
+
* You control phases explicitly via /skill: commands — no auto-detection,
|
|
8
|
+
* no state persistence, no prompts.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
type Phase = "brainstorm" | "plan" | null;
|
|
12
|
+
|
|
13
|
+
const SKILL_TO_PHASE: Record<string, Phase> = {
|
|
14
|
+
brainstorming: "brainstorm",
|
|
15
|
+
"writing-plans": "plan",
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export function getCurrentPhase(): Phase {
|
|
19
|
+
return phase;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
let phase: Phase = null;
|
|
23
|
+
|
|
24
|
+
export default function (pi: ExtensionAPI) {
|
|
25
|
+
pi.on("session_start", () => {
|
|
26
|
+
phase = null;
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
pi.on("input", (event) => {
|
|
30
|
+
const text = event.text ?? "";
|
|
31
|
+
for (const [skill, p] of Object.entries(SKILL_TO_PHASE)) {
|
|
32
|
+
if (text.includes(skill)) {
|
|
33
|
+
phase = p;
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (
|
|
38
|
+
text.includes("executing-tasks") ||
|
|
39
|
+
text.includes("finalizing")
|
|
40
|
+
) {
|
|
41
|
+
phase = null;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
pi.on("tool_call", (event, ctx) => {
|
|
46
|
+
if (!phase) return;
|
|
47
|
+
|
|
48
|
+
if (event.toolName !== "write" && event.toolName !== "edit") return;
|
|
49
|
+
|
|
50
|
+
const filePath = (event.input as { path?: string }).path ?? "";
|
|
51
|
+
if (!filePath) return;
|
|
52
|
+
|
|
53
|
+
if (filePath.startsWith("docs/plans/")) return;
|
|
54
|
+
|
|
55
|
+
if (ctx.hasUI) {
|
|
56
|
+
ctx.ui.notify(
|
|
57
|
+
`Blocked ${event.toolName} to ${filePath} during ${phase} phase. Only docs/plans/ is writable.`,
|
|
58
|
+
"warning",
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return {
|
|
63
|
+
blocked: true,
|
|
64
|
+
reason: `⚠️ ${phase.toUpperCase()} PHASE: Cannot ${event.toolName} to ${filePath}. Only docs/plans/ is writable during brainstorming and planning.`,
|
|
65
|
+
};
|
|
66
|
+
});
|
|
67
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tianhai/pi-workflow-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Workflow skills and enforcement extensions for pi",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package"
|
|
@@ -18,19 +18,15 @@
|
|
|
18
18
|
},
|
|
19
19
|
"files": [
|
|
20
20
|
"extensions/",
|
|
21
|
-
"agents/",
|
|
22
21
|
"skills/",
|
|
23
22
|
"docs/",
|
|
24
23
|
"banner.jpg",
|
|
25
24
|
"LICENSE",
|
|
26
|
-
"README.md"
|
|
27
|
-
"ROADMAP.md"
|
|
25
|
+
"README.md"
|
|
28
26
|
],
|
|
29
27
|
"pi": {
|
|
30
28
|
"extensions": [
|
|
31
|
-
"extensions/
|
|
32
|
-
"extensions/workflow-monitor.ts",
|
|
33
|
-
"extensions/subagent/index.ts"
|
|
29
|
+
"extensions/workflow-guard.ts"
|
|
34
30
|
],
|
|
35
31
|
"skills": [
|
|
36
32
|
"skills"
|
|
@@ -1,70 +1,27 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: brainstorming
|
|
3
|
-
description: "
|
|
3
|
+
description: "Use this before any creative work — creating features, building components, adding functionality, or modifying behavior. Explores intent and design before implementation."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
# Brainstorming
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Read-only exploration. You may **not** edit or create any files except under `docs/plans/`.
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Process
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
1. **Check git state** — run `git status` and `git log --oneline -5`. If there's uncommitted work, ask the user what to do with it first.
|
|
13
|
+
2. **Understand the idea** — read existing code, docs, and recent commits. Ask questions one at a time to refine the idea. Prefer multiple choice when possible.
|
|
14
|
+
3. **Explore approaches** — propose 2-3 approaches with trade-offs. Lead with your recommendation.
|
|
15
|
+
4. **Present the design** — break it into sections of 200-300 words. Check after each section whether it looks right. Cover: architecture, components, data flow, error handling, testing.
|
|
16
|
+
5. **Write the design doc** — save to `docs/plans/YYYY-MM-DD-<topic>-design.md` and commit.
|
|
13
17
|
|
|
14
|
-
|
|
18
|
+
## Principles
|
|
15
19
|
|
|
16
|
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
+
- One question at a time
|
|
21
|
+
- YAGNI — remove unnecessary features
|
|
22
|
+
- Design for testability
|
|
23
|
+
- Always explore alternatives before settling
|
|
20
24
|
|
|
21
|
-
##
|
|
25
|
+
## After the design
|
|
22
26
|
|
|
23
|
-
|
|
24
|
-
- Run `git status` and `git log --oneline -5`
|
|
25
|
-
- If on a feature branch with uncommitted or unmerged work, ask the user:
|
|
26
|
-
- "You're on `<branch>` with uncommitted changes. Want to finish/merge that first, stash it, or continue here?"
|
|
27
|
-
- Require exactly one of: finish prior work, stash, or explicitly continue here
|
|
28
|
-
- If the topic is new, suggest creating a new branch before brainstorming
|
|
29
|
-
|
|
30
|
-
**Understanding the idea:**
|
|
31
|
-
- Check out the current project state first (files, docs, recent commits)
|
|
32
|
-
- Check if the codebase or ecosystem already solves this before designing from scratch
|
|
33
|
-
- Ask questions one at a time to refine the idea
|
|
34
|
-
- Prefer multiple choice questions when possible, but open-ended is fine too
|
|
35
|
-
- Only one question per message - if a topic needs more exploration, break it into multiple questions
|
|
36
|
-
- Focus on understanding: purpose, constraints, success criteria
|
|
37
|
-
|
|
38
|
-
**Exploring approaches:**
|
|
39
|
-
- Propose 2-3 different approaches with trade-offs
|
|
40
|
-
- Present options conversationally with your recommendation and reasoning
|
|
41
|
-
- Lead with your recommended option and explain why
|
|
42
|
-
|
|
43
|
-
**Presenting the design:**
|
|
44
|
-
- Once you believe you understand what you're building, present the design
|
|
45
|
-
- Break it into sections of 200-300 words
|
|
46
|
-
- Ask after each section whether it looks right so far
|
|
47
|
-
- Cover: architecture, components, data flow, error handling, testing
|
|
48
|
-
- Be ready to go back and clarify if something doesn't make sense
|
|
49
|
-
|
|
50
|
-
## After the Design
|
|
51
|
-
|
|
52
|
-
**Documentation:**
|
|
53
|
-
- Write the validated design to `docs/plans/YYYY-MM-DD-<topic>-design.md`
|
|
54
|
-
- Commit the design document to git
|
|
55
|
-
- The workflow monitor automatically tracks phase transitions when you invoke skills
|
|
56
|
-
|
|
57
|
-
**Implementation (if continuing):**
|
|
58
|
-
- Ask: "Ready to set up for implementation?"
|
|
59
|
-
- Set up isolated workspace — `/skill:using-git-worktrees` for larger work, or just create a branch for small changes
|
|
60
|
-
- Use `/skill:writing-plans` to create detailed implementation plan
|
|
61
|
-
|
|
62
|
-
## Key Principles
|
|
63
|
-
|
|
64
|
-
- **One question at a time** - Don't overwhelm with multiple questions
|
|
65
|
-
- **Multiple choice preferred** - Easier to answer than open-ended when possible
|
|
66
|
-
- **YAGNI ruthlessly** - Remove unnecessary features from all designs
|
|
67
|
-
- **Design for testability** - Favor approaches with clear boundaries that are easy to verify with TDD
|
|
68
|
-
- **Explore alternatives** - Always propose 2-3 approaches before settling
|
|
69
|
-
- **Incremental validation** - Present design in sections, validate each
|
|
70
|
-
- **Be flexible** - Go back and clarify when something doesn't make sense
|
|
27
|
+
Ask: "Ready to plan? Run `/skill:writing-plans`"
|
|
@@ -1,247 +1,46 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: executing-tasks
|
|
3
|
-
description: Use
|
|
3
|
+
description: "Use this to implement an approved plan task-by-task. Run after writing-plans, before finalizing."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Executing Tasks
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Implement the plan from `docs/plans/*-implementation.md` task by task.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
## Per-task lifecycle
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
For each task:
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
1. **Implement** — write the code as described in the plan
|
|
15
|
+
2. **Run tests** — verify the changes work
|
|
16
|
+
3. **Fix if needed** — if tests fail, debug and fix before moving on
|
|
17
|
+
4. **Commit** — `git add` the relevant files and commit with a clear message
|
|
15
18
|
|
|
16
|
-
|
|
17
|
-
- [ ] On the correct branch/worktree
|
|
18
|
-
- [ ] Plan file exists at `docs/plans/YYYY-MM-DD-<name>.md`
|
|
19
|
-
- [ ] Plan has been reviewed and approved
|
|
19
|
+
## TDD discipline
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
Follow the TDD scenario from the plan:
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
plan_tracker({
|
|
27
|
-
action: "init",
|
|
28
|
-
tasks: [
|
|
29
|
-
{ name: "Task 1 name", type: "code" },
|
|
30
|
-
{ name: "Task 2 name", type: "non-code" },
|
|
31
|
-
],
|
|
32
|
-
})
|
|
33
|
-
```
|
|
34
|
-
3. Mark the execute phase as active
|
|
23
|
+
- **New feature**: write the test first, see it fail, then implement
|
|
24
|
+
- **Modifying tested code**: run existing tests before and after
|
|
25
|
+
- **Trivial change**: use judgment
|
|
35
26
|
|
|
36
|
-
|
|
27
|
+
Don't skip tests because "it's obvious." The test is the contract.
|
|
37
28
|
|
|
38
|
-
|
|
29
|
+
## Receiving code review
|
|
39
30
|
|
|
40
|
-
|
|
31
|
+
When the user shares code review feedback:
|
|
41
32
|
|
|
42
|
-
**
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
- Apply TDD-specific guidance only to code tasks
|
|
33
|
+
1. **Verify the criticism** — read the relevant code. Is the feedback accurate?
|
|
34
|
+
2. **Evaluate the suggestion** — is the proposed fix the right approach? Consider alternatives.
|
|
35
|
+
3. **Implement or push back** — if valid, fix it. If not, explain why with evidence from the codebase.
|
|
36
|
+
4. **Don't blindly implement** — every suggestion should be verified against the code before accepting.
|
|
47
37
|
|
|
48
|
-
|
|
49
|
-
- List specific, measurable conditions
|
|
50
|
-
- Each criterion must be independently verifiable
|
|
51
|
-
- Treat these criteria as the basis for approval and verification
|
|
38
|
+
## If you're stuck
|
|
52
39
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
```
|
|
40
|
+
- Re-read the plan — you may have drifted from the spec
|
|
41
|
+
- Check git log — recent commits may reveal context
|
|
42
|
+
- Ask the user — it's better to clarify than to guess wrong
|
|
57
43
|
|
|
58
|
-
|
|
44
|
+
## After all tasks
|
|
59
45
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
**For code tasks:**
|
|
63
|
-
- Show the test files to be written
|
|
64
|
-
- Explain what each test verifies
|
|
65
|
-
- Ask: "Do these test cases cover the requirements? Approve, revise, or reject?"
|
|
66
|
-
|
|
67
|
-
**For non-code tasks:**
|
|
68
|
-
- Show the acceptance criteria list from the plan
|
|
69
|
-
- Ask: "Do these criteria capture the intent? Approve, revise, or reject?"
|
|
70
|
-
|
|
71
|
-
**No execution begins until approved.**
|
|
72
|
-
|
|
73
|
-
If revised → return to Define step.
|
|
74
|
-
If rejected → skip task and mark as blocked.
|
|
75
|
-
|
|
76
|
-
```
|
|
77
|
-
plan_tracker({ action: "update", index: N, phase: "approve" })
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
### 3. Execute (max 3 attempts)
|
|
81
|
-
|
|
82
|
-
Implement the task following the plan's steps.
|
|
83
|
-
|
|
84
|
-
For each attempt:
|
|
85
|
-
1. Write/modify code as specified in the plan
|
|
86
|
-
2. Run tests or verify against acceptance criteria
|
|
87
|
-
3. If all pass → move to Verify
|
|
88
|
-
4. If failures:
|
|
89
|
-
- Analyze the failures
|
|
90
|
-
- Fix the implementation
|
|
91
|
-
- Increment executeAttempts
|
|
92
|
-
- If executeAttempts reaches 3 → **escalate to human**
|
|
93
|
-
|
|
94
|
-
```
|
|
95
|
-
plan_tracker({ action: "update", index: N, phase: "execute" })
|
|
96
|
-
plan_tracker({ action: "update", index: N, attempts: 1 }) // after each attempt (routes to executeAttempts based on phase)
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
**Escalation on budget exhaustion:**
|
|
100
|
-
> "I've attempted this task 3 times without success. Options:
|
|
101
|
-
> 1. Revise the scope or approach
|
|
102
|
-
> 2. Adjust the test cases / acceptance criteria
|
|
103
|
-
> 3. Abandon this task and move on
|
|
104
|
-
>
|
|
105
|
-
> What would you like to do?"
|
|
106
|
-
|
|
107
|
-
### 4. Verify
|
|
108
|
-
|
|
109
|
-
Re-run all tests or check all acceptance criteria.
|
|
110
|
-
|
|
111
|
-
Report results to the human:
|
|
112
|
-
- ✅ Condition 1: passed
|
|
113
|
-
- ✅ Condition 2: passed
|
|
114
|
-
- ❌ Condition 3: failed — [description of failure]
|
|
115
|
-
|
|
116
|
-
**Does not auto-fix.** Flags failures to human for decision.
|
|
117
|
-
|
|
118
|
-
```
|
|
119
|
-
plan_tracker({ action: "update", index: N, phase: "verify" })
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
If failures detected:
|
|
123
|
-
> "Verification found issues. Options:
|
|
124
|
-
> 1. Go back to Execute for another attempt
|
|
125
|
-
> 2. Revise the tests/criteria
|
|
126
|
-
> 3. Accept as-is (mark partial)
|
|
127
|
-
>
|
|
128
|
-
> What would you like to do?"
|
|
129
|
-
|
|
130
|
-
### 5. Review (two layers)
|
|
131
|
-
|
|
132
|
-
**Layer 1 — Subagent review:**
|
|
133
|
-
- Dispatch a subagent to review the implementation against the task spec
|
|
134
|
-
- Subagent checks: correctness, edge cases, code quality, test coverage
|
|
135
|
-
- Subagent reports findings
|
|
136
|
-
|
|
137
|
-
Use `agentScope: "both"` to access the bundled `code-reviewer` agent:
|
|
138
|
-
```
|
|
139
|
-
subagent({ agent: "code-reviewer", task: "Review implementation of task N against spec", agentScope: "both" })
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
**Layer 2 — Human sign-off:**
|
|
143
|
-
- Present the subagent review + test results to the human
|
|
144
|
-
- Summarize what was done, what passed, any concerns
|
|
145
|
-
- Ask: "Does this look good? Approve or request changes?"
|
|
146
|
-
|
|
147
|
-
```
|
|
148
|
-
plan_tracker({ action: "update", index: N, phase: "review" })
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
If issues found → move to Fix.
|
|
152
|
-
|
|
153
|
-
### 6. Fix (max 3 loops, re-enters Verify → Review)
|
|
154
|
-
|
|
155
|
-
1. Address the review feedback
|
|
156
|
-
2. Re-enter Verify → Review cycle
|
|
157
|
-
3. Increment fixAttempts after each fix round
|
|
158
|
-
4. If fixAttempts reaches 3 → **escalate to human**
|
|
159
|
-
|
|
160
|
-
```
|
|
161
|
-
plan_tracker({ action: "update", index: N, phase: "fix" })
|
|
162
|
-
plan_tracker({ action: "update", index: N, attempts: 1 }) // routes to fixAttempts based on phase
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
**Escalation on budget exhaustion:**
|
|
166
|
-
> "I've attempted fixes 3 times. Options:
|
|
167
|
-
> 1. Proceed as-is despite remaining issues
|
|
168
|
-
> 2. Keep fixing (at your own risk)
|
|
169
|
-
> 3. Abandon this task and move on
|
|
170
|
-
>
|
|
171
|
-
> What would you like to do?"
|
|
172
|
-
|
|
173
|
-
### Task Complete
|
|
174
|
-
|
|
175
|
-
When both reviewers are satisfied and all conditions pass:
|
|
176
|
-
|
|
177
|
-
```
|
|
178
|
-
plan_tracker({ action: "update", index: N, status: "complete" })
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
Commit the task:
|
|
182
|
-
```bash
|
|
183
|
-
git add <relevant files>
|
|
184
|
-
git commit -m "feat(task N): <description>"
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
## Escalation Rules
|
|
188
|
-
|
|
189
|
-
| Event | Action |
|
|
190
|
-
|-------|--------|
|
|
191
|
-
| Execute 3 attempts exhausted | Escalate to human — never auto-skip |
|
|
192
|
-
| Fix loop 3 attempts exhausted | Escalate to human — never auto-skip |
|
|
193
|
-
| Verify fails | Flag to human — human decides next step |
|
|
194
|
-
|
|
195
|
-
**No silent skipping. Consistent escalation everywhere.**
|
|
196
|
-
|
|
197
|
-
## Finalize Phase
|
|
198
|
-
|
|
199
|
-
After all tasks complete (or are explicitly accepted by human):
|
|
200
|
-
|
|
201
|
-
### 1. Final Review
|
|
202
|
-
- Dispatch subagent to review the entire implementation holistically
|
|
203
|
-
- Check for integration issues, consistency across tasks, documentation gaps
|
|
204
|
-
|
|
205
|
-
### 2. Create PR
|
|
206
|
-
```bash
|
|
207
|
-
git push origin <branch>
|
|
208
|
-
gh pr create --title "feat: <feature summary>" --body "<task summary>"
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
### 3. Archive Planning Docs
|
|
212
|
-
```bash
|
|
213
|
-
mkdir -p docs/plans/completed
|
|
214
|
-
mv docs/plans/<plan-file> docs/plans/completed/
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
### 4. Update Repo Docs
|
|
218
|
-
- Update CHANGELOG with feature summary
|
|
219
|
-
- Update README if API/surface changed
|
|
220
|
-
- Update inline documentation as needed
|
|
221
|
-
|
|
222
|
-
### 5. Update Project Documentation
|
|
223
|
-
- Update README if project overview has changed
|
|
224
|
-
- Update CONTRIBUTING or architecture docs if structure changed
|
|
225
|
-
- Note any new patterns or conventions introduced
|
|
226
|
-
|
|
227
|
-
### 6. Clean Up
|
|
228
|
-
- Remove worktree if one was used
|
|
229
|
-
- Mark finalize phase complete
|
|
230
|
-
|
|
231
|
-
## Boundaries
|
|
232
|
-
- Read code, docs, and tests: yes
|
|
233
|
-
- Write tests and implementation code: yes (within current task scope)
|
|
234
|
-
- Write to docs/plans/completed/: yes (during finalize)
|
|
235
|
-
- Edit files outside task scope: no (unless human explicitly approves)
|
|
236
|
-
|
|
237
|
-
## Remember
|
|
238
|
-
- Always present test cases/criteria for human approval before executing
|
|
239
|
-
- Extract each task's `Type:` from the plan and preserve it in `plan_tracker`
|
|
240
|
-
- Track per-task phase and attempts in plan_tracker
|
|
241
|
-
- Code tasks use TDD; non-code tasks use acceptance criteria during define, approve, and verify
|
|
242
|
-
- Escalate immediately on budget exhaustion — never silently skip or continue
|
|
243
|
-
- Verify does not auto-fix — always flag to human
|
|
244
|
-
- Review has two layers (subagent first, then human)
|
|
245
|
-
- Fix loops re-enter verify → review (max 3 fix loops)
|
|
246
|
-
- Execute has separate budget (max 3 attempts)
|
|
247
|
-
- Total max cycles per task: 3 execute + 3 fix = 6
|
|
46
|
+
Ask: "All tasks done? Run `/skill:finalizing` to ship."
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: finalizing
|
|
3
|
+
description: "Use this after all tasks are complete to clean up, document, and ship the work."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Finalizing
|
|
7
|
+
|
|
8
|
+
Ship the completed work.
|
|
9
|
+
|
|
10
|
+
## Process
|
|
11
|
+
|
|
12
|
+
1. **Move planning docs** — archive the design and implementation docs:
|
|
13
|
+
```
|
|
14
|
+
mkdir -p docs/plans/completed
|
|
15
|
+
mv docs/plans/*-design.md docs/plans/completed/
|
|
16
|
+
mv docs/plans/*-implementation.md docs/plans/completed/
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
2. **Update documentation** — if the API or surface changed:
|
|
20
|
+
- Update README.md
|
|
21
|
+
- Update CHANGELOG.md
|
|
22
|
+
- Update any inline docs
|
|
23
|
+
|
|
24
|
+
3. **Create PR**:
|
|
25
|
+
```
|
|
26
|
+
git push origin <branch>
|
|
27
|
+
gh pr create --title "feat: <summary>" --body "<task summary>"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
4. **Clean up** — if a worktree was used, remove it after the PR is merged:
|
|
31
|
+
```
|
|
32
|
+
git worktree remove ../<repo>-<feature-name>
|
|
33
|
+
```
|
|
@@ -1,149 +1,40 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: writing-plans
|
|
3
|
-
description: Use
|
|
3
|
+
description: "Use this to break a design into an implementation plan with bite-sized TDD tasks. Works with or without a prior brainstorm."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
> **Related skills:** Did you `/skill:brainstorming` first? Ready to implement? Use `/skill:executing-tasks`.
|
|
7
|
-
|
|
8
6
|
# Writing Plans
|
|
9
7
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
Write comprehensive implementation plans assuming the engineer has zero context for our codebase and questionable taste. Document everything they need to know: which files to touch for each task, code, testing, docs they might need to check, how to test it. Give them the whole plan as bite-sized tasks. DRY. YAGNI. TDD. Frequent commits.
|
|
13
|
-
|
|
14
|
-
Assume they are a skilled developer, but know almost nothing about our toolset or problem domain. Assume they don't know good test design very well.
|
|
15
|
-
|
|
16
|
-
**Announce at start:** "I'm using the writing-plans skill to create the implementation plan."
|
|
17
|
-
|
|
18
|
-
**Context:** This should be run in a dedicated worktree (created by brainstorming skill).
|
|
19
|
-
|
|
20
|
-
**Save plans to:** `docs/plans/YYYY-MM-DD-<feature-name>-implementation.md`
|
|
21
|
-
|
|
22
|
-
## Boundaries
|
|
23
|
-
- Read code and docs: yes
|
|
24
|
-
- Write to docs/plans/: yes
|
|
25
|
-
- Edit or create any other files: no
|
|
26
|
-
|
|
27
|
-
## Bite-Sized Task Granularity
|
|
28
|
-
|
|
29
|
-
**Each step is one action (2-5 minutes):**
|
|
30
|
-
- "Write the failing test" - step
|
|
31
|
-
- "Run it to make sure it fails" - step
|
|
32
|
-
- "Implement the minimal code to make the test pass" - step
|
|
33
|
-
- "Run the tests and make sure they pass" - step
|
|
34
|
-
- "Commit" - step
|
|
35
|
-
|
|
36
|
-
## Plan Document Header
|
|
37
|
-
|
|
38
|
-
**Every plan MUST start with this header:**
|
|
39
|
-
|
|
40
|
-
```markdown
|
|
41
|
-
# [Feature Name] Implementation Plan
|
|
42
|
-
|
|
43
|
-
> **REQUIRED SUB-SKILL:** Use the executing-tasks skill to implement this plan task-by-task.
|
|
44
|
-
|
|
45
|
-
**Goal:** [One sentence describing what this builds]
|
|
46
|
-
|
|
47
|
-
**Architecture:** [2-3 sentences about approach]
|
|
48
|
-
|
|
49
|
-
**Tech Stack:** [Key technologies/libraries]
|
|
50
|
-
|
|
51
|
-
---
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
## Task Structure
|
|
55
|
-
|
|
56
|
-
Every task must declare its type explicitly so `executing-tasks` can initialize `plan_tracker` with the correct metadata.
|
|
57
|
-
|
|
58
|
-
### Code task template
|
|
59
|
-
|
|
60
|
-
```markdown
|
|
61
|
-
### Task N: [Component Name]
|
|
62
|
-
|
|
63
|
-
**Type:** code
|
|
64
|
-
**TDD scenario:** [New feature — full TDD cycle | Modifying tested code — run existing tests first | Trivial change — use judgment]
|
|
65
|
-
|
|
66
|
-
**Files:**
|
|
67
|
-
- Create: `exact/path/to/file.py`
|
|
68
|
-
- Modify: `exact/path/to/existing.py:123-145`
|
|
69
|
-
- Test: `tests/exact/path/to/test.py`
|
|
70
|
-
|
|
71
|
-
**Step 1: Write the failing test**
|
|
72
|
-
|
|
73
|
-
```python
|
|
74
|
-
def test_specific_behavior():
|
|
75
|
-
result = function(input)
|
|
76
|
-
assert result == expected
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
**Step 2: Run test to verify it fails**
|
|
80
|
-
|
|
81
|
-
Run: `pytest tests/path/test.py::test_name -v`
|
|
82
|
-
Expected: FAIL with "function not defined"
|
|
83
|
-
|
|
84
|
-
**Step 3: Write minimal implementation**
|
|
85
|
-
|
|
86
|
-
```python
|
|
87
|
-
def function(input):
|
|
88
|
-
return expected
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
**Step 4: Run test to verify it passes**
|
|
92
|
-
|
|
93
|
-
Run: `pytest tests/path/test.py::test_name -v`
|
|
94
|
-
Expected: PASS
|
|
95
|
-
|
|
96
|
-
**Step 5: Commit**
|
|
97
|
-
|
|
98
|
-
```bash
|
|
99
|
-
git add tests/path/test.py src/path/file.py
|
|
100
|
-
git commit -m "feat: add specific feature"
|
|
101
|
-
```
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
### Non-code task template
|
|
105
|
-
|
|
106
|
-
```markdown
|
|
107
|
-
### Task N: [Documentation / rollout / analysis task]
|
|
108
|
-
|
|
109
|
-
**Type:** non-code
|
|
8
|
+
Read-only exploration. You may **not** edit or create any files except under `docs/plans/`.
|
|
110
9
|
|
|
111
|
-
|
|
112
|
-
- Modify: `README.md`
|
|
113
|
-
- Modify: `docs/architecture.md`
|
|
10
|
+
## Process
|
|
114
11
|
|
|
115
|
-
**
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
12
|
+
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.
|
|
13
|
+
2. **Set up workspace** — create a branch for this work. For larger features, use a git worktree for isolation:
|
|
14
|
+
```
|
|
15
|
+
git worktree add ../<repo>-<feature-name> -b <feature-name>
|
|
16
|
+
```
|
|
17
|
+
3. **Write the implementation plan** — break the design into tasks. Save to `docs/plans/YYYY-MM-DD-<topic>-implementation.md`.
|
|
119
18
|
|
|
120
|
-
|
|
121
|
-
- Update the listed files only.
|
|
122
|
-
- Keep terminology consistent with the rest of the repo.
|
|
123
|
-
- Reference the relevant code paths or docs where useful.
|
|
19
|
+
## Task format
|
|
124
20
|
|
|
125
|
-
|
|
126
|
-
- Review each acceptance criterion one-by-one.
|
|
127
|
-
- Confirm the updated docs match the implemented behavior.
|
|
128
|
-
```
|
|
21
|
+
Each task should be 2-5 minutes of work:
|
|
129
22
|
|
|
130
|
-
|
|
131
|
-
-
|
|
132
|
-
- Every task must include `**Type:** code` or `**Type:** non-code`
|
|
133
|
-
- Non-code tasks must include explicit `**Acceptance criteria:**`
|
|
134
|
-
- Complete code in plan (not "add validation")
|
|
23
|
+
- Exact file paths to create/modify
|
|
24
|
+
- Complete code (not "add validation")
|
|
135
25
|
- Exact commands with expected output
|
|
136
|
-
-
|
|
137
|
-
- DRY, YAGNI, TDD, frequent commits
|
|
138
|
-
- Order tasks so each task's dependencies are completed by earlier tasks
|
|
139
|
-
- If plan exceeds ~8 tasks, consider splitting into phases with a checkpoint between them
|
|
26
|
+
- `git commit` after each task
|
|
140
27
|
|
|
141
|
-
##
|
|
28
|
+
## TDD in the plan
|
|
142
29
|
|
|
143
|
-
|
|
30
|
+
Label each task with its TDD scenario:
|
|
144
31
|
|
|
145
|
-
|
|
32
|
+
| Scenario | When | Instructions in the task |
|
|
33
|
+
|---|---|---|
|
|
34
|
+
| **New feature** | Adding new behavior | Write failing test → run it → implement → run it → commit |
|
|
35
|
+
| **Modifying tested code** | Changing existing behavior | Run existing tests first → modify → verify they pass → commit |
|
|
36
|
+
| **Trivial** | Config, docs, naming | Use judgment, commit when done |
|
|
146
37
|
|
|
147
|
-
|
|
38
|
+
## After the plan
|
|
148
39
|
|
|
149
|
-
|
|
40
|
+
Ask: "Ready to execute? Run `/skill:executing-tasks`"
|