cc-codeconductor 0.5.0 → 1.0.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 (174) hide show
  1. package/README.md +95 -95
  2. package/dist/cli/errors.d.ts +65 -0
  3. package/dist/core/compilation/compile-checker.d.ts +51 -0
  4. package/dist/core/config/codeconductor-config.d.ts +42 -0
  5. package/dist/core/config/config-loader.d.ts +11 -0
  6. package/dist/core/filesystem/credential-guard.d.ts +18 -0
  7. package/dist/core/goal/goal-planner.d.ts +8 -0
  8. package/dist/core/goal/goal-state.d.ts +15 -0
  9. package/dist/core/loop/git-stats.d.ts +13 -0
  10. package/dist/core/loop/loop-engine.d.ts +79 -0
  11. package/dist/core/memory/episodic-store.d.ts +6 -0
  12. package/dist/core/memory/operational-state.d.ts +6 -0
  13. package/dist/core/orchestrator/runtime-orchestrator.d.ts +25 -0
  14. package/dist/core/planner/product-planner.d.ts +18 -0
  15. package/dist/core/presets/package-paths.d.ts +4 -0
  16. package/dist/core/product-graph/graph-store.d.ts +11 -0
  17. package/dist/core/product-graph/paths.d.ts +18 -0
  18. package/dist/core/verification/verification-runner.d.ts +57 -0
  19. package/dist/domain/loop/loop-state.d.ts +74 -0
  20. package/dist/domain/product/entities.d.ts +11 -0
  21. package/dist/index.d.ts +15 -0
  22. package/dist/index.js +21820 -15579
  23. package/dist/library.js +2595 -0
  24. package/dist/utils/result.d.ts +36 -0
  25. package/dist/validation/schemas.d.ts +3660 -0
  26. package/package.json +15 -2
  27. package/policy.yml +12 -11
  28. package/presets/agy/AGENTS.md +11 -5
  29. package/presets/agy/gates/pre-commit/GATE.md +136 -0
  30. package/presets/agy/skills/cc-fix/SKILL.md +2 -2
  31. package/presets/agy/skills/cc-tdd-cycle/SKILL.md +11 -0
  32. package/presets/agy/workflows/cc-api-contract.md +12 -0
  33. package/presets/agy/workflows/cc-ask.md +55 -0
  34. package/presets/agy/workflows/cc-clarify.md +33 -0
  35. package/presets/agy/workflows/cc-council.md +31 -7
  36. package/presets/agy/workflows/cc-db-migration.md +22 -9
  37. package/presets/agy/workflows/cc-explore.md +37 -0
  38. package/presets/agy/workflows/cc-feature.md +41 -19
  39. package/presets/agy/workflows/cc-fix.md +50 -23
  40. package/presets/agy/workflows/cc-handoff.md +42 -0
  41. package/presets/agy/workflows/cc-iterative.md +128 -0
  42. package/presets/agy/workflows/cc-openspec.md +13 -0
  43. package/presets/agy/workflows/cc-pagespeed.md +12 -0
  44. package/presets/agy/workflows/cc-prototype.md +39 -0
  45. package/presets/agy/workflows/cc-refactor.md +12 -0
  46. package/presets/agy/workflows/cc-review.md +12 -0
  47. package/presets/agy/workflows/cc-scorecard.md +12 -0
  48. package/presets/agy/workflows/cc-tdd-cycle.md +24 -0
  49. package/presets/agy/workflows/cc-test-plan.md +12 -0
  50. package/presets/agy/workflows/cc-triage.md +35 -0
  51. package/presets/claude/CLAUDE.md +64 -0
  52. package/presets/claude/commands/cc/api-contract.md +12 -0
  53. package/presets/claude/commands/cc/ask.md +55 -0
  54. package/presets/claude/commands/cc/clarify.md +32 -0
  55. package/presets/claude/commands/cc/council.md +87 -0
  56. package/presets/claude/commands/cc/db-migration.md +22 -9
  57. package/presets/claude/commands/cc/explore.md +36 -0
  58. package/presets/claude/commands/cc/feature.md +49 -22
  59. package/presets/claude/commands/cc/fix.md +74 -20
  60. package/presets/claude/commands/cc/handoff.md +44 -0
  61. package/presets/claude/commands/cc/iterative.md +132 -0
  62. package/presets/claude/commands/cc/openspec.md +25 -0
  63. package/presets/claude/commands/cc/pagespeed.md +12 -0
  64. package/presets/claude/commands/cc/prototype.md +38 -0
  65. package/presets/claude/commands/cc/refactor.md +152 -1
  66. package/presets/claude/commands/cc/review.md +78 -16
  67. package/presets/claude/commands/cc/scorecard.md +12 -0
  68. package/presets/claude/commands/cc/tdd-cycle.md +53 -3
  69. package/presets/claude/commands/cc/test-plan.md +12 -0
  70. package/presets/claude/commands/cc/triage.md +34 -0
  71. package/presets/claude/gates/pre-commit/GATE.md +136 -0
  72. package/presets/claude/settings.json +8 -46
  73. package/presets/codex/AGENTS.md +6 -6
  74. package/presets/codex/commands/cc-ask.md +55 -0
  75. package/presets/codex/gates/pre-commit/GATE.md +136 -0
  76. package/presets/cursor/AGENTS.md +6 -6
  77. package/presets/cursor/agents/business-agent.md +44 -0
  78. package/presets/cursor/agents/continuous-architect.md +37 -0
  79. package/presets/cursor/agents/docs.md +1 -0
  80. package/presets/cursor/agents/goal-planner.md +1 -1
  81. package/presets/cursor/agents/impact-analyst.md +43 -0
  82. package/presets/cursor/agents/orchestrator.md +6 -6
  83. package/presets/cursor/commands/cc/api-contract.md +12 -0
  84. package/presets/cursor/commands/cc/ask.md +55 -0
  85. package/presets/cursor/commands/cc/clarify.md +32 -0
  86. package/presets/cursor/commands/cc/council.md +87 -0
  87. package/presets/cursor/commands/cc/db-migration.md +22 -9
  88. package/presets/cursor/commands/cc/explore.md +36 -0
  89. package/presets/cursor/commands/cc/feature.md +41 -19
  90. package/presets/cursor/commands/cc/fix.md +47 -20
  91. package/presets/cursor/commands/cc/handoff.md +41 -0
  92. package/presets/cursor/commands/cc/iterative.md +133 -0
  93. package/presets/cursor/commands/cc/openspec.md +22 -7
  94. package/presets/cursor/commands/cc/pagespeed.md +12 -0
  95. package/presets/cursor/commands/cc/prototype.md +38 -0
  96. package/presets/cursor/commands/cc/refactor.md +12 -0
  97. package/presets/cursor/commands/cc/review.md +12 -0
  98. package/presets/cursor/commands/cc/scorecard.md +12 -0
  99. package/presets/cursor/commands/cc/tdd-cycle.md +24 -0
  100. package/presets/cursor/commands/cc/test-plan.md +12 -0
  101. package/presets/cursor/commands/cc/triage.md +34 -0
  102. package/presets/cursor/gates/pre-commit/GATE.md +136 -0
  103. package/presets/cursor/rules/orchestration.mdc +1 -1
  104. package/presets/opencode/agents/architect.md +22 -1
  105. package/presets/opencode/agents/complexity-auditor.md +16 -1
  106. package/presets/opencode/agents/contract-builder.md +17 -1
  107. package/presets/opencode/agents/devil.md +158 -0
  108. package/presets/opencode/agents/docs.md +19 -1
  109. package/presets/opencode/agents/goal-planner.md +32 -2
  110. package/presets/opencode/agents/implementer.md +32 -2
  111. package/presets/opencode/agents/orchestrator.md +79 -12
  112. package/presets/opencode/agents/planner.md +61 -0
  113. package/presets/opencode/agents/repo-explorer.md +16 -0
  114. package/presets/opencode/agents/reviewer.md +33 -3
  115. package/presets/opencode/agents/security-reviewer.md +31 -1
  116. package/presets/opencode/agents/task-coach.md +69 -1
  117. package/presets/opencode/agents/tester.md +18 -1
  118. package/presets/opencode/commands/cc-api-contract.md +12 -0
  119. package/presets/opencode/commands/cc-ask.md +55 -0
  120. package/presets/opencode/commands/cc-clarify.md +31 -0
  121. package/presets/opencode/commands/cc-council.md +87 -0
  122. package/presets/opencode/commands/cc-db-migration.md +22 -9
  123. package/presets/opencode/commands/cc-explore.md +35 -0
  124. package/presets/opencode/commands/cc-feature.md +41 -19
  125. package/presets/opencode/commands/cc-fix.md +50 -23
  126. package/presets/opencode/commands/cc-handoff.md +40 -0
  127. package/presets/opencode/commands/cc-iterative.md +127 -0
  128. package/presets/opencode/commands/cc-openspec.md +13 -0
  129. package/presets/opencode/commands/cc-pagespeed.md +12 -0
  130. package/presets/opencode/commands/cc-prototype.md +37 -0
  131. package/presets/opencode/commands/cc-refactor.md +12 -0
  132. package/presets/opencode/commands/cc-review.md +12 -0
  133. package/presets/opencode/commands/cc-scorecard.md +12 -0
  134. package/presets/opencode/commands/cc-tdd-cycle.md +24 -0
  135. package/presets/opencode/commands/cc-test-plan.md +12 -0
  136. package/presets/opencode/commands/cc-triage.md +33 -0
  137. package/presets/opencode/gates/pre-commit/GATE.md +136 -0
  138. package/presets/opencode/prompts/v0.1.0/DEPRECATED.md +11 -0
  139. package/presets/opencode/prompts/v0.2.0/DEPRECATED.md +11 -0
  140. package/presets/opencode/prompts/v0.3.0/DEPRECATED.md +11 -0
  141. package/presets/opencode/prompts/v0.4.0/DEPRECATED.md +11 -0
  142. package/presets/opencode/prompts/v0.5.0/goal-planner.md +1 -1
  143. package/presets/opencode/prompts/v0.5.0/orchestrator.md +6 -6
  144. package/presets/opencode/prompts/v0.6.0/implementer.md +35 -0
  145. package/presets/opencode/prompts/v0.6.0/planner.md +36 -0
  146. package/presets/opencode/prompts/v0.6.0/reviewer.md +40 -0
  147. package/presets/opencode/prompts/v1.0.0/README.md +47 -0
  148. package/presets/opencode/prompts/v1.0.0/architect.md +259 -0
  149. package/presets/opencode/prompts/v1.0.0/complexity-auditor.md +116 -0
  150. package/presets/opencode/prompts/v1.0.0/contract-builder.md +120 -0
  151. package/presets/opencode/prompts/v1.0.0/devil.md +169 -0
  152. package/presets/opencode/prompts/v1.0.0/docs.md +229 -0
  153. package/presets/opencode/prompts/v1.0.0/goal-planner.md +123 -0
  154. package/presets/opencode/prompts/v1.0.0/implementer.md +228 -0
  155. package/presets/opencode/prompts/v1.0.0/orchestrator.md +474 -0
  156. package/presets/opencode/prompts/v1.0.0/planner.md +72 -0
  157. package/presets/opencode/prompts/v1.0.0/repo-explorer.md +147 -0
  158. package/presets/opencode/prompts/v1.0.0/reviewer.md +295 -0
  159. package/presets/opencode/prompts/v1.0.0/security-reviewer.md +170 -0
  160. package/presets/opencode/prompts/v1.0.0/task-coach.md +235 -0
  161. package/presets/opencode/prompts/v1.0.0/tester.md +298 -0
  162. package/presets/seo-hotel/settings.json +0 -17
  163. package/src/presets/manifests/agy.yml +2 -2
  164. package/src/presets/manifests/claude.yml +2 -2
  165. package/src/presets/manifests/codex.yml +2 -2
  166. package/src/presets/manifests/cursor.yml +2 -2
  167. package/src/presets/manifests/gemini.yml +2 -2
  168. package/src/presets/manifests/opencode.yml +2 -2
  169. package/src/presets/models/agy.yml +93 -66
  170. package/src/presets/models/claude.yml +79 -53
  171. package/src/presets/models/codex.yml +79 -54
  172. package/src/presets/models/cursor.yml +72 -58
  173. package/src/presets/models/gemini.yml +79 -53
  174. package/src/presets/models/opencode.yml +72 -46
