cclaw-cli 0.55.2 → 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 (72) hide show
  1. package/README.md +3 -3
  2. package/dist/artifact-linter/brainstorm.js +45 -1
  3. package/dist/artifact-linter/design.js +32 -1
  4. package/dist/artifact-linter/plan.js +22 -1
  5. package/dist/artifact-linter/review.js +35 -1
  6. package/dist/artifact-linter/scope.js +19 -9
  7. package/dist/artifact-linter/shared.d.ts +11 -10
  8. package/dist/artifact-linter/shared.js +70 -41
  9. package/dist/artifact-linter/ship.js +36 -0
  10. package/dist/artifact-linter/spec.js +23 -1
  11. package/dist/artifact-linter/tdd.js +74 -0
  12. package/dist/artifact-linter.d.ts +1 -1
  13. package/dist/constants.d.ts +1 -1
  14. package/dist/constants.js +1 -0
  15. package/dist/content/closeout-guidance.d.ts +1 -1
  16. package/dist/content/closeout-guidance.js +10 -11
  17. package/dist/content/core-agents.d.ts +35 -36
  18. package/dist/content/core-agents.js +189 -99
  19. package/dist/content/diff-command.js +1 -1
  20. package/dist/content/examples.d.ts +0 -3
  21. package/dist/content/examples.js +197 -752
  22. package/dist/content/idea.d.ts +60 -0
  23. package/dist/content/idea.js +404 -0
  24. package/dist/content/learnings.d.ts +2 -4
  25. package/dist/content/learnings.js +10 -26
  26. package/dist/content/node-hooks.js +131 -97
  27. package/dist/content/opencode-plugin.js +12 -26
  28. package/dist/content/reference-patterns.js +2 -2
  29. package/dist/content/runtime-shared-snippets.d.ts +8 -0
  30. package/dist/content/runtime-shared-snippets.js +80 -0
  31. package/dist/content/session-hooks.js +1 -1
  32. package/dist/content/skills.d.ts +1 -0
  33. package/dist/content/skills.js +50 -0
  34. package/dist/content/stage-schema.js +107 -63
  35. package/dist/content/stages/review.js +8 -8
  36. package/dist/content/stages/schema-types.d.ts +2 -2
  37. package/dist/content/stages/scope.js +1 -1
  38. package/dist/content/stages/ship.js +1 -1
  39. package/dist/content/status-command.js +3 -3
  40. package/dist/content/subagent-context-skills.js +156 -1
  41. package/dist/content/subagents.d.ts +0 -5
  42. package/dist/content/subagents.js +12 -82
  43. package/dist/content/templates.js +87 -6
  44. package/dist/content/utility-skills.js +26 -97
  45. package/dist/flow-state.d.ts +5 -6
  46. package/dist/flow-state.js +4 -6
  47. package/dist/gate-evidence.d.ts +0 -31
  48. package/dist/gate-evidence.js +3 -181
  49. package/dist/harness-adapters.js +1 -1
  50. package/dist/install.js +38 -4
  51. package/dist/internal/advance-stage/advance.js +0 -1
  52. package/dist/internal/advance-stage/review-loop.js +1 -10
  53. package/dist/knowledge-store.d.ts +2 -20
  54. package/dist/knowledge-store.js +43 -57
  55. package/dist/policy.js +3 -3
  56. package/dist/retro-gate.js +8 -90
  57. package/dist/run-archive.js +1 -4
  58. package/dist/run-persistence.js +14 -109
  59. package/dist/runtime/run-hook.entry.d.ts +3 -0
  60. package/dist/runtime/run-hook.entry.js +5 -0
  61. package/dist/runtime/run-hook.mjs +9477 -0
  62. package/package.json +4 -2
  63. package/dist/content/hook-inline-snippets.d.ts +0 -96
  64. package/dist/content/hook-inline-snippets.js +0 -515
  65. package/dist/content/idea-command.d.ts +0 -8
  66. package/dist/content/idea-command.js +0 -322
  67. package/dist/content/idea-frames.d.ts +0 -31
  68. package/dist/content/idea-frames.js +0 -140
  69. package/dist/content/idea-ranking.d.ts +0 -25
  70. package/dist/content/idea-ranking.js +0 -65
  71. package/dist/trace-matrix.d.ts +0 -27
  72. package/dist/trace-matrix.js +0 -226
