cclaw-cli 0.51.23 → 0.51.25
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 +135 -414
- package/dist/artifact-linter.js +10 -6
- package/dist/config.d.ts +1 -1
- package/dist/config.js +28 -3
- package/dist/content/core-agents.d.ts +128 -2
- package/dist/content/core-agents.js +291 -13
- package/dist/content/examples.js +21 -10
- package/dist/content/next-command.js +10 -6
- package/dist/content/reference-patterns.d.ts +18 -0
- package/dist/content/reference-patterns.js +391 -0
- package/dist/content/seed-shelf.js +73 -8
- package/dist/content/skills.js +39 -34
- package/dist/content/stage-common-guidance.js +19 -3
- package/dist/content/stage-schema.d.ts +12 -0
- package/dist/content/stage-schema.js +224 -24
- package/dist/content/stages/_lint-metadata/index.js +3 -2
- package/dist/content/stages/brainstorm.js +27 -18
- package/dist/content/stages/design.js +27 -18
- package/dist/content/stages/review.js +20 -9
- package/dist/content/stages/schema-types.d.ts +9 -2
- package/dist/content/stages/scope.js +21 -10
- package/dist/content/stages/ship.js +3 -2
- package/dist/content/stages/tdd.js +18 -13
- package/dist/content/start-command.js +3 -2
- package/dist/content/status-command.js +9 -4
- package/dist/content/subagents.js +336 -38
- package/dist/content/templates.js +182 -25
- package/dist/delegation.d.ts +2 -0
- package/dist/delegation.js +27 -6
- package/dist/doctor.js +167 -25
- package/dist/flow-state.d.ts +1 -0
- package/dist/flow-state.js +1 -0
- package/dist/gate-evidence.js +25 -2
- package/dist/install.js +72 -8
- package/dist/internal/advance-stage.js +179 -26
- package/dist/knowledge-store.js +30 -6
- package/dist/run-archive.js +11 -0
- package/dist/run-persistence.js +35 -10
- package/dist/tdd-verification-evidence.d.ts +17 -0
- package/dist/tdd-verification-evidence.js +43 -0
- package/dist/types.d.ts +10 -0
- package/package.json +1 -1
|
@@ -6,6 +6,38 @@ function yamlScalarString(value) {
|
|
|
6
6
|
function yamlFlowSequence(values) {
|
|
7
7
|
return JSON.stringify(values);
|
|
8
8
|
}
|
|
9
|
+
const WORKER_RETURN_SCHEMA = {
|
|
10
|
+
statusField: "status",
|
|
11
|
+
allowedStatuses: ["DONE", "DONE_WITH_CONCERNS", "NEEDS_CONTEXT", "BLOCKED"],
|
|
12
|
+
requiredFields: ["status", "filesChanged", "testsRun", "evidenceRefs", "concerns", "needsContext", "blockers"],
|
|
13
|
+
evidenceFields: ["testsRun", "evidenceRefs"]
|
|
14
|
+
};
|
|
15
|
+
const REVIEW_RETURN_SCHEMA = {
|
|
16
|
+
statusField: "status",
|
|
17
|
+
allowedStatuses: ["PASS", "PASS_WITH_GAPS", "FAIL", "BLOCKED"],
|
|
18
|
+
requiredFields: ["status", "findings", "criteria", "evidenceRefs", "blockers"],
|
|
19
|
+
evidenceFields: ["findings.location", "criteria.evidence", "evidenceRefs"]
|
|
20
|
+
};
|
|
21
|
+
const ADVISORY_RETURN_SCHEMA = {
|
|
22
|
+
statusField: "status",
|
|
23
|
+
allowedStatuses: ["DONE", "DONE_WITH_CONCERNS", "NEEDS_CONTEXT", "BLOCKED"],
|
|
24
|
+
requiredFields: ["status", "summary", "recommendations", "evidenceRefs", "unknowns"],
|
|
25
|
+
evidenceFields: ["evidenceRefs", "recommendations"]
|
|
26
|
+
};
|
|
27
|
+
const DOC_RETURN_SCHEMA = {
|
|
28
|
+
statusField: "status",
|
|
29
|
+
allowedStatuses: ["DONE", "DONE_WITH_CONCERNS", "NEEDS_CONTEXT", "BLOCKED"],
|
|
30
|
+
requiredFields: ["status", "filesUpdated", "summary", "evidenceRefs", "openQuestions"],
|
|
31
|
+
evidenceFields: ["filesUpdated", "evidenceRefs"]
|
|
32
|
+
};
|
|
33
|
+
function formatReturnSchema(schema) {
|
|
34
|
+
return [
|
|
35
|
+
`- Status field: \`${schema.statusField}\``,
|
|
36
|
+
`- Allowed statuses: ${schema.allowedStatuses.map((status) => `\`${status}\``).join(", ")}`,
|
|
37
|
+
`- Required fields: ${schema.requiredFields.map((field) => `\`${field}\``).join(", ")}`,
|
|
38
|
+
`- Evidence fields: ${schema.evidenceFields.map((field) => `\`${field}\``).join(", ")}`
|
|
39
|
+
].join("\n");
|
|
40
|
+
}
|
|
9
41
|
function formattedAgentsForStages(stages) {
|
|
10
42
|
const summary = stageDelegationSummary("standard");
|
|
11
43
|
const merged = [];
|
|
@@ -39,7 +71,7 @@ function activationModeSummary() {
|
|
|
39
71
|
};
|
|
40
72
|
}
|
|
41
73
|
/**
|
|
42
|
-
* Canonical specialist roster
|
|
74
|
+
* Canonical specialist roster materialized under `.cclaw/agents/`.
|
|
43
75
|
*
|
|
44
76
|
* Declared with `satisfies` so the array retains literal `name` types for
|
|
45
77
|
* downstream type-level consumers (e.g. `AgentName`), while still being
|
|
@@ -48,6 +80,26 @@ function activationModeSummary() {
|
|
|
48
80
|
* to `string` and break the compile-time drift guard.
|
|
49
81
|
*/
|
|
50
82
|
export const CCLAW_AGENTS = [
|
|
83
|
+
{
|
|
84
|
+
name: "researcher",
|
|
85
|
+
description: "PROACTIVE when context readiness, repo search, reference patterns, or external docs could change a stage decision. MUST summarize search-before-read evidence before large reads.",
|
|
86
|
+
tools: ["Read", "Grep", "Glob", "WebSearch"],
|
|
87
|
+
model: "fast",
|
|
88
|
+
activation: "proactive",
|
|
89
|
+
relatedStages: ["brainstorm", "scope", "design", "plan"],
|
|
90
|
+
returnSchema: ADVISORY_RETURN_SCHEMA,
|
|
91
|
+
body: [
|
|
92
|
+
"You are a **context readiness and research specialist**.",
|
|
93
|
+
"",
|
|
94
|
+
"When invoked:",
|
|
95
|
+
"1. Start with search/query summaries before reading large files.",
|
|
96
|
+
"2. Name provider status when known: graph/search/docs/MCP/semantic index freshness.",
|
|
97
|
+
"3. Separate observed facts from assumptions and stale or missing context.",
|
|
98
|
+
"4. Return concise evidence refs the controller can paste into stage artifacts.",
|
|
99
|
+
"",
|
|
100
|
+
"**Role boundary:** research and context synthesis only. Do NOT edit files."
|
|
101
|
+
].join("\n")
|
|
102
|
+
},
|
|
51
103
|
{
|
|
52
104
|
name: "planner",
|
|
53
105
|
description: "MANDATORY for scope/design/plan and PROACTIVE for high-ambiguity work. MUST BE USED when sequencing, dependency mapping, or risk trade-offs are required before coding.",
|
|
@@ -55,18 +107,97 @@ export const CCLAW_AGENTS = [
|
|
|
55
107
|
model: "deep",
|
|
56
108
|
activation: "mandatory",
|
|
57
109
|
relatedStages: ["brainstorm", "scope", "design", "spec", "plan"],
|
|
110
|
+
returnSchema: ADVISORY_RETURN_SCHEMA,
|
|
58
111
|
body: [
|
|
59
112
|
"You are an **implementation planning specialist** (staff engineer mindset).",
|
|
60
113
|
"",
|
|
61
114
|
"When invoked:",
|
|
62
|
-
"1.
|
|
63
|
-
"2.
|
|
64
|
-
"3.
|
|
65
|
-
"4.
|
|
115
|
+
"1. Map upstream decisions, scope boundaries, and explicit drift before planning.",
|
|
116
|
+
"2. Break the work into concrete sub-problems with dependencies and existing-module fit.",
|
|
117
|
+
"3. Enforce one-question discipline: ask only decision-changing questions, one at a time.",
|
|
118
|
+
"4. Produce an ordered execution plan with verification checks and handoff quality notes.",
|
|
119
|
+
"5. Highlight risks and unknowns that need user decisions.",
|
|
66
120
|
"",
|
|
67
121
|
"**Role boundary:** planning only. Do NOT write production code."
|
|
68
122
|
].join("\n")
|
|
69
123
|
},
|
|
124
|
+
{
|
|
125
|
+
name: "product-manager",
|
|
126
|
+
description: "PROACTIVE during brainstorm/scope when product value, persona/JTBD, success metric, or why-now framing is unclear. Use for product discovery, not implementation.",
|
|
127
|
+
tools: ["Read", "Grep", "Glob", "WebSearch"],
|
|
128
|
+
model: "balanced",
|
|
129
|
+
activation: "proactive",
|
|
130
|
+
relatedStages: ["brainstorm", "scope"],
|
|
131
|
+
returnSchema: ADVISORY_RETURN_SCHEMA,
|
|
132
|
+
body: [
|
|
133
|
+
"You are a **product discovery specialist**.",
|
|
134
|
+
"",
|
|
135
|
+
"Produce concise evidence for:",
|
|
136
|
+
"- persona / user and job to be done",
|
|
137
|
+
"- pain or trigger",
|
|
138
|
+
"- value hypothesis and success metric",
|
|
139
|
+
"- evidence or signal strength",
|
|
140
|
+
"- why now, do-nothing consequence, and non-goals",
|
|
141
|
+
"",
|
|
142
|
+
"For technical-maintenance work, translate this to operator/developer, failure mode, operational improvement, verification signal, do-nothing cost, and non-goals.",
|
|
143
|
+
"",
|
|
144
|
+
"**Role boundary:** frame value and problem fit. Do NOT choose implementation architecture."
|
|
145
|
+
].join("\n")
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
name: "critic",
|
|
149
|
+
description: "PROACTIVE during brainstorm/scope/design when premises, alternatives, cost, rollback, or hidden assumptions need adversarial pressure.",
|
|
150
|
+
tools: ["Read", "Grep", "Glob", "WebSearch"],
|
|
151
|
+
model: "balanced",
|
|
152
|
+
activation: "proactive",
|
|
153
|
+
relatedStages: ["brainstorm", "scope", "design"],
|
|
154
|
+
returnSchema: ADVISORY_RETURN_SCHEMA,
|
|
155
|
+
body: [
|
|
156
|
+
"You are an **adversarial critic** for product and engineering decisions.",
|
|
157
|
+
"",
|
|
158
|
+
"Your job:",
|
|
159
|
+
"1. Attack the premise and name what could make the current direction wrong.",
|
|
160
|
+
"2. Identify cheaper, smaller, or more reversible alternatives.",
|
|
161
|
+
"3. Surface hidden assumptions, do-nothing viability, and scope creep.",
|
|
162
|
+
"4. In design, require a shadow alternative, switch trigger, failure/rescue path, and verification evidence.",
|
|
163
|
+
"",
|
|
164
|
+
"Return confirmed risks, disproven concerns, and the smallest decision-changing recommendation."
|
|
165
|
+
].join("\n")
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
name: "architect",
|
|
169
|
+
description: "MANDATORY during design. MUST BE USED to validate architecture boundaries, alternatives, failure modes, rollout, and spec handoff before implementation.",
|
|
170
|
+
tools: ["Read", "Grep", "Glob", "WebSearch"],
|
|
171
|
+
model: "deep",
|
|
172
|
+
activation: "mandatory",
|
|
173
|
+
relatedStages: ["design"],
|
|
174
|
+
returnSchema: ADVISORY_RETURN_SCHEMA,
|
|
175
|
+
body: [
|
|
176
|
+
"You are an **architecture validation specialist**.",
|
|
177
|
+
"",
|
|
178
|
+
"Check architecture boundaries, existing-system fit, critical paths, data/state flow, alternatives, rescue paths, and verification hooks.",
|
|
179
|
+
"Return chosen path risks, rejected alternatives, switch triggers, and required evidence before spec handoff.",
|
|
180
|
+
"",
|
|
181
|
+
"**Role boundary:** design validation only. Do NOT write implementation code."
|
|
182
|
+
].join("\n")
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
name: "spec-validator",
|
|
186
|
+
description: "MANDATORY during standard/deep spec. MUST BE USED to validate measurable acceptance criteria, assumptions, edge cases, and testability mapping.",
|
|
187
|
+
tools: ["Read", "Grep", "Glob"],
|
|
188
|
+
model: "balanced",
|
|
189
|
+
activation: "mandatory",
|
|
190
|
+
relatedStages: ["spec"],
|
|
191
|
+
returnSchema: REVIEW_RETURN_SCHEMA,
|
|
192
|
+
body: [
|
|
193
|
+
"You are a **specification validation specialist**.",
|
|
194
|
+
"",
|
|
195
|
+
"For every acceptance criterion, verify it is observable, measurable, falsifiable, mapped to upstream decisions, and paired with concrete verification evidence.",
|
|
196
|
+
"Flag vague language, missing edge cases, hidden assumptions, and RED tests that cannot be expressed.",
|
|
197
|
+
"",
|
|
198
|
+
"**Role boundary:** validate the spec; do NOT write plan tasks or implementation."
|
|
199
|
+
].join("\n")
|
|
200
|
+
},
|
|
70
201
|
{
|
|
71
202
|
name: "reviewer",
|
|
72
203
|
description: "MANDATORY during review. MUST BE USED to run a two-pass audit: spec compliance first, then correctness/maintainability/performance/architecture.",
|
|
@@ -74,6 +205,7 @@ export const CCLAW_AGENTS = [
|
|
|
74
205
|
model: "balanced",
|
|
75
206
|
activation: "mandatory",
|
|
76
207
|
relatedStages: ["spec", "review", "ship"],
|
|
208
|
+
returnSchema: REVIEW_RETURN_SCHEMA,
|
|
77
209
|
body: [
|
|
78
210
|
"You are a **combined spec + code reviewer**.",
|
|
79
211
|
"",
|
|
@@ -91,12 +223,59 @@ export const CCLAW_AGENTS = [
|
|
|
91
223
|
"",
|
|
92
224
|
"For each finding include:",
|
|
93
225
|
"- Severity: `Critical` | `Important` | `Suggestion`",
|
|
94
|
-
"- Location: `file:line
|
|
226
|
+
"- Location: `file:line`; if no line is possible, state the no-line reason",
|
|
95
227
|
"- Problem and concrete recommendation",
|
|
96
228
|
"",
|
|
229
|
+
"Also report files inspected, changed-file coverage, diagnostics run, dependency/version audit when relevant, and a no-finding attestation when no issues are found.",
|
|
230
|
+
"",
|
|
97
231
|
"**Trust model:** never rely on implementer claims; verify by reading code."
|
|
98
232
|
].join("\n")
|
|
99
233
|
},
|
|
234
|
+
{
|
|
235
|
+
name: "performance-reviewer",
|
|
236
|
+
description: "PROACTIVE during review for hot paths, IO, data volume, caching, rendering, or algorithmic cost changes. Produces no-impact rationale when clean.",
|
|
237
|
+
tools: ["Read", "Grep", "Glob"],
|
|
238
|
+
model: "balanced",
|
|
239
|
+
activation: "proactive",
|
|
240
|
+
relatedStages: ["review"],
|
|
241
|
+
returnSchema: REVIEW_RETURN_SCHEMA,
|
|
242
|
+
body: [
|
|
243
|
+
"You are a **performance review specialist**.",
|
|
244
|
+
"",
|
|
245
|
+
"Check hot paths, algorithmic complexity, IO/network calls, caching behavior, bundle/runtime costs, and accidental N+1 or repeated work.",
|
|
246
|
+
"Every finding needs a concrete code citation and a measurement or measurement plan."
|
|
247
|
+
].join("\n")
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
name: "compatibility-reviewer",
|
|
251
|
+
description: "PROACTIVE during design/review when public APIs, config, persisted data, CLI behavior, generated clients, or dependency versions may change.",
|
|
252
|
+
tools: ["Read", "Grep", "Glob"],
|
|
253
|
+
model: "balanced",
|
|
254
|
+
activation: "proactive",
|
|
255
|
+
relatedStages: ["design", "review"],
|
|
256
|
+
returnSchema: REVIEW_RETURN_SCHEMA,
|
|
257
|
+
body: [
|
|
258
|
+
"You are a **compatibility review specialist**.",
|
|
259
|
+
"",
|
|
260
|
+
"Check API compatibility, config/schema stability, persisted data migrations, CLI/user-facing behavior, generated clients, and rollout fallback paths.",
|
|
261
|
+
"Distinguish shipped compatibility obligations from in-branch implementation churn."
|
|
262
|
+
].join("\n")
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
name: "observability-reviewer",
|
|
266
|
+
description: "PROACTIVE during design/review when diagnosis, telemetry, rollout visibility, or supportability could affect safe operation.",
|
|
267
|
+
tools: ["Read", "Grep", "Glob"],
|
|
268
|
+
model: "balanced",
|
|
269
|
+
activation: "proactive",
|
|
270
|
+
relatedStages: ["design", "review"],
|
|
271
|
+
returnSchema: REVIEW_RETURN_SCHEMA,
|
|
272
|
+
body: [
|
|
273
|
+
"You are an **observability review specialist**.",
|
|
274
|
+
"",
|
|
275
|
+
"Check logs, metrics, traces, alerts, debug handles, failure detection, and support handoff evidence for the changed paths.",
|
|
276
|
+
"Report missing visibility as a ship risk only when it affects diagnosis or rollback."
|
|
277
|
+
].join("\n")
|
|
278
|
+
},
|
|
100
279
|
{
|
|
101
280
|
name: "security-reviewer",
|
|
102
281
|
description: "MANDATORY during review; PROACTIVE during design/ship for trust-boundary changes. Always produce an explicit no-change attestation when no security-relevant surface moved.",
|
|
@@ -104,6 +283,7 @@ export const CCLAW_AGENTS = [
|
|
|
104
283
|
model: "balanced",
|
|
105
284
|
activation: "mandatory",
|
|
106
285
|
relatedStages: ["design", "review", "ship"],
|
|
286
|
+
returnSchema: REVIEW_RETURN_SCHEMA,
|
|
107
287
|
body: [
|
|
108
288
|
"You are a **security vulnerability specialist** focused on exploitability.",
|
|
109
289
|
"",
|
|
@@ -118,7 +298,8 @@ export const CCLAW_AGENTS = [
|
|
|
118
298
|
"- severity aligned to ship risk",
|
|
119
299
|
"- CWE ID when possible (or UNKNOWN)",
|
|
120
300
|
"- short proof-of-concept vector",
|
|
121
|
-
"- concrete control-oriented fix"
|
|
301
|
+
"- concrete control-oriented fix",
|
|
302
|
+
"- `NO_CHANGE_ATTESTATION` or `NO_SECURITY_IMPACT` with inspected surfaces when no security finding exists"
|
|
122
303
|
].join("\n")
|
|
123
304
|
},
|
|
124
305
|
{
|
|
@@ -128,10 +309,11 @@ export const CCLAW_AGENTS = [
|
|
|
128
309
|
model: "balanced",
|
|
129
310
|
activation: "mandatory",
|
|
130
311
|
relatedStages: ["tdd"],
|
|
312
|
+
returnSchema: WORKER_RETURN_SCHEMA,
|
|
131
313
|
body: [
|
|
132
314
|
"You are a **test-driven development** specialist.",
|
|
133
315
|
"",
|
|
134
|
-
"**Iron law:** no production code without a failing test first.",
|
|
316
|
+
"**Iron law:** no production code without a failing test first during RED. In design, focus on testability and verification evidence without editing production code.",
|
|
135
317
|
"",
|
|
136
318
|
"Process:",
|
|
137
319
|
"1. RED: write a failing test for the desired behavior.",
|
|
@@ -141,6 +323,21 @@ export const CCLAW_AGENTS = [
|
|
|
141
323
|
"5. REFACTOR with behavior preserved."
|
|
142
324
|
].join("\n")
|
|
143
325
|
},
|
|
326
|
+
{
|
|
327
|
+
name: "release-reviewer",
|
|
328
|
+
description: "MANDATORY during ship. MUST BE USED for release readiness, rollback, finalization mode, evidence freshness, and victory detector checks.",
|
|
329
|
+
tools: ["Read", "Grep", "Glob", "Bash"],
|
|
330
|
+
model: "balanced",
|
|
331
|
+
activation: "mandatory",
|
|
332
|
+
relatedStages: ["ship"],
|
|
333
|
+
returnSchema: REVIEW_RETURN_SCHEMA,
|
|
334
|
+
body: [
|
|
335
|
+
"You are a **release readiness reviewer**.",
|
|
336
|
+
"",
|
|
337
|
+
"Verify preflight evidence, review verdict freshness, rollback trigger and steps, finalization enum, no-VCS handoff when applicable, learnings capture, and handoff completeness.",
|
|
338
|
+
"Block ship on stale evidence, unresolved criticals, missing rollback, or ambiguous finalization."
|
|
339
|
+
].join("\n")
|
|
340
|
+
},
|
|
144
341
|
{
|
|
145
342
|
name: "doc-updater",
|
|
146
343
|
description: "MANDATORY only at ship; PROACTIVE during tdd/review whenever behavior, config, or public API changes. Keep docs and runbooks in lockstep with shipped behavior.",
|
|
@@ -148,16 +345,78 @@ export const CCLAW_AGENTS = [
|
|
|
148
345
|
model: "fast",
|
|
149
346
|
activation: "mandatory",
|
|
150
347
|
relatedStages: ["tdd", "ship"],
|
|
348
|
+
returnSchema: DOC_RETURN_SCHEMA,
|
|
151
349
|
body: [
|
|
152
350
|
"You are a **documentation maintenance specialist**.",
|
|
153
351
|
"",
|
|
154
352
|
"After code changes, verify and update only stale sections in:",
|
|
155
353
|
"- README / setup / usage",
|
|
156
354
|
"- API docs and examples",
|
|
157
|
-
"- migration and operational notes",
|
|
355
|
+
"- migration, rollout, rollback, and operational notes",
|
|
356
|
+
"- public-surface change notes tied to actual changed files",
|
|
158
357
|
"",
|
|
159
358
|
"Preserve existing tone and structure; avoid rewrites for style alone."
|
|
160
359
|
].join("\n")
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
name: "slice-implementer",
|
|
363
|
+
description: "ON-DEMAND or PROACTIVE during TDD GREEN/REFACTOR for one bounded vertical slice after RED evidence exists and file ownership is non-overlapping.",
|
|
364
|
+
tools: ["Read", "Write", "Edit", "Grep", "Glob", "Bash"],
|
|
365
|
+
model: "balanced",
|
|
366
|
+
activation: "on-demand",
|
|
367
|
+
relatedStages: ["tdd"],
|
|
368
|
+
returnSchema: WORKER_RETURN_SCHEMA,
|
|
369
|
+
body: [
|
|
370
|
+
"You are a **vertical-slice implementation worker**.",
|
|
371
|
+
"",
|
|
372
|
+
"Rules:",
|
|
373
|
+
"1. Start only from the assigned RED failure and acceptance mapping.",
|
|
374
|
+
"2. Edit only the allowed files for the slice.",
|
|
375
|
+
"3. Implement the minimal GREEN change, then preserve behavior during REFACTOR.",
|
|
376
|
+
"4. Return files changed, tests run, evidence refs, concerns, and blockers.",
|
|
377
|
+
"",
|
|
378
|
+
"**Role boundary:** do not broaden scope, do not review your own work as final approval, and do not spawn subagents."
|
|
379
|
+
].join("\n")
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
name: "implementer",
|
|
383
|
+
description: "ON-DEMAND worker for one scoped implementation slice. Use only with self-contained task text, explicit file boundaries, and verification expectations.",
|
|
384
|
+
tools: ["Read", "Write", "Edit", "Grep", "Glob", "Bash"],
|
|
385
|
+
model: "balanced",
|
|
386
|
+
activation: "on-demand",
|
|
387
|
+
relatedStages: ["tdd"],
|
|
388
|
+
returnSchema: WORKER_RETURN_SCHEMA,
|
|
389
|
+
body: [
|
|
390
|
+
"You are an **implementation worker** for one bounded cclaw task.",
|
|
391
|
+
"",
|
|
392
|
+
"Rules:",
|
|
393
|
+
"1. Treat the parent prompt as the full task boundary; do not infer hidden scope from plan files.",
|
|
394
|
+
"2. Make the smallest coherent code change that satisfies the pasted acceptance criteria.",
|
|
395
|
+
"3. Run the requested verification commands when feasible and report representative evidence.",
|
|
396
|
+
"4. Return the strict worker JSON schema before prose.",
|
|
397
|
+
"",
|
|
398
|
+
"**Role boundary:** do not review your own work as final approval and do not spawn subagents."
|
|
399
|
+
].join("\n")
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
name: "fixer",
|
|
403
|
+
description: "ON-DEMAND fresh worker after review FAIL/PARTIAL evidence. Must fix only the cited criterion within explicit allowed files.",
|
|
404
|
+
tools: ["Read", "Write", "Edit", "Grep", "Glob", "Bash"],
|
|
405
|
+
model: "balanced",
|
|
406
|
+
activation: "on-demand",
|
|
407
|
+
relatedStages: ["review", "tdd"],
|
|
408
|
+
returnSchema: WORKER_RETURN_SCHEMA,
|
|
409
|
+
body: [
|
|
410
|
+
"You are a **fresh fixer worker** dispatched after a review found a concrete gap.",
|
|
411
|
+
"",
|
|
412
|
+
"Rules:",
|
|
413
|
+
"1. Start from the failing criterion and reviewer evidence, not from implementer claims.",
|
|
414
|
+
"2. Stay inside the allowed files and forbidden-change constraints.",
|
|
415
|
+
"3. Apply the smallest fix and rerun the relevant verification.",
|
|
416
|
+
"4. Return the strict fixer JSON schema before prose.",
|
|
417
|
+
"",
|
|
418
|
+
"**Role boundary:** fix only the cited gap; do not redesign the slice."
|
|
419
|
+
].join("\n")
|
|
161
420
|
}
|
|
162
421
|
];
|
|
163
422
|
import { stageDelegationSummary } from "./stage-schema.js";
|
|
@@ -187,6 +446,12 @@ ${agent.body}
|
|
|
187
446
|
- Mode: ${agent.activation}
|
|
188
447
|
- Related stages: ${relatedStages}
|
|
189
448
|
|
|
449
|
+
## Required Return Schema
|
|
450
|
+
|
|
451
|
+
STRICT_RETURN_SCHEMA: return a structured object matching this contract before any narrative when delegated.
|
|
452
|
+
|
|
453
|
+
${formatReturnSchema(agent.returnSchema)}
|
|
454
|
+
|
|
190
455
|
## Rules
|
|
191
456
|
|
|
192
457
|
## Conversation Language Policy
|
|
@@ -221,26 +486,39 @@ export function agentRoutingTable() {
|
|
|
221
486
|
`;
|
|
222
487
|
}
|
|
223
488
|
/**
|
|
224
|
-
* Cost tier routing for the
|
|
489
|
+
* Cost tier routing for the specialist agent roster.
|
|
225
490
|
*/
|
|
226
491
|
export function agentCostTierTable() {
|
|
227
492
|
return `| Tier | Use for | Example agents |
|
|
228
493
|
|---|---|---|
|
|
229
494
|
| \`deep\` | one heavy planning pass per stage | planner |
|
|
230
|
-
| \`balanced\` | review and
|
|
495
|
+
| \`balanced\` | discovery, criticism, review, TDD, and bounded worker execution | product-manager, critic, reviewer, security-reviewer, test-author, implementer, fixer |
|
|
231
496
|
| \`fast\` | bounded maintenance updates with limited blast radius | doc-updater |
|
|
232
497
|
`;
|
|
233
498
|
}
|
|
499
|
+
export function agentRegistryMatrix() {
|
|
500
|
+
const rows = CCLAW_AGENTS.map((agent) => {
|
|
501
|
+
const stages = agent.relatedStages.length > 0 ? agent.relatedStages.join(", ") : "none";
|
|
502
|
+
return `| ${agent.name} | ${agent.activation} | ${agent.model} | ${stages} | ${agent.returnSchema.allowedStatuses.join(" / ")} |`;
|
|
503
|
+
}).join("\n");
|
|
504
|
+
return `| Agent | Activation | Model | Related stages | Terminal statuses |
|
|
505
|
+
|---|---|---|---|---|
|
|
506
|
+
${rows}`;
|
|
507
|
+
}
|
|
234
508
|
/**
|
|
235
509
|
* AGENTS.md-ready section describing cclaw’s specialist delegation model.
|
|
236
510
|
*/
|
|
237
511
|
export function agentsAgentsMdBlock() {
|
|
238
512
|
return `### Agent Specialists
|
|
239
513
|
|
|
240
|
-
cclaw materializes
|
|
514
|
+
cclaw materializes specialist agents under \`.cclaw/agents/\`: ${CCLAW_AGENTS.map((agent) => agent.name).join(", ")}.
|
|
241
515
|
|
|
242
516
|
${agentRoutingTable()}
|
|
243
517
|
|
|
518
|
+
### Agent Registry Matrix
|
|
519
|
+
|
|
520
|
+
${agentRegistryMatrix()}
|
|
521
|
+
|
|
244
522
|
### Research Playbooks (in-thread)
|
|
245
523
|
|
|
246
524
|
Research work is no longer modeled as standalone personas. Use in-thread playbooks under \`.cclaw/skills/research/\`:
|
|
@@ -257,7 +535,7 @@ ${(() => {
|
|
|
257
535
|
const mode = activationModeSummary();
|
|
258
536
|
return `- **Mandatory:** ${mode.mandatory}.
|
|
259
537
|
- **Proactive:** ${mode.proactive}.
|
|
260
|
-
- **On-demand:**
|
|
538
|
+
- **On-demand:** slice-implementer, implementer, fixer. Research playbooks are in-thread procedures.`;
|
|
261
539
|
})()}
|
|
262
540
|
|
|
263
541
|
### Cost-aware routing
|
package/dist/content/examples.js
CHANGED
|
@@ -4,11 +4,19 @@ const STAGE_EXAMPLES = {
|
|
|
4
4
|
- **Project state:** Monorepo with CI pipeline using custom release scripts. Release checks are scattered across shell scripts with no shared validation logic.
|
|
5
5
|
- **Relevant existing code/patterns:** \`scripts/pre-publish.sh\` does metadata checks. \`src/release/\` has partial validation helpers.
|
|
6
6
|
|
|
7
|
-
## Problem
|
|
7
|
+
## Problem Decision Record
|
|
8
8
|
|
|
9
|
-
- **
|
|
10
|
-
- **
|
|
11
|
-
|
|
9
|
+
- **Depth:** standard
|
|
10
|
+
- **Frame type:** technical-maintenance
|
|
11
|
+
|
|
12
|
+
### Technical-maintenance framing
|
|
13
|
+
|
|
14
|
+
- **Affected operator/developer:** release operator and package maintainer.
|
|
15
|
+
- **Current failure mode:** release checks are fragile and inconsistent between CI and local runs; invalid metadata sometimes reaches npm publish.
|
|
16
|
+
- **Expected operational improvement:** invalid release preconditions are caught before publish with explicit operator feedback in CI and local workflows.
|
|
17
|
+
- **Verification signal:** shared release validation tests and CI release-check command fail on invalid metadata.
|
|
18
|
+
- **Do-nothing cost:** continued publish risk and duplicated local/CI fixes.
|
|
19
|
+
- **Non-goals:** no new runtime dependencies; no release-framework rewrite.
|
|
12
20
|
|
|
13
21
|
## Clarifying Questions
|
|
14
22
|
|
|
@@ -482,7 +490,7 @@ const GOOD_BAD_EXAMPLES = {
|
|
|
482
490
|
},
|
|
483
491
|
{
|
|
484
492
|
label: "Scope change trace",
|
|
485
|
-
good: "Scope delta at 2026-04-15: user asked to add per-user mute preferences. Decision: moved from Out-of-scope → In-scope; acknowledged cost (≈1 day, +1 schema migration); risk: touches settings surface. Recorded in
|
|
493
|
+
good: "Scope delta at 2026-04-15: user asked to add per-user mute preferences. Decision: moved from Out-of-scope → In-scope; acknowledged cost (≈1 day, +1 schema migration); risk: touches settings surface. Recorded in \`.cclaw/artifacts/03-design-<slug>.md#scope-trace\`. Requires re-running scope review before design lock.",
|
|
486
494
|
bad: "Added mute preferences to scope.",
|
|
487
495
|
lesson: "Scope changes silently are how projects drift. Every in↔out move needs a timestamp, a cost estimate, and a link to the next review it invalidates."
|
|
488
496
|
}
|
|
@@ -667,13 +675,14 @@ function exampleSummaryBullets(stage) {
|
|
|
667
675
|
// sample in STAGE_EXAMPLES gains or loses a top-level section.
|
|
668
676
|
const STAGE_EXAMPLE_SECTION_HEADINGS = {
|
|
669
677
|
brainstorm: [
|
|
670
|
-
"Problem
|
|
671
|
-
"
|
|
678
|
+
"Problem Decision Record (product or technical-maintenance framing)",
|
|
679
|
+
"Reference Pattern Candidates and approaches with trade-offs",
|
|
672
680
|
"Recommended direction + open questions",
|
|
673
681
|
"Clarification log and decision record"
|
|
674
682
|
],
|
|
675
683
|
scope: [
|
|
676
684
|
"In-scope / out-of-scope / deferred lists with concrete capabilities",
|
|
685
|
+
"Reference Pattern Registry with accepted/rejected/deferred dispositions",
|
|
677
686
|
"Requirements table with stable R# IDs",
|
|
678
687
|
"Boundary stress-tests and non-negotiables",
|
|
679
688
|
"Decision record for premise challenges"
|
|
@@ -681,6 +690,7 @@ const STAGE_EXAMPLE_SECTION_HEADINGS = {
|
|
|
681
690
|
design: [
|
|
682
691
|
"Blast-radius file list",
|
|
683
692
|
"Mandatory architecture diagram (Mermaid)",
|
|
693
|
+
"Reference-Grade Contracts for mirrored patterns",
|
|
684
694
|
"Failure-mode table with detection + mitigation",
|
|
685
695
|
"Test strategy + performance budget",
|
|
686
696
|
"Completion dashboard + unresolved decisions"
|
|
@@ -698,7 +708,7 @@ const STAGE_EXAMPLE_SECTION_HEADINGS = {
|
|
|
698
708
|
"No-Placeholder scan row + WAIT_FOR_CONFIRM marker"
|
|
699
709
|
],
|
|
700
710
|
tdd: [
|
|
701
|
-
"RED evidence per slice (failing test output)",
|
|
711
|
+
"RED evidence per vertical slice (failing test output)",
|
|
702
712
|
"Acceptance mapping per slice",
|
|
703
713
|
"GREEN evidence (full-suite pass)",
|
|
704
714
|
"REFACTOR notes with behavior-preservation confirmation",
|
|
@@ -708,10 +718,11 @@ const STAGE_EXAMPLE_SECTION_HEADINGS = {
|
|
|
708
718
|
"Spec-compliance findings (Layer 1)",
|
|
709
719
|
"Code-quality findings (Layer 2)",
|
|
710
720
|
"Severity, evidence, and status per finding",
|
|
711
|
-
"
|
|
721
|
+
"Victory Detector-backed go / no-go verdict"
|
|
712
722
|
],
|
|
713
723
|
ship: [
|
|
714
724
|
"Release checklist (version, changelog, tag, artifacts)",
|
|
725
|
+
"Victory Detector: valid review, fresh preflight, rollback, finalization enum",
|
|
715
726
|
"Rollback plan with trigger, steps, verification",
|
|
716
727
|
"Runbook (how to verify the release post-deploy)",
|
|
717
728
|
"Sign-off block"
|
|
@@ -724,7 +735,7 @@ const DOMAIN_LABELS = {
|
|
|
724
735
|
"data-pipeline": "Data pipeline / ETL"
|
|
725
736
|
};
|
|
726
737
|
export const RESEARCH_FLEET_USAGE_EXAMPLE = [
|
|
727
|
-
"Before drafting
|
|
738
|
+
"Before drafting `.cclaw/artifacts/03-design-<slug>.md`, run `research/research-fleet.md` once and",
|
|
728
739
|
"capture all four lenses in `.cclaw/artifacts/02a-research.md`.",
|
|
729
740
|
"Dispatch semantics by harness: Claude/OpenCode/Codex = native subagents;",
|
|
730
741
|
"Cursor = generic-dispatch Task mapping; role-switch only as degraded fallback.",
|
|
@@ -76,7 +76,7 @@ ${conversationLanguagePolicyMarkdown()}
|
|
|
76
76
|
|
|
77
77
|
1. Read **\`${flowPath}\`**. If missing → **BLOCKED** (state missing).
|
|
78
78
|
2. Parse JSON. Capture \`currentStage\` and \`stageGateCatalog[currentStage]\`.
|
|
79
|
-
3. If \`staleStages[currentStage]\` exists, do not advance automatically.
|
|
79
|
+
3. If \`staleStages[currentStage]\` exists, do not advance automatically. Report the stale marker reason/rewindId, re-run the stage artifact work, then clear only the current stage marker with \`cclaw internal rewind --ack <currentStage>\`.
|
|
80
80
|
4. Read **\`${reconciliationNoticesPath}\`** when present. If it contains entries for \`activeRunId + currentStage\` and the listed gate is still blocked in \`stageGateCatalog[currentStage].blocked\`, emit a structured warning before any stage-advance decision.
|
|
81
81
|
5. Let \`G\` = \`requiredGates\` for **\`currentStage\`** from the stage schema.
|
|
82
82
|
6. Let \`catalog\` = \`stageGateCatalog[currentStage]\` from flow state.
|
|
@@ -85,7 +85,7 @@ ${conversationLanguagePolicyMarkdown()}
|
|
|
85
85
|
9. If \`M\` is non-empty, inspect **\`${delegationPath}\`**. Treat as satisfied only if each mandatory agent is **completed** or **waived**.
|
|
86
86
|
10. For each satisfied mandatory delegation row, verify \`evidenceRefs\` is a non-empty array (unless status is \`waived\` with rationale). Missing evidenceRefs means delegation is unresolved.
|
|
87
87
|
11. If any mandatory delegation is missing and no waiver exists: **STOP** and ask the user whether to dispatch now or waive with rationale. Do not mark gates passed while delegation is unresolved.
|
|
88
|
-
12. If \`currentStage === "review"\` and \`catalog.blocked\` includes \`review_criticals_resolved\`, treat this as a hard remediation branch: recommend \`cclaw internal rewind tdd "review_blocked_by_critical
|
|
88
|
+
12. If \`currentStage === "review"\` and \`catalog.blocked\` includes \`review_criticals_resolved\`, treat this as a hard remediation branch: recommend the managed command \`cclaw internal rewind tdd "review_blocked_by_critical <finding-ids>"\`, and do not attempt to advance toward ship. After TDD rework, require \`cclaw internal rewind --ack tdd\` before continuing.
|
|
89
89
|
|
|
90
90
|
### Path A: Current stage is NOT complete (any gate unmet or delegation missing)
|
|
91
91
|
|
|
@@ -186,11 +186,13 @@ ${conversationLanguagePolicyMarkdown()}
|
|
|
186
186
|
Default output should be compact, like OMC/OMX operator surfaces:
|
|
187
187
|
|
|
188
188
|
\`\`\`
|
|
189
|
-
|
|
189
|
+
Current: <currentStage or closeout.shipSubstate> (<track>)
|
|
190
|
+
Stage: <currentStage>
|
|
190
191
|
Gates: <passed>/<required> passed, <blocked> blocked
|
|
191
192
|
Delegations: <done>/<mandatory> done
|
|
192
|
-
|
|
193
|
+
Blocked by: <none | gate/delegation/reconciliation/stale/TDD/review ids>
|
|
193
194
|
Next: <exact next action, usually /cc-next or one named remediation>
|
|
195
|
+
Evidence needed: <artifact/test/review/delegation evidence required to unblock>
|
|
194
196
|
\`\`\`
|
|
195
197
|
|
|
196
198
|
Only expand beyond this when blocked, when asking a structured question, or when
|
|
@@ -214,7 +216,7 @@ Do **not** mark gates satisfied from memory alone. Cite **artifact evidence** (p
|
|
|
214
216
|
|
|
215
217
|
1. Open **\`${flowPath}\`**.
|
|
216
218
|
2. Record \`currentStage\` and \`stageGateCatalog[currentStage]\`.
|
|
217
|
-
3. If \`staleStages[currentStage]\` exists, re-run the stage and clear marker via \`cclaw internal rewind --ack <currentStage>\` before advancing.
|
|
219
|
+
3. If \`staleStages[currentStage]\` exists, show the marker reason/rewindId, re-run the stage, and clear only the current marker via \`cclaw internal rewind --ack <currentStage>\` before advancing.
|
|
218
220
|
4. If the file is missing or invalid JSON → **BLOCKED** (report and stop).
|
|
219
221
|
5. Read \`${reconciliationNoticesPath}\` when present. For entries matching \`activeRunId + currentStage\` whose gate is still in \`stageGateCatalog[currentStage].blocked\`, show a warning with gate id + reason before proceeding.
|
|
220
222
|
|
|
@@ -242,7 +244,9 @@ Execute the stage protocol. The stage skill handles interaction, STOP points, ga
|
|
|
242
244
|
|
|
243
245
|
${ralphLoopContractSnippet()}
|
|
244
246
|
|
|
245
|
-
Special-case for review: if \`review_criticals_resolved\` is in \`blocked\`, route to rework instead of looping review forever
|
|
247
|
+
Special-case for review: if \`review_criticals_resolved\` is in \`blocked\`, route to rework instead of looping review forever - recommend \`cclaw internal rewind tdd "review_blocked_by_critical <finding-ids>"\`, then \`cclaw internal rewind --ack tdd\` after TDD rework.
|
|
248
|
+
|
|
249
|
+
Special-case for TDD blockers: when \`06-tdd.md\` records \`NO_SOURCE_CONTEXT\`, \`NO_TEST_SURFACE\`, \`NO_IMPLEMENTABLE_SLICE\`, \`RED_NOT_EXPRESSIBLE\`, or \`NO_VCS_MODE\`, keep status BLOCKED and print \`Current\`, \`Blocked by\`, \`Next\`, and \`Evidence needed\` instead of retrying speculative RED/GREEN work.
|
|
246
250
|
|
|
247
251
|
**Path B — stage IS complete (all gates met, all delegations done):**
|
|
248
252
|
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { FlowStage } from "../types.js";
|
|
2
|
+
export interface ReferencePatternContract {
|
|
3
|
+
stage: FlowStage;
|
|
4
|
+
guidance: string[];
|
|
5
|
+
artifactSections: string[];
|
|
6
|
+
}
|
|
7
|
+
export interface ReferencePattern {
|
|
8
|
+
id: string;
|
|
9
|
+
title: string;
|
|
10
|
+
intent: string;
|
|
11
|
+
useWhen: string;
|
|
12
|
+
policyNeedles: string[];
|
|
13
|
+
contracts: ReferencePatternContract[];
|
|
14
|
+
}
|
|
15
|
+
export declare const REFERENCE_PATTERNS: ReferencePattern[];
|
|
16
|
+
export declare function referencePatternsForStage(stage: FlowStage): ReferencePattern[];
|
|
17
|
+
export declare function referencePatternContractsForStage(stage: FlowStage): ReferencePatternContract[];
|
|
18
|
+
export declare function referencePatternPolicyNeedles(stage: FlowStage): string[];
|