cc-devflow 4.5.2 → 4.5.4

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 (100) hide show
  1. package/.claude/skills/cc-act/CHANGELOG.md +19 -0
  2. package/.claude/skills/cc-act/PLAYBOOK.md +14 -1
  3. package/.claude/skills/cc-act/SKILL.md +46 -6
  4. package/.claude/skills/cc-act/assets/PR_BRIEF_TEMPLATE.md +44 -1
  5. package/.claude/skills/cc-act/assets/RELEASE_NOTE_TEMPLATE.md +18 -1
  6. package/.claude/skills/cc-act/references/closure-contract.md +3 -0
  7. package/.claude/skills/cc-act/scripts/cc-act-common.sh +27 -1
  8. package/.claude/skills/cc-act/scripts/render-pr-brief.sh +31 -0
  9. package/.claude/skills/cc-act/scripts/verify-act-gate.sh +6 -0
  10. package/.claude/skills/cc-check/CHANGELOG.md +18 -0
  11. package/.claude/skills/cc-check/PLAYBOOK.md +38 -7
  12. package/.claude/skills/cc-check/SKILL.md +39 -7
  13. package/.claude/skills/cc-check/assets/REPORT_CARD_TEMPLATE.json +61 -0
  14. package/.claude/skills/cc-check/references/gate-contract.md +11 -0
  15. package/.claude/skills/cc-check/references/review-contract.md +17 -1
  16. package/.claude/skills/cc-check/scripts/render-report-card.js +37 -0
  17. package/.claude/skills/cc-check/scripts/verify-gate.sh +7 -0
  18. package/.claude/skills/cc-do/CHANGELOG.md +18 -0
  19. package/.claude/skills/cc-do/PLAYBOOK.md +20 -13
  20. package/.claude/skills/cc-do/SKILL.md +37 -17
  21. package/.claude/skills/cc-do/references/execution-recovery.md +19 -5
  22. package/.claude/skills/cc-do/references/parallel-dispatch.md +6 -4
  23. package/.claude/skills/cc-do/scripts/detect-file-conflicts.sh +49 -3
  24. package/.claude/skills/cc-do/scripts/verify-task-gates.sh +19 -6
  25. package/.claude/skills/cc-do/scripts/write-task-checkpoint.sh +14 -2
  26. package/.claude/skills/cc-investigate/CHANGELOG.md +24 -0
  27. package/.claude/skills/cc-investigate/PLAYBOOK.md +35 -13
  28. package/.claude/skills/cc-investigate/SKILL.md +87 -20
  29. package/.claude/skills/cc-investigate/assets/ANALYSIS_TEMPLATE.md +68 -3
  30. package/.claude/skills/cc-investigate/assets/TASKS_TEMPLATE.md +9 -4
  31. package/.claude/skills/cc-investigate/assets/TASK_MANIFEST_TEMPLATE.json +41 -2
  32. package/.claude/skills/cc-investigate/references/investigation-contract.md +46 -0
  33. package/.claude/skills/cc-plan/CHANGELOG.md +32 -0
  34. package/.claude/skills/cc-plan/PLAYBOOK.md +26 -8
  35. package/.claude/skills/cc-plan/SKILL.md +79 -34
  36. package/.claude/skills/cc-plan/assets/DESIGN_TEMPLATE.md +71 -3
  37. package/.claude/skills/cc-plan/assets/TASKS_TEMPLATE.md +32 -0
  38. package/.claude/skills/cc-plan/assets/TASK_MANIFEST_TEMPLATE.json +76 -2
  39. package/.claude/skills/cc-plan/assets/TINY_DESIGN_TEMPLATE.md +58 -0
  40. package/.claude/skills/cc-plan/references/planning-contract.md +26 -4
  41. package/.claude/skills/cc-roadmap/CHANGELOG.md +14 -0
  42. package/.claude/skills/cc-roadmap/PLAYBOOK.md +10 -7
  43. package/.claude/skills/cc-roadmap/SKILL.md +43 -23
  44. package/.claude/skills/cc-roadmap/assets/BACKLOG_TEMPLATE.md +10 -0
  45. package/.claude/skills/cc-roadmap/assets/ROADMAP_TEMPLATE.md +15 -0
  46. package/.claude/skills/cc-roadmap/assets/TRACKING_TEMPLATE.json +1 -1
  47. package/.claude/skills/cc-roadmap/references/roadmap-dialogue.md +11 -7
  48. package/.claude/skills/cc-simplify/CHANGELOG.md +6 -0
  49. package/.claude/skills/cc-simplify/SKILL.md +10 -1
  50. package/.claude/skills/cc-spec-init/CHANGELOG.md +6 -0
  51. package/.claude/skills/cc-spec-init/SKILL.md +14 -1
  52. package/CHANGELOG.md +29 -0
  53. package/README.md +10 -2
  54. package/README.zh-CN.md +10 -2
  55. package/bin/cc-devflow-cli.js +93 -2
  56. package/docs/examples/example-bindings.json +7 -7
  57. package/docs/examples/full-design-blocked/BACKLOG.md +1 -1
  58. package/docs/examples/full-design-blocked/README.md +1 -1
  59. package/docs/examples/full-design-blocked/ROADMAP.md +1 -1
  60. package/docs/examples/full-design-blocked/changes/REQ-002-bulk-invite-import/planning/design.md +1 -1
  61. package/docs/examples/full-design-blocked/changes/REQ-002-bulk-invite-import/planning/tasks.md +1 -1
  62. package/docs/examples/full-design-blocked/roadmap-tracking.json +1 -1
  63. package/docs/examples/local-handoff/BACKLOG.md +1 -1
  64. package/docs/examples/local-handoff/README.md +1 -1
  65. package/docs/examples/local-handoff/ROADMAP.md +1 -1
  66. package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/planning/design.md +1 -1
  67. package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/planning/tasks.md +1 -1
  68. package/docs/examples/local-handoff/roadmap-tracking.json +1 -1
  69. package/docs/examples/pdca-loop/BACKLOG.md +1 -1
  70. package/docs/examples/pdca-loop/README.md +1 -1
  71. package/docs/examples/pdca-loop/ROADMAP.md +1 -1
  72. package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/planning/design.md +1 -1
  73. package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/planning/task-manifest.json +2 -2
  74. package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/planning/tasks.md +1 -1
  75. package/docs/examples/pdca-loop/roadmap-tracking.json +1 -1
  76. package/docs/get-shit-done-strategy-audit.md +518 -0
  77. package/docs/skill-strategy-audit.md +48 -0
  78. package/lib/compiler/__tests__/inventory.test.js +51 -0
  79. package/lib/compiler/inventory.js +78 -0
  80. package/lib/skill-runtime/__tests__/approve.test.js +92 -0
  81. package/lib/skill-runtime/__tests__/autopilot.test.js +4 -0
  82. package/lib/skill-runtime/__tests__/planner.tdd.test.js +20 -0
  83. package/lib/skill-runtime/__tests__/query.test.js +147 -1
  84. package/lib/skill-runtime/__tests__/readiness.test.js +53 -0
  85. package/lib/skill-runtime/__tests__/release.test.js +85 -0
  86. package/lib/skill-runtime/__tests__/runtime.integration.test.js +30 -1
  87. package/lib/skill-runtime/__tests__/schemas.test.js +56 -0
  88. package/lib/skill-runtime/__tests__/worker-run.test.js +29 -0
  89. package/lib/skill-runtime/errors.js +39 -0
  90. package/lib/skill-runtime/index.js +8 -0
  91. package/lib/skill-runtime/operations/approve.js +17 -2
  92. package/lib/skill-runtime/operations/release.js +6 -3
  93. package/lib/skill-runtime/operations/worker-run.js +30 -0
  94. package/lib/skill-runtime/planner.js +10 -2
  95. package/lib/skill-runtime/query-registry.js +101 -0
  96. package/lib/skill-runtime/query.js +159 -91
  97. package/lib/skill-runtime/readiness.js +84 -0
  98. package/lib/skill-runtime/schemas.js +39 -4
  99. package/lib/skill-runtime/trace.js +22 -0
  100. package/package.json +1 -1
