cclaw-cli 0.15.1 → 0.21.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 +4 -3
- package/dist/content/compound-command.d.ts +2 -0
- package/dist/content/compound-command.js +72 -0
- 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 +5 -3
- package/dist/content/hooks.js +2 -2
- package/dist/content/ideate-command.d.ts +2 -0
- package/dist/content/ideate-command.js +73 -0
- package/dist/content/learnings.d.ts +1 -1
- package/dist/content/learnings.js +22 -5
- package/dist/content/meta-skill.js +6 -3
- package/dist/content/next-command.js +5 -5
- package/dist/content/observe.js +3 -2
- package/dist/content/ops-command.js +4 -4
- package/dist/content/protocols.js +27 -38
- package/dist/content/retro-command.js +2 -1
- package/dist/content/rewind-command.d.ts +0 -1
- package/dist/content/rewind-command.js +19 -33
- package/dist/content/skills.js +14 -8
- package/dist/content/stage-schema.js +3 -38
- package/dist/content/stages/plan.js +16 -5
- package/dist/content/stages/review.js +20 -0
- package/dist/content/stages/scope.js +9 -3
- package/dist/content/stages/ship.js +1 -0
- package/dist/content/stages/tdd.js +5 -4
- package/dist/content/templates.js +105 -9
- package/dist/content/utility-skills.d.ts +3 -1
- package/dist/content/utility-skills.js +91 -1
- package/dist/delegation.d.ts +33 -3
- package/dist/delegation.js +56 -3
- package/dist/doctor.js +269 -88
- package/dist/feature-system.d.ts +22 -5
- package/dist/feature-system.js +267 -126
- package/dist/harness-adapters.js +17 -1
- package/dist/install.js +10 -8
- package/dist/policy.js +13 -4
- package/package.json +1 -1
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* Canonical JSONL field order (matches the reference spec).
|
|
3
3
|
* Exported for tests and any programmatic writer that wants the exact shape.
|
|
4
4
|
*/
|
|
5
|
-
export declare const KNOWLEDGE_JSONL_FIELDS: readonly ["type", "trigger", "action", "confidence", "domain", "stage", "created", "project"];
|
|
5
|
+
export declare const KNOWLEDGE_JSONL_FIELDS: readonly ["type", "trigger", "action", "confidence", "domain", "stage", "origin_stage", "origin_feature", "frequency", "universality", "maturity", "created", "first_seen_ts", "last_seen_ts", "project"];
|
|
6
6
|
export declare function learnSkillMarkdown(): string;
|
|
7
7
|
export declare function learnCommandContract(): string;
|
|
@@ -20,7 +20,14 @@ export const KNOWLEDGE_JSONL_FIELDS = [
|
|
|
20
20
|
"confidence",
|
|
21
21
|
"domain",
|
|
22
22
|
"stage",
|
|
23
|
+
"origin_stage",
|
|
24
|
+
"origin_feature",
|
|
25
|
+
"frequency",
|
|
26
|
+
"universality",
|
|
27
|
+
"maturity",
|
|
23
28
|
"created",
|
|
29
|
+
"first_seen_ts",
|
|
30
|
+
"last_seen_ts",
|
|
24
31
|
"project"
|
|
25
32
|
];
|
|
26
33
|
export function learnSkillMarkdown() {
|
|
@@ -51,10 +58,10 @@ Do not invent alternate stores (no markdown mirror, no SQLite, no per-stage file
|
|
|
51
58
|
## Entry format — strict JSONL schema
|
|
52
59
|
|
|
53
60
|
Exactly one JSON object per line. Fields must appear in the order:
|
|
54
|
-
\`type, trigger, action, confidence, domain, stage, created, project\`.
|
|
61
|
+
\`type, trigger, action, confidence, domain, stage, origin_stage, origin_feature, frequency, universality, maturity, created, first_seen_ts, last_seen_ts, project\`.
|
|
55
62
|
|
|
56
63
|
\`\`\`json
|
|
57
|
-
{"type":"pattern","trigger":"when reviewing external payloads","action":"parse through zod before touching service layer","confidence":"high","domain":"api","stage":"review","created":"2026-04-14T12:00:00Z","project":"cclaw"}
|
|
64
|
+
{"type":"pattern","trigger":"when reviewing external payloads","action":"parse through zod before touching service layer","confidence":"high","domain":"api","stage":"review","origin_stage":"review","origin_feature":"payload-hardening","frequency":1,"universality":"project","maturity":"raw","created":"2026-04-14T12:00:00Z","first_seen_ts":"2026-04-14T12:00:00Z","last_seen_ts":"2026-04-14T12:00:00Z","project":"cclaw"}
|
|
58
65
|
\`\`\`
|
|
59
66
|
|
|
60
67
|
| field | type | required | notes |
|
|
@@ -65,7 +72,14 @@ Exactly one JSON object per line. Fields must appear in the order:
|
|
|
65
72
|
| \`confidence\` | \`"high" \\| "medium" \\| "low"\` | yes | Write \`medium\` when unsure; do not omit. |
|
|
66
73
|
| \`domain\` | string \\| null | yes | Free-form taxonomy (\`api\`, \`infra\`, \`ui\`, \`security\`, \`testing\`, …). Use \`null\` when cross-cutting. |
|
|
67
74
|
| \`stage\` | \`FlowStage\` \\| null | yes | One of brainstorm / scope / design / spec / plan / tdd / review / ship, or \`null\` when cross-stage. |
|
|
75
|
+
| \`origin_stage\` | \`FlowStage\` \\| null | yes | Stage where this learning was first observed. |
|
|
76
|
+
| \`origin_feature\` | string \\| null | yes | Feature/worktree label where it was observed first. |
|
|
77
|
+
| \`frequency\` | integer >= 1 | yes | Number of times this same trigger/action pair has been observed. |
|
|
78
|
+
| \`universality\` | \`"project" \\| "personal" \\| "universal"\` | yes | Scope of applicability. |
|
|
79
|
+
| \`maturity\` | \`"raw" \\| "lifted-to-rule" \\| "lifted-to-enforcement"\` | yes | Lifecycle state of the learning. |
|
|
68
80
|
| \`created\` | ISO 8601 UTC string | yes | \`date -u +%Y-%m-%dT%H:%M:%SZ\`. |
|
|
81
|
+
| \`first_seen_ts\` | ISO 8601 UTC string | yes | First observed timestamp (usually equals \`created\`). |
|
|
82
|
+
| \`last_seen_ts\` | ISO 8601 UTC string | yes | Last re-confirmed timestamp. |
|
|
69
83
|
| \`project\` | string \\| null | yes | Repo or scope name. Use \`null\` when the entry crosses projects. |
|
|
70
84
|
|
|
71
85
|
Rules:
|
|
@@ -96,10 +110,13 @@ Rules:
|
|
|
96
110
|
- Return the matched lines pretty-printed (do not mutate the file).
|
|
97
111
|
|
|
98
112
|
### \`/cc-learn add\`
|
|
99
|
-
- Ask for required fields in order: \`type\`, \`trigger\`, \`action\`, \`confidence\`, \`domain\`, \`stage\`, \`project\`.
|
|
113
|
+
- Ask for required user-facing fields in order: \`type\`, \`trigger\`, \`action\`, \`confidence\`, \`domain\`, \`stage\`, \`universality\`, \`project\`.
|
|
100
114
|
- \`confidence\` must be one of \`high\`, \`medium\`, \`low\`. Default to \`medium\` if the user declines to set it.
|
|
101
115
|
- \`domain\`, \`stage\`, and \`project\` may be explicitly \`null\`.
|
|
102
|
-
- \`
|
|
116
|
+
- \`origin_stage\` defaults to \`stage\`; \`origin_feature\` defaults to active feature (or \`null\` if unknown).
|
|
117
|
+
- \`frequency\` starts at \`1\`.
|
|
118
|
+
- \`maturity\` starts at \`raw\`.
|
|
119
|
+
- \`created\`, \`first_seen_ts\`, and \`last_seen_ts\` are set automatically to current UTC ISO timestamp.
|
|
103
120
|
- Append exactly one JSON line to \`${KNOWLEDGE_PATH}\` with the field order from the schema table above.
|
|
104
121
|
- Re-read the file tail to confirm the new line is valid JSON and parses back to the same object.
|
|
105
122
|
|
|
@@ -130,7 +147,7 @@ Do not edit source code from this command. Only operate on \`${KNOWLEDGE_PATH}\`
|
|
|
130
147
|
|---|---|---|
|
|
131
148
|
| (default) | — | Show recent knowledge entries (tail of JSONL, pretty-printed). |
|
|
132
149
|
| \`search\` | \`<query>\` | Stream-filter the JSONL for matching \`trigger\`, \`action\`, \`domain\`, \`project\`. |
|
|
133
|
-
| \`add\` | — | Append one JSON line (\`rule\` / \`pattern\` / \`lesson\` / \`compound\`) with the strict
|
|
150
|
+
| \`add\` | — | Append one JSON line (\`rule\` / \`pattern\` / \`lesson\` / \`compound\`) with the strict 15-field schema. |
|
|
134
151
|
| \`curate\` | — | Hand off to the **knowledge-curation** skill: read-only audit + soft-archive plan when the file exceeds the curation threshold. |
|
|
135
152
|
`;
|
|
136
153
|
}
|
|
@@ -3,7 +3,7 @@ export const META_SKILL_NAME = "using-cclaw";
|
|
|
3
3
|
export function usingCclawSkillMarkdown() {
|
|
4
4
|
return `---
|
|
5
5
|
name: using-cclaw
|
|
6
|
-
description: "Routing brain for cclaw. Decide whether to start/resume a stage, answer directly, or use utility commands like /cc-learn, /cc-view, and /cc-ops."
|
|
6
|
+
description: "Routing brain for cclaw. Decide whether to start/resume a stage, answer directly, or use utility commands like /cc-learn, /cc-ideate, /cc-view, and /cc-ops."
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
# Using Cclaw
|
|
@@ -25,10 +25,11 @@ Task arrives
|
|
|
25
25
|
├─ Running as spawned subagent? -> obey parent prompt only; do not run cclaw routing
|
|
26
26
|
├─ Pure question / non-software ask? -> answer directly (no stage)
|
|
27
27
|
├─ New software work? -> /cc <idea>
|
|
28
|
+
├─ Repo-improvement discovery? -> /cc-ideate
|
|
28
29
|
├─ Resume existing flow? -> /cc or /cc-next
|
|
29
30
|
├─ Knowledge operation? -> /cc-learn
|
|
30
31
|
├─ Read-only workspace view? -> /cc-view [status|tree|diff]
|
|
31
|
-
└─ Workspace operation? -> /cc-ops [feature|tdd-log|retro|archive|rewind
|
|
32
|
+
└─ Workspace operation? -> /cc-ops [feature|tdd-log|retro|compound|archive|rewind]
|
|
32
33
|
\`\`\`
|
|
33
34
|
|
|
34
35
|
## Task classification
|
|
@@ -60,6 +61,8 @@ Tracks may skip stages via \`flow-state.track\` + \`skippedStages\`.
|
|
|
60
61
|
Load utility skills only when triggered by the current task:
|
|
61
62
|
|
|
62
63
|
- security, performance, debugging, docs, ci-cd
|
|
64
|
+
- verification-before-completion before completion claims
|
|
65
|
+
- finishing-a-development-branch during ship/finalization
|
|
63
66
|
- document-review and execution context skills
|
|
64
67
|
- language rule packs from \`.cclaw/config.yaml\` when enabled
|
|
65
68
|
|
|
@@ -72,7 +75,7 @@ Do not inline these protocols in stage skills; cite by path:
|
|
|
72
75
|
|
|
73
76
|
- Decision protocol: \`${DECISION_PROTOCOL_REL_PATH}\`
|
|
74
77
|
- Completion/resume protocol: \`${COMPLETION_PROTOCOL_REL_PATH}\`
|
|
75
|
-
- Engineering ethos +
|
|
78
|
+
- Engineering ethos + announce discipline: \`${ETHOS_PROTOCOL_REL_PATH}\`
|
|
76
79
|
|
|
77
80
|
## Knowledge guidance
|
|
78
81
|
|
|
@@ -33,13 +33,13 @@ This is the only progression command the user needs to drive the entire flow. St
|
|
|
33
33
|
|
|
34
34
|
- **Do not** invent gate completion: use only \`${flowPath}\` plus observable evidence in repo artifacts.
|
|
35
35
|
- **Do not** skip stages: advance only from \`currentStage\` to its configured successor.
|
|
36
|
-
- If the flow reaches terminal ship completion, route closeout in order: **/cc-ops retro -> /cc-ops archive**.
|
|
36
|
+
- If the flow reaches terminal ship completion, route closeout in order: **/cc-ops retro -> /cc-ops compound (optional) -> /cc-ops archive**.
|
|
37
37
|
|
|
38
38
|
## Algorithm (mandatory)
|
|
39
39
|
|
|
40
40
|
1. Read **\`${flowPath}\`**. If missing → **BLOCKED** (state missing).
|
|
41
41
|
2. Parse JSON. Capture \`currentStage\` and \`stageGateCatalog[currentStage]\`.
|
|
42
|
-
3. If \`staleStages[currentStage]\` exists, do not advance automatically. Re-run the stage artifact work, then clear the marker with \`/cc-ops rewind
|
|
42
|
+
3. If \`staleStages[currentStage]\` exists, do not advance automatically. Re-run the stage artifact work, then clear the marker with \`/cc-ops rewind --ack <currentStage>\`.
|
|
43
43
|
4. Let \`G\` = \`requiredGates\` for **\`currentStage\`** from the stage schema.
|
|
44
44
|
5. Let \`catalog\` = \`stageGateCatalog[currentStage]\` from flow state.
|
|
45
45
|
6. **Satisfied** for gate id \`g\`: \`g\` in \`catalog.passed\` and \`g\` not in \`catalog.blocked\`.
|
|
@@ -56,7 +56,7 @@ This is the only progression command the user needs to drive the entire flow. St
|
|
|
56
56
|
|
|
57
57
|
→ If current stage's \`next\` is **\`done\`**:
|
|
58
58
|
- if \`currentStage === "ship"\` and \`retro.completedAt\` is missing -> route to \`/cc-ops retro\`,
|
|
59
|
-
- if \`currentStage === "ship"\` and \`retro.completedAt\` is present -> route to \`/cc-ops archive\`,
|
|
59
|
+
- if \`currentStage === "ship"\` and \`retro.completedAt\` is present -> suggest \`/cc-ops compound\` then route to \`/cc-ops archive\`,
|
|
60
60
|
- otherwise report **"Flow complete. All stages finished."** and stop.
|
|
61
61
|
→ Otherwise: load **\`${RUNTIME_ROOT}/skills/<skillFolder>/SKILL.md\`** and **\`${RUNTIME_ROOT}/commands/<nextStage>.md\`** for the successor stage. Execute that stage's protocol.
|
|
62
62
|
|
|
@@ -124,7 +124,7 @@ Do **not** mark gates satisfied from memory alone. Cite **artifact evidence** (p
|
|
|
124
124
|
|
|
125
125
|
1. Open **\`${flowPath}\`**.
|
|
126
126
|
2. Record \`currentStage\` and \`stageGateCatalog[currentStage]\`.
|
|
127
|
-
3. If \`staleStages[currentStage]\` exists, re-run the stage and clear marker via \`/cc-ops rewind
|
|
127
|
+
3. If \`staleStages[currentStage]\` exists, re-run the stage and clear marker via \`/cc-ops rewind --ack <currentStage>\` before advancing.
|
|
128
128
|
4. If the file is missing or invalid JSON → **BLOCKED** (report and stop).
|
|
129
129
|
|
|
130
130
|
### Step 2: Evaluate gates
|
|
@@ -150,7 +150,7 @@ Execute the stage protocol. The stage skill handles interaction, STOP points, ga
|
|
|
150
150
|
If \`next\` is \`done\`:
|
|
151
151
|
|
|
152
152
|
- If \`currentStage\` is \`ship\` and \`retro.completedAt\` is missing -> route to \`/cc-ops retro\`.
|
|
153
|
-
- If \`currentStage\` is \`ship\` and \`retro.completedAt\` exists -> route to \`/cc-ops archive\`.
|
|
153
|
+
- If \`currentStage\` is \`ship\` and \`retro.completedAt\` exists -> suggest \`/cc-ops compound\`, then route to \`/cc-ops archive\`.
|
|
154
154
|
- Otherwise report **"Flow complete. All stages finished."** and stop.
|
|
155
155
|
|
|
156
156
|
Otherwise load the next stage's skill and command contract, begin execution.
|
package/dist/content/observe.js
CHANGED
|
@@ -819,7 +819,8 @@ if command -v jq >/dev/null 2>&1; then
|
|
|
819
819
|
--arg phase "$PHASE" \\
|
|
820
820
|
--arg stage "$STAGE" \\
|
|
821
821
|
--arg runId "$ACTIVE_RUN" \\
|
|
822
|
-
|
|
822
|
+
--arg schemaVersion "1" \\
|
|
823
|
+
'{ts:$ts,event:$event,tool:$tool,phase:$phase,stage:$stage,runId:$runId,schemaVersion:($schemaVersion|tonumber)}' 2>/dev/null || echo "")
|
|
823
824
|
else
|
|
824
825
|
EVENT_JSON=$(printf '{"ts":"%s","event":"%s","tool":"%s","phase":"%s","stage":"%s","runId":"%s","data":"%s"}' \\
|
|
825
826
|
"$(escape_json "$TS")" \\
|
|
@@ -829,7 +830,7 @@ else
|
|
|
829
830
|
"$(escape_json "$STAGE")" \\
|
|
830
831
|
"$(escape_json "$ACTIVE_RUN")" \\
|
|
831
832
|
"$(escape_json "$PAYLOAD")")
|
|
832
|
-
ACTIVITY_JSON=$(printf '{"ts":"%s","event":"%s","tool":"%s","phase":"%s","stage":"%s","runId":"%s"}' \\
|
|
833
|
+
ACTIVITY_JSON=$(printf '{"ts":"%s","event":"%s","tool":"%s","phase":"%s","stage":"%s","runId":"%s","schemaVersion":1}' \\
|
|
833
834
|
"$(escape_json "$TS")" \\
|
|
834
835
|
"$(escape_json "$EVENT")" \\
|
|
835
836
|
"$(escape_json "$TOOL")" \\
|
|
@@ -12,9 +12,9 @@ Subcommands:
|
|
|
12
12
|
- \`feature\` -> \`/cc-ops feature\`
|
|
13
13
|
- \`tdd-log\` -> \`/cc-ops tdd-log\`
|
|
14
14
|
- \`retro\` -> \`/cc-ops retro\`
|
|
15
|
+
- \`compound\` -> \`/cc-ops compound\`
|
|
15
16
|
- \`archive\` -> \`/cc-ops archive\`
|
|
16
17
|
- \`rewind\` -> \`/cc-ops rewind\`
|
|
17
|
-
- \`rewind-ack\` -> \`/cc-ops rewind-ack\`
|
|
18
18
|
|
|
19
19
|
## HARD-GATE
|
|
20
20
|
|
|
@@ -28,9 +28,9 @@ Subcommands:
|
|
|
28
28
|
- \`feature\` -> \`${RUNTIME_ROOT}/commands/feature.md\`
|
|
29
29
|
- \`tdd-log\` -> \`${RUNTIME_ROOT}/commands/tdd-log.md\`
|
|
30
30
|
- \`retro\` -> \`${RUNTIME_ROOT}/commands/retro.md\`
|
|
31
|
+
- \`compound\` -> \`${RUNTIME_ROOT}/commands/compound.md\`
|
|
31
32
|
- \`archive\` -> \`${RUNTIME_ROOT}/commands/archive.md\`
|
|
32
33
|
- \`rewind\` -> \`${RUNTIME_ROOT}/commands/rewind.md\`
|
|
33
|
-
- \`rewind-ack\` -> \`${RUNTIME_ROOT}/commands/rewind-ack.md\`
|
|
34
34
|
3. Unknown subcommand -> print supported values and stop.
|
|
35
35
|
|
|
36
36
|
## Primary skill
|
|
@@ -41,7 +41,7 @@ Subcommands:
|
|
|
41
41
|
export function opsCommandSkillMarkdown() {
|
|
42
42
|
return `---
|
|
43
43
|
name: ${OPS_SKILL_NAME}
|
|
44
|
-
description: "Unified operational router for feature/tdd-log/retro/archive/rewind commands."
|
|
44
|
+
description: "Unified operational router for feature/tdd-log/retro/compound/archive/rewind commands."
|
|
45
45
|
---
|
|
46
46
|
|
|
47
47
|
# /cc-ops
|
|
@@ -52,7 +52,7 @@ This wrapper only dispatches. It must not apply state mutations itself.
|
|
|
52
52
|
|
|
53
53
|
## Protocol
|
|
54
54
|
|
|
55
|
-
1. Require a subcommand (\`feature|tdd-log|retro|archive|rewind
|
|
55
|
+
1. Require a subcommand (\`feature|tdd-log|retro|compound|archive|rewind\`).
|
|
56
56
|
2. Route to the matching command contract + skill pair.
|
|
57
57
|
3. Preserve pass-through args after the subcommand (e.g. \`/cc-ops rewind design\`).
|
|
58
58
|
4. Echo which subcommand was dispatched for auditability.
|
|
@@ -75,7 +75,12 @@ export function ethosProtocolMarkdown() {
|
|
|
75
75
|
|
|
76
76
|
Shared operating principles across all stages.
|
|
77
77
|
|
|
78
|
-
##
|
|
78
|
+
## 1) Boil the Lake
|
|
79
|
+
|
|
80
|
+
When the "complete version" costs only slightly more than a shortcut, prefer the
|
|
81
|
+
complete version. Do not leave obvious quality gaps for hypothetical follow-ups.
|
|
82
|
+
|
|
83
|
+
## 2) Search Before Building
|
|
79
84
|
|
|
80
85
|
Before adding new code/templates/rules:
|
|
81
86
|
|
|
@@ -84,52 +89,36 @@ Before adding new code/templates/rules:
|
|
|
84
89
|
3. Search codebase for reusable implementations.
|
|
85
90
|
4. Prefer built-in/library primitives over custom helpers.
|
|
86
91
|
|
|
87
|
-
##
|
|
88
|
-
|
|
89
|
-
- Prefer minimal, verifiable changes.
|
|
90
|
-
- Evidence beats volume.
|
|
91
|
-
- Keep stage output concrete and testable.
|
|
92
|
-
|
|
93
|
-
## Preamble budget
|
|
92
|
+
## 3) User Sovereignty
|
|
94
93
|
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
AI recommends. User decides. If your recommendation changes the user's stated
|
|
95
|
+
direction, ask first and wait for explicit approval.
|
|
97
96
|
|
|
98
|
-
|
|
97
|
+
## 4) Iron-Law Discipline
|
|
99
98
|
|
|
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 |
|
|
99
|
+
Every stage has a non-negotiable Iron Law. If a proposed action violates it,
|
|
100
|
+
stop and escalate via Decision Protocol instead of rationalizing exceptions.
|
|
105
101
|
|
|
106
|
-
|
|
102
|
+
## 5) Complete Before Ship
|
|
107
103
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
| Subagent dispatch payload | prompt is for spawned agent/tool call only |
|
|
113
|
-
| Cooldown hit | same stage + same trigger emitted within cooldown window |
|
|
104
|
+
No release shortcuts:
|
|
105
|
+
- review verdict must be explicit,
|
|
106
|
+
- preflight evidence must be fresh,
|
|
107
|
+
- rollback must be written before finalization.
|
|
114
108
|
|
|
115
|
-
|
|
109
|
+
## 6) Compound, Don't Repeat
|
|
116
110
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
4. \`Guardrails:\` key constraints / non-goals
|
|
121
|
-
|
|
122
|
-
### Cooldown
|
|
111
|
+
When a reusable lesson appears, add one strict-schema JSONL entry via
|
|
112
|
+
\`/cc-learn add\`. Repeated lessons should be lifted into stable rules/skills so
|
|
113
|
+
the same class of mistake gets harder to repeat.
|
|
123
114
|
|
|
124
|
-
|
|
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.
|
|
115
|
+
## Turn Announce Discipline
|
|
129
116
|
|
|
130
|
-
|
|
117
|
+
Keep orchestration visible without maintaining a dedicated preamble runtime log.
|
|
131
118
|
|
|
132
|
-
|
|
133
|
-
|
|
119
|
+
- Start substantial turns with a 1-2 sentence announce: current stage, intent, next action.
|
|
120
|
+
- Skip announce for trivial single-command actions.
|
|
121
|
+
- Never repeat boilerplate announces when the intent did not change.
|
|
122
|
+
- If plan or risk changes materially, post a fresh announce before executing.
|
|
134
123
|
`;
|
|
135
124
|
}
|
|
@@ -36,7 +36,7 @@ Mandatory retrospective gate before archive once ship is complete.
|
|
|
36
36
|
- \`required: true\`
|
|
37
37
|
- \`completedAt: <ISO>\`
|
|
38
38
|
- \`compoundEntries: <count>\`
|
|
39
|
-
5. Report completion summary and remind user that \`/cc-ops
|
|
39
|
+
5. Report completion summary and remind user that \`/cc-ops compound\` (optional) can lift repeated learnings before \`/cc-ops archive\`.
|
|
40
40
|
|
|
41
41
|
## Primary skill
|
|
42
42
|
|
|
@@ -67,6 +67,7 @@ Archive must remain blocked until retro artifact exists and compound knowledge w
|
|
|
67
67
|
5. Print explicit completion line:
|
|
68
68
|
- \`retro gate: complete\`
|
|
69
69
|
- \`compound entries added: <N>\`
|
|
70
|
+
- \`next: /cc-ops compound (optional) -> /cc-ops archive\`
|
|
70
71
|
|
|
71
72
|
## Validation
|
|
72
73
|
|
|
@@ -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
|
@@ -98,6 +98,9 @@ Provide fresh, stage-local verification evidence from this turn:
|
|
|
98
98
|
1. Run verification commands (tests/build/lint/type-check) for the changed scope.
|
|
99
99
|
2. Confirm output, do not infer success from prior runs.
|
|
100
100
|
3. If this is a bug fix, capture RED -> GREEN evidence for the regression path.
|
|
101
|
+
|
|
102
|
+
Reference utility skill:
|
|
103
|
+
\`.cclaw/skills/verification-before-completion/SKILL.md\`
|
|
101
104
|
`;
|
|
102
105
|
}
|
|
103
106
|
function waveExecutionModeBlock(stage) {
|
|
@@ -108,9 +111,8 @@ function waveExecutionModeBlock(stage) {
|
|
|
108
111
|
|
|
109
112
|
Execute the current dependency wave task-by-task (RED -> GREEN -> REFACTOR).
|
|
110
113
|
Stop on BLOCKED status or when user input is required.
|
|
111
|
-
Apply
|
|
112
|
-
|
|
113
|
-
plan changes materially.
|
|
114
|
+
Apply concise turn announces: one announce per wave boundary (or when risk/plan
|
|
115
|
+
changes materially), then execute tasks without repetitive boilerplate.
|
|
114
116
|
|
|
115
117
|
Detailed walkthrough:
|
|
116
118
|
\`.cclaw/${STAGE_EXAMPLES_REFERENCE_DIR}/tdd-wave-walkthrough.md\`
|
|
@@ -192,11 +194,14 @@ function stageSpecificSeeAlso(stage) {
|
|
|
192
194
|
],
|
|
193
195
|
review: [
|
|
194
196
|
`- \`${RUNTIME_ROOT}/skills/security/SKILL.md\``,
|
|
195
|
-
`- \`${RUNTIME_ROOT}/skills/parallel-dispatch/SKILL.md
|
|
197
|
+
`- \`${RUNTIME_ROOT}/skills/parallel-dispatch/SKILL.md\``,
|
|
198
|
+
`- \`${RUNTIME_ROOT}/skills/verification-before-completion/SKILL.md\``
|
|
196
199
|
],
|
|
197
200
|
ship: [
|
|
198
201
|
`- \`${RUNTIME_ROOT}/skills/ci-cd/SKILL.md\``,
|
|
199
|
-
`- \`${RUNTIME_ROOT}/skills/docs/SKILL.md
|
|
202
|
+
`- \`${RUNTIME_ROOT}/skills/docs/SKILL.md\``,
|
|
203
|
+
`- \`${RUNTIME_ROOT}/skills/verification-before-completion/SKILL.md\``,
|
|
204
|
+
`- \`${RUNTIME_ROOT}/skills/finishing-a-development-branch/SKILL.md\``
|
|
200
205
|
]
|
|
201
206
|
};
|
|
202
207
|
return refs[stage];
|
|
@@ -227,9 +232,10 @@ function quickStartBlock(stage) {
|
|
|
227
232
|
const gatePreview = schema.requiredGates.slice(0, 3).map((g) => `\`${g.id}\``).join(", ");
|
|
228
233
|
return `## Quick Start
|
|
229
234
|
|
|
230
|
-
1.
|
|
231
|
-
2.
|
|
232
|
-
3.
|
|
235
|
+
1. Announce at start: "Using \`${schema.skillName}\` to ${schema.purpose}".
|
|
236
|
+
2. Obey HARD-GATE and Iron Law.
|
|
237
|
+
3. Execute checklist in order and persist \`${RUNTIME_ROOT}/artifacts/${schema.artifactFile}\`.
|
|
238
|
+
4. Satisfy gates (${gatePreview}${schema.requiredGates.length > 3 ? ` +${schema.requiredGates.length - 3}` : ""}).
|
|
233
239
|
`;
|
|
234
240
|
}
|
|
235
241
|
/**
|
|
@@ -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
|
};
|