@@ -0,0 +1,132 @@
1
+ ---
2
+ description: >-
3
+ [cc: alias] Run the advanced iterative workflow — Wayfinding AST discovery,
4
+ Relentless Grilling, contract and spec design, TDD, council review, and docs.
5
+ ---
6
+
7
+ # Advanced Iterative Workflow
8
+
9
+ Iterative request: $ARGUMENTS
10
+
11
+ ---
12
+
13
+ ## Step 0 — CCEP Bootstrap
14
+
15
+ Command: `iterative` (fixed for this workflow — do not infer from user text)
16
+
17
+ 1. Run: `npx cc-codeconductor ccep parse --command iterative "$ARGUMENTS" --output json`
18
+ 2. Run: `npx cc-codeconductor ccep resolve --command iterative "$ARGUMENTS" --output json`
19
+ 3. Run: `npx cc-codeconductor ccep profile iterative --output json`
20
+ 4. After planner/intake JSON is available, run: `npx cc-codeconductor ccep evaluate --command iterative --input <planner.json> --output json`. If `stop` is true, show questions or risks and wait for human input.
21
+ 5. Delegate to subagents using compiled CCEP prompts — never forward raw `$ARGUMENTS` to planners.
22
+ Canonical delivery order is test-before-implement whenever both phases apply.
23
+
24
+ ---
25
+
26
+ ## Step 1 — Wayfinding (Repo Explorer role)
27
+
28
+ If `graphify-out/graph.json` exists, run `graphify query "$ARGUMENTS"` (and
29
+ `graphify path` / `graphify explain` when two modules or one concept need a
30
+ scoped subgraph). Then adopt the **Repo Explorer** role as defined in
31
+ `CLAUDE.md` with that graph output.
32
+
33
+ Map directory trees, conventions, god nodes, and affected modules. Do not write
34
+ code in this step. Write a short phase handoff (scope, files, open questions)
35
+ before the next phase — do not chain agents on unspoken context.
36
+
37
+ ---
38
+
39
+ ## Step 2 — Relentless Grilling & Task Card (Task Coach role)
40
+
41
+ Adopt the **Task Coach** role as defined in `CLAUDE.md`.
42
+
43
+ Produce a complete Task Card. The Task Card is ready when it contains: title,
44
+ type, risk classification, scope, context, acceptance criteria, and
45
+ constraints, and every assumption behind it has survived one grilling
46
+ question (Grilling protocol).
47
+
48
+ If any field is missing or ambiguous, ask one clarifying question at a time and
49
+ wait for the answer. Do not proceed with an incomplete Task Card.
50
+
51
+ **STOP here.** Unresolved grilling questions or missing fields populate
52
+ `questionsForUser` in the CCEP-1 `planner-output`; the `ConfirmationGate`
53
+ (`ccep evaluate`) reads that field and halts the workflow until a human
54
+ answers. Show the completed Task Card and wait for that confirmation before
55
+ continuing.
56
+
57
+ ---
58
+
59
+ ## Step 3 — Contract & Technical Plan (Architect role)
60
+
61
+ Adopt the **Architect** role as defined in `CLAUDE.md`. Define contracts first,
62
+ then the Technical Plan.
63
+
64
+ 1. Define API contracts, JSON Schemas, or TypeScript interfaces.
65
+ 2. Formulate the Technical Plan (chosen approach, affected files, trade-offs).
66
+ 3. Apply YAGNI, Simplicity First, and Stdlib-First.
67
+
68
+ **STOP here. Show the Technical Plan and wait for explicit human approval. Do
69
+ not proceed to tests until the plan is approved.**
70
+
71
+ ---
72
+
73
+ ## Step 4 — Test coverage (Tester role)
74
+
75
+ Adopt the **Tester** role as defined in `CLAUDE.md`.
76
+
77
+ 1. Write or extend failing tests for the new behavior before implementation (RED).
78
+ 2. Ensure all acceptance criteria from the Task Card have at least one test.
79
+ 3. Produce a Test Report: test files added or modified, cases covered.
80
+
81
+ ---
82
+
83
+ ## Step 5 — Implementation (Implementer role)
84
+
85
+ Adopt the **Implementer** role as defined in `CLAUDE.md`.
86
+
87
+ Use the approved Technical Plan, contracts, and the failing tests.
88
+ Create a Git Worktree before touching any file; all edits happen inside it.
89
+
90
+ 1. Read the Technical Plan before touching any file.
91
+ 2. Apply the minimal diff — only what the plan specifies.
92
+ 3. Run the project test suite and make the previously written failing tests pass.
93
+ 4. If tests fail, run up to 3 repair cycles (Implementer → Tester).
94
+ 5. Produce an Implementation Summary: what changed, which files, how to verify
95
+ locally.
96
+
97
+ ---
98
+
99
+ ## Step 6 — Multi-Perspective Council Review
100
+
101
+ Invoke the `council` skill on the generated diff (`council-review` phase).
102
+
103
+ The council evaluates Architecture, Security, Product, Delivery, DataOps, and
104
+ Devil. `security-reviewer` may set `securityVeto: true`; that REJECTED verdict
105
+ overrides majority consensus.
106
+
107
+ If ANY agent votes CRITICAL:
108
+ - The Review Report status is **BLOCKED**.
109
+ - Return to Step 5 with the feedback.
110
+
111
+ If APPROVED (no CRITICAL findings), continue.
112
+
113
+ ---
114
+
115
+ ## Step 7 — Documentation (Docs role)
116
+
117
+ Adopt the **Docs** role as defined in `CLAUDE.md` when a public API, public
118
+ module, or user-visible behavior changed.
119
+
120
+ Update: README (if applicable), OpenAPI spec (if applicable), CHANGELOG
121
+ (always when implementation changed), ADR (if an architectural decision was
122
+ made).
123
+
124
+ If `graphify-out/` is in use, run `graphify update .` (AST-only).
125
+
126
+ ---
127
+
128
+ ## Completion
129
+
130
+ The iterative workflow is complete only when: all tests pass, the council
131
+ approves the spec and the diff, no CRITICAL findings remain, and documentation
132
+ and the knowledge graph reflect the implemented behavior.
@@ -12,6 +12,18 @@ Orchestrate FIFO delivery from `BACKLOG.md`. CodeConductor owns planning; agents
12
12
 
