cclaw-cli 0.48.29 → 0.48.31

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.
@@ -1,22 +1,20 @@
1
1
  import { RUNTIME_ROOT, STAGE_TO_SKILL_FOLDER } from "../constants.js";
2
- import { STAGE_EXAMPLES_REFERENCE_DIR, stageDomainExamples, stageExamples, stageGoodBadExamples } from "./examples.js";
2
+ import { STAGE_EXAMPLES_REFERENCE_DIR, stageExamples } from "./examples.js";
3
3
  import { STAGE_COMMON_GUIDANCE_REL_PATH } from "./stage-common-guidance.js";
4
4
  import { stageAutoSubagentDispatch, stageSchema } from "./stage-schema.js";
5
5
  const VERIFICATION_STAGES = ["tdd", "review", "ship"];
6
6
  const DECISION_PROTOCOL_PATH = `${RUNTIME_ROOT}/references/protocols/decision.md`;
7
7
  const COMPLETION_PROTOCOL_PATH = `${RUNTIME_ROOT}/references/protocols/completion.md`;
8
- function whenNotToUseBlock(stage, track) {
9
- const schema = stageSchema(stage, track);
10
- if (schema.whenNotToUse.length === 0) {
8
+ function whenNotToUseBlock(items) {
9
+ if (items.length === 0) {
11
10
  return "";
12
11
  }
13
12
  return `## When Not to Use
14
- ${schema.whenNotToUse.map((item) => `- ${item}`).join("\n")}
13
+ ${items.map((item) => `- ${item}`).join("\n")}
15
14
 
16
15
  `;
17
16
  }
18
- function contextLoadingBlock(stage, track) {
19
- const trace = stageSchema(stage, track).crossStageTrace;
17
+ function contextLoadingBlock(trace) {
20
18
  const readLines = trace.readsFrom.length > 0
21
19
  ? trace.readsFrom.map((value) => `- \`${value}\``).join("\n")
22
20
  : "- (first stage — no upstream artifacts)";
@@ -54,8 +52,7 @@ Mandatory delegations for this stage: ${mandatoryList}.
54
52
  Record completion/waiver in \`${delegationLogRel}\` before stage completion.
55
53
  `;
56
54
  }
57
- function researchPlaybooksBlock(stage, track) {
58
- const playbooks = stageSchema(stage, track).researchPlaybooks ?? [];
55
+ function researchPlaybooksBlock(playbooks) {
59
56
  if (playbooks.length === 0)
60
57
  return "";
61
58
  const rows = playbooks
@@ -70,11 +67,10 @@ and record outcomes in the stage artifact when relevant.
70
67
  ${rows}
71
68
  `;
72
69
  }
73
- function reviewSectionsBlock(stage, track) {
74
- const schema = stageSchema(stage, track);
75
- if (schema.reviewSections.length === 0)
70
+ function reviewSectionsBlock(sectionsInput) {
71
+ if (sectionsInput.length === 0)
76
72
  return "";
77
- const sections = schema.reviewSections
73
+ const sections = sectionsInput
78
74
  .map((sec) => {
79
75
  const points = sec.evaluationPoints.map((p) => `- ${p}`).join("\n");
80
76
  const title = sec.stopGate ? `${sec.title} (STOP gate)` : sec.title;
@@ -116,8 +112,7 @@ Detailed walkthrough:
116
112
  \`.cclaw/${STAGE_EXAMPLES_REFERENCE_DIR}/tdd-batch-walkthrough.md\`
117
113
  `;
118
114
  }
119
- function crossStageTraceBlock(stage, track) {
120
- const trace = stageSchema(stage, track).crossStageTrace;
115
+ function crossStageTraceBlock(trace) {
121
116
  const reads = trace.readsFrom.length > 0
122
117
  ? trace.readsFrom.map((r) => `- ${r}`).join("\n")
123
118
  : "- (first stage — no upstream artifacts)";
@@ -135,8 +130,7 @@ ${writes}
135
130
  Rule: ${trace.traceabilityRule}
136
131
  `;
137
132
  }
138
- function artifactValidationBlock(stage, track) {
139
- const validations = stageSchema(stage, track).artifactValidation;
133
+ function artifactValidationBlock(validations) {
140
134
  if (validations.length === 0)
141
135
  return "";
142
136
  const rows = validations
@@ -152,10 +146,10 @@ function artifactValidationBlock(stage, track) {
152
146
  ${rows}
153
147
  `;
154
148
  }
155
- function mergedAntiPatterns(schema) {
149
+ function mergedAntiPatterns(philosophy, execution) {
156
150
  const merged = [];
157
151
  const seen = new Set();
158
- for (const item of [...schema.commonRationalizations, ...schema.blockers]) {
152
+ for (const item of [...philosophy.commonRationalizations, ...execution.blockers]) {
159
153
  const key = item.trim().toLowerCase();
160
154
  if (seen.has(key))
161
155
  continue;
@@ -205,9 +199,9 @@ function stageSpecificSeeAlso(stage) {
205
199
  return refs[stage];
206
200
  }
207
201
  function completionParametersBlock(schema, track) {
208
- const gateList = schema.requiredGates.map((g) => `\`${g.id}\``).join(", ");
209
- const mandatory = schema.mandatoryDelegations.length > 0
210
- ? schema.mandatoryDelegations.map((a) => `\`${a}\``).join(", ")
202
+ const gateList = schema.executionModel.requiredGates.map((g) => `\`${g.id}\``).join(", ");
203
+ const mandatory = schema.reviewLens.mandatoryDelegations.length > 0
204
+ ? schema.reviewLens.mandatoryDelegations.map((a) => `\`${a}\``).join(", ")
211
205
  : "none";
212
206
  const nextStage = schema.next === "done" ? "done" : schema.next;
213
207
  const nextDescription = schema.next === "done"
@@ -218,25 +212,24 @@ function completionParametersBlock(schema, track) {
218
212
  - \`stage\`: \`${schema.stage}\`
219
213
  - \`next\`: \`${nextStage}\` (${nextDescription})
220
214
  - \`gates\`: ${gateList}
221
- - \`artifact\`: \`${RUNTIME_ROOT}/artifacts/${schema.artifactFile}\`
215
+ - \`artifact\`: \`${RUNTIME_ROOT}/artifacts/${schema.artifactRules.artifactFile}\`
222
216
  - \`mandatory delegations\`: ${mandatory}
223
217
  - \`completion helper\`: \`node .cclaw/hooks/stage-complete.mjs ${schema.stage}\`
224
218
  - Fill \`## Learnings\` before closeout: either \`- None this stage.\` or JSON bullets with required keys \`type\`, \`trigger\`, \`action\`, \`confidence\` (knowledge-schema compatible).
225
219
  - Record mandatory delegation completion/waiver in \`${RUNTIME_ROOT}/state/delegation-log.json\` with rationale as needed.
226
220
  - Use the completion helper instead of raw \`flow-state.json\` edits (legacy direct edits trigger workflow-guard warnings or strict-mode blocks).
227
- Apply shared completion logic from:
228
- \`${COMPLETION_PROTOCOL_PATH}\`
221
+ - Completion protocol reference: \`${COMPLETION_PROTOCOL_PATH}\`
229
222
  `;
230
223
  }
231
224
  function quickStartBlock(stage, track) {
232
225
  const schema = stageSchema(stage, track);
233
- const gatePreview = schema.requiredGates.slice(0, 3).map((g) => `\`${g.id}\``).join(", ");
226
+ const gatePreview = schema.executionModel.requiredGates.slice(0, 3).map((g) => `\`${g.id}\``).join(", ");
234
227
  return `## Quick Start
235
228
 
236
- 1. Announce at start: "Using \`${schema.skillName}\` to ${schema.purpose}".
229
+ 1. Announce at start: "Using \`${schema.skillName}\` to ${schema.philosophy.purpose}".
237
230
  2. Obey HARD-GATE and Iron Law.
238
- 3. Execute checklist in order and persist \`${RUNTIME_ROOT}/artifacts/${schema.artifactFile}\`.
239
- 4. Satisfy gates (${gatePreview}${schema.requiredGates.length > 3 ? ` +${schema.requiredGates.length - 3}` : ""}).
231
+ 3. Execute checklist in order and persist \`${RUNTIME_ROOT}/artifacts/${schema.artifactRules.artifactFile}\`.
232
+ 4. Satisfy gates (${gatePreview}${schema.executionModel.requiredGates.length > 3 ? ` +${schema.executionModel.requiredGates.length - 3}` : ""}).
240
233
  `;
241
234
  }
242
235
  /**
@@ -325,21 +318,26 @@ function dedupeGuidance(items, blockedBy) {
325
318
  }
326
319
  export function stageSkillMarkdown(stage, track = "standard") {
327
320
  const schema = stageSchema(stage, track);
328
- const gateList = schema.requiredGates
321
+ const philosophy = schema.philosophy;
322
+ const executionModel = schema.executionModel;
323
+ const artifactRules = schema.artifactRules;
324
+ const reviewLens = schema.reviewLens;
325
+ const mandatoryDelegations = reviewLens.mandatoryDelegations;
326
+ const gateList = executionModel.requiredGates
329
327
  .map((g) => `- \`${g.id}\` — ${g.description}`)
330
328
  .join("\n");
331
- const evidenceList = schema.requiredEvidence
329
+ const evidenceList = executionModel.requiredEvidence
332
330
  .map((e) => `- [ ] ${e}`)
333
331
  .join("\n");
334
- const checklistItems = schema.checklist
332
+ const checklistItems = executionModel.checklist
335
333
  .map((item, i) => `${i + 1}. ${item}`)
336
334
  .join("\n");
337
- const interactionFocus = dedupeGuidance(schema.interactionProtocol, [...schema.checklist, ...schema.process]).slice(0, 5);
338
- const processSummary = dedupeGuidance(schema.process, schema.checklist).slice(0, 5);
339
- const processNote = schema.process.length > processSummary.length
340
- ? `- Follow the Checklist above for remaining execution detail (+${schema.process.length - processSummary.length} condensed step${schema.process.length - processSummary.length === 1 ? "" : "s"}).`
341
- : "";
335
+ const interactionFocus = dedupeGuidance(executionModel.interactionProtocol, [...executionModel.checklist, ...executionModel.process]).slice(0, 5);
336
+ const processSummary = dedupeGuidance(executionModel.process, executionModel.checklist).slice(0, 5);
342
337
  const stageRefs = stageSpecificSeeAlso(stage);
338
+ const mandatoryDelegationSummary = mandatoryDelegations.length > 0
339
+ ? mandatoryDelegations.map((name) => `\`${name}\``).join(", ")
340
+ : "none";
343
341
  return `---
344
342
  name: ${schema.skillName}
345
343
  description: "${schema.skillDescription}"
@@ -349,7 +347,7 @@ description: "${schema.skillDescription}"
349
347
 
350
348
  <EXTREMELY-IMPORTANT>
351
349
 
352
- **IRON LAW — ${stage.toUpperCase()}:** ${schema.ironLaw}
350
+ **IRON LAW — ${stage.toUpperCase()}:** ${philosophy.ironLaw}
353
351
 
354
352
  If you are about to violate the Iron Law, STOP. No amount of urgency, partial progress, or clever reinterpretation overrides it. Escalate via the Decision Protocol or abandon the stage.
355
353
 
@@ -357,28 +355,35 @@ If you are about to violate the Iron Law, STOP. No amount of urgency, partial pr
357
355
 
358
356
  ${quickStartBlock(stage, track)}
359
357
 
360
- ## Overview
361
- ${schema.purpose}
358
+ ## Philosophy
359
+ ${philosophy.purpose}
360
+
361
+ ## Complexity Tier
362
+ - Active tier: \`${schema.complexityTier}\`
363
+ - Mandatory delegations at this tier: ${mandatoryDelegationSummary}
362
364
 
363
365
  ## When to Use
364
- ${schema.whenToUse.map((item) => `- ${item}`).join("\n")}
366
+ ${philosophy.whenToUse.map((item) => `- ${item}`).join("\n")}
367
+
368
+ ${whenNotToUseBlock(philosophy.whenNotToUse)}
369
+ ## HARD-GATE
370
+ ${philosophy.hardGate}
371
+
372
+ ## Anti-Patterns & Red Flags
373
+ ${mergedAntiPatterns(philosophy, executionModel)}
374
+
375
+ ## Process
376
+ ${processSummary.length > 0 ? processSummary.map((item, i) => `${i + 1}. ${item}`).join("\n") : "1. Execute the Checklist in order.\n2. Satisfy every required gate.\n3. Complete verification before stage closeout."}
365
377
 
366
- ${whenNotToUseBlock(stage, track)}
367
378
  ## Inputs
368
- ${schema.inputs.length > 0 ? schema.inputs.map((item) => `- ${item}`).join("\n") : "- (first stage — no required inputs)"}
379
+ ${executionModel.inputs.length > 0 ? executionModel.inputs.map((item) => `- ${item}`).join("\n") : "- (first stage — no required inputs)"}
369
380
 
370
381
  ## Required Context
371
- ${schema.requiredContext.length > 0 ? schema.requiredContext.map((item) => `- ${item}`).join("\n") : "- None beyond this skill"}
382
+ ${executionModel.requiredContext.length > 0 ? executionModel.requiredContext.map((item) => `- ${item}`).join("\n") : "- None beyond this skill"}
372
383
 
373
- ${contextLoadingBlock(stage, track)}
384
+ ${contextLoadingBlock(artifactRules.crossStageTrace)}
374
385
  ${autoSubagentDispatchBlock(stage, track)}
375
- ${researchPlaybooksBlock(stage, track)}
376
-
377
- ## Outputs
378
- ${schema.outputs.map((item) => `- ${item}`).join("\n")}
379
-
380
- ## HARD-GATE
381
- ${schema.hardGate}
386
+ ${researchPlaybooksBlock(executionModel.researchPlaybooks ?? [])}
382
387
 
383
388
  ## Checklist
384
389
 
@@ -386,15 +391,12 @@ You MUST complete these steps in order:
386
391
 
387
392
  ${checklistItems}
388
393
 
389
- ${stageGoodBadExamples(stage)}
390
- ${stageDomainExamples(stage)}
391
394
  ${stageExamples(stage)}
392
395
 
393
396
  ## Interaction Protocol
394
397
  ${interactionFocus.length > 0 ? interactionFocus.map((item, i) => `${i + 1}. ${item}`).join("\n") : "- Keep communication concise and decision-focused; rely on the Checklist for execution order."}
395
398
 
396
- Shared decision/ask-user protocol:
397
- \`${DECISION_PROTOCOL_PATH}\`
399
+ Decision protocol reference: \`${DECISION_PROTOCOL_PATH}\`
398
400
 
399
401
  ${batchExecutionModeBlock(stage, track)}
400
402
  ## Required Gates
@@ -403,22 +405,24 @@ ${gateList}
403
405
  ## Required Evidence
404
406
  ${evidenceList}
405
407
 
406
- ## Process
407
- ${processSummary.length > 0 ? processSummary.map((item, i) => `${i + 1}. ${item}`).join("\n") : "1. Execute the Checklist in order.\n2. Satisfy every required gate.\n3. Complete verification before stage closeout."}
408
- ${processNote.length > 0 ? `\n${processNote}` : ""}
409
-
410
- ${reviewSectionsBlock(stage, track)}
411
408
  ${verificationBlock(stage)}
412
- ${crossStageTraceBlock(stage, track)}
413
- ${artifactValidationBlock(stage, track)}
414
-
415
- ## Anti-Patterns & Red Flags
416
- ${mergedAntiPatterns(schema)}
417
409
 
418
410
  ## Verification
419
- ${schema.exitCriteria.map((item) => `- [ ] ${item}`).join("\n")}
411
+ ${executionModel.exitCriteria.map((item) => `- [ ] ${item}`).join("\n")}
420
412
 
421
413
  ${completionParametersBlock(schema, track)}
414
+ ## Artifact Rules
415
+ - Artifact target: \`${RUNTIME_ROOT}/artifacts/${artifactRules.artifactFile}\`
416
+
417
+ ${crossStageTraceBlock(artifactRules.crossStageTrace)}
418
+ ${artifactValidationBlock(artifactRules.artifactValidation)}
419
+
420
+ ## Review Lens
421
+ ## Outputs
422
+ ${reviewLens.outputs.map((item) => `- ${item}`).join("\n")}
423
+
424
+ ${reviewSectionsBlock(reviewLens.reviewSections)}
425
+
422
426
  ## Shared Stage Guidance
423
427
  See:
424
428
  - \`${STAGE_COMMON_GUIDANCE_REL_PATH}\`
@@ -2,153 +2,163 @@
2
2
  // PLAN
3
3
  // ---------------------------------------------------------------------------
4
4
  export const PLAN = {
5
+ schemaShape: "v2",
5
6
  stage: "plan",
7
+ complexityTier: "standard",
6
8
  skillFolder: "planning-and-task-breakdown",
7
9
  skillName: "planning-and-task-breakdown",
8
10
  skillDescription: "Execution planning stage with strict confirmation gate before implementation.",
9
- hardGate: "Do NOT write code or tests. Planning only. This stage produces a task graph and execution order. WAIT_FOR_CONFIRM before any handoff to implementation.",
10
- ironLaw: "EVERY TASK IS 2–5 MINUTES, FULLY SPELLED OUT, AND CARRIES A STABLE ID NO PLACEHOLDERS, NO ‘ETC.’.",
11
- purpose: "Create small executable tasks with dependencies and pause for explicit user confirmation.",
12
- whenToUse: [
13
- "After spec approval",
14
- "Before writing tests or implementation",
15
- "When delivery path and dependency order are needed"
16
- ],
17
- whenNotToUse: [
18
- "Specification is unapproved or lacks measurable acceptance criteria",
19
- "Execution is already in TDD stage with active slice evidence",
20
- "The request is only release packaging with no task decomposition needed"
21
- ],
22
- checklist: [
23
- "Read upstream — load spec, design, and scope artifacts. Cross-reference acceptance criteria.",
24
- "Build dependency graph identify task ordering, parallel opportunities, and blocking dependencies.",
25
- "Group tasks into dependency batches — batch N+1 cannot start until batch N has verification evidence.",
26
- "Slice into vertical tasks — each task targets 2-5 minutes, produces one testable outcome, and touches one coherent area.",
27
- "Attach verification every task has an acceptance criterion mapping and a concrete verification command.",
28
- "Annotate slice-review metadata if `.cclaw/config.yaml::sliceReview.enabled` is true, every task row additionally carries `touchCount` (rough number of files expected to change) and `touchPaths` (glob hints, e.g. `migrations/**`, `src/auth/**`). A task may set `highRisk: true` to force a review pass regardless of thresholds. These fields feed the TDD stage's Per-Slice Review checkpoint; when `sliceReview` is disabled they are optional.",
29
- "Map scope Locked Decisions — every D-XX from scope is referenced by at least one plan task (or explicitly marked deferred with reason).",
30
- "Run anti-placeholder + anti-scope-reduction scans — block `TODO/TBD/...` and phrasing like `v1`, `for now`, `later` for locked boundaries.",
31
- "Define checkpoints mark points where progress should be validated before continuing.",
32
- "WAIT_FOR_CONFIRM write plan artifact and explicitly pause. **STOP.** Do NOT proceed until user confirms. Then close the stage with `node .cclaw/hooks/stage-complete.mjs plan` and tell user to run `/cc-next`."
33
- ],
34
- interactionProtocol: [
35
- "Plan in read-only mode relative to implementation.",
36
- "Split work into small vertical slices (target 2-5 minute tasks).",
37
- "Publish explicit dependency batches with entry and exit checks for each batch.",
38
- "Attach verification step to every task.",
39
- "Preserve locked scope boundaries: no silent scope reduction language in task rows.",
40
- "Enforce WAIT_FOR_CONFIRM: present the plan summary with options (A) Approve / (B) Revise / (C) Reject.",
41
- "**STOP.** Do NOT proceed until user explicitly approves.",
42
- "**STOP BEFORE ADVANCE.** Mandatory delegation `planner` must be marked completed or explicitly waived in `.cclaw/state/delegation-log.json`. Then close the stage via `node .cclaw/hooks/stage-complete.mjs plan` and tell the user to run `/cc-next`."
43
- ],
44
- process: [
45
- "Build dependency graph and ordered slices.",
46
- "Group slices into execution batches and define gate criteria per batch.",
47
- "Define each task with acceptance mapping and verification commands.",
48
- "Trace every locked decision (D-XX) to plan tasks or explicit defer rationale.",
49
- "Record checkpoints and blockers.",
50
- "Write plan artifact and pause at WAIT_FOR_CONFIRM."
51
- ],
52
- requiredGates: [
53
- { id: "plan_tasks_sliced_2_5_min", description: "Tasks are small, executable slices." },
54
- { id: "plan_dependency_batches_defined", description: "Tasks are grouped into executable batches with gate checks." },
55
- { id: "plan_acceptance_mapped", description: "Each task maps to a spec acceptance criterion." },
56
- { id: "plan_wait_for_confirm", description: "Execution blocked until explicit user confirmation." }
57
- ],
58
- requiredEvidence: [
59
- "Artifact written to `.cclaw/artifacts/05-plan.md`.",
60
- "Task list includes acceptance mapping.",
61
- "Locked decision coverage table present with D-XX trace links.",
62
- "Dependency graph documented.",
63
- "Dependency batches documented with batch-by-batch verification gates.",
64
- "WAIT_FOR_CONFIRM status recorded."
65
- ],
66
- inputs: ["approved spec", "codebase context", "delivery constraints"],
67
- requiredContext: [
68
- "spec acceptance criteria",
69
- "current architecture",
70
- "known technical debt and dependencies"
71
- ],
72
- outputs: ["task graph", "dependency batch plan", "ordered plan", "explicit confirmation checkpoint"],
73
- blockers: [
74
- "tasks too broad",
75
- "dependency uncertainty unresolved",
76
- "batch boundaries are unclear",
77
- "locked decisions from scope are not mapped to tasks",
78
- "no explicit confirmation"
79
- ],
80
- exitCriteria: [
81
- "plan quality gates complete",
82
- "WAIT_FOR_CONFIRM present and unresolved until user approves",
83
- "artifact ready for TDD execution",
84
- "acceptance mapping complete"
85
- ],
86
- commonRationalizations: [
87
- "Horizontal decomposition without end-to-end slices",
88
- "Tasks without verification steps",
89
- "Starting execution before approval",
90
- "Tasks that touch multiple unrelated areas",
91
- "Using placeholder tokens or scope-reduction phrases (`v1`, `for now`, `later`) in task definitions",
92
- "No dependency graph",
93
- "No WAIT_FOR_CONFIRM marker",
94
- "No explicit dependency batches",
95
- "Tasks exceed one coherent outcome",
96
- "No acceptance mapping",
97
- "Locked decisions are missing or not mapped",
98
- "Scope-reduction language appears without explicit approved defer decision"
99
- ],
100
- artifactFile: "05-plan.md",
101
- next: "tdd",
102
- reviewSections: [
103
- {
104
- title: "Task Decomposition Audit",
105
- evaluationPoints: [
106
- "Does every task target a single coherent area (vertical slice)?",
107
- "Can each task be completed in 2-5 minutes?",
108
- "Does every task have an acceptance criterion link and verification command?",
109
- "Are there tasks that touch multiple unrelated areas?",
110
- "Would a new engineer understand and start each task within two minutes?"
111
- ],
112
- stopGate: true
113
- },
114
- {
115
- title: "Batch Completeness Audit",
116
- evaluationPoints: [
117
- "Does every task belong to exactly one batch?",
118
- "Does each batch have a verification gate?",
119
- "Are batch dependencies explicit and acyclic?",
120
- "Is the acceptance mapping complete — every spec criterion covered?",
121
- "Are there hidden dependencies between tasks in different batches?"
122
- ],
123
- stopGate: true
11
+ philosophy: {
12
+ hardGate: "Do NOT write code or tests. Planning only. This stage produces a task graph and execution order. WAIT_FOR_CONFIRM before any handoff to implementation.",
13
+ ironLaw: "EVERY TASK IS 2–5 MINUTES, FULLY SPELLED OUT, AND CARRIES A STABLE ID — NO PLACEHOLDERS, NO ‘ETC.’.",
14
+ purpose: "Create small executable tasks with dependencies and pause for explicit user confirmation.",
15
+ whenToUse: [
16
+ "After spec approval",
17
+ "Before writing tests or implementation",
18
+ "When delivery path and dependency order are needed"
19
+ ],
20
+ whenNotToUse: [
21
+ "Specification is unapproved or lacks measurable acceptance criteria",
22
+ "Execution is already in TDD stage with active slice evidence",
23
+ "The request is only release packaging with no task decomposition needed"
24
+ ],
25
+ commonRationalizations: [
26
+ "Horizontal decomposition without end-to-end slices",
27
+ "Tasks without verification steps",
28
+ "Starting execution before approval",
29
+ "Tasks that touch multiple unrelated areas",
30
+ "Using placeholder tokens or scope-reduction phrases (`v1`, `for now`, `later`) in task definitions",
31
+ "No dependency graph",
32
+ "No WAIT_FOR_CONFIRM marker",
33
+ "No explicit dependency batches",
34
+ "Tasks exceed one coherent outcome",
35
+ "No acceptance mapping",
36
+ "Locked decisions are missing or not mapped",
37
+ "Scope-reduction language appears without explicit approved defer decision"
38
+ ]
39
+ },
40
+ executionModel: {
41
+ checklist: [
42
+ "Read upstream load spec, design, and scope artifacts. Cross-reference acceptance criteria.",
43
+ "Build dependency graph identify task ordering, parallel opportunities, and blocking dependencies.",
44
+ "Group tasks into dependency batches batch N+1 cannot start until batch N has verification evidence.",
45
+ "Slice into vertical tasks — each task targets 2-5 minutes, produces one testable outcome, and touches one coherent area.",
46
+ "Attach verification — every task has an acceptance criterion mapping and a concrete verification command.",
47
+ "Annotate slice-review metadata — if `.cclaw/config.yaml::sliceReview.enabled` is true, every task row additionally carries `touchCount` (rough number of files expected to change) and `touchPaths` (glob hints, e.g. `migrations/**`, `src/auth/**`). A task may set `highRisk: true` to force a review pass regardless of thresholds. These fields feed the TDD stage's Per-Slice Review checkpoint; when `sliceReview` is disabled they are optional.",
48
+ "Map scope Locked Decisions every D-XX from scope is referenced by at least one plan task (or explicitly marked deferred with reason).",
49
+ "Run anti-placeholder + anti-scope-reduction scans block `TODO/TBD/...` and phrasing like `v1`, `for now`, `later` for locked boundaries.",
50
+ "Define checkpoints mark points where progress should be validated before continuing.",
51
+ "WAIT_FOR_CONFIRM write plan artifact and explicitly pause. **STOP.** Do NOT proceed until user confirms. Then close the stage with `node .cclaw/hooks/stage-complete.mjs plan` and tell user to run `/cc-next`."
52
+ ],
53
+ interactionProtocol: [
54
+ "Plan in read-only mode relative to implementation.",
55
+ "Split work into small vertical slices (target 2-5 minute tasks).",
56
+ "Publish explicit dependency batches with entry and exit checks for each batch.",
57
+ "Attach verification step to every task.",
58
+ "Preserve locked scope boundaries: no silent scope reduction language in task rows.",
59
+ "Enforce WAIT_FOR_CONFIRM: present the plan summary with options (A) Approve / (B) Revise / (C) Reject.",
60
+ "**STOP.** Do NOT proceed until user explicitly approves.",
61
+ "**STOP BEFORE ADVANCE.** Mandatory delegation `planner` must be marked completed or explicitly waived in `.cclaw/state/delegation-log.json`. Then close the stage via `node .cclaw/hooks/stage-complete.mjs plan` and tell the user to run `/cc-next`."
62
+ ],
63
+ process: [
64
+ "Build dependency graph and ordered slices.",
65
+ "Group slices into execution batches and define gate criteria per batch.",
66
+ "Define each task with acceptance mapping and verification commands.",
67
+ "Trace every locked decision (D-XX) to plan tasks or explicit defer rationale.",
68
+ "Record checkpoints and blockers.",
69
+ "Write plan artifact and pause at WAIT_FOR_CONFIRM."
70
+ ],
71
+ requiredGates: [
72
+ { id: "plan_tasks_sliced_2_5_min", description: "Tasks are small, executable slices." },
73
+ { id: "plan_dependency_batches_defined", description: "Tasks are grouped into executable batches with gate checks." },
74
+ { id: "plan_acceptance_mapped", description: "Each task maps to a spec acceptance criterion." },
75
+ { id: "plan_wait_for_confirm", description: "Execution blocked until explicit user confirmation." }
76
+ ],
77
+ requiredEvidence: [
78
+ "Artifact written to `.cclaw/artifacts/05-plan.md`.",
79
+ "Task list includes acceptance mapping.",
80
+ "Locked decision coverage table present with D-XX trace links.",
81
+ "Dependency graph documented.",
82
+ "Dependency batches documented with batch-by-batch verification gates.",
83
+ "WAIT_FOR_CONFIRM status recorded."
84
+ ],
85
+ inputs: ["approved spec", "codebase context", "delivery constraints"],
86
+ requiredContext: [
87
+ "spec acceptance criteria",
88
+ "current architecture",
89
+ "known technical debt and dependencies"
90
+ ],
91
+ blockers: [
92
+ "tasks too broad",
93
+ "dependency uncertainty unresolved",
94
+ "batch boundaries are unclear",
95
+ "locked decisions from scope are not mapped to tasks",
96
+ "no explicit confirmation"
97
+ ],
98
+ exitCriteria: [
99
+ "plan quality gates complete",
100
+ "WAIT_FOR_CONFIRM present and unresolved until user approves",
101
+ "artifact ready for TDD execution",
102
+ "acceptance mapping complete"
103
+ ]
104
+ },
105
+ artifactRules: {
106
+ artifactFile: "05-plan.md",
107
+ completionStatus: ["DONE", "DONE_WITH_CONCERNS", "BLOCKED"],
108
+ crossStageTrace: {
109
+ readsFrom: [".cclaw/artifacts/04-spec.md", ".cclaw/artifacts/03-design-<slug>.md", ".cclaw/artifacts/02-scope-<slug>.md"],
110
+ writesTo: [".cclaw/artifacts/05-plan.md"],
111
+ traceabilityRule: "Every task must trace to a spec acceptance criterion. Every locked scope decision (D-XX) must trace to at least one plan task or explicit defer rationale. Every downstream RED test must trace to a plan task."
124
112
  },
125
- {
126
- title: "Five-Minute Budget + No-Placeholders Audit",
127
- evaluationPoints: [
128
- "Does every task carry an explicit minutes estimate (e.g. `[~3m]`) and does every estimate fit the 2-to-5-minute budget? Estimates >5 minutes must be split.",
129
- "Are all file paths, test commands, and verification commands copy-pasteable as written no `TODO`, `TBD`, `FIXME`, `<fill-in>`, `<your-*-here>`, `xxx`, or ellipsis standing in for omitted args?",
130
- "Does every acceptance-criterion reference resolve to a real R# / AC-### in the spec (not a blank link)?",
131
- "If an estimate is genuinely uncertain (first-time integration, unfamiliar library), is the uncertainty named explicitly and scheduled as a spike task in batch 0, rather than hidden behind a large estimate?"
132
- ],
133
- stopGate: true
134
- }
135
- ],
136
- completionStatus: ["DONE", "DONE_WITH_CONCERNS", "BLOCKED"],
137
- crossStageTrace: {
138
- readsFrom: [".cclaw/artifacts/04-spec.md", ".cclaw/artifacts/03-design-<slug>.md", ".cclaw/artifacts/02-scope-<slug>.md"],
139
- writesTo: [".cclaw/artifacts/05-plan.md"],
140
- traceabilityRule: "Every task must trace to a spec acceptance criterion. Every locked scope decision (D-XX) must trace to at least one plan task or explicit defer rationale. Every downstream RED test must trace to a plan task."
113
+ artifactValidation: [
114
+ { section: "Dependency Graph", required: false, validationRule: "Ordering and parallel opportunities explicit. No circular dependencies." },
115
+ { section: "Dependency Batches", required: true, validationRule: "Every task belongs to a batch. Each batch has an exit gate and dependency statement." },
116
+ { section: "Task List", required: true, validationRule: "Each task row includes ID, description, acceptance criterion, verification command, and effort estimate (S/M/L). Every task must also carry a minutes estimate within the 2-5 minute budget. When the sliceReview feature is enabled in the cclaw config, each task row additionally declares touchCount, touchPaths, and an optional highRisk flag so the TDD stage can decide whether a Per-Slice Review pass is required." },
117
+ { section: "Acceptance Mapping", required: true, validationRule: "Every spec criterion is covered by at least one task." },
118
+ { section: "Locked Decision Coverage", required: false, validationRule: "Every locked decision ID (D-XX) from scope is listed with linked task IDs or explicit defer rationale." },
119
+ { section: "Risk Assessment", required: false, validationRule: "If present: per-task or per-batch risk identification with likelihood, impact, and mitigation strategy." },
120
+ { section: "Boundary Map", required: false, validationRule: "If present: per-batch or per-task interface contracts listing what each task produces (exports) and consumes (imports) from other tasks." },
121
+ { section: "WAIT_FOR_CONFIRM", required: true, validationRule: "Explicit marker present. Status: pending until user approves." },
122
+ { section: "No-Placeholder Scan", required: false, validationRule: "Confirmation that a text scan for `TODO`, `TBD`, `FIXME`, `<fill-in>`, `<your-*-here>`, `xxx`, or bare ellipses has zero hits in the task list. A placeholder is a deferred decision masquerading as a plan." },
123
+ { section: "No Scope Reduction Language Scan", required: false, validationRule: "Confirmation that scope-reduction phrases (`v1`, `for now`, `later`, `temporary`, `placeholder`) are absent from task rows when locked decisions exist." }
124
+ ]
125
+ },
126
+ reviewLens: {
127
+ outputs: ["task graph", "dependency batch plan", "ordered plan", "explicit confirmation checkpoint"],
128
+ reviewSections: [
129
+ {
130
+ title: "Task Decomposition Audit",
131
+ evaluationPoints: [
132
+ "Does every task target a single coherent area (vertical slice)?",
133
+ "Can each task be completed in 2-5 minutes?",
134
+ "Does every task have an acceptance criterion link and verification command?",
135
+ "Are there tasks that touch multiple unrelated areas?",
136
+ "Would a new engineer understand and start each task within two minutes?"
137
+ ],
138
+ stopGate: true
139
+ },
140
+ {
141
+ title: "Batch Completeness Audit",
142
+ evaluationPoints: [
143
+ "Does every task belong to exactly one batch?",
144
+ "Does each batch have a verification gate?",
145
+ "Are batch dependencies explicit and acyclic?",
146
+ "Is the acceptance mapping complete — every spec criterion covered?",
147
+ "Are there hidden dependencies between tasks in different batches?"
148
+ ],
149
+ stopGate: true
150
+ },
151
+ {
152
+ title: "Five-Minute Budget + No-Placeholders Audit",
153
+ evaluationPoints: [
154
+ "Does every task carry an explicit minutes estimate (e.g. `[~3m]`) and does every estimate fit the 2-to-5-minute budget? Estimates >5 minutes must be split.",
155
+ "Are all file paths, test commands, and verification commands copy-pasteable as written — no `TODO`, `TBD`, `FIXME`, `<fill-in>`, `<your-*-here>`, `xxx`, or ellipsis standing in for omitted args?",
156
+ "Does every acceptance-criterion reference resolve to a real R# / AC-### in the spec (not a blank link)?",
157
+ "If an estimate is genuinely uncertain (first-time integration, unfamiliar library), is the uncertainty named explicitly and scheduled as a spike task in batch 0, rather than hidden behind a large estimate?"
158
+ ],
159
+ stopGate: true
160
+ }
161
+ ]
141
162
  },
142
- artifactValidation: [
143
- { section: "Dependency Graph", required: false, validationRule: "Ordering and parallel opportunities explicit. No circular dependencies." },
144
- { section: "Dependency Batches", required: true, validationRule: "Every task belongs to a batch. Each batch has an exit gate and dependency statement." },
145
- { section: "Task List", required: true, validationRule: "Each task row includes ID, description, acceptance criterion, verification command, and effort estimate (S/M/L). Every task must also carry a minutes estimate within the 2-5 minute budget. When the sliceReview feature is enabled in the cclaw config, each task row additionally declares touchCount, touchPaths, and an optional highRisk flag so the TDD stage can decide whether a Per-Slice Review pass is required." },
146
- { section: "Acceptance Mapping", required: true, validationRule: "Every spec criterion is covered by at least one task." },
147
- { section: "Locked Decision Coverage", required: false, validationRule: "Every locked decision ID (D-XX) from scope is listed with linked task IDs or explicit defer rationale." },
148
- { section: "Risk Assessment", required: false, validationRule: "If present: per-task or per-batch risk identification with likelihood, impact, and mitigation strategy." },
149
- { section: "Boundary Map", required: false, validationRule: "If present: per-batch or per-task interface contracts listing what each task produces (exports) and consumes (imports) from other tasks." },
150
- { section: "WAIT_FOR_CONFIRM", required: true, validationRule: "Explicit marker present. Status: pending until user approves." },
151
- { section: "No-Placeholder Scan", required: false, validationRule: "Confirmation that a text scan for `TODO`, `TBD`, `FIXME`, `<fill-in>`, `<your-*-here>`, `xxx`, or bare ellipses has zero hits in the task list. A placeholder is a deferred decision masquerading as a plan." },
152
- { section: "No Scope Reduction Language Scan", required: false, validationRule: "Confirmation that scope-reduction phrases (`v1`, `for now`, `later`, `temporary`, `placeholder`) are absent from task rows when locked decisions exist." }
153
- ]
163
+ next: "tdd",
154
164
  };