cclaw-cli 0.55.2 → 2.0.0

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.
Files changed (92) hide show
  1. package/README.md +3 -3
  2. package/dist/artifact-linter/brainstorm.js +59 -1
  3. package/dist/artifact-linter/design.js +46 -1
  4. package/dist/artifact-linter/plan.js +22 -1
  5. package/dist/artifact-linter/review.js +35 -1
  6. package/dist/artifact-linter/scope.js +33 -9
  7. package/dist/artifact-linter/shared.d.ts +12 -10
  8. package/dist/artifact-linter/shared.js +102 -41
  9. package/dist/artifact-linter/ship.js +36 -0
  10. package/dist/artifact-linter/spec.js +23 -1
  11. package/dist/artifact-linter/tdd.js +74 -0
  12. package/dist/artifact-linter.d.ts +1 -1
  13. package/dist/artifact-linter.js +11 -1
  14. package/dist/constants.d.ts +1 -1
  15. package/dist/constants.js +1 -0
  16. package/dist/content/closeout-guidance.d.ts +1 -1
  17. package/dist/content/closeout-guidance.js +10 -11
  18. package/dist/content/core-agents.d.ts +35 -36
  19. package/dist/content/core-agents.js +189 -99
  20. package/dist/content/diff-command.js +1 -1
  21. package/dist/content/examples.d.ts +0 -3
  22. package/dist/content/examples.js +197 -752
  23. package/dist/content/hook-events.js +1 -2
  24. package/dist/content/hook-manifest.d.ts +3 -4
  25. package/dist/content/hook-manifest.js +22 -25
  26. package/dist/content/hooks.js +54 -14
  27. package/dist/content/idea.d.ts +60 -0
  28. package/dist/content/idea.js +404 -0
  29. package/dist/content/learnings.d.ts +2 -4
  30. package/dist/content/learnings.js +10 -26
  31. package/dist/content/meta-skill.js +4 -3
  32. package/dist/content/node-hooks.js +368 -164
  33. package/dist/content/observe.js +3 -3
  34. package/dist/content/opencode-plugin.js +12 -32
  35. package/dist/content/reference-patterns.js +2 -2
  36. package/dist/content/runtime-shared-snippets.d.ts +8 -0
  37. package/dist/content/runtime-shared-snippets.js +80 -0
  38. package/dist/content/session-hooks.js +1 -1
  39. package/dist/content/skills-elicitation.d.ts +1 -0
  40. package/dist/content/skills-elicitation.js +123 -0
  41. package/dist/content/skills.d.ts +1 -0
  42. package/dist/content/skills.js +54 -2
  43. package/dist/content/stage-schema.js +107 -63
  44. package/dist/content/stages/brainstorm.js +7 -3
  45. package/dist/content/stages/design.js +4 -0
  46. package/dist/content/stages/review.js +8 -8
  47. package/dist/content/stages/schema-types.d.ts +2 -2
  48. package/dist/content/stages/scope.js +7 -3
  49. package/dist/content/stages/ship.js +1 -1
  50. package/dist/content/start-command.js +4 -4
  51. package/dist/content/status-command.js +3 -3
  52. package/dist/content/subagent-context-skills.js +156 -1
  53. package/dist/content/subagents.d.ts +0 -5
  54. package/dist/content/subagents.js +12 -82
  55. package/dist/content/templates.js +108 -6
  56. package/dist/content/utility-skills.js +26 -97
  57. package/dist/flow-state.d.ts +12 -6
  58. package/dist/flow-state.js +5 -6
  59. package/dist/gate-evidence.d.ts +0 -31
  60. package/dist/gate-evidence.js +3 -181
  61. package/dist/harness-adapters.js +1 -1
  62. package/dist/hook-schemas/claude-hooks.v1.json +2 -3
  63. package/dist/hook-schemas/codex-hooks.v1.json +1 -1
  64. package/dist/hook-schemas/cursor-hooks.v1.json +1 -1
  65. package/dist/install.js +50 -7
  66. package/dist/internal/advance-stage/advance.js +22 -2
  67. package/dist/internal/advance-stage/parsers.d.ts +1 -0
  68. package/dist/internal/advance-stage/parsers.js +6 -0
  69. package/dist/internal/advance-stage/review-loop.js +1 -10
  70. package/dist/knowledge-store.d.ts +2 -20
  71. package/dist/knowledge-store.js +43 -57
  72. package/dist/policy.js +3 -3
  73. package/dist/retro-gate.js +8 -90
  74. package/dist/run-archive.js +1 -4
  75. package/dist/run-persistence.d.ts +1 -1
  76. package/dist/run-persistence.js +43 -111
  77. package/dist/runtime/run-hook.entry.d.ts +3 -0
  78. package/dist/runtime/run-hook.entry.js +5 -0
  79. package/dist/runtime/run-hook.mjs +9647 -0
  80. package/dist/track-heuristics.d.ts +7 -1
  81. package/dist/track-heuristics.js +12 -0
  82. package/package.json +4 -2
  83. package/dist/content/hook-inline-snippets.d.ts +0 -96
  84. package/dist/content/hook-inline-snippets.js +0 -515
  85. package/dist/content/idea-command.d.ts +0 -8
  86. package/dist/content/idea-command.js +0 -322
  87. package/dist/content/idea-frames.d.ts +0 -31
  88. package/dist/content/idea-frames.js +0 -140
  89. package/dist/content/idea-ranking.d.ts +0 -25
  90. package/dist/content/idea-ranking.js +0 -65
  91. package/dist/trace-matrix.d.ts +0 -27
  92. package/dist/trace-matrix.js +0 -226
