cclaw-cli 7.7.1 → 8.1.1

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 (284) hide show
  1. package/README.md +211 -134
  2. package/dist/artifact-frontmatter.d.ts +51 -0
  3. package/dist/artifact-frontmatter.js +131 -0
  4. package/dist/artifact-paths.d.ts +7 -27
  5. package/dist/artifact-paths.js +20 -249
  6. package/dist/cancel.d.ts +16 -0
  7. package/dist/cancel.js +66 -0
  8. package/dist/cli.d.ts +2 -27
  9. package/dist/cli.js +107 -511
  10. package/dist/compound.d.ts +26 -0
  11. package/dist/compound.js +96 -0
  12. package/dist/config.d.ts +14 -51
  13. package/dist/config.js +23 -359
  14. package/dist/constants.d.ts +11 -18
  15. package/dist/constants.js +19 -106
  16. package/dist/content/antipatterns.d.ts +1 -0
  17. package/dist/content/antipatterns.js +109 -0
  18. package/dist/content/artifact-templates.d.ts +10 -0
  19. package/dist/content/artifact-templates.js +550 -0
  20. package/dist/content/cancel-command.d.ts +2 -2
  21. package/dist/content/cancel-command.js +25 -17
  22. package/dist/content/core-agents.d.ts +9 -233
  23. package/dist/content/core-agents.js +39 -768
  24. package/dist/content/decision-protocol.d.ts +1 -12
  25. package/dist/content/decision-protocol.js +27 -20
  26. package/dist/content/examples.d.ts +8 -42
  27. package/dist/content/examples.js +293 -425
  28. package/dist/content/idea-command.d.ts +2 -0
  29. package/dist/content/idea-command.js +38 -0
  30. package/dist/content/iron-laws.d.ts +4 -138
  31. package/dist/content/iron-laws.js +18 -197
  32. package/dist/content/meta-skill.d.ts +1 -3
  33. package/dist/content/meta-skill.js +57 -134
  34. package/dist/content/node-hooks.d.ts +12 -8
  35. package/dist/content/node-hooks.js +188 -838
  36. package/dist/content/recovery.d.ts +8 -0
  37. package/dist/content/recovery.js +179 -0
  38. package/dist/content/reference-patterns.d.ts +4 -13
  39. package/dist/content/reference-patterns.js +260 -389
  40. package/dist/content/research-playbooks.d.ts +8 -8
  41. package/dist/content/research-playbooks.js +108 -121
  42. package/dist/content/review-loop.d.ts +6 -192
  43. package/dist/content/review-loop.js +29 -731
  44. package/dist/content/skills.d.ts +8 -38
  45. package/dist/content/skills.js +681 -732
  46. package/dist/content/specialist-prompts/architect.d.ts +1 -0
  47. package/dist/content/specialist-prompts/architect.js +225 -0
  48. package/dist/content/specialist-prompts/brainstormer.d.ts +1 -0
  49. package/dist/content/specialist-prompts/brainstormer.js +168 -0
  50. package/dist/content/specialist-prompts/index.d.ts +2 -0
  51. package/dist/content/specialist-prompts/index.js +14 -0
  52. package/dist/content/specialist-prompts/planner.d.ts +1 -0
  53. package/dist/content/specialist-prompts/planner.js +182 -0
  54. package/dist/content/specialist-prompts/reviewer.d.ts +1 -0
  55. package/dist/content/specialist-prompts/reviewer.js +193 -0
  56. package/dist/content/specialist-prompts/security-reviewer.d.ts +1 -0
  57. package/dist/content/specialist-prompts/security-reviewer.js +133 -0
  58. package/dist/content/specialist-prompts/slice-builder.d.ts +1 -0
  59. package/dist/content/specialist-prompts/slice-builder.js +232 -0
  60. package/dist/content/stage-playbooks.d.ts +8 -0
  61. package/dist/content/stage-playbooks.js +404 -0
  62. package/dist/content/start-command.d.ts +2 -12
  63. package/dist/content/start-command.js +221 -207
  64. package/dist/flow-state.d.ts +21 -178
  65. package/dist/flow-state.js +67 -170
  66. package/dist/fs-utils.d.ts +6 -26
  67. package/dist/fs-utils.js +29 -162
  68. package/dist/gitignore.d.ts +2 -1
  69. package/dist/gitignore.js +51 -34
  70. package/dist/harness-detect.d.ts +10 -0
  71. package/dist/harness-detect.js +29 -0
  72. package/dist/harness-prompt.d.ts +26 -0
  73. package/dist/harness-prompt.js +142 -0
  74. package/dist/install.d.ts +35 -15
  75. package/dist/install.js +238 -1347
  76. package/dist/knowledge-store.d.ts +19 -163
  77. package/dist/knowledge-store.js +56 -590
  78. package/dist/logger.d.ts +8 -3
  79. package/dist/logger.js +13 -4
  80. package/dist/orchestrator-routing.d.ts +29 -0
  81. package/dist/orchestrator-routing.js +156 -0
  82. package/dist/run-persistence.d.ts +7 -118
  83. package/dist/run-persistence.js +29 -845
  84. package/dist/runtime/run-hook.entry.d.ts +1 -3
  85. package/dist/runtime/run-hook.entry.js +19 -4
  86. package/dist/runtime/run-hook.mjs +13 -1024
  87. package/dist/types.d.ts +25 -261
  88. package/dist/types.js +8 -36
  89. package/package.json +6 -3
  90. package/dist/artifact-linter/brainstorm.d.ts +0 -2
  91. package/dist/artifact-linter/brainstorm.js +0 -353
  92. package/dist/artifact-linter/design.d.ts +0 -18
  93. package/dist/artifact-linter/design.js +0 -444
  94. package/dist/artifact-linter/findings-dedup.d.ts +0 -56
  95. package/dist/artifact-linter/findings-dedup.js +0 -232
  96. package/dist/artifact-linter/plan.d.ts +0 -2
  97. package/dist/artifact-linter/plan.js +0 -826
  98. package/dist/artifact-linter/review-army.d.ts +0 -49
  99. package/dist/artifact-linter/review-army.js +0 -520
  100. package/dist/artifact-linter/review.d.ts +0 -2
  101. package/dist/artifact-linter/review.js +0 -113
  102. package/dist/artifact-linter/scope.d.ts +0 -2
  103. package/dist/artifact-linter/scope.js +0 -158
  104. package/dist/artifact-linter/shared.d.ts +0 -637
  105. package/dist/artifact-linter/shared.js +0 -2163
  106. package/dist/artifact-linter/ship.d.ts +0 -2
  107. package/dist/artifact-linter/ship.js +0 -250
  108. package/dist/artifact-linter/spec.d.ts +0 -2
  109. package/dist/artifact-linter/spec.js +0 -176
  110. package/dist/artifact-linter/tdd.d.ts +0 -118
  111. package/dist/artifact-linter/tdd.js +0 -1404
  112. package/dist/artifact-linter.d.ts +0 -15
  113. package/dist/artifact-linter.js +0 -517
  114. package/dist/codex-feature-flag.d.ts +0 -58
  115. package/dist/codex-feature-flag.js +0 -193
  116. package/dist/content/closeout-guidance.d.ts +0 -14
  117. package/dist/content/closeout-guidance.js +0 -44
  118. package/dist/content/diff-command.d.ts +0 -1
  119. package/dist/content/diff-command.js +0 -43
  120. package/dist/content/harness-doc.d.ts +0 -1
  121. package/dist/content/harness-doc.js +0 -65
  122. package/dist/content/hook-events.d.ts +0 -9
  123. package/dist/content/hook-events.js +0 -23
  124. package/dist/content/hook-manifest.d.ts +0 -81
  125. package/dist/content/hook-manifest.js +0 -156
  126. package/dist/content/hooks.d.ts +0 -11
  127. package/dist/content/hooks.js +0 -1972
  128. package/dist/content/idea.d.ts +0 -60
  129. package/dist/content/idea.js +0 -416
  130. package/dist/content/language-policy.d.ts +0 -2
  131. package/dist/content/language-policy.js +0 -13
  132. package/dist/content/learnings.d.ts +0 -6
  133. package/dist/content/learnings.js +0 -141
  134. package/dist/content/observe.d.ts +0 -19
  135. package/dist/content/observe.js +0 -86
  136. package/dist/content/opencode-plugin.d.ts +0 -1
  137. package/dist/content/opencode-plugin.js +0 -635
  138. package/dist/content/review-prompts.d.ts +0 -1
  139. package/dist/content/review-prompts.js +0 -104
  140. package/dist/content/runtime-shared-snippets.d.ts +0 -8
  141. package/dist/content/runtime-shared-snippets.js +0 -80
  142. package/dist/content/session-hooks.d.ts +0 -7
  143. package/dist/content/session-hooks.js +0 -107
  144. package/dist/content/skills-elicitation.d.ts +0 -1
  145. package/dist/content/skills-elicitation.js +0 -167
  146. package/dist/content/stage-command.d.ts +0 -2
  147. package/dist/content/stage-command.js +0 -17
  148. package/dist/content/stage-schema.d.ts +0 -117
  149. package/dist/content/stage-schema.js +0 -955
  150. package/dist/content/stages/_lint-metadata/index.d.ts +0 -2
  151. package/dist/content/stages/_lint-metadata/index.js +0 -97
  152. package/dist/content/stages/brainstorm.d.ts +0 -2
  153. package/dist/content/stages/brainstorm.js +0 -184
  154. package/dist/content/stages/design.d.ts +0 -2
  155. package/dist/content/stages/design.js +0 -288
  156. package/dist/content/stages/index.d.ts +0 -8
  157. package/dist/content/stages/index.js +0 -11
  158. package/dist/content/stages/plan.d.ts +0 -2
  159. package/dist/content/stages/plan.js +0 -191
  160. package/dist/content/stages/review.d.ts +0 -2
  161. package/dist/content/stages/review.js +0 -240
  162. package/dist/content/stages/schema-types.d.ts +0 -203
  163. package/dist/content/stages/schema-types.js +0 -1
  164. package/dist/content/stages/scope.d.ts +0 -2
  165. package/dist/content/stages/scope.js +0 -254
  166. package/dist/content/stages/ship.d.ts +0 -2
  167. package/dist/content/stages/ship.js +0 -159
  168. package/dist/content/stages/spec.d.ts +0 -2
  169. package/dist/content/stages/spec.js +0 -170
  170. package/dist/content/stages/tdd.d.ts +0 -4
  171. package/dist/content/stages/tdd.js +0 -273
  172. package/dist/content/state-contracts.d.ts +0 -1
  173. package/dist/content/state-contracts.js +0 -63
  174. package/dist/content/status-command.d.ts +0 -4
  175. package/dist/content/status-command.js +0 -109
  176. package/dist/content/subagent-context-skills.d.ts +0 -4
  177. package/dist/content/subagent-context-skills.js +0 -279
  178. package/dist/content/subagents.d.ts +0 -3
  179. package/dist/content/subagents.js +0 -997
  180. package/dist/content/templates.d.ts +0 -26
  181. package/dist/content/templates.js +0 -1692
  182. package/dist/content/track-render-context.d.ts +0 -18
  183. package/dist/content/track-render-context.js +0 -53
  184. package/dist/content/tree-command.d.ts +0 -1
  185. package/dist/content/tree-command.js +0 -64
  186. package/dist/content/utility-skills.d.ts +0 -30
  187. package/dist/content/utility-skills.js +0 -160
  188. package/dist/content/view-command.d.ts +0 -2
  189. package/dist/content/view-command.js +0 -92
  190. package/dist/delegation.d.ts +0 -649
  191. package/dist/delegation.js +0 -1539
  192. package/dist/early-loop.d.ts +0 -70
  193. package/dist/early-loop.js +0 -302
  194. package/dist/execution-topology.d.ts +0 -44
  195. package/dist/execution-topology.js +0 -95
  196. package/dist/gate-evidence.d.ts +0 -85
  197. package/dist/gate-evidence.js +0 -631
  198. package/dist/harness-adapters.d.ts +0 -151
  199. package/dist/harness-adapters.js +0 -756
  200. package/dist/harness-selection.d.ts +0 -31
  201. package/dist/harness-selection.js +0 -214
  202. package/dist/hook-schema.d.ts +0 -6
  203. package/dist/hook-schema.js +0 -114
  204. package/dist/hook-schemas/claude-hooks.v1.json +0 -10
  205. package/dist/hook-schemas/codex-hooks.v1.json +0 -10
  206. package/dist/hook-schemas/cursor-hooks.v1.json +0 -13
  207. package/dist/init-detect.d.ts +0 -2
  208. package/dist/init-detect.js +0 -50
  209. package/dist/internal/advance-stage/advance.d.ts +0 -89
  210. package/dist/internal/advance-stage/advance.js +0 -655
  211. package/dist/internal/advance-stage/cancel-run.d.ts +0 -8
  212. package/dist/internal/advance-stage/cancel-run.js +0 -19
  213. package/dist/internal/advance-stage/flow-state-coercion.d.ts +0 -3
  214. package/dist/internal/advance-stage/flow-state-coercion.js +0 -81
  215. package/dist/internal/advance-stage/helpers.d.ts +0 -14
  216. package/dist/internal/advance-stage/helpers.js +0 -145
  217. package/dist/internal/advance-stage/hook.d.ts +0 -8
  218. package/dist/internal/advance-stage/hook.js +0 -40
  219. package/dist/internal/advance-stage/parsers.d.ts +0 -72
  220. package/dist/internal/advance-stage/parsers.js +0 -357
  221. package/dist/internal/advance-stage/proactive-delegation-trace.d.ts +0 -24
  222. package/dist/internal/advance-stage/proactive-delegation-trace.js +0 -56
  223. package/dist/internal/advance-stage/review-loop.d.ts +0 -16
  224. package/dist/internal/advance-stage/review-loop.js +0 -199
  225. package/dist/internal/advance-stage/rewind.d.ts +0 -14
  226. package/dist/internal/advance-stage/rewind.js +0 -108
  227. package/dist/internal/advance-stage/start-flow.d.ts +0 -13
  228. package/dist/internal/advance-stage/start-flow.js +0 -241
  229. package/dist/internal/advance-stage/verify.d.ts +0 -21
  230. package/dist/internal/advance-stage/verify.js +0 -185
  231. package/dist/internal/advance-stage.d.ts +0 -7
  232. package/dist/internal/advance-stage.js +0 -138
  233. package/dist/internal/cohesion-contract-stub.d.ts +0 -24
  234. package/dist/internal/cohesion-contract-stub.js +0 -148
  235. package/dist/internal/compound-readiness.d.ts +0 -23
  236. package/dist/internal/compound-readiness.js +0 -102
  237. package/dist/internal/detect-public-api-changes.d.ts +0 -5
  238. package/dist/internal/detect-public-api-changes.js +0 -45
  239. package/dist/internal/detect-supply-chain-changes.d.ts +0 -6
  240. package/dist/internal/detect-supply-chain-changes.js +0 -138
  241. package/dist/internal/early-loop-status.d.ts +0 -7
  242. package/dist/internal/early-loop-status.js +0 -93
  243. package/dist/internal/envelope-validate.d.ts +0 -7
  244. package/dist/internal/envelope-validate.js +0 -66
  245. package/dist/internal/flow-state-repair.d.ts +0 -20
  246. package/dist/internal/flow-state-repair.js +0 -104
  247. package/dist/internal/plan-split-waves.d.ts +0 -190
  248. package/dist/internal/plan-split-waves.js +0 -764
  249. package/dist/internal/runtime-integrity.d.ts +0 -7
  250. package/dist/internal/runtime-integrity.js +0 -268
  251. package/dist/internal/slice-commit.d.ts +0 -7
  252. package/dist/internal/slice-commit.js +0 -619
  253. package/dist/internal/tdd-loop-status.d.ts +0 -14
  254. package/dist/internal/tdd-loop-status.js +0 -68
  255. package/dist/internal/tdd-red-evidence.d.ts +0 -7
  256. package/dist/internal/tdd-red-evidence.js +0 -153
  257. package/dist/internal/waiver-grant.d.ts +0 -62
  258. package/dist/internal/waiver-grant.js +0 -294
  259. package/dist/internal/wave-status.d.ts +0 -74
  260. package/dist/internal/wave-status.js +0 -506
  261. package/dist/managed-resources.d.ts +0 -53
  262. package/dist/managed-resources.js +0 -313
  263. package/dist/policy.d.ts +0 -10
  264. package/dist/policy.js +0 -167
  265. package/dist/retro-gate.d.ts +0 -9
  266. package/dist/retro-gate.js +0 -47
  267. package/dist/run-archive.d.ts +0 -61
  268. package/dist/run-archive.js +0 -391
  269. package/dist/runs.d.ts +0 -2
  270. package/dist/runs.js +0 -2
  271. package/dist/stack-detection.d.ts +0 -116
  272. package/dist/stack-detection.js +0 -489
  273. package/dist/streaming/event-stream.d.ts +0 -31
  274. package/dist/streaming/event-stream.js +0 -114
  275. package/dist/tdd-cycle.d.ts +0 -107
  276. package/dist/tdd-cycle.js +0 -289
  277. package/dist/tdd-verification-evidence.d.ts +0 -17
  278. package/dist/tdd-verification-evidence.js +0 -122
  279. package/dist/track-heuristics.d.ts +0 -27
  280. package/dist/track-heuristics.js +0 -154
  281. package/dist/util/slice-id.d.ts +0 -58
  282. package/dist/util/slice-id.js +0 -89
  283. package/dist/worktree-manager.d.ts +0 -20
  284. package/dist/worktree-manager.js +0 -108
