cclaw-cli 0.51.30 → 1.0.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 (160) hide show
  1. package/README.md +24 -18
  2. package/dist/artifact-linter/brainstorm.d.ts +2 -0
  3. package/dist/artifact-linter/brainstorm.js +289 -0
  4. package/dist/artifact-linter/design.d.ts +2 -0
  5. package/dist/artifact-linter/design.js +354 -0
  6. package/dist/artifact-linter/plan.d.ts +2 -0
  7. package/dist/artifact-linter/plan.js +183 -0
  8. package/dist/artifact-linter/review-army.d.ts +24 -0
  9. package/dist/artifact-linter/review-army.js +365 -0
  10. package/dist/artifact-linter/review.d.ts +2 -0
  11. package/dist/artifact-linter/review.js +99 -0
  12. package/dist/artifact-linter/scope.d.ts +2 -0
  13. package/dist/artifact-linter/scope.js +125 -0
  14. package/dist/artifact-linter/shared.d.ts +247 -0
  15. package/dist/artifact-linter/shared.js +1517 -0
  16. package/dist/artifact-linter/ship.d.ts +2 -0
  17. package/dist/artifact-linter/ship.js +82 -0
  18. package/dist/artifact-linter/spec.d.ts +2 -0
  19. package/dist/artifact-linter/spec.js +130 -0
  20. package/dist/artifact-linter/tdd.d.ts +2 -0
  21. package/dist/artifact-linter/tdd.js +198 -0
  22. package/dist/artifact-linter.d.ts +4 -76
  23. package/dist/artifact-linter.js +56 -2949
  24. package/dist/cli.d.ts +1 -6
  25. package/dist/cli.js +4 -159
  26. package/dist/codex-feature-flag.d.ts +1 -1
  27. package/dist/codex-feature-flag.js +1 -1
  28. package/dist/config.d.ts +3 -2
  29. package/dist/config.js +67 -3
  30. package/dist/constants.d.ts +1 -7
  31. package/dist/constants.js +10 -15
  32. package/dist/content/cancel-command.js +2 -2
  33. package/dist/content/closeout-guidance.d.ts +1 -1
  34. package/dist/content/closeout-guidance.js +15 -13
  35. package/dist/content/core-agents.d.ts +46 -29
  36. package/dist/content/core-agents.js +216 -82
  37. package/dist/content/decision-protocol.d.ts +1 -1
  38. package/dist/content/decision-protocol.js +1 -1
  39. package/dist/content/diff-command.js +1 -1
  40. package/dist/content/examples.d.ts +0 -3
  41. package/dist/content/examples.js +197 -752
  42. package/dist/content/harness-doc.js +20 -2
  43. package/dist/content/hook-manifest.d.ts +2 -2
  44. package/dist/content/hook-manifest.js +2 -2
  45. package/dist/content/hooks.d.ts +1 -0
  46. package/dist/content/hooks.js +32 -137
  47. package/dist/content/idea.d.ts +60 -0
  48. package/dist/content/idea.js +404 -0
  49. package/dist/content/iron-laws.d.ts +0 -1
  50. package/dist/content/iron-laws.js +31 -16
  51. package/dist/content/learnings.d.ts +2 -4
  52. package/dist/content/learnings.js +11 -27
  53. package/dist/content/meta-skill.js +7 -7
  54. package/dist/content/node-hooks.d.ts +10 -0
  55. package/dist/content/node-hooks.js +163 -95
  56. package/dist/content/opencode-plugin.js +15 -29
  57. package/dist/content/reference-patterns.js +2 -2
  58. package/dist/content/runtime-shared-snippets.d.ts +8 -0
  59. package/dist/content/runtime-shared-snippets.js +80 -0
  60. package/dist/content/session-hooks.js +1 -1
  61. package/dist/content/skills.d.ts +1 -0
  62. package/dist/content/skills.js +69 -7
  63. package/dist/content/stage-schema.js +147 -61
  64. package/dist/content/stages/_lint-metadata/index.js +26 -2
  65. package/dist/content/stages/brainstorm.js +13 -7
  66. package/dist/content/stages/design.js +16 -11
  67. package/dist/content/stages/plan.js +7 -4
  68. package/dist/content/stages/review.js +12 -12
  69. package/dist/content/stages/schema-types.d.ts +2 -2
  70. package/dist/content/stages/scope.js +15 -12
  71. package/dist/content/stages/ship.js +3 -3
  72. package/dist/content/stages/spec.js +9 -3
  73. package/dist/content/stages/tdd.js +14 -4
  74. package/dist/content/start-command.js +11 -10
  75. package/dist/content/status-command.js +5 -5
  76. package/dist/content/subagent-context-skills.js +156 -1
  77. package/dist/content/subagents.d.ts +0 -5
  78. package/dist/content/subagents.js +65 -81
  79. package/dist/content/templates.d.ts +1 -1
  80. package/dist/content/templates.js +187 -154
  81. package/dist/content/tree-command.js +2 -2
  82. package/dist/content/utility-skills.d.ts +2 -2
  83. package/dist/content/utility-skills.js +28 -99
  84. package/dist/content/view-command.js +4 -2
  85. package/dist/delegation.d.ts +2 -0
  86. package/dist/delegation.js +2 -1
  87. package/dist/early-loop.d.ts +66 -0
  88. package/dist/early-loop.js +275 -0
  89. package/dist/flow-state.d.ts +5 -6
  90. package/dist/flow-state.js +4 -6
  91. package/dist/gate-evidence.d.ts +0 -23
  92. package/dist/gate-evidence.js +111 -153
  93. package/dist/harness-adapters.d.ts +2 -2
  94. package/dist/harness-adapters.js +48 -19
  95. package/dist/install.js +190 -32
  96. package/dist/internal/advance-stage/advance.d.ts +50 -0
  97. package/dist/internal/advance-stage/advance.js +479 -0
  98. package/dist/internal/advance-stage/cancel-run.d.ts +8 -0
  99. package/dist/internal/advance-stage/cancel-run.js +19 -0
  100. package/dist/internal/advance-stage/flow-state-coercion.d.ts +3 -0
  101. package/dist/internal/advance-stage/flow-state-coercion.js +81 -0
  102. package/dist/internal/advance-stage/helpers.d.ts +14 -0
  103. package/dist/internal/advance-stage/helpers.js +145 -0
  104. package/dist/internal/advance-stage/hook.d.ts +8 -0
  105. package/dist/internal/advance-stage/hook.js +40 -0
  106. package/dist/internal/advance-stage/parsers.d.ts +54 -0
  107. package/dist/internal/advance-stage/parsers.js +307 -0
  108. package/dist/internal/advance-stage/review-loop.d.ts +7 -0
  109. package/dist/internal/advance-stage/review-loop.js +161 -0
  110. package/dist/internal/advance-stage/rewind.d.ts +14 -0
  111. package/dist/internal/advance-stage/rewind.js +108 -0
  112. package/dist/internal/advance-stage/start-flow.d.ts +11 -0
  113. package/dist/internal/advance-stage/start-flow.js +136 -0
  114. package/dist/internal/advance-stage/verify.d.ts +29 -0
  115. package/dist/internal/advance-stage/verify.js +225 -0
  116. package/dist/internal/advance-stage.js +21 -1470
  117. package/dist/internal/compound-readiness.d.ts +1 -1
  118. package/dist/internal/compound-readiness.js +2 -2
  119. package/dist/internal/early-loop-status.d.ts +7 -0
  120. package/dist/internal/early-loop-status.js +90 -0
  121. package/dist/internal/runtime-integrity.d.ts +7 -0
  122. package/dist/internal/runtime-integrity.js +288 -0
  123. package/dist/internal/tdd-red-evidence.js +1 -1
  124. package/dist/knowledge-store.d.ts +5 -28
  125. package/dist/knowledge-store.js +57 -84
  126. package/dist/managed-resources.js +24 -2
  127. package/dist/policy.js +7 -9
  128. package/dist/retro-gate.js +8 -90
  129. package/dist/run-archive.d.ts +1 -1
  130. package/dist/run-archive.js +13 -16
  131. package/dist/run-persistence.js +20 -15
  132. package/dist/runtime/run-hook.entry.d.ts +3 -0
  133. package/dist/runtime/run-hook.entry.js +5 -0
  134. package/dist/runtime/run-hook.mjs +9477 -0
  135. package/dist/tdd-cycle.d.ts +3 -3
  136. package/dist/tdd-cycle.js +1 -1
  137. package/dist/types.d.ts +18 -10
  138. package/package.json +4 -2
  139. package/dist/content/hook-inline-snippets.d.ts +0 -83
  140. package/dist/content/hook-inline-snippets.js +0 -302
  141. package/dist/content/ideate-command.d.ts +0 -8
  142. package/dist/content/ideate-command.js +0 -315
  143. package/dist/content/ideate-frames.d.ts +0 -31
  144. package/dist/content/ideate-frames.js +0 -140
  145. package/dist/content/ideate-ranking.d.ts +0 -25
  146. package/dist/content/ideate-ranking.js +0 -65
  147. package/dist/content/next-command.d.ts +0 -20
  148. package/dist/content/next-command.js +0 -298
  149. package/dist/content/seed-shelf.d.ts +0 -36
  150. package/dist/content/seed-shelf.js +0 -301
  151. package/dist/content/stage-common-guidance.d.ts +0 -1
  152. package/dist/content/stage-common-guidance.js +0 -106
  153. package/dist/doctor-registry.d.ts +0 -10
  154. package/dist/doctor-registry.js +0 -186
  155. package/dist/doctor.d.ts +0 -17
  156. package/dist/doctor.js +0 -2201
  157. package/dist/internal/hook-manifest.d.ts +0 -16
  158. package/dist/internal/hook-manifest.js +0 -77
  159. package/dist/trace-matrix.d.ts +0 -27
  160. package/dist/trace-matrix.js +0 -226
