@claude-pw/framework 0.4.0 → 0.5.1

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.es.md CHANGED
@@ -8,6 +8,20 @@ Workflow estructurado para proyectos con Claude Code.
8
8
 
9
9
  Claude Code es potente pero sin estructura, los proyectos no triviales se vuelven caóticos — sin plan, sin gestión de contexto, sin quality gates, sin continuidad entre sesiones. claude-pw soluciona esto instalando comandos, agentes, reglas y hooks sobre las features nativas de Claude Code. Node.js + markdown, agnóstico al lenguaje.
10
10
 
11
+ ## Instalación
12
+
13
+ Requiere [Node.js](https://nodejs.org/) >= 18 y [Claude Code](https://code.claude.com/docs/en/setup).
14
+
15
+ ```bash
16
+ npm install -g @claude-pw/framework
17
+ ```
18
+
19
+ O ejecuta directamente con npx (sin instalar):
20
+
21
+ ```bash
22
+ npx @claude-pw/framework mi-proyecto
23
+ ```
24
+
11
25
  ## Inicio rápido
12
26
 
13
27
  ### Proyecto nuevo
package/README.ja.md CHANGED
@@ -8,6 +8,20 @@ Claude Code のための構造化プロジェクトワークフロー。
8
8
 
9
9
  Claude Code は強力ですが、構造がなければ非自明なプロジェクトは混沌とします — 計画なし、コンテキスト管理なし、品質ゲートなし、セッション間の継続性なし。claude-pw は Claude Code のネイティブ機能の上にコマンド、エージェント、ルール、フックをインストールすることでこれを解決します。純粋な Node.js + markdown、言語非依存。
10
10
 
11
+ ## インストール
12
+
13
+ [Node.js](https://nodejs.org/) >= 18 と [Claude Code](https://code.claude.com/docs/en/setup) が必要です。
14
+
15
+ ```bash
16
+ npm install -g @claude-pw/framework
17
+ ```
18
+
19
+ または npx で直接実行(インストール不要):
20
+
21
+ ```bash
22
+ npx @claude-pw/framework my-project
23
+ ```
24
+
11
25
  ## クイックスタート
12
26
 
13
27
  ### 新規プロジェクト
package/README.md CHANGED
@@ -8,6 +8,20 @@ Structured Project Workflow for Claude Code.
8
8
 
9
9
  Claude Code is powerful but without structure, non-trivial projects get chaotic — no plan, no context management, no quality gates, no continuity between sessions. claude-pw fixes this by installing commands, agents, rules, and hooks on top of Claude Code's native features. Pure Node.js + markdown, language-agnostic.
10
10
 
11
+ ## Install
12
+
13
+ Requires [Node.js](https://nodejs.org/) >= 18 and [Claude Code](https://code.claude.com/docs/en/setup).
14
+
15
+ ```bash
16
+ npm install -g @claude-pw/framework
17
+ ```
18
+
19
+ Or run directly with npx (no install needed):
20
+
21
+ ```bash
22
+ npx @claude-pw/framework my-project
23
+ ```
24
+
11
25
  ## Quick start
12
26
 
13
27
  ### New project
package/README.pt-br.md CHANGED
@@ -8,6 +8,20 @@ Fluxo de trabalho estruturado para projetos com Claude Code.
8
8
 
9
9
  Claude Code é poderoso, mas sem estrutura, projetos não triviais viram caos — sem plano, sem gestão de contexto, sem portões de qualidade, sem continuidade entre sessões. claude-pw resolve isso instalando comandos, agentes, regras e hooks sobre os recursos nativos do Claude Code. Node.js puro + markdown, agnóstico de linguagem.
10
10
 
11
+ ## Instalação
12
+
13
+ Requer [Node.js](https://nodejs.org/) >= 18 e [Claude Code](https://code.claude.com/docs/en/setup).
14
+
15
+ ```bash
16
+ npm install -g @claude-pw/framework
17
+ ```
18
+
19
+ Ou execute diretamente com npx (sem instalação):
20
+
21
+ ```bash
22
+ npx @claude-pw/framework my-project
23
+ ```
24
+
11
25
  ## Início rápido
12
26
 
13
27
  ### Novo projeto
package/README.zh-cn.md CHANGED
@@ -8,6 +8,20 @@ Claude Code 结构化项目工作流。
8
8
 
9
9
  Claude Code 功能强大,但缺乏结构时,非简单项目会变得混乱——没有计划、没有上下文管理、没有质量门控、会话之间没有连续性。claude-pw 通过在 Claude Code 原生功能(命令、代理、规则、钩子)之上安装结构化工作流来解决这个问题。纯 Node.js + markdown,与编程语言无关。
10
10
 
11
+ ## 安装
12
+
13
+ 需要 [Node.js](https://nodejs.org/) >= 18 和 [Claude Code](https://code.claude.com/docs/en/setup)。
14
+
15
+ ```bash
16
+ npm install -g @claude-pw/framework
17
+ ```
18
+
19
+ 或使用 npx 直接运行(无需安装):
20
+
21
+ ```bash
22
+ npx @claude-pw/framework my-project
23
+ ```
24
+
11
25
  ## 快速开始
12
26
 
13
27
  ### 新项目
package/install.js CHANGED
@@ -15,7 +15,7 @@ const path = require('path');
15
15
  const readline = require('readline');
16
16
  const { execSync } = require('child_process');
17
17
 
18
- const VERSION = '0.3.0';
18
+ const VERSION = require('./package.json').version;
19
19
 
20
20
  // --- Colors ---
21
21
  const c = {
@@ -290,14 +290,18 @@ async function main() {
290
290
  let projectName = '';
291
291
 
292
292
  // Parse arguments
293
- for (const arg of args) {
293
+ let extractDir = null;
294
+ for (let i = 0; i < args.length; i++) {
295
+ const arg = args[i];
294
296
  if (arg === '--update') updateOnly = true;
297
+ else if (arg === '--extract') { extractDir = args[++i]; }
295
298
  else if (arg === '--version') { console.log(`claude-pw ${VERSION}`); process.exit(0); }
296
299
  else if (arg === '--help' || arg === '-h') {
297
300
  console.log('claude-pw — Structured Project Workflow for Claude Code\n');
298
301
  console.log('Usage:');
299
302
  console.log(' claude-pw [project-name] Create new project');
300
303
  console.log(' claude-pw --update Update .claude/ in existing project');
304
+ console.log(' claude-pw --extract <dir> Extract templates to directory (for /cpw-update)');
301
305
  console.log(' claude-pw --version Show version');
302
306
  process.exit(0);
303
307
  } else if (arg.startsWith('-')) {
@@ -318,6 +322,23 @@ async function main() {
318
322
 
319
323
  const date = new Date().toISOString().slice(0, 10);
320
324
 
325
+ // ============================================================
326
+ // EXTRACT MODE (for /cpw-update command)
327
+ // ============================================================
328
+ if (extractDir) {
329
+ if (!extractDir || typeof extractDir !== 'string') {
330
+ error('Usage: --extract <directory>');
331
+ process.exit(1);
332
+ }
333
+ fs.cpSync(templatesDir, extractDir, { recursive: true });
334
+ const releasesFile = path.join(scriptDir, 'RELEASES.md');
335
+ if (fs.existsSync(releasesFile)) {
336
+ fs.copyFileSync(releasesFile, path.join(extractDir, 'RELEASES.md'));
337
+ }
338
+ fs.writeFileSync(path.join(extractDir, '.version'), VERSION);
339
+ process.exit(0);
340
+ }
341
+
321
342
  // ============================================================
322
343
  // UPDATE MODE
323
344
  // ============================================================
@@ -372,15 +393,23 @@ async function main() {
372
393
  console.log(' settings.json (merge, custom hooks preserved)');
373
394
  console.log(' config.json (merge new fields)');
374
395
  if (allModified.length > 0) {
375
- console.log(`\n ${c.yellow('Modified by you (will be overwritten):')}`);
396
+ console.log(`\n ${c.yellow('Modified (differs from new version):')}`);
376
397
  for (const f of allModified) console.log(` ${f}`);
398
+ console.log(`\n For intelligent merge of modified files, use ${c.bold('/cpw-update')} inside Claude instead.`);
377
399
  }
378
400
  console.log(`\n Backup: .claude.backup.* (created before changes)\n`);
379
401
 
380
- const confirm = await askQuestion('Apply? [y/N]: ');
381
- if (!/^[yYsS]$/.test(confirm)) {
382
- info('Cancelled.');
383
- process.exit(0);
402
+ const confirm = await askQuestion(`${allModified.length > 0 ? 'Replace all (r) / Cancel (c): ' : 'Apply? [y/N]: '}`);
403
+ if (allModified.length > 0) {
404
+ if (!/^[rR]$/.test(confirm)) {
405
+ info('Cancelled. Use /cpw-update inside Claude for merge support.');
406
+ process.exit(0);
407
+ }
408
+ } else {
409
+ if (!/^[yYsS]$/.test(confirm)) {
410
+ info('Cancelled.');
411
+ process.exit(0);
412
+ }
384
413
  }
385
414
 
386
415
  // Backup
@@ -517,7 +546,12 @@ async function main() {
517
546
 
518
547
  // Root files with template variable substitution
519
548
  const vars = { PROJECT_NAME: projectName, DATE: date };
520
- if (!fs.existsSync('CLAUDE.md')) copyTemplate(path.join(templatesDir, 'CLAUDE.md.tpl'), 'CLAUDE.md', vars);
549
+ if (fs.existsSync('CLAUDE.md')) {
550
+ const backupName = `CLAUDE.md.user-backup`;
551
+ fs.copyFileSync('CLAUDE.md', backupName);
552
+ info(`CLAUDE.md existente respaldado en ${backupName}`);
553
+ }
554
+ copyTemplate(path.join(templatesDir, 'CLAUDE.md.tpl'), 'CLAUDE.md', vars);
521
555
  if (!fs.existsSync('PLAN.md')) copyTemplate(path.join(templatesDir, 'PLAN.md.tpl'), 'PLAN.md', vars);
522
556
  if (!fs.existsSync('STATUS.md')) copyTemplate(path.join(templatesDir, 'STATUS.md.tpl'), 'STATUS.md', vars);
523
557
  copyIfMissing(path.join(templatesDir, 'CHANGELOG.md'), 'CHANGELOG.md');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claude-pw/framework",
3
- "version": "0.4.0",
3
+ "version": "0.5.1",
4
4
  "description": "Structured Project Workflow for Claude Code — adaptive pipeline, context management, quality gates",
5
5
  "bin": {
6
6
  "claude-pw": "./install.js"
@@ -1,5 +1,7 @@
1
1
  # {{PROJECT_NAME}}
2
2
 
3
+ > If `CLAUDE.md.user-backup` exists, it contains your original CLAUDE.md. Review it during `/cpw-startup` and merge any project-specific instructions into this file.
4
+
3
5
  ## Stack
4
6
  TODO: Phase 0
5
7
 
@@ -30,6 +30,17 @@ Use the exact section headers above — the startup command parses them by name.
30
30
  ## Project Context
31
31
  After mandatory read, check `.claude/skills/` and `.claude/rules/` — include discovered skills and rules in your Conventions section.
32
32
 
33
+ ## Tool Strategy
34
+
35
+ | Priority | Tool | Use for |
36
+ |----------|------|---------|
37
+ | 1st | Glob | File discovery — map structure before reading |
38
+ | 2nd | Grep | Pattern detection — imports, configs, conventions |
39
+ | 3rd | Read | Representative files — 1-2 per module, not everything |
40
+ | 4th | Bash | Dependency analysis — `ls`, `wc`, lockfile parsing |
41
+
42
+ Scan wide, read selectively. Do NOT read every file — use Glob/Grep to identify what matters, then Read only representative samples.
43
+
33
44
  ## Analysis to perform
34
45
 
35
46
  ### 1. Stack detection
@@ -32,6 +32,16 @@ Your summary report (not the file) is what the command sees immediately. Make th
32
32
  ## Project Context
33
33
  After mandatory read, check `.claude/skills/` for existing project knowledge on the research topic. Avoid recommending solutions that contradict learned skills.
34
34
 
35
+ ## Tool Strategy
36
+
37
+ | Priority | Tool | Use for | Trust |
38
+ |----------|------|---------|-------|
39
+ | 1st | WebFetch | Official docs, READMEs, changelogs (when you have the URL) | High |
40
+ | 2nd | WebSearch | Ecosystem discovery, community patterns, comparisons | Verify first |
41
+ | 3rd | Read + Grep | Existing project code for patterns and prior decisions | High |
42
+
43
+ **Verification protocol:** If a finding comes only from WebSearch, verify against official docs (WebFetch) before recommending. Mark unverified claims as "LOW confidence" in your output. Training data is 6-18 months stale — prefer live sources.
44
+
35
45
  ## Types of research
36
46
 
37
47
  ### 1. Libraries/frameworks (BUILD-OR-BUY)
@@ -24,6 +24,16 @@ Answer with a clear viable/not-viable verdict. If viable, include the suggested
24
24
  ## Project Context
25
25
  After mandatory read, check `.claude/skills/` for existing knowledge about the topic — someone may have already explored this.
26
26
 
27
+ ## Tool Strategy
28
+
29
+ | Priority | Tool | Use for | Trust |
30
+ |----------|------|---------|-------|
31
+ | 1st | Read + Grep | Check existing code and prior research (docs/research/) | High |
32
+ | 2nd | WebSearch | Find examples, docs, known issues | Verify first |
33
+ | 3rd | Bash (in /tmp) | Test viability with disposable POC | High (empirical) |
34
+
35
+ Prefer empirical evidence (run it) over theoretical research (read about it). If you can test it in /tmp in under 5 minutes, test it.
36
+
27
37
  1. Investigate: docs, existing code, libs
28
38
  2. If you need to try something, do it in /tmp (disposable POC)
29
39
  3. Answer the question concretely
@@ -60,7 +60,12 @@ The agent:
60
60
  - If "yes": implement the fix, run tests, commit
61
61
  - Run skill extraction check (see below)
62
62
  - Move session to `.planning/debug/resolved/[date]-[title-slug].md`
63
- - Report: "Bug resolved. Fix applied and committed."
63
+ - Report:
64
+ ```
65
+ Bug resolved. Fix applied and committed.
66
+
67
+ Next: `/cpw-next-step` to continue where you left off.
68
+ ```
64
69
 
65
70
  ### Skill extraction check
66
71
  After confirming the debug conclusion, run these 5 questions internally:
@@ -107,7 +112,12 @@ If no self-check triggers or gates don't pass: continue normally.
107
112
  - If attempts remain:
108
113
  "Attempt [N]/[max]. Eliminated causes: [list]. Do you want to continue? (yes/no/increase limit)"
109
114
  - If the limit is reached:
110
- "All [max] attempts exhausted. Options: (a) increase limit, (b) escalate to /cpw-impact, (c) close as unresolved."
115
+ ```
116
+ All [max] attempts exhausted.
117
+
118
+ Recommended: close as unresolved and continue with `/cpw-next-step`.
119
+ Alternatives: (a) increase limit (b) escalate to /cpw-impact
120
+ ```
111
121
 
112
122
  ## 5. BETWEEN SESSIONS
113
123
  When the user returns (new /cpw-debug or /cpw-next-step that detects an active session):
@@ -65,3 +65,10 @@ The agent checks:
65
65
 
66
66
  If the agent reports "ok": include in diagnostic as passed.
67
67
  If problems found: include in diagnostic with the agent's report.
68
+
69
+ ## 5. REPORT
70
+
71
+ After all checks complete, present the full diagnostic and guide next steps:
72
+ - If everything passed: "Project healthy. Continue with `/cpw-next-step`."
73
+ - If repairs were applied: "Repairs applied. Run `/cpw-health` again to verify, or continue with `/cpw-next-step`."
74
+ - If issues remain unresolved: "Unresolved issues listed above. Fix them manually, then run `/cpw-next-step`."
@@ -2,6 +2,10 @@
2
2
  description: "Load context and execute the next pipeline stage"
3
3
  ---
4
4
 
5
+ ## Arguments
6
+ - No arguments: normal flow (respects `autoAdvance` from config)
7
+ - `--phase`: auto-advance all steps in the current phase, pause at UAT. Overrides `autoAdvance` to `auto` for this invocation only. Does NOT cross to next phase.
8
+
5
9
  ## 0. Health check (session start)
6
10
 
7
11
  ### Handoff detection
@@ -25,19 +29,49 @@ Delegate to the session-recovery agent in CHECK mode:
25
29
  - If INCONSISTENT: show diagnostic. Do NOT continue without user decision.
26
30
 
27
31
  ## 1. Load context
32
+
33
+ If STATUS.md does not exist:
34
+ - Report:
35
+ ```
36
+ No STATUS.md found — this project hasn't been initialized yet.
37
+
38
+ Next: run `/cpw-startup` to set up the project.
39
+ ```
40
+ - STOP. Do not continue.
41
+
28
42
  - Read STATUS.md -> phase, step, stage
29
43
  - Read indicated sub-plan (plans/phase-N.md)
44
+ - If the file does not exist: report "Sub-plan plans/phase-N.md not found. STATUS.md may be pointing to a non-existent phase. Run `/cpw-health` to diagnose." STOP.
30
45
  - If `plans/phase-N-context.md` exists (from /cpw-discuss), load it too
31
46
  - Load ONLY files in "Required context" — nothing else
32
47
  - Read `.planning/config.json` -> autoAdvance (off | auto | yolo)
33
48
 
34
49
  If stage = CORRECTION:
35
50
  - 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
51
+ - Read "Correction attempts" from session notes (default: 0)
52
+ - Show the list to the user. For each correction, offer:
53
+ - **Fix** resolve the correction now
54
+ - **Defer** move to next phase as a known issue (logged in plans/decisions.md)
55
+ - **Skip** not applicable, remove with justification
56
+
57
+ - After processing all corrections (fixed, deferred, or skipped):
58
+ - If any were fixed: `make commit m="fix(phase-N): validator corrections"`
59
+ - If any were deferred: add to plans/decisions.md as "Deferred from Phase N validation: [description]"
60
+ - Increment "Correction attempts" in STATUS.md session notes
61
+
62
+ - If correction attempts >= 2 AND there are still unfixed corrections:
63
+ ```
64
+ Phase N has been through 2 correction rounds with remaining issues.
65
+
66
+ Options:
67
+ 1. Fix remaining corrections (one more round)
68
+ 2. Defer all remaining to next phase and advance
69
+ 3. Run /cpw-health for a full diagnostic
70
+ ```
71
+
72
+ - If all corrections are fixed or deferred:
73
+ - Re-run phase validation (step 3) — but ONLY for fixed items
74
+ - Deferred items do NOT block phase advancement
41
75
 
42
76
  ## 1.4 Branch creation (only at phase start, non-trunk strategies)
43
77
 
@@ -239,7 +273,7 @@ Then execute the current stage (check docs/tooling.md for tools mapped to this s
239
273
  Max retries: [from `maxConsecutiveFailures` in config, default: 3]
240
274
  Wait for the agent's structured report.
241
275
  - If SUCCESS → proceed to ACCEPTANCE with the report as summary
242
- - If PARTIAL → present partial results to user. Options: continue to ACCEPTANCE / retry / abort
276
+ - If PARTIAL → if autoAdvance is auto/yolo or `--phase`: retry automatically (up to max retries). Otherwise: present partial results to user. Options: continue to ACCEPTANCE / retry / abort
243
277
  - If FAILED → present failure details. Options: retry with modified design / abort step
244
278
  - Deviations field → included in ACCEPTANCE summary for reviewer visibility
245
279
  - **TEST:** The implementer already ran tests. Review its test report.
@@ -290,7 +324,7 @@ If no self-check triggers or gates don't pass: continue normally.
290
324
  ### Auto-reflect check (CLOSE sub-step 5)
291
325
  Read `autoReflect` from `.planning/config.json` (default: "remind").
292
326
  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)
327
+ - Run a lightweight reflection: semantic validation classify each entry with learning-extractor apply approved changes → cleanup queue (skip history scan, skip user presentation for confidence ≥ 0.80, skip dedup)
294
328
  - Auto-approve entries with confidence ≥ 0.80
295
329
  - Present entries with confidence < 0.80 for manual approval
296
330
  - `make commit m="learn: auto-reflect session learnings"`
@@ -300,7 +334,8 @@ Update STATUS.md with the new stage when finished.
300
334
 
301
335
  ## 2. Advance based on mode
302
336
 
303
- Read `autoAdvance` from `.planning/config.json` (default: "off").
337
+ If `--phase` flag was passed, set effective autoAdvance = "auto" for this invocation.
338
+ Otherwise, read `autoAdvance` from `.planning/config.json` (default: "off").
304
339
  Read `maxConsecutiveFailures` from config (default: 3 for auto, 5 for yolo).
305
340
 
306
341
  ### off (default)
@@ -329,7 +364,13 @@ In yolo mode, Claude designs, implements, tests, closes, validates phases, and a
329
364
  - Commit messages are auto-generated in auto and yolo (no pause)
330
365
  - Phase validation always runs automatically when last step completes
331
366
  - 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
367
+ - `--phase` flag: ALWAYS stop between phases, regardless of effective autoAdvance. Report:
368
+ ```
369
+ Phase N complete. UAT next.
370
+
371
+ Next: continue with `/cpw-next-step` for UAT.
372
+ ```
373
+ - If context fills up (3+ auto-advanced steps), suggest /clear and re-invoke /cpw-next-step (add `--phase` if it was active)
333
374
 
334
375
  ## 3. Phase validation (auto-triggered when all steps are done)
335
376
 
@@ -376,6 +417,7 @@ Wait for its complete report.
376
417
  ## Session notes
377
418
  - Phase-validator found [X] corrections
378
419
  ```
420
+ - If there are deferred corrections from a previous round, do NOT re-add them — they are already in plans/decisions.md
379
421
  - Report: "Phase N has pending corrections. Run /cpw-next-step to resolve them."
380
422
  - STOP here. The next /cpw-next-step invocation will detect stage = CORRECTION and handle fixes, then re-run phase validation.
381
423
 
@@ -80,4 +80,9 @@ Add a line to `.planning/quick/log.md`:
80
80
  | [date] | [description] | [changed files] | [short commit hash] |
81
81
  ```
82
82
 
83
- Report: "Quick task completed. If this generated more work, consider adding it to the plan with /cpw-next-step."
83
+ Report:
84
+ ```
85
+ Quick task completed.
86
+
87
+ Next: `/cpw-next-step` to continue with the plan.
88
+ ```
@@ -158,6 +158,8 @@ Move processed entries to `.planning/learnings/applied.md` with this format:
158
158
  ```
159
159
  Remove processed entries from queue.md.
160
160
 
161
+ Report: "Learnings applied. Continue with `/cpw-next-step`."
162
+
161
163
  ## 6. Deduplication (only with --dedupe)
162
164
 
163
165
  ### 6.1 Load destinations
@@ -207,3 +209,5 @@ Unique entries: N (no changes needed)
207
209
  - For each similar group: ask whether to apply the consolidated version
208
210
  - Apply approved changes with Edit
209
211
  - `make commit m="learn: deduplicate learnings"`
212
+
213
+ Report: "Deduplication complete. Continue with `/cpw-next-step`."
@@ -267,12 +267,20 @@ Save responses in `.planning/config.json`:
267
267
  "modelProfile": "quality|balanced|budget",
268
268
  "modelOverrides": {},
269
269
  "gitStrategy": "trunk-based|feature-branch|gitflow",
270
- "commitPlanning": false
270
+ "commitPlanning": false,
271
+ "toolingSources": ["skills.sh", "claude-code-templates"],
272
+ "maxConsecutiveFailures": 3,
273
+ "autoReflect": "remind"
271
274
  }
272
275
  ```
273
276
 
274
277
  If the user has no preference, use defaults (off/standard/balanced/no).
275
278
 
279
+ Advanced settings (not asked during interview — edit `.planning/config.json` directly):
280
+ - `toolingSources`: where to search for skills/MCPs during tooling audit (default: `["skills.sh", "claude-code-templates"]`)
281
+ - `maxConsecutiveFailures`: halt auto-advance after N failures in same stage (default: 3 for auto, 5 for yolo)
282
+ - `autoReflect`: process learning queue automatically (`off` / `remind` / `auto`, default: `remind`)
283
+
276
284
  **If `commitPlanning: true`:**
277
285
  - Remove `.planning/` from `.gitignore`
278
286
  - Planning artifacts (config, learnings, decisions, debug sessions) will be tracked in git
@@ -314,8 +322,14 @@ Present the plan phase by phase for review:
314
322
 
315
323
  ## 6. COMMIT AND START
316
324
  - `make commit m="chore: initial plan from startup ([mode])"`
317
- - Report: "Plan generated. Run `/clear` first to reset context, then:"
318
- - " 1. `/cpw-discuss` — clarify ambiguities before building (recommended)"
319
- - " 2. `/cpw-todos` — review pending todos before starting"
320
- - " 3. `/cpw-next-step` — start Phase 0 directly"
321
325
  - IMPORTANT: startup fills the context window significantly. Always recommend `/clear` before continuing.
326
+ - Report:
327
+ ```
328
+ Plan generated and committed.
329
+
330
+ Next: run `/clear`, then `/cpw-next-step`
331
+
332
+ Optional before starting:
333
+ /cpw-discuss — clarify ambiguities for the current phase
334
+ /cpw-todos — review pending todos
335
+ ```
@@ -45,7 +45,7 @@ Append to `.planning/quick/log.md`:
45
45
  ```
46
46
 
47
47
  ### 5. Confirm and continue
48
- Report: "Captured: [description]. Continue with current work."
48
+ Report: "Captured: [description]. Continue with `/cpw-next-step`."
49
49
  Do NOT change context, read additional files, or start working on the todo.
50
50
 
51
51
  ---
@@ -98,3 +98,6 @@ Actions:
98
98
 
99
99
  ### Action d: Back to list
100
100
  - Return to step 2
101
+
102
+ When the user is done reviewing (no more selections or says "done"):
103
+ Report: "Todo review complete. Continue with `/cpw-next-step`."
@@ -0,0 +1,119 @@
1
+ ---
2
+ description: "Update claude-pw framework — diff, merge, apply intelligently"
3
+ ---
4
+
5
+ ## 1. Check version
6
+
7
+ ```bash
8
+ INSTALLED=$(cat .claude/.claude-pw-version 2>/dev/null || echo "0.0.0")
9
+ AVAILABLE=$(npx @claude-pw/framework --version 2>/dev/null)
10
+ ```
11
+
12
+ If same version: "Already up to date at v${INSTALLED}." STOP.
13
+ If different: show "Update available: v${INSTALLED} → v${AVAILABLE}"
14
+
15
+ ## 2. Extract new templates
16
+
17
+ ```bash
18
+ rm -rf /tmp/cpw-update
19
+ npx @claude-pw/framework --extract /tmp/cpw-update
20
+ ```
21
+
22
+ Read `/tmp/cpw-update/RELEASES.md` and show changelog entries between installed and available versions.
23
+
24
+ ## 3. Diff files
25
+
26
+ Compare each file in these categories:
27
+
28
+ | Category | Project path | Template path |
29
+ |----------|-------------|---------------|
30
+ | Commands | `.claude/commands/*.md` | `/tmp/cpw-update/claude/commands/*.md` |
31
+ | Agents | `.claude/agents/*.md` | `/tmp/cpw-update/claude/agents/*.md` |
32
+ | Rules | `.claude/rules/*.md` | `/tmp/cpw-update/claude/rules/*.md` |
33
+ | Hooks | `.claude/hooks/*.js` | `/tmp/cpw-update/claude/hooks/*.js` |
34
+ | Settings | `.claude/settings.json` | `/tmp/cpw-update/claude/settings.json` |
35
+ | Config | `.planning/config.json` | `/tmp/cpw-update/planning/config.json` |
36
+
37
+ For each file, classify:
38
+ - **NEW** — in template only → will be added
39
+ - **UNCHANGED** — identical content → skip
40
+ - **UPDATED** — template changed, user didn't modify → safe overwrite
41
+ - **CONFLICT** — both changed → needs merge
42
+ - **CUSTOM** — in project only → preserve (user's own file)
43
+
44
+ Heuristic for UPDATED vs CONFLICT: if project file differs from new template AND contains sections/lines not present in the new template, it's a CONFLICT. If the new template is a strict superset of the project file (only additions), it's UPDATED.
45
+
46
+ ## 4. Present summary
47
+
48
+ ```
49
+ Update: v{INSTALLED} → v{AVAILABLE}
50
+
51
+ Commands:
52
+ UPDATED cpw-next-step.md (+25 lines)
53
+ UNCHANGED cpw-startup.md
54
+ NEW cpw-new-command.md
55
+ ...
56
+
57
+ Agents:
58
+ UPDATED implementer.md (+20 lines)
59
+ CONFLICT researcher.md — you added custom content
60
+ CUSTOM my-agent.md — your file, preserved
61
+ ...
62
+
63
+ Config:
64
+ NEW FIELDS [list of new fields with defaults]
65
+
66
+ Apply? (all / review conflicts first / cancel)
67
+ ```
68
+
69
+ ## 5. Apply changes
70
+
71
+ ### NEW and UPDATED files:
72
+ Copy from `/tmp/cpw-update/` to project. Overwrite safely.
73
+
74
+ ### CONFLICT files:
75
+ For each conflicted file:
76
+ 1. Read user's version (project file)
77
+ 2. Read new template version (`/tmp/cpw-update/`)
78
+ 3. Identify user's custom additions (sections, rules, modifications not in template)
79
+ 4. Merge: start with new template, re-add user's custom sections at appropriate locations
80
+ 5. Show the merged result to user: "Here's the merged version of [file]. OK? (yes / edit / skip)"
81
+ 6. If skip: keep user's version unchanged
82
+
83
+ ### settings.json:
84
+ Merge: add new hooks from template, preserve user's custom hooks. Do NOT overwrite existing hooks.
85
+
86
+ ### config.json:
87
+ Add new fields with defaults. Do NOT overwrite user's existing values.
88
+
89
+ ### CUSTOM files:
90
+ Never touch. Report: "[file] is your custom file — preserved."
91
+
92
+ ## 6. Finalize
93
+
94
+ Update version:
95
+ ```bash
96
+ echo "{AVAILABLE}" > .claude/.claude-pw-version
97
+ ```
98
+
99
+ Clean up:
100
+ ```bash
101
+ rm -rf /tmp/cpw-update
102
+ ```
103
+
104
+ Commit:
105
+ `make commit m="chore: update claude-pw to v{AVAILABLE}"`
106
+
107
+ Report:
108
+ ```
109
+ Updated to v{AVAILABLE}.
110
+
111
+ Next: `/cpw-next-step` to continue with the plan.
112
+ ```
113
+
114
+ ## Rollback
115
+
116
+ If the user reports issues after update:
117
+ - Previous state is in git history: `git diff HEAD~1 -- .claude/`
118
+ - Revert: `git checkout HEAD~1 -- .claude/`
119
+ - Or selectively: `git checkout HEAD~1 -- .claude/agents/researcher.md`