cc-devflow 4.5.10 → 4.5.11

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 (45) hide show
  1. package/.claude/skills/cc-act/CHANGELOG.md +5 -0
  2. package/.claude/skills/cc-act/SKILL.md +9 -2
  3. package/.claude/skills/cc-check/CHANGELOG.md +6 -0
  4. package/.claude/skills/cc-check/SKILL.md +9 -7
  5. package/.claude/skills/cc-dev/CHANGELOG.md +5 -0
  6. package/.claude/skills/cc-dev/SKILL.md +9 -2
  7. package/.claude/skills/cc-do/CHANGELOG.md +6 -0
  8. package/.claude/skills/cc-do/SKILL.md +16 -7
  9. package/.claude/skills/cc-investigate/CHANGELOG.md +7 -0
  10. package/.claude/skills/cc-investigate/PLAYBOOK.md +4 -4
  11. package/.claude/skills/cc-investigate/SKILL.md +160 -426
  12. package/.claude/skills/cc-investigate/assets/TASKS_TEMPLATE.md +8 -5
  13. package/.claude/skills/cc-investigate/assets/TASK_MANIFEST_TEMPLATE.json +3 -4
  14. package/.claude/skills/cc-investigate/references/investigation-contract.md +3 -2
  15. package/.claude/skills/cc-plan/CHANGELOG.md +13 -0
  16. package/.claude/skills/cc-plan/SKILL.md +197 -540
  17. package/.claude/skills/cc-plan/assets/TASKS_TEMPLATE.md +3 -0
  18. package/.claude/skills/cc-plan/assets/TASK_MANIFEST_TEMPLATE.json +2 -3
  19. package/.claude/skills/cc-plan/references/planning-contract.md +2 -1
  20. package/CHANGELOG.md +14 -0
  21. package/README.md +5 -3
  22. package/README.zh-CN.md +5 -3
  23. package/docs/examples/START-HERE.md +2 -1
  24. package/docs/examples/example-bindings.json +6 -6
  25. package/docs/examples/full-design-blocked/README.md +1 -1
  26. package/docs/examples/full-design-blocked/changes/REQ-002-bulk-invite-import/planning/design.md +1 -1
  27. package/docs/examples/full-design-blocked/changes/REQ-002-bulk-invite-import/planning/task-manifest.json +1 -1
  28. package/docs/examples/full-design-blocked/changes/REQ-002-bulk-invite-import/planning/tasks.md +1 -1
  29. package/docs/examples/local-handoff/README.md +1 -1
  30. package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/planning/design.md +1 -1
  31. package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/planning/task-manifest.json +1 -1
  32. package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/planning/tasks.md +1 -1
  33. package/docs/examples/pdca-loop/README.md +1 -1
  34. package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/planning/design.md +1 -1
  35. package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/planning/task-manifest.json +1 -1
  36. package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/planning/tasks.md +1 -1
  37. package/docs/guides/artifact-contract.md +4 -0
  38. package/docs/guides/getting-started.md +4 -3
  39. package/docs/guides/getting-started.zh-CN.md +4 -3
  40. package/docs/guides/minimize-artifacts.md +19 -5
  41. package/lib/skill-runtime/__tests__/benchmark-skills.test.js +109 -0
  42. package/lib/skill-runtime/__tests__/task-contract.test.js +92 -1
  43. package/lib/skill-runtime/operations/task-contract.js +75 -6
  44. package/lib/skill-runtime/task-contract.js +2 -1
  45. package/package.json +8 -7
@@ -18,6 +18,7 @@
18
18
  - Open for scheduling: `planning/task-manifest.json`, ready-task selector output, dependencies, touched files.
19
19
  - Open for parallel or ownership questions: Implementation Surface Map, Tracer Bullet Map.
20
20
  - Open for audit/recovery: Task Quality Bar, Git state, CLI logs, review/report-card.json.
21
+ - Machine JSON rule: after editing this file, run `cc-devflow task-contract compile --change <changeId> --change-key <changeKey>` and `cc-devflow task-contract validate --change <changeId> --change-key <changeKey>`; do not handwrite `task-manifest.json` or `change-meta.json`.
21
22
 
22
23
  ## Contract Summary
23
24
 
@@ -47,6 +48,8 @@ Risk / Escalate If:
47
48
  > This is the default human-authored planning contract. Do not create
48
49
  > `planning/design.md` for new changes unless the user explicitly requests a
49
50
  > legacy artifact or a migration requires preserving one.
51
+ > `task-manifest.json` and `change-meta.json` are generated by
52
+ > `cc-devflow task-contract compile`, not by manual AI JSON authoring.
50
53
 
51
54
  ## Execution Handoff
52
55
 
@@ -9,7 +9,7 @@
9
9
  "documentLanguage": ""
10
10
  },
11
11
  "planningMeta": {
12
- "reqPlanSkillVersion": "3.9.0",
12
+ "reqPlanSkillVersion": "3.9.2",
13
13
  "designVersion": "design.v1",
14
14
  "workBranch": "REQ/XXX-short-feature-name",
15
15
  "approvedAt": "2026-04-15T12:00:00.000Z",
@@ -133,7 +133,6 @@
133
133
  ],
134
134
  "context": {
135
135
  "readFiles": [
136
- "design.md",
137
136
  "tasks.md",
138
137
  "change-meta.json"
139
138
  ],
@@ -173,7 +172,7 @@
173
172
  ],
174
173
  "metadata": {
175
174
  "source": "tasks.md",
176
- "generatedBy": "skill:cc-plan",
175
+ "generatedBy": "cc-devflow task-contract",
177
176
  "planVersion": 1
178
177
  }
179
178
  }
@@ -2,11 +2,12 @@
2
2
 