13
13
  ---
14
14
 
15
+ ## Planning Principles — tracer bullet and blocking edges
16
+
17
+ A **tracer bullet** is a vertical slice of work: one `BC-NNN` backlog item that goes discover → design → test → implement → review and produces a demoable result, sized to fit inside a single agent's context window without needing an intermediate `/clear`.
18
+
19
+ **Quantitative heuristic**: a tracer bullet must fit within a maximum of 5 acceptance criteria and the 5 canonical phases (discover, design, test, implement, review) per context window. If an item needs more, split it into multiple `BC-NNN` items linked by `Depends on` instead of growing one tracer bullet past that budget.
20
+
21
+ **Equivalence**: one `BC-NNN` item equals one tracer bullet equals one or more TaskCards. `cc openspec plan <BC-id>` generates the TaskCards (discover/design/test/implement/review) that implement that item's tracer bullet — each BC-NNN item corresponds to exactly one tracer bullet.
22
+
23
+ **Blocking edges**: the `Depends on` field between `BC-NNN` items expresses a blocking dependency — an item cannot be selected in Step 2 until every item in its `Depends on` list is `DONE`. `Depends on` is the sole mechanism for sequencing tracer bullets; there is no separate edge syntax.
24
+
25
+ ---
26
+
15
27
  ## Step 0 — Validate (mandatory gate)