@@ -45,7 +45,7 @@ a read-only command.
45
45
 
46
46
  ## Algorithm
47
47
 
48
- 1. Read \`${flowPath}\`. If missing → report **BLOCKED: flow state absent** and suggest \`cclaw init\`.
48
+ 1. Read \`${flowPath}\`. If missing → report **BLOCKED: flow state absent** and suggest \`npx cclaw-cli init\`.
49
49
  2. Read \`${delegationPath}\`. Missing → treat all mandatory delegations as pending.
50
50
  3. Render **time in stage** as \`(unknown)\` unless visible conversation or
51
51
  artifact handoff context gives a timestamp.
@@ -81,7 +81,7 @@ a read-only command.
81
81
  - If current stage has unmet gates -> \`/cc\` to resume.
82
82
  - If a mandatory delegation is missing evidence -> dispatch the worker/reviewer or waive with rationale; do not advance silently.
83
83
  - If a TDD blocker taxonomy code is present (\`NO_SOURCE_CONTEXT\`, \`NO_TEST_SURFACE\`, \`NO_IMPLEMENTABLE_SLICE\`, \`RED_NOT_EXPRESSIBLE\`, \`NO_VCS_MODE\`) -> name the blocker and the rewind/config route.
84
- - If review is blocked by critical findings -> show \`cclaw internal rewind tdd "review_blocked_by_critical <finding-ids>"\` plus the later \`cclaw internal rewind --ack tdd\`.
84
+ - If review is blocked by critical findings -> show \`npx cclaw-cli internal rewind tdd "review_blocked_by_critical <finding-ids>"\` plus the later \`npx cclaw-cli internal rewind --ack tdd\`.
85
85
  - If closeout substate is non-idle -> \`/cc\` to continue the chain.
86
86
  - If current stage is complete -> \`/cc\` to advance (or report "Flow complete" if terminal).
87
87
 
@@ -89,7 +89,7 @@ a read-only command.
89
89
 
90
90
  - Keep output compact (≤ 40 lines) — status, not narrative.
91
91
  - Start with the same operator rows as \`/cc\` when possible:
92
- \`Current\`, \`Stage\`, \`Progress\`, \`Gates\`, \`Delegations\`, \`Risks\`, \`Blocked by\`, \`Next\`, \`Evidence needed\`. Use labels like \`gate: tdd_green_full_suite\`, \`delegation proof: reviewer evidenceRefs\`, and \`closeout: compound_review\` instead of raw JSON tone.
92
+ \`Current\`, \`Stage\`, \`Progress\`, \`Gates\`, \`Delegations\`, \`Risks\`, \`Blocked by\`, \`Next\`, \`Evidence needed\`. Use labels like \`gate: tdd_green_full_suite\`, \`delegation proof: reviewer evidenceRefs\`, and \`closeout: post_ship_review\` instead of raw JSON tone.
93
93
  - When blocked, include a plain-English action block:
94
94
  \`Current: <stage or closeout substate>\`; \`Blocked by: <gate/delegation/blocker code>\`; \`Next: <exact command or managed remediation>\`; \`Evidence needed: <artifact/test/review/delegation evidence>\`.
95
95
  - Report counts, not full artifact contents. Include active subagent count from \`${subagentsPath()}\` and proof gaps from \`${delegationEventsPath()}\` when present. Convert gate/delegation state into human labels: \`passed\`, \`blocked\`, \`missing proof\`, \`waived with reason\`, \`stale\`, \`ready to advance\`, or the closeout substate label.
@@ -98,12 +98,12 @@ a read-only command.
98
98
 
99
99
  ## Anti-patterns
100
100
 
101
- - Rebuilding trace-matrix or running doctor from \`/cc-view status\` — those belong to dedicated tools.
101
+ - Re-running heavy artifact workflows from \`/cc-view status\` — status is read-only and should not trigger sync or mutation paths.
102
102
  - Treating absence of delegation log as "all delegations complete".
103
103
  - Collapsing \`◎ missing-evidence\` into \`✓ completed\` — role-switch gaps must stay
104
104
  visible so the stage cannot advance silently.
105
105
  - Omitting the closeout row when \`shipSubstate !== "idle"\`; it is the only signal
106
- that tells the user why \`/cc\` is about to run retro/compound/archive.
106
+ that tells the user why \`/cc\` is about to run post-ship closeout/archive.
107
107
  - Mutating state to "clean up" during a status check.
108
108
  `;
