cclaw-cli 0.4.0 → 0.5.0
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 +71 -156
- 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 +5 -5
- 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 -6
- package/dist/policy.js +1 -10
- 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
|
@@ -679,7 +679,7 @@ const PLAN = {
|
|
|
679
679
|
],
|
|
680
680
|
whenNotToUse: [
|
|
681
681
|
"Specification is unapproved or lacks measurable acceptance criteria",
|
|
682
|
-
"Execution is already in
|
|
682
|
+
"Execution is already in TDD stage with active slice evidence",
|
|
683
683
|
"The request is only release packaging with no task decomposition needed"
|
|
684
684
|
],
|
|
685
685
|
checklist: [
|
|
@@ -760,7 +760,7 @@ const PLAN = {
|
|
|
760
760
|
],
|
|
761
761
|
policyNeedles: ["WAIT_FOR_CONFIRM", "Task Graph", "Dependency Waves", "Acceptance Mapping", "verification steps"],
|
|
762
762
|
artifactFile: "05-plan.md",
|
|
763
|
-
next: "
|
|
763
|
+
next: "tdd",
|
|
764
764
|
cognitivePatterns: [
|
|
765
765
|
{ 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
766
|
{ 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 +782,124 @@ const PLAN = {
|
|
|
782
782
|
]
|
|
783
783
|
};
|
|
784
784
|
// ---------------------------------------------------------------------------
|
|
785
|
-
//
|
|
785
|
+
// TDD — RED → GREEN → REFACTOR cycle (merged test + build)
|
|
786
786
|
// ---------------------------------------------------------------------------
|
|
787
|
-
const
|
|
788
|
-
stage: "
|
|
789
|
-
skillFolder: "
|
|
790
|
-
skillName: "
|
|
791
|
-
skillDescription: "TDD RED
|
|
792
|
-
hardGate: "Do NOT
|
|
793
|
-
purpose: "
|
|
787
|
+
const TDD = {
|
|
788
|
+
stage: "tdd",
|
|
789
|
+
skillFolder: "test-driven-development",
|
|
790
|
+
skillName: "test-driven-development",
|
|
791
|
+
skillDescription: "Full TDD cycle: RED (failing tests), GREEN (minimal implementation), REFACTOR (cleanup). One plan slice at a time with strict traceability.",
|
|
792
|
+
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.",
|
|
793
|
+
purpose: "Implement features through the TDD cycle: write failing tests, make them pass with minimal code, then refactor.",
|
|
794
794
|
whenToUse: [
|
|
795
795
|
"After plan confirmation",
|
|
796
|
-
"
|
|
797
|
-
"
|
|
796
|
+
"For every behavior change in scope",
|
|
797
|
+
"Before review stage"
|
|
798
798
|
],
|
|
799
799
|
whenNotToUse: [
|
|
800
800
|
"Plan approval is still pending WAIT_FOR_CONFIRM",
|
|
801
801
|
"The change is docs-only and does not alter behavior",
|
|
802
|
-
"
|
|
802
|
+
"The stage intent is review/ship sign-off rather than implementation"
|
|
803
803
|
],
|
|
804
804
|
checklist: [
|
|
805
805
|
"Select plan slice — pick one task from the plan. Do not batch multiple tasks.",
|
|
806
806
|
"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
|
-
"
|
|
807
|
+
"RED: Write behavior-focused test — test the expected behavior, not implementation details. Tests MUST fail.",
|
|
808
|
+
"RED: Capture failure output — copy the exact failure output as RED evidence. Record in artifact.",
|
|
809
|
+
"GREEN: Minimal implementation — write the smallest code change that makes the RED tests pass. No extra features.",
|
|
810
|
+
"GREEN: Run full suite — execute ALL tests, not just the ones you wrote. The full suite must be GREEN.",
|
|
811
|
+
"GREEN: Verify no regressions — if any existing test breaks, fix the regression before proceeding.",
|
|
812
|
+
"REFACTOR: Improve code quality — without changing behavior. Document what you changed and why.",
|
|
813
|
+
"Record evidence — capture RED failure, GREEN output, and REFACTOR notes in the TDD artifact.",
|
|
814
|
+
"Annotate traceability — link to plan task ID and spec criterion.",
|
|
810
815
|
"Repeat for each slice — return to step 1 for the next plan slice."
|
|
811
816
|
],
|
|
812
817
|
interactionProtocol: [
|
|
813
818
|
"Pick one planned slice at a time.",
|
|
814
|
-
"Write behavior-focused tests before changing implementation.",
|
|
819
|
+
"Write behavior-focused tests before changing implementation (RED).",
|
|
815
820
|
"Capture and store failing output as RED evidence.",
|
|
816
|
-
"
|
|
821
|
+
"Apply minimal change to satisfy RED tests (GREEN).",
|
|
822
|
+
"Run full suite, not partial checks, for GREEN validation.",
|
|
823
|
+
"Refactor without changing behavior and document rationale (REFACTOR).",
|
|
824
|
+
"Stop if regressions appear and fix before proceeding.",
|
|
817
825
|
"If a test passes unexpectedly, investigate: does the behavior already exist, or is the test wrong?"
|
|
818
826
|
],
|
|
819
827
|
process: [
|
|
820
828
|
"Select slice and map to acceptance criterion.",
|
|
821
|
-
"Write test(s) that fail for expected reason.",
|
|
829
|
+
"Write test(s) that fail for expected reason (RED).",
|
|
822
830
|
"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
831
|
"Implement smallest change needed for GREEN.",
|
|
928
832
|
"Run full tests and build checks.",
|
|
929
833
|
"Perform refactor pass preserving behavior.",
|
|
930
|
-
"Record GREEN and REFACTOR evidence in artifact.",
|
|
834
|
+
"Record RED, GREEN, and REFACTOR evidence in artifact.",
|
|
931
835
|
"Annotate traceability to plan task and spec criterion."
|
|
932
836
|
],
|
|
933
837
|
requiredGates: [
|
|
934
|
-
{ id: "
|
|
838
|
+
{ id: "tdd_red_test_written", description: "Failing tests exist before implementation changes." },
|
|
839
|
+
{ id: "tdd_red_failure_captured", description: "Failure output is captured as evidence." },
|
|
840
|
+
{ id: "tdd_trace_to_acceptance", description: "RED tests trace to explicit acceptance criteria." },
|
|
841
|
+
{ id: "tdd_red_failure_reason_verified", description: "Failure is for the expected reason, not an unrelated error." },
|
|
935
842
|
{ id: "tdd_green_full_suite", description: "Full relevant suite passes in GREEN state." },
|
|
936
843
|
{ id: "tdd_refactor_completed", description: "Refactor pass completed with behavior preservation verified." },
|
|
937
844
|
{ id: "tdd_refactor_notes_written", description: "Refactor decisions and outcomes are documented." },
|
|
938
|
-
{ id: "
|
|
845
|
+
{ id: "tdd_traceable_to_plan", description: "Change traceability to plan slice is explicit." }
|
|
939
846
|
],
|
|
940
847
|
requiredEvidence: [
|
|
941
|
-
"Artifact `.cclaw/artifacts/06-tdd.md`
|
|
942
|
-
"
|
|
943
|
-
"
|
|
944
|
-
"
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
848
|
+
"Artifact updated at `.cclaw/artifacts/06-tdd.md` with RED, GREEN, and REFACTOR sections.",
|
|
849
|
+
"Failing command output captured (RED).",
|
|
850
|
+
"Full test/build output recorded (GREEN).",
|
|
851
|
+
"Acceptance mapping documented.",
|
|
852
|
+
"Failure reason analysis recorded.",
|
|
853
|
+
"Refactor rationale captured.",
|
|
854
|
+
"Traceability to task identifier is documented."
|
|
855
|
+
],
|
|
856
|
+
inputs: ["approved plan slice", "spec acceptance criterion", "test harness configuration", "coding standards and constraints"],
|
|
857
|
+
requiredContext: ["plan artifact", "spec artifact", "existing test patterns"],
|
|
858
|
+
outputs: ["failing test set", "passing implementation", "refactor evidence", "review-ready change set"],
|
|
949
859
|
blockers: [
|
|
950
|
-
"
|
|
860
|
+
"tests pass before behavior change (RED failure missing)",
|
|
951
861
|
"full suite not green",
|
|
952
|
-
"behavior changed during refactor"
|
|
862
|
+
"behavior changed during refactor",
|
|
863
|
+
"no evidence recorded"
|
|
953
864
|
],
|
|
954
865
|
exitCriteria: [
|
|
955
|
-
"
|
|
866
|
+
"RED evidence exists and is traceable",
|
|
867
|
+
"GREEN evidence captured with full suite pass",
|
|
956
868
|
"REFACTOR evidence captured",
|
|
957
869
|
"required gates marked satisfied",
|
|
958
870
|
"traceability annotated"
|
|
959
871
|
],
|
|
960
872
|
antiPatterns: [
|
|
873
|
+
"Writing code before failing test",
|
|
874
|
+
"Asserting implementation details instead of behavior",
|
|
961
875
|
"Big-bang implementation across multiple slices",
|
|
962
876
|
"Partial test runs presented as GREEN",
|
|
877
|
+
"Skipping evidence capture",
|
|
963
878
|
"Undocumented refactor changes",
|
|
964
879
|
"Adding features beyond what RED tests require"
|
|
965
880
|
],
|
|
966
881
|
rationalizations: [
|
|
882
|
+
{ claim: "This change is obvious, tests can be added later.", reality: "Without RED proof, regressions hide behind optimistic assumptions." },
|
|
883
|
+
{ claim: "A passing baseline is enough to continue.", reality: "Baseline pass does not prove new behavior requirements." },
|
|
884
|
+
{ claim: "One broad integration test is enough.", reality: "Slice-level RED tests are required for precise failure signal." },
|
|
967
885
|
{ claim: "Refactor can be skipped for speed.", reality: "Skipping refactor accumulates debt and weakens maintainability." },
|
|
968
886
|
{ claim: "Only changed tests need to pass.", reality: "Full-suite checks are needed to detect regressions." },
|
|
969
887
|
{ claim: "Traceability is implied by commit diff.", reality: "Explicit mapping avoids ambiguity in review and rollback." }
|
|
970
888
|
],
|
|
971
889
|
redFlags: [
|
|
890
|
+
"No failing test output (RED missing)",
|
|
891
|
+
"Implementation edits appear before RED evidence",
|
|
972
892
|
"No full-suite GREEN evidence",
|
|
973
893
|
"No refactor notes",
|
|
974
894
|
"Multiple tasks implemented in one pass without justification",
|
|
975
895
|
"Files changed outside current slice scope"
|
|
976
896
|
],
|
|
977
|
-
policyNeedles: ["GREEN", "full test suite", "
|
|
897
|
+
policyNeedles: ["RED", "GREEN", "REFACTOR", "failing test", "full test suite", "acceptance criteria", "traceable to plan slice"],
|
|
978
898
|
artifactFile: "06-tdd.md",
|
|
979
899
|
next: "review",
|
|
980
900
|
cognitivePatterns: [
|
|
901
|
+
{ 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." },
|
|
902
|
+
{ 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
903
|
{ 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
904
|
{ name: "Regression Paranoia", description: "Assume every change breaks something until the full suite proves otherwise. Partial test runs are lies of omission." },
|
|
983
905
|
{ 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 +907,14 @@ const BUILD = {
|
|
|
985
907
|
reviewSections: [],
|
|
986
908
|
completionStatus: ["DONE", "DONE_WITH_CONCERNS", "BLOCKED"],
|
|
987
909
|
crossStageTrace: {
|
|
988
|
-
readsFrom: [".cclaw/artifacts/
|
|
910
|
+
readsFrom: [".cclaw/artifacts/05-plan.md", ".cclaw/artifacts/04-spec.md"],
|
|
989
911
|
writesTo: [".cclaw/artifacts/06-tdd.md"],
|
|
990
|
-
traceabilityRule: "Every GREEN change traces to a RED test. Every
|
|
912
|
+
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
913
|
},
|
|
992
914
|
artifactValidation: [
|
|
915
|
+
{ section: "RED Evidence", required: true, validationRule: "Failing test output captured per slice." },
|
|
916
|
+
{ section: "Acceptance Mapping", required: true, validationRule: "Each RED test links to a plan task and spec criterion." },
|
|
917
|
+
{ section: "Failure Analysis", required: true, validationRule: "Failure reason matches expected missing behavior." },
|
|
993
918
|
{ section: "GREEN Evidence", required: true, validationRule: "Full suite pass output captured." },
|
|
994
919
|
{ section: "REFACTOR Notes", required: true, validationRule: "What changed, why, behavior preservation confirmed." },
|
|
995
920
|
{ section: "Traceability", required: true, validationRule: "Plan task ID and spec criterion linked." }
|
|
@@ -1007,13 +932,13 @@ const REVIEW = {
|
|
|
1007
932
|
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
933
|
purpose: "Validate that implementation matches spec and meets quality/security/performance bar through structured two-layer review.",
|
|
1009
934
|
whenToUse: [
|
|
1010
|
-
"After
|
|
935
|
+
"After TDD stage completes",
|
|
1011
936
|
"Before any ship action",
|
|
1012
937
|
"When release risk must be assessed explicitly"
|
|
1013
938
|
],
|
|
1014
939
|
whenNotToUse: [
|
|
1015
940
|
"There is no implementation diff to review",
|
|
1016
|
-
"
|
|
941
|
+
"TDD stage evidence is missing or stale",
|
|
1017
942
|
"The goal is direct release execution without layered quality checks"
|
|
1018
943
|
],
|
|
1019
944
|
checklist: [
|
|
@@ -1364,8 +1289,7 @@ const STAGE_SCHEMA_MAP = {
|
|
|
1364
1289
|
design: DESIGN,
|
|
1365
1290
|
spec: SPEC,
|
|
1366
1291
|
plan: PLAN,
|
|
1367
|
-
|
|
1368
|
-
build: BUILD,
|
|
1292
|
+
tdd: TDD,
|
|
1369
1293
|
review: REVIEW,
|
|
1370
1294
|
ship: SHIP
|
|
1371
1295
|
};
|
|
@@ -1422,21 +1346,12 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
|
|
|
1422
1346
|
requiresUserGate: false
|
|
1423
1347
|
}
|
|
1424
1348
|
],
|
|
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: [
|
|
1349
|
+
tdd: [
|
|
1435
1350
|
{
|
|
1436
1351
|
agent: "test-author",
|
|
1437
1352
|
mode: "mandatory",
|
|
1438
|
-
when: "Always during GREEN
|
|
1439
|
-
purpose: "
|
|
1353
|
+
when: "Always during TDD cycle (RED → GREEN → REFACTOR).",
|
|
1354
|
+
purpose: "Guarantee failing tests, traceable implementation, and full-suite verification.",
|
|
1440
1355
|
requiresUserGate: false
|
|
1441
1356
|
},
|
|
1442
1357
|
{
|
|
@@ -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
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const ARTIFACT_TEMPLATES: Record<string, string>;
|
|
2
|
-
export declare const RULEBOOK_MARKDOWN = "# Cclaw Rulebook\n\n## MUST_ALWAYS\n- Follow flow order: brainstorm -> scope -> design -> spec -> plan ->
|
|
3
|
-
export declare const CURSOR_WORKFLOW_RULE_MDC = "---\ndescription: cclaw workflow guardrails for Cursor agent sessions\nglobs:\n - \"**/*\"\nalwaysApply: true\n---\n\n<!-- cclaw-managed-cursor-workflow-rule -->\n\n# Cclaw Workflow Guardrails\n\n- Follow stage order: brainstorm -> scope -> design -> spec -> plan ->
|
|
2
|
+
export declare const RULEBOOK_MARKDOWN = "# Cclaw Rulebook\n\n## MUST_ALWAYS\n- Follow flow order: brainstorm -> scope -> design -> spec -> plan -> tdd -> review -> ship\n- Require explicit user confirmation after plan before TDD\n- Keep evidence artifacts in `.cclaw/artifacts/`\n- Enforce RED before GREEN in TDD\n- Run two-layer review (spec_compliance and code_quality) before ship\n- Validate all inputs before processing \u2014 never trust external data without sanitization\n- Prefer immutable data patterns and pure functions where the language supports them\n- Follow existing repo conventions, patterns, and directory structure \u2014 match the codebase\n- Verify claims with fresh evidence: \"tests pass\" requires running tests in this message\n- Use conventional commits: `type(scope): description` (feat, fix, refactor, test, docs, chore)\n\n## MUST_NEVER\n- Skip RED phase and jump directly to GREEN in TDD\n- Ship with critical review findings\n- Start implementation during /brainstorm\n- Modify generated cclaw files manually when CLI can regenerate them\n- Commit `.cclaw/` or generated shim files\n- Expose secrets, tokens, API keys, or absolute system paths in agent output\n- Duplicate existing functionality without explicit justification \u2014 search before building\n- Bypass security checks, linting hooks, or type checking to \"move faster\"\n- Claim success (\"Done,\" \"All good,\" \"Tests pass\") without running verification in this message\n- Make changes outside the blast radius of the current task without user consent\n\n## DELEGATION\nWhen a task requires specialist knowledge (security audit, performance profiling, database review),\ndelegate to a specialized agent or skill if the harness supports it. The primary agent should:\n1. Identify the specialist domain\n2. Provide focused context (relevant files, the specific concern)\n3. Evaluate the specialist output before acting on it \u2014 do not blindly apply recommendations\n";
|
|
3
|
+
export declare const CURSOR_WORKFLOW_RULE_MDC = "---\ndescription: cclaw workflow guardrails for Cursor agent sessions\nglobs:\n - \"**/*\"\nalwaysApply: true\n---\n\n<!-- cclaw-managed-cursor-workflow-rule -->\n\n# Cclaw Workflow Guardrails\n\n- Follow stage order: brainstorm -> scope -> design -> spec -> plan -> tdd -> review -> ship.\n- Read `.cclaw/state/flow-state.json` before acting; continue from current stage when active.\n- Use `/cc-next` only after required gates pass; never bypass explicit pause/approval rules.\n- Keep evidence in `.cclaw/artifacts/` and canonical run copies in `.cclaw/runs/<activeRunId>/artifacts/`.\n- For machine-only checks in design/plan/tdd/review/ship, dispatch required specialists automatically when tooling supports it.\n- Ask for user input only at explicit approval gates (scope mode, plan approval, user challenge resolution, ship finalization).\n- Treat `.cclaw/skills/using-cclaw/SKILL.md` as routing source of truth; load contextual utility skills only when their triggers apply.\n";
|
|
4
4
|
export declare function buildRulesJson(): Record<string, unknown>;
|
|
@@ -292,8 +292,8 @@ Execution rule: complete and verify each wave before starting the next wave.
|
|
|
292
292
|
export const RULEBOOK_MARKDOWN = `# Cclaw Rulebook
|
|
293
293
|
|
|
294
294
|
## MUST_ALWAYS
|
|
295
|
-
- Follow flow order: brainstorm -> scope -> design -> spec -> plan ->
|
|
296
|
-
- Require explicit user confirmation after
|
|
295
|
+
- Follow flow order: brainstorm -> scope -> design -> spec -> plan -> tdd -> review -> ship
|
|
296
|
+
- Require explicit user confirmation after plan before TDD
|
|
297
297
|
- Keep evidence artifacts in \`.cclaw/artifacts/\`
|
|
298
298
|
- Enforce RED before GREEN in TDD
|
|
299
299
|
- Run two-layer review (spec_compliance and code_quality) before ship
|
|
@@ -304,7 +304,7 @@ export const RULEBOOK_MARKDOWN = `# Cclaw Rulebook
|
|
|
304
304
|
- Use conventional commits: \`type(scope): description\` (feat, fix, refactor, test, docs, chore)
|
|
305
305
|
|
|
306
306
|
## MUST_NEVER
|
|
307
|
-
- Skip
|
|
307
|
+
- Skip RED phase and jump directly to GREEN in TDD
|
|
308
308
|
- Ship with critical review findings
|
|
309
309
|
- Start implementation during /brainstorm
|
|
310
310
|
- Modify generated cclaw files manually when CLI can regenerate them
|
|
@@ -333,11 +333,11 @@ alwaysApply: true
|
|
|
333
333
|
|
|
334
334
|
# Cclaw Workflow Guardrails
|
|
335
335
|
|
|
336
|
-
- Follow stage order: brainstorm -> scope -> design -> spec -> plan ->
|
|
336
|
+
- Follow stage order: brainstorm -> scope -> design -> spec -> plan -> tdd -> review -> ship.
|
|
337
337
|
- Read \`.cclaw/state/flow-state.json\` before acting; continue from current stage when active.
|
|
338
338
|
- Use \`/cc-next\` only after required gates pass; never bypass explicit pause/approval rules.
|
|
339
339
|
- Keep evidence in \`.cclaw/artifacts/\` and canonical run copies in \`.cclaw/runs/<activeRunId>/artifacts/\`.
|
|
340
|
-
- For machine-only checks in design/plan/
|
|
340
|
+
- For machine-only checks in design/plan/tdd/review/ship, dispatch required specialists automatically when tooling supports it.
|
|
341
341
|
- Ask for user input only at explicit approval gates (scope mode, plan approval, user challenge resolution, ship finalization).
|
|
342
342
|
- Treat \`.cclaw/skills/using-cclaw/SKILL.md\` as routing source of truth; load contextual utility skills only when their triggers apply.
|
|
343
343
|
`;
|
|
@@ -26,7 +26,7 @@ Do not approve code with known Critical security issues. No exceptions.
|
|
|
26
26
|
- Before shipping any user-facing feature
|
|
27
27
|
- When adding authentication, authorization, or secrets handling
|
|
28
28
|
- When handling user input, file uploads, or external API data
|
|
29
|
-
- During the review stage (\`/cc-
|
|
29
|
+
- During the review stage (entered via \`/cc-next\`) as a specialist lens
|
|
30
30
|
- When the security-reviewer agent persona is activated
|
|
31
31
|
|
|
32
32
|
## Checklist
|
|
@@ -534,7 +534,7 @@ Do not keep stale or oversized context loaded when task intent changes. Context
|
|
|
534
534
|
|
|
535
535
|
Modes are stored in \`.cclaw/contexts/\`:
|
|
536
536
|
- \`default\` — balanced execution
|
|
537
|
-
- \`execution\` — fast plan/
|
|
537
|
+
- \`execution\` — fast plan/tdd throughput
|
|
538
538
|
- \`review\` — defect/risk discovery
|
|
539
539
|
- \`incident\` — stabilization and recovery
|
|
540
540
|
|