cc-devflow 4.5.10 → 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 (187) hide show
  1. package/.claude/skills/cc-act/CHANGELOG.md +23 -0
  2. package/.claude/skills/cc-act/PLAYBOOK.md +17 -269
  3. package/.claude/skills/cc-act/SKILL.md +38 -418
  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 +24 -0
  15. package/.claude/skills/cc-check/PLAYBOOK.md +19 -273
  16. package/.claude/skills/cc-check/SKILL.md +33 -454
  17. package/.claude/skills/cc-check/references/review-contract.md +12 -147
  18. package/.claude/skills/cc-dev/CHANGELOG.md +20 -0
  19. package/.claude/skills/cc-dev/PLAYBOOK.md +1 -1
  20. package/.claude/skills/cc-dev/SKILL.md +52 -130
  21. package/.claude/skills/cc-dev/scripts/resolve-cc-devflow.sh +181 -0
  22. package/.claude/skills/cc-do/CHANGELOG.md +17 -0
  23. package/.claude/skills/cc-do/PLAYBOOK.md +19 -113
  24. package/.claude/skills/cc-do/SKILL.md +39 -236
  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 +23 -0
  31. package/.claude/skills/cc-investigate/PLAYBOOK.md +20 -180
  32. package/.claude/skills/cc-investigate/SKILL.md +65 -513
  33. package/.claude/skills/cc-investigate/assets/TASKS_TEMPLATE.md +48 -95
  34. package/.claude/skills/cc-investigate/references/investigation-contract.md +14 -217
  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 +29 -0
  39. package/.claude/skills/cc-plan/PLAYBOOK.md +22 -161
  40. package/.claude/skills/cc-plan/SKILL.md +47 -640
  41. package/.claude/skills/cc-plan/assets/TASKS_TEMPLATE.md +30 -225
  42. package/.claude/skills/cc-plan/references/planning-contract.md +24 -160
  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 +27 -0
  65. package/README.md +5 -3
  66. package/README.zh-CN.md +5 -3
  67. package/bin/cc-devflow-cli.js +20 -260
  68. package/bin/cc-devflow.js +44 -7
  69. package/docs/commands/README.md +1 -1
  70. package/docs/commands/README.zh-CN.md +1 -1
  71. package/docs/examples/README.md +1 -1
  72. package/docs/examples/START-HERE.md +14 -14
  73. package/docs/examples/example-bindings.json +11 -11
  74. package/docs/examples/full-design-blocked/README.md +4 -6
  75. package/docs/examples/full-design-blocked/changes/REQ-002-bulk-invite-import/{planning/tasks.md → task.md} +20 -15
  76. package/docs/examples/local-handoff/README.md +8 -11
  77. package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/handoff/pr-brief.md +31 -0
  78. package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/{planning/tasks.md → task.md} +18 -13
  79. package/docs/examples/pdca-loop/README.md +6 -9
  80. package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/handoff/pr-brief.md +9 -11
  81. package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/{planning/tasks.md → task.md} +18 -13
  82. package/docs/examples/scripts/check-example-bindings.sh +11 -62
  83. package/docs/guides/artifact-contract.md +10 -36
  84. package/docs/guides/getting-started.md +8 -7
  85. package/docs/guides/getting-started.zh-CN.md +8 -7
  86. package/docs/guides/minimize-artifacts.md +16 -116
  87. package/docs/guides/project-postmortem.md +14 -71
  88. package/lib/compiler/__tests__/skills-registry.test.js +9 -8
  89. package/lib/compiler/resource-copier.js +29 -0
  90. package/lib/skill-runtime/__tests__/archive-change.test.js +2 -2
  91. package/lib/skill-runtime/__tests__/benchmark-skills.test.js +109 -0
  92. package/lib/skill-runtime/__tests__/cli-bootstrap.integration.test.js +14 -4
  93. package/lib/skill-runtime/errors.js +3 -3
  94. package/lib/skill-runtime/index.js +5 -23
  95. package/lib/skill-runtime/paths.js +5 -52
  96. package/lib/skill-runtime/query-registry.js +4 -4
  97. package/lib/skill-runtime/query.js +89 -201
  98. package/lib/skill-runtime/store.js +4 -40
  99. package/lib/skill-runtime/trace.js +2 -2
  100. package/package.json +5 -7
  101. package/.claude/skills/cc-act/assets/PROJECT_POSTMORTEM_PRINCIPLES_TEMPLATE.md +0 -29
  102. package/.claude/skills/cc-act/assets/RELEASE_NOTE_TEMPLATE.md +0 -54
  103. package/.claude/skills/cc-act/scripts/generate-status-report.sh +0 -92
  104. package/.claude/skills/cc-act/scripts/sync-act-docs.sh +0 -355
  105. package/.claude/skills/cc-check/assets/REPORT_CARD_TEMPLATE.json +0 -234
  106. package/.claude/skills/cc-check/scripts/render-report-card.js +0 -438
  107. package/.claude/skills/cc-check/scripts/verify-gate.sh +0 -85
  108. package/.claude/skills/cc-do/scripts/build-task-context.sh +0 -175
  109. package/.claude/skills/cc-do/scripts/record-review-decision.sh +0 -88
  110. package/.claude/skills/cc-do/scripts/recover-workflow.sh +0 -82
  111. package/.claude/skills/cc-do/scripts/run-problem-analysis.sh +0 -70
  112. package/.claude/skills/cc-do/scripts/verify-task-gates.sh +0 -109
  113. package/.claude/skills/cc-do/scripts/write-task-checkpoint.sh +0 -92
  114. package/.claude/skills/cc-investigate/assets/TASK_MANIFEST_TEMPLATE.json +0 -225
  115. package/.claude/skills/cc-plan/assets/TASK_MANIFEST_TEMPLATE.json +0 -179
  116. package/.claude/skills/cc-spec-init/assets/CHANGE_META_TEMPLATE.json +0 -28
  117. package/.claude/skills/cc-spec-init/scripts/validate-spec-links.sh +0 -45
  118. package/docs/examples/full-design-blocked/changes/REQ-002-bulk-invite-import/planning/design.md +0 -234
  119. package/docs/examples/full-design-blocked/changes/REQ-002-bulk-invite-import/planning/task-manifest.json +0 -488
  120. package/docs/examples/full-design-blocked/changes/REQ-002-bulk-invite-import/review/report-card.json +0 -189
  121. package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/handoff/resume-index.md +0 -39
  122. package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/handoff/status.md +0 -29
  123. package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/planning/design.md +0 -123
  124. package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/planning/task-manifest.json +0 -292
  125. package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/review/report-card.json +0 -136
  126. package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/handoff/status.md +0 -29
  127. package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/planning/design.md +0 -124
  128. package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/planning/task-manifest.json +0 -292
  129. package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/review/report-card.json +0 -136
  130. package/docs/get-shit-done-strategy-audit.md +0 -518
  131. package/docs/skill-runtime-migration.md +0 -46
  132. package/lib/skill-runtime/__tests__/approve.test.js +0 -92
  133. package/lib/skill-runtime/__tests__/autopilot.test.js +0 -253
  134. package/lib/skill-runtime/__tests__/benchmark-artifacts.test.js +0 -165
  135. package/lib/skill-runtime/__tests__/delegation.test.js +0 -97
  136. package/lib/skill-runtime/__tests__/dispatch.test.js +0 -237
  137. package/lib/skill-runtime/__tests__/intent.test.js +0 -203
  138. package/lib/skill-runtime/__tests__/lifecycle.test.js +0 -169
  139. package/lib/skill-runtime/__tests__/planner.tdd.test.js +0 -331
  140. package/lib/skill-runtime/__tests__/prepare-pr.test.js +0 -126
  141. package/lib/skill-runtime/__tests__/query.test.js +0 -860
  142. package/lib/skill-runtime/__tests__/readiness.test.js +0 -53
  143. package/lib/skill-runtime/__tests__/release.test.js +0 -85
  144. package/lib/skill-runtime/__tests__/review-check-integration.test.js +0 -148
  145. package/lib/skill-runtime/__tests__/review-records.test.js +0 -619
  146. package/lib/skill-runtime/__tests__/runtime.integration.test.js +0 -351
  147. package/lib/skill-runtime/__tests__/schemas.test.js +0 -337
  148. package/lib/skill-runtime/__tests__/task-contract-migrate.test.js +0 -137
  149. package/lib/skill-runtime/__tests__/task-contract.test.js +0 -783
  150. package/lib/skill-runtime/__tests__/team-state.test.js +0 -51
  151. package/lib/skill-runtime/__tests__/verify-artifacts.test.js +0 -203
  152. package/lib/skill-runtime/__tests__/worker-run.test.js +0 -275
  153. package/lib/skill-runtime/__tests__/worker.test.js +0 -56
  154. package/lib/skill-runtime/__tests__/workflow-context-legacy-fallback.test.js +0 -31
  155. package/lib/skill-runtime/__tests__/workflow-context.test.js +0 -98
  156. package/lib/skill-runtime/artifacts.js +0 -88
  157. package/lib/skill-runtime/context-index.js +0 -545
  158. package/lib/skill-runtime/delegation.js +0 -533
  159. package/lib/skill-runtime/intent.js +0 -309
  160. package/lib/skill-runtime/lifecycle.js +0 -294
  161. package/lib/skill-runtime/operations/CLAUDE.md +0 -19
  162. package/lib/skill-runtime/operations/approve.js +0 -81
  163. package/lib/skill-runtime/operations/autopilot-core.js +0 -337
  164. package/lib/skill-runtime/operations/autopilot-execution.js +0 -307
  165. package/lib/skill-runtime/operations/autopilot-shared.js +0 -48
  166. package/lib/skill-runtime/operations/autopilot.js +0 -163
  167. package/lib/skill-runtime/operations/dispatch.js +0 -416
  168. package/lib/skill-runtime/operations/init.js +0 -60
  169. package/lib/skill-runtime/operations/janitor.js +0 -61
  170. package/lib/skill-runtime/operations/plan.js +0 -59
  171. package/lib/skill-runtime/operations/prepare-pr.js +0 -25
  172. package/lib/skill-runtime/operations/release.js +0 -99
  173. package/lib/skill-runtime/operations/resume.js +0 -126
  174. package/lib/skill-runtime/operations/review-records.js +0 -265
  175. package/lib/skill-runtime/operations/snapshot.js +0 -45
  176. package/lib/skill-runtime/operations/task-contract.js +0 -524
  177. package/lib/skill-runtime/operations/verify.js +0 -170
  178. package/lib/skill-runtime/operations/worker-run.js +0 -531
  179. package/lib/skill-runtime/operations/worker.js +0 -33
  180. package/lib/skill-runtime/planner.js +0 -539
  181. package/lib/skill-runtime/readiness.js +0 -84
  182. package/lib/skill-runtime/review-records.js +0 -123
  183. package/lib/skill-runtime/review.js +0 -855
  184. package/lib/skill-runtime/schemas.js +0 -746
  185. package/lib/skill-runtime/task-contract.js +0 -187
  186. package/lib/skill-runtime/team-state.js +0 -122
  187. package/lib/skill-runtime/workflow-context.js +0 -748
