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
@@ -3,10 +3,10 @@ import { nextStage as nextStageForTrack } from "../flow-state.js";
3
3
  import { FLOW_STAGES } from "../types.js";
4
4
  import { stageExamples } from "./examples.js";
5
5
  import { reviewStackAwareRoutes, reviewStackAwareRoutingSummary, stageAutoSubagentDispatch, stageSchema, stageTrackRenderContext } from "./stage-schema.js";
6
- import { conversationLanguagePolicyMarkdown } from "./language-policy.js";
7
6
  import { referencePatternsForStage } from "./reference-patterns.js";
8
7
  import { harnessDelegationRecipes } from "../harness-adapters.js";
9
8
  const VERIFICATION_STAGES = ["tdd", "review", "ship"];
9
+ const STAGE_LANGUAGE_POLICY_POINTER = "> Language policy: see `using-cclaw` section `Conversation Language Policy`.";
10
10
  // ---------- Cross-cutting universal mechanics (Layer 2 building blocks) ----------
11
11
  //
12
12
  // These are shared, structural blocks that get injected into every stage skill.
@@ -363,7 +363,7 @@ function completionParametersBlock(schema, track) {
363
363
  const nextDescription = nextStage === "done"
364
364
  ? "flow complete"
365
365
  : stageSchema(nextStage, track).skillDescription;
366
- return `## Completion Parameters
366
+ return `### Completion Parameters
367
367
 
368
368
  - \`stage\`: \`${schema.stage}\`
369
369
  - \`next\`: \`${nextStage}\` (${nextDescription})
@@ -373,13 +373,26 @@ function completionParametersBlock(schema, track) {
373
373
  - \`completion helper\`: \`node .cclaw/hooks/stage-complete.mjs ${schema.stage}\`
374
374
  - \`completion helper with evidence\`: \`node .cclaw/hooks/stage-complete.mjs ${schema.stage} --evidence-json '{"<gate_id>":"<evidence note>"}' --passed=<gate_id>[,<gate_id>]\`
375
375
  - \`completion helper JSON diagnostics\`: append \`--json\` to receive a machine-readable validation failure summary.
376
- - \`delegation record helper\`: \`node .cclaw/hooks/delegation-record.mjs --stage=${schema.stage} --agent=<agent> --mode=<mandatory|proactive> --status=<scheduled|launched|acknowledged|completed|failed|waived|stale> --span-id=<spanId> --dispatch-id=<dispatchId> --dispatch-surface=<surface> --agent-definition-path=<path> --json\`. \`delegation helper recipe\`: call \`--status=scheduled\`, then \`--status=launched\`, then \`--status=acknowledged\`, then \`--status=completed\` with the same \`--span-id\`, \`--dispatch-id\`, \`--dispatch-surface\`, and \`--agent-definition-path\`; completed isolated/generic rows fail unless that same span already has an acknowledged event or the completed call includes \`--ack-ts=<iso>\`. For role-switch fallback, use \`--dispatch-surface=role-switch --evidence-ref=<artifact#anchor>\` instead of pretending isolated completion.
376
+ - \`delegation lifecycle proof\`: use the delegation helper recipe in this section with explicit lifecycle rows: \`--status=scheduled\` -> \`--status=launched\` -> \`--status=acknowledged\` -> \`--status=completed\` (completed isolated/generic requires prior ACK for the same span or \`--ack-ts=<iso>\`).
377
377
  - Fill \`## Learnings\` before closeout: either \`- None this stage.\` or JSON bullets with required keys \`type\`, \`trigger\`, \`action\`, \`confidence\` (knowledge-schema compatible).
378
- - Record mandatory delegation lifecycle in \`${RUNTIME_ROOT}/state/delegation-log.json\` and append proof events to \`${RUNTIME_ROOT}/state/delegation-events.jsonl\`; the ledger is current state, the event log is audit proof.${mandatoryAgents.length > 0 ? ` If a mandatory delegation cannot run in this harness, use \`--waive-delegation=${mandatoryAgents.join(",")} --waiver-reason="<why safe>"\` on the completion helper.` : ""}
378
+ - Record mandatory delegation lifecycle in \`${RUNTIME_ROOT}/state/delegation-log.json\` and append proof events to \`${RUNTIME_ROOT}/state/delegation-events.jsonl\`; the ledger is current state, the event log is audit proof.${mandatoryAgents.length > 0 ? ` If a mandatory delegation cannot run in this harness, use \`--waive-delegation=${mandatoryAgents.join(",")} --waiver-reason="<why safe>"\` on the completion helper.` : ""} If proactive delegations were intentionally skipped, rerun only with \`--accept-proactive-waiver\` (optionally \`--accept-proactive-waiver-reason="<why safe>"\`) after explicit user approval.
379
379
  - Never edit raw \`flow-state.json\` to complete a stage, even in advisory mode; that bypasses validation, gate evidence, and Learnings harvest. If the helper fails, stop and report the exact command/output instead of applying a manual state workaround.
380
380
  - Completion protocol: verify required gates, update the artifact, then use the completion helper with \`--evidence-json\` and \`--passed\` for every satisfied gate.
381
381
  `;
382
382
  }
