cc-devflow 4.5.11 → 4.5.12

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 (185) hide show
  1. package/.claude/skills/cc-act/CHANGELOG.md +18 -0
  2. package/.claude/skills/cc-act/PLAYBOOK.md +17 -269
  3. package/.claude/skills/cc-act/SKILL.md +38 -425
  4. package/.claude/skills/cc-act/assets/PROJECT_POSTMORTEM_INDEX_TEMPLATE.md +2 -13
  5. package/.claude/skills/cc-act/assets/PROJECT_POSTMORTEM_TEMPLATE.md +1 -9
  6. package/.claude/skills/cc-act/assets/PR_BRIEF_TEMPLATE.md +21 -177
  7. package/.claude/skills/cc-act/references/closure-contract.md +12 -63
  8. package/.claude/skills/cc-act/references/git-commit-guidelines.md +5 -5
  9. package/.claude/skills/cc-act/scripts/cc-act-common.sh +5 -322
  10. package/.claude/skills/cc-act/scripts/detect-ship-target.sh +11 -2
  11. package/.claude/skills/cc-act/scripts/inspect-git-index.sh +58 -0
  12. package/.claude/skills/cc-act/scripts/render-pr-brief.sh +40 -440
  13. package/.claude/skills/cc-act/scripts/verify-act-gate.sh +10 -50
  14. package/.claude/skills/cc-check/CHANGELOG.md +18 -0
  15. package/.claude/skills/cc-check/PLAYBOOK.md +19 -273
  16. package/.claude/skills/cc-check/SKILL.md +33 -456
  17. package/.claude/skills/cc-check/references/review-contract.md +12 -147
  18. package/.claude/skills/cc-dev/CHANGELOG.md +15 -0
  19. package/.claude/skills/cc-dev/PLAYBOOK.md +1 -1
  20. package/.claude/skills/cc-dev/SKILL.md +52 -137
  21. package/.claude/skills/cc-dev/scripts/resolve-cc-devflow.sh +181 -0
  22. package/.claude/skills/cc-do/CHANGELOG.md +11 -0
  23. package/.claude/skills/cc-do/PLAYBOOK.md +19 -113
  24. package/.claude/skills/cc-do/SKILL.md +39 -245
  25. package/.claude/skills/cc-do/references/execution-recovery.md +15 -109
  26. package/.claude/skills/cc-do/scripts/cc-do-common.sh +5 -57
  27. package/.claude/skills/cc-do/scripts/check-task-status.sh +35 -65
  28. package/.claude/skills/cc-do/scripts/mark-task-complete.sh +9 -46
  29. package/.claude/skills/cc-do/scripts/select-ready-tasks.sh +29 -97
  30. package/.claude/skills/cc-investigate/CHANGELOG.md +16 -0
  31. package/.claude/skills/cc-investigate/PLAYBOOK.md +20 -180
  32. package/.claude/skills/cc-investigate/SKILL.md +64 -246
  33. package/.claude/skills/cc-investigate/assets/TASKS_TEMPLATE.md +48 -98
  34. package/.claude/skills/cc-investigate/references/investigation-contract.md +14 -218
  35. package/.claude/skills/cc-next/CHANGELOG.md +6 -0
  36. package/.claude/skills/cc-next/PLAYBOOK.md +12 -8
  37. package/.claude/skills/cc-next/SKILL.md +34 -140
  38. package/.claude/skills/cc-plan/CHANGELOG.md +16 -0
  39. package/.claude/skills/cc-plan/PLAYBOOK.md +22 -161
  40. package/.claude/skills/cc-plan/SKILL.md +45 -295
  41. package/.claude/skills/cc-plan/assets/TASKS_TEMPLATE.md +30 -228
  42. package/.claude/skills/cc-plan/references/planning-contract.md +24 -161
  43. package/.claude/skills/cc-plan/scripts/next-change-key.sh +8 -44
  44. package/.claude/skills/cc-plan/scripts/parse-task-dependencies.js +2 -2
  45. package/.claude/skills/cc-plan/scripts/validate-scope.sh +1 -1
  46. package/.claude/skills/cc-pr-land/SKILL.md +14 -114
  47. package/.claude/skills/cc-pr-review/CHANGELOG.md +4 -0
  48. package/.claude/skills/cc-pr-review/SKILL.md +20 -103
  49. package/.claude/skills/cc-review/CHANGELOG.md +17 -0
  50. package/.claude/skills/cc-review/PLAYBOOK.md +13 -86
  51. package/.claude/skills/cc-review/SKILL.md +53 -241
  52. package/.claude/skills/cc-review/references/e2e-and-plugin-verification.md +2 -2
  53. package/.claude/skills/cc-review/references/implementation-review-branch.md +7 -147
  54. package/.claude/skills/cc-review/references/plan-review-branch.md +5 -147
  55. package/.claude/skills/cc-review/references/review-methods.md +10 -218
  56. package/.claude/skills/cc-review/scripts/collect-review-context.sh +4 -63
  57. package/.claude/skills/cc-roadmap/PLAYBOOK.md +1 -1
  58. package/.claude/skills/cc-roadmap/SKILL.md +3 -3
  59. package/.claude/skills/cc-simplify/CHANGELOG.md +7 -0
  60. package/.claude/skills/cc-simplify/SKILL.md +26 -21
  61. package/.claude/skills/cc-spec-init/PLAYBOOK.md +12 -48
  62. package/.claude/skills/cc-spec-init/SKILL.md +29 -132
  63. package/.claude/skills/cc-spec-init/references/spec-contract.md +8 -17
  64. package/CHANGELOG.md +13 -0
  65. package/bin/cc-devflow-cli.js +20 -260
  66. package/bin/cc-devflow.js +44 -7
  67. package/docs/commands/README.md +1 -1
  68. package/docs/commands/README.zh-CN.md +1 -1
  69. package/docs/examples/README.md +1 -1
  70. package/docs/examples/START-HERE.md +14 -15
  71. package/docs/examples/example-bindings.json +11 -11
  72. package/docs/examples/full-design-blocked/README.md +4 -6
  73. package/docs/examples/full-design-blocked/changes/REQ-002-bulk-invite-import/{planning/tasks.md → task.md} +20 -15
  74. package/docs/examples/local-handoff/README.md +8 -11
  75. package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/handoff/pr-brief.md +31 -0
  76. package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/{planning/tasks.md → task.md} +18 -13
  77. package/docs/examples/pdca-loop/README.md +6 -9
  78. package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/handoff/pr-brief.md +9 -11
  79. package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/{planning/tasks.md → task.md} +18 -13
  80. package/docs/examples/scripts/check-example-bindings.sh +11 -62
  81. package/docs/guides/artifact-contract.md +10 -40
  82. package/docs/guides/getting-started.md +8 -8
  83. package/docs/guides/getting-started.zh-CN.md +8 -8
  84. package/docs/guides/minimize-artifacts.md +16 -130
  85. package/docs/guides/project-postmortem.md +14 -71
  86. package/lib/compiler/__tests__/skills-registry.test.js +9 -8
  87. package/lib/compiler/resource-copier.js +29 -0
  88. package/lib/skill-runtime/__tests__/archive-change.test.js +2 -2
  89. package/lib/skill-runtime/__tests__/benchmark-skills.test.js +3 -3
  90. package/lib/skill-runtime/__tests__/cli-bootstrap.integration.test.js +14 -4
  91. package/lib/skill-runtime/errors.js +3 -3
  92. package/lib/skill-runtime/index.js +5 -23
  93. package/lib/skill-runtime/paths.js +5 -52
  94. package/lib/skill-runtime/query-registry.js +4 -4
  95. package/lib/skill-runtime/query.js +89 -201
  96. package/lib/skill-runtime/store.js +4 -40
  97. package/lib/skill-runtime/trace.js +2 -2
  98. package/package.json +2 -5
  99. package/.claude/skills/cc-act/assets/PROJECT_POSTMORTEM_PRINCIPLES_TEMPLATE.md +0 -29
  100. package/.claude/skills/cc-act/assets/RELEASE_NOTE_TEMPLATE.md +0 -54
  101. package/.claude/skills/cc-act/scripts/generate-status-report.sh +0 -92
  102. package/.claude/skills/cc-act/scripts/sync-act-docs.sh +0 -355
  103. package/.claude/skills/cc-check/assets/REPORT_CARD_TEMPLATE.json +0 -234
  104. package/.claude/skills/cc-check/scripts/render-report-card.js +0 -438
  105. package/.claude/skills/cc-check/scripts/verify-gate.sh +0 -85
  106. package/.claude/skills/cc-do/scripts/build-task-context.sh +0 -175
  107. package/.claude/skills/cc-do/scripts/record-review-decision.sh +0 -88
  108. package/.claude/skills/cc-do/scripts/recover-workflow.sh +0 -82
  109. package/.claude/skills/cc-do/scripts/run-problem-analysis.sh +0 -70
  110. package/.claude/skills/cc-do/scripts/verify-task-gates.sh +0 -109
  111. package/.claude/skills/cc-do/scripts/write-task-checkpoint.sh +0 -92
  112. package/.claude/skills/cc-investigate/assets/TASK_MANIFEST_TEMPLATE.json +0 -224
  113. package/.claude/skills/cc-plan/assets/TASK_MANIFEST_TEMPLATE.json +0 -178
  114. package/.claude/skills/cc-spec-init/assets/CHANGE_META_TEMPLATE.json +0 -28
  115. package/.claude/skills/cc-spec-init/scripts/validate-spec-links.sh +0 -45
  116. package/docs/examples/full-design-blocked/changes/REQ-002-bulk-invite-import/planning/design.md +0 -234
  117. package/docs/examples/full-design-blocked/changes/REQ-002-bulk-invite-import/planning/task-manifest.json +0 -488
  118. package/docs/examples/full-design-blocked/changes/REQ-002-bulk-invite-import/review/report-card.json +0 -189
  119. package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/handoff/resume-index.md +0 -39
  120. package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/handoff/status.md +0 -29
  121. package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/planning/design.md +0 -123
  122. package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/planning/task-manifest.json +0 -292
  123. package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/review/report-card.json +0 -136
  124. package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/handoff/status.md +0 -29
  125. package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/planning/design.md +0 -124
  126. package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/planning/task-manifest.json +0 -292
  127. package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/review/report-card.json +0 -136
  128. package/docs/get-shit-done-strategy-audit.md +0 -518
  129. package/docs/skill-runtime-migration.md +0 -46
  130. package/lib/skill-runtime/__tests__/approve.test.js +0 -92
  131. package/lib/skill-runtime/__tests__/autopilot.test.js +0 -253
  132. package/lib/skill-runtime/__tests__/benchmark-artifacts.test.js +0 -165
  133. package/lib/skill-runtime/__tests__/delegation.test.js +0 -97
  134. package/lib/skill-runtime/__tests__/dispatch.test.js +0 -237
  135. package/lib/skill-runtime/__tests__/intent.test.js +0 -203
  136. package/lib/skill-runtime/__tests__/lifecycle.test.js +0 -169
  137. package/lib/skill-runtime/__tests__/planner.tdd.test.js +0 -331
  138. package/lib/skill-runtime/__tests__/prepare-pr.test.js +0 -126
  139. package/lib/skill-runtime/__tests__/query.test.js +0 -860
  140. package/lib/skill-runtime/__tests__/readiness.test.js +0 -53
  141. package/lib/skill-runtime/__tests__/release.test.js +0 -85
  142. package/lib/skill-runtime/__tests__/review-check-integration.test.js +0 -148
  143. package/lib/skill-runtime/__tests__/review-records.test.js +0 -619
  144. package/lib/skill-runtime/__tests__/runtime.integration.test.js +0 -351
  145. package/lib/skill-runtime/__tests__/schemas.test.js +0 -337
  146. package/lib/skill-runtime/__tests__/task-contract-migrate.test.js +0 -137
  147. package/lib/skill-runtime/__tests__/task-contract.test.js +0 -874
  148. package/lib/skill-runtime/__tests__/team-state.test.js +0 -51
  149. package/lib/skill-runtime/__tests__/verify-artifacts.test.js +0 -203
  150. package/lib/skill-runtime/__tests__/worker-run.test.js +0 -275
  151. package/lib/skill-runtime/__tests__/worker.test.js +0 -56
  152. package/lib/skill-runtime/__tests__/workflow-context-legacy-fallback.test.js +0 -31
  153. package/lib/skill-runtime/__tests__/workflow-context.test.js +0 -98
  154. package/lib/skill-runtime/artifacts.js +0 -88
  155. package/lib/skill-runtime/context-index.js +0 -545
  156. package/lib/skill-runtime/delegation.js +0 -533
  157. package/lib/skill-runtime/intent.js +0 -309
  158. package/lib/skill-runtime/lifecycle.js +0 -294
  159. package/lib/skill-runtime/operations/CLAUDE.md +0 -19
  160. package/lib/skill-runtime/operations/approve.js +0 -81
  161. package/lib/skill-runtime/operations/autopilot-core.js +0 -337
  162. package/lib/skill-runtime/operations/autopilot-execution.js +0 -307
  163. package/lib/skill-runtime/operations/autopilot-shared.js +0 -48
  164. package/lib/skill-runtime/operations/autopilot.js +0 -163
  165. package/lib/skill-runtime/operations/dispatch.js +0 -416
  166. package/lib/skill-runtime/operations/init.js +0 -60
  167. package/lib/skill-runtime/operations/janitor.js +0 -61
  168. package/lib/skill-runtime/operations/plan.js +0 -59
  169. package/lib/skill-runtime/operations/prepare-pr.js +0 -25
  170. package/lib/skill-runtime/operations/release.js +0 -99
  171. package/lib/skill-runtime/operations/resume.js +0 -126
  172. package/lib/skill-runtime/operations/review-records.js +0 -265
  173. package/lib/skill-runtime/operations/snapshot.js +0 -45
  174. package/lib/skill-runtime/operations/task-contract.js +0 -593
  175. package/lib/skill-runtime/operations/verify.js +0 -170
  176. package/lib/skill-runtime/operations/worker-run.js +0 -531
  177. package/lib/skill-runtime/operations/worker.js +0 -33
  178. package/lib/skill-runtime/planner.js +0 -539
  179. package/lib/skill-runtime/readiness.js +0 -84
  180. package/lib/skill-runtime/review-records.js +0 -123
  181. package/lib/skill-runtime/review.js +0 -855
  182. package/lib/skill-runtime/schemas.js +0 -746
  183. package/lib/skill-runtime/task-contract.js +0 -188
  184. package/lib/skill-runtime/team-state.js +0 -122
  185. package/lib/skill-runtime/workflow-context.js +0 -748
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: cc-plan
3
- version: 3.9.2
3
+ version: 3.10.1
4
4
  description: Use when a requirement, roadmap item, or bug needs scope clarification, design decisions, and executable task breakdown before coding starts.
