cclaw-cli 0.51.28 → 0.51.30
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/cli.d.ts +6 -1
- package/dist/cli.js +117 -64
- package/dist/codex-feature-flag.d.ts +1 -1
- package/dist/codex-feature-flag.js +1 -1
- package/dist/config.js +3 -0
- package/dist/content/cancel-command.d.ts +2 -0
- package/dist/content/cancel-command.js +25 -0
- package/dist/content/closeout-guidance.js +3 -3
- package/dist/content/core-agents.js +5 -5
- package/dist/content/harness-doc.js +1 -1
- package/dist/content/hooks.js +32 -9
- package/dist/content/ideate-command.js +12 -7
- package/dist/content/meta-skill.js +7 -9
- package/dist/content/next-command.d.ts +2 -2
- package/dist/content/next-command.js +31 -27
- package/dist/content/node-hooks.js +24 -8
- package/dist/content/opencode-plugin.js +1 -1
- package/dist/content/session-hooks.js +1 -1
- package/dist/content/stage-command.js +1 -1
- package/dist/content/stage-common-guidance.js +4 -4
- package/dist/content/stages/plan.js +2 -2
- package/dist/content/stages/review.js +1 -1
- package/dist/content/stages/tdd.js +1 -1
- package/dist/content/start-command.d.ts +2 -2
- package/dist/content/start-command.js +18 -15
- package/dist/content/status-command.js +9 -8
- package/dist/content/subagents.js +1 -1
- package/dist/content/templates.d.ts +1 -1
- package/dist/content/templates.js +2 -2
- package/dist/content/track-render-context.d.ts +1 -0
- package/dist/content/track-render-context.js +2 -0
- package/dist/doctor-registry.d.ts +2 -0
- package/dist/doctor-registry.js +37 -10
- package/dist/doctor.d.ts +2 -1
- package/dist/doctor.js +184 -8
- package/dist/flow-state.d.ts +1 -1
- package/dist/flow-state.js +1 -1
- package/dist/fs-utils.js +6 -0
- package/dist/harness-adapters.d.ts +2 -2
- package/dist/harness-adapters.js +21 -94
- package/dist/harness-selection.d.ts +31 -0
- package/dist/harness-selection.js +214 -0
- package/dist/install.d.ts +4 -1
- package/dist/install.js +47 -10
- package/dist/internal/advance-stage.js +7 -7
- package/dist/managed-resources.d.ts +53 -0
- package/dist/managed-resources.js +289 -0
- package/dist/policy.js +1 -1
- package/dist/run-archive.d.ts +8 -0
- package/dist/run-archive.js +23 -9
- package/dist/run-persistence.js +1 -1
- package/dist/runs.d.ts +1 -1
- package/dist/runs.js +1 -1
- package/dist/tdd-cycle.js +10 -10
- package/dist/tdd-verification-evidence.js +4 -4
- package/dist/track-heuristics.d.ts +2 -0
- package/dist/track-heuristics.js +11 -3
- package/package.json +1 -1
|
@@ -13,7 +13,7 @@ function generatedHelperSkillList() {
|
|
|
13
13
|
export function usingCclawSkillMarkdown() {
|
|
14
14
|
return `---
|
|
15
15
|
name: using-cclaw
|
|
16
|
-
description: "Routing brain for cclaw. Decide whether to start/resume a stage, answer directly, or use visible commands like /cc, /cc-
|
|
16
|
+
description: "Routing brain for cclaw. Decide whether to start/resume a stage, answer directly, or use visible commands like /cc, /cc-ideate, and /cc-cancel."
|
|
17
17
|
---
|
|
18
18
|
|
|
19
19
|
# Using Cclaw
|
|
@@ -65,11 +65,10 @@ Task arrives
|
|
|
65
65
|
├─ Pure question / non-software ask? -> answer directly (no stage)
|
|
66
66
|
├─ New software work? -> /cc <idea>
|
|
67
67
|
├─ Repo-improvement discovery? -> /cc-ideate
|
|
68
|
-
├─ Resume existing flow? -> /cc
|
|
68
|
+
├─ Resume existing flow? -> /cc
|
|
69
69
|
├─ Knowledge operation? -> load the learnings skill
|
|
70
|
-
├─
|
|
71
|
-
|
|
72
|
-
└─ Explicit early archival/reset? -> npx cclaw-cli archive [--name=<slug>]
|
|
70
|
+
├─ Normal post-ship closeout? -> /cc drives ${closeoutChainInline()}
|
|
71
|
+
└─ Explicit early cancellation/abandonment? -> /cc-cancel
|
|
73
72
|
\`\`\`
|
|
74
73
|
|
|
75
74
|
## Task classification
|
|
@@ -87,7 +86,7 @@ Task arrives
|
|
|
87
86
|
Before stage work:
|
|
88
87
|
|
|
89
88
|
1. Read \`.cclaw/state/flow-state.json\`.
|
|
90
|
-
2. If active stage exists, continue with \`/cc
|
|
89
|
+
2. If active stage exists, continue with \`/cc\`.
|
|
91
90
|
3. Do not jump directly to stage-specific commands.
|
|
92
91
|
|
|
93
92
|
## Platform reliability notes
|
|
@@ -98,13 +97,12 @@ Before stage work:
|
|
|
98
97
|
|
|
99
98
|
## Stage quick map
|
|
100
99
|
|
|
101
|
-
Use \`/cc <idea>\` for new work, \`/cc
|
|
100
|
+
Use \`/cc <idea>\` for new work, \`/cc\` for progression and closeout, \`/cc-ideate\` for backlog discovery, and \`/cc-cancel\` for cancellation/abandonment.
|
|
102
101
|
|
|
103
102
|
## Main vs Operator Surfaces
|
|
104
103
|
|
|
105
|
-
- **Main workflow:** \`/cc\`, \`/cc-
|
|
104
|
+
- **Main workflow:** \`/cc\`, \`/cc-ideate\`, and \`/cc-cancel\` inside the installed harness runtime.
|
|
106
105
|
- **Installer/support surface:** \`npx cclaw-cli init\`, \`npx cclaw-cli sync\`, \`npx cclaw-cli upgrade\`, \`npx cclaw-cli doctor\`, and explicit support/archive actions. Do not ask users to install or run a \`cclaw\` binary during normal stage flow.
|
|
107
|
-
- **Read-only support:** \`/cc-view tree\` and \`/cc-view diff\`.
|
|
108
106
|
- Use operator/support surfaces only for install/runtime diagnosis, explicit archival, or deeper inspection. Do not make them part of the happy path.
|
|
109
107
|
|
|
110
108
|
## Whole flow map
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
export declare const RALPH_LOOP_CONTRACT_MARKER = "ralph-loop-contract:v1";
|
|
11
11
|
export declare function ralphLoopContractSnippet(): string;
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* Internal compatibility contract for /cc-next.
|
|
14
|
+
* /cc is the promoted public progression command; this remains as an internal/legacy alias.
|
|
15
15
|
*/
|
|
16
16
|
export declare function nextCommandContract(): string;
|
|
17
17
|
/**
|
|
@@ -44,8 +44,8 @@ Ralph Loop fields never gate-check on their own.
|
|
|
44
44
|
<!-- ${RALPH_LOOP_CONTRACT_MARKER} -->`;
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
|
-
*
|
|
48
|
-
*
|
|
47
|
+
* Internal compatibility contract for /cc-next.
|
|
48
|
+
* /cc is the promoted public progression command; this remains as an internal/legacy alias.
|
|
49
49
|
*/
|
|
50
50
|
export function nextCommandContract() {
|
|
51
51
|
const flowPath = flowStatePath();
|
|
@@ -56,14 +56,14 @@ export function nextCommandContract() {
|
|
|
56
56
|
|
|
57
57
|
## Purpose
|
|
58
58
|
|
|
59
|
-
**
|
|
59
|
+
**Internal compatibility progression command.** \`/cc\` is the promoted public start/resume/continue command. This contract remains for legacy shims and internal references; read flow state, determine what to do:
|
|
60
60
|
|
|
61
61
|
- **Current stage not started / in progress** → load its skill and execute it.
|
|
62
62
|
- **Current stage complete (all gates passed)** → advance \`currentStage\` and load the next skill.
|
|
63
|
-
- **Ship complete** → continue the resumable ${closeoutChainInline()} closeout
|
|
63
|
+
- **Ship complete** → continue the resumable ${closeoutChainInline()} closeout. Public habit: use \`/cc\`.
|
|
64
64
|
- **Flow complete** → report done after closeout has archived the run.
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
The public habit is \`/cc\`; this command is a compatibility/internal route for the same progression behavior. Stage command contracts are internal implementation details.
|
|
67
67
|
|
|
68
68
|
## HARD-GATE
|
|
69
69
|
|
|
@@ -74,17 +74,17 @@ ${conversationLanguagePolicyMarkdown()}
|
|
|
74
74
|
|
|
75
75
|
## Algorithm (mandatory)
|
|
76
76
|
|
|
77
|
-
1. Read **\`${flowPath}\`**. If missing → **BLOCKED** (state missing).
|
|
77
|
+
1. Read **\`${flowPath}\`**. If missing → **BLOCKED** (state missing). Next action: run \`cclaw sync\` to safely regenerate generated runtime files, then \`cclaw doctor --explain\`; do not hand-edit state unless doctor says user repair is required.
|
|
78
78
|
2. Parse JSON. Capture \`currentStage\` and \`stageGateCatalog[currentStage]\`.
|
|
79
|
-
3. If \`staleStages[currentStage]\` exists, do not advance automatically. Report
|
|
80
|
-
4. Read **\`${reconciliationNoticesPath}\`** when present. If it contains entries for \`activeRunId + currentStage\` and the listed gate is still blocked in \`stageGateCatalog[currentStage].blocked\`, emit
|
|
79
|
+
3. If \`staleStages[currentStage]\` exists, do not advance automatically. Report \`Blocked by: stale stage\`, the marker reason/rewindId, the stage artifact work to re-run, and clear only the current stage marker with \`cclaw internal rewind --ack <currentStage>\` after rework.
|
|
80
|
+
4. Read **\`${reconciliationNoticesPath}\`** when present. If it contains entries for \`activeRunId + currentStage\` and the listed gate is still blocked in \`stageGateCatalog[currentStage].blocked\`, emit \`Blocked by: reconciliation notice\` with gate id, reason, and next action \`cclaw doctor --reconcile-gates --explain\`. Clarify that reconciliation refreshes derived gate status only; it does not repair missing artifacts or tests.
|
|
81
81
|
5. Let \`G\` = \`requiredGates\` for **\`currentStage\`** from the stage schema.
|
|
82
82
|
6. Let \`catalog\` = \`stageGateCatalog[currentStage]\` from flow state.
|
|
83
83
|
7. **Satisfied** for gate id \`g\`: \`g\` in \`catalog.passed\` and \`g\` not in \`catalog.blocked\`.
|
|
84
84
|
8. Let \`M\` = \`mandatoryDelegations\` for \`currentStage\`.
|
|
85
85
|
9. If \`M\` is non-empty, inspect **\`${delegationPath}\`**. Treat as satisfied only if each mandatory agent is **completed** or **waived**.
|
|
86
86
|
10. For each satisfied mandatory delegation row, verify \`evidenceRefs\` is a non-empty array (unless status is \`waived\` with rationale). Missing evidenceRefs means delegation is unresolved.
|
|
87
|
-
11. If any mandatory delegation is missing and no waiver exists: **STOP** and ask the user whether to dispatch now or waive with rationale.
|
|
87
|
+
11. If any mandatory delegation is missing and no waiver exists: **STOP** and ask the user whether to dispatch \`<agent>\` now or waive with rationale. State who must run, why the role is mandatory, whether the gap is ledger status, event-log dispatch proof, or artifact \`evidenceRefs\`, and do not mark gates passed while delegation is unresolved.
|
|
88
88
|
12. If \`currentStage === "review"\` and \`catalog.blocked\` includes \`review_criticals_resolved\`, treat this as a hard remediation branch: recommend the managed command \`cclaw internal rewind tdd "review_blocked_by_critical <finding-ids>"\`, and do not attempt to advance toward ship. After TDD rework, require \`cclaw internal rewind --ack tdd\` before continuing.
|
|
89
89
|
|
|
90
90
|
### Path A: Current stage is NOT complete (any gate unmet or delegation missing)
|
|
@@ -109,20 +109,20 @@ ${ralphLoopContractSnippet()}
|
|
|
109
109
|
|
|
110
110
|
\`flow-state.json\` carries a \`track\` field (\`"quick"\`, \`"medium"\`, or \`"standard"\`) and a \`skippedStages\` array.
|
|
111
111
|
|
|
112
|
-
- If \`track === "quick"\`, the critical path is **spec → tdd → review → ship**. When advancing, skip any stage listed in \`skippedStages\` — i.e. after the current stage completes, pick the next stage that is NOT in \`skippedStages\`.
|
|
112
|
+
- If \`track === "quick"\`, the critical path is **spec → tdd → review → ship**. Quick skips ceremony, not safety: spec approval, RED/GREEN/REFACTOR evidence, review, and ship gates still apply. When advancing, skip any stage listed in \`skippedStages\` — i.e. after the current stage completes, pick the next stage that is NOT in \`skippedStages\`.
|
|
113
113
|
- If \`track === "medium"\`, the critical path is **brainstorm → spec → plan → tdd → review → ship**. Scope and design are intentionally skipped unless the run is reclassified to standard.
|
|
114
114
|
- If \`track === "standard"\`, advance through all 8 stages in their natural order.
|
|
115
115
|
- Never manually reintroduce a skipped stage mid-run. If evidence shows the track was wrong, stop and use the managed start-flow helper with \`--reclassify\`; only that managed reclassification may add upstream stages back into the active track.
|
|
116
116
|
|
|
117
117
|
## Resume Semantics
|
|
118
118
|
|
|
119
|
-
\`/cc
|
|
119
|
+
\`/cc\` in a **new session** resumes from where you left off; \`/cc-next\` is a compatibility alias:
|
|
120
120
|
- Flow-state records \`currentStage\` and which gates have passed.
|
|
121
121
|
- The stage skill reads upstream artifacts and picks up context.
|
|
122
122
|
- ${closeoutSubstateInline()} carries the post-ship substate, so a crashed
|
|
123
123
|
session during retro/compound/archive resumes at the exact step without
|
|
124
124
|
regenerating the retro draft.
|
|
125
|
-
- No special resume command needed — \`/cc
|
|
125
|
+
- No special resume command needed — \`/cc\` is the public resume/progression command.
|
|
126
126
|
|
|
127
127
|
## Headless mode
|
|
128
128
|
|
|
@@ -171,14 +171,14 @@ export function nextCommandSkillMarkdown() {
|
|
|
171
171
|
.join("\n");
|
|
172
172
|
return `---
|
|
173
173
|
name: ${NEXT_SKILL_NAME}
|
|
174
|
-
description: "
|
|
174
|
+
description: "Internal compatibility progression command. Prefer /cc for start, resume, continue, and closeout."
|
|
175
175
|
---
|
|
176
176
|
|
|
177
|
-
# /cc-next — Flow Progression
|
|
177
|
+
# /cc-next — Flow Progression Compatibility
|
|
178
178
|
|
|
179
179
|
## Overview
|
|
180
180
|
|
|
181
|
-
\`/cc
|
|
181
|
+
\`/cc\` is the public command to drive the cclaw flow. \`/cc-next\` remains as an internal/compatibility alias for progression.
|
|
182
182
|
|
|
183
183
|
## Operator Output Contract
|
|
184
184
|
|
|
@@ -190,13 +190,16 @@ Current: <currentStage or closeout.shipSubstate> (<track>)
|
|
|
190
190
|
Stage: <currentStage>
|
|
191
191
|
Gates: <passed>/<required> passed, <blocked> blocked
|
|
192
192
|
Delegations: <done>/<mandatory> done
|
|
193
|
-
Blocked by: <none | gate/delegation/reconciliation/stale/TDD/review ids>
|
|
194
|
-
|
|
193
|
+
Blocked by: <none | gate/delegation/reconciliation/stale/TDD/review/closeout ids>
|
|
194
|
+
Blocker category: <sync-recovery | user-decision | stage-work | delegation-proof | review-rework | closeout>
|
|
195
|
+
Next: <exact next action, usually /cc or one named remediation>
|
|
195
196
|
Evidence needed: <artifact/test/review/delegation evidence required to unblock>
|
|
196
197
|
\`\`\`
|
|
197
198
|
|
|
198
199
|
Only expand beyond this when blocked, when asking a structured question, or when
|
|
199
|
-
the user explicitly requests detail.
|
|
200
|
+
the user explicitly requests detail. When blocked, name the blocker category,
|
|
201
|
+
why it blocks progression, the one next command/action, and the exact proof that
|
|
202
|
+
would unblock it. Do not dump full artifacts in progression output.
|
|
200
203
|
|
|
201
204
|
**How it works:**
|
|
202
205
|
1. Reads \`flow-state.json\` to find \`currentStage\`
|
|
@@ -204,7 +207,7 @@ the user explicitly requests detail. Do not dump full artifacts in progression o
|
|
|
204
207
|
3. If **not** → loads the stage skill and starts/resumes execution
|
|
205
208
|
4. If **yes** → advances to the next stage and loads its skill
|
|
206
209
|
|
|
207
|
-
**Resume:** \`/cc
|
|
210
|
+
**Resume:** \`/cc\` in a new session picks up from where \`flow-state.json\` says you are.
|
|
208
211
|
|
|
209
212
|
## HARD-GATE
|
|
210
213
|
|
|
@@ -216,9 +219,9 @@ Do **not** mark gates satisfied from memory alone. Cite **artifact evidence** (p
|
|
|
216
219
|
|
|
217
220
|
1. Open **\`${flowPath}\`**.
|
|
218
221
|
2. Record \`currentStage\` and \`stageGateCatalog[currentStage]\`.
|
|
219
|
-
3. If \`staleStages[currentStage]\` exists, show the marker reason/rewindId, re-run the stage, and clear only the current marker via \`cclaw internal rewind --ack <currentStage>\` before advancing.
|
|
220
|
-
4. If the file is missing or invalid JSON → **BLOCKED** (
|
|
221
|
-
5. Read \`${reconciliationNoticesPath}\` when present. For entries matching \`activeRunId + currentStage\` whose gate is still in \`stageGateCatalog[currentStage].blocked\`, show
|
|
222
|
+
3. If \`staleStages[currentStage]\` exists, show \`Blocked by: stale stage\`, the marker reason/rewindId, re-run the stage, and clear only the current marker via \`cclaw internal rewind --ack <currentStage>\` before advancing.
|
|
223
|
+
4. If the file is missing or invalid JSON → **BLOCKED** (state missing/corrupt). Next action: run \`cclaw sync\` for safe regeneration of generated runtime files, then \`cclaw doctor --explain\`; do not hand-edit flow state unless doctor says user repair is required.
|
|
224
|
+
5. Read \`${reconciliationNoticesPath}\` when present. For entries matching \`activeRunId + currentStage\` whose gate is still in \`stageGateCatalog[currentStage].blocked\`, show \`Blocked by: reconciliation notice\` with gate id + reason before proceeding; \`cclaw doctor --reconcile-gates --explain\` refreshes derived gate-state only; it does not repair missing artifacts or tests.
|
|
222
225
|
|
|
223
226
|
### Step 2: Evaluate gates
|
|
224
227
|
|
|
@@ -229,7 +232,8 @@ For each gate id in \`requiredGates\` for \`currentStage\`:
|
|
|
229
232
|
Check \`mandatoryDelegations\` via **\`${delegationPath}\`** — satisfied only if **completed** or **waived**.
|
|
230
233
|
Also verify each completed mandatory delegation row has non-empty \`evidenceRefs\` (waived rows must include rationale).
|
|
231
234
|
If a mandatory delegation is missing and no waiver exists, **STOP** and ask:
|
|
232
|
-
(A) dispatch now, (B) waive with rationale, (C) cancel stage advance.
|
|
235
|
+
(A) dispatch \`<agent>\` now, (B) waive with rationale, (C) cancel stage advance.
|
|
236
|
+
Explain who must run, why that role is mandatory for this stage, and whether the missing proof is ledger status, event-log dispatch proof, or artifact \`evidenceRefs\`. Waivers must include a user-visible safety reason.
|
|
233
237
|
|
|
234
238
|
If reconciliation warnings were emitted in Step 1, treat them as a pre-advance stop point: require explicit acknowledgement before continuing Path A or Path B.
|
|
235
239
|
|
|
@@ -246,7 +250,7 @@ ${ralphLoopContractSnippet()}
|
|
|
246
250
|
|
|
247
251
|
Special-case for review: if \`review_criticals_resolved\` is in \`blocked\`, route to rework instead of looping review forever - recommend \`cclaw internal rewind tdd "review_blocked_by_critical <finding-ids>"\`, then \`cclaw internal rewind --ack tdd\` after TDD rework.
|
|
248
252
|
|
|
249
|
-
Special-case for TDD blockers: when \`06-tdd.md\` records \`NO_SOURCE_CONTEXT\`, \`NO_TEST_SURFACE\`, \`NO_IMPLEMENTABLE_SLICE\`, \`RED_NOT_EXPRESSIBLE\`, or \`NO_VCS_MODE\`, keep status BLOCKED and print \`Current\`, \`Blocked by\`, \`Next\`, and \`Evidence needed\` instead of retrying speculative RED/GREEN work.
|
|
253
|
+
Special-case for TDD blockers: when \`06-tdd.md\` records \`NO_SOURCE_CONTEXT\`, \`NO_TEST_SURFACE\`, \`NO_IMPLEMENTABLE_SLICE\`, \`RED_NOT_EXPRESSIBLE\`, or \`NO_VCS_MODE\`, keep status BLOCKED and print \`Current\`, \`Blocked by\`, \`Next\`, \`Repair path\`, and \`Evidence needed\` instead of retrying speculative RED/GREEN work. RED blockers need a runnable failing test surface, GREEN blockers need passing full-suite evidence, REFACTOR blockers need behavior-preservation evidence.
|
|
250
254
|
|
|
251
255
|
**Path B — stage IS complete (all gates met, all delegations done):**
|
|
252
256
|
|
|
@@ -263,7 +267,7 @@ by inspecting ${closeoutSubstateInline()}:
|
|
|
263
267
|
| \`ready_to_archive\` | Run \`npx cclaw-cli archive\`; reset flow-state on success |
|
|
264
268
|
| \`archived\` | Report "run archived"; stop |
|
|
265
269
|
|
|
266
|
-
Each step owns its own state transition. \`/cc
|
|
270
|
+
Each step owns its own state transition. \`/cc\` keeps retro and compound
|
|
267
271
|
in-session, then uses the archive runtime only at \`ready_to_archive\`.
|
|
268
272
|
|
|
269
273
|
Otherwise report **"Flow complete. All stages finished."** and stop.
|
|
@@ -272,7 +276,7 @@ Otherwise (non-terminal \`next\`): load the next stage skill and begin execution
|
|
|
272
276
|
|
|
273
277
|
## Stage order
|
|
274
278
|
|
|
275
|
-
This table is the track-aware critical path. It must match \`flow-state.json.track\`; do not follow the natural schema edge when the active track skips a stage. After \`ship\`, \`/cc
|
|
279
|
+
This table is the track-aware critical path. It must match \`flow-state.json.track\`; do not follow the natural schema edge when the active track skips a stage. Quick skips ceremony, not safety: spec approval, RED/GREEN/REFACTOR evidence, review, and ship gates still apply. After \`ship\`, \`/cc\` continues closeout via ${closeoutSubstateInline()}: ${closeoutChainInline()}.
|
|
276
280
|
|
|
277
281
|
| Stage | Standard next | Medium next | Quick next | Skill path |
|
|
278
282
|
|---|---|---|---|---|
|
|
@@ -289,6 +293,6 @@ ${naturalStageRows}
|
|
|
289
293
|
- Advancing when \`blocked\` is non-empty for the current stage.
|
|
290
294
|
- Treating \`passed\` as trusted when artifact evidence contradicts it.
|
|
291
295
|
- Skipping **review** or **ship** because "the code looks fine".
|
|
292
|
-
- Loading a stage skill directly instead of using \`/cc
|
|
296
|
+
- Loading a stage skill directly instead of using \`/cc\` for progression.
|
|
293
297
|
`;
|
|
294
298
|
}
|
|
@@ -10,7 +10,7 @@ function normalizePatterns(patterns, fallback) {
|
|
|
10
10
|
return [...fallback];
|
|
11
11
|
return patterns.map((value) => value.trim()).filter((value) => value.length > 0);
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function resolveCliRuntimeForGeneratedHook() {
|
|
14
14
|
const here = fileURLToPath(import.meta.url);
|
|
15
15
|
const candidates = [
|
|
16
16
|
path.resolve(path.dirname(here), "..", "cli.js"),
|
|
@@ -19,9 +19,18 @@ function resolveCliEntrypointForGeneratedHook() {
|
|
|
19
19
|
for (const candidate of candidates) {
|
|
20
20
|
// Synchronous probe runs only during cclaw-cli init/sync generation.
|
|
21
21
|
if (existsSync(candidate))
|
|
22
|
-
return candidate;
|
|
22
|
+
return { entrypoint: candidate, argsPrefix: [] };
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
// Vitest exercises init/sync directly from src/ without a compiled dist/.
|
|
25
|
+
// Route that dev-only shape through vite-node so hooks still prove a local runtime.
|
|
26
|
+
if (process.env.VITEST === "true") {
|
|
27
|
+
const sourceCli = path.resolve(path.dirname(here), "..", "cli.ts");
|
|
28
|
+
const viteNode = path.resolve(path.dirname(here), "..", "..", "node_modules", "vite-node", "vite-node.mjs");
|
|
29
|
+
if (existsSync(sourceCli) && existsSync(viteNode)) {
|
|
30
|
+
return { entrypoint: viteNode, argsPrefix: ["--script", sourceCli] };
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return { entrypoint: null, argsPrefix: [] };
|
|
25
34
|
}
|
|
26
35
|
/**
|
|
27
36
|
* Node-only hook runtime (single entrypoint).
|
|
@@ -42,7 +51,7 @@ export function nodeHookRuntimeScript(options = {}) {
|
|
|
42
51
|
options.compoundRecurrenceThreshold >= 1
|
|
43
52
|
? options.compoundRecurrenceThreshold
|
|
44
53
|
: DEFAULT_COMPOUND_RECURRENCE_THRESHOLD;
|
|
45
|
-
const
|
|
54
|
+
const cliRuntime = resolveCliRuntimeForGeneratedHook();
|
|
46
55
|
return `#!/usr/bin/env node
|
|
47
56
|
import fs from "node:fs/promises";
|
|
48
57
|
import path from "node:path";
|
|
@@ -64,7 +73,8 @@ const DEFAULT_TDD_PRODUCTION_PATH_PATTERNS = ${JSON.stringify(tddProductionPathP
|
|
|
64
73
|
const COMPOUND_RECURRENCE_THRESHOLD = ${JSON.stringify(compoundRecurrenceThreshold)};
|
|
65
74
|
const SMALL_PROJECT_ARCHIVE_RUNS_THRESHOLD = ${JSON.stringify(SMALL_PROJECT_ARCHIVE_RUNS_THRESHOLD)};
|
|
66
75
|
const SMALL_PROJECT_RECURRENCE_THRESHOLD = ${JSON.stringify(SMALL_PROJECT_RECURRENCE_THRESHOLD)};
|
|
67
|
-
const CCLAW_CLI_ENTRYPOINT = ${JSON.stringify(
|
|
76
|
+
const CCLAW_CLI_ENTRYPOINT = ${JSON.stringify(cliRuntime.entrypoint)};
|
|
77
|
+
const CCLAW_CLI_ARGS_PREFIX = ${JSON.stringify(cliRuntime.argsPrefix)};
|
|
68
78
|
|
|
69
79
|
function resolveStrictness() {
|
|
70
80
|
return process.env.CCLAW_STRICTNESS === "strict" ? "strict" : DEFAULT_STRICTNESS;
|
|
@@ -313,6 +323,7 @@ async function readStdin() {
|
|
|
313
323
|
|
|
314
324
|
async function runCclawInternal(root, args, options = {}) {
|
|
315
325
|
const cliEntrypoint = process.env.CCLAW_CLI_JS || CCLAW_CLI_ENTRYPOINT;
|
|
326
|
+
const cliArgsPrefix = process.env.CCLAW_CLI_JS ? [] : CCLAW_CLI_ARGS_PREFIX;
|
|
316
327
|
if (!cliEntrypoint || String(cliEntrypoint).trim().length === 0) {
|
|
317
328
|
return {
|
|
318
329
|
code: 1,
|
|
@@ -324,6 +335,11 @@ async function runCclawInternal(root, args, options = {}) {
|
|
|
324
335
|
try {
|
|
325
336
|
const stat = await fs.stat(cliEntrypoint);
|
|
326
337
|
if (!stat.isFile()) throw new Error("not-file");
|
|
338
|
+
for (const argPath of cliArgsPrefix) {
|
|
339
|
+
if (typeof argPath !== "string" || argPath.startsWith("-")) continue;
|
|
340
|
+
const argStat = await fs.stat(argPath);
|
|
341
|
+
if (!argStat.isFile()) throw new Error("arg-not-file");
|
|
342
|
+
}
|
|
327
343
|
} catch {
|
|
328
344
|
return {
|
|
329
345
|
code: 1,
|
|
@@ -345,7 +361,7 @@ async function runCclawInternal(root, args, options = {}) {
|
|
|
345
361
|
};
|
|
346
362
|
let child;
|
|
347
363
|
try {
|
|
348
|
-
child = spawn(process.execPath, [cliEntrypoint, "internal", ...args], {
|
|
364
|
+
child = spawn(process.execPath, [cliEntrypoint, ...cliArgsPrefix, "internal", ...args], {
|
|
349
365
|
cwd: root,
|
|
350
366
|
env: process.env,
|
|
351
367
|
stdio: ["ignore", captureStdout ? "pipe" : "ignore", "pipe"]
|
|
@@ -922,7 +938,7 @@ async function handleSessionStart(runtime) {
|
|
|
922
938
|
);
|
|
923
939
|
const knowledge = await buildKnowledgeDigest(runtime.root, state.currentStage, knowledgeRaw);
|
|
924
940
|
|
|
925
|
-
// Refresh Ralph Loop status each session-start so /cc
|
|
941
|
+
// Refresh Ralph Loop status each session-start so /cc and the model
|
|
926
942
|
// both read a consistent "iter=N, acClosed=[...]" snapshot. Runs only when
|
|
927
943
|
// we are in tdd — other stages skip the write to keep the file stable.
|
|
928
944
|
let ralphLoopLine = "";
|
|
@@ -1121,7 +1137,7 @@ async function handleStopHandoff(runtime) {
|
|
|
1121
1137
|
const shipSubstate = typeof closeoutObj.shipSubstate === "string" ? closeoutObj.shipSubstate : "idle";
|
|
1122
1138
|
const closeoutContext =
|
|
1123
1139
|
state.currentStage === "ship" || shipSubstate !== "idle"
|
|
1124
|
-
? " closeout.shipSubstate=" + shipSubstate + "; closeout chain=retro -> compound -> archive; continue closeout with /cc
|
|
1140
|
+
? " closeout.shipSubstate=" + shipSubstate + "; closeout chain=retro -> compound -> archive; continue closeout with /cc."
|
|
1125
1141
|
: "";
|
|
1126
1142
|
|
|
1127
1143
|
const message =
|
|
@@ -131,7 +131,7 @@ export default function cclawPlugin(ctx) {
|
|
|
131
131
|
if (stageSupport.length > 0) parts.push(...stageSupport);
|
|
132
132
|
|
|
133
133
|
parts.push(
|
|
134
|
-
"If you discover a non-obvious rule or pattern during stage work, add it to the current artifact ## Learnings section; stage-complete harvests it into .cclaw/knowledge.jsonl. Direct JSONL append is only for explicit manual learnings operations."
|
|
134
|
+
"If you discover a non-obvious rule or pattern during stage work, add it to the current artifact ## Learnings section; stage-complete harvests it into .cclaw/knowledge.jsonl. If this plugin does not load, run \`cclaw sync\`, verify opencode.json(.c) includes the cclaw plugin registration, then run \`cclaw doctor --explain\`. Direct JSONL append is only for explicit manual learnings operations."
|
|
135
135
|
);
|
|
136
136
|
|
|
137
137
|
const meta = (await readFileText(metaSkillPath)).trim();
|
|
@@ -36,7 +36,7 @@ When a new session begins in any harness:
|
|
|
36
36
|
\`\`\`
|
|
37
37
|
Cclaw flow state: [current stage] ([N] of 8 stages completed)
|
|
38
38
|
Knowledge highlights: [rule/pattern 1], [rule/pattern 2], [rule/pattern 3]
|
|
39
|
-
Next action: /cc
|
|
39
|
+
Next action: /cc to continue or start work, /cc-cancel to cancel, or describe what you'd like to do.
|
|
40
40
|
\`\`\`
|
|
41
41
|
|
|
42
42
|
## Session Stop Protocol
|
|
@@ -10,7 +10,7 @@ Load and follow the authoritative stage skill:
|
|
|
10
10
|
|
|
11
11
|
- \`${skillPath}\`
|
|
12
12
|
|
|
13
|
-
Normal stage resume and advancement uses \`/cc
|
|
13
|
+
Normal stage resume and advancement uses \`/cc\`. Use \`/cc\` to read
|
|
14
14
|
\`.cclaw/state/flow-state.json\`, select the active stage, and advance only after
|
|
15
15
|
that stage's gates pass. Do not duplicate the stage protocol here.
|
|
16
16
|
`;
|
|
@@ -11,7 +11,7 @@ ${conversationLanguagePolicyMarkdown()}
|
|
|
11
11
|
- Stage-specific skills expose **Completion Parameters** plus the gates that
|
|
12
12
|
matter for that stage.
|
|
13
13
|
- Generic execution stays inline: verify required gates, update the artifact,
|
|
14
|
-
harvest learnings, then use \`/cc
|
|
14
|
+
harvest learnings, then use \`/cc\` for progression.
|
|
15
15
|
- Do not create separate protocol files.
|
|
16
16
|
|
|
17
17
|
## Context readiness
|
|
@@ -30,11 +30,11 @@ ${conversationLanguagePolicyMarkdown()}
|
|
|
30
30
|
|
|
31
31
|
Use this same closeout menu for every stage:
|
|
32
32
|
|
|
33
|
-
- **A) Advance** — run \`/cc
|
|
33
|
+
- **A) Advance** — run \`/cc\` and continue the critical path; after \`ship\`, the same command drives \`retro -> compound -> archive\`.
|
|
34
34
|
- **B) Revise this stage** — stay on current stage and apply feedback.
|
|
35
|
-
- **C) Pause / park** —
|
|
35
|
+
- **C) Pause / park** — stop after summarizing current stage, blockers, and next \`/cc\` action.
|
|
36
36
|
- **D) Rewind** — run \`npx cclaw-cli internal rewind <target-stage> "<reason>"\` as the managed support/runtime repair action; after redoing the target stage, run \`npx cclaw-cli internal rewind --ack <target-stage>\` to clear the stale marker.
|
|
37
|
-
- **E) Abandon** — only when the user explicitly wants to end a non-ship active run early, archive with \`npx cclaw-cli archive --skip-retro --retro-reason="<reason>"\`. Once in post-ship closeout, continue \`/cc
|
|
37
|
+
- **E) Abandon** — only when the user explicitly wants to end a non-ship active run early, archive with \`npx cclaw-cli archive --skip-retro --retro-reason="<reason>"\`. Once in post-ship closeout, continue \`/cc\` through retro/compound/archive instead.
|
|
38
38
|
|
|
39
39
|
Recommendation defaults:
|
|
40
40
|
|
|
@@ -50,7 +50,7 @@ export const PLAN = {
|
|
|
50
50
|
"Run anti-placeholder + anti-scope-reduction scans — block `TODO/TBD/...` and phrasing like `v1`, `for now`, `later` for locked boundaries.",
|
|
51
51
|
"Define validation points — mark where progress must be checked before continuing, with concrete command and expected evidence.",
|
|
52
52
|
"Define execution posture — record whether execution should be sequential, dependency-batched, parallel-safe, or blocked; include risk triggers and RED/GREEN/REFACTOR checkpoint/commit expectations when the repo workflow supports them. This fulfills the `plan_execution_posture_recorded` gate.",
|
|
53
|
-
"WAIT_FOR_CONFIRM — write plan artifact and explicitly pause. **STOP.** Do NOT proceed until user confirms. Then close the stage with `node .cclaw/hooks/stage-complete.mjs plan` and tell user to run `/cc
|
|
53
|
+
"WAIT_FOR_CONFIRM — write plan artifact and explicitly pause. **STOP.** Do NOT proceed until user confirms. Then close the stage with `node .cclaw/hooks/stage-complete.mjs plan` and tell user to run `/cc`."
|
|
54
54
|
],
|
|
55
55
|
interactionProtocol: [
|
|
56
56
|
"Plan in read-only mode relative to implementation.",
|
|
@@ -61,7 +61,7 @@ export const PLAN = {
|
|
|
61
61
|
"Preserve locked scope boundaries: no silent scope reduction language in task rows.",
|
|
62
62
|
"Enforce WAIT_FOR_CONFIRM: present the plan summary with options (A) Approve / (B) Revise / (C) Reject.",
|
|
63
63
|
"**STOP.** Do NOT proceed until user explicitly approves.",
|
|
64
|
-
"**STOP BEFORE ADVANCE.** Mandatory delegation `planner` must be marked completed or explicitly waived in `.cclaw/state/delegation-log.json`. Then close the stage via `node .cclaw/hooks/stage-complete.mjs plan` and tell the user to run `/cc
|
|
64
|
+
"**STOP BEFORE ADVANCE.** Mandatory delegation `planner` must be marked completed or explicitly waived in `.cclaw/state/delegation-log.json`. Then close the stage via `node .cclaw/hooks/stage-complete.mjs plan` and tell the user to run `/cc`."
|
|
65
65
|
],
|
|
66
66
|
process: [
|
|
67
67
|
"Build dependency graph and ordered slices.",
|
|
@@ -47,7 +47,7 @@ export const REVIEW = {
|
|
|
47
47
|
"Classify findings — Critical (blocks ship), Important (should fix), Suggestion (optional improvement).",
|
|
48
48
|
"Victory Detector — before verdict, confirm Layer 1, Layer 2, security sweep, structured findings, trace evidence, and unresolved-critical status are complete; otherwise iterate findings or route back to TDD.",
|
|
49
49
|
"Produce verdict — APPROVED, APPROVED_WITH_CONCERNS, or BLOCKED.",
|
|
50
|
-
"If verdict is BLOCKED, emit remediation route token `ROUTE_BACK_TO_TDD`, include the managed command `cclaw internal rewind tdd \"review_blocked_by_critical <finding-ids>\"`, and satisfy the special transition guard `review_verdict_blocked` instead of `review_criticals_resolved`. After TDD rework, clear the stale marker with `cclaw internal rewind --ack tdd` before `/cc
|
|
50
|
+
"If verdict is BLOCKED, emit remediation route token `ROUTE_BACK_TO_TDD`, include the managed command `cclaw internal rewind tdd \"review_blocked_by_critical <finding-ids>\"`, list the critical finding IDs and required TDD evidence to repair, and satisfy the special transition guard `review_verdict_blocked` instead of `review_criticals_resolved`. After TDD rework, clear the stale marker with `cclaw internal rewind --ack tdd` before `/cc`."
|
|
51
51
|
],
|
|
52
52
|
interactionProtocol: [
|
|
53
53
|
"Run Layer 1 (spec compliance) completely before starting Layer 2.",
|
|
@@ -118,7 +118,7 @@ export const TDD = {
|
|
|
118
118
|
"full suite not green",
|
|
119
119
|
"behavior changed during refactor",
|
|
120
120
|
"no evidence recorded",
|
|
121
|
-
"RED/GREEN blocked — classify with the managed taxonomy `NO_SOURCE_CONTEXT`, `NO_TEST_SURFACE`, `NO_IMPLEMENTABLE_SLICE`, `RED_NOT_EXPRESSIBLE`, or `NO_VCS_MODE` and capture blockedBecause, missingInputs, recommendedRoute, nextCommand, and
|
|
121
|
+
"RED/GREEN blocked — classify with the managed taxonomy `NO_SOURCE_CONTEXT`, `NO_TEST_SURFACE`, `NO_IMPLEMENTABLE_SLICE`, `RED_NOT_EXPRESSIBLE`, or `NO_VCS_MODE` and capture blockedBecause, missingInputs, recommendedRoute, nextCommand, resumeCriteria, and the repair path: RED needs a failing test surface, GREEN needs full-suite pass evidence, REFACTOR needs behavior-preservation evidence.",
|
|
122
122
|
"no-VCS workspace without explicit `vcs: none`, no-vcs reason, content/artifact hash, or `tdd.verificationRef: disabled`"
|
|
123
123
|
],
|
|
124
124
|
exitCriteria: [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Command contract for /cc — the unified entry point.
|
|
3
|
-
* No args → reads existing flow state and
|
|
4
|
-
*
|
|
3
|
+
* No args → reads existing flow state and progresses it when a tracked flow
|
|
4
|
+
* already exists; missing state/fresh placeholder state blocks with
|
|
5
5
|
* init/start guidance. With prompt → classifies the idea, selects a track, and
|
|
6
6
|
* starts the first stage of that track (brainstorm for medium/standard, spec for quick).
|
|
7
7
|
*/
|
|
@@ -7,8 +7,8 @@ function flowStatePath() {
|
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* Command contract for /cc — the unified entry point.
|
|
10
|
-
* No args → reads existing flow state and
|
|
11
|
-
*
|
|
10
|
+
* No args → reads existing flow state and progresses it when a tracked flow
|
|
11
|
+
* already exists; missing state/fresh placeholder state blocks with
|
|
12
12
|
* init/start guidance. With prompt → classifies the idea, selects a track, and
|
|
13
13
|
* starts the first stage of that track (brainstorm for medium/standard, spec for quick).
|
|
14
14
|
*/
|
|
@@ -20,10 +20,10 @@ export function startCommandContract() {
|
|
|
20
20
|
|
|
21
21
|
**The unified entry point for the cclaw flow.**
|
|
22
22
|
|
|
23
|
-
- \`/cc\` (no arguments) → reads existing flow state and resumes/progresses
|
|
23
|
+
- \`/cc\` (no arguments) → reads existing flow state and resumes/progresses the active flow. If flow state is missing or still a fresh init placeholder, stop and guide the user to run \`/cc <prompt>\` or \`cclaw init\`; do not silently create a brainstorm run.
|
|
24
24
|
- \`/cc <prompt>\` (with an idea/description) → saves the prompt as idea context and starts the first stage of the resolved track.
|
|
25
25
|
|
|
26
|
-
This is the **recommended way to start** working with cclaw.
|
|
26
|
+
This is the **recommended way to start, resume, and continue** working with cclaw.
|
|
27
27
|
|
|
28
28
|
## HARD-GATE
|
|
29
29
|
|
|
@@ -74,18 +74,19 @@ ${conversationLanguagePolicyMarkdown()}
|
|
|
74
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
75
|
7. **Track heuristic** — classify the idea text and **recommend** a track (the user can override before any state mutation):
|
|
76
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.
|
|
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
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
79
|
- **medium** (\`brainstorm → spec → plan → tdd → review → ship\`) — additive work that fits existing architecture and still needs product framing.
|
|
80
80
|
Triggers: \`add endpoint\`, \`add field\`, \`extend existing\`, \`wire integration\`, \`small migration\`, \`new screen following existing patterns\`.
|
|
81
81
|
- **standard** (full 8 stages — default fallback) — anything that introduces a new capability with architecture uncertainty, touches many modules, or has unclear scope.
|
|
82
82
|
Triggers: \`new feature\`, \`refactor\`, \`migration\`, \`platform\`, \`architecture\`, \`schema\`, \`integrate\`, \`workflow\`, \`onboarding\`, or any prompt that does not match quick/medium confidently.
|
|
83
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. Be explicit that this recommendation is advisory until the user accepts and the managed helper writes state; after that, \`/cc
|
|
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
85
|
8. Present one compact **Start framing** summary: class, recommended track, 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
86
|
9. Present the recommendation as a single decision with explicit options:
|
|
87
87
|
> \`Recommended track: <quick|medium|standard>\` because \`<one-line reason citing matched triggers>\`.
|
|
88
|
-
>
|
|
88
|
+
> \`Safety retained: <spec/TDD/review/ship gates that still apply>\`.
|
|
89
|
+
> Override? (A) keep \`<recommended>\` (B) switch track with reason (C) cancel.
|
|
89
90
|
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.
|
|
90
91
|
10. Start the tracked flow only through the managed helper:
|
|
91
92
|
\`node .cclaw/hooks/start-flow.mjs --track=<quick|medium|standard> --class=<class> --prompt=<prompt> --stack=<stack> --reason=<matched heuristic>\`
|
|
@@ -111,7 +112,7 @@ If during any stage the agent discovers evidence that contradicts the initial Ph
|
|
|
111
112
|
1. Read \`${flowPath}\`.
|
|
112
113
|
2. If flow state is missing → guide the user to run \`cclaw init\` and stop.
|
|
113
114
|
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.
|
|
114
|
-
4. Otherwise
|
|
115
|
+
4. Otherwise check current stage gates, resume if incomplete, and advance if complete.
|
|
115
116
|
|
|
116
117
|
## Headless mode
|
|
117
118
|
|
|
@@ -150,7 +151,7 @@ description: "Unified entry point for the cclaw flow. No args = resume/next. Wit
|
|
|
150
151
|
|
|
151
152
|
\`/cc\` is the **starting command** for cclaw. It intelligently routes:
|
|
152
153
|
|
|
153
|
-
- **No arguments** →
|
|
154
|
+
- **No arguments** → resumes or progresses an existing tracked flow; missing/fresh placeholder state blocks with start guidance
|
|
154
155
|
- **With a prompt** → classifies the task, picks a track (quick/medium/standard), and starts the **first stage of that track** (not always brainstorm — e.g. the \`quick\` track starts at \`spec\`)
|
|
155
156
|
|
|
156
157
|
## HARD-GATE
|
|
@@ -179,12 +180,12 @@ ${conversationLanguagePolicyMarkdown()}
|
|
|
179
180
|
|
|
180
181
|
| Track | Triggers | Use when |
|
|
181
182
|
|---|---|---|
|
|
182
|
-
| \`quick\` | \`bug\`, \`bugfix\`, \`fix\`, \`hotfix\`, \`patch\`, \`typo\`, \`regression\`, \`rename\`, \`bump\`, \`upgrade dep\`, \`docs only\`, \`comment\`, \`lint\`, \`format\`, \`small\`, \`tiny\`, \`one-liner\`, \`revert\`, \`copy change\` | Single-purpose, spec is essentially known, low blast radius |
|
|
183
|
+
| \`quick\` | \`bug\`, \`bugfix\`, \`fix\`, \`hotfix\`, \`patch\`, \`typo\`, \`regression\`, \`rename\`, \`bump\`, \`upgrade dep\`, \`docs only\`, \`comment\`, \`lint\`, \`format\`, \`small\`, \`tiny\`, \`one-liner\`, \`revert\`, \`copy change\` | Single-purpose, spec is essentially known, low blast radius; skips ceremony, not safety |
|
|
183
184
|
| \`medium\` | \`add endpoint\`, \`add field\`, \`extend existing\`, \`wire integration\`, \`small migration\`, \`new screen following existing pattern\` | Additive work with existing architecture |
|
|
184
185
|
| \`standard\` | \`new feature\`, \`refactor\`, \`migration\`, \`platform\`, \`architecture\`, \`schema\`, \`integrate\`, \`workflow\`, \`onboarding\` (or no confident quick/medium match) | New or uncertain multi-module work |
|
|
185
186
|
|
|
186
187
|
- On conflict, prefer \`standard\` over \`medium\`, and \`medium\` over \`quick\`.
|
|
187
|
-
- 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
|
|
188
|
+
- 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.
|
|
188
189
|
8. Run the managed start helper: \`node .cclaw/hooks/start-flow.mjs --track=<quick|medium|standard> --class=<class> --prompt=<prompt> --stack=<stack> --reason=<matched heuristic>\`. The helper writes \`${flowPath}\`, computes \`skippedStages\`, resets the gate catalog, and writes \`${RUNTIME_ROOT}/artifacts/00-idea.md\`. If it fails, STOP and report the exact command/output; do not manually edit flow state.
|
|
189
190
|
9. Load and execute the **first stage skill of the chosen track** (\`brainstorming\` for medium/standard, \`specification-authoring\` for quick) plus its matching command file.
|
|
190
191
|
|
|
@@ -194,7 +195,7 @@ If mid-stage evidence contradicts the initial Class/Track decision (the "trivial
|
|
|
194
195
|
|
|
195
196
|
### Path B: \`/cc\` (no arguments)
|
|
196
197
|
|
|
197
|
-
|
|
198
|
+
Progress the tracked flow only when one exists:
|
|
198
199
|
|
|
199
200
|
1. Read \`${flowPath}\`.
|
|
200
201
|
2. If missing, guide the user to run \`cclaw init\` and stop.
|
|
@@ -204,15 +205,17 @@ Delegate to \`/cc-next\` behavior only when a tracked flow exists:
|
|
|
204
205
|
6. If complete → advance to next stage and execute.
|
|
205
206
|
7. If flow is done → report completion.
|
|
206
207
|
|
|
207
|
-
##
|
|
208
|
+
## Public flow habit
|
|
209
|
+
|
|
210
|
+
Use \`/cc\` for the happy path:
|
|
208
211
|
|
|
209
212
|
| Scenario | Command |
|
|
210
213
|
|---|---|
|
|
211
214
|
| Starting work for the first time | \`/cc\` or \`/cc <idea>\` |
|
|
212
215
|
| Resuming in a new session | \`/cc\` |
|
|
213
|
-
| Progressing after completing a stage | \`/cc
|
|
216
|
+
| Progressing after completing a stage | \`/cc\` |
|
|
214
217
|
| Starting with a specific idea | \`/cc <idea>\` |
|
|
215
218
|
|
|
216
|
-
|
|
219
|
+
\`/cc <prompt>\` resolves class + track and starts that track's first stage; \`/cc\` without a prompt follows the current \`flow-state.json\`.
|
|
217
220
|
`;
|
|
218
221
|
}
|
|
@@ -28,7 +28,8 @@ export function statusSubcommandMarkdown() {
|
|
|
28
28
|
## Overview
|
|
29
29
|
|
|
30
30
|
\`/cc-view status\` is the quickest way to answer "where are we in the flow?" without
|
|
31
|
-
advancing or mutating anything.
|
|
31
|
+
advancing or mutating anything. Treat it as an operator note, not a JSON dump:
|
|
32
|
+
progress, blockers, risks, next action, and human-readable gate/delegation/closeout labels. Safe to run at any point. The snapshot reflects:
|
|
32
33
|
|
|
33
34
|
- progress across stages with per-stage markers,
|
|
34
35
|
- gate coverage,
|
|
@@ -77,21 +78,21 @@ a read-only command.
|
|
|
77
78
|
- harness row
|
|
78
79
|
- stale stage row
|
|
79
80
|
11. Suggest the next action:
|
|
80
|
-
- If current stage has unmet gates -> \`/cc
|
|
81
|
+
- If current stage has unmet gates -> \`/cc\` to resume.
|
|
81
82
|
- If a mandatory delegation is missing evidence -> dispatch the worker/reviewer or waive with rationale; do not advance silently.
|
|
82
83
|
- If a TDD blocker taxonomy code is present (\`NO_SOURCE_CONTEXT\`, \`NO_TEST_SURFACE\`, \`NO_IMPLEMENTABLE_SLICE\`, \`RED_NOT_EXPRESSIBLE\`, \`NO_VCS_MODE\`) -> name the blocker and the rewind/config route.
|
|
83
84
|
- If review is blocked by critical findings -> show \`cclaw internal rewind tdd "review_blocked_by_critical <finding-ids>"\` plus the later \`cclaw internal rewind --ack tdd\`.
|
|
84
|
-
- If closeout substate is non-idle -> \`/cc
|
|
85
|
-
- If current stage is complete -> \`/cc
|
|
85
|
+
- If closeout substate is non-idle -> \`/cc\` to continue the chain.
|
|
86
|
+
- If current stage is complete -> \`/cc\` to advance (or report "Flow complete" if terminal).
|
|
86
87
|
|
|
87
88
|
## Output Guidelines
|
|
88
89
|
|
|
89
90
|
- Keep output compact (≤ 40 lines) — status, not narrative.
|
|
90
|
-
- Start with the same operator rows as \`/cc
|
|
91
|
-
\`Current\`, \`Stage\`, \`Gates\`, \`Delegations\`, \`Blocked by\`, \`Next\`, \`Evidence needed\`.
|
|
91
|
+
- Start with the same operator rows as \`/cc\` when possible:
|
|
92
|
+
\`Current\`, \`Stage\`, \`Progress\`, \`Gates\`, \`Delegations\`, \`Risks\`, \`Blocked by\`, \`Next\`, \`Evidence needed\`. Use labels like \`gate: tdd_green_full_suite\`, \`delegation proof: reviewer evidenceRefs\`, and \`closeout: compound_review\` instead of raw JSON tone.
|
|
92
93
|
- When blocked, include a plain-English action block:
|
|
93
94
|
\`Current: <stage or closeout substate>\`; \`Blocked by: <gate/delegation/blocker code>\`; \`Next: <exact command or managed remediation>\`; \`Evidence needed: <artifact/test/review/delegation evidence>\`.
|
|
94
|
-
- Report counts, not full artifact contents. Include active subagent count from \`${subagentsPath()}\` and proof gaps from \`${delegationEventsPath()}\` when present.
|
|
95
|
+
- Report counts, not full artifact contents. Include active subagent count from \`${subagentsPath()}\` and proof gaps from \`${delegationEventsPath()}\` when present. Convert gate/delegation state into human labels: \`passed\`, \`blocked\`, \`missing proof\`, \`waived with reason\`, \`stale\`, \`ready to advance\`, or the closeout substate label.
|
|
95
96
|
- If any data source is missing or corrupt, say so explicitly rather than guessing.
|
|
96
97
|
- Include \`/cc-view tree\` for deep structure and \`/cc-view diff\` for before/after map in the final line.
|
|
97
98
|
|
|
@@ -102,7 +103,7 @@ a read-only command.
|
|
|
102
103
|
- Collapsing \`◎ missing-evidence\` into \`✓ completed\` — role-switch gaps must stay
|
|
103
104
|
visible so the stage cannot advance silently.
|
|
104
105
|
- Omitting the closeout row when \`shipSubstate !== "idle"\`; it is the only signal
|
|
105
|
-
that tells the user why \`/cc
|
|
106
|
+
that tells the user why \`/cc\` is about to run retro/compound/archive.
|
|
106
107
|
- Mutating state to "clean up" during a status check.
|
|
107
108
|
`;
|
|
108
109
|
}
|