cclaw-cli 0.5.6 → 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.
@@ -49,8 +49,46 @@ Carry the no-new-dependency constraint and hard-block behavior directly into sco
49
49
  scope: `### Scope contract
50
50
 
51
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).
52
54
 
53
- **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.
55
+ ### Prime Directives (applied)
56
+
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.
62
+
63
+ ### Premise challenge result
64
+
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.
66
+
67
+ ### Dream State Mapping
68
+
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. |
75
+
76
+ ### Implementation Alternatives
77
+
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 |
83
+
84
+ ### Temporal Interrogation
85
+
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 |
54
92
 
55
93
  ### In scope / out of scope / deferred
56
94
 
@@ -60,22 +98,28 @@ Carry the no-new-dependency constraint and hard-block behavior directly into sco
60
98
  | **Out of scope** | Email/SMS/push providers; marketing campaigns; per-user notification preferences beyond on/off |
61
99
  | **Deferred** | WebSocket channel; rich media attachments in notifications; full-text search across historical events |
62
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
+
63
106
  ### Error & Rescue Registry (sample entry)
64
107
 
65
108
  | Capability | Failure mode | Detection | Fallback |
66
109
  | --- | --- | --- | --- |
67
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 |
68
111
 
69
- ### Non-goals (guardrails)
112
+ ### Completion Dashboard
70
113
 
71
- - No “infinite history” guarantee in v1; retention policy can be time-bounded.
72
- - 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
73
117
 
74
- ### Owners & checkpoints
118
+ ### Scope Summary
75
119
 
76
- - **Product:** confirms reframed premise and acceptance of deferred items.
77
- - **Engineering:** confirms SSE + REST snapshot split is feasible behind current gateway.
78
- - **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.`,
79
123
  design: `### Search Before Building (sample result)
80
124
 
81
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");
@@ -48,8 +48,10 @@ const BRAINSTORM = {
48
48
  ],
49
49
  interactionProtocol: [
50
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.",
51
52
  "Ask exactly one question per turn. Prefer multiple choice. No bundled questions.",
52
- "Each question should change a concrete design decision. If a question only gathers trivia, skip it.",
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.",
53
55
  "Present design in sections scaled to their complexity — a few sentences for simple aspects, detailed for nuanced ones. Get approval after each section.",
54
56
  "When proposing approaches, lead with your recommendation and explain why.",
55
57
  "State explicitly what is being approved when requesting approval.",
@@ -136,7 +138,8 @@ const BRAINSTORM = {
136
138
  { name: "Context Before Questions", description: "Understand what exists before asking what to build." },
137
139
  { name: "Depth Matches Complexity", description: "Brief design for simple tasks, thorough exploration for complex ones." },
138
140
  { name: "Diverge Then Commit", description: "Explore multiple architecturally distinct options first, commit only after explicit approval." },
139
- { name: "Question Quality Over Quantity", description: "Each question should change what we build, not just gather trivia." }
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." }
140
143
  ],
141
144
  reviewSections: [],
142
145
  completionStatus: ["DONE", "DONE_WITH_CONCERNS", "BLOCKED"],
@@ -180,18 +183,23 @@ const SCOPE = {
180
183
  "The work is a pure implementation or debugging pass within existing scope"
181
184
  ],
182
185
  checklist: [
183
- "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.",
184
- "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?",
185
- "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.",
186
- "Dream State MappingDescribe the ideal end state 12 months from now. Does this plan move toward that state or away from it?",
187
- "Implementation Alternatives (MANDATORY) Produce 2-3 distinct approaches. One must be 'minimal viable', one must be 'ideal architecture'. Include effort/risk/reversibility for each.",
188
- "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?",
189
- "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.",
190
- "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."
191
196
  ],
192
197
  interactionProtocol: [
193
- "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.",
194
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.",
195
203
  "Present one structural scope issue at a time for decision. Do NOT batch. Use structured options for each scope boundary question.",
196
204
  "Record explicit in-scope and out-of-scope contract.",
197
205
  "Once the user accepts or rejects a recommendation, commit fully. Do not re-argue.",
@@ -200,25 +208,29 @@ const SCOPE = {
200
208
  ],
201
209
  process: [
202
210
  "Run premise challenge and existing-solution leverage check.",
203
- "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.",
204
212
  "Choose scope mode with user approval.",
213
+ "Run mode-specific analysis that matches the selected scope mode.",
205
214
  "Walk through scope review sections one at a time.",
206
- "Write explicit scope contract and deferred items.",
207
- "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`)."
208
217
  ],
209
218
  requiredGates: [
210
219
  { id: "scope_premise_challenged", description: "Problem framing and assumptions were challenged." },
211
- { 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." },
212
221
  { id: "scope_mode_selected", description: "One scope mode was explicitly selected." },
213
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)." },
214
224
  { id: "scope_user_approved", description: "User approved the final scope direction." }
215
225
  ],