5
5
  triggers:
6
6
  - 帮我规划这个需求
@@ -13,51 +13,34 @@ triggers:
13
13
  reads:
14
14
  - PLAYBOOK.md
15
15
  - assets/TASKS_TEMPLATE.md
16
- - assets/TASK_MANIFEST_TEMPLATE.json
17
16
  - references/planning-contract.md
18
- - ../cc-do/scripts/select-ready-tasks.sh
19
- - ../cc-do/scripts/mark-task-complete.sh
17
+ - ../cc-dev/scripts/resolve-cc-devflow.sh
20
18
  - ../cc-roadmap/scripts/locate-roadmap-item.sh
21
19
  - ../cc-roadmap/scripts/sync-roadmap-progress.sh
22
20
  writes:
23
- - path: devflow/changes/<change-key>/planning/tasks.md
24
- durability: durable
25
- required: true
26
- - path: devflow/changes/<change-key>/planning/task-manifest.json
27
- durability: durable
28
- required: true
29
- - path: devflow/changes/<change-key>/change-meta.json
21
+ - path: devflow/changes/<change-key>/task.md
30
22
  durability: durable
31
23
  required: true
32
24
  effects:
33
- - source roadmap progress sync when planning freezes, splits, or reroutes
25
+ - roadmap progress sync when a source item exists
26
+ - Git commit after the Plan stage is complete
34
27
  entry_gate:
35
- - Treat the ask as a requirement plan, not project strategy; reroute broad product direction to roadmap.
36
- - State assumptions and competing interpretations before choosing a plan; ask only when the answer changes scope, design, or verification.
37
- - Read only enough repo evidence to classify the plan, then expand through explicit escalation packs instead of loading every planning reference.
38
- - Assign a canonical REQ/FIX change key with `cc-devflow next-change-key` before durable artifacts are written.
39
- - "Enforce the Worktree Branch Contract immediately after the change key exists: detached worktrees bind to `REQ/<task>` or `FIX/<task>`, default branches stop as setup blockers."
40
- - Default to `tiny-design`; escalate to `full-design` only for cross-module, state/data/interface, migration, security, rollback, or high-ambiguity work.
41
- - Ask at most one blocking decision at a time, using the fixed D<N> Decision Question Protocol when the answer changes design or task boundaries.
42
- - Compare minimal viable and ideal architecture for non-trivial plans, but do not force that comparison for obvious tiny-design patches.
43
- - "Keep machine records CLI-owned: `task-manifest.json` and `change-meta.json` must be generated or refreshed by `cc-devflow task-contract compile`, not handwritten by the AI."
44
- - Generate durable artifacts only after the recommended design is approved.
45
- - Before exit, sync or explicitly no-op the source roadmap item.
28
+ - Resolve the CLI with `../cc-dev/scripts/resolve-cc-devflow.sh require query workflow-context next-change-key config` before workflow commands.
29
+ - Assign a canonical REQ/FIX change key through `next-change-key` before writing `task.md`.
30
+ - Enforce the Worktree Branch Contract immediately after the change key exists.
31
+ - Read only the repo evidence needed to decide scope, existing leverage, task boundaries, and verification.
32
+ - Ask only when the answer changes scope, design, implementation boundary, or verification.
46
33
  exit_criteria:
47
- - "`planning/tasks.md#Contract Summary` states the approved solution, boundaries, frozen decisions, verification expectations, and any open assumptions."
48
- - "`planning/tasks.md` contains executable task blocks generated from `assets/TASKS_TEMPLATE.md`, including the script-based completion protocol."
49
- - "`planning/task-manifest.json` and `change-meta.json` were generated or refreshed by `cc-devflow task-contract compile`, then validated."
50
- - "`cc-devflow query workflow-context --compact` can route the next stage and name the next task."
51
- - "The only normal next step is `cc-do`; unresolved WHAT/WHY ambiguity reroutes or blocks instead of leaking into execution."
34
+ - "`task.md#Contract Summary` states the approved solution, non-goals, frozen decisions, work branch, verification expectations, and open assumptions."
35
+ - "`task.md` contains executable task blocks generated from `assets/TASKS_TEMPLATE.md`."
36
+ - "No process file is created beyond `task.md`."
37
+ - "Source roadmap progress is synced or explicitly skipped in the final response."
38
+ - "Plan-stage changes are committed to Git before handing off to `cc-do`."
52
39
  reroutes:
53
- - when: The discussion is still about project direction or stage order instead of one requirement.
40
+ - when: The discussion is still project direction or stage order instead of one requirement.
54
41
  target: roadmap