109
109
  }
@@ -112,11 +112,166 @@ Use after the default reviewer/security-reviewer passes when repo signals identi
112
112
  - Keep the default general reviewer pass intact; this is additive context, not a replacement.
113
113
  `;
114
114
  }
115
+ function criticMultiPerspectiveSkill() {
116
+ return `${skillFrontmatter("critic-multi-perspective", "Multi-perspective critic protocol with pre-commitment predictions and realist checks.")}# Critic Multi-Perspective Pass
117
+
118
+ Use with the \`critic\` delegation in \`brainstorm\`, \`scope\`, and \`design\`.
119
+
120
+ ## Required Output
121
+
122
+ - Before investigation, emit \`predictions[]\` with explicit hypotheses.
123
+ - Analyze through context-aware angles:
124
+ - plan/spec/scope: executor, stakeholder, skeptic
125
+ - design/code: security, operator, new-hire
126
+ - Include a dedicated gap analysis (what is missing, not only what is wrong).
127
+ - Move low-confidence concerns (<=4/10) into \`openQuestions[]\`.
128
+ - For every critical/major concern, include a \`realistCheckResults[]\` verdict.
129
+ - End with \`predictionsValidated[]\` mapping each prediction to confirmed/disproven.
130
+
131
+ ## Guardrails
132
+
133
+ - Do not block solely on low-confidence concerns.
134
+ - Suppress or downgrade implausible critical findings during realist checks.
135
+ - Escalate to adversarial mode when reviewers disagree, confidence is low, or trust boundaries are involved.
136
+ `;
137
+ }
138
+ function documentCoherencePassSkill() {
139
+ return `${skillFrontmatter("document-coherence-pass", "Consistency-focused pass for cross-section coherence in spec/plan/design documents.")}# Document Coherence Pass
140
+
141
+ Use with \`coherence-reviewer\` on spec/plan/design artifacts.
142
+
143
+ ## Required Output
144
+
145
+ - List contradictions between sections and where they occur.
146
+ - Flag terminology drift where one concept is named inconsistently.
147
+ - Flag broken internal references, forward references, and dependency narrative mismatches.
148
+ - Return calibrated findings with concrete anchors and one-line corrections.
149
+
150
+ ## Guardrails
151
+
152
+ - Do not score overall quality; focus on consistency and coherence only.
153
+ - Do not invent contradictions without citation to concrete sections/lines.
154
+ `;
155
+ }
156
+ function documentScopeGuardSkill() {
157
+ return `${skillFrontmatter("document-scope-guard", "Complexity and minimum-change guardrail for scope/plan/design documents.")}# Document Scope Guard
158
+
159
+ Use with \`scope-guardian-reviewer\` when expansion pressure or abstraction creep is likely.
160
+
161
+ ## Required Output
162
+
163
+ - Surface where existing solutions can be reused instead of adding new abstractions.
164
+ - Identify minimum-change alternative when current proposal is broader than needed.
165
+ - Call out complexity smells (speculative generic utilities, framework-ahead-of-need structures).
166
+ - Return calibrated findings with explicit impact on scope boundaries.
167
+
168
+ ## Guardrails
169
+
170
+ - Challenge unnecessary breadth, but do not silently shrink required user outcomes.
171
+ - Tie every scope reduction recommendation to a concrete cost/risk rationale.
172
+ `;
173
+ }
174
+ function documentFeasibilityPassSkill() {
175
+ return `${skillFrontmatter("document-feasibility-pass", "Feasibility validation for runtime/resource/dependency assumptions in plan/design artifacts.")}# Document Feasibility Pass
176
+
177
+ Use with \`feasibility-reviewer\` on plan/design docs that rely on runtime or operational assumptions.
178
+
179
+ ## Required Output
180
+
181
+ - Enumerate resource/time/runtime assumptions and whether they are validated.
182
+ - Flag external dependency availability or reliability risks.
183
+ - Flag rollout assumptions that are not backed by operational evidence.
184
+ - Return PASS/PASS_WITH_GAPS/FAIL/BLOCKED rationale grounded in cited assumptions.
185
+
186
+ ## Guardrails
187
+
188
+ - Focus on practical viability; do not redesign architecture unless feasibility is blocked.
189
+ - Distinguish unknowns that need evidence from hard blockers that require rework.
190
+ `;
191
+ }
192
+ function reviewPerfLensSkill() {
193
+ return `${skillFrontmatter("review-perf-lens", "Optional deep performance lens for large or high-risk review surfaces.")}# Review Performance Lens
194
+
195
+ Use as an optional follow-up lens when the default reviewer pass flags non-trivial performance risk.
196
+
197
+ ## Required Output
198
+
199
+ - Hot-path or algorithmic-risk summary with touched files.
200
+ - Potential regressions and estimated blast radius.
201
+ - Clear NO_IMPACT or FOUND_<n> result with evidence.
202
+
203
+ ## Guardrails
204
+
205
+ - Run only when justified by diff scope or explicit trigger.
206
+ - Do not replace the mandatory reviewer pass; this lens is additive.
207
+ `;
208
+ }
209
+ function reviewCompatLensSkill() {
210
+ return `${skillFrontmatter("review-compat-lens", "Optional compatibility lens for high-risk API/config/schema changes.")}# Review Compatibility Lens
211
+
212
+ Use as an optional follow-up lens when contracts, config, persistence schema, or generated clients might break consumers.
213
+
214
+ ## Required Output
215
+
216
+ - Surface inventory: APIs/config/schema/CLI/client contracts touched.
217
+ - Compatibility risk assessment (backward, forward, migration path).
218
+ - Clear NO_IMPACT or FOUND_<n> result with evidence.
219
+
220
+ ## Guardrails
221
+
222
+ - Focus on externally observable contracts and migration safety.
223
+ - Do not duplicate baseline reviewer findings verbatim.
224
+ `;
225
+ }
226
+ function reviewObservabilityLensSkill() {
227
+ return `${skillFrontmatter("review-observability-lens", "Optional observability lens for diagnosability and rollback safety.")}# Review Observability Lens
228
+
229
+ Use as an optional follow-up lens when failure diagnosis, telemetry, or operational rollback confidence is at risk.
230
+
231
+ ## Required Output
232
+
233
+ - Signals checked: logs, metrics, traces, alerts, debug handles.
234
+ - Gaps that could block diagnosis or rollback during incidents.
235
+ - Clear NO_IMPACT or FOUND_<n> result with evidence.
236
+
237
+ ## Guardrails
238
+
239
+ - Escalate only diagnosis-impacting gaps; avoid style-only telemetry suggestions.
240
+ - Keep scope tied to touched code paths and rollout-critical behavior.
241
+ `;
242
+ }
243
+ function architectCrossStageVerificationSkill() {
244
+ return `${skillFrontmatter("architect-cross-stage-verification", "Cross-stage cohesion verification before ship finalization.")}# Architect Cross-Stage Verification
245
+
246
+ Use with the \`architect\` delegation in the \`ship\` stage.
247
+
248
+ ## Required Output
249
+
250
+ - Read scope/design/spec/plan/review artifacts plus shipped diff/code surfaces.
251
+ - Validate that locked decisions and acceptance mappings still match shipped behavior.
252
+ - Flag drift between intended architecture and implemented boundaries.
253
+ - Return exactly one status token: \`CROSS_STAGE_VERIFIED\`, \`DRIFT_DETECTED\`, or \`BLOCKED\`.
254
+ - Provide evidence refs for every drift claim and identify the smallest corrective route.
255
+
256
+ ## Guardrails
257
+
258
+ - Do not defer unresolved drift to post-ship follow-up without explicit waiver.
259
+ - If evidence is insufficient to verify cohesion, return \`BLOCKED\` with missing inputs.
260
+ `;
261
+ }
115
262
  export const SUBAGENT_CONTEXT_SKILLS = {
116
263
  "tdd-cycle-evidence": tddCycleEvidenceSkill(),
117
264
  "review-spec-pass": reviewSpecPassSkill(),
118
265
  "security-audit": securityAuditSkill(),
119
266
  "adversarial-review": adversarialReviewSkill(),
120
267
  "receiving-code-review": receivingCodeReviewSkill(),
121
- "stack-aware-review": stackAwareReviewSkill()
268
+ "stack-aware-review": stackAwareReviewSkill(),
269
+ "critic-multi-perspective": criticMultiPerspectiveSkill(),
270
+ "document-coherence-pass": documentCoherencePassSkill(),
271
+ "document-scope-guard": documentScopeGuardSkill(),
272
+ "document-feasibility-pass": documentFeasibilityPassSkill(),
273
+ "review-perf-lens": reviewPerfLensSkill(),
274
+ "review-compat-lens": reviewCompatLensSkill(),
275
+ "review-observability-lens": reviewObservabilityLensSkill(),
276
+ "architect-cross-stage-verification": architectCrossStageVerificationSkill()
122
277
  };
