@leocm/flowcraft 2.2.0 → 2.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.
Files changed (96) hide show
  1. package/README.md +7 -2
  2. package/bin/cli.js +108 -108
  3. package/flowcraft.yaml +30 -30
  4. package/install.sh +24 -24
  5. package/lib/args.js +38 -38
  6. package/lib/config.js +20 -20
  7. package/lib/copy.js +131 -131
  8. package/lib/fix.js +110 -110
  9. package/lib/fsutil.js +104 -104
  10. package/lib/global.js +229 -229
  11. package/lib/init.js +43 -43
  12. package/lib/runtime.js +84 -84
  13. package/lib/version.js +55 -55
  14. package/lib/wizard.js +125 -125
  15. package/package.json +33 -33
  16. package/presets/backend.yaml +20 -20
  17. package/presets/default.yaml +15 -15
  18. package/presets/frontend.yaml +20 -20
  19. package/presets/quick-fix.yaml +15 -15
  20. package/setup/.claude/hooks/check-phase-test.py +152 -152
  21. package/setup/.claude/hooks/check-phase-write.py +235 -235
  22. package/setup/.claude/hooks/dispatch.py +67 -67
  23. package/setup/.claude/hooks/file-suggestion.py +45 -45
  24. package/setup/.claude/hooks/flowcraft_env.py +162 -162
  25. package/setup/.claude/hooks/permission-request.py +132 -132
  26. package/setup/.claude/hooks/post-tool-failure.py +36 -36
  27. package/setup/.claude/hooks/pre-compact.py +66 -66
  28. package/setup/.claude/hooks/review-runner.py +846 -846
  29. package/setup/.claude/hooks/setup-keys.py +282 -282
  30. package/setup/.claude/hooks/statusline.py +63 -63
  31. package/setup/.claude/hooks/stop-check.py +186 -186
  32. package/setup/.claude/hooks/subagent-start.py +50 -50
  33. package/setup/.claude/hooks/subagent-stop.py +63 -63
  34. package/setup/.claude/hooks/task-completed.py +57 -57
  35. package/setup/.claude/hooks/task_manager.py +592 -592
  36. package/setup/.claude/hooks/user-prompt-submit.py +91 -91
  37. package/setup/.claude/settings.json +233 -233
  38. package/setup/.claude/skills/Pstatus/SKILL.md +68 -68
  39. package/setup/.claude/skills/archive/SKILL.md +195 -195
  40. package/setup/.claude/skills/brainstorming/SKILL.md +5 -5
  41. package/setup/.claude/skills/brainstorming/scripts/server.cjs +723 -723
  42. package/setup/.claude/skills/brainstorming/scripts/start-server.py +245 -245
  43. package/setup/.claude/skills/brainstorming/scripts/stop-server.py +178 -178
  44. package/setup/.claude/skills/brainstorming/visual-companion.md +298 -298
  45. package/setup/.claude/skills/chrome-integration/SKILL.md +66 -66
  46. package/setup/.claude/skills/code-review/SKILL.md +264 -264
  47. package/setup/.claude/skills/executing-plans/SKILL.md +1 -1
  48. package/setup/.claude/skills/gitnexus/gitnexus-cli/SKILL.md +67 -67
  49. package/setup/.claude/skills/gitnexus/gitnexus-debugging/SKILL.md +1 -1
  50. package/setup/.claude/skills/gitnexus/gitnexus-exploring/SKILL.md +1 -1
  51. package/setup/.claude/skills/gitnexus/gitnexus-guide/SKILL.md +1 -1
  52. package/setup/.claude/skills/gitnexus/gitnexus-impact-analysis/SKILL.md +1 -1
  53. package/setup/.claude/skills/gitnexus/gitnexus-refactoring/SKILL.md +1 -1
  54. package/setup/.claude/skills/methodology/SKILL.md +124 -0
  55. package/setup/.claude/skills/phase/SKILL.md +62 -62
  56. package/setup/.claude/skills/playwright/SKILL.md +85 -85
  57. package/setup/.claude/skills/review/SKILL.md +97 -97
  58. package/setup/.claude/skills/task/SKILL.md +26 -26
  59. package/setup/.claude/skills/test-driven-development/SKILL.md +1 -1
  60. package/setup/.claude/skills/ui-ux-pro-max/SKILL.md +1 -1
  61. package/setup/.claude/skills/verification-before-completion/SKILL.md +1 -1
  62. package/setup/.claude/skills/writing-plans/SKILL.md +1 -1
  63. package/setup/.codex/.agents/skills/archive/SKILL.md +195 -195
  64. package/setup/.codex/.agents/skills/brainstorming/SKILL.md +5 -5
  65. package/setup/.codex/.agents/skills/brainstorming/scripts/server.cjs +723 -723
  66. package/setup/.codex/.agents/skills/brainstorming/scripts/start-server.py +245 -245
  67. package/setup/.codex/.agents/skills/brainstorming/scripts/stop-server.py +178 -178
  68. package/setup/.codex/.agents/skills/brainstorming/visual-companion.md +298 -298
  69. package/setup/.codex/.agents/skills/chrome-integration/SKILL.md +66 -66
  70. package/setup/.codex/.agents/skills/code-review/SKILL.md +264 -264
  71. package/setup/.codex/.agents/skills/executing-plans/SKILL.md +1 -1
  72. package/setup/.codex/.agents/skills/gitnexus/gitnexus-cli/SKILL.md +67 -67
  73. package/setup/.codex/.agents/skills/gitnexus/gitnexus-debugging/SKILL.md +1 -1
  74. package/setup/.codex/.agents/skills/gitnexus/gitnexus-exploring/SKILL.md +1 -1
  75. package/setup/.codex/.agents/skills/gitnexus/gitnexus-guide/SKILL.md +1 -1
  76. package/setup/.codex/.agents/skills/gitnexus/gitnexus-impact-analysis/SKILL.md +1 -1
  77. package/setup/.codex/.agents/skills/gitnexus/gitnexus-refactoring/SKILL.md +1 -1
  78. package/setup/.codex/.agents/skills/methodology/SKILL.md +124 -0
  79. package/setup/.codex/.agents/skills/phase/SKILL.md +62 -62
  80. package/setup/.codex/.agents/skills/playwright/SKILL.md +85 -85
  81. package/setup/.codex/.agents/skills/review/SKILL.md +97 -97
  82. package/setup/.codex/.agents/skills/task/SKILL.md +27 -27
  83. package/setup/.codex/.agents/skills/test-driven-development/SKILL.md +1 -1
  84. package/setup/.codex/.agents/skills/ui-ux-pro-max/SKILL.md +1 -1
  85. package/setup/.codex/.agents/skills/verification-before-completion/SKILL.md +1 -1
  86. package/setup/.codex/.agents/skills/writing-plans/SKILL.md +1 -1
  87. package/setup/.codex/hooks/review-runner.py +851 -851
  88. package/setup/.codex/hooks/setup-keys.py +287 -287
  89. package/setup/AGENTS.md +11 -1
  90. package/setup/CLAUDE.md +11 -1
  91. package/setup/install.sh +24 -24
  92. package/setup/tests/test_decision_timeout.py +241 -241
  93. package/setup/tests/test_hook_guards.py +357 -357
  94. package/setup/tests/test_sdlc_bootstrap.py +167 -167
  95. package/setup/tests/test_sessionlog_switch.py +199 -199
  96. package/setup/tests/test_task_manager.py +148 -148
