cclaw-cli 0.48.27 → 0.48.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { stageSchema } from "./stage-schema.js";
1
+ import { stagePolicyNeedles, stageSchema } from "./stage-schema.js";
2
2
  import { stageSkillFolder } from "./skills.js";
3
3
  export function stageCommandContract(stage, track = "standard") {
4
4
  const schema = stageSchema(stage, track);
@@ -17,6 +17,7 @@ export function stageCommandContract(stage, track = "standard") {
17
17
  const writeStepPaths = writes.length > 1
18
18
  ? writes.map((w) => `\`${w}\``).join(" and ")
19
19
  : `\`${primaryArtifact}\``;
20
+ const policyNeedles = stagePolicyNeedles(stage, track);
20
21
  return `# /cc-${stage}
21
22
 
22
23
  Load and follow **${skillPath}** — it contains the full checklist, examples, interaction protocol, and verification discipline.
@@ -45,6 +46,6 @@ ${gateIds}
45
46
  ${schema.exitCriteria.map((v) => `- ${v}`).join("\n")}
46
47
 
47
48
  ## Anchors
48
- ${schema.policyNeedles.map((v) => `- ${v}`).join("\n")}
49
+ ${policyNeedles.map((v) => `- ${v}`).join("\n")}
49
50
  `;
50
51
  }
@@ -1,6 +1,6 @@
1
1
  import type { FlowStage, FlowTrack, TransitionRule } from "../types.js";
2
2
  import type { StageComplexityTier, StageAutoSubagentDispatch, StageSchema } from "./stages/schema-types.js";
3
- export type { ArtifactValidation, CrossStageTrace, ReviewSection, StageComplexityTier, StageExecutionModel, StagePhilosophy, StageArtifactRules, StageReviewLens, StageAutoSubagentDispatch, StageGate, StageSchema, StageSchemaInput } from "./stages/schema-types.js";
3
+ export type { ArtifactValidation, CrossStageTrace, ReviewSection, StageComplexityTier, StageExecutionModel, StagePhilosophy, StageArtifactRules, StageReviewLens, StageAutoSubagentDispatch, StageGate, StageSchemaLegacyInput, StageSchema, StageSchemaInput, StageSchemaV2Input } from "./stages/schema-types.js";
4
4
  export declare const SKILL_ENVELOPE_KINDS: readonly ["stage-output", "gate-result", "delegation-record"];
5
5
  export type SkillEnvelopeKind = (typeof SKILL_ENVELOPE_KINDS)[number];
6
6
  export interface SkillEnvelope {
@@ -1,6 +1,7 @@
1
1
  import { FLOW_STAGES, FLOW_TRACKS, TRACK_STAGES } from "../types.js";
2
2
  import { STAGE_TO_SKILL_FOLDER } from "../constants.js";
3
3
  import { BRAINSTORM, SCOPE, DESIGN, SPEC, PLAN, TDD, REVIEW, SHIP } from "./stages/index.js";
4
+ import { stagePolicyNeedlesFromMetadata } from "./stages/_lint-metadata/index.js";
4
5
  import { tddStageForTrack } from "./stages/tdd.js";
5
6
  // ---------------------------------------------------------------------------
6
7
  // NOTE: The former QUESTION_FORMAT_SPEC / ERROR_BUDGET_SPEC exports were
@@ -178,6 +179,46 @@ function readsFromForTrack(readsFrom, track) {
178
179
  return stageSet.has(stage);
179
180
  });
180
181
  }
