cclaw-cli 0.51.24 → 0.51.26

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 (45) hide show
  1. package/README.md +135 -414
  2. package/dist/artifact-linter.js +10 -6
  3. package/dist/config.d.ts +1 -1
  4. package/dist/config.js +28 -3
  5. package/dist/content/core-agents.d.ts +110 -0
  6. package/dist/content/core-agents.js +255 -3
  7. package/dist/content/examples.js +8 -5
  8. package/dist/content/harness-doc.d.ts +1 -0
  9. package/dist/content/harness-doc.js +3 -0
  10. package/dist/content/hooks.d.ts +1 -0
  11. package/dist/content/hooks.js +189 -0
  12. package/dist/content/next-command.js +10 -6
  13. package/dist/content/reference-patterns.d.ts +18 -0
  14. package/dist/content/reference-patterns.js +391 -0
  15. package/dist/content/skills.js +42 -36
  16. package/dist/content/stage-common-guidance.js +19 -3
  17. package/dist/content/stage-schema.d.ts +12 -0
  18. package/dist/content/stage-schema.js +184 -28
  19. package/dist/content/stages/_lint-metadata/index.js +3 -2
  20. package/dist/content/stages/brainstorm.js +7 -3
  21. package/dist/content/stages/design.js +12 -3
  22. package/dist/content/stages/review.js +7 -5
  23. package/dist/content/stages/schema-types.d.ts +9 -2
  24. package/dist/content/stages/scope.js +8 -2
  25. package/dist/content/stages/ship.js +3 -2
  26. package/dist/content/stages/tdd.js +18 -13
  27. package/dist/content/start-command.js +3 -2
  28. package/dist/content/status-command.js +17 -6
  29. package/dist/content/subagents.js +286 -40
  30. package/dist/content/templates.js +64 -3
  31. package/dist/content/tree-command.js +7 -1
  32. package/dist/delegation.d.ts +34 -1
  33. package/dist/delegation.js +168 -8
  34. package/dist/doctor-registry.js +9 -0
  35. package/dist/doctor.js +121 -6
  36. package/dist/gate-evidence.js +25 -2
  37. package/dist/harness-adapters.d.ts +6 -0
  38. package/dist/harness-adapters.js +28 -4
  39. package/dist/install.js +5 -10
  40. package/dist/internal/advance-stage.js +179 -26
  41. package/dist/run-persistence.js +21 -3
  42. package/dist/tdd-verification-evidence.d.ts +17 -0
  43. package/dist/tdd-verification-evidence.js +43 -0
  44. package/dist/types.d.ts +10 -0
  45. package/package.json +1 -1
@@ -81,6 +81,66 @@ function dedupeAgentsInOrder(agents) {
81
81
  }
82
82
  return out;
83
83
  }
