codebyplan 1.5.1 → 1.9.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 (211) hide show
  1. package/dist/cli.js +4462 -748
  2. package/package.json +5 -1
  3. package/templates/.gitkeep +0 -0
  4. package/templates/README.md +20 -0
  5. package/templates/agents/cbp-cc-executor.md +213 -0
  6. package/templates/agents/cbp-database-agent.md +229 -0
  7. package/templates/agents/cbp-improve-claude.md +245 -0
  8. package/templates/agents/cbp-improve-round.md +284 -0
  9. package/templates/agents/cbp-mechanical-edits.md +111 -0
  10. package/templates/agents/cbp-research.md +282 -0
  11. package/templates/agents/cbp-round-executor.md +604 -0
  12. package/templates/agents/cbp-security-agent.md +134 -0
  13. package/templates/agents/cbp-task-check.md +213 -0
  14. package/templates/agents/cbp-task-planner.md +582 -0
  15. package/templates/agents/cbp-test-e2e-agent.md +363 -0
  16. package/templates/agents/cbp-testing-qa-agent.md +400 -0
  17. package/templates/context/mcp-docs.md +139 -0
  18. package/templates/hooks/README.md +236 -0
  19. package/templates/hooks/cbp-auto-test-hooks.sh +44 -0
  20. package/templates/hooks/cbp-lint-format-on-edit.sh +159 -0
  21. package/templates/hooks/cbp-maestro-yaml-validate.sh +100 -0
  22. package/templates/hooks/cbp-mcp-migration-guard.sh +32 -0
  23. package/templates/hooks/cbp-mcp-round-sync.sh +79 -0
  24. package/templates/hooks/cbp-mcp-worktree-inject.sh +76 -0
  25. package/templates/hooks/cbp-notify.sh +68 -0
  26. package/templates/hooks/cbp-plugin-dispatch.sh +29 -0
  27. package/templates/hooks/cbp-pre-commit-quality-gate.sh +204 -0
  28. package/templates/hooks/cbp-statusline.sh +347 -0
  29. package/templates/hooks/cbp-subagent-statusline.sh +182 -0
  30. package/templates/hooks/cbp-test-coverage-gate.sh +144 -0
  31. package/templates/hooks/cbp-test-hooks.sh +320 -0
  32. package/templates/hooks/hooks.json +85 -0
  33. package/templates/hooks/validate-context-usage.sh +59 -0
  34. package/templates/hooks/validate-git-commit.sh +78 -0
  35. package/templates/hooks/validate-git-stash-deny.sh +32 -0
  36. package/templates/hooks/validate-structure-lengths.sh +57 -0
  37. package/templates/hooks/validate-structure-lib.sh +104 -0
  38. package/templates/hooks/validate-structure-patterns.sh +54 -0
  39. package/templates/hooks/validate-structure-scope.sh +33 -0
  40. package/templates/hooks/validate-structure-smoke.sh +95 -0
  41. package/templates/hooks/validate-structure-templates.sh +34 -0
  42. package/templates/hooks/validate-structure.sh +69 -0
  43. package/templates/rules/.gitkeep +0 -0
  44. package/templates/rules/README.md +47 -0
  45. package/templates/rules/context-file-loading.md +52 -0
  46. package/templates/rules/scope-vocabulary.md +64 -0
  47. package/templates/rules/todo-backend.md +109 -0
  48. package/templates/settings.project.base.json +55 -0
  49. package/templates/settings.user.base.json +25 -0
  50. package/templates/skills/cbp-build-cc-agent/SKILL.md +139 -0
  51. package/templates/skills/cbp-build-cc-agent/examples/read-only-reviewer.md +32 -0
  52. package/templates/skills/cbp-build-cc-agent/examples/with-hooks.md +41 -0
  53. package/templates/skills/cbp-build-cc-agent/examples/with-skills-preload.md +25 -0
  54. package/templates/skills/cbp-build-cc-agent/reference/cbp-quality.md +153 -0
  55. package/templates/skills/cbp-build-cc-agent/reference/frontmatter-fields.md +37 -0
  56. package/templates/skills/cbp-build-cc-agent/reference/permission-modes.md +18 -0
  57. package/templates/skills/cbp-build-cc-agent/scripts/validate-agent.sh +67 -0
  58. package/templates/skills/cbp-build-cc-agent/templates/agent.md +66 -0
  59. package/templates/skills/cbp-build-cc-claude-file/SKILL.md +178 -0
  60. package/templates/skills/cbp-build-cc-claude-file/examples/minimal-project.md +33 -0
  61. package/templates/skills/cbp-build-cc-claude-file/examples/monorepo-with-imports.md +39 -0
  62. package/templates/skills/cbp-build-cc-claude-file/reference/imports.md +72 -0
  63. package/templates/skills/cbp-build-cc-claude-file/reference/what-belongs.md +39 -0
  64. package/templates/skills/cbp-build-cc-claude-file/templates/project-claude-md.md +48 -0
  65. package/templates/skills/cbp-build-cc-claude-file/templates/user-claude-md.md +22 -0
  66. package/templates/skills/cbp-build-cc-memory/SKILL.md +201 -0
  67. package/templates/skills/cbp-build-cc-memory/examples/feedback-memory.md +11 -0
  68. package/templates/skills/cbp-build-cc-memory/examples/project-memory.md +11 -0
  69. package/templates/skills/cbp-build-cc-memory/examples/reference-memory.md +13 -0
  70. package/templates/skills/cbp-build-cc-memory/examples/user-memory.md +14 -0
  71. package/templates/skills/cbp-build-cc-memory/reference/memory-types.md +59 -0
  72. package/templates/skills/cbp-build-cc-memory/reference/when-to-save.md +62 -0
  73. package/templates/skills/cbp-build-cc-memory/templates/MEMORY-index.md +4 -0
  74. package/templates/skills/cbp-build-cc-memory/templates/memory-entry.md +15 -0
  75. package/templates/skills/cbp-build-cc-mode/SKILL.md +99 -0
  76. package/templates/skills/cbp-build-cc-rule/SKILL.md +176 -0
  77. package/templates/skills/cbp-build-cc-rule/examples/global-rule.md +19 -0
  78. package/templates/skills/cbp-build-cc-rule/examples/scoped-rule.md +41 -0
  79. package/templates/skills/cbp-build-cc-rule/reference/paths-patterns.md +48 -0
  80. package/templates/skills/cbp-build-cc-rule/templates/rule.md +32 -0
  81. package/templates/skills/cbp-build-cc-settings/SKILL.md +220 -0
  82. package/templates/skills/cbp-build-cc-settings/examples/hooks-config.json +64 -0
  83. package/templates/skills/cbp-build-cc-settings/examples/permissions-config.json +34 -0
  84. package/templates/skills/cbp-build-cc-settings/examples/sandbox-config.json +42 -0
  85. package/templates/skills/cbp-build-cc-settings/reference/cbp-conventions.md +104 -0
  86. package/templates/skills/cbp-build-cc-settings/reference/permission-rules.md +61 -0
  87. package/templates/skills/cbp-build-cc-settings/reference/scope-precedence.md +73 -0
  88. package/templates/skills/cbp-build-cc-settings/reference/settings-fields.md +166 -0
  89. package/templates/skills/cbp-build-cc-settings/templates/settings.json +23 -0
  90. package/templates/skills/cbp-build-cc-settings/templates/settings.local.json +10 -0
  91. package/templates/skills/cbp-build-cc-skill/SKILL.md +154 -0
  92. package/templates/skills/cbp-build-cc-skill/examples/dynamic-context.md +31 -0
  93. package/templates/skills/cbp-build-cc-skill/examples/fork-skill.md +22 -0
  94. package/templates/skills/cbp-build-cc-skill/examples/knowledge-skill.md +25 -0
  95. package/templates/skills/cbp-build-cc-skill/examples/task-skill.md +29 -0
  96. package/templates/skills/cbp-build-cc-skill/reference/cbp-quality.md +157 -0
  97. package/templates/skills/cbp-build-cc-skill/reference/frontmatter-fields.md +35 -0
  98. package/templates/skills/cbp-build-cc-skill/reference/string-substitutions.md +60 -0
  99. package/templates/skills/cbp-build-cc-skill/scripts/validate-skill.sh +90 -0
  100. package/templates/skills/cbp-build-cc-skill/templates/skill.md +51 -0
  101. package/templates/skills/cbp-checkpoint-check/SKILL.md +156 -0
  102. package/templates/skills/cbp-checkpoint-complete/SKILL.md +109 -0
  103. package/templates/skills/cbp-checkpoint-create/SKILL.md +116 -0
  104. package/templates/skills/cbp-checkpoint-end/SKILL.md +241 -0
  105. package/templates/skills/cbp-checkpoint-plan/SKILL.md +137 -0
  106. package/templates/skills/cbp-checkpoint-plan/reference/alternative-comparison-template.md +54 -0
  107. package/templates/skills/cbp-checkpoint-plan/reference/dep-decision-rubric.md +50 -0
  108. package/templates/skills/cbp-checkpoint-plan/reference/e2e-discovery-probe.md +57 -0
  109. package/templates/skills/cbp-checkpoint-plan/reference/gap-analysis-playbook.md +47 -0
  110. package/templates/skills/cbp-checkpoint-start/SKILL.md +84 -0
  111. package/templates/skills/cbp-checkpoint-update/SKILL.md +115 -0
  112. package/templates/skills/cbp-frontend-a11y/SKILL.md +109 -0
  113. package/templates/skills/cbp-frontend-a11y/reference/aria-roles-states.md +130 -0
  114. package/templates/skills/cbp-frontend-a11y/reference/contrast-visual.md +122 -0
  115. package/templates/skills/cbp-frontend-a11y/reference/keyboard-patterns.md +154 -0
  116. package/templates/skills/cbp-frontend-a11y/reference/semantic-html.md +111 -0
  117. package/templates/skills/cbp-frontend-design/SKILL.md +145 -0
  118. package/templates/skills/cbp-frontend-design/reference/nextjs-scss.md +118 -0
  119. package/templates/skills/cbp-frontend-design/reference/rn-expo.md +101 -0
  120. package/templates/skills/cbp-frontend-design/reference/tauri-react.md +82 -0
  121. package/templates/skills/cbp-frontend-ui/SKILL.md +262 -0
  122. package/templates/skills/cbp-frontend-ui/reference/ui-label-maps.md +42 -0
  123. package/templates/skills/cbp-frontend-ui/reference/ui-layout-patterns.md +105 -0
  124. package/templates/skills/cbp-frontend-ui/reference/variant-defaults.md +149 -0
  125. package/templates/skills/cbp-frontend-ux/SKILL.md +181 -0
  126. package/templates/skills/cbp-git-branch-feat-create/SKILL.md +115 -0
  127. package/templates/skills/cbp-git-commit/SKILL.md +278 -0
  128. package/templates/skills/cbp-git-worktree-create/SKILL.md +226 -0
  129. package/templates/skills/cbp-git-worktree-remove/SKILL.md +145 -0
  130. package/templates/skills/cbp-merge-main/SKILL.md +228 -0
  131. package/templates/skills/cbp-round-check/SKILL.md +104 -0
  132. package/templates/skills/cbp-round-end/SKILL.md +183 -0
  133. package/templates/skills/cbp-round-end/reference/findings-presentation.md +44 -0
  134. package/templates/skills/cbp-round-end/reference/inline-fallback.md +35 -0
  135. package/templates/skills/cbp-round-execute/SKILL.md +211 -0
  136. package/templates/skills/cbp-round-execute/reference/inline-fallback.md +59 -0
  137. package/templates/skills/cbp-round-input/SKILL.md +165 -0
  138. package/templates/skills/cbp-round-start/SKILL.md +222 -0
  139. package/templates/skills/cbp-round-update/SKILL.md +163 -0
  140. package/templates/skills/cbp-session-end/SKILL.md +187 -0
  141. package/templates/skills/cbp-session-start/SKILL.md +155 -0
  142. package/templates/skills/cbp-ship/SKILL.md +332 -0
  143. package/templates/skills/cbp-ship/reference/changesets-overview.md +120 -0
  144. package/templates/skills/cbp-ship/reference/eas-cli-overview.md +60 -0
  145. package/templates/skills/cbp-ship/reference/gh-cli-overview.md +135 -0
  146. package/templates/skills/cbp-ship/reference/gh-cli-shipment-commands.md +283 -0
  147. package/templates/skills/cbp-ship/reference/npm-publish-monorepo.md +252 -0
  148. package/templates/skills/cbp-ship/reference/npm-publish-oidc-trusted.md +157 -0
  149. package/templates/skills/cbp-ship/reference/npm-publish-overview.md +171 -0
  150. package/templates/skills/cbp-ship/reference/preflight-checklist.md +88 -0
  151. package/templates/skills/cbp-ship/reference/railway-nestjs-deployment.md +169 -0
  152. package/templates/skills/cbp-ship/reference/railway-overview.md +120 -0
  153. package/templates/skills/cbp-ship/reference/railway-troubleshooting.md +168 -0
  154. package/templates/skills/cbp-ship/reference/release-please-overview.md +99 -0
  155. package/templates/skills/cbp-ship/reference/surface-expo-eas.md +155 -0
  156. package/templates/skills/cbp-ship/reference/surface-npm.md +180 -0
  157. package/templates/skills/cbp-ship/reference/surface-railway.md +152 -0
  158. package/templates/skills/cbp-ship/reference/surface-supabase.md +178 -0
  159. package/templates/skills/cbp-ship/reference/surface-tauri.md +138 -0
  160. package/templates/skills/cbp-ship/reference/surface-vercel.md +124 -0
  161. package/templates/skills/cbp-ship/reference/surface-vscode-ext.md +144 -0
  162. package/templates/skills/cbp-ship/reference/surfaces.md +60 -0
  163. package/templates/skills/cbp-ship/reference/testflight-automation.md +215 -0
  164. package/templates/skills/cbp-ship/reference/testflight-internal-vs-external.md +69 -0
  165. package/templates/skills/cbp-ship/reference/testflight-overview.md +98 -0
  166. package/templates/skills/cbp-ship/reference/versioning.md +116 -0
  167. package/templates/skills/cbp-ship/scripts/detect-surfaces.sh +217 -0
  168. package/templates/skills/cbp-ship/scripts/verify-expo-eas.sh +35 -0
  169. package/templates/skills/cbp-ship/scripts/verify-npm.sh +21 -0
  170. package/templates/skills/cbp-ship/scripts/verify-railway.sh +41 -0
  171. package/templates/skills/cbp-ship/scripts/verify-supabase.sh +19 -0
  172. package/templates/skills/cbp-ship/scripts/verify-tauri.sh +24 -0
  173. package/templates/skills/cbp-ship/scripts/verify-vercel.sh +32 -0
  174. package/templates/skills/cbp-ship/scripts/verify-vscode-ext.sh +25 -0
  175. package/templates/skills/cbp-ship/templates/eas.json +66 -0
  176. package/templates/skills/cbp-ship/templates/railway.toml +15 -0
  177. package/templates/skills/cbp-ship/templates/release-please-config.json +17 -0
  178. package/templates/skills/cbp-ship/templates/vercel.json +19 -0
  179. package/templates/skills/cbp-ship/templates/vscodeignore +21 -0
  180. package/templates/skills/cbp-ship/templates/workflow-changesets.yml +41 -0
  181. package/templates/skills/cbp-ship/templates/workflow-eas-submit.yml +53 -0
  182. package/templates/skills/cbp-ship/templates/workflow-npm-publish.yml +36 -0
  183. package/templates/skills/cbp-ship/templates/workflow-release-please.yml +21 -0
  184. package/templates/skills/cbp-ship/templates/workflow-tauri-release.yml +69 -0
  185. package/templates/skills/cbp-ship/templates/workflow-vsce-publish.yml +31 -0
  186. package/templates/skills/cbp-ship-configure/SKILL.md +296 -0
  187. package/templates/skills/cbp-ship-configure/reference/expo-mobile.md +204 -0
  188. package/templates/skills/cbp-ship-configure/reference/npm-package.md +165 -0
  189. package/templates/skills/cbp-ship-configure/reference/railway-backend.md +199 -0
  190. package/templates/skills/cbp-ship-configure/reference/supabase.md +200 -0
  191. package/templates/skills/cbp-ship-configure/reference/tauri-desktop.md +181 -0
  192. package/templates/skills/cbp-ship-configure/reference/vercel.md +117 -0
  193. package/templates/skills/cbp-ship-configure/reference/vscode-ext.md +155 -0
  194. package/templates/skills/cbp-ship-main/SKILL.md +65 -0
  195. package/templates/skills/cbp-supabase-branch-check/SKILL.md +337 -0
  196. package/templates/skills/cbp-supabase-branch-check/reference/dag-steps.md +29 -0
  197. package/templates/skills/cbp-supabase-migrate/SKILL.md +314 -0
  198. package/templates/skills/cbp-supabase-migrate/reference/advisor-triage.md +70 -0
  199. package/templates/skills/cbp-supabase-migrate/reference/cli-fallback.md +87 -0
  200. package/templates/skills/cbp-supabase-migrate/reference/preflight-dry-run.md +58 -0
  201. package/templates/skills/cbp-supabase-setup/SKILL.md +239 -0
  202. package/templates/skills/cbp-supabase-setup/reference/branching-setup.md +121 -0
  203. package/templates/skills/cbp-supabase-setup/reference/cli-fallback.md +109 -0
  204. package/templates/skills/cbp-task-check/SKILL.md +166 -0
  205. package/templates/skills/cbp-task-complete/SKILL.md +206 -0
  206. package/templates/skills/cbp-task-complete/reference/checkpoint-done-branching.md +48 -0
  207. package/templates/skills/cbp-task-complete/reference/next-step-heuristic.md +56 -0
  208. package/templates/skills/cbp-task-create/SKILL.md +167 -0
  209. package/templates/skills/cbp-task-start/SKILL.md +239 -0
  210. package/templates/skills/cbp-task-testing/SKILL.md +277 -0
  211. package/templates/skills/cbp-todo/SKILL.md +111 -0