@@ -1,68 +1,68 @@
1
- ---
2
- name: Pstatus
3
- description: "查看 FlowCraft 项目完整状态。用户说'查看状态'/'项目状态'/'当前进度'时自动触发。"
4
- allowed-tools:
5
- - Read
6
- - Glob
7
- - Grep
8
- ---
9
-
10
- 用法:`/Pstatus`
11
-
12
- 参数:$ARGUMENTS
13
-
14
- ---
15
- ## 执行逻辑
16
-
17
- 1. **读取 project-state.md**:所有 YAML 字段
18
- 2. **读取 flowcraft.yaml**(如存在):阶段配置、审查规则
19
- 3. **读取 .claude/flowcraft-version**(如存在):版本信息
20
- 4. **收集 Git 信息**(如可用):当前分支、未提交变更数
21
- 5. **收集测试信息**(如可用):最近测试结果
22
- 6. **生成 Markdown 表格状态报告**:
23
-
24
- **格式:使用 Markdown 表格,自动对齐,无 Unicode 宽度问题。**
25
-
26
- **模板:**
27
-
28
- ```markdown
29
- ### FlowCraft 状态
30
-
31
- | 项目 | 值 |
32
- |------|-----|
33
- | **阶段** | {phase} {name} |
34
- | **进度** | {进度条} {百分比}% |
35
- | **任务** | {task} |
36
- | **分支** | {branch} |
37
- | **复杂度** | {level} |
38
- | **已完成** | ✓{list} |
39
- | **进行中** | ●{current} |
40
- | **待完成** | ○{list} |
41
- | **文件** | {n}个修改 |
42
- | **测试** | {pass}/{fail} |
43
- | **审查** | {status} ({retry}/3) |
44
- | **配置** | {preset} |
45
- | **版本** | {version} |
46
- | **更新** | {last_updated} |
47
- ```
48
-
49
- **进度条格式(固定20字符):**
50
- ```
51
- ████████████░░░░░░░░ 60%
52
- ```
53
- - 20个块字符 + 空格 + 百分比
54
- - P0: 0% | P1: 20% | P2: 50% | P3: 70% | P4: 85% | P5: 100%
55
-
56
- **阶段状态标记:**
57
- - ✓ 已完成(phase_history 中有记录)
58
- - ● 当前进行中
59
- - ○ 待完成
60
- - ⊘ 已跳过(auto模式,低复杂度)
61
-
62
- **简化模式:**
63
- 如果用户只是快速查看,输出单行摘要:
64
- ```
65
- [P2 编码实现] ████████░░░░ 60% | 任务: xxx | 文件: 5个
66
- ```
67
-
68
- 7. **同步更新** project-state.md(如信息不是最新)+ 更新 `last_updated`
1
+ ---
2
+ name: Pstatus
3
+ description: "查看 FlowCraft 项目完整状态。用户说'查看状态'/'项目状态'/'当前进度'时自动触发。"
4
+ allowed-tools:
5
+ - Read
6
+ - Glob
7
+ - Grep
8
+ ---
9
+
10
+ 用法:`/Pstatus`
11
+
12
+ 参数:$ARGUMENTS
13
+
14
+ ---
15
+ ## 执行逻辑
16
+
17
+ 1. **读取 project-state.md**:所有 YAML 字段
18
+ 2. **读取 flowcraft.yaml**(如存在):阶段配置、审查规则
19
+ 3. **读取 .claude/flowcraft-version**(如存在):版本信息
20
+ 4. **收集 Git 信息**(如可用):当前分支、未提交变更数
21
+ 5. **收集测试信息**(如可用):最近测试结果
22
+ 6. **生成 Markdown 表格状态报告**:
23
+
24
+ **格式:使用 Markdown 表格,自动对齐,无 Unicode 宽度问题。**
25
+
26
+ **模板:**
27
+
28
+ ```markdown
29
+ ### FlowCraft 状态
30
+
31
+ | 项目 | 值 |
32
+ |------|-----|
33
+ | **阶段** | {phase} {name} |
34
+ | **进度** | {进度条} {百分比}% |
35
+ | **任务** | {task} |
36
+ | **分支** | {branch} |
37
+ | **复杂度** | {level} |
38
+ | **已完成** | ✓{list} |
39
+ | **进行中** | ●{current} |
40
+ | **待完成** | ○{list} |
41
+ | **文件** | {n}个修改 |
42
+ | **测试** | {pass}/{fail} |
43
+ | **审查** | {status} ({retry}/3) |
44
+ | **配置** | {preset} |
45
+ | **版本** | {version} |
46
+ | **更新** | {last_updated} |
47
+ ```
48
+
49
+ **进度条格式(固定20字符):**
50
+ ```
51
+ ████████████░░░░░░░░ 60%
52
+ ```
53
+ - 20个块字符 + 空格 + 百分比
54
+ - P0: 0% | P1: 20% | P2: 50% | P3: 70% | P4: 85% | P5: 100%
55
+
56
+ **阶段状态标记:**
57
+ - ✓ 已完成(phase_history 中有记录)
58
+ - ● 当前进行中
59
+ - ○ 待完成
60
+ - ⊘ 已跳过(auto模式,低复杂度)
61
+
62
+ **简化模式:**
63
+ 如果用户只是快速查看,输出单行摘要:
64
+ ```
65
+ [P2 编码实现] ████████░░░░ 60% | 任务: xxx | 文件: 5个
66
+ ```
67
+
68
+ 7. **同步更新** project-state.md(如信息不是最新)+ 更新 `last_updated`
@@ -1,196 +1,196 @@
1
- ---
2
- name: archive
3
- description: "Archive & clean historical memory to free context space. | 触发词:清理历史/归档/释放空间"
4
- allowed-tools:
5
- - Read
6
- - Edit
7
- - Write
8
- - Bash
9
- ---
10
-
11
- Usage: `/archive`
12
-
13
- Arguments: $ARGUMENTS
14
-
15
- ---
16
-
17
- ## Function (功能)
18
-
19
- Automatically clean historical memory in `.codex/project-state.md` (Codex 端唯一状态文件), archiving rarely-used information to `.codex/archive/` to free context space; the Claude mirror `.claude/project-state.md` is synced afterwards.
20
-
21
- ---
22
-
23
- ## Execution logic (执行逻辑)
24
-
25
- ### 1. Read the current state
26
- Read `.codex/project-state.md` (Codex 端唯一状态文件,Claude 端镜像 `.claude/project-state.md`) and extract:
27
- - `completed_tasks` count
28
- - `phase_history` count
29
- - `architecture_decisions` count
30
-
31
- ### 2. Archive completed_tasks (when ≥5)
32
- If `completed_tasks.length >= 5`:
33
- 1. Extract the oldest `N-3` tasks (keep the most recent 3)
34
- 2. Append to `.codex/archive/tasks-{year}.md` (minimal format; mirror to `.claude/archive/tasks-{year}.md`):
35
- ```markdown
36
- - {completed_at}: {task} ({files_count} files)
37
- ```
38
- 3. Delete the archived tasks from `project-state.md`
39
-
40
- ### 3. Compress phase_history (when ≥10)
41
- If `phase_history.length >= 10`:
42
- 1. Keep the most recent 5 entries
43
- 2. Delete the rest
44
- 3. Add a comment in the file: `# History compressed, keeping the latest 5`
45
-
46
- ### 4. Trim architecture_decisions (when ≥8)
47
- If `architecture_decisions.length >= 8`:
48
- 1. Identify global decisions (spanning multiple modules) → sync to `global_architecture`
49
- 2. Keep decisions relevant to the current task (≤5)
50
- 3. Delete outdated/duplicate decisions
51
-
52
- ### 5. Sync mirrors (同步镜像)
53
- After cleaning, copy `.codex/project-state.md` → `.claude/project-state.md` and `.codex/archive/tasks-{year}.md` → `.claude/archive/tasks-{year}.md` so both ends stay consistent.
54
-
55
- ### 6. Generate the archive report
56
- ```markdown
57
- # Archive complete (归档完成)
58
-
59
- **Before (清理前)**: completed_tasks {n} | phase_history {n} | architecture_decisions {n}
60
- **After (清理后)**: completed_tasks 3 | phase_history 5 | architecture_decisions {n}
61
- **Location (归档位置)**: .codex/archive/tasks-{year}.md(镜像 .claude/archive/tasks-{year}.md)
62
- **Space saved (节省空间)**: ~{n} lines (~{n} tokens)
63
- ```
64
-
65
- ---
66
-
67
- ## Archive file format (归档文件格式)
68
-
69
- ### `.codex/archive/tasks-{year}.md` (minimal)
70
-
71
- ```markdown
72
- # {year} Completed task archive (已完成任务归档)
73
-
74
- > Archived at (归档时间): {timestamp}
75
-
76
- - 2025-01-15: User login feature (5 files)
77
- - 2025-01-20: Data display optimization (3 files)
78
- - 2025-02-01: Performance optimization (8 files)
79
- ```
80
-
81
- **Not saved**: prd_summary, key_decisions, detailed info (no longer needed)
82
-
83
- ---
84
-
85
- ## Trigger timing (触发时机)
86
-
87
- ### Automatic triggers (自动触发)
88
- - After P5 completes, if `completed_tasks >= 5`, prompt the user whether to archive
89
- - Before Context Compaction, auto-compress phase_history
90
-
91
- ### Manual triggers (手动触发)
92
- - User runs `/archive`
93
- - User says "清理历史" (clean history), "归档旧任务" (archive old tasks), "释放空间" (free space)
94
-
95
- ---
96
-
97
- ## Safety protection (安全保护)
98
-
99
- - ✅ Back up the original `project-state.md` before archiving → `.codex/archive/state-backup-{timestamp}.md`(mirror to `.claude/archive/`)
100
- - ✅ Archive files are append-only, never deleted
101
- - ✅ Keep the most recent 3 completed_tasks (not archived)
102
- - ✅ `project_roadmap` and `global_architecture` are never archived
103
-
104
- ---
105
-
106
- ## Example (示例)
107
-
108
- ### Before archiving (project-state.md, ~180 lines)
109
-
110
- ```yaml
111
- completed_tasks:
112
- - task: "Implement user login"
113
- prd_summary: "R1:user login R2:password encryption"
114
- key_decisions: ["React18", "JWT"]
115
- files_count: 5
116
- completed_at: "2024-12-01"
117
- - task: "Data display feature"
118
- prd_summary: "R1:list display R2:pagination"
119
- key_decisions: ["Redux Toolkit", "Ant Design"]
120
- files_count: 3
121
- completed_at: "2024-12-15"
122
- - task: "Search feature"
123
- prd_summary: "R1:keyword search R2:filters"
124
- key_decisions: ["Debounce", "URL params"]
125
- files_count: 4
126
- completed_at: "2025-01-05"
127
- - task: "Export feature"
128
- prd_summary: "R1:Excel export R2:PDF export"
129
- key_decisions: ["xlsx lib", "jsPDF"]
130
- files_count: 6
131
- completed_at: "2025-01-20"
132
- - task: "Permission management"
133
- prd_summary: "R1:role permissions R2:menu control"
134
- key_decisions: ["RBAC", "dynamic routes"]
135
- files_count: 7
136
- completed_at: "2025-02-01"
137
-
138
- phase_history:
139
- - "P1→P2 2024-12-01 10:00"
140
- - "P2→P3 2024-12-01 14:00"
141
- - "P3→P4 2024-12-01 16:00"
142
- - "P4→P5 2024-12-01 17:00"
143
- - "P0→P1 2024-12-15 09:00"
144
- - "P1→P2 2024-12-15 11:00"
145
- # ... 15 entries in total
146
- ```
147
-
148
- ### After archiving (project-state.md, ~60 lines)
149
-
150
- ```yaml
151
- completed_tasks:
152
- - task: "Search feature"
153
- prd_summary: "R1:keyword search R2:filters"
154
- key_decisions: ["Debounce"]
155
- files_count: 4
156
- completed_at: "2025-01-05"
157
- - task: "Export feature"
158
- prd_summary: "R1:Excel export R2:PDF export"
159
- key_decisions: ["xlsx lib"]
160
- files_count: 6
161
- completed_at: "2025-01-20"
162
- - task: "Permission management"
163
- prd_summary: "R1:role permissions R2:menu control"
164
- key_decisions: ["RBAC"]
165
- files_count: 7
166
- completed_at: "2025-02-01"
167
-
168
- phase_history:
169
- # History compressed, keeping the latest 5
170
- - "P1→P2 2025-02-01 10:00"
171
- - "P2→P3 2025-02-01 14:00"
172
- - "P3→P4 2025-02-01 16:00"
173
- - "P4→P5 2025-02-01 17:00"
174
- - "P0→P1 2025-02-08 09:00"
175
- ```
176
-
177
- ### Archive files (tasks-2024.md + tasks-2025.md, ~10 lines)
178
-
179
- ```markdown
180
- # 2024 Completed task archive (已完成任务归档)
181
-
182
- > Archived at (归档时间): 2025-02-08 10:30
183
-
184
- - 2024-12-01: Implement user login (5 files)
185
- - 2024-12-15: Data display feature (3 files)
186
- ```
187
-
188
- **Saved**: 180 → 60 lines (**-67%**, ~1500 tokens)
189
-
190
- ---
191
-
192
- ## Notes (注意事项)
193
-
194
- - Archiving is a **one-way operation**; detailed info after archiving is not restored (only summaries are kept)
195
- - To view archived task details, check Git history or code
1
+ ---
2
+ name: archive
3
+ description: "Archive & clean historical memory to free context space. | 触发词:清理历史/归档/释放空间"
4
+ allowed-tools:
5
+ - Read
6
+ - Edit
7
+ - Write
8
+ - Bash
9
+ ---
10
+
11
+ Usage: `/archive`
12
+
13
+ Arguments: $ARGUMENTS
14
+
15
+ ---
16
+
17
+ ## Function (功能)
18
+
19
+ Automatically clean historical memory in `.codex/project-state.md` (Codex 端唯一状态文件), archiving rarely-used information to `.codex/archive/` to free context space; the Claude mirror `.claude/project-state.md` is synced afterwards.
20
+
21
+ ---
22
+
23
+ ## Execution logic (执行逻辑)
24
+
25
+ ### 1. Read the current state
26
+ Read `.codex/project-state.md` (Codex 端唯一状态文件,Claude 端镜像 `.claude/project-state.md`) and extract:
27
+ - `completed_tasks` count
28
+ - `phase_history` count
29
+ - `architecture_decisions` count
30
+
31
+ ### 2. Archive completed_tasks (when ≥5)
32
+ If `completed_tasks.length >= 5`:
33
+ 1. Extract the oldest `N-3` tasks (keep the most recent 3)
34
+ 2. Append to `.codex/archive/tasks-{year}.md` (minimal format; mirror to `.claude/archive/tasks-{year}.md`):
35
+ ```markdown
36
+ - {completed_at}: {task} ({files_count} files)
37
+ ```
38
+ 3. Delete the archived tasks from `project-state.md`
39
+
40
+ ### 3. Compress phase_history (when ≥10)
41
+ If `phase_history.length >= 10`:
42
+ 1. Keep the most recent 5 entries
43
+ 2. Delete the rest
44
+ 3. Add a comment in the file: `# History compressed, keeping the latest 5`
45
+
46
+ ### 4. Trim architecture_decisions (when ≥8)
47
+ If `architecture_decisions.length >= 8`:
48
+ 1. Identify global decisions (spanning multiple modules) → sync to `global_architecture`
49
+ 2. Keep decisions relevant to the current task (≤5)
50
+ 3. Delete outdated/duplicate decisions
51
+
52
+ ### 5. Sync mirrors (同步镜像)
53
+ After cleaning, copy `.codex/project-state.md` → `.claude/project-state.md` and `.codex/archive/tasks-{year}.md` → `.claude/archive/tasks-{year}.md` so both ends stay consistent.
54
+
55
+ ### 6. Generate the archive report
56
+ ```markdown
57
+ # Archive complete (归档完成)
58
+
59
+ **Before (清理前)**: completed_tasks {n} | phase_history {n} | architecture_decisions {n}
60
+ **After (清理后)**: completed_tasks 3 | phase_history 5 | architecture_decisions {n}
61
+ **Location (归档位置)**: .codex/archive/tasks-{year}.md(镜像 .claude/archive/tasks-{year}.md)
62
+ **Space saved (节省空间)**: ~{n} lines (~{n} tokens)
63
+ ```
64
+
65
+ ---
66
+
67
+ ## Archive file format (归档文件格式)
68
+
69
+ ### `.codex/archive/tasks-{year}.md` (minimal)
70
+
71
+ ```markdown
72
+ # {year} Completed task archive (已完成任务归档)
73
+
74
+ > Archived at (归档时间): {timestamp}
75
+
76
+ - 2025-01-15: User login feature (5 files)
77
+ - 2025-01-20: Data display optimization (3 files)
78
+ - 2025-02-01: Performance optimization (8 files)
79
+ ```
80
+
81
+ **Not saved**: prd_summary, key_decisions, detailed info (no longer needed)
82
+
83
+ ---
84
+
85
+ ## Trigger timing (触发时机)
86
+
87
+ ### Automatic triggers (自动触发)
88
+ - After P5 completes, if `completed_tasks >= 5`, prompt the user whether to archive
89
+ - Before Context Compaction, auto-compress phase_history
90
+
91
+ ### Manual triggers (手动触发)
92
+ - User runs `/archive`
93
+ - User says "清理历史" (clean history), "归档旧任务" (archive old tasks), "释放空间" (free space)
94
+
95
+ ---
96
+
97
+ ## Safety protection (安全保护)
98
+
99
+ - ✅ Back up the original `project-state.md` before archiving → `.codex/archive/state-backup-{timestamp}.md`(mirror to `.claude/archive/`)
100
+ - ✅ Archive files are append-only, never deleted
101
+ - ✅ Keep the most recent 3 completed_tasks (not archived)
102
+ - ✅ `project_roadmap` and `global_architecture` are never archived
103
+
104
+ ---
105
+
106
+ ## Example (示例)
107
+
108
+ ### Before archiving (project-state.md, ~180 lines)
109
+
110
+ ```yaml
111
+ completed_tasks:
112
+ - task: "Implement user login"
113
+ prd_summary: "R1:user login R2:password encryption"
114
+ key_decisions: ["React18", "JWT"]
115
+ files_count: 5
116
+ completed_at: "2024-12-01"
117
+ - task: "Data display feature"
118
+ prd_summary: "R1:list display R2:pagination"
119
+ key_decisions: ["Redux Toolkit", "Ant Design"]
120
+ files_count: 3
121
+ completed_at: "2024-12-15"
122
+ - task: "Search feature"
123
+ prd_summary: "R1:keyword search R2:filters"
124
+ key_decisions: ["Debounce", "URL params"]
125
+ files_count: 4
126
+ completed_at: "2025-01-05"
127
+ - task: "Export feature"
128
+ prd_summary: "R1:Excel export R2:PDF export"
129
+ key_decisions: ["xlsx lib", "jsPDF"]
130
+ files_count: 6
131
+ completed_at: "2025-01-20"
132
+ - task: "Permission management"
133
+ prd_summary: "R1:role permissions R2:menu control"
134
+ key_decisions: ["RBAC", "dynamic routes"]
135
+ files_count: 7
136
+ completed_at: "2025-02-01"
137
+
138
+ phase_history:
139
+ - "P1→P2 2024-12-01 10:00"
140
+ - "P2→P3 2024-12-01 14:00"
141
+ - "P3→P4 2024-12-01 16:00"
142
+ - "P4→P5 2024-12-01 17:00"
143
+ - "P0→P1 2024-12-15 09:00"
144
+ - "P1→P2 2024-12-15 11:00"
145
+ # ... 15 entries in total
146
+ ```
147
+
148
+ ### After archiving (project-state.md, ~60 lines)
149
+
150
+ ```yaml
151
+ completed_tasks:
152
+ - task: "Search feature"
153
+ prd_summary: "R1:keyword search R2:filters"
154
+ key_decisions: ["Debounce"]
155
+ files_count: 4
156
+ completed_at: "2025-01-05"
157
+ - task: "Export feature"
158
+ prd_summary: "R1:Excel export R2:PDF export"
159
+ key_decisions: ["xlsx lib"]
160
+ files_count: 6
161
+ completed_at: "2025-01-20"
162
+ - task: "Permission management"
163
+ prd_summary: "R1:role permissions R2:menu control"
164
+ key_decisions: ["RBAC"]
165
+ files_count: 7
166
+ completed_at: "2025-02-01"
167
+
168
+ phase_history:
169
+ # History compressed, keeping the latest 5
170
+ - "P1→P2 2025-02-01 10:00"
171
+ - "P2→P3 2025-02-01 14:00"
172
+ - "P3→P4 2025-02-01 16:00"
173
+ - "P4→P5 2025-02-01 17:00"
174
+ - "P0→P1 2025-02-08 09:00"
175
+ ```
176
+
177
+ ### Archive files (tasks-2024.md + tasks-2025.md, ~10 lines)
178
+
179
+ ```markdown
180
+ # 2024 Completed task archive (已完成任务归档)
181
+
182
+ > Archived at (归档时间): 2025-02-08 10:30
183
+
184
+ - 2024-12-01: Implement user login (5 files)
185
+ - 2024-12-15: Data display feature (3 files)
186
+ ```
187
+
188
+ **Saved**: 180 → 60 lines (**-67%**, ~1500 tokens)
189
+
190
+ ---
191
+
192
+ ## Notes (注意事项)
193
+
194
+ - Archiving is a **one-way operation**; detailed info after archiving is not restored (only summaries are kept)
195
+ - To view archived task details, check Git history or code
196
196
  - Recommend batch-archiving during a stable period (after multiple tasks complete)
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: brainstorming
3
- description: "Explore user intent, requirements and design before any creative work. | 触发词:创意/需求澄清/设计"
3
+ description: "Explore user intent, requirements and design before any creative work. | 触发词:创意/需求澄清/设计"
4
4
  ---