182
+ function isStageSchemaV2Input(value) {
183
+ return value.schemaShape === "v2";
184
+ }
185
+ function normalizeStageSchemaInput(value) {
186
+ if (!isStageSchemaV2Input(value)) {
187
+ return value;
188
+ }
189
+ return {
190
+ stage: value.stage,
191
+ skillFolder: value.skillFolder,
192
+ skillName: value.skillName,
193
+ skillDescription: value.skillDescription,
194
+ complexityTier: value.complexityTier,
195
+ hardGate: value.philosophy.hardGate,
196
+ ironLaw: value.philosophy.ironLaw,
197
+ purpose: value.philosophy.purpose,
198
+ whenToUse: value.philosophy.whenToUse,
199
+ whenNotToUse: value.philosophy.whenNotToUse,
200
+ interactionProtocol: value.executionModel.interactionProtocol,
201
+ process: value.executionModel.process,
202
+ requiredGates: value.executionModel.requiredGates,
203
+ requiredEvidence: value.executionModel.requiredEvidence,
204
+ inputs: value.executionModel.inputs,
205
+ requiredContext: value.executionModel.requiredContext,
206
+ researchPlaybooks: value.executionModel.researchPlaybooks,
207
+ outputs: value.reviewLens.outputs,
208
+ blockers: value.executionModel.blockers,
209
+ exitCriteria: value.executionModel.exitCriteria,
210
+ commonRationalizations: value.philosophy.commonRationalizations,
211
+ artifactFile: value.artifactRules.artifactFile,
212
+ next: value.next,
213
+ checklist: value.executionModel.checklist,
214
+ reviewSections: value.reviewLens.reviewSections,
215
+ completionStatus: value.artifactRules.completionStatus,
216
+ crossStageTrace: value.artifactRules.crossStageTrace,
217
+ artifactValidation: value.artifactRules.artifactValidation,
218
+ batchExecutionAllowed: value.batchExecutionAllowed,
219
+ trivialOverrideSections: value.artifactRules.trivialOverrideSections
220
+ };
221
+ }
181
222
  // ---------------------------------------------------------------------------
182
223
  // Stage map and accessors
183
224
  // ---------------------------------------------------------------------------
@@ -357,7 +398,8 @@ export function mandatoryDelegationsForStage(stage, complexityTier = "standard")
357
398
  .map((d) => d.agent))];
358
399
  }