@@ -0,0 +1,550 @@
1
+ const PLAN_TEMPLATE = `---
2
+ slug: SLUG-PLACEHOLDER
3
+ stage: plan
4
+ status: active
5
+ ac:
6
+ - id: AC-1
7
+ text: "Replace with the first observable outcome (something a user or test can verify)."
8
+ status: pending
9
+ parallelSafe: true
10
+ touchSurface: []
11
+ - id: AC-2
12
+ text: "Replace with the second observable outcome, or delete this entry if one AC is enough."
13
+ status: pending
14
+ parallelSafe: true
15
+ touchSurface: []
16
+ last_specialist: null
17
+ refines: null
18
+ shipped_at: null
19
+ ship_commit: null
20
+ review_iterations: 0
21
+ security_flag: false
22
+ ---
23
+
24
+ # SLUG-PLACEHOLDER
25
+
26
+ > One short paragraph: what we are doing and why. If the goal does not fit in 4 lines, the request is probably too large — split it.
27
+
28
+ ## Frame
29
+
30
+ _(Brainstormer-authored when invoked. 2-5 sentences: what is broken or missing today, who feels it, what success looks like a user or test can verify, what is explicitly out of scope. Cite real evidence — \`file:path:line\`, ticket id, conversation excerpt — when you have it. If the orchestrator runs inline without brainstormer, leave a one-line summary here.)_
31
+
32
+ ## Approaches
33
+
34
+ _(Optional. Brainstormer fills this in \`guided\` or \`deep\` posture. Drop dead options before showing the table; do not pad to 3 rows for symmetry.)_
35
+
36
+ | Role | Approach | Trade-off | Reuse / reference |
37
+ | --- | --- | --- | --- |
38
+ | baseline | _approach_ | _trade-off_ | _reference_ |
39
+ | challenger | _approach_ | _trade-off_ | _reference_ |
40
+
41
+ ## Selected Direction
42
+
43
+ _(One paragraph when Approaches exists; cites the picked row and why.)_
44
+
45
+ ## Not Doing
46
+
47
+ _(3-5 bullets the brainstorm explicitly is NOT committing to. Protects scope from silent enlargement.)_
48
+
49
+ - _explicit non-commitment_
50
+ - _explicit non-commitment_
51
+
52
+ ## Architecture
53
+
54
+ _(Architect, when invoked. Link to \`flows/SLUG-PLACEHOLDER/decisions.md\`. Keep this section short — full rationale lives in decisions.md.)_
55
+
56
+ ## Plan
57
+
58
+ _(Planner authors this. AC-aligned, not horizontal-layer. Each unit ships an end-to-end vertical slice for one AC.)_
59
+
60
+ - **Phase 1 — Foundation (AC-1).**
61
+ - Concrete change with file:path:line reference.
62
+ - **Phase 2 — Wiring (AC-2, AC-3).**
63
+ - Concrete change with file:path:line reference.
64
+
65
+ ## Acceptance Criteria
66
+
67
+ | id | text | status | parallelSafe | touchSurface | commit |
68
+ | --- | --- | --- | --- | --- | --- |
69
+ | AC-1 | _Replace with the first observable outcome._ | pending | true | _list of repo paths_ | — |
70
+ | AC-2 | _Replace or delete._ | pending | true | _list of repo paths_ | — |
71
+
72
+ The AC block is the source of truth. Every commit produced by \`commit-helper.mjs\` references exactly one AC id. \`parallelSafe: false\` opts the AC out of parallel-build dispatch; \`touchSurface\` is the list of repo-relative paths the AC is allowed to modify. Each AC must point at a real \`file:line\` or destination path.
73
+
74
+ ## Edge cases
75
+
76
+ _(Planner-authored. One bullet per AC naming the non-happy-path the slice-builder's RED test must encode.)_
77
+
78
+ - **AC-1** — _empty input / boundary / error response_.
79
+ - **AC-2** — _hover under 100ms / missing fixture / etc_.
80
+
81
+ ## Topology
82
+
83
+ _(Planner topology mode. Default: \`inline\`. \`parallel-build\` is opt-in; see lib/skills/parallel-build.md for rules.)_
84
+
85
+ - topology: inline
86
+ - slices: _none_
87
+
88
+ ## Traceability block
89
+
90
+ - AC-1 → commit pending
91
+ - AC-2 → commit pending
92
+
93
+ This block is rebuilt by \`commit-helper.mjs\` after every AC commit. Do not edit by hand once a commit is recorded.
94
+ `;
95
+ const BUILD_TEMPLATE = `---
96
+ slug: SLUG-PLACEHOLDER
97
+ stage: build
98
+ status: active
99
+ build_iterations: 0
100
+ last_commit: null
101
+ tdd_cycle: enforced
102
+ ---
103
+
104
+ # Build log — SLUG-PLACEHOLDER
105
+
106
+ This is the TDD implementation journal. Every AC goes through RED → GREEN → REFACTOR; every phase is a separate commit recorded by \`commit-helper.mjs --phase=…\`.
107
+
108
+ > **Iron Law:** NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST. The RED failure is the spec.
109
+
110
+ ## Plan summary
111
+
112
+ _(One paragraph mirroring \`plans/SLUG-PLACEHOLDER.md\` Plan section.)_
113
+
114
+ ## TDD cycle log
115
+
116
+ For every AC, append one row with **all six columns filled** before the AC is considered done.
117
+
118
+ | AC | Discovery | RED proof | GREEN evidence | REFACTOR notes | commits |
119
+ | --- | --- | --- | --- | --- | --- |
120
+ | AC-1 | _file:path:line refs from discovery_ | _failing test name + 1-3 line failure excerpt_ | _full-suite command + PASS summary_ | _shape change or "skipped: reason"_ | _red SHA, green SHA, refactor SHA (or "skipped")_ |
121
+
122
+ ## Watched-RED proofs
123
+
124
+ \`\`\`text
125
+ _(Per AC: command run, test name, 1-3 line failure excerpt that proves RED failed for the right reason.)_
126
+ _AC-1: npm test src/lib/permissions.ts -- -t "renders email"_
127
+ _ AssertionError: expected 'anna@example.com' got undefined_
128
+ \`\`\`
129
+
130
+ ## GREEN suite evidence
131
+
132
+ \`\`\`text
133
+ _(Per AC: command run, PASS/FAIL summary of the FULL relevant suite — not the single test.)_
134
+ _AC-1: npm test src/lib/__ 47 passed, 0 failed (in 1.8s)_
135
+ \`\`\`
136
+
137
+ ## REFACTOR notes
138
+
139
+ _(Per AC: one-line shape change applied, or explicit "skipped: <reason>". Silence is not acceptable; the gate forces the question.)_
140
+
141
+ - AC-1: extracted \`hasViewEmail\` helper from inline check.
142
+
143
+ ## Fix iterations (after a review block)
144
+
145
+ _(Append one fix-iteration block per review iteration that returned \`block\`. Same TDD cycle applies; same AC id is reused; finding F-N is cited in the message.)_
146
+
147
+ ### Fix iteration 1 — review block 1
148
+
149
+ | F-N | AC | phase | commit | files | note |
150
+ | --- | --- | --- | --- | --- | --- |
151
+ | F-2 | AC-1 | red | _SHA_ | _tests/...:line_ | _what the new RED encodes_ |
152
+ | F-2 | AC-1 | green | _SHA_ | _src/...:line_ | _minimal fix_ |
153
+ | F-2 | AC-1 | refactor (skipped) | — | — | _reason_ |
154
+
155
+ ## Hooks invoked
156
+
157
+ - \`commit-helper.mjs --ac=AC-1 --phase=red --message="red(AC-1): …"\` → _SHA_
158
+ - \`commit-helper.mjs --ac=AC-1 --phase=green --message="green(AC-1): …"\` → _SHA_
159
+ - \`commit-helper.mjs --ac=AC-1 --phase=refactor --message="refactor(AC-1): …"\` → _SHA_ or _skipped_
160
+
161
+ ## Notes
162
+
163
+ _(Surprises, deviations from the plan, tests added, refactors that came up, paths considered and discarded, etc.)_
164
+ `;
165
+ const REVIEW_TEMPLATE = `---
166
+ slug: SLUG-PLACEHOLDER
167
+ stage: review
168
+ status: active
169
+ review_iterations: 0
170
+ modes_run:
171
+ - code
172
+ findings_block: []
173
+ ledger_open: 0
174
+ ledger_closed: 0
175
+ zero_block_streak: 0
176
+ ---
177
+
178
+ # Review — SLUG-PLACEHOLDER
179
+
180
+ This is the review log. \`reviewer\` (and \`security-reviewer\`, when relevant) append findings here. The loop is producer ↔ critic: iteration N proposes findings, \`slice-builder\` (mode=fix-only) closes them, iteration N+1 re-checks. The loop ends when the convergence detector fires (see review-loop skill).
181
+
182
+ ## Run summary
183
+
184
+ | iteration | mode | reviewer | result | new_block | closed_block |
185
+ | --- | --- | --- | --- | --- | --- |
186
+ | 1 | code | reviewer | _pending_ | _N_ | _N_ |
187
+
188
+ Hard cap: 5 iterations. After the 5th, stop and surface what remains in the ledger.
189
+
190
+ ## Concern Ledger (append-only)
191
+
192
+ Stable global ids per slug. Rows are never edited or deleted, only appended. Closing a row requires a citation to the fix evidence (commit SHA, test name, or new file:line).
193
+
194
+ | ID | Opened in | Mode | Severity | Status | Closed in | Citation |
195
+ | --- | --- | --- | --- | --- | --- | --- |
196
+ | F-1 | 1 | code | _block / warn_ | _open / closed_ | _N or –_ | \`path:line\` or commit SHA |
197
+
198
+ Severity rules:
199
+
200
+ - \`block\` — must close before ship.
201
+ - \`warn\` — may ship; carries to \`ships/<slug>.md\` and \`learnings/<slug>.md\`.
202
+
203
+ ## Iteration logs
204
+
205
+ \`\`\`markdown
206
+ ## Iteration N — <mode> — <ISO timestamp>
207
+
208
+ Ledger reread:
209
+ - F-K: <closed | open | superseded by F-L> — <citation>
210
+
211
+ New findings:
212
+ - F-M <severity> — \`<path:line>\` — <description> → <proposed fix>
213
+
214
+ Five Failure Modes:
215
+ - Hallucinated actions: no / yes (cite)
216
+ - Scope creep: no / yes (cite)
217
+ - Cascading errors: no / yes (cite)
218
+ - Context loss: no / yes (cite)
219
+ - Tool misuse: no / yes (cite)
220
+
221
+ Decision: <block | warn | clear | cap-reached>
222
+ \`\`\`
223
+
224
+ ## Convergence detector
225
+
226
+ The loop ends when ANY signal fires:
227
+
228
+ 1. All ledger rows closed → \`clear\`.
229
+ 2. Two consecutive iterations with zero new \`block\` findings AND every open row is \`warn\` → \`clear\` (warn carry-over).
230
+ 3. Hard cap reached with at least one open \`block\` row → \`cap-reached\`.
231
+
232
+ Tie-breaker: if iteration 5 closes the last block row, return \`clear\` (signal #1) regardless of cap.
233
+
234
+ ## Decision values
235
+
236
+ - **block** — at least one open block row. slice-builder (fix-only) addresses them; re-review next iteration.
237
+ - **warn** — convergence signal #2 fired. Open warns carry over. Ship may proceed.
238
+ - **clear** — signal #1 (all closed) or signal #2 (warn-only convergence). Ready for ship.
239
+ - **cap-reached** — signal #3. Stop; orchestrator surfaces remaining open rows to the user; user picks \`/cc-cancel\` or \`accept warns and ship\` (only valid if every open row is severity=warn).
240
+ `;
241
+ const SHIP_TEMPLATE = `---
242
+ slug: SLUG-PLACEHOLDER
243
+ stage: ship
244
+ status: active
245
+ ship_commit: null
246
+ push_approved: false
247
+ pr_url: null
248
+ finalization_mode: null
249
+ preflight_passed: false
250
+ rollback_recorded: false
251
+ repo_mode: git
252
+ ---
253
+
254
+ # Ship notes — SLUG-PLACEHOLDER
255
+
256
+ This artifact is written just before \`runCompoundAndShip()\` archives the run. It must contain enough information for downstream operators to understand what shipped without opening every other artifact.
257
+
258
+ > **Iron Law:** NO MERGE WITHOUT GREEN PREFLIGHT, A WRITTEN ROLLBACK, AND EXACTLY ONE SELECTED FINALIZATION MODE. No exceptions for urgency. If no VCS is available, use \`FINALIZE_NO_VCS\` explicitly instead of inventing git steps.
259
+
260
+ ## Summary
261
+
262
+ _(2-4 lines: what changed, who needs to know.)_
263
+
264
+ ## Preflight checks (mandatory; fresh output in this artifact)
265
+
266
+ Every check below must produce fresh output in this section. Pasting "tests passed yesterday" does not count.
267
+
268
+ | Check | Command | Result | Notes |
269
+ | --- | --- | --- | --- |
270
+ | tests | _e.g._ \`npm test\` | _pass / fail_ | _file paths or test names_ |
271
+ | build | _e.g._ \`npm run build\` | _pass / fail_ | _output stderr lines_ |
272
+ | linter | _e.g._ \`npm run lint\` | _pass / fail_ | _file paths_ |
273
+ | type-check | _e.g._ \`npm run typecheck\` or \`tsc --noEmit\` | _pass / fail_ | _error count_ |
274
+ | clean tree | \`git status --porcelain\` | _empty / non-empty_ | _file paths_ |
275
+
276
+ Set \`preflight_passed: true\` in the frontmatter only when every row is pass/empty.
277
+
278
+ ## Repository mode detection
279
+
280
+ Run \`test -d .git && echo git || echo no-vcs\`. Result: _git / no-vcs_.
281
+
282
+ If no-vcs, the only valid finalization mode is \`FINALIZE_NO_VCS\`; document the manual handoff target and rollback owner in the relevant sections.
283
+
284
+ ## Merge-base detection (git mode only)
285
+
286
+ Run \`git merge-base HEAD <base-branch>\`. If the base has diverged significantly, flag for rebase-first BEFORE proceeding to finalization.
287
+
288
+ \`\`\`bash
289
+ $ git merge-base HEAD main
290
+ <sha>
291
+
292
+ $ git rev-list --count <sha>..main
293
+ N commits behind main
294
+ \`\`\`
295
+
296
+ If \`N > 0\` and any of those commits touch this slug's \`touchSurface\`, rebase first. Re-run preflight after the rebase; do not trust the prior preflight result.
297
+
298
+ ## AC ↔ commit map
299
+
300
+ | AC | text (one line) | red SHA | green SHA | refactor SHA | description |
301
+ | --- | --- | --- | --- | --- | --- |
302
+ | AC-1 | _AC text_ | _sha_ | _sha_ | _sha or skipped_ | _short description_ |
303
+
304
+ This table mirrors \`flows/SLUG-PLACEHOLDER/plan.md > Acceptance Criteria\` with the final SHAs from \`flow-state.ac[].phases\`. The orchestrator refuses to run \`runCompoundAndShip()\` if any AC still shows \`status: pending\`.
305
+
306
+ ## Rollback plan (mandatory)
307
+
308
+ The rollback plan has three explicit fields; missing any one blocks ship:
309
+
310
+ - **Trigger conditions (what tells you it is broken):** _e.g._ error rate on /api/list > 1% over 5 min; latency p95 > 800ms over 10 min; user-visible 5xx in dashboard.
311
+ - **Rollback steps (exact commands or git operations):** _e.g._ \`git revert <ship_commit>; git push origin main\`. For non-git: \`scp release/<slug>-prev.tar.gz <host>:/srv/app && systemctl restart app\`.
312
+ - **Verification (how to confirm rollback worked):** _e.g._ /healthz returns 200; error rate back to baseline within 5 min; smoke test \`curl /api/list | jq '.items | length'\` returns N.
313
+
314
+ Set \`rollback_recorded: true\` in the frontmatter only when all three fields are filled with concrete content.
315
+
316
+ ## Monitoring checklist
317
+
318
+ - Error rate on _/path_: baseline _N_/min, alert above _M_/min for _T_ min.
319
+ - Latency p95 on _/path_: baseline _Nms_, alert above _Mms_ for _T_ min.
320
+ - Business metric: _e.g._ search_quality_score (rolling 1h average should not drop > 5%).
321
+ - If no monitoring exists for the affected surface, flag in Risks section below.
322
+
323
+ ## Push / PR
324
+
325
+ - push: _pending — orchestrator must explicitly ask the user before running \`git push\`._
326
+ - PR: _pending — only created if the user explicitly says "open a PR"._
327
+
328
+ When push is approved, record the upstream branch + PR URL above.
329
+
330
+ ## Finalization mode (exactly ONE)
331
+
332
+ Pick exactly one. Setting \`finalization_mode\` to anything other than these five values is rejected:
333
+
334
+ - **FINALIZE_MERGE_LOCAL** — merge into the base branch locally; no PR.
335
+ - **FINALIZE_OPEN_PR** — push and open a PR with this artifact's Summary + AC↔commit map as the body.
336
+ - **FINALIZE_KEEP_BRANCH** — push the branch but leave the merge to a downstream operator.
337
+ - **FINALIZE_DISCARD_BRANCH** — delete the branch entirely (requires typed confirmation in the orchestrator turn).
338
+ - **FINALIZE_NO_VCS** — no VCS available; record manual handoff target and rollback owner.
339
+
340
+ Selected: _<one mode>_
341
+ Rationale: _<one sentence>_
342
+
343
+ ## Breaking changes / migration
344
+
345
+ _(If none, write "none". If any, link to migration notes — typically docs/migration-… or a release-notes file.)_
346
+
347
+ ## Release notes (one paragraph)
348
+
349
+ _(Suitable for CHANGELOG.md. Avoid TODOs and references that won't make sense to readers without internal context.)_
350
+
351
+ ## Risks carried over
352
+
353
+ _(List any \`warn\`-severity ledger rows from \`flows/SLUG-PLACEHOLDER/review.md\` and any \`open\` assumptions from the plan. Each line says: id, source, why we are shipping anyway.)_
354
+
355
+ - _e.g._ F-2 (warn) — \`tests/integration/list.test.ts:31\` — no negative test for empty page; tracked in \`flows/SLUG-PLACEHOLDER/learnings.md\`.
356
+
357
+ ## Victory Detector
358
+
359
+ Ship is allowed only when ALL of these are true:
360
+
361
+ - valid review verdict (\`clear\` or \`warn\` with convergence signal #2)
362
+ - preflight_passed=true with fresh output
363
+ - rollback_recorded=true with all three fields filled
364
+ - finalization_mode set to exactly one enum value
365
+ - repo_mode matches the chosen finalization (\`no-vcs\` repo cannot pick \`FINALIZE_MERGE_LOCAL\`)
366
+
367
+ If any field is stale or missing, keep \`status: blocked\` and iterate.
368
+ `;
369
+ const DECISIONS_TEMPLATE = `---
370
+ slug: SLUG-PLACEHOLDER
371
+ stage: plan
372
+ status: active
373
+ decision_count: 0
374
+ architecture_tier: null
375
+ ---
376
+
377
+ # Decisions — SLUG-PLACEHOLDER
378
+
379
+ \`architect\` (and any reviewer in \`text-review\` mode) records decisions here. Each decision is independently citable.
380
+
381
+ ## Architecture tier
382
+
383
+ _(Architect picks one tier per slug, recorded once at the top of this file. Tier sets the depth bar for the whole D-N set.)_
384
+
385
+ - **minimum-viable** — solve only the immediate failure mode; ignore future-proofing. Use for hot-fixes, small enhancements, doc-only.
386
+ - **product-grade** — production-ready quality bar; includes failure modes, monitoring hooks, rollback plan. Default for most slugs.
387
+ - **ideal** — invest in long-term shape (clean abstractions, full failure-mode coverage, perf budgets, security review). Use only when explicitly requested or when the change is foundational.
388
+
389
+ Selected tier: _<minimum-viable | product-grade | ideal>_
390
+ Rationale: _<one sentence>_
391
+
392
+ ## Trivial-Change Escape Hatch
393
+
394
+ _(If the change is ≤3 files, no new interfaces, no cross-module data flow, write a one-paragraph mini-decision here and skip the full D-N machinery. Otherwise write \`Not applicable.\`.)_
395
+
396
+ ## Blast-radius Diff
397
+
398
+ _(Only the paths this slug touches, not the whole repo. Cite \`git diff\` against the slug's baseline SHA. Skip for trivial changes.)_
399
+
400
+ \`\`\`text
401
+ $ git diff <baseline-sha>..HEAD --stat
402
+ src/api/list.ts | 12 +
403
+ tests/unit/list.test.ts | 6 +
404
+ \`\`\`
405
+
406
+ ## D-1 — _decision title_
407
+
408
+ - **Context:** _what makes this a real decision instead of a default._
409
+ - **Considered options:**
410
+ - Option A — _summary_
411
+ - Option B — _summary_
412
+ - Option C — _summary_
413
+ - **Selected:** Option _X_
414
+ - **Rationale:** _why X beats A / B / C right now._
415
+ - **Rejected because:** _short reason per rejected option._
416
+ - **Consequences:** _what becomes easier; what becomes harder; what we will revisit._
417
+ - **Refs:** _file:path:line, AC-N, related external link._
418
+
419
+ ### Failure Mode Table
420
+
421
+ _(Only when this decision touches a user-visible failure path — rendering, request/response, persisted data, payment/auth, third-party calls. If the decision is purely internal, replace this section with the single line \`Failure Mode Table: not applicable — no user-visible failure path\`. When present, \`UserSees\` is mandatory in every row; silent failure paths must show "UserSees=nothing — recorded in <metric>".)_
422
+
423
+ | # | Method | Exception | Rescue | UserSees |
424
+ | --- | --- | --- | --- | --- |
425
+ | 1 | \`scoring.bm25\` | doc length missing in index | fallback to plain TF | warning toast: "Search ranking degraded" |
426
+
427
+ ### Pre-mortem
428
+
429
+ _(Imagine this decision shipped and failed. What did it look like in the failure scenario? Three bullets max. Mandatory at product-grade and ideal tiers; minimum-viable may skip.)_
430
+
431
+ - _Failure scenario 1_
432
+ - _Failure scenario 2_
433
+ - _Failure scenario 3_
434
+ `;
435
+ const LEARNINGS_TEMPLATE = `---
436
+ slug: SLUG-PLACEHOLDER
437
+ stage: ship
438
+ status: active
439
+ captured_by: orchestrator
440
+ quality_gate: passed
441
+ signals:
442
+ hasArchitectDecision: false
443
+ reviewIterations: 0
444
+ securityFlag: false
445
+ userRequestedCapture: false
446
+ ---
447
+
448
+ # Learnings — SLUG-PLACEHOLDER
449
+
450
+ The compound phase writes this only when at least one quality signal is present. If you are reading this in an active run, the orchestrator decided this run is worth remembering.
451
+
452
+ ## What we believed at the start
453
+
454
+ _(What was the going-in assumption when \`/cc\` was invoked?)_
455
+
456
+ ## What turned out to be true
457
+
458
+ _(Confirmed beliefs.)_
459
+
460
+ ## What turned out to be wrong
461
+
462
+ _(Discoveries that contradicted the assumption.)_
463
+
464
+ ## Decisions worth remembering
465
+
466
+ - D-N (link to decisions.md)
467
+
468
+ ## Patterns we should keep
469
+
470
+ _(Reusable patterns we saw work.)_
471
+
472
+ ## Anti-patterns we should avoid
473
+
474
+ _(Reusable patterns we saw fail.)_
475
+
476
+ ## Follow-ups
477
+
478
+ - _(Items intentionally deferred. Each one becomes a separate \`/cc <task>\` later.)_
479
+ `;
480
+ const MANIFEST_TEMPLATE = `---
481
+ slug: SLUG-PLACEHOLDER
482
+ stage: shipped
483
+ status: shipped
484
+ ship_commit: SHIP-COMMIT-PLACEHOLDER
485
+ shipped_at: SHIPPED-AT-PLACEHOLDER
486
+ artifacts:
487
+ - plan.md
488
+ ---
489
+
490
+ # SLUG-PLACEHOLDER — shipped manifest
491
+
492
+ This file is the entry point for any future agent that wants to understand what shipped under this slug.
493
+
494
+ ## Acceptance Criteria
495
+
496
+ - AC-1: _description_ (commit \`SHIP-COMMIT-PLACEHOLDER\`)
497
+
498
+ ## Artifacts
499
+
500
+ - plan.md — original plan
501
+ - build.md — implementation log
502
+ - review.md — review findings
503
+ - ship.md — release notes
504
+ - decisions.md — architectural decisions (if architect was invoked)
505
+ - learnings.md — lessons captured by compound (if quality gate passed)
506
+
507
+ ## Refines
508
+
509
+ _(If this run refined a previous slug, link to its shipped manifest here.)_
510
+
511
+ ## Knowledge index
512
+
513
+ This slug is referenced from \`.cclaw/knowledge.jsonl\` whenever the compound quality gate captured a learning.
514
+ `;
515
+ const IDEAS_TEMPLATE = `# .cclaw/ideas.md
516
+
517
+ This file is a free-form idea backlog. Entries are appended by \`/cc-idea\` and never auto-promoted to plans. To act on an idea, invoke \`/cc <task>\` describing it.
518
+
519
+ Each entry begins with an ISO timestamp, then a single-line summary, then the body.
520
+ `;
521
+ export const ARTIFACT_TEMPLATES = [
522
+ { id: "plan", fileName: "plan.md", description: "Plan template with frontmatter, AC table, and traceability block.", body: PLAN_TEMPLATE },
523
+ { id: "build", fileName: "build.md", description: "Build log template with commit table and hook invocation log.", body: BUILD_TEMPLATE },
524
+ { id: "review", fileName: "review.md", description: "Review template with iteration table, findings table, and Five Failure Modes pass.", body: REVIEW_TEMPLATE },
525
+ { id: "ship", fileName: "ship.md", description: "Ship notes template with AC↔commit map, push/PR section, release notes paragraph.", body: SHIP_TEMPLATE },
526
+ { id: "decisions", fileName: "decisions.md", description: "Architect-style decision record template (D-N entries).", body: DECISIONS_TEMPLATE },
527
+ { id: "learnings", fileName: "learnings.md", description: "Compound learning capture template with belief/outcome/follow-up sections.", body: LEARNINGS_TEMPLATE },
528
+ { id: "manifest", fileName: "manifest.md", description: "Shipped manifest template; lists AC, artifacts, refines link.", body: MANIFEST_TEMPLATE },
529
+ { id: "ideas", fileName: "ideas.md", description: "Append-only idea backlog seed.", body: IDEAS_TEMPLATE }
530
+ ];
531
+ export function templateBody(id, replacements = {}) {
532
+ const template = ARTIFACT_TEMPLATES.find((entry) => entry.id === id);
533
+ if (!template)
534
+ throw new Error(`Unknown artifact template: ${id}`);
535
+ let body = template.body;
536
+ for (const [key, value] of Object.entries(replacements)) {
537
+ body = body.split(key).join(value);
538
+ }
539
+ return body;
540
+ }
541
+ export function planTemplateForSlug(slug) {
542
+ return templateBody("plan", { "SLUG-PLACEHOLDER": slug });
543
+ }
544
+ export function manifestTemplate(slug, shipCommit, shippedAt) {
545
+ return templateBody("manifest", {
546
+ "SLUG-PLACEHOLDER": slug,
547
+ "SHIP-COMMIT-PLACEHOLDER": shipCommit,
548
+ "SHIPPED-AT-PLACEHOLDER": shippedAt
549
+ });
550
+ }
@@ -1,2 +1,2 @@
1
- export declare function cancelCommandContract(): string;
2
- export declare function cancelCommandSkillMarkdown(): string;
1
+ export declare const CANCEL_COMMAND_BODY = "# /cc-cancel \u2014 cancel the active cclaw run\n\nStop the current flow without finishing it. Artifacts are preserved.\n\n## Behaviour\n\n1. Read `.cclaw/state/flow-state.json`.\n2. If `currentSlug` is null \u2192 tell the user there is nothing to cancel and stop.\n3. Otherwise, perform the cancel runtime:\n - For every active stage (`plan`, `build`, `review`, `ship`, `decisions`, `learnings`), move `<slug>.md` into `.cclaw/flows/cancelled/<slug>/` as `<stage>.md`.\n - Write `.cclaw/flows/cancelled/<slug>/manifest.md` recording the cancel time, the user's reason (if provided), and the artifacts that were moved.\n - Update each moved artifact's frontmatter so `status: cancelled` and `stage: cancelled` (best-effort \u2014 invalid frontmatter is preserved as-is).\n - Reset `flow-state.json` to fresh: `currentSlug=null, currentStage=null, ac=[], reviewIterations=0, securityFlag=false`.\n - Leave the working tree alone. Do not auto-commit, do not stash, do not revert.\n4. Confirm the cancellation in one line and list the destination directory.\n\n## Recovery\n\nThe artifacts under `.cclaw/flows/cancelled/<slug>/` are read-only references for future runs. To resume the work:\n\n1. Invoke `/cc <task>` describing the same goal.\n2. Existing-plan detection will surface the cancelled match.\n3. Choose **resume from cancelled** to move the artifacts from `.cclaw/flows/cancelled/<slug>/` back into `.cclaw/flows/<slug>/`, reset `status: active`, and continue.\n\n## Hard rules\n\n- `/cc-cancel` never deletes artifacts. The orchestrator must refuse explicit deletion requests.\n- `/cc-cancel` never pushes to git or rewrites history.\n- `/cc-cancel` is idempotent: invoking it without an active slug prints \"no active run\" and stops.\n";
2
+ export declare function renderCancelCommand(): string;
@@ -1,25 +1,33 @@
1
- export function cancelCommandContract() {
2
- return `# /cc-cancel command contract
1
+ export const CANCEL_COMMAND_BODY = `# /cc-cancel — cancel the active cclaw run
3
2
 
4
- Use this command when the user wants to stop the active run without claiming completion.
3
+ Stop the current flow without finishing it. Artifacts are preserved.
5
4
 
6
- ## Protocol
5
+ ## Behaviour
7
6
 
8
- 1. Ask for a concise cancellation reason if the user has not already provided one.
9
- 2. Run \`node .cclaw/hooks/cancel-run.mjs --reason="<reason>"\` from the project root. Use \`--disposition=abandoned\` only when the user explicitly frames the run as abandoned rather than cancelled.
10
- 3. Report the archive path and reset run id. Make clear that the archived run is not a completed ship.
7
+ 1. Read \`.cclaw/state/flow-state.json\`.
8
+ 2. If \`currentSlug\` is null tell the user there is nothing to cancel and stop.
9
+ 3. Otherwise, perform the cancel runtime:
10
+ - For every active stage (\`plan\`, \`build\`, \`review\`, \`ship\`, \`decisions\`, \`learnings\`), move \`<slug>.md\` into \`.cclaw/flows/cancelled/<slug>/\` as \`<stage>.md\`.
11
+ - Write \`.cclaw/flows/cancelled/<slug>/manifest.md\` recording the cancel time, the user's reason (if provided), and the artifacts that were moved.
12
+ - Update each moved artifact's frontmatter so \`status: cancelled\` and \`stage: cancelled\` (best-effort — invalid frontmatter is preserved as-is).
13
+ - Reset \`flow-state.json\` to fresh: \`currentSlug=null, currentStage=null, ac=[], reviewIterations=0, securityFlag=false\`.
14
+ - Leave the working tree alone. Do not auto-commit, do not stash, do not revert.
15
+ 4. Confirm the cancellation in one line and list the destination directory.
11
16
 
12
- Cancelled and abandoned archives are allowed from any stage, but they require a required reason so future readers know why the run ended.
13
- `;
14
- }
15
- export function cancelCommandSkillMarkdown() {
16
- return `---
17
- name: flow-cancel
18
- description: Cancel or abandon the active cclaw run with a required reason. Use when the user types /cc-cancel or asks to cancel, abandon, stop, discard, or reset an unfinished run.
19
- ---
17
+ ## Recovery
18
+
19
+ The artifacts under \`.cclaw/flows/cancelled/<slug>/\` are read-only references for future runs. To resume the work:
20
+
21
+ 1. Invoke \`/cc <task>\` describing the same goal.
22
+ 2. Existing-plan detection will surface the cancelled match.
23
+ 3. Choose **resume from cancelled** to move the artifacts from \`.cclaw/flows/cancelled/<slug>/\` back into \`.cclaw/flows/<slug>/\`, reset \`status: active\`, and continue.
20
24
 
21
- # Cancel cclaw Run
25
+ ## Hard rules
22
26
 
23
- Load and follow \`.cclaw/commands/cancel.md\`. This is a non-completion path: require a reason, run the generated cancel helper, and archive with cancelled or abandoned disposition.
27
+ - \`/cc-cancel\` never deletes artifacts. The orchestrator must refuse explicit deletion requests.
28
+ - \`/cc-cancel\` never pushes to git or rewrites history.
29
+ - \`/cc-cancel\` is idempotent: invoking it without an active slug prints "no active run" and stops.
24
30
  `;
31
+ export function renderCancelCommand() {
32
+ return CANCEL_COMMAND_BODY;
25
33
  }