@@ -1,8 +1,3 @@
1
1
  export declare function subagentDrivenDevSkill(): string;
2
2
  export declare function parallelAgentsSkill(): string;
3
- /**
4
- * Returns markdown fragments augmenting each specialist persona with Task tool
5
- * delegation guidance. Combine with the existing `body` field from `core-agents.ts`.
6
- */
7
- export declare function enhancedAgentBody(agentName: string): string;
8
3
  export declare function subagentsAgentsMdBlock(): string;
@@ -5,25 +5,6 @@ import { conversationLanguagePolicyMarkdown } from "./language-policy.js";
5
5
  * specialist payloads. Cclaw materializes static instructions — this module does not
6
6
  * execute orchestration logic at install time beyond string assembly.
7
7
  */
8
- const SUBAGENT_AGENT_NAMES = [
9
- "researcher",
10
- "architect",
11
- "spec-validator",
12
- "slice-implementer",
13
- "performance-reviewer",
14
- "compatibility-reviewer",
15
- "observability-reviewer",
16
- "release-reviewer",
17
- "planner",
18
- "product-manager",
19
- "critic",
20
- "reviewer",
21
- "security-reviewer",
22
- "test-author",
23
- "doc-updater",
24
- "implementer",
25
- "fixer"
26
- ];
27
8
  const MARKDOWN_CODE_FENCE = "```";