@@ -0,0 +1,211 @@
1
+ ---
2
+ scope: org-shared
3
+ name: cbp-round-execute
4
+ description: Execute the approved plan from /cbp-round-start — runs per-wave executors, inline testing-qa per wave, and routes to /cbp-round-end
5
+ effort: xhigh
6
+ ---
7
+
8
+ # Round Execute Command
9
+
10
+ Execution and validation phase. Receives the approved plan from `/cbp-round-start`, dispatches wave executors, runs per-wave `cbp-testing-qa-agent` in parallel, and routes to `/cbp-round-end`.
11
+
12
+ ## Pipeline
13
+
14
+ ```
15
+ /cbp-round-start → /cbp-round-execute → /cbp-round-end (auto)
16
+ ```
17
+
18
+ ## Identifier Notation
19
+
20
+ This skill operates on the **active** task/round resolved via MCP `get_current_task` / `get_rounds` and does not accept a positional identifier argument. Canonical chk-task-round notation — used in prose, error messages, and cross-references — follows `.claude/rules/notation-consistency.md` "CHK / TASK / ROUND Identifier Notation": `108-1` (CHK-108 TASK-1), `45` (standalone TASK-45), `108-1-2` (round 2 of CHK-108 TASK-1), `45-2` (round 2 of standalone TASK-45).
21
+
22
+ ## Instructions
23
+
24
+ ### Step 1: Get Current Task and Round
25
+
26
+ Use MCP `get_current_task` with repo_id (pass checkpoint_id if known) to find the active task.
27
+ Use MCP `get_rounds` for the task to find the in-progress round.
28
+
29
+ If no in-progress round: `No active round. Run /cbp-round-start first.`
30
+
31
+ ### Step 2: Load Approved Plan
32
+
33
+ Read the plan from round context (`context.planner_output`). If no plan: `No approved plan in round context. Run /cbp-round-start first.`
34
+
35
+ Read effective testing profile: `round.context.testing_profile_override` if set (user override for this round only), else `task.context.testing_profile` (set by planner Phase 4.8), else default `'web'`. Pass the effective profile to all per-wave `cbp-testing-qa-agent` spawns.
36
+
37
+ ### Step 3: Route Execution Path
38
+
39
+ Inspect `approved_plan.files_to_modify[]` and `approved_plan.round_type`. Four execution paths exist; pick the one that matches BEFORE Step 3a/3b.
40
+
41
+ | Condition | Path |
42
+ | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
43
+ | `files_to_modify[]` empty AND `round_type === 'survey'` | **3-SURVEY** — orchestrator executes inline; constructs executor-equivalent output; NEVER spawn `cbp-round-executor` |
44
+ | Every entry under `.claude/**` | **3-INLINE** — orchestrator applies via build-cc skills or direct Edit; NEVER spawn `cbp-round-executor` |
45
+ | At least one entry outside `.claude/**` AND `approved_plan.waves[]` has ≥2 waves | **3-WAVE** — dispatch per-wave per schema in `approved_plan.waves[]` |
46
+ | At least one entry outside `.claude/**` (single wave or no waves field) | **3-AGENT** — spawn single `cbp-round-executor` |
47
+
48
+ #### Step 3-SURVEY: Empty-Files Survey Path
49
+
50
+ Execute the survey instructions inline using Read/Grep/Bash. Save to `round.context.survey_output`. Build executor-equivalent output object with `round_type: 'survey'`. Skip to Step 3c.
51
+
52
+ `round_type: 'survey'` MUST be set in `round.context` so Step 4 (dev-server probe) and downstream skills short-circuit correctly.
53
+
54
+ #### Step 3-INLINE: `.claude/`-Only Inline Path
55
+
56
+ For each entry, route per `rules/file-routing.md`:
57
+
58
+ - `.claude/skills/{name}/SKILL.md` → `cbp-build-cc-skill` via Skill tool
59
+ - `.claude/agents/{name}/AGENT.md` → `cbp-build-cc-agent` via Skill tool
60
+ - `.claude/rules/{name}.md` → `cbp-build-cc-rule` via Skill tool
61
+ - `.claude/CLAUDE.md` → `cbp-build-cc-claude-file` via Skill tool (or direct Edit)
62
+ - `.claude/settings*.json` → `cbp-build-cc-settings` via Skill tool
63
+ - `.claude/context/**`, `.claude/docs/**` → direct Edit
64
+ - `.claude/hooks/{name}.sh` → direct Write/Edit
65
+
66
+ Build executor-equivalent output object inline. Skip to Step 3c.
67
+
68
+ #### Step 3-WAVE: Multi-Wave Dispatch
69
+
70
+ When `approved_plan.waves[]` is present and has ≥2 entries:
71
+
72
+ 1. Topological-sort waves by `depends_on[]` to determine dispatch order.
73
+ 2. For each wave whose `depends_on[]` names are all complete, spawn the wave executor:
74
+ - `agent_type: 'cbp-round-executor'` → spawn `cbp-round-executor` with wave-scoped input (see `agents/cbp-round-executor.md` wave input contract)
75
+ - `agent_type: 'inline'` → execute inline as 3-INLINE path, scoped to `wave.files[]`
76
+ 3. After each wave completes, spawn `cbp-testing-qa-agent` against `wave.files[]` with `testing_profile` from Step 2. Run this testing spawn in PARALLEL with the next wave's executor when dependency order allows.
77
+ 4. After all waves complete, merge all `files_changed[]` into a single executor output.
78
+
79
+ #### Step 3-AGENT: Single `cbp-round-executor` Spawn
80
+
81
+ #### Mechanical-Edits Delegation Gate
82
+
83
+ Before spawning `cbp-round-executor`, inspect `task.context.work_mode` (set by cbp-task-planner Phase 4.1).
84
+
85
+ | Value | Action |
86
+ | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
87
+ | `mechanical` | Spawn `cbp-mechanical-edits` instead of `cbp-round-executor`. Derive the spec (renames / substitutions / frontmatter_edits / index_regen) from `approved_plan.files_to_modify[]` + the task's deliverables; pass it via the prompt body per the agent's Input Contract. After the agent returns, verify `git status --porcelain` reflects only expected paths AND `validation.orphaned_refs` is empty. Skip the rest of Step 3-AGENT and proceed to Step 3b. |
88
+ | `mixed` | Read `task.context.mechanical_files[]` (populated by cbp-task-planner Phase 4.1 per its partition rule). Spawn `cbp-round-executor` for the AUTHORED portion FIRST — the executor's `files` input is `files_to_modify[]` MINUS `mechanical_files[]`. After it returns, spawn `cbp-mechanical-edits` against ONLY `mechanical_files[]` — derive the spec (renames / substitutions / frontmatter_edits / index_regen) from those entries' purpose strings. Merge both `files_changed[]` results into a single output for Step 5. If `mechanical_files[]` is absent or empty when `work_mode === 'mixed'`, halt with a planner-output error (Phase 4.1 contract violation). |
89
+ | `design` or absent | Proceed with the existing `cbp-round-executor` spawn below (no change in behaviour). |
90
+
91
+ **Universal postcondition for both `mechanical` and `mixed`:** if any spawned `cbp-mechanical-edits` reports `validation.orphaned_refs.length > 0`, treat as a hard-fail signal and route through Step 6 (regardless of whether the executor also ran in the `mixed` path).
92
+
93
+ This gate is distinct from Phase 2.95's `execution_mode` parallelism hint (consumed downstream by `cbp-round-executor` Step 3.5 for batch-create scenarios). Both gates can fire on the same task.
94
+
95
+ Spawn `cbp-round-executor` with the approved plan and full context:
96
+
97
+ ```yaml
98
+ input:
99
+ task_number: N
100
+ round_number: N
101
+ approved_plan: [from round context]
102
+ checkpoint: { id, title, goal, context }
103
+ task: { id, title, requirements, context }
104
+ resources: [merged from checkpoint.resources + task.resources]
105
+ ```
106
+
107
+ Wait for executor output.
108
+
109
+ ### Step 3b: Database Work (if plan includes DB changes)
110
+
111
+ If the approved plan includes database schema changes, RLS policies, or type generation:
112
+
113
+ 1. Spawn `cbp-database-agent` with DB-related steps from the plan
114
+ 2. Wait for completion
115
+ 3. Merge `files_changed` into executor output
116
+
117
+ ### Step 3c: Completion Check
118
+
119
+ - `status: 'completed'` and all deliverables done → proceed to Step 4
120
+ - `status: 'blocked'` → present blocker to user via AskUserQuestion, resolve, re-spawn executor with remaining work
121
+ - Deliverables incomplete → re-spawn executor with remaining deliverables (max 3 re-triggers). After 3 re-triggers, save partial output and proceed.
122
+
123
+ ### Step 4: Dev-Server Probe (rounds 2+, web/desktop profile)
124
+
125
+ When `round_number >= 2` AND `testing_profile` is `'web'` or `'desktop'` AND `files_changed` contains any UI file, probe the dev server BEFORE cbp-testing-qa-agent spawns (saves a full agent spawn when the server is down).
126
+
127
+ Read `.codebyplan/server.json` `port_allocations[]`. For each configured port run:
128
+
129
+ ```bash
130
+ curl -sf --max-time 3 -o /dev/null -w "%{http_code}" http://localhost:{port}/
131
+ ```
132
+
133
+ Any non-2xx/3xx response → AskUserQuestion: start the dev server, skip UI checks, or abort.
134
+
135
+ Skip this probe for `testing_profile === 'claude_only'` or `'backend'`.
136
+
137
+ ### Step 5: Per-Wave Testing (or global testing for single-wave)
138
+
139
+ Read `task.context.testing_profile` (already loaded in Step 2).
140
+
141
+ **claude_only profile**: run inline checks only (no `cbp-testing-qa-agent` spawn):
142
+
143
+ 1. `bash -n <hook-file>` for each modified `.sh` in `files_changed`
144
+ 2. Verify each modified/created SKILL.md ≤300 lines (warn threshold; hook blocks at 600); `scope:` marker present; no `/cbp-*` notation
145
+
146
+ On pass, synthesise `testing_qa_output` inline per the procedure in `reference/inline-fallback.md` "Validation fallback" section (output shape defined in `agents/cbp-testing-qa-agent.md` Output Contract) and persist to `round.context.testing_qa_output` at Step 7.
147
+
148
+ **All other profiles**: spawn `cbp-testing-qa-agent` AND `cbp-test-e2e-agent` in parallel (two Agent calls in the same message) per completed wave (or full executor output in single-wave mode). `cbp-test-e2e-agent` is gated on `has_ui_work === true` AND profile in {`web`, `desktop`, `full_matrix`, `cross_app`} — skipped for `claude_only` / `backend`-only.
149
+
150
+ Input contracts: `cbp-testing-qa-agent` receives `executor_output`, `testing_profile`, `has_ui_work` (see `agents/cbp-testing-qa-agent.md` Input Contract). `cbp-test-e2e-agent` receives `repo_id`, `round_number`, `files_changed`, `prior_round_files_changed` (full task aggregate when round_number ≥ 2), `whole_checkpoint_mode: false`, `test_strategy`, `pages_affected`, `has_auth`, `dev_server_port` (see `agents/cbp-test-e2e-agent.md` Input Contract for the full shape).
151
+
152
+ **Independence**: neither agent reads the other's output. Cross-source user_qa items (cbp-frontend-ui + agent data) are constructed downstream at `/cbp-round-end` Step 3b. Per-wave spawns MAY run in parallel with the next wave's executor when dependency order allows.
153
+
154
+ ### Step 5b: Post-E2E Screenshot Review (cbp-frontend-ui Phase 6.5)
155
+
156
+ When `round.context.e2e_output.screenshots[]` is non-empty, invoke the `cbp-frontend-ui` skill with `phase: 'screenshot_review'` (input: `files_changed`, `e2e_screenshots: round.context.e2e_output.screenshots`, `context: { checkpoint_goal, round_requirements }`). Under this phase the skill runs only Phase 6.5 (Rendered-Output Visual Review) + 7 + 8 — Phases 1-6 (style) already ran inline at executor Step 3.8 with `phase: 'style_only'`.
157
+
158
+ Persist findings to `round.context.frontend_ui_review` (merge with Step 3.8's style-only output if present). `/cbp-round-end` Step 3b emits user_qa items for any `category: 'baseline_regression'` (any severity) and any `category: 'rendered_visual' + severity: 'critical'` — neither auto-fails the round. cbp-testing-qa-agent does NOT read these findings (full independence per Step 5).
159
+
160
+ **Skip** when `round.context.e2e_output` is absent, `screenshots` is empty, or `testing_profile === 'claude_only'`.
161
+
162
+ ### Step 6: Hard-Fail Routing
163
+
164
+ Per-wave hard-fail signal: `testing_qa_output.totals.hard_fail || e2e_output.status === 'failed' || e2e_output.test_results?.failed > 0`.
165
+
166
+ **All waves hard_fail: false** → proceed to Step 7. **Any wave hard_fail: true**:
167
+
168
+ - **Simple fixes** (type errors, lint, missing imports, test assertion fixes, e2e `real`-category with clear code-side root cause, no prior re-trigger this round) → save failure details to round context; retrigger the failing wave's executor; re-run testing-qa AND test-e2e for that wave.
169
+ - **Structural OR already re-triggered once OR e2e preflight aborts** → save failure context via MCP `update_round`; auto-trigger `/cbp-round-input`. STOP.
170
+
171
+ ## Inline execution fallback
172
+
173
+ When `cbp-round-executor` spawn fails (per `agent-spawn-failure-fallback.md` triggers), fall through to the 3-INLINE branch in Step 3 above for `.claude/`-only edits. For non-`.claude/` edits, walk `agents/cbp-round-executor.md` Phase 1–4 inline using Read / Edit / Write / Bash. Full procedure: `reference/inline-fallback.md` "Execution fallback" section.
174
+
175
+ ## Inline validation fallback
176
+
177
+ When `cbp-testing-qa-agent` spawn fails OR the resolved `testing_profile` is `claude_only` (in which case the agent isn't spawned by design), run validation inline. Apply the profile gate matrix in `agents/cbp-testing-qa-agent.md` Phase 3 to determine in-scope checks. Full procedure + per-profile shape: `reference/inline-fallback.md` "Validation fallback" section.
178
+
179
+ ### Step 7: Save Executor Output
180
+
181
+ Update round context via MCP `update_round`:
182
+
183
+ - `context`: { ...existing, executor_output, testing_qa_output, e2e_output, frontend_ui_review }
184
+
185
+ `e2e_output` and `frontend_ui_review` are present only when the gates above admitted them (e2e ran AND Step 5b ran).
186
+
187
+ ### Step 8: Auto-trigger Round End
188
+
189
+ ```
190
+ Execution and validation complete. Starting round wrap-up...
191
+ ```
192
+
193
+ Trigger `/cbp-round-end`.
194
+
195
+ ## Key Rules
196
+
197
+ - **Code + test writing + inline validation** — planning lives in `round-start`, summary in `round-end`
198
+ - Per-wave `cbp-testing-qa-agent` AND `cbp-test-e2e-agent` run in parallel (both against the same wave's `files[]`); they may also run in parallel with the NEXT wave's executor when dependency order allows
199
+ - `testing_profile` from `task.context` governs which checks run — read it once in Step 2; pass to every testing-qa + test-e2e spawn
200
+ - `claude_only` profile skips all agent spawns (testing-qa AND test-e2e); runs hook syntax and skill structure checks inline
201
+ - Step 5b (cbp-frontend-ui Phase 6.5) runs only when e2e produced screenshots — gated on `e2e_output.screenshots[]` non-empty
202
+ - Claude NEVER git adds files in round commands
203
+
204
+ ## Integration
205
+
206
+ - **Reads**: MCP `get_current_task`, `get_rounds`
207
+ - **Writes**: MCP `update_round` (context with executor_output + testing_qa_output + e2e_output + frontend_ui_review)
208
+ - **Spawns**: `cbp-round-executor` (per wave or single), `cbp-testing-qa-agent` (per wave, parallel sibling of cbp-test-e2e-agent), `cbp-test-e2e-agent` (per wave when has_ui_work + non-claude_only profile), `cbp-database-agent` (if DB work), `cbp-security-agent` (if security review needed)
209
+ - **Skill invocations**: `cbp-frontend-ui` at Step 5b with `phase: 'screenshot_review'` (post-e2e)
210
+ - **Triggers**: `/cbp-round-end` (auto)
211
+ - **Triggered by**: `/cbp-round-start` (auto, after plan approval)
@@ -0,0 +1,59 @@
1
+ ---
2
+ scope: org-shared
3
+ ---
4
+
5
+ # Inline-fallback procedures
6
+
7
+ When `round-executor` or `testing-qa-agent` cannot be spawned (env limits, monthly cap, 5xx, rate limit, context overflow), the orchestrator falls through to an inline procedure that walks the agent's Phase checklist using its own tools.
8
+
9
+ The two fallback modes are documented separately so the SKILL.md stubs can link the right section.
10
+
11
+ ## Execution fallback (round-executor spawn failed)
12
+
13
+ Triggered when the executor agent spawn returns one of the failure classes documented in `agent-spawn-failure-fallback.md`. Procedure:
14
+
15
+ 1. Detect failure class from error string. Record:
16
+ ```yaml
17
+ round.context.executor_findings.spawn_failure:
18
+ class: "monthly_agent_usage_limit" | "provider_5xx" | "rate_limit_429" | "context_overflow_at_spawn" | "billing_limit"
19
+ error_message: "<verbatim>"
20
+ decided_at: "<ISO>"
21
+ ```
22
+ 2. For `.claude/`-only file sets, fall through to the 3-INLINE branch in `../SKILL.md` Step 3 (orchestrator routes per file-routing.md to the matching build-cc skill or direct Edit).
23
+ 3. For non-`.claude/` file sets, walk `agents/round-executor.md` Phase 1–4 inline using Read / Edit / Write / Bash / Glob / Grep. Step 3 (Implementation) is the load-bearing phase — apply each `files_to_modify[]` deliverable in order, respecting wave boundaries when wave mode is active.
24
+ 4. Populate the executor's output contract with `mode: 'inline_fallback'` so analytics distinguishes.
25
+ 5. Pre-emptive skip on repeat: if `prior_round.context.executor_findings.spawn_failure.class === current_class`, skip the spawn attempt entirely and go straight to inline.
26
+
27
+ ## Validation fallback (testing-qa-agent spawn failed OR claude_only profile)
28
+
29
+ Triggered when testing-qa-agent spawn returns a failure class, OR when the resolved profile is `claude_only` (in which case the agent should not have been spawned at all). Procedure:
30
+
31
+ 1. Detect failure class. Record:
32
+ ```yaml
33
+ round.context.testing_qa_findings.spawn_failure:
34
+ class: "<failure_class>"
35
+ error_message: "<verbatim>"
36
+ decided_at: "<ISO>"
37
+ ```
38
+ 2. Apply the profile gate matrix from `agents/testing-qa-agent.md` Phase 3 to determine which checks are in-scope:
39
+ - `claude_only`: only hook bash syntax (`bash -n <hook>`) + skill structure validation (line counts, scope marker, /cbp-* legacy notation absent)
40
+ - `web`: skip desktop + backend
41
+ - `backend`: skip web + desktop
42
+ - `desktop`: skip web + backend
43
+ - `full_matrix`: all
44
+ - `cross_app`: union of touched apps
45
+ 3. Walk `agents/testing-qa-agent.md` Phase 1 (Setup) + Phase 2 (Discovery) + Phase 3 (Mandatory Automated Testing) inline using Read / Grep / Bash. Aggregate per-check results.
46
+ 4. Populate `testing_qa_output` shape with `mode: 'inline_fallback'`. For `claude_only` specifically, use `mode: 'inline_synthesised_for_claude_only_profile'` (the agent was never expected to spawn — this isn't a fallback, it's the documented happy path).
47
+ 5. Pre-emptive skip on repeat: if `prior_round.context.testing_qa_findings.spawn_failure.class === current_class`, skip the spawn attempt entirely.
48
+
49
+ ## Pre-emptive skip rule
50
+
51
+ Per `agent-spawn-failure-fallback.md` item 5: when the same failure class fired in the previous round of the same task, skip the spawn attempt entirely and go straight to inline. This avoids one wasted API call per round during a sustained outage.
52
+
53
+ ## Pairs With
54
+
55
+ - `../SKILL.md` — points at this reference for procedural detail
56
+ - `agents/round-executor.md` — execution-fallback target agent
57
+ - `agents/testing-qa-agent.md` — validation-fallback target agent + Phase 3 profile gate matrix
58
+ - `rules/agent-spawn-failure-fallback.md` — required-coverage table; canonical failure classes
59
+ - `rules/testing-profile.md` — claude_only profile detail; cross-app union semantics
@@ -0,0 +1,165 @@
1
+ ---
2
+ scope: org-shared
3
+ name: cbp-round-input
4
+ description: Gather input for a new round with deep analysis of unapproved work
5
+ argument-hint: [chk-task-round | task-round | requirements-text]
6
+ effort: xhigh
7
+ ---
8
+
9
+ # Round Input Command
10
+
11
+ Gathers input for a new round. Performs deep analysis of unapproved files, requirements coverage, and testing-QA failures before formulating requirements. Follow-up rounds get the same depth as round 1.
12
+
13
+ ## When Used
14
+
15
+ - After `/cbp-round-update` routes here (unapproved files)
16
+ - After `/cbp-round-execute` Step 6 routes here (structural failure or retry-exhausted hard-fail)
17
+ - After `/clear` + `/cbp-todo` reloads context and triggers this
18
+ - When user wants to start a new round with specific changes
19
+
20
+ ## Instructions
21
+
22
+ ### Step 1: Parse `$ARGUMENTS`
23
+
24
+ Try the numeric identifier regex first: `^[0-9]+(-[0-9]+){0,2}$`
25
+
26
+ | Shape | Segments | Resolves to |
27
+ |-------|----------|-------------|
28
+ | `{task}` (e.g. `45`) | 1 | Standalone TASK-{task} next round (matches cbp-task-start standalone convention) |
29
+ | `{chk}-{task}` (e.g. `108-1`) | 2 | CHK-{chk} TASK-{task} next round (round number implicit — round-input creates a new round) |
30
+ | `{chk}-{task}-{round}` (e.g. `108-1-2`) | 3 | CHK-{chk} TASK-{task} targeting ROUND-{round} (existing round context) |
31
+ | _(no match / empty)_ | — | Free-text requirements (passed through to Step 5) OR empty → use `get_current_task` |
32
+
33
+ If the argument matches the numeric regex, resolve the target task/round from DB. If no match (or empty), treat the argument as free-text requirements and proceed to Step 2 for context (free-text path still runs deep analysis before Step 5).
34
+
35
+ #### Worked examples
36
+
37
+ - `round-input 45` → standalone TASK-45 next round
38
+ - `round-input 108-1` → CHK-108 TASK-1 next round
39
+ - `round-input 108-1-2` → CHK-108 TASK-1 ROUND-2
40
+ - `round-input` (no arg) → active task via `get_current_task`
41
+ - `round-input Fix the broken lint rule in the auth module` → free-text requirements (numeric regex fails → falls through to free-text path)
42
+
43
+ > **Note on 2-segment divergence**: `round-input 108-1` resolves to **CHK-108 TASK-1** (targeting that task's next round). This diverges from `/cbp-round-start` where the 2-segment `108-1` means **standalone TASK-108 ROUND-1**. Round-input always operates on a task-level context (it creates a new round on a task), so the round number is implicit and 2 segments are interpreted as `{chk}-{task}`. To target a standalone task here, use the 1-segment form `45`. To target a specific existing round, use the 3-segment form `108-1-2`.
44
+
45
+ ### Step 2: Deep Analysis (MANDATORY — always runs)
46
+
47
+ **2a:** Load task via MCP `get_current_task` (pass `checkpoint_id` if known to avoid disambiguation) — get `files_changed`, `requirements`, `context`, `qa`
48
+
49
+ **2b:** Load all rounds via MCP `get_rounds(task_id)` — get previous round context, testing-qa output
50
+
51
+ **2c:** Identify unapproved files from `task.files_changed` where `user_approved === false`
52
+
53
+ **2d:** Read the content of each unapproved file (using Read tool, max 5 files, first 100 lines each)
54
+
55
+ **2e:** Cross-reference with task requirements — for each requirement, is it met or missed?
56
+
57
+ **2f:** Extract testing-qa failures from latest round context (`context.testing_qa_output`)
58
+
59
+ **2g:** Extract code review findings from latest round context (`context.improve_round_findings`).
60
+ These are user-accepted findings from `improve-round` agent — bugs, logic errors, edge cases
61
+ that the user agreed should be fixed. Include them as high-priority requirements.
62
+
63
+ **2h:** Identify root causes — not "file X is wrong" but "requirement Y was not met because Z"
64
+
65
+ **2i:** Produce structured analysis summary
66
+
67
+ ### Step 3: Present Analysis
68
+
69
+ Show the analysis to the user:
70
+
71
+ ```
72
+ ## Follow-up Round Analysis
73
+
74
+ ### Unapproved Files ([N])
75
+ | File | Action | Issue |
76
+ |------|--------|-------|
77
+ | path | modified | [what's wrong based on reading the file] |
78
+
79
+ ### Requirements Coverage
80
+ | Requirement | Status | Gap |
81
+ |-------------|--------|-----|
82
+ | [req] | met/missed | [what's missing] |
83
+
84
+ ### Testing-QA Issues (from previous round)
85
+ - [issue 1 from testing-qa output]
86
+ - [issue 2]
87
+
88
+ ### Code Review Findings (from improve-round)
89
+ | # | Severity | File | Issue |
90
+ |---|----------|------|-------|
91
+ | [findings accepted by user in previous round-end] |
92
+
93
+ ### Root Causes
94
+ 1. [root cause with explanation]
95
+ 2. [root cause with explanation]
96
+ ```
97
+
98
+ ### Step 4: Choose Mode
99
+
100
+ **If `round.context.auto_loop_mode === true` on the prior round**: skip the AskUserQuestion below. Auto-pick "Start round with these findings" using the analysis directly. Set the next round's `auto_loop_mode = true`, carry `auto_loop_index` and `auto_loop_cap` forward into round-start args.
101
+
102
+ **Else (manual mode — flag absent or false)**, ask user via AskUserQuestion:
103
+
104
+ - **Start round with these findings** — use analysis as requirements
105
+ - **Discuss first** — open conversation about the analysis
106
+ - **Adjust** — user provides their own requirements
107
+
108
+ If "Discuss first": enter open discussion about the analysis. When direction is clear, proceed to Step 5.
109
+ If "Adjust": user provides their own requirements, merged with analysis context.
110
+
111
+ ### Step 5: Formulate Requirements
112
+
113
+ Based on the analysis + user input, create detailed requirements that:
114
+
115
+ - Reference specific root causes identified in Step 2
116
+ - Include full task requirements context
117
+ - Are as thorough as round 1 (not quick fixes)
118
+ - Include checkpoint and task context for the planner
119
+
120
+ **Under `auto_loop_mode`**: requirements come VERBATIM from the prior round's `improve_round_findings[]` and `testing_qa_output` failures, treated as a flat list. Test failures are listed first (they block shipping); reviewer findings follow. Both sets are included unchanged — do not re-summarise or re-prioritise either. The auto-loop transcribes the prior reviewer's output directly.
121
+
122
+ ### Step 6: Update Context (if direction changed)
123
+
124
+ If the new round requirements change the task direction:
125
+
126
+ 1. Update task context via MCP `update_task(task_id, context: { ... })`:
127
+ - Add new decisions to `context.decisions[]`
128
+ - Update `context.discoveries[]` if applicable
129
+ 2. If checkpoint-level changes needed, update checkpoint context via MCP `update_checkpoint`
130
+
131
+ ### Step 7: Auto-trigger Round Start
132
+
133
+ Pass the new requirements to `/cbp-round-start`:
134
+
135
+ ```
136
+ Starting new round with updated requirements...
137
+ ```
138
+
139
+ Trigger `/cbp-round-start` with the round requirements as arguments.
140
+
141
+ **Under `auto_loop_mode`**: pass `auto_loop_mode: true`, `auto_loop_index: N`, `auto_loop_cap: C` into round-start's args/context so round-start Step 4 can persist them on the new round and downstream skills (round-execute, round-end) read them.
142
+
143
+ ## Fallback: Context Recovery
144
+
145
+ If this command is triggered **directly** (not via `/cbp-todo`) and no context is available in the session:
146
+
147
+ 1. Read `.codebyplan/repo.json` for `repo_id`
148
+ 2. Use MCP `get_current_task` to load checkpoint + task
149
+ 3. Use MCP `get_rounds(task_id)` to load round history
150
+ 4. Continue from Step 2 (deep analysis handles all context loading)
151
+
152
+ ## Key Rules
153
+
154
+ - **Deep analysis is MANDATORY** — always runs, even if arguments provided (for context)
155
+ - **Analysis reads from DB (MCP)**, not conversation history
156
+ - **Follow-up rounds get same depth as round 1** — no quick-fix behavior
157
+ - **Never ask to git add** — file approval is handled by `/cbp-round-update`
158
+ - **Update all context locations** — task, checkpoint, and round should all have consistent information
159
+
160
+ ## Integration
161
+
162
+ - **Triggered by**: `/cbp-round-update` (auto, unapproved files), `/cbp-round-execute` (auto, on hard-fail after retry exhausted), `/cbp-todo` (after /clear), user manually
163
+ - **Reads**: MCP `get_current_task`, `get_rounds`, file contents (Read tool)
164
+ - **Writes**: MCP `update_task` (context), `update_checkpoint` (context, if needed)
165
+ - **Triggers**: `/cbp-round-start` (auto)
@@ -0,0 +1,222 @@
1
+ ---
2
+ scope: org-shared
3
+ name: cbp-round-start
4
+ description: Start a round — planning phase only
5
+ triggers: [cbp-round-execute]
6
+ argument-hint: [chk-task-round | task-round | requirements-text] # e.g. `108-1-2`, `45-2`, or free-text from /cbp-round-input
7
+ effort: xhigh
8
+ ---
9
+
10
+ # Round Start Command
11
+
12
+ Planning phase for a new round. Analyzes context, creates plan, gets user approval. NO execution or testing — those are separate commands.
13
+
14
+ ## Inline-Fallback for Planner Spawn Failure
15
+
16
+ If the `cbp-task-planner` agent spawn fails for any reason (`API Error: Extra usage required`, monthly Agent usage cap, provider 5xx, rate limit, context overflow), the orchestrator MUST follow the canonical inline-fallback procedure documented in `skills/cbp-round-end/SKILL.md` "Inline-fallback for any spawn failure".
17
+
18
+ Procedure summary (pointer back to canonical):
19
+
20
+ 1. Detect the failure class from the error string; record `round.context.planner_findings.spawn_failure = { class, error_message, decided_at }`.
21
+ 2. Walk the planner's documented Phase 0-8 checklist inline using `Read` / `Grep` / `Bash` / MCP `get_*` — `agents/cbp-task-planner.md` is the inline script. Phase 1.5 (Requirement Premise Verification) and Phase 4.7 (Migration Shape-Distribution Pre-Flight) are MANDATORY in fallback mode — these are the gates the agent uniquely enforces; skipping them produces unverified plans.
22
+ 3. Populate the planner's output contract (`approved_plan` shape: `files_to_modify[]`, `deliverables`, `specialist_needs`, `round_type`, `shape_distribution` if applicable, `context_summary`) with `mode: 'inline_fallback'`.
23
+ 4. Apply the pre-emptive-skip rule: when the same failure class fired in the previous spawn of this session, skip the spawn attempt entirely and go straight to inline.
24
+ 5. Continue the skill — do NOT abort. The plan still requires user approval at Step 9.
25
+
26
+ Inline-fallback is NOT a quality downgrade trapdoor — Phase 1.5 row-by-row verification is mandatory. A fallback plan that skipped premise verification is a regression caught by the next session's cbp-improve-round.
27
+
28
+ ## Pipeline
29
+
30
+ ```
31
+ /cbp-round-start (planning) → [user approval] → /cbp-round-execute (auto)
32
+ ```
33
+
34
+ **Auto-loop mode**: when `round.context.auto_loop_mode === true` flows in from `/cbp-round-input`, Step 6 (Q&A) and Step 8 (user approval) skip user prompts. See cbp-round-update SKILL.md Step 6 (auto-loop decision) and cbp-round-end SKILL.md Step 8 for the full contract.
35
+
36
+ ## Instructions
37
+
38
+ ### Step 0: Parse `$ARGUMENTS` shape
39
+
40
+ Disambiguate the argument up front. Three input shapes (see `.claude/rules/notation-consistency.md` "CHK / TASK / ROUND Identifier Notation"):
41
+
42
+ | Shape | Regex | Meaning |
43
+ |-------|-------|---------|
44
+ | `{chk}-{task}-{round}` (e.g. `108-1-2`) | `^[0-9]+-[0-9]+-[0-9]+$` | **Identifier**: targets round {round} of CHK-{chk} TASK-{task}. Sets `target_checkpoint`, `target_task`, `target_round`. |
45
+ | `{task}-{round}` (e.g. `45-2`) | `^[0-9]+-[0-9]+$` | **Identifier**: targets round {round} of standalone TASK-{task}. Sets `target_task`, `target_round` (no checkpoint). |
46
+ | Non-empty, non-identifier-shaped | — | **Free-text round requirements** (the round-input passthrough path). |
47
+ | _(empty)_ | — | No identifier, no requirements text — derive task/round from `get_current_task` / `get_rounds`. |
48
+
49
+ Malformed identifier shapes (`108-`, `-1-2`, `108--1`, `abc-1`) — surface this error and stop, mirroring `/cbp-task-start`'s error vocabulary:
50
+
51
+ ```
52
+ round-start: invalid argument `{value}`. Expected:
53
+ 108-1-2 → round 2 of CHK-108 TASK-1
54
+ 45-2 → round 2 of standalone TASK-45
55
+ (free-text) → round requirements (typical from /cbp-round-input)
56
+ (empty) → derive from active task/round state
57
+ ```
58
+
59
+ #### Worked examples
60
+
61
+ - `round-start 108-1-2` → resolve CHK-108 TASK-1, target round 2
62
+ - `round-start 45-2` → resolve standalone TASK-45, target round 2
63
+ - `round-start 108-1` → **standalone TASK-108 round 1** (NOT CHK-108 TASK-1). The 2-segment form means `{task}-{round}`; checkpoint-bound round-targeting requires all three numbers (`108-1-2`). If you got here trying to target CHK-108 TASK-1, you want `108-1-2` (specifying a round number) or `/cbp-task-start 108-1` (specifying just a task).
64
+ - `round-start "Implement OAuth flow per CHK-X plan"` → free-text path; current-task/round derivation from state
65
+ - `round-start` (empty) → derive from `get_current_task` / `get_rounds`; round 1 uses `task.requirements`
66
+ - `round-start 108-` → error: malformed identifier
67
+ - `round-start -1-2` → error: malformed identifier
68
+ - `round-start abc-1` → error: malformed identifier
69
+
70
+ > **Mental-model warning**: `task-start` and `round-start` interpret the SAME `108-1` argument differently. `task-start 108-1` → CHK-108 TASK-1 (checkpoint-bound task). `round-start 108-1` → standalone TASK-108 round 1 (because round-start needs three numbers for a checkpoint-bound round). When in doubt, write all three: `round-start 108-1-2`.
71
+
72
+ ### Step 1: Get Current Task
73
+
74
+ If Step 0 produced an identifier (`target_task` set): resolve directly per the identifier (bound or standalone) — MCP `get_checkpoints` + `get_tasks`, or `get_tasks(standalone: true)`.
75
+
76
+ Otherwise: use MCP `get_current_task` with repo_id (pass checkpoint_id if known to avoid disambiguation) to find the active checkpoint and in-progress task.
77
+
78
+ If no in-progress task and Step 0 produced no identifier, show error: `No active task. Run /cbp-task-start first.`
79
+
80
+ ### Step 2: Determine Round Number
81
+
82
+ If Step 0 produced `target_round`: use that as the round number directly (may target an existing round for resume, or N+1 for a new round — disambiguate by checking MCP `get_rounds`).
83
+
84
+ Otherwise: use MCP `get_rounds` for the task; count existing rounds; next is N+1.
85
+
86
+ ### Step 3: Gather Round Requirements
87
+
88
+ **If Step 0 parsed an identifier**: this skill was invoked to resume/start a specific round. Requirements come from existing round data (when the round exists) or task.requirements (for new round 1) — `$ARGUMENTS` is the identifier itself, NOT requirements text.
89
+
90
+ **Else (free-text path), if round number is 1:**
91
+
92
+ - Use `task.requirements` as the primary requirements
93
+ - If `$ARGUMENTS` provided (free-text), merge as additional context
94
+
95
+ **Else (free-text path), if round number > 1:**
96
+
97
+ 1. If `$ARGUMENTS` provided (from `/cbp-round-input`): use as round requirements
98
+ 2. If NO arguments: show error - `Round 2+ requires input. Run /cbp-round-input first.`
99
+
100
+ ### Step 4: Create Round in DB
101
+
102
+ Use MCP `add_round`:
103
+ - `task_id`: current task ID
104
+ - `number`: next round number
105
+ - `status`: "in_progress"
106
+ - `started_at`: now (ISO format)
107
+ - `triggered_by`: `"user"` | `"claude"` | `"auto_loop"` — `auto_loop` when `auto_loop_mode === true` flows in from round-input; `claude` when auto-triggered by testing failure; `user` otherwise
108
+ - `requirements`: round requirements from Step 3
109
+ - `context`: when `auto_loop_mode === true`, persist `auto_loop_mode: true`, `auto_loop_index: N`, `auto_loop_cap: C` into `round.context` (carried forward from round-input args)
110
+
111
+ ### Step 5: Load Context from DB
112
+
113
+ Load from checkpoint and task:
114
+ - Checkpoint context (decisions, dependencies, constraints, goal)
115
+ - Task context and requirements
116
+ - Resources from checkpoint and task (documentation links, API docs, guides)
117
+ - Previous round results (files_changed, QA results)
118
+ - For round 2+: load the latest completed round's `context.testing_qa_output` and `context.executor_output` via `get_rounds` response
119
+ - Identify unapproved files from task.files_changed (where user_approved === false)
120
+
121
+ ### Step 6: First Round Analysis (Round 1 only)
122
+
123
+ For the first round only:
124
+
125
+ 1. Analyze the task context and requirements thoroughly
126
+ 2. Identify any ambiguities or gaps
127
+ 3. If questions are needed, ask user via AskUserQuestion (max 4 per batch)
128
+ 4. If task context changes from Q&A answers:
129
+ - Update task context via MCP `update_task(task_id, context: {...})`
130
+ - Save Q&A decisions as `context.decisions[]`
131
+
132
+ Skip this step for round 2+ (context already established via `/cbp-round-input`).
133
+
134
+ **If `auto_loop_mode === true`, skip Q&A regardless of round number** — the auto-loop already has authoritative requirements from the prior round's findings (round 1 is always manual in practice, but the rule is explicit so future round-1 auto-loops follow it).
135
+
136
+ ### Step 7: Spawn Task Planner Agent
137
+
138
+ Spawn `cbp-task-planner` agent with:
139
+ ```yaml
140
+ input:
141
+ task_number: N
142
+ round_number: N
143
+ requirements: task.requirements
144
+ round_requirements: [round-specific input from Step 3]
145
+ checkpoint: {id, title, goal, context}
146
+ task: {id, title, requirements, context}
147
+ previous_rounds: {count, files_pending, files_changed, testing_qa_output, unapproved_files}
148
+ ```
149
+
150
+ **Round 2+ context**: The planner receives the previous round's testing-qa output and list of unapproved files.
151
+
152
+ **Priority**: If `round_requirements` is set (round 2+), the planner focuses on those specific goals while respecting `task.requirements` as context.
153
+
154
+ Wait for planner output.
155
+
156
+ ### Step 8: User Approval
157
+
158
+ Present the plan to user:
159
+
160
+ ```
161
+ ## Round [N] Plan
162
+
163
+ **Goal**: [goal]
164
+
165
+ ### Steps:
166
+ 1. [step]
167
+ 2. [step]
168
+ ...
169
+
170
+ ### Files to modify:
171
+ | File | Action | Purpose |
172
+ |------|--------|---------|
173
+ | ... | ... | ... |
174
+ ```
175
+
176
+ **Wave table** — when `approved_plan.waves[]` contains ≥2 entries, render a wave summary table BEFORE the files table:
177
+
178
+ ```
179
+ ### Execution Waves
180
+ | Wave | Agent type | Files | Depends on | Skill preloads |
181
+ |------|-----------|-------|-----------|----------------|
182
+ | web-ui | cbp-round-executor | 7 | — | cbp-frontend-design, cbp-frontend-a11y |
183
+ | backend-api | cbp-round-executor | 4 | — | — |
184
+ ```
185
+
186
+ Single-wave plans present the existing flat plan view (no wave table) — backward compatible.
187
+
188
+ **If `auto_loop_mode === true`**: skip the AskUserQuestion below; auto-approve the plan. Log `round.context.plan_approval = { mode: "auto_loop", auto_approved_at: <ISO> }`. Surface a one-line note in the chat output: `"Auto-approved under auto_loop_mode (round N of cap C)"` so the user can see the loop is active. Proceed to Step 9.
189
+
190
+ **Else (manual mode)**, ask user via AskUserQuestion with explicit options:
191
+
192
+ 1. **Yes** — approve and start execution
193
+ 2. **No — needs changes** — user provides feedback, revise the plan (re-run Step 7 with feedback)
194
+ 3. **No — totally wrong** — discard plan, return to `/cbp-round-input` for new requirements
195
+
196
+ **If "Yes"**: proceed to Step 9.
197
+ **If "Needs changes"**: collect user feedback, re-spawn `cbp-task-planner` with feedback as constraint, present revised plan, ask again.
198
+ **If "Totally wrong"**: save rejection reason to round context, auto-trigger `/cbp-round-input`.
199
+
200
+ ### Step 9: Auto-trigger Round Execute
201
+
202
+ On approval, save planner output to round context via MCP `update_round`, then trigger `/cbp-round-execute`.
203
+
204
+ ```
205
+ Plan approved. Starting execution phase...
206
+ ```
207
+
208
+ ## Key Rules
209
+
210
+ - **Planning ONLY** — no code execution, no testing
211
+ - Planner gets full context (checkpoint + task + previous rounds)
212
+ - Round 1 auto-triggered from `/cbp-task-start`
213
+ - Round 2+ triggered from `/cbp-round-input`
214
+ - Claude NEVER git adds files in round commands
215
+
216
+ ## Integration
217
+
218
+ - **Reads**: MCP `get_current_task`, `get_rounds`
219
+ - **Writes**: MCP `add_round`, `update_round`, `update_task` (context only)
220
+ - **Spawns**: `cbp-task-planner`
221
+ - **Triggers**: `/cbp-round-execute` (auto, on plan approval)
222
+ - **Triggered by**: `/cbp-task-start` (round 1), `/cbp-round-input` (round 2+)