cclaw-cli 7.7.0 → 8.1.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 +210 -134
- package/dist/artifact-frontmatter.d.ts +51 -0
- package/dist/artifact-frontmatter.js +131 -0
- package/dist/artifact-paths.d.ts +7 -27
- package/dist/artifact-paths.js +20 -249
- package/dist/cancel.d.ts +16 -0
- package/dist/cancel.js +66 -0
- package/dist/cli.d.ts +2 -27
- package/dist/cli.js +90 -508
- package/dist/compound.d.ts +26 -0
- package/dist/compound.js +96 -0
- package/dist/config.d.ts +14 -51
- package/dist/config.js +23 -359
- package/dist/constants.d.ts +11 -18
- package/dist/constants.js +19 -106
- package/dist/content/antipatterns.d.ts +1 -0
- package/dist/content/antipatterns.js +109 -0
- package/dist/content/artifact-templates.d.ts +10 -0
- package/dist/content/artifact-templates.js +550 -0
- package/dist/content/cancel-command.d.ts +2 -2
- package/dist/content/cancel-command.js +25 -17
- package/dist/content/core-agents.d.ts +9 -233
- package/dist/content/core-agents.js +39 -766
- package/dist/content/decision-protocol.d.ts +1 -12
- package/dist/content/decision-protocol.js +27 -20
- package/dist/content/examples.d.ts +8 -42
- package/dist/content/examples.js +293 -425
- package/dist/content/idea-command.d.ts +2 -0
- package/dist/content/idea-command.js +38 -0
- package/dist/content/iron-laws.d.ts +4 -138
- package/dist/content/iron-laws.js +18 -197
- package/dist/content/meta-skill.d.ts +1 -3
- package/dist/content/meta-skill.js +57 -132
- package/dist/content/node-hooks.d.ts +12 -8
- package/dist/content/node-hooks.js +188 -838
- package/dist/content/recovery.d.ts +8 -0
- package/dist/content/recovery.js +179 -0
- package/dist/content/reference-patterns.d.ts +4 -13
- package/dist/content/reference-patterns.js +260 -389
- package/dist/content/research-playbooks.d.ts +8 -8
- package/dist/content/research-playbooks.js +108 -121
- package/dist/content/review-loop.d.ts +6 -192
- package/dist/content/review-loop.js +29 -731
- package/dist/content/skills.d.ts +8 -38
- package/dist/content/skills.js +681 -732
- package/dist/content/specialist-prompts/architect.d.ts +1 -0
- package/dist/content/specialist-prompts/architect.js +225 -0
- package/dist/content/specialist-prompts/brainstormer.d.ts +1 -0
- package/dist/content/specialist-prompts/brainstormer.js +168 -0
- package/dist/content/specialist-prompts/index.d.ts +2 -0
- package/dist/content/specialist-prompts/index.js +14 -0
- package/dist/content/specialist-prompts/planner.d.ts +1 -0
- package/dist/content/specialist-prompts/planner.js +182 -0
- package/dist/content/specialist-prompts/reviewer.d.ts +1 -0
- package/dist/content/specialist-prompts/reviewer.js +193 -0
- package/dist/content/specialist-prompts/security-reviewer.d.ts +1 -0
- package/dist/content/specialist-prompts/security-reviewer.js +133 -0
- package/dist/content/specialist-prompts/slice-builder.d.ts +1 -0
- package/dist/content/specialist-prompts/slice-builder.js +232 -0
- package/dist/content/stage-playbooks.d.ts +8 -0
- package/dist/content/stage-playbooks.js +404 -0
- package/dist/content/start-command.d.ts +2 -12
- package/dist/content/start-command.js +221 -207
- package/dist/flow-state.d.ts +21 -178
- package/dist/flow-state.js +67 -170
- package/dist/fs-utils.d.ts +6 -26
- package/dist/fs-utils.js +29 -162
- package/dist/gitignore.d.ts +2 -1
- package/dist/gitignore.js +51 -34
- package/dist/harness-detect.d.ts +10 -0
- package/dist/harness-detect.js +29 -0
- package/dist/install.d.ts +27 -15
- package/dist/install.js +230 -1342
- package/dist/knowledge-store.d.ts +19 -163
- package/dist/knowledge-store.js +56 -590
- package/dist/logger.d.ts +8 -3
- package/dist/logger.js +13 -4
- package/dist/orchestrator-routing.d.ts +29 -0
- package/dist/orchestrator-routing.js +156 -0
- package/dist/run-persistence.d.ts +7 -118
- package/dist/run-persistence.js +29 -845
- package/dist/runtime/run-hook.entry.d.ts +1 -3
- package/dist/runtime/run-hook.entry.js +19 -4
- package/dist/runtime/run-hook.mjs +13 -1024
- package/dist/types.d.ts +25 -261
- package/dist/types.js +8 -36
- package/package.json +6 -3
- package/dist/artifact-linter/brainstorm.d.ts +0 -2
- package/dist/artifact-linter/brainstorm.js +0 -353
- package/dist/artifact-linter/design.d.ts +0 -18
- package/dist/artifact-linter/design.js +0 -444
- package/dist/artifact-linter/findings-dedup.d.ts +0 -56
- package/dist/artifact-linter/findings-dedup.js +0 -232
- package/dist/artifact-linter/plan.d.ts +0 -2
- package/dist/artifact-linter/plan.js +0 -826
- package/dist/artifact-linter/review-army.d.ts +0 -49
- package/dist/artifact-linter/review-army.js +0 -520
- package/dist/artifact-linter/review.d.ts +0 -2
- package/dist/artifact-linter/review.js +0 -113
- package/dist/artifact-linter/scope.d.ts +0 -2
- package/dist/artifact-linter/scope.js +0 -158
- package/dist/artifact-linter/shared.d.ts +0 -637
- package/dist/artifact-linter/shared.js +0 -2163
- package/dist/artifact-linter/ship.d.ts +0 -2
- package/dist/artifact-linter/ship.js +0 -250
- package/dist/artifact-linter/spec.d.ts +0 -2
- package/dist/artifact-linter/spec.js +0 -176
- package/dist/artifact-linter/tdd.d.ts +0 -118
- package/dist/artifact-linter/tdd.js +0 -1404
- package/dist/artifact-linter.d.ts +0 -15
- package/dist/artifact-linter.js +0 -517
- package/dist/codex-feature-flag.d.ts +0 -58
- package/dist/codex-feature-flag.js +0 -193
- package/dist/content/closeout-guidance.d.ts +0 -14
- package/dist/content/closeout-guidance.js +0 -44
- package/dist/content/diff-command.d.ts +0 -1
- package/dist/content/diff-command.js +0 -43
- package/dist/content/harness-doc.d.ts +0 -1
- package/dist/content/harness-doc.js +0 -65
- package/dist/content/hook-events.d.ts +0 -9
- package/dist/content/hook-events.js +0 -23
- package/dist/content/hook-manifest.d.ts +0 -81
- package/dist/content/hook-manifest.js +0 -156
- package/dist/content/hooks.d.ts +0 -11
- package/dist/content/hooks.js +0 -1972
- package/dist/content/idea.d.ts +0 -60
- package/dist/content/idea.js +0 -416
- package/dist/content/language-policy.d.ts +0 -2
- package/dist/content/language-policy.js +0 -13
- package/dist/content/learnings.d.ts +0 -6
- package/dist/content/learnings.js +0 -141
- package/dist/content/observe.d.ts +0 -19
- package/dist/content/observe.js +0 -86
- package/dist/content/opencode-plugin.d.ts +0 -1
- package/dist/content/opencode-plugin.js +0 -635
- package/dist/content/review-prompts.d.ts +0 -1
- package/dist/content/review-prompts.js +0 -104
- package/dist/content/runtime-shared-snippets.d.ts +0 -8
- package/dist/content/runtime-shared-snippets.js +0 -80
- package/dist/content/session-hooks.d.ts +0 -7
- package/dist/content/session-hooks.js +0 -107
- package/dist/content/skills-elicitation.d.ts +0 -1
- package/dist/content/skills-elicitation.js +0 -167
- package/dist/content/stage-command.d.ts +0 -2
- package/dist/content/stage-command.js +0 -17
- package/dist/content/stage-schema.d.ts +0 -117
- package/dist/content/stage-schema.js +0 -955
- package/dist/content/stages/_lint-metadata/index.d.ts +0 -2
- package/dist/content/stages/_lint-metadata/index.js +0 -97
- package/dist/content/stages/brainstorm.d.ts +0 -2
- package/dist/content/stages/brainstorm.js +0 -184
- package/dist/content/stages/design.d.ts +0 -2
- package/dist/content/stages/design.js +0 -288
- package/dist/content/stages/index.d.ts +0 -8
- package/dist/content/stages/index.js +0 -11
- package/dist/content/stages/plan.d.ts +0 -2
- package/dist/content/stages/plan.js +0 -191
- package/dist/content/stages/review.d.ts +0 -2
- package/dist/content/stages/review.js +0 -240
- package/dist/content/stages/schema-types.d.ts +0 -203
- package/dist/content/stages/schema-types.js +0 -1
- package/dist/content/stages/scope.d.ts +0 -2
- package/dist/content/stages/scope.js +0 -254
- package/dist/content/stages/ship.d.ts +0 -2
- package/dist/content/stages/ship.js +0 -159
- package/dist/content/stages/spec.d.ts +0 -2
- package/dist/content/stages/spec.js +0 -170
- package/dist/content/stages/tdd.d.ts +0 -4
- package/dist/content/stages/tdd.js +0 -273
- package/dist/content/state-contracts.d.ts +0 -1
- package/dist/content/state-contracts.js +0 -63
- package/dist/content/status-command.d.ts +0 -4
- package/dist/content/status-command.js +0 -109
- package/dist/content/subagent-context-skills.d.ts +0 -4
- package/dist/content/subagent-context-skills.js +0 -279
- package/dist/content/subagents.d.ts +0 -3
- package/dist/content/subagents.js +0 -997
- package/dist/content/templates.d.ts +0 -26
- package/dist/content/templates.js +0 -1692
- package/dist/content/track-render-context.d.ts +0 -18
- package/dist/content/track-render-context.js +0 -53
- package/dist/content/tree-command.d.ts +0 -1
- package/dist/content/tree-command.js +0 -64
- package/dist/content/utility-skills.d.ts +0 -30
- package/dist/content/utility-skills.js +0 -160
- package/dist/content/view-command.d.ts +0 -2
- package/dist/content/view-command.js +0 -92
- package/dist/delegation.d.ts +0 -649
- package/dist/delegation.js +0 -1539
- package/dist/early-loop.d.ts +0 -70
- package/dist/early-loop.js +0 -302
- package/dist/execution-topology.d.ts +0 -36
- package/dist/execution-topology.js +0 -73
- package/dist/gate-evidence.d.ts +0 -85
- package/dist/gate-evidence.js +0 -631
- package/dist/harness-adapters.d.ts +0 -151
- package/dist/harness-adapters.js +0 -756
- package/dist/harness-selection.d.ts +0 -31
- package/dist/harness-selection.js +0 -214
- package/dist/hook-schema.d.ts +0 -6
- package/dist/hook-schema.js +0 -114
- package/dist/hook-schemas/claude-hooks.v1.json +0 -10
- package/dist/hook-schemas/codex-hooks.v1.json +0 -10
- package/dist/hook-schemas/cursor-hooks.v1.json +0 -13
- package/dist/init-detect.d.ts +0 -2
- package/dist/init-detect.js +0 -50
- package/dist/internal/advance-stage/advance.d.ts +0 -89
- package/dist/internal/advance-stage/advance.js +0 -655
- package/dist/internal/advance-stage/cancel-run.d.ts +0 -8
- package/dist/internal/advance-stage/cancel-run.js +0 -19
- package/dist/internal/advance-stage/flow-state-coercion.d.ts +0 -3
- package/dist/internal/advance-stage/flow-state-coercion.js +0 -81
- package/dist/internal/advance-stage/helpers.d.ts +0 -14
- package/dist/internal/advance-stage/helpers.js +0 -145
- package/dist/internal/advance-stage/hook.d.ts +0 -8
- package/dist/internal/advance-stage/hook.js +0 -40
- package/dist/internal/advance-stage/parsers.d.ts +0 -72
- package/dist/internal/advance-stage/parsers.js +0 -357
- package/dist/internal/advance-stage/proactive-delegation-trace.d.ts +0 -24
- package/dist/internal/advance-stage/proactive-delegation-trace.js +0 -56
- package/dist/internal/advance-stage/review-loop.d.ts +0 -16
- package/dist/internal/advance-stage/review-loop.js +0 -199
- package/dist/internal/advance-stage/rewind.d.ts +0 -14
- package/dist/internal/advance-stage/rewind.js +0 -108
- package/dist/internal/advance-stage/start-flow.d.ts +0 -13
- package/dist/internal/advance-stage/start-flow.js +0 -241
- package/dist/internal/advance-stage/verify.d.ts +0 -21
- package/dist/internal/advance-stage/verify.js +0 -185
- package/dist/internal/advance-stage.d.ts +0 -7
- package/dist/internal/advance-stage.js +0 -138
- package/dist/internal/cohesion-contract-stub.d.ts +0 -24
- package/dist/internal/cohesion-contract-stub.js +0 -148
- package/dist/internal/compound-readiness.d.ts +0 -23
- package/dist/internal/compound-readiness.js +0 -102
- package/dist/internal/detect-public-api-changes.d.ts +0 -5
- package/dist/internal/detect-public-api-changes.js +0 -45
- package/dist/internal/detect-supply-chain-changes.d.ts +0 -6
- package/dist/internal/detect-supply-chain-changes.js +0 -138
- package/dist/internal/early-loop-status.d.ts +0 -7
- package/dist/internal/early-loop-status.js +0 -93
- package/dist/internal/envelope-validate.d.ts +0 -7
- package/dist/internal/envelope-validate.js +0 -66
- package/dist/internal/flow-state-repair.d.ts +0 -20
- package/dist/internal/flow-state-repair.js +0 -104
- package/dist/internal/plan-split-waves.d.ts +0 -190
- package/dist/internal/plan-split-waves.js +0 -764
- package/dist/internal/runtime-integrity.d.ts +0 -7
- package/dist/internal/runtime-integrity.js +0 -268
- package/dist/internal/slice-commit.d.ts +0 -7
- package/dist/internal/slice-commit.js +0 -619
- package/dist/internal/tdd-loop-status.d.ts +0 -14
- package/dist/internal/tdd-loop-status.js +0 -68
- package/dist/internal/tdd-red-evidence.d.ts +0 -7
- package/dist/internal/tdd-red-evidence.js +0 -153
- package/dist/internal/waiver-grant.d.ts +0 -62
- package/dist/internal/waiver-grant.js +0 -294
- package/dist/internal/wave-status.d.ts +0 -63
- package/dist/internal/wave-status.js +0 -450
- package/dist/managed-resources.d.ts +0 -53
- package/dist/managed-resources.js +0 -313
- package/dist/policy.d.ts +0 -10
- package/dist/policy.js +0 -167
- package/dist/retro-gate.d.ts +0 -9
- package/dist/retro-gate.js +0 -47
- package/dist/run-archive.d.ts +0 -61
- package/dist/run-archive.js +0 -391
- package/dist/runs.d.ts +0 -2
- package/dist/runs.js +0 -2
- package/dist/stack-detection.d.ts +0 -116
- package/dist/stack-detection.js +0 -489
- package/dist/streaming/event-stream.d.ts +0 -31
- package/dist/streaming/event-stream.js +0 -114
- package/dist/tdd-cycle.d.ts +0 -107
- package/dist/tdd-cycle.js +0 -289
- package/dist/tdd-verification-evidence.d.ts +0 -17
- package/dist/tdd-verification-evidence.js +0 -122
- package/dist/track-heuristics.d.ts +0 -27
- package/dist/track-heuristics.js +0 -154
- package/dist/util/slice-id.d.ts +0 -58
- package/dist/util/slice-id.js +0 -89
- package/dist/worktree-manager.d.ts +0 -20
- package/dist/worktree-manager.js +0 -108
|
@@ -1,236 +1,250 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
- \`.cclaw/artifacts/00-idea.md\` if it already exists (resumed flow).
|
|
59
|
-
- Common origin locations: \`docs/prd/**\`, \`docs/rfcs/**\`, \`docs/adr/**\`, \`docs/design/**\`, \`specs/**\`, \`prd/**\`, \`rfc/**\`, \`design/**\`, root-level \`PRD.md\` / \`SPEC.md\` / \`DESIGN.md\` / \`REQUIREMENTS.md\` / \`ROADMAP.md\`.
|
|
60
|
-
- Summarize each discovered doc in \`00-idea.md\` under a \`Discovered context\` section with path + 1-line summary.
|
|
61
|
-
- If an origin doc contradicts the prompt, surface the conflict to the user before routing.
|
|
62
|
-
|
|
63
|
-
4. **Phase 2 — Tech-stack + version detection.** Sniff the repo for stack + language versions and record under \`Stack:\`:
|
|
64
|
-
- Node: \`package.json\` \`engines\` / \`volta\` / \`packageManager\` / \`devDependencies\`.
|
|
65
|
-
- Python: \`pyproject.toml\` / \`requirements*.txt\` / \`.python-version\`.
|
|
66
|
-
- Go: \`go.mod\` (module + Go version).
|
|
67
|
-
- Rust: \`Cargo.toml\` (\`[package]\` + \`rust-version\`).
|
|
68
|
-
- Java/Kotlin: \`pom.xml\` / \`build.gradle*\` + toolchain version.
|
|
69
|
-
- Containers: \`Dockerfile\`, \`docker-compose*.yml\`.
|
|
70
|
-
- CI: \`.github/workflows\`, \`.gitlab-ci.yml\`.
|
|
71
|
-
Skip detection quietly if no markers are found — do NOT invent a stack.
|
|
72
|
-
|
|
73
|
-
5. Read \`${flowPath}\`.
|
|
74
|
-
6. If flow already has completed stages, warn the user that starting a new tracked flow will reset progress. Ask for confirmation before proceeding. A fresh init placeholder state with \`completedStages: []\`, no passed gates, and no \`00-idea.md\` is **not** an active flow; do not ask the user to resume it.
|
|
75
|
-
7. **Internal track heuristic** — classify the idea text and compute an internal track recommendation before any state mutation:
|
|
76
|
-
- First, load \`${RUNTIME_ROOT}/config.yaml\`. If \`trackHeuristics\` is defined, apply those per-track vocabulary hints (\`fallback\`, \`tracks.<id>.{triggers,veto}\`) on top of the built-in defaults. Evaluation order is always \`standard -> medium -> quick\` (narrow-to-broad).
|
|
77
|
-
- **quick** (\`spec → tdd → review → ship\`) — single-purpose work where the spec is essentially already known. Quick skips ceremony, not safety: spec approval, TDD evidence, review, and ship gates remain mandatory.
|
|
78
|
-
Triggers (case-insensitive substring or close variant): \`bug\`, \`bugfix\`, \`fix\`, \`hotfix\`, \`patch\`, \`typo\`, \`regression\`, \`copy change\`, \`rename\`, \`bump\`, \`upgrade dep\`, \`config tweak\`, \`docs only\`, \`comment\`, \`lint\`, \`format\`, \`small\`, \`tiny\`, \`one-liner\`, \`revert\`.
|
|
79
|
-
- **medium** (\`brainstorm → spec → plan → tdd → review → ship\`) — additive work that fits existing architecture and still needs product framing.
|
|
80
|
-
Triggers: \`add endpoint\`, \`add field\`, \`extend existing\`, \`wire integration\`, \`small migration\`, \`new screen following existing patterns\`.
|
|
81
|
-
- **standard** (full 8 stages — default fallback) — anything that introduces a new capability with architecture uncertainty, touches many modules, or has unclear scope.
|
|
82
|
-
Triggers: \`new feature\`, \`refactor\`, \`migration\`, \`platform\`, \`architecture\`, \`schema\`, \`integrate\`, \`workflow\`, \`onboarding\`, or any prompt that does not match quick/medium confidently.
|
|
83
|
-
- When triggers conflict, prefer **standard** over **medium**, and **medium** over **quick**.
|
|
84
|
-
- Report **track selection confidence** as high/medium/low with the matched trigger or fallback reason, plus one sentence explaining what the selected track skips and what safety gates remain. Be explicit that this recommendation is advisory until the user accepts and the managed helper writes state; after that, \`/cc\` follows the configured track.
|
|
85
|
-
8. Present one compact **Start framing** summary: class, internal track recommendation, track selection confidence, stack, origin docs, seed recalls, and the recommended next action. Ask a single confirmation question only when there is a destructive reset, a real contradiction, or ambiguous software/non-software classification.
|
|
86
|
-
9. Ask one explicit **discovery mode** question and make it the only normal start-of-run user choice:
|
|
87
|
-
> \`Choose discovery mode: Lean / Guided / Deep\`.
|
|
88
|
-
> \`Lean\` = compact shaping, \`Guided\` = recommended default with enough questions and key specialists before drafting, \`Deep\` = stronger probing and broader specialist/research passes.
|
|
89
|
-
> Mention the internal track recommendation only as context, not as the primary decision. Offer track override only when reset, contradiction, or reclassification evidence makes the internal recommendation suspect.
|
|
90
|
-
Normalize the user's answer before calling the start helper: \`trim\`, lower-case, map UI labels to \`lean\` / \`guided\` / \`deep\` only; if the answer is not one of those three, re-ask the same question once with the compact definitions. In \`flow-state.json\`, persist only the canonical lowercase token (never \`Deep\`/\`Guided\` casing).
|
|
91
|
-
If the user prompt is one short line (at most 12 words) and the workspace matches an empty-repo signal set — either \`flow-state.repoSignals\` from the last successful \`start-flow\` shows \`fileCount < 5\` with \`hasReadme\` and \`hasPackageManifest\` both false, OR (before any \`start-flow\` yet) a shallow scan finds no root \`README.md\`, no root \`package.json\`/\`pyproject.toml\`/\`Cargo.toml\`, and fewer than five relevant files excluding \`node_modules\`/\`.git\` — recommend \`guided\` and ask for explicit confirmation before defaulting to \`deep\`.
|
|
92
|
-
If the harness's native ask tool is available (\`AskUserQuestion\` / \`AskQuestion\` / \`question\` / \`request_user_input\`), send exactly ONE question; on schema error, fall back to a plain-text lettered list.
|
|
93
|
-
10. Start the tracked flow only through the managed helper:
|
|
94
|
-
\`node .cclaw/hooks/start-flow.mjs --track=<quick|medium|standard> --discovery-mode=<lean|guided|deep> --class=<class> --prompt=<prompt> --stack=<stack> --reason=<matched heuristic>\`
|
|
95
|
-
If this helper fails, STOP. Report one human-readable failure line from the JSON \`error\` field, include the helper JSON payload in a fenced \`json\` block, and never echo the invoking command line. Do **not** manually edit \`${flowPath}\`.
|
|
96
|
-
11. The helper persists \`${flowPath}\`, computes \`skippedStages\`, sets the first stage for the track, resets the gate catalog, and writes \`.cclaw/artifacts/00-idea.md\`.
|
|
97
|
-
12. Load the **first-stage skill for the chosen track** and its command file:
|
|
98
|
-
- quick → \`.cclaw/skills/spec/SKILL.md\`
|
|
99
|
-
- medium/standard → \`.cclaw/skills/brainstorm/SKILL.md\`
|
|
100
|
-
- trivial fast-path → quick track spec skill per Phase 0 decision.
|
|
101
|
-
13. Execute that stage with the prompt + Phase 1/Phase 2 + seed context as initial input.
|
|
102
|
-
|
|
103
|
-
### Reclassification on discovery
|
|
104
|
-
|
|
105
|
-
If during any stage the agent discovers evidence that contradicts the initial Phase 0 / track decision (e.g. a supposedly \`trivial\` change turns out to require schema migration, a \`quick\` bug fix turns out to need design discussion, an origin doc reveals scope 3× larger than the prompt), STOP and re-classify:
|
|
106
|
-
|
|
107
|
-
1. Surface the new evidence in plain text.
|
|
108
|
-
2. Propose the updated \`Class\`, internal \`Track\`, and (when discovery posture should change) \`Discovery mode\` with a one-line reason.
|
|
109
|
-
3. Use the Decision Protocol to let the user accept, override, or cancel.
|
|
110
|
-
4. On acceptance: run \`node .cclaw/hooks/start-flow.mjs --reclassify --track=<new-track> --discovery-mode=<lean|guided|deep> --class=<new-class> --reason=<why>\`. The helper appends a \`Reclassification:\` entry to \`00-idea.md\` and updates flow state atomically. If it fails, STOP and report one human-readable line plus the helper JSON payload in a fenced \`json\` block; never echo the invoking command line. Do NOT manually edit \`flow-state.json\`.
|
|
111
|
-
|
|
112
|
-
### Without prompt (\`/cc\`)
|
|
113
|
-
|
|
114
|
-
1. Read \`${flowPath}\`.
|
|
115
|
-
2. If flow state is missing → guide the user to run \`npx cclaw-cli init\` and stop.
|
|
116
|
-
3. If flow state is only a fresh init placeholder (\`completedStages: []\`, all \`passed\` arrays empty, and no \`00-idea.md\`) → stop and ask for \`/cc <prompt>\` to start a tracked run. Do not create a brainstorm state implicitly.
|
|
117
|
-
4. Otherwise check current stage gates, resume if incomplete, and advance if complete.
|
|
118
|
-
5. **TDD wave dispatch:** When \`currentStage\` is \`tdd\`, run \`node .cclaw/cli.mjs internal wave-status --json\` first, then read the managed **Parallel Execution Plan** block inside \`${RUNTIME_ROOT}/artifacts/05-plan.md\` plus \`${RUNTIME_ROOT}/artifacts/wave-plans/\` for detail. Resume partial waves on remaining members only.
|
|
119
|
-
|
|
120
|
-
**The controller preserves TDD evidence.** When \`topology: parallel-builders\` and \`pathConflicts: []\`, fan out the ready independent units in a SINGLE controller message: one harness \`Task(subagent_type=…, description="slice-builder S-<id>", prompt=<full slice context>)\` call per routed builder, **side by side in the same tool batch**. Each \`slice-builder\` span owns the full RED → GREEN → REFACTOR → DOC cycle for its feature-atomic unit and emits its own \`delegation-record --phase=red|green|refactor|refactor-deferred|doc\` rows. RED-before-GREEN is enforced per-slice by the linter.
|
|
121
|
-
|
|
122
|
-
When \`mode: blocked\` with \`pathConflicts\`, surface exactly one AskQuestion that lets the user resolve the overlap (drop / split / serialize). When \`topology: single-builder\`, dispatch one \`Task\` for the next ready unit. When \`topology: inline\`, execute inline only if the same RED/GREEN/REFACTOR evidence and path/commit gates can be satisfied.
|
|
123
|
-
|
|
124
|
-
6. **Auto-advance after stage-complete:** when \`stage-complete\` returns \`ok\` with a new \`currentStage\`, immediately load the next stage skill and continue without waiting for the user to retype \`/cc\`. Announce \`Stage <prev> complete → entering <next>. Continuing.\` and proceed.
|
|
125
|
-
|
|
126
|
-
## Headless mode (CI/automation only)
|
|
127
|
-
|
|
128
|
-
Headless envelopes are a machine-mode exception for CI/automation orchestration.
|
|
129
|
-
In normal interactive runs, respond in natural language instead of emitting an envelope.
|
|
130
|
-
When called by another skill or subagent in machine mode, emit exactly one JSON envelope (no prose) and stop:
|
|
1
|
+
import { CORE_AGENTS } from "./core-agents.js";
|
|
2
|
+
import { ironLawsMarkdown } from "./iron-laws.js";
|
|
3
|
+
import { failureModesChecklist } from "./review-loop.js";
|
|
4
|
+
const SPECIALIST_LIST = CORE_AGENTS.map((agent) => `- **${agent.id}** (${agent.modes.join(" / ")}) — ${agent.description}`).join("\n");
|
|
5
|
+
const PLAN_FRONTMATTER_EXAMPLE = `\`\`\`yaml
|
|
6
|
+
---
|
|
7
|
+
slug: approval-page
|
|
8
|
+
stage: plan
|
|
9
|
+
status: active
|
|
10
|
+
ac:
|
|
11
|
+
- id: AC-1
|
|
12
|
+
text: "User sees an approval status pill on the dashboard."
|
|
13
|
+
status: pending
|
|
14
|
+
- id: AC-2
|
|
15
|
+
text: "Pending approvals show a tooltip with the approver's name."
|
|
16
|
+
status: pending
|
|
17
|
+
last_specialist: null
|
|
18
|
+
refines: null
|
|
19
|
+
shipped_at: null
|
|
20
|
+
ship_commit: null
|
|
21
|
+
review_iterations: 0
|
|
22
|
+
security_flag: false
|
|
23
|
+
---
|
|
24
|
+
\`\`\``;
|
|
25
|
+
const COMMIT_HELPER_EXAMPLE = `\`\`\`bash
|
|
26
|
+
# RED — failing test only, no production edits
|
|
27
|
+
git add tests/unit/approval-pill.test.tsx
|
|
28
|
+
node .cclaw/hooks/commit-helper.mjs --ac=AC-1 --phase=red \\
|
|
29
|
+
--message="red(AC-1): pill renders pending status"
|
|
30
|
+
|
|
31
|
+
# GREEN — minimal production change, full suite must be green
|
|
32
|
+
git add src/components/ApprovalPill.tsx
|
|
33
|
+
node .cclaw/hooks/commit-helper.mjs --ac=AC-1 --phase=green \\
|
|
34
|
+
--message="green(AC-1): minimal pill component for pending state"
|
|
35
|
+
|
|
36
|
+
# REFACTOR — applied or explicitly skipped (silence is not allowed)
|
|
37
|
+
node .cclaw/hooks/commit-helper.mjs --ac=AC-1 --phase=refactor --skipped \\
|
|
38
|
+
--message="refactor(AC-1) skipped: 18-line addition, idiomatic"
|
|
39
|
+
\`\`\``;
|
|
40
|
+
const REFINEMENT_EXAMPLE = `\`\`\`yaml
|
|
41
|
+
---
|
|
42
|
+
slug: approval-page-tooltips
|
|
43
|
+
stage: plan
|
|
44
|
+
status: active
|
|
45
|
+
ac:
|
|
46
|
+
- id: AC-1
|
|
47
|
+
text: "Approval pill shows a tooltip with the approver's email on hover."
|
|
48
|
+
status: pending
|
|
49
|
+
last_specialist: null
|
|
50
|
+
refines: approval-page # the original shipped slug
|
|
51
|
+
shipped_at: null
|
|
52
|
+
ship_commit: null
|
|
53
|
+
review_iterations: 0
|
|
54
|
+
security_flag: false
|
|
55
|
+
---
|
|
56
|
+
\`\`\``;
|
|
57
|
+
export const START_COMMAND_BODY = `# /cc — cclaw orchestrator
|
|
131
58
|
|
|
132
|
-
|
|
133
|
-
{"version":"1","kind":"stage-output","stage":"<currentStage>","payload":{"command":"/cc","track":"<track>","action":"start_or_resume"},"emittedAt":"<ISO-8601>"}
|
|
134
|
-
\`\`\`
|
|
59
|
+
You are the cclaw orchestrator. The user's request is: ${"`{{TASK}}`"}.
|
|
135
60
|
|
|
136
|
-
|
|
137
|
-
\`npx cclaw-cli internal envelope-validate --stdin\`
|
|
61
|
+
This document is your operating manual. Follow it in order. Skipping a step usually surfaces later as a failed gate.
|
|
138
62
|
|
|
139
|
-
##
|
|
63
|
+
## Step 0 — Sanity check
|
|
140
64
|
|
|
141
|
-
|
|
65
|
+
1. Read \`.cclaw/state/flow-state.json\`.
|
|
66
|
+
2. If the file is missing → it is a fresh session. Continue.
|
|
67
|
+
3. If \`schemaVersion\` is not \`2\` → **stop**. Surface this verbatim to the user:
|
|
142
68
|
|
|
143
|
-
|
|
69
|
+
> "This project's flow-state.json is from cclaw 7.x. cclaw v8 cannot resume it. Choose: (a) finish or abandon the run with cclaw 7.x; (b) delete \`.cclaw/state/flow-state.json\` and start a new v8 plan; (c) leave it alone and ask me again later."
|
|
144
70
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
71
|
+
Do not auto-migrate. Do not delete state on the user's behalf.
|
|
72
|
+
|
|
73
|
+
## Step 1 — Existing-plan detection
|
|
74
|
+
|
|
75
|
+
Glob \`.cclaw/flows/*/plan.md\` (skip \`shipped/\` and \`cancelled/\`) and \`.cclaw/flows/shipped/*/plan.md\`. For each match:
|
|
76
|
+
|
|
77
|
+
- Compute slug overlap with the new task.
|
|
78
|
+
- Read the YAML frontmatter (use the \`artifact-frontmatter\` skill).
|
|
79
|
+
- Surface to the user: slug, status (\`active\` | \`shipped\` | \`cancelled\`), \`last_specialist\`, AC progress (committed/pending counts), and \`security_flag\`.
|
|
80
|
+
|
|
81
|
+
Then ask the user one of:
|
|
82
|
+
|
|
83
|
+
- **active match** → \`amend\` (add AC) / \`rewrite\` (replace plan body) / \`new\` (separate slug).
|
|
84
|
+
- **shipped match** → \`refine shipped <slug>\` (creates new plan with \`refines: <old-slug>\`) / \`new unrelated\`.
|
|
85
|
+
- **cancelled match** → \`resume from cancelled\` (move artifacts back to active) / \`new\`.
|
|
86
|
+
- **no match** → continue to Phase 0.
|
|
87
|
+
|
|
88
|
+
Refinement always lives inside \`/cc\`. There is no \`/cc-amend\`. There is no auto-merge with the prior plan; the user picks.
|
|
89
|
+
|
|
90
|
+
## Step 2 — Phase 0 calibration
|
|
91
|
+
|
|
92
|
+
Ask the user **once**:
|
|
93
|
+
|
|
94
|
+
> "Targeted change in one place, or a feature spanning multiple components?"
|
|
95
|
+
|
|
96
|
+
Combine the answer with these heuristics to pick a routing class:
|
|
97
|
+
|
|
98
|
+
| Class | Trigger | Action |
|
|
99
|
+
| --- | --- | --- |
|
|
100
|
+
| trivial | typo / format / rename / docs-only edit, ≤1 file, ≤30 lines | edit + commit per AC, no \`plan.md\` |
|
|
101
|
+
| small / medium | new functionality in 1-3 modules, 1-5 AC, no architectural questions | inline plan/build/review/ship |
|
|
102
|
+
| large / abstract / risky | >5 AC, ambiguous prompt, architectural decision, security-sensitive, multi-component | propose specialists |
|
|
103
|
+
|
|
104
|
+
If the answer disagrees with the heuristic, prefer the **larger** class — agents underestimate scope more often than they overestimate.
|
|
105
|
+
|
|
106
|
+
## Step 3 — Specialist routing (large / risky only)
|
|
107
|
+
|
|
108
|
+
Ask the user once which specialists to invoke. Default proposal:
|
|
109
|
+
|
|
110
|
+
> "This looks like a larger task. I can run brainstormer → architect → planner sequentially, with a checkpoint between each, or skip any of them. Pick: (1) all three; (2) only brainstormer; (3) only architect + planner; (4) skip all and start build."
|
|
111
|
+
|
|
112
|
+
After the choice, run the selected specialists **sequentially with a checkpoint between each**:
|
|
113
|
+
|
|
114
|
+
1. \`brainstormer\` writes Context / Frame / Scope into \`plans/<slug>.md\` → user reads → continue with architect?
|
|
115
|
+
2. \`architect\` writes \`decisions/<slug>.md\` and adds Architecture subsection to \`plans/<slug>.md\` → user reads → continue with planner?
|
|
116
|
+
3. \`planner\` writes Plan / Phases / Acceptance Criteria / Topology into \`plans/<slug>.md\` → user reads → enter build.
|
|
117
|
+
|
|
118
|
+
The user can stop after any checkpoint and proceed with what is already in \`plan.md\`.
|
|
119
|
+
|
|
120
|
+
Available specialists (with modes):
|
|
121
|
+
|
|
122
|
+
${SPECIALIST_LIST}
|
|
123
|
+
|
|
124
|
+
\`reviewer\` is a multi-mode specialist. \`security-reviewer\` is separate; invoke it when the diff or task touches authn / authz / secrets / supply chain / data exposure.
|
|
157
125
|
|
|
158
|
-
|
|
126
|
+
## Step 4 — Plan template
|
|
159
127
|
|
|
160
|
-
|
|
128
|
+
If you are starting a new plan (no existing match), seed \`plans/<slug>.md\` from \`.cclaw/lib/templates/plan.md\` and replace \`SLUG-PLACEHOLDER\` with the actual slug. The frontmatter must include all fields below. Do not skip any.
|
|
161
129
|
|
|
162
|
-
|
|
130
|
+
${PLAN_FRONTMATTER_EXAMPLE}
|
|
163
131
|
|
|
164
|
-
|
|
165
|
-
- **With a prompt** → classifies the task, asks for one discovery mode (lean/guided/deep), resolves an internal track (quick/medium/standard), and starts the **first stage of that track** (not always brainstorm — e.g. the \`quick\` track starts at \`spec\`)
|
|
132
|
+
For a refinement, set \`refines\` to the parent slug:
|
|
166
133
|
|
|
167
|
-
|
|
134
|
+
${REFINEMENT_EXAMPLE}
|
|
168
135
|
|
|
169
|
-
|
|
136
|
+
## Step 5 — Build (TDD cycle)
|
|
170
137
|
|
|
171
|
-
|
|
172
|
-
## Protocol
|
|
138
|
+
**Build is the TDD stage.** Every AC goes through RED → GREEN → REFACTOR. There is no other build mode. Use \`slice-builder\` (or implement inline for small tasks).
|
|
173
139
|
|
|
174
|
-
|
|
140
|
+
For each AC:
|
|
175
141
|
|
|
176
|
-
1. **
|
|
177
|
-
2. **
|
|
178
|
-
3. **Origin-document discovery (Phase 1).** Scan for \`docs/prd/**\`, \`docs/rfcs/**\`, \`docs/adr/**\`, \`docs/design/**\`, \`specs/**\`, root-level \`PRD.md\` / \`SPEC.md\` / \`DESIGN.md\` / \`REQUIREMENTS.md\`. Summarize any hits in \`00-idea.md\` under \`Discovered context\`. Surface conflicts with the prompt before routing.
|
|
179
|
-
4. **Stack detection (Phase 2).** Inspect \`package.json\` engines, \`pyproject.toml\`, \`go.mod\`, \`Cargo.toml\`, \`pom.xml\`, \`build.gradle*\`, \`Dockerfile\`, \`docker-compose*.yml\`, and CI configs. Record stack + versions on the \`Stack:\` line. Do not invent stack details.
|
|
180
|
-
5. Read \`${flowPath}\`.
|
|
181
|
-
6. If \`completedStages\` is non-empty:
|
|
182
|
-
- Inform: "You have an active flow at stage **{currentStage}** with {N} completed stages. Starting a new tracked flow will reset progress."
|
|
183
|
-
- Ask: "Continue with reset? (A) Yes, start fresh (B) No, resume current flow"
|
|
184
|
-
- If (B) → switch to Path B behavior.
|
|
185
|
-
If \`completedStages\` is empty, all gate \`passed\` arrays are empty, and \`${RUNTIME_ROOT}/artifacts/00-idea.md\` is missing, treat it as a fresh init placeholder — do **not** ask whether to continue the current flow.
|
|
186
|
-
7. **Classify the idea** using the heuristic below and present one compact Start framing summary (class, internal track recommendation, stack, origin docs, seed recalls, next action). Wait for explicit confirmation or override before mutating any state only when reset/conflict/ambiguity makes it necessary.
|
|
187
|
-
- If \`${RUNTIME_ROOT}/config.yaml\` defines \`trackHeuristics\`, apply those vocabulary hints (\`fallback\`, \`tracks.<id>.{triggers,veto}\`) on top of built-in defaults. Evaluation order is fixed: \`standard -> medium -> quick\`. (Honest note: this is advisory prose; the LLM applies it, not a Node-level router.)
|
|
142
|
+
1. **Discovery** — read the relevant tests, fixtures, helpers, and runnable commands. Cite each finding as \`file:path:line\` in the AC's row in \`builds/<slug>.md\`.
|
|
143
|
+
2. **RED** — write a failing test that encodes the AC's verification line. The test must fail for the **right reason** (the assertion that encodes the AC, not a syntax/import error). **Test file is named after the unit under test, never after the AC id** (\`tests/unit/permissions.test.ts\`, not \`AC-1.test.ts\`). Stage **test files only**, then commit:
|
|
188
144
|
|
|
189
|
-
|
|
145
|
+
${COMMIT_HELPER_EXAMPLE}
|
|
190
146
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
| \`medium\` | \`add endpoint\`, \`add field\`, \`extend existing\`, \`wire integration\`, \`small migration\`, \`new screen following existing pattern\` | Additive work with existing architecture |
|
|
195
|
-
| \`standard\` | \`new feature\`, \`refactor\`, \`migration\`, \`platform\`, \`architecture\`, \`schema\`, \`integrate\`, \`workflow\`, \`onboarding\` (or no confident quick/medium match) | New or uncertain multi-module work |
|
|
147
|
+
3. **GREEN** — write the smallest production change that turns RED into PASS. Run the **full relevant suite** (not the single test). Stage and commit with \`--phase=green\`.
|
|
148
|
+
4. **REFACTOR** (mandatory) — either apply a real refactor and commit with \`--phase=refactor\`, or explicitly skip with \`--phase=refactor --skipped --message="refactor(AC-N) skipped: <reason>"\`. Silence fails the gate.
|
|
149
|
+
5. Append the row to \`builds/<slug>.md\` with all six columns (Discovery, RED proof, GREEN evidence, REFACTOR notes, commits) filled.
|
|
196
150
|
|
|
197
|
-
|
|
198
|
-
- Always state the recommendation as a one-line reason citing matched triggers and a high/medium/low track selection confidence. Clarify that the heuristic is advisory until the managed helper writes state; after that, \`/cc\` follows the selected track. Include override guidance: switch to standard when architecture, schema, migration, security, or unclear scope appears; switch to medium when product framing is needed but architecture is known.
|
|
199
|
-
8. Ask for the single explicit start choice: \`Lean / Guided / Deep\`. Use \`Guided\` as the recommended default unless the user clearly wants compact shaping or unusually deep probing. Keep track internal unless contradiction/reset/reclassification requires surfacing an override.
|
|
200
|
-
Normalize the answer (\`trim\`, lower-case) to exactly \`lean\` / \`guided\` / \`deep\` before invoking the start helper; re-ask once if the reply is not one of those. Pass only canonical lowercase tokens to \`--discovery-mode\`.
|
|
201
|
-
If the prompt is one short line (at most 12 words) and the workspace matches an empty-repo signal set — either persisted \`repoSignals\` has \`fileCount < 5\` with \`hasReadme\` and \`hasPackageManifest\` false, OR a shallow scan before the first \`start-flow\` shows the same — recommend \`guided\` and confirm before defaulting to \`deep\`.
|
|
202
|
-
9. Run the managed start helper: \`node .cclaw/hooks/start-flow.mjs --track=<quick|medium|standard> --discovery-mode=<lean|guided|deep> --class=<class> --prompt=<prompt> --stack=<stack> --reason=<matched heuristic>\`. The helper writes \`${flowPath}\`, including \`discoveryMode\`, computes \`skippedStages\`, resets the gate catalog, and writes \`${RUNTIME_ROOT}/artifacts/00-idea.md\`. If it fails, STOP, report one human-readable failure line from the JSON \`error\` field, and include the helper JSON payload in a fenced \`json\` block; do not echo the invoking command line, and do not manually edit flow state.
|
|
203
|
-
10. Load and execute the **first stage skill of the chosen track** (\`brainstorm\` for medium/standard, \`spec\` for quick) plus its matching command file.
|
|
151
|
+
\`commit-helper.mjs\` enforces the cycle: GREEN without a prior RED is rejected; REFACTOR without RED+GREEN is rejected; RED commits that contain production files (\`src/\`, \`lib/\`, \`app/\`) are rejected.
|
|
204
152
|
|
|
205
|
-
|
|
153
|
+
> **Iron Law:** NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST. The RED failure is the spec.
|
|
154
|
+
|
|
155
|
+
Never call \`git commit\` directly. The hook is the only path that keeps AC ↔ commit traceability and the TDD cycle intact.
|
|
156
|
+
|
|
157
|
+
### Step 5a — Parallel-build dispatch (when planner declared it)
|
|
158
|
+
|
|
159
|
+
If \`plans/<slug>.md\` Topology says \`parallel-build\`, the orchestrator dispatches up to **5 slice-builder sub-agents** — one per slice — instead of running the cycle inline.
|
|
160
|
+
|
|
161
|
+
A **slice** is one or more AC sharing a touchSurface. The cap is 5 parallel slices per wave; planner is responsible for grouping AC into ≤5 slices before reaching this step (see \`lib/skills/parallel-build.md\`).
|
|
162
|
+
|
|
163
|
+
For each slice:
|
|
164
|
+
|
|
165
|
+
1. Create a worktree if the harness supports it: \`git worktree add .cclaw/worktrees/<slug>-<slice-id> -b cclaw/<slug>/<slice-id>\`.
|
|
166
|
+
2. Dispatch a \`slice-builder\` sub-agent rooted at the worktree path. Pass the slice id, the AC ids it owns, the touchSurface, and the worktree cwd.
|
|
167
|
+
3. Each slice-builder runs the full RED → GREEN → REFACTOR cycle for every AC it owns, sequentially inside its slice.
|
|
168
|
+
|
|
169
|
+
After all slices return, invoke \`reviewer\` in mode \`integration\` (sub-agent if available, inline otherwise). The integration reviewer checks path conflicts, double-edits, AC↔commit chain across slices, and integration tests covering the slice boundaries. \`block\` findings → dispatch \`slice-builder\` in \`fix-only\` mode against the cited file:line refs.
|
|
170
|
+
|
|
171
|
+
If the harness does not support sub-agent dispatch (or worktree creation fails — non-git repo, permission denied), parallel-build **degrades silently to \`inline\`**: all slices run sequentially in the main working tree. Record the fallback in \`builds/<slug>.md\`. This is not an error.
|
|
172
|
+
|
|
173
|
+
### When to use sub-agents (and when not to)
|
|
174
|
+
|
|
175
|
+
Use sub-agents for:
|
|
176
|
+
|
|
177
|
+
- **Parallel slice dispatch** during \`parallel-build\` (cap: 5).
|
|
178
|
+
- **Specialist context isolation** for \`architect\`, \`security-reviewer\`, and the integration \`reviewer\` when the harness supports it. A fresh sub-agent reads a small focused filebag instead of the orchestrator's full history.
|
|
179
|
+
|
|
180
|
+
Do **not** use sub-agents for:
|
|
181
|
+
|
|
182
|
+
- Trivial / small / medium slugs (≤4 AC). Run inline. The dispatch overhead is not worth saving 1-2 AC of wall-clock.
|
|
183
|
+
- Sequential work that does not actually parallelize.
|
|
184
|
+
- Routine work the orchestrator can finish in 1-2 turns.
|
|
185
|
+
|
|
186
|
+
## Step 6 — Review
|
|
187
|
+
|
|
188
|
+
Run \`reviewer\` (and \`security-reviewer\` when relevant). Five Failure Modes are mandatory:
|
|
189
|
+
|
|
190
|
+
${failureModesChecklist()}
|
|
191
|
+
|
|
192
|
+
Hard cap: 5 review/fix iterations per slug. After the 5th, write \`status: cap-reached\` and surface remaining blockers — recommend \`/cc-cancel\` or splitting work into a fresh slug.
|
|
193
|
+
|
|
194
|
+
Block-level findings → \`slice-builder\` runs in \`fix-only\` mode against the cited file:path:line list, then re-review.
|
|
195
|
+
|
|
196
|
+
## Step 7 — Ship
|
|
197
|
+
|
|
198
|
+
Write \`ships/<slug>.md\` from \`.cclaw/lib/templates/ship.md\` with release notes, the AC ↔ commit map, and push/PR refs.
|
|
199
|
+
|
|
200
|
+
**Push and PR creation always require explicit user approval in the current turn.** Never run \`git push\` without asking. Never open a PR without asking. \`commit-per-AC\` is auto; everything past commit is not.
|
|
201
|
+
|
|
202
|
+
If the user approves \`git push\`, do that one action and stop. Do not proactively open a PR after pushing unless the user asked.
|
|
203
|
+
|
|
204
|
+
## Step 8 — Compound (automatic)
|
|
205
|
+
|
|
206
|
+
After ship, automatically check the compound quality gate. Capture \`learnings/<slug>.md\` only if at least one signal is present:
|
|
207
|
+
|
|
208
|
+
- a non-trivial decision was recorded by \`architect\` or \`planner\`;
|
|
209
|
+
- review needed three or more iterations;
|
|
210
|
+
- a security review ran or \`security_flag\` is true;
|
|
211
|
+
- the user explicitly asked to capture (\`/cc <task> --capture-learnings\`).
|
|
212
|
+
|
|
213
|
+
If the gate fails, do not write a learning — silently skip. If it passes:
|
|
214
|
+
|
|
215
|
+
1. Write \`learnings/<slug>.md\` from \`.cclaw/lib/templates/learnings.md\`.
|
|
216
|
+
2. Append one line to \`.cclaw/knowledge.jsonl\`:
|
|
217
|
+
|
|
218
|
+
\`\`\`json
|
|
219
|
+
{"slug":"approval-page","ship_commit":"abc1234","shipped_at":"2026-05-07T18:30:00Z","signals":{"hasArchitectDecision":true,"reviewIterations":2,"securityFlag":false,"userRequestedCapture":false}}
|
|
220
|
+
\`\`\`
|
|
206
221
|
|
|
207
|
-
|
|
222
|
+
## Step 9 — Active → shipped move
|
|
208
223
|
|
|
209
|
-
|
|
224
|
+
Move every \`<slug>.md\` from \`plans/ builds/ reviews/ ships/ decisions/ learnings/\` into \`.cclaw/flows/shipped/<slug>/\` as \`plan.md\`, \`build.md\`, etc. Write \`shipped/<slug>/manifest.md\` from \`.cclaw/lib/templates/manifest.md\` listing AC and ship_commit. Reset \`flow-state.json\` to \`currentSlug=null, currentStage=null, ac=[]\`.
|
|
210
225
|
|
|
211
|
-
|
|
226
|
+
## Always-ask rules
|
|
212
227
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
5. **TDD:** When \`currentStage\` is \`tdd\`, run \`wave-status --json\`, then reconcile the managed **Parallel Execution Plan** in \`05-plan.md\` with \`wave-plans/wave-NN.md\`. Route by \`nextDispatch.topology\`: \`parallel-builders\` fans out independent units in one controller message, \`single-builder\` dispatches one builder, \`inline\` executes directly only with equivalent evidence, and \`strict-micro\` preserves tiny-slice sequencing. If \`mode: blocked\`, resolve overlaps first. Each delegated \`slice-builder\` span owns its full RED → GREEN → REFACTOR → DOC cycle. Mirror plan \`dependsOn\` ordering between waves.
|
|
218
|
-
6. **Wave resume:** Parallelize unfinished members; never restart completed lanes. Integration-overseer follows \`integrationCheckRequired\`; when skipped, emit \`cclaw_integration_overseer_skipped\` per the hook contract.
|
|
219
|
-
7. If incomplete → load current stage skill and execute.
|
|
220
|
-
8. If complete → advance to next stage and execute. **Auto-advance:** when \`stage-complete\` returns \`ok\`, immediately load the next stage skill and continue without waiting for the user to retype \`/cc\`.
|
|
221
|
-
9. If flow is done → report completion.
|
|
228
|
+
- Always ask once before invoking specialists.
|
|
229
|
+
- Always ask before \`git push\` or PR creation.
|
|
230
|
+
- Always ask before deleting active artifacts (\`/cc-cancel\` is the supported way; do not \`rm\` artifacts directly).
|
|
231
|
+
- Always ask before resuming a refinement that crosses the trivial / medium / large boundary.
|
|
222
232
|
|
|
223
|
-
##
|
|
233
|
+
## Skills attached
|
|
224
234
|
|
|
225
|
-
|
|
235
|
+
The following skills auto-trigger during this flow. Do not re-explain them; obey them.
|
|
226
236
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
237
|
+
- **conversation-language** — always-on; reply in the user's language but never translate \`AC-N\`, \`D-N\`, \`F-N\`, slugs, paths, frontmatter keys, or hook output.
|
|
238
|
+
- **plan-authoring** — on every edit to \`.cclaw/flows/<slug>/plan.md\`.
|
|
239
|
+
- **ac-traceability** — before every commit and before push.
|
|
240
|
+
- **tdd-cycle** — always-on while stage=build; enforces RED → GREEN → REFACTOR per AC and the test-file-naming rule.
|
|
241
|
+
- **refinement** — when an existing plan match is detected.
|
|
242
|
+
- **parallel-build** — when planner topology is \`parallel-build\`; enforces the 5-slice cap and worktree dispatch.
|
|
243
|
+
- **security-review** — when the diff touches sensitive surfaces.
|
|
244
|
+
- **review-loop** — wraps every reviewer / security-reviewer invocation; runs the Concern Ledger + convergence detector.
|
|
233
245
|
|
|
234
|
-
|
|
246
|
+
${ironLawsMarkdown()}
|
|
235
247
|
`;
|
|
248
|
+
export function renderStartCommand() {
|
|
249
|
+
return START_COMMAND_BODY;
|
|
236
250
|
}
|