3
3
  ## Hard Rules
4
4
 
5
- 1. `cc-plan` 默认只产出 3 个文件:`planning/tasks.md`、`planning/task-manifest.json`、`change-meta.json`。
5
+ 1. `cc-plan` 默认只产出 3 个文件:`planning/tasks.md`、CLI 生成的 `planning/task-manifest.json`、CLI 生成的 `change-meta.json`。
6
6
  2. clarification / brainstorm / review 结论必须并入 `planning/tasks.md#Contract Summary`,不能再默认拆 `planning/design.md` 或独立文档。
7
7
  3. 执行 handoff 必须写进 `planning/tasks.md` 顶部,不能依赖单独的 `context-package.md`。
8
8
  4. `planning/task-manifest.json` 必须和 `planning/tasks.md` 同步,且能告诉 `cc-do` 当前任务是谁。
9
9
  5. `planning/tasks.md`、`planning/task-manifest.json` 必须记录来源版本链。
10
+ 6. 机器态 JSON 必须由 `cc-devflow task-contract compile` / 模板 / validator 生成或更新;AI 不手写 `task-manifest.json` 或 `change-meta.json`。
10
11
  6. 所有 SKILL 输出必须遵守 `docs/guides/artifact-contract.md`:状态只能有一个 owner,其它文件只能引用、投影或派生。
11
12
  7. 计划里出现 placeholder 词,就说明还没想清楚。
12
13
  8. 一次只推进一个澄清问题,不允许问题轰炸。
package/CHANGELOG.md CHANGED
@@ -9,6 +9,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
 
10
10
  ## [Unreleased]
11
11
 
12
+ ## [4.5.11] - 2026-05-13
13
+
14
+ ### Added
15
+
16
+ - Added `npm run benchmark:skills` to keep public skill entrypoints under explicit context budgets.
17
+
18
+ ### Changed
19
+
20
+ - Slimmed the `cc-plan` public entrypoint into a thin harness contract and moved low-frequency planning/review rules behind conditional references.
21
+ - Slimmed the `cc-investigate` public entrypoint into a thin root-cause contract and moved low-frequency debug rules behind conditional references.
22
+ - Updated `cc-plan` and `cc-investigate` to require CLI-owned machine artifacts: agents write `planning/tasks.md`, then run `cc-devflow task-contract compile` / `validate` for `task-manifest.json` and `change-meta.json`.
23
+ - Internalized the new PDCA/IDCA operating principles into the stage skills themselves: assumptions and simplicity in plan/investigate, surgical read-before-write execution in do, fresh intent-focused proof in check, and explicit checkpoint/ship blockers in dev/act.
24
+ - Updated `npm run verify` to include `benchmark:skills` after tests, example binding checks, and artifact verification.
25
+
12
26
  ## [4.5.10] - 2026-05-13
13
27
 
14
28
  ### Added
package/README.md CHANGED
@@ -118,7 +118,7 @@ Canonical language and durable decisions stay inside cc-devflow-native sources:
118
118
 
119
119
  `cc-plan` freezes more implementation decisions before `cc-do` starts. Non-trivial plans compare minimal viable and ideal architecture options, full designs include decision horizon plus error/rescue mapping, and test-first plans record test framework evidence, public test seams, spec-style test names, public verification paths, behavior assertions, mock boundaries, coverage quality, mandatory regression tests, interface depth, Green minimality guards, refactor candidates, and vertical tracer-bullet slices when existing behavior changes. Before handoff, `cc-plan` and `cc-investigate` also reconcile the source roadmap item so RM status, REQ/FIX binding, progress, and spec diagnosis do not drift from the frozen change artifacts.
120
120
 
121
- Every post-planning stage can start from `cc-devflow query workflow-context --change <id> --change-key <key> --data-only --no-trace --compact`. Treat the result as a context index, not semantic compression: it routes the next stage, names the current task, carries source hashes, `mustNotForget` constraints, default section/JSON refs, trusted commands, fail-closed rules, and machine-readable deep-open conditions. Source artifacts still decide disputed facts. This primarily reduces stage-routing and context-reset reads; end-to-end PDCA/IDCA savings depend on how often agents open `defaultOpen` and `deepOpen` refs. Use `npm run benchmark:workflow-context` to inspect token estimates plus routing correctness over the checked-in and synthetic examples.
121
+ Every post-planning stage can start from `cc-devflow query workflow-context --change <id> --change-key <key> --data-only --no-trace --compact`. Treat the result as a context index, not semantic compression: it routes the next stage, names the current task, carries source hashes, `mustNotForget` constraints, default section/JSON refs, trusted commands, fail-closed rules, and machine-readable deep-open conditions. Source artifacts still decide disputed facts. This primarily reduces stage-routing and context-reset reads; end-to-end PDCA/IDCA savings depend on how often agents open `defaultOpen` and `deepOpen` refs. Use `npm run benchmark:workflow-context` to inspect token estimates plus routing correctness over the checked-in and synthetic examples. Use `npm run benchmark:skills` to keep public skill entrypoints thin; deeper planning rules should live behind conditional references instead of default context.
122
122
 
123
123
  `cc-review` is optional and deeper than `cc-check`. It can run immediately after `cc-plan` / `cc-investigate` to review the frozen plan or root-cause contract, or after `cc-do` to review the implementation. It reads prior review records and current git/artifact delta, then records review lifecycle events through `cc-devflow review start`, `record-node`, `add-finding`, and `close` into `review-ledger.jsonl`. Human Markdown reports are rendered on demand with `cc-devflow review render`. When the host supports subagents, selected nodes can be dispatched to independent read-only reviewers so strategy, engineering, design, DX, smell, test, and runtime checks do not share one contaminated context. Broad implementation reviews can use separate risk lanes for intent/regression, security/privacy, performance/reliability, and contracts/coverage before the main thread triages raw findings. Plan reviews borrow strategy/design/engineering/DX methods through progressive references, while implementation reviews inspect diff scope, code smells, tests, UI/runtime behavior, Browser/Computer Use evidence, and logs when applicable. Findings route back to `cc-plan` or `cc-do`; clean implementation reviews continue to `cc-check`.
