cclaw-cli 7.7.1 → 8.1.0

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 (282) hide show
  1. package/README.md +210 -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 +90 -508
  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/install.d.ts +27 -15
  73. package/dist/install.js +230 -1342
  74. package/dist/knowledge-store.d.ts +19 -163
  75. package/dist/knowledge-store.js +56 -590
  76. package/dist/logger.d.ts +8 -3
  77. package/dist/logger.js +13 -4
  78. package/dist/orchestrator-routing.d.ts +29 -0
  79. package/dist/orchestrator-routing.js +156 -0
  80. package/dist/run-persistence.d.ts +7 -118
  81. package/dist/run-persistence.js +29 -845
  82. package/dist/runtime/run-hook.entry.d.ts +1 -3
  83. package/dist/runtime/run-hook.entry.js +19 -4
  84. package/dist/runtime/run-hook.mjs +13 -1024
  85. package/dist/types.d.ts +25 -261
  86. package/dist/types.js +8 -36
  87. package/package.json +6 -3
  88. package/dist/artifact-linter/brainstorm.d.ts +0 -2
  89. package/dist/artifact-linter/brainstorm.js +0 -353
  90. package/dist/artifact-linter/design.d.ts +0 -18
  91. package/dist/artifact-linter/design.js +0 -444
  92. package/dist/artifact-linter/findings-dedup.d.ts +0 -56
  93. package/dist/artifact-linter/findings-dedup.js +0 -232
  94. package/dist/artifact-linter/plan.d.ts +0 -2
  95. package/dist/artifact-linter/plan.js +0 -826
  96. package/dist/artifact-linter/review-army.d.ts +0 -49
  97. package/dist/artifact-linter/review-army.js +0 -520
  98. package/dist/artifact-linter/review.d.ts +0 -2
  99. package/dist/artifact-linter/review.js +0 -113
  100. package/dist/artifact-linter/scope.d.ts +0 -2
  101. package/dist/artifact-linter/scope.js +0 -158
  102. package/dist/artifact-linter/shared.d.ts +0 -637
  103. package/dist/artifact-linter/shared.js +0 -2163
  104. package/dist/artifact-linter/ship.d.ts +0 -2
  105. package/dist/artifact-linter/ship.js +0 -250
  106. package/dist/artifact-linter/spec.d.ts +0 -2
  107. package/dist/artifact-linter/spec.js +0 -176
  108. package/dist/artifact-linter/tdd.d.ts +0 -118
  109. package/dist/artifact-linter/tdd.js +0 -1404
  110. package/dist/artifact-linter.d.ts +0 -15
  111. package/dist/artifact-linter.js +0 -517
  112. package/dist/codex-feature-flag.d.ts +0 -58
  113. package/dist/codex-feature-flag.js +0 -193
  114. package/dist/content/closeout-guidance.d.ts +0 -14
  115. package/dist/content/closeout-guidance.js +0 -44
  116. package/dist/content/diff-command.d.ts +0 -1
  117. package/dist/content/diff-command.js +0 -43
  118. package/dist/content/harness-doc.d.ts +0 -1
  119. package/dist/content/harness-doc.js +0 -65
  120. package/dist/content/hook-events.d.ts +0 -9
  121. package/dist/content/hook-events.js +0 -23
  122. package/dist/content/hook-manifest.d.ts +0 -81
  123. package/dist/content/hook-manifest.js +0 -156
  124. package/dist/content/hooks.d.ts +0 -11
  125. package/dist/content/hooks.js +0 -1972
  126. package/dist/content/idea.d.ts +0 -60
  127. package/dist/content/idea.js +0 -416
  128. package/dist/content/language-policy.d.ts +0 -2
  129. package/dist/content/language-policy.js +0 -13
  130. package/dist/content/learnings.d.ts +0 -6
  131. package/dist/content/learnings.js +0 -141
  132. package/dist/content/observe.d.ts +0 -19
  133. package/dist/content/observe.js +0 -86
  134. package/dist/content/opencode-plugin.d.ts +0 -1
  135. package/dist/content/opencode-plugin.js +0 -635
  136. package/dist/content/review-prompts.d.ts +0 -1
  137. package/dist/content/review-prompts.js +0 -104
  138. package/dist/content/runtime-shared-snippets.d.ts +0 -8
  139. package/dist/content/runtime-shared-snippets.js +0 -80
  140. package/dist/content/session-hooks.d.ts +0 -7
  141. package/dist/content/session-hooks.js +0 -107
  142. package/dist/content/skills-elicitation.d.ts +0 -1
  143. package/dist/content/skills-elicitation.js +0 -167
  144. package/dist/content/stage-command.d.ts +0 -2
  145. package/dist/content/stage-command.js +0 -17
  146. package/dist/content/stage-schema.d.ts +0 -117
  147. package/dist/content/stage-schema.js +0 -955
  148. package/dist/content/stages/_lint-metadata/index.d.ts +0 -2
  149. package/dist/content/stages/_lint-metadata/index.js +0 -97
  150. package/dist/content/stages/brainstorm.d.ts +0 -2
  151. package/dist/content/stages/brainstorm.js +0 -184
  152. package/dist/content/stages/design.d.ts +0 -2
  153. package/dist/content/stages/design.js +0 -288
  154. package/dist/content/stages/index.d.ts +0 -8
  155. package/dist/content/stages/index.js +0 -11
  156. package/dist/content/stages/plan.d.ts +0 -2
  157. package/dist/content/stages/plan.js +0 -191
  158. package/dist/content/stages/review.d.ts +0 -2
  159. package/dist/content/stages/review.js +0 -240
  160. package/dist/content/stages/schema-types.d.ts +0 -203
  161. package/dist/content/stages/schema-types.js +0 -1
  162. package/dist/content/stages/scope.d.ts +0 -2
  163. package/dist/content/stages/scope.js +0 -254
  164. package/dist/content/stages/ship.d.ts +0 -2
  165. package/dist/content/stages/ship.js +0 -159
  166. package/dist/content/stages/spec.d.ts +0 -2
  167. package/dist/content/stages/spec.js +0 -170
  168. package/dist/content/stages/tdd.d.ts +0 -4
  169. package/dist/content/stages/tdd.js +0 -273
  170. package/dist/content/state-contracts.d.ts +0 -1
  171. package/dist/content/state-contracts.js +0 -63
  172. package/dist/content/status-command.d.ts +0 -4
  173. package/dist/content/status-command.js +0 -109
  174. package/dist/content/subagent-context-skills.d.ts +0 -4
  175. package/dist/content/subagent-context-skills.js +0 -279
  176. package/dist/content/subagents.d.ts +0 -3
  177. package/dist/content/subagents.js +0 -997
  178. package/dist/content/templates.d.ts +0 -26
  179. package/dist/content/templates.js +0 -1692
  180. package/dist/content/track-render-context.d.ts +0 -18
  181. package/dist/content/track-render-context.js +0 -53
  182. package/dist/content/tree-command.d.ts +0 -1
  183. package/dist/content/tree-command.js +0 -64
  184. package/dist/content/utility-skills.d.ts +0 -30
  185. package/dist/content/utility-skills.js +0 -160
  186. package/dist/content/view-command.d.ts +0 -2
  187. package/dist/content/view-command.js +0 -92
  188. package/dist/delegation.d.ts +0 -649
  189. package/dist/delegation.js +0 -1539
  190. package/dist/early-loop.d.ts +0 -70
  191. package/dist/early-loop.js +0 -302
  192. package/dist/execution-topology.d.ts +0 -44
  193. package/dist/execution-topology.js +0 -95
  194. package/dist/gate-evidence.d.ts +0 -85
  195. package/dist/gate-evidence.js +0 -631
  196. package/dist/harness-adapters.d.ts +0 -151
  197. package/dist/harness-adapters.js +0 -756
  198. package/dist/harness-selection.d.ts +0 -31
  199. package/dist/harness-selection.js +0 -214
  200. package/dist/hook-schema.d.ts +0 -6
  201. package/dist/hook-schema.js +0 -114
  202. package/dist/hook-schemas/claude-hooks.v1.json +0 -10
  203. package/dist/hook-schemas/codex-hooks.v1.json +0 -10
  204. package/dist/hook-schemas/cursor-hooks.v1.json +0 -13
  205. package/dist/init-detect.d.ts +0 -2
  206. package/dist/init-detect.js +0 -50
  207. package/dist/internal/advance-stage/advance.d.ts +0 -89
  208. package/dist/internal/advance-stage/advance.js +0 -655
  209. package/dist/internal/advance-stage/cancel-run.d.ts +0 -8
  210. package/dist/internal/advance-stage/cancel-run.js +0 -19
  211. package/dist/internal/advance-stage/flow-state-coercion.d.ts +0 -3
  212. package/dist/internal/advance-stage/flow-state-coercion.js +0 -81
  213. package/dist/internal/advance-stage/helpers.d.ts +0 -14
  214. package/dist/internal/advance-stage/helpers.js +0 -145
  215. package/dist/internal/advance-stage/hook.d.ts +0 -8
  216. package/dist/internal/advance-stage/hook.js +0 -40
  217. package/dist/internal/advance-stage/parsers.d.ts +0 -72
  218. package/dist/internal/advance-stage/parsers.js +0 -357
  219. package/dist/internal/advance-stage/proactive-delegation-trace.d.ts +0 -24
  220. package/dist/internal/advance-stage/proactive-delegation-trace.js +0 -56
  221. package/dist/internal/advance-stage/review-loop.d.ts +0 -16
  222. package/dist/internal/advance-stage/review-loop.js +0 -199
  223. package/dist/internal/advance-stage/rewind.d.ts +0 -14
  224. package/dist/internal/advance-stage/rewind.js +0 -108
  225. package/dist/internal/advance-stage/start-flow.d.ts +0 -13
  226. package/dist/internal/advance-stage/start-flow.js +0 -241
  227. package/dist/internal/advance-stage/verify.d.ts +0 -21
  228. package/dist/internal/advance-stage/verify.js +0 -185
  229. package/dist/internal/advance-stage.d.ts +0 -7
  230. package/dist/internal/advance-stage.js +0 -138
  231. package/dist/internal/cohesion-contract-stub.d.ts +0 -24
  232. package/dist/internal/cohesion-contract-stub.js +0 -148
  233. package/dist/internal/compound-readiness.d.ts +0 -23
  234. package/dist/internal/compound-readiness.js +0 -102
  235. package/dist/internal/detect-public-api-changes.d.ts +0 -5
  236. package/dist/internal/detect-public-api-changes.js +0 -45
  237. package/dist/internal/detect-supply-chain-changes.d.ts +0 -6
  238. package/dist/internal/detect-supply-chain-changes.js +0 -138
  239. package/dist/internal/early-loop-status.d.ts +0 -7
  240. package/dist/internal/early-loop-status.js +0 -93
  241. package/dist/internal/envelope-validate.d.ts +0 -7
  242. package/dist/internal/envelope-validate.js +0 -66
  243. package/dist/internal/flow-state-repair.d.ts +0 -20
  244. package/dist/internal/flow-state-repair.js +0 -104
  245. package/dist/internal/plan-split-waves.d.ts +0 -190
  246. package/dist/internal/plan-split-waves.js +0 -764
  247. package/dist/internal/runtime-integrity.d.ts +0 -7
  248. package/dist/internal/runtime-integrity.js +0 -268
  249. package/dist/internal/slice-commit.d.ts +0 -7
  250. package/dist/internal/slice-commit.js +0 -619
  251. package/dist/internal/tdd-loop-status.d.ts +0 -14
  252. package/dist/internal/tdd-loop-status.js +0 -68
  253. package/dist/internal/tdd-red-evidence.d.ts +0 -7
  254. package/dist/internal/tdd-red-evidence.js +0 -153
  255. package/dist/internal/waiver-grant.d.ts +0 -62
  256. package/dist/internal/waiver-grant.js +0 -294
  257. package/dist/internal/wave-status.d.ts +0 -74
  258. package/dist/internal/wave-status.js +0 -506
  259. package/dist/managed-resources.d.ts +0 -53
  260. package/dist/managed-resources.js +0 -313
  261. package/dist/policy.d.ts +0 -10
  262. package/dist/policy.js +0 -167
  263. package/dist/retro-gate.d.ts +0 -9
  264. package/dist/retro-gate.js +0 -47
  265. package/dist/run-archive.d.ts +0 -61
  266. package/dist/run-archive.js +0 -391
  267. package/dist/runs.d.ts +0 -2
  268. package/dist/runs.js +0 -2
  269. package/dist/stack-detection.d.ts +0 -116
  270. package/dist/stack-detection.js +0 -489
  271. package/dist/streaming/event-stream.d.ts +0 -31
  272. package/dist/streaming/event-stream.js +0 -114
  273. package/dist/tdd-cycle.d.ts +0 -107
  274. package/dist/tdd-cycle.js +0 -289
  275. package/dist/tdd-verification-evidence.d.ts +0 -17
  276. package/dist/tdd-verification-evidence.js +0 -122
  277. package/dist/track-heuristics.d.ts +0 -27
  278. package/dist/track-heuristics.js +0 -154
  279. package/dist/util/slice-id.d.ts +0 -58
  280. package/dist/util/slice-id.js +0 -89
  281. package/dist/worktree-manager.d.ts +0 -20
  282. package/dist/worktree-manager.js +0 -108
