cc-codeconductor 1.1.0 → 1.2.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.
Files changed (143) hide show
  1. package/README.md +4 -2
  2. package/dist/core/verification/verification-runner.d.ts +7 -0
  3. package/dist/index.d.ts +1 -1
  4. package/dist/index.js +1413 -309
  5. package/dist/library.js +29 -1
  6. package/dist/validation/schemas.d.ts +97 -26
  7. package/package.json +1 -1
  8. package/presets/agy/AGENTS.md +10 -9
  9. package/presets/agy/hooks.json +2 -2
  10. package/presets/agy/scripts/invoke-hook.cjs +115 -0
  11. package/presets/agy/skills/backlog/SKILL.md +40 -70
  12. package/presets/agy/skills/cc-spec-mutation/SKILL.md +165 -0
  13. package/presets/agy/skills/cc-tdd-cycle/SKILL.md +3 -0
  14. package/presets/agy/skills/evaluation/SKILL.md +61 -2
  15. package/presets/agy/skills/openspec/SKILL.md +49 -19
  16. package/presets/agy/skills/testing-tdd/SKILL.md +53 -0
  17. package/presets/agy/skills/using-cc-skills/SKILL.md +48 -0
  18. package/presets/agy/workflows/cc-api-contract.md +14 -0
  19. package/presets/agy/workflows/cc-db-migration.md +14 -0
  20. package/presets/agy/workflows/cc-feature.md +18 -0
  21. package/presets/agy/workflows/cc-fix.md +14 -0
  22. package/presets/agy/workflows/cc-iterative.md +14 -0
  23. package/presets/agy/workflows/cc-openspec.md +14 -0
  24. package/presets/agy/workflows/cc-scorecard.md +2 -0
  25. package/presets/agy/workflows/cc-spec-mutation.md +191 -0
  26. package/presets/agy/workflows/cc-tdd-cycle.md +14 -0
  27. package/presets/claude/commands/cc/api-contract.md +14 -0
  28. package/presets/claude/commands/cc/db-migration.md +14 -0
  29. package/presets/claude/commands/cc/feature.md +18 -0
  30. package/presets/claude/commands/cc/fix.md +17 -0
  31. package/presets/claude/commands/cc/iterative.md +14 -0
  32. package/presets/claude/commands/cc/openspec.md +14 -0
  33. package/presets/claude/commands/cc/review.md +3 -0
  34. package/presets/claude/commands/cc/scorecard.md +2 -0
  35. package/presets/claude/commands/cc/spec-mutation.md +190 -0
  36. package/presets/claude/commands/cc/tdd-cycle.md +17 -0
  37. package/presets/claude/settings.json +13 -11
  38. package/presets/claude/skills/backlog/SKILL.md +40 -70
  39. package/presets/claude/skills/evaluation/SKILL.md +47 -24
  40. package/presets/claude/skills/openspec/SKILL.md +46 -38
  41. package/presets/claude/skills/testing-tdd/SKILL.md +53 -0
  42. package/presets/claude/skills/using-cc-skills/SKILL.md +48 -0
  43. package/presets/codex/AGENTS.md +16 -12
  44. package/presets/codex/skills/backlog/SKILL.md +61 -0
  45. package/presets/codex/skills/cc-api-contract/SKILL.md +87 -0
  46. package/presets/codex/skills/cc-backlog/SKILL.md +108 -0
  47. package/presets/codex/skills/cc-clarify/SKILL.md +36 -0
  48. package/presets/codex/skills/cc-council/SKILL.md +92 -0
  49. package/presets/codex/skills/cc-db-migration/SKILL.md +88 -0
  50. package/presets/codex/skills/cc-explore/SKILL.md +40 -0
  51. package/presets/codex/skills/cc-feature/SKILL.md +154 -0
  52. package/presets/codex/skills/cc-fix/SKILL.md +165 -0
  53. package/presets/codex/skills/cc-handoff/SKILL.md +45 -0
  54. package/presets/codex/skills/cc-iterative/SKILL.md +150 -0
  55. package/presets/codex/skills/cc-openspec/SKILL.md +191 -0
  56. package/presets/codex/skills/cc-pagespeed/SKILL.md +124 -0
  57. package/presets/codex/skills/cc-prototype/SKILL.md +42 -0
  58. package/presets/codex/skills/cc-refactor/SKILL.md +163 -0
  59. package/presets/codex/skills/cc-review/SKILL.md +152 -0
  60. package/presets/codex/skills/cc-scorecard/SKILL.md +82 -0
  61. package/presets/codex/skills/cc-security/SKILL.md +182 -0
  62. package/presets/codex/skills/cc-spec-mutation/SKILL.md +192 -0
  63. package/presets/codex/skills/cc-tdd-cycle/SKILL.md +266 -0
  64. package/presets/codex/skills/cc-test-plan/SKILL.md +153 -0
  65. package/presets/codex/skills/cc-triage/SKILL.md +38 -0
  66. package/presets/codex/skills/evaluation/SKILL.md +65 -0
  67. package/presets/codex/skills/openspec/SKILL.md +66 -0
  68. package/presets/codex/skills/testing-tdd/SKILL.md +53 -0
  69. package/presets/codex/skills/using-cc-skills/SKILL.md +48 -0
  70. package/presets/cursor/commands/cc/api-contract.md +14 -0
  71. package/presets/cursor/commands/cc/db-migration.md +14 -0
  72. package/presets/cursor/commands/cc/feature.md +18 -0
  73. package/presets/cursor/commands/cc/fix.md +17 -0
  74. package/presets/cursor/commands/cc/iterative.md +14 -0
  75. package/presets/cursor/commands/cc/openspec.md +14 -0
  76. package/presets/cursor/commands/cc/scorecard.md +2 -0
  77. package/presets/cursor/commands/cc/spec-mutation.md +190 -0
  78. package/presets/cursor/commands/cc/tdd-cycle.md +14 -0
  79. package/presets/cursor/skills/backlog/SKILL.md +40 -70
  80. package/presets/cursor/skills/evaluation/SKILL.md +61 -4
  81. package/presets/cursor/skills/openspec/SKILL.md +46 -36
  82. package/presets/cursor/skills/testing-tdd/SKILL.md +35 -574
  83. package/presets/cursor/skills/using-cc-skills/SKILL.md +48 -0
  84. package/presets/gemini/commands/cc/api-contract.toml +82 -0
  85. package/presets/gemini/commands/cc/ask.toml +54 -0
  86. package/presets/gemini/commands/cc/backlog.toml +103 -0
  87. package/presets/gemini/commands/cc/clarify.toml +31 -0
  88. package/presets/gemini/commands/cc/council.toml +87 -0
  89. package/presets/gemini/commands/cc/db-migration.toml +83 -0
  90. package/presets/gemini/commands/cc/explore.toml +35 -0
  91. package/presets/gemini/commands/cc/feature.toml +153 -0
  92. package/presets/gemini/commands/cc/fix.toml +163 -0
  93. package/presets/gemini/commands/cc/handoff.toml +40 -0
  94. package/presets/gemini/commands/cc/iterative.toml +145 -0
  95. package/presets/gemini/commands/cc/openspec.toml +186 -0
  96. package/presets/gemini/commands/cc/pagespeed.toml +119 -0
  97. package/presets/gemini/commands/cc/prototype.toml +37 -0
  98. package/presets/gemini/commands/cc/refactor.toml +158 -0
  99. package/presets/gemini/commands/cc/review.toml +150 -0
  100. package/presets/gemini/commands/cc/scorecard.toml +77 -0
  101. package/presets/gemini/commands/cc/security.toml +177 -0
  102. package/presets/gemini/commands/cc/spec-mutation.toml +187 -0
  103. package/presets/gemini/commands/cc/tdd-cycle.toml +264 -0
  104. package/presets/gemini/commands/cc/test-plan.toml +148 -0
  105. package/presets/gemini/commands/cc/triage.toml +33 -0
  106. package/presets/opencode/README.md +24 -21
  107. package/presets/opencode/agents/architect.md +6 -0
  108. package/presets/opencode/agents/implementer.md +7 -0
  109. package/presets/opencode/agents/reviewer.md +6 -0
  110. package/presets/opencode/agents/tester.md +6 -0
  111. package/presets/opencode/commands/cc-api-contract.md +14 -0
  112. package/presets/opencode/commands/cc-db-migration.md +14 -0
  113. package/presets/opencode/commands/cc-feature.md +18 -0
  114. package/presets/opencode/commands/cc-fix.md +17 -0
  115. package/presets/opencode/commands/cc-iterative.md +14 -0
  116. package/presets/opencode/commands/cc-openspec.md +14 -0
  117. package/presets/opencode/commands/cc-scorecard.md +2 -0
  118. package/presets/opencode/commands/cc-spec-mutation.md +190 -0
  119. package/presets/opencode/commands/cc-tdd-cycle.md +14 -0
  120. package/presets/opencode/opencode.jsonc +1 -1
  121. package/presets/opencode/prompts/v1.0.0/architect.md +6 -0
  122. package/presets/opencode/prompts/v1.0.0/implementer.md +7 -0
  123. package/presets/opencode/prompts/v1.0.0/reviewer.md +6 -0
  124. package/presets/opencode/prompts/v1.0.0/tester.md +6 -0
  125. package/presets/opencode/skills/backlog/SKILL.md +40 -70
  126. package/presets/opencode/skills/evaluation/SKILL.md +61 -2
  127. package/presets/opencode/skills/openspec/SKILL.md +46 -34
  128. package/presets/opencode/skills/testing-tdd/SKILL.md +35 -574
  129. package/presets/opencode/skills/using-cc-skills/SKILL.md +48 -0
  130. package/presets/shared/__pycache__/mutation_runner.cpython-314.pyc +0 -0
  131. package/presets/shared/invoke-hook.cjs +115 -0
  132. package/presets/shared/mutation_runner.py +273 -0
  133. package/src/presets/manifests/agy.yml +2 -0
  134. package/src/presets/manifests/claude.yml +3 -0
  135. package/src/presets/manifests/gemini.yml +15 -0
  136. package/src/presets/models/agy.yml +24 -24
  137. package/src/presets/models/claude.yml +10 -10
  138. package/src/presets/models/codex.yml +10 -10
  139. package/src/presets/models/cursor.yml +10 -10
  140. package/src/presets/models/gemini.yml +10 -10
  141. package/src/presets/models/opencode.yml +10 -10
  142. package/presets/agy/scripts/post-tool.sh +0 -25
  143. package/presets/agy/scripts/pre-tool.sh +0 -56