@@ -24,6 +24,10 @@ const ADVISORY_RETURN_SCHEMA = {
24
24
  requiredFields: ["status", "summary", "recommendations", "evidenceRefs", "unknowns"],
25
25
  evidenceFields: ["evidenceRefs", "recommendations"]
26
26
  };
27
+ const CRITIC_ADVISORY_RETURN_SCHEMA = {
28
+ ...ADVISORY_RETURN_SCHEMA,
29
+ optionalFields: ["predictions", "predictionsValidated", "openQuestions", "realistCheckResults"]
30
+ };
27
31
  const DOC_RETURN_SCHEMA = {
28
32
  statusField: "status",
29
33
  allowedStatuses: ["DONE", "DONE_WITH_CONCERNS", "NEEDS_CONTEXT", "BLOCKED"],
@@ -49,12 +53,16 @@ Before doing substantive work, return an ACK object that the parent can record:
49
53
  Finish with the required return schema plus the same \`spanId\` and \`dispatchId\`. The parent must not claim isolated completion unless ACK/result proof matches the ledger/event span.`;
50
54
  }
51
55
  function formatReturnSchema(schema) {
52
- return [
56
+ const lines = [
53
57
  `- Status field: \`${schema.statusField}\``,
54
58
  `- Allowed statuses: ${schema.allowedStatuses.map((status) => `\`${status}\``).join(", ")}`,
55
59
  `- Required fields: ${schema.requiredFields.map((field) => `\`${field}\``).join(", ")}`,
56
60
  `- Evidence fields: ${schema.evidenceFields.map((field) => `\`${field}\``).join(", ")}`
57
- ].join("\n");
61
+ ];
62
+ if (schema.optionalFields && schema.optionalFields.length > 0) {
63
+ lines.push(`- Optional fields: ${schema.optionalFields.map((field) => `\`${field}\``).join(", ")}`);
64
+ }
65
+ return lines.join("\n");
58
66
  }
59
67
  function formattedAgentsForStages(stages) {
60
68
  const summary = stageDelegationSummary("standard");
@@ -140,48 +148,58 @@ export const CCLAW_AGENTS = [
140
148
  ].join("\n")
141
149
  },
142
150
  {
143
- name: "product-manager",
144
- description: "PROACTIVE during brainstorm/scope when product value, persona/JTBD, success metric, or why-now framing is unclear. Use for product discovery, not implementation.",
151
+ name: "product-discovery",
152
+ description: "MANDATORY during brainstorm and PROACTIVE during scope when value framing or expansion strategy needs product-level discovery pressure.",
145
153
  tools: ["Read", "Grep", "Glob", "WebSearch"],
146
- model: "balanced",
147
- activation: "proactive",
154
+ model: "deep",
155
+ activation: "mandatory",
148
156
  relatedStages: ["brainstorm", "scope"],
149
157
  returnSchema: ADVISORY_RETURN_SCHEMA,
150
158
  body: [
151
159
  "You are a **product discovery specialist**.",
152
160
  "",
153
- "Produce concise evidence for:",
161
+ "**Mode: discovery** (default)",
154
162
  "- persona / user and job to be done",
155
163
  "- pain or trigger",
156
164
  "- value hypothesis and success metric",
157
165
  "- evidence or signal strength",
158
166
  "- why now, do-nothing consequence, and non-goals",
159
167
  "",
160
- "For technical-maintenance work, translate this to operator/developer, failure mode, operational improvement, verification signal, do-nothing cost, and non-goals.",
168
+ "**Mode: strategist** (trigger when scope mode is SCOPE EXPANSION or SELECTIVE EXPANSION)",
169
+ "- 10x vision and ideal outcome versus baseline scope",
170
+ "- concrete expansion proposals (not cosmetic variants)",
171
+ "- expected upside, reversibility, and trajectory impact",
172
+ "- explicit add/defer/skip recommendation per proposal",
173
+ "",
174
+ "For technical-maintenance work, translate these modes to operator/developer outcomes, failure-mode reduction, verification signal quality, and trajectory impact.",
161
175
  "",
162
- "**Role boundary:** frame value and problem fit. Do NOT choose implementation architecture."
176
+ "**Role boundary:** frame value and trajectory fit. Do NOT choose implementation architecture."
163
177
  ].join("\n")
164
178
  },
165
179
  {
166
- name: "product-strategist",
167
- description: "PROACTIVE during scope. MUST BE USED when selected scope mode is SCOPE EXPANSION or SELECTIVE EXPANSION to pressure-test 10x vision, strategic upside, and long-term trajectory before lock.",
180
+ name: "divergent-thinker",
181
+ description: "PROACTIVE before planner/critic convergence when brainstorm or scope needs option-space expansion and alternative framings.",
168
182
  tools: ["Read", "Grep", "Glob", "WebSearch"],
169
- model: "deep",
183
+ model: "balanced",
170
184
  activation: "proactive",
171
- relatedStages: ["scope"],
185
+ relatedStages: ["brainstorm", "scope"],
172
186
  returnSchema: ADVISORY_RETURN_SCHEMA,
173
187
  body: [
174
- "You are a **product strategy specialist** focused on expansion decisions.",
188
+ "You are a **creative divergent-thinker** dispatched BEFORE planner/critic converge on a single path.",
175
189
  "",
176
- "Produce concise evidence for:",
177
- "- 10x vision and ideal outcome versus baseline scope",
178
- "- concrete expansion proposals (not cosmetic variants)",
179
- "- expected upside, reversibility, and trajectory impact",
180
- "- explicit add/defer/skip recommendation per proposal",
181
- "",
182
- "Operate only when scope mode is SCOPE EXPANSION or SELECTIVE EXPANSION; otherwise return `None - mode does not require strategist pass`.",
183
- "",
184
- "**Role boundary:** challenge strategic scope and trajectory; do NOT choose implementation architecture."
190
+ "Your job:",
191
+ "1. Generate 3-5 alternative framings of the problem.",
192
+ "2. Generate 3-5 alternative approaches per framing where reasonable.",
193
+ "3. For each option, include one-line pro/con plus reversibility flag.",
194
+ "4. Highlight option-space the user might not have considered.",
195
+ "5. Return concise structured output in `recommendations[]` for planner/critic consumption.",
196
+ "",
197
+ "Role boundary: divergence only.",
198
+ "- Do NOT recommend a single approach.",
199
+ "- Do NOT validate feasibility (feasibility-reviewer owns that).",
200
+ "- Do NOT critique premise validity (critic owns that).",
201
+ "",
202
+ "You are an explicit amplifier of option-space; convergence happens after you."
185
203
  ].join("\n")
186
204
  },
187
205
  {
@@ -191,32 +209,52 @@ export const CCLAW_AGENTS = [
191
209
  model: "balanced",
192
210
  activation: "proactive",
193
211
  relatedStages: ["brainstorm", "scope", "design"],
194
- returnSchema: ADVISORY_RETURN_SCHEMA,
212
+ returnSchema: CRITIC_ADVISORY_RETURN_SCHEMA,
195
213
  body: [
196
214
  "You are an **adversarial critic** for product and engineering decisions.",
197
215
  "",
198
- "Your job:",
199
- "1. Attack the premise and name what could make the current direction wrong.",
200
- "2. Identify cheaper, smaller, or more reversible alternatives.",
201
- "3. Surface hidden assumptions, do-nothing viability, and scope creep.",
202
- "4. In design, require a shadow alternative, switch trigger, failure/rescue path, and verification evidence.",
216
+ "## Why this matters",
217
+ "False approval is expensive: a missed flaw early can cost 10-100x more to unwind after implementation.",
218
+ "Anchor every concern in evidence and avoid inventing hypothetical blockers without proof.",
219
+ "",
220
+ "## Pre-commitment predictions",
221
+ "Before deep investigation, list your hypotheses in `predictions[]` (what you expect to find and why).",
222
+ "",
223
+ "## Multi-perspective angles",
224
+ "Pick context-aware angles before analysis:",
225
+ "- plan/spec/scope: `executor`, `stakeholder`, `skeptic`",
226
+ "- design/code: `security`, `operator`, `new-hire`",
227
+ "",
228
+ "## Gap analysis",
229
+ "Name what is missing (evidence gaps, undefined contracts, absent safeguards), not just what looks wrong.",
230
+ "",
231
+ "## Self-audit",
232
+ "Low-confidence concerns (confidence <=4/10) must move into `openQuestions[]` and should not block stage transition by themselves.",
233
+ "",
234
+ "## Realist check",
235
+ "For each Critical/Major concern, test if it would realistically ship; downgrade or suppress concerns that are not plausible in this context.",
236
+ "Record the result in `realistCheckResults[]`.",
203
237
  "",
204
- "Return confirmed risks, disproven concerns, and the smallest decision-changing recommendation."
238
+ "## ADVERSARIAL mode escalation",
239
+ "Escalate to ADVERSARIAL mode when reviewers disagree, your confidence is low, or trust/security boundaries are involved.",
240
+ "",
241
+ "Return validated risks, disproven predictions in `predictionsValidated[]`, and the smallest decision-changing recommendation."
205
242
  ].join("\n")
206
243
  },
207
244
  {
208
245
  name: "architect",
209
- description: "MANDATORY during design. MUST BE USED to validate architecture boundaries, alternatives, failure modes, rollout, and spec handoff before implementation.",
246
+ description: "MANDATORY during design and final ship verification. MUST BE USED to validate architecture boundaries, alternatives, failure modes, rollout, and cross-stage cohesion before release.",
210
247
  tools: ["Read", "Grep", "Glob", "WebSearch"],
211
248
  model: "deep",
212
249
  activation: "mandatory",
213
- relatedStages: ["design"],
250
+ relatedStages: ["design", "ship"],
214
251
  returnSchema: ADVISORY_RETURN_SCHEMA,
215
252
  body: [
216
253
  "You are an **architecture validation specialist**.",
217
254
  "",
218
255
  "Check architecture boundaries, existing-system fit, critical paths, data/state flow, alternatives, rescue paths, and verification hooks.",
219
256
  "Return chosen path risks, rejected alternatives, switch triggers, and required evidence before spec handoff.",
257
+ "At ship, perform cross-stage verification across scope/design/spec/plan/review/code and flag DRIFT_DETECTED when shipped behavior diverges from locked decisions.",
220
258
  "",
221
259
  "**Role boundary:** design validation only. Do NOT write implementation code."
222
260
  ].join("\n")
@@ -261,81 +299,109 @@ export const CCLAW_AGENTS = [
261
299
  ].join("\n")
262
300
  },
263
301
  {
264
- name: "reviewer",
265
- description: "MANDATORY during review. MUST BE USED to run a two-pass audit: spec compliance first, then correctness/maintainability/performance/architecture.",
302
+ name: "coherence-reviewer",
303
+ description: "PROACTIVE during spec/plan/design when internal consistency must be validated across sections, terminology, references, and dependency narratives.",
266
304
  tools: ["Read", "Grep", "Glob"],
267
305
  model: "balanced",
268
- activation: "mandatory",
269
- relatedStages: ["spec", "review", "ship"],
306
+ activation: "proactive",
307
+ relatedStages: ["spec", "plan", "design"],
270
308
  returnSchema: REVIEW_RETURN_SCHEMA,
271
309
  body: [
272
- "You are a **combined spec + code reviewer**.",
273
- "",
274
- "Run two explicit passes:",
275
- "",
276
- "1. **Spec pass**",
277
- " - For each acceptance criterion: PASS / PARTIAL / FAIL.",
278
- " - Cite evidence as `file:line`.",
279
- "",
280
- "2. **Code-quality pass**",
281
- " - Correctness: logic, boundaries, state transitions.",
282
- " - Maintainability: naming, structure, complexity, debt risks.",
283
- " - Performance: avoid obvious hot-path regressions.",
284
- " - Architecture fit: layering and contract stability.",
310
+ "You are a **document coherence reviewer** focused on consistency, not quality scoring.",
285
311
  "",
286
- "For each finding include:",
287
- "- Severity: `Critical` | `Important` | `Suggestion`",
288
- "- Location: `file:line`; if no line is possible, state the no-line reason",
289
- "- Problem and concrete recommendation",
312
+ "Check for:",
313
+ "- contradictions between sections",
314
+ "- terminology drift (same concept named differently)",
315
+ "- broken internal references and forward-reference mismatches",
316
+ "- dependency/storyline conflicts between architecture, scope, and execution notes",
290
317
  "",
291
- "Also report files inspected, changed-file coverage, diagnostics run, dependency/version audit when relevant, and a no-finding attestation when no issues are found.",
318
+ "Return `PASS`, `PASS_WITH_GAPS`, `FAIL`, or `BLOCKED` with calibrated, evidence-anchored findings.",
292
319
  "",
293
- "**Trust model:** never rely on implementer claims; verify by reading code."
320
+ "**Role boundary:** consistency checks only. Do NOT rewrite the document or propose architecture alternatives."
294
321
  ].join("\n")
295
322
  },
296
323
  {
297
- name: "performance-reviewer",
298
- description: "PROACTIVE during review for hot paths, IO, data volume, caching, rendering, or algorithmic cost changes. Produces no-impact rationale when clean.",
324
+ name: "scope-guardian-reviewer",
325
+ description: "PROACTIVE during scope/plan/design when complexity growth, scope drift, or unnecessary abstraction risk needs a dedicated challenge pass.",
299
326
  tools: ["Read", "Grep", "Glob"],
300
327
  model: "balanced",
301
328
  activation: "proactive",
302
- relatedStages: ["review"],
329
+ relatedStages: ["scope", "plan", "design"],
303
330
  returnSchema: REVIEW_RETURN_SCHEMA,
304
331
  body: [
305
- "You are a **performance review specialist**.",
332
+ "You are a **scope guard reviewer** focused on minimum viable change and complexity discipline.",
333
+ "",
334
+ "Check for:",
335
+ "- whether the document reuses existing solutions before adding abstractions",
336
+ "- scope-goal alignment and minimum useful slice",
337
+ "- complexity smell tests (generic utilities, framework-ahead-of-need patterns, speculative layers)",
338
+ "- dependency ordering that can accidentally widen scope",
306
339
  "",
307
- "Check hot paths, algorithmic complexity, IO/network calls, caching behavior, bundle/runtime costs, and accidental N+1 or repeated work.",
308
- "Every finding needs a concrete code citation and a measurement or measurement plan."
340
+ "Return `PASS`, `PASS_WITH_GAPS`, `FAIL`, or `BLOCKED` with concrete evidence refs and smallest corrective action.",
341
+ "",
342
+ "**Role boundary:** challenge over-scope and unnecessary complexity; do NOT replace planner/architect ownership."
309
343
  ].join("\n")
310
344
  },
311
345
  {
312
- name: "compatibility-reviewer",
313
- description: "PROACTIVE during design/review when public APIs, config, persisted data, CLI behavior, generated clients, or dependency versions may change.",
346
+ name: "feasibility-reviewer",
347
+ description: "PROACTIVE during plan/design when resource, runtime, environment, dependency, or rollout assumptions can make the solution non-viable.",
314
348
  tools: ["Read", "Grep", "Glob"],
315
349
  model: "balanced",
316
350
  activation: "proactive",
317
- relatedStages: ["design", "review"],
351
+ relatedStages: ["plan", "design"],
318
352
  returnSchema: REVIEW_RETURN_SCHEMA,
319
353
  body: [
320
- "You are a **compatibility review specialist**.",
354
+ "You are a **feasibility reviewer** focused on execution realism.",
355
+ "",
356
+ "Check for:",
357
+ "- resource/time assumptions versus current constraints",
358
+ "- runtime and environment assumptions (infrastructure, limits, deployment shape)",
359
+ "- availability/reliability assumptions for external dependencies",
360
+ "- rollout and operational risk under real-world conditions",
361
+ "",
362
+ "Return `PASS`, `PASS_WITH_GAPS`, `FAIL`, or `BLOCKED` with evidence and explicit risk-to-ship mapping.",
321
363
  "",
322
- "Check API compatibility, config/schema stability, persisted data migrations, CLI/user-facing behavior, generated clients, and rollout fallback paths.",
323
- "Distinguish shipped compatibility obligations from in-branch implementation churn."
364
+ "**Role boundary:** feasibility realism only; do NOT redesign architecture unless feasibility is blocked."
324
365
  ].join("\n")
325
366
  },
326
367
  {
327
- name: "observability-reviewer",
328
- description: "PROACTIVE during design/review when diagnosis, telemetry, rollout visibility, or supportability could affect safe operation.",
368
+ name: "reviewer",
369
+ description: "MANDATORY during review. MUST BE USED to run a two-pass audit with explicit inline lens coverage for performance, compatibility, and observability.",
329
370
  tools: ["Read", "Grep", "Glob"],
330
371
  model: "balanced",
331
- activation: "proactive",
332
- relatedStages: ["design", "review"],
372
+ activation: "mandatory",
373
+ relatedStages: ["spec", "review", "ship"],
333
374
  returnSchema: REVIEW_RETURN_SCHEMA,
334
375
  body: [
335
- "You are an **observability review specialist**.",
376
+ "You are a **combined spec + code reviewer**.",
377
+ "",
378
+ "Run two explicit passes:",
336
379
  "",
337
- "Check logs, metrics, traces, alerts, debug handles, failure detection, and support handoff evidence for the changed paths.",
338
- "Report missing visibility as a ship risk only when it affects diagnosis or rollback."
380
+ "1. **Spec pass**",
381
+ " - For each acceptance criterion: PASS / PARTIAL / FAIL.",
382
+ " - Cite evidence as `file:line`.",
383
+ "",
384
+ "2. **Code-quality pass**",
385
+ " - Correctness: logic, boundaries, state transitions.",
386
+ " - Maintainability: naming, structure, complexity, debt risks.",
387
+ " - Performance: avoid obvious hot-path regressions.",
388
+ " - Architecture fit: layering and contract stability.",
389
+ "",
390
+ "## Lens Coverage",
391
+ "Performance: NO_IMPACT / FOUND_<n>",
392
+ "Compatibility: NO_IMPACT / FOUND_<n>",
393
+ "Observability: NO_IMPACT / FOUND_<n>",
394
+ "Security: routed to security-reviewer (always separate)",
395
+ "For unusually large/high-risk diffs, optional deep-dive context skills may be loaded: `review-perf-lens`, `review-compat-lens`, `review-observability-lens`.",
396
+ "",
397
+ "For each finding include:",
398
+ "- Severity: `Critical` | `Important` | `Suggestion`",
399
+ "- Location: `file:line`; if no line is possible, state the no-line reason",
400
+ "- Problem and concrete recommendation",
401
+ "",
402
+ "Also report files inspected, changed-file coverage, diagnostics run, dependency/version audit when relevant, and a no-finding attestation when no issues are found.",
403
+ "",
404
+ "**Trust model:** never rely on implementer claims; verify by reading code."
339
405
  ].join("\n")
340
406
  },
341
407
  {
@@ -364,6 +430,31 @@ export const CCLAW_AGENTS = [
364
430
  "- `NO_CHANGE_ATTESTATION` or `NO_SECURITY_IMPACT` with inspected surfaces when no security finding exists"
365
431
  ].join("\n")
366
432
  },
433
+ {
434
+ name: "integration-overseer",
435
+ description: "ON-DEMAND after TDD fan-out to verify cross-slice cohesion contract integrity, integration surfaces, and shared invariants before review handoff.",
436
+ tools: ["Read", "Grep", "Glob"],
437
+ model: "balanced",
438
+ activation: "on-demand",
439
+ relatedStages: ["tdd", "review"],
440
+ returnSchema: REVIEW_RETURN_SCHEMA,
441
+ body: [
442
+ "You are an **integration overseer** for TDD fan-out runs.",
443
+ "",
444
+ "You are dispatched after parallel `slice-implementer` lanes complete.",
445
+ "",
446
+ "Checks:",
447
+ "- every integration test named in `cohesion-contract.md` passes (or has explicit gap rationale)",
448
+ "- naming conventions remain consistent across slices",
449
+ "- shared invariants stay true after fan-in",
450
+ "- boundary types at touchpoints match the contract",
451
+ "- integration between slices is executable and regression-safe",
452
+ "",
453
+ "Return `PASS`, `PASS_WITH_GAPS`, `FAIL`, or `BLOCKED` with evidence refs and explicit integration risks.",
454
+ "",
455
+ "**Role boundary:** integration and cohesion oversight only; do NOT implement production code."
456
+ ].join("\n")
457
+ },
367
458
  {
368
459
  name: "test-author",
369
460
  description: "MANDATORY in TDD stage. MUST BE USED for RED -> GREEN -> REFACTOR with evidence-first discipline.",
@@ -431,6 +522,14 @@ export const CCLAW_AGENTS = [
431
522
  body: [
432
523
  "You are a **vertical-slice implementation worker**.",
433
524
  "",
525
+ "**Mode: TDD-bound** (default)",
526
+ "- Requires RED evidence before production edits.",
527
+ "- Requires explicit file boundaries and acceptance mapping from the slice contract.",
528
+ "",
529
+ "**Mode: Generic** (only when withTDD=false on quick-track)",
530
+ "- Allows bounded implementation without full RED/GREEN loop.",
531
+ "- Still requires explicit scope boundaries and verification evidence.",
532
+ "",
434
533
  "Rules:",
435
534
  "1. Start only from the assigned RED failure and acceptance mapping.",
436
535
  "2. Edit only the allowed files for the slice.",
@@ -440,26 +539,6 @@ export const CCLAW_AGENTS = [
440
539
  "**Role boundary:** do not broaden scope, do not review your own work as final approval, and do not spawn subagents."
441
540
  ].join("\n")
442
541
  },
443
- {
444
- name: "implementer",
445
- description: "ON-DEMAND worker for one scoped implementation slice. Use only with self-contained task text, explicit file boundaries, and verification expectations.",
446
- tools: ["Read", "Write", "Edit", "Grep", "Glob", "Bash"],
447
- model: "balanced",
448
- activation: "on-demand",
449
- relatedStages: ["tdd"],
450
- returnSchema: WORKER_RETURN_SCHEMA,
451
- body: [
452
- "You are an **implementation worker** for one bounded cclaw task.",
453
- "",
454
- "Rules:",
455
- "1. Treat the parent prompt as the full task boundary; do not infer hidden scope from plan files.",
456
- "2. Make the smallest coherent code change that satisfies the pasted acceptance criteria.",
457
- "3. Run the requested verification commands when feasible and report representative evidence.",
458
- "4. Return the strict worker JSON schema before prose.",
459
- "",
460
- "**Role boundary:** do not review your own work as final approval and do not spawn subagents."
461
- ].join("\n")
462
- },
463
542
  {
464
543
  name: "fixer",
465
544
  description: "ON-DEMAND fresh worker after review FAIL/PARTIAL evidence. Must fix only the cited criterion within explicit allowed files.",
@@ -482,10 +561,21 @@ export const CCLAW_AGENTS = [
482
561
  }
483
562
  ];
484
563
  import { stageDelegationSummary } from "./stage-schema.js";
485
- import { enhancedAgentBody } from "./subagents.js";
486
564
  /**
487
565
  * Render a complete cclaw agent markdown file (YAML frontmatter + body).
488
566
  */
567
+ function defaultTaskDelegationSection(agentName) {
568
+ return `
569
+
570
+ ## Task Tool Delegation
571
+
572
+ Use native Task/subagent delegation only when this agent's role requires isolated context or strict lifecycle evidence. Keep the delegation prompt self-contained and bounded to this agent's role.
573
+
574
+ ${agentName === "reviewer"
575
+ ? "- For large/high-risk diffs, load optional deep lens skills (`review-perf-lens`, `review-compat-lens`, `review-observability-lens`) before final verdict."
576
+ : "_No extra agent-specific delegation template is required._"}
577
+ `;
578
+ }
489
579
  export function agentMarkdown(agent) {
490
580
  const frontmatter = [
491
581
  "---",
@@ -496,7 +586,7 @@ export function agentMarkdown(agent) {
496
586
  "---"
497
587
  ].join("\n");
498
588
  const relatedStages = agent.relatedStages.length > 0 ? agent.relatedStages.join(", ") : "(none)";
499
- const taskDelegation = enhancedAgentBody(agent.name);
589
+ const taskDelegation = defaultTaskDelegationSection(agent.name);
500
590
  return `${frontmatter}
501
591
 
502
592
  # ${agent.name}
@@ -555,8 +645,8 @@ export function agentRoutingTable() {
555
645
  export function agentCostTierTable() {
556
646
  return `| Tier | Use for | Example agents |
557
647
  |---|---|---|
558
- | \`deep\` | one heavy planning/strategy pass per stage | planner, product-strategist |
559
- | \`balanced\` | discovery, criticism, review, TDD, and bounded worker execution | product-manager, critic, spec-document-reviewer, reviewer, security-reviewer, test-author, implementer, fixer |
648
+ | \`deep\` | one heavy planning/strategy pass per stage | planner, product-discovery |
649
+ | \`balanced\` | discovery, criticism, review, TDD, and bounded worker execution | critic, spec-document-reviewer, coherence-reviewer, scope-guardian-reviewer, feasibility-reviewer, reviewer, security-reviewer, test-author, slice-implementer, fixer |
560
650
  | \`fast\` | bounded maintenance updates with limited blast radius | doc-updater |
561
651
  `;
562
652
  }
@@ -599,7 +689,7 @@ ${(() => {
599
689
  const mode = activationModeSummary();
600
690
  return `- **Mandatory:** ${mode.mandatory}.
601
691
  - **Proactive:** ${mode.proactive}.
602
- - **On-demand:** slice-implementer, implementer, fixer. Research playbooks are in-thread procedures.`;
692
+ - **On-demand:** slice-implementer, fixer. Research playbooks are in-thread procedures.`;
603
693
  })()}
604
694
 
605
695
  ### Cost-aware routing
@@ -37,7 +37,7 @@ Never mutate state from \`/cc-view diff\`. It is a read-only inspection command.
37
37
  - The command must not create or update any \`.cclaw/state/*.snapshot*\` file.
38
38
  - Do not suppress removed values; removals are first-class evidence.
39
39
  - Closeout diff lines must use the same \`shipSubstate\` vocabulary as the
40
- state machine (\`idle\` / \`retro_review\` / \`compound_review\` /
40
+ state machine (\`idle\` / \`post_ship_review\` /
41
41
  \`ready_to_archive\` / \`archived\`).
42
42
  `;
43
43
  }
@@ -9,6 +9,3 @@ export declare function stageFullArtifactExampleMarkdown(stage: FlowStage): stri
9
9
  * Returns short inline shape cues rendered directly inside the stage skill.
10
10
  */
11
11
  export declare function stageExamples(stage: FlowStage): string;
12
- export type ExampleDomain = "web" | "cli" | "library" | "data-pipeline";
13
- export declare const RESEARCH_FLEET_USAGE_EXAMPLE: string;
14
- export declare function stageDomainExamples(stage: FlowStage): string;