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
@@ -1,158 +1,81 @@
1
- import { conversationLanguagePolicyMarkdown } from "./language-policy.js";
2
- import { CLOSEOUT_CHAIN, closeoutChainInline, closeoutFlowMapSentence, closeoutProtocolBehaviorSentence } from "./closeout-guidance.js";
3
- export const META_SKILL_NAME = "using-cclaw";
4
- export const META_SKILL_GENERATED_HELPER_SKILLS = [
5
- "subagent-dev",
6
- "parallel-dispatch",
7
- "session",
8
- "iron-laws"
9
- ];
10
- function generatedHelperSkillList() {
11
- return META_SKILL_GENERATED_HELPER_SKILLS.map((name) => `\`${name}\``).join(", ");
12
- }
13
- export function usingCclawSkillMarkdown() {
14
- return `---
15
- name: using-cclaw
16
- description: "Routing brain for cclaw. Decide whether to start/resume a stage, answer directly, or use visible commands like /cc, /cc-idea, and /cc-cancel."
1
+ export const META_SKILL = `---
2
+ name: cclaw-meta
3
+ trigger: always-on; loaded with every /cc invocation
17
4
  ---
18
5
 
19
- # Using Cclaw
6
+ # Meta-skill — how to be a cclaw orchestrator
20
7
 
21
- ## Instruction priority
8
+ This skill is loaded by the harness with every \`/cc\` invocation. It does not duplicate \`/cc\` itself; it tells you **how to use** the rest of cclaw's content.
22
9
 
23
- 1. User message in current turn.
24
- 2. Active stage skill and command contract.
25
- 3. This routing file.
26
- 4. Generated cclaw helper skills, research playbooks, and enabled rule packs.
27
- 5. Default model behavior.
10
+ ## What is in your context
28
11
 
29
- If the user explicitly overrides a stage rule, record it in the artifact.
12
+ When \`/cc\` runs, the harness has access to:
30
13
 
31
- ${conversationLanguagePolicyMarkdown()}
32
- ## Skill-before-response gate
14
+ - \`.cursor/commands/cc.md\` — your operating manual (also in \`.cursor/skills/cclaw/\` mirrors).
15
+ - \`.cclaw/lib/agents/*.md\` — six specialist prompts.
16
+ - \`.cclaw/lib/skills/*.md\` — six auto-trigger skills.
17
+ - \`.cclaw/lib/templates/*.md\` — ten artifact templates.
18
+ - \`.cclaw/lib/runbooks/*.md\` — four stage runbooks.
19
+ - \`.cclaw/lib/patterns/*.md\` — eight task patterns.
20
+ - \`.cclaw/lib/research/*.md\` — five research playbooks.
21
+ - \`.cclaw/lib/recovery/*.md\` — five recovery playbooks.
22
+ - \`.cclaw/lib/decision-protocol.md\` — D-N record format.
23
+ - \`.cclaw/lib/examples/*.md\` — thirteen worked examples.
24
+ - \`.cclaw/lib/antipatterns.md\` — twelve known failure modes.
33
25
 
34
- If \`.cclaw/state/flow-state.json\` exists and \`currentStage\` is set,
35
- load the matching stage SKILL before producing **substantive** work
36
- (artifact edits, code, structured clarifying questions). Do not improvise
37
- from memory. Load only generated helper surfaces that actually exist in this install: ${generatedHelperSkillList()}, research playbooks, review prompts, or enabled language rule packs under \`.cclaw/rules/lang/\`. Do not invent helper-skill names beyond those generated surfaces.
26
+ ## How to read this content efficiently
38
27
 
39
- Substantive vs. non-substantive:
28
+ You do not need to read everything. The right loading pattern:
40
29
 
41
- - **Substantive** (must load skill first): proposing design, editing an
42
- artifact, running gates, dispatching subagents, asking a
43
- \`Decision Protocol\` question, declaring a stage done.
44
- - **Non-substantive** (skill load optional): one-line acknowledgement,
45
- clarifying a typo, confirming a prior answer, pure conversation.
30
+ 1. **Always read \`/cc\`** your operating manual.
31
+ 2. **Read the runbook** for the stage you are in (\`.cclaw/lib/runbooks/<stage>.md\`).
32
+ 3. **Read the pattern(s)** that match the task (\`.cclaw/lib/patterns/\`).
33
+ 4. **Read the specialist prompt** when you invoke a specialist (\`.cclaw/lib/agents/<id>.md\`).
34
+ 5. **Read the recovery playbook** when an automated check fails.
35
+ 6. **Read examples** when authoring an artifact you have not seen before.
46
36
 
47
- If \`.cclaw/state/flow-state.json\` is missing, treat it as a normal fresh-init
48
- state and route through \`/cc <idea>\` to start the first tracked run.
49
- If the file exists but is corrupt/unreadable, stop and route through \`/cc\`
50
- before any substantive response.
37
+ Don't read research playbooks unless you're invoking planner mode=\`research\`. Don't read antipatterns proactively; the reviewer cites them as findings.
51
38
 
52
- ## Red Flags (stop and re-route)
39
+ ## Your responsibilities as orchestrator
53
40
 
54
- If you think any of these, stop and follow the routing flow:
41
+ 1. **Sanity check first.** Always verify \`flow-state.json\` schemaVersion=2 before doing anything.
42
+ 2. **Detect existing plans.** Always run existing-plan detection before authoring a new plan.
43
+ 3. **Calibrate routing.** Always run Phase 0 calibration; never skip to specialists for a trivial task.
44
+ 4. **Ask before invoking specialists.** Never silently invoke. The user picks.
45
+ 5. **Ask before push / PR.** Always; every time; per turn.
46
+ 6. **Surface, don't decide.** When a checkpoint, conflict, or cap-reached situation appears, present options to the user. Do not decide on their behalf.
47
+ 7. **Cite, don't invent.** Every file:line reference in your output must be real. Reviewer adversarial mode will catch you.
55
48
 
56
- - "This looks simple, I can skip the stage." -> No. Route through \`/cc\`.
57
- - "I can answer from memory without loading the active stage skill." -> No. Load the skill first.
58
- - "Hook guard warned, but I can ignore it." -> No. Resolve the warning before continuing.
59
- - "I'll edit \`.cclaw/state\` directly to move faster." -> No. Use managed commands only.
60
- - "I'll just do the worker's job inline so we move faster." -> Only if the active TDD topology is explicitly \`inline\` (\`nextDispatch.mode = controller-inline\` from \`wave-status\`); otherwise see the Controller dispatch discipline below.
49
+ ## Your boundaries
61
50
 
62
- ## Controller dispatch discipline (applies to every stage)
51
+ - You do not write code. \`slice-builder\` does.
52
+ - You do not author decisions alone. \`architect\` does.
53
+ - You do not enforce AC traceability. \`commit-helper.mjs\` does.
54
+ - You do not delete artifacts. \`/cc-cancel\` does.
55
+ - You do not push or open PRs without explicit user approval.
63
56
 
64
- cclaw stages have **mandatory delegations** (TDD normally routes through \`slice-builder\`; review: \`reviewer\` + \`security-reviewer\`; design: \`architect\`; scope: \`planner\`; etc.). The controller is the **orchestrator**, not the worker, except when the TDD router selects \`inline\` (a non-high-risk discovery/scaffold/docs ready set with no path conflicts). When a stage declares a mandatory delegation:
57
+ ## Iron laws (always-on)
65
58
 
66
- - **Dispatch via the harness Task tool unless topology says inline.** Do NOT write the worker's output (slice code, review findings, architect notes) into the artifact yourself as a substitute for delegating. For TDD \`inline\`, record \`delegation-record\` lifecycle rows with \`--dispatch-surface=role-switch\` and \`--agent-definition-path=.cclaw/skills/tdd/SKILL.md\` (scheduled → completed with \`--evidence-ref\`) and satisfy the same RED/GREEN/REFACTOR, AC traceability, path containment, managed commit/worktree, lockfile twin, and orphan-change gates.
67
- - **\`single-builder\`: one Task covers the wave.** When the router chooses \`single-builder\` and the ready set has more than one slice, issue exactly ONE \`Task\` dispatch and let that single \`slice-builder\` span own multi-slice TDD for every currently ready member. Do not split the ready set into multiple Task calls when the router chose single-builder.
68
- - **Parallel only when topology says parallel-builders.** TDD fan-out requires genuinely independent substantial units with disjoint \`claimedPaths\` and at least one non-discovery ready unit (pure discovery-only sets are collapsed by the router); review-army (independent reviewer lenses) MUST emit all parallel \`Task\` calls in a SINGLE controller message — not sequentially over multiple turns. The controller waits for all spans to return before reconciling.
69
- - **Record lifecycle on the same span** via \`delegation-record --status=scheduled|launched|acknowledged|completed\`; the worker emits its own \`--phase=…\` and evidence rows. A \`completed\` row without a matching ACK or dispatch surface is a forgery.
70
- - **Trust the router; skip routing AskQuestions.** \`wave-status\` already returns \`nextDispatch.topology\`, \`nextDispatch.mode\`, and (when present) \`nextDispatch.controllerHint\`. Act on them; do not wrap an extra "launch wave or single builder?" confirmation around routing.
71
- - **Auto-advance when stage-complete returns ok.** When the helper reports a new \`currentStage\`, immediately load the next stage skill and continue. Announce \`Stage <prev> complete → entering <next>. Continuing.\` Do NOT pause for the user to retype \`/cc\` or say \"продолжай\" — that pause is the failure mode 7.0.2 explicitly removed. The only legitimate stop is a real blocker (missing user input, ambiguous decision, hook fail).
59
+ 1. **Think before coding.** Read the targets first. Cite \`file:line\`.
60
+ 2. **Simplicity first.** The smallest correct change wins.
61
+ 3. **Surgical changes.** Touch only declared files.
62
+ 4. **Goal-driven execution.** AC are the contract; everything else is implementation detail.
72
63
 
73
- ## Routing flow
64
+ ## Five failure modes (always-on)
74
65
 
75
- \`\`\`
76
- Task arrives
77
- ├─ Running as spawned subagent? -> obey parent prompt only; do not run cclaw routing
78
- ├─ Pure question / non-software ask? -> answer directly (no stage)
79
- ├─ New software work? -> /cc <idea>
80
- ├─ Repo-improvement discovery? -> /cc-idea
81
- ├─ Resume existing flow? -> /cc
82
- ├─ Knowledge operation? -> load the learnings skill
83
- ├─ Normal post-ship closeout? -> /cc drives ${closeoutChainInline()}
84
- └─ Explicit early cancellation/abandonment? -> /cc-cancel
85
- \`\`\`
66
+ When in doubt, ask: am I about to commit one of these?
86
67
 
87
- ## Task classification
68
+ 1. Hallucinated actions (invented files / ids / flags).
69
+ 2. Scope creep (changes outside declared AC).
70
+ 3. Cascading errors (fix breaks something else).
71
+ 4. Context loss (forgot earlier decision).
72
+ 5. Tool misuse (wrong mode / destructive action).
88
73
 
89
- | Class | Route |
90
- |---|---|
91
- | non-trivial software work | \`/cc <idea>\` |
92
- | trivial software fix | \`/cc <idea>\` (quick track) |
93
- | bugfix with clear repro | \`/cc <idea>\` and enforce RED-first in tdd |
94
- | pure question / conversation | answer directly |
95
- | non-software work | answer directly |
74
+ If yes, stop and surface.
96
75
 
97
- ## Flow-state checks
76
+ ## When the user pushes back
98
77
 
99
- Before stage work:
78
+ Trust the user's calibration. If they say "this feels weak", they are not asking for reassurance — they are asking for more depth. Open more content (patterns, examples, recovery), broaden the AC set, invoke the missing specialist. Do not defend the current state.
100
79
 
101
- 1. Read \`.cclaw/state/flow-state.json\`.
102
- 2. If active stage exists, continue with \`/cc\`.
103
- 3. Do not jump directly to stage-specific commands.
104
-
105
- ## Platform reliability notes
106
-
107
- - Managed hook dispatch uses \`.cclaw/hooks/run-hook.cmd\` (cross-platform wrapper).
108
- - If hooks fail due missing runtime deps (for example \`node\` not on \`PATH\`), run \`npx cclaw-cli sync\` before continuing.
109
- - Prefer cross-platform commands in artifacts/examples (\`npm test\`, \`pnpm test\`, \`python -m pytest\`, etc.) over shell-specific aliases whenever possible.
110
-
111
- ## Stage quick map
112
-
113
- Use \`/cc <idea>\` for new work, \`/cc\` for progression and closeout, \`/cc-idea\` for backlog discovery, and \`/cc-cancel\` for cancellation/abandonment.
114
-
115
- ## Main vs Operator Surfaces
116
-
117
- - **Main workflow:** \`/cc\`, \`/cc-idea\`, and \`/cc-cancel\` inside the installed harness runtime.
118
- - **Installer/support surface:** \`npx cclaw-cli init\`, \`npx cclaw-cli sync\`, \`npx cclaw-cli upgrade\`, \`npx cclaw-cli sync\`, and \`npx cclaw-cli uninstall\`.
119
- - Use operator/support surfaces only for install/runtime diagnosis or lifecycle maintenance. Do not make them part of the happy path.
120
-
121
- ## Whole flow map
122
-
123
- standard: brainstorm -> scope -> design -> spec -> plan -> tdd -> review -> ship -> ${CLOSEOUT_CHAIN}
124
- medium: brainstorm -> spec -> plan -> tdd -> review -> ship -> ${CLOSEOUT_CHAIN}
125
- quick: spec -> tdd -> review -> ship -> ${CLOSEOUT_CHAIN}
126
-
127
- ${closeoutFlowMapSentence()}
128
-
129
- Tracks may skip critical-path stages via \`flow-state.track\` + \`skippedStages\`.
130
- Use the current stage skill plus \`.cclaw/state/flow-state.json\` for orientation.
131
-
132
- ## Contextual Skill Activation
133
-
134
- Use built-in judgment only when triggered by the current task:
135
-
136
- - generated subagent context skills for mandatory review/delegation contracts
137
- - research playbooks and review prompts when a stage explicitly calls for them
138
- - inline verification and ship/finalization sections in the active stage skill
139
- - \`iron-laws\` as policy arbitration when instructions conflict
140
- - language rule packs from \`.cclaw/config.yaml\` when enabled
141
-
142
- ## Protocol Behavior
143
-
144
- ${closeoutProtocolBehaviorSentence()}
145
-
146
- ## Knowledge guidance
147
-
148
- Use session-injected knowledge digest first. Only stream full
149
- \`.cclaw/knowledge.jsonl\` when digest evidence is insufficient.
150
-
151
- ## Failure guardrails
152
-
153
- - Do not skip stages silently.
154
- - Do not claim gate completion without evidence.
155
- - DO auto-advance to the next stage after \`stage-complete\` returns ok (see Controller dispatch discipline). The user does not need to retype \`/cc\`.
156
- - Escalate after repeated failures (see decision protocol).
80
+ If they say "this feels overcomplicated", they are asking for less. Skip specialists, shorten Context, drop optional sections. Trivial tasks should not run the full chain.
157
81
  `;
158
- }
@@ -1,9 +1,13 @@
1
- export interface NodeHookRuntimeOptions {
1
+ export interface NodeHookSpec {
2
+ id: string;
3
+ fileName: string;
4
+ description: string;
5
+ events: string[];
6
+ body: string;
7
+ defaultEnabled: boolean;
2
8
  }
3
- /**
4
- * Node-only hook runtime (single entrypoint).
5
- *
6
- * Generated into `.cclaw/hooks/run-hook.mjs` and used by all harnesses to avoid
7
- * bash/python/jq runtime dependencies.
8
- */
9
- export declare function nodeHookRuntimeScript(options?: NodeHookRuntimeOptions): string;
9
+ export declare const SESSION_START_HOOK_SPEC: NodeHookSpec;
10
+ export declare const STOP_HANDOFF_HOOK_SPEC: NodeHookSpec;
11
+ export declare const COMMIT_HELPER_HOOK_SPEC: NodeHookSpec;
12
+ export declare const NODE_HOOKS: NodeHookSpec[];
13
+ export declare const DEFAULT_HOOK_PROFILE: "minimal";