55
- - when: The plan is already approved and tasks are already frozen.
42
+ - when: The plan is already approved and tasks are frozen.
56
43
  target: cc-do
57
- recovery_modes:
58
- - name: re-open-design
59
- when: Execution feedback, review findings, or user correction invalidates the current design contract.
60
- action: Return to planning/tasks.md#Contract Summary, reopen the approved decision explicitly, then rerun CLI generation only after the contract is stable again.
61
44
  tool_budget:
62
45
  read_files: 8
63
46
  search_steps: 5
@@ -66,278 +49,45 @@ tool_budget:
66
49
 
67
50
  # CC-Plan
68
51
 
69
- > [PROTOCOL]: 变更时同步更新 `version`、`CHANGELOG.md`、相关模板/脚本引用,必要时写 migration note,然后检查 `CLAUDE.md`
70
-
71
- ## Role
72
-
73
- `cc-plan` 是 PDCA 里的 `Plan`。它把一个明确 requirement 压成最少但足够强的执行合同,让 `cc-do` 不需要继承当前聊天上下文也能继续。
74
-
75
- 它不是完整产品路线图,不写生产代码,也不制造规划文档农场。
76
-
77
- ## Thin Harness Rule
78
-
79
- 默认相信顶级模型的工程判断。Harness 只做三件事:
80
-
81
- 1. 防止并发开发写错分支、写错真相源、跳过验证。
82
- 2. 把关键决策落到可恢复 artifact,而不是留在聊天里。
83
- 3. 在复杂度真的出现时才打开深层检查。
84
- 4. 机器态 JSON 必须由 CLI / 模板生成或更新,AI 不手写过程 JSON。
85
-
86
- 不要为了“流程完整”读取所有 reference。先用本文件闭合常规路径;只有触发升级条件时,才打开 `PLAYBOOK.md` 或 `references/planning-contract.md` 的对应段落。
87
-
88
- ## Harness Contract
89
-
90
- - Allowed actions: clarify scope, compare approaches, freeze decisions, write the 3 default planning artifacts, and sync or no-op the source roadmap item.
91
- - Forbidden actions: production code, extra planning side-docs, task generation before approval, or default-loading every deep planning reference.
92
- - Required evidence: decisions, task boundaries, work branch, and verification commands point to repo facts or explicit user approval.
93
- - Reroute rule: broad strategy returns to `roadmap`; already frozen work goes to `cc-do`.
94
-
95
- ## Planning Discipline
96
-
97
- - Prefer the smallest reversible scope; if a simpler plan solves the requirement, push back on broader work.
98
- - Do not add speculative features or single-use abstractions.
99
- - When repo patterns conflict, choose the newer or better-verified pattern and mark the other as cleanup, not a blended design.
100
- - Verification must encode the user's intent and why the behavior matters, not only implementation shape.
101
- - Deterministic numbering, routing, and JSON generation belong to CLI commands, not model judgment.
102
-
103
- ## Runtime Output Policy
104
-
105
- 写入任何 durable Markdown 或 JSON metadata 前,先运行:
106
-
107
- ```bash
108
- cc-devflow config resolve --format policy
109
- ```
110
-
111
- - `Output language` 是机器约束,`planning/tasks.md` 和 `change-meta.json` 必须记录并遵守。
112
- - `agent_preferences` 只影响表达方式,不覆盖 workflow 边界。
113
- - 配置解析失败时先修配置或报告阻塞,不用默认语言偷跑。
52
+ `cc-plan` PDCA `Plan`。它只产出一份 durable 任务合同:
114
53
 
115
- ## Read Lazily
54
+ - `devflow/changes/<change-key>/task.md`
116
55
 
117
- 启动时只读:
56
+ 不要生成额外过程文件或 JSON 文档。Git commit 是阶段历史,`task.md` 是任务真相。
118
57
 
