cclaw-cli 0.51.24 → 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 +110 -0
- package/dist/content/core-agents.js +235 -3
- package/dist/content/examples.js +8 -5
- 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/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 +184 -28
- package/dist/content/stages/_lint-metadata/index.js +3 -2
- package/dist/content/stages/brainstorm.js +7 -3
- package/dist/content/stages/design.js +12 -3
- package/dist/content/stages/review.js +7 -5
- package/dist/content/stages/schema-types.d.ts +9 -2
- package/dist/content/stages/scope.js +8 -2
- 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 +281 -39
- package/dist/content/templates.js +64 -3
- package/dist/delegation.d.ts +2 -0
- package/dist/delegation.js +27 -6
- package/dist/doctor.js +47 -5
- package/dist/gate-evidence.js +25 -2
- package/dist/install.js +2 -9
- package/dist/internal/advance-stage.js +179 -26
- package/dist/run-persistence.js +21 -3
- 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,14 +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",
|
|
10
18
|
"product-manager",
|
|
11
19
|
"critic",
|
|
12
20
|
"reviewer",
|
|
13
21
|
"security-reviewer",
|
|
14
22
|
"test-author",
|
|
15
|
-
"doc-updater"
|
|
23
|
+
"doc-updater",
|
|
24
|
+
"implementer",
|
|
25
|
+
"fixer"
|
|
16
26
|
];
|
|
27
|
+
const MARKDOWN_CODE_FENCE = "```";
|
|
17
28
|
function formatAgentList(agents) {
|
|
18
29
|
return agents.length > 0 ? agents.join(", ") : "none";
|
|
19
30
|
}
|
|
@@ -28,7 +39,7 @@ ${rows}`;
|
|
|
28
39
|
}
|
|
29
40
|
function stageSummary(stage) {
|
|
30
41
|
return stageDelegationSummary("standard").find((row) => row.stage === stage)
|
|
31
|
-
?? { stage, mandatoryAgents: [], proactiveAgents: [], primaryAgents: [], stackAwareRoutes: [] };
|
|
42
|
+
?? { stage, mandatoryAgents: [], proactiveAgents: [], primaryAgents: [], dispatchRules: [], stackAwareRoutes: [] };
|
|
32
43
|
}
|
|
33
44
|
export function subagentDrivenDevSkill() {
|
|
34
45
|
return `---
|
|
@@ -40,11 +51,11 @@ description: "Orchestrate implementation via isolated subagents — one fresh ag
|
|
|
40
51
|
|
|
41
52
|
## Overview
|
|
42
53
|
|
|
43
|
-
Use a **controller
|
|
54
|
+
Use a **controller -> coder -> overseer** loop when building multi-step software work.
|
|
44
55
|
|
|
45
56
|
- **Controller (parent agent):** owns the plan, gating, sequencing, and dispatch decisions; never mixes deep implementation context with review evidence.
|
|
46
|
-
- **
|
|
47
|
-
- **
|
|
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.
|
|
48
59
|
|
|
49
60
|
This pattern is intentionally **Superpowers-style**: cheap parallelism where it doesn’t corrupt state, strict serialization where it would.
|
|
50
61
|
|
|
@@ -198,9 +209,43 @@ Borrow the good part of Team/Ruflo-style orchestration without adding a swarm ru
|
|
|
198
209
|
| NEEDS_CONTEXT | Missing authoritative information only the parent/user can supply | Parent gathers context, then re-dispatch implementer with augmented prompt |
|
|
199
210
|
| BLOCKED | Hard stop (permissions, tool failure, conflicting requirements, unsafe state) | Parent escalates to user; do not stack speculative guesses |
|
|
200
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
|
+
|
|
201
246
|
## Implementer Prompt Template (paste into Task tool)
|
|
202
247
|
|
|
203
|
-
|
|
248
|
+
${MARKDOWN_CODE_FENCE}
|
|
204
249
|
You are implementing a single task from a development plan.
|
|
205
250
|
|
|
206
251
|
TASK: {paste full task text here}
|
|
@@ -209,15 +254,15 @@ CONSTRAINTS: {paste from spec — what NOT to do}
|
|
|
209
254
|
|
|
210
255
|
After implementation:
|
|
211
256
|
0. Write user-facing narrative in the parent/user language; keep status tokens unchanged.
|
|
212
|
-
1. Run the
|
|
213
|
-
2.
|
|
214
|
-
3. If DONE_WITH_CONCERNS, list each concern
|
|
215
|
-
4. If NEEDS_CONTEXT, specify exactly what you need
|
|
216
|
-
|
|
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}
|
|
217
262
|
|
|
218
263
|
## Spec-Reviewer Prompt Template (paste into Task tool)
|
|
219
264
|
|
|
220
|
-
|
|
265
|
+
${MARKDOWN_CODE_FENCE}
|
|
221
266
|
Review the implementation against the specification.
|
|
222
267
|
|
|
223
268
|
SPEC CRITERIA: {paste acceptance criteria}
|
|
@@ -225,7 +270,7 @@ FILES CHANGED: {list files}
|
|
|
225
270
|
|
|
226
271
|
For each criterion: PASS / FAIL / PARTIAL with evidence (file:line).
|
|
227
272
|
Do NOT trust the implementer's self-report — read the actual code.
|
|
228
|
-
|
|
273
|
+
${MARKDOWN_CODE_FENCE}
|
|
229
274
|
|
|
230
275
|
## Anti-patterns
|
|
231
276
|
|
|
@@ -273,7 +318,7 @@ Do NOT trust the implementer's self-report — read the actual code.
|
|
|
273
318
|
|
|
274
319
|
## Code-Quality Reviewer Prompt Template (paste into Task tool)
|
|
275
320
|
|
|
276
|
-
|
|
321
|
+
${MARKDOWN_CODE_FENCE}
|
|
277
322
|
You are a code-quality reviewer (subagent) after a single SDD task.
|
|
278
323
|
|
|
279
324
|
SCOPE: {files touched by this task}
|
|
@@ -288,11 +333,11 @@ Review for maintainability and ship hygiene across:
|
|
|
288
333
|
Output:
|
|
289
334
|
- FINDINGS: severity, file:line, issue, recommendation
|
|
290
335
|
- VERDICT: APPROVE | APPROVE_WITH_NITS | REWORK_REQUIRED
|
|
291
|
-
|
|
336
|
+
${MARKDOWN_CODE_FENCE}
|
|
292
337
|
|
|
293
338
|
## Fixer Subagent Prompt Template (after spec review FAIL)
|
|
294
339
|
|
|
295
|
-
|
|
340
|
+
${MARKDOWN_CODE_FENCE}
|
|
296
341
|
You are a fixer subagent. You are NOT the original implementer.
|
|
297
342
|
|
|
298
343
|
FAILING CRITERION (verbatim): {paste failed criterion}
|
|
@@ -305,11 +350,11 @@ Process:
|
|
|
305
350
|
2) Implement the smallest fix that satisfies the criterion.
|
|
306
351
|
3) Run the full test suite.
|
|
307
352
|
4) Report STATUS: DONE / DONE_WITH_CONCERNS / NEEDS_CONTEXT / BLOCKED with evidence excerpts.
|
|
308
|
-
|
|
353
|
+
${MARKDOWN_CODE_FENCE}
|
|
309
354
|
|
|
310
355
|
## Final Code Reviewer Prompt Template (post-queue sweep)
|
|
311
356
|
|
|
312
|
-
|
|
357
|
+
${MARKDOWN_CODE_FENCE}
|
|
313
358
|
You are the final code-quality reviewer after ALL SDD tasks completed.
|
|
314
359
|
|
|
315
360
|
ENTIRE CHANGESET: {summary + primary entrypoints}
|
|
@@ -323,7 +368,7 @@ Deliver:
|
|
|
323
368
|
- TOP_FINDINGS (merge blockers first)
|
|
324
369
|
- CONSISTENCY_PASS/FAIL with rationale
|
|
325
370
|
- SHIP_RECOMMENDATION: SHIP | SHIP_WITH_FOLLOWUPS | NO_SHIP
|
|
326
|
-
|
|
371
|
+
${MARKDOWN_CODE_FENCE}
|
|
327
372
|
|
|
328
373
|
## Glossary
|
|
329
374
|
|
|
@@ -400,7 +445,7 @@ Implementation that touches shared source trees must remain **sequential** unles
|
|
|
400
445
|
|
|
401
446
|
Write a structured reconciliation artifact at \`.cclaw/artifacts/07-review-army.json\` using this schema:
|
|
402
447
|
|
|
403
|
-
|
|
448
|
+
${MARKDOWN_CODE_FENCE}json
|
|
404
449
|
{
|
|
405
450
|
"version": 1,
|
|
406
451
|
"generatedAt": "ISO timestamp",
|
|
@@ -424,7 +469,7 @@ Write a structured reconciliation artifact at \`.cclaw/artifacts/07-review-army.
|
|
|
424
469
|
"shipBlockers": []
|
|
425
470
|
}
|
|
426
471
|
}
|
|
427
|
-
|
|
472
|
+
${MARKDOWN_CODE_FENCE}
|
|
428
473
|
|
|
429
474
|
Contract rules:
|
|
430
475
|
- \`id\` and \`fingerprint\` must be stable between reruns if the finding is unchanged.
|
|
@@ -506,7 +551,7 @@ Contract rules:
|
|
|
506
551
|
|
|
507
552
|
## Parallel Review Task Template (paste into Task tool)
|
|
508
553
|
|
|
509
|
-
|
|
554
|
+
${MARKDOWN_CODE_FENCE}
|
|
510
555
|
You are an independent review/investigation subagent.
|
|
511
556
|
|
|
512
557
|
LENS: {security|data|perf|api|ux|observability — pick one}
|
|
@@ -518,7 +563,7 @@ Rules:
|
|
|
518
563
|
- Do not edit files unless explicitly authorized in this prompt.
|
|
519
564
|
- Cite evidence as file:line for every finding.
|
|
520
565
|
- If uncertain, emit CONFIDENCE <= 4 and label as hypothesis.
|
|
521
|
-
|
|
566
|
+
${MARKDOWN_CODE_FENCE}
|
|
522
567
|
|
|
523
568
|
## Worked Example (narrative)
|
|
524
569
|
|
|
@@ -529,6 +574,137 @@ A large refactor touches **auth middleware** and **repository queries**. The con
|
|
|
529
574
|
- Parallel agents produce **evidence and prioritized tasks**.
|
|
530
575
|
- SDD **implements** those tasks **one at a time** with sequential implementers.
|
|
531
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
|
+
|
|
532
708
|
`;
|
|
533
709
|
}
|
|
534
710
|
function plannerEnhancedBody() {
|
|
@@ -540,7 +716,7 @@ When a planning problem is too broad for one message, delegate **planning subtas
|
|
|
540
716
|
|
|
541
717
|
Paste the template below verbatim and fill \`{placeholders}\` in the parent before dispatching.
|
|
542
718
|
|
|
543
|
-
|
|
719
|
+
${MARKDOWN_CODE_FENCE}
|
|
544
720
|
You are a planning subagent for a larger Cclaw / engineering workflow.
|
|
545
721
|
|
|
546
722
|
PLANNING GOAL: {one sentence outcome — e.g., sequencing, risk register, dependency graph}
|
|
@@ -553,7 +729,7 @@ Rules:
|
|
|
553
729
|
- Every task must include acceptance criteria copy-paste ready for SDD implementers.
|
|
554
730
|
- Flag UNKNOWN explicitly instead of guessing.
|
|
555
731
|
- Close with: OPEN_QUESTIONS: ... and NEXT_TASK_TEXT: ... (verbatim extractable queue item)
|
|
556
|
-
|
|
732
|
+
${MARKDOWN_CODE_FENCE}
|
|
557
733
|
|
|
558
734
|
`;
|
|
559
735
|
}
|
|
@@ -564,7 +740,7 @@ function specReviewerEnhancedBody() {
|
|
|
564
740
|
|
|
565
741
|
For review audits, use the Task tool with the following **reviewer** payload (fill placeholders in the parent session).
|
|
566
742
|
|
|
567
|
-
|
|
743
|
+
${MARKDOWN_CODE_FENCE}
|
|
568
744
|
You are a specification compliance reviewer (subagent).
|
|
569
745
|
|
|
570
746
|
SPEC CRITERIA (verbatim): {acceptance criteria / invariants / non-goals}
|
|
@@ -575,7 +751,7 @@ Instructions:
|
|
|
575
751
|
- For EACH criterion emit PASS / PARTIAL / FAIL with evidence as file:line.
|
|
576
752
|
- Read the code; ignore implementer claims unless backed by code citations.
|
|
577
753
|
- Close with SPEC_VERDICT: PASS | PASS_WITH_GAPS | FAIL plus GAPS/FAIL list.
|
|
578
|
-
|
|
754
|
+
${MARKDOWN_CODE_FENCE}
|
|
579
755
|
|
|
580
756
|
`;
|
|
581
757
|
}
|
|
@@ -586,7 +762,7 @@ function codeReviewerEnhancedBody() {
|
|
|
586
762
|
|
|
587
763
|
Launch deep **code-quality** reviews using this five-axis template in the Task tool body:
|
|
588
764
|
|
|
589
|
-
|
|
765
|
+
${MARKDOWN_CODE_FENCE}
|
|
590
766
|
You are a code-quality reviewer (subagent). Review along ALL axes:
|
|
591
767
|
|
|
592
768
|
1) Correctness — logic, data flow, error handling, boundary conditions
|
|
@@ -601,7 +777,7 @@ BASELINE CONTEXT: {tests, deployment constraints, compatibility promises}
|
|
|
601
777
|
Output format (mandatory):
|
|
602
778
|
- FINDING: [Critical|Important|Suggestion] file:line — problem — recommendation
|
|
603
779
|
- Close with RISK_SUMMARY and SHIP_BLOCKERS (explicit list, possibly empty).
|
|
604
|
-
|
|
780
|
+
${MARKDOWN_CODE_FENCE}
|
|
605
781
|
|
|
606
782
|
`;
|
|
607
783
|
}
|
|
@@ -612,7 +788,7 @@ function productManagerEnhancedBody() {
|
|
|
612
788
|
|
|
613
789
|
Use this payload when product discovery needs an isolated lens:
|
|
614
790
|
|
|
615
|
-
|
|
791
|
+
${MARKDOWN_CODE_FENCE}
|
|
616
792
|
You are a product-manager subagent.
|
|
617
793
|
|
|
618
794
|
DISCOVERY GOAL: {problem/value decision to clarify}
|
|
@@ -626,7 +802,7 @@ Required output:
|
|
|
626
802
|
- WHY_NOW_AND_DO_NOTHING: why now plus consequence of no action
|
|
627
803
|
- NON_GOALS: explicit exclusions
|
|
628
804
|
- SCOPE_HANDOFF: one recommendation for hold/selective/expand/reduce
|
|
629
|
-
|
|
805
|
+
${MARKDOWN_CODE_FENCE}
|
|
630
806
|
|
|
631
807
|
`;
|
|
632
808
|
}
|
|
@@ -637,7 +813,7 @@ function criticEnhancedBody() {
|
|
|
637
813
|
|
|
638
814
|
Use this payload when a premise, scope mode, or engineering path needs adversarial pressure:
|
|
639
815
|
|
|
640
|
-
|
|
816
|
+
${MARKDOWN_CODE_FENCE}
|
|
641
817
|
You are a critic subagent.
|
|
642
818
|
|
|
643
819
|
DECISION_UNDER_REVIEW: {direction/scope/design choice}
|
|
@@ -651,7 +827,7 @@ Required output:
|
|
|
651
827
|
- SWITCH_TRIGGER: signal that should change the decision
|
|
652
828
|
- FAILURE_RESCUE: likely failure and rescue/degraded behavior
|
|
653
829
|
- VERIFICATION_EVIDENCE: evidence needed before locking
|
|
654
|
-
|
|
830
|
+
${MARKDOWN_CODE_FENCE}
|
|
655
831
|
|
|
656
832
|
`;
|
|
657
833
|
}
|
|
@@ -665,7 +841,7 @@ function securityReviewerEnhancedBody() {
|
|
|
665
841
|
|
|
666
842
|
Use a dedicated Task tool invocation for CWE-focused review with reproducible narratives:
|
|
667
843
|
|
|
668
|
-
|
|
844
|
+
${MARKDOWN_CODE_FENCE}
|
|
669
845
|
You are a security reviewer (subagent). Perform a CWE-oriented review of the scoped change.
|
|
670
846
|
|
|
671
847
|
SCOPE: {files/commits/services touched}
|
|
@@ -677,7 +853,7 @@ Requirements:
|
|
|
677
853
|
- Include a short proof-of-concept attack vector (conceptual, no weaponization).
|
|
678
854
|
- Recommend concrete controls (validation, sandboxing, authz checks, safer APIs).
|
|
679
855
|
- Close with SECURITY_VERDICT: SHIP | SHIP_WITH_HOTFIXES | NO_SHIP and cite top 3 drivers.
|
|
680
|
-
|
|
856
|
+
${MARKDOWN_CODE_FENCE}
|
|
681
857
|
|
|
682
858
|
`;
|
|
683
859
|
}
|
|
@@ -691,7 +867,7 @@ This agent runs in two explicit stage modes to respect cclaw hard-gates:
|
|
|
691
867
|
- \`TEST_RED_ONLY\` (only failing tests + evidence; no production edits)
|
|
692
868
|
- \`BUILD_GREEN_REFACTOR\` (implementation + full-suite green + refactor notes)
|
|
693
869
|
|
|
694
|
-
|
|
870
|
+
${MARKDOWN_CODE_FENCE}
|
|
695
871
|
You are a TDD implementer subagent.
|
|
696
872
|
|
|
697
873
|
STAGE_MODE: {TEST_RED_ONLY | BUILD_GREEN_REFACTOR}
|
|
@@ -708,6 +884,52 @@ Process (mandatory):
|
|
|
708
884
|
- GREEN — minimal production code to satisfy existing RED tests, rerun full suite.
|
|
709
885
|
- REFACTOR — only after full suite is green; preserve behavior.
|
|
710
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.
|
|
711
933
|
\`\`\`
|
|
712
934
|
|
|
713
935
|
`;
|
|
@@ -719,7 +941,7 @@ function docUpdaterEnhancedBody() {
|
|
|
719
941
|
|
|
720
942
|
For documentation parallelism, still avoid conflicting writes — partition by artifact:
|
|
721
943
|
|
|
722
|
-
|
|
944
|
+
${MARKDOWN_CODE_FENCE}
|
|
723
945
|
You are a documentation updater subagent.
|
|
724
946
|
|
|
725
947
|
DOCS SCOPE: {README|API ref|runbook|changelog section}
|
|
@@ -729,7 +951,7 @@ Tasks:
|
|
|
729
951
|
- Diff mental model vs reality; update only stale sections.
|
|
730
952
|
- Preserve tone/structure; no doc rewrite for its own sake.
|
|
731
953
|
- List FILES_UPDATED + SUMMARY + OPEN_DOC_QUESTIONS (if user input needed).
|
|
732
|
-
|
|
954
|
+
${MARKDOWN_CODE_FENCE}
|
|
733
955
|
|
|
734
956
|
`;
|
|
735
957
|
}
|
|
@@ -739,6 +961,22 @@ Tasks:
|
|
|
739
961
|
*/
|
|
740
962
|
export function enhancedAgentBody(agentName) {
|
|
741
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();
|
|
742
980
|
case "planner":
|
|
743
981
|
return plannerEnhancedBody();
|
|
744
982
|
case "product-manager":
|
|
@@ -753,6 +991,10 @@ export function enhancedAgentBody(agentName) {
|
|
|
753
991
|
return testAuthorEnhancedBody();
|
|
754
992
|
case "doc-updater":
|
|
755
993
|
return docUpdaterEnhancedBody();
|
|
994
|
+
case "implementer":
|
|
995
|
+
return implementerEnhancedBody();
|
|
996
|
+
case "fixer":
|
|
997
|
+
return fixerEnhancedBody();
|
|
756
998
|
default:
|
|
757
999
|
return `
|
|
758
1000
|
|
|
@@ -771,7 +1013,7 @@ Two patterns (skills under \`.cclaw/skills/\`):
|
|
|
771
1013
|
- **SDD** (subagent-driven-development): sequential implementer→reviewer loops. Paste self-contained task text; never point subagents at plan files.
|
|
772
1014
|
- **Parallel Agents** (dispatching-parallel-agents): parallel review/analysis lenses. Never parallelize implementers on same codebase.
|
|
773
1015
|
|
|
774
|
-
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\`.
|
|
775
1017
|
|
|
776
1018
|
- Controller sequentially dispatches **implementer → reviewer** loops per task.
|
|
777
1019
|
- HARD-GATE: paste **self-contained task text**; never point subagents at plan files to “discover” scope.
|