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,12 +6,25 @@ import { conversationLanguagePolicyMarkdown } from "./language-policy.js";
|
|
|
6
6
|
* execute orchestration logic at install time beyond string assembly.
|
|
7
7
|
*/
|
|
8
8
|
const SUBAGENT_AGENT_NAMES = [
|
|
9
|
+
"researcher",
|
|
10
|
+
"architect",
|
|
11
|
+
"spec-validator",
|
|
12
|
+
"slice-implementer",
|
|
13
|
+
"performance-reviewer",
|
|
14
|
+
"compatibility-reviewer",
|
|
15
|
+
"observability-reviewer",
|
|
16
|
+
"release-reviewer",
|
|
9
17
|
"planner",
|
|
18
|
+
"product-manager",
|
|
19
|
+
"critic",
|
|
10
20
|
"reviewer",
|
|
11
21
|
"security-reviewer",
|
|
12
22
|
"test-author",
|
|
13
|
-
"doc-updater"
|
|
23
|
+
"doc-updater",
|
|
24
|
+
"implementer",
|
|
25
|
+
"fixer"
|
|
14
26
|
];
|
|
27
|
+
const MARKDOWN_CODE_FENCE = "```";
|
|
15
28
|
function formatAgentList(agents) {
|
|
16
29
|
return agents.length > 0 ? agents.join(", ") : "none";
|
|
17
30
|
}
|
|
@@ -26,7 +39,7 @@ ${rows}`;
|
|
|
26
39
|
}
|
|
27
40
|
function stageSummary(stage) {
|
|
28
41
|
return stageDelegationSummary("standard").find((row) => row.stage === stage)
|
|
29
|
-
?? { stage, mandatoryAgents: [], proactiveAgents: [], primaryAgents: [], stackAwareRoutes: [] };
|
|
42
|
+
?? { stage, mandatoryAgents: [], proactiveAgents: [], primaryAgents: [], dispatchRules: [], stackAwareRoutes: [] };
|
|
30
43
|
}
|
|
31
44
|
export function subagentDrivenDevSkill() {
|
|
32
45
|
return `---
|
|
@@ -38,11 +51,11 @@ description: "Orchestrate implementation via isolated subagents — one fresh ag
|
|
|
38
51
|
|
|
39
52
|
## Overview
|
|
40
53
|
|
|
41
|
-
Use a **controller
|
|
54
|
+
Use a **controller -> coder -> overseer** loop when building multi-step software work.
|
|
42
55
|
|
|
43
56
|
- **Controller (parent agent):** owns the plan, gating, sequencing, and dispatch decisions; never mixes deep implementation context with review evidence.
|
|
44
|
-
- **
|
|
45
|
-
- **
|
|
57
|
+
- **Coder / slice-implementer (subagent):** receives a **single self-contained task** and edits code only within that scope; exits with a structured status contract.
|
|
58
|
+
- **Overseer / reviewer (subagent):** validates outputs against the specification **by reading code** and never edits during the overseer pass.
|
|
46
59
|
|
|
47
60
|
This pattern is intentionally **Superpowers-style**: cheap parallelism where it doesn’t corrupt state, strict serialization where it would.
|
|
48
61
|
|
|
@@ -130,9 +143,9 @@ Concrete per-stage rules so the controller does not have to guess which tier fit
|
|
|
130
143
|
|
|
131
144
|
| Stage | Deep slot | Balanced slot(s) | Fast fan-out | Trigger to escalate |
|
|
132
145
|
|---|---|---|---|---|
|
|
133
|
-
| brainstorm | planner (only if ambiguity spans >1 module) |
|
|
134
|
-
| scope | planner (always) |
|
|
135
|
-
| design | planner (always) | security-reviewer
|
|
146
|
+
| brainstorm | planner (only if ambiguity spans >1 module) | product-manager / critic when product value or premise is uncertain | run in-thread research playbooks | promote to \`balanced\` critic if the do-nothing path may beat the idea |
|
|
147
|
+
| scope | planner (always) | product-manager / critic when mode changes user value or boundaries are soft | run \`research/git-history.md\` in-thread when churn is high | promote to \`balanced\` critic if scope mode is disputed |
|
|
148
|
+
| design | planner (always) | critic, security-reviewer, test-author when alternatives/trust/testability apply | run \`research/framework-docs-lookup.md\` + \`research/best-practices-lookup.md\` in-thread | escalate one specialist to \`deep\` only if a failure mode is Critical-severity |
|
|
136
149
|
| spec | — | reviewer (if spec > 200 lines or multiple ACs) | — | escalate to \`deep\` only for spec ↔ design contradictions |
|
|
137
150
|
| plan | planner (solo, always) | — | — | never fan out at plan stage; one owner for dependency graph |
|
|
138
151
|
| tdd | — | ${formatAgentList(stageSummary("tdd").primaryAgents)} (per slice, carrying RED/GREEN/REFACTOR evidence) · reviewer (slice-local only when sliceReview triggers) | doc-updater (API surface changes) | escalate to \`deep\` only when a RED test cannot be expressed (design leak) |
|
|
@@ -196,9 +209,43 @@ Borrow the good part of Team/Ruflo-style orchestration without adding a swarm ru
|
|
|
196
209
|
| NEEDS_CONTEXT | Missing authoritative information only the parent/user can supply | Parent gathers context, then re-dispatch implementer with augmented prompt |
|
|
197
210
|
| BLOCKED | Hard stop (permissions, tool failure, conflicting requirements, unsafe state) | Parent escalates to user; do not stack speculative guesses |
|
|
198
211
|
|
|
212
|
+
## Strict Worker Return Schemas
|
|
213
|
+
|
|
214
|
+
Every delegated worker must return one terminal status and the listed evidence fields. Prefer JSON fenced as \`json\`; prose may follow only after the object.
|
|
215
|
+
|
|
216
|
+
### Implementer / fixer return
|
|
217
|
+
|
|
218
|
+
${MARKDOWN_CODE_FENCE}json
|
|
219
|
+
{
|
|
220
|
+
"status": "DONE|DONE_WITH_CONCERNS|NEEDS_CONTEXT|BLOCKED",
|
|
221
|
+
"filesChanged": ["path"],
|
|
222
|
+
"testsRun": [{ "command": "string", "result": "PASS|FAIL|NOT_RUN", "evidence": "short excerpt or reason" }],
|
|
223
|
+
"evidenceRefs": [".cclaw/artifacts/<file>#anchor"],
|
|
224
|
+
"concerns": ["string"],
|
|
225
|
+
"needsContext": ["string"],
|
|
226
|
+
"blockers": ["string"]
|
|
227
|
+
}
|
|
228
|
+
${MARKDOWN_CODE_FENCE}
|
|
229
|
+
|
|
230
|
+
### Reviewer return
|
|
231
|
+
|
|
232
|
+
${MARKDOWN_CODE_FENCE}json
|
|
233
|
+
{
|
|
234
|
+
"status": "PASS|PASS_WITH_GAPS|FAIL|BLOCKED",
|
|
235
|
+
"findings": [{ "severity": "Critical|Important|Suggestion", "location": "file:line", "problem": "string", "recommendation": "string" }],
|
|
236
|
+
"criteria": [{ "id": "string", "verdict": "PASS|PARTIAL|FAIL", "evidence": "file:line" }],
|
|
237
|
+
"evidenceRefs": [".cclaw/artifacts/<file>#anchor"],
|
|
238
|
+
"blockers": ["string"]
|
|
239
|
+
}
|
|
240
|
+
${MARKDOWN_CODE_FENCE}
|
|
241
|
+
|
|
242
|
+
### Lifecycle evidence
|
|
243
|
+
|
|
244
|
+
Before dispatch, create or reserve a delegation span (\`status: "scheduled"\`, \`spanId\`, \`startTs\`, optional \`taskId\`). On return, append a terminal row for the same \`spanId\` with \`endTs\`, \`status\`, \`fulfillmentMode\`, and non-empty \`evidenceRefs\` whenever the worker was generic-dispatch or role-switch. A scheduled span without a terminal row in the current run is stale and must be resolved before claiming the stage is complete.
|
|
245
|
+
|
|
199
246
|
## Implementer Prompt Template (paste into Task tool)
|
|
200
247
|
|
|
201
|
-
|
|
248
|
+
${MARKDOWN_CODE_FENCE}
|
|
202
249
|
You are implementing a single task from a development plan.
|
|
203
250
|
|
|
204
251
|
TASK: {paste full task text here}
|
|
@@ -207,15 +254,15 @@ CONSTRAINTS: {paste from spec — what NOT to do}
|
|
|
207
254
|
|
|
208
255
|
After implementation:
|
|
209
256
|
0. Write user-facing narrative in the parent/user language; keep status tokens unchanged.
|
|
210
|
-
1. Run the
|
|
211
|
-
2.
|
|
212
|
-
3. If DONE_WITH_CONCERNS, list each concern
|
|
213
|
-
4. If NEEDS_CONTEXT, specify exactly what you need
|
|
214
|
-
|
|
257
|
+
1. Run the relevant test suite or explain why it was not run.
|
|
258
|
+
2. Return the strict implementer/fixer JSON schema first.
|
|
259
|
+
3. If DONE_WITH_CONCERNS, list each concern in \`concerns\`.
|
|
260
|
+
4. If NEEDS_CONTEXT, specify exactly what you need in \`needsContext\`.
|
|
261
|
+
${MARKDOWN_CODE_FENCE}
|
|
215
262
|
|
|
216
263
|
## Spec-Reviewer Prompt Template (paste into Task tool)
|
|
217
264
|
|
|
218
|
-
|
|
265
|
+
${MARKDOWN_CODE_FENCE}
|
|
219
266
|
Review the implementation against the specification.
|
|
220
267
|
|
|
221
268
|
SPEC CRITERIA: {paste acceptance criteria}
|
|
@@ -223,7 +270,7 @@ FILES CHANGED: {list files}
|
|
|
223
270
|
|
|
224
271
|
For each criterion: PASS / FAIL / PARTIAL with evidence (file:line).
|
|
225
272
|
Do NOT trust the implementer's self-report — read the actual code.
|
|
226
|
-
|
|
273
|
+
${MARKDOWN_CODE_FENCE}
|
|
227
274
|
|
|
228
275
|
## Anti-patterns
|
|
229
276
|
|
|
@@ -271,7 +318,7 @@ Do NOT trust the implementer's self-report — read the actual code.
|
|
|
271
318
|
|
|
272
319
|
## Code-Quality Reviewer Prompt Template (paste into Task tool)
|
|
273
320
|
|
|
274
|
-
|
|
321
|
+
${MARKDOWN_CODE_FENCE}
|
|
275
322
|
You are a code-quality reviewer (subagent) after a single SDD task.
|
|
276
323
|
|
|
277
324
|
SCOPE: {files touched by this task}
|
|
@@ -286,11 +333,11 @@ Review for maintainability and ship hygiene across:
|
|
|
286
333
|
Output:
|
|
287
334
|
- FINDINGS: severity, file:line, issue, recommendation
|
|
288
335
|
- VERDICT: APPROVE | APPROVE_WITH_NITS | REWORK_REQUIRED
|
|
289
|
-
|
|
336
|
+
${MARKDOWN_CODE_FENCE}
|
|
290
337
|
|
|
291
338
|
## Fixer Subagent Prompt Template (after spec review FAIL)
|
|
292
339
|
|
|
293
|
-
|
|
340
|
+
${MARKDOWN_CODE_FENCE}
|
|
294
341
|
You are a fixer subagent. You are NOT the original implementer.
|
|
295
342
|
|
|
296
343
|
FAILING CRITERION (verbatim): {paste failed criterion}
|
|
@@ -303,11 +350,11 @@ Process:
|
|
|
303
350
|
2) Implement the smallest fix that satisfies the criterion.
|
|
304
351
|
3) Run the full test suite.
|
|
305
352
|
4) Report STATUS: DONE / DONE_WITH_CONCERNS / NEEDS_CONTEXT / BLOCKED with evidence excerpts.
|
|
306
|
-
|
|
353
|
+
${MARKDOWN_CODE_FENCE}
|
|
307
354
|
|
|
308
355
|
## Final Code Reviewer Prompt Template (post-queue sweep)
|
|
309
356
|
|
|
310
|
-
|
|
357
|
+
${MARKDOWN_CODE_FENCE}
|
|
311
358
|
You are the final code-quality reviewer after ALL SDD tasks completed.
|
|
312
359
|
|
|
313
360
|
ENTIRE CHANGESET: {summary + primary entrypoints}
|
|
@@ -321,7 +368,7 @@ Deliver:
|
|
|
321
368
|
- TOP_FINDINGS (merge blockers first)
|
|
322
369
|
- CONSISTENCY_PASS/FAIL with rationale
|
|
323
370
|
- SHIP_RECOMMENDATION: SHIP | SHIP_WITH_FOLLOWUPS | NO_SHIP
|
|
324
|
-
|
|
371
|
+
${MARKDOWN_CODE_FENCE}
|
|
325
372
|
|
|
326
373
|
## Glossary
|
|
327
374
|
|
|
@@ -398,7 +445,7 @@ Implementation that touches shared source trees must remain **sequential** unles
|
|
|
398
445
|
|
|
399
446
|
Write a structured reconciliation artifact at \`.cclaw/artifacts/07-review-army.json\` using this schema:
|
|
400
447
|
|
|
401
|
-
|
|
448
|
+
${MARKDOWN_CODE_FENCE}json
|
|
402
449
|
{
|
|
403
450
|
"version": 1,
|
|
404
451
|
"generatedAt": "ISO timestamp",
|
|
@@ -422,7 +469,7 @@ Write a structured reconciliation artifact at \`.cclaw/artifacts/07-review-army.
|
|
|
422
469
|
"shipBlockers": []
|
|
423
470
|
}
|
|
424
471
|
}
|
|
425
|
-
|
|
472
|
+
${MARKDOWN_CODE_FENCE}
|
|
426
473
|
|
|
427
474
|
Contract rules:
|
|
428
475
|
- \`id\` and \`fingerprint\` must be stable between reruns if the finding is unchanged.
|
|
@@ -504,7 +551,7 @@ Contract rules:
|
|
|
504
551
|
|
|
505
552
|
## Parallel Review Task Template (paste into Task tool)
|
|
506
553
|
|
|
507
|
-
|
|
554
|
+
${MARKDOWN_CODE_FENCE}
|
|
508
555
|
You are an independent review/investigation subagent.
|
|
509
556
|
|
|
510
557
|
LENS: {security|data|perf|api|ux|observability — pick one}
|
|
@@ -516,7 +563,7 @@ Rules:
|
|
|
516
563
|
- Do not edit files unless explicitly authorized in this prompt.
|
|
517
564
|
- Cite evidence as file:line for every finding.
|
|
518
565
|
- If uncertain, emit CONFIDENCE <= 4 and label as hypothesis.
|
|
519
|
-
|
|
566
|
+
${MARKDOWN_CODE_FENCE}
|
|
520
567
|
|
|
521
568
|
## Worked Example (narrative)
|
|
522
569
|
|
|
@@ -527,6 +574,137 @@ A large refactor touches **auth middleware** and **repository queries**. The con
|
|
|
527
574
|
- Parallel agents produce **evidence and prioritized tasks**.
|
|
528
575
|
- SDD **implements** those tasks **one at a time** with sequential implementers.
|
|
529
576
|
- Never parallelize **writers** on the same codebase; parallelize **readers/analysts** with disjoint scopes.
|
|
577
|
+
`;
|
|
578
|
+
}
|
|
579
|
+
function researcherEnhancedBody() {
|
|
580
|
+
return `
|
|
581
|
+
|
|
582
|
+
## Task Tool Delegation
|
|
583
|
+
|
|
584
|
+
Use this payload when a stage needs context-readiness or search-before-read evidence:
|
|
585
|
+
|
|
586
|
+
${MARKDOWN_CODE_FENCE}
|
|
587
|
+
You are a researcher subagent.
|
|
588
|
+
|
|
589
|
+
QUESTION: {one falsifiable research question}
|
|
590
|
+
SCOPE: {repo paths, docs, references, providers to inspect}
|
|
591
|
+
CONTEXT READINESS: {graph/search/provider status if known}
|
|
592
|
+
|
|
593
|
+
Required output:
|
|
594
|
+
- SEARCH_SUMMARY: queries/patterns/providers tried before large reads
|
|
595
|
+
- FACTS: evidence-backed findings with refs
|
|
596
|
+
- STALE_OR_MISSING_CONTEXT: gaps and recommended recovery
|
|
597
|
+
- DECISION_IMPACT: what stage decision this changes
|
|
598
|
+
${MARKDOWN_CODE_FENCE}
|
|
599
|
+
|
|
600
|
+
`;
|
|
601
|
+
}
|
|
602
|
+
function architectEnhancedBody() {
|
|
603
|
+
return `
|
|
604
|
+
|
|
605
|
+
## Task Tool Delegation
|
|
606
|
+
|
|
607
|
+
${MARKDOWN_CODE_FENCE}
|
|
608
|
+
You are an architect subagent.
|
|
609
|
+
|
|
610
|
+
DESIGN_DECISION: {architecture decision to validate}
|
|
611
|
+
SCOPE_CONTRACT: {approved boundaries}
|
|
612
|
+
BLAST_RADIUS: {paths/modules/interfaces}
|
|
613
|
+
|
|
614
|
+
Required output:
|
|
615
|
+
- BOUNDARIES: chosen ownership and interface contracts
|
|
616
|
+
- ALTERNATIVES: rejected alternatives and revival signals
|
|
617
|
+
- FAILURE_MODES: method/exception/rescue/user-visible impact
|
|
618
|
+
- SPEC_HANDOFF: requirements and verification evidence downstream spec must carry
|
|
619
|
+
${MARKDOWN_CODE_FENCE}
|
|
620
|
+
|
|
621
|
+
`;
|
|
622
|
+
}
|
|
623
|
+
function specValidatorEnhancedBody() {
|
|
624
|
+
return `
|
|
625
|
+
|
|
626
|
+
## Task Tool Delegation
|
|
627
|
+
|
|
628
|
+
${MARKDOWN_CODE_FENCE}
|
|
629
|
+
You are a spec-validator subagent.
|
|
630
|
+
|
|
631
|
+
ACCEPTANCE_CRITERIA: {criteria to validate}
|
|
632
|
+
UPSTREAM_DECISIONS: {design/scope refs}
|
|
633
|
+
|
|
634
|
+
Required output:
|
|
635
|
+
- CRITERIA_AUDIT: PASS/PARTIAL/FAIL per AC with reason
|
|
636
|
+
- EDGE_CASE_GAPS: boundary/error cases missing
|
|
637
|
+
- ASSUMPTION_GAPS: assumptions requiring approval or rewrite
|
|
638
|
+
- TESTABILITY_MAP: concrete test level and command/manual evidence per AC
|
|
639
|
+
${MARKDOWN_CODE_FENCE}
|
|
640
|
+
|
|
641
|
+
`;
|
|
642
|
+
}
|
|
643
|
+
function sliceImplementerEnhancedBody() {
|
|
644
|
+
return `
|
|
645
|
+
|
|
646
|
+
## Task Tool Delegation
|
|
647
|
+
|
|
648
|
+
${MARKDOWN_CODE_FENCE}
|
|
649
|
+
You are a slice-implementer subagent.
|
|
650
|
+
|
|
651
|
+
SLICE: {single vertical slice}
|
|
652
|
+
RED_EVIDENCE: {failing test and expected failure}
|
|
653
|
+
ALLOWED_FILES: {explicit file boundaries}
|
|
654
|
+
FORBIDDEN_CHANGES: {scope/compatibility limits}
|
|
655
|
+
VERIFICATION: {commands expected}
|
|
656
|
+
|
|
657
|
+
Rules:
|
|
658
|
+
- Implement only the minimal GREEN change for the existing RED evidence.
|
|
659
|
+
- Keep REFACTOR behavior-preserving.
|
|
660
|
+
- Return the strict worker JSON schema first.
|
|
661
|
+
${MARKDOWN_CODE_FENCE}
|
|
662
|
+
|
|
663
|
+
`;
|
|
664
|
+
}
|
|
665
|
+
function performanceReviewerEnhancedBody() {
|
|
666
|
+
return `${codeReviewerEnhancedBody()}
|
|
667
|
+
|
|
668
|
+
## Performance Lens
|
|
669
|
+
|
|
670
|
+
Focus on hot paths, IO/network calls, repeated work, caching, data volume, rendering, and algorithmic complexity. Include measurement evidence or a concrete measurement plan for every non-trivial finding.
|
|
671
|
+
`;
|
|
672
|
+
}
|
|
673
|
+
function compatibilityReviewerEnhancedBody() {
|
|
674
|
+
return `${codeReviewerEnhancedBody()}
|
|
675
|
+
|
|
676
|
+
## Compatibility Lens
|
|
677
|
+
|
|
678
|
+
Focus on public APIs, CLI/config shape, persisted data, migrations, generated clients, dependency/runtime versions, and backwards-compatibility obligations. Distinguish shipped behavior from in-branch churn.
|
|
679
|
+
`;
|
|
680
|
+
}
|
|
681
|
+
function observabilityReviewerEnhancedBody() {
|
|
682
|
+
return `${codeReviewerEnhancedBody()}
|
|
683
|
+
|
|
684
|
+
## Observability Lens
|
|
685
|
+
|
|
686
|
+
Focus on logs, metrics, traces, alerts, debug paths, rollout visibility, and support handoff. Block only when missing visibility affects diagnosis, rollback, or user/data safety.
|
|
687
|
+
`;
|
|
688
|
+
}
|
|
689
|
+
function releaseReviewerEnhancedBody() {
|
|
690
|
+
return `
|
|
691
|
+
|
|
692
|
+
## Task Tool Delegation
|
|
693
|
+
|
|
694
|
+
${MARKDOWN_CODE_FENCE}
|
|
695
|
+
You are a release-reviewer subagent.
|
|
696
|
+
|
|
697
|
+
SHIP_ARTIFACT: {ship/preflight evidence}
|
|
698
|
+
REVIEW_VERDICT: {review status and blockers}
|
|
699
|
+
FINALIZATION_MODE: {selected enum}
|
|
700
|
+
|
|
701
|
+
Required output:
|
|
702
|
+
- PREFLIGHT: commands and PASS/FAIL evidence freshness
|
|
703
|
+
- VICTORY_DETECTOR: feature coverage, evaluator evidence, clean state, learnings, handoff
|
|
704
|
+
- ROLLBACK: trigger, steps, owner, and no-VCS handoff if applicable
|
|
705
|
+
- SHIP_VERDICT: SHIP | SHIP_WITH_CONCERNS | BLOCKED
|
|
706
|
+
${MARKDOWN_CODE_FENCE}
|
|
707
|
+
|
|
530
708
|
`;
|
|
531
709
|
}
|
|
532
710
|
function plannerEnhancedBody() {
|
|
@@ -538,7 +716,7 @@ When a planning problem is too broad for one message, delegate **planning subtas
|
|
|
538
716
|
|
|
539
717
|
Paste the template below verbatim and fill \`{placeholders}\` in the parent before dispatching.
|
|
540
718
|
|
|
541
|
-
|
|
719
|
+
${MARKDOWN_CODE_FENCE}
|
|
542
720
|
You are a planning subagent for a larger Cclaw / engineering workflow.
|
|
543
721
|
|
|
544
722
|
PLANNING GOAL: {one sentence outcome — e.g., sequencing, risk register, dependency graph}
|
|
@@ -551,7 +729,7 @@ Rules:
|
|
|
551
729
|
- Every task must include acceptance criteria copy-paste ready for SDD implementers.
|
|
552
730
|
- Flag UNKNOWN explicitly instead of guessing.
|
|
553
731
|
- Close with: OPEN_QUESTIONS: ... and NEXT_TASK_TEXT: ... (verbatim extractable queue item)
|
|
554
|
-
|
|
732
|
+
${MARKDOWN_CODE_FENCE}
|
|
555
733
|
|
|
556
734
|
`;
|
|
557
735
|
}
|
|
@@ -562,7 +740,7 @@ function specReviewerEnhancedBody() {
|
|
|
562
740
|
|
|
563
741
|
For review audits, use the Task tool with the following **reviewer** payload (fill placeholders in the parent session).
|
|
564
742
|
|
|
565
|
-
|
|
743
|
+
${MARKDOWN_CODE_FENCE}
|
|
566
744
|
You are a specification compliance reviewer (subagent).
|
|
567
745
|
|
|
568
746
|
SPEC CRITERIA (verbatim): {acceptance criteria / invariants / non-goals}
|
|
@@ -573,7 +751,7 @@ Instructions:
|
|
|
573
751
|
- For EACH criterion emit PASS / PARTIAL / FAIL with evidence as file:line.
|
|
574
752
|
- Read the code; ignore implementer claims unless backed by code citations.
|
|
575
753
|
- Close with SPEC_VERDICT: PASS | PASS_WITH_GAPS | FAIL plus GAPS/FAIL list.
|
|
576
|
-
|
|
754
|
+
${MARKDOWN_CODE_FENCE}
|
|
577
755
|
|
|
578
756
|
`;
|
|
579
757
|
}
|
|
@@ -584,7 +762,7 @@ function codeReviewerEnhancedBody() {
|
|
|
584
762
|
|
|
585
763
|
Launch deep **code-quality** reviews using this five-axis template in the Task tool body:
|
|
586
764
|
|
|
587
|
-
|
|
765
|
+
${MARKDOWN_CODE_FENCE}
|
|
588
766
|
You are a code-quality reviewer (subagent). Review along ALL axes:
|
|
589
767
|
|
|
590
768
|
1) Correctness — logic, data flow, error handling, boundary conditions
|
|
@@ -599,7 +777,57 @@ BASELINE CONTEXT: {tests, deployment constraints, compatibility promises}
|
|
|
599
777
|
Output format (mandatory):
|
|
600
778
|
- FINDING: [Critical|Important|Suggestion] file:line — problem — recommendation
|
|
601
779
|
- Close with RISK_SUMMARY and SHIP_BLOCKERS (explicit list, possibly empty).
|
|
602
|
-
|
|
780
|
+
${MARKDOWN_CODE_FENCE}
|
|
781
|
+
|
|
782
|
+
`;
|
|
783
|
+
}
|
|
784
|
+
function productManagerEnhancedBody() {
|
|
785
|
+
return `
|
|
786
|
+
|
|
787
|
+
## Task Tool Delegation
|
|
788
|
+
|
|
789
|
+
Use this payload when product discovery needs an isolated lens:
|
|
790
|
+
|
|
791
|
+
${MARKDOWN_CODE_FENCE}
|
|
792
|
+
You are a product-manager subagent.
|
|
793
|
+
|
|
794
|
+
DISCOVERY GOAL: {problem/value decision to clarify}
|
|
795
|
+
CONTEXT: {existing artifact excerpts, user segment, constraints}
|
|
796
|
+
DEPTH: {lite|standard|deep}
|
|
797
|
+
|
|
798
|
+
Required output:
|
|
799
|
+
- PERSONA_JTBD: persona, job, pain/trigger
|
|
800
|
+
- VALUE_HYPOTHESIS: expected value and success metric
|
|
801
|
+
- EVIDENCE_SIGNAL: strongest evidence, weakest assumption
|
|
802
|
+
- WHY_NOW_AND_DO_NOTHING: why now plus consequence of no action
|
|
803
|
+
- NON_GOALS: explicit exclusions
|
|
804
|
+
- SCOPE_HANDOFF: one recommendation for hold/selective/expand/reduce
|
|
805
|
+
${MARKDOWN_CODE_FENCE}
|
|
806
|
+
|
|
807
|
+
`;
|
|
808
|
+
}
|
|
809
|
+
function criticEnhancedBody() {
|
|
810
|
+
return `
|
|
811
|
+
|
|
812
|
+
## Task Tool Delegation
|
|
813
|
+
|
|
814
|
+
Use this payload when a premise, scope mode, or engineering path needs adversarial pressure:
|
|
815
|
+
|
|
816
|
+
${MARKDOWN_CODE_FENCE}
|
|
817
|
+
You are a critic subagent.
|
|
818
|
+
|
|
819
|
+
DECISION_UNDER_REVIEW: {direction/scope/design choice}
|
|
820
|
+
CONTEXT: {artifact excerpts, constraints, known risks}
|
|
821
|
+
DEPTH: {lite|standard|deep}
|
|
822
|
+
|
|
823
|
+
Required output:
|
|
824
|
+
- PREMISE_ATTACK: what could make this decision wrong
|
|
825
|
+
- CHEAPER_ALTERNATIVE: smaller or more reversible option
|
|
826
|
+
- SHADOW_ALTERNATIVE: viable competing path
|
|
827
|
+
- SWITCH_TRIGGER: signal that should change the decision
|
|
828
|
+
- FAILURE_RESCUE: likely failure and rescue/degraded behavior
|
|
829
|
+
- VERIFICATION_EVIDENCE: evidence needed before locking
|
|
830
|
+
${MARKDOWN_CODE_FENCE}
|
|
603
831
|
|
|
604
832
|
`;
|
|
605
833
|
}
|
|
@@ -613,7 +841,7 @@ function securityReviewerEnhancedBody() {
|
|
|
613
841
|
|
|
614
842
|
Use a dedicated Task tool invocation for CWE-focused review with reproducible narratives:
|
|
615
843
|
|
|
616
|
-
|
|
844
|
+
${MARKDOWN_CODE_FENCE}
|
|
617
845
|
You are a security reviewer (subagent). Perform a CWE-oriented review of the scoped change.
|
|
618
846
|
|
|
619
847
|
SCOPE: {files/commits/services touched}
|
|
@@ -625,7 +853,7 @@ Requirements:
|
|
|
625
853
|
- Include a short proof-of-concept attack vector (conceptual, no weaponization).
|
|
626
854
|
- Recommend concrete controls (validation, sandboxing, authz checks, safer APIs).
|
|
627
855
|
- Close with SECURITY_VERDICT: SHIP | SHIP_WITH_HOTFIXES | NO_SHIP and cite top 3 drivers.
|
|
628
|
-
|
|
856
|
+
${MARKDOWN_CODE_FENCE}
|
|
629
857
|
|
|
630
858
|
`;
|
|
631
859
|
}
|
|
@@ -639,7 +867,7 @@ This agent runs in two explicit stage modes to respect cclaw hard-gates:
|
|
|
639
867
|
- \`TEST_RED_ONLY\` (only failing tests + evidence; no production edits)
|
|
640
868
|
- \`BUILD_GREEN_REFACTOR\` (implementation + full-suite green + refactor notes)
|
|
641
869
|
|
|
642
|
-
|
|
870
|
+
${MARKDOWN_CODE_FENCE}
|
|
643
871
|
You are a TDD implementer subagent.
|
|
644
872
|
|
|
645
873
|
STAGE_MODE: {TEST_RED_ONLY | BUILD_GREEN_REFACTOR}
|
|
@@ -656,6 +884,52 @@ Process (mandatory):
|
|
|
656
884
|
- GREEN — minimal production code to satisfy existing RED tests, rerun full suite.
|
|
657
885
|
- REFACTOR — only after full suite is green; preserve behavior.
|
|
658
886
|
- Report: FILES_EDITED, GREEN_COMMAND_RUN, REFACTOR_NOTES, STATUS: DONE|BLOCKED.
|
|
887
|
+
${MARKDOWN_CODE_FENCE}
|
|
888
|
+
|
|
889
|
+
`;
|
|
890
|
+
}
|
|
891
|
+
function implementerEnhancedBody() {
|
|
892
|
+
return `
|
|
893
|
+
|
|
894
|
+
## Task Tool Delegation
|
|
895
|
+
|
|
896
|
+
You are the default sequential implementation worker for one scoped task. Do not expand scope silently.
|
|
897
|
+
|
|
898
|
+
\`\`\`
|
|
899
|
+
You are an implementer subagent.
|
|
900
|
+
|
|
901
|
+
TASK: {single task with acceptance criteria pasted in full}
|
|
902
|
+
ALLOWED FILES / MODULES: {explicit boundaries}
|
|
903
|
+
FORBIDDEN CHANGES: {out-of-scope behavior, compatibility constraints}
|
|
904
|
+
VERIFICATION: {commands expected, or explain if unavailable}
|
|
905
|
+
|
|
906
|
+
Rules:
|
|
907
|
+
- Implement the smallest code change that satisfies the task.
|
|
908
|
+
- Do not spawn subagents.
|
|
909
|
+
- Return the strict implementer JSON schema first.
|
|
910
|
+
\`\`\`
|
|
911
|
+
|
|
912
|
+
`;
|
|
913
|
+
}
|
|
914
|
+
function fixerEnhancedBody() {
|
|
915
|
+
return `
|
|
916
|
+
|
|
917
|
+
## Task Tool Delegation
|
|
918
|
+
|
|
919
|
+
Fixers are fresh workers dispatched only after a reviewer identifies a concrete failing criterion.
|
|
920
|
+
|
|
921
|
+
\`\`\`
|
|
922
|
+
You are a fixer subagent. You are NOT the original implementer.
|
|
923
|
+
|
|
924
|
+
FAILING CRITERION: {verbatim criterion}
|
|
925
|
+
REVIEW EVIDENCE: {file:line citations and short quotes}
|
|
926
|
+
ALLOWED FILES: {explicit list}
|
|
927
|
+
FORBIDDEN CHANGES: {scope and compatibility constraints}
|
|
928
|
+
|
|
929
|
+
Rules:
|
|
930
|
+
- Reproduce or reason from the cited failure before editing.
|
|
931
|
+
- Apply the smallest fix that closes the cited gap.
|
|
932
|
+
- Return the strict fixer JSON schema first.
|
|
659
933
|
\`\`\`
|
|
660
934
|
|
|
661
935
|
`;
|
|
@@ -667,7 +941,7 @@ function docUpdaterEnhancedBody() {
|
|
|
667
941
|
|
|
668
942
|
For documentation parallelism, still avoid conflicting writes — partition by artifact:
|
|
669
943
|
|
|
670
|
-
|
|
944
|
+
${MARKDOWN_CODE_FENCE}
|
|
671
945
|
You are a documentation updater subagent.
|
|
672
946
|
|
|
673
947
|
DOCS SCOPE: {README|API ref|runbook|changelog section}
|
|
@@ -677,7 +951,7 @@ Tasks:
|
|
|
677
951
|
- Diff mental model vs reality; update only stale sections.
|
|
678
952
|
- Preserve tone/structure; no doc rewrite for its own sake.
|
|
679
953
|
- List FILES_UPDATED + SUMMARY + OPEN_DOC_QUESTIONS (if user input needed).
|
|
680
|
-
|
|
954
|
+
${MARKDOWN_CODE_FENCE}
|
|
681
955
|
|
|
682
956
|
`;
|
|
683
957
|
}
|
|
@@ -687,8 +961,28 @@ Tasks:
|
|
|
687
961
|
*/
|
|
688
962
|
export function enhancedAgentBody(agentName) {
|
|
689
963
|
switch (agentName) {
|
|
964
|
+
case "researcher":
|
|
965
|
+
return researcherEnhancedBody();
|
|
966
|
+
case "architect":
|
|
967
|
+
return architectEnhancedBody();
|
|
968
|
+
case "spec-validator":
|
|
969
|
+
return specValidatorEnhancedBody();
|
|
970
|
+
case "slice-implementer":
|
|
971
|
+
return sliceImplementerEnhancedBody();
|
|
972
|
+
case "performance-reviewer":
|
|
973
|
+
return performanceReviewerEnhancedBody();
|
|
974
|
+
case "compatibility-reviewer":
|
|
975
|
+
return compatibilityReviewerEnhancedBody();
|
|
976
|
+
case "observability-reviewer":
|
|
977
|
+
return observabilityReviewerEnhancedBody();
|
|
978
|
+
case "release-reviewer":
|
|
979
|
+
return releaseReviewerEnhancedBody();
|
|
690
980
|
case "planner":
|
|
691
981
|
return plannerEnhancedBody();
|
|
982
|
+
case "product-manager":
|
|
983
|
+
return productManagerEnhancedBody();
|
|
984
|
+
case "critic":
|
|
985
|
+
return criticEnhancedBody();
|
|
692
986
|
case "reviewer":
|
|
693
987
|
return reviewerEnhancedBody();
|
|
694
988
|
case "security-reviewer":
|
|
@@ -697,6 +991,10 @@ export function enhancedAgentBody(agentName) {
|
|
|
697
991
|
return testAuthorEnhancedBody();
|
|
698
992
|
case "doc-updater":
|
|
699
993
|
return docUpdaterEnhancedBody();
|
|
994
|
+
case "implementer":
|
|
995
|
+
return implementerEnhancedBody();
|
|
996
|
+
case "fixer":
|
|
997
|
+
return fixerEnhancedBody();
|
|
700
998
|
default:
|
|
701
999
|
return `
|
|
702
1000
|
|
|
@@ -715,7 +1013,7 @@ Two patterns (skills under \`.cclaw/skills/\`):
|
|
|
715
1013
|
- **SDD** (subagent-driven-development): sequential implementer→reviewer loops. Paste self-contained task text; never point subagents at plan files.
|
|
716
1014
|
- **Parallel Agents** (dispatching-parallel-agents): parallel review/analysis lenses. Never parallelize implementers on same codebase.
|
|
717
1015
|
|
|
718
|
-
Status contract: DONE | DONE_WITH_CONCERNS | NEEDS_CONTEXT | BLOCKED.
|
|
1016
|
+
Status contract: DONE | DONE_WITH_CONCERNS | NEEDS_CONTEXT | BLOCKED. Worker returns must use the strict JSON schemas in \`subagent-driven-development\`.
|
|
719
1017
|
|
|
720
1018
|
- Controller sequentially dispatches **implementer → reviewer** loops per task.
|
|
721
1019
|
- HARD-GATE: paste **self-contained task text**; never point subagents at plan files to “discover” scope.
|