119
- 1. 用户 objective / roadmap handoff / bug report
120
- 2. 当前 repo 指令:`CLAUDE.md` / `AGENTS.md` / README 中和本需求直接相关的部分
121
- 3. 相关代码、测试、docs 的最小证据集
122
- 4. `assets/TASKS_TEMPLATE.md` 和 `assets/TASK_MANIFEST_TEMPLATE.json`
58
+ ## Operating Contract
123
59
 
124
- 按需再读:
125
-
126
- - `PLAYBOOK.md`:需要完整计划剧本、review shape、设计模式判断时打开。
127
- - `references/planning-contract.md`:要校验 hard rules、task fields、review gate 时打开。
128
- - `docs/guides/project-postmortem.md`:只有仓库存在 `devflow/postmortems/`,且本需求匹配历史失败类时打开。
129
- - `../cc-do/scripts/*`:生成 completion command 或验证 ready-task 规则时打开。
130
- - `../cc-roadmap/scripts/*`:定位或回写 source RM 时打开。
131
-
132
- ## Change Key And Branch
133
-
134
- 新计划必须先分配 change key:
60
+ 1. 先用 resolver 找到当前仓库的 `cc-devflow`,并确认支持 `query workflow-context`、`next-change-key`、`config`。
61
+ 2. 用 `next-change-key --prefix REQ|FIX --description "..."` 生成 `changeId` 和完整 `changeKey`,不要手动扫描编号。
62
+ 3. 分配 change key 后立刻锚定分支:`REQ-003-copy-link` 对应 `REQ/003-copy-link`,`FIX-014-auth-race` 对应 `FIX/014-auth-race`。当前在 default branch 时停止并报告 setup blocker。
63
+ 4. `task.md` 前先确认方案。tiny 计划仍要被批准,只是更短。
64
+ 5. `task.md` 必须包含 `Contract Summary`、任务列表、验证命令、完成证据、禁止重决策事项和阶段 commit 要求。
65
+ 6. 完成 Plan 后提交 Git commit。下一阶段从 Git history 和 `task.md` 恢复,不靠过程文件。
135
66
 
136
67
  ```bash
137
- cc-devflow next-change-key --prefix REQ --description "short feature name"
68
+ DEVFLOW=".claude/skills/cc-dev/scripts/resolve-cc-devflow.sh"
69
+ bash "$DEVFLOW" config resolve --format policy
138
70
  ```
139
71
 
140
- bug / regression 用 `--prefix FIX`。脚本输出两行:`changeId` 和完整 `changeKey`。直接使用输出,不手动扫描、不心算编号。
141
-
142
- 分支锚定规则:
143
-
144
- 1. `REQ-003-copy-link` 对应 `REQ/003-copy-link`。
145
- 2. `FIX-014-auth-race` 对应 `FIX/014-auth-race`。
146
- 3. 当前 detached 时,立刻 `git switch -c <canonical-work-branch>`。
147
- 4. 当前是 `main` / `master` / default branch 时停止,报告 setup blocker。
148
- 5. 当前是其它分支时,只有它已明确绑定同一个 change key 才继续。
149
-
150
- `planning/tasks.md` 和 `change-meta.json` 必须记录 work branch。
151
-
152
- ## Machine Artifact Rule
153
-
154
- AI 只手写默认人类合同:`planning/tasks.md#Contract Summary` 和后面的 task blocks。
155
-
156
- 机器态文件必须由命令生成或更新:
157
-
158
- ```bash
159
- cc-devflow task-contract compile --change <changeId> --change-key <changeKey>
160
- cc-devflow task-contract validate --change <changeId> --change-key <changeKey>
161
- ```
162
-
163
- 硬规则:
164
-
165
- - 不手写 `planning/task-manifest.json`。
166
- - 不手写 `change-meta.json`。
167
- - 不生成 `planning/design.md`、`planning/analysis.md`、task `context.md`、`checkpoint.json`、review Markdown 或其它 AI 手写过程文件。
168
- - 需要修机器态结构时,改 CLI / 模板 / validator,再重新生成;不要在项目 change 目录里补 JSON。
169
- - legacy `planning/design.md` / `planning/analysis.md` 只能作为读取或 migration 输入。
170
-
171
- ## Density Switch
172
-
173
- 先决定计划密度,再写计划。
174
-
175
- `tiny-design` 是默认:
176
-
177
- - 单一功能点
178
- - 通常触达 1-3 个文件
179
- - 不涉及 migration、权限、安全、复杂状态流或高代价回滚
180
- - 执行者看完冻结卡片即可落地
181
-
182
- `full-design` 只在这些条件出现时升级:
183
-
184
- - 跨模块协调或多阶段落地
185
- - 新增/改变接口、数据字段、状态机、迁移或兼容性
186
- - 安全、权限、计费、同步一致性、发布物分发等高代价边界
187
- - 不先讲清边界就会逼 `cc-do` 二次设计
188
-
189
- `tiny-design` 仍然需要批准;它删的是冗长文档,不是删设计。
72
+ ## Planning Standard
190
73
 