124
124
 
@@ -244,9 +244,10 @@ The currently distributed skill folders are:
244
244
 
245
245
  - `devflow/specs/` stores durable capability truth: `INDEX.md` plus `capabilities/*.md`.
246
246
  - New change directories use `REQ-<number>-<description>` for requirements or `FIX-<number>-<description>` for bug fixes. `REQ` and `FIX` numbers advance independently, so the same number may exist in both prefixes. Parallel worktrees may also create repeated numbers; the full change key must use a specific description to distinguish the work.
247
- - `devflow/changes/<change>/` stores durable change truth: `change-meta.json`, `planning/tasks.md`, CLI-generated `task-manifest.json`, review ledger/findings records, optional CLI logs for debug/failure, `report-card.json`, and one final handoff file. Task `context.md`, `checkpoint.json`, review markdown, and AI-written process files are not default durable truth.
247
+ - `devflow/changes/<change>/` stores durable change truth: CLI-generated `change-meta.json`, `planning/tasks.md`, CLI-generated `task-manifest.json`, review ledger/findings records, optional CLI logs for debug/failure, `report-card.json`, and one final handoff file. Task `context.md`, `checkpoint.json`, review markdown, and AI-written process files are not default durable truth.
248
248
  - New changes default to one human-authored Markdown artifact: `planning/tasks.md`. Feature plans put the frozen design in `## Contract Summary`; bug investigations put root-cause truth in `## Root Cause Contract`. Legacy `planning/design.md`, `planning/analysis.md`, and `cc-review-*.md` remain fallback inputs, not new default writes.
249
- - Use `cc-devflow task-contract validate`, `npm run verify:artifacts`, and `npm run benchmark:artifacts` to keep workflow artifacts small and measurable.
249
+ - Machine JSON is CLI-owned: write the human contract in `planning/tasks.md`, then run `cc-devflow task-contract compile` / `validate`; do not handwrite `task-manifest.json` or `change-meta.json`.
250
+ - Use `cc-devflow task-contract validate`, `npm run verify:artifacts`, `npm run benchmark:artifacts`, and `npm run benchmark:skills` to keep workflow artifacts and skill entrypoints small and measurable.
250
251
  - `devflow/workspaces/<change>/` stores ephemeral runtime scratch such as worker assignment, journals, prompts, and session logs.
251
252
  - Regenerable files should not be persisted under `devflow/changes/`.
252
253
 
@@ -256,6 +257,7 @@ Artifact contract quick checks:
256
257
  npx cc-devflow task-contract validate --change REQ-001 --change-key REQ-001-copy-invite-link
257
258
  npm run verify:artifacts
258
259
  npm run benchmark:artifacts