84
+ function defaultReturnSchemaForAgent(agent) {
85
+ switch (agent) {
86
+ case "researcher":
87
+ return "research-return";
88
+ case "architect":
89
+ return "architecture-return";
90
+ case "spec-validator":
91
+ return "spec-validation-return";
92
+ case "slice-implementer":
93
+ 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
+ case "release-reviewer":
101
+ return "release-return";
102
+ case "planner":
103
+ return "planning-return";
104
+ case "product-manager":
105
+ return "product-return";
106
+ case "critic":
107
+ return "critic-return";
108
+ case "reviewer":
109
+ return "review-return";
110
+ case "security-reviewer":
111
+ return "security-return";
112
+ case "test-author":
113
+ return "tdd-return";
114
+ case "doc-updater":
115
+ return "docs-return";
116
+ case "fixer":
117
+ return "fixer-return";
118
+ case "implementer":
119
+ return "worker-return";
120
+ }
121
+ }
122
+ function dispatchClassForRow(row) {
123
+ if (row.dispatchClass)
124
+ return row.dispatchClass;
125
+ if (row.agent === "implementer" || row.agent === "fixer" || row.agent === "slice-implementer")
126
+ return "worker";
127
+ return row.skill?.includes("review") || row.agent === "reviewer" || row.agent === "security-reviewer" || row.agent.endsWith("-reviewer")
128
+ ? "review-lens"
129
+ : "stage-specialist";
130
+ }
131
+ function delegationDispatchRule(row) {
132
+ return {
133
+ agent: row.agent,
134
+ mode: row.mode,
135
+ when: row.when,
136
+ purpose: row.purpose,
137
+ requiresUserGate: row.requiresUserGate,
138
+ requiredAtTier: row.requiredAtTier,
139
+ dispatchClass: dispatchClassForRow(row),
140
+ returnSchema: row.returnSchema ?? defaultReturnSchemaForAgent(row.agent),
141
+ skill: row.skill
142
+ };
143
+ }
84
144
  /**
85
145
  * Canonical delegation summary derived from STAGE_AUTO_SUBAGENT_DISPATCH.
86
146
  *
@@ -106,6 +166,7 @@ export function stageDelegationSummary(complexityTier = "standard") {
106
166
  mandatoryAgents,
107
167
  proactiveAgents,
108
168
  primaryAgents,
169
+ dispatchRules: eligibleRows.map(delegationDispatchRule),
109
170
  stackAwareRoutes: stackAwareRoutesForStage(stage)
110
171
  };
111
172
  });
@@ -361,23 +422,25 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
361
422
  brainstorm: [
362
423
  {
363
424
  agent: "product-manager",
364
- mode: "proactive",
365
- when: "When product value, persona/JTBD, success metric, or why-now framing is ambiguous.",
425
+ mode: "mandatory",
426
+ requiredAtTier: "standard",
427
+ when: "Always for standard/deep brainstorm to validate value, persona/JTBD, success metric, and why-now framing.",
366
428
  purpose: "Pressure-test problem/value fit and produce product-discovery evidence for the Problem Decision Record.",
367
429
  requiresUserGate: false
368
430
  },
369
431
  {
370
432
  agent: "critic",
371
- mode: "proactive",
372
- when: "When the premise may be wrong, cheaper alternatives exist, or the do-nothing path could be acceptable.",
433
+ mode: "mandatory",
434
+ requiredAtTier: "standard",
435
+ when: "Always for standard/deep brainstorm to challenge the premise, do-nothing path, and higher-upside alternatives.",
373
436
  purpose: "Attack assumptions and surface non-goals before direction approval.",
374
437
  requiresUserGate: false
375
438
  },
376
439
  {
377
- agent: "planner",
440
+ agent: "researcher",
378
441
  mode: "proactive",
379
- when: "When request is ambiguous, multi-surface, or staged feasibility is unclear.",
380
- purpose: "Map scope and alternatives before direction lock.",
442
+ when: "When repository, market, docs, or prior-art context changes the approach set.",
443
+ purpose: "Provide search-before-read summaries and context-readiness evidence before large reads or decisions.",
381
444
  requiresUserGate: false
382
445
  }
383
446
  ],
@@ -392,11 +455,19 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
392
455
  },
393
456
  {
394
457
  agent: "critic",
395
- mode: "proactive",
396
- when: "When selecting SELECTIVE EXPANSION, SCOPE EXPANSION, or SCOPE REDUCTION, or when boundaries feel soft.",
458
+ mode: "mandatory",
459
+ requiredAtTier: "standard",
460
+ when: "Always during scope shaping for standard/deep work.",
397
461
  purpose: "Test whether the selected scope mode is too timid, too broad, or hiding a smaller useful slice.",
398
462
  requiresUserGate: false
399
463
  },
464
+ {
465
+ agent: "researcher",
466
+ mode: "proactive",
467
+ when: "When churn, prior attempts, reference patterns, or external constraints may change scope boundaries.",
468
+ purpose: "Summarize search/context findings before the scope contract locks accepted/rejected/deferred ideas.",
469
+ requiresUserGate: false
470
+ },
400
471
  {
401
472
  agent: "product-manager",
402
473
  mode: "proactive",
@@ -407,13 +478,21 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
407
478
  ],
408
479
  design: [
409
480
  {
410
- agent: "planner",
481
+ agent: "architect",
411
482
  mode: "mandatory",
412
483
  requiredAtTier: "standard",
413
484
  when: "Always during design lock.",
414
485
  purpose: "Stress architecture boundaries, dependency graph, critical path, and spec handoff.",
415
486
  requiresUserGate: false
416
487
  },
488
+ {
489
+ agent: "test-author",
490
+ mode: "mandatory",
491
+ requiredAtTier: "standard",
492
+ when: "Always during design lock.",
493
+ purpose: "Check test diagram mapping, RED expressibility, assertion quality, and verification routes before implementation.",
494
+ requiresUserGate: false
495
+ },
417
496
  {
418
497
  agent: "critic",
419
498
  mode: "proactive",
@@ -421,6 +500,13 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
421
500
  purpose: "Produce a shadow alternative, switch trigger, and cheaper-path challenge for the engineering lock.",
422
501
  requiresUserGate: false
423
502
  },
503
+ {
504
+ agent: "researcher",
505
+ mode: "proactive",
506
+ when: "When framework/library docs, repo graph context, or reference contracts may change the design.",
507
+ purpose: "Run search-before-read context synthesis before architecture locks.",
508
+ requiresUserGate: false
509
+ },
424
510
  {
425
511
  agent: "security-reviewer",
426
512
  mode: "proactive",
@@ -429,26 +515,36 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
429
515
  requiresUserGate: false
430
516
  },
431
517
  {
432
- agent: "test-author",
518
+ agent: "compatibility-reviewer",
519
+ 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
524
+ },
525
+ {
526
+ agent: "observability-reviewer",
433
527
  mode: "proactive",
434
- when: "When testability, failure/rescue behavior, or verification evidence is unclear.",
435
- purpose: "Check that the design can produce concrete RED/GREEN/REFACTOR and rollout verification evidence.",
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.",
436
531
  requiresUserGate: false
437
532
  }
438
533
  ],
439
534
  spec: [
440
535
  {
441
- agent: "planner",
442
- mode: "proactive",
443
- when: "When acceptance criteria are unclear or constraints conflict.",
444
- purpose: "Normalize measurable criteria and testability mapping.",
536
+ agent: "spec-validator",
537
+ mode: "mandatory",
538
+ requiredAtTier: "standard",
539
+ when: "Always for standard/deep specs before plan handoff.",
540
+ purpose: "Validate measurability, edge cases, assumptions, and AC-to-testability mapping.",
445
541
  requiresUserGate: false
446
542
  },
447
543
  {
448
- agent: "reviewer",
544
+ agent: "test-author",
449
545
  mode: "proactive",
450
- when: "When acceptance criteria and edge cases are drafted and need independent validation before plan stage.",
451
- purpose: "Independent review of spec against measurability, testability, and completeness before locking the contract for plan.",
546
+ when: "When acceptance criteria need testability review or RED expressibility is uncertain.",
547
+ purpose: "Confirm likely test levels, commands/manual evidence, and assertion surfaces are concrete.",
452
548
  requiresUserGate: false
453
549
  }
454
550
  ],
@@ -458,7 +554,14 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
458
554
  mode: "mandatory",
459
555
  requiredAtTier: "standard",
460
556
  when: "Always when producing execution slices.",
461
- purpose: "Create dependency-aware task graph with verification steps.",
557
+ purpose: "Create dependency-aware executable packets with expected failing test, passing command, stop condition, and verification evidence.",
558
+ requiresUserGate: false
559
+ },
560
+ {
561
+ agent: "researcher",
562
+ mode: "proactive",
563
+ when: "When plan tasks touch unfamiliar areas or reference-pattern adoption needs source verification.",
564
+ purpose: "Confirm context/search evidence before plan packets rely on discovered patterns.",
462
565
  requiresUserGate: false
463
566
  }
464
567
  ],
@@ -468,10 +571,25 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
468
571
  mode: "mandatory",
469
572
  requiredAtTier: "lightweight",
470
573
  when: "Always during the TDD cycle.",
471
- purpose: "Own phase-specific RED/GREEN/REFACTOR evidence for each slice: failing tests before production writes, minimal GREEN implementation, then behavior-preserving refactor notes.",
574
+ purpose: "Own RED quality and per-slice RED/GREEN/REFACTOR evidence: failing tests before production writes, minimal GREEN implementation, then behavior-preserving refactor notes.",
472
575
  requiresUserGate: false,
473
576
  skill: "tdd-cycle-evidence"
474
577
  },
578
+ {
579
+ agent: "slice-implementer",
580
+ mode: "proactive",
581
+ requiredAtTier: "lightweight",
582
+ when: "When a bounded GREEN/REFACTOR slice has non-overlapping file ownership and a clear RED failure.",
583
+ purpose: "Implement the minimal passing slice inside explicit file boundaries and return strict worker evidence.",
584
+ requiresUserGate: false
585
+ },
586
+ {
587
+ agent: "reviewer",
588
+ mode: "proactive",
589
+ when: "When per-slice review triggers fire or assertion quality needs an independent read-only overseer.",
590
+ purpose: "Read-only overseer pass for slice spec fit, assertion quality, and simpler alternatives.",
591
+ requiresUserGate: false
592
+ },
475
593
  {
476
594
  agent: "doc-updater",
477
595
  mode: "proactive",
@@ -486,7 +604,7 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
486
604
  mode: "mandatory",
487
605
  requiredAtTier: "lightweight",
488
606
  when: "Always in review stage.",
489
- purpose: "Layer 1 spec compliance plus integrated Layer 2 review across correctness, performance, architecture, and external-safety tags with source-tagged findings.",
607
+ purpose: "Layer 1 spec compliance plus integrated Layer 2 review across correctness, architecture, and external-safety tags with source-tagged findings.",
490
608
  requiresUserGate: false,
491
609
  skill: "review-spec-pass"
492
610
  },
@@ -494,11 +612,35 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
494
612
  agent: "security-reviewer",
495
613
  mode: "mandatory",
496
614
  requiredAtTier: "lightweight",
497
- when: "Always in review stage. Even when no trust boundaries changed, produce an explicit 'no-change' security attestation.",
498
- purpose: "Guarantee a dedicated security pass on every diff: auth, input validation, secrets, injection, privilege, and blast-radius review are never opt-in. MUST load the `security-audit` skill and run a pattern-based sweep across the diff scope and touched modules in addition to the per-diff Layer 2 security checklist.",
615
+ when: "Always in review stage. Even when no trust boundaries changed, produce an explicit no-change/no-impact security attestation.",
616
+ purpose: "Guarantee a dedicated security pass on every diff: auth, input validation, secrets, injection, privilege, and blast-radius review are never opt-in.",
499
617
  requiresUserGate: false,
500
618
  skill: "security-audit"
501
619
  },
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
+ },
502
644
  {
503
645
  agent: "reviewer",
504
646
  mode: "proactive",
@@ -511,7 +653,7 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
511
653
  agent: "reviewer",
512
654
  mode: "proactive",
513
655
  when: "When external reviewer comments, bot findings, or CI annotations are present after the initial review pass.",
514
- purpose: "Run the receiving-code-review workflow so every incoming feedback item gets an explicit disposition with evidence, and the queue is mirrored into review artifacts.",
656
+ purpose: "Run the receiving-code-review workflow so every incoming feedback item gets an explicit disposition with evidence.",
515
657
  requiresUserGate: false,
516
658
  skill: "receiving-code-review"
517
659
  },
@@ -526,10 +668,17 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
526
668
  ],
527
669
  ship: [
528
670
  {
529
- agent: "doc-updater",
671
+ agent: "release-reviewer",
530
672
  mode: "mandatory",
531
673
  requiredAtTier: "lightweight",
532
674
  when: "Always in ship stage.",
675
+ purpose: "Run release readiness, finalization mode, rollback, evidence freshness, and victory-detector checks before archive/ship.",
676
+ requiresUserGate: false
677
+ },
678
+ {
679
+ agent: "doc-updater",
680
+ mode: "proactive",
681
+ when: "When release notes, migrations, public behavior, CLI/config, or docs changed.",
533
682
  purpose: "Ensure release notes and docs reflect actual shipped behavior.",
534
683
  requiresUserGate: false
535
684
  },
@@ -661,5 +810,12 @@ export function stageTrackRenderContext(track = "standard") {
661
810
  return trackRenderContext(track);
662
811
  }
663
812
  export function stageAutoSubagentDispatch(stage) {
664
- return STAGE_AUTO_SUBAGENT_DISPATCH[stage];
813
+ return STAGE_AUTO_SUBAGENT_DISPATCH[stage].map((row) => {
814
+ const normalized = delegationDispatchRule(row);
815
+ return {
816
+ ...row,
817
+ dispatchClass: normalized.dispatchClass,
818
+ returnSchema: normalized.returnSchema
819
+ };
820
+ });
665
821
  }
@@ -1,5 +1,6 @@
1
1
  import { SHIP_FINALIZATION_MODES } from "../../../constants.js";
2
2
  import { renderTrackTerminology, trackRenderContext } from "../../track-render-context.js";
3
+ import { referencePatternPolicyNeedles } from "../../reference-patterns.js";
3
4
  const STAGE_POLICY_NEEDLES = {
4
5
  brainstorm: [
5
6
  "Explore project context",
@@ -64,10 +65,10 @@ const STAGE_POLICY_NEEDLES = {
64
65
  ]
65
66
  };
66
67
  export function stagePolicyNeedlesFromMetadata(stage, track = "standard") {
67
- const needles = STAGE_POLICY_NEEDLES[stage];
68
+ const needles = [...STAGE_POLICY_NEEDLES[stage], ...referencePatternPolicyNeedles(stage)];
68
69
  const renderContext = trackRenderContext(track);
69
70
  if (stage === "tdd" && !renderContext.usesPlanTerminology) {
70
71
  return needles.map((needle) => renderTrackTerminology(needle, renderContext));
71
72
  }
72
- return [...needles];
73
+ return needles;
73
74
  }
@@ -41,11 +41,12 @@ export const BRAINSTORM = {
41
41
  "**Write the Problem Decision Record** — product work captures persona/JTBD/pain/value/evidence/success/why-now/do-nothing/non-goals; technical-maintenance work captures affected operator/developer, failure mode, operational improvement, verification signal, do-nothing cost, and non-goals.",
42
42
  "**Premise check (one pass)** — answer the three gstack-style questions in the artifact body: *Right problem? Direct path? What if we do nothing?* Take a position; do not hedge.",
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
+ "**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.",
44
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.",
45
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
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.",
47
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.",
48
- "**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 and reuse notes; include exactly one challenger with explicit `high` or `higher` upside.",
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.",
49
50
  "**Collect reaction before recommending** — ask which option feels closest and what concern remains, then recommend based on that reaction.",
50
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.",
51
52
  "**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.",
@@ -81,8 +82,9 @@ export const BRAINSTORM = {
81
82
  "Artifact written to `.cclaw/artifacts/01-brainstorm-<slug>.md`.",
82
83
  "Project context was explored (files, docs, or recent activity referenced).",
83
84
  "Problem Decision Record includes product framing or technical-maintenance framing.",
85
+ "Clarity Gate records ambiguity score, decision boundaries, reaffirmed non-goals, and residual-risk handoff.",
84
86
  "Clarifying questions are one-at-a-time and captured only when they change a decision or stop condition.",
85
- "2-3 approaches with trade-offs are recorded, including one higher-upside challenger option.",
87
+ "2-3 approaches with trade-offs are recorded, including one higher-upside challenger option and reference-pattern source/disposition when applicable.",
86
88
  "User reaction to approaches is captured before final recommendation.",
87
89
  "Final recommendation explicitly reflects user reaction.",
88
90
  "Selected Direction includes the handoff to the track-aware next stage: scope on standard, spec on medium when scope/design are skipped.",
@@ -131,11 +133,13 @@ export const BRAINSTORM = {
131
133
  { section: "Problem Decision Record", required: true, validationRule: "Must include either product framing fields (persona/JTBD/pain/value/evidence/success/why-now/do-nothing/non-goals) or technical-maintenance fields (operator/developer, failure mode, operational improvement, verification signal, do-nothing cost, non-goals)." },
132
134
  { section: "Premise Check", required: false, validationRule: "Recommended: explicit answers to `Right problem?`, `Direct path?`, `What if we do nothing?` — take a position, do not hedge." },
133
135
  { section: "How Might We", required: false, validationRule: "Recommended: a single `How Might We …?` line naming the user, the outcome, and the binding constraint." },
136
+ { section: "Clarity Gate", required: false, validationRule: "Recommended before recommendation lock: include ambiguity score (0.00-1.00), decision boundaries, reaffirmed non-goals, and residual-risk handoff for scope." },
134
137
  { section: "Sharpening Questions", required: false, validationRule: "Recommended only when needed: one decision-changing question per turn with explicit `Decision impact`; compact tasks may record `None - early exit` with rationale." },
135
138
  { section: "Clarifying Questions", required: false, validationRule: "Must capture question, answer, and decision impact for each clarifying question." },
136
139
  { section: "Approach Tier", required: true, validationRule: "Must classify depth as lite/standard/deep and explain the risk/uncertainty signal." },
137
140
  { section: "Short-Circuit Decision", required: false, validationRule: "Must include Status/Why/Scope handoff lines when short-circuit is discussed; compact stubs are valid for concrete asks." },
138
- { 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." },
141
+ { 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
+ { 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." },
139
143
  { 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." },
140
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." },
141
145
  { 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." },
@@ -45,9 +45,10 @@ export const DESIGN = {
45
45
  "Tiered Research — for simple/medium work, do compact inline codebase/research synthesis in `Research Fleet Synthesis`; write `.cclaw/artifacts/02a-research.md` and run the full fleet only for deep/high-risk work or when external framework/architecture uncertainty exists.",
46
46
  "Design Doc Check — read upstream artifacts and current design docs; latest superseding doc wins.",
47
47
  "Investigator pass — before design decisions, read blast-radius code and record touched files, responsibilities, reuse candidates, and existing patterns.",
48
- "Scope Challenge + Search Before Building — find existing solutions, minimum change set, and complexity smells before custom architecture.",
48
+ "Scope Challenge + Search Before Building — find existing solutions, minimum change set, reference-grade contracts to mirror, and complexity smells before custom architecture.",
49
49
  "Architecture Review — lock boundaries, chosen path, shadow alternative, switch trigger, failure/rescue/degraded behavior, and verification evidence for every high-risk choice; include tier-required diagrams.",
50
50
  "Review core risk areas — existing system fit, data/state flow, critical path, security/trust boundaries, tests, performance budget, observability/debuggability, rollout/rollback, rejected alternatives, and spec handoff.",
51
+ "**ADR + pre-mortem contract** — capture ADR-style decision rows (context, decision, alternatives, consequences), run a pre-mortem on likely failures, and map each critical flow to a validating test and diagram anchor before lock.",
51
52
  `Critic pass — run/reconcile adversarial second opinion on architecture, coupling, failure modes, and cheaper alternatives. ${reviewLoopPolicySummary("design")} ${reviewLoopSecondOpinionSummary("design")}`,
52
53
  "Run optional stale-diagram audit only when configured.",
53
54
  "Capture leftovers — seed high-upside deferred ideas, list unresolved decisions with defaults, document distribution for new artifact types, and cross-reference deferred items to scope or unresolved decisions."
@@ -83,7 +84,7 @@ export const DESIGN = {
83
84
  { id: "design_test_and_perf_defined", description: "Test strategy and performance budget are defined." }
84
85
  ],
85
86
  requiredEvidence: [
86
- "Research Fleet Synthesis is filled in `03-design.md`; for deep/high-risk work, `.cclaw/artifacts/02a-research.md` is also written with stack/features/architecture/pitfalls sections plus synthesis.",
87
+ "Research Fleet Synthesis is filled in `.cclaw/artifacts/03-design-<slug>.md`; for deep/high-risk work, `.cclaw/artifacts/02a-research.md` is also written with stack/features/architecture/pitfalls sections plus synthesis.",
87
88
  "Artifact written to `.cclaw/artifacts/03-design-<slug>.md`.",
88
89
  "Failure-mode table exists in Method/Exception/Rescue/UserSees format.",
89
90
  "Tier-required diagram markers are present: architecture (all tiers). Standard/Deep add-ons (shadow/error) and Deep add-ons (state-machine/rollback/deployment-sequence) are included only when risk warrants them.",
@@ -93,7 +94,10 @@ export const DESIGN = {
93
94
  "Outside-voice findings and dispositions are recorded (accept/reject/defer).",
94
95
  `Spec review loop summary includes iteration count and quality score trajectory per ${reviewLoopPolicySummary("design")}`,
95
96
  reviewLoopSecondOpinionSummary("design"),
96
- "Adversarial lock table includes chosen path, shadow alternative, switch trigger, failure/rescue/degraded behavior, and verification evidence.",
97
+ "Adversarial lock table includes chosen path, shadow alternative, switch trigger, failure/rescue/degraded behavior, and verification evidence, with reference-grade contracts for mirrored patterns when applicable.",
98
+ "Architecture Decision Record (ADR) section captures context, decision, alternatives, consequences, and reversal trigger for major choices.",
99
+ "Pre-mortem section lists top failure scenarios, early signals, mitigations, and owner before implementation begins.",
100
+ "Test-Diagram Mapping links critical flows to both validating tests and diagram anchors.",
97
101
  "Test strategy includes unit/integration/e2e expectations.",
98
102
  "When a high-upside idea is deferred, a seed file is created under `.cclaw/seeds/` and referenced in the artifact.",
99
103
  "NOT-in-scope section produced.",
@@ -147,6 +151,7 @@ export const DESIGN = {
147
151
  { section: "Research Fleet Synthesis", required: true, validationRule: "Must summarize the tiered lenses actually run and map findings to concrete design decisions. Default may be compact inline synthesis; full separate research pack is Deep/high-risk only." },
148
152
  { section: "Codebase Investigation", required: false, validationRule: "Investigator pass: list blast-radius files with current responsibilities, discovered patterns, reuse candidates, and existing system fit." },
149
153
  { section: "Engineering Lock", required: true, validationRule: "Canonical lock: chosen path, shadow alternative, switch trigger, failure/rescue/degraded behavior, verification evidence, critical path, rollout/rollback, and confidence." },
154
+ { section: "Architecture Decision Record (ADR)", required: false, validationRule: "Recommended: rows for context, decision, alternatives, consequences, and reversal trigger for each major architecture choice." },
150
155
  { section: "Search Before Building", required: false, validationRule: "For each technical choice: Layer 1 (exact match), Layer 2 (partial match), Layer 3 (inspiration), EUREKA labels with reuse-first default." },
151
156
  { section: "Architecture Boundaries", required: true, validationRule: "Must list component boundaries with ownership." },
152
157
  { section: "Architecture Diagram", required: true, validationRule: "Must include `<!-- diagram: architecture -->` marker. Diagram must label concrete nodes, label arrows, mark direction, distinguish sync/async edges, and include at least one failure/degraded edge." },
@@ -155,12 +160,16 @@ export const DESIGN = {
155
160
  { section: "Data Flow", required: false, validationRule: "Must include data/state flow, happy path, nil input, empty input, upstream error paths, plus Interaction Edge Case matrix rows for double-click, nav-away-mid-request, 10K-result dataset, background-job abandonment, zombie connection. Each row declares handled yes/no and deferred item when not handled." },
156
161
  { section: "Stale Diagram Audit", required: false, validationRule: "When `.cclaw/config.yaml::optInAudits.staleDiagramAudit` is true: blast-radius files from Codebase Investigation must not be newer than the current design diagram-marker baseline unless explicitly refreshed." },
157
162
  { section: "Failure Mode Table", required: true, validationRule: "Use Method/Exception/Rescue/UserSees columns and treat silent user impact without rescue as critical." },
163
+ { section: "Pre-mortem", required: false, validationRule: "Recommended: list top failure scenarios, early warning signal, mitigation owner, and containment action before implementation." },
158
164
  { section: "Security & Threat Model", required: true, validationRule: "Must list trust boundaries, abuse/failure scenarios, mitigations, and residual risks." },
159
165
  { section: "Test Strategy", required: false, validationRule: "Must define unit/integration/e2e expectations with coverage targets." },
166
+ { section: "Test-Diagram Mapping", required: false, validationRule: "Recommended: map each critical flow to at least one validating test ID and one diagram marker/anchor." },
167
+ { section: "Test Strategy", required: false, validationRule: "Must define unit/integration/e2e expectations with coverage targets." },
160
168
  { section: "Performance Budget", required: false, validationRule: "For each critical path: metric name, target threshold, and measurement method." },
161
169
  { section: "Observability & Debuggability", required: true, validationRule: "Must define logs/metrics/traces plus alerting/debug path for critical failure modes." },
162
170
  { section: "Deployment & Rollout", required: true, validationRule: "Must define migration/flag strategy, rollout/rollback plan, switch trigger, and post-deploy verification steps." },
163
171
  { section: "What Already Exists", required: false, validationRule: "For each sub-problem: existing code/library found (Layer 1-3/EUREKA label), reuse decision, and adaptation needed." },
172
+ { section: "Reference-Grade Contracts", required: false, validationRule: "For every mirrored pattern: source, reusable invariant, local adaptation, rejection boundary, and verification signal. Omit with `None - no external or in-repo pattern mirrored` for compact local changes." },
164
173
  { section: "Rejected Alternatives", required: false, validationRule: "List alternatives considered, why rejected, and what signal would revive them." },
165
174
  { section: "Design Decisions", required: false, validationRule: "Stable design decisions with requirement/locked-decision refs and downstream spec impact." },
166
175
  { section: "Spec Handoff", required: true, validationRule: "Exact requirements, design decisions, risks, test/perf expectations, and unresolved questions that spec must carry forward." },
@@ -45,8 +45,9 @@ export const REVIEW = {
45
45
  "Structured Review reconciliation — normalize findings into `07-review-army.json`, dedup by fingerprint, and mark multi-specialist confirmations when multiple lenses agree.",
46
46
  "Meta-Review — Were tests/diagnostics actually run? Do test names match what they test? Are there real assertions? Is the dependency/version surface unchanged or audited?",
47
47
  "Classify findings — Critical (blocks ship), Important (should fix), Suggestion (optional improvement).",
48
+ "Victory Detector — before verdict, confirm Layer 1, Layer 2, security sweep, structured findings, trace evidence, and unresolved-critical status are complete; otherwise iterate findings or route back to TDD.",
48
49
  "Produce verdict — APPROVED, APPROVED_WITH_CONCERNS, or BLOCKED.",
49
- "If verdict is BLOCKED, emit remediation route token `ROUTE_BACK_TO_TDD`, include `cclaw internal rewind tdd \"review_blocked_by_critical\"` with the blocking finding IDs, and satisfy the special transition guard `review_verdict_blocked` instead of `review_criticals_resolved`."
50
+ "If verdict is BLOCKED, emit remediation route token `ROUTE_BACK_TO_TDD`, include the managed command `cclaw internal rewind tdd \"review_blocked_by_critical <finding-ids>\"`, and satisfy the special transition guard `review_verdict_blocked` instead of `review_criticals_resolved`. After TDD rework, clear the stale marker with `cclaw internal rewind --ack tdd` before `/cc-next`."
50
51
  ],
51
52
  interactionProtocol: [
52
53
  "Run Layer 1 (spec compliance) completely before starting Layer 2.",
@@ -54,7 +55,7 @@ export const REVIEW = {
54
55
  "Classify every finding as Critical, Important, or Suggestion.",
55
56
  decisionProtocolInstruction("each Critical finding", "present resolution options (A/B/C) with trade-offs, and mark one as (recommended)", "recommend the option that fully closes the finding with no carry-over risk and the smallest blast radius", STRUCTURED_ASK_TOOL_LIST_REVIEW),
56
57
  "Resolve all critical blockers before ship. If verdict is BLOCKED, do not pass `review_criticals_resolved`; pass only the remediation route gate `review_verdict_blocked` when routing back to TDD.",
57
- "When verdict is BLOCKED, do not end with a passive stop: explicitly route remediation to TDD via `ROUTE_BACK_TO_TDD` and point to `cclaw internal rewind tdd` with the blocking IDs.",
58
+ "When verdict is BLOCKED, do not end with a passive stop: explicitly route remediation to TDD via `ROUTE_BACK_TO_TDD`, point to `cclaw internal rewind tdd` with the blocking IDs, and tell the operator to ack the stale TDD marker only after rework is complete.",
58
59
  structuredAskSingleChoiceInstruction("final verdict", "verdict (APPROVED / APPROVED_WITH_CONCERNS / BLOCKED)"),
59
60
  "**STOP.** Do NOT proceed to ship until the user provides an explicit verdict."
60
61
  ],
@@ -65,7 +66,7 @@ export const REVIEW = {
65
66
  "Reconcile structured findings into `.cclaw/artifacts/07-review-army.json` (dedup + confidence + conflict notes + source tags from spec/correctness/security/performance/architecture/external-safety passes).",
66
67
  "Classify and prioritize all findings.",
67
68
  "Write review report artifact with explicit verdict.",
68
- "If verdict is BLOCKED, include the remediation route token `ROUTE_BACK_TO_TDD` and the rewind command payload."
69
+ "If verdict is BLOCKED, include the remediation route token `ROUTE_BACK_TO_TDD`, the managed rewind command payload, and the follow-up ack command after TDD rework."
69
70
  ],
70
71
  requiredGates: [
71
72
  { id: "review_layer1_spec_compliance", description: "Spec compliance check completed with per-criterion verdict." },
@@ -86,9 +87,10 @@ export const REVIEW = {
86
87
  "No-finding attestation is explicit when no issues are found.",
87
88
  "Dependency/version audit is recorded when manifests, lockfiles, generated clients, CI, runtime config, or external APIs are relevant.",
88
89
  "Severity log includes critical/important/suggestion buckets.",
90
+ "Victory Detector recorded: Layer 1, Layer 2, security sweep, structured findings, trace evidence, and unresolved-critical status are complete, or BLOCKED route is explicit.",
89
91
  "Explicit final verdict: APPROVED, APPROVED_WITH_CONCERNS, or BLOCKED.",
90
92
  "Fresh verification command discovery recorded, and the command cited in `review_trace_matrix_clean` evidence before ship handoff.",
91
- "If BLOCKED: include explicit remediation route (`ROUTE_BACK_TO_TDD`) with blocking finding IDs."
93
+ "If BLOCKED: include explicit remediation route (`ROUTE_BACK_TO_TDD`) with blocking finding IDs, managed rewind command, and post-rework ack instruction."
92
94
  ],
93
95
  inputs: ["implementation diff", "upstream artifacts", "test/build evidence"],
94
96
  requiredContext: ["spec criteria", "tdd artifact", "rulebook constraints"],
@@ -126,7 +128,7 @@ export const REVIEW = {
126
128
  { section: "Security Sweep Attestation", required: false, validationRule: "Dedicated security-reviewer result: findings or `NO_CHANGE_ATTESTATION` / `NO_SECURITY_IMPACT` with inspected surfaces and rationale." },
127
129
  { section: "Dependency & Version Audit", required: false, validationRule: "Required when manifests, lockfiles, generated clients, CI, runtime config, or external APIs changed; otherwise record no-impact rationale." },
128
130
  { section: "Review Findings Contract", required: true, validationRule: "Structured findings in 07-review-army.json include id/severity/confidence/fingerprint/reportedBy/status and source tags from {spec, correctness, security, performance, architecture, external-safety} with dedup reconciliation summary." },
129
- { section: "Review Readiness Snapshot", required: false, validationRule: "Optional compact summary: completed checks, delegation-log status, staleness signal, open critical blockers, and ship recommendation." },
131
+ { section: "Review Readiness Snapshot", required: false, validationRule: "Optional compact summary: completed checks, delegation-log status, staleness signal, open critical blockers, ship recommendation, and Victory Detector pass/fail." },
130
132
  { section: "Completeness Snapshot", required: false, validationRule: "Optional compact coverage summary for AC coverage, source item coverage, test-slice coverage, and adversarial-review status when triggered." },
131
133
  { section: "Incoming Feedback Queue", required: false, validationRule: "When external review feedback exists, include a queue summary with per-item disposition (resolved / accepted-risk / rejected-with-evidence) and evidence refs." },
132
134
  { section: "Trace Matrix Check", required: false, validationRule: "Records source-item/test orphan counts (all zero on enforced tracks) with command output reference." },
@@ -20,8 +20,11 @@ export interface ArtifactValidation {
20
20
  tier?: "required" | "recommended";
21
21
  validationRule: string;
22
22
  }
23
+ export type StageSubagentName = "researcher" | "architect" | "spec-validator" | "slice-implementer" | "performance-reviewer" | "compatibility-reviewer" | "observability-reviewer" | "release-reviewer" | "planner" | "product-manager" | "critic" | "reviewer" | "security-reviewer" | "test-author" | "doc-updater" | "implementer" | "fixer";
24
+ export type StageSubagentDispatchClass = "stage-specialist" | "worker" | "review-lens";
25
+ export type StageSubagentReturnSchema = "planning-return" | "product-return" | "critic-return" | "review-return" | "security-return" | "tdd-return" | "docs-return" | "worker-return" | "fixer-return" | "research-return" | "architecture-return" | "spec-validation-return" | "performance-return" | "compatibility-return" | "observability-return" | "release-return";
23
26
  export interface StageAutoSubagentDispatch {
24
- agent: "planner" | "product-manager" | "critic" | "reviewer" | "security-reviewer" | "test-author" | "doc-updater";
27
+ agent: StageSubagentName;
25
28
  /**
26
29
  * - `mandatory` — must be dispatched (or explicitly waived) before stage transition.
27
30
  * - `proactive` — should be dispatched automatically when context matches `when`.
@@ -29,12 +32,16 @@ export interface StageAutoSubagentDispatch {
29
32
  mode: "mandatory" | "proactive";
30
33
  /**
31
34
  * Minimum complexity tier where this dispatch policy applies.
32
- * Defaults to `standard` for mandatory dispatches when omitted.
35
+ * Defaults to `standard` for mandatory/proactive dispatches when omitted.
33
36
  */
