cclaw-cli 0.51.29 → 0.55.2

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 (151) hide show
  1. package/README.md +22 -16
  2. package/dist/artifact-linter/brainstorm.d.ts +2 -0
  3. package/dist/artifact-linter/brainstorm.js +245 -0
  4. package/dist/artifact-linter/design.d.ts +2 -0
  5. package/dist/artifact-linter/design.js +323 -0
  6. package/dist/artifact-linter/plan.d.ts +2 -0
  7. package/dist/artifact-linter/plan.js +162 -0
  8. package/dist/artifact-linter/review-army.d.ts +24 -0
  9. package/dist/artifact-linter/review-army.js +365 -0
  10. package/dist/artifact-linter/review.d.ts +2 -0
  11. package/dist/artifact-linter/review.js +65 -0
  12. package/dist/artifact-linter/scope.d.ts +2 -0
  13. package/dist/artifact-linter/scope.js +115 -0
  14. package/dist/artifact-linter/shared.d.ts +246 -0
  15. package/dist/artifact-linter/shared.js +1488 -0
  16. package/dist/artifact-linter/ship.d.ts +2 -0
  17. package/dist/artifact-linter/ship.js +46 -0
  18. package/dist/artifact-linter/spec.d.ts +2 -0
  19. package/dist/artifact-linter/spec.js +108 -0
  20. package/dist/artifact-linter/tdd.d.ts +2 -0
  21. package/dist/artifact-linter/tdd.js +124 -0
  22. package/dist/artifact-linter.d.ts +4 -76
  23. package/dist/artifact-linter.js +56 -2949
  24. package/dist/cli.d.ts +2 -18
  25. package/dist/cli.js +8 -246
  26. package/dist/codex-feature-flag.d.ts +1 -1
  27. package/dist/codex-feature-flag.js +1 -1
  28. package/dist/config.d.ts +3 -2
  29. package/dist/config.js +67 -3
  30. package/dist/constants.d.ts +1 -7
  31. package/dist/constants.js +9 -15
  32. package/dist/content/cancel-command.js +2 -2
  33. package/dist/content/closeout-guidance.js +13 -10
  34. package/dist/content/core-agents.d.ts +18 -0
  35. package/dist/content/core-agents.js +51 -7
  36. package/dist/content/decision-protocol.d.ts +1 -1
  37. package/dist/content/decision-protocol.js +1 -1
  38. package/dist/content/examples.js +6 -6
  39. package/dist/content/harness-doc.js +20 -2
  40. package/dist/content/hook-inline-snippets.d.ts +17 -4
  41. package/dist/content/hook-inline-snippets.js +218 -5
  42. package/dist/content/hook-manifest.d.ts +2 -2
  43. package/dist/content/hook-manifest.js +2 -2
  44. package/dist/content/hooks.d.ts +1 -0
  45. package/dist/content/hooks.js +32 -137
  46. package/dist/content/idea-command.d.ts +8 -0
  47. package/dist/content/{ideate-command.js → idea-command.js} +57 -50
  48. package/dist/content/idea-frames.d.ts +31 -0
  49. package/dist/content/{ideate-frames.js → idea-frames.js} +9 -9
  50. package/dist/content/idea-ranking.d.ts +25 -0
  51. package/dist/content/{ideate-ranking.js → idea-ranking.js} +5 -5
  52. package/dist/content/iron-laws.d.ts +0 -1
  53. package/dist/content/iron-laws.js +31 -16
  54. package/dist/content/learnings.js +1 -1
  55. package/dist/content/meta-skill.js +11 -13
  56. package/dist/content/node-hooks.d.ts +10 -0
  57. package/dist/content/node-hooks.js +45 -11
  58. package/dist/content/opencode-plugin.js +3 -3
  59. package/dist/content/session-hooks.js +1 -1
  60. package/dist/content/skills.js +19 -7
  61. package/dist/content/stage-command.js +1 -1
  62. package/dist/content/stage-schema.js +44 -2
  63. package/dist/content/stages/_lint-metadata/index.js +26 -2
  64. package/dist/content/stages/brainstorm.js +13 -7
  65. package/dist/content/stages/design.js +16 -11
  66. package/dist/content/stages/plan.js +9 -6
  67. package/dist/content/stages/review.js +4 -4
  68. package/dist/content/stages/schema-types.d.ts +1 -1
  69. package/dist/content/stages/scope.js +15 -12
  70. package/dist/content/stages/ship.js +2 -2
  71. package/dist/content/stages/spec.js +9 -3
  72. package/dist/content/stages/tdd.js +14 -4
  73. package/dist/content/start-command.d.ts +2 -2
  74. package/dist/content/start-command.js +24 -21
  75. package/dist/content/status-command.js +8 -8
  76. package/dist/content/subagents.js +61 -7
  77. package/dist/content/templates.d.ts +1 -1
  78. package/dist/content/templates.js +104 -152
  79. package/dist/content/tree-command.js +2 -2
  80. package/dist/content/utility-skills.d.ts +2 -2
  81. package/dist/content/utility-skills.js +2 -2
  82. package/dist/content/view-command.js +4 -2
  83. package/dist/delegation.d.ts +2 -0
  84. package/dist/delegation.js +2 -1
  85. package/dist/early-loop.d.ts +66 -0
  86. package/dist/early-loop.js +275 -0
  87. package/dist/flow-state.d.ts +1 -1
  88. package/dist/flow-state.js +1 -1
  89. package/dist/gate-evidence.d.ts +8 -0
  90. package/dist/gate-evidence.js +141 -5
  91. package/dist/harness-adapters.d.ts +2 -2
  92. package/dist/harness-adapters.js +54 -122
  93. package/dist/harness-selection.d.ts +31 -0
  94. package/dist/harness-selection.js +214 -0
  95. package/dist/install.js +166 -38
  96. package/dist/internal/advance-stage/advance.d.ts +50 -0
  97. package/dist/internal/advance-stage/advance.js +480 -0
  98. package/dist/internal/advance-stage/cancel-run.d.ts +8 -0
  99. package/dist/internal/advance-stage/cancel-run.js +19 -0
  100. package/dist/internal/advance-stage/flow-state-coercion.d.ts +3 -0
  101. package/dist/internal/advance-stage/flow-state-coercion.js +81 -0
  102. package/dist/internal/advance-stage/helpers.d.ts +14 -0
  103. package/dist/internal/advance-stage/helpers.js +145 -0
  104. package/dist/internal/advance-stage/hook.d.ts +8 -0
  105. package/dist/internal/advance-stage/hook.js +40 -0
  106. package/dist/internal/advance-stage/parsers.d.ts +54 -0
  107. package/dist/internal/advance-stage/parsers.js +307 -0
  108. package/dist/internal/advance-stage/review-loop.d.ts +7 -0
  109. package/dist/internal/advance-stage/review-loop.js +170 -0
  110. package/dist/internal/advance-stage/rewind.d.ts +14 -0
  111. package/dist/internal/advance-stage/rewind.js +108 -0
  112. package/dist/internal/advance-stage/start-flow.d.ts +11 -0
  113. package/dist/internal/advance-stage/start-flow.js +136 -0
  114. package/dist/internal/advance-stage/verify.d.ts +29 -0
  115. package/dist/internal/advance-stage/verify.js +225 -0
  116. package/dist/internal/advance-stage.js +21 -1470
  117. package/dist/internal/compound-readiness.d.ts +1 -1
  118. package/dist/internal/compound-readiness.js +2 -2
  119. package/dist/internal/early-loop-status.d.ts +7 -0
  120. package/dist/internal/early-loop-status.js +90 -0
  121. package/dist/internal/runtime-integrity.d.ts +7 -0
  122. package/dist/internal/runtime-integrity.js +288 -0
  123. package/dist/internal/tdd-red-evidence.js +1 -1
  124. package/dist/knowledge-store.d.ts +3 -8
  125. package/dist/knowledge-store.js +16 -29
  126. package/dist/managed-resources.js +24 -2
  127. package/dist/policy.js +5 -7
  128. package/dist/run-archive.d.ts +1 -1
  129. package/dist/run-archive.js +16 -16
  130. package/dist/run-persistence.js +112 -12
  131. package/dist/tdd-cycle.d.ts +3 -3
  132. package/dist/tdd-cycle.js +1 -1
  133. package/dist/types.d.ts +18 -10
  134. package/package.json +1 -1
  135. package/dist/content/finish-command.d.ts +0 -2
  136. package/dist/content/finish-command.js +0 -26
  137. package/dist/content/ideate-command.d.ts +0 -8
  138. package/dist/content/ideate-frames.d.ts +0 -31
  139. package/dist/content/ideate-ranking.d.ts +0 -25
  140. package/dist/content/next-command.d.ts +0 -20
  141. package/dist/content/next-command.js +0 -298
  142. package/dist/content/seed-shelf.d.ts +0 -36
  143. package/dist/content/seed-shelf.js +0 -301
  144. package/dist/content/stage-common-guidance.d.ts +0 -1
  145. package/dist/content/stage-common-guidance.js +0 -106
  146. package/dist/doctor-registry.d.ts +0 -10
  147. package/dist/doctor-registry.js +0 -186
  148. package/dist/doctor.d.ts +0 -17
  149. package/dist/doctor.js +0 -2206
  150. package/dist/internal/hook-manifest.d.ts +0 -16
  151. package/dist/internal/hook-manifest.js +0 -77