16
28
 
17
29
  Run:
@@ -28,6 +40,19 @@ If validation fails:
28
40
 
29
41
  ---
30
42
 
43
+ ## Step 0 — CCEP Bootstrap
44
+
45
+ Command: `openspec` (fixed for this workflow — do not infer from user text)
46
+
47
+ 1. Run: `npx cc-codeconductor ccep parse --command openspec "$ARGUMENTS" --output json`
48
+ 2. Run: `npx cc-codeconductor ccep resolve --command openspec "$ARGUMENTS" --output json`
49
+ 3. Run: `npx cc-codeconductor ccep profile openspec --output json`
50
+ 4. After planner/intake JSON is available, run: `npx cc-codeconductor ccep evaluate --command openspec --input <planner.json> --output json`. If `stop` is true, show questions or risks and wait for human input.
51
+ 5. Delegate to subagents using compiled CCEP prompts — never forward raw `$ARGUMENTS` to planners.
52
+ Canonical delivery order is test-before-implement whenever both phases apply.
53
+
54
+ ---
55
+
31
56
  ## Step 1 — Scan
32
57
 
33
58
  Run:
@@ -4,6 +4,18 @@ Audit web performance using the PageSpeed Insights API. Applies the 80/20
4
4
  principle: identify the 20% of changes that produce 80% of the performance gain.
5
5
  Produces a prioritized report in the current working directory.
6
6
 
7
+ ## Step 0 — CCEP Bootstrap
8
+
9
+ Command: `pagespeed` (fixed for this workflow — do not infer from user text)
10
+
11
+ 1. Run: `npx cc-codeconductor ccep parse --command pagespeed "$ARGUMENTS" --output json`
12
+ 2. Run: `npx cc-codeconductor ccep resolve --command pagespeed "$ARGUMENTS" --output json`
13
+ 3. Run: `npx cc-codeconductor ccep profile pagespeed --output json`
14
+ 4. After planner/intake JSON is available, run: `npx cc-codeconductor ccep evaluate --command pagespeed --input <planner.json> --output json`. If `stop` is true, show questions or risks and wait for human input.
15
+ 5. Delegate to subagents using compiled CCEP prompts — never forward raw `$ARGUMENTS` to planners.
16
+
17
+ ---
18
+
7
19
  ## Usage
