cclaw-cli 0.48.30 → 0.48.31
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/dist/content/skills.js +71 -67
- package/package.json +1 -1
package/dist/content/skills.js
CHANGED
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
import { RUNTIME_ROOT, STAGE_TO_SKILL_FOLDER } from "../constants.js";
|
|
2
|
-
import { STAGE_EXAMPLES_REFERENCE_DIR,
|
|
2
|
+
import { STAGE_EXAMPLES_REFERENCE_DIR, stageExamples } from "./examples.js";
|
|
3
3
|
import { STAGE_COMMON_GUIDANCE_REL_PATH } from "./stage-common-guidance.js";
|
|
4
4
|
import { stageAutoSubagentDispatch, stageSchema } from "./stage-schema.js";
|
|
5
5
|
const VERIFICATION_STAGES = ["tdd", "review", "ship"];
|
|
6
6
|
const DECISION_PROTOCOL_PATH = `${RUNTIME_ROOT}/references/protocols/decision.md`;
|
|
7
7
|
const COMPLETION_PROTOCOL_PATH = `${RUNTIME_ROOT}/references/protocols/completion.md`;
|
|
8
|
-
function whenNotToUseBlock(
|
|
9
|
-
|
|
10
|
-
if (schema.whenNotToUse.length === 0) {
|
|
8
|
+
function whenNotToUseBlock(items) {
|
|
9
|
+
if (items.length === 0) {
|
|
11
10
|
return "";
|
|
12
11
|
}
|
|
13
12
|
return `## When Not to Use
|
|
14
|
-
${
|
|
13
|
+
${items.map((item) => `- ${item}`).join("\n")}
|
|
15
14
|
|
|
16
15
|
`;
|
|
17
16
|
}
|
|
18
|
-
function contextLoadingBlock(
|
|
19
|
-
const trace = stageSchema(stage, track).crossStageTrace;
|
|
17
|
+
function contextLoadingBlock(trace) {
|
|
20
18
|
const readLines = trace.readsFrom.length > 0
|
|
21
19
|
? trace.readsFrom.map((value) => `- \`${value}\``).join("\n")
|
|
22
20
|
: "- (first stage — no upstream artifacts)";
|
|
@@ -54,8 +52,7 @@ Mandatory delegations for this stage: ${mandatoryList}.
|
|
|
54
52
|
Record completion/waiver in \`${delegationLogRel}\` before stage completion.
|
|
55
53
|
`;
|
|
56
54
|
}
|
|
57
|
-
function researchPlaybooksBlock(
|
|
58
|
-
const playbooks = stageSchema(stage, track).researchPlaybooks ?? [];
|
|
55
|
+
function researchPlaybooksBlock(playbooks) {
|
|
59
56
|
if (playbooks.length === 0)
|
|
60
57
|
return "";
|
|
61
58
|
const rows = playbooks
|
|
@@ -70,11 +67,10 @@ and record outcomes in the stage artifact when relevant.
|
|
|
70
67
|
${rows}
|
|
71
68
|
`;
|
|
72
69
|
}
|
|
73
|
-
function reviewSectionsBlock(
|
|
74
|
-
|
|
75
|
-
if (schema.reviewSections.length === 0)
|
|
70
|
+
function reviewSectionsBlock(sectionsInput) {
|
|
71
|
+
if (sectionsInput.length === 0)
|
|
76
72
|
return "";
|
|
77
|
-
const sections =
|
|
73
|
+
const sections = sectionsInput
|
|
78
74
|
.map((sec) => {
|
|
79
75
|
const points = sec.evaluationPoints.map((p) => `- ${p}`).join("\n");
|
|
80
76
|
const title = sec.stopGate ? `${sec.title} (STOP gate)` : sec.title;
|
|
@@ -116,8 +112,7 @@ Detailed walkthrough:
|
|
|
116
112
|
\`.cclaw/${STAGE_EXAMPLES_REFERENCE_DIR}/tdd-batch-walkthrough.md\`
|
|
117
113
|
`;
|
|
118
114
|
}
|
|
119
|
-
function crossStageTraceBlock(
|
|
120
|
-
const trace = stageSchema(stage, track).crossStageTrace;
|
|
115
|
+
function crossStageTraceBlock(trace) {
|
|
121
116
|
const reads = trace.readsFrom.length > 0
|
|
122
117
|
? trace.readsFrom.map((r) => `- ${r}`).join("\n")
|
|
123
118
|
: "- (first stage — no upstream artifacts)";
|
|
@@ -135,8 +130,7 @@ ${writes}
|
|
|
135
130
|
Rule: ${trace.traceabilityRule}
|
|
136
131
|
`;
|
|
137
132
|
}
|
|
138
|
-
function artifactValidationBlock(
|
|
139
|
-
const validations = stageSchema(stage, track).artifactValidation;
|
|
133
|
+
function artifactValidationBlock(validations) {
|
|
140
134
|
if (validations.length === 0)
|
|
141
135
|
return "";
|
|
142
136
|
const rows = validations
|
|
@@ -152,10 +146,10 @@ function artifactValidationBlock(stage, track) {
|
|
|
152
146
|
${rows}
|
|
153
147
|
`;
|
|
154
148
|
}
|
|
155
|
-
function mergedAntiPatterns(
|
|
149
|
+
function mergedAntiPatterns(philosophy, execution) {
|
|
156
150
|
const merged = [];
|
|
157
151
|
const seen = new Set();
|
|
158
|
-
for (const item of [...
|
|
152
|
+
for (const item of [...philosophy.commonRationalizations, ...execution.blockers]) {
|
|
159
153
|
const key = item.trim().toLowerCase();
|
|
160
154
|
if (seen.has(key))
|
|
161
155
|
continue;
|
|
@@ -205,9 +199,9 @@ function stageSpecificSeeAlso(stage) {
|
|
|
205
199
|
return refs[stage];
|
|
206
200
|
}
|
|
207
201
|
function completionParametersBlock(schema, track) {
|
|
208
|
-
const gateList = schema.requiredGates.map((g) => `\`${g.id}\``).join(", ");
|
|
209
|
-
const mandatory = schema.mandatoryDelegations.length > 0
|
|
210
|
-
? schema.mandatoryDelegations.map((a) => `\`${a}\``).join(", ")
|
|
202
|
+
const gateList = schema.executionModel.requiredGates.map((g) => `\`${g.id}\``).join(", ");
|
|
203
|
+
const mandatory = schema.reviewLens.mandatoryDelegations.length > 0
|
|
204
|
+
? schema.reviewLens.mandatoryDelegations.map((a) => `\`${a}\``).join(", ")
|
|
211
205
|
: "none";
|
|
212
206
|
const nextStage = schema.next === "done" ? "done" : schema.next;
|
|
213
207
|
const nextDescription = schema.next === "done"
|
|
@@ -218,25 +212,24 @@ function completionParametersBlock(schema, track) {
|
|
|
218
212
|
- \`stage\`: \`${schema.stage}\`
|
|
219
213
|
- \`next\`: \`${nextStage}\` (${nextDescription})
|
|
220
214
|
- \`gates\`: ${gateList}
|
|
221
|
-
- \`artifact\`: \`${RUNTIME_ROOT}/artifacts/${schema.artifactFile}\`
|
|
215
|
+
- \`artifact\`: \`${RUNTIME_ROOT}/artifacts/${schema.artifactRules.artifactFile}\`
|
|
222
216
|
- \`mandatory delegations\`: ${mandatory}
|
|
223
217
|
- \`completion helper\`: \`node .cclaw/hooks/stage-complete.mjs ${schema.stage}\`
|
|
224
218
|
- Fill \`## Learnings\` before closeout: either \`- None this stage.\` or JSON bullets with required keys \`type\`, \`trigger\`, \`action\`, \`confidence\` (knowledge-schema compatible).
|
|
225
219
|
- Record mandatory delegation completion/waiver in \`${RUNTIME_ROOT}/state/delegation-log.json\` with rationale as needed.
|
|
226
220
|
- Use the completion helper instead of raw \`flow-state.json\` edits (legacy direct edits trigger workflow-guard warnings or strict-mode blocks).
|
|
227
|
-
|
|
228
|
-
\`${COMPLETION_PROTOCOL_PATH}\`
|
|
221
|
+
- Completion protocol reference: \`${COMPLETION_PROTOCOL_PATH}\`
|
|
229
222
|
`;
|
|
230
223
|
}
|
|
231
224
|
function quickStartBlock(stage, track) {
|
|
232
225
|
const schema = stageSchema(stage, track);
|
|
233
|
-
const gatePreview = schema.requiredGates.slice(0, 3).map((g) => `\`${g.id}\``).join(", ");
|
|
226
|
+
const gatePreview = schema.executionModel.requiredGates.slice(0, 3).map((g) => `\`${g.id}\``).join(", ");
|
|
234
227
|
return `## Quick Start
|
|
235
228
|
|
|
236
|
-
1. Announce at start: "Using \`${schema.skillName}\` to ${schema.purpose}".
|
|
229
|
+
1. Announce at start: "Using \`${schema.skillName}\` to ${schema.philosophy.purpose}".
|
|
237
230
|
2. Obey HARD-GATE and Iron Law.
|
|
238
|
-
3. Execute checklist in order and persist \`${RUNTIME_ROOT}/artifacts/${schema.artifactFile}\`.
|
|
239
|
-
4. Satisfy gates (${gatePreview}${schema.requiredGates.length > 3 ? ` +${schema.requiredGates.length - 3}` : ""}).
|
|
231
|
+
3. Execute checklist in order and persist \`${RUNTIME_ROOT}/artifacts/${schema.artifactRules.artifactFile}\`.
|
|
232
|
+
4. Satisfy gates (${gatePreview}${schema.executionModel.requiredGates.length > 3 ? ` +${schema.executionModel.requiredGates.length - 3}` : ""}).
|
|
240
233
|
`;
|
|
241
234
|
}
|
|
242
235
|
/**
|
|
@@ -325,21 +318,26 @@ function dedupeGuidance(items, blockedBy) {
|
|
|
325
318
|
}
|
|
326
319
|
export function stageSkillMarkdown(stage, track = "standard") {
|
|
327
320
|
const schema = stageSchema(stage, track);
|
|
328
|
-
const
|
|
321
|
+
const philosophy = schema.philosophy;
|
|
322
|
+
const executionModel = schema.executionModel;
|
|
323
|
+
const artifactRules = schema.artifactRules;
|
|
324
|
+
const reviewLens = schema.reviewLens;
|
|
325
|
+
const mandatoryDelegations = reviewLens.mandatoryDelegations;
|
|
326
|
+
const gateList = executionModel.requiredGates
|
|
329
327
|
.map((g) => `- \`${g.id}\` — ${g.description}`)
|
|
330
328
|
.join("\n");
|
|
331
|
-
const evidenceList =
|
|
329
|
+
const evidenceList = executionModel.requiredEvidence
|
|
332
330
|
.map((e) => `- [ ] ${e}`)
|
|
333
331
|
.join("\n");
|
|
334
|
-
const checklistItems =
|
|
332
|
+
const checklistItems = executionModel.checklist
|
|
335
333
|
.map((item, i) => `${i + 1}. ${item}`)
|
|
336
334
|
.join("\n");
|
|
337
|
-
const interactionFocus = dedupeGuidance(
|
|
338
|
-
const processSummary = dedupeGuidance(
|
|
339
|
-
const processNote = schema.process.length > processSummary.length
|
|
340
|
-
? `- Follow the Checklist above for remaining execution detail (+${schema.process.length - processSummary.length} condensed step${schema.process.length - processSummary.length === 1 ? "" : "s"}).`
|
|
341
|
-
: "";
|
|
335
|
+
const interactionFocus = dedupeGuidance(executionModel.interactionProtocol, [...executionModel.checklist, ...executionModel.process]).slice(0, 5);
|
|
336
|
+
const processSummary = dedupeGuidance(executionModel.process, executionModel.checklist).slice(0, 5);
|
|
342
337
|
const stageRefs = stageSpecificSeeAlso(stage);
|
|
338
|
+
const mandatoryDelegationSummary = mandatoryDelegations.length > 0
|
|
339
|
+
? mandatoryDelegations.map((name) => `\`${name}\``).join(", ")
|
|
340
|
+
: "none";
|
|
343
341
|
return `---
|
|
344
342
|
name: ${schema.skillName}
|
|
345
343
|
description: "${schema.skillDescription}"
|
|
@@ -349,7 +347,7 @@ description: "${schema.skillDescription}"
|
|
|
349
347
|
|
|
350
348
|
<EXTREMELY-IMPORTANT>
|
|
351
349
|
|
|
352
|
-
**IRON LAW — ${stage.toUpperCase()}:** ${
|
|
350
|
+
**IRON LAW — ${stage.toUpperCase()}:** ${philosophy.ironLaw}
|
|
353
351
|
|
|
354
352
|
If you are about to violate the Iron Law, STOP. No amount of urgency, partial progress, or clever reinterpretation overrides it. Escalate via the Decision Protocol or abandon the stage.
|
|
355
353
|
|
|
@@ -357,28 +355,35 @@ If you are about to violate the Iron Law, STOP. No amount of urgency, partial pr
|
|
|
357
355
|
|
|
358
356
|
${quickStartBlock(stage, track)}
|
|
359
357
|
|
|
360
|
-
##
|
|
361
|
-
${
|
|
358
|
+
## Philosophy
|
|
359
|
+
${philosophy.purpose}
|
|
360
|
+
|
|
361
|
+
## Complexity Tier
|
|
362
|
+
- Active tier: \`${schema.complexityTier}\`
|
|
363
|
+
- Mandatory delegations at this tier: ${mandatoryDelegationSummary}
|
|
362
364
|
|
|
363
365
|
## When to Use
|
|
364
|
-
${
|
|
366
|
+
${philosophy.whenToUse.map((item) => `- ${item}`).join("\n")}
|
|
367
|
+
|
|
368
|
+
${whenNotToUseBlock(philosophy.whenNotToUse)}
|
|
369
|
+
## HARD-GATE
|
|
370
|
+
${philosophy.hardGate}
|
|
371
|
+
|
|
372
|
+
## Anti-Patterns & Red Flags
|
|
373
|
+
${mergedAntiPatterns(philosophy, executionModel)}
|
|
374
|
+
|
|
375
|
+
## Process
|
|
376
|
+
${processSummary.length > 0 ? processSummary.map((item, i) => `${i + 1}. ${item}`).join("\n") : "1. Execute the Checklist in order.\n2. Satisfy every required gate.\n3. Complete verification before stage closeout."}
|
|
365
377
|
|
|
366
|
-
${whenNotToUseBlock(stage, track)}
|
|
367
378
|
## Inputs
|
|
368
|
-
${
|
|
379
|
+
${executionModel.inputs.length > 0 ? executionModel.inputs.map((item) => `- ${item}`).join("\n") : "- (first stage — no required inputs)"}
|
|
369
380
|
|
|
370
381
|
## Required Context
|
|
371
|
-
${
|
|
382
|
+
${executionModel.requiredContext.length > 0 ? executionModel.requiredContext.map((item) => `- ${item}`).join("\n") : "- None beyond this skill"}
|
|
372
383
|
|
|
373
|
-
${contextLoadingBlock(
|
|
384
|
+
${contextLoadingBlock(artifactRules.crossStageTrace)}
|
|
374
385
|
${autoSubagentDispatchBlock(stage, track)}
|
|
375
|
-
${researchPlaybooksBlock(
|
|
376
|
-
|
|
377
|
-
## Outputs
|
|
378
|
-
${schema.outputs.map((item) => `- ${item}`).join("\n")}
|
|
379
|
-
|
|
380
|
-
## HARD-GATE
|
|
381
|
-
${schema.hardGate}
|
|
386
|
+
${researchPlaybooksBlock(executionModel.researchPlaybooks ?? [])}
|
|
382
387
|
|
|
383
388
|
## Checklist
|
|
384
389
|
|
|
@@ -386,15 +391,12 @@ You MUST complete these steps in order:
|
|
|
386
391
|
|
|
387
392
|
${checklistItems}
|
|
388
393
|
|
|
389
|
-
${stageGoodBadExamples(stage)}
|
|
390
|
-
${stageDomainExamples(stage)}
|
|
391
394
|
${stageExamples(stage)}
|
|
392
395
|
|
|
393
396
|
## Interaction Protocol
|
|
394
397
|
${interactionFocus.length > 0 ? interactionFocus.map((item, i) => `${i + 1}. ${item}`).join("\n") : "- Keep communication concise and decision-focused; rely on the Checklist for execution order."}
|
|
395
398
|
|
|
396
|
-
|
|
397
|
-
\`${DECISION_PROTOCOL_PATH}\`
|
|
399
|
+
Decision protocol reference: \`${DECISION_PROTOCOL_PATH}\`
|
|
398
400
|
|
|
399
401
|
${batchExecutionModeBlock(stage, track)}
|
|
400
402
|
## Required Gates
|
|
@@ -403,22 +405,24 @@ ${gateList}
|
|
|
403
405
|
## Required Evidence
|
|
404
406
|
${evidenceList}
|
|
405
407
|
|
|
406
|
-
## Process
|
|
407
|
-
${processSummary.length > 0 ? processSummary.map((item, i) => `${i + 1}. ${item}`).join("\n") : "1. Execute the Checklist in order.\n2. Satisfy every required gate.\n3. Complete verification before stage closeout."}
|
|
408
|
-
${processNote.length > 0 ? `\n${processNote}` : ""}
|
|
409
|
-
|
|
410
|
-
${reviewSectionsBlock(stage, track)}
|
|
411
408
|
${verificationBlock(stage)}
|
|
412
|
-
${crossStageTraceBlock(stage, track)}
|
|
413
|
-
${artifactValidationBlock(stage, track)}
|
|
414
|
-
|
|
415
|
-
## Anti-Patterns & Red Flags
|
|
416
|
-
${mergedAntiPatterns(schema)}
|
|
417
409
|
|
|
418
410
|
## Verification
|
|
419
|
-
${
|
|
411
|
+
${executionModel.exitCriteria.map((item) => `- [ ] ${item}`).join("\n")}
|
|
420
412
|
|
|
421
413
|
${completionParametersBlock(schema, track)}
|
|
414
|
+
## Artifact Rules
|
|
415
|
+
- Artifact target: \`${RUNTIME_ROOT}/artifacts/${artifactRules.artifactFile}\`
|
|
416
|
+
|
|
417
|
+
${crossStageTraceBlock(artifactRules.crossStageTrace)}
|
|
418
|
+
${artifactValidationBlock(artifactRules.artifactValidation)}
|
|
419
|
+
|
|
420
|
+
## Review Lens
|
|
421
|
+
## Outputs
|
|
422
|
+
${reviewLens.outputs.map((item) => `- ${item}`).join("\n")}
|
|
423
|
+
|
|
424
|
+
${reviewSectionsBlock(reviewLens.reviewSections)}
|
|
425
|
+
|
|
422
426
|
## Shared Stage Guidance
|
|
423
427
|
See:
|
|
424
428
|
- \`${STAGE_COMMON_GUIDANCE_REL_PATH}\`
|