cclaw-cli 0.51.21 → 0.51.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -13
- package/dist/config.d.ts +8 -1
- package/dist/config.js +9 -6
- package/dist/content/examples.js +2 -2
- package/dist/content/hook-manifest.d.ts +2 -4
- package/dist/content/hook-manifest.js +5 -7
- package/dist/content/learnings.js +5 -2
- package/dist/content/meta-skill.d.ts +1 -0
- package/dist/content/meta-skill.js +16 -9
- package/dist/content/next-command.js +2 -2
- package/dist/content/node-hooks.js +14 -4
- package/dist/content/review-loop.js +15 -5
- package/dist/content/review-prompts.js +1 -1
- package/dist/content/skills.js +16 -11
- package/dist/content/stage-command.d.ts +2 -0
- package/dist/content/stage-command.js +17 -0
- package/dist/content/stage-schema.js +1 -0
- package/dist/content/stages/brainstorm.js +3 -3
- package/dist/content/stages/design.js +18 -17
- package/dist/content/stages/plan.js +2 -1
- package/dist/content/stages/review.js +15 -15
- package/dist/content/stages/scope.js +14 -14
- package/dist/content/stages/spec.js +7 -5
- package/dist/content/stages/tdd.js +11 -4
- package/dist/content/start-command.d.ts +4 -3
- package/dist/content/start-command.js +21 -17
- package/dist/content/subagents.js +14 -4
- package/dist/content/templates.d.ts +1 -1
- package/dist/content/templates.js +49 -29
- package/dist/content/track-render-context.js +7 -0
- package/dist/content/view-command.js +3 -1
- package/dist/delegation.d.ts +2 -2
- package/dist/delegation.js +40 -13
- package/dist/doctor-registry.js +1 -1
- package/dist/doctor.js +222 -34
- package/dist/gate-evidence.js +19 -7
- package/dist/harness-adapters.d.ts +14 -11
- package/dist/harness-adapters.js +154 -22
- package/dist/install.js +116 -28
- package/dist/internal/advance-stage.js +90 -11
- package/dist/knowledge-store.d.ts +4 -1
- package/dist/knowledge-store.js +24 -14
- package/dist/retro-gate.d.ts +1 -0
- package/dist/retro-gate.js +9 -9
- package/dist/run-archive.js +19 -1
- package/dist/run-persistence.js +6 -2
- package/dist/tdd-cycle.js +6 -3
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ import { decisionProtocolInstruction } from "../decision-protocol.js";
|
|
|
6
6
|
export const DESIGN = {
|
|
7
7
|
schemaShape: "v2",
|
|
8
8
|
stage: "design",
|
|
9
|
-
complexityTier: "
|
|
9
|
+
complexityTier: "standard",
|
|
10
10
|
skillFolder: "engineering-design-lock",
|
|
11
11
|
skillName: "engineering-design-lock",
|
|
12
12
|
skillDescription: "Engineering lock-in stage. Build a concrete technical spine before spec and planning, with section-by-section interactive review.",
|
|
@@ -42,7 +42,7 @@ export const DESIGN = {
|
|
|
42
42
|
checklist: [
|
|
43
43
|
"Compact design lock — for simple greenfield/product slices, produce a tight but complete design spine: codebase investigation, architecture boundary, one labeled diagram, data flow, failure/rescue table, test/perf expectations, and handoff. Do not run a sprawling workshop when a strong engineering lock fits on one page.",
|
|
44
44
|
"Trivial-Change Escape Hatch — for <=3 files, no new interfaces, and no cross-module data flow, produce a mini-design (rationale, changed files, one risk) and proceed to spec.",
|
|
45
|
-
"Tiered Research
|
|
45
|
+
"Tiered Research — for simple/medium work, do compact inline codebase/research synthesis in `Research Fleet Synthesis`; write `.cclaw/artifacts/02a-research.md` and run the full fleet only for deep/high-risk work or when external framework/architecture uncertainty exists.",
|
|
46
46
|
"Design Doc Check — read upstream artifacts and current design docs; latest superseding doc wins.",
|
|
47
47
|
"Investigator pass — before design decisions, read blast-radius code and record touched files, responsibilities, reuse candidates, and existing patterns.",
|
|
48
48
|
"Scope Challenge + Search Before Building — find existing solutions, minimum change set, and complexity smells before custom architecture.",
|
|
@@ -59,14 +59,14 @@ export const DESIGN = {
|
|
|
59
59
|
"If a section has no issues, say 'No issues found' and move on.",
|
|
60
60
|
"Do not skip failure-mode mapping; use Method/Exception/Rescue/UserSees and treat silent user impact without rescue as critical.",
|
|
61
61
|
"Take a firm position, push back on weak framing, and call out suboptimal architecture with concrete alternatives.",
|
|
62
|
-
"Classify ambiguity before acting
|
|
62
|
+
"Classify ambiguity before acting. Only non-critical preference/default assumptions may continue; STOP on uncertainty about scope, architecture, security, data loss, public API, migration, auth/pricing, or required user approval. Design hypotheses must name validation path, rollback trigger, and owner before they can be carried forward.",
|
|
63
63
|
"Before final approval, run the critic pass, reconcile material findings, and bound retries with the review-loop policy.",
|
|
64
64
|
"For baseline approval, present the full design plus exact spec handoff and **STOP** until explicit approval.",
|
|
65
65
|
"**STOP BEFORE ADVANCE.** Mandatory delegation `planner` must be completed or explicitly waived, then close via `node .cclaw/hooks/stage-complete.mjs design`."
|
|
66
66
|
],
|
|
67
67
|
process: [
|
|
68
68
|
"Read upstream artifacts and current design docs.",
|
|
69
|
-
"Run
|
|
69
|
+
"Run compact research by default; write `.cclaw/artifacts/02a-research.md` only when deep/high-risk uncertainty requires a separate research artifact.",
|
|
70
70
|
"Run investigator pass plus scope challenge/search-before-building.",
|
|
71
71
|
"Walk review sections interactively and lock boundaries, data flow, state transitions, edge cases, and failure modes.",
|
|
72
72
|
"Cover security, observability, deployment, tests, and performance for Standard+ changes.",
|
|
@@ -76,17 +76,17 @@ export const DESIGN = {
|
|
|
76
76
|
"Write design lock artifact for downstream spec/plan."
|
|
77
77
|
],
|
|
78
78
|
requiredGates: [
|
|
79
|
-
{ id: "design_research_complete", description: "
|
|
79
|
+
{ id: "design_research_complete", description: "Research is complete: compact inline synthesis by default, or a separate research artifact for deep/high-risk work, and findings are mapped to design decisions." },
|
|
80
80
|
{ id: "design_architecture_locked", description: "Architecture boundaries are explicit and approved." },
|
|
81
81
|
{ id: "design_data_flow_mapped", description: "Data/state flow includes edge-case paths." },
|
|
82
82
|
{ id: "design_failure_modes_mapped", description: "Failure modes and mitigations are documented." },
|
|
83
83
|
{ id: "design_test_and_perf_defined", description: "Test strategy and performance budget are defined." }
|
|
84
84
|
],
|
|
85
85
|
requiredEvidence: [
|
|
86
|
-
"Research
|
|
86
|
+
"Research Fleet Synthesis is filled in `03-design.md`; for deep/high-risk work, `.cclaw/artifacts/02a-research.md` is also written with stack/features/architecture/pitfalls sections plus synthesis.",
|
|
87
87
|
"Artifact written to `.cclaw/artifacts/03-design-<slug>.md`.",
|
|
88
88
|
"Failure-mode table exists in Method/Exception/Rescue/UserSees format.",
|
|
89
|
-
"Tier-required diagram markers are present: architecture (all tiers)
|
|
89
|
+
"Tier-required diagram markers are present: architecture (all tiers). Standard/Deep add-ons (shadow/error) and Deep add-ons (state-machine/rollback/deployment-sequence) are included only when risk warrants them.",
|
|
90
90
|
"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).",
|
|
91
91
|
"Security & threat model findings are documented with mitigations.",
|
|
92
92
|
"Observability and deployment plans are explicit for critical flows.",
|
|
@@ -101,7 +101,7 @@ export const DESIGN = {
|
|
|
101
101
|
],
|
|
102
102
|
inputs: ["scope agreement artifact", "system constraints", "non-functional requirements"],
|
|
103
103
|
requiredContext: [
|
|
104
|
-
"
|
|
104
|
+
"compact inline Research Fleet Synthesis, plus `.cclaw/artifacts/02a-research.md` only when deep/high-risk research was needed",
|
|
105
105
|
"existing architecture and boundaries",
|
|
106
106
|
"operational constraints",
|
|
107
107
|
"security and reliability expectations"
|
|
@@ -143,16 +143,16 @@ export const DESIGN = {
|
|
|
143
143
|
},
|
|
144
144
|
artifactValidation: [
|
|
145
145
|
{ section: "Upstream Handoff", required: false, validationRule: "Summarizes scope/research decisions, constraints, open questions, and explicit drift before design choices." },
|
|
146
|
-
{ section: "Research Fleet Synthesis", required: true, validationRule: "Must summarize the tiered lenses actually run
|
|
146
|
+
{ section: "Research Fleet Synthesis", required: true, validationRule: "Must summarize the tiered lenses actually run and map findings to concrete design decisions. Default may be compact inline synthesis; full separate research pack is Deep/high-risk only." },
|
|
147
147
|
{ section: "Codebase Investigation", required: false, validationRule: "Investigator pass: list blast-radius files with current responsibilities, discovered patterns, and reuse candidates." },
|
|
148
148
|
{ 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." },
|
|
149
149
|
{ section: "Architecture Boundaries", required: true, validationRule: "Must list component boundaries with ownership." },
|
|
150
150
|
{ 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." },
|
|
151
|
-
{ section: "Data-Flow Shadow Paths", required: false, validationRule: "Standard/Deep: include `<!-- diagram: data-flow-shadow-paths -->` marker plus a table for high-risk choices: chosen path, shadow alternative, switch trigger, fallback/degrade behavior, and verification evidence." },
|
|
152
|
-
{ section: "Error Flow Diagram", required: false, validationRule: "Standard/Deep: include `<!-- diagram: error-flow -->` marker and failure-detection -> rescue -> user-visible outcome flow." },
|
|
153
|
-
{ section: "State Machine Diagram", required: false, validationRule: "Deep: include `<!-- diagram: state-machine -->` marker and state transitions for critical flow lifecycle." },
|
|
154
|
-
{ section: "Rollback Flowchart", required: false, validationRule: "Deep: include `<!-- diagram: rollback-flowchart -->` marker with trigger -> rollback actions -> verification." },
|
|
155
|
-
{ section: "Deployment Sequence Diagram", required: false, validationRule: "Deep: include `<!-- diagram: deployment-sequence -->` marker with rollout order and guard checks." },
|
|
151
|
+
{ section: "Data-Flow Shadow Paths", required: false, validationRule: "Standard/Deep add-on: include `<!-- diagram: data-flow-shadow-paths -->` marker plus a table for high-risk choices: chosen path, shadow alternative, switch trigger, fallback/degrade behavior, and verification evidence." },
|
|
152
|
+
{ section: "Error Flow Diagram", required: false, validationRule: "Standard/Deep add-on: include `<!-- diagram: error-flow -->` marker and failure-detection -> rescue -> user-visible outcome flow." },
|
|
153
|
+
{ section: "State Machine Diagram", required: false, validationRule: "Deep add-on: include `<!-- diagram: state-machine -->` marker and state transitions for critical flow lifecycle." },
|
|
154
|
+
{ section: "Rollback Flowchart", required: false, validationRule: "Deep add-on: include `<!-- diagram: rollback-flowchart -->` marker with trigger -> rollback actions -> verification." },
|
|
155
|
+
{ section: "Deployment Sequence Diagram", required: false, validationRule: "Deep add-on: include `<!-- diagram: deployment-sequence -->` marker with rollout order and guard checks." },
|
|
156
156
|
{ 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." },
|
|
157
157
|
{ 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." },
|
|
158
158
|
{ section: "Failure Mode Table", required: true, validationRule: "Use Method/Exception/Rescue/UserSees columns and treat silent user impact without rescue as critical." },
|
|
@@ -163,10 +163,11 @@ export const DESIGN = {
|
|
|
163
163
|
{ section: "Deployment & Rollout", required: true, validationRule: "Must define migration/flag strategy, rollback plan, and post-deploy verification steps." },
|
|
164
164
|
{ 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." },
|
|
165
165
|
{ section: "Outside Voice Findings", required: false, validationRule: "Critic pass: list adversarial findings and disposition (accept/reject/defer) with rationale per material finding." },
|
|
166
|
-
{ section: "
|
|
166
|
+
{ section: "Design Outside Voice Loop", required: false, validationRule: `Record iteration table with quality score per iteration, stop reason, and unresolved concerns. Enforce ${reviewLoopPolicySummary("design")}` },
|
|
167
167
|
{ section: "NOT in scope", required: false, validationRule: "Work considered and explicitly deferred with one-line rationale." },
|
|
168
|
-
{ section: "Parallelization Strategy", required: false, validationRule: "
|
|
169
|
-
{ section: "
|
|
168
|
+
{ section: "Parallelization Strategy", required: false, validationRule: "Standard/Deep add-on when multi-module: dependency table, parallel lanes, conflict flags." },
|
|
169
|
+
{ section: "Interface Contracts", required: false, validationRule: "Standard/Deep add-on when module boundaries or APIs change: producers, consumers, and payload/interface expectations." },
|
|
170
|
+
{ section: "Unresolved Decisions", required: false, validationRule: "Standard/Deep add-on if any: what info is missing, who provides it, default if unanswered." },
|
|
170
171
|
{ section: "Completion Dashboard", required: true, validationRule: "Lists every review section with status (clear / issues-found-resolved / issues-open), critical/open gap counts, decision count, and unresolved items (or 'None')." }
|
|
171
172
|
],
|
|
172
173
|
trivialOverrideSections: ["Architecture Boundaries", "NOT in scope", "Completion Dashboard"]
|
|
@@ -49,7 +49,7 @@ export const PLAN = {
|
|
|
49
49
|
"Map scope Locked Decisions — every LD#hash anchor from scope is referenced by at least one plan task (or explicitly marked deferred with reason).",
|
|
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
|
-
"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.",
|
|
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
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-next`."
|
|
54
54
|
],
|
|
55
55
|
interactionProtocol: [
|
|
@@ -75,6 +75,7 @@ export const PLAN = {
|
|
|
75
75
|
{ id: "plan_tasks_sliced_2_5_min", description: "Tasks are small, executable slices." },
|
|
76
76
|
{ id: "plan_dependency_batches_defined", description: "Tasks are grouped into executable batches with gate checks and execution posture." },
|
|
77
77
|
{ id: "plan_acceptance_mapped", description: "Each task maps to a spec acceptance criterion." },
|
|
78
|
+
{ id: "plan_execution_posture_recorded", description: "Execution posture is recorded before implementation handoff." },
|
|
78
79
|
{ id: "plan_wait_for_confirm", description: "Execution blocked until explicit user confirmation." }
|
|
79
80
|
],
|
|
80
81
|
requiredEvidence: [
|
|
@@ -35,8 +35,8 @@ export const REVIEW = {
|
|
|
35
35
|
"Diff Scope — Run `git diff` against base branch. If no diff, exit early with APPROVED (no changes to review). Scope the review to changed files unless blast-radius analysis requires wider inspection.",
|
|
36
36
|
"Change-Size Check — ~100 lines = normal. ~300 lines = consider splitting. ~1000+ lines = strongly recommend stacked PRs. Flag large diffs to the user.",
|
|
37
37
|
"Risk-Based Second Opinion — compute changed-line count, files-touched count, and trust-boundary movement. Dispatch an adversarial reviewer only when trust boundaries changed, Critical/Important ambiguity remains, or the diff is both large and high-risk; otherwise record `not triggered`.",
|
|
38
|
-
"Load upstream evidence — read TDD artifact (RED + GREEN + REFACTOR), spec, and
|
|
39
|
-
"Run traceability matrix
|
|
38
|
+
"Load upstream evidence — read TDD artifact (RED + GREEN + REFACTOR), spec, and the active track's upstream source items.",
|
|
39
|
+
"Run traceability matrix when the active track enforces it; otherwise confirm spec acceptance/reproduction slices are covered directly.",
|
|
40
40
|
"Layer 1: Spec Compliance — check every acceptance criterion against implementation. Verdict: pass/fail per criterion.",
|
|
41
41
|
"Layer 2: Integrated findings — one structured pass tagged by category: correctness, security, performance, architecture, external-safety.",
|
|
42
42
|
"Security sweep — mandatory dedicated security-reviewer pass across diff + touched modules. A zero-finding pass must include `NO_CHANGE_ATTESTATION` with rationale.",
|
|
@@ -45,14 +45,14 @@ export const REVIEW = {
|
|
|
45
45
|
"Meta-Review — Were tests actually run? Do test names match what they test? Are there real assertions?",
|
|
46
46
|
"Classify findings — Critical (blocks ship), Important (should fix), Suggestion (optional improvement).",
|
|
47
47
|
"Produce verdict — APPROVED, APPROVED_WITH_CONCERNS, or BLOCKED.",
|
|
48
|
-
"If verdict is BLOCKED, emit remediation route token `ROUTE_BACK_TO_TDD
|
|
48
|
+
"If verdict is BLOCKED, emit remediation route token `ROUTE_BACK_TO_TDD`, include `cclaw internal rewind tdd \"review_blocked_by_critical\"` with the blocking finding IDs, and satisfy the special transition guard `review_verdict_blocked` instead of `review_criticals_resolved`."
|
|
49
49
|
],
|
|
50
50
|
interactionProtocol: [
|
|
51
51
|
"Run Layer 1 (spec compliance) completely before starting Layer 2.",
|
|
52
52
|
"In each review section, present findings ONE AT A TIME. Do NOT batch.",
|
|
53
53
|
"Classify every finding as Critical, Important, or Suggestion.",
|
|
54
54
|
decisionProtocolInstruction("each Critical finding", "present resolution options (A/B/C) with trade-offs, and mark one as (recommended)", "recommend the option that fully closes the finding with no carry-over risk and the smallest blast radius", STRUCTURED_ASK_TOOL_LIST_REVIEW),
|
|
55
|
-
"Resolve all critical blockers before ship.",
|
|
55
|
+
"Resolve all critical blockers before ship. If verdict is BLOCKED, do not pass `review_criticals_resolved`; pass only the remediation route gate `review_verdict_blocked` when routing back to TDD.",
|
|
56
56
|
"When verdict is BLOCKED, do not end with a passive stop: explicitly route remediation to TDD via `ROUTE_BACK_TO_TDD` and point to `cclaw internal rewind tdd` with the blocking IDs.",
|
|
57
57
|
structuredAskSingleChoiceInstruction("final verdict", "verdict (APPROVED / APPROVED_WITH_CONCERNS / BLOCKED)"),
|
|
58
58
|
"**STOP.** Do NOT proceed to ship until the user provides an explicit verdict."
|
|
@@ -70,22 +70,22 @@ export const REVIEW = {
|
|
|
70
70
|
{ id: "review_layer1_spec_compliance", description: "Spec compliance check completed with per-criterion verdict." },
|
|
71
71
|
{ id: "review_layer2_security", description: "Security review completed." },
|
|
72
72
|
{ id: "review_layer_coverage_complete", description: "Layer coverage map in 07-review-army.json confirms spec/correctness/security/performance/architecture/external-safety tags were considered." },
|
|
73
|
-
{ id: "review_criticals_resolved", description: "
|
|
73
|
+
{ id: "review_criticals_resolved", description: "Normal APPROVED or APPROVED_WITH_CONCERNS path only: no unresolved critical blockers remain. BLOCKED routes use review_verdict_blocked instead." },
|
|
74
74
|
{ id: "review_army_json_valid", description: "07-review-army.json passes schema validation (validateReviewArmy)." },
|
|
75
|
-
{ id: "review_trace_matrix_clean", description: "Trace matrix has no orphaned
|
|
75
|
+
{ id: "review_trace_matrix_clean", description: "Trace matrix has no orphaned source items or test slices for the active run, and evidence cites a discovered real test command before ship handoff." }
|
|
76
76
|
],
|
|
77
77
|
requiredEvidence: [
|
|
78
78
|
"Artifact written to `.cclaw/artifacts/07-review.md`.",
|
|
79
79
|
"Artifact written to `.cclaw/artifacts/07-review-army.json`.",
|
|
80
|
-
"Traceability matrix run recorded (no orphaned
|
|
80
|
+
"Traceability matrix run recorded (no orphaned source items or tests for enforced tracks).",
|
|
81
81
|
"Layer 1 verdict captured with per-criterion pass/fail.",
|
|
82
|
-
"Layer 2 sections completed
|
|
82
|
+
"Layer 2 sections completed across correctness, security, performance, architecture, and external-safety findings.",
|
|
83
83
|
"Severity log includes critical/important/suggestion buckets.",
|
|
84
84
|
"Explicit final verdict: APPROVED, APPROVED_WITH_CONCERNS, or BLOCKED.",
|
|
85
85
|
"Fresh verification command discovery recorded, and the command cited in `review_trace_matrix_clean` evidence before ship handoff.",
|
|
86
86
|
"If BLOCKED: include explicit remediation route (`ROUTE_BACK_TO_TDD`) with blocking finding IDs."
|
|
87
87
|
],
|
|
88
|
-
inputs: ["implementation diff", "
|
|
88
|
+
inputs: ["implementation diff", "upstream artifacts", "test/build evidence"],
|
|
89
89
|
requiredContext: ["spec criteria", "tdd artifact", "rulebook constraints"],
|
|
90
90
|
blockers: [
|
|
91
91
|
"layer 1 failed",
|
|
@@ -95,8 +95,8 @@ export const REVIEW = {
|
|
|
95
95
|
exitCriteria: [
|
|
96
96
|
"both layers completed",
|
|
97
97
|
"all review sections evaluated",
|
|
98
|
-
"critical blockers resolved",
|
|
99
|
-
"ship readiness explicitly stated"
|
|
98
|
+
"critical blockers resolved for APPROVED paths, or BLOCKED routes through review_verdict_blocked",
|
|
99
|
+
"ship readiness or remediation route explicitly stated"
|
|
100
100
|
],
|
|
101
101
|
platformNotes: [
|
|
102
102
|
"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.",
|
|
@@ -115,12 +115,12 @@ export const REVIEW = {
|
|
|
115
115
|
artifactValidation: [
|
|
116
116
|
{ section: "Upstream Handoff", required: false, validationRule: "Summarizes spec/plan/tdd decisions, constraints, open questions, and explicit drift before review verdicts." },
|
|
117
117
|
{ section: "Layer 1 Verdict", required: true, validationRule: "Per-criterion pass/fail with references." },
|
|
118
|
-
{ section: "Layer 2 Findings", required: false, validationRule: "Each finding has severity, description, and resolution status. Security coverage must include either explicit security findings or `NO_CHANGE_ATTESTATION: <reason>` when no security-relevant changes were found." },
|
|
118
|
+
{ section: "Layer 2 Findings", required: false, validationRule: "Each finding has severity, description, and resolution status across correctness, security, performance, architecture, and external-safety. Security coverage must include either explicit security findings or `NO_CHANGE_ATTESTATION: <reason>` when no security-relevant changes were found." },
|
|
119
119
|
{ section: "Review Findings Contract", required: true, validationRule: "Structured findings in 07-review-army.json include id/severity/confidence/fingerprint/reportedBy/status and source tags from {spec, correctness, security, performance, architecture, external-safety} with dedup reconciliation summary." },
|
|
120
120
|
{ section: "Review Readiness Snapshot", required: false, validationRule: "Optional compact summary: completed checks, delegation-log status, staleness signal, open critical blockers, and ship recommendation." },
|
|
121
|
-
{ section: "Completeness Snapshot", required: false, validationRule: "Optional compact coverage summary for AC coverage,
|
|
121
|
+
{ section: "Completeness Snapshot", required: false, validationRule: "Optional compact coverage summary for AC coverage, source item coverage, test-slice coverage, and adversarial-review status when triggered." },
|
|
122
122
|
{ section: "Incoming Feedback Queue", required: false, validationRule: "When external review feedback exists, include a queue summary with per-item disposition (resolved / accepted-risk / rejected-with-evidence) and evidence refs." },
|
|
123
|
-
{ section: "Trace Matrix Check", required: false, validationRule: "Records
|
|
123
|
+
{ section: "Trace Matrix Check", required: false, validationRule: "Records source-item/test orphan counts (all zero on enforced tracks) with command output reference." },
|
|
124
124
|
{ section: "Blocked Route", required: false, validationRule: "When Final Verdict is BLOCKED: includes `ROUTE_BACK_TO_TDD`, rewind target `tdd`, and blocked finding IDs." },
|
|
125
125
|
{ section: "Severity Summary", required: true, validationRule: "Per-severity count lines for critical, important, and suggestion buckets." },
|
|
126
126
|
{ section: "Final Verdict", required: true, validationRule: "Exactly one of: APPROVED, APPROVED_WITH_CONCERNS, BLOCKED." }
|
|
@@ -140,7 +140,7 @@ export const REVIEW = {
|
|
|
140
140
|
stopGate: true
|
|
141
141
|
},
|
|
142
142
|
{
|
|
143
|
-
title: "Layer 2: Integrated Correctness / Performance / Architecture",
|
|
143
|
+
title: "Layer 2: Integrated Correctness / Security / Performance / Architecture / External-Safety",
|
|
144
144
|
evaluationPoints: [
|
|
145
145
|
"Logic errors and boundary violations",
|
|
146
146
|
"Race conditions and concurrency issues",
|
|
@@ -45,13 +45,13 @@ export const SCOPE = {
|
|
|
45
45
|
},
|
|
46
46
|
executionModel: {
|
|
47
47
|
checklist: [
|
|
48
|
-
"**
|
|
48
|
+
"**Scope contract first** — read brainstorm, name the job-to-be-done, draft the explicit in-scope/out-of-scope/deferred contract, select one mode, and write the rationale. This is the default path; use dream/10-star/temporal/deep strategy sections only when risk, novelty, or user ambition justifies them.",
|
|
49
49
|
"**Premise and leverage check** — answer in the artifact: *Right problem? Direct path? What if nothing? Where can we leverage existing code? What is the reversibility cost?* Take a position; do not hedge.",
|
|
50
|
-
"**
|
|
50
|
+
"**Conditional 10-star boundary** — for deep/high-risk/product-strategy work, show what would make the product meaningfully better, then explicitly choose what ships now, what is deferred, and what is excluded without vague `later/for now` placeholders. Skip this for straightforward repair work and record `not needed: compact scope`.",
|
|
51
51
|
"**Pick one of four gstack modes with the user** — SCOPE EXPANSION, SELECTIVE EXPANSION, HOLD SCOPE, or SCOPE REDUCTION. Recommend one, state why and what signal would change it, then STOP for the user's mode/scope approval before writing the final artifact.",
|
|
52
|
-
"**Run mode-specific analysis** —
|
|
52
|
+
"**Run mode-specific analysis only to needed depth** — ordinary path is a selected-mode row plus rationale tied to the scope contract. For deep/high-risk work, expand the analysis to match the chosen mode: SCOPE EXPANSION enumerates 10x opportunities + delight features; SELECTIVE EXPANSION lists baseline + cherry-picked additions; HOLD SCOPE proves rigor on the current slice; SCOPE REDUCTION names the smallest useful wedge.",
|
|
53
53
|
"**Compare implementation alternatives** — include minimum viable, product-grade, and ideal architecture options with effort (S/M/L/XL), risk (Low/Med/High), pros, cons, and reuses. Recommend one and tie it to mode.",
|
|
54
|
-
"**Run outside voice before final approval** — for simple/low-risk scope, record one concise adversarial self-check row; for complex/high-risk/configured scope, iterate until threshold. Record the loop summary in `##
|
|
54
|
+
"**Run outside voice before final approval** — for simple/low-risk scope, record one concise adversarial self-check row; for complex/high-risk/configured scope, iterate until threshold. Record the loop summary in `## Scope Outside Voice Loop`, but do not treat it as user approval.",
|
|
55
55
|
"**Ask only one decision-changing question** — if the user rejects the contract but is unsure, offer 3-4 concrete scope moves instead of open-ended interrogation.",
|
|
56
56
|
"**Write the scope contract after approval** — include in-scope/out-of-scope, discretion areas, deferred items, locked decisions, error/rescue notes, completion dashboard, scope summary (with canonical mode token + next-stage handoff), and explicit approval evidence."
|
|
57
57
|
],
|
|
@@ -61,18 +61,18 @@ export const SCOPE = {
|
|
|
61
61
|
"For simple web-app flows, default to HOLD SCOPE or SELECTIVE EXPANSION, show the exact in/out/deferred contract as a proposal, and STOP for one explicit approval before writing the final scope artifact or completing the stage.",
|
|
62
62
|
"Challenge premise first, take a firm position, and name one concrete condition that would change it.",
|
|
63
63
|
"Push back on weak framing: vague scope needs a specific user/problem, platform vision needs a narrow wedge, social proof needs behavioral evidence.",
|
|
64
|
-
"Resolve one structural scope issue at a time;
|
|
64
|
+
"Resolve one structural scope issue at a time. Only non-critical preference/default assumptions may continue; STOP on uncertainty about scope boundary, architecture commitment, security, data loss, public API, migration, auth/pricing, or required user approval.",
|
|
65
65
|
"If the user says no but cannot name the change, offer concrete moves: keep scope, add one obvious adjacent capability, reduce to wedge, or re-open stack/product direction.",
|
|
66
|
-
`Before final approval, record outside-voice findings and a \`##
|
|
66
|
+
`Before final approval, record outside-voice findings and a \`## Scope Outside Voice Loop\` table using ${reviewLoopPolicySummary("scope")}`,
|
|
67
67
|
"**STOP.** Wait for explicit user approval of the scope mode and scope contract before writing final approval language or advancing.",
|
|
68
|
-
"**STOP BEFORE ADVANCE.** Mandatory delegation `planner` must be completed or explicitly waived. If
|
|
68
|
+
"**STOP BEFORE ADVANCE.** Mandatory delegation `planner` must be completed or explicitly waived for a real blocker. If the active harness cannot isolate a planner, run a role-switch planner pass instead: announce `## cclaw role-switch: scope/planner (mandatory)`, write the planner output/evidence into the scope artifact, and append a completed delegation row with `fulfillmentMode: \"role-switch\"` plus non-empty `evidenceRefs`. Then close with `node .cclaw/hooks/stage-complete.mjs scope --passed=scope_mode_selected,scope_contract_written,scope_user_approved --evidence-json '{\"scope_mode_selected\":\"<user-approved mode + rationale>\",\"scope_contract_written\":\"<artifact path + sections>\",\"scope_user_approved\":\"<explicit user approval quote or summary>\"}'`. `scope_user_approved` must cite the user's approval; review-loop evidence alone is not approval."
|
|
69
69
|
],
|
|
70
70
|
process: [
|
|
71
71
|
"Run configured pre-scope audit only when enabled.",
|
|
72
|
-
"Run the
|
|
72
|
+
"Run the scope pass scaled to risk: default to job-to-be-done plus explicit scope contract; add premise challenge, 10-star upside, smallest useful wedge, and change conditions only for deep/high-risk scope.",
|
|
73
73
|
"Compare minimum viable, product-grade, and ideal architecture scope alternatives with explicit reuse/effort/risk.",
|
|
74
74
|
"Recommend a scope mode with explicit rationale, then ask for user opt-in before treating it as selected.",
|
|
75
|
-
"Run outside voice / adversarial self-check before final approval and record a valid `##
|
|
75
|
+
"Run outside voice / adversarial self-check before final approval and record a valid `## Scope Outside Voice Loop` table.",
|
|
76
76
|
"Write explicit scope contract, discretion areas, deferred items, error/rescue registry, and D-XX locked decisions.",
|
|
77
77
|
"Produce scope summary, completion dashboard, and exact next-stage handoff before asking final approval."
|
|
78
78
|
],
|
|
@@ -90,7 +90,7 @@ export const SCOPE = {
|
|
|
90
90
|
"Locked Decisions section lists stable LD#hash anchors for non-negotiable boundaries.",
|
|
91
91
|
"Premise challenge findings documented.",
|
|
92
92
|
"Outside Voice findings and dispositions are recorded (accept/reject/defer with rationale) before final approval.",
|
|
93
|
-
`
|
|
93
|
+
`Scope outside-voice loop summary includes a table with columns Iteration, Quality Score, Findings, plus Stop reason, Target score, and Max iterations. This is outside-voice evidence only; it does not satisfy user approval. ${reviewLoopPolicySummary("scope")}`,
|
|
94
94
|
reviewLoopSecondOpinionSummary("scope"),
|
|
95
95
|
"Deferred items list with one-line rationale for each.",
|
|
96
96
|
"When an upside deferred idea is parked, a seed file is created under `.cclaw/seeds/` and referenced in the artifact.",
|
|
@@ -146,17 +146,17 @@ export const SCOPE = {
|
|
|
146
146
|
{ section: "Locked Decisions (LD#hash)", required: false, validationRule: "List of stable locked decisions with unique `LD#<sha8>` anchors. Each anchor is derived from the normalized Decision cell and is referenced downstream for cross-stage traceability." },
|
|
147
147
|
{ section: "Implementation Alternatives", required: false, validationRule: "2-3 options with Name, Summary, Effort, Risk, Pros, Cons, and Reuses. Must include minimal viable and ideal architecture options." },
|
|
148
148
|
{ section: "Scope Mode", required: true, validationRule: "Must state selected mode and rationale with default heuristic justification." },
|
|
149
|
-
{ section: "Mode-Specific Analysis", required: false, validationRule: "Deep/complex scope only: document the analysis matching the selected mode.
|
|
149
|
+
{ section: "Mode-Specific Analysis", required: false, validationRule: "Default path: one selected-mode row with rationale. Deep/complex scope only: document the expanded analysis matching the selected mode." },
|
|
150
150
|
{ section: "In Scope / Out of Scope", required: true, validationRule: "Two separate explicit lists. Canonical form is one `## In Scope / Out of Scope` section with `### In Scope` and `### Out of Scope`; legacy split `## In Scope` and `## Out of Scope` headings are accepted. Out-of-scope must not be empty." },
|
|
151
151
|
{ section: "Discretion Areas", required: false, validationRule: "Explicit list of implementer decision zones, or 'None' if scope is fully locked." },
|
|
152
152
|
{ section: "Deferred Items", required: false, validationRule: "Each item has one-line rationale. If empty, state 'None' explicitly." },
|
|
153
153
|
{ section: "Error & Rescue Registry", required: false, validationRule: "Each scoped capability has: failure mode, detection method, fallback decision." },
|
|
154
154
|
{ section: "Outside Voice Findings", required: false, validationRule: "Must list external/adversarial findings and disposition (accept/reject/defer) with rationale." },
|
|
155
|
-
{ section: "
|
|
155
|
+
{ section: "Scope Outside Voice Loop", required: false, validationRule: `Must record iterations, quality score per iteration, stop reason, and unresolved concerns. Enforce ${reviewLoopPolicySummary("scope")}` },
|
|
156
156
|
{ section: "Completion Dashboard", required: true, validationRule: "Lists per-review-section status, count of critical/open gaps, resolved decisions, and unresolved decisions (or 'None')." },
|
|
157
157
|
{ section: "Scope Summary", required: true, validationRule: "Compact recap of the locked scope. Must name the selected mode using one of the canonical tokens (`SCOPE EXPANSION`, `SELECTIVE EXPANSION`, `HOLD SCOPE`, `SCOPE REDUCTION`) and record the track-aware next-stage handoff (`design` for standard, `spec` for medium); the linter checks structure, not English wording." },
|
|
158
|
-
{ section: "Dream State Mapping", required: false, validationRule: "
|
|
159
|
-
{ section: "Temporal Interrogation", required: false, validationRule: "
|
|
158
|
+
{ section: "Dream State Mapping", required: false, validationRule: "Deep/optional only: CURRENT STATE, THIS PLAN, 12-MONTH IDEAL, and alignment verdict. Omit for compact scope." },
|
|
159
|
+
{ section: "Temporal Interrogation", required: false, validationRule: "Deep/optional only: timeline simulation table with decision pressures and lock-now vs defer verdicts. Omit for compact scope." }
|
|
160
160
|
]
|
|
161
161
|
},
|
|
162
162
|
reviewLens: {
|
|
@@ -36,10 +36,10 @@ export const SPEC = {
|
|
|
36
36
|
},
|
|
37
37
|
executionModel: {
|
|
38
38
|
checklist: [
|
|
39
|
-
"Read upstream —
|
|
39
|
+
"Read upstream — standard track loads design + scope; medium loads brainstorm/spec handoff; quick loads `00-idea.md` plus any reproduction context. Cross-reference only artifacts that exist on the active track.",
|
|
40
40
|
"Define measurable acceptance criteria — each criterion must be observable and falsifiable. No vague adjectives.",
|
|
41
41
|
"Capture edge cases — for each criterion, define at least one boundary condition and one error condition.",
|
|
42
|
-
"Document constraints and assumptions — regulatory, system, integration, and performance boundaries.
|
|
42
|
+
"Document constraints and assumptions — regulatory, system, integration, and performance boundaries. Only non-critical preference/default assumptions may continue; STOP on uncertainty about scope, architecture, security, data loss, public API, migration, auth/pricing, or required user approval.",
|
|
43
43
|
"Surface assumptions before finalization — list each assumption with source/confidence, validation path, and whether it is accepted, rejected, or still open.",
|
|
44
44
|
"Build the Acceptance Mapping contract — for each AC, map upstream design decision, observable evidence, verification method, and likely test level. If any column is unclear, rewrite the criterion.",
|
|
45
45
|
"Present acceptance criteria to the user in 3-5-item batches, pausing for explicit ACK between batches (see Interaction Protocol).",
|
|
@@ -53,7 +53,7 @@ export const SPEC = {
|
|
|
53
53
|
"**Chunk acceptance criteria for review.** When presenting the spec to the user for sign-off, deliver acceptance criteria in batches of 3-5 and **pause for explicit ACK** (via Decision Protocol) before sending the next batch. Do not dump the full criteria wall in one message — small batches surface objections earlier and keep the sign-off meaningful. Full spec writeup still lands in `04-spec.md`, but the conversation itself must be digestible.",
|
|
54
54
|
"Require user confirmation on the written spec. **STOP.** Do NOT proceed to plan until user approves.",
|
|
55
55
|
"For each criterion, ask: what exact evidence proves this passed? If the evidence or verification command/manual step is vague, rewrite.",
|
|
56
|
-
"When encountering ambiguity, classify it before acting: (A) ask user for missing info, (B) enumerate interpretations and pick one with justification, (C) propose hypothesis with validation path. Do NOT silently resolve ambiguity."
|
|
56
|
+
"When encountering ambiguity, classify it before acting: (A) ask user for missing info, (B) enumerate non-critical interpretations and pick one with justification, (C) propose hypothesis with validation path. Do NOT silently resolve ambiguity. STOP on scope, architecture, security, data loss, public API, migration, auth/pricing, or user-approval uncertainty."
|
|
57
57
|
],
|
|
58
58
|
process: [
|
|
59
59
|
"Define measurable acceptance criteria.",
|
|
@@ -75,7 +75,8 @@ export const SPEC = {
|
|
|
75
75
|
"Each acceptance criterion maps to upstream design decision, observable evidence, verification method, and likely test level.",
|
|
76
76
|
"Edge cases documented per criterion.",
|
|
77
77
|
"Assumptions Before Finalization section records source/confidence, validation path, and accepted/rejected/open disposition.",
|
|
78
|
-
"Approval marker captured in artifact."
|
|
78
|
+
"Approval marker captured in artifact.",
|
|
79
|
+
"For quick bug-fix specs, reproduction contract records symptom, repro steps, expected RED test, and acceptance criterion."
|
|
79
80
|
],
|
|
80
81
|
inputs: ["design artifact", "business constraints", "quality requirements"],
|
|
81
82
|
requiredContext: [
|
|
@@ -112,7 +113,8 @@ export const SPEC = {
|
|
|
112
113
|
},
|
|
113
114
|
artifactValidation: [
|
|
114
115
|
{ section: "Upstream Handoff", required: false, validationRule: "Summarizes scope/design decisions, constraints, open questions, and explicit drift before acceptance criteria." },
|
|
115
|
-
{ section: "Acceptance Criteria", required: true, validationRule: "Each criterion is observable, measurable, and falsifiable.
|
|
116
|
+
{ section: "Acceptance Criteria", required: true, validationRule: "Each criterion is observable, measurable, and falsifiable. Standard track should include Requirement Ref and Design Decision Ref columns; quick track may instead link each AC to the reproduction contract or bug slice. AC IDs (AC-1, AC-2…) are stable across revisions — dropped ACs stay with Priority `DROPPED`." },
|
|
117
|
+
{ section: "Quick Reproduction Contract", required: false, validationRule: "Quick bug-fix specs own the reproduction contract: symptom, repro steps, expected RED test behavior, and acceptance criterion." },
|
|
116
118
|
{ section: "Edge Cases", required: true, validationRule: "At least one boundary and one error condition per criterion." },
|
|
117
119
|
{ section: "Constraints and Assumptions", required: false, validationRule: "All implicit assumptions surfaced. Constraints have sources." },
|
|
118
120
|
{ section: "Assumptions Before Finalization", required: true, validationRule: "Each assumption has source/confidence, validation path, and accepted/rejected/open disposition before the Approval section is finalized." },
|
|
@@ -50,7 +50,7 @@ export const TDD = {
|
|
|
50
50
|
"Run verification-before-completion discipline for the slice — capture a fresh test command, commit SHA, and explicit PASS/FAIL status before completion claims.",
|
|
51
51
|
"REFACTOR: continue the `test-author` evidence cycle (or a dedicated refactor mode when available) to improve code quality without behavior changes. Set `CCLAW_ACTIVE_AGENT=tdd-refactor` when the harness supports phase labels.",
|
|
52
52
|
"Record evidence — capture test discovery, system-wide impact check, RED failure, GREEN output, and REFACTOR notes in the TDD artifact. When logging a `green` row, attach the closed acceptance-criterion IDs in `acIds` so Ralph Loop status counts them.",
|
|
53
|
-
"Annotate traceability — link to plan task ID
|
|
53
|
+
"Annotate traceability — link to the active track's source: plan task ID + spec criterion on standard/medium, or spec acceptance item / bug reproduction slice on quick.",
|
|
54
54
|
"Per-Slice Review (conditional) — if `.cclaw/config.yaml::sliceReview.enabled` is true and the slice meets any trigger (touchCount >= filesChangedThreshold, touchPaths match touchTriggers, or highRisk=true), append a `## Per-Slice Review` entry for this slice before moving on (see the dedicated section below).",
|
|
55
55
|
"Repeat for each slice — return to step 1 for the next plan slice."
|
|
56
56
|
],
|
|
@@ -241,7 +241,12 @@ function tddStageVariantForTrack(track) {
|
|
|
241
241
|
skillDescription: renderTrackTerminology(TDD.skillDescription, renderContext),
|
|
242
242
|
philosophy: {
|
|
243
243
|
...TDD.philosophy,
|
|
244
|
-
hardGate: renderTrackTerminology(TDD.philosophy.hardGate, renderContext)
|
|
244
|
+
hardGate: renderTrackTerminology(TDD.philosophy.hardGate, renderContext),
|
|
245
|
+
purpose: renderTrackTerminology(TDD.philosophy.purpose, renderContext),
|
|
246
|
+
whenToUse: TDD.philosophy.whenToUse.map((value) => renderTrackTerminology(value, renderContext)),
|
|
247
|
+
whenNotToUse: TDD.philosophy.whenNotToUse.map((value) => renderTrackTerminology(value, renderContext)),
|
|
248
|
+
commonRationalizations: TDD.philosophy.commonRationalizations
|
|
249
|
+
.map((value) => renderTrackTerminology(value, renderContext))
|
|
245
250
|
},
|
|
246
251
|
executionModel: {
|
|
247
252
|
...TDD.executionModel,
|
|
@@ -258,7 +263,9 @@ function tddStageVariantForTrack(track) {
|
|
|
258
263
|
requiredEvidence: TDD.executionModel.requiredEvidence
|
|
259
264
|
.map((value) => renderTrackTerminology(value, renderContext)),
|
|
260
265
|
inputs: TDD.executionModel.inputs.map((value) => renderTrackTerminology(value, renderContext)),
|
|
261
|
-
requiredContext: [renderContext.upstreamArtifactLabel, "existing test patterns", "affected contracts and state boundaries"]
|
|
266
|
+
requiredContext: [renderContext.upstreamArtifactLabel, "existing test patterns", "affected contracts and state boundaries"],
|
|
267
|
+
blockers: TDD.executionModel.blockers.map((value) => renderTrackTerminology(value, renderContext)),
|
|
268
|
+
exitCriteria: TDD.executionModel.exitCriteria.map((value) => renderTrackTerminology(value, renderContext))
|
|
262
269
|
},
|
|
263
270
|
reviewLens: {
|
|
264
271
|
...TDD.reviewLens,
|
|
@@ -286,7 +293,7 @@ function tddStageVariantForTrack(track) {
|
|
|
286
293
|
if (row.section === "Traceability") {
|
|
287
294
|
return {
|
|
288
295
|
...row,
|
|
289
|
-
validationRule: "
|
|
296
|
+
validationRule: "Spec acceptance item IDs and, for bug fixes, reproduction slice IDs are linked to RED/GREEN evidence."
|
|
290
297
|
};
|
|
291
298
|
}
|
|
292
299
|
return {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Command contract for /cc — the unified entry point.
|
|
3
|
-
* No args → behaves like /cc-next
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* No args → reads existing flow state and behaves like /cc-next only when a
|
|
4
|
+
* tracked flow already exists; missing state/fresh placeholder state blocks with
|
|
5
|
+
* init/start guidance. With prompt → classifies the idea, selects a track, and
|
|
6
|
+
* starts the first stage of that track (brainstorm for medium/standard, spec for quick).
|
|
6
7
|
*/
|
|
7
8
|
export declare function startCommandContract(): string;
|
|
8
9
|
/**
|
|
@@ -7,9 +7,10 @@ function flowStatePath() {
|
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* Command contract for /cc — the unified entry point.
|
|
10
|
-
* No args → behaves like /cc-next
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* No args → reads existing flow state and behaves like /cc-next only when a
|
|
11
|
+
* tracked flow already exists; missing state/fresh placeholder state blocks with
|
|
12
|
+
* init/start guidance. With prompt → classifies the idea, selects a track, and
|
|
13
|
+
* starts the first stage of that track (brainstorm for medium/standard, spec for quick).
|
|
13
14
|
*/
|
|
14
15
|
export function startCommandContract() {
|
|
15
16
|
const flowPath = flowStatePath();
|
|
@@ -19,7 +20,7 @@ export function startCommandContract() {
|
|
|
19
20
|
|
|
20
21
|
**The unified entry point for the cclaw flow.**
|
|
21
22
|
|
|
22
|
-
- \`/cc\` (no arguments) →
|
|
23
|
+
- \`/cc\` (no arguments) → reads existing flow state and resumes/progresses it through \`/cc-next\`. 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.
|
|
23
24
|
- \`/cc <prompt>\` (with an idea/description) → saves the prompt as idea context and starts the first stage of the resolved track.
|
|
24
25
|
|
|
25
26
|
This is the **recommended way to start** working with cclaw. Use \`/cc-next\` for subsequent stage progression.
|
|
@@ -41,8 +42,8 @@ ${conversationLanguagePolicyMarkdown()}
|
|
|
41
42
|
|---|---|---|
|
|
42
43
|
| **non-software** | legal text / docs / marketing copy / meeting notes / therapy-style conversation | Respond directly, do NOT open a stage, do NOT mutate flow state. |
|
|
43
44
|
| **pure-question** | "how does X work?", "explain Y", "what are the trade-offs of Z?" | Answer directly, do NOT open a stage. |
|
|
44
|
-
| **trivial** | typo, one-liner, rename, config tweak, copy change, version bump with zero behavior change | Fast-path:
|
|
45
|
-
| **software — bug fix with repro** | regression / hotfix / named symptom + repro steps | Fast-path: set track to \`quick\`,
|
|
45
|
+
| **trivial** | typo, one-liner, rename, config tweak, copy change, version bump with zero behavior change | Fast-path: set track to \`quick\`, seed \`00-idea.md\`, and enter \`spec\`. Runtime quick never starts at design. |
|
|
46
|
+
| **software — bug fix with repro** | regression / hotfix / named symptom + repro steps | Fast-path: set track to \`quick\`, enter \`spec\`, and capture a reproduction contract first. TDD later writes the RED reproduction test from that contract. |
|
|
46
47
|
| **software — medium** | additive feature following existing architecture | medium track (\`brainstorm → spec → plan → tdd → review → ship\`). |
|
|
47
48
|
| **software — standard** | feature, refactor, migration, integration, architecture change | Full 8-stage flow starting at \`brainstorm\`. |
|
|
48
49
|
|
|
@@ -92,7 +93,7 @@ ${conversationLanguagePolicyMarkdown()}
|
|
|
92
93
|
12. Load the **first-stage skill for the chosen track** and its command file:
|
|
93
94
|
- quick → \`.cclaw/skills/specification-authoring/SKILL.md\`
|
|
94
95
|
- medium/standard → \`.cclaw/skills/brainstorming/SKILL.md\`
|
|
95
|
-
- trivial fast-path → spec skill per Phase 0 decision.
|
|
96
|
+
- trivial fast-path → quick track spec skill per Phase 0 decision.
|
|
96
97
|
13. Execute that stage with the prompt + Phase 1/Phase 2 + seed context as initial input.
|
|
97
98
|
|
|
98
99
|
### Reclassification on discovery
|
|
@@ -107,8 +108,9 @@ If during any stage the agent discovers evidence that contradicts the initial Ph
|
|
|
107
108
|
### Without prompt (\`/cc\`)
|
|
108
109
|
|
|
109
110
|
1. Read \`${flowPath}\`.
|
|
110
|
-
2. If flow state is missing → run \`cclaw init\`
|
|
111
|
-
3.
|
|
111
|
+
2. If flow state is missing → guide the user to run \`cclaw init\` and stop.
|
|
112
|
+
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.
|
|
113
|
+
4. Otherwise behave exactly like \`/cc-next\`: check current stage gates, resume if incomplete, advance if complete.
|
|
112
114
|
|
|
113
115
|
## Headless mode
|
|
114
116
|
|
|
@@ -116,7 +118,7 @@ When called by another skill or subagent in machine mode, emit exactly one
|
|
|
116
118
|
JSON envelope (no prose) and stop:
|
|
117
119
|
|
|
118
120
|
\`\`\`json
|
|
119
|
-
{"version":"1","kind":"stage-output","stage":"
|
|
121
|
+
{"version":"1","kind":"stage-output","stage":"<currentStage>","payload":{"command":"/cc","track":"<track>","action":"start_or_resume"},"emittedAt":"<ISO-8601>"}
|
|
120
122
|
\`\`\`
|
|
121
123
|
|
|
122
124
|
Validate envelopes with:
|
|
@@ -147,7 +149,7 @@ description: "Unified entry point for the cclaw flow. No args = resume/next. Wit
|
|
|
147
149
|
|
|
148
150
|
\`/cc\` is the **starting command** for cclaw. It intelligently routes:
|
|
149
151
|
|
|
150
|
-
- **No arguments** → acts as \`/cc-next\`
|
|
152
|
+
- **No arguments** → acts as \`/cc-next\` only for an existing tracked flow; missing/fresh placeholder state blocks with start guidance
|
|
151
153
|
- **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\`)
|
|
152
154
|
|
|
153
155
|
## HARD-GATE
|
|
@@ -159,7 +161,7 @@ ${conversationLanguagePolicyMarkdown()}
|
|
|
159
161
|
|
|
160
162
|
### Path A: \`/cc <prompt>\`
|
|
161
163
|
|
|
162
|
-
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.
|
|
164
|
+
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. Bugfixes with a clear repro still start on quick \`spec\`: capture the reproduction contract first, then TDD writes the RED reproduction test from that contract.
|
|
163
165
|
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\`.
|
|
164
166
|
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.
|
|
165
167
|
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.
|
|
@@ -191,13 +193,15 @@ If mid-stage evidence contradicts the initial Class/Track decision (the "trivial
|
|
|
191
193
|
|
|
192
194
|
### Path B: \`/cc\` (no arguments)
|
|
193
195
|
|
|
194
|
-
Delegate
|
|
196
|
+
Delegate to \`/cc-next\` behavior only when a tracked flow exists:
|
|
195
197
|
|
|
196
198
|
1. Read \`${flowPath}\`.
|
|
197
|
-
2.
|
|
198
|
-
3. If
|
|
199
|
-
4.
|
|
200
|
-
5. If
|
|
199
|
+
2. If missing, guide the user to run \`cclaw init\` and stop.
|
|
200
|
+
3. If it is only a fresh init placeholder (\`completedStages: []\`, no passed gates, and no \`${RUNTIME_ROOT}/artifacts/00-idea.md\`), stop and ask for \`/cc <prompt>\` to start a tracked run. Do not silently create a brainstorm run.
|
|
201
|
+
4. Check gates for \`currentStage\`.
|
|
202
|
+
5. If incomplete → load current stage skill and execute.
|
|
203
|
+
6. If complete → advance to next stage and execute.
|
|
204
|
+
7. If flow is done → report completion.
|
|
201
205
|
|
|
202
206
|
## When to use \`/cc\` vs \`/cc-next\`
|
|
203
207
|
|
|
@@ -83,16 +83,26 @@ can enforce phase-appropriate write boundaries. Use separate workers only when t
|
|
|
83
83
|
|---|---|---|---|---|
|
|
84
84
|
| Claude | \`native\` | Task (named subagent_type) | AskUserQuestion | \`npx cclaw-cli doctor\` |
|
|
85
85
|
| Cursor | \`generic-dispatch\` | Task (generic subagent_type: explore/generalPurpose/…) | AskQuestion | \`npx cclaw-cli doctor\` |
|
|
86
|
-
| OpenCode | \`
|
|
87
|
-
| Codex | \`
|
|
86
|
+
| OpenCode | \`native\` | generated \`.opencode/agents/<agent>.md\` subagents via Task / \`@agent\` mention | \`question\` (permission-gated; \`permission.question: "allow"\`) | \`npx cclaw-cli doctor\` |
|
|
87
|
+
| Codex | \`native\` | generated \`.codex/agents/<agent>.toml\` custom agents via native parallel subagent spawning | \`request_user_input\` (experimental; Plan / Collaboration mode) | \`npx cclaw-cli doctor\` |
|
|
88
88
|
|
|
89
89
|
**Dispatch rules driven by \`subagentFallback\`:**
|
|
90
90
|
|
|
91
91
|
- \`native\` — use the harness's own named subagent primitive; delegation entry uses \`fulfillmentMode: "isolated"\`.
|
|
92
92
|
- \`generic-dispatch\` — map each cclaw agent onto the generic dispatcher with a role prompt; delegation entry uses \`fulfillmentMode: "generic-dispatch"\`.
|
|
93
|
-
- \`role-switch\` —
|
|
93
|
+
- \`role-switch\` — degraded fallback only when the active runtime cannot expose its declared dispatch surface. Announce the role in-session, perform the work, append a delegation row with \`fulfillmentMode: "role-switch"\` and ≥1 \`evidenceRef\`. Without evidenceRefs the \`delegation:mandatory:current_stage\` check reports \`missingEvidence\` and blocks stage completion.
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
### Native dispatch contract
|
|
96
|
+
|
|
97
|
+
Use real harness subagents for OpenCode and Codex:
|
|
98
|
+
|
|
99
|
+
1. OpenCode: invoke the generated \`.opencode/agents/<agent>.md\` subagent via Task or \`@<agent>\`. Built-in \`general\` / \`explore\` remain fallback subagent types for ad hoc tasks, but cclaw's core roles are generated by name.
|
|
100
|
+
2. Codex: ask Codex to spawn the generated \`.codex/agents/<agent>.toml\` custom agent(s) by name; for review-style independent lanes, request parallel spawning and wait for all results before reconciliation.
|
|
101
|
+
3. Claude: use the native named Task subagent. Cursor: map the cclaw role onto the generic Task/Subagent surface with a self-contained prompt.
|
|
102
|
+
4. Produce stage output in the current artifact, with anchors suitable for \`evidenceRefs\`.
|
|
103
|
+
5. Append delegation ledger rows with \`stage\`, \`agent\`, \`mode\`, \`status: "completed"\`, and \`fulfillmentMode\` matching the dispatch mode (\`"isolated"\` for Claude/OpenCode/Codex, \`"generic-dispatch"\` for Cursor).
|
|
104
|
+
|
|
105
|
+
The only time a \`harness_limitation\` waiver fires automatically is when every installed harness declares \`subagentFallback: "waiver"\`. Do not map Codex or OpenCode onto auto-waiver or default role-switch; they have true subagent surfaces.
|
|
96
106
|
|
|
97
107
|
### Model routing
|
|
98
108
|
|