cclaw-cli 0.5.5 → 0.5.7

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,74 +1,94 @@
1
1
  const STAGE_EXAMPLES = {
2
- brainstorm: `### Route selection
2
+ brainstorm: `### Context
3
3
 
4
- - **Route:** Complex Route
5
- - **Why:** touches CI behavior, release checks, and CLI flow across multiple components.
4
+ - **Project state:** Monorepo with CI pipeline using custom release scripts. Release checks are scattered across shell scripts with no shared validation logic.
5
+ - **Relevant existing code/patterns:** \`scripts/pre-publish.sh\` does metadata checks. \`src/release/\` has partial validation helpers.
6
6
 
7
- ### Round 1 grounding
7
+ ### Problem
8
8
 
9
- - **Grounding summary:** "We are improving release reliability for the platform team. Success means invalid release preconditions are caught before publish with explicit operator feedback."
10
- - **User confirmation:** confirmed.
9
+ - **What we're solving:** release checks are fragile and inconsistent between CI and local runs. Invalid metadata sometimes reaches npm publish.
10
+ - **Success criteria:** invalid release preconditions are caught before publish with explicit operator feedback, in both CI and local workflows.
11
+ - **Constraints:** no new runtime dependencies; must work within existing CI pipeline structure.
11
12
 
12
- ### Round 2 forcing questions (boundaries/constraints)
13
+ ### Clarifying Questions
13
14
 
14
- **Q1:** "If release metadata is invalid, do we block publishing hard or only warn?"
15
- **A1:** "Block hard."
16
-
17
- **Decision impact:** release checks become mandatory gates with no warning-only fallback.
15
+ | # | Question | Answer | Decision impact |
16
+ | --- | --- | --- | --- |
17
+ | 1 | If release metadata is invalid, should we block publishing hard or only warn? | Block hard. | Validation becomes a mandatory gate — no warning-only fallback. |
18
+ | 2 | Should the validation logic live in a reusable module or stay as shell scripts? | Reusable module. | Architecture: shared TypeScript module imported by CI and local tooling, not duplicated shell scripts. |
19
+ | 3 | For v1, prioritize rapid delivery or maximum configurability? | Rapid delivery. | Minimal deterministic validation surface; defer plugin/config system to v2. |
18
20
 
19
- **Q2:** "Do we allow new runtime dependencies for speed, or keep runtime dependency set unchanged?"
20
- **A2:** "Keep runtime dependencies unchanged."
21
+ ### Approaches
21
22
 
22
- **Decision impact:** implementation should reuse existing tooling and built-in capabilities.
23
+ | Approach | Architecture | Trade-offs | Recommendation |
24
+ | --- | --- | --- | --- |
25
+ | A: Reusable validation module | Shared TS module with typed validators, imported by CI scripts and local CLI. Existing \`pre-publish.sh\` calls the module. | Medium upfront effort, high reuse. Requires test coverage for the module. | **Recommended** — best balance of reuse and delivery speed. |
26
+ | B: Hardened shell scripts | Keep existing script approach, add stricter checks and error messages. | Lowest effort. Weak reuse, CI/local divergence risk grows over time. | Viable fallback if TS module is blocked. |
27
+ | C: Full release framework | New release orchestrator with plugin system, config files, rollback commands. | Maximum flexibility. High risk, delivery delay, over-engineered for current needs. | Not recommended for v1. |
23
28
 
24
- ### Grounding checkpoint after Round 2
29
+ ### Selected Direction
25
30
 
26
- - **Fixed:** hard-block behavior, no new runtime dependencies.
27
- - **Unknown:** rollback command details and status reporting format.
31
+ - **Approach:** A Reusable validation module
32
+ - **Rationale:** shared TS module gives consistent behavior in CI and local, avoids script duplication, and stays within the no-new-dependency constraint.
33
+ - **Approval:** approved
28
34
 
29
- ### Round 3 forcing questions (trade-offs)
35
+ ### Design
30
36
 
31
- **Q3:** "For v1, prioritize rapid delivery or maximum configurability?"
32
- **A3:** "Rapid delivery."
37
+ - **Architecture:** single \`release-validator\` module in \`src/release/\` exporting typed check functions. CI script and local CLI both import and run the same checks.
38
+ - **Key components:** \`validateMetadata()\`, \`validateChangelog()\`, \`validateVersion()\` — each returns a typed result with error details. A \`runAll()\` orchestrator runs checks and exits non-zero on any failure.
39
+ - **Data flow:** package.json + CHANGELOG.md → validator module → structured result → CI/CLI renders human-readable report.
33
40
 
34
- **Decision impact:** choose a minimal deterministic validation surface; defer advanced configuration.
41
+ ### Assumptions and Open Questions
35
42
 
36
- ### Options comparison
43
+ - **Assumptions:** CI remains the primary execution path; existing release metadata files remain the source of truth; v1 prioritizes determinism over customization.
44
+ - **Open questions:** What exact rollback sequence for failed publish? Should status output include machine-readable JSON alongside markdown?
37
45
 
38
- | Option | Pros | Cons | Effort | Recommendation |
39
- | --- | --- | --- | --- | --- |
40
- | Script-only checks | Lowest implementation cost | Weak reuse and long-term maintainability | Low | Useful fallback, not preferred |
41
- | Reusable validation module | Reusable across CI and local runs | Slightly higher upfront design effort | Medium | **Recommended** |
42
- | Full release framework rewrite | Highest long-term flexibility | High risk and delivery delay | High | Not recommended for v1 |
46
+ ### Notes for the next stage
43
47
 
44
- ### Approved Direction
48
+ Carry the no-new-dependency constraint and hard-block behavior directly into scope in/out boundaries.`,
49
+ scope: `### Scope contract
45
50
 
46
- We will implement a **reusable release validation module** used by CI and local tooling, aligned with hard-block safety and no-new-runtime-dependency constraints.
51
+ **Mode selected:** SELECTIVE EXPANSION
52
+ **Default heuristic used:** feature enhancement -> selective
53
+ **Mode-specific analysis result:** hold-scope baseline accepted first; one expansion accepted (degraded-state UX), one deferred (real-time channel upgrade).
47
54
 
48
- ### Open Questions
55
+ ### Prime Directives (applied)
49
56
 
50
- - What exact rollback command sequence should be documented for failed publish attempts?
51
- - Should status output include machine-readable JSON in addition to markdown?
57
+ - Zero silent failures: every delivery failure maps to a visible degraded state.
58
+ - Named error surfaces: stream disconnect, auth drift, and publisher timeout are explicit.
59
+ - Four-path data flow mapped: happy, nil payload, empty payload, upstream publish error.
60
+ - Interaction edge cases in scope: double-open panel, reconnect after sleep, stale tab state.
61
+ - Observability in scope: stream error counter, publish-to-visible lag metric, and alert threshold.
52
62
 
53
- ### Assumptions (explicit)
63
+ ### Premise challenge result
54
64
 
55
- - CI remains the primary execution path; local flow mirrors CI checks.
56
- - Existing release metadata files remain the source of truth.
57
- - v1 prioritizes deterministic behavior over broad customization.
65
+ The original premise (“add notifications”) was reframed to **“ensure users know when an action requires follow-up”**, which expands the solution space beyond toast spam to include durable inbox items, empty states, and recovery paths when delivery fails.
58
66
 
59
- ### Constraints
67
+ ### Dream State Mapping
60
68
 
61
- - No additional runtime dependencies in validation path.
62
- - Validation overhead should remain acceptable for routine CI execution.
69
+ | Stage | Statement |
70
+ | --- | --- |
71
+ | **CURRENT STATE** | Users miss time-sensitive follow-ups because alerts are ephemeral and not recoverable. |
72
+ | **THIS PLAN** | Introduce durable in-app feed + live updates + explicit degraded mode fallback. |
73
+ | **12-MONTH IDEAL** | Unified notification center with reliable multi-channel fan-out and user-level routing preferences. |
74
+ | **Alignment verdict** | Aligned: this scope builds the durability foundation without prematurely committing to channel expansion. |
63
75
 
64
- ### Notes for the next stage
76
+ ### Implementation Alternatives
65
77
 
66
- Carry fixed trade-off decisions directly into scope in/out boundaries and deferred list.`,
67
- scope: `### Scope contract
78
+ | Option | Summary | Effort (S/M/L/XL) | Risk | Pros | Cons | Reuses |
79
+ | --- | --- | --- | --- | --- | --- | --- |
80
+ | **A (minimum viable)** | Polling-only feed with no live stream | S | Low | Fastest ship, low infra risk | Weaker UX, delayed visibility | Existing REST snapshot endpoint |
81
+ | **B (recommended)** | SSE live updates + REST fallback snapshot | M | Med | Better timeliness, graceful degradation | Requires reconnect handling | Existing event publisher + REST path |
82
+ | **C (ideal architecture)** | Event bus + WebSocket channel + feed projection | XL | High | Strong long-term scalability | Overbuilt for current demand | Partial reuse of publisher only |
68
83
 
69
- **Mode selected:** SELECTIVE EXPANSION
84
+ ### Temporal Interrogation
70
85
 
71
- **Premise challenge result:** The original premise (“add notifications”) was reframed to **“ensure users know when an action requires follow-up”**, which expands the solution space beyond toast spam to include durable inbox items, empty states, and recovery paths when delivery fails.
86
+ | Time slice | Likely decision pressure | Lock now or defer? | Reason |
87
+ | --- | --- | --- | --- |
88
+ | **HOUR 1 (foundations)** | Canonical event schema and dedupe key policy | **Lock now** | Prevent downstream rework in storage and UI merge behavior |
89
+ | **HOUR 2-3 (core logic)** | Retry/backoff semantics for stream loss | **Lock now** | Impacts both backend signaling and client state machine |
90
+ | **HOUR 4-5 (integration)** | Handling gaps between snapshot and stream cursor | **Lock now** | Prevent silent data loss during reconnect windows |
91
+ | **HOUR 6+ (polish/tests)** | Banner copy tone and polling cadence tuning | **Defer** | Safe to iterate after baseline reliability is proven |
72
92
 
73
93
  ### In scope / out of scope / deferred
74
94
 
@@ -78,22 +98,28 @@ Carry fixed trade-off decisions directly into scope in/out boundaries and deferr
78
98
  | **Out of scope** | Email/SMS/push providers; marketing campaigns; per-user notification preferences beyond on/off |
79
99
  | **Deferred** | WebSocket channel; rich media attachments in notifications; full-text search across historical events |
80
100
 
101
+ ### Discretion Areas
102
+
103
+ - Client-side badge rendering strategy (optimistic vs server-confirmed) is implementation discretion.
104
+ - Polling fallback backoff curve is implementation discretion if degraded-state UX remains explicit.
105
+
81
106
  ### Error & Rescue Registry (sample entry)
82
107
 
83
108
  | Capability | Failure mode | Detection | Fallback |
84
109
  | --- | --- | --- | --- |
85
110
  | Event delivery | SSE connection drops mid-session | Client \`EventSource\` error event + heartbeat timeout | Fall back to REST polling every 30s until SSE reconnect succeeds; show subtle “live updates paused” banner |
86
111
 
87
- ### Non-goals (guardrails)
112
+ ### Completion Dashboard
88
113
 
89
- - No “infinite history” guarantee in v1; retention policy can be time-bounded.
90
- - No cross-tenant fan-out optimizations until multi-tenant load tests exist.
114
+ - Checklist findings: 9/9 complete (complex path)
115
+ - Resolved decisions count: 7
116
+ - Unresolved decisions: None
91
117
 
92
- ### Owners & checkpoints
118
+ ### Scope Summary
93
119
 
94
- - **Product:** confirms reframed premise and acceptance of deferred items.
95
- - **Engineering:** confirms SSE + REST snapshot split is feasible behind current gateway.
96
- - **Checkpoint:** scope sign-off happens before detailed component design changes land in the repo.`,
120
+ - Accepted scope: durable feed + SSE + explicit degraded UX.
121
+ - Deferred: WebSocket channel and rich-media/search enhancements.
122
+ - Explicitly excluded: outbound channels and marketing workflows for v1.`,
97
123
  design: `### Search Before Building (sample result)
98
124
 
99
125
  | Layer | Label | What to reuse first |
@@ -24,7 +24,7 @@ function reviewSectionsBlock(stage) {
24
24
  const sections = schema.reviewSections.map((sec) => {
25
25
  const points = sec.evaluationPoints.map((p) => `- ${p}`).join("\n");
26
26
  const stop = sec.stopGate
27
- ? "\n\n**STOP.** For each issue found in this section, present it ONE AT A TIME. Describe the problem concretely, present 2-3 options, state your recommendation, and explain WHY. Only proceed to the next section after ALL issues in this section are resolved."
27
+ ? "\n\n**STOP.** Present the most important question from this section to the user, even if your recommendation is clear. If no issues are found, state your assessment in one sentence and ask the user to confirm before moving on. If issues exist, present them ONE AT A TIME: describe the problem concretely, present 2-3 options, state your recommendation, and explain WHY."
28
28
  : "";
29
29
  return `### ${sec.title}\n\nEvaluate:\n${points}${stop}`;
30
30
  }).join("\n\n");
@@ -22,9 +22,9 @@ const BRAINSTORM = {
22
22
  stage: "brainstorm",
23
23
  skillFolder: "brainstorming",
24
24
  skillName: "brainstorming",
25
- skillDescription: "Design-first stage. Route request complexity, run phased forcing questions, and lock an approved direction before scope/design work.",
25
+ skillDescription: "Design-first stage. Explore context, understand intent through collaborative dialogue, propose distinct approaches, and lock an approved direction before scope/design work.",
26
26
  hardGate: "Do NOT invoke implementation skills, write code, scaffold projects, or mutate product behavior until a concrete direction is approved by the user.",
27
- purpose: "Turn an initial idea into an approved direction through routing, phased grounding, and decision-forcing questions.",
27
+ purpose: "Turn an initial idea into an approved design direction through natural collaborative dialogue understanding the problem before proposing solutions.",
28
28
  whenToUse: [
29
29
  "Starting a new feature or behavior change",
30
30
  "Requirements are ambiguous or trade-offs are unclear",
@@ -36,52 +36,51 @@ const BRAINSTORM = {
36
36
  "The task is retrospective only (post-ship audit with no new solution choices)"
37
37
  ],
38
38
  checklist: [
39
- "Principles (one line): one decision-forcing question at a time, grounding summary between rounds, and no implementation before approval.",
40
- "Route the work: classify as Simple Route (single-surface, low-risk) or Complex Route (multi-surface, high-uncertainty); explain why.",
41
- "Round 1 grounding: restate the problem, desired outcome, and success signal in your own words; get confirmation before deeper questioning.",
42
- "Round 2 forcing questions: ask one decision-forcing question per turn about boundaries and constraints; each answer must change a concrete design decision.",
43
- "Grounding checkpoint: summarize what is fixed vs still unknown after Round 2; confirm this summary before moving to solution options.",
44
- "Round 3 forcing questions: ask trade-off questions that force prioritization (for example speed vs flexibility), then lock assumptions.",
45
- "Propose multiple viable approaches with real trade-offs and one explicit recommendation tied to the forced decisions.",
46
- "Write `.cclaw/artifacts/01-brainstorm.md` with route, grounding checkpoints, forcing-question log, options, and approved direction; run a contradiction pass.",
47
- "Ask the user to review the written artifact and explicitly approve or request changes; only then complete stage and point to `/cc-next`."
39
+ "**Explore project context** check files, docs, recent commits to understand what already exists.",
40
+ "**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.",
41
+ "**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.",
42
+ "**Propose 2-3 architecturally distinct approaches** with real trade-offs and your recommendation. Lead with the recommended option and explain why.",
43
+ "**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.",
44
+ "**Write artifact** to `.cclaw/artifacts/01-brainstorm.md`.",
45
+ "**Self-review** scan for placeholders/TODOs, check internal consistency, verify scope is focused, resolve any ambiguity.",
46
+ "**User reviews artifact** ask the user to review the written artifact and explicitly approve or request changes.",
47
+ "**Handoff** only then complete stage and point to `/cc-next`."
48
48
  ],
49
49
  interactionProtocol: [
50
- "Start with routing (Simple Route vs Complex Route) so question depth matches real complexity.",
51
- "Use phased questioning: Round 1 grounding -> Round 2 constraints/boundaries -> grounding checkpoint -> Round 3 trade-off forcing.",
52
- "Ask exactly one decision-forcing question per turn; avoid bundled or purely informational questions.",
53
- "After each round, publish a short grounding summary (fixed decisions vs unknowns) before continuing.",
54
- "Use the Decision Protocol for option selection, with explicit recommendation and rationale.",
50
+ "Explore what exists before asking what to build check project files first.",
51
+ "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.",
52
+ "Ask exactly one question per turn. Prefer multiple choice. No bundled questions.",
53
+ "After 2-3 questions, summarize your emerging understanding before continuing so the user can correct course early.",
54
+ "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.",
55
+ "Present design in sections scaled to their complexity — a few sentences for simple aspects, detailed for nuanced ones. Get approval after each section.",
56
+ "When proposing approaches, lead with your recommendation and explain why.",
55
57
  "State explicitly what is being approved when requesting approval.",
56
- "Run a brief contradiction and ambiguity pass before handoff.",
58
+ "Run a brief self-review (placeholders, contradictions, scope, ambiguity) before presenting the artifact.",
57
59
  "**STOP.** Wait for explicit user approval after writing the artifact. Do NOT auto-advance."
58
60
  ],
59
61
  process: [
60
- "Route request complexity (Simple Route or Complex Route) and capture rationale.",
61
- "Round 1 grounding: restate problem, outcome, and success signal; confirm alignment.",
62
- "Round 2 forcing questions: boundaries and constraints one question at a time.",
63
- "Grounding checkpoint: summarize fixed decisions and remaining unknowns.",
64
- "Round 3 forcing questions: trade-offs and priorities; lock explicit assumptions.",
65
- "Offer multiple approaches with recommendation and rationale.",
66
- "Capture approved direction in `.cclaw/artifacts/01-brainstorm.md`.",
67
- "Run contradiction/ambiguity pass and request explicit user approval.",
62
+ "Explore project context: check files, docs, recent activity.",
63
+ "Assess scope: flag if request is too broad, help decompose first.",
64
+ "Ask clarifying questions one at a time focus on purpose, constraints, success criteria.",
65
+ "Propose 2-3 architecturally distinct approaches with trade-offs and a recommendation.",
66
+ "Present design sections incrementally, get approval after each.",
67
+ "Write approved direction to `.cclaw/artifacts/01-brainstorm.md`.",
68
+ "Self-review: placeholder scan, internal consistency, scope check, ambiguity check.",
69
+ "Request explicit user approval of the artifact.",
68
70
  "Handoff to scope only after approval is explicit."
69
71
  ],
70
72
  requiredGates: [
71
- { id: "brainstorm_route_selected", description: "Simple vs Complex route was selected with explicit rationale." },
72
- { id: "brainstorm_round1_grounded", description: "Round 1 grounding (problem, outcome, success signal) was confirmed by the user." },
73
- { id: "brainstorm_round2_forcing_questions", description: "Round 2 forcing questions captured boundaries and constraints that changed real decisions." },
74
- { id: "brainstorm_round3_tradeoff_decisions", description: "Round 3 forcing questions locked explicit trade-off priorities and assumptions." },
75
- { id: "brainstorm_options_compared", description: "Multiple solution approaches were compared with real trade-offs and a recommendation." },
73
+ { id: "brainstorm_context_explored", description: "Project context (files, docs, existing patterns) was checked before asking questions." },
74
+ { id: "brainstorm_idea_understood", description: "Agent and user share the same understanding of the problem, constraints, and success criteria." },
75
+ { id: "brainstorm_approaches_compared", description: "2-3 architecturally distinct approaches were compared with real trade-offs and a recommendation." },
76
76
  { id: "brainstorm_direction_approved", description: "User approved a concrete direction and what exactly was approved is stated." },
77
77
  { id: "brainstorm_artifact_reviewed", description: "User reviewed the written brainstorm artifact and confirmed readiness." }
78
78
  ],
79
79
  requiredEvidence: [
80
80
  "Artifact written to `.cclaw/artifacts/01-brainstorm.md`.",
81
- "Routing decision (`simple` or `complex`) with rationale is recorded.",
82
- "Grounding checkpoints between rounds are recorded (fixed decisions vs unknowns).",
83
- "Forcing-question log captures question, answer, and decision impact.",
84
- "Approaches and recommendation are recorded with explicit trade-offs.",
81
+ "Project context was explored (files, docs, or recent activity referenced).",
82
+ "Clarifying questions and their answers are captured.",
83
+ "2-3 approaches with trade-offs and recommendation are recorded.",
85
84
  "Approved direction and approval marker are present.",
86
85
  "Assumptions and open questions are captured (or explicitly marked as none)."
87
86
  ],
@@ -99,7 +98,7 @@ const BRAINSTORM = {
99
98
  blockers: [
100
99
  "no explicit approval",
101
100
  "critical ambiguity unresolved",
102
- "route cannot be determined due to missing context"
101
+ "project context not explored"
103
102
  ],
104
103
  exitCriteria: [
105
104
  "approved design direction documented",
@@ -108,58 +107,59 @@ const BRAINSTORM = {
108
107
  "artifact reviewed by user"
109
108
  ],
110
109
  antiPatterns: [
111
- "Skipping route selection and treating all requests with the same question depth",
112
- "Asking non-forcing or bundled questions",
113
- "Skipping grounding checkpoints between rounds",
110
+ "Asking questions without exploring existing project context first",
111
+ "Asking bundled or purely informational questions that don't change decisions",
112
+ "Proposing cosmetic option variants instead of architecturally distinct approaches",
114
113
  "Jumping directly into implementation",
115
114
  "Requesting approval without stating what decision is being approved"
116
115
  ],
117
116
  rationalizations: [
118
- { claim: "This is straightforward so routing is unnecessary.", reality: "Explicit routing prevents under-questioning complex work and over-questioning simple work." },
119
- { claim: "Any question is useful context.", reality: "Only forcing questions that change decisions improve design quality." },
120
- { claim: "Grounding summaries slow us down.", reality: "Grounding checkpoints prevent hidden drift and reduce expensive rework later." }
117
+ { claim: "I already know what to build, so exploration is unnecessary.", reality: "Checking files and context catches wrong assumptions that waste hours later." },
118
+ { claim: "Any question is useful context.", reality: "Only questions whose answers change what we build improve the design." },
119
+ { claim: "Two options that differ only in tooling count as distinct approaches.", reality: "Distinct means different architecture, not different libraries for the same approach." }
121
120
  ],
122
121
  redFlags: [
123
- "Route is missing or unjustified",
124
- "No grounding checkpoint between question rounds",
125
- "Questions do not force concrete decisions",
122
+ "No project context exploration before questions",
123
+ "Questions that only gather preferences without design impact",
124
+ "Options that are variants of one approach, not distinct alternatives",
126
125
  "Approval requested without explicit decision context"
127
126
  ],
128
127
  policyNeedles: [
129
- "Simple Route / Complex Route",
130
- "One forcing question per message",
131
- "Grounding checkpoint between rounds",
132
- "Multiple approaches with trade-offs",
128
+ "Explore project context",
129
+ "One question at a time",
130
+ "2-3 architecturally distinct approaches",
133
131
  "State what is being approved",
132
+ "Self-review before handoff",
134
133
  "Do NOT implement, scaffold, or modify behavior"
135
134
  ],
136
135
  artifactFile: "01-brainstorm.md",
137
136
  next: "scope",
138
137
  cognitivePatterns: [
139
- { name: "Route Before Depth", description: "Choose question depth using simple-vs-complex routing before diving into details." },
140
- { name: "Forcing Question Discipline", description: "Each question must force a concrete decision, not just gather trivia." },
141
- { name: "Grounding Cadence", description: "After each question round, re-ground on fixed decisions vs unknowns before continuing." },
142
- { name: "Diverge Then Commit", description: "Explore multiple viable options first, then commit only after explicit approval." }
138
+ { name: "Context Before Questions", description: "Understand what exists before asking what to build." },
139
+ { name: "Depth Matches Complexity", description: "Brief design for simple tasks, thorough exploration for complex ones." },
140
+ { name: "Diverge Then Commit", description: "Explore multiple architecturally distinct options first, commit only after explicit approval." },
141
+ { name: "Question Quality Over Quantity", description: "Each question should change what we build, not just gather trivia." },
142
+ { name: "Know When To Move On", description: "Stop asking when problem, constraints, and success criteria are clear enough to compare approaches." }
143
143
  ],
144
144
  reviewSections: [],
145
145
  completionStatus: ["DONE", "DONE_WITH_CONCERNS", "BLOCKED"],
146
146
  crossStageTrace: {
147
147
  readsFrom: [],
148
148
  writesTo: [".cclaw/artifacts/01-brainstorm.md"],
149
- traceabilityRule: "Scope and design decisions must trace back to routed question rounds and approved brainstorm direction."
149
+ traceabilityRule: "Scope and design decisions must trace back to explored context and approved brainstorm direction."
150
150
  },
151
151
  artifactValidation: [
152
- { section: "Problem Framing", required: true, validationRule: "Must define the user problem, desired outcome, and success signal." },
153
- { section: "Routing Decision", required: true, validationRule: "Must state simple vs complex route and explain why." },
154
- { section: "Grounding Checkpoints", required: true, validationRule: "Must capture fixed decisions and remaining unknowns between rounds." },
155
- { section: "Forcing Questions Log", required: true, validationRule: "Must capture question, answer, and decision impact for each forcing question." },
156
- { section: "Options Comparison", required: true, validationRule: "Must compare multiple distinct options with real trade-offs and recommendation." },
157
- { section: "Approved Direction", required: true, validationRule: "Must include explicit approval marker and what was approved." },
152
+ { section: "Context", required: true, validationRule: "Must reference project state and relevant existing code or patterns." },
153
+ { section: "Problem", required: true, validationRule: "Must define what we're solving, success criteria, and constraints." },
154
+ { section: "Clarifying Questions", required: true, validationRule: "Must capture question, answer, and decision impact for each clarifying question." },
155
+ { section: "Approaches", required: true, validationRule: "Must compare 2-3 architecturally distinct options with real trade-offs and recommendation." },
156
+ { section: "Selected Direction", required: true, validationRule: "Must include the selected approach, rationale, and explicit approval marker." },
157
+ { section: "Design", required: true, validationRule: "Must cover architecture, key components, and data flow scaled to complexity." },
158
158
  { section: "Assumptions and Open Questions", required: true, validationRule: "Must capture unresolved assumptions/open questions, or explicitly state none." }
159
159
  ],
160
160
  namedAntiPattern: {
161
- title: "This Is Too Simple To Brainstorm",
162
- description: "Skipping routing and forcing questions because a task looks simple creates silent assumption debt. Even simple-route work needs explicit grounding and approval."
161
+ title: "This Is Too Simple To Need A Design",
162
+ description: "Every project goes through this process. Simple projects are where unexamined assumptions cause the most wasted work. The design can be short, but you MUST present it and get approval."
163
163
  }
164
164
  };
165
165
  // ---------------------------------------------------------------------------
@@ -183,18 +183,23 @@ const SCOPE = {
183
183
  "The work is a pure implementation or debugging pass within existing scope"
184
184
  ],
185
185
  checklist: [
186
- "Prime DirectivesZero silent failures (every failure mode visible). Every error has a name (not 'handle errors' name the exception). Every data flow has four paths: happy, nil input, upstream error, downstream timeout. Observability is a scope deliverable, not a post-launch add-on.",
187
- "Premise ChallengeIs this the right problem? Could a different framing yield a simpler or more impactful solution? What happens if we do nothing? What are we optimizing for speed, quality, cost, user experience?",
188
- "Existing Code Leverage Map every sub-problem to existing code. Run searches (grep, codebase exploration) BEFORE deciding to build new. If built-in or library solutions exist, default to them.",
189
- "Dream State MappingDescribe the ideal end state 12 months from now. Does this plan move toward that state or away from it?",
190
- "Implementation Alternatives (MANDATORY) Produce 2-3 distinct approaches. One must be 'minimal viable', one must be 'ideal architecture'. Include effort/risk/reversibility for each.",
191
- "Temporal InterrogationThink in time slices: HOUR 1 (foundation, what must exist first), HOURS 2-3 (core logic, what builds on foundation), HOURS 4-5 (integration, what connects the pieces), HOUR 6+ (polish, what can wait). What decisions must be locked NOW vs deferred to implementation?",
192
- "Mode Selection with Default Heuristic Present four options: SCOPE EXPANSION (dream big), SELECTIVE EXPANSION (hold scope + cherry-pick), HOLD SCOPE (maximum rigor), SCOPE REDUCTION (strip to essentials). Suggest default: greenfield EXPANSION, bug/hotfix HOLD, >15 files touched → suggest REDUCTION. Once selected, commit fully.",
193
- "Error & Rescue Registry For every new capability in scope: what breaks if it fails? How is the failure detected? What is the fallback? This is scope, not design — decide WHAT to protect, not HOW."
186
+ "**Assess complexity**Read the brainstorm artifact. If project is simple (single component, clear architecture, personal/prototype), run light-touch scope: mode selection, 3-5 key in/out boundaries, deferred items. Skip Dream State Mapping and Temporal Interrogation. If project is complex (multi-component, team delivery, production), run the full checklist.",
187
+ "**Prime Directives**Zero silent failures. For each in-scope capability, name concrete failure modes, the exact error surface, and trace all four data-flow paths (happy, nil, empty, upstream error). Include interaction edge cases (double-click, navigate-away, stale state), observability commitments, and explicit deferred-item logging.",
188
+ "**Premise Challenge**Is this the right problem? What if we do nothing? What are we optimizing for?",
189
+ "**Existing Code Leverage**Search for existing solutions before deciding to build new.",
190
+ "**Dream State Mapping** — (complex projects only) describe the ideal state 12 months out using `CURRENT STATE -> THIS PLAN -> 12-MONTH IDEAL`, then verify this scope moves toward that target.",
191
+ "**Implementation Alternatives**Produce 2-3 distinct approaches. For each: Name, Summary, Effort (S/M/L/XL), Risk (Low/Med/High), 2-3 Pros, 2-3 Cons, and explicit Reuses. One option must be minimal viable, one must be ideal architecture.",
192
+ "**Temporal Interrogation** (complex projects only) simulate implementation timeline: HOUR 1 foundations, HOUR 2-3 core logic, HOUR 4-5 integration surprises, HOUR 6+ polish/tests. Decide what must be locked now vs safely deferred.",
193
+ "**Mode Selection** Present expand/selective/hold/reduce with recommendation and default heuristic: greenfield -> expand, feature enhancement -> selective, bugfix/hotfix/refactor -> hold, broad blast radius (>15 files or multi-team impact) -> reduce.",
194
+ "**Mode-Specific Analysis** — After mode is selected, run the matching analysis: EXPAND (10x and delight opportunities), SELECTIVE (hold-scope rigor then cherry-picked expansions), HOLD (minimum-change-set hardening), REDUCE (ruthless cuts and follow-up split).",
195
+ "**Error and Rescue Registry** — For each capability: what breaks, how detected, what fallback."
194
196
  ],
195
197
  interactionProtocol: [
196
- "For scope mode selection: use the Decision Protocol — present expand/selective/hold/reduce as labeled options with trade-offs and mark one as (recommended). If AskQuestion/AskUserQuestion is available, send exactly ONE question per call, validate fields against runtime schema, and on schema error immediately fall back to plain-text question instead of retrying guessed payloads.",
198
+ "For scope mode selection: use the Decision Protocol — present expand/selective/hold/reduce as labeled options with trade-offs and mark one as (recommended). Base your recommendation on default heuristics: greenfield -> expand, enhancement -> selective, bugfix/hotfix/refactor -> hold, broad blast radius -> reduce. If AskQuestion/AskUserQuestion is available, send exactly ONE question per call, validate fields against runtime schema, and on schema error immediately fall back to plain-text question instead of retrying guessed payloads.",
199
+ "Walk through the scope checklist interactively. Each checklist item that surfaces a decision should be presented to the user as a question, not as a monologue. Do not dump all items at once.",
197
200
  "Challenge premise and verify the problem framing before anything else.",
201
+ "Take a position on every scope decision. Avoid hedging phrases like 'this could work' or 'there are many ways'; state your recommendation and one concrete condition that would change it.",
202
+ "Use pushback patterns when framing is weak: vague scope -> force a specific user/problem, platform vision -> force a narrowest viable wedge, social proof -> demand behavioral evidence.",
198
203
  "Present one structural scope issue at a time for decision. Do NOT batch. Use structured options for each scope boundary question.",
199
204
  "Record explicit in-scope and out-of-scope contract.",
200
205
  "Once the user accepts or rejects a recommendation, commit fully. Do not re-argue.",
@@ -203,25 +208,29 @@ const SCOPE = {
203
208
  ],
204
209
  process: [
205
210
  "Run premise challenge and existing-solution leverage check.",
206
- "Produce 2-3 scope alternatives (minimum viable + ideal included).",
211
+ "Produce 2-3 scope alternatives in a structured format (Name, Summary, Effort, Risk, Pros, Cons, Reuses) with minimum viable and ideal architecture options included.",
207
212
  "Choose scope mode with user approval.",
213
+ "Run mode-specific analysis that matches the selected scope mode.",
208
214
  "Walk through scope review sections one at a time.",
209
- "Write explicit scope contract and deferred items.",
210
- "Produce scope summary with mode, in-scope, out-of-scope, and deferred."
215
+ "Write explicit scope contract, discretion areas, and deferred items.",
216
+ "Produce scope summary plus completion dashboard (checklist findings, number of resolved decisions, unresolved items or `None`)."
211
217
  ],
212
218
  requiredGates: [
213
219
  { id: "scope_premise_challenged", description: "Problem framing and assumptions were challenged." },
214
- { id: "scope_alternatives_produced", description: "At least 2 implementation alternatives with effort/risk evaluated." },
220
+ { id: "scope_alternatives_produced", description: "At least 2 implementation alternatives were evaluated with explicit effort/risk and reuse fields." },
215
221
  { id: "scope_mode_selected", description: "One scope mode was explicitly selected." },
216
222
  { id: "scope_contract_written", description: "In-scope/out-of-scope contract is documented." },
223
+ { id: "scope_discretion_documented", description: "Discretion areas are documented (or explicitly marked as none)." },
217
224
  { id: "scope_user_approved", description: "User approved the final scope direction." }
218
225
  ],
219
226
  requiredEvidence: [
220
227
  "Artifact written to `.cclaw/artifacts/02-scope.md`.",
221
228
  "In-scope and out-of-scope lists are explicit.",
229
+ "Discretion areas are explicit (or marked as `None`).",
222
230
  "Selected mode and rationale are documented.",
223
231
  "Premise challenge findings documented.",
224
- "Deferred items list with one-line rationale for each."
232
+ "Deferred items list with one-line rationale for each.",
233
+ "Completion dashboard lists checklist findings, decision count, and unresolved items (or `None`)."
225
234
  ],
226
235
  inputs: ["brainstorm artifact", "timeline constraints", "product priorities"],
227
236
  requiredContext: [
@@ -229,22 +238,27 @@ const SCOPE = {
229
238
  "existing capabilities and reusable components",
230
239
  "delivery deadlines and risk tolerance"
231
240
  ],
232
- outputs: ["scope mode decision", "scope contract", "deferred scope list", "scope summary"],
241
+ outputs: ["scope mode decision", "scope contract", "discretion areas list", "deferred scope list", "scope summary", "scope completion dashboard"],
233
242
  blockers: [
234
243
  "scope mode not selected",
235
244
  "in/out boundaries ambiguous",
245
+ "discretion areas undefined",
236
246
  "critical premise disagreement unresolved"
237
247
  ],
238
248
  exitCriteria: [
239
249
  "scope contract approved by user",
250
+ "discretion areas recorded explicitly",
240
251
  "required gates marked satisfied",
241
252
  "deferred list recorded explicitly",
253
+ "completion dashboard produced",
242
254
  "scope summary produced"
243
255
  ],
244
256
  antiPatterns: [
245
257
  "Scope silently expanded during discussion",
246
258
  "No explicit out-of-scope section",
247
259
  "Premise accepted without challenge",
260
+ "Sycophantic agreement without evidence-based pushback",
261
+ "Hedged recommendations that avoid taking a position",
248
262
  "Batching multiple scope issues into one question",
249
263
  "Re-arguing for smaller scope after user rejects reduction"
250
264
  ],
@@ -252,19 +266,23 @@ const SCOPE = {
252
266
  { claim: "Scope can be finalized during implementation.", reality: "Late scope decisions create architecture churn and missed deadlines." },
253
267
  { claim: "Mode selection is unnecessary overhead.", reality: "Mode selection makes trade-offs explicit and prevents silent drift." },
254
268
  { claim: "Out-of-scope is obvious.", reality: "Unwritten exclusions return later as hidden requirements." },
255
- { claim: "We do not need alternatives for a clear request.", reality: "Even clear requests benefit from a minimal-viable vs ideal comparison." }
269
+ { claim: "We do not need alternatives for a clear request.", reality: "Even clear requests benefit from a minimal-viable vs ideal comparison." },
270
+ { claim: "Pushback risks sounding confrontational, so I should stay neutral.", reality: "Respectful pushback catches framing errors before they become expensive implementation mistakes." }
256
271
  ],
257
272
  redFlags: [
258
273
  "No selected mode in artifact",
274
+ "Mode selected without heuristic justification",
275
+ "No discretion section (or explicit `None`) in artifact",
259
276
  "No deferred/not-in-scope section",
260
277
  "No user approval marker",
261
278
  "Premise challenge missing or superficial",
262
279
  "No implementation alternatives evaluated"
263
280
  ],
264
- policyNeedles: ["Scope mode", "In Scope", "Out of Scope", "NOT in scope", "Premise Challenge"],
281
+ policyNeedles: ["Scope mode", "In Scope", "Out of Scope", "Discretion Areas", "NOT in scope", "Premise Challenge"],
265
282
  artifactFile: "02-scope.md",
266
283
  next: "design",
267
284
  cognitivePatterns: [
285
+ { name: "Depth Matches Complexity", description: "Scale each section to project complexity: concise for simple prototypes, deep for production systems." },
268
286
  { name: "Classification Instinct", description: "Categorize every decision by reversibility x magnitude. Most things are two-way doors — move fast. Only slow down for irreversible + high-magnitude decisions." },
269
287
  { name: "Inversion Reflex", description: "For every 'how do we win?' also ask 'what would make us fail?' Map failure modes before committing to scope." },
270
288
  { name: "Focus as Subtraction", description: "Primary value-add is what to NOT do. Default: do fewer things, better. Every feature must earn its place." },
@@ -330,12 +348,15 @@ const SCOPE = {
330
348
  traceabilityRule: "Every scope boundary must be traceable to a brainstorm decision. Every downstream design choice must stay within the scope contract."
331
349
  },
332
350
  artifactValidation: [
333
- { section: "Prime Directives", required: true, validationRule: "Named error modes for each capability. Four paths per data flow." },
351
+ { section: "Prime Directives", required: true, validationRule: "For each scoped capability: named failure modes, explicit error surface, four data-flow paths, interaction edge cases, observability expectations, and deferred-item handling." },
334
352
  { section: "Premise Challenge", required: true, validationRule: "Must contain explicit answers to: right problem? direct path? what if nothing?" },
353
+ { section: "Implementation Alternatives", required: true, validationRule: "2-3 options with Name, Summary, Effort, Risk, Pros, Cons, and Reuses. Must include minimal viable and ideal architecture options." },
335
354
  { section: "Scope Mode", required: true, validationRule: "Must state selected mode and rationale with default heuristic justification." },
336
355
  { section: "In Scope / Out of Scope", required: true, validationRule: "Two separate explicit lists. Out-of-scope must not be empty." },
356
+ { section: "Discretion Areas", required: true, validationRule: "Explicit list of implementer decision zones, or 'None' if scope is fully locked." },
337
357
  { section: "Deferred Items", required: true, validationRule: "Each item has one-line rationale. If empty, state 'None' explicitly." },
338
358
  { section: "Error & Rescue Registry", required: true, validationRule: "Each scoped capability has: failure mode, detection method, fallback decision." },
359
+ { section: "Completion Dashboard", required: true, validationRule: "Lists checklist findings, count of resolved decisions, and unresolved decisions (or 'None')." },
339
360
  { section: "Scope Summary", required: true, validationRule: "Clean summary: mode, strongest challenges, recommended path, accepted scope, deferred, excluded." }
340
361
  ],
341
362
  namedAntiPattern: {
@@ -3,46 +3,35 @@ import { orderedStageSchemas } from "./stage-schema.js";
3
3
  export const ARTIFACT_TEMPLATES = {
4
4
  "01-brainstorm.md": `# Brainstorm Artifact
5
5
 
6
- ## Problem Framing
7
- - **User problem:**
8
- - **Desired outcome:**
9
- - **Success signal:**
10
-
11
- ## Routing Decision
12
- - **Route:** simple | complex
13
- - **Reasoning:**
14
-
15
- ## Grounding Checkpoints
16
- ### Round 1 grounding
17
- - **What is fixed now:**
18
- - **What is still unknown:**
19
-
20
- ### Round 2 grounding
21
- - **What is fixed now:**
22
- - **What is still unknown:**
23
-
24
- ### Round 3 grounding
25
- - **What is fixed now:**
26
- - **What is still unknown:**
27
-
28
- ## Forcing Questions Log
29
- | Round | Question | User answer | Decision impact |
6
+ ## Context
7
+ - **Project state:**
8
+ - **Relevant existing code/patterns:**
9
+
10
+ ## Problem
11
+ - **What we're solving:**
12
+ - **Success criteria:**
13
+ - **Constraints:**
14
+
15
+ ## Clarifying Questions
16
+ | # | Question | Answer | Decision impact |
30
17
  |---|---|---|---|
31
- | 2 | | | |
32
- | 2 | | | |
33
- | 3 | | | |
18
+ | 1 | | | |
34
19
 
35
- ## Options Comparison
36
- | Option | Summary | Trade-offs | Recommendation |
20
+ ## Approaches
21
+ | Approach | Architecture | Trade-offs | Recommendation |
37
22
  |---|---|---|---|
38
23
  | A | | | |
39
24
  | B | | | |
40
25
 
41
- ## Approved Direction
42
- - **Selected option:**
43
- - **Why selected:**
44
- - **What was approved:**
45
- - **Approval marker:**
26
+ ## Selected Direction
27
+ - **Approach:**
28
+ - **Rationale:**
29
+ - **Approval:** pending
30
+
31
+ ## Design
32
+ - **Architecture:**
33
+ - **Key components:**
34
+ - **Data flow:**
46
35
 
47
36
  ## Assumptions and Open Questions
48
37
  - **Assumptions:**
@@ -60,6 +49,27 @@ export const ARTIFACT_TEMPLATES = {
60
49
  - Why this path?
61
50
  - What if we do nothing?
62
51
 
52
+ ## Dream State Mapping
53
+ - CURRENT STATE:
54
+ - THIS PLAN:
55
+ - 12-MONTH IDEAL:
56
+ - Alignment verdict:
57
+
58
+ ## Implementation Alternatives
59
+ | Option | Summary | Effort (S/M/L/XL) | Risk (Low/Med/High) | Pros | Cons | Reuses |
60
+ |---|---|---|---|---|---|---|
61
+ | A (minimum viable) | | | | | | |
62
+ | B (ideal architecture) | | | | | | |
63
+ | C (optional) | | | | | | |
64
+
65
+ ## Temporal Interrogation
66
+ | Time slice | Likely decision pressure | Lock now or defer? | Reason |
67
+ |---|---|---|---|
68
+ | HOUR 1 (foundations) | | | |
69
+ | HOUR 2-3 (core logic) | | | |
70
+ | HOUR 4-5 (integration) | | | |
71
+ | HOUR 6+ (polish/tests) | | | |
72
+
63
73
  ## Scope Mode
64
74
  - [ ] expand
65
75
  - [ ] selective
@@ -74,6 +84,9 @@ export const ARTIFACT_TEMPLATES = {
74
84
  ### Out of Scope
75
85
  -
76
86
 
87
+ ## Discretion Areas
88
+ - (or \`None\`)
89
+
77
90
  ## Deferred Items
78
91
  | Item | Rationale |
79
92
  |---|---|
@@ -84,6 +97,11 @@ export const ARTIFACT_TEMPLATES = {
84
97
  |---|---|---|---|
85
98
  | | | | |
86
99
 
100
+ ## Completion Dashboard
101
+ - Checklist findings:
102
+ - Resolved decisions count:
103
+ - Unresolved decisions (or \`None\`):
104
+
87
105
  ## Scope Summary
88
106
  - Selected mode:
89
107
  - Accepted scope:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cclaw-cli",
3
- "version": "0.5.5",
3
+ "version": "0.5.7",
4
4
  "description": "Installer-first flow toolkit for coding agents",
5
5
  "type": "module",
6
6
  "bin": {