@claude-pw/framework 0.3.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/LICENSE +21 -0
- package/README.es.md +173 -0
- package/README.ja.md +173 -0
- package/README.md +173 -0
- package/README.pt-br.md +173 -0
- package/README.zh-cn.md +173 -0
- package/RELEASES.md +66 -0
- package/install.js +593 -0
- package/package.json +35 -0
- package/templates/CHANGELOG.md +6 -0
- package/templates/CLAUDE.md.tpl +38 -0
- package/templates/Makefile +37 -0
- package/templates/PLAN.md.tpl +18 -0
- package/templates/STATUS.md.tpl +15 -0
- package/templates/claude/agents/codebase-mapper.md +105 -0
- package/templates/claude/agents/debugger.md +90 -0
- package/templates/claude/agents/decision-impact.md +36 -0
- package/templates/claude/agents/implementer.md +73 -0
- package/templates/claude/agents/interface-reviewer.md +22 -0
- package/templates/claude/agents/learning-extractor.md +104 -0
- package/templates/claude/agents/phase-validator.md +108 -0
- package/templates/claude/agents/plan-checker.md +18 -0
- package/templates/claude/agents/researcher.md +85 -0
- package/templates/claude/agents/session-recovery.md +127 -0
- package/templates/claude/agents/spike-explorer.md +34 -0
- package/templates/claude/commands/cpw-debug.md +116 -0
- package/templates/claude/commands/cpw-discuss.md +70 -0
- package/templates/claude/commands/cpw-health.md +67 -0
- package/templates/claude/commands/cpw-impact.md +22 -0
- package/templates/claude/commands/cpw-next-step.md +492 -0
- package/templates/claude/commands/cpw-pause.md +49 -0
- package/templates/claude/commands/cpw-quick.md +83 -0
- package/templates/claude/commands/cpw-reflect.md +209 -0
- package/templates/claude/commands/cpw-startup.md +321 -0
- package/templates/claude/commands/cpw-todos.md +100 -0
- package/templates/claude/hooks/cpw-context-monitor.js +59 -0
- package/templates/claude/hooks/cpw-statusline.js +36 -0
- package/templates/claude/rules/git.md +27 -0
- package/templates/claude/rules/interfaces.md +9 -0
- package/templates/claude/rules/testing.md +8 -0
- package/templates/claude/settings.json +42 -0
- package/templates/docs/architecture.md +4 -0
- package/templates/docs/codebase-map.md +3 -0
- package/templates/docs/conventions.md +3 -0
- package/templates/docs/interfaces.md +10 -0
- package/templates/docs/tech-debt.md +3 -0
- package/templates/docs/tooling.md +15 -0
- package/templates/gitignore +17 -0
- package/templates/husky/pre-commit +23 -0
- package/templates/planning/config.json +11 -0
- package/templates/planning/learnings/applied.md +3 -0
- package/templates/planning/learnings/queue.md +5 -0
- package/templates/planning/quick/log.md +4 -0
- package/templates/plans/decisions.md +9 -0
- package/templates/plans/phase-0.md +57 -0
- package/templates/plans/phase-1.md +49 -0
|
@@ -0,0 +1,492 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Load context and execute the next pipeline stage"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
## 0. Health check (session start)
|
|
6
|
+
|
|
7
|
+
### Handoff detection
|
|
8
|
+
If `.planning/handoff.md` exists:
|
|
9
|
+
- Show the handoff summary to the user
|
|
10
|
+
- Ask: "Resume from this handoff? (yes/no)"
|
|
11
|
+
- If yes: load context from handoff, delete handoff file, continue
|
|
12
|
+
- If no: delete handoff file, proceed normally
|
|
13
|
+
|
|
14
|
+
### Session recovery
|
|
15
|
+
Delegate to the session-recovery agent in CHECK mode:
|
|
16
|
+
<files_to_read>
|
|
17
|
+
- STATUS.md
|
|
18
|
+
- ./CLAUDE.md (if exists)
|
|
19
|
+
</files_to_read>
|
|
20
|
+
|
|
21
|
+
- If CLEAN: continue.
|
|
22
|
+
- If RECOVERABLE: show suggested actions. Ask: "Repair automatically? (yes/no)".
|
|
23
|
+
- If yes: re-invoke session-recovery with REPAIR=true. Continue.
|
|
24
|
+
- If no: show manual actions. Wait.
|
|
25
|
+
- If INCONSISTENT: show diagnostic. Do NOT continue without user decision.
|
|
26
|
+
|
|
27
|
+
## 1. Load context
|
|
28
|
+
- Read STATUS.md -> phase, step, stage
|
|
29
|
+
- Read indicated sub-plan (plans/phase-N.md)
|
|
30
|
+
- If `plans/phase-N-context.md` exists (from /cpw-discuss), load it too
|
|
31
|
+
- Load ONLY files in "Required context" — nothing else
|
|
32
|
+
- Read `.planning/config.json` -> autoAdvance (off | auto | yolo)
|
|
33
|
+
|
|
34
|
+
If stage = CORRECTION:
|
|
35
|
+
- Read "Pending corrections" from STATUS.md
|
|
36
|
+
- Show the list to the user
|
|
37
|
+
- Resolve each correction one by one
|
|
38
|
+
- After fixing all: `make commit m="fix(phase-N): validator corrections"`
|
|
39
|
+
- Report: "Corrections resolved. Re-running phase validation..."
|
|
40
|
+
- Go to step 3 (Phase validation) to re-validate
|
|
41
|
+
|
|
42
|
+
## 1.4 Branch creation (only at phase start, non-trunk strategies)
|
|
43
|
+
|
|
44
|
+
This step runs ONLY when:
|
|
45
|
+
- Step is the FIRST step of the phase (e.g., N.1)
|
|
46
|
+
- `gitStrategy` is `"feature-branch"` or `"gitflow"` (skip for trunk-based)
|
|
47
|
+
|
|
48
|
+
Read `gitStrategy` from `.planning/config.json`:
|
|
49
|
+
- **feature-branch**: create branch `phase-N/[phase-description-slug]` from main. `git checkout -b phase-N/[slug]`
|
|
50
|
+
- **gitflow**: ensure `develop` branch exists (create from main if not). Create branch `feature/phase-N-[slug]` from develop. `git checkout -b feature/phase-N-[slug] develop`
|
|
51
|
+
|
|
52
|
+
Add "Branch: [branch-name]" to STATUS.md session notes.
|
|
53
|
+
|
|
54
|
+
## 1.5 Tooling audit (only at phase start)
|
|
55
|
+
|
|
56
|
+
This step runs ONLY when:
|
|
57
|
+
- Stage = DESIGN
|
|
58
|
+
- Step is the FIRST step of the phase (e.g., N.1, not N.2 or N.3)
|
|
59
|
+
- The session notes in STATUS.md do NOT contain "Tooling audited for phase N"
|
|
60
|
+
|
|
61
|
+
If any condition is false, skip to pipeline evaluation.
|
|
62
|
+
|
|
63
|
+
### 1.5.1 Detect phase technologies
|
|
64
|
+
- Read the current sub-plan (plans/phase-N.md) — extract technologies, libraries, domains
|
|
65
|
+
- Read docs/architecture.md — extract stack context
|
|
66
|
+
- Build a keyword list: frameworks, languages, domains (e.g., "React", "SQLite", "auth", "video processing")
|
|
67
|
+
|
|
68
|
+
### 1.5.2 Search for relevant tools
|
|
69
|
+
Read `toolingSources` from `.planning/config.json` (default: `["skills.sh", "claude-code-templates"]`).
|
|
70
|
+
Only search sources listed in the config. For each keyword:
|
|
71
|
+
|
|
72
|
+
**If "skills.sh" in toolingSources** — Skills and agents (88K+):
|
|
73
|
+
```bash
|
|
74
|
+
npx skills find "[keyword]"
|
|
75
|
+
```
|
|
76
|
+
Collect top results by install count. Filter for quality (>1K installs, maintained repos).
|
|
77
|
+
|
|
78
|
+
**If "claude-code-templates" in toolingSources** — Agents, MCPs, hooks, settings (100+ curated):
|
|
79
|
+
Browse for components matching the phase technologies:
|
|
80
|
+
- Agents: `npx claude-code-templates@latest --agent [category/name] --yes`
|
|
81
|
+
- MCPs: `npx claude-code-templates@latest --mcp [category/name] --yes`
|
|
82
|
+
- Hooks: `npx claude-code-templates@latest --hook [category/name] --yes`
|
|
83
|
+
|
|
84
|
+
**Other configurable sources** (add to `toolingSources` array if needed):
|
|
85
|
+
- `"claude-plugins.dev"` → `npx skills-installer search "[keyword]"`
|
|
86
|
+
- `"web-search"` → delegate to researcher agent for broader search:
|
|
87
|
+
<files_to_read>
|
|
88
|
+
- ./CLAUDE.md (if exists)
|
|
89
|
+
- docs/architecture.md (if exists)
|
|
90
|
+
</files_to_read>
|
|
91
|
+
Type: tooling
|
|
92
|
+
Topic: [keyword search for broader tooling options]
|
|
93
|
+
|
|
94
|
+
### 1.5.3 Audit current tooling
|
|
95
|
+
- Read `.claude/settings.local.json` → `enabledMcpjsonServers` (active MCPs)
|
|
96
|
+
- List installed skills: `npx skills list --json` (or scan `.claude/skills/`)
|
|
97
|
+
- List installed agents: scan `.claude/agents/` for non-default agents
|
|
98
|
+
- For each currently installed tool, evaluate: is it relevant to THIS phase?
|
|
99
|
+
- If yes → KEEP
|
|
100
|
+
- If no → propose DISABLE (not delete — can be re-enabled later)
|
|
101
|
+
|
|
102
|
+
### 1.5.4 Present recommendations
|
|
103
|
+
```
|
|
104
|
+
══════════════════════════════════════════
|
|
105
|
+
TOOLING AUDIT — Phase N: [phase name]
|
|
106
|
+
══════════════════════════════════════════
|
|
107
|
+
|
|
108
|
+
Technologies detected: [list]
|
|
109
|
+
|
|
110
|
+
INSTALL (recommended):
|
|
111
|
+
1. [type] [name] — [why it helps]
|
|
112
|
+
Install: [exact command]
|
|
113
|
+
2. ...
|
|
114
|
+
|
|
115
|
+
DISABLE (no longer needed for this phase):
|
|
116
|
+
3. [tool] — used in Phase M, not relevant now
|
|
117
|
+
|
|
118
|
+
KEEP (still relevant):
|
|
119
|
+
4. [tool] — [why]
|
|
120
|
+
|
|
121
|
+
Install/disable recommendations? (numbers, "all", or "skip")
|
|
122
|
+
══════════════════════════════════════════
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### 1.5.5 Execute approved changes
|
|
126
|
+
- Skills from skills.sh: `npx skills add [repo] -s [skill] -y`
|
|
127
|
+
- Components from claude-code-templates: `npx claude-code-templates@latest --[type] [path] --yes`
|
|
128
|
+
- Disable MCPs: remove from `enabledMcpjsonServers` in `.claude/settings.local.json`
|
|
129
|
+
- Disable skills: `npx skills remove [skill]`
|
|
130
|
+
|
|
131
|
+
### 1.5.6 Generate tooling map
|
|
132
|
+
Update docs/tooling.md with a **tooling map** that tells Claude WHEN and HOW to use each tool during this phase:
|
|
133
|
+
|
|
134
|
+
```markdown
|
|
135
|
+
# Tooling — Phase N
|
|
136
|
+
|
|
137
|
+
## Active tools
|
|
138
|
+
|
|
139
|
+
### [skill/agent/MCP name]
|
|
140
|
+
- **Type:** skill | agent | MCP | hook
|
|
141
|
+
- **Source:** skills.sh | claude-plugins.dev | claude-code-templates
|
|
142
|
+
- **Installed for:** Phase N
|
|
143
|
+
- **Use in steps:** [N.2, N.3, N.5] (map to specific sub-plan steps)
|
|
144
|
+
- **When to use:** [concrete trigger — e.g., "during DESIGN stage when proposing component architecture", "during IMPLEMENT when writing React components", "during TEST for e2e browser tests"]
|
|
145
|
+
- **How to use:** [exact invocation — e.g., "reference the skill's best practices when designing", "use the MCP's query tool for database operations", "delegate to agent for security review"]
|
|
146
|
+
|
|
147
|
+
### [next tool...]
|
|
148
|
+
...
|
|
149
|
+
|
|
150
|
+
## Disabled (available for re-enable)
|
|
151
|
+
- [tool] — was active in Phase M, disabled because [reason]
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Read each installed skill's SKILL.md or description to understand its capabilities. Then cross-reference with the sub-plan steps to determine WHERE it applies.
|
|
155
|
+
|
|
156
|
+
This map is the bridge between "installed" and "actually used."
|
|
157
|
+
|
|
158
|
+
- Add "Tooling audited for phase N" to STATUS.md session notes (prevents re-running)
|
|
159
|
+
|
|
160
|
+
### 1.5.7 Continue to pipeline
|
|
161
|
+
Proceed with normal DESIGN stage evaluation below.
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
### 1.6 Load step-specific tooling
|
|
166
|
+
If `docs/tooling.md` exists, read the "Active tools" section and filter for tools mapped to the CURRENT step (N.Y).
|
|
167
|
+
For each relevant tool, note:
|
|
168
|
+
- What it does
|
|
169
|
+
- When to use it (which pipeline stage)
|
|
170
|
+
- How to invoke it
|
|
171
|
+
|
|
172
|
+
Keep this context available throughout the step's pipeline stages. When executing a stage, actively use the tools mapped to that stage — don't just have them installed, USE them.
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
If it's a STEP START (stage = DESIGN), evaluate the adaptive pipeline:
|
|
177
|
+
|
|
178
|
+
```
|
|
179
|
+
Pipeline for Step [X.Y]:
|
|
180
|
+
- SPIKE: [ok / skip + reason]
|
|
181
|
+
- DESIGN: ok
|
|
182
|
+
- BUILD-OR-BUY: [ok / skip + reason]
|
|
183
|
+
- FEASIBILITY: [ok / skip + reason]
|
|
184
|
+
- COMPATIBILITY: [ok / skip + reason]
|
|
185
|
+
- IMPLEMENT: [ok / skip + reason]
|
|
186
|
+
- TEST: [ok / skip + reason]
|
|
187
|
+
- ACCEPTANCE: ok
|
|
188
|
+
- CLOSE: ok
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Then execute the current stage (check docs/tooling.md for tools mapped to this stage):
|
|
192
|
+
- **SPIKE:** Define question + timebox. Delegate to the spike-explorer agent:
|
|
193
|
+
<files_to_read>
|
|
194
|
+
- ./CLAUDE.md (if exists)
|
|
195
|
+
- [current sub-plan: plans/phase-N.md]
|
|
196
|
+
- docs/architecture.md (if exists)
|
|
197
|
+
</files_to_read>
|
|
198
|
+
Question: [the spike question]
|
|
199
|
+
Timebox: [timebox]
|
|
200
|
+
Report result. Discard code. Record findings in plans/decisions.md if relevant.
|
|
201
|
+
- **DESIGN:** Before proposing, check for technical unknowns. If found, delegate to the researcher agent:
|
|
202
|
+
<files_to_read>
|
|
203
|
+
- ./CLAUDE.md (if exists)
|
|
204
|
+
- docs/architecture.md (if exists)
|
|
205
|
+
- [current sub-plan: plans/phase-N.md]
|
|
206
|
+
</files_to_read>
|
|
207
|
+
Type: [architecture | feasibility]
|
|
208
|
+
Topic: [the unknown to investigate]
|
|
209
|
+
Incorporate findings into the design. Cite: "Based on research (docs/research/[topic].md)". **Apply any skills mapped to DESIGN for this step** (e.g., best-practice skills, architecture agents). Then propose design. Wait for approval.
|
|
210
|
+
- **BUILD-OR-BUY:** Delegate to the researcher agent:
|
|
211
|
+
<files_to_read>
|
|
212
|
+
- ./CLAUDE.md (if exists)
|
|
213
|
+
- docs/architecture.md (if exists)
|
|
214
|
+
- [current sub-plan: plans/phase-N.md]
|
|
215
|
+
</files_to_read>
|
|
216
|
+
Type: library
|
|
217
|
+
Topic: [what to compare]
|
|
218
|
+
The agent searches and compares options. Present findings with recommendation. Wait for approval.
|
|
219
|
+
- **FEASIBILITY:** Verify feasibility with the stack.
|
|
220
|
+
- **COMPATIBILITY:** Delegate to the interface-reviewer agent:
|
|
221
|
+
<files_to_read>
|
|
222
|
+
- ./CLAUDE.md (if exists)
|
|
223
|
+
- docs/interfaces.md (if exists)
|
|
224
|
+
- src/interfaces/ (directory — read all files)
|
|
225
|
+
</files_to_read>
|
|
226
|
+
The agent checks consistency, circular deps, missing contracts, coverage. Then run `make test-contracts` if contract tests exist. If the agent reports problems, resolve them before proceeding to IMPLEMENT.
|
|
227
|
+
- **IMPLEMENT:** Delegate to the implementer agent with:
|
|
228
|
+
<files_to_read>
|
|
229
|
+
- ./CLAUDE.md (if exists)
|
|
230
|
+
- [file paths from "Required context" in STATUS.md]
|
|
231
|
+
- docs/interfaces.md (if exists)
|
|
232
|
+
- docs/tooling.md (if exists)
|
|
233
|
+
- docs/conventions.md (if exists)
|
|
234
|
+
</files_to_read>
|
|
235
|
+
Design: [the approved DESIGN proposal — copy the full design text]
|
|
236
|
+
Interface contracts: [from COMPATIBILITY output, if that stage ran]
|
|
237
|
+
Skills: [mapped to IMPLEMENT from docs/tooling.md]
|
|
238
|
+
Test command: `make check` (or project-specific command from docs/tooling.md)
|
|
239
|
+
Max retries: [from `maxConsecutiveFailures` in config, default: 3]
|
|
240
|
+
Wait for the agent's structured report.
|
|
241
|
+
- If SUCCESS → proceed to ACCEPTANCE with the report as summary
|
|
242
|
+
- If PARTIAL → present partial results to user. Options: continue to ACCEPTANCE / retry / abort
|
|
243
|
+
- If FAILED → present failure details. Options: retry with modified design / abort step
|
|
244
|
+
- Deviations field → included in ACCEPTANCE summary for reviewer visibility
|
|
245
|
+
- **TEST:** The implementer already ran tests. Review its test report.
|
|
246
|
+
- If all tests passed → proceed to ACCEPTANCE
|
|
247
|
+
- If the implementer reported PARTIAL → run `make check` to verify current state
|
|
248
|
+
- If additional test tools exist in docs/tooling.md (e.g., browser MCPs, e2e tests) → run those now
|
|
249
|
+
- **Use any testing skills/MCPs mapped to TEST for this step**
|
|
250
|
+
- **ACCEPTANCE:** Summary for approval.
|
|
251
|
+
- **CLOSE:**
|
|
252
|
+
1. If interfaces/architecture/contracts changed → update corresponding docs
|
|
253
|
+
2. If this step added a significant feature, new command, API endpoint, or changed the stack → update README.md (keep it current for anyone opening the repo)
|
|
254
|
+
3. Mark [x] in sub-plan
|
|
255
|
+
3. `make commit m="type(scope): description"`
|
|
256
|
+
- `make commit` respects commitPlanning from config.json
|
|
257
|
+
- If pre-commit fails: fix, retry
|
|
258
|
+
4. Skill self-check (see below)
|
|
259
|
+
5. Auto-reflect check (see below)
|
|
260
|
+
6. Git push (strategy-aware, see below)
|
|
261
|
+
7. Check if this was the LAST step in the phase (all steps [x] in sub-plan)
|
|
262
|
+
- If YES → go to step 3 (Phase validation)
|
|
263
|
+
- If NO → update STATUS.md to next step, stage DESIGN
|
|
264
|
+
|
|
265
|
+
### Git push (CLOSE sub-step 6)
|
|
266
|
+
Read `gitStrategy` from `.planning/config.json` (default: "trunk-based").
|
|
267
|
+
- **trunk-based**: `make push` (push directly to main/master)
|
|
268
|
+
- **feature-branch** / **gitflow**: `git push` to the current branch (do NOT push to main/develop directly)
|
|
269
|
+
|
|
270
|
+
### Skill self-check (CLOSE sub-step 4)
|
|
271
|
+
If the step involved debugging, workarounds, or non-obvious configuration, run these 5 questions internally:
|
|
272
|
+
1. Did the solution require significant investigation (not obvious from docs)?
|
|
273
|
+
2. Was the error/problem misleading (root cause differed from symptom)?
|
|
274
|
+
3. Did I find a workaround for a tool/framework limitation?
|
|
275
|
+
4. Does the configuration differ from the standard documented pattern?
|
|
276
|
+
5. Did I try multiple approaches before finding one that works?
|
|
277
|
+
|
|
278
|
+
If ≥1 answer is yes, apply 4 quality gates:
|
|
279
|
+
- **Reusable**: Will help with future tasks, not just this instance
|
|
280
|
+
- **Non-trivial**: Required discovery, not just documentation lookup
|
|
281
|
+
- **Specific**: Has concrete trigger conditions (error messages, symptoms)
|
|
282
|
+
- **Verified**: Solution was tested and works
|
|
283
|
+
|
|
284
|
+
If all gates pass:
|
|
285
|
+
- Propose: "This step produced reusable knowledge. Extract as skill? (yes/no)"
|
|
286
|
+
- If yes (or autoAdvance is auto/yolo): create `.claude/skills/[name-slug].md` using the skill template
|
|
287
|
+
- `make commit m="learn: extract skill [name]"`
|
|
288
|
+
If no self-check triggers or gates don't pass: continue normally.
|
|
289
|
+
|
|
290
|
+
### Auto-reflect check (CLOSE sub-step 5)
|
|
291
|
+
Read `autoReflect` from `.planning/config.json` (default: "remind").
|
|
292
|
+
If `autoReflect` is `"auto"` AND `.planning/learnings/queue.md` has entries:
|
|
293
|
+
- Run a lightweight reflection (steps 1.5, 2, 4, 5 of /cpw-reflect — skip history scan and dedup)
|
|
294
|
+
- Auto-approve entries with confidence ≥ 0.80
|
|
295
|
+
- Present entries with confidence < 0.80 for manual approval
|
|
296
|
+
- `make commit m="learn: auto-reflect session learnings"`
|
|
297
|
+
If `autoReflect` is `"remind"` or `"off"`: skip (the Stop hook handles reminders).
|
|
298
|
+
|
|
299
|
+
Update STATUS.md with the new stage when finished.
|
|
300
|
+
|
|
301
|
+
## 2. Advance based on mode
|
|
302
|
+
|
|
303
|
+
Read `autoAdvance` from `.planning/config.json` (default: "off").
|
|
304
|
+
Read `maxConsecutiveFailures` from config (default: 3 for auto, 5 for yolo).
|
|
305
|
+
|
|
306
|
+
### off (default)
|
|
307
|
+
Pause at every stage. User confirms each step.
|
|
308
|
+
After CLOSE, report: "Step X.Y closed. Next: Step X.Z"
|
|
309
|
+
|
|
310
|
+
### auto
|
|
311
|
+
Auto-advance through ALL stages including DESIGN and ACCEPTANCE.
|
|
312
|
+
Pause ONLY at:
|
|
313
|
+
- **UAT** — always interactive (requires human testing)
|
|
314
|
+
- **Ambiguous decisions** — when multiple valid options exist with no clear winner
|
|
315
|
+
- **Errors** — test fail, build fail, pre-commit fail → offer: fix / skip / stop
|
|
316
|
+
- **Consecutive failures** — HALT after N failures in same stage (default: 3, configurable via `maxConsecutiveFailures`)
|
|
317
|
+
|
|
318
|
+
Auto-approves: all pipeline stages (SPIKE, DESIGN, BUILD-OR-BUY, FEASIBILITY, COMPATIBILITY, IMPLEMENT, TEST, ACCEPTANCE, CLOSE), commit messages, phase validation if passed, cross-phase advancement after UAT passes.
|
|
319
|
+
|
|
320
|
+
### yolo
|
|
321
|
+
Auto-advance through everything. Same as auto but also:
|
|
322
|
+
- **UAT** — auto-approves if all deliverables pass; pauses ONLY if issues found
|
|
323
|
+
- **Ambiguous decisions** — auto-selects first viable option
|
|
324
|
+
- **Consecutive failures** — HALT after N failures (default: 5)
|
|
325
|
+
|
|
326
|
+
In yolo mode, Claude designs, implements, tests, closes, validates phases, and advances — only stopping when something breaks or UAT finds actual issues.
|
|
327
|
+
|
|
328
|
+
### Rules for all modes
|
|
329
|
+
- Commit messages are auto-generated in auto and yolo (no pause)
|
|
330
|
+
- Phase validation always runs automatically when last step completes
|
|
331
|
+
- Between phases: auto and yolo continue automatically (run tooling audit → next step); off always stops
|
|
332
|
+
- If context fills up (3+ auto-advanced steps), suggest /clear and re-invoke /cpw-next-step
|
|
333
|
+
|
|
334
|
+
## 3. Phase validation (auto-triggered when all steps are done)
|
|
335
|
+
|
|
336
|
+
This step runs automatically when the last step of a phase is completed.
|
|
337
|
+
Do NOT wait for the user to invoke a separate command.
|
|
338
|
+
|
|
339
|
+
### 3.1 Verify sub-plan
|
|
340
|
+
- All steps must be [x] in plans/phase-N.md
|
|
341
|
+
- If there are pending steps: this should not happen (step 1 CLOSE detected last step). Report error.
|
|
342
|
+
|
|
343
|
+
### 3.2 Execute phase-validator
|
|
344
|
+
Delegate to the phase-validator agent:
|
|
345
|
+
<files_to_read>
|
|
346
|
+
- ./CLAUDE.md (if exists)
|
|
347
|
+
- [current sub-plan: plans/phase-N.md]
|
|
348
|
+
- docs/architecture.md (if exists)
|
|
349
|
+
- docs/interfaces.md (if exists)
|
|
350
|
+
- docs/tooling.md (if exists)
|
|
351
|
+
- plans/decisions.md (if exists)
|
|
352
|
+
</files_to_read>
|
|
353
|
+
Phase: N
|
|
354
|
+
The agent validates: code, documentation, consistency, gate.
|
|
355
|
+
Wait for its complete report.
|
|
356
|
+
|
|
357
|
+
### 3.3 Evaluate result
|
|
358
|
+
|
|
359
|
+
#### If CORRECTIONS NEEDED:
|
|
360
|
+
- Do NOT close the phase
|
|
361
|
+
- Update STATUS.md to correction mode:
|
|
362
|
+
```
|
|
363
|
+
## Now
|
|
364
|
+
- Phase: N
|
|
365
|
+
- Step: N.fix
|
|
366
|
+
- Stage: CORRECTION
|
|
367
|
+
- Sub-plan: plans/phase-N.md
|
|
368
|
+
|
|
369
|
+
## Pending corrections
|
|
370
|
+
1. [correction from the validator report]
|
|
371
|
+
2. ...
|
|
372
|
+
|
|
373
|
+
## Required context
|
|
374
|
+
- [files that need correction]
|
|
375
|
+
|
|
376
|
+
## Session notes
|
|
377
|
+
- Phase-validator found [X] corrections
|
|
378
|
+
```
|
|
379
|
+
- Report: "Phase N has pending corrections. Run /cpw-next-step to resolve them."
|
|
380
|
+
- STOP here. The next /cpw-next-step invocation will detect stage = CORRECTION and handle fixes, then re-run phase validation.
|
|
381
|
+
|
|
382
|
+
#### If APPROVED:
|
|
383
|
+
- Update PLAN.md (phase marked as completed)
|
|
384
|
+
- `make commit m="chore: complete phase N"`
|
|
385
|
+
- `make push`
|
|
386
|
+
- Continue to step 4 (User Acceptance Testing)
|
|
387
|
+
|
|
388
|
+
## 4. User Acceptance Testing (after phase validation passes)
|
|
389
|
+
|
|
390
|
+
This step runs automatically after phase-validator approves.
|
|
391
|
+
The goal is to verify that features actually WORK from the user's perspective.
|
|
392
|
+
UAT state persists in `.planning/uat.md` — survives `/clear` and context resets.
|
|
393
|
+
|
|
394
|
+
### 4.1 Check for active UAT session
|
|
395
|
+
If `.planning/uat.md` exists:
|
|
396
|
+
- Read the file. It contains deliverables with their status (PENDING/PASSED/SKIPPED/ISSUE).
|
|
397
|
+
- Resume from the first PENDING item.
|
|
398
|
+
- Show: "Resuming UAT for Phase N — [X] passed, [Y] remaining."
|
|
399
|
+
|
|
400
|
+
If it does NOT exist: continue to 4.2.
|
|
401
|
+
|
|
402
|
+
### 4.2 Extract testable deliverables
|
|
403
|
+
Read the sub-plan (plans/phase-N.md) and extract user-observable outcomes:
|
|
404
|
+
- Features the user should be able to use
|
|
405
|
+
- Behaviors that should be visible
|
|
406
|
+
- Interactions that should work
|
|
407
|
+
|
|
408
|
+
Skip internal/non-observable items (refactors, type changes, internal restructuring).
|
|
409
|
+
|
|
410
|
+
Write `.planning/uat.md`:
|
|
411
|
+
```markdown
|
|
412
|
+
# UAT — Phase N
|
|
413
|
+
Started: [date]
|
|
414
|
+
|
|
415
|
+
## Deliverables
|
|
416
|
+
1. [PENDING] [Feature name] — [expected behavior]
|
|
417
|
+
2. [PENDING] [Feature name] — [expected behavior]
|
|
418
|
+
3. [PENDING] [Feature name] — [expected behavior]
|
|
419
|
+
|
|
420
|
+
## Issues
|
|
421
|
+
(none yet)
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
### 4.3 Walkthrough (conversational, one at a time)
|
|
425
|
+
For each PENDING deliverable, present:
|
|
426
|
+
```
|
|
427
|
+
[1/N] [Feature name]
|
|
428
|
+
Expected: [what should happen]
|
|
429
|
+
|
|
430
|
+
Does it work? (yes / describe the issue / skip)
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
After each response, update `.planning/uat.md` immediately:
|
|
434
|
+
- "yes", "y", "pass" → mark as `[PASSED]`
|
|
435
|
+
- "skip" → mark as `[SKIPPED]`
|
|
436
|
+
- Anything else → mark as `[ISSUE]`, add user's description to the Issues section
|
|
437
|
+
|
|
438
|
+
This ensures progress is never lost — even if context resets mid-walkthrough.
|
|
439
|
+
|
|
440
|
+
### 4.4 Results summary
|
|
441
|
+
When all deliverables are resolved (no PENDING items left):
|
|
442
|
+
```
|
|
443
|
+
══════════════════════════════════════
|
|
444
|
+
UAT RESULTS — Phase N
|
|
445
|
+
══════════════════════════════════════
|
|
446
|
+
Passed: X
|
|
447
|
+
Issues: Y
|
|
448
|
+
Skipped: Z
|
|
449
|
+
|
|
450
|
+
Issues found:
|
|
451
|
+
1. [feature]: [user's description]
|
|
452
|
+
2. ...
|
|
453
|
+
══════════════════════════════════════
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
### 4.5 Handle issues (if any)
|
|
457
|
+
If there are issues:
|
|
458
|
+
- For each issue, analyze the root cause (read relevant code)
|
|
459
|
+
- Propose a fix plan (which files to change, what to fix)
|
|
460
|
+
- Ask: "Fix these issues now? (yes/no)"
|
|
461
|
+
- If yes: execute fixes as a quick task, commit. Mark fixed items as `[PASSED]` in `.planning/uat.md`. Re-present only the fixed items for re-verification.
|
|
462
|
+
- If no: capture issues as todos in `.planning/quick/log.md` for later
|
|
463
|
+
|
|
464
|
+
### 4.6 Phase advancement
|
|
465
|
+
If all deliverables passed (or issues were fixed):
|
|
466
|
+
- Delete `.planning/uat.md` (session complete)
|
|
467
|
+
- Git strategy — phase merge (read `gitStrategy` from config):
|
|
468
|
+
- **trunk-based**: already on main, nothing to do
|
|
469
|
+
- **feature-branch**: create PR from `phase-N/[slug]` to main. Report PR URL. Wait for merge (or auto-merge if user approves). After merge: `git checkout main && git pull`
|
|
470
|
+
- **gitflow**: create PR from `feature/phase-N-[slug]` to develop. Report PR URL. Wait for merge. After merge: `git checkout develop && git pull`
|
|
471
|
+
- Reset STATUS.md for next phase:
|
|
472
|
+
```
|
|
473
|
+
## Now
|
|
474
|
+
- Phase: [N+1]
|
|
475
|
+
- Step: [N+1].1
|
|
476
|
+
- Stage: DESIGN
|
|
477
|
+
- Sub-plan: plans/phase-[N+1].md
|
|
478
|
+
|
|
479
|
+
## Required context
|
|
480
|
+
- [minimum for new phase]
|
|
481
|
+
|
|
482
|
+
## Session notes
|
|
483
|
+
- (empty)
|
|
484
|
+
```
|
|
485
|
+
- If autoAdvance is **off**: Recommend /clear, then report:
|
|
486
|
+
"Phase N complete. Before starting Phase N+1:"
|
|
487
|
+
" 1. `/cpw-discuss` — clarify ambiguities for the next phase"
|
|
488
|
+
" 2. `/cpw-todos` — review pending todos (some may fit the next phase)"
|
|
489
|
+
" 3. `/cpw-next-step` — start directly"
|
|
490
|
+
- If autoAdvance is **auto** or **yolo**: Suggest /clear for context refresh, then automatically continue with Phase N+1 (run tooling audit → first step).
|
|
491
|
+
|
|
492
|
+
NEVER advance between phases without completing UAT first (in any mode).
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Save session state for later resume — create handoff document"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
## 1. Capture current state
|
|
6
|
+
- Read STATUS.md (phase, step, stage)
|
|
7
|
+
- Read current sub-plan progress ([x] vs [ ])
|
|
8
|
+
- Check for uncommitted changes (`git status`)
|
|
9
|
+
|
|
10
|
+
## 2. Capture session context
|
|
11
|
+
Ask the user:
|
|
12
|
+
- "What were you working on?" (or infer from recent conversation)
|
|
13
|
+
- "Any blockers or decisions pending?"
|
|
14
|
+
- "Anything the next session should know?"
|
|
15
|
+
|
|
16
|
+
If the user wants to skip details, infer from the conversation context.
|
|
17
|
+
|
|
18
|
+
## 3. Generate handoff file
|
|
19
|
+
Write `.planning/handoff.md`:
|
|
20
|
+
|
|
21
|
+
```markdown
|
|
22
|
+
# Session Handoff — [date]
|
|
23
|
+
|
|
24
|
+
## State
|
|
25
|
+
- Phase: N, Step: X.Y, Stage: [stage]
|
|
26
|
+
- Progress: X/Y steps complete in current phase
|
|
27
|
+
|
|
28
|
+
## What was happening
|
|
29
|
+
- [description of current work]
|
|
30
|
+
|
|
31
|
+
## Uncommitted changes
|
|
32
|
+
- [list of modified files, or "none"]
|
|
33
|
+
|
|
34
|
+
## Pending decisions
|
|
35
|
+
- [any blockers or open questions]
|
|
36
|
+
|
|
37
|
+
## Notes for next session
|
|
38
|
+
- [user's notes]
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## 4. Handle uncommitted work
|
|
42
|
+
If there are uncommitted changes:
|
|
43
|
+
- Ask: "Commit as WIP before pausing? (yes/no)"
|
|
44
|
+
- If yes: `make commit m="wip([scope]): pause — [brief description]"`
|
|
45
|
+
- If no: leave changes as-is (warn they may be lost if branch switches)
|
|
46
|
+
|
|
47
|
+
## 5. Confirm
|
|
48
|
+
Report: "Session paused. Handoff saved to `.planning/handoff.md`."
|
|
49
|
+
Report: "Next session: run `/cpw-next-step` — it will detect the handoff and restore context."
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Quick task without full pipeline -- for ad-hoc work that doesn't affect the plan"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
## Arguments
|
|
6
|
+
- No arguments: normal flow (all approvals)
|
|
7
|
+
- `--auto`: skip design approval and scope-creep confirmation. Overrides autoAdvance config.
|
|
8
|
+
|
|
9
|
+
This command is for one-off tasks that do NOT justify the full pipeline.
|
|
10
|
+
Do NOT touch STATUS.md, PLAN.md, or sub-plans. This lives outside the plan.
|
|
11
|
+
|
|
12
|
+
## 0. Check arguments
|
|
13
|
+
If `--auto` is passed, set AUTO=true. Otherwise AUTO=false.
|
|
14
|
+
|
|
15
|
+
## 1. DESCRIBE
|
|
16
|
+
Ask the user for a short description of the task (1-2 sentences).
|
|
17
|
+
|
|
18
|
+
## 2. EVALUATE SIZE
|
|
19
|
+
Before continuing, evaluate whether this is truly quick:
|
|
20
|
+
|
|
21
|
+
Signs that it is NOT quick (recommend /cpw-next-step):
|
|
22
|
+
- Touches more than 3 files
|
|
23
|
+
- Requires changes in src/interfaces/ (needs RFC)
|
|
24
|
+
- Affects more than one module
|
|
25
|
+
- Needs an entry in plans/decisions.md
|
|
26
|
+
- Is a new feature, not a tweak/fix
|
|
27
|
+
|
|
28
|
+
If any apply:
|
|
29
|
+
- If AUTO: show warning but continue anyway
|
|
30
|
+
- If not AUTO: "This seems too large for quick mode. I recommend /cpw-next-step so it goes through the pipeline. Do you want to continue with /cpw-quick anyway?" Only continue if the user confirms.
|
|
31
|
+
|
|
32
|
+
## 3. QUICK DESIGN
|
|
33
|
+
Propose in 3-5 bullets:
|
|
34
|
+
- What will be changed
|
|
35
|
+
- In which files
|
|
36
|
+
- What approach
|
|
37
|
+
|
|
38
|
+
- If AUTO: show the design and proceed immediately
|
|
39
|
+
- If not AUTO: wait for approval. Do NOT do formal design.
|
|
40
|
+
|
|
41
|
+
## 4. IMPLEMENT
|
|
42
|
+
Make the change. During implementation, apply deviation rules:
|
|
43
|
+
- **Auto-fix**: lint/format errors, missing imports, type errors from your changes — fix and continue.
|
|
44
|
+
- **Stop**: if you discover an architectural issue (schema change, interface break, different library needed) — stop and report to the user before continuing.
|
|
45
|
+
- Only fix issues caused by THIS change. Note pre-existing issues but do not fix them.
|
|
46
|
+
|
|
47
|
+
## 5. VERIFY
|
|
48
|
+
- Run `make check` if it exists
|
|
49
|
+
- If there's no make check, run the relevant tests
|
|
50
|
+
- If there are no tests, manually verify it works
|
|
51
|
+
|
|
52
|
+
## 6. SCOPE CHECK
|
|
53
|
+
Before committing, run `git diff --stat` and evaluate the actual changes:
|
|
54
|
+
|
|
55
|
+
- **More than 3 files changed** → warn: "This quick task touched [N] files."
|
|
56
|
+
- **Files in more than 1 module/directory** → warn: "Changes span multiple modules."
|
|
57
|
+
- **Any file in src/interfaces/** → warn: "Interface changes require RFC — this should not be a quick task."
|
|
58
|
+
|
|
59
|
+
If any trigger:
|
|
60
|
+
- If AUTO: show warning but commit anyway
|
|
61
|
+
- If not AUTO:
|
|
62
|
+
```
|
|
63
|
+
⚠ This quick task grew beyond quick scope:
|
|
64
|
+
[list of warnings]
|
|
65
|
+
|
|
66
|
+
Options:
|
|
67
|
+
1. Commit anyway as quick task
|
|
68
|
+
2. Abort — move this work to the pipeline with /cpw-next-step
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
If no triggers: continue to commit.
|
|
72
|
+
|
|
73
|
+
## 7. COMMIT
|
|
74
|
+
`make commit m="quick: [short description]"`
|
|
75
|
+
|
|
76
|
+
## 8. LOG
|
|
77
|
+
Add a line to `.planning/quick/log.md`:
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
| [date] | [description] | [changed files] | [short commit hash] |
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Report: "Quick task completed. If this generated more work, consider adding it to the plan with /cpw-next-step."
|