8
20
 
9
21
  ```
@@ -0,0 +1,38 @@
1
+ ---
2
+ description: >-
3
+ [cc: alias] Disposable spike in an isolated worktree. Not a merge candidate.
4
+ ---
5
+
6
+ # Prototype Workflow
7
+
8
+ Prototype request: $ARGUMENTS
9
+
10
+ ## Step 0 — CCEP Bootstrap
11
+
12
+ Command: `prototype` (fixed for this workflow — do not infer from user text)
13
+
14
+ 1. Run: `npx cc-codeconductor ccep parse --command prototype "$ARGUMENTS" --output json`
15
+ 2. Run: `npx cc-codeconductor ccep resolve --command prototype "$ARGUMENTS" --output json`
16
+ 3. Run: `npx cc-codeconductor ccep profile prototype --output json`
17
+ 4. After planner/intake JSON is available, run: `npx cc-codeconductor ccep evaluate --command prototype --input <planner.json> --output json`. If `stop` is true, show questions or risks and wait for human input.
18
+ 5. Delegate to subagents using compiled CCEP prompts — never forward raw `$ARGUMENTS` to planners.
19
+
20
+ ---
21
+
22
+ ## Step 1 — Bounds (architect)
23
+
24
+ Invoke `architect`. Define what the spike may touch, time-box, and what must not leak into main. Do not treat this as a production Technical Plan.
25
+
26
+ **STOP here. Wait for approval of the spike bounds.**
27
+
28
+ ---
29
+
30
+ ## Step 2 — Spike (implementer)
31
+
32
+ Invoke `implementer` in a Git worktree that is not a merge candidate. Label the Implementation Summary as disposable. Do not open a PR against protected branches.
33
+
34
+ ---
35
+
36
+ ## Completion
37
+
38
+ Report bounds, worktree path, and what was learned. Recommend `/cc:feature` or `/cc:fix` if the spike should become real work.
@@ -33,6 +33,18 @@ If coverage is insufficient:
33
33
 
34
34
  ---
35
35
 
36
+ ## Step 0 — CCEP Bootstrap
37
+
38
+ Command: `refactor` (fixed for this workflow — do not infer from user text)
39
+
40
+ 1. Run: `npx cc-codeconductor ccep parse --command refactor "$ARGUMENTS" --output json`
41
+ 2. Run: `npx cc-codeconductor ccep resolve --command refactor "$ARGUMENTS" --output json`
42
+ 3. Run: `npx cc-codeconductor ccep profile refactor --output json`
43
+ 4. After planner/intake JSON is available, run: `npx cc-codeconductor ccep evaluate --command refactor --input <planner.json> --output json`. If `stop` is true, show questions or risks and wait for human input.
44
+ 5. Delegate to subagents using compiled CCEP prompts — never forward raw `$ARGUMENTS` to planners.
45
+
46
+ ---
47
+
36
48
  ## Step 1 — Architectural justification (Architect role)
37
49
 
38
50
  Adopt the **Architect** role as defined in `CLAUDE.md`. Always invoke this step
@@ -56,6 +68,141 @@ proceed without written approval of the plan.**
56
68
 
57
69
  ---
58
70
 
71
+ ## Step 1.5 — Blast Radius Assessment (Orchestrator role)
72
+
73
+ After Architect approval, assess the scope of the refactor using impact analysis.
74
+ Large refactors require staged sequencing to keep the tree green between batches.
75
+
76
+ ### When to apply Blast Radius Assessment
77
+
78
+ Always run this step. It determines the route for implementation:
79
+
80
+ - **Narrow refactor** (blast radius within limits) → proceed to Step 2 (normal routing by risk)
81
+ - **Wide refactor** (blast radius exceeds limits) → proceed to expand-migrate-contract sequence
82
+
83
+ ### Measuring blast radius
84
+
85
+ Run impact analysis on the files listed in the approved Refactor Plan:
86
+
87
+ ```bash
88
+ cc impact --files <file1> <file2> ... <fileN>
89
+ ```
90
+
91
+ The report returns three metrics:
92
+
93
+ 1. **affectedComponents** (array of strings) — distinct components/modules that depend on the refactored files
94
+ 2. **brokenContracts** (array of strings) — public interfaces or contracts that change
95
+ 3. **affectedFlows** (array of strings) — end-to-end user flows or business processes impacted
96
+
97
+ ### Threshold decision
98
+
99
+ **Hardcoded heuristic thresholds** (adjust manually for your codebase size):
100
+
101
+ ```
102
+ Wide refactor triggered if ANY condition is true:
103
+ - affectedComponents.length >= 6
104
+ - brokenContracts.length >= 3
105
+ - affectedFlows.length >= 2
106
+ ```
107
+
108
+ If blast radius exceeds these thresholds, the refactor is classified as **wide**
109
+ and requires staged batching. Otherwise, it is **narrow** and proceeds via
110
+ normal risk-based routing.
111
+
112
+ **Note:** These thresholds are heuristics meant for medium-sized codebases
113
+ (5–20K lines). Adjust based on your repository's complexity and component
114
+ density. A high-level import count alone does not guarantee impact.
115
+
116
+ ### Route: Narrow refactor
117
+
118
+ If blast radius is within limits:
119
+
120
+ 1. Show the impact report: affectedComponents count, brokenContracts, affectedFlows.
121
+ 2. Proceed to Step 2 (Route by risk) using the risk level from the approved Refactor Plan.
122
+
123
+ ### Route: Wide refactor — expand-migrate-contract sequence
124
+
125
+ If blast radius exceeds limits, the refactor must be delivered in sequenced
126
+ batches to maintain tree-green guarantees between phases.
127
+
128
+ **Process:**
129
+
130
+ 1. **Expand phase** (batch 1): Introduce the new interface alongside the old one
131
+ without removing the old interface. This allows consumers to adopt
132
+ incrementally. Tests for both old and new paths must pass in this batch.
133
+
134
+ Example: If refactoring a component from function-based to class-based:
135
+ ```typescript
136
+ // OLD: function-based API (keep during expand)
137
+ export function transformData(input: Data): Output {
138
+ return Transform.apply(input);
139
+ }
140
+
141
+ // NEW: class-based API (add during expand)
142
+ export class DataTransformer {
143
+ apply(input: Data): Output {
144
+ return Transform.apply(input);
145
+ }
146
+ }
147
+
148
+ // Both exported; both tested; old not yet removed.
149
+ ```
150
+
151
+ 2. **Migrate batches** (batches 2–N): Each batch moves a logical subset of
152
+ consumers from the old interface to the new one, running tests to confirm
153
+ no regressions. If tests fail in any migrate batch, that batch is BLOCKED
154
+ (via `Depends on` in BACKLOG.md) and subsequent batches do not start until
155
+ the regression is fixed.
156
+
157
+ Example: Migrate Service-A consumers in batch 2, Service-B consumers in
158
+ batch 3, etc. Each batch is a separate `BC-NNN` item in BACKLOG.md.
159
+
160
+ 3. **Contract phase** (final batch): Remove the old interface entirely after all
161
+ consumers are migrated. This is the point where the contract actually changes.
162
+
163
+ **Sequencing batches via BACKLOG.md:**
164
+
165
+ Create multiple `BC-NNN` items, one per batch (expand, then one per migrate, then
166
+ contract). Use the `Depends on` field to enforce ordering:
167
+
168
+ ```
169
+ ### BC-001 | Expand Phase
170
+ Status: READY
171
+ Depends on: (none)
172
+ Description: Introduce new interface alongside old...
173
+
174
+ ### BC-002 | Migrate Batch 1 (Service-A consumers)
175
+ Status: READY (but not eligible until BC-001 done)
176
+ Depends on: BC-001
177
+ Description: Move Service-A from old to new interface...
178
+
179
+ ### BC-003 | Migrate Batch 2 (Service-B consumers)
180
+ Status: READY (but not eligible until BC-002 done)
181
+ Depends on: BC-002
182
+ Description: Move Service-B from old to new interface...
183
+
184
+ ### BC-004 | Contract Phase (Remove old interface)
185
+ Status: READY (but not eligible until BC-003 done)
186
+ Depends on: BC-003
187
+ Description: Delete old interface and consolidate tests...
188
+ ```
189
+
190
+ **BLOCKED policy on test failures:**
191
+
192
+ If any migrate batch's test suite fails after implementation, that batch item
193
+ is marked BLOCKED (and stays BLOCKED in BACKLOG.md until the regression is
194
+ fixed). Subsequent batches in the `Depends on` chain do not start — the
195
+ orchestrator skips them and reports the blocker to the user.
196
+
197
+ This ensures the tree remains green and no downstream consumer migration builds
198
+ on unstable code.
199
+
200
+ **STOP here. Show the Blast Radius Assessment report and the recommended route
201
+ (narrow or wide). If wide, show the proposed batch structure and wait for
202
+ user approval before proceeding.**
203
+
204
+ ---
205
+
59
206
  ## Step 2 — Route by risk
60
207
 
61
208
  Read the risk field from the Refactor Plan and follow the corresponding route.
@@ -140,9 +287,13 @@ findings block completion.
140
287
 
141
288
  ## Completion
142
289
 
143
- Report: Refactor Plan (approved), Implementation Summary, test results before
290
+ Report: Refactor Plan (approved), Blast Radius Assessment (if applicable), Implementation Summary, test results before
144
291
  and after, Review Report (if applicable).
145
292
 
146
293
  The refactor is complete only when: all pre-existing tests still pass, the
147
294
  implementation matches the approved plan exactly, and no CRITICAL review
148
295
  findings remain.
296
+
297
+ If using expand-migrate-contract: completion occurs only after all batches
298
+ (expand, migrate, contract) are DONE and no BLOCKED items remain in the
299
+ sequencing chain.
@@ -17,6 +17,18 @@ Specify what to review. Accepted formats:
17
17
 
18
18
  ---
19
19
 
20
+ ## Step 0 — CCEP Bootstrap
21
+
22
+ Command: `review` (fixed for this workflow — do not infer from user text)
23
+
24
+ 1. Run: `npx cc-codeconductor ccep parse --command review "$ARGUMENTS" --output json`
25
+ 2. Run: `npx cc-codeconductor ccep resolve --command review "$ARGUMENTS" --output json`
26
+ 3. Run: `npx cc-codeconductor ccep profile review --output json`
27
+ 4. After planner/intake JSON is available, run: `npx cc-codeconductor ccep evaluate --command review --input <planner.json> --output json`. If `stop` is true, show questions or risks and wait for human input.
28
+ 5. Delegate to subagents using compiled CCEP prompts — never forward raw `$ARGUMENTS` to planners.
29
+
30
+ ---
31
+
20
32
  ## Step 1 — Diff collection
21
33
 
22
34
  Before adopting the Reviewer role, collect the diff for the specified target.
@@ -45,7 +57,33 @@ Show the diff summary (files changed, lines added/removed) before proceeding.
45
57
 
46
58
  Adopt the **Reviewer** role as defined in `CLAUDE.md`.
47
59
 
48
- Evaluate the diff against the following checklist:
60
+ Execute two axes in **parallel** without reranking between them, via separate sub-agents:
61
+
62
+ **Standards Axis** — Code smell detection against Fowler baseline with documented override:
63
+
64
+ - Long Method
65
+ - Large Class
66
+ - Duplicated Code
67
+ - Feature Envy
68
+ - Shotgun Surgery
69
+ - Primitive Obsession
70
+ - Data Clumps
71
+ - Switch Statements
72
+ - Speculative Generality
73
+ - Temporary Fields
74
+ - Message Chains
75
+ - Middle Man
76
+ - Inappropriate Intimacy
77
+ - Data Class
78
+ - Comments-as-apology
79
+
80
+ **Spec Axis** — Task Card, acceptance criteria, and scope validation:
81
+
82
+ - Does the implementation match the stated intent from the Task Card?
83
+ - Are all acceptance criteria addressed?
84
+ - Are there changes outside the stated scope?
85
+
86
+ **Combined sub-checks** (apply findings from both axes):
49
87
 
50
88
  **Correctness**
51
89
 
@@ -77,31 +115,45 @@ Evaluate the diff against the following checklist:
77
115
  - Are public interfaces documented?
78
116
  - Is CHANGELOG updated if behavior changed?
79
117
 
80
- ---
81
-
82
118
  ## Step 3 — Review Report
83
119
 
84
- Produce a structured Review Report with findings in three categories:
120
+ Produce a structured Review Report combining findings from both Standards and Spec axes (executed in parallel without reranking):
85
121
 
86
122
  ```markdown
