cclaw-cli 0.5.0 → 0.5.1
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.
- package/dist/content/stage-schema.js +39 -23
- package/dist/content/templates.js +17 -6
- package/dist/install.js +0 -4
- package/dist/runs.js +2 -14
- package/package.json +1 -1
|
@@ -36,38 +36,44 @@ const BRAINSTORM = {
|
|
|
36
36
|
"The task is purely retrospective after ship with no new design decisions needed"
|
|
37
37
|
],
|
|
38
38
|
checklist: [
|
|
39
|
-
"Explore project context — check files, docs, recent commits, existing behavior.",
|
|
39
|
+
"Explore project context — check files, docs, recent commits, existing behavior. Summarize what you found (even for seemingly simple projects).",
|
|
40
40
|
"Assess scope — if the request describes multiple independent subsystems, flag for decomposition before detailed questions.",
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
41
|
+
"Restate the problem — before any questions, summarize what you understood the user wants and why. Ask the user to confirm or correct your understanding.",
|
|
42
|
+
"Ask clarifying questions — one at a time, understand purpose, constraints, success criteria, target users, and edge cases. Continue until you can confidently describe the solution space. Minimum: understand the WHY, WHO, WHAT, and boundary conditions.",
|
|
43
|
+
"Propose 2-3 approaches — with real trade-offs (not cosmetic differences) and your explicit recommendation with reasoning. Explain WHY you recommend this option over others.",
|
|
44
|
+
"Present design — in sections. After each section, explicitly state what you are asking the user to approve: 'Do you approve [specific thing]?' Never ask a bare 'одобряете?/approve?' without context.",
|
|
44
45
|
"Write design doc — save to `.cclaw/artifacts/01-brainstorm.md`.",
|
|
45
46
|
"Self-review — scan for placeholders, TBDs, contradictions, ambiguity, scope creep. Fix inline.",
|
|
46
|
-
"User reviews written artifact — ask user to review
|
|
47
|
+
"User reviews written artifact — ask user to review the written artifact (not the chat summary). **STOP.** Do NOT proceed until user responds.",
|
|
47
48
|
"Stage complete — update `flow-state.json` per the Stage Completion Protocol. Tell user to run `/cc-next` to continue to scope."
|
|
48
49
|
],
|
|
49
50
|
interactionProtocol: [
|
|
50
|
-
"Explore context first (files, docs, existing behavior).",
|
|
51
|
-
"
|
|
52
|
-
"
|
|
51
|
+
"Explore context first (files, docs, existing behavior). Share a brief summary of what you found.",
|
|
52
|
+
"Restate the problem in your own words. Ask user to confirm before proceeding to questions.",
|
|
53
|
+
"Ask one clarifying question per message. Do NOT combine questions. Continue until you understand purpose, constraints, users, success criteria, and edge cases.",
|
|
54
|
+
"For approach selection: use the Decision Protocol — present labeled options (A/B/C) with REAL trade-offs (not cosmetic) and mark one as (recommended) with clear reasoning. 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.",
|
|
55
|
+
"Every approval question MUST state what exactly is being approved: 'Do you approve [the architecture / the API shape / the dependency choice]?' Never ask a bare 'approve?' or 'looks good?'.",
|
|
53
56
|
"Get section-by-section approval before finalizing the design direction.",
|
|
54
57
|
"Run a self-review pass (ambiguity, placeholders, contradictions) before handoff.",
|
|
55
58
|
"**STOP.** Wait for explicit user approval after writing the artifact. Do NOT auto-advance to the next stage."
|
|
56
59
|
],
|
|
57
60
|
process: [
|
|
58
|
-
"
|
|
61
|
+
"Explore project context — files, docs, behavior, recent changes. Share findings.",
|
|
62
|
+
"Restate the problem — summarize what the user wants and why. Get confirmation.",
|
|
63
|
+
"Clarify iteratively — ask questions one at a time until you understand WHY, WHO, WHAT, success criteria, and boundaries.",
|
|
59
64
|
"Identify whether request should be decomposed into smaller sub-problems.",
|
|
60
|
-
"Offer alternatives and recommendation with rationale.",
|
|
61
|
-
"Present design in sections
|
|
62
|
-
"Write artifact
|
|
65
|
+
"Offer 2-3 alternatives with real trade-offs and recommendation with rationale.",
|
|
66
|
+
"Present design in sections. After each section explicitly name what you ask the user to approve.",
|
|
67
|
+
"Write artifact to `.cclaw/artifacts/01-brainstorm.md`.",
|
|
63
68
|
"Run self-review: placeholder scan, internal consistency, scope check, ambiguity check.",
|
|
64
|
-
"Ask user to review the written
|
|
69
|
+
"Ask user to review the written artifact. Wait for changes or approval.",
|
|
65
70
|
"Handoff to scope stage only after approval is explicit."
|
|
66
71
|
],
|
|
67
72
|
requiredGates: [
|
|
68
|
-
{ id: "brainstorm_context_explored", description: "Project context and constraints have been reviewed." },
|
|
69
|
-
{ id: "
|
|
70
|
-
{ id: "
|
|
73
|
+
{ id: "brainstorm_context_explored", description: "Project context and constraints have been reviewed and summarized." },
|
|
74
|
+
{ id: "brainstorm_problem_restated", description: "Problem was restated in agent's words and user confirmed the understanding." },
|
|
75
|
+
{ id: "brainstorm_options_compared", description: "At least two alternatives were compared with real trade-offs." },
|
|
76
|
+
{ id: "brainstorm_design_approved", description: "User approved a concrete design direction (with explicit statement of what was approved)." },
|
|
71
77
|
{ id: "brainstorm_self_review_passed", description: "Design doc passed placeholder/ambiguity/consistency checks." },
|
|
72
78
|
{ id: "brainstorm_user_reviewed_artifact", description: "User reviewed the written artifact and confirmed readiness." }
|
|
73
79
|
],
|
|
@@ -104,24 +110,32 @@ const BRAINSTORM = {
|
|
|
104
110
|
"Asking many questions in one message",
|
|
105
111
|
"Jumping directly into implementation",
|
|
106
112
|
"Combining visual companion offer with a clarifying question",
|
|
107
|
-
"Invoking implementation skills before writing plans"
|
|
113
|
+
"Invoking implementation skills before writing plans",
|
|
114
|
+
"Asking bare 'approve?' or 'одобряете?' without stating WHAT is being approved",
|
|
115
|
+
"Presenting a single summary and asking for blanket approval instead of section-by-section review",
|
|
116
|
+
"Rushing through clarification — asking 1-2 generic questions then jumping to design"
|
|
108
117
|
],
|
|
109
118
|
rationalizations: [
|
|
110
119
|
{ claim: "This is too simple for design.", reality: "Simple tasks fail fast when assumptions are wrong; a short design pass prevents rework." },
|
|
111
120
|
{ claim: "We can figure it out while coding.", reality: "Coding before alignment creates churn and hidden scope growth." },
|
|
112
121
|
{ claim: "There is only one obvious approach.", reality: "Without alternatives, trade-offs stay implicit and risk goes unexamined." },
|
|
113
|
-
{ claim: "The user already knows what they want.", reality: "Unstated assumptions diverge during implementation; explicit design surfaces them early." }
|
|
122
|
+
{ claim: "The user already knows what they want.", reality: "Unstated assumptions diverge during implementation; explicit design surfaces them early." },
|
|
123
|
+
{ claim: "This is straightforward, 1-2 questions are enough.", reality: "Even simple projects have hidden constraints (error handling, edge cases, deployment). A few extra questions now prevent rework later." }
|
|
114
124
|
],
|
|
115
125
|
redFlags: [
|
|
116
126
|
"No alternatives documented",
|
|
117
127
|
"No explicit approval checkpoint",
|
|
118
128
|
"Implementation-related actions before approval",
|
|
119
129
|
"Self-review skipped or glossed over",
|
|
120
|
-
"Artifact has TBD or placeholder sections"
|
|
130
|
+
"Artifact has TBD or placeholder sections",
|
|
131
|
+
"Fewer than 3 clarifying questions asked for any non-trivial project",
|
|
132
|
+
"Approval requested without stating what exactly is being approved"
|
|
121
133
|
],
|
|
122
134
|
policyNeedles: [
|
|
135
|
+
"Restate problem before questions",
|
|
123
136
|
"One clarifying question per message",
|
|
124
|
-
"2-3 approaches with trade-offs",
|
|
137
|
+
"2-3 approaches with real trade-offs",
|
|
138
|
+
"State what is being approved",
|
|
125
139
|
"Do NOT implement, scaffold, or modify behavior"
|
|
126
140
|
],
|
|
127
141
|
artifactFile: "01-brainstorm.md",
|
|
@@ -140,9 +154,11 @@ const BRAINSTORM = {
|
|
|
140
154
|
traceabilityRule: "Every approved direction must be traceable forward through scope and design. Downstream stages must reference brainstorm decisions."
|
|
141
155
|
},
|
|
142
156
|
artifactValidation: [
|
|
143
|
-
{ section: "Problem Statement", required: true, validationRule: "Must describe the user problem, not the solution." },
|
|
144
|
-
{ section: "
|
|
145
|
-
{ section: "
|
|
157
|
+
{ section: "Problem Statement", required: true, validationRule: "Must describe the user problem, not the solution. Include WHO and WHY." },
|
|
158
|
+
{ section: "Known Context", required: true, validationRule: "Files, patterns, constraints discovered during exploration. Evidence that context was actually explored." },
|
|
159
|
+
{ section: "Alternatives Table", required: true, validationRule: "At least 2 approaches with real trade-offs (not cosmetic) and recommendation with reasoning." },
|
|
160
|
+
{ section: "Approved Direction", required: true, validationRule: "Must contain explicit approval marker from user. State what was approved." },
|
|
161
|
+
{ section: "Assumptions & Risks", required: true, validationRule: "Explicit assumptions made during design. Known risks. If none, state 'None'." },
|
|
146
162
|
{ section: "Open Questions", required: true, validationRule: "If empty, state 'None' explicitly. Do not omit." }
|
|
147
163
|
],
|
|
148
164
|
namedAntiPattern: {
|
|
@@ -4,9 +4,16 @@ export const ARTIFACT_TEMPLATES = {
|
|
|
4
4
|
"01-brainstorm.md": `# Brainstorm Artifact
|
|
5
5
|
|
|
6
6
|
## Problem Statement
|
|
7
|
-
- User problem
|
|
8
|
-
-
|
|
9
|
-
-
|
|
7
|
+
- **User problem:**
|
|
8
|
+
- **Who benefits:**
|
|
9
|
+
- **Why now:**
|
|
10
|
+
- **Success signal:**
|
|
11
|
+
- **Constraints:**
|
|
12
|
+
|
|
13
|
+
## Known Context
|
|
14
|
+
- **Explored files/patterns:**
|
|
15
|
+
- **Existing behavior:**
|
|
16
|
+
- **Relevant dependencies:**
|
|
10
17
|
|
|
11
18
|
## Alternatives Table
|
|
12
19
|
| Option | Summary | Trade-offs | Recommendation |
|
|
@@ -16,9 +23,13 @@ export const ARTIFACT_TEMPLATES = {
|
|
|
16
23
|
| C | | | |
|
|
17
24
|
|
|
18
25
|
## Approved Direction
|
|
19
|
-
- Selected option
|
|
20
|
-
- Why selected
|
|
21
|
-
-
|
|
26
|
+
- **Selected option:**
|
|
27
|
+
- **Why selected:**
|
|
28
|
+
- **What was approved:** (state the specific decision)
|
|
29
|
+
- **Approval marker:**
|
|
30
|
+
|
|
31
|
+
## Assumptions & Risks
|
|
32
|
+
-
|
|
22
33
|
|
|
23
34
|
## Open Questions
|
|
24
35
|
- None
|
package/dist/install.js
CHANGED
|
@@ -179,10 +179,6 @@ async function writeCommandContracts(projectRoot) {
|
|
|
179
179
|
async function writeArtifactTemplates(projectRoot) {
|
|
180
180
|
for (const [fileName, content] of Object.entries(ARTIFACT_TEMPLATES)) {
|
|
181
181
|
await writeFileSafe(runtimePath(projectRoot, "templates", fileName), content);
|
|
182
|
-
const artifactPath = runtimePath(projectRoot, "artifacts", fileName);
|
|
183
|
-
if (!(await exists(artifactPath))) {
|
|
184
|
-
await writeFileSafe(artifactPath, content);
|
|
185
|
-
}
|
|
186
182
|
}
|
|
187
183
|
}
|
|
188
184
|
async function writeSkills(projectRoot) {
|
package/dist/runs.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import fs from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { COMMAND_FILE_ORDER, RUNTIME_ROOT } from "./constants.js";
|
|
4
|
-
import { ARTIFACT_TEMPLATES } from "./content/templates.js";
|
|
5
4
|
import { createInitialFlowState } from "./flow-state.js";
|
|
6
5
|
import { ensureDir, exists, withDirectoryLock, writeFileSafe } from "./fs-utils.js";
|
|
7
6
|
const FLOW_STATE_REL_PATH = `${RUNTIME_ROOT}/state/flow-state.json`;
|
|
@@ -287,12 +286,6 @@ async function persistRunStateSnapshot(projectRoot, runId, state) {
|
|
|
287
286
|
stateSnapshot: snapshotState(safeState)
|
|
288
287
|
});
|
|
289
288
|
}
|
|
290
|
-
async function seedArtifactsFromTemplates(targetDir) {
|
|
291
|
-
await ensureDir(targetDir);
|
|
292
|
-
for (const [fileName, content] of Object.entries(ARTIFACT_TEMPLATES)) {
|
|
293
|
-
await writeFileSafe(path.join(targetDir, fileName), content);
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
289
|
async function syncActiveArtifactsToRun(projectRoot, runId) {
|
|
297
290
|
const fromDir = activeArtifactsPath(projectRoot);
|
|
298
291
|
const toDir = runArtifactsPath(projectRoot, runId);
|
|
@@ -317,13 +310,10 @@ async function createRun(projectRoot, options) {
|
|
|
317
310
|
await ensureDir(runRoot(projectRoot, runId));
|
|
318
311
|
await ensureRunMetadata(projectRoot, meta);
|
|
319
312
|
const runArtifactsDir = runArtifactsPath(projectRoot, runId);
|
|
313
|
+
await ensureDir(runArtifactsDir);
|
|
320
314
|
if (options?.seedFromActiveArtifacts && (await exists(activeArtifactsPath(projectRoot)))) {
|
|
321
|
-
await ensureDir(runArtifactsDir);
|
|
322
315
|
await copyImmediateFiles(activeArtifactsPath(projectRoot), runArtifactsDir);
|
|
323
316
|
}
|
|
324
|
-
else {
|
|
325
|
-
await seedArtifactsFromTemplates(runArtifactsDir);
|
|
326
|
-
}
|
|
327
317
|
return meta;
|
|
328
318
|
}
|
|
329
319
|
async function ensureRunHandoff(projectRoot, runId) {
|
|
@@ -350,9 +340,7 @@ export async function ensureRunSystem(projectRoot) {
|
|
|
350
340
|
await writeFlowState(projectRoot, state);
|
|
351
341
|
}
|
|
352
342
|
const runArtifactsDir = runArtifactsPath(projectRoot, activeRunId);
|
|
353
|
-
|
|
354
|
-
await seedArtifactsFromTemplates(runArtifactsDir);
|
|
355
|
-
}
|
|
343
|
+
await ensureDir(runArtifactsDir);
|
|
356
344
|
if ((await listImmediateFiles(activeArtifactsPath(projectRoot))).length === 0) {
|
|
357
345
|
await loadRunArtifactsToActive(projectRoot, activeRunId);
|
|
358
346
|
}
|