cclaw-cli 0.48.31 → 0.48.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/artifact-linter.js +609 -10
- package/dist/config.d.ts +1 -1
- package/dist/config.js +82 -4
- package/dist/content/examples.js +23 -6
- package/dist/content/hook-inline-snippets.d.ts +80 -0
- package/dist/content/hook-inline-snippets.js +270 -0
- package/dist/content/ideate-command.d.ts +6 -2
- package/dist/content/ideate-command.js +43 -16
- package/dist/content/ideate-frames.d.ts +31 -0
- package/dist/content/ideate-frames.js +140 -0
- package/dist/content/ideate-ranking.d.ts +25 -0
- package/dist/content/ideate-ranking.js +65 -0
- package/dist/content/node-hooks.js +9 -197
- package/dist/content/review-loop.d.ts +192 -0
- package/dist/content/review-loop.js +689 -0
- package/dist/content/seed-shelf.d.ts +36 -0
- package/dist/content/seed-shelf.js +236 -0
- package/dist/content/skills.js +77 -4
- package/dist/content/stage-schema.d.ts +1 -1
- package/dist/content/stage-schema.js +18 -2
- package/dist/content/stages/brainstorm.js +20 -4
- package/dist/content/stages/design.js +36 -8
- package/dist/content/stages/plan.js +5 -0
- package/dist/content/stages/review.js +5 -0
- package/dist/content/stages/schema-types.d.ts +29 -0
- package/dist/content/stages/scope.js +22 -6
- package/dist/content/stages/ship.js +6 -0
- package/dist/content/stages/spec.js +6 -0
- package/dist/content/stages/tdd.js +6 -0
- package/dist/content/start-command.js +24 -18
- package/dist/content/templates.js +108 -4
- package/dist/internal/advance-stage.js +143 -1
- package/dist/trace-matrix.d.ts +14 -0
- package/dist/trace-matrix.js +55 -1
- package/dist/types.d.ts +27 -0
- package/package.json +1 -1
|
@@ -100,6 +100,11 @@ export const PLAN = {
|
|
|
100
100
|
"WAIT_FOR_CONFIRM present and unresolved until user approves",
|
|
101
101
|
"artifact ready for TDD execution",
|
|
102
102
|
"acceptance mapping complete"
|
|
103
|
+
],
|
|
104
|
+
platformNotes: [
|
|
105
|
+
"Per-task verification commands must be runnable on Windows PowerShell, macOS bash/zsh, and Linux bash. Prefer `npm run <script>` / `pnpm <script>` / `pytest -k <name>` over raw shell one-liners so the command portability is handled by the script runner.",
|
|
106
|
+
"If a task command needs globbing, wrap the glob in single quotes on POSIX and escape as needed on PowerShell (`'src/**/*.ts'` vs `\"src/**/*.ts\"`). Note the quoting variant when the task is expected to run in mixed-OS CI.",
|
|
107
|
+
"Environment variables referenced from tasks must be named in uppercase with underscores (`CCLAW_PROJECT_ROOT`) and set via a cross-shell wrapper (e.g. `cross-env` for Node tasks) — do not inline `KEY=value cmd` style that fails in PowerShell/cmd.exe."
|
|
103
108
|
]
|
|
104
109
|
},
|
|
105
110
|
artifactRules: {
|
|
@@ -100,6 +100,11 @@ export const REVIEW = {
|
|
|
100
100
|
"all review sections evaluated",
|
|
101
101
|
"critical blockers resolved",
|
|
102
102
|
"ship readiness explicitly stated"
|
|
103
|
+
],
|
|
104
|
+
platformNotes: [
|
|
105
|
+
"When citing file locations in findings, use repo-relative forward-slash paths with a line number (`src/foo/bar.ts:42`). Avoid IDE-generated hyperlinks that embed absolute machine-specific paths.",
|
|
106
|
+
"Line-range or diff-range references must match `git diff --unified=0` output format so reviewers on any OS can reproduce the range locally without GUI tooling.",
|
|
107
|
+
"Commands in remediation suggestions must be portable (`npm run lint`, `pytest -x path/to/test`) — if a platform-specific command is required, tag the note explicitly (`# PowerShell only`, `# macOS only`)."
|
|
103
108
|
]
|
|
104
109
|
},
|
|
105
110
|
artifactRules: {
|
|
@@ -50,6 +50,14 @@ export interface StagePhilosophy {
|
|
|
50
50
|
export interface StageExecutionModel {
|
|
51
51
|
interactionProtocol: string[];
|
|
52
52
|
process: string[];
|
|
53
|
+
/**
|
|
54
|
+
* Optional custom mermaid `flowchart` body (without the fenced `mermaid`
|
|
55
|
+
* code block) that overrides the auto-generated linear flowchart in the
|
|
56
|
+
* rendered `## Process` section. Use for stages whose state machine is
|
|
57
|
+
* non-linear (loops, conditional branches) — otherwise leave unset and
|
|
58
|
+
* let the renderer derive a simple `A --> B --> C` chart from `process`.
|
|
59
|
+
*/
|
|
60
|
+
processFlow?: string;
|
|
53
61
|
checklist: string[];
|
|
54
62
|
requiredGates: StageGate[];
|
|
55
63
|
requiredEvidence: string[];
|
|
@@ -58,6 +66,13 @@ export interface StageExecutionModel {
|
|
|
58
66
|
researchPlaybooks?: string[];
|
|
59
67
|
blockers: string[];
|
|
60
68
|
exitCriteria: string[];
|
|
69
|
+
/**
|
|
70
|
+
* Optional platform-specific notes (Windows/macOS/Linux path separators,
|
|
71
|
+
* PowerShell vs cmd, harness-specific tool names). Rendered under
|
|
72
|
+
* "## Platform Notes" when present. Omit when the stage is
|
|
73
|
+
* platform-agnostic.
|
|
74
|
+
*/
|
|
75
|
+
platformNotes?: string[];
|
|
61
76
|
}
|
|
62
77
|
export interface StageArtifactRules {
|
|
63
78
|
artifactFile: string;
|
|
@@ -70,10 +85,18 @@ export interface StageReviewLens {
|
|
|
70
85
|
outputs: string[];
|
|
71
86
|
reviewSections: ReviewSection[];
|
|
72
87
|
mandatoryDelegations: string[];
|
|
88
|
+
reviewLoop?: StageReviewLoop;
|
|
73
89
|
}
|
|
74
90
|
export interface StageReviewLensInput {
|
|
75
91
|
outputs: string[];
|
|
76
92
|
reviewSections: ReviewSection[];
|
|
93
|
+
reviewLoop?: StageReviewLoop;
|
|
94
|
+
}
|
|
95
|
+
export interface StageReviewLoop {
|
|
96
|
+
stage: "scope" | "design";
|
|
97
|
+
checklist: string[];
|
|
98
|
+
maxIterations: number;
|
|
99
|
+
targetScore: number;
|
|
77
100
|
}
|
|
78
101
|
export interface StageSchema {
|
|
79
102
|
schemaShape: "v2";
|
|
@@ -100,6 +123,10 @@ export interface StageSchema {
|
|
|
100
123
|
whenNotToUse: string[];
|
|
101
124
|
interactionProtocol: string[];
|
|
102
125
|
process: string[];
|
|
126
|
+
/** See {@link StageExecutionModel.processFlow}. */
|
|
127
|
+
processFlow?: string;
|
|
128
|
+
/** See {@link StageExecutionModel.platformNotes}. */
|
|
129
|
+
platformNotes?: string[];
|
|
103
130
|
requiredGates: StageGate[];
|
|
104
131
|
requiredEvidence: string[];
|
|
105
132
|
inputs: string[];
|
|
@@ -130,6 +157,8 @@ export interface StageSchema {
|
|
|
130
157
|
trivialOverrideSections?: string[];
|
|
131
158
|
/** Agent names that MUST be dispatched (or waived) before stage transition — derived from mandatory auto-subagent rows. */
|
|
132
159
|
mandatoryDelegations: string[];
|
|
160
|
+
/** Optional shared outside-voice loop config for scope/design stages. */
|
|
161
|
+
reviewLoop?: StageReviewLoop;
|
|
133
162
|
}
|
|
134
163
|
export type StageSchemaLegacyInput = Omit<StageSchema, "schemaShape" | "philosophy" | "executionModel" | "artifactRules" | "reviewLens" | "mandatoryDelegations" | "complexityTier"> & {
|
|
135
164
|
schemaShape?: "legacy";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { REVIEW_LOOP_CHECKLISTS } from "../review-loop.js";
|
|
1
2
|
// ---------------------------------------------------------------------------
|
|
2
3
|
// SCOPE — reference: gstack CEO review
|
|
3
4
|
// ---------------------------------------------------------------------------
|
|
@@ -43,7 +44,7 @@ export const SCOPE = {
|
|
|
43
44
|
},
|
|
44
45
|
executionModel: {
|
|
45
46
|
checklist: [
|
|
46
|
-
"**Pre-Scope System Audit** — before premise challenge
|
|
47
|
+
"**Pre-Scope System Audit (opt-in)** — when `.cclaw/config.yaml::optInAudits.scopePreAudit` is true, before premise challenge gather reality snapshot: recent commits (`git log -30 --oneline`), current diff (`git diff --stat`), stash state (`git stash list`), and deferred debt markers (`rg -n 'TODO|FIXME|XXX|HACK'`). Record findings in scope artifact.",
|
|
47
48
|
"**Assess complexity** — Read the brainstorm artifact. If project is simple (single component, clear architecture, personal/prototype), run light-touch scope: mode selection, 3-5 key in/out boundaries, deferred items. Skip Dream State Mapping and Temporal Interrogation. If project is complex (multi-component, team delivery, production), run the full checklist.",
|
|
48
49
|
"**Prime Directives** — Zero silent failures. For each in-scope capability, name concrete failure modes, the exact error surface, and trace all four data-flow paths (happy, nil, empty, upstream error). Include interaction edge cases (double-click, navigate-away, stale state), observability commitments, and explicit deferred-item logging.",
|
|
49
50
|
"**Premise Challenge** — Is this the right problem? What if we do nothing? What are we optimizing for?",
|
|
@@ -55,7 +56,8 @@ export const SCOPE = {
|
|
|
55
56
|
"**Temporal Interrogation** — (complex projects only) simulate implementation timeline: HOUR 1 foundations, HOUR 2-3 core logic, HOUR 4-5 integration surprises, HOUR 6+ polish/tests. Decide what must be locked now vs safely deferred.",
|
|
56
57
|
"**Mode Selection** — Present expand/selective/hold/reduce with recommendation and default heuristic: greenfield -> expand, feature enhancement -> selective, bugfix/hotfix/refactor -> hold, broad blast radius (>15 files or multi-team impact) -> reduce.",
|
|
57
58
|
"**Mode-Specific Analysis** — After mode is selected, run the matching analysis: EXPAND (10x and delight opportunities), SELECTIVE (hold-scope rigor then cherry-picked expansions), HOLD (minimum-change-set hardening), REDUCE (ruthless cuts and follow-up split).",
|
|
58
|
-
"**
|
|
59
|
+
"**Plant-seed shelf (optional)** — when a deferred/out-of-scope idea still has upside, capture it as `.cclaw/seeds/SEED-<YYYY-MM-DD>-<slug>.md` with trigger_when and action instead of losing it in prose-only notes.",
|
|
60
|
+
"**Outside Voice + Spec Review Loop** — run an adversarial second-opinion pass on the scope artifact, reconcile findings, and iterate up to 3 cycles or until quality score >= 0.8. When `.cclaw/config.yaml::reviewLoop.externalSecondOpinion.enabled` is true, run an additional external-model pass and explicitly resolve score/finding disagreements.",
|
|
59
61
|
"**Error and Rescue Registry** — For each capability: what breaks, how detected, what fallback."
|
|
60
62
|
],
|
|
61
63
|
interactionProtocol: [
|
|
@@ -74,15 +76,16 @@ export const SCOPE = {
|
|
|
74
76
|
"**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 scope` (do not hand-edit `.cclaw/state/flow-state.json`)."
|
|
75
77
|
],
|
|
76
78
|
process: [
|
|
77
|
-
"
|
|
79
|
+
"When `.cclaw/config.yaml::optInAudits.scopePreAudit` is true, run pre-scope system audit (git log/diff/stash/debt markers).",
|
|
78
80
|
"Run premise challenge and existing-solution leverage check.",
|
|
79
81
|
"When mode is EXPAND/SELECTIVE, run brief landscape check before final scope lock.",
|
|
80
82
|
"Calibrate quality bar against 2-3 strong existing modules/files.",
|
|
81
83
|
"Produce 2-3 scope alternatives in a structured format (Name, Summary, Effort, Risk, Pros, Cons, Reuses) with minimum viable and ideal architecture options included.",
|
|
82
84
|
"Choose scope mode with user approval.",
|
|
83
85
|
"Run mode-specific analysis that matches the selected scope mode.",
|
|
86
|
+
"Optionally plant high-upside deferred ideas into `.cclaw/seeds/SEED-<YYYY-MM-DD>-<slug>.md` with trigger_when/action notes.",
|
|
84
87
|
"Walk through scope review sections one at a time.",
|
|
85
|
-
"Run outside-voice spec review loop (up to 3 iterations, quality score target >= 0.8).",
|
|
88
|
+
"Run outside-voice spec review loop (up to 3 iterations, quality score target >= 0.8). If configured, include external second opinion and reconcile deltas.",
|
|
86
89
|
"Write explicit scope contract, discretion areas, and deferred items.",
|
|
87
90
|
"Freeze non-negotiable boundaries as stable Locked Decisions (D-XX IDs).",
|
|
88
91
|
"Produce scope summary plus completion dashboard (section status, critical gaps, resolved decisions, unresolved items or `None`)."
|
|
@@ -94,7 +97,7 @@ export const SCOPE = {
|
|
|
94
97
|
],
|
|
95
98
|
requiredEvidence: [
|
|
96
99
|
"Artifact written to `.cclaw/artifacts/02-scope-<slug>.md`.",
|
|
97
|
-
"Pre-Scope System Audit findings are captured (git log/diff/stash/debt markers).",
|
|
100
|
+
"When `.cclaw/config.yaml::optInAudits.scopePreAudit` is true, Pre-Scope System Audit findings are captured (git log/diff/stash/debt markers).",
|
|
98
101
|
"In-scope and out-of-scope lists are explicit.",
|
|
99
102
|
"Discretion areas are explicit (or marked as `None`).",
|
|
100
103
|
"Selected mode and rationale are documented.",
|
|
@@ -102,7 +105,9 @@ export const SCOPE = {
|
|
|
102
105
|
"Premise challenge findings documented.",
|
|
103
106
|
"Outside Voice findings and dispositions are recorded (accept/reject/defer with rationale).",
|
|
104
107
|
"Spec review loop summary includes iteration count and quality score trajectory.",
|
|
108
|
+
"When `.cclaw/config.yaml::reviewLoop.externalSecondOpinion.enabled` is true, external second-opinion disposition is captured.",
|
|
105
109
|
"Deferred items list with one-line rationale for each.",
|
|
110
|
+
"When an upside deferred idea is parked, a seed file is created under `.cclaw/seeds/` and referenced in the artifact.",
|
|
106
111
|
"Completion dashboard lists per-section status, critical/open gaps, decision count, and unresolved items (or `None`)."
|
|
107
112
|
],
|
|
108
113
|
inputs: ["brainstorm artifact", "timeline constraints", "product priorities"],
|
|
@@ -128,6 +133,11 @@ export const SCOPE = {
|
|
|
128
133
|
"locked decisions captured with stable D-XX IDs",
|
|
129
134
|
"completion dashboard produced",
|
|
130
135
|
"scope summary produced"
|
|
136
|
+
],
|
|
137
|
+
platformNotes: [
|
|
138
|
+
"Scope contract paths must be repo-relative with forward slashes so they resolve identically on Windows, macOS, and Linux (`src/pkg/mod.ts`, NOT `src\\pkg\\mod.ts`).",
|
|
139
|
+
"When invoking `git log`/`git diff` for the Pre-Scope audit, wrap glob patterns in single quotes on POSIX shells and double quotes on PowerShell (`git log -- 'src/**/*.ts'` vs `git log -- \"src/**/*.ts\"`). Document the command with the quoting style you actually ran.",
|
|
140
|
+
"Do not hard-code machine-specific absolute paths (home dirs, drive letters) into the scope contract — keep boundaries repo-relative."
|
|
131
141
|
]
|
|
132
142
|
},
|
|
133
143
|
artifactRules: {
|
|
@@ -139,7 +149,7 @@ export const SCOPE = {
|
|
|
139
149
|
traceabilityRule: "Every scope boundary must be traceable to a brainstorm decision. Every downstream design choice must stay within the scope contract."
|
|
140
150
|
},
|
|
141
151
|
artifactValidation: [
|
|
142
|
-
{ section: "Pre-Scope System Audit", required: false, validationRule: "
|
|
152
|
+
{ section: "Pre-Scope System Audit", required: false, validationRule: "When `.cclaw/config.yaml::optInAudits.scopePreAudit` is true: must capture git log -30, git diff --stat, git stash list, and debt-marker scan (TODO/FIXME/XXX/HACK) before premise challenge." },
|
|
143
153
|
{ section: "Prime Directives", required: false, validationRule: "For each scoped capability: named failure modes, explicit error surface, four data-flow paths, interaction edge cases, observability expectations, and deferred-item handling." },
|
|
144
154
|
{ section: "Premise Challenge", required: false, validationRule: "Must contain explicit answers to: right problem? direct path? what if nothing?" },
|
|
145
155
|
{ section: "Landscape Check", required: false, validationRule: "When mode is EXPAND/SELECTIVE, include at least one external reference insight and its impact on scope." },
|
|
@@ -163,6 +173,12 @@ export const SCOPE = {
|
|
|
163
173
|
},
|
|
164
174
|
reviewLens: {
|
|
165
175
|
outputs: ["scope mode decision", "scope contract", "discretion areas list", "deferred scope list", "scope summary", "scope completion dashboard"],
|
|
176
|
+
reviewLoop: {
|
|
177
|
+
stage: "scope",
|
|
178
|
+
checklist: REVIEW_LOOP_CHECKLISTS.scope.map((dimension) => dimension.id),
|
|
179
|
+
maxIterations: 3,
|
|
180
|
+
targetScore: 0.8
|
|
181
|
+
},
|
|
166
182
|
reviewSections: [
|
|
167
183
|
{
|
|
168
184
|
title: "Scope Boundary Audit",
|
|
@@ -92,6 +92,12 @@ export const SHIP = {
|
|
|
92
92
|
"preflight completed",
|
|
93
93
|
"rollback and release notes complete",
|
|
94
94
|
"finalization action explicitly chosen and executed"
|
|
95
|
+
],
|
|
96
|
+
platformNotes: [
|
|
97
|
+
"Release commands (`npm publish`, `git tag -s`, `gh release create`, `cargo publish`, `goreleaser`) behave the same across OSes, but signing keys differ: macOS Keychain, Windows credential store, Linux GPG agent. Verify the signing flow on the actual release machine before running the real publish.",
|
|
98
|
+
"Version tags must be pure ASCII and lowercase after an optional `v` prefix (`v1.2.3`, `v1.2.3-rc.1`). Avoid Unicode dashes and non-breaking spaces that sneak in via copy-paste from docs.",
|
|
99
|
+
"When the rollback plan references timestamps (CI run windows, DB snapshot IDs), pin them to UTC ISO-8601 so the plan reads identically across CI runners in different regions.",
|
|
100
|
+
"`gh release create` requires a repo-level `GH_TOKEN`/`GITHUB_TOKEN`; document whether it is sourced from the shell env, `.env`, or the OS keychain so another operator on a different OS can reproduce the release."
|
|
95
101
|
]
|
|
96
102
|
},
|
|
97
103
|
artifactRules: {
|
|
@@ -40,6 +40,7 @@ export const SPEC = {
|
|
|
40
40
|
"Capture edge cases — for each criterion, define at least one boundary condition and one error condition.",
|
|
41
41
|
"Document constraints and assumptions — regulatory, system, integration, and performance boundaries. Surface implicit assumptions explicitly.",
|
|
42
42
|
"Confirm testability — for each acceptance criterion, describe the test that would prove it. If untestable, rewrite the criterion.",
|
|
43
|
+
"Present acceptance criteria to the user in 3-5-item batches, pausing for explicit ACK between batches (see Interaction Protocol).",
|
|
43
44
|
"Write spec artifact and request user approval — wait for explicit confirmation before proceeding."
|
|
44
45
|
],
|
|
45
46
|
interactionProtocol: [
|
|
@@ -86,6 +87,11 @@ export const SPEC = {
|
|
|
86
87
|
"required gates marked satisfied",
|
|
87
88
|
"plan-ready acceptance mapping exists",
|
|
88
89
|
"testability confirmed for all criteria"
|
|
90
|
+
],
|
|
91
|
+
platformNotes: [
|
|
92
|
+
"Acceptance criteria that reference CLI commands must name the executable portably (`node`, `npm`, `pytest`) and avoid OS-specific shell features (`&&` is safe, `||` differs subtly between cmd.exe and POSIX — prefer explicit multi-step descriptions).",
|
|
93
|
+
"When a criterion specifies file-content expectations, use `LF` as the canonical newline and state any CRLF-on-Windows tolerance explicitly (most git-managed repos normalize via `.gitattributes`; the criterion should not implicitly depend on autocrlf).",
|
|
94
|
+
"Timezone-sensitive criteria (timestamps, retention windows) must pin UTC or note the source of truth — clocks differ across CI runners (GitHub macOS vs Linux image vs Windows image)."
|
|
89
95
|
]
|
|
90
96
|
},
|
|
91
97
|
artifactRules: {
|
|
@@ -103,6 +103,12 @@ export const TDD = {
|
|
|
103
103
|
"REFACTOR evidence captured",
|
|
104
104
|
"required gates marked satisfied",
|
|
105
105
|
"traceability annotated"
|
|
106
|
+
],
|
|
107
|
+
platformNotes: [
|
|
108
|
+
"Record the **exact** test command run (`npm test -- path/to/file`, `pytest path/to/file`, `go test ./...`) so RED/GREEN evidence is reproducible on any OS. Do not paraphrase to a shorter alias.",
|
|
109
|
+
"Line-ending drift (CRLF vs LF) can turn a passing test red on Windows if the repo mixes styles. When a GREEN flip happens only after whitespace normalization, record it as a refactor note, not a hidden fix.",
|
|
110
|
+
"When invoking a test file path from Windows PowerShell, use forward slashes (`npm test -- tests/foo.test.ts`) — backslashes trip globbing on `cross-env` and similar wrappers.",
|
|
111
|
+
"Flaky tests that only fail on one OS must be marked as such in the TDD artifact (OS + runner + one failing output snippet) — do not retry until green without evidence."
|
|
106
112
|
]
|
|
107
113
|
},
|
|
108
114
|
artifactRules: {
|
|
@@ -47,13 +47,18 @@ This is the **recommended way to start** working with cclaw. Use \`/cc-next\` fo
|
|
|
47
47
|
|
|
48
48
|
Record the chosen class in \`.cclaw/artifacts/00-idea.md\` on the \`Class:\` line. Do NOT silently treat a non-software task as software.
|
|
49
49
|
|
|
50
|
-
2. **Phase
|
|
50
|
+
2. **Phase 0.5 — Seed shelf recall.** Before routing, scan \`${RUNTIME_ROOT}/seeds/SEED-*.md\` and match each seed's \`trigger_when\` tokens against the prompt text (substring match is enough). If any match:
|
|
51
|
+
- Surface up to 3 matches (file + title + one-line action) as \`Seed recalls\`.
|
|
52
|
+
- Ask whether to apply now, keep as reference, or ignore for this run.
|
|
53
|
+
- If applied/reference, append selected seeds to \`00-idea.md\` under \`Discovered context\` so downstream stages keep the trace.
|
|
54
|
+
|
|
55
|
+
3. **Phase 1 — Origin-document discovery.** Before asking the user for context, scan for existing requirements/plan artifacts and merge them into initial context:
|
|
51
56
|
- \`.cclaw/artifacts/00-idea.md\` if it already exists (resumed flow).
|
|
52
57
|
- 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\`.
|
|
53
58
|
- Summarize each discovered doc in \`00-idea.md\` under a \`Discovered context\` section with path + 1-line summary.
|
|
54
59
|
- If an origin doc contradicts the prompt, surface the conflict to the user before routing.
|
|
55
60
|
|
|
56
|
-
|
|
61
|
+
4. **Phase 2 — Tech-stack + version detection.** Sniff the repo for stack + language versions and record under \`Stack:\`:
|
|
57
62
|
- Node: \`package.json\` \`engines\` / \`volta\` / \`packageManager\` / \`devDependencies\`.
|
|
58
63
|
- Python: \`pyproject.toml\` / \`requirements*.txt\` / \`.python-version\`.
|
|
59
64
|
- Go: \`go.mod\` (module + Go version).
|
|
@@ -63,9 +68,9 @@ This is the **recommended way to start** working with cclaw. Use \`/cc-next\` fo
|
|
|
63
68
|
- CI: \`.github/workflows\`, \`.gitlab-ci.yml\`.
|
|
64
69
|
Skip detection quietly if no markers are found — do NOT invent a stack.
|
|
65
70
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
71
|
+
5. Read \`${flowPath}\`.
|
|
72
|
+
6. If flow already has completed stages, warn the user that starting a new tracked flow will reset progress. Ask for confirmation before proceeding.
|
|
73
|
+
7. **Track heuristic** — classify the idea text and **recommend** a track (the user can override before any state mutation):
|
|
69
74
|
- 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).
|
|
70
75
|
- **quick** (\`spec → tdd → review → ship\`) — single-purpose work where the spec is essentially already known.
|
|
71
76
|
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\`.
|
|
@@ -74,17 +79,17 @@ This is the **recommended way to start** working with cclaw. Use \`/cc-next\` fo
|
|
|
74
79
|
- **standard** (full 8 stages — default fallback) — anything that introduces a new capability with architecture uncertainty, touches many modules, or has unclear scope.
|
|
75
80
|
Triggers: \`new feature\`, \`refactor\`, \`migration\`, \`platform\`, \`architecture\`, \`schema\`, \`integrate\`, \`workflow\`, \`onboarding\`, or any prompt that does not match quick/medium confidently.
|
|
76
81
|
- When triggers conflict, prefer **standard** over **medium**, and **medium** over **quick**.
|
|
77
|
-
|
|
82
|
+
8. Present the recommendation as a single decision with explicit options:
|
|
78
83
|
> \`Recommended track: <quick|medium|standard>\` because \`<one-line reason citing matched triggers>\`.
|
|
79
84
|
> Override? (A) keep \`<recommended>\` (B) switch track (C) cancel.
|
|
80
85
|
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.
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
86
|
+
9. Persist the chosen track to \`${flowPath}\` (\`track\` field). Compute \`skippedStages\` from the track and write that too. Use the **first stage of the chosen track** as \`currentStage\` (quick → \`spec\`, medium/standard → \`brainstorm\`, trivial fast-path → \`design\` or \`spec\` per Phase 0).
|
|
87
|
+
10. Write the prompt to \`.cclaw/artifacts/00-idea.md\` with the following header lines: \`Class:\` (from Phase 0), \`Track:\` (chosen track + matched heuristic), \`Stack:\` (from Phase 2 detection, or \`unknown\`), and a \`Discovered context\` section if Phase 1/seed recall found references.
|
|
88
|
+
11. Load the **first-stage skill for the chosen track** and its command file:
|
|
84
89
|
- quick → \`.cclaw/skills/specification-authoring/SKILL.md\` + \`.cclaw/commands/spec.md\`
|
|
85
90
|
- medium/standard → \`.cclaw/skills/brainstorming/SKILL.md\` + \`.cclaw/commands/brainstorm.md\`
|
|
86
91
|
- trivial fast-path → design or spec skill per Phase 0 decision.
|
|
87
|
-
|
|
92
|
+
12. Execute that stage with the prompt + Phase 1/Phase 2 + seed context as initial input.
|
|
88
93
|
|
|
89
94
|
### Reclassification on discovery
|
|
90
95
|
|
|
@@ -152,14 +157,15 @@ Do **not** silently discard an existing flow when the user provides a prompt. If
|
|
|
152
157
|
### Path A: \`/cc <prompt>\`
|
|
153
158
|
|
|
154
159
|
1. **Task classification (Phase 0).** Decide whether the prompt is \`software-standard\`, \`software-trivial\`, \`software-bugfix\`, \`pure-question\`, or \`non-software\`. Non-software and pure-question exit immediately — answer directly, do not open a stage.
|
|
155
|
-
2. **
|
|
156
|
-
3. **
|
|
157
|
-
4.
|
|
158
|
-
5.
|
|
160
|
+
2. **Seed shelf recall (Phase 0.5).** Scan \`${RUNTIME_ROOT}/seeds/SEED-*.md\` and match \`trigger_when\` tokens against the prompt text. Surface up to 3 matching seeds with file/title/action and ask whether to apply or ignore. When applied, add them to \`00-idea.md\` under \`Discovered context\`.
|
|
161
|
+
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.
|
|
162
|
+
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.
|
|
163
|
+
5. Read \`${flowPath}\`.
|
|
164
|
+
6. If \`completedStages\` is non-empty:
|
|
159
165
|
- Inform: "You have an active flow at stage **{currentStage}** with {N} completed stages. Starting a new tracked flow will reset progress."
|
|
160
166
|
- Ask: "Continue with reset? (A) Yes, start fresh (B) No, resume current flow"
|
|
161
167
|
- If (B) → switch to Path B behavior.
|
|
162
|
-
|
|
168
|
+
7. **Classify the idea** using the heuristic below and present a single track recommendation. Wait for explicit confirmation or override before mutating any state.
|
|
163
169
|
- 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.)
|
|
164
170
|
|
|
165
171
|
**Track heuristic** (lowercase substring match against the user prompt):
|
|
@@ -172,9 +178,9 @@ Do **not** silently discard an existing flow when the user provides a prompt. If
|
|
|
172
178
|
|
|
173
179
|
- On conflict, prefer \`standard\` over \`medium\`, and \`medium\` over \`quick\`.
|
|
174
180
|
- Always state the recommendation as a one-line reason citing matched triggers.
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
181
|
+
8. Persist the chosen track in \`${flowPath}\` (\`track\` + \`skippedStages\`). Set \`currentStage\` to the first stage of the chosen track (\`quick\` → \`spec\`, \`medium\`/ \`standard\` → \`brainstorm\`, trivial fast-path → \`design\` or \`spec\`). Reset gate catalog.
|
|
182
|
+
9. Write \`${RUNTIME_ROOT}/artifacts/00-idea.md\` with the user's prompt plus header lines: \`Class:\`, \`Track:\`, \`Stack:\`, and a \`Discovered context\` section from Phase 0.5/1.
|
|
183
|
+
10. Load and execute the **first stage skill of the chosen track** (\`brainstorming\` for medium/standard, \`specification-authoring\` for quick) plus its matching command file.
|
|
178
184
|
|
|
179
185
|
### Reclassification on discovery
|
|
180
186
|
|
|
@@ -28,17 +28,36 @@ inputs_hash: sha256:pending
|
|
|
28
28
|
|---|---|---|---|
|
|
29
29
|
| 1 | | | |
|
|
30
30
|
|
|
31
|
+
## Approach Tier
|
|
32
|
+
- Tier: Lightweight | Standard | Deep
|
|
33
|
+
- Why this tier:
|
|
34
|
+
|
|
35
|
+
## Short-Circuit Decision
|
|
36
|
+
- Status: bypassed
|
|
37
|
+
- Why:
|
|
38
|
+
- Scope handoff:
|
|
39
|
+
|
|
31
40
|
## Approaches
|
|
32
|
-
| Approach | Architecture | Trade-offs | Recommendation |
|
|
33
|
-
|
|
34
|
-
| A | | | |
|
|
35
|
-
| B | | | |
|
|
41
|
+
| Approach | Role | Architecture | Trade-offs | Recommendation |
|
|
42
|
+
|---|---|---|---|---|
|
|
43
|
+
| A | baseline | | | |
|
|
44
|
+
| B | challenger: higher-upside | | | |
|
|
45
|
+
|
|
46
|
+
## Approach Reaction
|
|
47
|
+
- Closest option:
|
|
48
|
+
- Concerns:
|
|
49
|
+
- What changed after reaction:
|
|
36
50
|
|
|
37
51
|
## Selected Direction
|
|
38
52
|
- **Approach:**
|
|
39
53
|
- **Rationale:**
|
|
40
54
|
- **Approval:** pending
|
|
41
55
|
|
|
56
|
+
## Seed Shelf Candidates (optional)
|
|
57
|
+
| Seed file | Trigger when | Suggested action | Status (planted/deferred/ignored) |
|
|
58
|
+
|---|---|---|---|
|
|
59
|
+
| .cclaw/seeds/SEED-YYYY-MM-DD-<slug>.md | | | |
|
|
60
|
+
|
|
42
61
|
## Design
|
|
43
62
|
- **Architecture:**
|
|
44
63
|
- **Key components:**
|
|
@@ -62,6 +81,14 @@ inputs_hash: sha256:pending
|
|
|
62
81
|
|
|
63
82
|
# Scope Artifact
|
|
64
83
|
|
|
84
|
+
## Pre-Scope System Audit
|
|
85
|
+
| Check | Command | Findings |
|
|
86
|
+
|---|---|---|
|
|
87
|
+
| Recent commits | \`git log -30 --oneline\` | |
|
|
88
|
+
| Current diff | \`git diff --stat\` | |
|
|
89
|
+
| Stash state | \`git stash list\` | |
|
|
90
|
+
| Debt markers | \`rg -n "TODO|FIXME|XXX|HACK"\` | |
|
|
91
|
+
|
|
65
92
|
## Prime Directives
|
|
66
93
|
- Zero silent failures:
|
|
67
94
|
- Every error has a name:
|
|
@@ -138,11 +165,28 @@ inputs_hash: sha256:pending
|
|
|
138
165
|
|---|---|
|
|
139
166
|
| | |
|
|
140
167
|
|
|
168
|
+
## Seed Shelf Candidates (optional)
|
|
169
|
+
| Seed file | Trigger when | Suggested action | Status (planted/deferred/ignored) |
|
|
170
|
+
|---|---|---|---|
|
|
171
|
+
| .cclaw/seeds/SEED-YYYY-MM-DD-<slug>.md | | | |
|
|
172
|
+
|
|
141
173
|
## Error & Rescue Registry
|
|
142
174
|
| Capability | Failure mode | Detection | Fallback |
|
|
143
175
|
|---|---|---|---|
|
|
144
176
|
| | | | |
|
|
145
177
|
|
|
178
|
+
## Outside Voice Findings
|
|
179
|
+
| ID | Dimension | Finding | Disposition | Rationale |
|
|
180
|
+
|---|---|---|---|---|
|
|
181
|
+
| F-1 | premise_fit | | accept/reject/defer | |
|
|
182
|
+
|
|
183
|
+
## Spec Review Loop
|
|
184
|
+
| Iteration | Quality Score | Findings | Stop decision |
|
|
185
|
+
|---|---|---|---|
|
|
186
|
+
| 1 | 0.00 | 0 | continue/stop |
|
|
187
|
+
- Stop reason:
|
|
188
|
+
- Unresolved concerns:
|
|
189
|
+
|
|
146
190
|
## Completion Dashboard
|
|
147
191
|
- Checklist findings:
|
|
148
192
|
- Resolved decisions count:
|
|
@@ -236,21 +280,55 @@ inputs_hash: sha256:pending
|
|
|
236
280
|
|
|
237
281
|
## Architecture Diagram
|
|
238
282
|
|
|
283
|
+
<!-- diagram: architecture -->
|
|
284
|
+
|
|
239
285
|
\`\`\`
|
|
240
286
|
(ASCII, Mermaid, or tool-generated diagram showing component boundaries and data flow direction)
|
|
241
287
|
\`\`\`
|
|
242
288
|
|
|
243
289
|
## Data-Flow Shadow Paths
|
|
290
|
+
<!-- diagram: data-flow-shadow-paths -->
|
|
244
291
|
| Path | Trigger | Fallback/Degrade behavior |
|
|
245
292
|
|---|---|---|
|
|
246
293
|
| | | |
|
|
247
294
|
|
|
248
295
|
## Error Flow Diagram
|
|
249
296
|
|
|
297
|
+
<!-- diagram: error-flow -->
|
|
298
|
+
|
|
250
299
|
\`\`\`
|
|
251
300
|
(failure detection -> rescue action -> user-visible outcome)
|
|
252
301
|
\`\`\`
|
|
253
302
|
|
|
303
|
+
## State Machine Diagram
|
|
304
|
+
|
|
305
|
+
<!-- diagram: state-machine -->
|
|
306
|
+
|
|
307
|
+
\`\`\`
|
|
308
|
+
(state transitions for the critical flow lifecycle)
|
|
309
|
+
\`\`\`
|
|
310
|
+
|
|
311
|
+
## Rollback Flowchart
|
|
312
|
+
|
|
313
|
+
<!-- diagram: rollback-flowchart -->
|
|
314
|
+
|
|
315
|
+
\`\`\`
|
|
316
|
+
(trigger -> rollback actions -> verification)
|
|
317
|
+
\`\`\`
|
|
318
|
+
|
|
319
|
+
## Deployment Sequence Diagram
|
|
320
|
+
|
|
321
|
+
<!-- diagram: deployment-sequence -->
|
|
322
|
+
|
|
323
|
+
\`\`\`
|
|
324
|
+
(rollout order, guard checks, and verification sequence)
|
|
325
|
+
\`\`\`
|
|
326
|
+
|
|
327
|
+
## Stale Diagram Audit
|
|
328
|
+
| File | Last modified | Diagram marker baseline | Status | Notes |
|
|
329
|
+
|---|---|---|---|---|
|
|
330
|
+
| | | | clear/stale | |
|
|
331
|
+
|
|
254
332
|
## What Already Exists
|
|
255
333
|
| Sub-problem | Existing code/library | Layer | Reuse decision |
|
|
256
334
|
|---|---|---|---|
|
|
@@ -262,6 +340,15 @@ inputs_hash: sha256:pending
|
|
|
262
340
|
- Upstream error path:
|
|
263
341
|
- Timeout/downstream path:
|
|
264
342
|
|
|
343
|
+
### Interaction Edge Case Matrix
|
|
344
|
+
| Edge case | Handled? | Design response | Deferred item (if not handled) |
|
|
345
|
+
|---|---|---|---|
|
|
346
|
+
| double-click | yes/no | | None / D-XX |
|
|
347
|
+
| nav-away-mid-request | yes/no | | None / D-XX |
|
|
348
|
+
| 10K-result dataset | yes/no | | None / D-XX |
|
|
349
|
+
| background-job abandonment | yes/no | | None / D-XX |
|
|
350
|
+
| zombie connection | yes/no | | None / D-XX |
|
|
351
|
+
|
|
265
352
|
## Security & Threat Model
|
|
266
353
|
| Boundary | Threat | Mitigation | Owner |
|
|
267
354
|
|---|---|---|---|
|
|
@@ -292,6 +379,18 @@ inputs_hash: sha256:pending
|
|
|
292
379
|
|---|---|---|
|
|
293
380
|
| | | |
|
|
294
381
|
|
|
382
|
+
## Outside Voice Findings
|
|
383
|
+
| ID | Dimension | Finding | Disposition | Rationale |
|
|
384
|
+
|---|---|---|---|---|
|
|
385
|
+
| F-1 | architecture_fit | | accept/reject/defer | |
|
|
386
|
+
|
|
387
|
+
## Spec Review Loop
|
|
388
|
+
| Iteration | Quality Score | Findings | Stop decision |
|
|
389
|
+
|---|---|---|---|
|
|
390
|
+
| 1 | 0.00 | 0 | continue/stop |
|
|
391
|
+
- Stop reason:
|
|
392
|
+
- Unresolved concerns:
|
|
393
|
+
|
|
295
394
|
## NOT in scope
|
|
296
395
|
-
|
|
297
396
|
|
|
@@ -314,6 +413,11 @@ inputs_hash: sha256:pending
|
|
|
314
413
|
|---|---|---|---|
|
|
315
414
|
| | | | |
|
|
316
415
|
|
|
416
|
+
## Seed Shelf Candidates (optional)
|
|
417
|
+
| Seed file | Trigger when | Suggested action | Status (planted/deferred/ignored) |
|
|
418
|
+
|---|---|---|---|
|
|
419
|
+
| .cclaw/seeds/SEED-YYYY-MM-DD-<slug>.md | | | |
|
|
420
|
+
|
|
317
421
|
## Completion Dashboard
|
|
318
422
|
| Review Section | Status | Issues |
|
|
319
423
|
|---|---|---|
|