87
123
  ## Review Report
88
124
 
89
- ### CRITICAL
90
- [Findings that must be fixed before merge — file:line, description, suggested resolution]
125
+ **Task**: [objective from Task Card] **Verdict**: [approved | approved with warnings | blocked]
126
+
127
+ ---
128
+
129
+ ### Standards Axis
130
+
131
+ Findings from Fowler code smell baseline evaluation (with documented overrides applied).
132
+
133
+ - [ ] [S1] [file:line] — [code smell type] | Override: [documented or N/A] | Required action: [change needed] (CRITICAL) or Recommended action: [change needed] (WARNING)
134
+
135
+ _(none)_ if no code smell findings
136
+
137
+ ### Spec Axis
138
+
139
+ Findings from Task Card, acceptance criteria, and scope alignment.
91
140
 
92
- ### WARNING
93
- [Findings that should be resolved before merge — same format as CRITICAL]
141
+ - [ ] [Sp1] [criterion] — [description] | Evidence: [quote] | Required action: [change needed] (CRITICAL) or Recommended action: [change needed] (WARNING)
94
142
 
95
- ### SUGGESTION
96
- [Optional improvements — style, readability, future-proofing. These do not block merge.]
143
+ _(none)_ if no spec findings
97
144
 
98
- ### Summary
99
- - Files reviewed: N
100
- - Total findings: N (X critical, Y warnings, Z suggestions)
101
- - Merge recommendation: APPROVED | BLOCKED
145
+ ### Combined Summary
146
+
147
+ - Standards findings: [count] (X CRITICAL, Y WARNING, Z SUGGESTION)
148
+ - Spec findings: [count] (X CRITICAL, Y WARNING, Z SUGGESTION)
149
+ - **Combined Verdict**: [approved | approved with warnings | blocked]
150
+ - **Verdict justification**: [one sentence explaining the combined decision]
102
151
  ```
103
152
 
104
- ---
153
+ Verdict mapping from parallel axes (no reranking):
154
+ - If either axis has CRITICAL → verdict is `blocked`
155
+ - Else if either axis has WARNING → verdict is `approved with warnings`
156
+ - Else → verdict is `approved`
105
157
 
106
158
  ## Step 4 — Merge decision
107
159
 
@@ -128,10 +180,20 @@ Deliver the complete Review Report. Never summarize or omit findings.
128
180
 
129
181
  ## Step 5 — Scorecard and outcome
130
182
 
183
+ Record the review outcome via scorecard with explicit verdict mapping:
184
+
131
185
  ```bash