@@ -90,25 +90,23 @@ function defaultReturnSchemaForAgent(agent) {
90
90
  case "spec-validator":
91
91
  return "spec-validation-return";
92
92
  case "spec-document-reviewer":
93
+ case "coherence-reviewer":
94
+ case "scope-guardian-reviewer":
95
+ case "feasibility-reviewer":
93
96
  return "review-return";
94
97
  case "slice-implementer":
95
98
  return "worker-return";
96
- case "performance-reviewer":
97
- return "performance-return";
98
- case "compatibility-reviewer":
99
- return "compatibility-return";
100
- case "observability-reviewer":
101
- return "observability-return";
102
99
  case "release-reviewer":
103
100
  return "release-return";
104
101
  case "planner":
105
102
  return "planning-return";
106
- case "product-manager":
107
- case "product-strategist":
103
+ case "product-discovery":
108
104
  return "product-return";
105
+ case "divergent-thinker":
109
106
  case "critic":
110
107
  return "critic-return";
111
108
  case "reviewer":
109
+ case "integration-overseer":
112
110
  return "review-return";
113
111
  case "security-reviewer":
114
112
  return "security-return";
@@ -118,14 +116,12 @@ function defaultReturnSchemaForAgent(agent) {
118
116
  return "docs-return";
119
117
  case "fixer":
120
118
  return "fixer-return";
121
- case "implementer":
122
- return "worker-return";
123
119
  }
124
120
  }