191
- ## Planning Loop
192
-
193
- 1. **Frame**:确认对象是一个 requirement,写清问题、非目标、成功信号和验证方式。
194
- 2. **Evidence**:用 repo 证据确认现有实现、测试框架、复用点和限制;证据不足写 assumption。
195
- 3. **Decide Density**:默认 tiny,满足升级条件才 full。
196
- 4. **Compare Options**:非 trivial 计划至少比较 `minimal viable` 与 `ideal architecture`;明显 tiny patch 可直接给推荐并说明排除项。
197
- 5. **Ask Only If Blocking**:用户答案会改变设计、任务或交付边界时才问;一次只问一个。
198
- 6. **Approve**:推荐方案获批前不写执行 task blocks。
199
- 7. **Freeze Tasks**:写稳 `planning/tasks.md#Contract Summary` 和 task blocks。
200
- 8. **Compile**:运行 `cc-devflow task-contract compile` 生成/刷新 manifest 和 meta,再 validate。
201
- 9. **Sync Roadmap**:source RM 存在就回写;不存在就记录 no-op reason。
202
-
203
- ## Decision Questions
204
-
205
- 只在这些 gate 问用户:
206
-
207
- - `planning-mode`:tiny/full/design route 无法由证据决定
208
- - `ambiguity-blocker`:WHAT/WHY 缺口会改变任务
209
- - `approach-approval`:需要批准方案
210
- - `external-best-practice`:外部资料可能改变设计或验证
211
- - `taste-or-user-challenge`:推荐方案挑战用户原方向
212
- - `final-design-approval`:准备冻结执行任务
213
-
214
- 格式固定:
215
-
216
- ```text
217
- D<N> - <decision title>
218
- Planning object: <REQ/FIX/RM id, branch, or change key>
219
- Known evidence: <repo / roadmap / code / test facts>
220
- Decision needed: <what this changes downstream>
221
- Recommendation: <A/B/C> because <one concrete reason>
222
- Completeness: A=<score>/10, B=<score>/10, C=<score>/10
223
- Options:
224
- A) <label> (recommended)
225
- Good: <concrete upside>
226
- Cost/Risk: <honest cost or what it leaves out>
227
- B) <label>
228
- Good: <concrete upside>
229
- Cost/Risk: <honest cost or what it leaves out>
230
- Impact: <what cc-do will do differently>
231
- STOP: wait for the user answer before continuing.
232
- ```
233
-
234
- 选项必须是 `A/B/C`,不能用 `1/2/3`。机械选择可以 auto-decide,但必须写进 `Decision Questions` 记录。
235
-
236
- ## Output Model
237
-
238
- 默认只允许 3 个主文件:
239
-
240
- 1. `planning/tasks.md`
241
- - 唯一默认 human-authored Markdown
242
- - `## Contract Summary` 放批准方案、边界、冻结决策、验证、review 结论
243
- - task blocks 放执行步骤和 completion command
244
- 2. `planning/task-manifest.json`
245
- - CLI 生成的执行图真相源
246
- - 保留 `currentTaskId`、依赖、触点、命令、验证、证据和 review 状态
247
- - 不复制 PRD、review prose、source-trust prose、completion shell 命令、roadmap progress 或 spec sync 状态
248
- 3. `change-meta.json`
249
- - CLI 生成/更新的 capability/spec sync、source RM、roadmap sync、work branch metadata
250
-
251
- 新计划默认不写:
252
-
253
- - `planning/design.md`
254
- - `planning/analysis.md`
255
- - `BRAINSTORM.md`
256
- - `PLAN_REVIEW.md`
257
- - `context-package.md`
258
- - `handoff/resume-index.md`
259
- - AI 手写的 `execution/tasks/<task-id>/context.md` 或 `checkpoint.json`
260
-
261
- 历史文件只能作为 legacy fallback 读取;有效内容吸收进 `planning/tasks.md#Contract Summary`。
262
-
263
- ## Progressive Disclosure
264
-
265
- `planning/tasks.md` 第一屏必须能回答:做什么、不做什么、为什么现在做、当前批准状态、下一步读哪个 task。
266
-
267
- 后续阶段默认从这里恢复:
268
-
269
- ```bash
270
- cc-devflow query workflow-context --change <changeId> --change-key <changeKey> --cwd <repo-root> --data-only --no-trace --compact
271
- ```
272
-
273
- `workflow-context` 是 context index,不是语义裁决者。它负责路由和打开引用;源 artifact 负责事实裁决。
274
-
275
- ## Task Contract
276
-
277
- 行为变更默认测试先行:
278
-
279
- ```text
280
- [TEST] Red -> [IMPL] Green -> [REFACTOR] cleanup
281
- ```
282
-
283
- 每个 task 至少写清:
284
-
285
- - Goal
286
- - TDD phase 或 exception
287
- - Files / touches
288
- - Read first
289
- - Verification
290
- - Evidence
291
- - Public test seam 或替代验证
292
- - Mock boundary
293
- - Completion command
294
-
295
- 完成命令必须调用 `mark-task-complete.sh`,禁止手工勾 checkbox 或只改 manifest:
296
-
297
- ```bash
298
- SCRIPT_ROOT=".claude/skills/cc-do/scripts"
299
- if [[ ! -d "$SCRIPT_ROOT" && -d ".codex/skills/cc-do/scripts" ]]; then
300
- SCRIPT_ROOT=".codex/skills/cc-do/scripts"
301
- fi
302
- bash "$SCRIPT_ROOT/mark-task-complete.sh" --manifest devflow/changes/<change-key>/planning/task-manifest.json --tasks devflow/changes/<change-key>/planning/tasks.md --task <task-id>
303
- ```
304
-
305
- 纯文档、纯配置、纯生成文件、throwaway prototype 可以写 TDD exception,但必须写清替代验证。
306
-
307
- ## Escalation Packs
308
-
309
- 只在触发时打开深层规则:
310
-
311
- | Pack | Trigger | Open |
312
- | --- | --- | --- |
313
- | Deep Planning Funnel | 新接口、字段、状态流、多文件协作、需求仍模糊 | `PLAYBOOK.md#Planning Standard`, `references/planning-contract.md#Review Gate` |
314
- | AI Leverage Lens | 范围可能太小或太大,用户担心 AI 被流程绑住 | `PLAYBOOK.md#Core Rules`, `references/planning-contract.md#Decision Log` |
315
- | External Best Practice | 新平台、外部 API、安全、分发、性能、UI/DX 且 repo 无先例 | `references/planning-contract.md#Decision Question Fields` |
316
- | Postmortem Recall | `devflow/postmortems/` 存在且匹配模块/失败类 | `docs/guides/project-postmortem.md` |
317
- | Full Engineering Review | 跨模块、高风险、实现者会二次设计 | `PLAYBOOK.md#Review Shape` |
318
- | UI/DX Review | UI / API / CLI / operator-facing scope | `PLAYBOOK.md#Planning Standard` |
319
-
320
- 如果没有触发条件,不要打开这些包。
321
-
322
- ## Roadmap Sync
323
-
324
- 退出前定位 source RM:
325
-
326
- ```bash
327
- bash .claude/skills/cc-roadmap/scripts/locate-roadmap-item.sh --id <RM-or-REQ>
328
- ```
74
+ - 用最小可逆方案解决真实需求,不扩张到假想未来。
75
+ - 缺证据就写 assumption,不伪装成事实。
76
+ - trivial 方案比较 `minimal viable` 和 `ideal architecture`,但推荐必须落到当前仓库可执行边界。
77
+ - 行为变更任务按 tracer bullet 写:`[TEST] -> [IMPL] -> [REFACTOR]`,不要水平切层。
78
+ - 每个任务写清目标、文件、依赖、TDD phase、读什么、怎么验证、完成证据。
79
+ - 回归测试不能 defer;缺 seam 时先计划 spike 或设计修正。
329
80
 
330
- source RM 存在时,用 roadmap sync 脚本回写 `devflow/roadmap.json` 并重新生成投影。找不到 source RM 时,在 `planning/tasks.md#Contract Summary` 和 `change-meta.json.roadmapSync` 记录 `no-source-rm`。
81
+ ## Required Output
331
82
 
332
- ## Exit Rule
83
+ `task.md` 的结构由 `assets/TASKS_TEMPLATE.md` 提供。模板外只允许补充对当前需求必要的事实,不允许新建额外过程文件。
333
84
 
334
- 计划合格的标准很简单:
85
+ ## Handoff
335
86
 
336
- - 范围边界清楚
337
- - 推荐方案已批准
338
- - 任务顺序和验证方式没有歧义
339
- - machine artifacts 由 CLI 生成并通过 validate
340
- - `workflow-context --compact` 能恢复下一步
341
- - `cc-do` 不需要靠聊天记忆补设计
87
+ 退出时只说清:
342
88
 
343
- 如果执行者还要猜“碰哪些文件、为什么这么改、先写什么失败测试”,计划没完成。
89
+ - change key 和分支
90
+ - `task.md` 路径
91
+ - 已运行或跳过的验证
92
+ - Plan commit hash
93
+ - 下一步 `cc-do`