@claude-pw/framework 0.9.1 → 0.11.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/RELEASES.md CHANGED
@@ -2,6 +2,27 @@
2
2
 
3
3
  Formato: [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
4
4
 
5
+ ## [0.11.0] - 2026-03-15
6
+
7
+ ### Changed
8
+ - Plan completion is now a clean cycle: last phase → auto-delegates to `/cpw-cleanup --complete`
9
+ - `/cpw-cleanup --complete` mode: generates plan summary, reviews docs, archives ALL phases, resets execution state, deletes STATUS.md
10
+ - `/cpw-startup` new cycle detection simplified: PLAN.md + config.json exist, STATUS.md absent
11
+ - `/cpw-next-step` slimmed down — completion logic moved to cleanup (net -110 lines)
12
+ - Workflow is now fully cyclical: startup → next-step (loop) → cleanup --complete → startup
13
+
14
+ ## [0.10.0] - 2026-03-15
15
+
16
+ ### Added
17
+ - Plan completion lifecycle: summary generation (plan-summary.md), docs evolution review, DONE state in STATUS.md
18
+ - Robust new cycle detection in `/cpw-startup`: 3 signals (STATUS.md DONE, PLAN.md all-done, PLAN.md all-archived)
19
+ - Context loading before new cycle interview: loads architecture, interfaces, decisions, prior summary
20
+ - Plan summary preserved across cycles (renamed to plan-summary-[date].md)
21
+
22
+ ### Fixed
23
+ - `/cpw-next-step` no longer creates dead-end STATUS.md pointing to non-existent phase after last phase completes
24
+ - `/cpw-cleanup` edge cases: empty results after filtering, commit skip when only .planning/ modified, dynamic commit messages
25
+
5
26
  ## [0.9.0] - 2026-03-15
6
27
 
7
28
  ### Added
package/install.js CHANGED
@@ -547,6 +547,7 @@ async function main() {
547
547
  copyIfMissing(path.join(templatesDir, 'planning', 'learnings', 'queue.md'), path.join('.planning', 'learnings', 'queue.md'));
548
548
  copyIfMissing(path.join(templatesDir, 'planning', 'learnings', 'applied.md'), path.join('.planning', 'learnings', 'applied.md'));
549
549
  copyIfMissing(path.join(templatesDir, 'planning', 'config.json'), path.join('.planning', 'config.json'));
550
+ copyIfMissing(path.join(templatesDir, 'planning', 'plan-summary.md'), path.join('.planning', 'plan-summary.md'));
550
551
 
551
552
  // Root files with template variable substitution
552
553
  const vars = { PROJECT_NAME: projectName, DATE: date };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claude-pw/framework",
3
- "version": "0.9.1",
3
+ "version": "0.11.0",
4
4
  "description": "Structured Project Workflow for Claude Code — adaptive pipeline, context management, quality gates",
5
5
  "bin": {
6
6
  "claude-pw": "./install.js"
@@ -5,8 +5,123 @@ description: "Archive completed phases and clean accumulated state"
5
5
  ## Arguments
6
6
  - No arguments: dry-run (show what would be cleaned, ask for confirmation)
7
7
  - `--execute`: skip confirmation, execute immediately
8
+ - `--complete`: full plan completion cycle (summary, docs review, archive ALL, reset state). Auto-triggered by `/cpw-next-step` when the last phase completes. Can also be run manually.
8
9
 
9
- ## 0. Load state
10
+ ---
11
+
12
+ ## --complete mode (plan completion cycle)
13
+
14
+ If `--complete` is passed, execute the full completion cycle. This mode is designed to
15
+ close a finished plan, archive everything, and leave the project ready for `/cpw-startup`.
16
+
17
+ ### 1. Plan completion summary
18
+ Generate `.planning/plan-summary.md`:
19
+ - Read all phase sub-plans (plans/phase-N.md for each phase in PLAN.md)
20
+ - Read plans/decisions.md
21
+ - For each phase, extract: name, step count, Objective line
22
+ - From decisions.md, extract decisions made during these phases
23
+ - Get date range from git: first plan commit and today
24
+
25
+ Write `.planning/plan-summary.md`:
26
+ ```markdown
27
+ # Plan Summary
28
+
29
+ ## Completed
30
+ - **Date**: [today]
31
+ - **Phases**: [N]
32
+ - **Steps**: [total across all phases]
33
+
34
+ ## Phases
35
+ | # | Phase | Steps | Key output |
36
+ |---|-------|-------|------------|
37
+ | 0 | Stack and Scaffolding | 6 | Project setup, toolchain, CI |
38
+ | 1 | Interfaces | 5 | Module contracts, type system |
39
+ | ... | ... | ... | ... |
40
+
41
+ ## Key decisions
42
+ - Phase N: [decision summary from decisions.md]
43
+ - ...
44
+
45
+ ## Key deliverables
46
+ - [extracted from each phase's Objective]
47
+ - ...
48
+ ```
49
+
50
+ If a previous `.planning/plan-summary.md` exists (from a prior cycle), rename it
51
+ to `.planning/plan-summary-[date].md` before writing the new one.
52
+
53
+ ### 2. Docs evolution review
54
+ Review if docs/ need updating after the full plan:
55
+ - Read `docs/architecture.md` — does it reflect what was actually built?
56
+ Compare with the plan phases and deliverables. If outdated, update it.
57
+ - Read `docs/interfaces.md` — are interfaces current with the final state of `src/interfaces/`?
58
+ If outdated, update it.
59
+ - If any docs were updated:
60
+ `make commit m="docs: update architecture and interfaces after plan completion"`
61
+
62
+ This is a lightweight pass to catch drift — not a full rewrite.
63
+
64
+ ### 3. Archive ALL phase files
65
+ ```bash
66
+ mkdir -p .planning/archive
67
+ ```
68
+ For every phase in PLAN.md (regardless of `archiveCompletedPhases` config — in --complete mode, everything gets archived):
69
+ - Move `plans/phase-N.md` to `.planning/archive/phase-N.md`
70
+ - Move `plans/phase-N-context.md` to `.planning/archive/phase-N-context.md` (if exists)
71
+
72
+ Update PLAN.md: sub-plan column → `(archived)` for all phases.
73
+
74
+ ### 4. Reset execution state
75
+ Clean all execution artifacts. These served the current plan cycle and are not needed for the next:
76
+ - **Delete** `STATUS.md` (session pointer — no longer needed)
77
+ - **Reset** `.planning/quick/log.md` to empty table header only
78
+ - **Delete** all files in `.planning/debug/resolved/`
79
+ - **Delete** `.planning/debug/active-session.md` (if exists)
80
+ - **Reset** `.planning/learnings/queue.md` to empty
81
+ - **Reset** `.planning/learnings/applied.md` to empty (already applied to rules/skills)
82
+ - **Delete** `.planning/handoff.md` (if exists)
83
+ - **Delete** `.planning/uat.md` (if exists)
84
+
85
+ Do NOT touch (project context that survives between cycles):
86
+ - `plans/decisions.md` — cumulative project history
87
+ - `docs/*` — project documentation (just reviewed in step 2)
88
+ - `.planning/config.json` — workflow settings carry over
89
+ - `.planning/plan-summary.md` — just generated in step 1
90
+ - `PLAN.md` — updated with (archived) markers
91
+ - `CLAUDE.md` — project instructions
92
+ - `.claude/skills/*` — extracted knowledge
93
+ - `.claude/rules/*` — project rules
94
+ - All source code, tests, Makefile, etc.
95
+
96
+ ### 5. Commit
97
+ `make commit m="chore: plan complete — archived [N] phases, reset execution state"`
98
+
99
+ ### 6. Report
100
+ ```
101
+ ══════════════════════════════════════
102
+ PLAN COMPLETE
103
+ ══════════════════════════════════════
104
+ All [N] phases finished.
105
+ Summary: .planning/plan-summary.md
106
+
107
+ Archived: [N] phase files → .planning/archive/
108
+ Cleaned: STATUS.md, quick log, debug sessions, learnings
109
+
110
+ Project is ready for the next development cycle.
111
+ Run /cpw-startup to begin.
112
+ ══════════════════════════════════════
113
+ ```
114
+
115
+ STOP.
116
+
117
+ ---
118
+
119
+ ## Standard mode (mid-plan cleanup)
120
+
121
+ If `--complete` is NOT passed, run the standard cleanup flow below.
122
+ This is for archiving completed phases while the plan is still in progress.
123
+
124
+ ### 0. Load state
10
125
 
11
126
  Read `.planning/config.json` -> extract `cleanupPolicy` (use defaults if missing):
12
127
  - `archiveCompletedPhases`: true
@@ -23,9 +138,9 @@ Nothing to clean up. All phases are current or pending.
23
138
  ```
24
139
  STOP.
25
140
 
26
- ## 1. Identify what to clean
141
+ ### 1. Identify what to clean
27
142
 
28
- ### 1.1 Completed phase files
143
+ #### 1.1 Completed phase files
29
144
  If `archiveCompletedPhases` is true:
30
145
  For each phase with Status "done" in PLAN.md:
31
146
  - Check if `plans/phase-N.md` still exists (not already archived)
@@ -33,26 +148,26 @@ For each phase with Status "done" in PLAN.md:
33
148
  - Add to archive list
34
149
  - NEVER archive the current phase or pending phases
35
150
 
36
- ### 1.2 Quick log done entries
151
+ #### 1.2 Quick log done entries
37
152
  Read `.planning/quick/log.md` (if exists):
38
153
  - Count entries with Status: done or dismissed
39
154
  - If count > `keepQuickLogDone`: mark oldest excess entries for removal
40
155
 
41
- ### 1.3 Resolved debug sessions
156
+ #### 1.3 Resolved debug sessions
42
157
  List `.planning/debug/resolved/` (if exists):
43
158
  - Count files
44
159
  - If count > `keepResolvedDebug`: mark oldest files for deletion (by filename date prefix)
45
160
 
46
- ### 1.4 Applied learnings
161
+ #### 1.4 Applied learnings
47
162
  Read `.planning/learnings/applied.md` (if exists):
48
163
  - Count entries (each entry starts with `---`)
49
164
  - If count > `keepAppliedLearnings`: mark oldest excess entries for trimming
50
165
 
51
- ### 1.5 Stale files
166
+ #### 1.5 Stale files
52
167
  - `.planning/handoff.md` — if it exists AND STATUS.md does NOT show a handoff in progress
53
168
  - `.planning/uat.md` — if it exists AND all phases it references are done (no active UAT)
54
169
 
55
- ## 2. Present cleanup plan
170
+ ### 2. Present cleanup plan
56
171
 
57
172
  ```
58
173
  Cleanup Summary:
@@ -87,9 +202,9 @@ STOP.
87
202
  If `--execute`: show the summary and proceed to step 3.
88
203
  Otherwise: ask "Proceed? (yes/no)". If no: STOP.
89
204
 
90
- ## 3. Execute
205
+ ### 3. Execute
91
206
 
92
- ### 3.1 Archive phase files
207
+ #### 3.1 Archive phase files
93
208
  ```bash
94
209
  mkdir -p .planning/archive
95
210
  ```
@@ -97,7 +212,7 @@ For each phase in the archive list:
97
212
  - Move `plans/phase-N.md` to `.planning/archive/phase-N.md`
98
213
  - Move `plans/phase-N-context.md` to `.planning/archive/phase-N-context.md` (if exists)
99
214
 
100
- ### 3.2 Update PLAN.md
215
+ #### 3.2 Update PLAN.md
101
216
  For each archived phase, change the sub-plan column from `plans/phase-N.md` to `(archived)`:
102
217
  ```
103
218
  | 0 | Stack and Scaffolding | plans/phase-0.md | done |
@@ -107,22 +222,22 @@ becomes:
107
222
  | 0 | Stack and Scaffolding | (archived) | done |
108
223
  ```
109
224
 
110
- ### 3.3 Trim quick log
225
+ #### 3.3 Trim quick log
111
226
  Remove done/dismissed entries beyond the keep limit from `.planning/quick/log.md`.
112
227
  Keep the most recent N entries (by date). Preserve the table header.
113
228
 
114
- ### 3.4 Delete old debug sessions
229
+ #### 3.4 Delete old debug sessions
115
230
  Delete files from `.planning/debug/resolved/` beyond the keep limit.
116
231
  Delete the oldest by filename date prefix.
117
232
 
118
- ### 3.5 Trim applied learnings
233
+ #### 3.5 Trim applied learnings
119
234
  Remove the oldest entries from `.planning/learnings/applied.md` beyond the keep limit.
120
235
  Keep the most recent N entries. Each entry is delimited by `---`.
121
236
 
122
- ### 3.6 Delete stale files
237
+ #### 3.6 Delete stale files
123
238
  Delete identified stale files (handoff.md, uat.md).
124
239
 
125
- ### 3.7 Commit
240
+ #### 3.7 Commit
126
241
  Read `commitPlanning` from `.planning/config.json`.
127
242
 
128
243
  Build commit message based on what was actually executed:
@@ -139,7 +254,7 @@ Check if there are staged changes (`git diff --cached --quiet`).
139
254
  - If there are changes: `make commit m="[built message]"`
140
255
  - If there are NO changes (e.g., only .planning/ was modified and commitPlanning is false): skip commit. Report: "Only local state cleaned (.planning/ is gitignored) — no commit needed."
141
256
 
142
- ## 4. Report
257
+ ### 4. Report
143
258
 
144
259
  ```
145
260
  Cleanup complete.
@@ -43,13 +43,22 @@ Delegate to the session-recovery agent in CHECK mode:
43
43
  ## 1. Load context
44
44
 
45
45
  If STATUS.md does not exist:
46
- - Report:
47
- ```
48
- No STATUS.md found — this project hasn't been initialized yet.
49
-
50
- Next: run `/cpw-startup` to set up the project.
51
- ```
52
- - STOP. Do not continue.
46
+ - If PLAN.md exists AND `.planning/config.json` exists:
47
+ - This project completed a plan cycle. Report:
48
+ ```
49
+ Plan completed — project is ready for the next development cycle.
50
+
51
+ Next: run `/cpw-startup` to start a new cycle.
52
+ ```
53
+ - STOP.
54
+ - Otherwise:
55
+ - Report:
56
+ ```
57
+ No STATUS.md found — this project hasn't been initialized yet.
58
+
59
+ Next: run `/cpw-startup` to set up the project.
60
+ ```
61
+ - STOP.
53
62
 
54
63
  - Read STATUS.md -> phase, step, stage
55
64
  - Read indicated sub-plan (plans/phase-N.md)
@@ -566,6 +575,21 @@ If all deliverables passed (or issues were fixed):
566
575
  - **trunk-based**: already on main, nothing to do
567
576
  - **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`
568
577
  - **gitflow**: create PR from `feature/phase-N-[slug]` to develop. Report PR URL. Wait for merge. After merge: `git checkout develop && git pull`
578
+ - Delete `.planning/.phase-active` if it exists (re-enables normal tool permissions)
579
+
580
+ #### Check if this is the LAST phase
581
+ Read PLAN.md. Check if there is a next phase (any phase with Status "pending" or a `plans/phase-[N+1].md` file).
582
+
583
+ **If there is NO next phase — plan complete:**
584
+
585
+ All phases are done. Delegate the full completion cycle to `/cpw-cleanup --complete`.
586
+ This will: generate plan summary, review docs, archive all phases, reset execution state.
587
+
588
+ Execute `/cpw-cleanup --complete` now (invoke the command inline, do NOT ask the user to run it manually).
589
+
590
+ After cleanup completes, STOP. Do NOT attempt to advance to a non-existent phase.
591
+
592
+ **If there IS a next phase — normal advancement:**
569
593
  - Reset STATUS.md for next phase:
570
594
  ```
571
595
  ## Now
@@ -580,7 +604,6 @@ If all deliverables passed (or issues were fixed):
580
604
  ## Session notes
581
605
  - (empty)
582
606
  ```
583
- - Delete `.planning/.phase-active` if it exists (re-enables normal tool permissions)
584
607
  - If `--phase` flag is active: STOP. Do NOT advance to next phase. Report:
585
608
  ```
586
609
  Phase N complete. UAT passed.
@@ -8,6 +8,54 @@ analysis report. You can stop after the scan by declining plan generation.
8
8
 
9
9
  ## 0. MODE DETECTION
10
10
 
11
+ ### Check for existing completed plan (new cycle detection)
12
+ Detect new cycle by ANY of these signals:
13
+ 1. PLAN.md exists AND `.planning/config.json` exists AND STATUS.md does NOT exist (post-completion state — STATUS.md was deleted by /cpw-cleanup --complete)
14
+ 2. PLAN.md exists AND all phases have Status "done" AND no phase has Status "in progress" or "pending" (implicit completion — cleanup may not have run)
15
+
16
+ If PLAN.md exists with phases "in progress" or "pending" → NOT a new cycle. Skip to standard mode detection below.
17
+
18
+ If ANY signal matches → **NEW CYCLE** mode:
19
+
20
+ #### Load project context
21
+ Before interviewing, load what exists:
22
+ - Read `docs/architecture.md` — current architecture
23
+ - Read `docs/interfaces.md` — current interfaces
24
+ - Read `plans/decisions.md` — accumulated decisions
25
+ - Read `.planning/plan-summary.md` (if exists) — what was built in the last cycle
26
+ - Read `.planning/config.json` — workflow settings (carry over, don't re-ask)
27
+
28
+ #### Present status and ask
29
+ ```
30
+ Detected a completed plan.
31
+
32
+ Previously built:
33
+ [summary from plan-summary.md, or phase list from PLAN.md if no summary]
34
+
35
+ Architecture: [key points from architecture.md]
36
+ Active decisions: [count from decisions.md]
37
+
38
+ Starting a new development cycle. This will:
39
+ - Keep all existing code, docs, and project structure
40
+ - Keep .planning/config.json (workflow settings carry over)
41
+ - Keep plans/decisions.md (cumulative)
42
+ - Add new phases to PLAN.md (continuing phase numbering)
43
+
44
+ What do you want to build next?
45
+ ```
46
+
47
+ #### Route to interview
48
+ - Skip mode detection (already have code), skip scan (already know the codebase), skip workflow configuration (config.json already exists).
49
+ - Go directly to step 3 (INTERVIEW) — scope the interview to the NEW work only. Use the loaded docs as context for what already exists.
50
+ - In step 4 (PLAN GENERATION):
51
+ - Do NOT overwrite PLAN.md — append new phases to the existing table, continuing the phase numbering (e.g., if last phase was 5, new phases start at 6)
52
+ - Do NOT overwrite docs/ or decisions.md
53
+ - Do NOT regenerate Phase 0 (stack already set up) or Phase 1 (interfaces already defined) unless the user explicitly requests it
54
+ - Generate new phase-N.md sub-plans for the new work
55
+ - Reset STATUS.md to point to the first new phase
56
+ - Continue to step 5 (PLAN REVIEW) and step 6 (COMMIT AND START) as normal.
57
+
58
+ ### Standard mode detection (no existing plan or plan in progress)
11
59
  Check the directory state:
12
60
  - Are there source files? (src/, lib/, app/, *.py, *.ts, *.go, etc.)
13
61
  - Is there git history? (more than 3 commits)
@@ -0,0 +1,16 @@
1
+ # Plan Summary
2
+
3
+ ## Completed
4
+ - **Date**: --
5
+ - **Phases**: --
6
+ - **Steps**: --
7
+
8
+ ## Phases
9
+ | # | Phase | Steps | Key output |
10
+ |---|-------|-------|------------|
11
+
12
+ ## Key decisions
13
+ (from plans/decisions.md)
14
+
15
+ ## Key deliverables
16
+ (from phase objectives)