cclaw-cli 0.15.1 → 0.18.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/dist/artifact-linter.js +154 -0
- package/dist/cli.js +2 -1
- package/dist/constants.d.ts +2 -2
- package/dist/constants.js +2 -3
- package/dist/content/contracts.js +1 -1
- package/dist/content/doctor-references.js +7 -6
- package/dist/content/feature-command.js +54 -51
- package/dist/content/harnesses-doc.js +2 -2
- package/dist/content/hooks.js +2 -2
- package/dist/content/learnings.d.ts +1 -1
- package/dist/content/learnings.js +22 -5
- package/dist/content/meta-skill.js +2 -2
- package/dist/content/next-command.js +2 -2
- package/dist/content/observe.js +3 -2
- package/dist/content/ops-command.js +1 -3
- package/dist/content/protocols.js +6 -34
- package/dist/content/rewind-command.d.ts +0 -1
- package/dist/content/rewind-command.js +19 -33
- package/dist/content/skills.js +2 -3
- package/dist/content/stage-schema.js +3 -38
- package/dist/content/stages/plan.js +16 -5
- package/dist/content/stages/scope.js +9 -3
- package/dist/content/stages/tdd.js +5 -4
- package/dist/content/templates.js +105 -9
- package/dist/content/utility-skills.js +1 -1
- package/dist/delegation.d.ts +33 -3
- package/dist/delegation.js +56 -3
- package/dist/doctor.js +147 -88
- package/dist/feature-system.d.ts +22 -5
- package/dist/feature-system.js +267 -126
- package/dist/install.js +4 -8
- package/dist/policy.js +3 -4
- package/package.json +1 -1
|
@@ -90,42 +90,14 @@ Before adding new code/templates/rules:
|
|
|
90
90
|
- Evidence beats volume.
|
|
91
91
|
- Keep stage output concrete and testable.
|
|
92
92
|
|
|
93
|
-
##
|
|
93
|
+
## Turn announce discipline
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
Do not duplicate preamble rules in AGENTS.md, harness adapters, or stage-local docs.
|
|
95
|
+
Keep orchestration visible without maintaining a dedicated preamble runtime log.
|
|
97
96
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
| Stage transition | \`flow-state.currentStage\` changes in this turn |
|
|
103
|
-
| Non-trivial implementation turn | agent is about to run source-editing tools outside \`.cclaw/\` |
|
|
104
|
-
| Multi-step risky operation | planned sequence contains 2+ commands with rollback/risk potential |
|
|
105
|
-
|
|
106
|
-
### Skip when
|
|
107
|
-
|
|
108
|
-
| Skip reason | Condition |
|
|
109
|
-
|---|---|
|
|
110
|
-
| Pure Q&A | no filesystem or runtime mutation planned |
|
|
111
|
-
| Trivial change | single low-risk edit with no stage or plan drift |
|
|
112
|
-
| Subagent dispatch payload | prompt is for spawned agent/tool call only |
|
|
113
|
-
| Cooldown hit | same stage + same trigger emitted within cooldown window |
|
|
114
|
-
|
|
115
|
-
### Form contract (max 4 lines)
|
|
116
|
-
|
|
117
|
-
1. \`Stage:\` current stage id
|
|
118
|
-
2. \`Goal:\` concrete objective for this turn
|
|
119
|
-
3. \`Plan:\` next 1-3 actions
|
|
120
|
-
4. \`Guardrails:\` key constraints / non-goals
|
|
121
|
-
|
|
122
|
-
### Cooldown
|
|
123
|
-
|
|
124
|
-
- Record each emitted preamble in \`.cclaw/state/preamble-log.jsonl\` as JSON line:
|
|
125
|
-
\`{"ts","stage","runId","trigger","hash"}\`.
|
|
126
|
-
- Default cooldown: 15 minutes for identical \`stage + trigger + hash\`.
|
|
127
|
-
- TDD wave mode uses stricter dedupe: one preamble per wave unless scope changes.
|
|
128
|
-
- If the plan changes materially, a new preamble is allowed inside cooldown.
|
|
97
|
+
- Start substantial turns with a 1-2 sentence announce: current stage, intent, next action.
|
|
98
|
+
- Skip announce for trivial single-command actions.
|
|
99
|
+
- Never repeat boilerplate announces when the intent did not change.
|
|
100
|
+
- If plan or risk changes materially, post a fresh announce before executing.
|
|
129
101
|
|
|
130
102
|
## Operational learning
|
|
131
103
|
|
|
@@ -15,7 +15,8 @@ export function rewindCommandContract() {
|
|
|
15
15
|
|
|
16
16
|
## Purpose
|
|
17
17
|
|
|
18
|
-
Rewind active flow to an earlier stage
|
|
18
|
+
Rewind active flow to an earlier stage, or acknowledge stale markers after
|
|
19
|
+
intentional rework.
|
|
19
20
|
|
|
20
21
|
## HARD-GATE
|
|
21
22
|
|
|
@@ -26,9 +27,12 @@ Rewind active flow to an earlier stage and atomically invalidate downstream work
|
|
|
26
27
|
## Inputs
|
|
27
28
|
|
|
28
29
|
\`/cc-ops rewind <target-stage> [reason]\`
|
|
30
|
+
or
|
|
31
|
+
\`/cc-ops rewind --ack <stage>\`
|
|
29
32
|
|
|
30
33
|
## Algorithm
|
|
31
34
|
|
|
35
|
+
### rewind mode
|
|
32
36
|
1. Read \`${flowStatePath()}\` and current track.
|
|
33
37
|
2. Validate \`target-stage\` belongs to the active track and is not ahead of current stage.
|
|
34
38
|
3. Compute downstream stages to invalidate (all stages after target that were completed or current).
|
|
@@ -42,42 +46,24 @@ Rewind active flow to an earlier stage and atomically invalidate downstream work
|
|
|
42
46
|
- append \`rewinds[]\` record
|
|
43
47
|
7. Append JSON line to \`${rewindLogPath()}\`.
|
|
44
48
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
- Rewind id
|
|
48
|
-
- from -> to stage
|
|
49
|
-
- Invalidated stages list
|
|
50
|
-
- Number of stale artifacts
|
|
51
|
-
|
|
52
|
-
## Primary skill
|
|
53
|
-
|
|
54
|
-
**${RUNTIME_ROOT}/skills/${REWIND_SKILL_FOLDER}/SKILL.md**
|
|
55
|
-
`;
|
|
56
|
-
}
|
|
57
|
-
export function rewindAcknowledgeCommandContract() {
|
|
58
|
-
return `# /cc-ops rewind-ack
|
|
59
|
-
|
|
60
|
-
## Purpose
|
|
61
|
-
|
|
62
|
-
Acknowledge and clear stale-stage markers after downstream work is intentionally redone.
|
|
63
|
-
|
|
64
|
-
## Input
|
|
65
|
-
|
|
66
|
-
\`/cc-ops rewind-ack <stage>\`
|
|
67
|
-
|
|
68
|
-
## HARD-GATE
|
|
69
|
-
|
|
70
|
-
- Only clear stale marker for the requested stage.
|
|
71
|
-
- Never modify completedStages from this command.
|
|
72
|
-
|
|
73
|
-
## Algorithm
|
|
74
|
-
|
|
49
|
+
### acknowledge mode (\`--ack\`)
|
|
75
50
|
1. Read \`${flowStatePath()}\`.
|
|
76
51
|
2. If \`staleStages.<stage>\` is missing, report no-op.
|
|
77
52
|
3. Remove \`staleStages.<stage>\`.
|
|
78
53
|
4. Write updated flow-state.
|
|
79
54
|
5. Print remaining stale stages (if any).
|
|
80
55
|
|
|
56
|
+
## Output
|
|
57
|
+
|
|
58
|
+
- In rewind mode:
|
|
59
|
+
- rewind id
|
|
60
|
+
- from -> to stage
|
|
61
|
+
- invalidated stages list
|
|
62
|
+
- number of stale artifacts
|
|
63
|
+
- In acknowledge mode:
|
|
64
|
+
- acknowledged stage
|
|
65
|
+
- remaining stale stages
|
|
66
|
+
|
|
81
67
|
## Primary skill
|
|
82
68
|
|
|
83
69
|
**${RUNTIME_ROOT}/skills/${REWIND_SKILL_FOLDER}/SKILL.md**
|
|
@@ -89,7 +75,7 @@ name: ${REWIND_SKILL_NAME}
|
|
|
89
75
|
description: "Rewind active flow stage safely and acknowledge stale invalidations."
|
|
90
76
|
---
|
|
91
77
|
|
|
92
|
-
# /cc-ops rewind
|
|
78
|
+
# /cc-ops rewind
|
|
93
79
|
|
|
94
80
|
## HARD-GATE
|
|
95
81
|
|
|
@@ -105,7 +91,7 @@ Rewind is an atomic state transition. Never leave flow-state half-updated (for e
|
|
|
105
91
|
5. Record \`rewinds[]\` and \`staleStages\` in flow-state.
|
|
106
92
|
6. Append rewind entry into \`${rewindLogPath()}\`.
|
|
107
93
|
|
|
108
|
-
### rewind
|
|
94
|
+
### rewind --ack <stage>
|
|
109
95
|
1. Load flow-state stale map.
|
|
110
96
|
2. Remove exactly one stale stage marker.
|
|
111
97
|
3. Report remaining stale stages.
|
package/dist/content/skills.js
CHANGED
|
@@ -108,9 +108,8 @@ function waveExecutionModeBlock(stage) {
|
|
|
108
108
|
|
|
109
109
|
Execute the current dependency wave task-by-task (RED -> GREEN -> REFACTOR).
|
|
110
110
|
Stop on BLOCKED status or when user input is required.
|
|
111
|
-
Apply
|
|
112
|
-
|
|
113
|
-
plan changes materially.
|
|
111
|
+
Apply concise turn announces: one announce per wave boundary (or when risk/plan
|
|
112
|
+
changes materially), then execute tasks without repetitive boilerplate.
|
|
114
113
|
|
|
115
114
|
Detailed walkthrough:
|
|
116
115
|
\`.cclaw/${STAGE_EXAMPLES_REFERENCE_DIR}/tdd-wave-walkthrough.md\`
|
|
@@ -59,14 +59,6 @@ const REQUIRED_GATE_IDS = {
|
|
|
59
59
|
"ship_finalization_executed"
|
|
60
60
|
]
|
|
61
61
|
};
|
|
62
|
-
const CONDITIONAL_GATE_RULES = {
|
|
63
|
-
review: {
|
|
64
|
-
review_security_audit_swept: "diff_lines_gt:100||files_touched_gt:10||trust_boundary_changed"
|
|
65
|
-
},
|
|
66
|
-
ship: {
|
|
67
|
-
ship_post_merge_tests: "files_touched_gt:10||release_blast_radius_high"
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
62
|
const REQUIRED_ARTIFACT_SECTIONS = {
|
|
71
63
|
brainstorm: ["Context", "Problem", "Approaches", "Selected Direction"],
|
|
72
64
|
scope: ["Scope Mode", "In Scope / Out of Scope", "Completion Dashboard", "Scope Summary"],
|
|
@@ -77,26 +69,9 @@ const REQUIRED_ARTIFACT_SECTIONS = {
|
|
|
77
69
|
review: ["Layer 1 Verdict", "Review Army Contract", "Severity Summary", "Final Verdict"],
|
|
78
70
|
ship: ["Preflight Results", "Release Notes", "Rollback Plan", "Finalization"]
|
|
79
71
|
};
|
|
80
|
-
const CONDITIONAL_ARTIFACT_RULES = {
|
|
81
|
-
review: {
|
|
82
|
-
"Review Readiness Dashboard": "diff_lines_gt:100||files_touched_gt:10||trust_boundary_changed"
|
|
83
|
-
},
|
|
84
|
-
ship: {
|
|
85
|
-
Monitoring: "release_blast_radius_high"
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
72
|
function tieredStageGates(stage, gates) {
|
|
89
73
|
const requiredSet = new Set(REQUIRED_GATE_IDS[stage]);
|
|
90
|
-
const conditional = CONDITIONAL_GATE_RULES[stage] ?? {};
|
|
91
74
|
return gates.map((gate) => {
|
|
92
|
-
const condition = conditional[gate.id];
|
|
93
|
-
if (condition) {
|
|
94
|
-
return {
|
|
95
|
-
...gate,
|
|
96
|
-
tier: "conditional",
|
|
97
|
-
condition
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
75
|
return {
|
|
101
76
|
...gate,
|
|
102
77
|
tier: requiredSet.has(gate.id) ? "required" : "recommended"
|
|
@@ -105,17 +80,7 @@ function tieredStageGates(stage, gates) {
|
|
|
105
80
|
}
|
|
106
81
|
function tieredArtifactValidation(stage, rows) {
|
|
107
82
|
const requiredSections = new Set(REQUIRED_ARTIFACT_SECTIONS[stage]);
|
|
108
|
-
const conditional = CONDITIONAL_ARTIFACT_RULES[stage] ?? {};
|
|
109
83
|
return rows.map((row) => {
|
|
110
|
-
const condition = conditional[row.section];
|
|
111
|
-
if (condition) {
|
|
112
|
-
return {
|
|
113
|
-
...row,
|
|
114
|
-
tier: "conditional",
|
|
115
|
-
condition,
|
|
116
|
-
required: false
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
84
|
const required = requiredSections.has(row.section);
|
|
120
85
|
return {
|
|
121
86
|
...row,
|
|
@@ -291,9 +256,9 @@ export function stageRecommendedGateIds(stage) {
|
|
|
291
256
|
.map((gate) => gate.id);
|
|
292
257
|
}
|
|
293
258
|
export function stageConditionalGateIds(stage) {
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
259
|
+
// Conditional gate DSL removed in favor of explicit required/recommended tiers.
|
|
260
|
+
void stage;
|
|
261
|
+
return [];
|
|
297
262
|
}
|
|
298
263
|
export function nextCclawCommand(stage) {
|
|
299
264
|
const next = stageSchema(stage).next;
|
|
@@ -25,6 +25,8 @@ export const PLAN = {
|
|
|
25
25
|
"Group tasks into dependency waves — wave N+1 cannot start until wave N has verification evidence.",
|
|
26
26
|
"Slice into vertical tasks — each task targets 2-5 minutes, produces one testable outcome, and touches one coherent area.",
|
|
27
27
|
"Attach verification — every task has an acceptance criterion mapping and a concrete verification command.",
|
|
28
|
+
"Map scope Locked Decisions — every D-XX from scope is referenced by at least one plan task (or explicitly marked deferred with reason).",
|
|
29
|
+
"Run anti-placeholder + anti-scope-reduction scans — block `TODO/TBD/...` and phrasing like `v1`, `for now`, `later` for locked boundaries.",
|
|
28
30
|
"Define checkpoints — mark points where progress should be validated before continuing.",
|
|
29
31
|
"WAIT_FOR_CONFIRM — write plan artifact and explicitly pause. **STOP.** Do NOT proceed until user confirms. Then update `flow-state.json` and tell user to run `/cc-next`."
|
|
30
32
|
],
|
|
@@ -33,6 +35,7 @@ export const PLAN = {
|
|
|
33
35
|
"Split work into small vertical slices (target 2-5 minute tasks).",
|
|
34
36
|
"Publish explicit dependency waves with entry and exit checks for each wave.",
|
|
35
37
|
"Attach verification step to every task.",
|
|
38
|
+
"Preserve locked scope boundaries: no silent scope reduction language in task rows.",
|
|
36
39
|
"Enforce WAIT_FOR_CONFIRM: present the plan summary with options (A) Approve / (B) Revise / (C) Reject.",
|
|
37
40
|
"**STOP.** Do NOT proceed until user explicitly approves. Then update `flow-state.json` and tell user to run `/cc-next`."
|
|
38
41
|
],
|
|
@@ -40,6 +43,7 @@ export const PLAN = {
|
|
|
40
43
|
"Build dependency graph and ordered slices.",
|
|
41
44
|
"Group slices into execution waves and define gate criteria per wave.",
|
|
42
45
|
"Define each task with acceptance mapping and verification commands.",
|
|
46
|
+
"Trace every locked decision (D-XX) to plan tasks or explicit defer rationale.",
|
|
43
47
|
"Record checkpoints and blockers.",
|
|
44
48
|
"Write plan artifact and pause at WAIT_FOR_CONFIRM."
|
|
45
49
|
],
|
|
@@ -54,6 +58,7 @@ export const PLAN = {
|
|
|
54
58
|
requiredEvidence: [
|
|
55
59
|
"Artifact written to `.cclaw/artifacts/05-plan.md`.",
|
|
56
60
|
"Task list includes acceptance mapping.",
|
|
61
|
+
"Locked decision coverage table present with D-XX trace links.",
|
|
57
62
|
"Dependency graph documented.",
|
|
58
63
|
"Dependency waves documented with wave-by-wave verification gates.",
|
|
59
64
|
"WAIT_FOR_CONFIRM status recorded."
|
|
@@ -69,6 +74,7 @@ export const PLAN = {
|
|
|
69
74
|
"tasks too broad",
|
|
70
75
|
"dependency uncertainty unresolved",
|
|
71
76
|
"wave boundaries are unclear",
|
|
77
|
+
"locked decisions from scope are not mapped to tasks",
|
|
72
78
|
"no explicit confirmation"
|
|
73
79
|
],
|
|
74
80
|
exitCriteria: [
|
|
@@ -81,16 +87,19 @@ export const PLAN = {
|
|
|
81
87
|
"Horizontal decomposition without end-to-end slices",
|
|
82
88
|
"Tasks without verification steps",
|
|
83
89
|
"Starting execution before approval",
|
|
84
|
-
"Tasks that touch multiple unrelated areas"
|
|
90
|
+
"Tasks that touch multiple unrelated areas",
|
|
91
|
+
"Using placeholder tokens or scope-reduction phrases (`v1`, `for now`, `later`) in task definitions"
|
|
85
92
|
],
|
|
86
93
|
redFlags: [
|
|
87
94
|
"No dependency graph",
|
|
88
95
|
"No WAIT_FOR_CONFIRM marker",
|
|
89
96
|
"No explicit dependency waves",
|
|
90
97
|
"Tasks exceed one coherent outcome",
|
|
91
|
-
"No acceptance mapping"
|
|
98
|
+
"No acceptance mapping",
|
|
99
|
+
"Locked decisions are missing or not mapped",
|
|
100
|
+
"Scope-reduction language appears without explicit approved defer decision"
|
|
92
101
|
],
|
|
93
|
-
policyNeedles: ["WAIT_FOR_CONFIRM", "Task Graph", "Dependency Waves", "Acceptance Mapping", "verification steps"],
|
|
102
|
+
policyNeedles: ["WAIT_FOR_CONFIRM", "Task Graph", "Dependency Waves", "Acceptance Mapping", "verification steps", "Locked Decision Coverage"],
|
|
94
103
|
artifactFile: "05-plan.md",
|
|
95
104
|
next: "tdd",
|
|
96
105
|
reviewSections: [
|
|
@@ -131,16 +140,18 @@ export const PLAN = {
|
|
|
131
140
|
crossStageTrace: {
|
|
132
141
|
readsFrom: [".cclaw/artifacts/04-spec.md", ".cclaw/artifacts/03-design.md", ".cclaw/artifacts/02-scope.md"],
|
|
133
142
|
writesTo: [".cclaw/artifacts/05-plan.md"],
|
|
134
|
-
traceabilityRule: "Every task must trace to a spec acceptance criterion. Every downstream RED test must trace to a plan task."
|
|
143
|
+
traceabilityRule: "Every task must trace to a spec acceptance criterion. Every locked scope decision (D-XX) must trace to at least one plan task or explicit defer rationale. Every downstream RED test must trace to a plan task."
|
|
135
144
|
},
|
|
136
145
|
artifactValidation: [
|
|
137
146
|
{ section: "Dependency Graph", required: true, validationRule: "Ordering and parallel opportunities explicit. No circular dependencies." },
|
|
138
147
|
{ section: "Dependency Waves", required: true, validationRule: "Every task belongs to a wave. Each wave has an exit gate and dependency statement." },
|
|
139
148
|
{ section: "Task List", required: true, validationRule: "Each task row includes ID, description, acceptance criterion, verification command, and effort estimate (S/M/L). Every task must also carry a minutes estimate within the 2-5 minute budget." },
|
|
140
149
|
{ section: "Acceptance Mapping", required: true, validationRule: "Every spec criterion is covered by at least one task." },
|
|
150
|
+
{ section: "Locked Decision Coverage", required: false, validationRule: "Every locked decision ID (D-XX) from scope is listed with linked task IDs or explicit defer rationale." },
|
|
141
151
|
{ section: "Risk Assessment", required: false, validationRule: "If present: per-task or per-wave risk identification with likelihood, impact, and mitigation strategy." },
|
|
142
152
|
{ section: "Boundary Map", required: false, validationRule: "If present: per-wave or per-task interface contracts listing what each task produces (exports) and consumes (imports) from other tasks." },
|
|
143
153
|
{ section: "WAIT_FOR_CONFIRM", required: true, validationRule: "Explicit marker present. Status: pending until user approves." },
|
|
144
|
-
{ section: "No-Placeholder Scan", required: false, validationRule: "
|
|
154
|
+
{ section: "No-Placeholder Scan", required: false, validationRule: "Confirmation that a text scan for `TODO`, `TBD`, `FIXME`, `<fill-in>`, `<your-*-here>`, `xxx`, or bare ellipses has zero hits in the task list. A placeholder is a deferred decision masquerading as a plan." },
|
|
155
|
+
{ section: "No Scope Reduction Language Scan", required: false, validationRule: "Confirmation that scope-reduction phrases (`v1`, `for now`, `later`, `temporary`, `placeholder`) are absent from task rows when locked decisions exist." }
|
|
145
156
|
]
|
|
146
157
|
};
|
|
@@ -50,6 +50,7 @@ export const SCOPE = {
|
|
|
50
50
|
"Run mode-specific analysis that matches the selected scope mode.",
|
|
51
51
|
"Walk through scope review sections one at a time.",
|
|
52
52
|
"Write explicit scope contract, discretion areas, and deferred items.",
|
|
53
|
+
"Freeze non-negotiable boundaries as stable Locked Decisions (D-XX IDs).",
|
|
53
54
|
"Produce scope summary plus completion dashboard (checklist findings, number of resolved decisions, unresolved items or `None`)."
|
|
54
55
|
],
|
|
55
56
|
requiredGates: [
|
|
@@ -65,6 +66,7 @@ export const SCOPE = {
|
|
|
65
66
|
"In-scope and out-of-scope lists are explicit.",
|
|
66
67
|
"Discretion areas are explicit (or marked as `None`).",
|
|
67
68
|
"Selected mode and rationale are documented.",
|
|
69
|
+
"Locked Decisions section lists stable D-XX IDs for non-negotiable boundaries.",
|
|
68
70
|
"Premise challenge findings documented.",
|
|
69
71
|
"Deferred items list with one-line rationale for each.",
|
|
70
72
|
"Completion dashboard lists checklist findings, decision count, and unresolved items (or `None`)."
|
|
@@ -90,6 +92,7 @@ export const SCOPE = {
|
|
|
90
92
|
"discretion areas recorded explicitly",
|
|
91
93
|
"required gates marked satisfied",
|
|
92
94
|
"deferred list recorded explicitly",
|
|
95
|
+
"locked decisions captured with stable D-XX IDs",
|
|
93
96
|
"completion dashboard produced",
|
|
94
97
|
"scope summary produced"
|
|
95
98
|
],
|
|
@@ -100,7 +103,8 @@ export const SCOPE = {
|
|
|
100
103
|
"Sycophantic agreement without evidence-based pushback",
|
|
101
104
|
"Hedged recommendations that avoid taking a position",
|
|
102
105
|
"Batching multiple scope issues into one question",
|
|
103
|
-
"Re-arguing for smaller scope after user rejects reduction"
|
|
106
|
+
"Re-arguing for smaller scope after user rejects reduction",
|
|
107
|
+
"Using scope-reduction placeholders (`v1`, `for now`, `we can do later`) instead of explicit user-approved boundaries"
|
|
104
108
|
],
|
|
105
109
|
redFlags: [
|
|
106
110
|
"No selected mode in artifact",
|
|
@@ -109,9 +113,10 @@ export const SCOPE = {
|
|
|
109
113
|
"No deferred/not-in-scope section",
|
|
110
114
|
"No user approval marker",
|
|
111
115
|
"Premise challenge missing or superficial",
|
|
112
|
-
"No implementation alternatives evaluated"
|
|
116
|
+
"No implementation alternatives evaluated",
|
|
117
|
+
"Missing Locked Decisions section or decisions without D-XX IDs"
|
|
113
118
|
],
|
|
114
|
-
policyNeedles: ["Scope mode", "In Scope", "Out of Scope", "Discretion Areas", "NOT in scope", "Premise Challenge"],
|
|
119
|
+
policyNeedles: ["Scope mode", "In Scope", "Out of Scope", "Discretion Areas", "NOT in scope", "Premise Challenge", "Locked Decisions"],
|
|
115
120
|
artifactFile: "02-scope.md",
|
|
116
121
|
next: "design",
|
|
117
122
|
reviewSections: [
|
|
@@ -173,6 +178,7 @@ export const SCOPE = {
|
|
|
173
178
|
{ section: "Prime Directives", required: true, validationRule: "For each scoped capability: named failure modes, explicit error surface, four data-flow paths, interaction edge cases, observability expectations, and deferred-item handling." },
|
|
174
179
|
{ section: "Premise Challenge", required: true, validationRule: "Must contain explicit answers to: right problem? direct path? what if nothing?" },
|
|
175
180
|
{ section: "Requirements", required: true, validationRule: "Table of stable requirement IDs (R1, R2, R3…) one per row with observable outcome, priority, and source. IDs are assigned once and never renumbered across scope/design/spec/plan/review; dropped requirements stay with Priority `DROPPED`." },
|
|
181
|
+
{ section: "Locked Decisions (D-XX)", required: false, validationRule: "List of stable locked decisions with IDs D-01, D-02... Each ID appears once, includes rationale, and is intended for downstream cross-stage traceability." },
|
|
176
182
|
{ section: "Implementation Alternatives", required: true, validationRule: "2-3 options with Name, Summary, Effort, Risk, Pros, Cons, and Reuses. Must include minimal viable and ideal architecture options." },
|
|
177
183
|
{ section: "Scope Mode", required: true, validationRule: "Must state selected mode and rationale with default heuristic justification." },
|
|
178
184
|
{ section: "Mode-Specific Analysis", required: true, validationRule: "Must document the analysis matching the selected scope mode: EXPAND (10x and delight opportunities), SELECTIVE (hold-scope baseline then cherry-picked expansions), HOLD (minimum-change-set hardening), REDUCE (ruthless cuts and follow-up split)." },
|
|
@@ -22,9 +22,9 @@ export const TDD = {
|
|
|
22
22
|
checklist: [
|
|
23
23
|
"Select plan slice — pick one task from the plan. Do not batch multiple tasks.",
|
|
24
24
|
"Map to acceptance criterion — identify the specific spec criterion this test proves.",
|
|
25
|
-
"
|
|
25
|
+
"Dispatch mandatory `test-author` subagent in `TEST_RED_ONLY` mode — produce failing behavior tests and RED evidence only (no production edits).",
|
|
26
26
|
"RED: Capture failure output — copy the exact failure output as RED evidence. Record in artifact.",
|
|
27
|
-
"
|
|
27
|
+
"Dispatch `test-author` subagent in `BUILD_GREEN_REFACTOR` mode — minimal implementation + full-suite GREEN + refactor notes.",
|
|
28
28
|
"GREEN: Run full suite — execute ALL tests, not just the ones you wrote. The full suite must be GREEN.",
|
|
29
29
|
"GREEN: Verify no regressions — if any existing test breaks, fix the regression before proceeding.",
|
|
30
30
|
"REFACTOR: Improve code quality — without changing behavior. Document what you changed and why.",
|
|
@@ -34,6 +34,7 @@ export const TDD = {
|
|
|
34
34
|
],
|
|
35
35
|
interactionProtocol: [
|
|
36
36
|
"Pick one planned slice at a time.",
|
|
37
|
+
"Controller owns orchestration; execution runs through the mandatory `test-author` delegation for RED then GREEN/REFACTOR modes.",
|
|
37
38
|
"Write behavior-focused tests before changing implementation (RED).",
|
|
38
39
|
"Capture and store failing output as RED evidence.",
|
|
39
40
|
"Apply minimal change to satisfy RED tests (GREEN).",
|
|
@@ -44,9 +45,9 @@ export const TDD = {
|
|
|
44
45
|
],
|
|
45
46
|
process: [
|
|
46
47
|
"Select slice and map to acceptance criterion.",
|
|
47
|
-
"
|
|
48
|
+
"Dispatch `test-author` in TEST_RED_ONLY mode and produce failing test(s) for expected reason (RED).",
|
|
48
49
|
"Run tests and capture failure output.",
|
|
49
|
-
"
|
|
50
|
+
"Dispatch `test-author` in BUILD_GREEN_REFACTOR mode and implement smallest change needed for GREEN.",
|
|
50
51
|
"Run full tests and build checks.",
|
|
51
52
|
"Perform refactor pass preserving behavior.",
|
|
52
53
|
"Record RED, GREEN, and REFACTOR evidence in artifact.",
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import { COMMAND_FILE_ORDER } from "../constants.js";
|
|
2
2
|
import { orderedStageSchemas } from "./stage-schema.js";
|
|
3
3
|
export const ARTIFACT_TEMPLATES = {
|
|
4
|
-
"01-brainstorm.md":
|
|
4
|
+
"01-brainstorm.md": `---
|
|
5
|
+
stage: brainstorm
|
|
6
|
+
schema_version: 1
|
|
7
|
+
version: 0.18.0
|
|
8
|
+
feature: <feature-id>
|
|
9
|
+
locked_decisions: []
|
|
10
|
+
inputs_hash: sha256:pending
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Brainstorm Artifact
|
|
5
14
|
|
|
6
15
|
## Context
|
|
7
16
|
- **Project state:**
|
|
@@ -37,7 +46,16 @@ export const ARTIFACT_TEMPLATES = {
|
|
|
37
46
|
- **Assumptions:**
|
|
38
47
|
- **Open questions (or "None"):**
|
|
39
48
|
`,
|
|
40
|
-
"02-scope.md":
|
|
49
|
+
"02-scope.md": `---
|
|
50
|
+
stage: scope
|
|
51
|
+
schema_version: 1
|
|
52
|
+
version: 0.18.0
|
|
53
|
+
feature: <feature-id>
|
|
54
|
+
locked_decisions: []
|
|
55
|
+
inputs_hash: sha256:pending
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
# Scope Artifact
|
|
41
59
|
|
|
42
60
|
## Prime Directives
|
|
43
61
|
- Zero silent failures:
|
|
@@ -94,6 +112,11 @@ export const ARTIFACT_TEMPLATES = {
|
|
|
94
112
|
> is later dropped, keep the row and mark Priority \`DROPPED\`; if a new one is
|
|
95
113
|
> added mid-flow, append with the next free R-number — do NOT reuse numbers.
|
|
96
114
|
|
|
115
|
+
## Locked Decisions (D-XX)
|
|
116
|
+
| Decision ID | Decision | Why locked now | Downstream impact |
|
|
117
|
+
|---|---|---|---|
|
|
118
|
+
| D-01 | | | |
|
|
119
|
+
|
|
97
120
|
## In Scope / Out of Scope
|
|
98
121
|
|
|
99
122
|
### In Scope
|
|
@@ -126,7 +149,16 @@ export const ARTIFACT_TEMPLATES = {
|
|
|
126
149
|
- Deferred:
|
|
127
150
|
- Explicitly excluded:
|
|
128
151
|
`,
|
|
129
|
-
"03-design.md":
|
|
152
|
+
"03-design.md": `---
|
|
153
|
+
stage: design
|
|
154
|
+
schema_version: 1
|
|
155
|
+
version: 0.18.0
|
|
156
|
+
feature: <feature-id>
|
|
157
|
+
locked_decisions: []
|
|
158
|
+
inputs_hash: sha256:pending
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
# Design Artifact
|
|
130
162
|
|
|
131
163
|
## Codebase Investigation
|
|
132
164
|
| File | Current responsibility | Patterns discovered |
|
|
@@ -210,7 +242,16 @@ export const ARTIFACT_TEMPLATES = {
|
|
|
210
242
|
|
|
211
243
|
**Decisions made:** 0 | **Unresolved:** 0
|
|
212
244
|
`,
|
|
213
|
-
"04-spec.md":
|
|
245
|
+
"04-spec.md": `---
|
|
246
|
+
stage: spec
|
|
247
|
+
schema_version: 1
|
|
248
|
+
version: 0.18.0
|
|
249
|
+
feature: <feature-id>
|
|
250
|
+
locked_decisions: []
|
|
251
|
+
inputs_hash: sha256:pending
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
# Specification Artifact
|
|
214
255
|
|
|
215
256
|
## Acceptance Criteria
|
|
216
257
|
| ID | Requirement Ref (R#) | Criterion (observable/measurable/falsifiable) | Design Decision Ref |
|
|
@@ -254,7 +295,16 @@ export const ARTIFACT_TEMPLATES = {
|
|
|
254
295
|
- Approved by:
|
|
255
296
|
- Date:
|
|
256
297
|
`,
|
|
257
|
-
"05-plan.md":
|
|
298
|
+
"05-plan.md": `---
|
|
299
|
+
stage: plan
|
|
300
|
+
schema_version: 1
|
|
301
|
+
version: 0.18.0
|
|
302
|
+
feature: <feature-id>
|
|
303
|
+
locked_decisions: []
|
|
304
|
+
inputs_hash: sha256:pending
|
|
305
|
+
---
|
|
306
|
+
|
|
307
|
+
# Plan Artifact
|
|
258
308
|
|
|
259
309
|
## Dependency Graph
|
|
260
310
|
-
|
|
@@ -282,6 +332,7 @@ Execution rule: complete and verify each wave before starting the next wave.
|
|
|
282
332
|
**Rules (apply before writing rows):**
|
|
283
333
|
- Every task fits the **2-5 minute budget**. If \`[~Nm]\` is >5, split the task.
|
|
284
334
|
- **No placeholders.** Forbidden tokens anywhere in this table: \`TODO\`, \`TBD\`, \`FIXME\`, \`<fill-in>\`, \`<your-*-here>\`, \`xxx\`, bare ellipsis. Every file path, test, and verification command must be copy-pasteable as written.
|
|
335
|
+
- **No silent scope reduction.** Forbidden phrasing when locked decisions exist: \`v1\`, \`for now\`, \`later\`, \`temporary\`, \`placeholder\`, \`mock for now\`, \`hardcoded for now\`, \`will improve later\`.
|
|
285
336
|
- If an estimate is genuinely uncertain (new library, unfamiliar subsystem), add a **spike task in wave 0** to de-risk — do NOT hide the uncertainty inside a large estimate.
|
|
286
337
|
|
|
287
338
|
| Task ID | Description | Acceptance criterion | Verification command | Effort (S/M/L) | Minutes |
|
|
@@ -293,6 +344,11 @@ Execution rule: complete and verify each wave before starting the next wave.
|
|
|
293
344
|
|---|---|
|
|
294
345
|
| AC-1 | T-1 |
|
|
295
346
|
|
|
347
|
+
## Locked Decision Coverage
|
|
348
|
+
| Decision ID | Source section | Plan tasks implementing decision | Status |
|
|
349
|
+
|---|---|---|---|
|
|
350
|
+
| D-01 | 02-scope.md > Locked Decisions | T-1 | covered |
|
|
351
|
+
|
|
296
352
|
## Risk Assessment
|
|
297
353
|
| Task/Wave | Risk | Likelihood | Impact | Mitigation |
|
|
298
354
|
|---|---|---|---|---|
|
|
@@ -307,11 +363,24 @@ Execution rule: complete and verify each wave before starting the next wave.
|
|
|
307
363
|
- Scanned tokens: \`TODO\`, \`TBD\`, \`FIXME\`, \`<fill-in>\`, \`<your-*-here>\`, \`xxx\`, bare ellipsis in task rows.
|
|
308
364
|
- Hits: 0 (required for WAIT_FOR_CONFIRM to resolve).
|
|
309
365
|
|
|
366
|
+
## No Scope Reduction Language Scan
|
|
367
|
+
- Scanned phrases: \`v1\`, \`for now\`, \`later\`, \`temporary\`, \`placeholder\`, \`mock for now\`, \`hardcoded for now\`, \`will improve later\`.
|
|
368
|
+
- Hits: 0 (required when Locked Decisions section is non-empty).
|
|
369
|
+
|
|
310
370
|
## WAIT_FOR_CONFIRM
|
|
311
371
|
- Status: pending
|
|
312
372
|
- Confirmed by:
|
|
313
373
|
`,
|
|
314
|
-
"06-tdd.md":
|
|
374
|
+
"06-tdd.md": `---
|
|
375
|
+
stage: tdd
|
|
376
|
+
schema_version: 1
|
|
377
|
+
version: 0.18.0
|
|
378
|
+
feature: <feature-id>
|
|
379
|
+
locked_decisions: []
|
|
380
|
+
inputs_hash: sha256:pending
|
|
381
|
+
---
|
|
382
|
+
|
|
383
|
+
# TDD Artifact
|
|
315
384
|
|
|
316
385
|
## RED Evidence
|
|
317
386
|
| Slice | Test name | Command | Failure output summary |
|
|
@@ -366,7 +435,16 @@ Execution rule: complete and verify each wave before starting the next wave.
|
|
|
366
435
|
|---|---|---|---|---|
|
|
367
436
|
| S-1 | | | | |
|
|
368
437
|
`,
|
|
369
|
-
"07-review.md":
|
|
438
|
+
"07-review.md": `---
|
|
439
|
+
stage: review
|
|
440
|
+
schema_version: 1
|
|
441
|
+
version: 0.18.0
|
|
442
|
+
feature: <feature-id>
|
|
443
|
+
locked_decisions: []
|
|
444
|
+
inputs_hash: sha256:pending
|
|
445
|
+
---
|
|
446
|
+
|
|
447
|
+
# Review Artifact
|
|
370
448
|
|
|
371
449
|
## Layer 1 Verdict
|
|
372
450
|
| Criterion | Verdict | Evidence |
|
|
@@ -444,7 +522,16 @@ Execution rule: complete and verify each wave before starting the next wave.
|
|
|
444
522
|
}
|
|
445
523
|
}
|
|
446
524
|
`,
|
|
447
|
-
"08-ship.md":
|
|
525
|
+
"08-ship.md": `---
|
|
526
|
+
stage: ship
|
|
527
|
+
schema_version: 1
|
|
528
|
+
version: 0.18.0
|
|
529
|
+
feature: <feature-id>
|
|
530
|
+
locked_decisions: []
|
|
531
|
+
inputs_hash: sha256:pending
|
|
532
|
+
---
|
|
533
|
+
|
|
534
|
+
# Ship Artifact
|
|
448
535
|
|
|
449
536
|
## Preflight Results
|
|
450
537
|
- Review verdict:
|
|
@@ -485,7 +572,16 @@ Execution rule: complete and verify each wave before starting the next wave.
|
|
|
485
572
|
- Retro artifact path: \`.cclaw/artifacts/09-retro.md\`
|
|
486
573
|
- Archive remains blocked until retro gate is complete.
|
|
487
574
|
`,
|
|
488
|
-
"09-retro.md":
|
|
575
|
+
"09-retro.md": `---
|
|
576
|
+
stage: retro
|
|
577
|
+
schema_version: 1
|
|
578
|
+
version: 0.18.0
|
|
579
|
+
feature: <feature-id>
|
|
580
|
+
locked_decisions: []
|
|
581
|
+
inputs_hash: sha256:pending
|
|
582
|
+
---
|
|
583
|
+
|
|
584
|
+
# Retro Artifact
|
|
489
585
|
|
|
490
586
|
## Run Summary
|
|
491
587
|
- Flow track:
|
|
@@ -1271,7 +1271,7 @@ For each lens, write either a knowledge entry **or** the explicit string
|
|
|
1271
1271
|
## Output protocol
|
|
1272
1272
|
|
|
1273
1273
|
For every harvested insight, append one strict-schema JSON line to
|
|
1274
|
-
\`.cclaw/knowledge.jsonl\` (fields: \`type, trigger, action, confidence, domain, stage, created, project\`).
|
|
1274
|
+
\`.cclaw/knowledge.jsonl\` (fields: \`type, trigger, action, confidence, domain, stage, origin_stage, origin_feature, frequency, universality, maturity, created, first_seen_ts, last_seen_ts, project\`).
|
|
1275
1275
|
See the \`learnings\` skill for the canonical shape. Choose \`type\`:
|
|
1276
1276
|
|
|
1277
1277
|
- \`compound\` for process/speed accelerators.
|
package/dist/delegation.d.ts
CHANGED
|
@@ -1,12 +1,34 @@
|
|
|
1
1
|
import type { FlowStage } from "./types.js";
|
|
2
|
+
export type DelegationMode = "mandatory" | "proactive" | "conditional";
|
|
3
|
+
export type DelegationStatus = "scheduled" | "completed" | "failed" | "waived";
|
|
4
|
+
export interface DelegationTokenUsage {
|
|
5
|
+
input: number;
|
|
6
|
+
output: number;
|
|
7
|
+
model: string;
|
|
8
|
+
}
|
|
2
9
|
export type DelegationEntry = {
|
|
3
10
|
stage: string;
|
|
4
11
|
agent: string;
|
|
5
|
-
mode:
|
|
6
|
-
status:
|
|
12
|
+
mode: DelegationMode;
|
|
13
|
+
status: DelegationStatus;
|
|
14
|
+
/**
|
|
15
|
+
* Span identifier for this delegation unit. Multiple status transitions for
|
|
16
|
+
* the same delegated unit should reuse the same spanId.
|
|
17
|
+
*/
|
|
18
|
+
spanId?: string;
|
|
19
|
+
/** Parent span id when this delegation was spawned from another span. */
|
|
20
|
+
parentSpanId?: string;
|
|
21
|
+
/** ISO timestamp when the delegation span started. */
|
|
22
|
+
startTs?: string;
|
|
23
|
+
/** ISO timestamp when the delegation span ended (for terminal statuses). */
|
|
24
|
+
endTs?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Legacy timestamp used by historical ledgers. New writers set both `ts` and
|
|
27
|
+
* `startTs` for backward compatibility.
|
|
28
|
+
*/
|
|
7
29
|
taskId?: string;
|
|
8
30
|
waiverReason?: string;
|
|
9
|
-
ts
|
|
31
|
+
ts?: string;
|
|
10
32
|
/**
|
|
11
33
|
* Run id the entry belongs to. Older ledgers written before 0.5.17 may omit this;
|
|
12
34
|
* consumers treat missing runId as unscoped (conservatively excluded from current-run checks).
|
|
@@ -17,6 +39,14 @@ export type DelegationEntry = {
|
|
|
17
39
|
* Recorded for audit so reviewers can see why the second pass was required.
|
|
18
40
|
*/
|
|
19
41
|
conditionTrigger?: string;
|
|
42
|
+
/** Optional token usage captured from the delegated run. */
|
|
43
|
+
tokens?: DelegationTokenUsage;
|
|
44
|
+
/** Number of retries attempted for this span. */
|
|
45
|
+
retryCount?: number;
|
|
46
|
+
/** Optional references to evidence anchors in artifacts. */
|
|
47
|
+
evidenceRefs?: string[];
|
|
48
|
+
/** Schema version marker for span-compatible delegation logs. */
|
|
49
|
+
schemaVersion?: 1;
|
|
20
50
|
};
|
|
21
51
|
export type DelegationLedger = {
|
|
22
52
|
runId: string;
|