260
+ npm run benchmark:skills
259
261
  ```
260
262
 
261
263
  For complete artifact examples, start with [`docs/examples/START-HERE.md`](./docs/examples/START-HERE.md). Example version bindings live in [`docs/examples/example-bindings.json`](./docs/examples/example-bindings.json). Migration and authoring guidance for the minimized artifact contract lives in [`docs/guides/minimize-artifacts.md`](./docs/guides/minimize-artifacts.md).
package/README.zh-CN.md CHANGED
@@ -118,7 +118,7 @@ Canonical language 和 durable decisions 只收敛到 cc-devflow 原生真相源
118
118
 
119
119
  `cc-plan` 会在 `cc-do` 开始前冻结更多实现决策。非 trivial 计划需要比较 minimal viable 和 ideal architecture,full-design 需要包含 implementation decision horizon 和 error/rescue map;测试计划要记录测试框架证据、public test seam、spec-style test name、public verification path、behavior assertion、mock boundary、覆盖质量、强制 regression test、interface depth、Green minimality guard、refactor candidates 和 vertical tracer-bullet slices。交接前,`cc-plan` 和 `cc-investigate` 还会校准 source roadmap item,让 RM 状态、REQ/FIX 绑定、progress 和 spec diagnosis 不再漂移。
120
120
 
121
- planning 之后的每个阶段都可以先运行 `cc-devflow query workflow-context --change <id> --change-key <key> --data-only --no-trace --compact`。把结果当成 context index,而不是语义压缩:它负责路由下一阶段、标记当前 task、携带 source hash、`mustNotForget` 约束、默认 section/JSON refs、可信命令、fail-closed 规则和机器可读 deep-open 条件;有争议的事实仍由源 artifact 裁决。它主要降低 stage-routing 和 context-reset 的读取成本;端到端 PDCA/IDCA 节省取决于 agent 实际打开多少 `defaultOpen` 和 `deepOpen` refs。可用 `npm run benchmark:workflow-context` 查看仓库示例和合成用例上的 token 估算与路由正确性。
121
+ planning 之后的每个阶段都可以先运行 `cc-devflow query workflow-context --change <id> --change-key <key> --data-only --no-trace --compact`。把结果当成 context index,而不是语义压缩:它负责路由下一阶段、标记当前 task、携带 source hash、`mustNotForget` 约束、默认 section/JSON refs、可信命令、fail-closed 规则和机器可读 deep-open 条件;有争议的事实仍由源 artifact 裁决。它主要降低 stage-routing 和 context-reset 的读取成本;端到端 PDCA/IDCA 节省取决于 agent 实际打开多少 `defaultOpen` 和 `deepOpen` refs。可用 `npm run benchmark:workflow-context` 查看仓库示例和合成用例上的 token 估算与路由正确性。用 `npm run benchmark:skills` 保持 public skill 入口足够薄;深层规划规则应该放在条件 reference 后面,而不是默认上下文里。
122
122
 
123
123
  `cc-review` 是可选的深度 Review,不替代 `cc-check`。它可以接在 `cc-plan` / `cc-investigate` 后审冻结的计划或根因合同,也可以接在 `cc-do` 后审实现。它先读取上次 Review 记录和当前 git/artifact delta,再通过 `cc-devflow review start`、`record-node`、`add-finding`、`close` 把生命周期事件写进 `review-ledger.jsonl`。需要人类 Markdown 报告时,再用 `cc-devflow review render` 按需渲染。宿主支持 subAgent 时,选中的节点可以派给独立只读 reviewer,让 strategy、engineering、design、DX、坏味道、测试和运行时审查不共享同一个被污染的上下文。复杂实现 Review 可以把 intent/regression、security/privacy、performance/reliability、contracts/coverage 拆成独立风险 lane,再由主线程聚合和筛掉弱 findings。计划 Review 通过渐进式 references 借鉴 strategy / design / engineering / DX 方法;实现 Review 检查 diff 范围、代码坏味道、测试、UI/runtime 行为、Browser/Computer Use 证据和日志。Finding 回到 `cc-plan` 或 `cc-do`;实现 Review 干净后再进入 `cc-check`。
124
124
 
@@ -244,9 +244,10 @@ npx cc-devflow config doctor --cwd /path/to/your/project
244
244
 
245
245
  - `devflow/specs/` 保存 durable capability truth:`INDEX.md` 和 `capabilities/*.md`。
246
246
  - 新 change 目录使用 `REQ-<number>-<description>` 表示需求,使用 `FIX-<number>-<description>` 表示 Bug 修复。`REQ` 和 `FIX` 各自递增自己的编号,跨前缀同号允许共存。并行工作树也可能产生重复编号,必须用完整 change key 的描述区分业务内容。
247
- - `devflow/changes/<change>/` 保存 durable change truth:`change-meta.json`、`planning/tasks.md`、CLI 生成的 `task-manifest.json`、review ledger / findings 记录、debug / failed 的可选 CLI 日志、`report-card.json` 和唯一最终 handoff 文件。任务级 `context.md`、`checkpoint.json`、review markdown 和 AI 手写过程文件不是默认 durable truth。
247
+ - `devflow/changes/<change>/` 保存 durable change truth:CLI 生成的 `change-meta.json`、`planning/tasks.md`、CLI 生成的 `task-manifest.json`、review ledger / findings 记录、debug / failed 的可选 CLI 日志、`report-card.json` 和唯一最终 handoff 文件。任务级 `context.md`、`checkpoint.json`、review markdown 和 AI 手写过程文件不是默认 durable truth。
248
248
  - 新 change 默认只有一个人工编写的 Markdown artifact:`planning/tasks.md`。功能计划把冻结设计写进 `## Contract Summary`;Bug 调查把根因真相写进 `## Root Cause Contract`。历史 `planning/design.md`、`planning/analysis.md` 和 `cc-review-*.md` 只作为旧 change 的 fallback 输入,不再是新默认写入。
249
- - `cc-devflow task-contract validate`、`npm run verify:artifacts` `npm run benchmark:artifacts` 保持 workflow artifact 小而可测。
249
+ - 机器态 JSON 归 CLI 所有:先把人类合同写进 `planning/tasks.md`,再运行 `cc-devflow task-contract compile` / `validate`;不要手写 `task-manifest.json` `change-meta.json`。
250
+ - 用 `cc-devflow task-contract validate`、`npm run verify:artifacts`、`npm run benchmark:artifacts` 和 `npm run benchmark:skills` 保持 workflow artifact 与 skill 入口小而可测。
250
251
  - `devflow/workspaces/<change>/` 保存 ephemeral runtime scratch,例如 worker assignment、journal、prompt 和 session log。
251
252
  - 能从 durable truth 再生成的文件,不应该持久化到 `devflow/changes/`。
252
253
 
@@ -256,6 +257,7 @@ Artifact contract 快速检查:
256
257
  npx cc-devflow task-contract validate --change REQ-001 --change-key REQ-001-copy-invite-link
257
258
  npm run verify:artifacts
258
259
  npm run benchmark:artifacts
260
+ npm run benchmark:skills
259
261
  ```
260
262
 
261
263
  想先看完整产物链,可以从 [`docs/examples/START-HERE.md`](./docs/examples/START-HERE.md) 开始。样例和 Skill 的版本绑定真相源在 [`docs/examples/example-bindings.json`](./docs/examples/example-bindings.json)。最小 artifact 合同的迁移与编写指南在 [`docs/guides/minimize-artifacts.md`](./docs/guides/minimize-artifacts.md)。
@@ -140,7 +140,8 @@ That should already tell you:
140
140
 
141
141
  `devflow/changes/<change>/` should stay lean.
142
142
 
143
- - Durable truth only: `change-meta.json`, `planning/tasks.md`, CLI-generated `task-manifest.json`, review ledger/findings records, optional CLI logs for debug/failure, `report-card.json`, and one final handoff file. Do not generate task `context.md`, `checkpoint.json`, or AI-written process files.
143
+ - Durable truth only: CLI-generated `change-meta.json`, `planning/tasks.md`, CLI-generated `task-manifest.json`, review ledger/findings records, optional CLI logs for debug/failure, `report-card.json`, and one final handoff file. Do not generate task `context.md`, `checkpoint.json`, or AI-written process files.
144
+ - Machine JSON is CLI-owned: run `cc-devflow task-contract compile` / `validate`; do not handwrite `task-manifest.json` or `change-meta.json`.
144
145
  - Legacy `planning/design.md`, `planning/analysis.md`, and `cc-review-*.md` are readable fallback inputs for older examples, not new default writes.
145
146
  - Runtime scratch belongs in `devflow/workspaces/<change>/`, not beside the durable record.
146
147
 
@@ -3,15 +3,15 @@
3
3
  "skills": {
4
4
  "cc-roadmap": "5.3.0",
5
5
  "cc-next": "1.0.1",
6
- "cc-dev": "1.0.1",
7
- "cc-plan": "3.9.0",
8
- "cc-investigate": "1.5.0",
9
- "cc-do": "1.6.7",
6
+ "cc-dev": "1.0.2",
7
+ "cc-plan": "3.9.2",
8
+ "cc-investigate": "1.5.1",
9
+ "cc-do": "1.6.8",
10
10
  "cc-review": "2.0.0",
11
11
  "cc-pr-review": "1.0.0",
12
12
  "cc-pr-land": "1.0.0",
13
- "cc-check": "1.11.1",
14
- "cc-act": "1.8.8",
13
+ "cc-check": "1.11.2",
14
+ "cc-act": "1.8.9",
15
15
  "cc-spec-init": "1.1.0"
16
16
  },
17
17
  "examples": [
@@ -4,7 +4,7 @@
4
4
 
5
5
  - Example version: `1.0.0`
6
6
  - Last reviewed: `2026-04-17`
7
- - Bound skills: `cc-roadmap@5.3.0`, `cc-plan@3.9.0`, `cc-do@1.6.7`, `cc-check@1.11.1`
7
+ - Bound skills: `cc-roadmap@5.3.0`, `cc-plan@3.9.2`, `cc-do@1.6.8`, `cc-check@1.11.2`
8
8
 
9
9
  This example shows a requirement that **looked executable**, but `cc-check` correctly stopped it and sent it back to `cc-plan`.
10
10
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  - Requirement version: `REQ-002.v2`
6
6
  - Design version: `design.v2`
7
- - CC-Plan skill version: `3.9.0`
7
+ - CC-Plan skill version: `3.9.2`
8
8
  - Work branch: `REQ/002-bulk-invite-import`
9
9
  - Requirement ID: `REQ-002`
10
10
  - Design mode: `full-design`
@@ -6,7 +6,7 @@
6
6
  "requirementId": "REQ-002",
7
7
  "requirementVersion": "REQ-002.v2",
8
8
  "planningMeta": {
9
- "reqPlanSkillVersion": "3.9.0",
9
+ "reqPlanSkillVersion": "3.9.2",
10
10
  "designVersion": "design.v2",
11
11
  "workBranch": "REQ/002-bulk-invite-import",
12
12
  "approvedAt": null,
@@ -4,7 +4,7 @@
4
4
 
5
5
  - Requirement version: `REQ-002.v2`
6
6
  - Design version: `design.v2`
7
- - CC-Plan skill version: `3.9.0`
7
+ - CC-Plan skill version: `3.9.2`
8
8
  - Work branch: `REQ/002-bulk-invite-import`
9
9
  - Source roadmap item: `RM-010`
10
10
  - Source roadmap version: `roadmap.v2`
@@ -4,7 +4,7 @@
4
4
 
5
5
  - Example version: `1.0.0`
6
6
  - Last reviewed: `2026-04-17`
7
- - Bound skills: `cc-roadmap@5.3.0`, `cc-plan@3.9.0`, `cc-do@1.6.7`, `cc-check@1.11.1`, `cc-act@1.8.8`
7
+ - Bound skills: `cc-roadmap@5.3.0`, `cc-plan@3.9.2`, `cc-do@1.6.8`, `cc-check@1.11.2`, `cc-act@1.8.9`
8
8
 
9
9
  This example shows verified work that is **ready to move forward**, but `cc-act` still chooses `local-handoff`.
10
10
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  - Requirement version: `REQ-003.v1`
6
6
  - Design version: `design.v1`
7
- - CC-Plan skill version: `3.9.0`
7
+ - CC-Plan skill version: `3.9.2`
8
8
  - Work branch: `REQ/003-audit-log-export`
9
9
  - Requirement ID: `REQ-003`
10
10
  - Design mode: `tiny-design`
@@ -6,7 +6,7 @@
6
6
  "requirementId": "REQ-003",
7
7
  "requirementVersion": "REQ-003.v1",
8
8
  "planningMeta": {
9
- "reqPlanSkillVersion": "3.9.0",
9
+ "reqPlanSkillVersion": "3.9.2",
10
10
  "designVersion": "design.v1",
11
11
  "workBranch": "REQ/003-audit-log-export",
12
12
  "approvedAt": "2026-04-16T13:10:00.000Z",
@@ -4,7 +4,7 @@
4
4
 
5
5
  - Requirement version: `REQ-003.v1`
6
6
  - Design version: `design.v1`
7
- - CC-Plan skill version: `3.9.0`
7
+ - CC-Plan skill version: `3.9.2`
8
8
  - Work branch: `REQ/003-audit-log-export`
9
9
  - Source roadmap item: `RM-020`
10
10
  - Source roadmap version: `roadmap.v3`
@@ -4,7 +4,7 @@
4
4
 
5
5
  - Example version: `1.0.0`
6
6
  - Last reviewed: `2026-04-17`
7
- - Bound skills: `cc-roadmap@5.3.0`, `cc-plan@3.9.0`, `cc-do@1.6.7`, `cc-check@1.11.1`, `cc-act@1.8.8`
7
+ - Bound skills: `cc-roadmap@5.3.0`, `cc-plan@3.9.2`, `cc-do@1.6.8`, `cc-check@1.11.2`, `cc-act@1.8.9`
8
8
 
9
9
  This folder shows one minimal but complete `cc-roadmap -> cc-plan -> cc-do -> cc-check -> cc-act` loop.
10
10
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  - Requirement version: `REQ-001.v1`
6
6
  - Design version: `design.v1`
7
- - CC-Plan skill version: `3.9.0`
7
+ - CC-Plan skill version: `3.9.2`
8
8
  - Work branch: `REQ/001-copy-invite-link`
9
9
  - Requirement ID: `REQ-001`
10
10
  - Design mode: `tiny-design`
@@ -6,7 +6,7 @@
6
6
  "requirementId": "REQ-001",
7
7
  "requirementVersion": "REQ-001.v1",
8
8
  "planningMeta": {
9
- "reqPlanSkillVersion": "3.9.0",
9
+ "reqPlanSkillVersion": "3.9.2",
10
10
  "designVersion": "design.v1",
11
11
  "workBranch": "REQ/001-copy-invite-link",
12
12
  "approvedAt": "2026-04-15T10:05:00.000Z",
@@ -4,7 +4,7 @@
4
4
 
5
5
  - Requirement version: `REQ-001.v1`
6
6
  - Design version: `design.v1`
7
- - CC-Plan skill version: `3.9.0`
7
+ - CC-Plan skill version: `3.9.2`
8
8
  - Work branch: `REQ/001-copy-invite-link`
9
9
  - Source roadmap item: `RM-001`
10
10
  - Source roadmap version: `roadmap.v1`
@@ -1,6 +1,9 @@
1
1
  # Artifact Contract
2
2
 
3
3
  cc-devflow artifacts follow two rules: progressive disclosure and one state owner.
4
+ Machine JSON has a third rule: it is CLI-owned. Agents write the human contract
5
+ in `planning/tasks.md`, then run `cc-devflow task-contract compile` / `validate`;
6
+ they must not handwrite `task-manifest.json` or `change-meta.json`.
4
7
 
5
8
  ## Progressive Disclosure
6
9
 
@@ -32,6 +35,7 @@ If a field has no clear opener and no downstream consumer, remove it.
32
35
  - Derived fields must be described as derived/cache and must be recomputable.
33
36
  - A skill must not create a new status field unless it also names the owner, lifecycle, projection readers, and validation gate.
34
37
  - Task manifests must not duplicate PRD narrative, review-loop prose, source-trust details, completion shell commands, roadmap progress, or spec sync status.
38
+ - Task manifests and change metadata must be generated or refreshed by CLI/template tooling, not manually edited as process notes.
35
39
  - Project postmortems must cite stronger owner artifacts and Git evidence; they do not own roadmap progress, task status, review verdicts, or spec sync state.
36
40
 
37
41
  ## Required Check
@@ -87,8 +87,8 @@ Typical outputs:
87
87
 
88
88
  - `cc-roadmap` writes `devflow/roadmap.json` as the editable roadmap truth, then generates `devflow/ROADMAP.md` and deprecated `devflow/BACKLOG.md`
89
89
  - `cc-spec-init` writes `devflow/specs/INDEX.md`, capability specs, and `change-meta.json`
90
- - `cc-plan` writes `planning/tasks.md#Contract Summary`, CLI-generated `task-manifest.json`, and `change-meta.json`
91
- - `cc-investigate` writes `planning/tasks.md#Root Cause Contract`, CLI-generated `task-manifest.json`, and `change-meta.json`
90
+ - `cc-plan` writes `planning/tasks.md#Contract Summary`, then CLI-generates `task-manifest.json` and `change-meta.json`
91
+ - `cc-investigate` writes `planning/tasks.md#Root Cause Contract`, then CLI-generates `task-manifest.json` and `change-meta.json`
92
92
  - `cc-review` writes `review-ledger.jsonl`, optional `review-findings.json`, and Markdown reports only when rendered on demand
93
93
  - `cc-check` writes `report-card.json`
94
94
  - `cc-act` writes exactly one final handoff file: `handoff/pr-brief.md`, `handoff/resume-index.md`, or `handoff/release-note.md`
@@ -98,7 +98,8 @@ Change truth lives in `devflow/changes/<change>/`.
98
98
 
99
99
  - Keep `INDEX.md` plus capability markdown under `devflow/specs/`.
100
100
  - Name new change directories as `REQ-<number>-<description>` for requirements or `FIX-<number>-<description>` for bug fixes. `REQ` and `FIX` advance as separate local sequences, so cross-prefix duplicates are valid. Parallel worktrees may still repeat numbers; the full change key, especially the description, distinguishes the work. Old lowercase directories are compatibility reads only.
101
- - Keep `change-meta.json`, `planning/tasks.md`, CLI-generated `task-manifest.json`, review ledger/findings records, optional CLI logs for debug/failure, `report-card.json`, and one final handoff file under each `devflow/changes/<change>/`. Do not generate task `context.md`, `checkpoint.json`, or AI-written process files.
101
+ - Keep CLI-generated `change-meta.json`, `planning/tasks.md`, CLI-generated `task-manifest.json`, review ledger/findings records, optional CLI logs for debug/failure, `report-card.json`, and one final handoff file under each `devflow/changes/<change>/`. Do not generate task `context.md`, `checkpoint.json`, or AI-written process files.
102
+ - Machine JSON is CLI-owned: run `cc-devflow task-contract compile` / `validate`; do not handwrite `task-manifest.json` or `change-meta.json`.
102
103
  - Legacy `planning/design.md`, `planning/analysis.md`, and `cc-review-*.md` are readable fallback inputs for older changes, not new default writes.
103
104
  - Worker prompts, journals, assignments, and session logs belong under `devflow/workspaces/<change>/` as ephemeral scratch.
104
105
 
@@ -87,8 +87,8 @@ find .codex/skills -mindepth 2 -maxdepth 2 -name SKILL.md | sort
87
87
 
88
88
  - `cc-roadmap` 产出可编辑真相 `devflow/roadmap.json`,再生成 `devflow/ROADMAP.md` 和 deprecated `devflow/BACKLOG.md`
89
89
  - `cc-spec-init` 产出 `devflow/specs/INDEX.md`、capability spec 和 `change-meta.json`
90
- - `cc-plan` 产出 `planning/tasks.md#Contract Summary`、CLI 生成的 `task-manifest.json` 和 `change-meta.json`
91
- - `cc-investigate` 产出 `planning/tasks.md#Root Cause Contract`、CLI 生成的 `task-manifest.json` 和 `change-meta.json`
90
+ - `cc-plan` 产出 `planning/tasks.md#Contract Summary`,再由 CLI 生成 `task-manifest.json` 和 `change-meta.json`
91
+ - `cc-investigate` 产出 `planning/tasks.md#Root Cause Contract`,再由 CLI 生成 `task-manifest.json` 和 `change-meta.json`
92
92
  - `cc-review` 产出 `review-ledger.jsonl`、可选 `review-findings.json`,Markdown 报告只在需要时按需渲染
93
93
  - `cc-check` 产出 `report-card.json`
94
94
  - `cc-act` 只产出一个最终 handoff 文件:`handoff/pr-brief.md`、`handoff/resume-index.md` 或 `handoff/release-note.md`
@@ -97,7 +97,8 @@ durable truth 分两层:
97
97
 
98
98
  - `devflow/specs/`:capability 真相,保留 `INDEX.md` 与 `capabilities/*.md`
99
99
  - 新 change 目录必须命名为 `REQ-<number>-<description>`(需求)或 `FIX-<number>-<description>`(修复);`REQ` 和 `FIX` 分别维护自己的递增编号,跨前缀同号不是冲突;并行工作树造成重复编号时,完整 change key 的描述负责区分业务内容,旧小写目录只作为历史兼容读取。
100
- - `devflow/changes/<change>/`:变更真相,保留 `change-meta.json`、`planning/tasks.md`、CLI 生成的 `task-manifest.json`、review ledger / findings 记录、debug / failed 的可选 CLI 日志、`report-card.json` 和唯一的最终 handoff 文件。不要生成任务级 `context.md`、`checkpoint.json` 或 AI 手写过程文件。
100
+ - `devflow/changes/<change>/`:变更真相,保留 CLI 生成的 `change-meta.json`、`planning/tasks.md`、CLI 生成的 `task-manifest.json`、review ledger / findings 记录、debug / failed 的可选 CLI 日志、`report-card.json` 和唯一的最终 handoff 文件。不要生成任务级 `context.md`、`checkpoint.json` 或 AI 手写过程文件。
101
+ - 机器态 JSON 归 CLI 所有:运行 `cc-devflow task-contract compile` / `validate`;不要手写 `task-manifest.json` 或 `change-meta.json`。
101
102
  - 历史 `planning/design.md`、`planning/analysis.md` 和 `cc-review-*.md` 是旧 change 的可读 fallback,不再是新默认写入。
102
103
  - worker prompt、journal、assignment、session log 统一放到 `devflow/workspaces/<change>/`,作为 ephemeral scratch。
103
104
 
@@ -11,7 +11,7 @@ Default human-authored Markdown:
11
11
 
12
12
  - `planning/tasks.md`
13
13
 
14
- Default machine-owned records:
14
+ Default CLI-owned machine records:
15
15
 
16
16
  - `change-meta.json`
17
17
  - `planning/task-manifest.json`
@@ -34,8 +34,8 @@ Feature and scope changes use:
34
34
 
35
35
  `Contract Summary` owns the frozen human-readable plan: user story, non-negotiable
36
36
  constraints, decisions that must not be reopened, task slices, and verification
37
- expectations. The task manifest is generated or validated by CLI tooling and owns
38
- machine-readable task status.
37
+ expectations. `task-manifest.json` and `change-meta.json` must be generated or
38
+ updated by `cc-devflow task-contract compile`; agents must not handwrite them.
39
39
 
40
40
  ## Bug Investigations
41
41
 
@@ -48,6 +48,8 @@ Bug, regression, and unexpected-behavior work uses:
48
48
  `Root Cause Contract` owns the symptom, reproduction evidence, confirmed cause,
49
49
  rejected near-causes, repair boundary, and task handoff. `cc-do` should implement
50
50
  from that frozen contract instead of reopening investigation during execution.
51
+ `task-manifest.json` and `change-meta.json` must be generated or updated by
52
+ `cc-devflow task-contract compile`; agents must not handwrite them.
51
53
 
52
54
  ## Review Records
53
55
 
@@ -90,6 +92,7 @@ them by default. When migrating old work, fold feature-plan truth into
90
92
  Validate one change:
91
93
 
92
94
  ```bash
95
+ npx cc-devflow task-contract compile --change REQ-001 --change-key REQ-001-copy-invite-link
93
96
  npx cc-devflow task-contract validate --change REQ-001 --change-key REQ-001-copy-invite-link
94
97
  ```
95
98
 
@@ -111,6 +114,16 @@ The package-level verification command also includes artifact validation:
111
114
  npm run verify
112
115
  ```
113
116
 
117
+ Skill entrypoints have a separate context budget:
118
+
119
+ ```bash
120
+ npm run benchmark:skills
121
+ ```
122
+
123
+ Keep `SKILL.md` files as thin entry contracts. Move low-frequency planning,
124
+ review, and recovery details behind `PLAYBOOK.md` or `references/*` so agents
125
+ open them only when the matching escalation condition appears.
126
+
114
127
  ## Authoring Rule
115
128
 
116
129
  Before adding a durable file under `devflow/changes/<change-key>/`, answer:
@@ -119,5 +132,6 @@ Before adding a durable file under `devflow/changes/<change-key>/`, answer:
119
132
  2. Which state does it own that no existing artifact owns?
120
133
  3. Which command fails if it drifts?
121
134
 
122
- If those answers are unclear, keep the information in `planning/tasks.md`, a
123
- machine record, or ephemeral workspace scratch instead.
135
+ If those answers are unclear, keep the information in `planning/tasks.md` or
136
+ ephemeral workspace scratch. Machine JSON belongs to the CLI/compiler path, not
137
+ manual agent authoring.
@@ -0,0 +1,109 @@
1
+ /**
2
+ * [INPUT]: 依赖 scripts/benchmark-skills.js 导出的 runBenchmarkSkills 和临时 skill fixture。
3
+ * [OUTPUT]: 验证 benchmark:skills 对 SKILL.md 入口体积执行 byte/line 预算。
4
+ * [POS]: skill 入口瘦身基准的 Red/Green 证据。
5
+ * [PROTOCOL]: 变更时更新此头部,然后检查 CLAUDE.md
6
+ */
7
+
8
+ const fs = require('fs');
9
+ const os = require('os');
10
+ const path = require('path');
11
+ const { spawnSync } = require('child_process');
12
+
13
+ const { runBenchmarkSkills } = require('../../../scripts/benchmark-skills');
14
+
15
+ const REPO_ROOT = path.resolve(__dirname, '../../..');
16
+ const BENCHMARK_SCRIPT = path.join(REPO_ROOT, 'scripts', 'benchmark-skills.js');
17
+
18
+ function writeSkill(repoRoot, skillName, body) {
19
+ const filePath = path.join(repoRoot, '.claude', 'skills', skillName, 'SKILL.md');
20
+ fs.mkdirSync(path.dirname(filePath), { recursive: true });
21
+ fs.writeFileSync(filePath, body);
22
+ }
23
+
24
+ function skillBody({ version = '1.0.0', filler = '' } = {}) {
25
+ return [
26
+ '---',
27
+ 'name: cc-plan',
28
+ `version: ${version}`,
29
+ 'description: fixture',
30
+ '---',
31
+ '',
32
+ '# Fixture',
33
+ '',
34
+ 'Thin entrypoint.',
35
+ filler
36
+ ].join('\n');
37
+ }
38
+
39
+ function investigateSkillBody({ filler = '' } = {}) {
40
+ return skillBody().replace('name: cc-plan', 'name: cc-investigate') + filler;
41
+ }
42
+
43
+ describe('benchmark:skills', () => {
44
+ let repoRoot;
45
+
46
+ beforeEach(() => {
47
+ repoRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'cc-devflow-benchmark-skills-'));
48
+ });
49
+
50
+ afterEach(() => {
51
+ fs.rmSync(repoRoot, { recursive: true, force: true });
52
+ });
53
+
54
+ test('passes when cc-plan stays under the thin entrypoint budget', () => {
55
+ writeSkill(repoRoot, 'cc-plan', skillBody());
56
+
57
+ const result = runBenchmarkSkills(repoRoot);
58
+
59
+ expect(result.code).toBe(0);
60
+ expect(result.rows[0]).toMatchObject({
61
+ skill: 'cc-plan',
62
+ max_bytes: 16000,
63
+ max_lines: 360,
64
+ correctness_pass: true
65
+ });
66
+ });
67
+
68
+ test('passes when cc-investigate stays under the thin entrypoint budget', () => {
69
+ writeSkill(repoRoot, 'cc-investigate', investigateSkillBody());
70
+
71
+ const result = runBenchmarkSkills(repoRoot);
72
+
73
+ expect(result.rows[0]).toMatchObject({
74
+ skill: 'cc-investigate',
75
+ max_bytes: 16000,
76
+ max_lines: 360,
77
+ correctness_pass: true
78
+ });
79
+ });
80
+
81
+ test('exits 1 when cc-plan grows past the byte budget', () => {
82
+ writeSkill(repoRoot, 'cc-plan', skillBody({ filler: 'x'.repeat(17000) }));
83
+
84
+ const result = runBenchmarkSkills(repoRoot);
85
+
86
+ expect(result.code).toBe(1);
87
+ expect(result.rows[0]).toMatchObject({
88
+ skill: 'cc-plan',
89
+ correctness_pass: false,
90
+ note: 'skill entrypoint exceeds context budget'
91
+ });
92
+ });
93
+
94
+ test('CLI prints stdout JSON array', () => {
95
+ writeSkill(repoRoot, 'cc-plan', skillBody());
96
+
97
+ const result = spawnSync(process.execPath, [BENCHMARK_SCRIPT, repoRoot], { encoding: 'utf8' });
98
+ const rows = JSON.parse(result.stdout);
99
+
100
+ expect(result.status).toBe(0);
101
+ expect(Array.isArray(rows)).toBe(true);
102
+ expect(rows[0]).toHaveProperty('estimated_tokens');
103
+ });
104
+
105
+ test('package.json exposes npm run benchmark:skills', () => {
106
+ const pkg = JSON.parse(fs.readFileSync(path.join(REPO_ROOT, 'package.json'), 'utf8'));
107
+ expect(pkg.scripts['benchmark:skills']).toBe('node scripts/benchmark-skills.js');
108
+ });
109
+ });