cclaw-cli 6.14.3 → 7.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.
- package/README.md +0 -2
- package/dist/artifact-linter/brainstorm.js +1 -1
- package/dist/artifact-linter/design.js +2 -2
- package/dist/artifact-linter/findings-dedup.js +1 -1
- package/dist/artifact-linter/plan.js +6 -6
- package/dist/artifact-linter/review-army.d.ts +1 -1
- package/dist/artifact-linter/review-army.js +1 -1
- package/dist/artifact-linter/scope.js +6 -6
- package/dist/artifact-linter/shared.d.ts +37 -73
- package/dist/artifact-linter/shared.js +30 -37
- package/dist/artifact-linter/spec.js +1 -1
- package/dist/artifact-linter/tdd.d.ts +20 -33
- package/dist/artifact-linter/tdd.js +89 -617
- package/dist/artifact-linter.js +11 -32
- package/dist/cli.js +1 -1
- package/dist/config.js +1 -1
- package/dist/constants.js +1 -1
- package/dist/content/core-agents.d.ts +8 -26
- package/dist/content/core-agents.js +48 -94
- package/dist/content/examples.d.ts +1 -1
- package/dist/content/examples.js +4 -4
- package/dist/content/hooks.js +62 -149
- package/dist/content/idea.js +2 -2
- package/dist/content/iron-laws.js +1 -1
- package/dist/content/node-hooks.js +2 -2
- package/dist/content/skills-elicitation.js +2 -2
- package/dist/content/skills.d.ts +4 -6
- package/dist/content/skills.js +14 -53
- package/dist/content/stage-schema.d.ts +3 -3
- package/dist/content/stage-schema.js +8 -46
- package/dist/content/stages/brainstorm.js +5 -5
- package/dist/content/stages/plan.js +2 -2
- package/dist/content/stages/review.js +1 -1
- package/dist/content/stages/schema-types.d.ts +1 -1
- package/dist/content/stages/scope.js +1 -1
- package/dist/content/stages/spec.js +2 -2
- package/dist/content/stages/tdd.js +43 -108
- package/dist/content/start-command.js +3 -3
- package/dist/content/subagent-context-skills.js +5 -3
- package/dist/content/subagents.js +13 -74
- package/dist/content/templates.d.ts +6 -6
- package/dist/content/templates.js +23 -24
- package/dist/content/utility-skills.d.ts +1 -1
- package/dist/content/utility-skills.js +1 -1
- package/dist/delegation.d.ts +79 -139
- package/dist/delegation.js +83 -215
- package/dist/early-loop.js +1 -1
- package/dist/flow-state.d.ts +24 -129
- package/dist/flow-state.js +5 -30
- package/dist/gate-evidence.d.ts +2 -7
- package/dist/gate-evidence.js +2 -59
- package/dist/harness-adapters.d.ts +1 -1
- package/dist/harness-adapters.js +11 -10
- package/dist/install.js +24 -459
- package/dist/internal/advance-stage/advance.d.ts +5 -5
- package/dist/internal/advance-stage/advance.js +9 -24
- package/dist/internal/advance-stage/parsers.d.ts +1 -1
- package/dist/internal/advance-stage/review-loop.d.ts +1 -1
- package/dist/internal/advance-stage/review-loop.js +3 -3
- package/dist/internal/advance-stage/start-flow.js +1 -3
- package/dist/internal/advance-stage.js +4 -23
- package/dist/internal/cohesion-contract-stub.d.ts +8 -13
- package/dist/internal/cohesion-contract-stub.js +18 -24
- package/dist/internal/flow-state-repair.d.ts +1 -1
- package/dist/internal/plan-split-waves.d.ts +44 -7
- package/dist/internal/plan-split-waves.js +113 -12
- package/dist/internal/wave-status.d.ts +3 -6
- package/dist/internal/wave-status.js +5 -27
- package/dist/policy.js +1 -1
- package/dist/run-persistence.js +10 -44
- package/dist/runtime/run-hook.mjs +3 -3
- package/dist/track-heuristics.js +1 -1
- package/dist/types.d.ts +2 -2
- package/package.json +1 -1
- package/dist/integration-fanin.d.ts +0 -44
- package/dist/integration-fanin.js +0 -180
- package/dist/internal/set-checkpoint-mode.d.ts +0 -16
- package/dist/internal/set-checkpoint-mode.js +0 -72
- package/dist/internal/set-integration-overseer-mode.d.ts +0 -14
- package/dist/internal/set-integration-overseer-mode.js +0 -69
- package/dist/internal/set-worktree-mode.d.ts +0 -10
- package/dist/internal/set-worktree-mode.js +0 -28
- package/dist/worktree-manager.d.ts +0 -50
- package/dist/worktree-manager.js +0 -136
- package/dist/worktree-types.d.ts +0 -36
- package/dist/worktree-types.js +0 -6
package/dist/artifact-linter.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import fs from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { resolveArtifactPath as resolveStageArtifactPath } from "./artifact-paths.js";
|
|
4
|
-
import { effectiveIntegrationOverseerMode, effectiveTddCheckpointMode, effectiveWorktreeExecutionMode } from "./flow-state.js";
|
|
5
4
|
import { exists } from "./fs-utils.js";
|
|
6
5
|
import { stageSchema } from "./content/stage-schema.js";
|
|
7
6
|
import { readFlowState } from "./run-persistence.js";
|
|
@@ -110,7 +109,7 @@ export async function lintArtifact(projectRoot, stage, track = "standard", optio
|
|
|
110
109
|
const overrideSet = isTrivialOverride
|
|
111
110
|
? new Set(schema.trivialOverrideSections.map((s) => normalizeHeadingTitle(s).toLowerCase()))
|
|
112
111
|
: null;
|
|
113
|
-
//
|
|
112
|
+
// Precompute the lite-tier signal so the per-section
|
|
114
113
|
// validators (Interaction Edge Case matrix today, others tomorrow)
|
|
115
114
|
// can relax network-dependent mandatory rows for lite/quick/bugfix
|
|
116
115
|
// runs without each validator having to re-derive the predicate.
|
|
@@ -119,15 +118,10 @@ export async function lintArtifact(projectRoot, stage, track = "standard", optio
|
|
|
119
118
|
let activeStageFlags = [];
|
|
120
119
|
let discoveryMode = "guided";
|
|
121
120
|
let taskClass = null;
|
|
121
|
+
let packageVersion;
|
|
122
122
|
let activeRunId = null;
|
|
123
123
|
let completedStagesForAudit = [];
|
|
124
124
|
let completedStageMetaForAudit;
|
|
125
|
-
let legacyContinuation = false;
|
|
126
|
-
let worktreeExecutionMode = "single-tree";
|
|
127
|
-
let tddCheckpointMode = "per-slice";
|
|
128
|
-
let integrationOverseerMode = "always";
|
|
129
|
-
let tddCutoverSliceId = "";
|
|
130
|
-
let tddWorktreeCutoverSliceId = "";
|
|
131
125
|
try {
|
|
132
126
|
const flowState = await readFlowState(projectRoot);
|
|
133
127
|
const hint = flowState.interactionHints?.[stage];
|
|
@@ -135,29 +129,19 @@ export async function lintArtifact(projectRoot, stage, track = "standard", optio
|
|
|
135
129
|
activeStageFlags.push("--skip-questions");
|
|
136
130
|
discoveryMode = flowState.discoveryMode ?? "guided";
|
|
137
131
|
taskClass = flowState.taskClass ?? null;
|
|
132
|
+
packageVersion = flowState.packageVersion;
|
|
138
133
|
activeRunId = flowState.activeRunId ?? null;
|
|
139
134
|
completedStagesForAudit = flowState.completedStages;
|
|
140
135
|
completedStageMetaForAudit = flowState.completedStageMeta;
|
|
141
|
-
legacyContinuation = flowState.legacyContinuation === true;
|
|
142
|
-
worktreeExecutionMode = effectiveWorktreeExecutionMode(flowState);
|
|
143
|
-
tddCheckpointMode = effectiveTddCheckpointMode(flowState);
|
|
144
|
-
integrationOverseerMode = effectiveIntegrationOverseerMode(flowState);
|
|
145
|
-
tddCutoverSliceId = flowState.tddCutoverSliceId ?? "";
|
|
146
|
-
tddWorktreeCutoverSliceId = flowState.tddWorktreeCutoverSliceId ?? "";
|
|
147
136
|
}
|
|
148
137
|
catch {
|
|
149
138
|
activeStageFlags = [];
|
|
150
139
|
discoveryMode = "guided";
|
|
151
140
|
taskClass = null;
|
|
141
|
+
packageVersion = undefined;
|
|
152
142
|
activeRunId = null;
|
|
153
143
|
completedStagesForAudit = [];
|
|
154
144
|
completedStageMetaForAudit = undefined;
|
|
155
|
-
legacyContinuation = false;
|
|
156
|
-
worktreeExecutionMode = "single-tree";
|
|
157
|
-
tddCheckpointMode = "per-slice";
|
|
158
|
-
integrationOverseerMode = "always";
|
|
159
|
-
tddCutoverSliceId = "";
|
|
160
|
-
tddWorktreeCutoverSliceId = "";
|
|
161
145
|
}
|
|
162
146
|
for (const extra of options.extraStageFlags ?? []) {
|
|
163
147
|
if (typeof extra === "string" && extra.length > 0 && !activeStageFlags.includes(extra)) {
|
|
@@ -165,9 +149,9 @@ export async function lintArtifact(projectRoot, stage, track = "standard", optio
|
|
|
165
149
|
}
|
|
166
150
|
}
|
|
167
151
|
const liteTierForValidators = shouldDemoteArtifactValidationByTrack(track, taskClass);
|
|
168
|
-
//
|
|
152
|
+
// pre-resolve RED/GREEN Evidence pointers AND
|
|
169
153
|
// delegation phase events so `validateSectionBody` (sync) can
|
|
170
|
-
// short-circuit. The Evidence: pointer mode (
|
|
154
|
+
// short-circuit. The Evidence: pointer mode (T3) stays as a
|
|
171
155
|
// fallback alongside legacy markdown content; phase events with a
|
|
172
156
|
// `phase=red`/`phase=green` row plus non-empty evidenceRefs auto-pass
|
|
173
157
|
// the corresponding markdown validator.
|
|
@@ -294,12 +278,7 @@ export async function lintArtifact(projectRoot, stage, track = "standard", optio
|
|
|
294
278
|
overrideSet,
|
|
295
279
|
activeStageFlags,
|
|
296
280
|
taskClass,
|
|
297
|
-
|
|
298
|
-
worktreeExecutionMode,
|
|
299
|
-
tddCheckpointMode,
|
|
300
|
-
integrationOverseerMode,
|
|
301
|
-
tddCutoverSliceId,
|
|
302
|
-
tddWorktreeCutoverSliceId
|
|
281
|
+
packageVersion
|
|
303
282
|
};
|
|
304
283
|
switch (stage) {
|
|
305
284
|
case "brainstorm":
|
|
@@ -404,7 +383,7 @@ export async function lintArtifact(projectRoot, stage, track = "standard", optio
|
|
|
404
383
|
continue;
|
|
405
384
|
finding.required = false;
|
|
406
385
|
finding.details =
|
|
407
|
-
`${finding.details} (
|
|
386
|
+
`${finding.details} (demoted to advisory by track="${track}"` +
|
|
408
387
|
(taskClass ? `, taskClass="${taskClass}"` : "") +
|
|
409
388
|
").";
|
|
410
389
|
demotedSections.push(finding.section);
|
|
@@ -440,7 +419,7 @@ export async function lintArtifact(projectRoot, stage, track = "standard", optio
|
|
|
440
419
|
return { stage, file: relFile, passed, findings, ...(dedup ? { dedup } : {}) };
|
|
441
420
|
}
|
|
442
421
|
/**
|
|
443
|
-
*
|
|
422
|
+
* section names whose required-finding outcome is
|
|
444
423
|
* demoted from blocking → advisory when
|
|
445
424
|
* `shouldDemoteArtifactValidationByTrack(track, taskClass)` returns
|
|
446
425
|
* `true`. Mirrors the user-reported quick-tier failure modes:
|
|
@@ -460,7 +439,7 @@ const ARTIFACT_VALIDATION_LITE_DEMOTE_SECTIONS = new Set([
|
|
|
460
439
|
"Product Discovery Delegation (Strategist Mode)"
|
|
461
440
|
]);
|
|
462
441
|
/**
|
|
463
|
-
*
|
|
442
|
+
* pre-resolve `Evidence:` pointers and delegation
|
|
464
443
|
* phase-event auto-satisfy state for the TDD stage's RED/GREEN
|
|
465
444
|
* Evidence rows so `validateSectionBody` (sync) can short-circuit.
|
|
466
445
|
*
|
|
@@ -471,7 +450,7 @@ const ARTIFACT_VALIDATION_LITE_DEMOTE_SECTIONS = new Set([
|
|
|
471
450
|
* - Phase-event auto-satisfy fires when `delegation-events.jsonl`
|
|
472
451
|
* carries at least one slice-tagged event for the active run with
|
|
473
452
|
* `phase=red`/`phase=green` and non-empty `evidenceRefs`. This is the
|
|
474
|
-
|
|
453
|
+
replacement for the sidecar auto-satisfy hook —
|
|
475
454
|
* slice events are now the source of truth, the RED/GREEN markdown
|
|
476
455
|
* tables are auto-rendered from them, and the validators MUST NOT
|
|
477
456
|
* demand pasted stdout when the events already prove RED/GREEN.
|
package/dist/cli.js
CHANGED
|
@@ -152,7 +152,7 @@ function buildInitSurfacePreview(harnesses) {
|
|
|
152
152
|
lines.push(".cursor/rules/cclaw-workflow.mdc");
|
|
153
153
|
}
|
|
154
154
|
if (harness === "codex") {
|
|
155
|
-
//
|
|
155
|
+
// .codex/hooks.json is managed because Codex CLI
|
|
156
156
|
// grew a real hooks API (v0.114+, behind the `codex_hooks`
|
|
157
157
|
// feature flag). Legacy `.codex/commands/*` is still auto-cleaned.
|
|
158
158
|
lines.push(".codex/hooks.json (requires `codex_hooks = true` in ~/.codex/config.toml)");
|
package/dist/config.js
CHANGED
|
@@ -59,7 +59,7 @@ function assertOnlySupportedKeys(parsed, fullPath) {
|
|
|
59
59
|
throw configValidationError(fullPath, `key(s) ${keyList} are no longer supported in cclaw 3.0.0; see CHANGELOG.md`);
|
|
60
60
|
}
|
|
61
61
|
export async function detectLanguageRulePacks(_projectRoot) {
|
|
62
|
-
//
|
|
62
|
+
// Harness-only config. Language packs are no longer configurable.
|
|
63
63
|
return [];
|
|
64
64
|
}
|
|
65
65
|
export async function readConfig(projectRoot, _options = {}) {
|
package/dist/constants.js
CHANGED
|
@@ -77,7 +77,7 @@ export const REQUIRED_GITIGNORE_PATTERNS = [
|
|
|
77
77
|
".opencode/commands/cc-*.md",
|
|
78
78
|
".opencode/commands/cc.md",
|
|
79
79
|
// Codex uses skill-kind shims under `.agents/skills/cc*/` since
|
|
80
|
-
//
|
|
80
|
+
// Codex shim layout (renamed from the older `cclaw-cc*` layout).
|
|
81
81
|
// `cclaw sync` and `cclaw uninstall` both auto-remove the legacy
|
|
82
82
|
// `cclaw-cc*` directories.
|
|
83
83
|
".agents/skills/cc/SKILL.md",
|
|
@@ -36,6 +36,11 @@ export interface AgentDefinition {
|
|
|
36
36
|
/** Markdown body rendered below the YAML frontmatter. */
|
|
37
37
|
body: string;
|
|
38
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Canonical slice-builder worker protocol text (embedded in the agent body and
|
|
41
|
+
* echoed in the TDD skill block).
|
|
42
|
+
*/
|
|
43
|
+
export declare function sliceBuilderProtocol(): string;
|
|
39
44
|
/**
|
|
40
45
|
* Canonical specialist roster materialized under `.cclaw/agents/`.
|
|
41
46
|
*
|
|
@@ -171,15 +176,6 @@ export declare const CCLAW_AGENTS: readonly [{
|
|
|
171
176
|
readonly relatedStages: ["tdd", "review"];
|
|
172
177
|
readonly returnSchema: AgentReturnSchema;
|
|
173
178
|
readonly body: string;
|
|
174
|
-
}, {
|
|
175
|
-
readonly name: "test-author";
|
|
176
|
-
readonly description: "MANDATORY in TDD stage. MUST BE USED for RED -> GREEN -> REFACTOR with evidence-first discipline.";
|
|
177
|
-
readonly tools: ["Read", "Write", "Edit", "Grep", "Glob", "Bash"];
|
|
178
|
-
readonly model: "balanced";
|
|
179
|
-
readonly activation: "mandatory";
|
|
180
|
-
readonly relatedStages: ["tdd"];
|
|
181
|
-
readonly returnSchema: AgentReturnSchema;
|
|
182
|
-
readonly body: string;
|
|
183
179
|
}, {
|
|
184
180
|
readonly name: "release-reviewer";
|
|
185
181
|
readonly description: "MANDATORY during ship. MUST BE USED for release readiness, rollback, finalization mode, evidence freshness, and victory detector checks.";
|
|
@@ -199,27 +195,13 @@ export declare const CCLAW_AGENTS: readonly [{
|
|
|
199
195
|
readonly returnSchema: AgentReturnSchema;
|
|
200
196
|
readonly body: string;
|
|
201
197
|
}, {
|
|
202
|
-
readonly name: "slice-
|
|
203
|
-
readonly description: "
|
|
198
|
+
readonly name: "slice-builder";
|
|
199
|
+
readonly description: "MANDATORY for every TDD slice. Owns RED → GREEN → REFACTOR → per-slice DOC for one bounded vertical slice in a single delegated span. Multiple slice-builder spans run in parallel inside one wave when their `claimedPaths` are disjoint.";
|
|
204
200
|
readonly tools: ["Read", "Write", "Edit", "Grep", "Glob", "Bash"];
|
|
205
201
|
readonly model: "balanced";
|
|
206
|
-
readonly activation: "on-demand";
|
|
207
|
-
readonly relatedStages: ["tdd"];
|
|
208
|
-
readonly returnSchema: AgentReturnSchema;
|
|
209
|
-
readonly body: string;
|
|
210
|
-
}, {
|
|
211
|
-
readonly name: "slice-documenter";
|
|
212
|
-
readonly description: "MANDATORY in PARALLEL with slice-implementer for every TDD slice (regardless of discoveryMode, v6.12.0 Phase R). Writes per-slice prose summary to `<artifacts-dir>/tdd-slices/S-<id>.md`. Does NOT implement, does NOT write tests. Linter rule `tdd_slice_documenter_missing` blocks the gate when a `phase=doc` event is missing for a green slice.";
|
|
213
|
-
readonly tools: ["Read", "Write", "Edit", "Grep", "Glob"];
|
|
214
|
-
readonly model: "fast";
|
|
215
202
|
readonly activation: "mandatory";
|
|
216
203
|
readonly relatedStages: ["tdd"];
|
|
217
|
-
readonly returnSchema:
|
|
218
|
-
readonly statusField: "status";
|
|
219
|
-
readonly allowedStatuses: ["DONE", "DONE_WITH_CONCERNS", "NEEDS_CONTEXT", "BLOCKED"];
|
|
220
|
-
readonly requiredFields: ["status", "summaryMd", "learnings", "evidenceRefs", "blockers"];
|
|
221
|
-
readonly evidenceFields: ["summaryMd", "evidenceRefs"];
|
|
222
|
-
};
|
|
204
|
+
readonly returnSchema: AgentReturnSchema;
|
|
223
205
|
readonly body: string;
|
|
224
206
|
}, {
|
|
225
207
|
readonly name: "fixer";
|
|
@@ -53,22 +53,19 @@ Before doing substantive work, return an ACK object that the parent can record:
|
|
|
53
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.`;
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
56
|
-
*
|
|
57
|
-
* `
|
|
58
|
-
*
|
|
59
|
-
* (on exit). This contract restores the v6.13.1 discipline that
|
|
60
|
-
* v6.14.0 dropped — the controller-side fix in v6.14.1's TDD skill
|
|
61
|
-
* text is paired with this worker-side self-record helper template.
|
|
56
|
+
* TDD worker self-record contract. The parent records `scheduled` and
|
|
57
|
+
* `launched` rows BEFORE dispatching the Task; the worker records
|
|
58
|
+
* `acknowledged` (on entry) and `completed` (on exit).
|
|
62
59
|
*/
|
|
63
60
|
function tddWorkerSelfRecordContract(agentName) {
|
|
64
|
-
const
|
|
65
|
-
const refactorOutcomeFlag =
|
|
61
|
+
const isBuilder = agentName === "slice-builder";
|
|
62
|
+
const refactorOutcomeFlag = isBuilder
|
|
66
63
|
? " --refactor-outcome=inline|deferred [--refactor-rationale=\"<why>\"]"
|
|
67
64
|
: "";
|
|
68
|
-
const laneFlags =
|
|
65
|
+
const laneFlags = isBuilder
|
|
69
66
|
? " [--claim-token=<t>] [--lane-id=<lane>] [--lease-until=<iso>]"
|
|
70
67
|
: "";
|
|
71
|
-
return `## TDD
|
|
68
|
+
return `## TDD worker delegation self-record contract
|
|
72
69
|
|
|
73
70
|
You are a TDD worker dispatched via \`Task\`. The parent already wrote your \`scheduled\` and \`launched\` ledger rows BEFORE invoking you. **Your responsibility is to self-record \`acknowledged\` on entry and \`completed\` on exit** by invoking \`.cclaw/hooks/delegation-record.mjs\` directly. Do NOT skip these — the controller depends on them, the linter validates them, and back-fill via \`--repair\` is reserved for recovery only.
|
|
74
71
|
|
|
@@ -100,7 +97,7 @@ node .cclaw/hooks/delegation-record.mjs \\
|
|
|
100
97
|
--json
|
|
101
98
|
\`\`\`
|
|
102
99
|
|
|
103
|
-
Reuse the same \`<spanId>\` and \`<dispatchId>\` across both rows. **
|
|
100
|
+
Reuse the same \`<spanId>\` and \`<dispatchId>\` across both rows. **GREEN evidence freshness** (slice-builder): the FIRST \`--evidence-ref\` MUST (1) reference the same test the matching \`phase=red\` row cited (basename/stem substring; reject \`green_evidence_red_test_mismatch\`), (2) include a recognized passing-runner line such as \`=> N passed; 0 failed\`, \`N passed in 0.42s\`, or \`ok pkg 0.12s\` (reject \`green_evidence_passing_assertion_missing\`), AND (3) be captured AFTER \`ackTs\` of this span — \`completedTs - ackTs\` must be ≥ \`flow-state.json::tddGreenMinElapsedMs\` (default 4000ms; reject \`green_evidence_too_fresh\`). Escape clause for legitimate observational GREEN: pass BOTH \`--allow-fast-green --green-mode=observational\`. \`--ack-ts\` and \`--completed-ts\` must be monotonic on the span (\`startTs ≤ launchedTs ≤ ackTs ≤ completedTs\`); the helper rejects out-of-order writes with \`delegation_timestamp_non_monotonic\`. If the helper rejects with \`dispatch_active_span_collision\` against a stale span, surface the conflicting \`spanId\` to the parent — do NOT silently retry with \`--allow-parallel\`.`;
|
|
104
101
|
}
|
|
105
102
|
function formatReturnSchema(schema) {
|
|
106
103
|
const lines = [
|
|
@@ -146,6 +143,29 @@ function activationModeSummary() {
|
|
|
146
143
|
proactive: [...proactive].join(", ")
|
|
147
144
|
};
|
|
148
145
|
}
|
|
146
|
+
/**
|
|
147
|
+
* Canonical slice-builder worker protocol text (embedded in the agent body and
|
|
148
|
+
* echoed in the TDD skill block).
|
|
149
|
+
*/
|
|
150
|
+
export function sliceBuilderProtocol() {
|
|
151
|
+
return [
|
|
152
|
+
"## slice-builder protocol",
|
|
153
|
+
"",
|
|
154
|
+
"**slice-builder** is the canonical worker for **one bounded vertical slice** end-to-end: **RED → GREEN → REFACTOR → inline DOC** in **one** delegated span. Multiple slice-builder spans run in parallel under a single wave when the wave plan declares disjoint `claimedPaths`.",
|
|
155
|
+
"",
|
|
156
|
+
"### Invariants",
|
|
157
|
+
"- Produce failing RED evidence (or cite the delegated RED artifact) **before** production edits.",
|
|
158
|
+
"- Stay inside the slice contract: `claimedPaths`, acceptance mapping, and forbidden-change lists from the parent.",
|
|
159
|
+
"- After GREEN, refactor inline **or** record deferred refactor via the same `--refactor-outcome` mechanics the controller specifies.",
|
|
160
|
+
"- Own the prose slice summary at `<artifacts-dir>/tdd-slices/S-<id>.md` yourself.",
|
|
161
|
+
"",
|
|
162
|
+
"### Events",
|
|
163
|
+
"- Honor every `delegation-record`/`delegation-record.mjs` row shape the controller requests so artifact linters keep passing.",
|
|
164
|
+
"- The umbrella `slice-completed` row ties RED/GREEN/REFACTOR/DOC timestamps to your builder span.",
|
|
165
|
+
"",
|
|
166
|
+
"**Role boundary:** do not widen scope, do not self-approve ship-level review, and do not recurse into other agents unless the parent explicitly directs it."
|
|
167
|
+
].join("\n");
|
|
168
|
+
}
|
|
149
169
|
/**
|
|
150
170
|
* Canonical specialist roster materialized under `.cclaw/agents/`.
|
|
151
171
|
*
|
|
@@ -496,7 +516,7 @@ export const CCLAW_AGENTS = [
|
|
|
496
516
|
body: [
|
|
497
517
|
"You are an **integration overseer** for TDD fan-out runs.",
|
|
498
518
|
"",
|
|
499
|
-
"You are dispatched after parallel `slice-
|
|
519
|
+
"You are dispatched after parallel `slice-builder` lanes complete.",
|
|
500
520
|
"",
|
|
501
521
|
"Checks:",
|
|
502
522
|
"- every integration test named in `cohesion-contract.md` passes (or has explicit gap rationale)",
|
|
@@ -510,27 +530,6 @@ export const CCLAW_AGENTS = [
|
|
|
510
530
|
"**Role boundary:** integration and cohesion oversight only; do NOT implement production code."
|
|
511
531
|
].join("\n")
|
|
512
532
|
},
|
|
513
|
-
{
|
|
514
|
-
name: "test-author",
|
|
515
|
-
description: "MANDATORY in TDD stage. MUST BE USED for RED -> GREEN -> REFACTOR with evidence-first discipline.",
|
|
516
|
-
tools: ["Read", "Write", "Edit", "Grep", "Glob", "Bash"],
|
|
517
|
-
model: "balanced",
|
|
518
|
-
activation: "mandatory",
|
|
519
|
-
relatedStages: ["tdd"],
|
|
520
|
-
returnSchema: WORKER_RETURN_SCHEMA,
|
|
521
|
-
body: [
|
|
522
|
-
"You are a **test-driven development** specialist.",
|
|
523
|
-
"",
|
|
524
|
-
"**Iron law:** no production code without a failing test first during RED. In design, focus on testability and verification evidence without editing production code.",
|
|
525
|
-
"",
|
|
526
|
-
"Process:",
|
|
527
|
-
"1. RED: write a failing test for the desired behavior.",
|
|
528
|
-
"2. Verify RED fails for the right reason.",
|
|
529
|
-
"3. GREEN: implement minimal code to pass.",
|
|
530
|
-
"4. Verify GREEN on relevant suite/full suite.",
|
|
531
|
-
"5. REFACTOR with behavior preserved."
|
|
532
|
-
].join("\n")
|
|
533
|
-
},
|
|
534
533
|
{
|
|
535
534
|
name: "release-reviewer",
|
|
536
535
|
description: "MANDATORY during ship. MUST BE USED for release readiness, rollback, finalization mode, evidence freshness, and victory detector checks.",
|
|
@@ -567,66 +566,23 @@ export const CCLAW_AGENTS = [
|
|
|
567
566
|
].join("\n")
|
|
568
567
|
},
|
|
569
568
|
{
|
|
570
|
-
name: "slice-
|
|
571
|
-
description: "
|
|
569
|
+
name: "slice-builder",
|
|
570
|
+
description: "MANDATORY for every TDD slice. Owns RED → GREEN → REFACTOR → per-slice DOC for one bounded vertical slice in a single delegated span. Multiple slice-builder spans run in parallel inside one wave when their `claimedPaths` are disjoint.",
|
|
572
571
|
tools: ["Read", "Write", "Edit", "Grep", "Glob", "Bash"],
|
|
573
572
|
model: "balanced",
|
|
574
|
-
activation: "
|
|
573
|
+
activation: "mandatory",
|
|
575
574
|
relatedStages: ["tdd"],
|
|
576
575
|
returnSchema: WORKER_RETURN_SCHEMA,
|
|
577
576
|
body: [
|
|
578
|
-
"You are
|
|
577
|
+
"You are **slice-builder**, the canonical vertical-slice TDD worker.",
|
|
579
578
|
"",
|
|
580
|
-
|
|
581
|
-
"- Requires RED evidence before production edits.",
|
|
582
|
-
"- Requires explicit file boundaries and acceptance mapping from the slice contract.",
|
|
579
|
+
sliceBuilderProtocol(),
|
|
583
580
|
"",
|
|
584
|
-
"**Mode
|
|
585
|
-
"-
|
|
586
|
-
"-
|
|
587
|
-
"",
|
|
588
|
-
"Rules:",
|
|
589
|
-
"1. Start only from the assigned RED failure and acceptance mapping.",
|
|
590
|
-
"2. Edit only the allowed files for the slice.",
|
|
591
|
-
"3. Implement the minimal GREEN change, then preserve behavior during REFACTOR.",
|
|
592
|
-
"4. Return files changed, tests run, evidence refs, concerns, and blockers.",
|
|
581
|
+
"**Mode hints:**",
|
|
582
|
+
"- **TDD-bound (default)** — RED evidence precedes GREEN; preserve behavior across REFACTOR; document outcomes in `tdd-slices/S-<id>.md`.",
|
|
583
|
+
"- **Generic** — only when the parent explicitly disables TDD gates for quick-track breadth; bounded scope and verification still apply.",
|
|
593
584
|
"",
|
|
594
|
-
"**Role boundary:**
|
|
595
|
-
].join("\n")
|
|
596
|
-
},
|
|
597
|
-
{
|
|
598
|
-
name: "slice-documenter",
|
|
599
|
-
description: "MANDATORY in PARALLEL with slice-implementer for every TDD slice (regardless of discoveryMode, v6.12.0 Phase R). Writes per-slice prose summary to `<artifacts-dir>/tdd-slices/S-<id>.md`. Does NOT implement, does NOT write tests. Linter rule `tdd_slice_documenter_missing` blocks the gate when a `phase=doc` event is missing for a green slice.",
|
|
600
|
-
tools: ["Read", "Write", "Edit", "Grep", "Glob"],
|
|
601
|
-
model: "fast",
|
|
602
|
-
activation: "mandatory",
|
|
603
|
-
relatedStages: ["tdd"],
|
|
604
|
-
returnSchema: {
|
|
605
|
-
statusField: "status",
|
|
606
|
-
allowedStatuses: ["DONE", "DONE_WITH_CONCERNS", "NEEDS_CONTEXT", "BLOCKED"],
|
|
607
|
-
requiredFields: ["status", "summaryMd", "learnings", "evidenceRefs", "blockers"],
|
|
608
|
-
evidenceFields: ["summaryMd", "evidenceRefs"]
|
|
609
|
-
},
|
|
610
|
-
body: [
|
|
611
|
-
"You are a **slice-documenter** dispatched in PARALLEL with `slice-implementer` for the same slice.",
|
|
612
|
-
"",
|
|
613
|
-
"**Mission:** capture per-slice prose summary while production code is being written.",
|
|
614
|
-
"Because your only `claimedPath` is `<artifacts-dir>/tdd-slices/S-<id>.md` and the implementer's `claimedPaths` are production code, the file-overlap scheduler auto-allows the parallel dispatch.",
|
|
615
|
-
"",
|
|
616
|
-
"When invoked:",
|
|
617
|
-
"1. Read the active plan unit, acceptance criterion, and the failing RED test for this slice.",
|
|
618
|
-
"2. Write a thin per-slice file at `<artifacts-dir>/tdd-slices/S-<id>.md` with the headings:",
|
|
619
|
-
" - `# Slice S-<id>`",
|
|
620
|
-
" - `## Plan unit` (T-... pointer)",
|
|
621
|
-
" - `## Acceptance criteria` (AC-... ids)",
|
|
622
|
-
" - `## Why this slice`",
|
|
623
|
-
" - `## What was tested`",
|
|
624
|
-
" - `## What was implemented`",
|
|
625
|
-
" - `## REFACTOR notes`",
|
|
626
|
-
" - `## Learnings`",
|
|
627
|
-
"3. Return JSON: `{ status, summaryMd, learnings: string[], evidenceRefs: [\"<artifacts-dir>/tdd-slices/S-<id>.md\"], blockers: [] }`.",
|
|
628
|
-
"",
|
|
629
|
-
"**Forbidden:** edit `06-tdd.md`, test files, or production code. Edit ONLY your slice file."
|
|
585
|
+
"**Role boundary:** obey the parent's phase flags (`--phase=red|green|refactor|doc`); never improvise undeclared parallelism."
|
|
630
586
|
].join("\n")
|
|
631
587
|
},
|
|
632
588
|
{
|
|
@@ -651,15 +607,12 @@ export const CCLAW_AGENTS = [
|
|
|
651
607
|
}
|
|
652
608
|
];
|
|
653
609
|
/**
|
|
654
|
-
*
|
|
655
|
-
*
|
|
656
|
-
*
|
|
657
|
-
* responsible for `acknowledged` and `completed` ledger writes.
|
|
610
|
+
* Agents whose rendered `.cclaw/agents/<name>.md` file gets the TDD worker
|
|
611
|
+
* self-record helper template. Controllers dispatch these via `Task` during
|
|
612
|
+
* TDD; they own `acknowledged` and `completed` ledger writes.
|
|
658
613
|
*/
|
|
659
614
|
const TDD_WORKER_SELF_RECORD_AGENTS = new Set([
|
|
660
|
-
"
|
|
661
|
-
"slice-implementer",
|
|
662
|
-
"slice-documenter",
|
|
615
|
+
"slice-builder",
|
|
663
616
|
"integration-overseer"
|
|
664
617
|
]);
|
|
665
618
|
import { stageDelegationSummary } from "./stage-schema.js";
|
|
@@ -751,7 +704,7 @@ export function agentCostTierTable() {
|
|
|
751
704
|
return `| Tier | Use for | Example agents |
|
|
752
705
|
|---|---|---|
|
|
753
706
|
| \`deep\` | one heavy planning/strategy pass per stage | planner, product-discovery |
|
|
754
|
-
| \`balanced\` | discovery, criticism, review, TDD, and bounded worker execution | critic, spec-document-reviewer, coherence-reviewer, scope-guardian-reviewer, feasibility-reviewer, reviewer, security-reviewer,
|
|
707
|
+
| \`balanced\` | discovery, criticism, review, TDD, and bounded worker execution | critic, spec-document-reviewer, coherence-reviewer, scope-guardian-reviewer, feasibility-reviewer, reviewer, security-reviewer, slice-builder, fixer |
|
|
755
708
|
| \`fast\` | bounded maintenance updates with limited blast radius | doc-updater |
|
|
756
709
|
`;
|
|
757
710
|
}
|
|
@@ -770,7 +723,8 @@ ${rows}`;
|
|
|
770
723
|
export function agentsAgentsMdBlock() {
|
|
771
724
|
return `### Agent Specialists
|
|
772
725
|
|
|
773
|
-
cclaw
|
|
726
|
+
cclaw defines specialist personas for \`.cclaw/agents/\`: ${CCLAW_AGENTS.map((agent) => agent.name).join(", ")}.
|
|
727
|
+
**TDD work** is owned end-to-end by **slice-builder** — one worker per slice, multiple workers in parallel within a wave when \`claimedPaths\` are disjoint.
|
|
774
728
|
|
|
775
729
|
${agentRoutingTable()}
|
|
776
730
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { FlowStage } from "../types.js";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* short bad → good behavior anchor per stage.
|
|
4
4
|
*
|
|
5
5
|
* Each entry is rendered exactly once in the corresponding stage skill md
|
|
6
6
|
* (via `behaviorAnchorBlock` in `skills.ts`) and exactly once in the stage's
|
package/dist/content/examples.js
CHANGED
|
@@ -36,10 +36,10 @@ export const BEHAVIOR_ANCHORS = [
|
|
|
36
36
|
},
|
|
37
37
|
{
|
|
38
38
|
stage: "tdd",
|
|
39
|
-
section: "
|
|
40
|
-
bad: "Controller
|
|
41
|
-
good: "
|
|
42
|
-
ruleHint: "
|
|
39
|
+
section: "RED Evidence",
|
|
40
|
+
bad: "Controller edits production code or per-slice prose directly, skips ledger rows, then hand-edits auto-render tables. Slice workers never ran; lint blocks on missing span history.",
|
|
41
|
+
good: "`Task(\"slice-builder --slice S-1 --paths …\")` when major ≥7; otherwise the historical trio must still log `phase=red|green|doc` rows. Controller records before dispatch; linter mirrors history into auto-render blocks.",
|
|
42
|
+
ruleHint: "Wave-status first, record-before-dispatch, one delegated worker owns RED→GREEN→REFACTOR→slice doc; controller stays out of production edits."
|
|
43
43
|
},
|
|
44
44
|
{
|
|
45
45
|
stage: "review",
|