132
186
  npx cc-codeconductor scorecard create --from-diff --agent reviewer
133
187
  npx cc-codeconductor scorecard record --verdict PASS|REVISE|REJECT --score <weighted>
134
188
  npx cc-codeconductor scorecard regression
135
189
  ```
136
190
 
137
- Map merge recommendation to scorecard verdict. Record outcome for trend tracking.
191
+ **Verdict Mapping** (combined Standards + Spec axes):
192
+
193
+ - `approved` → `npx cc-codeconductor scorecard record --verdict PASS`
194
+ - `approved with warnings` → `npx cc-codeconductor scorecard record --verdict REVISE`
195
+ - `blocked` → `npx cc-codeconductor scorecard record --verdict REJECT`
196
+
197
+ Example: if the combined verdict is `blocked` (either axis found CRITICAL), record with `--verdict REJECT`.
198
+
199
+ Map each review outcome for trend tracking and decision audit.
@@ -10,6 +10,18 @@ Scope: $ARGUMENTS
10
10
 
11
11
  ---
12
12
 
13
+ ## Step 0 — CCEP Bootstrap
14
+
15
+ Command: `scorecard` (fixed for this workflow — do not infer from user text)
16
+
17
+ 1. Run: `npx cc-codeconductor ccep parse --command scorecard "$ARGUMENTS" --output json`
18
+ 2. Run: `npx cc-codeconductor ccep resolve --command scorecard "$ARGUMENTS" --output json`
19
+ 3. Run: `npx cc-codeconductor ccep profile scorecard --output json`
20
+ 4. After planner/intake JSON is available, run: `npx cc-codeconductor ccep evaluate --command scorecard --input <planner.json> --output json`. If `stop` is true, show questions or risks and wait for human input.
21
+ 5. Delegate to subagents using compiled CCEP prompts — never forward raw `$ARGUMENTS` to planners.
22
+
23
+ ---
24
+
13
25
  ## Step 1 — Identify task
14
26
 
15
27
  Use `$ARGUMENTS` as task id (e.g. `BC-001`) or read active item from `npx cc-codeconductor openspec status`.
@@ -18,6 +18,19 @@ Describe what behavior you want to implement. Include:
18
18
 
19
19
  ---
20
20
 
21
+ ## Step 0 — CCEP Bootstrap
22
+
23
+ Command: `tdd-cycle` (fixed for this workflow — do not infer from user text)
24
+
25
+ 1. Run: `npx cc-codeconductor ccep parse --command tdd-cycle "$ARGUMENTS" --output json`
26
+ 2. Run: `npx cc-codeconductor ccep resolve --command tdd-cycle "$ARGUMENTS" --output json`
27
+ 3. Run: `npx cc-codeconductor ccep profile tdd-cycle --output json`
28
+ 4. After planner/intake JSON is available, run: `npx cc-codeconductor ccep evaluate --command tdd-cycle --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
+
21
34
  ## Before you begin — mandatory pre-check
