cclaw-cli 0.48.30 → 0.48.32
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/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/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 +84 -67
- package/dist/content/stage-schema.d.ts +1 -1
- package/dist/content/stage-schema.js +14 -2
- package/dist/content/stages/brainstorm.js +15 -4
- package/dist/content/stages/design.js +31 -8
- package/dist/content/stages/schema-types.d.ts +10 -0
- package/dist/content/stages/scope.js +17 -6
- 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
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { REVIEW_LOOP_CHECKLISTS } from "../review-loop.js";
|
|
1
2
|
// ---------------------------------------------------------------------------
|
|
2
3
|
// DESIGN — reference: gstack Eng review
|
|
3
4
|
// ---------------------------------------------------------------------------
|
|
@@ -44,7 +45,7 @@ export const DESIGN = {
|
|
|
44
45
|
"Codebase Investigation — Before any design decision, read the actual code in the blast radius. List every file that will be touched, its current responsibilities, and existing patterns (error handling, naming, test style). Design must conform to discovered patterns, not impose new ones without justification.",
|
|
45
46
|
"Step 0: Scope Challenge — what existing code solves sub-problems? Minimum change set? Complexity check: 8+ files or 2+ new services = complexity smell → flag for possible scope reduction.",
|
|
46
47
|
"Search Before Building — For each technical choice (library, pattern, architecture), search for existing solutions. Label findings: Layer 1 (exact match), Layer 2 (partial match, needs adaptation), Layer 3 (inspiration only), EUREKA (unexpected perfect solution). Default to existing before custom.",
|
|
47
|
-
"Architecture Review — lock component boundaries and one realistic failure scenario per new codepath. **Mandatory diagrams
|
|
48
|
+
"Architecture Review — lock component boundaries and one realistic failure scenario per new codepath. **Mandatory diagrams by tier:** Lightweight=Architecture Diagram, Standard=+Data-Flow Shadow Paths + Error Flow Diagram, Deep=+State Machine Diagram + Rollback Flowchart + Deployment Sequence Diagram.",
|
|
48
49
|
"Security & Threat Model Review — trust boundaries, authn/authz, input validation, secrets handling, data exposure risks, abuse cases, and mitigation ownership.",
|
|
49
50
|
"Code Quality Review — code organization, DRY violations, error handling patterns, over/under-engineering assessment. Include stale-diagram audit for touched files.",
|
|
50
51
|
"Test Review — diagram every new flow, data path, error path. For each: what test type covers it? Does one exist? What is the gap? Produce test plan artifact.",
|
|
@@ -52,7 +53,9 @@ export const DESIGN = {
|
|
|
52
53
|
"Observability & Debuggability Review — logging, metrics, traces, alerts, and on-call diagnosis path for each critical failure mode.",
|
|
53
54
|
"Deployment & Rollout Review — migration sequencing, flag strategy, rollback plan, compatibility window, and post-deploy verification steps.",
|
|
54
55
|
"Parallelization Strategy — If multiple independent modules, produce dependency table: which can be built in parallel? Where are conflict risks? Flag shared-state modules.",
|
|
55
|
-
"Outside Voice + Spec Review Loop — run adversarial second-opinion review, reconcile findings, and iterate up to 3 cycles or until quality score >= 0.8.",
|
|
56
|
+
"Outside Voice + Spec Review Loop — run adversarial second-opinion review, 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.",
|
|
57
|
+
"Stale Diagram Audit (opt-in) — when `.cclaw/config.yaml::optInAudits.staleDiagramAudit` is true, compare blast-radius file mtimes against diagram-marker freshness and flag stale diagrams before design lock.",
|
|
58
|
+
"Plant-seed shelf (optional) — when an unresolved/deferred design idea has upside, capture it as `.cclaw/seeds/SEED-<YYYY-MM-DD>-<slug>.md` with trigger_when and action so it can be recalled on future `/cc` starts.",
|
|
56
59
|
"Unresolved Decisions — List any design decisions that could not be resolved in this session. For each: what information is missing? Who can provide it? What is the default if no answer comes?",
|
|
57
60
|
"Distribution Check — If the plan creates new artifact types (packages, CLI tools, configs), document the build/publish story. How does it reach the user?",
|
|
58
61
|
"Deferred Items Cross-Reference — Collect every item explicitly deferred during design review. Each must appear in the Unresolved Decisions table or in the upstream scope artifact's deferred list. No deferred item may exist only in conversation — it must be written down."
|
|
@@ -86,8 +89,9 @@ export const DESIGN = {
|
|
|
86
89
|
"Add security, observability, and deployment reviews for Standard+ changes.",
|
|
87
90
|
"Run stale-diagram audit in touched files and reconcile drift.",
|
|
88
91
|
"Define test coverage strategy and performance budget.",
|
|
89
|
-
"Produce required outputs: NOT-in-scope section, What-already-exists section,
|
|
90
|
-
"
|
|
92
|
+
"Produce required outputs: NOT-in-scope section, What-already-exists section, tier-required diagrams with markers, failure mode table.",
|
|
93
|
+
"Optionally plant unresolved high-upside ideas into `.cclaw/seeds/SEED-<YYYY-MM-DD>-<slug>.md` with trigger_when/action notes.",
|
|
94
|
+
"Run outside-voice spec review loop (up to 3 iterations, quality score target >= 0.8). If configured, include external second opinion and reconcile deltas.",
|
|
91
95
|
"Produce completion dashboard: status per review section, critical/open gap counts, decision count, unresolved items.",
|
|
92
96
|
"Write design lock artifact for downstream spec/plan."
|
|
93
97
|
],
|
|
@@ -102,12 +106,15 @@ export const DESIGN = {
|
|
|
102
106
|
"Research artifact written to `.cclaw/artifacts/02a-research.md` with stack/features/architecture/pitfalls sections plus synthesis.",
|
|
103
107
|
"Artifact written to `.cclaw/artifacts/03-design-<slug>.md`.",
|
|
104
108
|
"Failure-mode table exists in Method/Exception/Rescue/UserSees format.",
|
|
105
|
-
"
|
|
109
|
+
"Tier-required diagram markers are present: architecture (all tiers), +shadow/error (Standard+), +state-machine/rollback/deployment-sequence (Deep).",
|
|
110
|
+
"When `.cclaw/config.yaml::optInAudits.staleDiagramAudit` is true, stale diagram audit finding is clear (no blast-radius file newer than diagram markers without explicit update).",
|
|
106
111
|
"Security & threat model findings are documented with mitigations.",
|
|
107
112
|
"Observability and deployment plans are explicit for critical flows.",
|
|
108
113
|
"Outside-voice findings and dispositions are recorded (accept/reject/defer).",
|
|
109
114
|
"Spec review loop summary includes iteration count and quality score trajectory.",
|
|
115
|
+
"When `.cclaw/config.yaml::reviewLoop.externalSecondOpinion.enabled` is true, external second-opinion disposition is captured.",
|
|
110
116
|
"Test strategy includes unit/integration/e2e expectations.",
|
|
117
|
+
"When a high-upside idea is deferred, a seed file is created under `.cclaw/seeds/` and referenced in the artifact.",
|
|
111
118
|
"NOT-in-scope section produced.",
|
|
112
119
|
"What-already-exists section produced.",
|
|
113
120
|
"Completion dashboard lists review section status, critical/open gap counts, decision count, and unresolved items (or 'None')."
|
|
@@ -154,13 +161,23 @@ export const DESIGN = {
|
|
|
154
161
|
{ section: "Codebase Investigation", required: false, validationRule: "Must list blast-radius files with current responsibilities and discovered patterns." },
|
|
155
162
|
{ section: "Search Before Building", required: false, validationRule: "For each technical choice: Layer 1 (exact match), Layer 2 (partial match), Layer 3 (inspiration), EUREKA labels with reuse-first default." },
|
|
156
163
|
{ section: "Architecture Boundaries", required: true, validationRule: "Must list component boundaries with ownership." },
|
|
157
|
-
{ section: "Architecture Diagram", required: true, validationRule: "
|
|
158
|
-
{ section: "Data
|
|
164
|
+
{ section: "Architecture Diagram", required: true, validationRule: "Must include `<!-- diagram: architecture -->` marker. Diagram must label concrete nodes, label arrows, mark direction, distinguish sync/async edges, and include at least one failure/degraded edge." },
|
|
165
|
+
{ section: "Data-Flow Shadow Paths", required: false, validationRule: "Standard/Deep: include `<!-- diagram: data-flow-shadow-paths -->` marker and path table with trigger plus fallback/degrade behavior." },
|
|
166
|
+
{ section: "Error Flow Diagram", required: false, validationRule: "Standard/Deep: include `<!-- diagram: error-flow -->` marker and failure-detection -> rescue -> user-visible outcome flow." },
|
|
167
|
+
{ section: "State Machine Diagram", required: false, validationRule: "Deep: include `<!-- diagram: state-machine -->` marker and state transitions for critical flow lifecycle." },
|
|
168
|
+
{ section: "Rollback Flowchart", required: false, validationRule: "Deep: include `<!-- diagram: rollback-flowchart -->` marker with trigger -> rollback actions -> verification." },
|
|
169
|
+
{ section: "Deployment Sequence Diagram", required: false, validationRule: "Deep: include `<!-- diagram: deployment-sequence -->` marker with rollout order and guard checks." },
|
|
170
|
+
{ section: "Data Flow", required: false, validationRule: "Must include happy path, nil input, empty input, upstream error paths, plus Interaction Edge Case matrix rows for: double-click, nav-away-mid-request, 10K-result dataset, background-job abandonment, zombie connection. Each row must declare handled yes/no and deferred item when not handled." },
|
|
171
|
+
{ section: "Stale Diagram Audit", required: false, validationRule: "When `.cclaw/config.yaml::optInAudits.staleDiagramAudit` is true: blast-radius files from Codebase Investigation must not be newer than the current design diagram-marker baseline unless explicitly refreshed." },
|
|
159
172
|
{ section: "Failure Mode Table", required: true, validationRule: "Use Method/Exception/Rescue/UserSees columns and treat silent user impact without rescue as critical." },
|
|
160
|
-
{ section: "Security & Threat Model", required:
|
|
173
|
+
{ section: "Security & Threat Model", required: true, validationRule: "Must list trust boundaries, abuse/failure scenarios, mitigations, and residual risks." },
|
|
161
174
|
{ section: "Test Strategy", required: false, validationRule: "Must define unit/integration/e2e expectations with coverage targets." },
|
|
162
175
|
{ section: "Performance Budget", required: false, validationRule: "For each critical path: metric name, target threshold, and measurement method." },
|
|
176
|
+
{ section: "Observability & Debuggability", required: true, validationRule: "Must define logs/metrics/traces plus alerting/debug path for critical failure modes." },
|
|
177
|
+
{ section: "Deployment & Rollout", required: true, validationRule: "Must define migration/flag strategy, rollback plan, and post-deploy verification steps." },
|
|
163
178
|
{ section: "What Already Exists", required: false, validationRule: "For each sub-problem: existing code/library found (Layer 1-3/EUREKA label), reuse decision, and adaptation needed." },
|
|
179
|
+
{ section: "Outside Voice Findings", required: false, validationRule: "List adversarial findings and disposition (accept/reject/defer) with rationale per finding." },
|
|
180
|
+
{ section: "Spec Review Loop", required: false, validationRule: "Record iteration table (max 3) with quality score per iteration, stop reason, and unresolved concerns." },
|
|
164
181
|
{ section: "NOT in scope", required: false, validationRule: "Work considered and explicitly deferred with one-line rationale." },
|
|
165
182
|
{ section: "Parallelization Strategy", required: false, validationRule: "If multi-module: dependency table, parallel lanes, conflict flags." },
|
|
166
183
|
{ section: "Unresolved Decisions", required: false, validationRule: "If any: what info is missing, who provides it, default if unanswered." },
|
|
@@ -178,6 +195,12 @@ export const DESIGN = {
|
|
|
178
195
|
"What-already-exists section",
|
|
179
196
|
"design completion dashboard"
|
|
180
197
|
],
|
|
198
|
+
reviewLoop: {
|
|
199
|
+
stage: "design",
|
|
200
|
+
checklist: REVIEW_LOOP_CHECKLISTS.design.map((dimension) => dimension.id),
|
|
201
|
+
maxIterations: 3,
|
|
202
|
+
targetScore: 0.8
|
|
203
|
+
},
|
|
181
204
|
reviewSections: [
|
|
182
205
|
{
|
|
183
206
|
title: "Architecture Review",
|
|
@@ -70,10 +70,18 @@ export interface StageReviewLens {
|
|
|
70
70
|
outputs: string[];
|
|
71
71
|
reviewSections: ReviewSection[];
|
|
72
72
|
mandatoryDelegations: string[];
|
|
73
|
+
reviewLoop?: StageReviewLoop;
|
|
73
74
|
}
|
|
74
75
|
export interface StageReviewLensInput {
|
|
75
76
|
outputs: string[];
|
|
76
77
|
reviewSections: ReviewSection[];
|
|
78
|
+
reviewLoop?: StageReviewLoop;
|
|
79
|
+
}
|
|
80
|
+
export interface StageReviewLoop {
|
|
81
|
+
stage: "scope" | "design";
|
|
82
|
+
checklist: string[];
|
|
83
|
+
maxIterations: number;
|
|
84
|
+
targetScore: number;
|
|
77
85
|
}
|
|
78
86
|
export interface StageSchema {
|
|
79
87
|
schemaShape: "v2";
|
|
@@ -130,6 +138,8 @@ export interface StageSchema {
|
|
|
130
138
|
trivialOverrideSections?: string[];
|
|
131
139
|
/** Agent names that MUST be dispatched (or waived) before stage transition — derived from mandatory auto-subagent rows. */
|
|
132
140
|
mandatoryDelegations: string[];
|
|
141
|
+
/** Optional shared outside-voice loop config for scope/design stages. */
|
|
142
|
+
reviewLoop?: StageReviewLoop;
|
|
133
143
|
}
|
|
134
144
|
export type StageSchemaLegacyInput = Omit<StageSchema, "schemaShape" | "philosophy" | "executionModel" | "artifactRules" | "reviewLens" | "mandatoryDelegations" | "complexityTier"> & {
|
|
135
145
|
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"],
|
|
@@ -139,7 +144,7 @@ export const SCOPE = {
|
|
|
139
144
|
traceabilityRule: "Every scope boundary must be traceable to a brainstorm decision. Every downstream design choice must stay within the scope contract."
|
|
140
145
|
},
|
|
141
146
|
artifactValidation: [
|
|
142
|
-
{ section: "Pre-Scope System Audit", required: false, validationRule: "
|
|
147
|
+
{ 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
148
|
{ 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
149
|
{ section: "Premise Challenge", required: false, validationRule: "Must contain explicit answers to: right problem? direct path? what if nothing?" },
|
|
145
150
|
{ 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 +168,12 @@ export const SCOPE = {
|
|
|
163
168
|
},
|
|
164
169
|
reviewLens: {
|
|
165
170
|
outputs: ["scope mode decision", "scope contract", "discretion areas list", "deferred scope list", "scope summary", "scope completion dashboard"],
|
|
171
|
+
reviewLoop: {
|
|
172
|
+
stage: "scope",
|
|
173
|
+
checklist: REVIEW_LOOP_CHECKLISTS.scope.map((dimension) => dimension.id),
|
|
174
|
+
maxIterations: 3,
|
|
175
|
+
targetScore: 0.8
|
|
176
|
+
},
|
|
166
177
|
reviewSections: [
|
|
167
178
|
{
|
|
168
179
|
title: "Scope Boundary Audit",
|
|
@@ -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
|
|---|---|---|
|