@claude-pw/framework 0.8.1 → 0.9.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
@@ -169,7 +169,7 @@ Issue capturado. ¿Arreglar ahora? (sí/no)
169
169
  ```
170
170
  mi-proyecto/
171
171
  ├── .claude/
172
- │ ├── commands/ 11 slash commands (/cpw-*)
172
+ │ ├── commands/ 12 slash commands (/cpw-*)
173
173
  │ ├── agents/ 12 agentes especializados (4 con memoria persistente)
174
174
  │ ├── rules/ 3 reglas context-aware (git, interfaces, testing)
175
175
  │ ├── hooks/ Hooks Node.js (statusline, monitor de contexto)
package/README.ja.md CHANGED
@@ -169,7 +169,7 @@ Issue captured. Fix now? (yes/no)
169
169
  ```
170
170
  my-project/
171
171
  ├── .claude/
172
- │ ├── commands/ 11個のスラッシュコマンド (/cpw-*)
172
+ │ ├── commands/ 12個のスラッシュコマンド (/cpw-*)
173
173
  │ ├── agents/ 12個の専門エージェント(4つに永続メモリ)
174
174
  │ ├── rules/ 3つのコンテキスト対応ルール(git、インターフェース、テスト)
175
175
  │ ├── hooks/ Node.js フック(ステータスライン、コンテキストモニター)
package/README.md CHANGED
@@ -169,7 +169,7 @@ Issue captured. Fix now? (yes/no)
169
169
  ```
170
170
  my-project/
171
171
  ├── .claude/
172
- │ ├── commands/ 11 slash commands (/cpw-*)
172
+ │ ├── commands/ 12 slash commands (/cpw-*)
173
173
  │ ├── agents/ 12 specialized agents (4 with persistent memory)
174
174
  │ ├── rules/ 3 context-aware rules (git, interfaces, testing)
175
175
  │ ├── hooks/ Node.js hooks (statusline, context monitor)
package/README.pt-br.md CHANGED
@@ -169,7 +169,7 @@ Issue captured. Fix now? (yes/no)
169
169
  ```
170
170
  my-project/
171
171
  ├── .claude/
172
- │ ├── commands/ 11 slash commands (/cpw-*)
172
+ │ ├── commands/ 12 slash commands (/cpw-*)
173
173
  │ ├── agents/ 12 agentes especializados (4 com memória persistente)
174
174
  │ ├── rules/ 3 regras sensíveis ao contexto (git, interfaces, testes)
175
175
  │ ├── hooks/ Hooks Node.js (statusline, monitor de contexto)