125
121
  function dispatchClassForRow(row) {
126
122
  if (row.dispatchClass)
127
123
  return row.dispatchClass;
128
- if (row.agent === "implementer" || row.agent === "fixer" || row.agent === "slice-implementer")
124
+ if (row.agent === "fixer" || row.agent === "slice-implementer")
129
125
  return "worker";
130
126
  return row.skill?.includes("review") || row.agent === "reviewer" || row.agent === "security-reviewer" || row.agent.endsWith("-reviewer")
131
127
  ? "review-lens"
@@ -298,8 +294,7 @@ const REQUIRED_GATE_IDS = {
298
294
  "review_layer2_security",
299
295
  "review_layer_coverage_complete",
300
296
  "review_criticals_resolved",
301
- "review_army_json_valid",
302
- ...(track === "quick" ? [] : ["review_trace_matrix_clean"])
297
+ "review_army_json_valid"
303
298
  ],
304
299
  ship: [
305
300
  "ship_review_verdict_valid",
@@ -447,11 +442,18 @@ const STAGE_SCHEMA_MAP = {
447
442
  const STAGE_AUTO_SUBAGENT_DISPATCH = {
448
443
  brainstorm: [
449
444
  {
450
- agent: "product-manager",
445
+ agent: "product-discovery",
451
446
  mode: "mandatory",
452
447
  requiredAtTier: "standard",
453
448
  when: "Always for standard/deep brainstorm to validate value, persona/JTBD, success metric, and why-now framing.",
454
- 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.",
455
457
  requiresUserGate: false
456
458
  },
457
459
  {
@@ -459,8 +461,9 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
459
461
  mode: "mandatory",
460
462
  requiredAtTier: "standard",
461
463
  when: "Always for standard/deep brainstorm to challenge the premise, do-nothing path, and higher-upside alternatives.",
462
- purpose: "Attack assumptions and surface non-goals before direction approval.",
463
- 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"
464
467
  },
465
468
  {
466
469
  agent: "researcher",
@@ -479,13 +482,21 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
479
482
  purpose: "Challenge premise, map alternatives, and produce explicit in/out contract.",
480
483
  requiresUserGate: false
481
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
+ },
482
492
  {
483
493
  agent: "critic",
484
494
  mode: "mandatory",
485
495
  requiredAtTier: "standard",
486
496
  when: "Always during scope shaping for standard/deep work.",
487
- purpose: "Test whether the selected scope mode is too timid, too broad, or hiding a smaller useful slice.",
488
- 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"
489
500
  },
490
501
  {
491
502
  agent: "researcher",
@@ -495,19 +506,27 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
495
506
  requiresUserGate: false
496
507
  },
497
508
  {
498
- agent: "product-manager",
509
+ agent: "product-discovery",
499
510
  mode: "proactive",
500
- when: "When scope choices change user value, success metrics, or product positioning.",
501
- 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.",
502
513
  requiresUserGate: false
503
514
  },
504
515
  {
505
- agent: "product-strategist",
516
+ agent: "product-discovery",
506
517
  mode: "proactive",
507
518
  requiredAtTier: "standard",
508
- when: "When scope mode resolves to SCOPE EXPANSION or SELECTIVE EXPANSION.",
509
- purpose: "Drive 10x vision and concrete expansion proposals before locking the scope contract.",
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.",
510
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"
511
530
  }
512
531
  ],
513
532
  design: [
@@ -530,9 +549,10 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
530
549
  {
531
550
  agent: "critic",
532
551
  mode: "proactive",
533
- when: "When architecture alternatives, coupling, cost, or rollback risk remain debatable.",
534
- purpose: "Produce a shadow alternative, switch trigger, and cheaper-path challenge for the engineering lock.",
535
- 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"
536
556
  },
537
557
  {
538
558
  agent: "researcher",
@@ -549,20 +569,20 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
549
569
  requiresUserGate: false
550
570
  },
551
571
  {
552
- agent: "compatibility-reviewer",
572
+ agent: "coherence-reviewer",
553
573
  mode: "proactive",
554
- requiredAtTier: "lightweight",
555
- when: "When public API, config, persisted data, CLI, generated clients, or cross-version behavior can change.",
556
- purpose: "Identify backward-compatibility and migration hazards before spec/plan.",
557
- 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"
558
578
  },
559
579
  {
560
- agent: "observability-reviewer",
580
+ agent: "feasibility-reviewer",
561
581
  mode: "proactive",
562
- requiredAtTier: "lightweight",
563
- when: "When runtime/debuggability, rollout, failure detection, or supportability matters.",
564
- purpose: "Validate logs/metrics/traces, alerting, and rescue-path visibility before implementation.",
565
- 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"
566
586
  }
567
587
  ],
568
588
  spec: [
@@ -588,6 +608,14 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
588
608
  when: "When Spec Self-Review reports gaps (Status: Issues Found) or subsystem boundaries drift beyond one coherent plan slice.",
589
609
  purpose: "Run a final document-level quality pass for completeness, consistency, clarity, and scope fit before handoff to plan.",
590
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"
591
619
  }
592
620
  ],
593
621
  plan: [
@@ -605,6 +633,30 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
605
633
  when: "When plan tasks touch unfamiliar areas or reference-pattern adoption needs source verification.",
606
634
  purpose: "Confirm context/search evidence before plan packets rely on discovered patterns.",
607
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"
608
660
  }
609
661
  ],
610
662
  tdd: [
@@ -625,6 +677,13 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
625
677
  purpose: "Implement the minimal passing slice inside explicit file boundaries and return strict worker evidence.",
626
678
  requiresUserGate: false
627
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
+ },
628
687
  {
629
688
  agent: "reviewer",
630
689
  mode: "proactive",
@@ -646,7 +705,7 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
646
705
  mode: "mandatory",
647
706
  requiredAtTier: "lightweight",
648
707
  when: "Always in review stage.",
649
- 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.",
650
709
  requiresUserGate: false,
651
710
  skill: "review-spec-pass"
652
711
  },
@@ -659,30 +718,6 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
659
718
  requiresUserGate: false,
660
719
  skill: "security-audit"
661
720
  },
662
- {
663
- agent: "performance-reviewer",
664
- mode: "proactive",
665
- requiredAtTier: "lightweight",
666
- when: "When hot paths, IO, data volume, rendering, caching, or algorithmic cost can move.",
667
- purpose: "Run a focused performance lens and report evidence-backed regressions or no-impact rationale.",
668
- requiresUserGate: false
669
- },
670
- {
671
- agent: "compatibility-reviewer",
672
- mode: "proactive",
673
- requiredAtTier: "lightweight",
674
- when: "When public API, CLI/config, persisted data, generated clients, or dependency versions change.",
675
- purpose: "Check compatibility, migrations, and consumer-facing contract stability.",
676
- requiresUserGate: false
677
- },
678
- {
679
- agent: "observability-reviewer",
680
- mode: "proactive",
681
- requiredAtTier: "lightweight",
682
- when: "When failure diagnosis, logging/metrics/traces, rollout, or operational support matters.",
683
- purpose: "Check observability and supportability evidence against the design/review artifact.",
684
- requiresUserGate: false
685
- },
686
721
  {
687
722
  agent: "reviewer",
688
723
  mode: "proactive",
@@ -709,6 +744,15 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
709
744
  }
710
745
  ],