@@ -5,8 +5,8 @@ export const PLAN = {
5
5
  schemaShape: "v2",
6
6
  stage: "plan",
7
7
  complexityTier: "standard",
8
- skillFolder: "planning-and-task-breakdown",
9
- skillName: "planning-and-task-breakdown",
8
+ skillFolder: "plan",
9
+ skillName: "plan",
10
10
  skillDescription: "Execution planning stage with strict confirmation gate before implementation.",
11
11
  philosophy: {
12
12
  hardGate: "Do NOT write code or tests. Planning only. This stage produces a task graph and execution order. WAIT_FOR_CONFIRM before any handoff to implementation.",
@@ -50,7 +50,7 @@ export const PLAN = {
50
50
  "Run anti-placeholder + anti-scope-reduction scans — block `TODO/TBD/...` and phrasing like `v1`, `for now`, `later` for locked boundaries.",
51
51
  "Define validation points — mark where progress must be checked before continuing, with concrete command and expected evidence.",
52
52
  "Define execution posture — record whether execution should be sequential, dependency-batched, parallel-safe, or blocked; include risk triggers and RED/GREEN/REFACTOR checkpoint/commit expectations when the repo workflow supports them. This fulfills the `plan_execution_posture_recorded` gate.",
53
- "WAIT_FOR_CONFIRM — write plan artifact and explicitly pause. **STOP.** Do NOT proceed until user confirms. Then close the stage with `node .cclaw/hooks/stage-complete.mjs plan` and tell user to run `/cc-next`."
53
+ "WAIT_FOR_CONFIRM — write plan artifact and explicitly pause. **STOP.** Do NOT proceed until user confirms. Then close the stage with `node .cclaw/hooks/stage-complete.mjs plan` and tell user to run `/cc`."
54
54
  ],
55
55
  interactionProtocol: [
56
56
  "Plan in read-only mode relative to implementation.",
@@ -61,7 +61,7 @@ export const PLAN = {
61
61
  "Preserve locked scope boundaries: no silent scope reduction language in task rows.",
62
62
  "Enforce WAIT_FOR_CONFIRM: present the plan summary with options (A) Approve / (B) Revise / (C) Reject.",
63
63
  "**STOP.** Do NOT proceed until user explicitly approves.",
64
- "**STOP BEFORE ADVANCE.** Mandatory delegation `planner` must be marked completed or explicitly waived in `.cclaw/state/delegation-log.json`. Then close the stage via `node .cclaw/hooks/stage-complete.mjs plan` and tell the user to run `/cc-next`."
64
+ "**STOP BEFORE ADVANCE.** Mandatory delegation `planner` must be marked completed or explicitly waived in `.cclaw/state/delegation-log.json`. Then close the stage via `node .cclaw/hooks/stage-complete.mjs plan` and tell the user to run `/cc`."
65
65
  ],
66
66
  process: [
67
67
  "Build dependency graph and ordered slices.",
@@ -69,6 +69,7 @@ export const PLAN = {
69
69
  "Define each task with acceptance mapping, verification command/manual step, and expected evidence/pass condition.",
70
70
  "Trace every locked decision (D-XX) to plan tasks or explicit defer rationale.",
71
71
  "Record validation points, blockers, and execution posture.",
72
+ "For high-risk/multi-batch plans, add a calibrated findings pass and explicit regression iron-rule acknowledgement.",
72
73
  "Write plan artifact and pause at WAIT_FOR_CONFIRM."
73
74
  ],
74
75
  requiredGates: [
@@ -132,9 +133,11 @@ export const PLAN = {
132
133
  { section: "Locked Decision Coverage", required: false, validationRule: "Every locked decision ID (D-XX) from scope is listed with linked task IDs or explicit defer rationale." },
133
134
  { section: "Risk Assessment", required: false, validationRule: "If present: per-task or per-batch risk identification with likelihood, impact, and mitigation strategy." },
134
135
  { section: "Boundary Map", required: false, validationRule: "If present: per-batch or per-task interface contracts listing what each task produces (exports) and consumes (imports) from other tasks." },
136
+ { section: "Implementation Units", required: false, validationRule: "If present: each `### Implementation Unit U-<n>` includes Goal, Files, Approach, Test scenarios, and Verification fields." },
137
+ { section: "Calibrated Findings", required: false, validationRule: "If present: either `None this stage` or one or more lines in `[P1|P2|P3] (confidence: <n>/10) <path>[:<line>] — <description>` format." },
138
+ { section: "Regression Iron Rule", required: false, validationRule: "If present: includes `Iron rule acknowledged: yes`." },
135
139
  { section: "WAIT_FOR_CONFIRM", required: true, validationRule: "Explicit marker present. Status: pending until user approves." },
136
- { section: "No-Placeholder Scan", required: false, validationRule: "Confirmation that a text scan for `TODO`, `TBD`, `FIXME`, `<fill-in>`, `<your-*-here>`, `xxx`, or bare ellipses has zero hits in the task list. A placeholder is a deferred decision masquerading as a plan." },
137
- { section: "No Scope Reduction Language Scan", required: false, validationRule: "Confirmation that scope-reduction phrases (`v1`, `for now`, `later`, `temporary`, `placeholder`) are absent from task rows when locked decisions exist." }
140
+ { section: "Plan Quality Scan", required: false, validationRule: "If present: includes a placeholder scan (`TODO`/`TBD`/`FIXME`/`<fill-in>`/`<your-*-here>`/`xxx`/bare ellipsis) and a scope-reduction language scan (`v1`, `for now`, `later`, `temporary`, `placeholder`) with zero hits in task rows when locked decisions exist." }
138
141
  ]
139
142
  },
140
143
  reviewLens: {
@@ -6,8 +6,8 @@ export const REVIEW = {
6
6
  schemaShape: "v2",
7
7
  stage: "review",
8
8
  complexityTier: "standard",
9
- skillFolder: "two-layer-review",
10
- skillName: "two-layer-review",
9
+ skillFolder: "review",
10
+ skillName: "review",
11
11
  skillDescription: "Two-layer review stage: spec compliance first, then code quality and production readiness. Section-by-section with severity discipline.",
12
12
  philosophy: {
13
13
  hardGate: "Do NOT ship, merge, or release until both review layers complete with an explicit verdict. No exceptions for urgency. Critical blockers MUST be resolved before handoff.",
@@ -47,7 +47,7 @@ export const REVIEW = {
47
47
  "Classify findings — Critical (blocks ship), Important (should fix), Suggestion (optional improvement).",
48
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.",
49
49
  "Produce verdict — APPROVED, APPROVED_WITH_CONCERNS, or BLOCKED.",
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>\"`, 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 `cclaw internal rewind --ack tdd` before `/cc-next`."
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
  ],
52
52
  interactionProtocol: [
53
53
  "Run Layer 1 (spec compliance) completely before starting Layer 2.",
@@ -55,7 +55,7 @@ export const REVIEW = {
55
55
  "Classify every finding as Critical, Important, or Suggestion.",
56
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),
57
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.",
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
+ "When verdict is BLOCKED, do not end with a passive stop: explicitly route remediation to TDD via `ROUTE_BACK_TO_TDD`, point to `npx cclaw-cli internal rewind tdd` with the blocking IDs, and tell the operator to ack the stale TDD marker only after rework is complete.",
59
59
  structuredAskSingleChoiceInstruction("final verdict", "verdict (APPROVED / APPROVED_WITH_CONCERNS / BLOCKED)"),
60
60
  "**STOP.** Do NOT proceed to ship until the user provides an explicit verdict."
61
61
  ],
@@ -20,7 +20,7 @@ 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";
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";
24
24
  export type StageSubagentDispatchClass = "stage-specialist" | "worker" | "review-lens";
25
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";
26
26
  export interface StageAutoSubagentDispatch {
@@ -1,4 +1,4 @@
1
- import { REVIEW_LOOP_CHECKLISTS, reviewLoopPolicySummary, reviewLoopSecondOpinionSummary } from "../review-loop.js";
1
+ import { REVIEW_LOOP_CHECKLISTS, reviewLoopPolicySummary } from "../review-loop.js";
2
2
  import { decisionProtocolInstruction } from "../decision-protocol.js";
3
3
  // ---------------------------------------------------------------------------
4
4
  // SCOPE — reference: gstack CEO review
@@ -7,8 +7,8 @@ export const SCOPE = {
7
7
  schemaShape: "v2",
8
8
  stage: "scope",
9
9
  complexityTier: "standard",
10
- skillFolder: "scope-shaping",
11
- skillName: "scope-shaping",
10
+ skillFolder: "scope",
11
+ skillName: "scope",
12
12
  skillDescription: "Strategic contract stage. Select HOLD/SELECTIVE/EXPAND/REDUCE mode, lock the slice and boundaries, and hand stable discretion zones to design.",
13
13
  philosophy: {
14
14
  hardGate: "Do NOT begin architecture, design, or code. This stage produces scope decisions only. Do not silently add or remove scope — every change is an explicit user opt-in.",
@@ -53,18 +53,19 @@ export const SCOPE = {
53
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.",
54
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.",
55
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.",
56
+ "**Run early Ralph loop discipline** — after each producer iteration, append a `Critic Pass` JSONL row to `.cclaw/state/early-loop-log.jsonl`, refresh `.cclaw/state/early-loop.json`, and iterate until open concerns clear or convergence guard escalates.",
56
57
  "**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.",
57
58
  "**Write the scope contract after approval** — include selected mode, in scope, out of scope, requirements, locked decisions, discretion areas, deferred ideas, accepted/rejected reference ideas, success definition, design handoff, completion dashboard, and explicit approval evidence."
58
59
  ],
59
60
  interactionProtocol: [
60
61
  decisionProtocolInstruction("scope mode selection", "present expand/selective/hold/reduce as labeled options with trade-offs and mark one as (recommended)", "recommend the option that best covers the prime-directive failure modes, four data-flow paths, observability, and deferred handling for the in-scope set with the smallest blast radius. Base your recommendation on default heuristics: greenfield -> expand, enhancement -> selective, bugfix/hotfix/refactor -> hold, broad blast radius -> reduce"),
61
62
  "Do not walk the full checklist by default. Lead with a proposed scope contract, selected depth (`lite`/`standard`/`deep`), and the one decision that matters most; label the mode as recommended, not selected, until the user answers.",
62
- "For simple web-app flows, default to HOLD SCOPE or SELECTIVE EXPANSION, show the exact in/out/deferred contract as a proposal, and STOP for one explicit approval before writing the final scope artifact or completing the stage.",
63
+ "For low-risk concrete asks, keep the proposal compact but still explicit: recommend (do not auto-select) one mode, show exact in/out/deferred boundaries, and STOP for one explicit approval before finalizing the artifact or completing the stage.",
63
64
  "Challenge premise first, take a firm position, and name one concrete condition that would change it.",
64
65
  "Push back on weak framing: vague scope needs a specific user/problem, platform vision needs a narrow wedge, social proof needs behavioral evidence.",
65
66
  "Resolve one structural scope issue at a time. Only non-critical preference/default assumptions may continue; STOP on uncertainty about scope boundary, architecture commitment, security, data loss, public API, migration, auth/pricing, or required user approval.",
66
67
  "If the user says no but cannot name the change, offer concrete moves: keep scope, add one obvious adjacent capability, reduce to wedge, or re-open stack/product direction.",
67
- `Before final approval, record outside-voice findings and a \`## Scope Outside Voice Loop\` table using ${reviewLoopPolicySummary("scope")}`,
68
+ "Before final approval, record outside-voice findings and a `## Scope Outside Voice Loop` table per the Scope Outside Voice Loop policy above.",
68
69
  "**STOP.** Wait for explicit user approval of the scope mode and scope contract before writing final approval language or advancing.",
69
70
  "**STOP BEFORE ADVANCE.** Mandatory delegation `planner` must be completed or explicitly waived for a real blocker. If the active harness cannot isolate a planner, run a role-switch planner pass instead: announce `## cclaw role-switch: scope/planner (mandatory)`, write the planner output/evidence into the scope artifact, and append a completed delegation row with `fulfillmentMode: \"role-switch\"` plus non-empty `evidenceRefs`. Then close with `node .cclaw/hooks/stage-complete.mjs scope --passed=scope_mode_selected,scope_contract_written,scope_user_approved --evidence-json '{\"scope_mode_selected\":\"<user-approved mode + rationale>\",\"scope_contract_written\":\"<artifact path + sections>\",\"scope_user_approved\":\"<explicit user approval quote or summary>\"}'`. `scope_user_approved` must cite the user's approval; review-loop evidence alone is not approval."
70
71
  ],
@@ -88,14 +89,16 @@ export const SCOPE = {
88
89
  "In-scope and out-of-scope lists are explicit.",
89
90
  "Discretion areas are explicit (or marked as `None`).",
90
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`.",
91
93
  "Scope Contract captures requirements, locked decisions, discretion areas, accepted/rejected/deferred reference ideas from the Reference Pattern Registry, success definition, and design handoff.",
92
94
  "Decision Drivers section records weighted criteria and per-option scores used to choose mode and boundary moves.",
93
95
  "Scope Completeness Score is recorded (0.00-1.00) with the explicit blocker list for any remaining uncertainty.",
94
96
  "Locked Decisions section lists stable LD#hash anchors for non-negotiable boundaries.",
95
97
  "Premise challenge findings documented.",
96
98
  "Outside Voice findings and dispositions are recorded (accept/reject/defer with rationale) before final approval.",
97
- `Scope outside-voice loop summary includes a table with columns Iteration, Quality Score, Findings, plus Stop reason, Target score, and Max iterations. This is outside-voice evidence only; it does not satisfy user approval. ${reviewLoopPolicySummary("scope")}`,
98
- reviewLoopSecondOpinionSummary("scope"),
99
+ "Scope outside-voice loop summary includes a table with columns Iteration, Quality Score, Findings, plus Stop reason, Target score, Max iterations, and unresolved concerns. This is outside-voice evidence only; it does not satisfy user approval.",
100
+ "Early-loop status is reflected via `Victory Detector` / `Critic Pass` sections and `.cclaw/state/early-loop.json` when concerns remain.",
101
+ "When a second opinion is used, record source, critique frame, and disposition (accept/reject/defer) with rationale.",
99
102
  "Deferred items list with one-line rationale for each.",
100
103
  "When an upside deferred idea is parked, a seed file is created under `.cclaw/seeds/` and referenced in the artifact.",
101
104
  "Completion dashboard lists per-section status, critical/open gaps, decision count, and unresolved items (or `None`).",
@@ -103,7 +106,7 @@ export const SCOPE = {
103
106
  ],
104
107
  inputs: ["brainstorm artifact", "timeline constraints", "product priorities"],
105
108
  requiredContext: [
106
- "approved brainstorm direction",
109
+ "approved brainstorm direction with selected option and non-goals",
107
110
  "existing capabilities and reusable components",
108
111
  "delivery deadlines and risk tolerance"
109
112
  ],
@@ -150,7 +153,7 @@ export const SCOPE = {
150
153
  { 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." },
151
154
  { 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
155
  { 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`." },
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." },
156
+ { section: "Reference Pull", required: false, validationRule: "Optional evidence heading: cite ideas pulled from `<repo-relative references dir>` or state no reference pull was needed for compact HOLD SCOPE." },
154
157
  { section: "Ambitious Alternatives", required: false, validationRule: "Optional evidence heading for SCOPE EXPANSION/SELECTIVE: list larger alternatives considered and their disposition." },
155
158
  { 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." },
156
159
  { section: "Requirements", required: false, validationRule: "Table of stable requirement IDs (R1, R2, R3…) one per row with observable outcome, priority, and source. IDs are assigned once and never renumbered across scope/design/spec/plan/review; dropped requirements stay with Priority `DROPPED`." },
@@ -164,10 +167,10 @@ export const SCOPE = {
164
167
  { section: "Error & Rescue Registry", required: false, validationRule: "Each scoped capability has: failure mode, detection method, fallback decision." },
165
168
  { section: "Outside Voice Findings", required: false, validationRule: "Must list external/adversarial findings and disposition (accept/reject/defer) with rationale." },
166
169
  { section: "Scope Outside Voice Loop", required: false, validationRule: `Must record iterations, quality score per iteration, stop reason, and unresolved concerns. Enforce ${reviewLoopPolicySummary("scope")}` },
170
+ { section: "Victory Detector", required: false, validationRule: "Recommended early-loop checkpoint: cite `.cclaw/state/early-loop.json`, current iteration/maxIterations, open concern count, convergence status, and iterate/ready/escalate decision." },
171
+ { section: "Critic Pass", required: false, validationRule: "Recommended producer/critic log contract: each iteration appends one JSONL row to `.cclaw/state/early-loop-log.jsonl` with runId, stage, iteration, and open concerns." },
167
172
  { section: "Completion Dashboard", required: true, validationRule: "Lists per-review-section status, count of critical/open gaps, resolved decisions, and unresolved decisions (or 'None')." },
168
- { section: "Scope Summary", required: true, validationRule: "Compact recap of the locked scope. Must name the selected mode using one canonical token, confidence, explicit drift from brainstorm, unresolved questions, and the track-aware next-stage handoff (`design` for standard, `spec` for medium); the linter checks structure, not English wording." },
169
- { section: "Dream State Mapping", required: false, validationRule: "Deep/optional only: CURRENT STATE, THIS PLAN, 12-MONTH IDEAL, and alignment verdict. Omit for compact scope." },
170
- { section: "Temporal Interrogation", required: false, validationRule: "Deep/optional only: timeline simulation table with decision pressures and lock-now vs defer verdicts. Omit for compact scope." }
173
+ { section: "Scope Summary", required: true, validationRule: "Compact recap of the locked scope. Must name the selected mode using one canonical token, confidence, explicit drift from brainstorm, unresolved questions, and the track-aware next-stage handoff (`design` for standard, `spec` for medium); the linter checks structure, not English wording." }
171
174
  ]
172
175
  },
173
176
  reviewLens: {
@@ -6,8 +6,8 @@ export const SHIP = {
6
6
  schemaShape: "v2",
7
7
  stage: "ship",
8
8
  complexityTier: "standard",
9
- skillFolder: "shipping-and-handoff",
10
- skillName: "shipping-and-handoff",
9
+ skillFolder: "ship",
10
+ skillName: "ship",
11
11
  skillDescription: "Release handoff stage with preflight checks, rollback readiness, and explicit finalization mode for both git and non-git workflows.",
12
12
  philosophy: {
13
13
  hardGate: "Do NOT merge, push, or finalize without a passed preflight check, written rollback plan, and exactly one explicit finalization mode selected. No exceptions for urgency. If no VCS is available, use FINALIZE_NO_VCS explicitly instead of inventing git steps.",
@@ -5,8 +5,8 @@ export const SPEC = {
5
5
  schemaShape: "v2",
6
6
  stage: "spec",
7
7
  complexityTier: "standard",
8
- skillFolder: "specification-authoring",
9
- skillName: "specification-authoring",
8
+ skillFolder: "spec",
9
+ skillName: "spec",
10
10
  skillDescription: "Specification stage. Produce measurable, testable requirements without ambiguity.",
11
11
  philosophy: {
12
12
  hardGate: "Do NOT plan tasks or write implementation code. This stage produces a specification document only. Every requirement must be expressed in observable, testable terms.",
@@ -42,6 +42,7 @@ export const SPEC = {
42
42
  "Document constraints and assumptions — regulatory, system, integration, and performance boundaries. Only non-critical preference/default assumptions may continue; STOP on uncertainty about scope, architecture, security, data loss, public API, migration, auth/pricing, or required user approval.",
43
43
  "Surface assumptions before finalization — list each assumption with source/confidence, validation path, and whether it is accepted, rejected, or still open.",
44
44
  "Build the Acceptance Mapping contract — for each AC, map upstream design decision, observable evidence, verification method, and likely test level. If any column is unclear, rewrite the criterion.",
45
+ "Run Spec Self-Review — explicitly verify placeholder/consistency/scope/ambiguity checks before approval.",
45
46
  "Present acceptance criteria to the user in 3-5-item batches, pausing for explicit ACK between batches (see Interaction Protocol).",
46
47
  "Write spec artifact and request user approval — wait for explicit confirmation before proceeding."
47
48
  ],
@@ -68,6 +69,7 @@ export const SPEC = {
68
69
  { id: "spec_acceptance_measurable", description: "Acceptance criteria are measurable and observable." },
69
70
  { id: "spec_testability_confirmed", description: "Each criterion has a described test method." },
70
71
  { id: "spec_assumptions_surfaced", description: "Assumptions were explicitly reviewed with source/confidence, validation path, and disposition before approval." },
72
+ { id: "spec_self_review_complete", description: "Spec Self-Review covers placeholder, consistency, scope, and ambiguity checks before approval." },
71
73
  { id: "spec_user_approved", description: "User approved the final written spec." }
72
74
  ],
73
75
  requiredEvidence: [
@@ -75,6 +77,7 @@ export const SPEC = {
75
77
  "Each acceptance criterion maps to upstream design decision, observable evidence, verification method, and likely test level.",
76
78
  "Edge cases documented per criterion.",
77
79
  "Assumptions Before Finalization section records source/confidence, validation path, and accepted/rejected/open disposition.",
80
+ "Spec Self-Review section covers placeholder, consistency, scope, and ambiguity checks with any patches noted.",
78
81
  "Approval marker captured in artifact.",
79
82
  "For quick bug-fix specs, reproduction contract records symptom, repro steps, expected RED test, and acceptance criterion."
80
83
  ],
@@ -119,9 +122,12 @@ export const SPEC = {
119
122
  { section: "Constraints and Assumptions", required: false, validationRule: "All implicit assumptions surfaced. Constraints have sources." },
120
123
  { section: "Assumptions Before Finalization", required: true, validationRule: "Each assumption has source/confidence, validation path, and accepted/rejected/open disposition before the Approval section is finalized." },
121
124
  { section: "Acceptance Mapping", required: true, validationRule: "Each criterion maps to upstream design decision, observable evidence, verification method, likely test level (unit/integration/e2e/manual), and command or manual steps when known." },
122
- { section: "Vague to Fixed", required: false, validationRule: "If present: table with original vague wording and rewritten observable/testable version for each ambiguous requirement." },
123
125
  { section: "Non-Functional Requirements", required: false, validationRule: "If present: performance thresholds, security constraints, scalability limits, reliability targets with measurable values." },
124
126
  { section: "Interface Contracts", required: false, validationRule: "If present: for each module boundary list produces (outputs) and consumes (inputs) with data types." },
127
+ { section: "Synthesis Sources", required: false, validationRule: "If present: cite at least one upstream/context source with what it supplied and confidence." },
128
+ { section: "Behavior Contract", required: false, validationRule: "If present: list >=3 behaviors in user-story or Given/When/Then shape (or `- None.` for single-step specs)." },
129
+ { section: "Architecture Modules", required: false, validationRule: "If present: module responsibilities only (no code fences or function/class signatures); keep module count within a single coherent subsystem." },
130
+ { section: "Spec Self-Review", required: true, validationRule: "Must explicitly cover placeholder, consistency, scope, and ambiguity checks plus applied patches/remaining concerns." },
125
131
  { section: "Approval", required: true, validationRule: "Explicit user approval marker present." }
126
132
  ]
127
133
  },
@@ -6,8 +6,8 @@ export const TDD = {
6
6
  schemaShape: "v2",
7
7
  stage: "tdd",
8
8
  complexityTier: "standard",
9
- skillFolder: "test-driven-development",
10
- skillName: "test-driven-development",
9
+ skillFolder: "tdd",
10
+ skillName: "tdd",
11
11
  skillDescription: "Full vertical-slice TDD cycle: discover existing tests and system impact, then RED (failing tests), GREEN (minimal implementation), REFACTOR (cleanup). One source item at a time with strict traceability.",
12
12
  philosophy: {
13
13
  hardGate: "Do NOT merge, ship, or skip review. Follow RED → GREEN → REFACTOR strictly for each plan slice. Do NOT write implementation code before RED tests exist. Do NOT write RED tests before discovering relevant existing tests and impacted contracts. Do NOT skip the REFACTOR step.",
@@ -70,7 +70,7 @@ export const TDD = {
70
70
  "Use incremental RED/GREEN/REFACTOR commits when the repository workflow and working tree make that appropriate; otherwise record the checkpoint boundaries in the artifact.",
71
71
  "Stop if regressions appear and fix before proceeding.",
72
72
  "If a test passes unexpectedly, investigate: does the behavior already exist, or is the test wrong?",
73
- "**Per-Slice Review point (conditional, opt-in).** When `.cclaw/config.yaml::sliceReview.enabled` is true, check every slice against the triggers before declaring it DONE. Triggers: `touchCount >= filesChangedThreshold`, any `touchPaths` match a `touchTriggers` glob, or the plan row declares `highRisk: true`. On a trigger, run two passes on the slice alone — (1) Spec-Compliance: trace RED/GREEN/REFACTOR evidence back to its plan task + spec criterion, noting edge cases the tests skip; (2) Quality: diff-scan for naming, error handling, dead code, simpler alternatives. Record both under `## Per-Slice Review` in `06-tdd.md`, naming the trigger that fired. Dispatch the `reviewer` subagent natively when available (log `fulfillmentMode: \"isolated\"`); otherwise fulfil via in-session role switch (`fulfillmentMode: \"role-switch\"`). Never fabricate an isolated pass from memory. Tracks outside `sliceReview.enforceOnTracks` still emit the section; doctor only escalates missed reviews on enforced tracks."
73
+ "**Per-Slice Review point (conditional, opt-in).** When `.cclaw/config.yaml::sliceReview.enabled` is true, check every slice against the triggers before declaring it DONE. Triggers: `touchCount >= filesChangedThreshold`, any `touchPaths` match a `touchTriggers` glob, or the plan row declares `highRisk: true`. On a trigger, run two passes on the slice alone — (1) Spec-Compliance: trace RED/GREEN/REFACTOR evidence back to its plan task + spec criterion, noting edge cases the tests skip; (2) Quality: diff-scan for naming, error handling, dead code, simpler alternatives. Record both under `## Per-Slice Review` in `06-tdd.md`, naming the trigger that fired. Dispatch the `reviewer` subagent natively when available (log `fulfillmentMode: \"isolated\"`); otherwise fulfil via in-session role switch (`fulfillmentMode: \"role-switch\"`). Never fabricate an isolated pass from memory. Tracks outside `sliceReview.enforceOnTracks` still emit the section; sync only escalates missed reviews on enforced tracks."
74
74
  ],
75
75
  process: [
76
76
  "Select one vertical slice and map it to acceptance criterion(s).",
@@ -93,6 +93,9 @@ export const TDD = {
93
93
  { id: "tdd_green_full_suite", description: "Full relevant suite passes in GREEN state." },
94
94
  { id: "tdd_refactor_completed", description: "Refactor pass completed with behavior preservation verified." },
95
95
  { id: "tdd_verified_before_complete", description: "Fresh verification evidence includes test command, explicit pass/fail status, and a config-aware ref: commit SHA when VCS is present/required or an explicit no-VCS attestation when allowed." },
96
+ { id: "tdd_iron_law_acknowledged", description: "Iron Law acknowledgement is explicit (`Acknowledged: yes`) before implementation proceeds." },
97
+ { id: "tdd_watched_red_observed", description: "Watched-RED Proof records at least one observed failing test with ISO timestamp evidence." },
98
+ { id: "tdd_slice_cycle_complete", description: "Vertical Slice Cycle records RED, GREEN, and REFACTOR phases per active slice." },
96
99
  { id: "tdd_traceable_to_plan", description: "Change traceability to plan slice is explicit." },
97
100
  { id: "tdd_docs_drift_check", description: "When public API/config/CLI surfaces change, docs drift is addressed via a completed doc-updater pass." }
98
101
  ],
@@ -104,6 +107,9 @@ export const TDD = {
104
107
  "Failing command output captured (RED).",
105
108
  "Full test/build output recorded (GREEN).",
106
109
  "Fresh verification evidence recorded with command, PASS/FAIL status, and config-aware commit SHA or no-VCS reason plus content/artifact hash before completion.",
110
+ "Iron Law Acknowledgement section explicitly states `Acknowledged: yes`.",
111
+ "Watched-RED Proof includes at least one populated row with an ISO timestamp.",
112
+ "Vertical Slice Cycle records RED, GREEN, and REFACTOR per active slice.",
107
113
  "Acceptance mapping documented.",
108
114
  "Failure reason analysis recorded.",
109
115
  "Refactor rationale captured.",
@@ -155,10 +161,14 @@ export const TDD = {
155
161
  { section: "GREEN Evidence", required: true, validationRule: "Full suite pass output captured." },
156
162
  { section: "REFACTOR Notes", required: true, validationRule: "What changed, why, behavior preservation confirmed." },
157
163
  { section: "Traceability", required: true, validationRule: "Plan task ID and spec criterion linked." },
164
+ { section: "Iron Law Acknowledgement", required: true, validationRule: "Must include `Acknowledged: yes` and list exceptions (or `None`)." },
165
+ { section: "Watched-RED Proof", required: true, validationRule: "At least one populated row with ISO timestamp proving RED was observed before production edits." },
166
+ { section: "Vertical Slice Cycle", required: true, validationRule: "Per active slice records RED, GREEN, and REFACTOR timestamps (refactor may be deferred only with explicit rationale)." },
158
167
  { section: "Verification Ladder", required: true, validationRule: "Per-slice verification tier (static, command, behavioral, human) with evidence captured for the highest tier reached this turn. Must include command + PASS/FAIL + commit SHA when VCS is present, or explicit no-vcs reason plus content/artifact hash/config override." },
159
168
  { section: "TDD Blocker Taxonomy", required: false, validationRule: "When blocked, classify as NO_SOURCE_CONTEXT, NO_TEST_SURFACE, NO_IMPLEMENTABLE_SLICE, RED_NOT_EXPRESSIBLE, or NO_VCS_MODE; include blockedBecause, missingInputs, recommendedRoute, nextCommand, and resumeCriteria." },
160
169
  { section: "Coverage Targets", required: false, validationRule: "If present: per-module or per-code-type coverage thresholds with current values and measurement commands." },
161
170
  { section: "Test Pyramid Shape", required: false, validationRule: "If present: per-slice count of Small/Medium/Large tests added, to let reviewers verify the suite is not drifting top-heavy." },
171
+ { section: "Mock Preference Order", required: false, validationRule: "When mocks/spies appear in Test Discovery or RED Evidence, prefer Real > Fake > Stub > Mock. Mock-heavy slices should include explicit boundary justification (for example network/fs/time/external trust boundaries)." },
162
172
  { section: "Prove-It Reproduction", required: false, validationRule: "Required for bug-fix slices: original failing reproduction test (RED without fix), passing output with fix (GREEN), and a note confirming the test fails again if the fix is reverted." },
163
173
  { section: "Per-Slice Review", required: false, validationRule: "When `.cclaw/config.yaml::sliceReview.enabled` is true: per triggered slice, a two-part record — Spec-Compliance (slice <-> plan task <-> spec criterion trace plus edge-case notes) and Quality (diff-focused review of naming, error handling, dead code, simpler alternatives). Each entry names the trigger (touchCount, touchPaths glob, or highRisk) and the delegation fulfillmentMode (`isolated` when a reviewer subagent was dispatched natively; `role-switch` when fulfilled in-session). Slices that did not meet any trigger may list `not triggered` instead of a full pass." }
164
174
  ]
@@ -216,7 +226,7 @@ export const TDD = {
216
226
  evaluationPoints: [
217
227
  "When `.cclaw/config.yaml::sliceReview.enabled` is true: does every triggered slice (touchCount >= threshold, touchPaths match, or highRisk=true) carry a Per-Slice Review entry with BOTH a Spec-Compliance pass (plan task <-> spec criterion + edge-case notes) AND a Quality pass (diff-level naming/errors/dead code/simpler alternatives)?",
218
228
  "Is the delegation `fulfillmentMode` recorded (`isolated` for a dispatched reviewer subagent, `role-switch` for an in-session pass) and does it match an entry in `.cclaw/state/delegation-log.json`?",
219
- "On tracks listed in `sliceReview.enforceOnTracks`, are there zero missed triggered slices (doctor also surfaces this as a warning)?"
229
+ "On tracks listed in `sliceReview.enforceOnTracks`, are there zero missed triggered slices (sync also surfaces this as a warning)?"
220
230
  ],
221
231
  stopGate: false
222
232
  },
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Command contract for /cc — the unified entry point.
3
- * No args → reads existing flow state and behaves like /cc-next only when a
4
- * tracked flow already exists; missing state/fresh placeholder state blocks with
3
+ * No args → reads existing flow state and progresses it when a tracked flow
4
+ * already exists; missing state/fresh placeholder state blocks with
5
5
  * init/start guidance. With prompt → classifies the idea, selects a track, and
6
6
  * starts the first stage of that track (brainstorm for medium/standard, spec for quick).
7
7
  */
@@ -7,8 +7,8 @@ function flowStatePath() {
7
7
  }
8
8
  /**
9
9
  * Command contract for /cc — the unified entry point.
10
- * No args → reads existing flow state and behaves like /cc-next only when a
11
- * tracked flow already exists; missing state/fresh placeholder state blocks with
10
+ * No args → reads existing flow state and progresses it when a tracked flow
11
+ * already exists; missing state/fresh placeholder state blocks with
12
12
  * init/start guidance. With prompt → classifies the idea, selects a track, and
13
13
  * starts the first stage of that track (brainstorm for medium/standard, spec for quick).
14
14
  */
@@ -20,10 +20,10 @@ export function startCommandContract() {
20
20
 
21
21
  **The unified entry point for the cclaw flow.**
22
22
 
23
- - \`/cc\` (no arguments) → reads existing flow state and resumes/progresses it through \`/cc-next\`. If flow state is missing or still a fresh init placeholder, stop and guide the user to run \`/cc <prompt>\` or \`cclaw init\`; do not silently create a brainstorm run.
23
+ - \`/cc\` (no arguments) → reads existing flow state and resumes/progresses the active flow. If flow state is missing or still a fresh init placeholder, stop and guide the user to run \`/cc <prompt>\` or \`npx cclaw-cli init\`; do not silently create a brainstorm run.
24
24
  - \`/cc <prompt>\` (with an idea/description) → saves the prompt as idea context and starts the first stage of the resolved track.
25
25
 
26
- This is the **recommended way to start** working with cclaw. Use \`/cc-next\` for subsequent stage progression.
26
+ This is the **recommended way to start, resume, and continue** working with cclaw.
27
27
 
28
28
  ## HARD-GATE
29
29
 
@@ -81,7 +81,7 @@ ${conversationLanguagePolicyMarkdown()}
81
81
  - **standard** (full 8 stages — default fallback) — anything that introduces a new capability with architecture uncertainty, touches many modules, or has unclear scope.
82
82
  Triggers: \`new feature\`, \`refactor\`, \`migration\`, \`platform\`, \`architecture\`, \`schema\`, \`integrate\`, \`workflow\`, \`onboarding\`, or any prompt that does not match quick/medium confidently.
83
83
  - When triggers conflict, prefer **standard** over **medium**, and **medium** over **quick**.
84
- - Report **track selection confidence** as high/medium/low with the matched trigger or fallback reason, plus one sentence explaining what the selected track skips and what safety gates remain. Be explicit that this recommendation is advisory until the user accepts and the managed helper writes state; after that, \`/cc-next\` follows the configured track.
84
+ - Report **track selection confidence** as high/medium/low with the matched trigger or fallback reason, plus one sentence explaining what the selected track skips and what safety gates remain. Be explicit that this recommendation is advisory until the user accepts and the managed helper writes state; after that, \`/cc\` follows the configured track.
85
85
  8. Present one compact **Start framing** summary: class, recommended track, track selection confidence, stack, origin docs, seed recalls, and the recommended next action. Ask a single confirmation question only when there is a destructive reset, a real contradiction, or ambiguous software/non-software classification.
86
86
  9. Present the recommendation as a single decision with explicit options:
87
87
  > \`Recommended track: <quick|medium|standard>\` because \`<one-line reason citing matched triggers>\`.
@@ -93,8 +93,8 @@ ${conversationLanguagePolicyMarkdown()}
93
93
  If this helper fails, STOP and report the exact command/output. Do **not** manually edit \`${flowPath}\`.
94
94
  11. The helper persists \`${flowPath}\`, computes \`skippedStages\`, sets the first stage for the track, resets the gate catalog, and writes \`.cclaw/artifacts/00-idea.md\`.
95
95
  12. Load the **first-stage skill for the chosen track** and its command file:
96
- - quick → \`.cclaw/skills/specification-authoring/SKILL.md\`
97
- - medium/standard → \`.cclaw/skills/brainstorming/SKILL.md\`
96
+ - quick → \`.cclaw/skills/spec/SKILL.md\`
97
+ - medium/standard → \`.cclaw/skills/brainstorm/SKILL.md\`
98
98
  - trivial fast-path → quick track spec skill per Phase 0 decision.
99
99
  13. Execute that stage with the prompt + Phase 1/Phase 2 + seed context as initial input.
100
100
 
@@ -110,21 +110,22 @@ If during any stage the agent discovers evidence that contradicts the initial Ph
110
110
  ### Without prompt (\`/cc\`)
111
111
 
112
112
  1. Read \`${flowPath}\`.
113
- 2. If flow state is missing → guide the user to run \`cclaw init\` and stop.
113
+ 2. If flow state is missing → guide the user to run \`npx cclaw-cli init\` and stop.
114
114
  3. If flow state is only a fresh init placeholder (\`completedStages: []\`, all \`passed\` arrays empty, and no \`00-idea.md\`) → stop and ask for \`/cc <prompt>\` to start a tracked run. Do not create a brainstorm state implicitly.
115
- 4. Otherwise behave exactly like \`/cc-next\`: check current stage gates, resume if incomplete, advance if complete.
115
+ 4. Otherwise check current stage gates, resume if incomplete, and advance if complete.
116
116
 
117
- ## Headless mode
117
+ ## Headless mode (CI/automation only)
118
118
 
119
- When called by another skill or subagent in machine mode, emit exactly one
120
- JSON envelope (no prose) and stop:
119
+ Headless envelopes are a machine-mode exception for CI/automation orchestration.
120
+ In normal interactive runs, respond in natural language instead of emitting an envelope.
121
+ When called by another skill or subagent in machine mode, emit exactly one JSON envelope (no prose) and stop:
121
122
 
122
123
  \`\`\`json
123
124
  {"version":"1","kind":"stage-output","stage":"<currentStage>","payload":{"command":"/cc","track":"<track>","action":"start_or_resume"},"emittedAt":"<ISO-8601>"}
124
125
  \`\`\`
125
126
 
126
127
  Validate envelopes with:
127
- \`cclaw internal envelope-validate --stdin\`
128
+ \`npx cclaw-cli internal envelope-validate --stdin\`
128
129
 
129
130
  ## Primary skill
130
131
 
@@ -151,7 +152,7 @@ description: "Unified entry point for the cclaw flow. No args = resume/next. Wit
151
152
 
152
153
  \`/cc\` is the **starting command** for cclaw. It intelligently routes:
153
154
 
154
- - **No arguments** → acts as \`/cc-next\` only for an existing tracked flow; missing/fresh placeholder state blocks with start guidance
155
+ - **No arguments** → resumes or progresses an existing tracked flow; missing/fresh placeholder state blocks with start guidance
155
156
  - **With a prompt** → classifies the task, picks a track (quick/medium/standard), and starts the **first stage of that track** (not always brainstorm — e.g. the \`quick\` track starts at \`spec\`)
156
157
 
157
158
  ## HARD-GATE
@@ -185,9 +186,9 @@ ${conversationLanguagePolicyMarkdown()}
185
186
  | \`standard\` | \`new feature\`, \`refactor\`, \`migration\`, \`platform\`, \`architecture\`, \`schema\`, \`integrate\`, \`workflow\`, \`onboarding\` (or no confident quick/medium match) | New or uncertain multi-module work |
186
187
 
187
188
  - On conflict, prefer \`standard\` over \`medium\`, and \`medium\` over \`quick\`.
188
- - Always state the recommendation as a one-line reason citing matched triggers and a high/medium/low track selection confidence. Clarify that the heuristic is advisory until the managed helper writes state; after that, \`/cc-next\` follows the selected track. Include override guidance: switch to standard when architecture, schema, migration, security, or unclear scope appears; switch to medium when product framing is needed but architecture is known.
189
+ - Always state the recommendation as a one-line reason citing matched triggers and a high/medium/low track selection confidence. Clarify that the heuristic is advisory until the managed helper writes state; after that, \`/cc\` follows the selected track. Include override guidance: switch to standard when architecture, schema, migration, security, or unclear scope appears; switch to medium when product framing is needed but architecture is known.
189
190
  8. Run the managed start helper: \`node .cclaw/hooks/start-flow.mjs --track=<quick|medium|standard> --class=<class> --prompt=<prompt> --stack=<stack> --reason=<matched heuristic>\`. The helper writes \`${flowPath}\`, computes \`skippedStages\`, resets the gate catalog, and writes \`${RUNTIME_ROOT}/artifacts/00-idea.md\`. If it fails, STOP and report the exact command/output; do not manually edit flow state.
190
- 9. Load and execute the **first stage skill of the chosen track** (\`brainstorming\` for medium/standard, \`specification-authoring\` for quick) plus its matching command file.
191
+ 9. Load and execute the **first stage skill of the chosen track** (\`brainstorm\` for medium/standard, \`spec\` for quick) plus its matching command file.
191
192
 
192
193
  ### Reclassification on discovery
193
194
 
@@ -195,25 +196,27 @@ If mid-stage evidence contradicts the initial Class/Track decision (the "trivial
195
196
 
196
197
  ### Path B: \`/cc\` (no arguments)
197
198
 
198
- Delegate to \`/cc-next\` behavior only when a tracked flow exists:
199
+ Progress the tracked flow only when one exists:
199
200
 
200
201
  1. Read \`${flowPath}\`.
201
- 2. If missing, guide the user to run \`cclaw init\` and stop.
202
+ 2. If missing, guide the user to run \`npx cclaw-cli init\` and stop.
202
203
  3. If it is only a fresh init placeholder (\`completedStages: []\`, no passed gates, and no \`${RUNTIME_ROOT}/artifacts/00-idea.md\`), stop and ask for \`/cc <prompt>\` to start a tracked run. Do not silently create a brainstorm run.
203
204
  4. Check gates for \`currentStage\`.
204
205
  5. If incomplete → load current stage skill and execute.
205
206
  6. If complete → advance to next stage and execute.
206
207
  7. If flow is done → report completion.
207
208
 
208
- ## When to use \`/cc\` vs \`/cc-next\`
209
+ ## Public flow habit
210
+
211
+ Use \`/cc\` for the happy path:
209
212
 
210
213
  | Scenario | Command |
211
214
  |---|---|
212
215
  | Starting work for the first time | \`/cc\` or \`/cc <idea>\` |
213
216
  | Resuming in a new session | \`/cc\` |
214
- | Progressing after completing a stage | \`/cc-next\` |
217
+ | Progressing after completing a stage | \`/cc\` |
215
218
  | Starting with a specific idea | \`/cc <idea>\` |
216
219
 
217
- Both commands read the same \`flow-state.json\`. The difference is that \`/cc <prompt>\` resolves class + track and starts that track's first stage, while \`/cc\` and \`/cc-next\` follow the current state.
220
+ \`/cc <prompt>\` resolves class + track and starts that track's first stage; \`/cc\` without a prompt follows the current \`flow-state.json\`.
218
221
  `;
219
222
  }
@@ -45,7 +45,7 @@ a read-only command.
45
45
 
46
46
  ## Algorithm
47
47
 
48
- 1. Read \`${flowPath}\`. If missing → report **BLOCKED: flow state absent** and suggest \`cclaw init\`.
48
+ 1. Read \`${flowPath}\`. If missing → report **BLOCKED: flow state absent** and suggest \`npx cclaw-cli init\`.
49
49
  2. Read \`${delegationPath}\`. Missing → treat all mandatory delegations as pending.
50
50
  3. Render **time in stage** as \`(unknown)\` unless visible conversation or
51
51
  artifact handoff context gives a timestamp.
@@ -78,17 +78,17 @@ a read-only command.
78
78
  - harness row
79
79
  - stale stage row
80
80
  11. Suggest the next action:
81
- - If current stage has unmet gates -> \`/cc-next\` to resume.
81
+ - If current stage has unmet gates -> \`/cc\` to resume.
82
82
  - If a mandatory delegation is missing evidence -> dispatch the worker/reviewer or waive with rationale; do not advance silently.
83
83
  - If a TDD blocker taxonomy code is present (\`NO_SOURCE_CONTEXT\`, \`NO_TEST_SURFACE\`, \`NO_IMPLEMENTABLE_SLICE\`, \`RED_NOT_EXPRESSIBLE\`, \`NO_VCS_MODE\`) -> name the blocker and the rewind/config route.
84
- - If review is blocked by critical findings -> show \`cclaw internal rewind tdd "review_blocked_by_critical <finding-ids>"\` plus the later \`cclaw internal rewind --ack tdd\`.
85
- - If closeout substate is non-idle -> \`/cc-next\` to continue the chain.
86
- - If current stage is complete -> \`/cc-next\` to advance (or report "Flow complete" if terminal).
84
+ - If review is blocked by critical findings -> show \`npx cclaw-cli internal rewind tdd "review_blocked_by_critical <finding-ids>"\` plus the later \`npx cclaw-cli internal rewind --ack tdd\`.
85
+ - If closeout substate is non-idle -> \`/cc\` to continue the chain.
86
+ - If current stage is complete -> \`/cc\` to advance (or report "Flow complete" if terminal).
87
87
 
88
88
  ## Output Guidelines
89
89
 
90
90
  - Keep output compact (≤ 40 lines) — status, not narrative.
91
- - Start with the same operator rows as \`/cc-next\` when possible:
91
+ - Start with the same operator rows as \`/cc\` when possible:
92
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.
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>\`.
@@ -98,12 +98,12 @@ a read-only command.
98
98
 
99
99
  ## Anti-patterns
100
100
 
101
- - Rebuilding trace-matrix or running doctor from \`/cc-view status\` — those belong to dedicated tools.
101
+ - Rebuilding trace-matrix or running sync from \`/cc-view status\` — those belong to dedicated tools.
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-next\` is about to run retro/compound/archive.
106
+ that tells the user why \`/cc\` is about to run retro/compound/archive.
107
107
  - Mutating state to "clean up" during a status check.
108
108
  `;
109
109
  }