@@ -0,0 +1,65 @@
1
+ ---
2
+ name: evaluation
3
+ description:
4
+ Guides agents through scorecards, outcomes, model profiles, and eval suites.
5
+ Use when running /cc-scorecard or /cc:scorecard, measuring a deliverable, or
6
+ checking workflow gates with suite-run.
7
+ ---
8
+
9
+ # Evaluation
10
+
11
+ ## Overview
12
+
13
+ A scorecard measures the deliverable against eight weighted criteria. Spec
14
+ quality checklists are reviewer-owned. "Seems right" is not a verdict.
15
+
16
+ Pass threshold: weighted score >= 2.0 and no criterion at 0.
17
+
18
+ ## When to Use
19
+
20
+ - After implement/review, before `openspec archive`
21
+ - Comparing models or prompt versions
22
+ - Proving the workflow tools still work (`suite-run`)
23
+
24
+ **NOT** for rewriting specs (reviewer checklist) or for implementing code.
25
+
26
+ ## Process
27
+
28
+ Local: `bun run dev`. Published: `npx cc-codeconductor`.
29
+
30
+ ```text
31
+ scorecard create --task BC-001 --from-diff
32
+ scorecard record --task BC-001 --verdict PASS --score 2.5
33
+ scorecard list | aggregate | models | regression | matrix | compare-models
34
+ scorecard prompt-diff 0.4.0 0.5.0 --agent architect
35
+ scorecard experiment start --suite harness-v1
36
+ scorecard suite-run --suite workflow-gates
37
+ scorecard suite-run --suite hook-guardrails
38
+ scorecard suite-run --suite scorecard-signals
39
+ ```
40
+
41
+ `openspec analyze` can auto-suggest `acceptance` / `tests` on `--from-diff`.
42
+ Archive needs PASS when review is required.
43
+
44
+ Outcomes append to `.codeconductor/evaluation/outcomes.jsonl`.
45
+
46
+ ## Common Rationalizations
47
+
48
+ | Rationalization | Reality |
49
+ | --- | --- |
50
+ | I'll fill the scorecard by hand without a diff | Use `--from-diff` and runner evidence. |
51
+ | Suites are optional toys | `suite-run` is the workflow tool that proves gates. |
52
+ | Handmade TDD JSON is fine | The runner rejects it. |
53
+
54
+ ## Red Flags
55
+
56
+ - PASS with a criterion at 0
57
+ - Archive without a recorded scorecard when review is required
58
+ - Declaring the workflow ready without `suite-run` or `scorecard record`
59
+
60
+ ## Verification
61
+
62
+ - [ ] Scorecard created from diff (or explicit scores)
63
+ - [ ] Verdict PASS / REVISE / REJECT recorded
64
+ - [ ] For process changes: `scorecard suite-run --suite hook-guardrails` (and
65
+ `workflow-gates` / `scorecard-signals` when those gates changed)
@@ -0,0 +1,66 @@
1
+ ---
2
+ name: openspec
3
+ description:
4
+ Guides agents through OpenSpec delivery from BACKLOG.md (validate, analyze,
5
+ test-before-implement, scorecard, archive). Use when running /cc-openspec,
6
+ /cc:openspec, or delivering an existing backlog item. Authoring BACKLOG.md
7
+ is skill backlog, not this skill.
8
+ ---
9
+
10
+ # OpenSpec delivery
11
+
12
+ ## Overview
13
+
14
+ This skill delivers an existing `BACKLOG.md` item. It is a workflow with CLI
15
+ gates, not a reference doc. Specs describe WHAT; `design.md` describes HOW.
16
+
17
+ ## When to Use
18
+
19
+ - `/cc-openspec` or `openspec next` / `plan` / `done` / `archive`
20
+ - An item is `READY` or later and must move through the state machine
21
+
22
+ **NOT** for creating `BACKLOG.md` (use skill `backlog`) or for stack-specific
23
+ coding rules.
24
+
25
+ ## Process
26
+
27
+ Local CLI is `bun run dev`. Published package is `npx cc-codeconductor`.
28
+
29
+ 1. `openspec validate` — must pass before delivery.
30
+ 2. `openspec plan BC-xxx` if the item is not yet `PLANNED`.
31
+ 3. `openspec analyze --output json` — CRITICAL findings exit 1. Do not implement.
32
+ 4. Phases: discover (`repo-explorer`) → design (`architect`) → test (`tester`) →
33
+ implement (`implementer`) → review (`reviewer`). If Global `TDD required: yes`,
34
+ test runs before implement.
35
+ 5. `openspec done` on test/implement requires `captureTddSuiteEvidence`. Handmade
36
+ evidence JSON is rejected.
37
+ 6. `scorecard create --task BC-xxx --from-diff` then record a verdict.
38
+ 7. `openspec archive` only after human review when `Review required: yes` and
39
+ the scorecard is PASS.
40
+
41
+ Status machine: `TODO` → `READY` → `PLANNED` → `IN_PROGRESS` → `REVIEW` → `DONE`
42
+ → Archive. `BLOCKED` returns to `READY`. Reviewer rejection: `REVIEW` →
43
+ `IN_PROGRESS`.
44
+
45
+ ## Common Rationalizations
46
+
47
+ | Rationalization | Reality |
48
+ | --- | --- |
49
+ | Validate is bureaucracy | `openspec validate` is the gate. Skipping it is a defect. |
50
+ | I'll add tests after green | Global TDD required means tester before implementer. |
51
+ | I'll write the evidence JSON myself | Handmade TDD JSON is rejected. Use the verification runner. |
52
+ | The item is small; skip analyze | `openspec analyze` CRITICAL still stops implement. |
53
+
54
+ ## Red Flags
55
+
56
+ - Implementing while analyze reports CRITICAL
57
+ - Archive without a PASS scorecard when review is required
58
+ - Acceptance like "improve UX" with no measurable check
59
+
60
+ ## Verification
61
+
62
+ - [ ] `openspec validate` exit 0
63
+ - [ ] `openspec analyze --output json` has no CRITICAL
64
+ - [ ] TDD evidence from the runner when TDD is required
65
+ - [ ] `scorecard create --from-diff` recorded
66
+ - [ ] Suite check (optional): `bun run dev scorecard suite-run --suite workflow-gates`
@@ -0,0 +1,53 @@
1
+ ---
2
+ name: testing-tdd
3
+ description:
4
+ Guides agents through Red-Green-Refactor with runner-captured evidence.
5
+ Use when running /cc-tdd-cycle, writing tests before implementation, or
6
+ Global TDD required is yes.
7
+ ---
8
+
9
+ # Test-Driven Development
10
+
11
+ ## Overview
12
+
13
+ Red (failing test) → Green (minimal code) → Refactor. Evidence comes from
14
+ `captureTddSuiteEvidence`, not handmade JSON.
15
+
16
+ ## When to Use
17
+
18
+ - `/cc-tdd-cycle`, new behavior, bug fixes, TDD-required OpenSpec items
19
+
20
+ **NOT** for docs-only changes or when the Task Card forbids tests.
21
+
22
+ ## Process
23
+
24
+ 1. Write the failing test that encodes one acceptance criterion. Run the suite.
25
+ It MUST fail (`suiteFails === true`).
26
+ 2. Implement the minimum that turns it green. Do not expand scope.
27
+ 3. Refactor only with a green suite.
28
+ 4. Capture evidence via the verification runner (`openspec done` on test/implement
29
+ when TDD is required).
30
+ 5. Cover happy path, edge, and error for each behavior.
31
+
32
+ Local: `bun run dev`. Pyramid default: many unit, fewer integration, rare E2E.
33
+
34
+ ## Common Rationalizations
35
+
36
+ | Rationalization | Reality |
37
+ | --- | --- |
38
+ | I'll add tests later | Later means never. Red first. |
39
+ | This is too small to test | If it can break, it needs a failing test first. |
40
+ | I'll write the evidence JSON | Handmade TDD JSON is rejected. |
41
+
42
+ ## Red Flags
43
+
44
+ - Tests that assert implementation details instead of behavior
45
+ - Green without a recorded red
46
+ - Skipping error cases
47
+
48
+ ## Verification
49
+
50
+ - [ ] Suite failed before implement
51
+ - [ ] Suite passed after implement
52
+ - [ ] Runner evidence exists (not handmade)
53
+ - [ ] Optional: `bun run dev scorecard suite-run --suite workflow-gates`
@@ -0,0 +1,48 @@
1
+ ---
2
+ name: using-cc-skills
3
+ description:
4
+ Maps incoming work to the CodeConductor slash command and workflow skill.
5
+ Use when starting a session or deciding which /cc-* command applies.
6
+ ---
7
+
8
+ # Using CodeConductor skills
9
+
10
+ ## Overview
11
+
12
+ Pick one slash command. Follow its skill. Invoke CLI for gates. Do not invent
13
+ a parallel process.
14
+
15
+ ## When to Use
16
+
17
+ - Start of a session, ambiguous request, or "which /cc should I run?"
18
+
19
+ ## Process
20
+
21
+ | Intent | Command | Skill |
22
+ | --- | --- | --- |
23
+ | New backlog item | `/cc-backlog` | `backlog` |
24
+ | Deliver a BC-xxx item | `/cc-openspec` | `openspec` |
25
+ | New feature | `/cc-feature` | `openspec` + `testing-tdd` |
26
+ | Bug fix | `/cc-fix` | `testing-tdd` |
27
+ | Review a diff | `/cc-review` | `evaluation` |
28
+ | TDD cycle only | `/cc-tdd-cycle` | `testing-tdd` |
29
+ | Scorecard / suites | `/cc-scorecard` | `evaluation` |
30
+
31
+ Then run the matching CLI (`openspec validate`, `scorecard create --from-diff`,
32
+ `hook pre-tool`, `scorecard suite-run`).
33
+
34
+ ## Common Rationalizations
35
+
36
+ | Rationalization | Reality |
37
+ | --- | --- |
38
+ | I'll skip the slash and just code | Skipping the workflow is a defect. |
39
+
40
+ ## Red Flags
41
+
42
+ - Two slash commands in parallel that mutate the same files
43
+ - Implementing before `openspec analyze` when a change folder is active
44
+
45
+ ## Verification
46
+
47
+ - [ ] One command selected and shown to the user
48
+ - [ ] Matching skill loaded before edits
@@ -20,6 +20,20 @@ Command: `api-contract` (fixed for this workflow — do not infer from user text
20
20
 
21
21
  ---
22
22
 
23
+ ## Step 0b — OpenSpec quality gates
24
+
25
+ If `openspec status` reports an active change folder:
26
+
27
+ 1. Run: `npx cc-codeconductor openspec validate --output json`
28
+ 2. Run: `npx cc-codeconductor openspec analyze --output json`
29
+ 3. If analyze `stop` is true or any finding is CRITICAL, stop. Do not delegate to implementer.
30
+ 4. Next command spelling on this runner: `/cc:api-contract`
31
+
32
+ Local development: `bun run dev <same argv>`. Published package: `npx cc-codeconductor`.
33
+
34
+ ---
35
+
36
+
23
37
  ## Step 1 — Task Card validation (Task Coach role)
24
38
 
25
39
  Invoke the `task-coach` subagent via the Task tool.
@@ -21,6 +21,20 @@ Command: `db-migration` (fixed for this workflow — do not infer from user text
21
21
 
22
22
  ---
23
23
 
24
+ ## Step 0b — OpenSpec quality gates
25
+
26
+ If `openspec status` reports an active change folder:
27
+
28
+ 1. Run: `npx cc-codeconductor openspec validate --output json`
29
+ 2. Run: `npx cc-codeconductor openspec analyze --output json`
30
+ 3. If analyze `stop` is true or any finding is CRITICAL, stop. Do not delegate to implementer.
31
+ 4. Next command spelling on this runner: `/cc:db-migration`
32
+
33
+ Local development: `bun run dev <same argv>`. Published package: `npx cc-codeconductor`.
34
+
35
+ ---
36
+
37
+
24
38
  ## Step 1 — Task Card validation (Task Coach role)
25
39
 
26
40
  Invoke the `task-coach` subagent via the Task tool.
@@ -23,6 +23,24 @@ Command: `feature` (fixed for this workflow — do not infer from user text)
23
23
 
24
24
  ---
25
25
 
26
+ ## Step 0b — OpenSpec quality gates
27
+
28
+ If `openspec status` reports an active change folder:
29
+
30
+ 1. Run: `npx cc-codeconductor openspec validate --output json`
31
+ 2. Run: `npx cc-codeconductor openspec analyze --output json`
32
+ 3. If analyze `stop` is true or any finding is CRITICAL, stop. Do not delegate to implementer.
33
+ 4. Next command spelling on this runner: `/cc:feature`
34
+
35
+ Local development: `bun run dev <same argv>`. Published package: `npx cc-codeconductor`.
36
+
37
+ Skills: `using-cc-skills`, `openspec`, `testing-tdd`, `evaluation`.
38
+ Do not skip `openspec analyze` when a change folder is active.
39
+ "I'll add tests later" is not allowed — tester before implementer.
40
+
41
+ ---
42
+
43
+
26
44
  ## Step 1 — Wayfinding (repo-explorer)
27
45
 
28
46
  If `graphify-out/graph.json` exists, run `graphify query "$ARGUMENTS"` (and
@@ -31,6 +31,20 @@ Command: `fix` (fixed for this workflow — do not infer from user text)
31
31
 
32
32
  ---
33
33
 
34
+ ## Step 0b — OpenSpec quality gates
35
+
36
+ If `openspec status` reports an active change folder:
37
+
38
+ 1. Run: `npx cc-codeconductor openspec validate --output json`
39
+ 2. Run: `npx cc-codeconductor openspec analyze --output json`
40
+ 3. If analyze `stop` is true or any finding is CRITICAL, stop. Do not delegate to implementer.
41
+ 4. Next command spelling on this runner: `/cc:fix`
42
+
43
+ Local development: `bun run dev <same argv>`. Published package: `npx cc-codeconductor`.
44
+
45
+ ---
46
+
47
+
34
48
  ## Step 1 — Wayfinding (repo-explorer)
35
49
 
36
50
  If `graphify-out/graph.json` exists, run `graphify query "$ARGUMENTS"` (and
@@ -146,3 +160,6 @@ Report: Task Card, Implementation Summary, regression test added, Review Report
146
160
 
147
161
  The fix is complete only when: the regression test passes, the full suite
148
162
  passes, and no CRITICAL review findings remain.
163
+
164
+ Skills: `testing-tdd`, `evaluation`. Record `scorecard create --from-diff`.
165
+ A small fix still needs a Task Card and a failing regression test first.
@@ -23,6 +23,20 @@ Command: `iterative` (fixed for this workflow — do not infer from user text)
23
23
 
24
24
  ---
25
25
 
26
+ ## Step 0b — OpenSpec quality gates
27
+
28
+ If `openspec status` reports an active change folder:
29
+
30
+ 1. Run: `npx cc-codeconductor openspec validate --output json`
31
+ 2. Run: `npx cc-codeconductor openspec analyze --output json`
32
+ 3. If analyze `stop` is true or any finding is CRITICAL, stop. Do not delegate to implementer.
33
+ 4. Next command spelling on this runner: `/cc:iterative`
34
+
35
+ Local development: `bun run dev <same argv>`. Published package: `npx cc-codeconductor`.
36
+
37
+ ---
38
+
39
+
26
40
  ## Step 1 — Wayfinding (repo-explorer)
27
41
 
28
42
  If `graphify-out/graph.json` exists, run `graphify query "$ARGUMENTS"` (and
@@ -27,6 +27,20 @@ Command: `openspec` (fixed for this workflow — do not infer from user text)
27
27
 
28
28
  ---
29
29
 
30
+ ## Step 0b — OpenSpec quality gates
31
+
32
+ If `openspec status` reports an active change folder:
33
+
34
+ 1. Run: `npx cc-codeconductor openspec validate --output json`
35
+ 2. Run: `npx cc-codeconductor openspec analyze --output json`
36
+ 3. If analyze `stop` is true or any finding is CRITICAL, stop. Do not delegate to implementer.
37
+ 4. Next command spelling on this runner: `/cc:openspec`
38
+
39
+ Local development: `bun run dev <same argv>`. Published package: `npx cc-codeconductor`.
40
+
41
+ ---
42
+
43
+
30
44
  ## Step 1 — Validate (mandatory gate)
31
45
 
32
46
  Run:
@@ -26,6 +26,8 @@ Command: `scorecard` (fixed for this workflow — do not infer from user text)
26
26
 
27
27
  Use `$ARGUMENTS` as task id (e.g. `BC-001`) or read active item from `npx cc-codeconductor openspec status`.
28
28
 
29
+ If a change folder exists, run `npx cc-codeconductor openspec analyze --output json` first. `--from-diff` overlays FR/SC coverage onto `acceptance` and TDD evidence onto `tests`.
30
+
29
31
  ---
30
32
 
31
33
  ## Step 2 — Create scorecard with auto-signals
@@ -0,0 +1,190 @@
1
+ ---
2
+ description: >-
3
+ [cc: alias] Spec-locked TDD with a mutation-testing gate — refine the intent
4
+ into an immutable Gherkin contract (SHA-256 frozen), implement under the
5
+ three laws of TDD, pass a judge audit, and merge only if every mutant dies.
6
+ ---
7
+
8
+ # Spec-Mutation — Hard Spec → TDD → Judge → Mutation Gate
9
+
10
+ Scope: $ARGUMENTS
11
+
12
+ Describe what behavior you want to implement. Include:
13
+
14
+ - The function, method, or feature to implement
15
+ - The expected behavior (inputs, outputs, invariants, edge cases)
16
+ - The allowed file scope (production files that may change)
17
+ - The test command for the affected suite (e.g. `pytest tests/test_billing.py`)
18
+
19
+ ---
20
+
21
+ ## Step 0 — CCEP Bootstrap
22
+
23
+ Command: `spec-mutation` (fixed for this workflow — do not infer from user text)
24
+
25
+ 1. Run: `npx cc-codeconductor ccep parse --command spec-mutation "$ARGUMENTS" --output json`
26
+ 2. Run: `npx cc-codeconductor ccep resolve --command spec-mutation "$ARGUMENTS" --output json`
27
+ 3. Run: `npx cc-codeconductor ccep profile spec-mutation --output json`
28
+ 4. After planner/intake JSON is available, run: `npx cc-codeconductor ccep evaluate --command spec-mutation --input <planner.json> --output json`. If `stop` is true, show questions or risks and wait for human input.
29
+ 5. Delegate to subagents using compiled CCEP prompts — never forward raw `$ARGUMENTS` to planners.
30
+ Canonical delivery order is test-before-implement whenever both phases apply.
31
+
32
+ ---
33
+
34
+ ## Step 0b — OpenSpec quality gates
35
+
36
+ If `openspec status` reports an active change folder:
37
+
38
+ 1. Run: `npx cc-codeconductor openspec validate --output json`
39
+ 2. Run: `npx cc-codeconductor openspec analyze --output json`
40
+ 3. If analyze `stop` is true or any finding is CRITICAL, stop. Do not delegate to implementer.
41
+ 4. Next command spelling on this runner: `/cc:spec-mutation`
42
+
43
+ Local development: `bun run dev <same argv>`. Published package: `npx cc-codeconductor`.
44
+
45
+ ---
46
+
47
+ ## Contract
48
+
49
+ The Gherkin specification is the **immutable contract** of the system. No code
50
+ merges unless it survives intentional source mutations. The loop is closed:
51
+
52
+ ```
53
+ [Human + spec_partner] ──> [gherkin_author] ──> [Test Freeze: SHA-256]
54
+
55
+ ┌──────────────────────────────────────────────────────┘
56
+
57
+ [tdd_craftsman] <───────────────┐ (surviving mutant)
58
+ (Red-Green-Refactor) │
59
+ │ │
60
+ ▼ │
61
+ [judge] ───────────> [mutation_testing] ───> [Safe Merge]
62
+ ```
63
+
64
+ Role mapping onto Conductor Agents (AGENTS.md):
65
+
66
+ | Workflow role | Conductor Agent | Deliverable |
67
+ | ------------------ | ----------------- | ------------------------------------------ |
68
+ | `craftsman_lead` | `orchestrator` | Routed Task Cards, per-stage scorecards |
69
+ | `spec_partner` | `task-coach` | Spec draft with invariants and boundaries |
70
+ | `gherkin_author` | `contract-builder`| Strict `.feature` file (Given/When/Then) |
71
+ | `tdd_craftsman` | `tester` → `implementer` | Failing test, then minimal production code |
72
+ | `judge` | `reviewer` | Binary verdict (PASS/REJECT) with scoring |
73
+ | `mutation_testing` | `tester` (runner) | Killed/survived mutant report |
74
+
75
+ ## Stage 1 — Interactive refinement (`spec_partner` / task-coach)
76
+
77
+ Do not jump to implementation. Apply Socratic questioning to the initial intent:
78
+
79
+ - Preconditions, postconditions, and edge cases.
80
+ - Invariant matrix: what must always be true.
81
+ - Scope boundaries: explicit `Scope / Files` and `Scope / Out` for the Task Card.
82
+
83
+ Stop gate: human confirms the draft before formalization.
84
+
85
+ ## Stage 2 — Hard Spec formalization (`gherkin_author` / contract-builder)
86
+
87
+ Formalize the agreed draft into `specs/<task>.feature` using strict Gherkin:
88
+
89
+ - No vague language ("must respond fast" is forbidden — use measurable Then steps).
90
+ - Every scenario declares preconditions (`Given`), actions (`When`), and
91
+ observable states (`Then`).
92
+ - Once the human approves the `.feature`, freeze it:
93
+
94
+ ```bash
95
+ shasum -a 256 specs/<task>.feature tests/ > .codeconductor/tasks/<task_id>.lock
96
+ ```
97
+
98
+ From this point `specs/` and `tests/` are **read-only** for implementation
99
+ agents. Before every later gate, recompute the hash; any single-byte difference
100
+ aborts the pipeline with scorecard 0 (Specification Gaming).
101
+
102
+ ## Stage 3 — TDD under the three laws (`tdd_craftsman`)
103
+
104
+ Delegates to the `/cc:tdd-cycle` state machine (`tddCycleStateMachine` in
105
+ `domain/loop`). Evidence must be captured with `captureTddSuiteEvidence` — do
106
+ not hand-edit JSON under `.codeconductor/evidence/`.
107
+
108
+ 1. **Law 1 (RED):** no production code except to make a failing test pass. A
109
+ compile error from a missing interface counts as a failure.
110
+ 2. **Law 2:** write exactly one failing assertion or scenario at a time.
111
+ 3. **Law 3 (GREEN):** write only the minimal production code to pass. No
112
+ speculative code, no preventive heuristics, stdlib-first.
113
+
114
+ Hard rule: any write attempt against `specs/` or `tests/` during GREEN/REFACTOR
115
+ is a harness violation — stop execution and report.
116
+
117
+ ## Stage 4 — Judge audit (`judge` / reviewer)
118
+
119
+ Deterministic gates before spending compute on mutation:
120
+
121
+ - Clean compile / diagnostics exit code 0.
122
+ - Traceability: every Gherkin step maps to an implemented test step.
123
+ - Scope Gaming audit: `git diff --name-only` must match the Task Card
124
+ `Scope / Files` exactly. Relaxed types, weakened assertions, or out-of-scope
125
+ edits → REJECT with findings.
126
+
127
+ Verdict is binary: PASS continues to the mutation gate; REJECT returns to the
128
+ `implement` phase with the findings attached.
129
+
130
+ ## Stage 5 — Mutation gate (`mutation_testing`)
131
+
132
+ Run the deterministic AST mutator shipped with this preset:
133
+
134
+ ```bash
135
+ python3 presets/shared/mutation_runner.py \
136
+ --target <production_file.py> \
137
+ --test-command "<test command>" \
138
+ --spec-folder specs
139
+ ```
140
+
141
+ The runner applies deterministic operator mutations (`>` → `<=`, `==` → `!=`,
142
+ `is` → `is not`, …) one at a time, re-runs the suite per mutant, and restores
143
+ the original source unconditionally (`finally` rollback).
144
+
145
+ - **Mutant killed (tests fail):** the suite detects the corruption. Continue.
146
+ - **Mutant survived (tests pass):** the tests are blind to this branch. The
147
+ runner writes `specs/handover.md` + appends to
148
+ `specs/implementation-summary.md` and exits with code **2**.
149
+
150
+ Non-Python stacks: substitute Stryker (JS/TS), PITest (JVM), or Mutmut
151
+ (Python full-suite) with the same contract — 100% kill rate or hands-off.
152
+
153
+ ### Hands-off protocol (exit code 2)
154
+
155
+ 1. Do NOT modify production code to "fix" a surviving mutant.
156
+ 2. Route back to `tdd_craftsman` with `specs/handover.md` as input: write the
157
+ missing failing test (Law 1 & 2) that asserts the mutated branch.
158
+ 3. Re-run stages 3–5.
159
+
160
+ ### Circuit breaker (max 3 loops)
161
+
162
+ The orchestrator keeps a persistent counter per Task Card. If the
163
+ `tdd_craftsman ↔ mutation_testing` loop does not reach a 100% kill rate after
164
+ **3 iterations**:
165
+
166
+ - Cancel active subagents (stop token/context spend).
167
+ - `git checkout -- <scope>` rollback to the last clean state.
168
+ - Scorecard: `STATUS = BLOCKED`; escalate to a human operator. The branch stays
169
+ frozen until human arbitration.
170
+
171
+ ## Guardrails (harness-enforced, not prompt-enforced)
172
+
173
+ - **Test Freezing:** SHA-256 of `specs/` + `tests/` stored in
174
+ `.codeconductor/tasks/<task_id>.lock`; hash mismatch aborts the pipeline.
175
+ - **Scope Guardian:** `fs_write`/`fs_patch` paths are validated against the Task
176
+ Card `Scope / Files`; path escapes (`../`) and critical files (`**/.env*`,
177
+ `**/credentials*`, infrastructure roots) are denied per `policy.yml`.
178
+ - **RBAC per role:** `gherkin_author` writes only `specs/`; `tdd_craftsman`
179
+ reads specs/tests and writes only scoped `src/`; `judge` and
180
+ `mutation_testing` are read-only except the runner's rolled-back patch.
181
+ - **Worktree isolation:** run the whole flow in a dedicated `git worktree`;
182
+ protected branches (`main`, `master`, `develop`) are never touched.
183
+
184
+ ## Completion criteria
185
+
186
+ - [ ] `.feature` approved and frozen (SHA-256 lock file exists and matches).
187
+ - [ ] RED → GREEN → REFACTOR evidence captured per phase.
188
+ - [ ] Judge verdict PASS (compile clean, traceability complete, scope clean).
189
+ - [ ] Mutation runner exits 0 with `total_mutants_killed == total_points`.
190
+ - [ ] Scorecard records the kill rate and iteration count (≤ 3).
@@ -31,6 +31,20 @@ Command: `tdd-cycle` (fixed for this workflow — do not infer from user text)
31
31
 
32
32
  ---
33
33
 
34
+ ## Step 0b — OpenSpec quality gates
35
+
36
+ If `openspec status` reports an active change folder:
37
+
38
+ 1. Run: `npx cc-codeconductor openspec validate --output json`
39
+ 2. Run: `npx cc-codeconductor openspec analyze --output json`
40
+ 3. If analyze `stop` is true or any finding is CRITICAL, stop. Do not delegate to implementer.
41
+ 4. Next command spelling on this runner: `/cc:tdd-cycle`
42
+
43
+ Local development: `bun run dev <same argv>`. Published package: `npx cc-codeconductor`.
44
+
45
+ ---
46
+
47
+
34
48
  ## Before you begin — mandatory pre-check
35
49
 
36
50
  This command enforces strict TDD discipline. The three phases are sequential and