383
+ function delegationAndCompletionBlock(schema, track) {
384
+ const dispatchBlock = autoSubagentDispatchBlock(schema.stage, track).trim();
385
+ const completionBlock = completionParametersBlock(schema, track).trim();
386
+ const normalizedDispatch = dispatchBlock.length > 0
387
+ ? dispatchBlock.replace(/^## Automatic Subagent Dispatch/mu, "### Automatic Subagent Dispatch")
388
+ : "### Automatic Subagent Dispatch\nNo automatic subagent dispatch rules for this stage.";
389
+ return `## Delegation & Completion
390
+
391
+ ${normalizedDispatch}
392
+
393
+ ${completionBlock}
394
+ `;
395
+ }
383
396
  function quickStartBlock(stage, track) {
384
397
  const schema = stageSchema(stage, track);
385
398
  const gatePreview = schema.executionModel.requiredGates.slice(0, 3).map((g) => `\`${g.id}\``).join(", ");
@@ -516,7 +529,7 @@ If you are about to violate the Iron Law, STOP. No amount of urgency, partial pr
516
529
 
517
530
  ${quickStartBlock(stage, track)}
518
531
 
519
- ${conversationLanguagePolicyMarkdown()}
532
+ ${STAGE_LANGUAGE_POLICY_POINTER}
520
533
  ## Philosophy
521
534
  ${philosophy.purpose}
522
535
 
@@ -541,7 +554,7 @@ Stage state machine (map only; Checklist is authoritative):
541
554
  ${processFlowMermaid.length > 0 ? processFlowMermaid : "```mermaid\nflowchart TD\n S1[\"Execute Checklist\"] --> S2[\"Satisfy required gates\"] --> S3[\"Verify before closeout\"]\n```"}
542
555
 
543
556
  ${platformNotesBlock}${contextLoadingBlock(stage, artifactRules.crossStageTrace, executionModel)}
544
- ${autoSubagentDispatchBlock(stage, track)}
557
+ ${delegationAndCompletionBlock(schema, track)}
545
558
  ${stackAwareReviewRoutingBlock(stage)}
546
559
  ${researchPlaybooksBlock(executionModel.researchPlaybooks ?? [])}
547
560
  ${referencePatternsBlock(stage)}
@@ -575,7 +588,6 @@ ${verificationBlock(stage)}
575
588
  ## Exit Criteria
576
589
  ${executionModel.exitCriteria.map((item) => `- [ ] ${item}`).join("\n")}
577
590
 
578
- ${completionParametersBlock(schema, track)}
579
591
  ## Artifact Rules
580
592
  - Artifact target: \`${RUNTIME_ROOT}/artifacts/${artifactRules.artifactFile}\`
581
593
 
@@ -595,3 +607,53 @@ ${reviewSectionsBlock(reviewLens.reviewSections)}
595
607
  - Keep decisions explicit: context, options, chosen option, rationale, risk, and rollback.
596
608
  `;
597
609
  }
610
+ export function executingWavesSkillMarkdown() {
611
+ return `---
612
+ name: executing-waves
613
+ description: "Execute multi-wave work using existing cclaw run resume + verify-current-state — no new CLI needed."
614
+ ---
615
+
616
+ # Executing Waves (Persistent Multi-Wave Work)
617
+
618
+ ## Overview
619
+
620
+ Long-form work (large refactors, multi-stage uplifts) often spans many waves.
621
+ This skill documents how the controller persists work across waves WITHOUT new
622
+ CLI commands, using existing \`cclaw run resume\` and \`internal verify-current-state\`.
623
+
624
+ ## When to Use
625
+
626
+ - Work spans 2+ commits / waves with cohesion concerns between waves.
627
+ - Each wave has its own stage cycle (brainstorm -> scope -> design -> spec -> plan -> tdd -> review -> ship).
628
+ - User wants explicit per-wave verification before the next wave starts.
629
+ - Risk of cross-wave drift exists.
630
+
631
+ ## Anti-Pattern
632
+
633
+ - Running many waves linearly without verification between them, accumulating drift.
634
+ - Treating a wave as only a commit boundary without re-verifying upstream decisions.
635
+
636
+ ## Process
637
+
638
+ 1. **Wave Start**: author wave plan as \`.cclaw/wave-plans/<wave-n>.md\` referencing previous wave's ship artifact.
639
+ 2. **Carry-forward Audit**: at brainstorm of the next wave, re-read previous wave ship artifact and explicitly record:
640
+ - Carrying forward: <locked decisions still valid>
641
+ - Drift detected: <decisions no longer valid + reason>
642
+ - Re-scope needed: <yes/no>
643
+ 3. **Resume Path**: if a wave was interrupted mid-stage, \`cclaw run resume\` restores state. Run \`internal verify-current-state\` before continuing.
644
+ 4. **Wave End**: at ship, architect cross-stage verification runs from dispatch matrix. If \`DRIFT_DETECTED\`, fix before ship.
645
+ 5. **Next Wave Trigger**: launch new \`/cc <topic>\` for next wave and reference previous wave ship artifact in upstream handoff.
646
+
647
+ ## Status Markers
648
+
649
+ - \`wave-status: in-progress\` — current stage incomplete.
650
+ - \`wave-status: blocked-by-prev\` — waiting on previous wave verification.
651
+ - \`wave-status: shipped\` — wave shipped, next wave can start.
652
+ - \`wave-status: rolled-back\` — previous wave invalidated, current wave needs rebase.
653
+
654
+ ## Linter Hooks
655
+
656
+ - If multi-wave work is detected (>1 wave-plan files in \`.cclaw/wave-plans/\`), current brainstorm artifact MUST contain \`## Wave Carry-forward\` section with drift audit.
657
+ - If carry-forward drift is missing in multi-wave context, emit \`[P1] wave.drift_unaddressed\`.
658
+ `;
659
+ }
@@ -89,23 +89,24 @@ function defaultReturnSchemaForAgent(agent) {
89
89
  return "architecture-return";
90
90
  case "spec-validator":
91
91
  return "spec-validation-return";
92
+ case "spec-document-reviewer":
93
+ case "coherence-reviewer":
94
+ case "scope-guardian-reviewer":
95
+ case "feasibility-reviewer":
96
+ return "review-return";
92
97
  case "slice-implementer":
93
98
  return "worker-return";
94
- case "performance-reviewer":
95
- return "performance-return";
96
- case "compatibility-reviewer":
97
- return "compatibility-return";
98
- case "observability-reviewer":
99
- return "observability-return";
100
99
  case "release-reviewer":
101
100
  return "release-return";
102
101
  case "planner":
103
102
  return "planning-return";
104
- case "product-manager":
103
+ case "product-discovery":
105
104
  return "product-return";
105
+ case "divergent-thinker":
106
106
  case "critic":
107
107
  return "critic-return";
108
108
  case "reviewer":
109
+ case "integration-overseer":
109
110
  return "review-return";
110
111
  case "security-reviewer":
111
112
  return "security-return";
@@ -115,14 +116,12 @@ function defaultReturnSchemaForAgent(agent) {
115
116
  return "docs-return";
116
117
  case "fixer":
117
118
  return "fixer-return";
118
- case "implementer":
119
- return "worker-return";
120
119
  }
121
120
  }
122
121
  function dispatchClassForRow(row) {
123
122
  if (row.dispatchClass)
124
123
  return row.dispatchClass;
125
- if (row.agent === "implementer" || row.agent === "fixer" || row.agent === "slice-implementer")
124
+ if (row.agent === "fixer" || row.agent === "slice-implementer")
126
125
  return "worker";
127
126
  return row.skill?.includes("review") || row.agent === "reviewer" || row.agent === "security-reviewer" || row.agent.endsWith("-reviewer")
128
127
  ? "review-lens"
@@ -258,6 +257,7 @@ const REQUIRED_GATE_IDS = {
258
257
  design: [
259
258
  "design_research_complete",
260
259
  "design_architecture_locked",
260
+ "design_diagram_freshness",
261
261
  "design_data_flow_mapped",
262
262
  "design_failure_modes_mapped",
263
263
  "design_test_and_perf_defined"
@@ -266,6 +266,7 @@ const REQUIRED_GATE_IDS = {
266
266
  "spec_acceptance_measurable",
267
267
  "spec_testability_confirmed",
268
268
  "spec_assumptions_surfaced",
269
+ "spec_self_review_complete",
269
270
  "spec_user_approved"
270
271
  ],
271
272
  plan: [
@@ -282,6 +283,9 @@ const REQUIRED_GATE_IDS = {
282
283
  "tdd_green_full_suite",
283
284
  "tdd_refactor_completed",
284
285
  "tdd_verified_before_complete",
286
+ "tdd_iron_law_acknowledged",
287
+ "tdd_watched_red_observed",
288
+ "tdd_slice_cycle_complete",
285
289
  "tdd_docs_drift_check",
286
290
  ...(track === "quick" ? [] : ["tdd_traceable_to_plan"])
287
291
  ],
@@ -290,8 +294,7 @@ const REQUIRED_GATE_IDS = {
290
294
  "review_layer2_security",
291
295
  "review_layer_coverage_complete",
292
296
  "review_criticals_resolved",
293
- "review_army_json_valid",
294
- ...(track === "quick" ? [] : ["review_trace_matrix_clean"])
297
+ "review_army_json_valid"
295
298
  ],
296
299
  ship: [
297
300
  "ship_review_verdict_valid",
@@ -322,9 +325,27 @@ const REQUIRED_ARTIFACT_SECTIONS = {
322
325
  "Spec Handoff",
323
326
  "Completion Dashboard"
324
327
  ],
325
- spec: ["Acceptance Criteria", "Edge Cases", "Assumptions Before Finalization", "Acceptance Mapping", "Approval"],
328
+ spec: [
329
+ "Acceptance Criteria",
330
+ "Edge Cases",
331
+ "Assumptions Before Finalization",
332
+ "Acceptance Mapping",
333
+ "Spec Self-Review",
334
+ "Approval"
335
+ ],
326
336
  plan: ["Task List", "Dependency Batches", "Acceptance Mapping", "Execution Posture", "WAIT_FOR_CONFIRM"],
327
- tdd: ["Test Discovery", "System-Wide Impact Check", "RED Evidence", "GREEN Evidence", "REFACTOR Notes", "Traceability", "Verification Ladder"],
337
+ tdd: [
338
+ "Test Discovery",
339
+ "System-Wide Impact Check",
340
+ "RED Evidence",
341
+ "GREEN Evidence",
342
+ "REFACTOR Notes",
343
+ "Traceability",
344
+ "Iron Law Acknowledgement",
345
+ "Watched-RED Proof",
346
+ "Vertical Slice Cycle",
347
+ "Verification Ladder"
348
+ ],
328
349
  review: ["Review Evidence Scope", "Changed-File Coverage", "Layer 1 Verdict", "Review Findings Contract", "Severity Summary", "Final Verdict"],
329
350
  ship: ["Preflight Results", "Release Notes", "Rollback Plan", "Finalization"]
330
351
  };
@@ -421,11 +442,18 @@ const STAGE_SCHEMA_MAP = {
421
442
  const STAGE_AUTO_SUBAGENT_DISPATCH = {
422
443
  brainstorm: [
423
444
  {
424
- agent: "product-manager",
445
+ agent: "product-discovery",
425
446
  mode: "mandatory",
426
447
  requiredAtTier: "standard",
427
448
  when: "Always for standard/deep brainstorm to validate value, persona/JTBD, success metric, and why-now framing.",
428
- purpose: "Pressure-test problem/value fit and produce product-discovery evidence for the Problem Decision Record.",
449
+ purpose: "Run product-discovery mode to pressure-test problem/value fit and produce product evidence for the Problem Decision Record.",
450
+ requiresUserGate: false
451
+ },
452
+ {
453
+ agent: "divergent-thinker",
454
+ mode: "proactive",
455
+ when: "When brainstorm has >1 candidate direction or user signals openness to alternatives.",
456
+ purpose: "Expand option-space with alternative framings and approaches before planner/critic convergence.",
429
457
  requiresUserGate: false
430
458
  },
431
459
  {
@@ -433,8 +461,9 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
433
461
  mode: "mandatory",
434
462
  requiredAtTier: "standard",
435
463
  when: "Always for standard/deep brainstorm to challenge the premise, do-nothing path, and higher-upside alternatives.",
436
- purpose: "Attack assumptions and surface non-goals before direction approval.",
437
- requiresUserGate: false
464
+ purpose: "Attack assumptions and surface non-goals before direction approval, with pre-commitment predictions validated against evidence.",
465
+ requiresUserGate: false,
466
+ skill: "critic-multi-perspective"
438
467
  },
439
468
  {
440
469
  agent: "researcher",
@@ -453,13 +482,21 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
453
482
  purpose: "Challenge premise, map alternatives, and produce explicit in/out contract.",
454
483
  requiresUserGate: false
455
484
  },
485
+ {
486
+ agent: "divergent-thinker",
487
+ mode: "proactive",
488
+ when: "When scope mode is SCOPE EXPANSION or SELECTIVE EXPANSION, or scope contract has fewer than 3 alternatives considered.",
489
+ purpose: "Generate additional framings and approach variants before scope convergence hardens.",
490
+ requiresUserGate: false
491
+ },
456
492
  {
457
493
  agent: "critic",
458
494
  mode: "mandatory",
459
495
  requiredAtTier: "standard",
460
496
  when: "Always during scope shaping for standard/deep work.",
461
- purpose: "Test whether the selected scope mode is too timid, too broad, or hiding a smaller useful slice.",
462
- requiresUserGate: false
497
+ purpose: "Test whether the selected scope mode is too timid, too broad, or hiding a smaller useful slice, using pre-commitment predictions and validation.",
498
+ requiresUserGate: false,
499
+ skill: "critic-multi-perspective"
463
500
  },
464
501
  {
465
502
  agent: "researcher",
@@ -469,11 +506,27 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
469
506
  requiresUserGate: false
470
507
  },
471
508
  {
472
- agent: "product-manager",
509
+ agent: "product-discovery",
473
510
  mode: "proactive",
474
- when: "When scope choices change user value, success metrics, or product positioning.",
475
- purpose: "Keep accepted/deferred reference ideas tied to user value and measurable success.",
511
+ when: "When scope choices change user value, success metrics, or product positioning (Mode: discovery).",
512
+ purpose: "Keep accepted/deferred reference ideas tied to user value and measurable success under product-discovery mode.",
476
513
  requiresUserGate: false
514
+ },
515
+ {
516
+ agent: "product-discovery",
517
+ mode: "proactive",
518
+ requiredAtTier: "standard",
519
+ when: "When scope mode resolves to SCOPE EXPANSION or SELECTIVE EXPANSION (Mode: strategist).",
520
+ purpose: "Drive 10x vision and concrete expansion proposals before locking the scope contract via product-discovery strategist mode.",
521
+ requiresUserGate: false
522
+ },
523
+ {
524
+ agent: "scope-guardian-reviewer",
525
+ mode: "proactive",
526
+ when: "When scope mode is SCOPE EXPANSION or SELECTIVE EXPANSION, or scope contract has many accepted ideas.",
527
+ purpose: "Challenge complexity growth and enforce minimum-change scope discipline before scope lock.",
528
+ requiresUserGate: false,
529
+ skill: "document-scope-guard"
477
530
  }
478
531
  ],
479
532
  design: [
@@ -496,9 +549,10 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
496
549
  {
497
550
  agent: "critic",
498
551
  mode: "proactive",
499
- when: "When architecture alternatives, coupling, cost, or rollback risk remain debatable.",
500
- purpose: "Produce a shadow alternative, switch trigger, and cheaper-path challenge for the engineering lock.",
501
- requiresUserGate: false
552
+ when: "When architecture alternatives, coupling, cost, or rollback risk remain debatable, or when security/auth/authz trust boundaries are involved.",
553
+ purpose: "Produce a shadow alternative, switch trigger, and cheaper-path challenge for the engineering lock with pre-commitment predictions and validation.",
554
+ requiresUserGate: false,
555
+ skill: "critic-multi-perspective"
502
556
  },
503
557
  {
504
558
  agent: "researcher",
@@ -515,20 +569,20 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
515
569
  requiresUserGate: false
516
570
  },
517
571
  {
518
- agent: "compatibility-reviewer",
572
+ agent: "coherence-reviewer",
519
573
  mode: "proactive",
520
- requiredAtTier: "lightweight",
521
- when: "When public API, config, persisted data, CLI, generated clients, or cross-version behavior can change.",
522
- purpose: "Identify backward-compatibility and migration hazards before spec/plan.",
523
- requiresUserGate: false
574
+ when: "When design touches multiple subsystems or includes multiple alternatives sections.",
575
+ purpose: "Detect internal contradictions, terminology drift, and broken cross-section references in design docs.",
576
+ requiresUserGate: false,
577
+ skill: "document-coherence-pass"
524
578
  },
525
579
  {
526
- agent: "observability-reviewer",
580
+ agent: "feasibility-reviewer",
527
581
  mode: "proactive",
528
- requiredAtTier: "lightweight",
529
- when: "When runtime/debuggability, rollout, failure detection, or supportability matters.",
530
- purpose: "Validate logs/metrics/traces, alerting, and rescue-path visibility before implementation.",
531
- requiresUserGate: false
582
+ when: "When design assumes runtime conditions, scaling behavior, or external service availability.",
583
+ purpose: "Validate that design assumptions remain feasible in real runtime and rollout constraints.",
584
+ requiresUserGate: false,
585
+ skill: "document-feasibility-pass"
532
586
  }
533
587
  ],
534
588
  spec: [
@@ -546,6 +600,22 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
546
600
  when: "When acceptance criteria need testability review or RED expressibility is uncertain.",
547
601
  purpose: "Confirm likely test levels, commands/manual evidence, and assertion surfaces are concrete.",
548
602
  requiresUserGate: false
603
+ },
604
+ {
605
+ agent: "spec-document-reviewer",
606
+ mode: "proactive",
607
+ requiredAtTier: "standard",
608
+ when: "When Spec Self-Review reports gaps (Status: Issues Found) or subsystem boundaries drift beyond one coherent plan slice.",
609
+ purpose: "Run a final document-level quality pass for completeness, consistency, clarity, and scope fit before handoff to plan.",
610
+ requiresUserGate: false
611
+ },
612
+ {
613
+ agent: "coherence-reviewer",
614
+ mode: "proactive",
615
+ when: "When spec has more than five acceptance criteria or multiple assumptions sections.",
616
+ purpose: "Check cross-section coherence, terminology consistency, and internal references before plan handoff.",
617
+ requiresUserGate: false,
618
+ skill: "document-coherence-pass"
549
619
  }
550
620
  ],
551
621
  plan: [
@@ -563,6 +633,30 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
563
633
  when: "When plan tasks touch unfamiliar areas or reference-pattern adoption needs source verification.",
564
634
  purpose: "Confirm context/search evidence before plan packets rely on discovered patterns.",
565
635
  requiresUserGate: false
636
+ },
637
+ {
638
+ agent: "coherence-reviewer",
639
+ mode: "proactive",
640
+ when: "When plan packets touch more than one subsystem or map more than five dependency edges.",
641
+ purpose: "Verify internal consistency across batches, dependencies, and handoff narratives.",
642
+ requiresUserGate: false,
643
+ skill: "document-coherence-pass"
644
+ },
645
+ {
646
+ agent: "scope-guardian-reviewer",
647
+ mode: "proactive",
648
+ when: "When plan introduces new abstractions or generic utility layers.",
649
+ purpose: "Challenge unnecessary abstraction and enforce minimum viable implementation scope.",
650
+ requiresUserGate: false,
651
+ skill: "document-scope-guard"
652
+ },
653
+ {
654
+ agent: "feasibility-reviewer",
655
+ mode: "proactive",
656
+ when: "When plan carries runtime, environment, dependency, or resource assumptions.",
657
+ purpose: "Validate execution and rollout feasibility before implementation starts.",
658
+ requiresUserGate: false,
659
+ skill: "document-feasibility-pass"
566
660
  }
567
661
  ],
568
662
  tdd: [
@@ -583,6 +677,13 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
583
677
  purpose: "Implement the minimal passing slice inside explicit file boundaries and return strict worker evidence.",
584
678
  requiresUserGate: false
585
679
  },
680
+ {
681
+ agent: "integration-overseer",
682
+ mode: "proactive",
683
+ when: "When TDD fan-out used 2+ parallel slice-implementers, or when slices touch shared interfaces.",
684
+ purpose: "Verify cohesion-contract integrity across shared types, touchpoints, invariants, and integration test outcomes after fan-in.",
685
+ requiresUserGate: false
686
+ },
586
687
  {
587
688
  agent: "reviewer",
588
689
  mode: "proactive",
@@ -604,7 +705,7 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
604
705
  mode: "mandatory",
605
706
  requiredAtTier: "lightweight",
606
707
  when: "Always in review stage.",
607
- purpose: "Layer 1 spec compliance plus integrated Layer 2 review across correctness, architecture, and external-safety tags with source-tagged findings.",
708
+ purpose: "Layer 1 spec compliance plus integrated Layer 2 review across correctness, architecture, and inline performance/compatibility/observability lens coverage with source-tagged findings. Escalate to optional dedicated lens skills only when diff scope/risk justifies a deeper pass.",
608
709
  requiresUserGate: false,
609
710
  skill: "review-spec-pass"
610
711
  },
@@ -617,30 +718,6 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
617
718
  requiresUserGate: false,
618
719
  skill: "security-audit"
619
720
  },
620
- {
621
- agent: "performance-reviewer",
622
- mode: "proactive",
623
- requiredAtTier: "lightweight",
624
- when: "When hot paths, IO, data volume, rendering, caching, or algorithmic cost can move.",
625
- purpose: "Run a focused performance lens and report evidence-backed regressions or no-impact rationale.",
626
- requiresUserGate: false
627
- },
628
- {
629
- agent: "compatibility-reviewer",
630
- mode: "proactive",
631
- requiredAtTier: "lightweight",
632
- when: "When public API, CLI/config, persisted data, generated clients, or dependency versions change.",
633
- purpose: "Check compatibility, migrations, and consumer-facing contract stability.",
634
- requiresUserGate: false
635
- },
636
- {
637
- agent: "observability-reviewer",
638
- mode: "proactive",
639
- requiredAtTier: "lightweight",
640
- when: "When failure diagnosis, logging/metrics/traces, rollout, or operational support matters.",
641
- purpose: "Check observability and supportability evidence against the design/review artifact.",
642
- requiresUserGate: false
643
- },
644
721
  {
645
722
  agent: "reviewer",
646
723
  mode: "proactive",
@@ -667,6 +744,15 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
667
744
  }
668
745
  ],
669
746
  ship: [
747
+ {
748
+ agent: "architect",
749
+ mode: "mandatory",
750
+ requiredAtTier: "lightweight",
751
+ when: "Always before final ship — verify cross-stage cohesion across scope/design/spec/plan/code.",
752
+ purpose: "Final cross-stage cohesion gate before release finalization.",
753
+ requiresUserGate: false,
754
+ skill: "architect-cross-stage-verification"
755
+ },
670
756
  {
671
757
  agent: "release-reviewer",
672
758
  mode: "mandatory",
@@ -6,6 +6,9 @@ const STAGE_POLICY_NEEDLES = {
6
6
  "Explore project context",
7
7
  "One question at a time",
8
8
  "2-3 architecturally distinct approaches",
9
+ "Embedded Grill",
10
+ "Victory Detector",
11
+ "Critic Pass",
9
12
  "State what is being approved",
10
13
  "Self-review before handoff",
11
14
  "Do NOT implement, scaffold, or modify behavior"
@@ -17,7 +20,9 @@ const STAGE_POLICY_NEEDLES = {
17
20
  "Discretion Areas",
18
21
  "NOT in scope",
19
22
  "Premise Challenge",
20
- "Locked Decisions"
23
+ "Locked Decisions",
24
+ "Victory Detector",
25
+ "Critic Pass"
21
26
  ],
22
27
  design: [
23
28
  "Parallel Research Fleet",
@@ -25,9 +30,21 @@ const STAGE_POLICY_NEEDLES = {
25
30
  "Data Flow",
26
31
  "Failure Modes and Mitigation",
27
32
  "Performance Budget",
33
+ "Long-Term Trajectory",
34
+ "Victory Detector",
35
+ "Critic Pass",
28
36
  "One issue at a time"
29
37
  ],
30
- spec: ["Acceptance Criteria", "Constraints", "Assumptions Before Finalization", "Testability", "approved spec", "Edge Cases"],
38
+ spec: [
39
+ "Acceptance Criteria",
40
+ "Constraints",
41
+ "Assumptions Before Finalization",
42
+ "Testability",
43
+ "Spec Self-Review",
44
+ "single subsystem",
45
+ "approved spec",
46
+ "Edge Cases"
47
+ ],
31
48
  plan: [
32
49
  "WAIT_FOR_CONFIRM",
33
50
  "Task Graph",
@@ -35,6 +52,8 @@ const STAGE_POLICY_NEEDLES = {
35
52
  "Acceptance Mapping",
36
53
  "verification steps",
37
54
  "Execution Posture",
55
+ "Calibrated Findings",
56
+ "Regression Iron Rule",
38
57
  "Locked Decision Coverage"
39
58
  ],
40
59
  tdd: [
@@ -42,8 +61,13 @@ const STAGE_POLICY_NEEDLES = {
42
61
  "GREEN",
43
62
  "REFACTOR",
44
63
  "failing test",
64
+ "Iron Law Acknowledgement",
65
+ "Watched-RED Proof",
66
+ "Vertical Slice Cycle",
45
67
  "Test Discovery",
46
68
  "System-Wide Impact Check",
69
+ "TDD Blocker Taxonomy",
70
+ "Per-Slice Review",
47
71
  "full test suite",
48
72
  "acceptance criteria",
49
73
  "traceable to plan slice"
@@ -5,8 +5,8 @@ export const BRAINSTORM = {
5
5
  schemaShape: "v2",
6
6
  stage: "brainstorm",
7
7
  complexityTier: "standard",
8
- skillFolder: "brainstorming",
9
- skillName: "brainstorming",
8
+ skillFolder: "brainstorm",
9
+ skillName: "brainstorm",
10
10
  skillDescription: "Problem-discovery stage. Build a concise Problem Decision Record, choose lite/standard/deep depth, compare distinct directions, and hand approved decisions to scope.",
11
11
  philosophy: {
12
12
  hardGate: "Do NOT invoke implementation skills, write code, scaffold projects, or mutate product behavior until a concrete direction is approved by the user.",
@@ -43,15 +43,17 @@ export const BRAINSTORM = {
43
43
  "**Reframe with How Might We** — write a single `How Might We …?` line that names the user/operator, the desired outcome, and the constraint. This is the altitude check before approaches.",
44
44
  "**Run Clarity Gate** — record ambiguity score (0.00-1.00), decision boundaries, reaffirmed non-goals, and residual-risk handoff before locking recommendations. If ambiguity remains high (>0.40), ask one decision-changing question before recommending.",
45
45
  "**Sharpening question discipline** — ask one decision-changing question at a time. Do not default to 3-5 batched questions; record only questions that changed the direction or a critical stop decision.",
46
- "**Use compact discovery for simple apps** — for concrete low-risk asks (todo app, landing page, local widget), do one context pass, compare one baseline and one challenger, then ask for one explicit approval; do not drag the user through a full workshop.",
46
+ "**Use compact discovery for low-risk asks** — for concrete bounded requests, do one context pass, compare one baseline and one challenger, then ask for one explicit approval; do not drag the user through a full workshop.",
47
47
  "**Early-exit concrete asks** — for unambiguous implementation-only requests, write a compact Problem Decision Record plus short-circuit handoff (context, approved intent, constraints, assumptions, next-stage risks) and ask for one explicit approval.",
48
48
  "**Ask only decision-changing questions** — one at a time; if answers would not change approach and are non-critical preference/default assumptions, state the assumption and continue; STOP on scope, architecture, security, data loss, public API, migration, auth/pricing, or user approval uncertainty.",
49
49
  "**Compare 2-3 distinct approaches with stable Role/Upside columns** — Role values are `baseline` | `challenger` | `wild-card`; Upside is `low` | `modest` | `high` | `higher`; include real trade-offs, reuse notes, and reference-pattern source/disposition when a known pattern influenced the option; include exactly one challenger with explicit `high` or `higher` upside.",
50
50
  "**Collect reaction before recommending** — ask which option feels closest and what concern remains, then recommend based on that reaction.",
51
51
  "**Write the `Not Doing` list** — name 3-5 things this brainstorm explicitly is not committing to (vs. deferred). This protects scope from silent enlargement and the next stage from rework.",
52
+ "**Run early Ralph loop discipline** — after each producer iteration, append a `Critic Pass` JSONL row to `.cclaw/state/early-loop-log.jsonl`, refresh `.cclaw/state/early-loop.json`, and iterate until open concerns clear or convergence guard escalates.",
53
+ "**Embedded Grill (post-pick)** — after `Selected Direction` is named, run 3-5 sharp checks on hidden constraints, reversibility/rollback, scope boundaries, existing-pattern conformance, and domain-language fit; record each question with recommended answer and disposition (accept/refine/reject).",
52
54
  "**Self-review before user approval** — re-read the artifact and patch contradictions, weak trade-offs, placeholders, ambiguity, and weak handoff language. Record the result in `Self-Review Notes` using the calibrated review format: `- Status: Approved` (or `Issues Found`), `- Patches applied:` with inline note or sub-bullets, `- Remaining concerns:` with inline note or sub-bullets. Use `Patches applied: None` and `Remaining concerns: None` when there is nothing to record.",
53
55
  "**Request explicit approval** — state exactly what direction is being approved; do not advance without approval and artifact review.",
54
- "**Handoff** — only after approval, hand scope: upstream decisions used, explicit drift, confidence level, unresolved questions, next-stage risk hints, and non-goals."
56
+ "**Handoff packet** — only after approval, produce a scope handoff packet with selected direction, why rejected options were rejected, explicit non-goals, unresolved questions, risk hints, and explicit drift from the initial ask so scope starts from locked upstream decisions instead of rediscovering intent."
55
57
  ],
56
58
  interactionProtocol: [
57
59
  "Start from observed project context; if the idea is vague, first narrow the project type with **one** structured question, then keep going.",
@@ -59,7 +61,7 @@ export const BRAINSTORM = {
59
61
  "Lead with the premise check (right problem / direct path / what if nothing) and the `How Might We` reframing before approaches; both go in the artifact, not just the chat.",
60
62
  "Ask at most one question per turn, only when decision-changing; if using a structured question tool, send exactly one question object, not a multi-question form.",
61
63
  "Only non-critical preference/default assumptions may continue inline. STOP and ask when uncertainty affects scope, architecture, security, data loss, public API, migration, auth/pricing, or user approval.",
62
- "For simple greenfield web apps, present a compact A/B choice with one recommended path and one higher-upside challenger; keep the artifact concise but structurally complete (Context, Premise, How Might We, Sharpening Questions, Approaches, Reaction, Selected Direction, Not Doing).",
64
+ "For simple low-risk greenfield work, present a compact A/B choice with one recommended path and one higher-upside challenger; keep the artifact concise but structurally complete (Context, Premise, How Might We, Sharpening Questions, Approaches, Reaction, Selected Direction, Not Doing).",
63
65
  "Show approaches before the recommendation; include a higher-upside challenger and gather reaction first.",
64
66
  "Self-review before approval: re-read the artifact, fix contradictions/placeholders/weak trade-offs, then ask for approval. Do not ask for approval on a draft you have not re-read.",
65
67
  "State exactly what is being approved, then **STOP** until the user explicitly approves the artifact."
@@ -87,11 +89,12 @@ export const BRAINSTORM = {
87
89
  "2-3 approaches with trade-offs are recorded, including one higher-upside challenger option and reference-pattern source/disposition when applicable.",
88
90
  "User reaction to approaches is captured before final recommendation.",
89
91
  "Final recommendation explicitly reflects user reaction.",
92
+ "Early-loop status is reflected via `Victory Detector` / `Critic Pass` sections and `.cclaw/state/early-loop.json` when concerns remain.",
90
93
  "Selected Direction includes the handoff to the track-aware next stage: scope on standard, spec on medium when scope/design are skipped.",
91
94
  "When a promising option is parked, a seed file is created under `.cclaw/seeds/` and referenced in the artifact.",
92
95
  "Approved direction and approval marker are present.",
93
96
  "Assumptions and open questions are captured (or explicitly marked as none).",
94
- "Scope handoff includes upstream decisions used, explicit drift, confidence, unresolved questions, next-stage risk hints, and non-goals."
97
+ "Scope handoff packet includes selected direction, upstream decisions used, explicit drift, confidence, unresolved questions, next-stage risk hints, and non-goals."
95
98
  ],
96
99
  inputs: ["problem statement", "constraints", "success criteria"],
97
100
  requiredContext: [
@@ -141,10 +144,13 @@ export const BRAINSTORM = {
141
144
  { section: "Reference Pattern Candidates", required: false, validationRule: "Recommended when examples influence direction: list pattern/source, reusable invariant, accept/reject/defer disposition, and reason before approaches are finalized." },
142
145
  { section: "Approaches", required: true, validationRule: "Must compare 2-3 distinct options with real trade-offs. Use the canonical `Role` column with `baseline` | `challenger` | `wild-card` and the `Upside` column with `low` | `modest` | `high` | `higher`; include exactly one challenger row with `high` or `higher` upside, and cite reference-pattern source/disposition when applicable." },
143
146
  { section: "Approach Reaction", required: true, validationRule: "Must appear before Selected Direction and summarize user reaction before recommendation, including `Closest option`, `Concerns`, and what changed after reaction." },
144
- { section: "Selected Direction", required: true, validationRule: "Must include the selected approach, explicit approval marker, rationale traceable to Approach Reaction, and scope handoff with decisions, drift, confidence, unresolved questions, risk hints, and non-goals." },
147
+ { section: "Selected Direction", required: true, validationRule: "Must include the selected approach, explicit approval marker, rationale traceable to Approach Reaction, and a scope handoff packet with selected direction, decisions, drift, confidence, unresolved questions, risk hints, and non-goals." },
148
+ { section: "Embedded Grill", required: false, validationRule: "Recommended after Selected Direction: 3-5 rows covering hidden constraints, reversibility/rollback, scope boundaries, existing-pattern fit, and domain-language alignment. Each row records question, recommended answer, and disposition (accept/refine/reject)." },
145
149
  { section: "Not Doing", required: false, validationRule: "Recommended: 3-5 explicitly non-committed items (distinct from deferred). Protects scope from silent enlargement and the next stage from rework." },
146
150
  { section: "Design", required: false, validationRule: "Must cover architecture, key components, and data flow scaled to complexity." },
147
151
  { section: "Visual Companion", required: false, validationRule: "If architecture/data-flow complexity is medium+, include compact ASCII/Mermaid diagram or explicitly justify omission." },
152
+ { section: "Victory Detector", required: false, validationRule: "Recommended early-loop checkpoint: cite `.cclaw/state/early-loop.json`, current iteration/maxIterations, open concern count, convergence status, and iterate/ready/escalate decision." },
153
+ { section: "Critic Pass", required: false, validationRule: "Recommended producer/critic log contract: each iteration appends one JSONL row to `.cclaw/state/early-loop-log.jsonl` with runId, stage, iteration, and open concerns." },
148
154
  { section: "Self-Review Notes", required: false, validationRule: "Recommended: use the calibrated review format — `- Status: Approved` (or `Issues Found`), `- Patches applied:` (inline note or sub-bullets, use `None` if nothing changed), `- Remaining concerns:` (inline note or sub-bullets, use `None` if nothing remains). Done before requesting user approval." },
149
155
  { section: "Assumptions and Open Questions", required: false, validationRule: "Must capture unresolved assumptions/open questions, or explicitly state none." }
150
156
  ],