package/README.zh-cn.md CHANGED
@@ -169,7 +169,7 @@ UAT 演练:
169
169
  ```
170
170
  my-project/
171
171
  ├── .claude/
172
- │ ├── commands/ 11 个斜杠命令(/cpw-*)
172
+ │ ├── commands/ 12 个斜杠命令(/cpw-*)
173
173
  │ ├── agents/ 12 个专用代理(4 个具有持久记忆)
174
174
  │ ├── rules/ 3 个上下文感知规则(git、interfaces、testing)
175
175
  │ ├── hooks/ Node.js 钩子(状态栏、上下文监控)
package/RELEASES.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  Formato: [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
4
4
 
5
+ ## [0.9.0] - 2026-03-15
6
+
7
+ ### Added
8
+ - `/cpw-cleanup` command — archive completed phase files and clean accumulated state (.planning/archive/)
9
+ - `cleanupPolicy` in config.json — configurable retention for applied learnings, debug sessions, quick log entries
10
+ - Cleanup suggestion in `/cpw-next-step` after phase advancement (when 3+ completed phases unarchived)
11
+
5
12
  ## [0.3.0] - 2026-03-15
6
13
 
7
14
  ### Added
package/install.js CHANGED
@@ -602,7 +602,7 @@ async function main() {
602
602
  header('Listo');
603
603
  console.log('');
604
604
  console.log(` ${projectName}/`);
605
- console.log(' ├── .claude/commands/ 10 commands (/cpw-startup, /cpw-next-step, /cpw-quick, ...)');
605
+ console.log(' ├── .claude/commands/ 12 commands (/cpw-startup, /cpw-next-step, /cpw-quick, ...)');
606
606
  console.log(' ├── .claude/agents/ 11 agentes (plan-checker, debugger, researcher, implementer, ...)');
607
607
  console.log(' ├── .claude/rules/ 3 reglas (interfaces, testing, git)');
608
608
  console.log(' ├── .claude/hooks/ 2 hooks (statusline, context monitor)');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claude-pw/framework",
3
- "version": "0.8.1",
3
+ "version": "0.9.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"
@@ -24,6 +24,7 @@ TODO: Phase 0
24
24
  - Ad-hoc tasks that don't affect the plan -> /cpw-quick
25
25
  - Debug that may take several sessions -> /cpw-debug (persists state)
26
26
  - If something seems broken or inconsistent -> /cpw-health
27
+ - Completed phases accumulating? -> /cpw-cleanup (archive and free context)
27
28
  - If the user corrects you, capture the correction in .planning/learnings/queue.md (include the active command in the Command field)
28
29
  - Learnings are auto-processed based on config (autoReflect: off/remind/auto)
29
30
  - When you discover something non-obvious (debug, workaround), evaluate for skill extraction → .claude/skills/
@@ -37,4 +38,4 @@ TODO: Phase 0
37
38
  - plans/decisions.md — Decisions and RFCs
38
39
  - src/interfaces/ — Contracts (RFC required to modify)
39
40
  - .planning/ — Project state (gitignored by default, set commitPlanning: true to track)
40
- - .planning/config.json — Workflow config (autoAdvance, granularity, modelProfile, modelOverrides, gitStrategy, commitPlanning, toolingSources, maxConsecutiveFailures, autoReflect)
41
+ - .planning/config.json — Workflow config (autoAdvance, granularity, modelProfile, modelOverrides, gitStrategy, commitPlanning, toolingSources, maxConsecutiveFailures, autoReflect, cleanupPolicy)
@@ -0,0 +1,152 @@
1
+ ---
2
+ description: "Archive completed phases and clean accumulated state"
3
+ ---
4
+
5
+ ## Arguments
6
+ - No arguments: dry-run (show what would be cleaned, ask for confirmation)
7
+ - `--execute`: skip confirmation, execute immediately
8
+
9
+ ## 0. Load state
10
+
11
+ Read `.planning/config.json` -> extract `cleanupPolicy` (use defaults if missing):
12
+ - `archiveCompletedPhases`: true
13
+ - `keepAppliedLearnings`: 20
14
+ - `keepResolvedDebug`: 5
15
+ - `keepQuickLogDone`: 10
16
+
17
+ Read PLAN.md -> extract phases table. Identify phases with Status = "done".
18
+ Read STATUS.md -> identify current phase (to avoid archiving it).
19
+
20
+ If no completed phases and no accumulated state to clean:
21
+ ```
22
+ Nothing to clean up. All phases are current or pending.
23
+ ```
24
+ STOP.
25
+
26
+ ## 1. Identify what to clean
27
+
28
+ ### 1.1 Completed phase files
29
+ If `archiveCompletedPhases` is true:
30
+ For each phase with Status "done" in PLAN.md:
31
+ - Check if `plans/phase-N.md` still exists (not already archived)
32
+ - Check if `plans/phase-N-context.md` exists
33
+ - Add to archive list
34
+ - NEVER archive the current phase or pending phases
35
+
36
+ ### 1.2 Quick log done entries
37
+ Read `.planning/quick/log.md` (if exists):
38
+ - Count entries with Status: done or dismissed
39
+ - If count > `keepQuickLogDone`: mark oldest excess entries for removal
40
+
41
+ ### 1.3 Resolved debug sessions
42
+ List `.planning/debug/resolved/` (if exists):
43
+ - Count files
44
+ - If count > `keepResolvedDebug`: mark oldest files for deletion (by filename date prefix)
45
+
46
+ ### 1.4 Applied learnings
47
+ Read `.planning/learnings/applied.md` (if exists):
48
+ - Count entries (each entry starts with `---`)
49
+ - If count > `keepAppliedLearnings`: mark oldest excess entries for trimming
50
+
51
+ ### 1.5 Stale files
52
+ - `.planning/handoff.md` — if it exists AND STATUS.md does NOT show a handoff in progress
53
+ - `.planning/uat.md` — if it exists AND all phases it references are done (no active UAT)
54
+
55
+ ## 2. Present cleanup plan
56
+
57
+ ```
58
+ Cleanup Summary:
59
+
60
+ ARCHIVE (move to .planning/archive/):
61
+ - plans/phase-0.md (6 steps, all done)
62
+ - plans/phase-0-context.md
63
+ - plans/phase-1.md (4 steps, all done)
64
+
65
+ TRIM:
66
+ - quick/log.md: remove N done entries (keeping last M)
67
+ - debug/resolved/: delete N old sessions (keeping last M)
68
+ - learnings/applied.md: trim N old entries (keeping last M)
69
+
70
+ DELETE:
71
+ - .planning/handoff.md (stale)
72
+
73
+ NO CHANGES:
74
+ - plans/phase-2.md (current phase)
75
+ - plans/decisions.md (cumulative, always kept)
76
+ - docs/* (living documentation, always kept)
77
+ ```
78
+
79
+ If nothing to clean in a category, omit it from the summary.
80
+
81
+ If ALL lists are empty after step 1 filtering (no files to archive, nothing exceeds retention limits, no stale files):
82
+ ```
83
+ Nothing to clean — completed phases already archived and accumulated state within retention limits.
84
+ ```
85
+ STOP.
86
+
87
+ If `--execute`: show the summary and proceed to step 3.
88
+ Otherwise: ask "Proceed? (yes/no)". If no: STOP.
89
+
90
+ ## 3. Execute
91
+
92
+ ### 3.1 Archive phase files
93
+ ```bash
94
+ mkdir -p .planning/archive
95
+ ```
96
+ For each phase in the archive list:
97
+ - Move `plans/phase-N.md` to `.planning/archive/phase-N.md`
98
+ - Move `plans/phase-N-context.md` to `.planning/archive/phase-N-context.md` (if exists)
99
+
100
+ ### 3.2 Update PLAN.md
101
+ For each archived phase, change the sub-plan column from `plans/phase-N.md` to `(archived)`:
102
+ ```
103
+ | 0 | Stack and Scaffolding | plans/phase-0.md | done |
104
+ ```
105
+ becomes:
106
+ ```
107
+ | 0 | Stack and Scaffolding | (archived) | done |
108
+ ```
109
+
110
+ ### 3.3 Trim quick log
111
+ Remove done/dismissed entries beyond the keep limit from `.planning/quick/log.md`.
112
+ Keep the most recent N entries (by date). Preserve the table header.
113
+
114
+ ### 3.4 Delete old debug sessions
115
+ Delete files from `.planning/debug/resolved/` beyond the keep limit.
116
+ Delete the oldest by filename date prefix.
117
+
118
+ ### 3.5 Trim applied learnings
119
+ Remove the oldest entries from `.planning/learnings/applied.md` beyond the keep limit.
120
+ Keep the most recent N entries. Each entry is delimited by `---`.
121
+
122
+ ### 3.6 Delete stale files
123
+ Delete identified stale files (handoff.md, uat.md).
124
+
125
+ ### 3.7 Commit
126
+ Read `commitPlanning` from `.planning/config.json`.
127
+
128
+ Build commit message based on what was actually executed:
129
+ - If phases were archived AND state was trimmed: `"chore: archive phases N-M and trim planning state"`
130
+ - If only phases were archived: `"chore: archive completed phases N-M"`
131
+ - If only state was trimmed: `"chore: trim accumulated planning state"`
132
+
133
+ Git add the changes:
134
+ - `PLAN.md` (always — sub-plan column updated)
135
+ - `plans/` (always — phase files removed)
136
+ - `.planning/` (only if `commitPlanning: true`)
137
+
138
+ Check if there are staged changes (`git diff --cached --quiet`).
139
+ - If there are changes: `make commit m="[built message]"`
140
+ - 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
+
142
+ ## 4. Report
143
+
144
+ ```
145
+ Cleanup complete.
146
+
147
+ Archived: N phase files → .planning/archive/
148
+ Trimmed: M quick log entries, K debug sessions, L learnings
149
+ Deleted: P stale files
150
+
151
+ Next: /cpw-next-step to continue.
152
+ ```
@@ -598,4 +598,13 @@ If all deliverables passed (or issues were fixed):
598
598
  " 3. `/cpw-next-step` — start directly"
599
599
  - If autoAdvance is **auto** or **yolo** (and no --phase): Suggest /clear for context refresh, then automatically continue with Phase N+1 (run tooling audit → first step).
600
600
 
601
+ ### Cleanup suggestion
602
+ After phase advancement, count completed phases in PLAN.md that still have sub-plan files in `plans/` (sub-plan column is NOT `(archived)`).
603
+ If count >= 3:
604
+ ```
605
+ Tip: You have N completed phase files that could be archived.
606
+ Run /cpw-cleanup to free up context.
607
+ ```
608
+ This is a suggestion only — do NOT block advancement.
609
+
601
610
  NEVER advance between phases without completing UAT first (in any mode).
@@ -7,5 +7,11 @@
7
7
  "toolingSources": ["skills.sh", "claude-code-templates"],
8
8
  "maxConsecutiveFailures": null,
9
9
  "gitStrategy": "trunk-based",
10
- "autoReflect": "remind"
10
+ "autoReflect": "remind",
11
+ "cleanupPolicy": {
12
+ "archiveCompletedPhases": true,
13
+ "keepAppliedLearnings": 20,
14
+ "keepResolvedDebug": 5,
15
+ "keepQuickLogDone": 10
16
+ }
11
17
  }