@@ -1,123 +1,23 @@
1
- # Minimized Workflow Artifacts
1
+ # Minimize Artifacts
2
2
 
3
- This guide describes the default artifact contract for new cc-devflow changes.
4
- The goal is simple: keep durable workflow truth readable, small, and measurable.
3
+ The workflow is intentionally Git-first.
5
4
 
6
- ## Default Shape
5
+ ## Keep
7
6
 
8
- Each new change keeps durable truth under `devflow/changes/<change-key>/`.
7
+ - `task.md`
8
+ - `handoff/pr-brief.md` when a PR or local handoff needs it
9
+ - incident postmortem when a FIX or recurring failure needs it
9
10
 
10
- Default human-authored Markdown:
11
+ ## Do Not Keep
11
12
 
12
- - `planning/tasks.md`
13
+ - process JSON
14
+ - review ledgers or finding files
15
+ - report cards
16
+ - status or resume files
17
+ - release notes
18
+ - principles files
19
+ - task context or checkpoint files
13
20
 
14
- Default machine-owned records:
21
+ ## Commit Rule
15
22
 
16
- - `change-meta.json`
17
- - `planning/task-manifest.json`
18
- - `review/review-ledger.jsonl`
19
- - `review/review-findings.json` when findings exist
20
- - `execution/tasks/<task-id>/checkpoint.json`
21
- - `review/report-card.json`
22
- - one final handoff file under `handoff/`
23
-
24
- Runtime scratch, worker prompts, journals, assignments, and session logs belong
25
- under `devflow/workspaces/<change-key>/`, not beside durable change truth.
26
-
27
- ## Feature Plans
28
-
29
- Feature and scope changes use:
30
-
31
- - `planning/tasks.md#Contract Summary`
32
- - `planning/task-manifest.json`
33
- - `change-meta.json`
34
-
35
- `Contract Summary` owns the frozen human-readable plan: user story, non-negotiable
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.
39
-
40
- ## Bug Investigations
41
-
42
- Bug, regression, and unexpected-behavior work uses:
43
-
44
- - `planning/tasks.md#Root Cause Contract`
45
- - `planning/task-manifest.json`
46
- - `change-meta.json`
47
-
48
- `Root Cause Contract` owns the symptom, reproduction evidence, confirmed cause,
49
- rejected near-causes, repair boundary, and task handoff. `cc-do` should implement
50
- from that frozen contract instead of reopening investigation during execution.
51
-
52
- ## Review Records
53
-
54
- `cc-review` writes structured lifecycle events first:
55
-
56
- - `review/review-ledger.jsonl`
57
- - optional `review/review-findings.json`
58
- - optional rendered Markdown from `cc-devflow review render`
59
-
60
- Markdown review reports are for human reading when needed. They are not the
61
- default durable review source.
62
-
63
- Useful commands:
64
-
65
- ```bash
66
- npx cc-devflow review start --change REQ-001 --change-key REQ-001-copy-invite-link --base-sha abc123 --head-sha def456
67
- npx cc-devflow review record-node --change REQ-001 --change-key REQ-001-copy-invite-link --review-id <review-id> --node-id R001 --target planning/tasks.md --status checked --coverage contract --evidence-ref "cmd:npm run verify"
68
- npx cc-devflow review add-finding --change REQ-001 --change-key REQ-001-copy-invite-link --review-id <review-id> --finding-id F001 --severity important --confidence 8 --display-tier blocking --fingerprint sha256:<hash> --scope "current change" --path planning/tasks.md --evidence "finding evidence" --recommendation "repair action" --route cc-do
69
- npx cc-devflow review close --change REQ-001 --change-key REQ-001-copy-invite-link --review-id <review-id> --status clean --blocking-count 0 --warning-count 0 --next cc-check
70
- npx cc-devflow review render --change REQ-001 --change-key REQ-001-copy-invite-link --review-id <review-id> --output review/review-report.md
71
- ```
72
-
73
- ## Legacy Fallback
74
-
75
- Older changes may still contain:
76
-
77
- - `planning/design.md`
78
- - `planning/analysis.md`
79
- - `review/cc-review-plan.md`
80
- - `review/cc-review-report.md`
81
- - `review/cc-review-agent-results.jsonl`
82
-
83
- Those files remain readable compatibility inputs. New changes should not write
84
- them by default. When migrating old work, fold feature-plan truth into
85
- `planning/tasks.md#Contract Summary` and bug-investigation truth into
86
- `planning/tasks.md#Root Cause Contract`.
87
-
88
- ## Validation Gates
89
-
90
- Validate one change:
91
-
92
- ```bash
93
- npx cc-devflow task-contract validate --change REQ-001 --change-key REQ-001-copy-invite-link
94
- ```
95
-
96
- Validate the repository artifact contract:
97
-
98
- ```bash
99
- npm run verify:artifacts
100
- ```
101
-
102
- Measure the contract:
103
-
104
- ```bash
105
- npm run benchmark:artifacts
106
- ```
107
-
108
- The package-level verification command also includes artifact validation:
109
-
110
- ```bash
111
- npm run verify
112
- ```
113
-
114
- ## Authoring Rule
115
-
116
- Before adding a durable file under `devflow/changes/<change-key>/`, answer:
117
-
118
- 1. Which downstream skill reads it by default?
119
- 2. Which state does it own that no existing artifact owns?
120
- 3. Which command fails if it drifts?
121
-
122
- If those answers are unclear, keep the information in `planning/tasks.md`, a
123
- machine record, or ephemeral workspace scratch instead.
23
+ Each completed PDCA or IDCA environment/stage gets a Git commit. Use the commit graph as the process record.
@@ -1,78 +1,21 @@
1
- # Project Postmortem Contract
1
+ # Project Postmortems
2
2
 