359
400
  export function stageSchema(stage, track = "standard") {
360
- const base = stage === "tdd" ? tddStageForTrack(track) : STAGE_SCHEMA_MAP[stage];
401
+ const rawInput = stage === "tdd" ? tddStageForTrack(track) : STAGE_SCHEMA_MAP[stage];
402
+ const base = normalizeStageSchemaInput(rawInput);
361
403
  const tieredGates = tieredStageGates(stage, base.requiredGates, track);
362
404
  const tieredValidation = tieredArtifactValidation(stage, base.artifactValidation);
363
405
  const crossStageTrace = {
@@ -396,8 +438,7 @@ export function stageSchema(stage, track = "standard") {
396
438
  const reviewLens = {
397
439
  outputs: base.outputs,
398
440
  reviewSections: base.reviewSections,
399
- mandatoryDelegations,
400
- policyNeedles: base.policyNeedles
441
+ mandatoryDelegations
401
442
  };
402
443
  return {
403
444
  ...base,
@@ -464,7 +505,7 @@ export function buildTransitionRules() {
464
505
  return rules;
465
506
  }
466
507
  export function stagePolicyNeedles(stage, track = "standard") {
467
- return stageSchema(stage, track).policyNeedles;
508
+ return stagePolicyNeedlesFromMetadata(stage, track);
468
509
  }
469
510
  export function stageAutoSubagentDispatch(stage) {
470
511
  return STAGE_AUTO_SUBAGENT_DISPATCH[stage];
@@ -0,0 +1,2 @@
1
+ import type { FlowStage, FlowTrack } from "../../../types.js";
2
+ export declare function stagePolicyNeedlesFromMetadata(stage: FlowStage, track?: FlowTrack): string[];
@@ -0,0 +1,79 @@
1
+ import { SHIP_FINALIZATION_MODES } from "../../../constants.js";
2
+ const STAGE_POLICY_NEEDLES = {
3
+ brainstorm: [
4
+ "Explore project context",
5
+ "One question at a time",
6
+ "2-3 architecturally distinct approaches",
7
+ "State what is being approved",
8
+ "Self-review before handoff",
9
+ "Do NOT implement, scaffold, or modify behavior"
10
+ ],
11
+ scope: [
12
+ "Scope mode",
13
+ "In Scope",
14
+ "Out of Scope",
15
+ "Discretion Areas",
16
+ "NOT in scope",
17
+ "Premise Challenge",
18
+ "Locked Decisions"
19
+ ],
20
+ design: [
21
+ "Parallel Research Fleet",
22
+ "Architecture",
23
+ "Data Flow",
24
+ "Failure Modes and Mitigation",
25
+ "Performance Budget",
26
+ "One issue at a time"
27
+ ],
28
+ spec: ["Acceptance Criteria", "Constraints", "Testability", "approved spec", "Edge Cases"],
29
+ plan: [
30
+ "WAIT_FOR_CONFIRM",
31
+ "Task Graph",
32
+ "Dependency Batches",
33
+ "Acceptance Mapping",
34
+ "verification steps",
35
+ "Locked Decision Coverage"
36
+ ],
37
+ tdd: [
38
+ "RED",
39
+ "GREEN",
40
+ "REFACTOR",
41
+ "failing test",
42
+ "full test suite",
43
+ "acceptance criteria",
44
+ "traceable to plan slice"
45
+ ],
46
+ review: [
47
+ "Layer 1",
48
+ "Layer 2",
49
+ "Critical",
50
+ "Review Army",
51
+ "Ready to Ship",
52
+ "ROUTE_BACK_TO_TDD",
53
+ "One issue at a time"
54
+ ],
55
+ ship: [
56
+ "Pre-Ship Checks",
57
+ "Release Notes",
58
+ "Rollback Plan",
59
+ ...SHIP_FINALIZATION_MODES
60
+ ]
61
+ };
62
+ function quickTrackText(value) {
63
+ return value
64
+ .replace(/\btask from the plan\b/giu, "acceptance criterion from the spec")
65
+ .replace(/\bplan task ID\b/giu, "acceptance criterion ID")
66
+ .replace(/\bplan task\b/giu, "acceptance criterion")
67
+ .replace(/\bplan row\b/giu, "acceptance row")
68
+ .replace(/\bplan slice\b/giu, "acceptance slice")
69
+ .replace(/\bplan artifact\b/giu, "spec artifact")
70
+ .replace(/\btraceable to plan slice\b/giu, "traceable to acceptance criterion")
71
+ .replace(/05-plan\.md/gu, "04-spec.md");
72
+ }
73
+ export function stagePolicyNeedlesFromMetadata(stage, track = "standard") {
74
+ const needles = STAGE_POLICY_NEEDLES[stage];
75
+ if (stage === "tdd" && track === "quick") {
76
+ return needles.map(quickTrackText);
77
+ }
78
+ return [...needles];
79
+ }
@@ -2,149 +2,150 @@
2
2
  // BRAINSTORM — reference: superpowers brainstorming
3
3
  // ---------------------------------------------------------------------------
4
4
  export const BRAINSTORM = {
5
+ schemaShape: "v2",
5
6
  stage: "brainstorm",
6
7
  complexityTier: "standard",
7
8
  skillFolder: "brainstorming",
8
9
  skillName: "brainstorming",
9
10
  skillDescription: "Design-first stage. Explore context, understand intent through collaborative dialogue, propose distinct approaches, and lock an approved direction before scope/design work.",
10
- hardGate: "Do NOT invoke implementation skills, write code, scaffold projects, or mutate product behavior until a concrete direction is approved by the user.",
11
- ironLaw: "NO ARTIFACT IS COMPLETE WITHOUT AN EXPLICITLY APPROVED DIRECTION SILENCE IS NOT APPROVAL.",
12
- purpose: "Turn an initial idea into an approved design direction through natural collaborative dialogue understanding the problem before proposing solutions.",
13
- whenToUse: [
14
- "Starting a new feature or behavior change",
15
- "Requirements are ambiguous or trade-offs are unclear",
16
- "Before any implementation-stage command or architecture commitment"
17
- ],
18
- whenNotToUse: [
19
- "A valid approved direction already exists and only execution remains",
20
- "The request is a pure release/finalization action with no new product decisions",
21
- "The task is retrospective only (post-ship audit with no new solution choices)"
22
- ],
23
- checklist: [
24
- "**Explore project context** — check files, docs, recent commits to understand what already exists.",
25
- "**Assess depth tier first** classify the request as Lightweight / Standard / Deep. Lightweight = narrow/localized ask; Standard = cross-module but bounded; Deep = platform or multi-surface product change.",
26
- "**Assess scope** if the request covers multiple independent subsystems, flag it and help decompose before deep-diving. Each sub-project gets its own brainstorm cycle.",
27
- "**Short-circuit gate** if requirements are already concrete and unambiguous, write a minimal brainstorm stub (problem + approved intent + constraints) and hand off to scope.",
28
- "**Ask clarifying questions** one at a time, understand purpose, constraints, and success criteria. Prefer multiple choice when possible. Each question should change what we build, not just gather trivia.",
29
- "**Propose 2-3 architecturally distinct approaches** with real trade-offs and no recommendation yet. At least one option must be a higher-upside challenger that raises ambition vs the user's initial ask.",
30
- "**Collect user reaction** — ask which approach feels closest and what concerns remain before stating your recommendation.",
31
- "**Recommend only after reaction** present final recommendation with rationale that explicitly references user feedback.",
32
- "**Present design by sections** scale each section to its complexity. Ask after each section whether it looks right so far. Cover: architecture, key components, data flow.",
33
- "**Optional visual companion** when architecture/data flow complexity is medium+ offer a compact diagram (ASCII or Mermaid) before artifact write-up.",
34
- "**Write artifact** to `.cclaw/artifacts/01-brainstorm.md`.",
35
- "**Document-quality pass** — run a brief adversarial review of the artifact (gaps, contradictions, missing trade-offs), then patch before user review.",
36
- "**Self-review** — scan for placeholders/TODOs, check internal consistency, verify scope is focused, resolve any ambiguity.",
37
- "**User reviews artifact** — ask the user to review the written artifact and explicitly approve or request changes.",
38
- "**Handoff** — only then complete stage and point to `/cc-next`."
39
- ],
40
- interactionProtocol: [
41
- "Explore what exists before asking what to build — check project files first.",
42
- "If the idea is vague or could mean many different things, your FIRST question narrows to a specific kind of project. Do not ask detail questions until the project type is clear.",
43
- "Ask exactly one question per turn. Prefer multiple choice. No bundled questions.",
44
- "After 2-3 questions, summarize your emerging understanding before continuing so the user can correct course early.",
45
- "Each question should change a concrete design decision. Litmus test: if the two most likely answers do not lead to different architectures, make the choice yourself and state it.",
46
- "Present design in sections scaled to their complexity — a few sentences for simple aspects, detailed for nuanced ones. Get approval after each section.",
47
- "When proposing approaches, do NOT reveal your recommendation yet. Present options first, gather reaction, then recommend.",
48
- "At least one approach must be a higher-upside challenger; avoid three same-altitude variants.",
49
- "State explicitly what is being approved when requesting approval.",
50
- "Run a brief self-review (placeholders, contradictions, scope, ambiguity) before presenting the artifact.",
51
- "**STOP.** Wait for explicit user approval after writing the artifact. Do NOT auto-advance."
52
- ],
53
- process: [
54
- "Explore project context: check files, docs, recent activity.",
55
- "Classify depth tier (Lightweight / Standard / Deep) before diving.",
56
- "Assess scope: flag if request is too broad, help decompose first.",
57
- "Apply short-circuit when requirements are already concrete enough for scope.",
58
- "Ask clarifying questions one at a time — focus on purpose, constraints, success criteria.",
59
- "Propose 2-3 architecturally distinct approaches with trade-offs (one must be higher-upside challenger).",
60
- "Collect user reaction before giving your recommendation.",
61
- "Recommend after reaction and explain how feedback changed the recommendation.",
62
- "Present design sections incrementally, get approval after each.",
63
- "Write approved direction to `.cclaw/artifacts/01-brainstorm.md`.",
64
- "Run document-quality pass to close contradictions and weak trade-off reasoning.",
65
- "Self-review: placeholder scan, internal consistency, scope check, ambiguity check.",
66
- "Request explicit user approval of the artifact.",
67
- "Handoff to scope only after approval is explicit."
68
- ],
69
- requiredGates: [
70
- { id: "brainstorm_approaches_compared", description: "2-3 architecturally distinct approaches were compared with real trade-offs and a recommendation." },
71
- { id: "brainstorm_direction_approved", description: "User approved a concrete direction and what exactly was approved is stated." },
72
- { id: "brainstorm_artifact_reviewed", description: "User reviewed the written brainstorm artifact and confirmed readiness." }
73
- ],
74
- requiredEvidence: [
75
- "Artifact written to `.cclaw/artifacts/01-brainstorm.md`.",
76
- "Project context was explored (files, docs, or recent activity referenced).",
77
- "Clarifying questions and their answers are captured.",
78
- "2-3 approaches with trade-offs are recorded, including one higher-upside challenger option.",
79
- "User reaction to approaches is captured before final recommendation.",
80
- "Final recommendation explicitly reflects user reaction.",
81
- "Approved direction and approval marker are present.",
82
- "Assumptions and open questions are captured (or explicitly marked as none)."
83
- ],
84
- inputs: ["problem statement", "constraints", "success criteria"],
85
- requiredContext: [
86
- "existing project context and patterns",
87
- "current behavior of affected area",
88
- "business and delivery constraints"
89
- ],
90
- researchPlaybooks: [
91
- "research/repo-scan.md",
92
- "research/learnings-lookup.md"
93
- ],
94
- outputs: [
95
- "approved design direction",
96
- "alternatives with trade-offs",
97
- "brainstorm artifact"
98
- ],
99
- blockers: [
100
- "no explicit approval",
101
- "critical ambiguity unresolved",
102
- "project context not explored"
103
- ],
104
- exitCriteria: [
105
- "approved design direction documented",
106
- "required gates marked satisfied",
107
- "no implementation action taken",
108
- "artifact reviewed by user"
109
- ],
110
- commonRationalizations: [
111
- "Asking questions without exploring existing project context first",
112
- "Asking bundled or purely informational questions that don't change decisions",
113
- "Proposing cosmetic option variants instead of architecturally distinct approaches",
114
- "Revealing recommendation before collecting user reaction",
115
- "Three same-altitude approaches with no higher-upside challenger",
116
- "Jumping directly into implementation",
117
- "Requesting approval without stating what decision is being approved",
118
- "Questions that only gather preferences without design impact",
119
- "Options that are variants of one approach, not distinct alternatives"
120
- ],
121
- policyNeedles: [
122
- "Explore project context",
123
- "One question at a time",
124
- "2-3 architecturally distinct approaches",
125
- "State what is being approved",
126
- "Self-review before handoff",
127
- "Do NOT implement, scaffold, or modify behavior"
128
- ],
129
- artifactFile: "01-brainstorm.md",
130
- next: "scope",
131
- reviewSections: [],
132
- completionStatus: ["DONE", "DONE_WITH_CONCERNS", "BLOCKED"],
133
- crossStageTrace: {
134
- readsFrom: [],
135
- writesTo: [".cclaw/artifacts/01-brainstorm.md"],
136
- traceabilityRule: "Scope and design decisions must trace back to explored context and approved brainstorm direction."
11
+ philosophy: {
12
+ hardGate: "Do NOT invoke implementation skills, write code, scaffold projects, or mutate product behavior until a concrete direction is approved by the user.",
13
+ ironLaw: "NO ARTIFACT IS COMPLETE WITHOUT AN EXPLICITLY APPROVED DIRECTIONSILENCE IS NOT APPROVAL.",
14
+ purpose: "Turn an initial idea into an approved design direction through natural collaborative dialogue — understanding the problem before proposing solutions.",
15
+ whenToUse: [
16
+ "Starting a new feature or behavior change",
17
+ "Requirements are ambiguous or trade-offs are unclear",
18
+ "Before any implementation-stage command or architecture commitment"
19
+ ],
20
+ whenNotToUse: [
21
+ "A valid approved direction already exists and only execution remains",
22
+ "The request is a pure release/finalization action with no new product decisions",
23
+ "The task is retrospective only (post-ship audit with no new solution choices)"
24
+ ],
25
+ commonRationalizations: [
26
+ "Asking questions without exploring existing project context first",
27
+ "Asking bundled or purely informational questions that don't change decisions",
28
+ "Proposing cosmetic option variants instead of architecturally distinct approaches",
29
+ "Revealing recommendation before collecting user reaction",
30
+ "Three same-altitude approaches with no higher-upside challenger",
31
+ "Jumping directly into implementation",
32
+ "Requesting approval without stating what decision is being approved",
33
+ "Questions that only gather preferences without design impact",
34
+ "Options that are variants of one approach, not distinct alternatives"
35
+ ]
137
36
  },
138
- artifactValidation: [
139
- { section: "Context", required: true, validationRule: "Must reference project state and relevant existing code or patterns." },
140
- { section: "Problem", required: true, validationRule: "Must define what we're solving, success criteria, and constraints." },
141
- { section: "Clarifying Questions", required: false, validationRule: "Must capture question, answer, and decision impact for each clarifying question." },
142
- { section: "Approach Tier", required: false, validationRule: "Must classify depth as Lightweight/Standard/Deep and explain why." },
143
- { section: "Approaches", required: true, validationRule: "Must compare 2-3 architecturally distinct options with real trade-offs and include one higher-upside challenger option." },
144
- { section: "Approach Reaction", required: false, validationRule: "Must summarize user reaction before recommendation, including concerns that changed direction." },
145
- { section: "Selected Direction", required: true, validationRule: "Must include the selected approach, rationale tied to user reaction, and explicit approval marker." },
146
- { section: "Design", required: false, validationRule: "Must cover architecture, key components, and data flow scaled to complexity." },
147
- { section: "Visual Companion", required: false, validationRule: "If architecture/data-flow complexity is medium+, include compact ASCII/Mermaid diagram or explicitly justify omission." },
148
- { section: "Assumptions and Open Questions", required: false, validationRule: "Must capture unresolved assumptions/open questions, or explicitly state none." }
149
- ]
37
+ executionModel: {
38
+ checklist: [
39
+ "**Explore project context** check files, docs, recent commits to understand what already exists.",
40
+ "**Assess depth tier first** classify the request as Lightweight / Standard / Deep. Lightweight = narrow/localized ask; Standard = cross-module but bounded; Deep = platform or multi-surface product change.",
41
+ "**Assess scope** if the request covers multiple independent subsystems, flag it and help decompose before deep-diving. Each sub-project gets its own brainstorm cycle.",
42
+ "**Short-circuit gate** if requirements are already concrete and unambiguous, write a minimal brainstorm stub (problem + approved intent + constraints) and hand off to scope.",
43
+ "**Ask clarifying questions** — one at a time, understand purpose, constraints, and success criteria. Prefer multiple choice when possible. Each question should change what we build, not just gather trivia.",
44
+ "**Propose 2-3 architecturally distinct approaches** with real trade-offs and no recommendation yet. At least one option must be a higher-upside challenger that raises ambition vs the user's initial ask.",
45
+ "**Collect user reaction** ask which approach feels closest and what concerns remain before stating your recommendation.",
46
+ "**Recommend only after reaction** present final recommendation with rationale that explicitly references user feedback.",
47
+ "**Present design by sections** — scale each section to its complexity. Ask after each section whether it looks right so far. Cover: architecture, key components, data flow.",
48
+ "**Optional visual companion** — when architecture/data flow complexity is medium+ offer a compact diagram (ASCII or Mermaid) before artifact write-up.",
49
+ "**Write artifact** to `.cclaw/artifacts/01-brainstorm.md`.",
50
+ "**Document-quality pass** — run a brief adversarial review of the artifact (gaps, contradictions, missing trade-offs), then patch before user review.",
51
+ "**Self-review** — scan for placeholders/TODOs, check internal consistency, verify scope is focused, resolve any ambiguity.",
52
+ "**User reviews artifact** — ask the user to review the written artifact and explicitly approve or request changes.",
53
+ "**Handoff** — only then complete stage and point to `/cc-next`."
54
+ ],
55
+ interactionProtocol: [
56
+ "Explore what exists before asking what to build — check project files first.",
57
+ "If the idea is vague or could mean many different things, your FIRST question narrows to a specific kind of project. Do not ask detail questions until the project type is clear.",
58
+ "Ask exactly one question per turn. Prefer multiple choice. No bundled questions.",
59
+ "After 2-3 questions, summarize your emerging understanding before continuing so the user can correct course early.",
60
+ "Each question should change a concrete design decision. Litmus test: if the two most likely answers do not lead to different architectures, make the choice yourself and state it.",
61
+ "Present design in sections scaled to their complexity — a few sentences for simple aspects, detailed for nuanced ones. Get approval after each section.",
62
+ "When proposing approaches, do NOT reveal your recommendation yet. Present options first, gather reaction, then recommend.",
63
+ "At least one approach must be a higher-upside challenger; avoid three same-altitude variants.",
64
+ "State explicitly what is being approved when requesting approval.",
65
+ "Run a brief self-review (placeholders, contradictions, scope, ambiguity) before presenting the artifact.",
66
+ "**STOP.** Wait for explicit user approval after writing the artifact. Do NOT auto-advance."
67
+ ],
68
+ process: [
69
+ "Explore project context: check files, docs, recent activity.",
70
+ "Classify depth tier (Lightweight / Standard / Deep) before diving.",
71
+ "Assess scope: flag if request is too broad, help decompose first.",
72
+ "Apply short-circuit when requirements are already concrete enough for scope.",
73
+ "Ask clarifying questions one at a time — focus on purpose, constraints, success criteria.",
74
+ "Propose 2-3 architecturally distinct approaches with trade-offs (one must be higher-upside challenger).",
75
+ "Collect user reaction before giving your recommendation.",
76
+ "Recommend after reaction and explain how feedback changed the recommendation.",
77
+ "Present design sections incrementally, get approval after each.",
78
+ "Write approved direction to `.cclaw/artifacts/01-brainstorm.md`.",
79
+ "Run document-quality pass to close contradictions and weak trade-off reasoning.",
80
+ "Self-review: placeholder scan, internal consistency, scope check, ambiguity check.",
81
+ "Request explicit user approval of the artifact.",
82
+ "Handoff to scope only after approval is explicit."
83
+ ],
84
+ requiredGates: [
85
+ { id: "brainstorm_approaches_compared", description: "2-3 architecturally distinct approaches were compared with real trade-offs and a recommendation." },
86
+ { id: "brainstorm_direction_approved", description: "User approved a concrete direction and what exactly was approved is stated." },
87
+ { id: "brainstorm_artifact_reviewed", description: "User reviewed the written brainstorm artifact and confirmed readiness." }
88
+ ],
89
+ requiredEvidence: [
90
+ "Artifact written to `.cclaw/artifacts/01-brainstorm.md`.",
91
+ "Project context was explored (files, docs, or recent activity referenced).",
92
+ "Clarifying questions and their answers are captured.",
93
+ "2-3 approaches with trade-offs are recorded, including one higher-upside challenger option.",
94
+ "User reaction to approaches is captured before final recommendation.",
95
+ "Final recommendation explicitly reflects user reaction.",
96
+ "Approved direction and approval marker are present.",
97
+ "Assumptions and open questions are captured (or explicitly marked as none)."
98
+ ],
99
+ inputs: ["problem statement", "constraints", "success criteria"],
100
+ requiredContext: [
101
+ "existing project context and patterns",
102
+ "current behavior of affected area",
103
+ "business and delivery constraints"
104
+ ],
105
+ researchPlaybooks: [
106
+ "research/repo-scan.md",
107
+ "research/learnings-lookup.md"
108
+ ],
109
+ blockers: [
110
+ "no explicit approval",
111
+ "critical ambiguity unresolved",
112
+ "project context not explored"
113
+ ],
114
+ exitCriteria: [
115
+ "approved design direction documented",
116
+ "required gates marked satisfied",
117
+ "no implementation action taken",
118
+ "artifact reviewed by user"
119
+ ]
120
+ },
121
+ artifactRules: {
122
+ artifactFile: "01-brainstorm.md",
123
+ completionStatus: ["DONE", "DONE_WITH_CONCERNS", "BLOCKED"],
124
+ crossStageTrace: {
125
+ readsFrom: [],
126
+ writesTo: [".cclaw/artifacts/01-brainstorm.md"],
127
+ traceabilityRule: "Scope and design decisions must trace back to explored context and approved brainstorm direction."
128
+ },
129
+ artifactValidation: [
130
+ { section: "Context", required: true, validationRule: "Must reference project state and relevant existing code or patterns." },
131
+ { section: "Problem", required: true, validationRule: "Must define what we're solving, success criteria, and constraints." },
132
+ { section: "Clarifying Questions", required: false, validationRule: "Must capture question, answer, and decision impact for each clarifying question." },
133
+ { section: "Approach Tier", required: false, validationRule: "Must classify depth as Lightweight/Standard/Deep and explain why." },
134
+ { section: "Approaches", required: true, validationRule: "Must compare 2-3 architecturally distinct options with real trade-offs and include one higher-upside challenger option." },
135
+ { section: "Approach Reaction", required: false, validationRule: "Must summarize user reaction before recommendation, including concerns that changed direction." },
136
+ { section: "Selected Direction", required: true, validationRule: "Must include the selected approach, rationale tied to user reaction, and explicit approval marker." },
137
+ { section: "Design", required: false, validationRule: "Must cover architecture, key components, and data flow scaled to complexity." },
138
+ { section: "Visual Companion", required: false, validationRule: "If architecture/data-flow complexity is medium+, include compact ASCII/Mermaid diagram or explicitly justify omission." },
139
+ { section: "Assumptions and Open Questions", required: false, validationRule: "Must capture unresolved assumptions/open questions, or explicitly state none." }
140
+ ]
141
+ },
142
+ reviewLens: {
143
+ outputs: [
144
+ "approved design direction",
145
+ "alternatives with trade-offs",
146
+ "brainstorm artifact"
147
+ ],
148
+ reviewSections: []
149
+ },
150
+ next: "scope"
150
151
  };