cclaw-cli 0.4.0 → 0.5.1
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 +7 -7
- package/dist/constants.d.ts +2 -2
- package/dist/constants.js +6 -3
- package/dist/content/agents.d.ts +1 -1
- package/dist/content/agents.js +12 -16
- package/dist/content/examples.js +4 -3
- package/dist/content/hooks.js +4 -6
- package/dist/content/learnings.js +1 -1
- package/dist/content/meta-skill.js +21 -32
- package/dist/content/next-command.js +2 -2
- package/dist/content/observe.js +22 -8
- package/dist/content/session-hooks.js +1 -1
- package/dist/content/skills.js +13 -10
- package/dist/content/stage-schema.d.ts +1 -1
- package/dist/content/stage-schema.js +110 -179
- package/dist/content/start-command.d.ts +10 -0
- package/dist/content/start-command.js +109 -0
- package/dist/content/subagents.js +3 -3
- package/dist/content/templates.d.ts +2 -2
- package/dist/content/templates.js +22 -11
- package/dist/content/utility-skills.js +2 -2
- package/dist/doctor.js +10 -41
- package/dist/harness-adapters.js +13 -42
- package/dist/install.js +10 -10
- package/dist/policy.js +1 -10
- package/dist/runs.js +2 -14
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -2
- package/package.json +1 -1
- package/dist/content/autoplan.d.ts +0 -7
- package/dist/content/autoplan.js +0 -344
|
@@ -36,38 +36,44 @@ const BRAINSTORM = {
|
|
|
36
36
|
"The task is purely retrospective after ship with no new design decisions needed"
|
|
37
37
|
],
|
|
38
38
|
checklist: [
|
|
39
|
-
"Explore project context — check files, docs, recent commits, existing behavior.",
|
|
39
|
+
"Explore project context — check files, docs, recent commits, existing behavior. Summarize what you found (even for seemingly simple projects).",
|
|
40
40
|
"Assess scope — if the request describes multiple independent subsystems, flag for decomposition before detailed questions.",
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
41
|
+
"Restate the problem — before any questions, summarize what you understood the user wants and why. Ask the user to confirm or correct your understanding.",
|
|
42
|
+
"Ask clarifying questions — one at a time, understand purpose, constraints, success criteria, target users, and edge cases. Continue until you can confidently describe the solution space. Minimum: understand the WHY, WHO, WHAT, and boundary conditions.",
|
|
43
|
+
"Propose 2-3 approaches — with real trade-offs (not cosmetic differences) and your explicit recommendation with reasoning. Explain WHY you recommend this option over others.",
|
|
44
|
+
"Present design — in sections. After each section, explicitly state what you are asking the user to approve: 'Do you approve [specific thing]?' Never ask a bare 'одобряете?/approve?' without context.",
|
|
44
45
|
"Write design doc — save to `.cclaw/artifacts/01-brainstorm.md`.",
|
|
45
46
|
"Self-review — scan for placeholders, TBDs, contradictions, ambiguity, scope creep. Fix inline.",
|
|
46
|
-
"User reviews written artifact — ask user to review
|
|
47
|
+
"User reviews written artifact — ask user to review the written artifact (not the chat summary). **STOP.** Do NOT proceed until user responds.",
|
|
47
48
|
"Stage complete — update `flow-state.json` per the Stage Completion Protocol. Tell user to run `/cc-next` to continue to scope."
|
|
48
49
|
],
|
|
49
50
|
interactionProtocol: [
|
|
50
|
-
"Explore context first (files, docs, existing behavior).",
|
|
51
|
-
"
|
|
52
|
-
"
|
|
51
|
+
"Explore context first (files, docs, existing behavior). Share a brief summary of what you found.",
|
|
52
|
+
"Restate the problem in your own words. Ask user to confirm before proceeding to questions.",
|
|
53
|
+
"Ask one clarifying question per message. Do NOT combine questions. Continue until you understand purpose, constraints, users, success criteria, and edge cases.",
|
|
54
|
+
"For approach selection: use the Decision Protocol — present labeled options (A/B/C) with REAL trade-offs (not cosmetic) and mark one as (recommended) with clear reasoning. If AskQuestion/AskUserQuestion is available, send exactly ONE question per call, validate fields against runtime schema, and on schema error immediately fall back to plain-text question instead of retrying guessed payloads.",
|
|
55
|
+
"Every approval question MUST state what exactly is being approved: 'Do you approve [the architecture / the API shape / the dependency choice]?' Never ask a bare 'approve?' or 'looks good?'.",
|
|
53
56
|
"Get section-by-section approval before finalizing the design direction.",
|
|
54
57
|
"Run a self-review pass (ambiguity, placeholders, contradictions) before handoff.",
|
|
55
58
|
"**STOP.** Wait for explicit user approval after writing the artifact. Do NOT auto-advance to the next stage."
|
|
56
59
|
],
|
|
57
60
|
process: [
|
|
58
|
-
"
|
|
61
|
+
"Explore project context — files, docs, behavior, recent changes. Share findings.",
|
|
62
|
+
"Restate the problem — summarize what the user wants and why. Get confirmation.",
|
|
63
|
+
"Clarify iteratively — ask questions one at a time until you understand WHY, WHO, WHAT, success criteria, and boundaries.",
|
|
59
64
|
"Identify whether request should be decomposed into smaller sub-problems.",
|
|
60
|
-
"Offer alternatives and recommendation with rationale.",
|
|
61
|
-
"Present design in sections
|
|
62
|
-
"Write artifact
|
|
65
|
+
"Offer 2-3 alternatives with real trade-offs and recommendation with rationale.",
|
|
66
|
+
"Present design in sections. After each section explicitly name what you ask the user to approve.",
|
|
67
|
+
"Write artifact to `.cclaw/artifacts/01-brainstorm.md`.",
|
|
63
68
|
"Run self-review: placeholder scan, internal consistency, scope check, ambiguity check.",
|
|
64
|
-
"Ask user to review the written
|
|
69
|
+
"Ask user to review the written artifact. Wait for changes or approval.",
|
|
65
70
|
"Handoff to scope stage only after approval is explicit."
|
|
66
71
|
],
|
|
67
72
|
requiredGates: [
|
|
68
|
-
{ id: "brainstorm_context_explored", description: "Project context and constraints have been reviewed." },
|
|
69
|
-
{ id: "
|
|
70
|
-
{ id: "
|
|
73
|
+
{ id: "brainstorm_context_explored", description: "Project context and constraints have been reviewed and summarized." },
|
|
74
|
+
{ id: "brainstorm_problem_restated", description: "Problem was restated in agent's words and user confirmed the understanding." },
|
|
75
|
+
{ id: "brainstorm_options_compared", description: "At least two alternatives were compared with real trade-offs." },
|
|
76
|
+
{ id: "brainstorm_design_approved", description: "User approved a concrete design direction (with explicit statement of what was approved)." },
|
|
71
77
|
{ id: "brainstorm_self_review_passed", description: "Design doc passed placeholder/ambiguity/consistency checks." },
|
|
72
78
|
{ id: "brainstorm_user_reviewed_artifact", description: "User reviewed the written artifact and confirmed readiness." }
|
|
73
79
|
],
|
|
@@ -104,24 +110,32 @@ const BRAINSTORM = {
|
|
|
104
110
|
"Asking many questions in one message",
|
|
105
111
|
"Jumping directly into implementation",
|
|
106
112
|
"Combining visual companion offer with a clarifying question",
|
|
107
|
-
"Invoking implementation skills before writing plans"
|
|
113
|
+
"Invoking implementation skills before writing plans",
|
|
114
|
+
"Asking bare 'approve?' or 'одобряете?' without stating WHAT is being approved",
|
|
115
|
+
"Presenting a single summary and asking for blanket approval instead of section-by-section review",
|
|
116
|
+
"Rushing through clarification — asking 1-2 generic questions then jumping to design"
|
|
108
117
|
],
|
|
109
118
|
rationalizations: [
|
|
110
119
|
{ claim: "This is too simple for design.", reality: "Simple tasks fail fast when assumptions are wrong; a short design pass prevents rework." },
|
|
111
120
|
{ claim: "We can figure it out while coding.", reality: "Coding before alignment creates churn and hidden scope growth." },
|
|
112
121
|
{ claim: "There is only one obvious approach.", reality: "Without alternatives, trade-offs stay implicit and risk goes unexamined." },
|
|
113
|
-
{ claim: "The user already knows what they want.", reality: "Unstated assumptions diverge during implementation; explicit design surfaces them early." }
|
|
122
|
+
{ claim: "The user already knows what they want.", reality: "Unstated assumptions diverge during implementation; explicit design surfaces them early." },
|
|
123
|
+
{ claim: "This is straightforward, 1-2 questions are enough.", reality: "Even simple projects have hidden constraints (error handling, edge cases, deployment). A few extra questions now prevent rework later." }
|
|
114
124
|
],
|
|
115
125
|
redFlags: [
|
|
116
126
|
"No alternatives documented",
|
|
117
127
|
"No explicit approval checkpoint",
|
|
118
128
|
"Implementation-related actions before approval",
|
|
119
129
|
"Self-review skipped or glossed over",
|
|
120
|
-
"Artifact has TBD or placeholder sections"
|
|
130
|
+
"Artifact has TBD or placeholder sections",
|
|
131
|
+
"Fewer than 3 clarifying questions asked for any non-trivial project",
|
|
132
|
+
"Approval requested without stating what exactly is being approved"
|
|
121
133
|
],
|
|
122
134
|
policyNeedles: [
|
|
135
|
+
"Restate problem before questions",
|
|
123
136
|
"One clarifying question per message",
|
|
124
|
-
"2-3 approaches with trade-offs",
|
|
137
|
+
"2-3 approaches with real trade-offs",
|
|
138
|
+
"State what is being approved",
|
|
125
139
|
"Do NOT implement, scaffold, or modify behavior"
|
|
126
140
|
],
|
|
127
141
|
artifactFile: "01-brainstorm.md",
|
|
@@ -140,9 +154,11 @@ const BRAINSTORM = {
|
|
|
140
154
|
traceabilityRule: "Every approved direction must be traceable forward through scope and design. Downstream stages must reference brainstorm decisions."
|
|
141
155
|
},
|
|
142
156
|
artifactValidation: [
|
|
143
|
-
{ section: "Problem Statement", required: true, validationRule: "Must describe the user problem, not the solution." },
|
|
144
|
-
{ section: "
|
|
145
|
-
{ section: "
|
|
157
|
+
{ section: "Problem Statement", required: true, validationRule: "Must describe the user problem, not the solution. Include WHO and WHY." },
|
|
158
|
+
{ section: "Known Context", required: true, validationRule: "Files, patterns, constraints discovered during exploration. Evidence that context was actually explored." },
|
|
159
|
+
{ section: "Alternatives Table", required: true, validationRule: "At least 2 approaches with real trade-offs (not cosmetic) and recommendation with reasoning." },
|
|
160
|
+
{ section: "Approved Direction", required: true, validationRule: "Must contain explicit approval marker from user. State what was approved." },
|
|
161
|
+
{ section: "Assumptions & Risks", required: true, validationRule: "Explicit assumptions made during design. Known risks. If none, state 'None'." },
|
|
146
162
|
{ section: "Open Questions", required: true, validationRule: "If empty, state 'None' explicitly. Do not omit." }
|
|
147
163
|
],
|
|
148
164
|
namedAntiPattern: {
|
|
@@ -679,7 +695,7 @@ const PLAN = {
|
|
|
679
695
|
],
|
|
680
696
|
whenNotToUse: [
|
|
681
697
|
"Specification is unapproved or lacks measurable acceptance criteria",
|
|
682
|
-
"Execution is already in
|
|
698
|
+
"Execution is already in TDD stage with active slice evidence",
|
|
683
699
|
"The request is only release packaging with no task decomposition needed"
|
|
684
700
|
],
|
|
685
701
|
checklist: [
|
|
@@ -760,7 +776,7 @@ const PLAN = {
|
|
|
760
776
|
],
|
|
761
777
|
policyNeedles: ["WAIT_FOR_CONFIRM", "Task Graph", "Dependency Waves", "Acceptance Mapping", "verification steps"],
|
|
762
778
|
artifactFile: "05-plan.md",
|
|
763
|
-
next: "
|
|
779
|
+
next: "tdd",
|
|
764
780
|
cognitivePatterns: [
|
|
765
781
|
{ name: "Vertical Slice Thinking", description: "Each task delivers one thin end-to-end slice of value. Horizontal layers (all models, then all controllers) create integration risk. Vertical slices (one feature through all layers) reduce it." },
|
|
766
782
|
{ name: "Two-Minute Smell Test", description: "If a competent engineer cannot understand and start a task in two minutes, the task is too large or too vague. Break it down further." },
|
|
@@ -782,202 +798,124 @@ const PLAN = {
|
|
|
782
798
|
]
|
|
783
799
|
};
|
|
784
800
|
// ---------------------------------------------------------------------------
|
|
785
|
-
//
|
|
801
|
+
// TDD — RED → GREEN → REFACTOR cycle (merged test + build)
|
|
786
802
|
// ---------------------------------------------------------------------------
|
|
787
|
-
const
|
|
788
|
-
stage: "
|
|
789
|
-
skillFolder: "
|
|
790
|
-
skillName: "
|
|
791
|
-
skillDescription: "TDD RED
|
|
792
|
-
hardGate: "Do NOT
|
|
793
|
-
purpose: "
|
|
803
|
+
const TDD = {
|
|
804
|
+
stage: "tdd",
|
|
805
|
+
skillFolder: "test-driven-development",
|
|
806
|
+
skillName: "test-driven-development",
|
|
807
|
+
skillDescription: "Full TDD cycle: RED (failing tests), GREEN (minimal implementation), REFACTOR (cleanup). One plan slice at a time with strict traceability.",
|
|
808
|
+
hardGate: "Do NOT merge, ship, or skip review. Follow RED → GREEN → REFACTOR strictly for each plan slice. Do NOT write implementation code before RED tests exist. Do NOT skip the REFACTOR step.",
|
|
809
|
+
purpose: "Implement features through the TDD cycle: write failing tests, make them pass with minimal code, then refactor.",
|
|
794
810
|
whenToUse: [
|
|
795
811
|
"After plan confirmation",
|
|
796
|
-
"
|
|
797
|
-
"
|
|
812
|
+
"For every behavior change in scope",
|
|
813
|
+
"Before review stage"
|
|
798
814
|
],
|
|
799
815
|
whenNotToUse: [
|
|
800
816
|
"Plan approval is still pending WAIT_FOR_CONFIRM",
|
|
801
817
|
"The change is docs-only and does not alter behavior",
|
|
802
|
-
"
|
|
818
|
+
"The stage intent is review/ship sign-off rather than implementation"
|
|
803
819
|
],
|
|
804
820
|
checklist: [
|
|
805
821
|
"Select plan slice — pick one task from the plan. Do not batch multiple tasks.",
|
|
806
822
|
"Map to acceptance criterion — identify the specific spec criterion this test proves.",
|
|
807
|
-
"Write behavior-focused test — test the expected behavior, not implementation details.
|
|
808
|
-
"
|
|
809
|
-
"
|
|
823
|
+
"RED: Write behavior-focused test — test the expected behavior, not implementation details. Tests MUST fail.",
|
|
824
|
+
"RED: Capture failure output — copy the exact failure output as RED evidence. Record in artifact.",
|
|
825
|
+
"GREEN: Minimal implementation — write the smallest code change that makes the RED tests pass. No extra features.",
|
|
826
|
+
"GREEN: Run full suite — execute ALL tests, not just the ones you wrote. The full suite must be GREEN.",
|
|
827
|
+
"GREEN: Verify no regressions — if any existing test breaks, fix the regression before proceeding.",
|
|
828
|
+
"REFACTOR: Improve code quality — without changing behavior. Document what you changed and why.",
|
|
829
|
+
"Record evidence — capture RED failure, GREEN output, and REFACTOR notes in the TDD artifact.",
|
|
830
|
+
"Annotate traceability — link to plan task ID and spec criterion.",
|
|
810
831
|
"Repeat for each slice — return to step 1 for the next plan slice."
|
|
811
832
|
],
|
|
812
833
|
interactionProtocol: [
|
|
813
834
|
"Pick one planned slice at a time.",
|
|
814
|
-
"Write behavior-focused tests before changing implementation.",
|
|
835
|
+
"Write behavior-focused tests before changing implementation (RED).",
|
|
815
836
|
"Capture and store failing output as RED evidence.",
|
|
816
|
-
"
|
|
837
|
+
"Apply minimal change to satisfy RED tests (GREEN).",
|
|
838
|
+
"Run full suite, not partial checks, for GREEN validation.",
|
|
839
|
+
"Refactor without changing behavior and document rationale (REFACTOR).",
|
|
840
|
+
"Stop if regressions appear and fix before proceeding.",
|
|
817
841
|
"If a test passes unexpectedly, investigate: does the behavior already exist, or is the test wrong?"
|
|
818
842
|
],
|
|
819
843
|
process: [
|
|
820
844
|
"Select slice and map to acceptance criterion.",
|
|
821
|
-
"Write test(s) that fail for expected reason.",
|
|
845
|
+
"Write test(s) that fail for expected reason (RED).",
|
|
822
846
|
"Run tests and capture failure output.",
|
|
823
|
-
"Record RED evidence in TDD artifact.",
|
|
824
|
-
"Verify failure reason matches expected missing behavior."
|
|
825
|
-
],
|
|
826
|
-
requiredGates: [
|
|
827
|
-
{ id: "tdd_red_test_written", description: "Failing tests exist before implementation changes." },
|
|
828
|
-
{ id: "tdd_red_failure_captured", description: "Failure output is captured as evidence." },
|
|
829
|
-
{ id: "tdd_trace_to_acceptance", description: "RED tests trace to explicit acceptance criteria." },
|
|
830
|
-
{ id: "tdd_red_failure_reason_verified", description: "Failure is for the expected reason, not an unrelated error." }
|
|
831
|
-
],
|
|
832
|
-
requiredEvidence: [
|
|
833
|
-
"Artifact updated at `.cclaw/artifacts/06-tdd.md` RED section.",
|
|
834
|
-
"Failing command output captured.",
|
|
835
|
-
"Acceptance mapping documented.",
|
|
836
|
-
"Failure reason analysis recorded."
|
|
837
|
-
],
|
|
838
|
-
inputs: ["approved plan slice", "spec acceptance criterion", "test harness configuration"],
|
|
839
|
-
requiredContext: ["plan artifact", "spec artifact", "existing test patterns"],
|
|
840
|
-
outputs: ["failing test set", "captured RED evidence", "ready signal for GREEN stage"],
|
|
841
|
-
blockers: [
|
|
842
|
-
"tests pass before behavior change",
|
|
843
|
-
"failure reason does not match expected behavior",
|
|
844
|
-
"no evidence recorded"
|
|
845
|
-
],
|
|
846
|
-
exitCriteria: [
|
|
847
|
-
"RED evidence exists and is traceable",
|
|
848
|
-
"required gates marked satisfied",
|
|
849
|
-
"no implementation changes made in this stage",
|
|
850
|
-
"failure reason verified for each test"
|
|
851
|
-
],
|
|
852
|
-
antiPatterns: [
|
|
853
|
-
"Writing code before failing test",
|
|
854
|
-
"Asserting implementation details instead of behavior",
|
|
855
|
-
"Skipping evidence capture",
|
|
856
|
-
"Testing multiple slices without recording evidence for each"
|
|
857
|
-
],
|
|
858
|
-
rationalizations: [
|
|
859
|
-
{ claim: "This change is obvious, tests can be added later.", reality: "Without RED proof, regressions hide behind optimistic assumptions." },
|
|
860
|
-
{ claim: "A passing baseline is enough to continue.", reality: "Baseline pass does not prove new behavior requirements." },
|
|
861
|
-
{ claim: "One broad integration test is enough.", reality: "Slice-level RED tests are required for precise failure signal." }
|
|
862
|
-
],
|
|
863
|
-
redFlags: [
|
|
864
|
-
"No failing test output",
|
|
865
|
-
"No acceptance linkage",
|
|
866
|
-
"Implementation edits appear before RED evidence",
|
|
867
|
-
"Test passes without behavior change"
|
|
868
|
-
],
|
|
869
|
-
policyNeedles: ["RED", "failing test", "acceptance criteria", "no implementation changes"],
|
|
870
|
-
artifactFile: "06-tdd.md",
|
|
871
|
-
next: "build",
|
|
872
|
-
cognitivePatterns: [
|
|
873
|
-
{ name: "Behavior Over Implementation", description: "Tests describe WHAT the system does, not HOW. Test the observable behavior from outside the unit. If you need to test internals, the design needs work." },
|
|
874
|
-
{ name: "Failure-First Thinking", description: "The failing test IS the specification. Until you see the right failure, you do not understand what you are building. Wrong failures are information." },
|
|
875
|
-
{ name: "Proof Before Claim", description: "Do not claim a feature works without evidence. RED output is proof of what is missing. GREEN output is proof it was added. Both are required." }
|
|
876
|
-
],
|
|
877
|
-
reviewSections: [],
|
|
878
|
-
completionStatus: ["DONE", "DONE_WITH_CONCERNS", "BLOCKED"],
|
|
879
|
-
crossStageTrace: {
|
|
880
|
-
readsFrom: [".cclaw/artifacts/05-plan.md", ".cclaw/artifacts/04-spec.md"],
|
|
881
|
-
writesTo: [".cclaw/artifacts/06-tdd.md"],
|
|
882
|
-
traceabilityRule: "Every RED test traces to a plan task. Every plan task traces to a spec criterion. Evidence chain: spec -> plan -> RED test -> failure output."
|
|
883
|
-
},
|
|
884
|
-
artifactValidation: [
|
|
885
|
-
{ section: "RED Evidence", required: true, validationRule: "Failing test output captured per slice." },
|
|
886
|
-
{ section: "Acceptance Mapping", required: true, validationRule: "Each RED test links to a plan task and spec criterion." },
|
|
887
|
-
{ section: "Failure Analysis", required: true, validationRule: "Failure reason matches expected missing behavior." }
|
|
888
|
-
],
|
|
889
|
-
waveExecutionAllowed: true
|
|
890
|
-
};
|
|
891
|
-
// ---------------------------------------------------------------------------
|
|
892
|
-
// BUILD — TDD GREEN + REFACTOR stage
|
|
893
|
-
// ---------------------------------------------------------------------------
|
|
894
|
-
const BUILD = {
|
|
895
|
-
stage: "build",
|
|
896
|
-
skillFolder: "incremental-implementation",
|
|
897
|
-
skillName: "incremental-implementation",
|
|
898
|
-
skillDescription: "TDD GREEN and REFACTOR stage with strict traceability to plan slices.",
|
|
899
|
-
hardGate: "Do NOT merge, ship, or skip review. This stage produces GREEN and REFACTOR evidence for one plan slice at a time. If you are touching files unrelated to the current slice, STOP.",
|
|
900
|
-
purpose: "Implement minimal passing change, run full suite GREEN, then refactor safely.",
|
|
901
|
-
whenToUse: [
|
|
902
|
-
"After RED evidence is complete",
|
|
903
|
-
"For one accepted plan slice at a time",
|
|
904
|
-
"Before review stage"
|
|
905
|
-
],
|
|
906
|
-
whenNotToUse: [
|
|
907
|
-
"RED evidence is missing or failure reason is unverified",
|
|
908
|
-
"Multiple unrelated slices are being merged into one build pass",
|
|
909
|
-
"The stage intent is review/ship sign-off rather than implementation"
|
|
910
|
-
],
|
|
911
|
-
checklist: [
|
|
912
|
-
"Minimal GREEN change — implement the smallest code change that makes the RED tests pass. No extra features.",
|
|
913
|
-
"Run full suite — execute ALL tests, not just the ones you wrote. The full suite must be GREEN.",
|
|
914
|
-
"Verify no regressions — if any existing test breaks, fix the regression before proceeding.",
|
|
915
|
-
"Refactor pass — improve code quality without changing behavior. Document what you changed and why.",
|
|
916
|
-
"Record evidence — capture GREEN output and REFACTOR notes in the TDD artifact.",
|
|
917
|
-
"Annotate traceability — link the implementation to the plan task ID and spec criterion."
|
|
918
|
-
],
|
|
919
|
-
interactionProtocol: [
|
|
920
|
-
"Apply minimal change to satisfy RED tests.",
|
|
921
|
-
"Run full suite, not partial checks, for GREEN validation.",
|
|
922
|
-
"Refactor without changing behavior and document rationale.",
|
|
923
|
-
"Stop if regressions appear and return to prior step.",
|
|
924
|
-
"Record traceability to plan slice explicitly."
|
|
925
|
-
],
|
|
926
|
-
process: [
|
|
927
847
|
"Implement smallest change needed for GREEN.",
|
|
928
848
|
"Run full tests and build checks.",
|
|
929
849
|
"Perform refactor pass preserving behavior.",
|
|
930
|
-
"Record GREEN and REFACTOR evidence in artifact.",
|
|
850
|
+
"Record RED, GREEN, and REFACTOR evidence in artifact.",
|
|
931
851
|
"Annotate traceability to plan task and spec criterion."
|
|
932
852
|
],
|
|
933
853
|
requiredGates: [
|
|
934
|
-
{ id: "
|
|
854
|
+
{ id: "tdd_red_test_written", description: "Failing tests exist before implementation changes." },
|
|
855
|
+
{ id: "tdd_red_failure_captured", description: "Failure output is captured as evidence." },
|
|
856
|
+
{ id: "tdd_trace_to_acceptance", description: "RED tests trace to explicit acceptance criteria." },
|
|
857
|
+
{ id: "tdd_red_failure_reason_verified", description: "Failure is for the expected reason, not an unrelated error." },
|
|
935
858
|
{ id: "tdd_green_full_suite", description: "Full relevant suite passes in GREEN state." },
|
|
936
859
|
{ id: "tdd_refactor_completed", description: "Refactor pass completed with behavior preservation verified." },
|
|
937
860
|
{ id: "tdd_refactor_notes_written", description: "Refactor decisions and outcomes are documented." },
|
|
938
|
-
{ id: "
|
|
861
|
+
{ id: "tdd_traceable_to_plan", description: "Change traceability to plan slice is explicit." }
|
|
939
862
|
],
|
|
940
863
|
requiredEvidence: [
|
|
941
|
-
"Artifact `.cclaw/artifacts/06-tdd.md`
|
|
942
|
-
"
|
|
943
|
-
"
|
|
944
|
-
"
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
864
|
+
"Artifact updated at `.cclaw/artifacts/06-tdd.md` with RED, GREEN, and REFACTOR sections.",
|
|
865
|
+
"Failing command output captured (RED).",
|
|
866
|
+
"Full test/build output recorded (GREEN).",
|
|
867
|
+
"Acceptance mapping documented.",
|
|
868
|
+
"Failure reason analysis recorded.",
|
|
869
|
+
"Refactor rationale captured.",
|
|
870
|
+
"Traceability to task identifier is documented."
|
|
871
|
+
],
|
|
872
|
+
inputs: ["approved plan slice", "spec acceptance criterion", "test harness configuration", "coding standards and constraints"],
|
|
873
|
+
requiredContext: ["plan artifact", "spec artifact", "existing test patterns"],
|
|
874
|
+
outputs: ["failing test set", "passing implementation", "refactor evidence", "review-ready change set"],
|
|
949
875
|
blockers: [
|
|
950
|
-
"
|
|
876
|
+
"tests pass before behavior change (RED failure missing)",
|
|
951
877
|
"full suite not green",
|
|
952
|
-
"behavior changed during refactor"
|
|
878
|
+
"behavior changed during refactor",
|
|
879
|
+
"no evidence recorded"
|
|
953
880
|
],
|
|
954
881
|
exitCriteria: [
|
|
955
|
-
"
|
|
882
|
+
"RED evidence exists and is traceable",
|
|
883
|
+
"GREEN evidence captured with full suite pass",
|
|
956
884
|
"REFACTOR evidence captured",
|
|
957
885
|
"required gates marked satisfied",
|
|
958
886
|
"traceability annotated"
|
|
959
887
|
],
|
|
960
888
|
antiPatterns: [
|
|
889
|
+
"Writing code before failing test",
|
|
890
|
+
"Asserting implementation details instead of behavior",
|
|
961
891
|
"Big-bang implementation across multiple slices",
|
|
962
892
|
"Partial test runs presented as GREEN",
|
|
893
|
+
"Skipping evidence capture",
|
|
963
894
|
"Undocumented refactor changes",
|
|
964
895
|
"Adding features beyond what RED tests require"
|
|
965
896
|
],
|
|
966
897
|
rationalizations: [
|
|
898
|
+
{ claim: "This change is obvious, tests can be added later.", reality: "Without RED proof, regressions hide behind optimistic assumptions." },
|
|
899
|
+
{ claim: "A passing baseline is enough to continue.", reality: "Baseline pass does not prove new behavior requirements." },
|
|
900
|
+
{ claim: "One broad integration test is enough.", reality: "Slice-level RED tests are required for precise failure signal." },
|
|
967
901
|
{ claim: "Refactor can be skipped for speed.", reality: "Skipping refactor accumulates debt and weakens maintainability." },
|
|
968
902
|
{ claim: "Only changed tests need to pass.", reality: "Full-suite checks are needed to detect regressions." },
|
|
969
903
|
{ claim: "Traceability is implied by commit diff.", reality: "Explicit mapping avoids ambiguity in review and rollback." }
|
|
970
904
|
],
|
|
971
905
|
redFlags: [
|
|
906
|
+
"No failing test output (RED missing)",
|
|
907
|
+
"Implementation edits appear before RED evidence",
|
|
972
908
|
"No full-suite GREEN evidence",
|
|
973
909
|
"No refactor notes",
|
|
974
910
|
"Multiple tasks implemented in one pass without justification",
|
|
975
911
|
"Files changed outside current slice scope"
|
|
976
912
|
],
|
|
977
|
-
policyNeedles: ["GREEN", "full test suite", "
|
|
913
|
+
policyNeedles: ["RED", "GREEN", "REFACTOR", "failing test", "full test suite", "acceptance criteria", "traceable to plan slice"],
|
|
978
914
|
artifactFile: "06-tdd.md",
|
|
979
915
|
next: "review",
|
|
980
916
|
cognitivePatterns: [
|
|
917
|
+
{ name: "Behavior Over Implementation", description: "Tests describe WHAT the system does, not HOW. Test the observable behavior from outside the unit. If you need to test internals, the design needs work." },
|
|
918
|
+
{ name: "Failure-First Thinking", description: "The failing test IS the specification. Until you see the right failure, you do not understand what you are building. Wrong failures are information." },
|
|
981
919
|
{ name: "Minimal Viable Change", description: "The best implementation is the smallest one that passes all RED tests. Every extra line is risk. Resist the urge to 'improve while you are here.'" },
|
|
982
920
|
{ name: "Regression Paranoia", description: "Assume every change breaks something until the full suite proves otherwise. Partial test runs are lies of omission." },
|
|
983
921
|
{ name: "Refactor-as-Hygiene", description: "Refactoring is not optional cleanup — it is the third leg of TDD. GREEN without REFACTOR accumulates mess. REFACTOR without GREEN breaks things." }
|
|
@@ -985,11 +923,14 @@ const BUILD = {
|
|
|
985
923
|
reviewSections: [],
|
|
986
924
|
completionStatus: ["DONE", "DONE_WITH_CONCERNS", "BLOCKED"],
|
|
987
925
|
crossStageTrace: {
|
|
988
|
-
readsFrom: [".cclaw/artifacts/
|
|
926
|
+
readsFrom: [".cclaw/artifacts/05-plan.md", ".cclaw/artifacts/04-spec.md"],
|
|
989
927
|
writesTo: [".cclaw/artifacts/06-tdd.md"],
|
|
990
|
-
traceabilityRule: "Every GREEN change traces to a RED test. Every
|
|
928
|
+
traceabilityRule: "Every RED test traces to a plan task. Every GREEN change traces to a RED test. Every plan task traces to a spec criterion. Evidence chain must be unbroken."
|
|
991
929
|
},
|
|
992
930
|
artifactValidation: [
|
|
931
|
+
{ section: "RED Evidence", required: true, validationRule: "Failing test output captured per slice." },
|
|
932
|
+
{ section: "Acceptance Mapping", required: true, validationRule: "Each RED test links to a plan task and spec criterion." },
|
|
933
|
+
{ section: "Failure Analysis", required: true, validationRule: "Failure reason matches expected missing behavior." },
|
|
993
934
|
{ section: "GREEN Evidence", required: true, validationRule: "Full suite pass output captured." },
|
|
994
935
|
{ section: "REFACTOR Notes", required: true, validationRule: "What changed, why, behavior preservation confirmed." },
|
|
995
936
|
{ section: "Traceability", required: true, validationRule: "Plan task ID and spec criterion linked." }
|
|
@@ -1007,13 +948,13 @@ const REVIEW = {
|
|
|
1007
948
|
hardGate: "Do NOT ship, merge, or release until both review layers complete with an explicit verdict. No exceptions for urgency. Critical blockers MUST be resolved before handoff.",
|
|
1008
949
|
purpose: "Validate that implementation matches spec and meets quality/security/performance bar through structured two-layer review.",
|
|
1009
950
|
whenToUse: [
|
|
1010
|
-
"After
|
|
951
|
+
"After TDD stage completes",
|
|
1011
952
|
"Before any ship action",
|
|
1012
953
|
"When release risk must be assessed explicitly"
|
|
1013
954
|
],
|
|
1014
955
|
whenNotToUse: [
|
|
1015
956
|
"There is no implementation diff to review",
|
|
1016
|
-
"
|
|
957
|
+
"TDD stage evidence is missing or stale",
|
|
1017
958
|
"The goal is direct release execution without layered quality checks"
|
|
1018
959
|
],
|
|
1019
960
|
checklist: [
|
|
@@ -1364,8 +1305,7 @@ const STAGE_SCHEMA_MAP = {
|
|
|
1364
1305
|
design: DESIGN,
|
|
1365
1306
|
spec: SPEC,
|
|
1366
1307
|
plan: PLAN,
|
|
1367
|
-
|
|
1368
|
-
build: BUILD,
|
|
1308
|
+
tdd: TDD,
|
|
1369
1309
|
review: REVIEW,
|
|
1370
1310
|
ship: SHIP
|
|
1371
1311
|
};
|
|
@@ -1422,21 +1362,12 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
|
|
|
1422
1362
|
requiresUserGate: false
|
|
1423
1363
|
}
|
|
1424
1364
|
],
|
|
1425
|
-
|
|
1426
|
-
{
|
|
1427
|
-
agent: "test-author",
|
|
1428
|
-
mode: "mandatory",
|
|
1429
|
-
when: "Always during RED stage.",
|
|
1430
|
-
purpose: "Guarantee failing tests are created before implementation.",
|
|
1431
|
-
requiresUserGate: false
|
|
1432
|
-
}
|
|
1433
|
-
],
|
|
1434
|
-
build: [
|
|
1365
|
+
tdd: [
|
|
1435
1366
|
{
|
|
1436
1367
|
agent: "test-author",
|
|
1437
1368
|
mode: "mandatory",
|
|
1438
|
-
when: "Always during GREEN
|
|
1439
|
-
purpose: "
|
|
1369
|
+
when: "Always during TDD cycle (RED → GREEN → REFACTOR).",
|
|
1370
|
+
purpose: "Guarantee failing tests, traceable implementation, and full-suite verification.",
|
|
1440
1371
|
requiresUserGate: false
|
|
1441
1372
|
},
|
|
1442
1373
|
{
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Command contract for /cc — the unified entry point.
|
|
3
|
+
* No args → behaves like /cc-next (resume or start brainstorm).
|
|
4
|
+
* With prompt → starts brainstorm with the given idea.
|
|
5
|
+
*/
|
|
6
|
+
export declare function startCommandContract(): string;
|
|
7
|
+
/**
|
|
8
|
+
* Skill body for /cc — the unified entry point.
|
|
9
|
+
*/
|
|
10
|
+
export declare function startCommandSkillMarkdown(): string;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { RUNTIME_ROOT } from "../constants.js";
|
|
2
|
+
const START_SKILL_FOLDER = "flow-start";
|
|
3
|
+
const START_SKILL_NAME = "flow-start";
|
|
4
|
+
function flowStatePath() {
|
|
5
|
+
return `${RUNTIME_ROOT}/state/flow-state.json`;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Command contract for /cc — the unified entry point.
|
|
9
|
+
* No args → behaves like /cc-next (resume or start brainstorm).
|
|
10
|
+
* With prompt → starts brainstorm with the given idea.
|
|
11
|
+
*/
|
|
12
|
+
export function startCommandContract() {
|
|
13
|
+
const flowPath = flowStatePath();
|
|
14
|
+
return `# /cc
|
|
15
|
+
|
|
16
|
+
## Purpose
|
|
17
|
+
|
|
18
|
+
**The unified entry point for the cclaw flow.**
|
|
19
|
+
|
|
20
|
+
- \`/cc\` (no arguments) → behaves exactly like \`/cc-next\`: reads flow state and resumes the current stage, or starts brainstorm if the flow is fresh.
|
|
21
|
+
- \`/cc <prompt>\` (with an idea/description) → saves the prompt as brainstorm context and begins the brainstorm stage, regardless of current flow state.
|
|
22
|
+
|
|
23
|
+
This is the **recommended way to start** working with cclaw. Use \`/cc-next\` for subsequent stage progression.
|
|
24
|
+
|
|
25
|
+
## HARD-GATE
|
|
26
|
+
|
|
27
|
+
- **Do not** skip reading \`${flowPath}\` — always check current state before acting.
|
|
28
|
+
- **Do not** start implementation stages directly from \`/cc <prompt>\` — always begin at brainstorm.
|
|
29
|
+
|
|
30
|
+
## Algorithm
|
|
31
|
+
|
|
32
|
+
### With prompt (\`/cc <text>\`)
|
|
33
|
+
|
|
34
|
+
1. Read \`${flowPath}\`.
|
|
35
|
+
2. If flow already has completed stages beyond brainstorm, warn the user that starting a new brainstorm will reset progress. Ask for confirmation before proceeding.
|
|
36
|
+
3. Write the prompt to \`.cclaw/artifacts/00-idea.md\` as the raw idea capture.
|
|
37
|
+
4. Set \`currentStage: "brainstorm"\` in flow state (reset if needed).
|
|
38
|
+
5. Load \`.cclaw/skills/brainstorming/SKILL.md\` and \`.cclaw/commands/brainstorm.md\`.
|
|
39
|
+
6. Execute brainstorm with the prompt as initial context.
|
|
40
|
+
|
|
41
|
+
### Without prompt (\`/cc\`)
|
|
42
|
+
|
|
43
|
+
1. Read \`${flowPath}\`.
|
|
44
|
+
2. If flow state is missing → run \`cclaw init\` guidance and stop.
|
|
45
|
+
3. Behave exactly like \`/cc-next\`: check current stage gates, resume if incomplete, advance if complete.
|
|
46
|
+
|
|
47
|
+
## Primary skill
|
|
48
|
+
|
|
49
|
+
**${RUNTIME_ROOT}/skills/${START_SKILL_FOLDER}/SKILL.md**
|
|
50
|
+
`;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Skill body for /cc — the unified entry point.
|
|
54
|
+
*/
|
|
55
|
+
export function startCommandSkillMarkdown() {
|
|
56
|
+
const flowPath = flowStatePath();
|
|
57
|
+
return `---
|
|
58
|
+
name: ${START_SKILL_NAME}
|
|
59
|
+
description: "Unified entry point for the cclaw flow. No args = resume/next. With prompt = start brainstorm with idea."
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
# /cc — Flow Entry Point
|
|
63
|
+
|
|
64
|
+
## Overview
|
|
65
|
+
|
|
66
|
+
\`/cc\` is the **starting command** for cclaw. It intelligently routes:
|
|
67
|
+
|
|
68
|
+
- **No arguments** → acts as \`/cc-next\` (resume current stage or advance to next)
|
|
69
|
+
- **With a prompt** → captures the idea and starts brainstorm
|
|
70
|
+
|
|
71
|
+
## HARD-GATE
|
|
72
|
+
|
|
73
|
+
Do **not** silently discard an existing flow when the user provides a prompt. If completed stages exist, inform and confirm before resetting.
|
|
74
|
+
|
|
75
|
+
## Protocol
|
|
76
|
+
|
|
77
|
+
### Path A: \`/cc <prompt>\`
|
|
78
|
+
|
|
79
|
+
1. Read \`${flowPath}\`.
|
|
80
|
+
2. If \`completedStages\` is non-empty:
|
|
81
|
+
- Inform: "You have an active flow at stage **{currentStage}** with {N} completed stages. Starting a new brainstorm will reset progress."
|
|
82
|
+
- Ask: "Continue with reset? (A) Yes, start fresh (B) No, resume current flow"
|
|
83
|
+
- If (B) → switch to Path B behavior.
|
|
84
|
+
3. Write \`${RUNTIME_ROOT}/artifacts/00-idea.md\` with the user's prompt.
|
|
85
|
+
4. Update \`${flowPath}\`: set \`currentStage: "brainstorm"\`, clear \`completedStages\`, reset gate catalog.
|
|
86
|
+
5. Load and execute: \`${RUNTIME_ROOT}/skills/brainstorming/SKILL.md\` + \`${RUNTIME_ROOT}/commands/brainstorm.md\`.
|
|
87
|
+
|
|
88
|
+
### Path B: \`/cc\` (no arguments)
|
|
89
|
+
|
|
90
|
+
Delegate entirely to \`/cc-next\` behavior:
|
|
91
|
+
|
|
92
|
+
1. Read \`${flowPath}\`.
|
|
93
|
+
2. Check gates for \`currentStage\`.
|
|
94
|
+
3. If incomplete → load current stage skill and execute.
|
|
95
|
+
4. If complete → advance to next stage and execute.
|
|
96
|
+
5. If flow is done → report completion.
|
|
97
|
+
|
|
98
|
+
## When to use \`/cc\` vs \`/cc-next\`
|
|
99
|
+
|
|
100
|
+
| Scenario | Command |
|
|
101
|
+
|---|---|
|
|
102
|
+
| Starting work for the first time | \`/cc\` or \`/cc <idea>\` |
|
|
103
|
+
| Resuming in a new session | \`/cc\` |
|
|
104
|
+
| Progressing after completing a stage | \`/cc-next\` |
|
|
105
|
+
| Starting with a specific idea | \`/cc <idea>\` |
|
|
106
|
+
|
|
107
|
+
Both commands read the same \`flow-state.json\`. The difference is that \`/cc <prompt>\` always targets brainstorm, while \`/cc\` and \`/cc-next\` follow the state.
|
|
108
|
+
`;
|
|
109
|
+
}
|
|
@@ -34,7 +34,7 @@ This pattern is intentionally **Superpowers-style**: cheap parallelism where it
|
|
|
34
34
|
For cclaw flow stages, machine-only specialist work should auto-dispatch without waiting for a manual user request:
|
|
35
35
|
|
|
36
36
|
- **design/plan:** planner
|
|
37
|
-
- **
|
|
37
|
+
- **tdd:** test-author
|
|
38
38
|
- **review:** spec-reviewer + code-reviewer (security-reviewer when trust boundaries moved)
|
|
39
39
|
- **ship:** doc-updater
|
|
40
40
|
|
|
@@ -295,7 +295,7 @@ Implementation that touches shared source trees must remain **sequential** unles
|
|
|
295
295
|
- **3–4:** appendix / “worth tracking” section (not merge-blocking alone)
|
|
296
296
|
- **1–2:** suppress from primary narrative unless paired with stronger evidence
|
|
297
297
|
|
|
298
|
-
### Review Army Artifact Contract (required in /cc-
|
|
298
|
+
### Review Army Artifact Contract (required in review stage via /cc-next)
|
|
299
299
|
|
|
300
300
|
Write a structured reconciliation artifact at \`.cclaw/artifacts/07-review-army.json\` using this schema:
|
|
301
301
|
|
|
@@ -620,7 +620,7 @@ Status contract: DONE | DONE_WITH_CONCERNS | NEEDS_CONTEXT | BLOCKED.
|
|
|
620
620
|
- Controller sequentially dispatches **implementer → reviewer** loops per task.
|
|
621
621
|
- HARD-GATE: paste **self-contained task text**; never point subagents at plan files to “discover” scope.
|
|
622
622
|
- **Spec fixers** are **fresh agents** after failed spec reviews — avoids parent-context pollution.
|
|
623
|
-
- **Machine-only flow checks auto-dispatch** by stage (design/plan/
|
|
623
|
+
- **Machine-only flow checks auto-dispatch** by stage (design/plan/tdd/review/ship) without asking the user to trigger each specialist manually.
|
|
624
624
|
|
|
625
625
|
### Parallel Agents (\`dispatching-parallel-agents\` skill)
|
|
626
626
|
|