711
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
+ },
712
756
  {
713
757
  agent: "release-reviewer",
714
758
  mode: "mandatory",
@@ -36,7 +36,7 @@ export const REVIEW = {
36
36
  "Change-Size Check — ~100 lines = normal. ~300 lines = consider splitting. ~1000+ lines = strongly recommend stacked PRs. Flag large diffs to the user.",
37
37
  "Risk-Based Second Opinion — compute changed-line count, files-touched count, and trust-boundary movement. Dispatch an adversarial reviewer only when trust boundaries changed, Critical/Important ambiguity remains, or the diff is both large and high-risk; otherwise record `not triggered`.",
38
38
  "Load upstream evidence — read TDD artifact (RED + GREEN + REFACTOR), spec, and the active track's upstream source items.",
39
- "Run traceability matrix when the active track enforces it; otherwise confirm spec acceptance/reproduction slices are covered directly.",
39
+ "Confirm spec acceptance criteria and reproduction slices are covered directly in the review artifact evidence.",
40
40
  "Layer 1: Spec Compliance — check every acceptance criterion against implementation. Verdict: pass/fail per criterion.",
41
41
  "Review Evidence Scope — record base/head, files inspected, changed-file coverage, diagnostics run, dependency/version audit when relevant, and any files intentionally not inspected with explicit reason.",
42
42
  "Layer 2: Integrated findings — one structured pass tagged by category: correctness, security, performance, architecture, external-safety. Every finding uses file:line; if impossible, include an explicit no-line reason.",
@@ -45,7 +45,7 @@ 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
+ "Victory Detector — before verdict, confirm Layer 1, Layer 2, security sweep, structured findings, acceptance/reproduction coverage evidence, and unresolved-critical status are complete; otherwise iterate findings or route back to TDD.",
49
49
  "Produce verdict — APPROVED, APPROVED_WITH_CONCERNS, or BLOCKED.",
50
50
  "If verdict is BLOCKED, emit remediation route token `ROUTE_BACK_TO_TDD`, include the managed command `npx cclaw-cli internal rewind tdd \"review_blocked_by_critical <finding-ids>\"`, list the critical finding IDs and required TDD evidence to repair, and satisfy the special transition guard `review_verdict_blocked` instead of `review_criticals_resolved`. After TDD rework, clear the stale marker with `npx cclaw-cli internal rewind --ack tdd` before `/cc`."
51
51
  ],
@@ -73,13 +73,12 @@ export const REVIEW = {
73
73
  { id: "review_layer2_security", description: "Security review completed." },
74
74
  { id: "review_layer_coverage_complete", description: "Layer coverage map in 07-review-army.json confirms spec/correctness/security/performance/architecture/external-safety tags were considered." },
75
75
  { id: "review_criticals_resolved", description: "Normal APPROVED or APPROVED_WITH_CONCERNS path only: no unresolved critical blockers remain. BLOCKED routes use review_verdict_blocked instead." },
76
- { id: "review_army_json_valid", description: "07-review-army.json passes schema validation (validateReviewArmy)." },
77
- { id: "review_trace_matrix_clean", description: "Trace matrix has no orphaned source items or test slices for the active run, and evidence cites a discovered real test command before ship handoff." }
76
+ { id: "review_army_json_valid", description: "07-review-army.json passes schema validation (validateReviewArmy)." }
78
77
  ],
79
78
  requiredEvidence: [
80
79
  "Artifact written to `.cclaw/artifacts/07-review.md`.",
81
80
  "Artifact written to `.cclaw/artifacts/07-review-army.json`.",
82
- "Traceability matrix run recorded (no orphaned source items or tests for enforced tracks).",
81
+ "Acceptance/reproduction coverage evidence recorded in the review artifact (AC and source-item/slice coverage snapshot).",
83
82
  "Layer 1 verdict captured with per-criterion pass/fail.",
84
83
  "Review Evidence Scope lists files inspected, changed-file coverage, diagnostics run, and omitted files with explicit reason.",
85
84
  "Layer 2 sections completed across correctness, security, performance, architecture, and external-safety findings.",
@@ -87,9 +86,9 @@ export const REVIEW = {
87
86
  "No-finding attestation is explicit when no issues are found.",
88
87
  "Dependency/version audit is recorded when manifests, lockfiles, generated clients, CI, runtime config, or external APIs are relevant.",
89
88
  "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
+ "Victory Detector recorded: Layer 1, Layer 2, security sweep, structured findings, acceptance/reproduction coverage evidence, and unresolved-critical status are complete, or BLOCKED route is explicit.",
91
90
  "Explicit final verdict: APPROVED, APPROVED_WITH_CONCERNS, or BLOCKED.",
92
- "Fresh verification command discovery recorded, and the command cited in `review_trace_matrix_clean` evidence before ship handoff.",
91
+ "Fresh verification command discovery recorded before ship handoff, with command and result captured in review evidence.",
93
92
  "If BLOCKED: include explicit remediation route (`ROUTE_BACK_TO_TDD`) with blocking finding IDs, managed rewind command, and post-rework ack instruction."
94
93
  ],
95
94
  inputs: ["implementation diff", "upstream artifacts", "test/build evidence"],
@@ -125,13 +124,14 @@ export const REVIEW = {
125
124
  { section: "Changed-File Coverage", required: true, validationRule: "Each changed file is covered, intentionally omitted with no-impact reason, or linked to a broader inspected module." },
126
125
  { section: "Layer 1 Verdict", required: true, validationRule: "Per-criterion pass/fail with references." },
127
126
  { section: "Layer 2 Findings", required: false, validationRule: "Each finding has severity, category, file:line or explicit no-line reason, description, and resolution status across correctness/security/performance/architecture/external-safety. If there are no findings, include a no-finding attestation." },
127
+ { section: "Lens Coverage", required: true, validationRule: "Reviewer must report inline lens outcomes: Performance/Compatibility/Observability as `NO_IMPACT` or `FOUND_<n>`, plus `Security: routed to security-reviewer`." },
128
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." },
129
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." },
130
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." },
131
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." },
132
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." },
133
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." },
134
- { section: "Trace Matrix Check", required: false, validationRule: "Records source-item/test orphan counts (all zero on enforced tracks) with command output reference." },
134
+ { section: "Coverage Check", required: false, validationRule: "Records AC/source-item/slice coverage status with explicit no-orphan rationale and evidence references." },
135
135
  { section: "Blocked Route", required: false, validationRule: "When Final Verdict is BLOCKED: includes `ROUTE_BACK_TO_TDD`, rewind target `tdd`, and blocked finding IDs." },
136
136
  { section: "Severity Summary", required: true, validationRule: "Per-severity count lines for critical, important, and suggestion buckets." },
137
137
  { section: "Final Verdict", required: true, validationRule: "Exactly one of: APPROVED, APPROVED_WITH_CONCERNS, BLOCKED." }
@@ -20,9 +20,9 @@ export interface ArtifactValidation {
20
20
  tier?: "required" | "recommended";
21
21
  validationRule: string;
22
22
  }
23
- export type StageSubagentName = "researcher" | "architect" | "spec-validator" | "spec-document-reviewer" | "slice-implementer" | "performance-reviewer" | "compatibility-reviewer" | "observability-reviewer" | "release-reviewer" | "planner" | "product-manager" | "product-strategist" | "critic" | "reviewer" | "security-reviewer" | "test-author" | "doc-updater" | "implementer" | "fixer";
23
+ export type StageSubagentName = "researcher" | "architect" | "spec-validator" | "spec-document-reviewer" | "coherence-reviewer" | "scope-guardian-reviewer" | "feasibility-reviewer" | "slice-implementer" | "release-reviewer" | "planner" | "product-discovery" | "divergent-thinker" | "critic" | "reviewer" | "security-reviewer" | "integration-overseer" | "test-author" | "doc-updater" | "fixer";
24
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";
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" | "release-return";
26
26
  export interface StageAutoSubagentDispatch {
27
27
  agent: StageSubagentName;
28
28
  /**
@@ -89,7 +89,7 @@ export const SCOPE = {
89
89
  "In-scope and out-of-scope lists are explicit.",
90
90
  "Discretion areas are explicit (or marked as `None`).",
91
91
  "Selected mode and rationale are documented using HOLD SCOPE, SELECTIVE EXPANSION, SCOPE EXPANSION, or SCOPE REDUCTION.",
92
- "When selected mode is SCOPE EXPANSION or SELECTIVE EXPANSION, active-run delegation ledger includes a completed `product-strategist` row with non-empty `evidenceRefs`.",
92
+ "When selected mode is SCOPE EXPANSION or SELECTIVE EXPANSION, active-run delegation ledger includes a completed `product-discovery` row with non-empty `evidenceRefs`.",
93
93
  "Scope Contract captures requirements, locked decisions, discretion areas, accepted/rejected/deferred reference ideas from the Reference Pattern Registry, success definition, and design handoff.",
94
94
  "Decision Drivers section records weighted criteria and per-option scores used to choose mode and boundary moves.",
95
95
  "Scope Completeness Score is recorded (0.00-1.00) with the explicit blocker list for any remaining uncertainty.",
@@ -118,7 +118,7 @@ export const SHIP = {
118
118
  { section: "Monitoring", required: false, validationRule: "If applicable: what metrics/logs to watch post-deploy. Risk note if no monitoring." },
119
119
  { section: "Finalization", required: true, validationRule: "Exactly one finalization enum token selected (FINALIZE_MERGE_LOCAL | FINALIZE_OPEN_PR | FINALIZE_KEEP_BRANCH | FINALIZE_DISCARD_BRANCH | FINALIZE_NO_VCS). Execution result documented. Worktree cleaned if applicable." },
120
120
  { section: "Completion Status", required: false, validationRule: "If present: exactly one of SHIPPED, SHIPPED_WITH_EXCEPTIONS, BLOCKED. Exceptions documented when applicable. BLOCKED is required when the Victory Detector has stale or missing evidence." },
121
- { section: "Compound Step", required: false, validationRule: "Optional retrospective: include overlap assessment before appending duplicate knowledge; distinguish bug-track fixes/tests from knowledge-track process/project guidance; use supersedes/superseded_by only for clear refreshes; or include an explicit 'No compound insight this run.' line." }
121
+ { section: "Compound Step", required: false, validationRule: "Optional retrospective: include overlap assessment before appending duplicate knowledge; distinguish bug-track fixes/tests from knowledge-track process/project guidance; or include an explicit 'No compound insight this run.' line." }
122
122
  ]
123
123
  },
124
124
  reviewLens: {
@@ -89,7 +89,7 @@ a read-only command.
89
89
 
90
90
  - Keep output compact (≤ 40 lines) — status, not narrative.
91
91
  - Start with the same operator rows as \`/cc\` when possible:
92
- \`Current\`, \`Stage\`, \`Progress\`, \`Gates\`, \`Delegations\`, \`Risks\`, \`Blocked by\`, \`Next\`, \`Evidence needed\`. Use labels like \`gate: tdd_green_full_suite\`, \`delegation proof: reviewer evidenceRefs\`, and \`closeout: compound_review\` instead of raw JSON tone.
92
+ \`Current\`, \`Stage\`, \`Progress\`, \`Gates\`, \`Delegations\`, \`Risks\`, \`Blocked by\`, \`Next\`, \`Evidence needed\`. Use labels like \`gate: tdd_green_full_suite\`, \`delegation proof: reviewer evidenceRefs\`, and \`closeout: post_ship_review\` instead of raw JSON tone.
93
93
  - When blocked, include a plain-English action block:
94
94
  \`Current: <stage or closeout substate>\`; \`Blocked by: <gate/delegation/blocker code>\`; \`Next: <exact command or managed remediation>\`; \`Evidence needed: <artifact/test/review/delegation evidence>\`.
95
95
  - Report counts, not full artifact contents. Include active subagent count from \`${subagentsPath()}\` and proof gaps from \`${delegationEventsPath()}\` when present. Convert gate/delegation state into human labels: \`passed\`, \`blocked\`, \`missing proof\`, \`waived with reason\`, \`stale\`, \`ready to advance\`, or the closeout substate label.
@@ -98,12 +98,12 @@ a read-only command.
98
98
 
99
99
  ## Anti-patterns
100
100
 
101
- - Rebuilding trace-matrix or running sync from \`/cc-view status\` — those belong to dedicated tools.
101
+ - Re-running heavy artifact workflows from \`/cc-view status\` — status is read-only and should not trigger sync or mutation paths.
102
102
  - Treating absence of delegation log as "all delegations complete".
103
103
  - Collapsing \`◎ missing-evidence\` into \`✓ completed\` — role-switch gaps must stay
104
104
  visible so the stage cannot advance silently.
105
105
  - Omitting the closeout row when \`shipSubstate !== "idle"\`; it is the only signal
106
- that tells the user why \`/cc\` is about to run retro/compound/archive.
106
+ that tells the user why \`/cc\` is about to run post-ship closeout/archive.
107
107
  - Mutating state to "clean up" during a status check.
108
108
  `;
109
109
  }
@@ -112,11 +112,166 @@ Use after the default reviewer/security-reviewer passes when repo signals identi
112
112
  - Keep the default general reviewer pass intact; this is additive context, not a replacement.
113
113
  `;
114
114
  }
115
+ function criticMultiPerspectiveSkill() {
116
+ return `${skillFrontmatter("critic-multi-perspective", "Multi-perspective critic protocol with pre-commitment predictions and realist checks.")}# Critic Multi-Perspective Pass
117
+
118
+ Use with the \`critic\` delegation in \`brainstorm\`, \`scope\`, and \`design\`.
119
+
120
+ ## Required Output
121
+
122
+ - Before investigation, emit \`predictions[]\` with explicit hypotheses.
123
+ - Analyze through context-aware angles:
124
+ - plan/spec/scope: executor, stakeholder, skeptic
125
+ - design/code: security, operator, new-hire
126
+ - Include a dedicated gap analysis (what is missing, not only what is wrong).
127
+ - Move low-confidence concerns (<=4/10) into \`openQuestions[]\`.
128
+ - For every critical/major concern, include a \`realistCheckResults[]\` verdict.
129
+ - End with \`predictionsValidated[]\` mapping each prediction to confirmed/disproven.
130
+
131
+ ## Guardrails
132
+
133
+ - Do not block solely on low-confidence concerns.
134
+ - Suppress or downgrade implausible critical findings during realist checks.
135
+ - Escalate to adversarial mode when reviewers disagree, confidence is low, or trust boundaries are involved.
136
+ `;
137
+ }
138
+ function documentCoherencePassSkill() {
139
+ return `${skillFrontmatter("document-coherence-pass", "Consistency-focused pass for cross-section coherence in spec/plan/design documents.")}# Document Coherence Pass
140
+
141
+ Use with \`coherence-reviewer\` on spec/plan/design artifacts.
142
+
143
+ ## Required Output
144
+
145
+ - List contradictions between sections and where they occur.
146
+ - Flag terminology drift where one concept is named inconsistently.
147
+ - Flag broken internal references, forward references, and dependency narrative mismatches.
148
+ - Return calibrated findings with concrete anchors and one-line corrections.
149
+
150
+ ## Guardrails
151
+
152
+ - Do not score overall quality; focus on consistency and coherence only.
153
+ - Do not invent contradictions without citation to concrete sections/lines.
154
+ `;
155
+ }
156
+ function documentScopeGuardSkill() {
157
+ return `${skillFrontmatter("document-scope-guard", "Complexity and minimum-change guardrail for scope/plan/design documents.")}# Document Scope Guard
158
+
159
+ Use with \`scope-guardian-reviewer\` when expansion pressure or abstraction creep is likely.
160
+
161
+ ## Required Output
162
+
163
+ - Surface where existing solutions can be reused instead of adding new abstractions.
164
+ - Identify minimum-change alternative when current proposal is broader than needed.
165
+ - Call out complexity smells (speculative generic utilities, framework-ahead-of-need structures).
166
+ - Return calibrated findings with explicit impact on scope boundaries.
167
+
168
+ ## Guardrails
169
+
170
+ - Challenge unnecessary breadth, but do not silently shrink required user outcomes.
171
+ - Tie every scope reduction recommendation to a concrete cost/risk rationale.
172
+ `;
173
+ }
174
+ function documentFeasibilityPassSkill() {
175
+ return `${skillFrontmatter("document-feasibility-pass", "Feasibility validation for runtime/resource/dependency assumptions in plan/design artifacts.")}# Document Feasibility Pass
176
+
177
+ Use with \`feasibility-reviewer\` on plan/design docs that rely on runtime or operational assumptions.
178
+
179
+ ## Required Output
180
+
181
+ - Enumerate resource/time/runtime assumptions and whether they are validated.
182
+ - Flag external dependency availability or reliability risks.
183
+ - Flag rollout assumptions that are not backed by operational evidence.
184
+ - Return PASS/PASS_WITH_GAPS/FAIL/BLOCKED rationale grounded in cited assumptions.
185
+
186
+ ## Guardrails
187
+
188
+ - Focus on practical viability; do not redesign architecture unless feasibility is blocked.
189
+ - Distinguish unknowns that need evidence from hard blockers that require rework.
190
+ `;
191
+ }
192
+ function reviewPerfLensSkill() {
193
+ return `${skillFrontmatter("review-perf-lens", "Optional deep performance lens for large or high-risk review surfaces.")}# Review Performance Lens
194
+
195
+ Use as an optional follow-up lens when the default reviewer pass flags non-trivial performance risk.
196
+
197
+ ## Required Output
198
+
199
+ - Hot-path or algorithmic-risk summary with touched files.
200
+ - Potential regressions and estimated blast radius.
201
+ - Clear NO_IMPACT or FOUND_<n> result with evidence.
202
+
203
+ ## Guardrails
204
+
205
+ - Run only when justified by diff scope or explicit trigger.
206
+ - Do not replace the mandatory reviewer pass; this lens is additive.
207
+ `;
208
+ }
209
+ function reviewCompatLensSkill() {
210
+ return `${skillFrontmatter("review-compat-lens", "Optional compatibility lens for high-risk API/config/schema changes.")}# Review Compatibility Lens
211
+
212
+ Use as an optional follow-up lens when contracts, config, persistence schema, or generated clients might break consumers.
213
+
214
+ ## Required Output
215
+
216
+ - Surface inventory: APIs/config/schema/CLI/client contracts touched.
217
+ - Compatibility risk assessment (backward, forward, migration path).
218
+ - Clear NO_IMPACT or FOUND_<n> result with evidence.
219
+
220
+ ## Guardrails
221
+
222
+ - Focus on externally observable contracts and migration safety.
223
+ - Do not duplicate baseline reviewer findings verbatim.
224
+ `;
225
+ }
226
+ function reviewObservabilityLensSkill() {
227
+ return `${skillFrontmatter("review-observability-lens", "Optional observability lens for diagnosability and rollback safety.")}# Review Observability Lens
228
+
229
+ Use as an optional follow-up lens when failure diagnosis, telemetry, or operational rollback confidence is at risk.
230
+
231
+ ## Required Output
232
+
233
+ - Signals checked: logs, metrics, traces, alerts, debug handles.
234
+ - Gaps that could block diagnosis or rollback during incidents.
235
+ - Clear NO_IMPACT or FOUND_<n> result with evidence.
236
+
237
+ ## Guardrails
238
+
239
+ - Escalate only diagnosis-impacting gaps; avoid style-only telemetry suggestions.
240
+ - Keep scope tied to touched code paths and rollout-critical behavior.
241
+ `;
242
+ }
243
+ function architectCrossStageVerificationSkill() {
244
+ return `${skillFrontmatter("architect-cross-stage-verification", "Cross-stage cohesion verification before ship finalization.")}# Architect Cross-Stage Verification
245
+
246
+ Use with the \`architect\` delegation in the \`ship\` stage.
247
+
248
+ ## Required Output
249
+
250
+ - Read scope/design/spec/plan/review artifacts plus shipped diff/code surfaces.
251
+ - Validate that locked decisions and acceptance mappings still match shipped behavior.
252
+ - Flag drift between intended architecture and implemented boundaries.
253
+ - Return exactly one status token: \`CROSS_STAGE_VERIFIED\`, \`DRIFT_DETECTED\`, or \`BLOCKED\`.
254
+ - Provide evidence refs for every drift claim and identify the smallest corrective route.
255
+
256
+ ## Guardrails
257
+
258
+ - Do not defer unresolved drift to post-ship follow-up without explicit waiver.
259
+ - If evidence is insufficient to verify cohesion, return \`BLOCKED\` with missing inputs.
260
+ `;
261
+ }
115
262
  export const SUBAGENT_CONTEXT_SKILLS = {
116
263
  "tdd-cycle-evidence": tddCycleEvidenceSkill(),
117
264
  "review-spec-pass": reviewSpecPassSkill(),
118
265
  "security-audit": securityAuditSkill(),
119
266
  "adversarial-review": adversarialReviewSkill(),
120
267
  "receiving-code-review": receivingCodeReviewSkill(),
121
- "stack-aware-review": stackAwareReviewSkill()
268
+ "stack-aware-review": stackAwareReviewSkill(),
269
+ "critic-multi-perspective": criticMultiPerspectiveSkill(),
270
+ "document-coherence-pass": documentCoherencePassSkill(),
271
+ "document-scope-guard": documentScopeGuardSkill(),
272
+ "document-feasibility-pass": documentFeasibilityPassSkill(),
273
+ "review-perf-lens": reviewPerfLensSkill(),
274
+ "review-compat-lens": reviewCompatLensSkill(),
275
+ "review-observability-lens": reviewObservabilityLensSkill(),
276
+ "architect-cross-stage-verification": architectCrossStageVerificationSkill()
122
277
  };
@@ -1,8 +1,3 @@
1
1
  export declare function subagentDrivenDevSkill(): string;
2
2
  export declare function parallelAgentsSkill(): string;
3
- /**
4
- * Returns markdown fragments augmenting each specialist persona with Task tool
5
- * delegation guidance. Combine with the existing `body` field from `core-agents.ts`.
6
- */
7
- export declare function enhancedAgentBody(agentName: string): string;
8
3
  export declare function subagentsAgentsMdBlock(): string;