34
37
  requiredAtTier?: StageComplexityTier;
35
38
  when: string;
36
39
  purpose: string;
37
40
  requiresUserGate: boolean;
41
+ /** Role category used by generated routing tables and lifecycle checks. */
42
+ dispatchClass?: StageSubagentDispatchClass;
43
+ /** Strict status/evidence contract the dispatched agent must return. */
44
+ returnSchema?: StageSubagentReturnSchema;
38
45
  /** Optional skill folder the dispatched agent should load as additional context. */
39
46
  skill?: string;
40
47
  }
@@ -49,7 +49,8 @@ export const SCOPE = {
49
49
  "**Premise and leverage check** — answer in the artifact: *Right problem? Direct path? What if nothing? Where can we leverage existing code? What is the reversibility cost?* Take a position; do not hedge.",
50
50
  "**Conditional 10-star boundary** — for deep/high-risk/product-strategy work, show what would make the product meaningfully better, then explicitly choose what ships now, what is deferred, and what is excluded without vague `later/for now` placeholders. Skip this for straightforward repair work and record `not needed: compact scope`.",
51
51
  "**Pick one operational mode with the user** — HOLD SCOPE preserves focus; SELECTIVE EXPANSION cherry-picks high-leverage reference ideas; SCOPE EXPANSION explores ambitious alternatives; SCOPE REDUCTION cuts to the essential wedge. Recommend one, state why and what signal would change it, then STOP for approval.",
52
- "**Run mode-specific analysis only to needed depth** — lite keeps the selected-mode row compact; standard adds requirements/locked decisions/discretion; deep may add Landscape Check, Taste Calibration, Reference Pull, Ambitious Alternatives, and Ruthless Minimum Slice evidence when mode/risk warrants it.",
52
+ "**Run mode-specific analysis only to needed depth** — lite keeps the selected-mode row compact; standard adds requirements/locked decisions/discretion; deep may add Landscape Check, Taste Calibration, Reference Pattern Registry, Reference Pull, Ambitious Alternatives, and Ruthless Minimum Slice evidence when mode/risk warrants it.",
53
+ "**Decision-driver contract** — list weighted decision drivers (value, risk, reversibility, effort, timeline) and score candidate scope moves so the selected mode and boundaries are evidence-backed, not preference-led.",
53
54
  "**Compare implementation alternatives** — include minimum viable, product-grade, and ideal architecture options with effort (S/M/L/XL), risk (Low/Med/High), pros, cons, and reuses. Recommend one and tie it to mode.",
54
55
  "**Run outside voice before final approval** — for simple/low-risk scope, record one concise adversarial self-check row; for complex/high-risk/configured scope, iterate until threshold. Record the loop summary in `## Scope Outside Voice Loop`, but do not treat it as user approval.",
55
56
  "**Ask only one decision-changing question** — if the user rejects the contract but is unsure, offer 3-4 concrete scope moves instead of open-ended interrogation.",
@@ -87,7 +88,9 @@ export const SCOPE = {
87
88
  "In-scope and out-of-scope lists are explicit.",
88
89
  "Discretion areas are explicit (or marked as `None`).",
89
90
  "Selected mode and rationale are documented using HOLD SCOPE, SELECTIVE EXPANSION, SCOPE EXPANSION, or SCOPE REDUCTION.",
90
- "Scope Contract captures requirements, locked decisions, discretion areas, accepted/rejected reference ideas, success definition, and design handoff.",
91
+ "Scope Contract captures requirements, locked decisions, discretion areas, accepted/rejected/deferred reference ideas from the Reference Pattern Registry, success definition, and design handoff.",
92
+ "Decision Drivers section records weighted criteria and per-option scores used to choose mode and boundary moves.",
93
+ "Scope Completeness Score is recorded (0.00-1.00) with the explicit blocker list for any remaining uncertainty.",
91
94
  "Locked Decisions section lists stable LD#hash anchors for non-negotiable boundaries.",
92
95
  "Premise challenge findings documented.",
93
96
  "Outside Voice findings and dispositions are recorded (accept/reject/defer with rationale) before final approval.",
@@ -142,8 +145,11 @@ export const SCOPE = {
142
145
  { section: "Prime Directives", required: false, validationRule: "For each scoped capability: named failure modes, explicit error surface, four data-flow paths, interaction edge cases, observability expectations, and deferred-item handling." },
143
146
  { section: "Premise Challenge", required: false, validationRule: "Must list at least 3 question/answer rows in a markdown table or bullet list (gstack default trio: right problem? direct path? what if we do nothing? — extend with leverage and reversibility for richer scope). The linter enforces structure, not English wording — answers may be in any language." },
144
147
  { section: "Scope Contract", required: true, validationRule: "Canonical contract: selected mode, in scope, out of scope, requirements, locked decisions, discretion areas, deferred ideas, accepted/rejected reference ideas, success definition, and design handoff." },
148
+ { section: "Decision Drivers", required: false, validationRule: "Recommended: weighted decision drivers (value, risk, reversibility, effort, timeline) with scored options and the selected boundary rationale." },
149
+ { section: "Scope Completeness Score", required: false, validationRule: "Recommended: score 0.00-1.00 plus unresolved blockers and the escalation trigger when confidence is low." },
145
150
  { section: "Landscape Check", required: false, validationRule: "Optional evidence heading for EXPAND/SELECTIVE/deep modes: include reference insight and impact on scope, or omit for compact HOLD SCOPE." },
146
151
  { section: "Taste Calibration", required: false, validationRule: "Optional evidence heading: reference 2-3 strong in-repo modules/files that define the quality bar or justify omission." },
152
+ { section: "Reference Pattern Registry", required: false, validationRule: "Recommended for SELECTIVE/EXPAND/deep scope: table of pattern/source, accepted/rejected/deferred disposition, invariant to preserve, and boundary impact. Compact HOLD SCOPE may state `Not needed - compact scope`." },
147
153
  { section: "Reference Pull", required: false, validationRule: "Optional evidence heading: cite ideas pulled from `/Users/zuevrs/Downloads/references` or state no reference pull was needed for compact HOLD SCOPE." },
148
154
  { section: "Ambitious Alternatives", required: false, validationRule: "Optional evidence heading for SCOPE EXPANSION/SELECTIVE: list larger alternatives considered and their disposition." },
149
155
  { section: "Ruthless Minimum Slice", required: false, validationRule: "Optional evidence heading for SCOPE REDUCTION or high-risk scope: define the smallest useful wedge and what it proves." },