22
35
 
23
36
  This command enforces strict TDD discipline. The three phases are sequential and
@@ -30,13 +43,38 @@ non-negotiable:
30
43
  Do not write implementation code during RED. Do not refactor during GREEN.
31
44
  Mixing phases invalidates the cycle.
32
45
 
46
+ ## Verifiable phase gates
47
+
48
+ RED → GREEN and GREEN → REFACTOR are enforced by `tddCycleStateMachine` in
49
+ `domain/loop`. Evidence must be captured with `captureTddSuiteEvidence` (verification
50
+ runner) — do not hand-edit JSON under `.codeconductor/evidence/`.
51
+
52
+ - RED→GREEN requires runner evidence that the suite **failed**.
53
+ - GREEN→REFACTOR requires runner evidence that the suite **passed**.
54
+
55
+ Do not advance phases until that evidence exists.
56
+
57
+ Each cycle covers a single vertical slice of behavior — one cycle, one
58
+ behavior — and follows red-before-green: RED must complete before GREEN
59
+ starts.
60
+
33
61
  ---
34
62
 
35
63
  ## Phase 1 — RED (Tester role)
36
64
 
37
65
  Adopt the **Tester** role as defined in `CLAUDE.md`.
38
66
 
39
- ### 1a — Scope clarification
67
+ ### 1a — Agree on the seam
68
+
69
+ Before writing any test, identify and state the seam — the point where the
70
+ behavior under test can be exercised and observed in isolation (a function
71
+ boundary, an interface, an injectable dependency). Confirm the seam does not
72
+ require reaching into implementation internals.
73
+
74
+ If no seam exists yet (the code is not structured to allow isolated testing),
75
+ say so and agree on the minimal seam to introduce before continuing.
76
+
77
+ ### 1b — Scope clarification
40
78
 
41
79
  Before writing any test, confirm:
42
80
 
@@ -47,7 +85,7 @@ Before writing any test, confirm:
47
85
 
48
86
  If the scope is ambiguous, ask one clarifying question and wait for the answer.
49
87
 
50
- ### 1b — Write the failing test
88
+ ### 1c — Write the failing test
51
89
 
52
90
  Write a test that:
53
91
 
@@ -61,7 +99,19 @@ Write a test that:
61
99
  Do not write the implementation. Do not make the test pass by any means other
62
100
  than the implementation that will follow in Phase 2.
63
101
 
64
- ### 1cRun the test suite and confirm RED
102
+ ### 1dAnti-pattern checklist
103
+
104
+ Before declaring the test ready, verify none of these anti-patterns apply:
105
+
106
+ - **Implementation-coupled** — asserts internal details instead of observable
107
+ behavior.
108
+ - **Tautological** — cannot fail given the test's own setup.
109
+ - **Horizontal slicing** — spans multiple unrelated behaviors instead of one
110
+ vertical slice.
111
+
112
+ If any anti-pattern applies, rewrite the test before continuing.
113
+
114
+ ### 1e — Run the test suite and confirm RED
65
115
 
66
116
  Run the test suite. The new test must fail. Existing tests must pass.
67
117
 
@@ -20,6 +20,18 @@ proceeding.
20
20
 
21
21
  ---
22
22
 
23
+ ## Step 0 — CCEP Bootstrap
24
+
25
+ Command: `test-plan` (fixed for this workflow — do not infer from user text)
26
+
27
+ 1. Run: `npx cc-codeconductor ccep parse --command test-plan "$ARGUMENTS" --output json`
28
+ 2. Run: `npx cc-codeconductor ccep resolve --command test-plan "$ARGUMENTS" --output json`
29
+ 3. Run: `npx cc-codeconductor ccep profile test-plan --output json`
30
+ 4. After planner/intake JSON is available, run: `npx cc-codeconductor ccep evaluate --command test-plan --input <planner.json> --output json`. If `stop` is true, show questions or risks and wait for human input.
31
+ 5. Delegate to subagents using compiled CCEP prompts — never forward raw `$ARGUMENTS` to planners.
32
+
33
+ ---
34
+
23
35
  ## Step 1 — Scope confirmation
24
36
 
25
37
  Before generating the test plan, confirm the scope is well-defined.