@@ -0,0 +1,518 @@
1
+ # Get Shit Done Strategy Migration Blueprint
2
+
3
+ 本蓝图覆盖 `/Users/dimon/001Area/80-CodeWorld/002-devflow/get-shit-done`
4
+ 当前源码里的公开功能面。目标不是复制 GSD 的命令、agent、hook 和
5
+ workflow 表面积,而是把其中能增强 cc-devflow 的机制迁移为原生
6
+ `cc-*` SKILL contract、runtime typed reads、compiler/publish gate 和测试证据。
7
+
8
+ 核心原则:**GSD 是输入,cc-devflow contract 才是输出。**
9
+
10
+ ## Source Facts
11
+
12
+ - Package: `get-shit-done-cc@1.39.0-rc.4`
13
+ - Public command surface: `commands/gsd/*.md` 共 86 个命令
14
+ - Agent surface: `agents/gsd-*.md` 共 33 个专用 agent
15
+ - Workflow surface: `get-shit-done/workflows/*.md` 共 84 个顶层 workflow,另有
16
+ `discuss-phase/` 和 `execute-phase/steps/` 的拆分子文件
17
+ - Runtime helpers: `get-shit-done/bin/lib/*.cjs` 共 31 个 CLI module,SDK 查询层
18
+ 位于 `sdk/src/query/`
19
+ - Safety hooks: `hooks/` 共 11 个
20
+
21
+ cc-devflow 当前公开表面保持不变:
22
+
23
+ ```text
24
+ cc-roadmap
25
+
26
+ PDCA: cc-plan -> cc-do -> cc-check -> cc-act
27
+ IDCA: cc-investigate -> cc-do -> cc-check -> cc-act
28
+ ```
29
+
30
+ 维护型能力继续归入 `cc-spec-init`、`cc-simplify`、`docs-sync`、
31
+ `npm-release` 和 internal runtime/compiler。禁止新增一套平行命令森林。
32
+
33
+ ## Target Architecture
34
+
35
+ ```text
36
+ GSD source evidence
37
+ |
38
+ v
39
+ Strategy extraction
40
+ |
41
+ v
42
+ cc-devflow native contract map
43
+ |
44
+ +--> cc-plan ambiguity gate / trust boundary / bounded review
45
+ +--> cc-do wave scheduling / touched paths / quick lane
46
+ +--> cc-investigate debug session / forensics / diagnose-only
47
+ +--> cc-check UAT / named errors / review facets
48
+ +--> cc-act ship preflight / rollback / learning extraction
49
+ +--> runtime/compiler typed reads / inventory / drift gates
50
+ ```
51
+
52
+ Runtime 边界必须保持克制:
53
+
54
+ ```text
55
+ Public SKILL contract
56
+ cc-plan / cc-do / cc-investigate / cc-check / cc-act
57
+ |
58
+ | declares required artifact fields / gates / reroutes
59
+ v
60
+ Skill-local scripts
61
+ |
62
+ | call shared helpers only for schema/query/io
63
+ v
64
+ lib/skill-runtime
65
+ query-registry.js read-only derived views
66
+ errors.js named runtime errors
67
+ trace.js event refs + next action shape
68
+ |
69
+ v
70
+ durable artifacts
71
+ task-manifest.json / report-card.json / change-state.json / analysis.md
72
+ ```
73
+
74
+ SKILL/PLAYBOOK 拥有 workflow 语义。`lib/skill-runtime` 只拥有 typed reads、
75
+ schema validation、named errors、trace shape 和 IO helper。不要把 runtime 做成
76
+ 隐藏 workflow engine。
77
+
78
+ ## Core Diagnosis
79
+
80
+ GSD 的优势在三个地方:
81
+
82
+ 1. 上下文工程:命令只是薄入口,重活交给 workflow、agent、SDK query 和文件状态。
83
+ 2. 显式 lifecycle:project/phase/quick/debug/thread/workstream 到 PR ship 都有可恢复状态。
84
+ 3. 防腐层:context budget、read guard、prompt-injection scan、inventory parity、SDK golden parity 防止长流程腐烂。
85
+
86
+ cc-devflow 的优势更克制:少入口、强文档、capability truth、report-card gate。
87
+ 迁移策略是吸收机制,不吸收表面。
88
+
89
+ ## Accepted Scope
90
+
91
+ ### P0
92
+
93
+ - `cc-plan`: spec ambiguity gate、assumptions preview、bounded review loop、external doc conflict buckets、trust boundary。
94
+ - `cc-do`: wave scheduling、per-task touched-path conflict、submodule-aware worktree gate、quick-lane mini manifest。
95
+ - `cc-investigate`: persistent debug session、diagnose-only report、workflow forensics。
96
+ - `cc-check`: named error evidence、human UAT、security/ui/ai-eval facets、hostile fixture gates。
97
+ - `cc-act`: structured ship preflight、rollback guard、learning extraction、PR branch hygiene。
98
+ - Runtime/compiler: typed query registry、named errors、operational trace、inventory parity、drift gate、scale budget。
99
+
100
+ ### P1
101
+
102
+ - `docs-sync`: spike/sketch/research wrap-up 变成 durable project learning。
103
+ - `cc-roadmap`: import backlog/roadmap cleanup guard、urgent insertion semantics、deferred triggers。
104
+ - Config/runtime: provider-neutral effort/profile hints,只作为 advisory preference。
105
+ - Adapter: prompt-injection/read-before-edit/context warnings 作为 opt-in capability。
106
+
107
+ ### Optional Lane
108
+
109
+ Codebase Map 七件套只作为按需缓存:
110
+
111
+ - stack
112
+ - architecture
113
+ - structure
114
+ - conventions
115
+ - testing
116
+ - integrations
117
+ - concerns
118
+
119
+ 触发条件:陌生仓库、大型 brownfield、跨模块/跨技术栈改造。它不能成为默认产物,
120
+ 不能高于 `devflow/specs/`、roadmap/backlog、planning artifacts 和 machine truth。
121
+
122
+ ## Contract-First Migration Plan
123
+
124
+ ### `cc-plan`
125
+
126
+ | Contract | Artifact owner | Gate | Tests |
127
+ | --- | --- | --- | --- |
128
+ | WHAT/WHY ambiguity score | `task-manifest.json.planningMeta` + `planning/design.md` | score above threshold blocks task manifest approval | unit fixture: ambiguous input blocks; clear input passes |
129
+ | Assumptions preview | `planning/design.md` decision log | user-visible assumptions before approval | fixture: hidden assumption fails review |
130
+ | Bounded review loop | `task-manifest.json.planningMeta.reviewLoop` | max attempts and stall detection reroute to `cc-roadmap` or user question | hostile fixture: repeated issue count blocks |
131
+ | External doc conflict buckets | `task-manifest.json.languageAndDecisions` | imported docs classified as auto-resolved, competing, unresolved | fixture: conflicting ADR/PRD creates blocker |
132
+ | Trust boundary | `task-manifest.json.sourceEvidence[]` | external text is evidence/source only, never instruction | hostile fixture: prompt injection remains evidence-only |
133
+
134
+ `cc-plan` must keep design decisions readable in Markdown and machine truth in JSON.
135
+ No separate GSD-style `.planning/` tree.
136
+
137
+ ### `cc-do`
138
+
139
+ | Contract | Artifact owner | Gate | Tests |
140
+ | --- | --- | --- | --- |
141
+ | Wave scheduling | `task-manifest.json.tasks[].phase/parallel/dependsOn/touches` | parallel only when dependencies and touches do not conflict | schema fixture: shared touches rejected |
142
+ | Submodule-aware worktree gate | `task-manifest.json.tasks[].touches` + runtime submodule scan | only tasks touching submodule paths lose isolation | hostile fixture: repo with `.gitmodules` but unrelated touches still parallel |
143
+ | Quick lane mini manifest | `task-manifest.json.metadata.lane=quick` | small work still has checkpoint, verification, handoff | fixture: quick lane without verification blocks |
144
+ | Thread/pause/resume | `change-state.json` + one final handoff file | resume query returns stable next action | integration: stale checkpoint restores to pending |
145
+
146
+ `cc-do` should not invent new task state outside `task-manifest.json` and checkpoints.
147
+
148
+ ### `cc-investigate`
149
+
150
+ | Contract | Artifact owner | Gate | Tests |
151
+ | --- | --- | --- | --- |
152
+ | Persistent debug session | `planning/analysis.md` session block, optional machine summary in `task-manifest.json` | hypotheses, probes, symptom match, cleanup recorded | fixture: missing cleanup blocks freeze |
153
+ | Diagnose-only report | `planning/analysis.md` | no code edits required; root cause and next action explicit | fixture: diagnose-only does not mark implementation complete |
154
+ | Workflow forensics | `planning/analysis.md` + trace refs | git/artifact/state failures classified before fixes | hostile fixture: corrupt manifest produces named failure |
155
+
156
+ Prefer extending `planning/analysis.md` over adding `planning/debug-session.md`.
157
+ Only add a new file if the debug transcript becomes too large and has a single owner.
158
+
159
+ ### `cc-check`
160
+
161
+ | Contract | Artifact owner | Gate | Tests |
162
+ | --- | --- | --- | --- |
163
+ | Human UAT | `report-card.json.qa.humanUat` | failed UAT reroutes to `cc-investigate` or `cc-do` | fixture: UAT fail blocks pass |
164
+ | Named error evidence | `report-card.json.runtime.failureOwnership` | every runtime failure has error name, artifact refs, rescue action | hostile fixture: invalid JSON is not silent |
165
+ | Specialist facets | `report-card.json.review.specialistReviews[]` | security/ui/ai-eval facet either passes or has skip reason | fixture: missing required facet blocks |
166
+ | Review-fix loop | `report-card.json.review.findings[]` | finding fingerprint/action/status drives reroute | fixture: unresolved blocking finding prevents `cc-act` |
167
+
168
+ Prior learning applied: verification is a zero-trust pre-claim gate. A passing
169
+ statement needs fresh command output, exit status, and key observation.
170
+
171
+ ### `cc-act`
172
+
173
+ | Contract | Artifact owner | Gate | Tests |
174
+ | --- | --- | --- | --- |
175
+ | Ship-ready preflight | structured output from `detect-ship-target.sh` or successor | branch/base/remote/auth/clean tree/review freshness explicit | shell fixture: missing auth produces `ShipPreflightError` |
176
+ | Rollback guard | `handoff/pr-brief.md` or release note | rollback command and safe state recorded before publish | fixture: release without rollback note blocks |
177
+ | Learning extraction | roadmap/backlog/spec follow-up | follow-up is behavior contract, not chat TODO | fixture: file-only TODO rejected |
178
+ | PR branch hygiene | `handoff/pr-brief.md` | planning-only commits and release commits classified | fixture: duplicate PR branch action blocked |
179
+
180
+ `cc-act` owns landing and closeout, not late feature development. Any new implementation
181
+ inside `cc-act` returns to `cc-check` after verification changes.
182
+
183
+ ### Runtime And Compiler
184
+
185
+ | Contract | Artifact owner | Gate | Tests |
186
+ | --- | --- | --- | --- |
187
+ | Typed query registry | `lib/skill-runtime/query-registry.js` | query ids dispatch to typed read-only handlers | unit: unknown id returns named error |
188
+ | Named errors | `lib/skill-runtime/errors.js` | no `null`/`false` for failure states that need action | hostile fixtures: missing/invalid/stale artifacts |
189
+ | Operational trace | `lib/skill-runtime/trace.js` | every query/doctor/preflight result has eventId, artifact refs, next action | unit: trace shape required |
190
+ | Inventory parity | `lib/compiler/inventory.js` + publish gate | managed skills/scripts/templates/docs/mirrors match manifest | integration: drifted mirror fails |
191
+ | Scale budget | tests or smoke output | `adapt:check`, `verify:publish`, inventory and query stay within budget | smoke: record baseline and fail only on large regression |
192
+
193
+ Existing baseline on 2026-04-29:
194
+
195
+ - `.claude/skills`: 672K
196
+ - `.codex/skills`: 632K
197
+ - `docs`: 236K
198
+ - `lib`: 688K
199
+ - `config`: 20K
200
+ - Relevant files scanned: 313
201
+ - `npm run adapt:check`: 3.207s
202
+ - `npm run verify:publish`: 4.757s
203
+
204
+ Budgets should prevent avoidable full-repo scans. Optional codebase map never runs in the
205
+ default planning path.
206
+
207
+ ## Artifact Ownership Table
208
+
209
+ | Data | Owner | Human view | Machine truth |
210
+ | --- | --- | --- | --- |
211
+ | Ambiguity and assumptions | `cc-plan` | `planning/design.md` | `task-manifest.json.planningMeta` |
212
+ | Imported doc trust classification | `cc-plan` | `planning/design.md` | `task-manifest.json.sourceEvidence[]` |
213
+ | Task graph and waves | `cc-plan` / `cc-do` | `planning/tasks.md` | `task-manifest.json.tasks[]` |
214
+ | Quick lane state | `cc-do` | checkpoint summary | `task-manifest.json.metadata`, `checkpoint.json` |
215
+ | Debug hypotheses and probes | `cc-investigate` | `planning/analysis.md` | optional `task-manifest.json.investigation` |
216
+ | Verification/UAT/facets | `cc-check` | review summary | `report-card.json` |
217
+ | Runtime failures | `cc-check` | review summary | `report-card.json.runtime.failureOwnership[]` |
218
+ | Ship target and rollback | `cc-act` | `handoff/pr-brief.md` / `release-note.md` | structured preflight output |
219
+ | Inventory parity | compiler/docs-sync | publish report | compiler inventory manifest |
220
+ | Query state | runtime | CLI/doctor output | typed derived view from existing artifacts |
221
+
222
+ ## Named Error And Rescue Contract
223
+
224
+ Every new query, gate, preflight, inventory check, and debug path must name failures.
225
+
226
+ | Error name | Trigger | Rescue action | User sees |
227
+ | --- | --- | --- | --- |
228
+ | `MissingArtifactError` | required artifact is absent | show artifact path and owner skill | blocked with next action |
229
+ | `InvalidJsonError` | JSON parse fails | show path and parse excerpt | blocked, repair artifact |
230
+ | `SchemaValidationError` | Zod/schema check fails | show schema path and failing field | blocked, reroute owner skill |
231
+ | `NoActiveChangeError` | no change selected | ask for change key or query list | clear prompt |
232
+ | `InvalidTaskGraphError` | missing dependency, cycle, invalid active phase | reroute `cc-plan` or `cc-do` | blocked graph summary |
233
+ | `InventoryDriftError` | managed file missing, extra, or hash drifted | run adapt or update inventory | publish blocked |
234
+ | `TrustBoundaryError` | external source tries to become instruction | classify as evidence-only and block if unresolved | planning blocked |
235
+ | `ShipPreflightError` | branch/base/auth/clean tree/review freshness fails | show failed preflight item | act blocked |
236
+
237
+ Catch-all logging is not sufficient. Every rescued error must provide an artifact ref,
238
+ owner skill, and next action.
239
+
240
+ ## Shadow Path Matrix
241
+
242
+ | Flow | Nil/missing | Empty | Invalid | Conflict | Stale | Partial |
243
+ | --- | --- | --- | --- | --- | --- | --- |
244
+ | external docs -> `cc-plan` | block with missing source | skip with reason | `TrustBoundaryError` | conflict bucket | mark stale source | partial import warning |
245
+ | `tasks.md` -> `task-manifest.json` | block | block | schema error | dependency conflict | plan version mismatch | no manifest approval |
246
+ | manifest -> wave scheduling | block | no runnable task | `InvalidTaskGraphError` | serialize or block | stale checkpoint rejected | reroute resume |
247
+ | debug session -> analysis | block freeze | require note | schema/narrative mismatch | competing hypotheses | stale symptom | diagnose-only |
248
+ | query registry -> next action | `MissingArtifactError` | no next action with reason | named parse/schema error | blocked graph | stale state warning | degraded output |
249
+ | inventory -> publish gate | missing inventory blocks | empty inventory blocks | schema error | drift blocks | stale hash blocks | publish blocked |
250
+ | ship preflight -> `cc-act` | missing remote/base handled | local handoff path | `ShipPreflightError` | branch/PR conflict | stale review blocks | handoff fallback |
251
+
252
+ ## Trust Boundary Contract
253
+
254
+ External text includes imported PRDs, ADRs, specs, repo docs, web pages, compressed memory,
255
+ issues, and PR comments. These inputs can become evidence, constraints, or questions.
256
+ They cannot directly become workflow instructions.
257
+
258
+ Required classifications:
259
+
260
+ - `source`: where the text came from
261
+ - `trust`: `internal-contract` / `repo-evidence` / `external-evidence` / `untrusted-text`
262
+ - `allowedUse`: evidence, term proposal, constraint candidate, blocker, or follow-up
263
+ - `instructionUse`: always false unless the source is a cc-devflow SKILL/PLAYBOOK/config contract
264
+ - `finding`: optional prompt-injection/security note
265
+
266
+ Prompt-injection scanning is best placed at import and planning boundaries. Adapter hooks
267
+ remain opt-in safety aids, not default blockers.
268
+
269
+ ## Migration Test Matrix
270
+
271
+ | Area | Unit | Integration | Publish/adapt gate | Hostile fixture |
272
+ | --- | --- | --- | --- | --- |
273
+ | `cc-plan` ambiguity/trust | score and bucket parser | plan artifact fixture | example binding if public docs change | injection doc stays evidence-only |
274
+ | `cc-do` waves/touches | schema conflict | dispatch/resume | none | stale plan version rejected |
275
+ | `cc-investigate` debug session | session block parser | diagnose-only fixture | example fixture if template changes | missing probe cleanup blocks freeze |
276
+ | `cc-check` UAT/errors/facets | report-card schema | verify gate fixture | `verify:examples` | invalid artifact blocks pass |
277
+ | `cc-act` preflight/rollback | preflight parser | shell fixture | `verify:publish` | missing auth/dirty tree explicit |
278
+ | Runtime query registry | dispatch and errors | full-state fixture | none | missing/invalid/stale artifacts |
279
+ | Compiler inventory | manifest schema | drift fixture | `adapt:check`, `verify:publish` | drifted mirror blocks |
280
+
281
+ Test framework: Jest. Existing tests already cover schema, query, dispatch, compiler drift,
282
+ config, adapter security, and publish validation. New work must add negative fixtures before
283
+ claiming the contract is migrated.
284
+
285
+ ## Module Boundary Plan
286
+
287
+ Do not grow existing large files unless the change is a local extension of their current job.
288
+
289
+ | Module | Responsibility |
290
+ | --- | --- |
291
+ | `lib/skill-runtime/errors.js` | named runtime error classes and formatting |
292
+ | `lib/skill-runtime/query-registry.js` | typed read-only query dispatch |
293
+ | `lib/skill-runtime/trace.js` | eventId, artifact refs, next action shape |
294
+ | `lib/skill-runtime/query.js` | compatibility facade over query registry |
295
+ | `lib/compiler/inventory.js` | managed inventory, hashes, parity rules |
296
+ | `scripts/validate-publish.js` | invoke inventory validation, not own all logic |
297
+ | SKILL-local scripts | owner-specific gate logic and human output |
298
+
299
+ Large-file guardrails:
300
+
301
+ - Keep `schemas.js` for schemas only.
302
+ - Keep `query.js` as facade, not new business logic.
303
+ - Keep `validate-publish.js` as orchestrator, not inventory implementation.
304
+ - Split commits by module and SKILL owner.
305
+
306
+ ## Phased Rollout Plan
307
+
308
+ ### Phase 1: Contract-first document and first executable seam
309
+
310
+ - Rewrite this blueprint into SKILL-owned sections.
311
+ - Add artifact ownership, named errors, shadow paths, test matrix, module boundary, scale budget.
312
+ - First implementation targets `cc-plan` and `cc-do` only where existing schema/query tests already support validation.
313
+ - Required proof: hostile fixtures for missing/invalid/stale/conflict states.
314
+
315
+ ### Phase 2: Runtime query and named error foundation
316
+
317
+ - Add `errors.js`, `query-registry.js`, `trace.js`.
318
+ - Keep SKILL semantics outside runtime.
319
+ - Required proof: typed query unit tests and missing/invalid/stale artifact fixtures.
320
+
321
+ ### Phase 3: `cc-investigate` debug session and forensics
322
+
323
+ - Extend `planning/analysis.md` and optional machine summary.
324
+ - Required proof: diagnose-only and missing cleanup fixtures.
325
+
326
+ ### Phase 4: `cc-check` and `cc-act` consumers
327
+
328
+ - Add human UAT, named error ownership, ship preflight, rollback guard.
329
+ - Required proof: report-card and preflight fixtures.
330
+
331
+ ### Phase 5: Compiler inventory and publish gate
332
+
333
+ - Add inventory parity and drift checks.
334
+ - Required proof: `adapt:check`, `verify:examples`, `verify:publish`, and drifted mirror fixture.
335
+
336
+ Rollback should be per phase: revert the SKILL version and the module/gate introduced in that phase.
337
+ Do not ship all phases as one undifferentiated release.
338
+
339
+ ## Anti-GSD Drift Charter
340
+
341
+ These rules protect cc-devflow's identity:
342
+
343
+ 1. Do not add GSD command aliases as public entry points.
344
+ 2. Do not add manager UI or default runtime dashboard before typed query and artifacts are stable.
345
+ 3. Do not default-enable hooks; adapter safety remains opt-in unless the platform requires it.
346
+ 4. Do not create a competing `.planning/` tree.
347
+ 5. Do not make codebase map a default artifact.
348
+ 6. Do not hide workflow decisions inside runtime helpers.
349
+ 7. Do not add a new durable truth source when an existing artifact can own the field.
350
+ 8. Every migrated mechanism must name its SKILL owner, artifact owner, test gate, and rollback path.
351
+
352
+ ## What Already Exists
353
+
354
+ | Existing cc-devflow asset | Reuse |
355
+ | --- | --- |
356
+ | `lib/skill-runtime/query.js` | current progress/next/full-state facade |
357
+ | `lib/skill-runtime/schemas.js` | manifest/report/checkpoint schema boundary |
358
+ | `lib/skill-runtime/config.js` | layered config and doctor pattern |
359
+ | `lib/compiler/manifest.js` | hash and drift detection foundation |
360
+ | `scripts/validate-publish.js` | publish validation orchestrator |
361
+ | `docs/examples/scripts/check-example-bindings.sh` | example/version drift gate |
362
+ | `npm run adapt:check` | platform mirror drift check |
363
+ | `npm run verify:publish` | package and public skill contract validation |
364
+
365
+ Reuse these before adding new systems.
366
+
367
+ ## NOT In Scope
368
+
369
+ - Copying GSD's 86 command surface.
370
+ - Copying GSD's 33-agent surface as named cc-devflow agents.
371
+ - Copying Claude-specific `ultraplan-phase`.
372
+ - Adding community/marketing commands such as `join-discord`.
373
+ - Making `graphify` a default project capability.
374
+ - Building a manager/autonomous UI.
375
+ - Default-enabling safety hooks.
376
+ - Replacing `devflow/changes/<change-key>` with GSD `.planning/`.
377
+ - Treating model/provider profile as a required workflow contract.
378
+
379
+ ## Appendix A: Command Coverage
380
+
381
+ The table below proves the GSD command surface was reviewed. It is coverage evidence,
382
+ not the cc-devflow implementation order.
383
+
384
+ ### Core Workflow
385
+
386
+ | GSD command | Decision |
387
+ | --- | --- |
388
+ | `new-project` | migrate bootstrap checklist into `cc-roadmap` / `cc-spec-init` |
389
+ | `new-workspace` | partial: multi-repo/worktree execution isolation |
390
+ | `list-workspaces` | low priority runtime query |
391
+ | `remove-workspace` | `cc-act` cleanup guard |
392
+ | `discuss-phase` | migrate assumptions/batch/text mechanisms only |
393
+ | `spec-phase` | P0: WHAT/WHY ambiguity gate |
394
+ | `ui-phase` | conditional UI contract template |
395
+ | `ai-integration-phase` | conditional AI scope review/eval plan |
396
+ | `plan-phase` | P0 bounded review loop |
397
+ | `plan-review-convergence` | high-concern convergence only |
398
+ | `ultraplan-phase` | skip, Claude-specific |
399
+ | `spike` | prototype exception + evidence |
400
+ | `sketch` | design exploration evidence, no command |
401
+ | `research-phase` | source authority in Context Sweep |
402
+ | `execute-phase` | P0 wave scheduling |
403
+ | `verify-work` | UAT + auto reroute |
404
+ | `ship` | structured ship preflight |
405
+ | `next` | runtime query `route.next-action` |
406
+ | `fast` | TDD exception / quick lane rule |
407
+ | `quick` | mini manifest + checkpoint |
408
+ | `ui-review` | conditional frontend `cc-check` facet |
409
+ | `code-review` | finding schema |
410
+ | `code-review-fix` | fix loop and return to `cc-check` |
411
+ | `eval-review` | conditional AI eval facet |
412
+
413
+ ### Phase And Milestone Management
414
+
415
+ | GSD command | Decision |
416
+ | --- | --- |
417
+ | `add-phase` | roadmap append helper |
418
+ | `edit-phase` | roadmap edit semantics |
419
+ | `insert-phase` | urgent insertion semantics, no decimal numbering |
420
+ | `remove-phase` | backlog/roadmap cleanup guard |
421
+ | `add-tests` | coverage gap task generation |
422
+ | `list-phase-assumptions` | assumptions preview |
423
+ | `analyze-dependencies` | roadmap graph and task deps |
424
+ | `validate-phase` | report-card gap closure |
425
+ | `secure-phase` | conditional security facet |
426
+ | `audit-milestone` | post-merge/closeout audit |
427
+ | `audit-uat` | human feedback debt audit |
428
+ | `audit-fix` | classification only, no auto big-rewrite |
429
+ | `plan-milestone-gaps` | roadmap/plan gap writeback |
430
+ | `complete-milestone` | partial: archive/version/tag via `cc-act` / `npm-release` |
431
+ | `new-milestone` | stage reset |
432
+ | `milestone-summary` | release/handoff summary |
433
+ | `cleanup` | low priority cleanup |
434
+ | `manager` | skip UI |
435
+ | `workstreams` | active pointer only |
436
+ | `autonomous` | smart-discuss/checkpoint guard only |
437
+ | `undo` | rollback guard |
438
+
439
+ ### Session And Navigation
440
+
441
+ | GSD command | Decision |
442
+ | --- | --- |
443
+ | `progress` | runtime query |
444
+ | `stats` | low priority runtime query |
445
+ | `session-report` | partial `cc-act` summary |
446
+ | `pause-work` | lightweight pause |
447
+ | `resume-work` | query-backed resume |
448
+ | `explore` | pre-roadmap exploration mode |
449
+ | `do` | natural-language route query, no new public command |
450
+ | `note` | roadmap/backlog note |
451
+ | `add-todo` | durable follow-up |
452
+ | `check-todos` | backlog promotion |
453
+ | `add-backlog` | parking lot without 999.x numbering |
454
+ | `review-backlog` | backlog promotion |
455
+ | `plant-seed` | deferred trigger |
456
+ | `thread` | lightweight resume/thread entry |
457
+
458
+ ### Codebase Intelligence
459
+
460
+ | GSD command | Decision |
461
+ | --- | --- |
462
+ | `map-codebase` | optional lane only |
463
+ | `scan` | lightweight Context Sweep |
464
+ | `intel` | medium-priority query/cache |
465
+ | `graphify` | skip default capability |
466
+ | `extract_learnings` | post-closeout learning extraction |
467
+
468
+ ### Review, Debug, Recovery
469
+
470
+ | GSD command | Decision |
471
+ | --- | --- |
472
+ | `review` | optional reviewer command/config |
473
+ | `debug` | P0 persistent investigation session |
474
+ | `forensics` | workflow failure mode |
475
+ | `health` | `cc-devflow doctor` direction |
476
+ | `import` | external plan conflict detection |
477
+ | `from-gsd2` | skip migration-only command |
478
+ | `inbox` | optional remote lane |
479
+
480
+ ### Docs, Profile, Utilities
481
+
482
+ | GSD command | Decision |
483
+ | --- | --- |
484
+ | `docs-update` | docs-sync fact check |
485
+ | `ingest-docs` | import conflict buckets |
486
+ | `spike-wrap-up` | project learning mechanism |
487
+ | `sketch-wrap-up` | project learning mechanism |
488
+ | `profile-user` | not a main workflow |
489
+ | `settings` | config profile support |
490
+ | `settings-advanced` | partial config support |
491
+ | `settings-integrations` | partial with secrets masking |
492
+ | `set-profile` | provider-neutral hints only |
493
+ | `pr-branch` | branch hygiene guard |
494
+ | `sync-skills` | adapt drift report |
495
+ | `update` | npm/update docs already cover |
496
+ | `reapply-patches` | low priority |
497
+ | `help` | existing docs/CLI |
498
+ | `join-discord` | skip |
499
+
500
+ ## Appendix B: Agent And Hook Coverage
501
+
502
+ | GSD area | Migration decision |
503
+ | --- | --- |
504
+ | Research agents | optional evidence lanes; write artifacts, do not add agent surface |
505
+ | Planning agents | producer/checker separation; no new agent names |
506
+ | Execution agents | mechanism only; no agent count migration |
507
+ | Verification agents | facets with PASS/PARTIAL/ESCALATE |
508
+ | Knowledge/docs agents | docs-sync and query support |
509
+ | Profile agents | config advisory only |
510
+ | Context/status/update hooks | skip or existing npm/update docs |
511
+ | Prompt/read/workflow guards | opt-in adapter safety and trust boundary |
512
+ | Commit/phase hooks | migrate checks, not hooks |
513
+
514
+ ## Taste Check
515
+
516
+ - Good strategy: make state, gates, context budget, trust boundaries, and parallelism machine-checkable.
517
+ - Bad strategy: turn every scenario into a command and make users learn the source system's shape.
518
+ - Correct cc-devflow path: few entry points, strong SKILL contracts, typed runtime reads, hostile fixtures, publish gates.
@@ -0,0 +1,48 @@
1
+ # External Skill Strategy Audit
2
+
3
+ 本审计覆盖 `/Users/dimon/001Area/80-CodeWorld/003-project/skills` 下的 22 个
4
+ `SKILL.md`。目标不是复制外部 skill,而是抽取能让 cc-devflow 原生 workflow
5
+ 更稳的策略,并把不适合迁移的部分明确跳过。
6
+
7
+ ## Migration Summary
8
+
9
+ | Source skill | Good strategy | cc-devflow target | Decision |
10
+ | --- | --- | --- | --- |
11
+ | `deprecated/design-an-interface` | "design it twice",用不同接口形态比较 depth、易用错点和隐藏复杂度 | `cc-plan` | 迁移为接口备选比较 gate,不迁移 parallel subagent 强制要求 |
12
+ | `deprecated/qa` | 用户视角 issue、轻量澄清、按可独立验证行为拆分 | `cc-act` / `cc-plan` | 迁移为 follow-up / issue handoff 的行为化规则 |
13
+ | `deprecated/request-refactor-plan` | 重构计划拆成 tiny commits,每步保持可运行 | `cc-plan` / `cc-act` | 迁移为 refactor slicing 和 bisectable commit 规则 |
14
+ | `deprecated/triage-issue` | 先查根因,再写 TDD fix plan,issue 不绑定易腐烂文件行号 | `cc-investigate` / `cc-plan` | 迁移为 repair contract 和 durable issue brief 规则 |
15
+ | `deprecated/ubiquitous-language` | canonical terms、aliases to avoid、ambiguity flag | `cc-spec-init` / `cc-plan` | 迁移为 capability/domain language glossary gate |
16
+ | `engineering/diagnose` | 反馈回路优先级、提高 flaky 复现率、假设必须可证伪、debug tag cleanup | `cc-investigate` | 已有大部分;补强 loop sharpening 和 postmortem handoff |
17
+ | `engineering/github-triage` | label state machine、needs-info 保留已确认事实、resume triage notes | `cc-act` | 迁移为远端 issue/PR closeout 的状态一致性规则 |
18
+ | `engineering/grill-with-docs` | 术语冲突立即叫停、具体场景压测、ADR 只记难逆/意外/真实取舍 | `cc-plan` | 已有大部分;补强 glossary update 和 ADR sparsity |
19
+ | `engineering/improve-codebase-architecture` | deep module、deletion test、one adapter vs two adapters、locality/leverage | `cc-simplify` / `cc-plan` | 迁移为架构坏味道确认清单 |
20
+ | `engineering/tdd` | 禁止水平切片,使用 tracer bullet 垂直 Red/Green 循环 | `cc-do` / `cc-plan` | 已有 planning 规则;补强执行阶段逐条 task 的 tracer bullet guard |
21
+ | `engineering/to-issues` | 独立可领的 vertical slices,HITL/AFK 标注,依赖顺序创建 | `cc-plan` / `cc-act` | 迁移为 task / follow-up 切片规则 |
22
+ | `engineering/to-prd` | 从现有上下文合成 PRD,测试决策只写行为和模块,不写短期文件路径 | `cc-plan` | 迁移为 design durable output 规则,不迁移 GitHub issue 自动创建 |
23
+ | `engineering/zoom-out` | 不熟悉区域时先上升一层,画模块和调用方地图 | `cc-roadmap` / `cc-plan` | 已被 context sweep 覆盖;仅作为审计备注 |
24
+ | `misc/git-guardrails-claude-code` | 阻断危险 git 动作,保留用户确认边界 | `cc-act` | 迁移为 destructive / publish action guard,不迁移 Claude hook 实现 |
25
+ | `misc/migrate-to-shoehorn` | 测试里的 partial fixture 要显式表达,不用不透明 cast 掩盖类型事实 | `cc-do` / `cc-check` | 迁移为通用 test fixture discipline,不绑定 shoehorn 依赖 |
26
+ | `misc/scaffold-exercises` | 生成目录后必须跑专用 lint,移动用 `git mv` 保留历史 | `cc-act` | 仅迁移验证/移动原则;课程目录规则不迁移 |
27
+ | `misc/setup-pre-commit` | 根据实际包管理器和已有 scripts 装配 hook,最后用真实 hook smoke | `cc-act` | 仅作为工具链变更验证参考,不迁移 Husky 方案 |
28
+ | `personal/edit-article` | 文档结构按依赖顺序组织,段落短、信息先后可追踪 | `docs-sync` | 迁移为 docs-sync 叙事顺序规则 |
29
+ | `personal/obsidian-vault` | index note、wikilink、反向查找的知识图谱维护 | none | 个人知识库规则,不迁移到 cc-devflow |
30
+ | `productivity/caveman` | 压缩沟通但保留精确技术事实,复杂步骤暂时恢复完整表达 | `cc-act` / output style | 作为输出风格参考,不写进 workflow 合约 |
31
+ | `productivity/grill-me` | 一次一个问题;能查代码就别问用户 | `cc-plan` | 已有规则;审计确认不重复迁移 |
32
+ | `productivity/write-a-skill` | description 是触发真相源;SKILL.md 要短,复杂内容下沉到 references/scripts | `docs-sync` | 迁移为 skill contract quality gate |
33
+
34
+ ## Implementation Order
35
+
36
+ 1. `cc-plan`: 吸收接口备选、领域语言、垂直切片和 durable design 输出规则。
37
+ 2. `cc-investigate`: 补强 feedback loop sharpening、flaky rate、postmortem handoff。
38
+ 3. `cc-do`: 补强 tracer bullet 执行和 test fixture discipline。
39
+ 4. `cc-simplify`: 增加 deep module / deletion test / adapter reality 检查。
40
+ 5. `cc-act`: 增加 issue/PR 状态、危险 git 动作、工具链验证和 durable follow-up 规则。
41
+ 6. `docs-sync`: 增加 skill 合约质量 gate 和文档依赖顺序检查。
42
+
43
+ ## Skip Rules
44
+
45
+ - 不迁移个人路径、个人 vault、课程目录命名、具体第三方测试依赖。
46
+ - 不把 deprecated skill 的 GitHub issue 自动创建行为搬进主流程;cc-devflow 仍以
47
+ durable local artifact 和可选 remote handoff 为主。
48
+ - 不新增一套平行 skill;所有迁移必须落回现有 `cc-*` workflow 语义。
@@ -0,0 +1,51 @@
1
+ const fs = require('fs');
2
+ const os = require('os');
3
+ const path = require('path');
4
+
5
+ const { validateSkillInventory } = require('../inventory');
6
+
7
+ function writeFile(filePath, content = '') {
8
+ fs.mkdirSync(path.dirname(filePath), { recursive: true });
9
+ fs.writeFileSync(filePath, content);
10
+ }
11
+
12
+ function makeSkill(root, name, files = ['SKILL.md']) {
13
+ for (const file of files) {
14
+ writeFile(path.join(root, '.claude/skills', name, file), `# ${name}\n`);
15
+ }
16
+ }
17
+
18
+ describe('compiler inventory parity', () => {
19
+ test('rejects unconfigured managed skill directories', () => {
20
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), 'cc-devflow-inventory-extra-'));
21
+ makeSkill(root, 'cc-plan', ['SKILL.md', 'PLAYBOOK.md']);
22
+ makeSkill(root, 'mystery-skill');
23
+
24
+ const errors = validateSkillInventory({
25
+ root,
26
+ publicSkills: ['cc-plan'],
27
+ distributedSkills: ['cc-plan'],
28
+ internalSkills: []
29
+ });
30
+
31
+ expect(errors).toContain('Unconfigured skill directory: mystery-skill');
32
+ });
33
+
34
+ test('requires public mirrors to match public skill inventory when present', () => {
35
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), 'cc-devflow-inventory-mirror-'));
36
+ makeSkill(root, 'cc-plan', ['SKILL.md', 'PLAYBOOK.md']);
37
+ writeFile(path.join(root, '.codex/skills/cc-roadmap/SKILL.md'), '# cc-roadmap\n');
38
+
39
+ const errors = validateSkillInventory({
40
+ root,
41
+ publicSkills: ['cc-plan'],
42
+ distributedSkills: ['cc-plan'],
43
+ internalSkills: []
44
+ });
45
+
46
+ expect(errors).toEqual(expect.arrayContaining([
47
+ 'Codex mirror missing public skill: cc-plan',
48
+ 'Codex mirror has unconfigured public skill: cc-roadmap'
49
+ ]));
50
+ });
51
+ });