28
9
  function formatAgentList(agents) {
29
10
  return agents.length > 0 ? agents.join(", ") : "none";
@@ -94,10 +75,10 @@ can enforce phase-appropriate write boundaries. Use separate workers only when t
94
75
 
95
76
  | Harness | Fallback | Delegation tool | Structured ask | Capability source |
96
77
  |---|---|---|---|---|
97
- | Claude | \`native\` | Task (named subagent_type) | AskUserQuestion | \`npx cclaw-cli doctor\` |
98
- | Cursor | \`generic-dispatch\` | Task (generic subagent_type: explore/generalPurpose/…) | AskQuestion | \`npx cclaw-cli doctor\` |
99
- | OpenCode | \`native\` | generated \`.opencode/agents/<agent>.md\` subagents via Task / \`@agent\` mention | \`question\` (permission-gated; \`permission.question: "allow"\`) | \`npx cclaw-cli doctor\` |
100
- | Codex | \`native\` | generated \`.codex/agents/<agent>.toml\` custom agents via native parallel subagent spawning | \`request_user_input\` (experimental; Plan / Collaboration mode) | \`npx cclaw-cli doctor\` |
78
+ | Claude | \`native\` | Task (named subagent_type) | AskUserQuestion | \`npx cclaw-cli sync\` |
79
+ | Cursor | \`generic-dispatch\` | Task (generic subagent_type: explore/generalPurpose/…) | AskQuestion | \`npx cclaw-cli sync\` |
80
+ | OpenCode | \`native\` | generated \`.opencode/agents/<agent>.md\` subagents via Task / \`@agent\` mention | \`question\` (permission-gated; \`permission.question: "allow"\`) | \`npx cclaw-cli sync\` |
81
+ | Codex | \`native\` | generated \`.codex/agents/<agent>.toml\` custom agents via native parallel subagent spawning | \`request_user_input\` (experimental; Plan / Collaboration mode) | \`npx cclaw-cli sync\` |
101
82
 
102
83
  **Dispatch rules driven by \`subagentFallback\`:**
103
84
 
@@ -143,10 +124,10 @@ Concrete per-stage rules so the controller does not have to guess which tier fit
143
124
 
144
125
  | Stage | Deep slot | Balanced slot(s) | Fast fan-out | Trigger to escalate |
145
126
  |---|---|---|---|---|
146
- | brainstorm | planner (only if ambiguity spans >1 module) | product-manager / critic when product value or premise is uncertain | run in-thread research playbooks | promote to \`balanced\` critic if the do-nothing path may beat the idea |
147
- | scope | planner (always) | product-manager / critic when mode changes user value or boundaries are soft | run \`research/git-history.md\` in-thread when churn is high | promote to \`balanced\` critic if scope mode is disputed |
127
+ | brainstorm | planner (only if ambiguity spans >1 module) | product-discovery / critic when product value or premise is uncertain | run in-thread research playbooks | promote to \`balanced\` critic if the do-nothing path may beat the idea |
128
+ | scope | planner (always) | product-discovery / critic when mode changes value, trajectory, or boundaries | run \`research/git-history.md\` in-thread when churn is high | promote to \`balanced\` critic if scope mode is disputed |
148
129
  | design | planner (always) | critic, security-reviewer, test-author when alternatives/trust/testability apply | run \`research/framework-docs-lookup.md\` + \`research/best-practices-lookup.md\` in-thread | escalate one specialist to \`deep\` only if a failure mode is Critical-severity |
149
- | spec | — | reviewer (if spec > 200 lines or multiple ACs) | — | escalate to \`deep\` only for spec ↔ design contradictions |
130
+ | spec | — | spec-validator / spec-document-reviewer / reviewer (for long or high-risk specs) | — | escalate to \`deep\` only for spec ↔ design contradictions |
150
131
  | plan | planner (solo, always) | — | — | never fan out at plan stage; one owner for dependency graph |
151
132
  | tdd | — | ${formatAgentList(stageSummary("tdd").primaryAgents)} (per slice, carrying RED/GREEN/REFACTOR evidence) · reviewer (slice-local only when sliceReview triggers) | doc-updater (API surface changes) | escalate to \`deep\` only when a RED test cannot be expressed (design leak) |
152
133
  | review | — | ${formatAgentList(stageSummary("review").mandatoryAgents)} (both mandatory) | doc-updater for release-note drift checks | escalate a \`balanced\` reviewer to \`deep\` only when two reviewers disagree on severity |
@@ -174,6 +155,7 @@ Borrow the good part of Team/Ruflo-style orchestration without adding a swarm ru
174
155
  - **No parallel writes to adjacent surfaces.** If tasks may touch the same module, serialize them.
175
156
  - **Checkpoint before synthesis.** Each agent returns status, files inspected/changed, evidence, and blockers before the parent acts.
176
157
  - **Consensus is for hard calls only.** Use two reviewers when severity or architecture is disputed; otherwise one evidence-backed reviewer is enough.
158
+ - **Multi-wave persistence uses the executing-waves skill.** For 2+ wave efforts, maintain \`.cclaw/wave-plans/\` and run carry-forward drift audits in brainstorm.
177
159
 
178
160
  ## Parallelization Decision Gate
179
161
 
@@ -404,6 +386,8 @@ ${conversationLanguagePolicyMarkdown()}
404
386
 
405
387
  Implementation that touches shared source trees must remain **sequential** unless you have proven disjoint filesystem ownership (rare) and an explicit merge protocol.
406
388
 
389
+ When explicit bounded TDD fan-out is approved with parallel \`slice-implementer\` lanes, author \`.cclaw/artifacts/cohesion-contract.md\` + \`.json\` before launch and run \`integration-overseer\` after fan-in.
390
+
407
391
  ## When to Use
408
392
 
409
393
  - **Independent investigations** (perf vs correctness vs dependency hygiene) with separated code neighborhoods.
@@ -427,11 +411,13 @@ Implementation that touches shared source trees must remain **sequential** unles
427
411
  ## Dispatch Protocol
428
412
 
429
413
  1. **Identify independent problem domains** (no file overlap; no shared mutable working assumptions).
430
- 2. **Craft one prompt per domain** with **full context pasted** — same HARD-GATE as SDD: no “go read X to learn why.”
431
- 3. **Launch ALL agents in a single controller message** (multiple Task tool calls) so they start with comparable timelines.
432
- 4. **Wait for all to return** before synthesis (avoid incremental confirmation bias).
433
- 5. **Reconcile results:** deduplicate findings, merge overlaps, and **conflict-check** contradictions explicitly.
434
- 6. **Run the full test suite after any code changes** parallel analysis may propose edits; verification stays mandatory.
414
+ 2. **Author cohesion contract first** whenever fan-out touches shared interfaces or bounded parallel \`slice-implementer\` lanes.
415
+ 3. **Craft one prompt per domain** with **full context pasted** same HARD-GATE as SDD: no “go read X to learn why.”
416
+ 4. **Launch ALL agents in a single controller message** (multiple Task tool calls) so they start with comparable timelines.
417
+ 5. **Wait for all to return** before synthesis (avoid incremental confirmation bias).
418
+ 6. **Run integration-overseer after fan-in** to verify touchpoints, boundary types, invariants, and integration-test outcomes.
419
+ 7. **Reconcile results:** deduplicate findings, merge overlaps, and **conflict-check** contradictions explicitly.
420
+ 8. **Run the full test suite after any code changes** — parallel analysis may propose edits; verification stays mandatory.
435
421
 
436
422
  ## Review Army Pattern (gstack)
437
423
 
@@ -642,6 +628,30 @@ Required output:
642
628
  - TESTABILITY_MAP: concrete test level and command/manual evidence per AC
643
629
  ${MARKDOWN_CODE_FENCE}
644
630
 
631
+ `;
632
+ }
633
+ function specDocumentReviewerEnhancedBody() {
634
+ return `
635
+
636
+ ## Task Tool Delegation
637
+
638
+ Use this payload for final spec-document quality checks before plan handoff:
639
+
640
+ ${MARKDOWN_CODE_FENCE}
641
+ You are a spec-document-reviewer subagent.
642
+
643
+ SPEC_ARTIFACT: {04-spec excerpt or full body}
644
+ UPSTREAM_CONTEXT: {scope/design refs used by the spec}
645
+
646
+ Required output:
647
+ - DOCUMENT_VERDICT: PASS | PASS_WITH_GAPS | FAIL | BLOCKED
648
+ - COMPLETENESS_CHECK: missing required sections or weakly populated rows
649
+ - CONSISTENCY_CHECK: contradictions across ACs, assumptions, mapping, and approval
650
+ - CLARITY_CHECK: ambiguity/placeholders/two-way wording to rewrite
651
+ - SCOPE_FIT_CHECK: whether the artifact still maps to one coherent subsystem/plan slice
652
+ - PATCH_RECOMMENDATIONS: minimal edits to make the spec plan-ready
653
+ ${MARKDOWN_CODE_FENCE}
654
+
645
655
  `;
646
656
  }