@@ -1,104 +0,0 @@
1
- export const REVIEW_PROMPTS = {
2
- "brainstorm-self-review.md": `# Brainstorm Self-Review Prompt
3
-
4
- Use this before asking the user to approve the brainstorm artifact.
5
-
6
- ## Calibration
7
-
8
- Only flag issues that would cause a real downstream scope/design mistake:
9
- wrong problem, no real alternative, hidden scope growth, missing user reaction,
10
- or a recommendation that does not trace to the user's answer.
11
-
12
- Do not flag prose style, wording preferences, section length, or missing detail
13
- that would not change the scope/design decision.
14
-
15
- ## Checks
16
-
17
- | Category | What to check |
18
- |---|---|
19
- | Premise | Is this the right problem and the direct path? |
20
- | Alternatives | Are there 2-3 meaningfully different options, including exactly one challenger with high/higher upside? |
21
- | User reaction | Does the selected direction trace to the user's reaction/concerns? |
22
- | Scope protection | Does the Not Doing list prevent silent enlargement? |
23
- | Handoff | Is the next-stage handoff explicit and track-aware? |
24
-
25
- ## Output
26
-
27
- Write the result into \`## Self-Review Notes\`:
28
-
29
- \`\`\`markdown
30
- - Status: Approved | Issues Found
31
- - Patches applied:
32
- - <specific patch or None>
33
- - Remaining concerns:
34
- - <concern or None>
35
- \`\`\`
36
- `,
37
- "scope-ceo-review.md": `# Scope CEO Review Prompt
38
-
39
- Use this after drafting scope boundaries and before user approval.
40
-
41
- ## Calibration
42
-
43
- Think like a founder reviewing whether this is the right product slice. Flag
44
- only issues that would materially change scope, sequencing, leverage, or user
45
- value. Do not nitpick wording.
46
-
47
- ## Checks
48
-
49
- | Category | What to check |
50
- |---|---|
51
- | Premise | Are we solving the right problem now? |
52
- | Leverage | Are we using existing code, constraints, and platform strengths? |
53
- | 10-star delta | Is there a better high-leverage scope move worth cherry-picking? |
54
- | Boundary | Are accepted, deferred, and excluded items unambiguous? |
55
- | Mode fit | Does the selected mode match the evidence: SCOPE EXPANSION, SELECTIVE EXPANSION, HOLD SCOPE, or SCOPE REDUCTION? |
56
- | Downstream refs | Are R-IDs and D-XX decision IDs ready for design/spec/plan? |
57
-
58
- ## Output
59
-
60
- Record in \`## Outside Voice Findings\` or the stage-specific outside voice loop section:
61
-
62
- \`\`\`markdown
63
- | ID | Dimension | Finding | Disposition | Rationale |
64
- |---|---|---|---|---|
65
- | CEO-1 | <dimension> | <issue> | accept/reject/defer | <why> |
66
- \`\`\`
67
- `,
68
- "design-eng-review.md": `# Design Engineering Review Prompt
69
-
70
- Use this after drafting design and before handing to spec.
71
-
72
- ## Calibration
73
-
74
- Think like a senior engineer reviewing whether implementation can proceed
75
- without hidden architecture risk. Flag only issues that would cause wrong code,
76
- rework, missing failure behavior, or unverifiable acceptance criteria.
77
-
78
- ## Checks
79
-
80
- | Category | What to check |
81
- |---|---|
82
- | Architecture | Are component boundaries concrete and aligned with scope? |
83
- | Data flow | Are inputs, outputs, persistence, and async/sync edges explicit? |
84
- | Failure modes | Does every meaningful failure have detection, rescue, and user-visible behavior? |
85
- | Traceability | Do design decisions reference relevant R-IDs and D-XX decision IDs? |
86
- | Verification | Is each risky choice testable by spec/plan/TDD? |
87
- | Overbuild | Is any architecture stronger than the locked scope actually needs? |
88
-
89
- ## Output
90
-
91
- Record findings in the design artifact's review section:
92
-
93
- \`\`\`markdown
94
- ## Engineering Review
95
- **Status:** Approved | Issues Found
96
-
97
- **Issues:**
98
- - [R#/D-XX]: <specific issue> — <why it matters>
99
-
100
- **Recommendations:**
101
- - <advisory item or None>
102
- \`\`\`
103
- `
104
- };
@@ -1,8 +0,0 @@
1
- /**
2
- * Shared runtime snippets interpolated into generated hook/plugin scripts.
3
- *
4
- * Keep these string helpers minimal and dependency-free so both runtimes
5
- * (node hooks and OpenCode plugin) stay in sync without duplicating constants.
6
- */
7
- export declare const SHARED_FLOW_AND_KNOWLEDGE_SNIPPETS = "\nfunction summarizeFlowState(rawState) {\n const state =\n rawState && typeof rawState === \"object\" && !Array.isArray(rawState)\n ? rawState\n : {};\n return {\n stage: typeof state.currentStage === \"string\" ? state.currentStage : \"none\",\n completed: Array.isArray(state.completedStages) ? state.completedStages.length : 0,\n activeRunId: typeof state.activeRunId === \"string\" ? state.activeRunId : \"none\"\n };\n}\n\nfunction parseKnowledgeDigest(rawKnowledge, currentStage, maxRows = 6) {\n const text = typeof rawKnowledge === \"string\" ? rawKnowledge : \"\";\n if (text.trim().length === 0) {\n return { learningsCount: 0, lines: [] };\n }\n const rows = text\n .split(/\\r?\\n/gu)\n .map((line) => line.trim())\n .filter((line) => line.length > 0);\n let learningsCount = 0;\n const parsedRows = [];\n for (const line of rows) {\n if (line.startsWith(\"{\")) learningsCount += 1;\n try {\n const parsed = JSON.parse(line);\n if (!parsed || typeof parsed !== \"object\" || Array.isArray(parsed)) continue;\n parsedRows.push(parsed);\n } catch {\n // ignore malformed knowledge line in digest\n }\n }\n const lines = parsedRows\n .filter((row) => {\n const stage = typeof row.stage === \"string\" ? row.stage : null;\n return stage === null || stage === currentStage;\n })\n .slice(-maxRows)\n .reverse()\n .map((row) => {\n const confidence = typeof row.confidence === \"string\" ? row.confidence : \"unknown\";\n const stage = typeof row.stage === \"string\" ? row.stage : \"global\";\n const trigger = typeof row.trigger === \"string\" ? row.trigger : \"trigger\";\n const action = typeof row.action === \"string\" ? row.action : \"action\";\n return \"- [\" + confidence + \" \u2022 \" + stage + \"] \" + trigger + \" -> \" + action;\n });\n return { learningsCount, lines };\n}\n\nfunction activeArtifactsPathLabel(runtimeRoot) {\n return String(runtimeRoot || \".cclaw\") + \"/artifacts/\";\n}\n";
8
- export declare const SHARED_STAGE_SUPPORT_SNIPPETS = "\nconst STAGE_IDS = [\"brainstorm\", \"scope\", \"design\", \"spec\", \"plan\", \"tdd\", \"review\", \"ship\"];\nconst REVIEW_PROMPT_BY_STAGE = {\n brainstorm: \"brainstorm-self-review.md\",\n scope: \"scope-ceo-review.md\",\n design: \"design-eng-review.md\"\n};\nconst REVIEW_PROMPT_FILES = Object.values(REVIEW_PROMPT_BY_STAGE);\n\nfunction isKnownStageId(stage) {\n return typeof stage === \"string\" && STAGE_IDS.includes(stage);\n}\n\nfunction reviewPromptFileName(stage) {\n if (!isKnownStageId(stage)) return null;\n const name = REVIEW_PROMPT_BY_STAGE[stage];\n return typeof name === \"string\" ? name : null;\n}\n";
@@ -1,80 +0,0 @@
1
- /**
2
- * Shared runtime snippets interpolated into generated hook/plugin scripts.
3
- *
4
- * Keep these string helpers minimal and dependency-free so both runtimes
5
- * (node hooks and OpenCode plugin) stay in sync without duplicating constants.
6
- */
7
- export const SHARED_FLOW_AND_KNOWLEDGE_SNIPPETS = `
8
- function summarizeFlowState(rawState) {
9
- const state =
10
- rawState && typeof rawState === "object" && !Array.isArray(rawState)
11
- ? rawState
12
- : {};
13
- return {
14
- stage: typeof state.currentStage === "string" ? state.currentStage : "none",
15
- completed: Array.isArray(state.completedStages) ? state.completedStages.length : 0,
16
- activeRunId: typeof state.activeRunId === "string" ? state.activeRunId : "none"
17
- };
18
- }
19
-
20
- function parseKnowledgeDigest(rawKnowledge, currentStage, maxRows = 6) {
21
- const text = typeof rawKnowledge === "string" ? rawKnowledge : "";
22
- if (text.trim().length === 0) {
23
- return { learningsCount: 0, lines: [] };
24
- }
25
- const rows = text
26
- .split(/\\r?\\n/gu)
27
- .map((line) => line.trim())
28
- .filter((line) => line.length > 0);
29
- let learningsCount = 0;
30
- const parsedRows = [];
31
- for (const line of rows) {
32
- if (line.startsWith("{")) learningsCount += 1;
33
- try {
34
- const parsed = JSON.parse(line);
35
- if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) continue;
36
- parsedRows.push(parsed);
37
- } catch {
38
- // ignore malformed knowledge line in digest
39
- }
40
- }
41
- const lines = parsedRows
42
- .filter((row) => {
43
- const stage = typeof row.stage === "string" ? row.stage : null;
44
- return stage === null || stage === currentStage;
45
- })
46
- .slice(-maxRows)
47
- .reverse()
48
- .map((row) => {
49
- const confidence = typeof row.confidence === "string" ? row.confidence : "unknown";
50
- const stage = typeof row.stage === "string" ? row.stage : "global";
51
- const trigger = typeof row.trigger === "string" ? row.trigger : "trigger";
52
- const action = typeof row.action === "string" ? row.action : "action";
53
- return "- [" + confidence + " • " + stage + "] " + trigger + " -> " + action;
54
- });
55
- return { learningsCount, lines };
56
- }
57
-
58
- function activeArtifactsPathLabel(runtimeRoot) {
59
- return String(runtimeRoot || ".cclaw") + "/artifacts/";
60
- }
61
- `;
62
- export const SHARED_STAGE_SUPPORT_SNIPPETS = `
63
- const STAGE_IDS = ["brainstorm", "scope", "design", "spec", "plan", "tdd", "review", "ship"];
64
- const REVIEW_PROMPT_BY_STAGE = {
65
- brainstorm: "brainstorm-self-review.md",
66
- scope: "scope-ceo-review.md",
67
- design: "design-eng-review.md"
68
- };
69
- const REVIEW_PROMPT_FILES = Object.values(REVIEW_PROMPT_BY_STAGE);
70
-
71
- function isKnownStageId(stage) {
72
- return typeof stage === "string" && STAGE_IDS.includes(stage);
73
- }
74
-
75
- function reviewPromptFileName(stage) {
76
- if (!isKnownStageId(stage)) return null;
77
- const name = REVIEW_PROMPT_BY_STAGE[stage];
78
- return typeof name === "string" ? name : null;
79
- }
80
- `;
@@ -1,7 +0,0 @@
1
- /**
2
- * Session guidelines content for Cclaw.
3
- * Describes recommended behavior at session boundaries.
4
- * Pure markdown generation — no runtime logic.
5
- */
6
- export declare function sessionHooksSkillMarkdown(): string;
7
- export declare function sessionHooksAgentsMdBlock(): string;
@@ -1,107 +0,0 @@
1
- /**
2
- * Session guidelines content for Cclaw.
3
- * Describes recommended behavior at session boundaries.
4
- * Pure markdown generation — no runtime logic.
5
- */
6
- export function sessionHooksSkillMarkdown() {
7
- return `---
8
- name: session
9
- description: "Session boundary guidelines: what to do when a session starts, ends, or reaches a stop condition."
10
- ---
11
-
12
- # Session Guidelines
13
-
14
- ## Overview
15
-
16
- This skill defines recommended behavior at **session boundaries** — start, stop, and resume. These guidelines help agents maintain continuity, avoid losing context, and enforce quality gates at natural breakpoints.
17
-
18
- These are prompt-discipline guidelines that complement the real hooks cclaw generates. The hooks handle automatic context injection at session start/stop; these guidelines cover manual steps the agent should follow.
19
-
20
- ## HARD-GATE
21
-
22
- **Never end a session with uncommitted or untested changes.** If you must stop, leave a short handoff in the current artifact or commit message.
23
-
24
- ## Session Start Protocol
25
-
26
- When a new session begins in any harness:
27
-
28
- 1. **Read flow state:** Load \`.cclaw/state/flow-state.json\` to find the current stage and completed stages.
29
- 2. **Load knowledge:** Use the session-injected knowledge digest first; stream \`.cclaw/knowledge.jsonl\` only when the digest is missing or insufficient.
30
- 3. **Check for in-progress work:** If the last stage is incomplete, remind the user and offer to resume.
31
- 4. **Load iron laws:** Read \`.cclaw/state/iron-laws.json\` to know which laws are strict in this repo.
32
- 5. **Read AGENTS.md:** The cclaw block contains routing and rules — follow them.
33
-
34
- ### What to show the user at session start
35
-
36
- \`\`\`
37
- Cclaw flow state: [current stage] ([N] of 8 stages completed)
38
- Knowledge highlights: [rule/pattern 1], [rule/pattern 2], [rule/pattern 3]
39
- Next action: /cc to continue or start work, /cc-cancel to cancel, or describe what you'd like to do.
40
- \`\`\`
41
-
42
- ## Session Stop Protocol
43
-
44
- Before ending a session or when context is full:
45
-
46
- 1. **Verify no pending changes:** All modified files must be either committed or explicitly reverted.
47
- 2. **Update flow state:** Mark the current stage as its actual status (DONE / DONE_WITH_CONCERNS / BLOCKED).
48
- 3. **Capture knowledge:** If any non-obvious reusable insight appears during stage work, add a strict JSON bullet to the current artifact \`## Learnings\`; stage completion harvests it into \`.cclaw/knowledge.jsonl\`.
49
- 4. **Leave handoff context:** Put blockers and remaining work in the current stage artifact, not a separate state file.
50
-
51
- ### Stop conditions (agent must halt and report)
52
-
53
- - Repeated verification failure (3+ attempts at the same check)
54
- - Unclear requirements that block progress
55
- - Security concern discovered that needs human review
56
- - Context window approaching limit — compact or hand off
57
-
58
- ## Session Resume Protocol
59
-
60
- When resuming work after a break:
61
-
62
- 1. Re-read \`.cclaw/state/flow-state.json\` (may have changed externally).
63
- 2. Re-read the current stage's artifact to verify it matches the last handoff.
64
- 3. Re-load the knowledge digest first, then scan \`.cclaw/knowledge.jsonl\` only if the digest lacks enough evidence.
65
- 4. Continue from the last incomplete step — do not restart the stage.
66
-
67
- ### Optional session-history scan for compound
68
-
69
- During post-ship \`post_ship_review\`, ask before scanning external session history. If the user opts in, inspect only relevant Cursor/Claude/Codex transcripts for repeated failures or process lessons, summarize matches, and then apply the same overlap/refresh/supersede rules before touching \`.cclaw/knowledge.jsonl\`.
70
-
71
- ## Context Management
72
-
73
- When approaching context limits:
74
-
75
- 1. **Prefer subagents** for deep investigation (results return as summary, not full context).
76
- 2. **Compact strategically** — at logical breakpoints (after a stage completes), not mid-task.
77
- 3. **Never compact during:** active debugging, mid-refactor, or while holding uncommitted changes.
78
- 4. **After compaction:** re-read flow state and current artifact before continuing.
79
-
80
- ## Common Rationalizations
81
-
82
- | Rationalization | Reality |
83
- |---|---|
84
- | "I'll remember where I was" | Context is lost between sessions. Write it down. |
85
- | "This is almost done, no need for handoff" | "Almost done" is the most dangerous state — changes are half-applied. |
86
- | "The tests will tell me the state" | Tests tell you pass/fail, not intent or remaining work. |
87
-
88
- ## Red Flags
89
-
90
- - Ending a session with modified but uncommitted files
91
- - No flow state update after completing work
92
- - Restarting a stage from scratch instead of resuming from artifact context
93
- - Ignoring knowledge from prior sessions
94
- `;
95
- }
96
- export function sessionHooksAgentsMdBlock() {
97
- return `### Session Guidelines
98
-
99
- Session boundary behavior (real hooks inject context automatically; guidelines cover manual steps):
100
- - **Start:** Hooks inject flow state + knowledge snapshot. Check for in-progress work, show status.
101
- - **Stop:** Hooks remind about handoff. Verify no pending changes, update the current artifact handoff, and capture reusable knowledge in \`## Learnings\`; stage completion harvests it.
102
- - **Resume:** Re-read state, verify artifact, re-load knowledge, continue from last step. For compound closeout, optional session-history scans require user opt-in.
103
-
104
- Skill: \`.cclaw/skills/session/SKILL.md\`
105
- Policy: \`.cclaw/skills/iron-laws/SKILL.md\`
106
- `;
107
- }
@@ -1 +0,0 @@
1
- export declare function adaptiveElicitationSkillMarkdown(): string;
@@ -1,167 +0,0 @@
1
- import { RUNTIME_ROOT } from "../constants.js";
2
- import { questionBudgetHint } from "../track-heuristics.js";
3
- const ELICITATION_STAGES = ["brainstorm", "scope", "design"];
4
- function renderQuestionBudgetHintTable() {
5
- const rows = [];
6
- for (const mode of ["lean", "guided", "deep"]) {
7
- for (const stage of ELICITATION_STAGES) {
8
- const hint = questionBudgetHint(mode, stage);
9
- rows.push(`| \`${mode}\` | \`${stage}\` | ${hint.min} | ${hint.recommended} | ${hint.hardCapWarning} |`);
10
- }
11
- }
12
- return `| Discovery mode | Stage | Min | Recommended | Hard cap warning |
13
- |---|---|---|---|---|
14
- ${rows.join("\n")}`;
15
- }
16
- export function adaptiveElicitationSkillMarkdown() {
17
- const budgetTable = renderQuestionBudgetHintTable();
18
- return `---
19
- name: adaptive-elicitation
20
- description: "Harness-native one-question-at-a-time dialogue for brainstorm/scope/design with stop signals, smart-skip, and append-only Q&A logging. Walking forcing questions in order is mandatory; the linter blocks stage-complete when Q&A Log is below floor."
21
- ---
22
-
23
- # Adaptive Elicitation
24
-
25
- Pinned anchor: "Don't tell it what to do, give it success criteria and watch it go."
26
-
27
- ## Anti-pattern (BAD examples — never do these)
28
-
29
- These behaviors are the exact reason this skill exists. The linter will block your stage-complete if you do them.
30
-
31
- - **Bad**: User asks for a "simple web app" -> agent asks 1 question about stack -> 1 question about auth -> drafts the brainstorm artifact and asks for approval.
32
- - **Good**: User asks for a "simple web app" -> agent asks Q1 (what pain) -> Q2 (direct path) -> Q3 (first operator/user) -> Q4 (no-go boundaries) -> self-eval: clear -> drafts the brainstorm artifact.
33
-
34
- - **Bad**: Agent immediately dispatches a subagent (\`product-discovery\`, \`critic\`, \`planner\`) at the start of brainstorm/scope/design to "gather context" before any user dialogue.
35
- - **Good**: Agent walks the Q&A loop with the user first; subagent dispatch happens only after the user approves the elicitation outcome.
36
-
37
- - **Bad**: Agent batches 3-5 grill questions into one large message and asks the user to answer them all at once.
38
- - **Good**: Agent asks one grill question, waits, logs the answer, asks the next.
39
-
40
- - **Bad**: Agent skips forcing questions because it "already has a good idea" of the answer.
41
- - **Good**: Agent asks the forcing question; if the user's reply confirms the assumption, log it as \`asked (confirmed assumption)\` and move on. Do not silently skip.
42
-
43
- ## HARD-GATE (machine-enforced)
44
-
45
- - User does not run cclaw manually. Do not tell the user to run CLI commands for answers.
46
- - Ask exactly one question per turn and wait for the answer before asking the next one.
47
- - Use harness-native question tools first; prose fallback is allowed only when the tool is unavailable.
48
- - Keep a running Q&A trace in the active artifact under \`## Q&A Log\` in \`${RUNTIME_ROOT}/artifacts/\` as append-only rows.
49
- - **Early-loop ledger discipline**: Never append \`.cclaw/state/early-loop-log.jsonl\` rows whose \`iteration\` exceeds the active \`maxIterations\`. If the cap fired, escalate or accept convergence outcomes—do not bump the iteration counter afterward. \`deriveEarlyLoopStatus\` clamps persistence, but the log source should stay honest too.
50
- - **Convergence floor (a.k.a. "Q&A Ralph Loop" / "Elicitation Convergence")**: do NOT advance the stage (do NOT call \`stage-complete.mjs\`) until Q&A converges. The machine contract matches \`evaluateQaLogFloor\` in \`src/artifact-linter/shared.ts\` (rule \`qa_log_unconverged\`). Pass when ANY holds: (a) every forcing-question topic id is tagged \`[topic:<id>]\` on at least one \`## Q&A Log\` row; (b) the Q&A Ralph Loop detector fires (last 2 substantive rows are non-decision-changing: \`skip\`/\`continue\`/\`no-change\`/\`done\`/etc.) **and** the log has at least \`max(2, questionBudgetHint(discoveryMode, stage).min)\` substantive rows — **unless** \`discoveryMode\` is \`guided\` or \`deep\` with pending forcing-topic ids (then the Q&A Ralph Loop alone cannot pass until topics are tagged, a stop-signal is recorded, or \`--skip-questions\` downgrades the finding to advisory); (c) an explicit user stop-signal row; or (d) \`--skip-questions\` was persisted (unconverged is advisory only). made \`[topic:<id>]\` mandatory (no English keyword fallback). The "Q&A Ralph Loop" is the elicitation-stage convergence mechanism; the producer/critic Concern Ledger that drives early-stage iteration is the **Early-Loop**, persisted in \`.cclaw/state/early-loop-log.jsonl\` and \`early-loop.json\` — they are different machines, do not conflate them.
51
- - **NEVER run shell hash commands** (\`shasum\`, \`sha256sum\`, \`md5sum\`, \`Get-FileHash\`, \`certutil\`, etc.) to compute artifact hashes. If a linter ever asks you for a hash, that is a linter bug — report failure and stop, do not auto-fix in bash.
52
- - **NEVER paste cclaw command lines into chat** (e.g. \`node .cclaw/hooks/stage-complete.mjs ... --evidence-json '{...}'\`). Run them via the tool layer; report only the resulting summary. The user does not run cclaw manually and seeing the command line is noise.
53
-
54
- ## Harness Question Surface
55
-
56
- Preferred native tool names:
57
- - Claude Code: \`AskUserQuestion\`
58
- - Codex: \`request_user_input\`
59
- - Gemini: \`ask_user\`
60
- - Cursor: \`AskQuestion\`
61
-
62
- If unavailable, ask one concise prose question and explicitly wait for chat answer.
63
-
64
- ## Core Protocol
65
-
66
- 1. Ask one decision-changing question via the harness-native question tool.
67
- 2. Wait for the answer.
68
- 3. Append one row to \`## Q&A Log\`: \`Turn | Question | User answer (1-line) | Decision impact\`.
69
- 4. Self-evaluate:
70
- - What did I learn?
71
- - Is context enough to draft now? (yes/no + reason)
72
- - Have I covered all stage forcing questions in order? (yes/no + which remain)
73
- - If forcing questions remain or context is incomplete, what is the next decision-changing question?
74
- 5. Repeat until **all forcing questions are answered/skipped/waived AND self-evaluation says context is sufficient**, OR user records an explicit stop-signal row.
75
-
76
- ## Question Shape Rules
77
-
78
- - Prefer single-select multiple choice when one direction/priority/next step must be chosen.
79
- - Use multi-select only for compatible sets (goals, constraints, non-goals).
80
- - Smart-skip: if a question is already answered earlier (directly or implicitly), log \`skipped (already covered: turn N)\` instead of skipping silently. The smart-skip row counts as a substantive Q&A Log entry for floor purposes.
81
-
82
- ## Stop Signals (Natural Language)
83
-
84
- Treat these as stop-and-draft signals:
85
- - RU: "достаточно", "хватит", "давай драфт", "хватит вопросов"
86
- - EN: "enough", "skip", "just draft it", "stop asking", "move on", "no more questions"
87
- - UA: "досить", "вистачить", "давай драфт", "рухаємось далі"
88
-
89
- Label disambiguation: The word **skip** is a valid stop phrase during brainstorm/scope/design Q&A. In ship closeout retros, compound clustering, or any structured retro ask, expose **no changes** / **accept as-is** for the passive option instead of wording it as "skip" so agents do not mix elicitation stop-signals with closeout choreography.
90
-
91
- When detected:
92
- - Append a Q&A Log row exactly like: \`Turn N | (stop-signal) | <user quote> | stop-and-draft\` — this row satisfies the linter floor escape hatch.
93
- - Do not ask another question in this stage loop.
94
- - Move to drafting with available context.
95
- - For the next internal agent-only call to advance-stage, pass \`--skip-questions\`. **The user never sees or types this flag.**
96
-
97
- ## Conditional Grilling (Only On Risk Triggers)
98
-
99
- When one of these triggers appears, continue the elicitation loop with sharper questions **one at a time** (do NOT batch them):
100
- - Irreversibility (data deletion, schema migration, breaking API/contract)
101
- - Security/auth boundary changes
102
- - Domain-model ambiguity with multiple plausible invariants
103
-
104
- Each grill question follows the same Core Protocol: ask one, wait, log, self-eval, ask next.
105
-
106
- Do not ask extra questions "for theater" on simple low-risk work.
107
-
108
- ## Question Budget Hint (\`questionBudgetHint\` — min rows feed the convergence floor)
109
-
110
- Source of truth: \`questionBudgetHint(discoveryMode, stage)\`. The \`Min\` column is **not advisory** for the Q&A Ralph Loop exit: \`evaluateQaLogFloor\` requires at least \`max(2, Min)\` substantive rows before the no-new-decisions path can converge (other exits — full topic coverage, stop-signal, \`--skip-questions\` advisory — ignore that minimum). \`Recommended\` and \`Hard cap warning\` remain pacing hints for the harness.
111
-
112
- ${budgetTable}
113
-
114
- Default mapping note: \`lean\` maps to a lightweight specialist tier on early stages, \`guided\` to standard, \`deep\` to deep; risk signals can escalate further.
115
-
116
- **Walk the forcing questions list one-by-one in order, asking each as a separate turn.** Do NOT batch. Do NOT pick favorites — go in order. For each question record one of:
117
- - \`asked\` — question was asked and answered.
118
- - \`asked (confirmed assumption)\` — question was asked, user confirmed your prior reading.
119
- - \`skipped (already covered: turn N)\` — answered implicitly by an earlier reply; cite the turn.
120
- - \`waived (user override)\` — user explicitly waived this question.
121
-
122
- ### Topic tagging (MANDATORY for forcing-question rows)
123
-
124
- Each forcing question has a stable topic id (kebab-case ASCII, e.g. \`pain\`, \`direct-path\`, \`data-flow\`). Tag the matching Q&A Log row's \`Decision impact\` cell with \`[topic:<id>]\` so the linter can verify coverage in any natural language. This is a **HARD requirement** in the linter no longer keyword-matches English question prose, so an un-tagged row does NOT count toward coverage even if the answer fully addresses the topic.
125
-
126
- RU example (after asking \`pain\` in Russian):
127
-
128
- \`\`\`
129
- | Turn | Question | User answer (1-line) | Decision impact |
130
- |---|---|---|---|
131
- | 1 | Какую боль мы решаем? | Регистрация занимает 30 минут. | scope-shaping [topic:pain] |
132
- \`\`\`
133
-
134
- Multiple tags in one row are allowed when one answer covers several topics: \`[topic:pain] [topic:direct-path]\`. Stop-signal rows do NOT need a tag.
135
-
136
- Stage forcing question lists (id → topic):
137
-
138
- - **Brainstorm**:
139
- - \`pain\` — What pain are we solving?
140
- - \`direct-path\` — What is the most direct path?
141
- - \`operator\` — Who is the operator/user impacted first?
142
- - \`no-go\` — What are non-negotiable no-go boundaries?
143
- - **Scope**:
144
- - \`in-out\` — What is definitely in and definitely out?
145
- - \`locked-upstream\` — Which decisions are already locked upstream?
146
- - **Design**:
147
- - \`data-flow\` — What is the data flow end-to-end?
148
- - \`seams\` — Where are the seams/interfaces and ownership boundaries?
149
- - \`invariants\` — Which invariants must always hold?
150
- - \`not-refactor\` — What will we explicitly NOT refactor now?
151
-
152
- ## One-Way Override (Irreversible Decisions)
153
-
154
- For irreversible moves (deletion, schema migration, breaking API):
155
- - Ask for explicit confirmation even if user asked to stop questions.
156
- - Proceed only after explicit override ("I understand the irreversible risk; proceed").
157
- - Record the override in \`## Q&A Log\` and in the stage artifact decision section.
158
-
159
- ## Completion Rule
160
-
161
- Continue asking forcing questions in order until one of:
162
- - (a) all forcing questions for the stage are answered/skipped/waived AND self-evaluation says context is sufficient, OR
163
- - (b) user records an explicit stop-signal row in \`## Q&A Log\`, OR
164
- - (c) the \`hard cap warning\` count is reached and you compressed the remaining forcing questions into one final batched ask (not skip).
165
-
166
- Do NOT exit the loop after the first 1-2 questions just because you can draft something. The point of the loop is to surface the user's actual constraints, not to confirm your initial reading.`;
167
- }
@@ -1,2 +0,0 @@
1
- import type { FlowStage } from "../types.js";
2
- export declare function stageCommandShimMarkdown(stage: FlowStage): string;
@@ -1,17 +0,0 @@
1
- import { RUNTIME_ROOT } from "../constants.js";
2
- import { stageSkillFolder } from "./skills.js";
3
- export function stageCommandShimMarkdown(stage) {
4
- const skillPath = `${RUNTIME_ROOT}/skills/${stageSkillFolder(stage)}/SKILL.md`;
5
- return `# /cc-${stage}
6
-
7
- This is a thin compatibility shim for the \`${stage}\` flow stage.
8
-
9
- Load and follow the authoritative stage skill:
10
-
11
- - \`${skillPath}\`
12
-
13
- Normal stage resume and advancement uses \`/cc\`. Use \`/cc\` to read
14
- \`.cclaw/state/flow-state.json\`, select the active stage, and advance only after
15
- that stage's gates pass. Do not duplicate the stage protocol here.
16
- `;
17
- }
@@ -1,117 +0,0 @@
1
- import type { DiscoveryMode, FlowStage, FlowTrack, TransitionRule } from "../types.js";
2
- import type { StageComplexityTier, StageAutoSubagentDispatch, StageSchema } from "./stages/schema-types.js";
3
- export type { ArtifactValidation, CrossStageTrace, ReviewSection, StageComplexityTier, StageExecutionModel, StagePhilosophy, StageArtifactRules, StageReviewLoop, StageReviewLens, StageAutoSubagentDispatch, StageGate, StageSchemaLegacyInput, StageSchema, StageSchemaInput, StageSchemaV2Input } from "./stages/schema-types.js";
4
- export declare const SKILL_ENVELOPE_KINDS: readonly ["stage-output", "gate-result", "delegation-record"];
5
- export type SkillEnvelopeKind = (typeof SKILL_ENVELOPE_KINDS)[number];
6
- export declare const NON_FLOW_ENVELOPE_STAGE: "non-flow";
7
- export type SkillEnvelopeStage = FlowStage | typeof NON_FLOW_ENVELOPE_STAGE;
8
- export interface SkillEnvelope {
9
- version: "1";
10
- kind: SkillEnvelopeKind;
11
- stage: SkillEnvelopeStage;
12
- payload: unknown;
13
- emittedAt: string;
14
- agent?: string;
15
- }
16
- export interface SkillEnvelopeValidation {
17
- ok: boolean;
18
- errors: string[];
19
- }
20
- export interface StageStackAwareReviewRoute {
21
- stack: string;
22
- agent: "reviewer";
23
- signals: string[];
24
- focus: string;
25
- }
26
- export interface StageDelegationDispatchRule {
27
- agent: string;
28
- mode: "mandatory" | "proactive";
29
- when: string;
30
- purpose: string;
31
- requiresUserGate: boolean;
32
- requiredAtTier?: StageComplexityTier;
33
- dispatchClass: NonNullable<StageAutoSubagentDispatch["dispatchClass"]>;
34
- returnSchema: NonNullable<StageAutoSubagentDispatch["returnSchema"]>;
35
- skill?: string;
36
- }
37
- export interface StageDelegationSummary {
38
- stage: FlowStage;
39
- mandatoryAgents: string[];
40
- proactiveAgents: string[];
41
- primaryAgents: string[];
42
- dispatchRules: StageDelegationDispatchRule[];
43
- stackAwareRoutes: StageStackAwareReviewRoute[];
44
- }
45
- export declare function reviewStackAwareRoutes(): StageStackAwareReviewRoute[];
46
- export declare function reviewStackAwareRoutingSummary(): string;
47
- /**
48
- * Canonical delegation summary derived from STAGE_AUTO_SUBAGENT_DISPATCH.
49
- *
50
- * Keep all generated routing surfaces (skills, AGENTS.md) on this helper so
51
- * stage->agent defaults are maintained in one place.
52
- */
53
- export declare function stageDelegationSummary(complexityTier?: StageComplexityTier): StageDelegationSummary[];
54
- export declare function validateSkillEnvelope(value: unknown): SkillEnvelopeValidation;
55
- export declare function parseSkillEnvelope(raw: string): SkillEnvelope | null;
56
- /** Transition guard: agents with `mode: "mandatory"` in auto-subagent dispatch for this stage. */
57
- export declare function mandatoryDelegationsForStage(stage: FlowStage, complexityTier?: StageComplexityTier): string[];
58
- /**
59
- * Track-aware mandatory delegation lookup.
60
- *
61
- * Returns `[]` (skip the gate entirely) when the run is on a small-fix
62
- * track or classified as a software bugfix:
63
- *
64
- * - `track === "quick"` — the quick track is for trivial single-purpose
65
- * fixes (landing-page copy, doc edits, config tweaks). Mandatory
66
- * subagent dispatch is theatre on that surface area.
67
- * - `taskClass === "software-bugfix"` — bugfixes carry a RED-first
68
- * repro contract; the test author + reviewer in the tdd/review
69
- * stages already cover the safety surface, so mandatory upstream
70
- * delegation only burns tokens.
71
- *
72
- * Otherwise returns the registered mandatory list for the stage at the
73
- * given tier. Callers (gate-evidence, advance-stage validator,
74
- * subagents.ts table generator) MUST go through this helper instead of
75
- * `mandatoryDelegationsForStage` so the track-aware drop applies
76
- * uniformly.
77
- *
78
- * NOTE: the user query also calls this `lite/quick`. There is no `lite`
79
- * FlowTrack — the closest concept in cclaw is the `quick` track plus the
80
- * brainstorm `lightweight` complexity tier. We key on the FlowTrack
81
- * because the run-level decision is what matters at gate time;
82
- * complexity tier is a per-stage knob that doesn't survive the dispatch
83
- * boundary.
84
- */
85
- export type MandatoryDelegationTaskClass = "software-standard" | "software-trivial" | "software-bugfix";
86
- export declare function mandatoryAgentsFor(stage: FlowStage, track: FlowTrack, taskClass?: MandatoryDelegationTaskClass | null, complexityTier?: StageComplexityTier, discoveryMode?: DiscoveryMode): string[];
87
- /**
88
- * Track-aware artifact validation demotion.
89
- *
90
- * Mirrors `mandatoryAgentsFor`'s skip logic for the small-fix lanes.
91
- * Returns `true` when artifact-level "advanced" validation rules
92
- * (architecture-diagram async/failure edges, interaction edge-case
93
- * mandatory rows, stale-diagram drift check, expansion-strategist
94
- * delegation) should be DEMOTED from required → advisory.
95
- *
96
- * - `track === "quick"` — quick-tier runs (single-purpose
97
- * landing-page edits, doc tweaks, config nudges). The advanced
98
- * checks fire on architecture surfaces a quick-track artifact
99
- * usually doesn't have.
100
- * - `taskClass === "software-bugfix"` — bugfixes carry RED-first
101
- * repro coverage; tdd/review own the safety surface.
102
- *
103
- * When this returns `true`, the linter still runs the rules and prints
104
- * their findings (so authors see them as advisory info), but does NOT
105
- * block stage advance. An audit event of type
106
- * `artifact_validation_demoted_by_track` is appended to
107
- * `delegation-events.jsonl` once per stage advance for traceability.
108
- */
109
- export declare function shouldDemoteArtifactValidationByTrack(track: FlowTrack, taskClass?: MandatoryDelegationTaskClass | null): boolean;
110
- export declare function stageSchema(stage: FlowStage, track?: FlowTrack, discoveryMode?: DiscoveryMode, taskClass?: MandatoryDelegationTaskClass | null): StageSchema;
111
- export declare function orderedStageSchemas(track?: FlowTrack): StageSchema[];
112
- export declare function stageGateIds(stage: FlowStage, track?: FlowTrack): string[];
113
- export declare function stageRecommendedGateIds(stage: FlowStage, track?: FlowTrack): string[];
114
- export declare function buildTransitionRules(): TransitionRule[];
115
- export declare function stagePolicyNeedles(stage: FlowStage, track?: FlowTrack): string[];
116
- export declare function stageTrackRenderContext(track?: FlowTrack): import("./track-render-context.js").TrackRenderContext;
117
- export declare function stageAutoSubagentDispatch(stage: FlowStage): StageAutoSubagentDispatch[];