3
- cc-devflow treats project postmortems as a durable AI memory surface. They are not
4
- chat summaries. They are repo-owned evidence that future agents can search before
5
- planning, investigating, or executing work.
3
+ Postmortems preserve recurring failures without turning every workflow step into a file.
6
4
 
7
- ## Storage Layout
5
+ ## Files
8
6
 
9
- Project-level postmortems live under `devflow/postmortems/`:
7
+ - `devflow/postmortems/INDEX.md`
8
+ - `devflow/postmortems/incidents/<date>-<change-key>.md`
10
9
 
11
- | Path | Owner | Purpose |
12
- | --- | --- | --- |
13
- | `INDEX.md` | `cc-act` | Progressive entry point, latest incidents, tags, and search hints |
14
- | `principles.md` | `cc-act` | Generalized lessons about recurring model, process, and engineering mistakes |
15
- | `incidents/<date>-<change-key>.md` | `cc-act` | Immutable-ish factual record for one incident, bug, or repeated AI failure |
10
+ ## When To Write One
16
11
 
17
- `cc-act` owns writes because it has verified closeout, Git state, review state, and
18
- ship facts. Earlier skills only read and project the relevant reminders into their
19
- own artifacts.
12
+ - closing a `FIX-*`
13
+ - repeated AI, test, release, Git, or architecture failure
14
+ - explicit user request
20
15
 