647
657
  function sliceImplementerEnhancedBody() {
@@ -808,6 +818,30 @@ Required output:
808
818
  - SCOPE_HANDOFF: one recommendation for hold/selective/expand/reduce
809
819
  ${MARKDOWN_CODE_FENCE}
810
820
 
821
+ `;
822
+ }
823
+ function productStrategistEnhancedBody() {
824
+ return `
825
+
826
+ ## Task Tool Delegation
827
+
828
+ Use this payload for expansion-mode scope strategy checks:
829
+
830
+ ${MARKDOWN_CODE_FENCE}
831
+ You are a product-strategist subagent.
832
+
833
+ SCOPE_MODE: {SCOPE EXPANSION|SELECTIVE EXPANSION}
834
+ DECISION_CONTEXT: {scope contract excerpt + constraints + approved brainstorm direction}
835
+ DEPTH: {standard|deep}
836
+
837
+ Required output:
838
+ - VISION_DELTA: 10x trajectory vs hold-scope baseline
839
+ - EXPANSION_PROPOSALS: 2-3 concrete proposals with add/defer/skip recommendation
840
+ - UPSIDE_AND_RISK: strategic upside, reversibility, and principal downside per proposal
841
+ - TRAJECTORY_FIT: whether current architecture trajectory can absorb accepted expansions
842
+ - FINAL_RECOMMENDATION: smallest high-leverage expansion set to lock now
843
+ ${MARKDOWN_CODE_FENCE}
844
+
811
845
  `;
812
846
  }
813
847
  function criticEnhancedBody() {
@@ -959,56 +993,6 @@ ${MARKDOWN_CODE_FENCE}
959
993
 
960
994
  `;
961
995
  }