5
5
 
6
6
  # Brainstorming Ideas Into Designs
@@ -31,10 +31,10 @@ You MUST create a task for each of these items and complete them in order:
31
31
  8. **User reviews written spec** — ask user to review the spec file before proceeding
32
32
  9. **Transition to implementation** — invoke writing-plans skill to create implementation plan
33
33
 
34
- ## Decision Point Format (决策点格式)
35
-
36
- When presenting choices — multiple-choice clarifying questions, 2-3 approach options, or design decisions — use the Decision Card format from AGENTS.md / CLAUDE.md → Display Format Standard (展示格式规范): bold black title (`**🧭 决策点 N | 名称**`), options labeled A./B./C. in order, recommended option marked ✅ Recommended (推荐), others 🔀 Alternative (备选), each option lists Features/When-to-use/Costs (特点/适合/代价). No thin box-drawing characters; no trailing operation hint line.
37
-
34
+ ## Decision Point Format (决策点格式)
35
+
36
+ When presenting choices — multiple-choice clarifying questions, 2-3 approach options, or design decisions — use the Decision Card format from AGENTS.md / CLAUDE.md → Display Format Standard (展示格式规范): bold black title (`**🧭 决策点 N | 名称**`), options labeled A./B./C. in order, recommended option marked ✅ Recommended (推荐), others 🔀 Alternative (备选), each option lists Features/When-to-use/Costs (特点/适合/代价). No thin box-drawing characters; no trailing operation hint line.
37
+
38
38
  ## Process Flow
39
39
 
40
40
  ```dot