21
- ## Progressive Disclosure
16
+ ## Rules
22
17
 
23
- - Default layer: `INDEX.md` gives tags, one-line lessons, severity, affected
24
- surfaces, and links to deeper incident files.
25
- - Principle layer: `principles.md` gives reusable rules such as model failure
26
- modes, domain-specific judgment traps, and required countermeasures.
27
- - Incident layer: `incidents/*.md` gives the detailed facts, Git evidence,
28
- timeline, root cause, detection gap, repair, follow-ups, and search terms.
29
-
30
- Agents should start with keyword search over the default and principle layers, then
31
- open incident files only when the tags or failure class match the current task.
32
-
33
- ## Required Incident Evidence
34
-
35
- Every incident file should include:
36
-
37
- - Symptom and impact.
38
- - Trigger and timeline.
39
- - Confirmed root cause and rejected near-causes.
40
- - Why the failure escaped planning, investigation, execution, review, or ship.
41
- - Git evidence: branch, base, head SHA, PR if any, relevant commits, review range,
42
- and dirty-tree notes when they matter.
43
- - Verification evidence: commands, exit status, key output, and artifact paths.
44
- - Follow-up actions: root-cause fixes, detection improvements, and backlog items.
45
- - AI failure mode: model limitation, pattern-matching trap, missing evidence habit,
46
- over-broad abstraction, fake compatibility, test-seam mistake, or other reusable
47
- class.
48
- - Search terms future agents should use before repeating similar work.
49
-
50
- ## Redaction Guard
51
-
52
- Postmortems are durable repo artifacts, so they must never preserve secrets,
53
- tokens, private customer data, personal machine paths, or raw private logs unless
54
- the repository already treats that exact artifact as public source truth.
55
-
56
- - Record the command, file path, commit, or artifact pointer that proves the fact.
57
- - Quote only the minimal output needed to prove the incident.
58
- - Replace sensitive values with `<redacted>` and add a short redaction summary.
59
- - If the only available proof is sensitive, cite the owner artifact and describe
60
- the observed shape instead of copying the raw value.
61
-
62
- ## Read Gates
63
-
64
- `cc-plan`, `cc-investigate`, and `cc-do` must run a quick local search before they
65
- freeze direction or touch code:
66
-
67
- ```bash
68
- rg -n "<capability|module|error|failure-class|model-risk>" devflow/postmortems
69
- ```
70
-
71
- If `devflow/postmortems/` does not exist, record `no-project-postmortems-yet`.
72
- If a match exists, load only `INDEX.md`, `principles.md`, and the one or two
73
- incident files most relevant to the current work.
74
-
75
- ## State Ownership
76
-
77
- Postmortems do not own task status, roadmap progress, review verdicts, or spec sync
78
- state. They cite those stronger owners by path, commit, or command output.
18
+ - Use Git evidence, commands, and current files.
19
+ - Redact secrets, customer data, private logs, and local machine paths.
20
+ - Do not create a separate principles file.
21
+ - Do not use postmortems as task, review, or release state.
@@ -159,9 +159,9 @@ describe('Skills Registry Generator', () => {
159
159
  expect(execute.writes).toEqual(
160
160
  expect.arrayContaining([
161
161
  expect.objectContaining({
162
- path: 'devflow/changes/<change-key>/execution/tasks/<task-id>/events.jsonl',
162
+ path: 'devflow/changes/<change-key>/task.md',
163
163
  durability: 'durable',
164
- required: false
164
+ required: true
165
165
  })
166
166
  ])
167
167
  );
@@ -183,13 +183,14 @@ describe('Skills Registry Generator', () => {
183
183
  expect.arrayContaining([
184
184
  expect.objectContaining({
185
185
  path: 'devflow/changes/<change-key>/handoff/pr-brief.md',
186
- required: false,
187
- exclusiveGroup: 'handoff'
188
- }),
186
+ required: false
187
+ })
188
+ ])
189
+ );
190
+ expect(act.writes).not.toEqual(
191
+ expect.arrayContaining([
189
192
  expect.objectContaining({
190
- path: 'devflow/changes/<change-key>/handoff/release-note.md',
191
- required: false,
192
- exclusiveGroup: 'handoff'
193
+ path: expect.stringContaining('release')
193
194
  })
194
195
  ])
195
196
  );
@@ -428,6 +428,7 @@ async function mirrorDirectoryRecursive(sourceDir, targetDir, options = {}) {
428
428
 
429
429
  if (!dryRun) {
430
430
  await fs.promises.mkdir(targetDir, { recursive: true, mode: 0o755 });
431
+ await pruneMirroredDirectoryRecursive(sourceDir, targetDir, options);
431
432
  }
432
433
 
433
434
  for (const entry of entries) {
@@ -473,6 +474,34 @@ async function mirrorDirectoryRecursive(sourceDir, targetDir, options = {}) {
473
474
  return result;
474
475
  }
475
476
 
477
+ async function pruneMirroredDirectoryRecursive(sourceDir, targetDir, options = {}) {
478
+ const { verbose = false } = options;
479
+
480
+ if (!fs.existsSync(targetDir)) {
481
+ return;
482
+ }
483
+
484
+ const targetEntries = await fs.promises.readdir(targetDir, { withFileTypes: true });
485
+ await Promise.all(
486
+ targetEntries.map(async (entry) => {
487
+ const sourcePath = path.join(sourceDir, entry.name);
488
+ const targetPath = path.join(targetDir, entry.name);
489
+
490
+ if (!fs.existsSync(sourcePath)) {
491
+ await fs.promises.rm(targetPath, { recursive: true, force: true });
492
+ if (verbose) {
493
+ console.log(`Pruned stale skill file: ${path.relative(process.cwd(), targetPath)}`);
494
+ }
495
+ return;
496
+ }
497
+
498
+ if (entry.isDirectory()) {
499
+ await pruneMirroredDirectoryRecursive(sourcePath, targetPath, options);
500
+ }
501
+ })
502
+ );
503
+ }
504
+
476
505
  // ============================================================
477
506
  // clearResourceCache - 清除资源缓存(用于测试)
478
507
  // ============================================================
@@ -61,13 +61,13 @@ describe('restoreChange', () => {
61
61
  const repoRoot = makeTempRepo();
62
62
  const archivedDir = path.join(repoRoot, 'devflow', 'changes', 'archive', '2026-04', 'REQ-002-restored');
63
63
  fs.mkdirSync(archivedDir, { recursive: true });
64
- fs.writeFileSync(path.join(archivedDir, 'tasks.md'), '- [ ] task');
64
+ fs.writeFileSync(path.join(archivedDir, 'task.md'), '- [ ] task');
65
65
 
66
66
  const result = restoreChange(repoRoot, archivedDir);
67
67
 
68
68
  expect(result.changeKey).toBe('REQ-002-restored');
69
69
  expect(fs.existsSync(result.restored)).toBe(true);
70
- expect(fs.existsSync(path.join(result.restored, 'tasks.md'))).toBe(true);
70
+ expect(fs.existsSync(path.join(result.restored, 'task.md'))).toBe(true);
71
71
  expect(fs.existsSync(archivedDir)).toBe(false);
72
72
 
73
73
  fs.rmSync(repoRoot, { recursive: true, force: true });
@@ -0,0 +1,109 @@
1
+ /**
2
+ * [INPUT]: 依赖 scripts/benchmark-skills.js 导出的 runBenchmarkSkills 和临时 skill fixture。
3
+ * [OUTPUT]: 验证 benchmark:skills 对 SKILL.md 入口体积执行 byte/line advisory 预算。
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('reports advisory failure without blocking 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(0);
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
+ });
@@ -108,7 +108,8 @@ describe('cc-devflow cli distribution bootstrap', () => {
108
108
 
109
109
  expect(skillContent).not.toContain('<!-- CC-DEVFLOW OUTPUT POLICY START -->');
110
110
  expect(skillContent).not.toContain('文档语言: zh-CN');
111
- expect(skillContent).toContain('cc-devflow config resolve --format policy');
111
+ expect(skillContent).toContain('resolve-cc-devflow.sh');
112
+ expect(skillContent).toContain('bash "$DEVFLOW" config resolve --format policy');
112
113
  expect(fs.readFileSync(path.join(customSkillDir, 'SKILL.md'), 'utf8')).toBe('# Custom Skill\n');
113
114
  });
114
115
 
@@ -177,7 +178,10 @@ describe('cc-devflow cli distribution bootstrap', () => {
177
178
  expect(runCli(['init', '--dir', repoRoot], repoRoot).status).toBe(0);
178
179
 
179
180
  const targetSkill = path.join(repoRoot, '.claude', 'skills', 'cc-roadmap', 'SKILL.md');
181
+ const staleManagedFile = path.join(repoRoot, '.claude', 'skills', 'cc-act', 'assets', 'STALE.md');
182
+ fs.mkdirSync(path.dirname(staleManagedFile), { recursive: true });
180
183
  fs.writeFileSync(targetSkill, '# local override\n');
184
+ fs.writeFileSync(staleManagedFile, '# stale\n');
181
185
 
182
186
  const result = runCli(['init', '--dir', repoRoot, '--force'], repoRoot);
183
187
  expect(result.status).toBe(0);
@@ -186,10 +190,14 @@ describe('cc-devflow cli distribution bootstrap', () => {
186
190
  fs.readFileSync(path.join(TEMPLATE_ROOT, 'skills', 'cc-roadmap', 'SKILL.md'), 'utf8')
187
191
  );
188
192
  expect(fs.existsSync(`${targetSkill}.new`)).toBe(false);
193
+ expect(fs.existsSync(staleManagedFile)).toBe(false);
189
194
  });
190
195
 
191
196
  test('adapt mirrors public skills into .codex/skills for Codex', () => {
192
197
  expect(runCli(['init', '--dir', repoRoot], repoRoot).status).toBe(0);
198
+ const staleCodexAsset = path.join(repoRoot, '.codex', 'skills', 'cc-act', 'assets', 'STALE.md');
199
+ fs.mkdirSync(path.dirname(staleCodexAsset), { recursive: true });
200
+ fs.writeFileSync(staleCodexAsset, '# stale\n');
193
201
 
194
202
  const result = runCli(['adapt', '--cwd', repoRoot, '--platform', 'codex'], repoRoot);
195
203
  expect(result.status).toBe(0);
@@ -202,6 +210,7 @@ describe('cc-devflow cli distribution bootstrap', () => {
202
210
  expect(fs.existsSync(path.join(repoRoot, '.codex', 'skills', 'cc-review', 'SKILL.md'))).toBe(true);
203
211
  expect(fs.existsSync(path.join(repoRoot, '.codex', 'skills', 'cc-check', 'SKILL.md'))).toBe(true);
204
212
  expect(fs.existsSync(path.join(repoRoot, '.codex', 'skills', 'cc-act', 'SKILL.md'))).toBe(true);
213
+ expect(fs.existsSync(staleCodexAsset)).toBe(false);
205
214
 
206
215
  const codexInvestigateSkill = fs.readFileSync(
207
216
  path.join(repoRoot, '.codex', 'skills', 'cc-investigate', 'SKILL.md'),
@@ -217,9 +226,9 @@ describe('cc-devflow cli distribution bootstrap', () => {
217
226
  expect(codexDoSkill.data.writes).toEqual(
218
227
  expect.arrayContaining([
219
228
  expect.objectContaining({
220
- path: 'devflow/changes/<change-key>/execution/tasks/<task-id>/events.jsonl',
229
+ path: 'devflow/changes/<change-key>/task.md',
221
230
  durability: 'durable',
222
- required: false
231
+ required: true
223
232
  })
224
233
  ])
225
234
  );
@@ -277,7 +286,8 @@ describe('cc-devflow cli distribution bootstrap', () => {
277
286
  );
278
287
  expect(codexPlanSkill).not.toContain('<!-- CC-DEVFLOW OUTPUT POLICY START -->');
279
288
  expect(codexPlanSkill).not.toContain('文档语言: zh-CN');
280
- expect(codexPlanSkill).toContain('cc-devflow config resolve --format policy');
289
+ expect(codexPlanSkill).toContain('resolve-cc-devflow.sh');
290
+ expect(codexPlanSkill).toContain('bash "$DEVFLOW" config resolve --format policy');
281
291
  });
282
292
 
283
293
  test('adapt preserves pre-existing non-public Codex skills and does not mirror new private ones', () => {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * [INPUT]: 接收 runtime/query/compiler 边界抛出的错误或失败字段。
3
- * [OUTPUT]: 生成可序列化 named error,保留 artifact refs 与 rescue action。
3
+ * [OUTPUT]: 生成可序列化 named error,保留 refs 与 rescue action。
4
4
  * [POS]: skill runtime 的失败语义层,避免用 null/false/string 表达可恢复失败。
5
5
  * [PROTOCOL]: 变更时更新此头部,然后检查 CLAUDE.md
6
6
  */
@@ -10,7 +10,7 @@ class SkillRuntimeError extends Error {
10
10
  super(message);
11
11
  this.name = name;
12
12
  this.artifactRefs = options.artifactRefs || [];
13
- this.rescueAction = options.rescueAction || 'inspect-runtime-artifacts';
13
+ this.rescueAction = options.rescueAction || 'inspect-task-md-and-git-history';
14
14
  this.details = options.details || {};
15
15
  }
16
16
  }
@@ -27,7 +27,7 @@ function serializeError(error, fallbackName = 'SkillRuntimeError') {
27
27
  name,
28
28
  message,
29
29
  artifactRefs: error?.artifactRefs || [],
30
- rescueAction: error?.rescueAction || 'inspect-runtime-artifacts',
30
+ rescueAction: error?.rescueAction || 'inspect-task-md-and-git-history',
31
31
  details: error?.details || {}
32
32
  };
33
33
  }
@@ -1,44 +1,26 @@
1
1
  /**
2
- * [INPUT]: 依赖 skill runtime 各模块。
3
- * [OUTPUT]: 统一导出 schema/store/planner/query 与 operations 入口。
4
- * [POS]: skill runtime 模块聚合出口,被内部测试与脚本使用。
2
+ * [INPUT]: 依赖 skill runtime 基础模块。
3
+ * [OUTPUT]: 统一导出 config/path/store/query helpers。
4
+ * [POS]: skill runtime 模块聚合出口,只保留 CLI 仍需的轻量能力。
5
5
  * [PROTOCOL]: 变更时更新此头部,然后检查 CLAUDE.md
6
6
  */
7
7
 
8
8
  const store = require('./store');
9
- const schemas = require('./schemas');
10
- const planner = require('./planner');
11
9
  const query = require('./query');
12
10
  const queryRegistry = require('./query-registry');
13
11
  const errors = require('./errors');
14
12
  const trace = require('./trace');
15
- const readiness = require('./readiness');
16
- const intent = require('./intent');
17
- const artifacts = require('./artifacts');
18
- const lifecycle = require('./lifecycle');
19
- const teamState = require('./team-state');
20
- const delegation = require('./delegation');
21
13
  const paths = require('./paths');
22
14
  const config = require('./config');
23
- const worker = require('./operations/worker');
24
- const workerRun = require('./operations/worker-run');
15
+ const archiveChange = require('./archive-change');
25
16
 
26
17
  module.exports = {
27
18
  ...store,
28
- ...schemas,
29
- ...planner,
30
19
  ...query,
31
20
  ...queryRegistry,
32
21
  ...errors,
33
22
  ...trace,
34
- ...readiness,
35
- ...artifacts,
36
- ...intent,
37
- ...lifecycle,
38
- ...teamState,
39
- ...delegation,
40
23
  ...paths,
41
24
  ...config,
42
- ...worker,
43
- ...workerRun
25
+ ...archiveChange
44
26
  };
@@ -1,6 +1,6 @@
1
1
  /**
2
- * [INPUT]: 依赖 fs/path,接收 repoRoot/changeId/taskId/workerId 等定位参数。
3
- * [OUTPUT]: 对外提供 devflow canonical layout 的唯一路径解析能力。
2
+ * [INPUT]: 依赖 fs/path,接收 repoRoot/changeId 等定位参数。
3
+ * [OUTPUT]: 对外提供 devflow canonical change layout 的唯一路径解析能力。
4
4
  * [POS]: skill runtime 的路径真相源,完整 change key 才是目录身份。
5
5
  * [PROTOCOL]: 变更时更新此头部,然后检查 CLAUDE.md
6
6
  */
@@ -70,10 +70,6 @@ function getChangesRoot(repoRoot) {
70
70
  return path.join(getDevflowRoot(repoRoot), 'changes');
71
71
  }
72
72
 
73
- function getWorkspacesRoot(repoRoot) {
74
- return path.join(getDevflowRoot(repoRoot), 'workspaces');
75
- }
76
-
77
73
  function listChangeKeys(repoRoot) {
78
74
  const changesRoot = getChangesRoot(repoRoot);
79
75
  if (!fs.existsSync(changesRoot)) {
@@ -196,56 +192,15 @@ function nextChangeKey(repoRoot, prefix, description) {
196
192
  function getChangePaths(repoRoot, changeId, options = {}) {
197
193
  const changeKey = resolveChangeKey(repoRoot, changeId, options);
198
194
  const changeDir = path.join(getChangesRoot(repoRoot), changeKey);
199
- const metaDir = path.join(changeDir, 'meta');
200
- const planningDir = path.join(changeDir, 'planning');
201
- const executionDir = path.join(changeDir, 'execution');
202
- const reviewDir = path.join(changeDir, 'review');
203
195
  const handoffDir = path.join(changeDir, 'handoff');
204
196
 
205
197
  return {
206
198
  changeId,
207
199
  changeKey,
208
200
  changeDir,
209
- metaDir,
210
- planningDir,
211
- executionDir,
212
- reviewDir,
213
201
  handoffDir,
214
- tasksDir: path.join(executionDir, 'tasks'),
215
- workersDir: path.join(executionDir, 'workers'),
216
- workspacesDir: path.join(getWorkspacesRoot(repoRoot), changeKey)
217
- };
218
- }
219
-
220
- function getTaskPaths(repoRoot, changeId, taskId, options = {}) {
221
- const change = getChangePaths(repoRoot, changeId, options);
222
- const taskDir = path.join(change.tasksDir, taskId);
223
-
224
- return {
225
- ...change,
226
- taskId,
227
- taskDir,
228
- eventsPath: path.join(taskDir, 'events.jsonl')
229
- };
230
- }
231
-
232
- function getWorkerPaths(repoRoot, changeId, workerId, options = {}) {
233
- const change = getChangePaths(repoRoot, changeId, options);
234
- const workspacePath = path.join(change.workspacesDir, workerId);
235
- const workerDir = path.join(workspacePath, '.runtime');
236
-
237
- return {
238
- ...change,
239
- workerId,
240
- workerDir,
241
- sharedRuntimeDir: path.join(change.workspacesDir, '.runtime'),
242
- assignmentPath: path.join(workerDir, 'assignment.md'),
243
- promptPath: path.join(workerDir, 'prompt.md'),
244
- launchPath: path.join(workerDir, 'launch.md'),
245
- statePath: path.join(workerDir, 'state.md'),
246
- journalPath: path.join(workerDir, 'journal.md'),
247
- sessionLogPath: path.join(workerDir, 'session.log'),
248
- workspacePath
202
+ taskPath: path.join(changeDir, 'task.md'),
203
+ prBriefPath: path.join(handoffDir, 'pr-brief.md')
249
204
  };
250
205
  }
251
206
 
@@ -256,11 +211,9 @@ module.exports = {
256
211
  getChangeSlug,
257
212
  getDevflowRoot,
258
213
  getChangesRoot,
259
- getWorkspacesRoot,
260
214
  nextChangeKey,
261
215
  resolveChangeKey,
262
216
  buildChangeKey,
263
217
  getChangePaths,
264
- getTaskPaths,
265
- getWorkerPaths
218
+ assertChangeId
266
219
  };