cclaw-cli 0.5.3 → 0.5.5
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/README.md +8 -11
- package/dist/artifact-linter.js +41 -13
- package/dist/cli.d.ts +2 -1
- package/dist/cli.js +12 -1
- package/dist/config.js +0 -19
- package/dist/content/contracts.js +7 -12
- package/dist/content/examples.js +42 -26
- package/dist/content/hooks.d.ts +4 -6
- package/dist/content/hooks.js +105 -435
- package/dist/content/learnings.js +55 -203
- package/dist/content/meta-skill.js +8 -11
- package/dist/content/next-command.js +3 -3
- package/dist/content/observe.d.ts +4 -7
- package/dist/content/observe.js +81 -55
- package/dist/content/session-hooks.js +8 -8
- package/dist/content/skills.js +9 -16
- package/dist/content/stage-schema.js +80 -97
- package/dist/content/templates.d.ts +1 -1
- package/dist/content/templates.js +27 -48
- package/dist/delegation.js +7 -7
- package/dist/doctor.js +17 -34
- package/dist/flow-state.js +1 -1
- package/dist/harness-adapters.js +1 -1
- package/dist/install.js +23 -49
- package/dist/policy.js +1 -4
- package/dist/runs.d.ts +13 -9
- package/dist/runs.js +108 -317
- package/dist/trace-matrix.js +8 -18
- package/dist/types.d.ts +0 -4
- package/package.json +1 -1
- package/dist/learnings-summarizer.d.ts +0 -25
- package/dist/learnings-summarizer.js +0 -201
|
@@ -22,161 +22,144 @@ const BRAINSTORM = {
|
|
|
22
22
|
stage: "brainstorm",
|
|
23
23
|
skillFolder: "brainstorming",
|
|
24
24
|
skillName: "brainstorming",
|
|
25
|
-
skillDescription: "Design-first stage.
|
|
26
|
-
hardGate: "Do NOT invoke
|
|
27
|
-
purpose: "Turn
|
|
25
|
+
skillDescription: "Design-first stage. Route request complexity, run phased forcing questions, and lock an approved direction before scope/design work.",
|
|
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.",
|
|
28
28
|
whenToUse: [
|
|
29
29
|
"Starting a new feature or behavior change",
|
|
30
|
-
"Requirements are ambiguous or
|
|
31
|
-
"Before any implementation-stage command"
|
|
30
|
+
"Requirements are ambiguous or trade-offs are unclear",
|
|
31
|
+
"Before any implementation-stage command or architecture commitment"
|
|
32
32
|
],
|
|
33
33
|
whenNotToUse: [
|
|
34
|
-
"
|
|
35
|
-
"The request is
|
|
36
|
-
"The task is
|
|
34
|
+
"A valid approved direction already exists and only execution remains",
|
|
35
|
+
"The request is a pure release/finalization action with no new product decisions",
|
|
36
|
+
"The task is retrospective only (post-ship audit with no new solution choices)"
|
|
37
37
|
],
|
|
38
38
|
checklist: [
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"Stage complete — update `flow-state.json` per the Stage Completion Protocol. Tell user to run `/cc-next` to continue to scope."
|
|
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`."
|
|
49
48
|
],
|
|
50
49
|
interactionProtocol: [
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"Ask
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"Run a
|
|
58
|
-
"**STOP.** Wait for explicit user approval after writing the artifact. Do NOT auto-advance
|
|
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.",
|
|
55
|
+
"State explicitly what is being approved when requesting approval.",
|
|
56
|
+
"Run a brief contradiction and ambiguity pass before handoff.",
|
|
57
|
+
"**STOP.** Wait for explicit user approval after writing the artifact. Do NOT auto-advance."
|
|
59
58
|
],
|
|
60
59
|
process: [
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"Run
|
|
69
|
-
"
|
|
70
|
-
"Handoff to scope stage only after approval is explicit."
|
|
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.",
|
|
68
|
+
"Handoff to scope only after approval is explicit."
|
|
71
69
|
],
|
|
72
70
|
requiredGates: [
|
|
73
|
-
{ id: "
|
|
74
|
-
{ id: "
|
|
75
|
-
{ id: "
|
|
76
|
-
{ id: "
|
|
77
|
-
{ id: "
|
|
78
|
-
{ id: "
|
|
79
|
-
{ id: "
|
|
80
|
-
{ id: "brainstorm_design_approved", description: "User approved a concrete design direction (with explicit statement of what was approved)." },
|
|
81
|
-
{ id: "brainstorm_self_review_passed", description: "Design doc passed placeholder/ambiguity/consistency checks." },
|
|
82
|
-
{ id: "brainstorm_user_reviewed_artifact", description: "User reviewed the written artifact and confirmed readiness." }
|
|
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." },
|
|
76
|
+
{ id: "brainstorm_direction_approved", description: "User approved a concrete direction and what exactly was approved is stated." },
|
|
77
|
+
{ id: "brainstorm_artifact_reviewed", description: "User reviewed the written brainstorm artifact and confirmed readiness." }
|
|
83
78
|
],
|
|
84
79
|
requiredEvidence: [
|
|
85
80
|
"Artifact written to `.cclaw/artifacts/01-brainstorm.md`.",
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
"
|
|
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.",
|
|
85
|
+
"Approved direction and approval marker are present.",
|
|
86
|
+
"Assumptions and open questions are captured (or explicitly marked as none)."
|
|
91
87
|
],
|
|
92
88
|
inputs: ["problem statement", "constraints", "success criteria"],
|
|
93
89
|
requiredContext: [
|
|
94
|
-
"existing project
|
|
90
|
+
"existing project context and patterns",
|
|
95
91
|
"current behavior of affected area",
|
|
96
92
|
"business and delivery constraints"
|
|
97
93
|
],
|
|
98
94
|
outputs: [
|
|
99
95
|
"approved design direction",
|
|
100
|
-
"alternatives
|
|
96
|
+
"alternatives with trade-offs",
|
|
101
97
|
"brainstorm artifact"
|
|
102
98
|
],
|
|
103
99
|
blockers: [
|
|
104
100
|
"no explicit approval",
|
|
105
101
|
"critical ambiguity unresolved",
|
|
106
|
-
"
|
|
102
|
+
"route cannot be determined due to missing context"
|
|
107
103
|
],
|
|
108
104
|
exitCriteria: [
|
|
109
105
|
"approved design direction documented",
|
|
110
106
|
"required gates marked satisfied",
|
|
111
107
|
"no implementation action taken",
|
|
112
|
-
"
|
|
108
|
+
"artifact reviewed by user"
|
|
113
109
|
],
|
|
114
110
|
antiPatterns: [
|
|
115
|
-
"Skipping
|
|
116
|
-
"Asking
|
|
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",
|
|
117
114
|
"Jumping directly into implementation",
|
|
118
|
-
"
|
|
119
|
-
"Invoking implementation skills before writing plans",
|
|
120
|
-
"Asking bare 'approve?' or 'одобряете?' without stating WHAT is being approved",
|
|
121
|
-
"Presenting a single summary and asking for blanket approval instead of section-by-section review",
|
|
122
|
-
"Rushing through clarification — asking 1-2 generic questions then jumping to design",
|
|
123
|
-
"Batching multiple gate confirmations in one message when resuming a session"
|
|
115
|
+
"Requesting approval without stating what decision is being approved"
|
|
124
116
|
],
|
|
125
117
|
rationalizations: [
|
|
126
|
-
{ claim: "This is
|
|
127
|
-
{ claim: "
|
|
128
|
-
{ claim: "
|
|
129
|
-
{ claim: "The user already knows what they want.", reality: "Unstated assumptions diverge during implementation; explicit design surfaces them early." },
|
|
130
|
-
{ 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." }
|
|
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." }
|
|
131
121
|
],
|
|
132
122
|
redFlags: [
|
|
133
|
-
"
|
|
134
|
-
"No
|
|
135
|
-
"
|
|
136
|
-
"
|
|
137
|
-
"Artifact has TBD or placeholder sections",
|
|
138
|
-
"Fewer than 3 clarifying questions asked for any non-trivial project",
|
|
139
|
-
"Approval requested without stating what exactly is being approved"
|
|
123
|
+
"Route is missing or unjustified",
|
|
124
|
+
"No grounding checkpoint between question rounds",
|
|
125
|
+
"Questions do not force concrete decisions",
|
|
126
|
+
"Approval requested without explicit decision context"
|
|
140
127
|
],
|
|
141
128
|
policyNeedles: [
|
|
142
|
-
"
|
|
143
|
-
"One
|
|
144
|
-
"
|
|
129
|
+
"Simple Route / Complex Route",
|
|
130
|
+
"One forcing question per message",
|
|
131
|
+
"Grounding checkpoint between rounds",
|
|
132
|
+
"Multiple approaches with trade-offs",
|
|
145
133
|
"State what is being approved",
|
|
146
134
|
"Do NOT implement, scaffold, or modify behavior"
|
|
147
135
|
],
|
|
148
136
|
artifactFile: "01-brainstorm.md",
|
|
149
137
|
next: "scope",
|
|
150
138
|
cognitivePatterns: [
|
|
151
|
-
{ name: "
|
|
152
|
-
{ name: "
|
|
153
|
-
{ name: "
|
|
154
|
-
{ name: "
|
|
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." }
|
|
155
143
|
],
|
|
156
144
|
reviewSections: [],
|
|
157
145
|
completionStatus: ["DONE", "DONE_WITH_CONCERNS", "BLOCKED"],
|
|
158
146
|
crossStageTrace: {
|
|
159
147
|
readsFrom: [],
|
|
160
148
|
writesTo: [".cclaw/artifacts/01-brainstorm.md"],
|
|
161
|
-
traceabilityRule: "
|
|
149
|
+
traceabilityRule: "Scope and design decisions must trace back to routed question rounds and approved brainstorm direction."
|
|
162
150
|
},
|
|
163
151
|
artifactValidation: [
|
|
164
|
-
{ section: "Problem
|
|
165
|
-
{ section: "
|
|
166
|
-
{ section: "
|
|
167
|
-
{ section: "
|
|
168
|
-
{ section: "
|
|
169
|
-
{ section: "
|
|
170
|
-
{ section: "
|
|
171
|
-
{ section: "Constraints", required: true, validationRule: "At least 2 concrete constraints (performance, compatibility, dependency, or policy)." },
|
|
172
|
-
{ section: "Alternatives Table", required: true, validationRule: "At least 2 approaches with real trade-offs (not cosmetic) and recommendation with reasoning." },
|
|
173
|
-
{ section: "Approved Direction", required: true, validationRule: "Must contain explicit approval marker from user. State what was approved." },
|
|
174
|
-
{ section: "Assumptions & Risks", required: true, validationRule: "Explicit assumptions made during design. Known risks. If none, state 'None'." },
|
|
175
|
-
{ section: "Open Questions", required: true, validationRule: "If empty, state 'None' explicitly. Do not omit." }
|
|
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." },
|
|
158
|
+
{ section: "Assumptions and Open Questions", required: true, validationRule: "Must capture unresolved assumptions/open questions, or explicitly state none." }
|
|
176
159
|
],
|
|
177
160
|
namedAntiPattern: {
|
|
178
|
-
title: "This Is Too Simple To
|
|
179
|
-
description: "
|
|
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."
|
|
180
163
|
}
|
|
181
164
|
};
|
|
182
165
|
// ---------------------------------------------------------------------------
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const ARTIFACT_TEMPLATES: Record<string, string>;
|
|
2
2
|
export declare const RULEBOOK_MARKDOWN = "# Cclaw Rulebook\n\n## MUST_ALWAYS\n- Follow flow order: brainstorm -> scope -> design -> spec -> plan -> tdd -> review -> ship\n- Require explicit user confirmation after plan before TDD\n- Keep evidence artifacts in `.cclaw/artifacts/`\n- Enforce RED before GREEN in TDD\n- Run two-layer review (spec_compliance and code_quality) before ship\n- Validate all inputs before processing \u2014 never trust external data without sanitization\n- Prefer immutable data patterns and pure functions where the language supports them\n- Follow existing repo conventions, patterns, and directory structure \u2014 match the codebase\n- Verify claims with fresh evidence: \"tests pass\" requires running tests in this message\n- Use conventional commits: `type(scope): description` (feat, fix, refactor, test, docs, chore)\n\n## MUST_NEVER\n- Skip RED phase and jump directly to GREEN in TDD\n- Ship with critical review findings\n- Start implementation during /brainstorm\n- Modify generated cclaw files manually when CLI can regenerate them\n- Commit `.cclaw/` or generated shim files\n- Expose secrets, tokens, API keys, or absolute system paths in agent output\n- Duplicate existing functionality without explicit justification \u2014 search before building\n- Bypass security checks, linting hooks, or type checking to \"move faster\"\n- Claim success (\"Done,\" \"All good,\" \"Tests pass\") without running verification in this message\n- Make changes outside the blast radius of the current task without user consent\n\n## DELEGATION\nWhen a task requires specialist knowledge (security audit, performance profiling, database review),\ndelegate to a specialized agent or skill if the harness supports it. The primary agent should:\n1. Identify the specialist domain\n2. Provide focused context (relevant files, the specific concern)\n3. Evaluate the specialist output before acting on it \u2014 do not blindly apply recommendations\n";
|
|
3
|
-
export declare const CURSOR_WORKFLOW_RULE_MDC = "---\ndescription: cclaw workflow guardrails for Cursor agent sessions\nglobs:\n - \"**/*\"\nalwaysApply: true\n---\n\n<!-- cclaw-managed-cursor-workflow-rule -->\n\n# Cclaw Workflow Guardrails\n\n- Follow stage order: brainstorm -> scope -> design -> spec -> plan -> tdd -> review -> ship.\n- Read `.cclaw/state/flow-state.json` before acting; continue from current stage when active.\n- Use `/cc-next` only after required gates pass; never bypass explicit pause/approval rules.\n- Keep evidence in `.cclaw/artifacts/`;
|
|
3
|
+
export declare const CURSOR_WORKFLOW_RULE_MDC = "---\ndescription: cclaw workflow guardrails for Cursor agent sessions\nglobs:\n - \"**/*\"\nalwaysApply: true\n---\n\n<!-- cclaw-managed-cursor-workflow-rule -->\n\n# Cclaw Workflow Guardrails\n\n- Follow stage order: brainstorm -> scope -> design -> spec -> plan -> tdd -> review -> ship.\n- Read `.cclaw/state/flow-state.json` before acting; continue from current stage when active.\n- Use `/cc-next` only after required gates pass; never bypass explicit pause/approval rules.\n- Keep evidence in `.cclaw/artifacts/`; archive completed feature artifacts only via `cclaw archive`.\n- For machine-only checks in design/plan/tdd/review/ship, dispatch required specialists automatically when tooling supports it.\n- Ask for user input only at explicit approval gates (scope mode, plan approval, user challenge resolution, ship finalization).\n- Treat `.cclaw/skills/using-cclaw/SKILL.md` as routing source of truth; load contextual utility skills only when their triggers apply.\n";
|
|
4
4
|
export declare function buildRulesJson(): Record<string, unknown>;
|
|
@@ -3,71 +3,50 @@ import { orderedStageSchemas } from "./stage-schema.js";
|
|
|
3
3
|
export const ARTIFACT_TEMPLATES = {
|
|
4
4
|
"01-brainstorm.md": `# Brainstorm Artifact
|
|
5
5
|
|
|
6
|
-
## Problem
|
|
6
|
+
## Problem Framing
|
|
7
7
|
- **User problem:**
|
|
8
|
-
- **
|
|
9
|
-
- **Why now:**
|
|
8
|
+
- **Desired outcome:**
|
|
10
9
|
- **Success signal:**
|
|
11
10
|
|
|
12
|
-
##
|
|
13
|
-
- **
|
|
14
|
-
- **
|
|
15
|
-
- **Relevant dependencies:**
|
|
11
|
+
## Routing Decision
|
|
12
|
+
- **Route:** simple | complex
|
|
13
|
+
- **Reasoning:**
|
|
16
14
|
|
|
17
|
-
##
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
| SCOPE | | | |
|
|
22
|
-
| BOUNDARIES | | | |
|
|
23
|
-
| ENVIRONMENT | | | |
|
|
24
|
-
| CONSTRAINTS | | | |
|
|
25
|
-
|
|
26
|
-
## Purpose & Beneficiaries
|
|
27
|
-
- **Project purpose:**
|
|
28
|
-
- **Primary users:**
|
|
29
|
-
- **Value outcome:**
|
|
30
|
-
|
|
31
|
-
## Scope Boundaries
|
|
32
|
-
### In Scope
|
|
33
|
-
-
|
|
15
|
+
## Grounding Checkpoints
|
|
16
|
+
### Round 1 grounding
|
|
17
|
+
- **What is fixed now:**
|
|
18
|
+
- **What is still unknown:**
|
|
34
19
|
|
|
35
|
-
###
|
|
36
|
-
-
|
|
20
|
+
### Round 2 grounding
|
|
21
|
+
- **What is fixed now:**
|
|
22
|
+
- **What is still unknown:**
|
|
37
23
|
|
|
38
|
-
|
|
39
|
-
- **
|
|
40
|
-
- **
|
|
41
|
-
- **Error visibility expectations:**
|
|
24
|
+
### Round 3 grounding
|
|
25
|
+
- **What is fixed now:**
|
|
26
|
+
- **What is still unknown:**
|
|
42
27
|
|
|
43
|
-
##
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
- **Performance constraints:**
|
|
50
|
-
- **Compatibility constraints:**
|
|
51
|
-
- **Dependency constraints:**
|
|
28
|
+
## Forcing Questions Log
|
|
29
|
+
| Round | Question | User answer | Decision impact |
|
|
30
|
+
|---|---|---|---|
|
|
31
|
+
| 2 | | | |
|
|
32
|
+
| 2 | | | |
|
|
33
|
+
| 3 | | | |
|
|
52
34
|
|
|
53
|
-
##
|
|
35
|
+
## Options Comparison
|
|
54
36
|
| Option | Summary | Trade-offs | Recommendation |
|
|
55
37
|
|---|---|---|---|
|
|
56
38
|
| A | | | |
|
|
57
39
|
| B | | | |
|
|
58
|
-
| C | | | |
|
|
59
40
|
|
|
60
41
|
## Approved Direction
|
|
61
42
|
- **Selected option:**
|
|
62
43
|
- **Why selected:**
|
|
63
|
-
- **What was approved:**
|
|
44
|
+
- **What was approved:**
|
|
64
45
|
- **Approval marker:**
|
|
65
46
|
|
|
66
|
-
## Assumptions
|
|
67
|
-
-
|
|
68
|
-
|
|
69
|
-
## Open Questions
|
|
70
|
-
- None
|
|
47
|
+
## Assumptions and Open Questions
|
|
48
|
+
- **Assumptions:**
|
|
49
|
+
- **Open questions (or "None"):**
|
|
71
50
|
`,
|
|
72
51
|
"02-scope.md": `# Scope Artifact
|
|
73
52
|
|
|
@@ -382,7 +361,7 @@ alwaysApply: true
|
|
|
382
361
|
- Follow stage order: brainstorm -> scope -> design -> spec -> plan -> tdd -> review -> ship.
|
|
383
362
|
- Read \`.cclaw/state/flow-state.json\` before acting; continue from current stage when active.
|
|
384
363
|
- Use \`/cc-next\` only after required gates pass; never bypass explicit pause/approval rules.
|
|
385
|
-
- Keep evidence in \`.cclaw/artifacts/\`;
|
|
364
|
+
- Keep evidence in \`.cclaw/artifacts/\`; archive completed feature artifacts only via \`cclaw archive\`.
|
|
386
365
|
- For machine-only checks in design/plan/tdd/review/ship, dispatch required specialists automatically when tooling supports it.
|
|
387
366
|
- Ask for user input only at explicit approval gates (scope mode, plan approval, user challenge resolution, ship finalization).
|
|
388
367
|
- Treat \`.cclaw/skills/using-cclaw/SKILL.md\` as routing source of truth; load contextual utility skills only when their triggers apply.
|
package/dist/delegation.js
CHANGED
|
@@ -4,11 +4,11 @@ import { RUNTIME_ROOT } from "./constants.js";
|
|
|
4
4
|
import { exists, withDirectoryLock, writeFileSafe } from "./fs-utils.js";
|
|
5
5
|
import { readFlowState } from "./runs.js";
|
|
6
6
|
import { stageSchema } from "./content/stage-schema.js";
|
|
7
|
-
function delegationLogPath(projectRoot
|
|
8
|
-
return path.join(projectRoot, RUNTIME_ROOT, "
|
|
7
|
+
function delegationLogPath(projectRoot) {
|
|
8
|
+
return path.join(projectRoot, RUNTIME_ROOT, "state", "delegation-log.json");
|
|
9
9
|
}
|
|
10
|
-
function delegationLockPath(projectRoot
|
|
11
|
-
return path.join(projectRoot, RUNTIME_ROOT, "
|
|
10
|
+
function delegationLockPath(projectRoot) {
|
|
11
|
+
return path.join(projectRoot, RUNTIME_ROOT, "state", ".delegation.lock");
|
|
12
12
|
}
|
|
13
13
|
function isDelegationEntry(value) {
|
|
14
14
|
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
@@ -45,7 +45,7 @@ function parseLedger(raw, runId) {
|
|
|
45
45
|
}
|
|
46
46
|
export async function readDelegationLedger(projectRoot) {
|
|
47
47
|
const { activeRunId } = await readFlowState(projectRoot);
|
|
48
|
-
const filePath = delegationLogPath(projectRoot
|
|
48
|
+
const filePath = delegationLogPath(projectRoot);
|
|
49
49
|
if (!(await exists(filePath))) {
|
|
50
50
|
return { runId: activeRunId, entries: [] };
|
|
51
51
|
}
|
|
@@ -60,8 +60,8 @@ export async function readDelegationLedger(projectRoot) {
|
|
|
60
60
|
}
|
|
61
61
|
export async function appendDelegation(projectRoot, entry) {
|
|
62
62
|
const { activeRunId } = await readFlowState(projectRoot);
|
|
63
|
-
await withDirectoryLock(delegationLockPath(projectRoot
|
|
64
|
-
const filePath = delegationLogPath(projectRoot
|
|
63
|
+
await withDirectoryLock(delegationLockPath(projectRoot), async () => {
|
|
64
|
+
const filePath = delegationLogPath(projectRoot);
|
|
65
65
|
const prior = await readDelegationLedger(projectRoot);
|
|
66
66
|
const ledger = {
|
|
67
67
|
runId: activeRunId,
|
package/dist/doctor.js
CHANGED
|
@@ -426,10 +426,7 @@ export async function doctorChecks(projectRoot, options = {}) {
|
|
|
426
426
|
"stop-checkpoint.sh",
|
|
427
427
|
"prompt-guard.sh",
|
|
428
428
|
"workflow-guard.sh",
|
|
429
|
-
"context-monitor.sh"
|
|
430
|
-
"observe.sh",
|
|
431
|
-
"summarize-observations.sh",
|
|
432
|
-
"summarize-observations.mjs"
|
|
429
|
+
"context-monitor.sh"
|
|
433
430
|
]) {
|
|
434
431
|
const scriptPath = path.join(projectRoot, RUNTIME_ROOT, "hooks", script);
|
|
435
432
|
const scriptExists = await exists(scriptPath);
|
|
@@ -524,15 +521,12 @@ export async function doctorChecks(projectRoot, options = {}) {
|
|
|
524
521
|
const wiringOk = sessionCommands.some((cmd) => cmd.includes("session-start.sh")) &&
|
|
525
522
|
preCommands.some((cmd) => cmd.includes("prompt-guard.sh")) &&
|
|
526
523
|
preCommands.some((cmd) => cmd.includes("workflow-guard.sh")) &&
|
|
527
|
-
preCommands.some((cmd) => cmd.includes("observe.sh pre")) &&
|
|
528
|
-
postCommands.some((cmd) => cmd.includes("observe.sh post")) &&
|
|
529
524
|
postCommands.some((cmd) => cmd.includes("context-monitor.sh")) &&
|
|
530
|
-
stopCommands.some((cmd) => cmd.includes("summarize-observations.sh")) &&
|
|
531
525
|
stopCommands.some((cmd) => cmd.includes("stop-checkpoint.sh"));
|
|
532
526
|
checks.push({
|
|
533
527
|
name: "hook:wiring:claude",
|
|
534
528
|
ok: wiringOk,
|
|
535
|
-
details: `${file} must wire session-start/prompt-guard/workflow-guard/
|
|
529
|
+
details: `${file} must wire session-start/prompt-guard/workflow-guard/context-monitor/stop-checkpoint`
|
|
536
530
|
});
|
|
537
531
|
}
|
|
538
532
|
if (configuredHarnesses.includes("cursor")) {
|
|
@@ -560,15 +554,12 @@ export async function doctorChecks(projectRoot, options = {}) {
|
|
|
560
554
|
const wiringOk = sessionCommands.some((cmd) => cmd.includes("session-start.sh")) &&
|
|
561
555
|
preCommands.some((cmd) => cmd.includes("prompt-guard.sh")) &&
|
|
562
556
|
preCommands.some((cmd) => cmd.includes("workflow-guard.sh")) &&
|
|
563
|
-
preCommands.some((cmd) => cmd.includes("observe.sh pre")) &&
|
|
564
|
-
postCommands.some((cmd) => cmd.includes("observe.sh post")) &&
|
|
565
557
|
postCommands.some((cmd) => cmd.includes("context-monitor.sh")) &&
|
|
566
|
-
stopCommands.some((cmd) => cmd.includes("summarize-observations.sh")) &&
|
|
567
558
|
stopCommands.some((cmd) => cmd.includes("stop-checkpoint.sh"));
|
|
568
559
|
checks.push({
|
|
569
560
|
name: "hook:wiring:cursor",
|
|
570
561
|
ok: wiringOk,
|
|
571
|
-
details: `${file} must wire session-start/prompt-guard/workflow-guard/
|
|
562
|
+
details: `${file} must wire session-start/prompt-guard/workflow-guard/context-monitor/stop-checkpoint`
|
|
572
563
|
});
|
|
573
564
|
const cursorRulePath = path.join(projectRoot, ".cursor/rules/cclaw-workflow.mdc");
|
|
574
565
|
let cursorRuleOk = false;
|
|
@@ -603,15 +594,12 @@ export async function doctorChecks(projectRoot, options = {}) {
|
|
|
603
594
|
const wiringOk = sessionCommands.some((cmd) => cmd.includes("session-start.sh")) &&
|
|
604
595
|
preCommands.some((cmd) => cmd.includes("prompt-guard.sh")) &&
|
|
605
596
|
preCommands.some((cmd) => cmd.includes("workflow-guard.sh")) &&
|
|
606
|
-
preCommands.some((cmd) => cmd.includes("observe.sh pre")) &&
|
|
607
|
-
postCommands.some((cmd) => cmd.includes("observe.sh post")) &&
|
|
608
597
|
postCommands.some((cmd) => cmd.includes("context-monitor.sh")) &&
|
|
609
|
-
stopCommands.some((cmd) => cmd.includes("summarize-observations.sh")) &&
|
|
610
598
|
stopCommands.some((cmd) => cmd.includes("stop-checkpoint.sh"));
|
|
611
599
|
checks.push({
|
|
612
600
|
name: "hook:wiring:codex",
|
|
613
601
|
ok: wiringOk,
|
|
614
|
-
details: `${file} must wire session-start/prompt-guard/workflow-guard/
|
|
602
|
+
details: `${file} must wire session-start/prompt-guard/workflow-guard/context-monitor/stop-checkpoint`
|
|
615
603
|
});
|
|
616
604
|
}
|
|
617
605
|
if (configuredHarnesses.includes("opencode")) {
|
|
@@ -627,7 +615,6 @@ export async function doctorChecks(projectRoot, options = {}) {
|
|
|
627
615
|
content.includes("workflow-guard.sh") &&
|
|
628
616
|
content.includes("context-monitor.sh") &&
|
|
629
617
|
content.includes('"session.idle"') &&
|
|
630
|
-
content.includes('"session.updated"') &&
|
|
631
618
|
content.includes('"session.resumed"') &&
|
|
632
619
|
content.includes('"session.cleared"') &&
|
|
633
620
|
content.includes('"experimental.chat.system.transform"');
|
|
@@ -635,7 +622,7 @@ export async function doctorChecks(projectRoot, options = {}) {
|
|
|
635
622
|
checks.push({
|
|
636
623
|
name: "lifecycle:opencode:rehydration_events",
|
|
637
624
|
ok,
|
|
638
|
-
details: `${file} must include event lifecycle handler, tool.execute.before/after with prompt/workflow/context hooks, session.idle
|
|
625
|
+
details: `${file} must include event lifecycle handler, tool.execute.before/after with prompt/workflow/context hooks, session.idle checkpoint, and transform rehydration`
|
|
639
626
|
});
|
|
640
627
|
const runtimeShape = await opencodePluginRuntimeShapeCheck(projectRoot);
|
|
641
628
|
checks.push({
|
|
@@ -679,11 +666,11 @@ export async function doctorChecks(projectRoot, options = {}) {
|
|
|
679
666
|
ok: true,
|
|
680
667
|
details: hasPython ? "python3 available" : "warning: python3 not found, jq/node paths must stay healthy"
|
|
681
668
|
});
|
|
682
|
-
//
|
|
669
|
+
// Knowledge store exists
|
|
683
670
|
checks.push({
|
|
684
|
-
name: "
|
|
685
|
-
ok: await exists(path.join(projectRoot, RUNTIME_ROOT, "
|
|
686
|
-
details: `${RUNTIME_ROOT}/
|
|
671
|
+
name: "knowledge:store_exists",
|
|
672
|
+
ok: await exists(path.join(projectRoot, RUNTIME_ROOT, "knowledge.md")),
|
|
673
|
+
details: `${RUNTIME_ROOT}/knowledge.md must exist`
|
|
687
674
|
});
|
|
688
675
|
checks.push({
|
|
689
676
|
name: "state:checkpoint_exists",
|
|
@@ -750,25 +737,21 @@ export async function doctorChecks(projectRoot, options = {}) {
|
|
|
750
737
|
: `no gate reconciliation changes needed for stage "${reconciliation.stage}"`
|
|
751
738
|
});
|
|
752
739
|
}
|
|
740
|
+
const activeRunId = typeof flowState.activeRunId === "string" ? flowState.activeRunId.trim() : "";
|
|
753
741
|
checks.push({
|
|
754
742
|
name: "flow_state:active_run_id",
|
|
755
|
-
ok:
|
|
743
|
+
ok: activeRunId.length > 0,
|
|
756
744
|
details: `${RUNTIME_ROOT}/state/flow-state.json must include activeRunId`
|
|
757
745
|
});
|
|
758
746
|
checks.push({
|
|
759
|
-
name: "
|
|
760
|
-
ok: await exists(path.join(projectRoot, RUNTIME_ROOT, "
|
|
761
|
-
details: `${RUNTIME_ROOT}/
|
|
747
|
+
name: "artifacts:active_root",
|
|
748
|
+
ok: await exists(path.join(projectRoot, RUNTIME_ROOT, "artifacts")),
|
|
749
|
+
details: `${RUNTIME_ROOT}/artifacts must exist as the active artifact root`
|
|
762
750
|
});
|
|
763
751
|
checks.push({
|
|
764
|
-
name: "
|
|
765
|
-
ok: await exists(path.join(projectRoot, RUNTIME_ROOT, "runs"
|
|
766
|
-
details: `${RUNTIME_ROOT}/runs
|
|
767
|
-
});
|
|
768
|
-
checks.push({
|
|
769
|
-
name: "run:active_handoff",
|
|
770
|
-
ok: await exists(path.join(projectRoot, RUNTIME_ROOT, "runs", flowState.activeRunId, "handoff.md")),
|
|
771
|
-
details: `${RUNTIME_ROOT}/runs/${flowState.activeRunId}/handoff.md must exist`
|
|
752
|
+
name: "runs:archive_root",
|
|
753
|
+
ok: await exists(path.join(projectRoot, RUNTIME_ROOT, "runs")),
|
|
754
|
+
details: `${RUNTIME_ROOT}/runs must exist for archived feature snapshots`
|
|
772
755
|
});
|
|
773
756
|
const delegation = await checkMandatoryDelegations(projectRoot, flowState.currentStage);
|
|
774
757
|
checks.push({
|
package/dist/flow-state.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { COMMAND_FILE_ORDER } from "./constants.js";
|
|
2
2
|
import { buildTransitionRules, orderedStageSchemas, stageGateIds } from "./content/stage-schema.js";
|
|
3
3
|
export const TRANSITION_RULES = buildTransitionRules();
|
|
4
|
-
export function createInitialFlowState(activeRunId = "
|
|
4
|
+
export function createInitialFlowState(activeRunId = "active") {
|
|
5
5
|
const stageGateCatalog = {};
|
|
6
6
|
for (const schema of orderedStageSchemas()) {
|
|
7
7
|
stageGateCatalog[schema.stage] = {
|
package/dist/harness-adapters.js
CHANGED
|
@@ -37,7 +37,7 @@ Before responding to a coding request:
|
|
|
37
37
|
|---|---|
|
|
38
38
|
| \`/cc\` | **Entry point.** No args = resume current stage. With prompt = start brainstorm with idea. |
|
|
39
39
|
| \`/cc-next\` | **Progression.** Advances to the next stage when current is complete. |
|
|
40
|
-
| \`/cc-learn\` | **Cross-cutting.** Capture or review project
|
|
40
|
+
| \`/cc-learn\` | **Cross-cutting.** Capture or review project knowledge. |
|
|
41
41
|
|
|
42
42
|
**Stage order:** brainstorm > scope > design > spec > plan > tdd > review > ship.
|
|
43
43
|
\`/cc-next\` loads the right stage skill automatically. Gates must pass before handoff.
|