216
226
  requiredEvidence: [
217
227
  "Artifact written to `.cclaw/artifacts/02-scope.md`.",
218
228
  "In-scope and out-of-scope lists are explicit.",
229
+ "Discretion areas are explicit (or marked as `None`).",
219
230
  "Selected mode and rationale are documented.",
220
231
  "Premise challenge findings documented.",
221
- "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`)."
222
234
  ],
223
235
  inputs: ["brainstorm artifact", "timeline constraints", "product priorities"],
224
236
  requiredContext: [
@@ -226,22 +238,27 @@ const SCOPE = {
226
238
  "existing capabilities and reusable components",
227
239
  "delivery deadlines and risk tolerance"
228
240
  ],
229
- 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"],
230
242
  blockers: [
231
243
  "scope mode not selected",
232
244
  "in/out boundaries ambiguous",
245
+ "discretion areas undefined",
233
246
  "critical premise disagreement unresolved"
234
247
  ],
235
248
  exitCriteria: [
236
249
  "scope contract approved by user",
250
+ "discretion areas recorded explicitly",
237
251
  "required gates marked satisfied",
238
252
  "deferred list recorded explicitly",
253
+ "completion dashboard produced",
239
254
  "scope summary produced"
240
255
  ],
241
256
  antiPatterns: [
242
257
  "Scope silently expanded during discussion",
243
258
  "No explicit out-of-scope section",
244
259
  "Premise accepted without challenge",
260
+ "Sycophantic agreement without evidence-based pushback",
261
+ "Hedged recommendations that avoid taking a position",
245
262
  "Batching multiple scope issues into one question",
246
263
  "Re-arguing for smaller scope after user rejects reduction"
247
264
  ],
@@ -249,19 +266,23 @@ const SCOPE = {
249
266
  { claim: "Scope can be finalized during implementation.", reality: "Late scope decisions create architecture churn and missed deadlines." },
250
267
  { claim: "Mode selection is unnecessary overhead.", reality: "Mode selection makes trade-offs explicit and prevents silent drift." },
251
268
  { claim: "Out-of-scope is obvious.", reality: "Unwritten exclusions return later as hidden requirements." },
252
- { 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." }
253
271
  ],
254
272
  redFlags: [
255
273
  "No selected mode in artifact",
274
+ "Mode selected without heuristic justification",
275
+ "No discretion section (or explicit `None`) in artifact",
256
276
  "No deferred/not-in-scope section",
257
277
  "No user approval marker",
258
278
  "Premise challenge missing or superficial",
259
279
  "No implementation alternatives evaluated"
260
280
  ],
261
- 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"],
262
282
  artifactFile: "02-scope.md",
263
283
  next: "design",
264
284
  cognitivePatterns: [
285
+ { name: "Depth Matches Complexity", description: "Scale each section to project complexity: concise for simple prototypes, deep for production systems." },
265
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." },
266
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." },
267
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." },
@@ -327,12 +348,15 @@ const SCOPE = {
327
348
  traceabilityRule: "Every scope boundary must be traceable to a brainstorm decision. Every downstream design choice must stay within the scope contract."
328
349
  },
329
350
  artifactValidation: [
330
- { 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." },
331
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." },
332
354
  { section: "Scope Mode", required: true, validationRule: "Must state selected mode and rationale with default heuristic justification." },
333
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." },
334
357
  { section: "Deferred Items", required: true, validationRule: "Each item has one-line rationale. If empty, state 'None' explicitly." },
335
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')." },
336
360
  { section: "Scope Summary", required: true, validationRule: "Clean summary: mode, strongest challenges, recommended path, accepted scope, deferred, excluded." }
337
361
  ],
338
362
  namedAntiPattern: {
@@ -49,6 +49,27 @@ export const ARTIFACT_TEMPLATES = {
49
49
  - Why this path?
50
50
  - What if we do nothing?
51
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
+
52
73
  ## Scope Mode
53
74
  - [ ] expand
54
75
  - [ ] selective
@@ -63,6 +84,9 @@ export const ARTIFACT_TEMPLATES = {
63
84
  ### Out of Scope
64
85
  -
65
86
 
87
+ ## Discretion Areas
88
+ - (or \`None\`)
89
+
66
90
  ## Deferred Items
67
91
  | Item | Rationale |
68
92
  |---|---|
@@ -73,6 +97,11 @@ export const ARTIFACT_TEMPLATES = {
73
97
  |---|---|---|---|
74
98
  | | | | |
75
99
 
100
+ ## Completion Dashboard
101
+ - Checklist findings:
102
+ - Resolved decisions count:
103
+ - Unresolved decisions (or \`None\`):
104
+
76
105
  ## Scope Summary
77
106
  - Selected mode:
78
107
  - Accepted scope:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cclaw-cli",
3
- "version": "0.5.6",
3
+ "version": "0.5.7",
4
4
  "description": "Installer-first flow toolkit for coding agents",
5
5
  "type": "module",
6
6
  "bin": {