962
- /**
963
- * Returns markdown fragments augmenting each specialist persona with Task tool
964
- * delegation guidance. Combine with the existing `body` field from `core-agents.ts`.
965
- */
966
- export function enhancedAgentBody(agentName) {
967
- switch (agentName) {
968
- case "researcher":
969
- return researcherEnhancedBody();
970
- case "architect":
971
- return architectEnhancedBody();
972
- case "spec-validator":
973
- return specValidatorEnhancedBody();
974
- case "slice-implementer":
975
- return sliceImplementerEnhancedBody();
976
- case "performance-reviewer":
977
- return performanceReviewerEnhancedBody();
978
- case "compatibility-reviewer":
979
- return compatibilityReviewerEnhancedBody();
980
- case "observability-reviewer":
981
- return observabilityReviewerEnhancedBody();
982
- case "release-reviewer":
983
- return releaseReviewerEnhancedBody();
984
- case "planner":
985
- return plannerEnhancedBody();
986
- case "product-manager":
987
- return productManagerEnhancedBody();
988
- case "critic":
989
- return criticEnhancedBody();
990
- case "reviewer":
991
- return reviewerEnhancedBody();
992
- case "security-reviewer":
993
- return securityReviewerEnhancedBody();
994
- case "test-author":
995
- return testAuthorEnhancedBody();
996
- case "doc-updater":
997
- return docUpdaterEnhancedBody();
998
- case "implementer":
999
- return implementerEnhancedBody();
1000
- case "fixer":
1001
- return fixerEnhancedBody();
1002
- default:
1003
- return `
1004
-
1005
- ## Task Tool Delegation
1006
-
1007
- _No enhanced Task template is defined for agent \`${agentName}\`._
1008
-
1009
- `;
1010
- }
1011
- }
1012
996
  export function subagentsAgentsMdBlock() {
1013
997
  return `### Subagent Orchestration
1014
998
 
@@ -1,4 +1,4 @@
1
1
  export declare const ARTIFACT_TEMPLATES: Record<string, string>;
2
2
  export declare const RULEBOOK_MARKDOWN = "# Cclaw Rulebook\n\n## MUST_ALWAYS\n- Follow flow order: brainstorm -> scope -> design -> spec -> plan -> tdd -> review -> ship\n- Require explicit user confirmation after plan before TDD\n- Keep evidence artifacts in `.cclaw/artifacts/`\n- Enforce RED before GREEN in TDD\n- Run two-layer review (spec_compliance and code_quality) before ship\n- Validate all inputs before processing \u2014 never trust external data without sanitization\n- Prefer immutable data patterns and pure functions where the language supports them\n- Follow existing repo conventions, patterns, and directory structure \u2014 match the codebase\n- Verify claims with fresh evidence: \"tests pass\" requires running tests in this message\n- Use conventional commits: `type(scope): description` (feat, fix, refactor, test, docs, chore)\n\n## MUST_NEVER\n- Skip RED phase and jump directly to GREEN in TDD\n- Ship with critical review findings\n- Start implementation during /brainstorm\n- Modify generated cclaw files manually when CLI can regenerate them\n- Commit `.cclaw/` or generated shim files\n- Expose secrets, tokens, API keys, or absolute system paths in agent output\n- Duplicate existing functionality without explicit justification \u2014 search before building\n- Bypass security checks, linting hooks, or type checking to \"move faster\"\n- Claim success (\"Done,\" \"All good,\" \"Tests pass\") without running verification in this message\n- Make changes outside the blast radius of the current task without user consent\n\n## DELEGATION\nWhen a task requires specialist knowledge (security audit, performance profiling, database review),\ndelegate to a specialized agent or skill if the harness supports it. The primary agent should:\n1. Identify the specialist domain\n2. Provide focused context (relevant files, the specific concern)\n3. Evaluate the specialist output before acting on it \u2014 do not blindly apply recommendations\n";
3
- export declare const CURSOR_WORKFLOW_RULE_MDC = "---\ndescription: cclaw workflow guardrails for Cursor agent sessions\nglobs:\n - \"**/*\"\nalwaysApply: true\n---\n\n<!-- cclaw-managed-cursor-workflow-rule -->\n\n# Cclaw Workflow Guardrails\n\n## Activation Rule\n\nBefore responding to coding work:\n1. Read `.cclaw/state/flow-state.json`.\n2. Start with `/cc` or continue with `/cc`.\n3. If no software-stage flow applies, respond normally.\n\n## Stage Order\n\n`brainstorm -> scope -> design -> spec -> plan -> tdd -> review -> ship`\n\nTrack-specific skips are allowed only when `flow-state.track` + `skippedStages` explicitly say so.\n\n## Task Classification\n\n| Class | Route |\n|---|---|\n| non-trivial software work | `/cc <idea>` |\n| trivial software fix | `/cc <idea>` (quick track) |\n| bugfix with repro | `/cc <idea>` and enforce RED-first in tdd |\n| pure question / non-software | direct answer (no stage flow) |\n\n## Command Surface\n\n- `/cc` = entry and resume.\n- `/cc` = only progression path.\n- Knowledge capture and recall use the `learnings` skill when requested.\n\n## Verification Discipline\n\n- No completion claim without fresh command evidence in this turn.\n- Do not mark gates passed from memory.\n- Keep evidence in `.cclaw/artifacts/`; archive via `npx cclaw-cli archive`.\n\n## Delegation And Approvals\n\n- Machine-only checks in design/plan/tdd/review/ship should auto-dispatch when tooling supports it.\n- Ask for user input only at explicit approval gates (scope mode, plan approval, challenge resolution, ship finalization).\n- If harness capabilities are partial, record waiver reasons in delegation logs.\n\n## Routing Source Of Truth\n\n- Primary router: `.cclaw/skills/using-cclaw/SKILL.md`.\n- Stage behavior: current stage skill plus `.cclaw/state/flow-state.json`.\n- Preamble budget: keep role/status announcements brief and avoid repeating\n them unless the stage or role changes.\n";
3
+ export declare const CURSOR_WORKFLOW_RULE_MDC = "---\ndescription: cclaw workflow guardrails for Cursor agent sessions\nglobs:\n - \"**/*\"\nalwaysApply: true\n---\n\n<!-- cclaw-managed-cursor-workflow-rule -->\n\n# Cclaw Workflow Guardrails\n\n## Activation Rule\n\nBefore responding to coding work:\n1. Read `.cclaw/state/flow-state.json`.\n2. Start with `/cc` or continue with `/cc`.\n3. If no software-stage flow applies, respond normally.\n\n## Stage Order\n\n`brainstorm -> scope -> design -> spec -> plan -> tdd -> review -> ship`\n\nTrack-specific skips are allowed only when `flow-state.track` + `skippedStages` explicitly say so.\n\n## Task Classification\n\n| Class | Route |\n|---|---|\n| non-trivial software work | `/cc <idea>` |\n| trivial software fix | `/cc <idea>` (quick track) |\n| bugfix with repro | `/cc <idea>` and enforce RED-first in tdd |\n| pure question / non-software | direct answer (no stage flow) |\n\n## Command Surface\n\n- `/cc` = entry and resume.\n- `/cc` = only progression path.\n- Knowledge capture and recall use the `learnings` skill when requested.\n\n## Verification Discipline\n\n- No completion claim without fresh command evidence in this turn.\n- Do not mark gates passed from memory.\n- Keep evidence in `.cclaw/artifacts/`; archive through closeout via `/cc` or cancel early via `node .cclaw/hooks/cancel-run.mjs`.\n\n## Delegation And Approvals\n\n- Machine-only checks in design/plan/tdd/review/ship should auto-dispatch when tooling supports it.\n- Ask for user input only at explicit approval gates (scope mode, plan approval, challenge resolution, ship finalization).\n- If harness capabilities are partial, record waiver reasons in delegation logs.\n\n## Routing Source Of Truth\n\n- Primary router: `.cclaw/skills/using-cclaw/SKILL.md`.\n- Stage behavior: current stage skill plus `.cclaw/state/flow-state.json`.\n- Preamble budget: keep role/status announcements brief and avoid repeating\n them unless the stage or role changes.\n";
4
4
  export declare function buildRulesJson(): Record<string, unknown>;