codebyplan 1.5.0 → 1.8.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 (206) hide show
  1. package/README.md +48 -5
  2. package/dist/cli.js +4578 -2709
  3. package/package.json +5 -1
  4. package/templates/.gitkeep +0 -0
  5. package/templates/README.md +20 -0
  6. package/templates/agents/cbp-cc-executor.md +213 -0
  7. package/templates/agents/cbp-database-agent.md +229 -0
  8. package/templates/agents/cbp-improve-claude.md +245 -0
  9. package/templates/agents/cbp-improve-round.md +284 -0
  10. package/templates/agents/cbp-mechanical-edits.md +111 -0
  11. package/templates/agents/cbp-research.md +282 -0
  12. package/templates/agents/cbp-round-executor.md +604 -0
  13. package/templates/agents/cbp-security-agent.md +134 -0
  14. package/templates/agents/cbp-task-check.md +213 -0
  15. package/templates/agents/cbp-task-planner.md +582 -0
  16. package/templates/agents/cbp-test-e2e-agent.md +363 -0
  17. package/templates/agents/cbp-testing-qa-agent.md +400 -0
  18. package/templates/context/mcp-docs.md +139 -0
  19. package/templates/hooks/README.md +236 -0
  20. package/templates/hooks/cbp-auto-test-hooks.sh +44 -0
  21. package/templates/hooks/cbp-lint-format-on-edit.sh +159 -0
  22. package/templates/hooks/cbp-maestro-yaml-validate.sh +100 -0
  23. package/templates/hooks/cbp-mcp-migration-guard.sh +32 -0
  24. package/templates/hooks/cbp-mcp-round-sync.sh +79 -0
  25. package/templates/hooks/cbp-mcp-worktree-inject.sh +76 -0
  26. package/templates/hooks/cbp-notify.sh +68 -0
  27. package/templates/hooks/cbp-plugin-dispatch.sh +29 -0
  28. package/templates/hooks/cbp-pre-commit-quality-gate.sh +204 -0
  29. package/templates/hooks/cbp-statusline.sh +347 -0
  30. package/templates/hooks/cbp-subagent-statusline.sh +182 -0
  31. package/templates/hooks/cbp-test-coverage-gate.sh +144 -0
  32. package/templates/hooks/cbp-test-hooks.sh +320 -0
  33. package/templates/hooks/hooks.json +85 -0
  34. package/templates/hooks/validate-context-usage.sh +59 -0
  35. package/templates/hooks/validate-git-commit.sh +78 -0
  36. package/templates/hooks/validate-git-stash-deny.sh +32 -0
  37. package/templates/hooks/validate-structure-lengths.sh +57 -0
  38. package/templates/hooks/validate-structure-lib.sh +104 -0
  39. package/templates/hooks/validate-structure-patterns.sh +54 -0
  40. package/templates/hooks/validate-structure-scope.sh +33 -0
  41. package/templates/hooks/validate-structure-smoke.sh +95 -0
  42. package/templates/hooks/validate-structure-templates.sh +34 -0
  43. package/templates/hooks/validate-structure.sh +69 -0
  44. package/templates/rules/.gitkeep +0 -0
  45. package/templates/rules/README.md +47 -0
  46. package/templates/rules/context-file-loading.md +52 -0
  47. package/templates/rules/scope-vocabulary.md +64 -0
  48. package/templates/rules/todo-backend.md +109 -0
  49. package/templates/settings.project.base.json +55 -0
  50. package/templates/settings.user.base.json +25 -0
  51. package/templates/skills/cbp-build-cc-agent/SKILL.md +139 -0
  52. package/templates/skills/cbp-build-cc-agent/examples/read-only-reviewer.md +32 -0
  53. package/templates/skills/cbp-build-cc-agent/examples/with-hooks.md +41 -0
  54. package/templates/skills/cbp-build-cc-agent/examples/with-skills-preload.md +25 -0
  55. package/templates/skills/cbp-build-cc-agent/reference/cbp-quality.md +153 -0
  56. package/templates/skills/cbp-build-cc-agent/reference/frontmatter-fields.md +37 -0
  57. package/templates/skills/cbp-build-cc-agent/reference/permission-modes.md +18 -0
  58. package/templates/skills/cbp-build-cc-agent/scripts/validate-agent.sh +67 -0
  59. package/templates/skills/cbp-build-cc-agent/templates/agent.md +66 -0
  60. package/templates/skills/cbp-build-cc-claude-file/SKILL.md +178 -0
  61. package/templates/skills/cbp-build-cc-claude-file/examples/minimal-project.md +33 -0
  62. package/templates/skills/cbp-build-cc-claude-file/examples/monorepo-with-imports.md +39 -0
  63. package/templates/skills/cbp-build-cc-claude-file/reference/imports.md +72 -0
  64. package/templates/skills/cbp-build-cc-claude-file/reference/what-belongs.md +39 -0
  65. package/templates/skills/cbp-build-cc-claude-file/templates/project-claude-md.md +48 -0
  66. package/templates/skills/cbp-build-cc-claude-file/templates/user-claude-md.md +22 -0
  67. package/templates/skills/cbp-build-cc-memory/SKILL.md +201 -0
  68. package/templates/skills/cbp-build-cc-memory/examples/feedback-memory.md +11 -0
  69. package/templates/skills/cbp-build-cc-memory/examples/project-memory.md +11 -0
  70. package/templates/skills/cbp-build-cc-memory/examples/reference-memory.md +13 -0
  71. package/templates/skills/cbp-build-cc-memory/examples/user-memory.md +14 -0
  72. package/templates/skills/cbp-build-cc-memory/reference/memory-types.md +59 -0
  73. package/templates/skills/cbp-build-cc-memory/reference/when-to-save.md +62 -0
  74. package/templates/skills/cbp-build-cc-memory/templates/MEMORY-index.md +4 -0
  75. package/templates/skills/cbp-build-cc-memory/templates/memory-entry.md +15 -0
  76. package/templates/skills/cbp-build-cc-mode/SKILL.md +99 -0
  77. package/templates/skills/cbp-build-cc-rule/SKILL.md +176 -0
  78. package/templates/skills/cbp-build-cc-rule/examples/global-rule.md +19 -0
  79. package/templates/skills/cbp-build-cc-rule/examples/scoped-rule.md +41 -0
  80. package/templates/skills/cbp-build-cc-rule/reference/paths-patterns.md +48 -0
  81. package/templates/skills/cbp-build-cc-rule/templates/rule.md +32 -0
  82. package/templates/skills/cbp-build-cc-settings/SKILL.md +220 -0
  83. package/templates/skills/cbp-build-cc-settings/examples/hooks-config.json +64 -0
  84. package/templates/skills/cbp-build-cc-settings/examples/permissions-config.json +34 -0
  85. package/templates/skills/cbp-build-cc-settings/examples/sandbox-config.json +42 -0
  86. package/templates/skills/cbp-build-cc-settings/reference/cbp-conventions.md +104 -0
  87. package/templates/skills/cbp-build-cc-settings/reference/permission-rules.md +61 -0
  88. package/templates/skills/cbp-build-cc-settings/reference/scope-precedence.md +73 -0
  89. package/templates/skills/cbp-build-cc-settings/reference/settings-fields.md +166 -0
  90. package/templates/skills/cbp-build-cc-settings/templates/settings.json +23 -0
  91. package/templates/skills/cbp-build-cc-settings/templates/settings.local.json +10 -0
  92. package/templates/skills/cbp-build-cc-skill/SKILL.md +154 -0
  93. package/templates/skills/cbp-build-cc-skill/examples/dynamic-context.md +31 -0
  94. package/templates/skills/cbp-build-cc-skill/examples/fork-skill.md +22 -0
  95. package/templates/skills/cbp-build-cc-skill/examples/knowledge-skill.md +25 -0
  96. package/templates/skills/cbp-build-cc-skill/examples/task-skill.md +29 -0
  97. package/templates/skills/cbp-build-cc-skill/reference/cbp-quality.md +157 -0
  98. package/templates/skills/cbp-build-cc-skill/reference/frontmatter-fields.md +35 -0
  99. package/templates/skills/cbp-build-cc-skill/reference/string-substitutions.md +60 -0
  100. package/templates/skills/cbp-build-cc-skill/scripts/validate-skill.sh +90 -0
  101. package/templates/skills/cbp-build-cc-skill/templates/skill.md +51 -0
  102. package/templates/skills/cbp-checkpoint-check/SKILL.md +156 -0
  103. package/templates/skills/cbp-checkpoint-complete/SKILL.md +109 -0
  104. package/templates/skills/cbp-checkpoint-create/SKILL.md +287 -0
  105. package/templates/skills/cbp-checkpoint-end/SKILL.md +241 -0
  106. package/templates/skills/cbp-checkpoint-update/SKILL.md +115 -0
  107. package/templates/skills/cbp-frontend-a11y/SKILL.md +109 -0
  108. package/templates/skills/cbp-frontend-a11y/reference/aria-roles-states.md +130 -0
  109. package/templates/skills/cbp-frontend-a11y/reference/contrast-visual.md +122 -0
  110. package/templates/skills/cbp-frontend-a11y/reference/keyboard-patterns.md +154 -0
  111. package/templates/skills/cbp-frontend-a11y/reference/semantic-html.md +111 -0
  112. package/templates/skills/cbp-frontend-design/SKILL.md +145 -0
  113. package/templates/skills/cbp-frontend-design/reference/nextjs-scss.md +118 -0
  114. package/templates/skills/cbp-frontend-design/reference/rn-expo.md +101 -0
  115. package/templates/skills/cbp-frontend-design/reference/tauri-react.md +82 -0
  116. package/templates/skills/cbp-frontend-ui/SKILL.md +262 -0
  117. package/templates/skills/cbp-frontend-ui/reference/ui-label-maps.md +42 -0
  118. package/templates/skills/cbp-frontend-ui/reference/ui-layout-patterns.md +105 -0
  119. package/templates/skills/cbp-frontend-ui/reference/variant-defaults.md +149 -0
  120. package/templates/skills/cbp-frontend-ux/SKILL.md +181 -0
  121. package/templates/skills/cbp-git-branch-feat-create/SKILL.md +115 -0
  122. package/templates/skills/cbp-git-commit/SKILL.md +278 -0
  123. package/templates/skills/cbp-git-worktree-create/SKILL.md +226 -0
  124. package/templates/skills/cbp-git-worktree-remove/SKILL.md +145 -0
  125. package/templates/skills/cbp-merge-main/SKILL.md +228 -0
  126. package/templates/skills/cbp-round-check/SKILL.md +104 -0
  127. package/templates/skills/cbp-round-end/SKILL.md +183 -0
  128. package/templates/skills/cbp-round-end/reference/findings-presentation.md +44 -0
  129. package/templates/skills/cbp-round-end/reference/inline-fallback.md +35 -0
  130. package/templates/skills/cbp-round-execute/SKILL.md +211 -0
  131. package/templates/skills/cbp-round-execute/reference/inline-fallback.md +59 -0
  132. package/templates/skills/cbp-round-input/SKILL.md +165 -0
  133. package/templates/skills/cbp-round-start/SKILL.md +222 -0
  134. package/templates/skills/cbp-round-update/SKILL.md +163 -0
  135. package/templates/skills/cbp-session-end/SKILL.md +187 -0
  136. package/templates/skills/cbp-session-start/SKILL.md +155 -0
  137. package/templates/skills/cbp-ship/SKILL.md +332 -0
  138. package/templates/skills/cbp-ship/reference/changesets-overview.md +120 -0
  139. package/templates/skills/cbp-ship/reference/eas-cli-overview.md +60 -0
  140. package/templates/skills/cbp-ship/reference/gh-cli-overview.md +135 -0
  141. package/templates/skills/cbp-ship/reference/gh-cli-shipment-commands.md +283 -0
  142. package/templates/skills/cbp-ship/reference/npm-publish-monorepo.md +252 -0
  143. package/templates/skills/cbp-ship/reference/npm-publish-oidc-trusted.md +157 -0
  144. package/templates/skills/cbp-ship/reference/npm-publish-overview.md +171 -0
  145. package/templates/skills/cbp-ship/reference/preflight-checklist.md +88 -0
  146. package/templates/skills/cbp-ship/reference/railway-nestjs-deployment.md +169 -0
  147. package/templates/skills/cbp-ship/reference/railway-overview.md +120 -0
  148. package/templates/skills/cbp-ship/reference/railway-troubleshooting.md +168 -0
  149. package/templates/skills/cbp-ship/reference/release-please-overview.md +99 -0
  150. package/templates/skills/cbp-ship/reference/surface-expo-eas.md +155 -0
  151. package/templates/skills/cbp-ship/reference/surface-npm.md +180 -0
  152. package/templates/skills/cbp-ship/reference/surface-railway.md +152 -0
  153. package/templates/skills/cbp-ship/reference/surface-supabase.md +178 -0
  154. package/templates/skills/cbp-ship/reference/surface-tauri.md +138 -0
  155. package/templates/skills/cbp-ship/reference/surface-vercel.md +124 -0
  156. package/templates/skills/cbp-ship/reference/surface-vscode-ext.md +144 -0
  157. package/templates/skills/cbp-ship/reference/surfaces.md +60 -0
  158. package/templates/skills/cbp-ship/reference/testflight-automation.md +215 -0
  159. package/templates/skills/cbp-ship/reference/testflight-internal-vs-external.md +69 -0
  160. package/templates/skills/cbp-ship/reference/testflight-overview.md +98 -0
  161. package/templates/skills/cbp-ship/reference/versioning.md +116 -0
  162. package/templates/skills/cbp-ship/scripts/detect-surfaces.sh +217 -0
  163. package/templates/skills/cbp-ship/scripts/verify-expo-eas.sh +35 -0
  164. package/templates/skills/cbp-ship/scripts/verify-npm.sh +21 -0
  165. package/templates/skills/cbp-ship/scripts/verify-railway.sh +41 -0
  166. package/templates/skills/cbp-ship/scripts/verify-supabase.sh +19 -0
  167. package/templates/skills/cbp-ship/scripts/verify-tauri.sh +24 -0
  168. package/templates/skills/cbp-ship/scripts/verify-vercel.sh +32 -0
  169. package/templates/skills/cbp-ship/scripts/verify-vscode-ext.sh +25 -0
  170. package/templates/skills/cbp-ship/templates/eas.json +66 -0
  171. package/templates/skills/cbp-ship/templates/railway.toml +15 -0
  172. package/templates/skills/cbp-ship/templates/release-please-config.json +17 -0
  173. package/templates/skills/cbp-ship/templates/vercel.json +19 -0
  174. package/templates/skills/cbp-ship/templates/vscodeignore +21 -0
  175. package/templates/skills/cbp-ship/templates/workflow-changesets.yml +41 -0
  176. package/templates/skills/cbp-ship/templates/workflow-eas-submit.yml +53 -0
  177. package/templates/skills/cbp-ship/templates/workflow-npm-publish.yml +36 -0
  178. package/templates/skills/cbp-ship/templates/workflow-release-please.yml +21 -0
  179. package/templates/skills/cbp-ship/templates/workflow-tauri-release.yml +69 -0
  180. package/templates/skills/cbp-ship/templates/workflow-vsce-publish.yml +31 -0
  181. package/templates/skills/cbp-ship-configure/SKILL.md +296 -0
  182. package/templates/skills/cbp-ship-configure/reference/expo-mobile.md +204 -0
  183. package/templates/skills/cbp-ship-configure/reference/npm-package.md +165 -0
  184. package/templates/skills/cbp-ship-configure/reference/railway-backend.md +199 -0
  185. package/templates/skills/cbp-ship-configure/reference/supabase.md +200 -0
  186. package/templates/skills/cbp-ship-configure/reference/tauri-desktop.md +181 -0
  187. package/templates/skills/cbp-ship-configure/reference/vercel.md +117 -0
  188. package/templates/skills/cbp-ship-configure/reference/vscode-ext.md +155 -0
  189. package/templates/skills/cbp-ship-main/SKILL.md +65 -0
  190. package/templates/skills/cbp-supabase-branch-check/SKILL.md +337 -0
  191. package/templates/skills/cbp-supabase-branch-check/reference/dag-steps.md +29 -0
  192. package/templates/skills/cbp-supabase-migrate/SKILL.md +314 -0
  193. package/templates/skills/cbp-supabase-migrate/reference/advisor-triage.md +70 -0
  194. package/templates/skills/cbp-supabase-migrate/reference/cli-fallback.md +87 -0
  195. package/templates/skills/cbp-supabase-migrate/reference/preflight-dry-run.md +58 -0
  196. package/templates/skills/cbp-supabase-setup/SKILL.md +239 -0
  197. package/templates/skills/cbp-supabase-setup/reference/branching-setup.md +121 -0
  198. package/templates/skills/cbp-supabase-setup/reference/cli-fallback.md +109 -0
  199. package/templates/skills/cbp-task-check/SKILL.md +166 -0
  200. package/templates/skills/cbp-task-complete/SKILL.md +206 -0
  201. package/templates/skills/cbp-task-complete/reference/checkpoint-done-branching.md +48 -0
  202. package/templates/skills/cbp-task-complete/reference/next-step-heuristic.md +56 -0
  203. package/templates/skills/cbp-task-create/SKILL.md +167 -0
  204. package/templates/skills/cbp-task-start/SKILL.md +239 -0
  205. package/templates/skills/cbp-task-testing/SKILL.md +277 -0
  206. package/templates/skills/cbp-todo/SKILL.md +97 -0
@@ -0,0 +1,239 @@
1
+ ---
2
+ scope: org-shared
3
+ name: cbp-task-start
4
+ description: Start a task, load context from DB
5
+ triggers: [cbp-round-start]
6
+ argument-hint: [chk-task | task] # e.g. `108-1` (CHK-108 TASK-1) or `45` (standalone TASK-45)
7
+ effort: xhigh
8
+ ---
9
+
10
+ # Task Start Command
11
+
12
+ Start a task by loading context from the database and preparing for work.
13
+
14
+ ## Instructions
15
+
16
+ ### Step 1: Parse `$ARGUMENTS`
17
+
18
+ Parse the argument using the canonical chk-task-round notation (see `.claude/rules/notation-consistency.md`):
19
+
20
+ | Shape | Regex | Resolves to |
21
+ |-------|-------|-------------|
22
+ | `{chk}-{task}` (e.g. `108-1`) | `^[0-9]+-[0-9]+$` | Checkpoint-bound: CHK-{chk} TASK-{task} |
23
+ | `{task}` (e.g. `45`) | `^[0-9]+$` | Standalone: standalone TASK-{task} **only** (bare number = standalone discriminator) |
24
+ | _(empty)_ | — | Use MCP `get_current_task` to find the next pending task |
25
+
26
+ Anything else is malformed — surface this error and stop:
27
+
28
+ ```
29
+ task-start: invalid argument `{value}`. Expected:
30
+ 108-1 → CHK-108 TASK-1 (checkpoint-bound)
31
+ 45 → standalone TASK-45
32
+ (empty) → next pending task
33
+
34
+ For a specific round, use `/cbp-round-start 108-1-2`.
35
+ ```
36
+
37
+ Error cases: `108-1-2` (that is round-start's shape), `abc`, `108-`, `-1`, `108--1`, anything with whitespace or non-numeric characters.
38
+
39
+ **BREAKING from prior behaviour**: bare-number now resolves to **standalone only**. Previously `task-start 45` would match the first TASK-45 it found anywhere; that heuristic is removed. To target a checkpoint-bound TASK-45, use `{chk}-45`.
40
+
41
+ #### Worked examples
42
+
43
+ - `task-start 108-1` → CHK-108 TASK-1
44
+ - `task-start 45` → standalone TASK-45 (errors if no standalone TASK-45 exists)
45
+ - `task-start` (no arg) → next pending via `get_current_task`
46
+ - `task-start 108-1-2` → error: "use `/cbp-round-start 108-1-2`"
47
+ - `task-start abc` → error: malformed
48
+ - `task-start 108-` → error: malformed
49
+
50
+ ### Step 2: Resolve Checkpoint and Task
51
+
52
+ Given the parse from Step 1:
53
+
54
+ | Parse | Resolution path |
55
+ |-------|-----------------|
56
+ | `{chk}-{task}` | MCP `get_checkpoints(repo_id)` → filter `number === {chk}` (must exist). MCP `get_tasks(checkpoint_id)` → filter `number === {task}` (must exist). |
57
+ | `{task}` | MCP `get_tasks(repo_id, standalone: true)` → filter `number === {task}` (must exist). Checkpoint context is null for the rest of the skill. |
58
+ | _(empty)_ | MCP `get_current_task(repo_id)` — output gives both checkpoint (if any) and task. When multiple checkpoints are active and the result is ambiguous, surface the disambiguation prompt and stop. |
59
+
60
+ If any required row is missing, surface this and stop:
61
+
62
+ ```
63
+ task-start: no task found for `{ARG}`.
64
+ - For `108-1`: CHK-108 may not exist, or TASK-1 may not exist within it.
65
+ - For `45`: no standalone TASK-45 exists. If a checkpoint-bound TASK-45 exists, invoke as `{chk}-45`.
66
+ ```
67
+
68
+ ### Step 3: Branch Auto-Handling
69
+
70
+ The task MUST run on its target feat branch. Claude switches/creates that branch automatically — never asks the user to do it.
71
+
72
+ #### 3.1 — Determine the target branch
73
+
74
+ Read `.codebyplan/git.json`:
75
+ - `branch_config.protected` (fall back to `["main", "development"]`)
76
+ - `branch_config.integration` (fall back to `"development"`)
77
+
78
+ Compute `TARGET`:
79
+
80
+ | Task type | TARGET |
81
+ |-----------|--------|
82
+ | Checkpoint-bound, `checkpoint.branch_name` set | `checkpoint.branch_name` (e.g. `feat/CHK-095-pricing-page`) |
83
+ | Checkpoint-bound, `branch_name` null (legacy) | `feat/CHK-{NNN}-{kebab-slug-from-checkpoint-title}` |
84
+ | Standalone | `feat/standalone-TASK-{N}-{kebab-slug-from-task-title}` |
85
+
86
+ Slug rules: lowercase, words joined by `-`, drop punctuation, truncate to 40 chars.
87
+
88
+ #### 3.2 — Compare current branch
89
+
90
+ Run `git branch --show-current`. If `current == TARGET` → continue to Step 3b. Done.
91
+
92
+ #### 3.3 — Switch automatically (no AskUserQuestion, no blocking)
93
+
94
+ Run the switch directly. Three sub-cases, in order:
95
+
96
+ ```bash
97
+ # (a) target exists locally
98
+ if git rev-parse --verify "$TARGET" >/dev/null 2>&1; then
99
+ git checkout "$TARGET"
100
+
101
+ # (b) target exists on origin (track it)
102
+ elif git rev-parse --verify "origin/$TARGET" >/dev/null 2>&1; then
103
+ git checkout -t "origin/$TARGET"
104
+
105
+ # (c) target doesn't exist — create from integration branch
106
+ else
107
+ # First make sure integration is up to date
108
+ git fetch origin "$INTEGRATION" 2>/dev/null || true
109
+ git checkout -b "$TARGET" "origin/$INTEGRATION" 2>/dev/null \
110
+ || git checkout -b "$TARGET" "$INTEGRATION"
111
+ fi
112
+ ```
113
+
114
+ **Carrying uncommitted work** — `git checkout` carries clean (non-conflicting) working-tree changes to the new branch automatically. This is intended: changes made on `development` while preparing the task move with the user to the new feat branch. No `git stash`, ever (per `git-safety.md`). No `git add`, ever (per `git-workflow.md`).
115
+
116
+ **If `git checkout` exits non-zero** (typically "would clobber" because a tracked file has unstaged changes that conflict with target's version): surface the raw git error verbatim, stop, do NOT attempt recovery. The user resolves and re-invokes. This is the only case where `/cbp-task-start` halts on branch state.
117
+
118
+ #### 3.4 — Persist + verify
119
+
120
+ After successful switch:
121
+
122
+ 1. Re-run `git branch --show-current` to confirm `current == TARGET`. If not, fail loudly — something raced.
123
+ 2. **Persist for next time**:
124
+ - Standalone task → `update_task(task_id, context: { ...task.context, branch_name: TARGET })`
125
+ - Checkpoint with `branch_name: null` → `update_checkpoint(checkpoint_id, branch_name: TARGET)`
126
+ - Checkpoint with existing `branch_name` → no write (already canonical)
127
+ 3. One-line confirmation in output: `Branch: [TARGET] (switched from [previous])`. No prompt, no waiting.
128
+
129
+ #### 3.5 — Protected-branch sanity (defensive)
130
+
131
+ After all of the above, `current` should be a feat branch by construction. If somehow it's still in `branch_config.protected` (e.g. TARGET resolved to "development" because a checkpoint has a malformed `branch_name`), THEN block with a hard error citing the bad config — this is a data bug, not a user workflow problem.
132
+
133
+ ### Step 3b: Clean Slate
134
+
135
+ Before loading context, ensure a clean working tree:
136
+
137
+ 1. Run `git status --short` to check for uncommitted files
138
+ 2. If uncommitted files exist → commit them with message `chore: clean slate for task start`. **Prefer plain `git add -A && git commit -m "..."` over MCP `git_commit`** — the MCP variant resolves to the main repo path and silently fails inside a worktree.
139
+ 3. This ensures the task starts with a clean working tree so all file changes during the task are properly tracked
140
+
141
+ ### Step 3c: CVE/GHSA Audit Sweep
142
+
143
+ Skip this step if the task title and requirements contain no CVE ID (`CVE-YYYY-NNNNN`) or GHSA ID (`GHSA-xxxx-xxxx-xxxx`). Otherwise:
144
+
145
+ 1. Run `pnpm audit --json` from the monorepo root. If it fails (network, registry), surface the error and stop — do NOT start a CVE task without a clean snapshot.
146
+ 2. Parse the advisory list from the JSON output.
147
+ 3. Call MCP `get_tasks(repo_id)`; for each advisory, match by ID in task title/requirements.
148
+ 4. For every advisory with no matching open task, call MCP `create_task` per `immediate-issue-capture.md`.
149
+ 5. Report the sweep result:
150
+ ```
151
+ ## CVE/GHSA Audit Sweep
152
+ - Total advisories: N
153
+ - Already tracked: M
154
+ - Newly captured: K (TASK-a, TASK-b, …)
155
+ ```
156
+
157
+ See `dependency-vulnerability-fixes.md` "Audit Sweep at Task Start" for the source rule.
158
+
159
+ ### Step 3.5: Worktree-Match Verification
160
+
161
+ Before activating the task, verify the caller's worktree matches the assigned worktree on the target row. (Per CHK-104 TASK-2 — DB-level hard-lock prevents cross-worktree mutations.)
162
+
163
+ 1. Read caller worktree: `CALLER_WT=$(npx codebyplan resolve-worktree 2>/dev/null)`. If empty, the `caller_worktree_id` parameter is omitted from the MCP call entirely — the pre-guard is skipped and the update proceeds without a worktree check (backwards-compat).
164
+ 2. Determine target worktree:
165
+ - **Checkpoint-bound tasks**: `TARGET_WT = checkpoint.worktree_id` (read from MCP `get_checkpoints`). Note: checkpoint-bound tasks may have a NULL `task.assigned_worktree_id` because the lock lives on the parent checkpoint — fall through to `checkpoint.worktree_id`.
166
+ - **Standalone tasks**: `TARGET_WT = task.assigned_worktree_id`.
167
+ 3. If `TARGET_WT IS NOT NULL AND TARGET_WT != CALLER_WT`, surface this error and abort:
168
+
169
+ ```
170
+ TASK-N is assigned to worktree {TARGET_WT_NAME} ({TARGET_WT}); current worktree is {CALLER_WT_NAME} ({CALLER_WT}).
171
+ Use the release_assignment MCP tool (requires maintainer role) if {TARGET_WT_NAME} is dead, then re-run /cbp-task-start.
172
+ ```
173
+
174
+ 4. If `TARGET_WT IS NULL` or matches, proceed.
175
+
176
+ ### Step 3.6: Integration Drift Check (optional)
177
+
178
+ Before loading context, check if the feat branch has drifted from integration. Soft-skip on fetch failure (this gate is optional, not mandatory).
179
+
180
+ 1. Run `git fetch origin {INTEGRATION}` where `{INTEGRATION}` comes from `.codebyplan/git.json` `branch_config.integration` (default `development`). If fetch fails (offline, auth), skip this entire step silently and proceed to Step 4.
181
+ 2. Compute: `BEHIND=$(git rev-list --count HEAD..origin/{INTEGRATION})`.
182
+ 3. Compute `LAST_FETCH_AGE_HOURS` from the mtime of `.git/FETCH_HEAD` relative to now.
183
+ 4. If `BEHIND >= 10` OR `LAST_FETCH_AGE_HOURS > 24`: surface AskUserQuestion:
184
+
185
+ ```
186
+ Feat branch is {BEHIND} commits behind origin/{INTEGRATION} (last fetch {AGE}h ago).
187
+ Merge integration now before starting the task?
188
+ A) Yes — run /cbp-merge-main (recommended)
189
+ B) No — continue without merging
190
+ ```
191
+
192
+ 5. On **A**: trigger `/cbp-merge-main`. Wait for completion. If it fails (this is a hard stop — the user consented to the merge, so failure means the branch cannot safely proceed), surface the error and STOP `/cbp-task-start`.
193
+ 6. On **B**, or if `BEHIND < 10` AND `LAST_FETCH_AGE_HOURS <= 24`: proceed silently to Step 4.
194
+
195
+ ### Step 4: Load Context
196
+
197
+ Load context from DB:
198
+
199
+ 1. **Checkpoint context**: decisions, discoveries, dependencies, constraints
200
+ 2. **Task context**: task-specific decisions and requirements
201
+ 3. **Task research**: if any research was done
202
+ 4. **Previous rounds**: check for completed rounds via MCP `get_rounds`
203
+
204
+ Display context summary:
205
+
206
+ ```
207
+ ## Starting Task: TASK-[N]
208
+
209
+ **Checkpoint**: CHK-[NNN] - [title]
210
+ **Task**: [title]
211
+ **Requirements**: [requirements]
212
+
213
+ ### Context
214
+ - **Decisions**: [list locked decisions relevant to this task]
215
+ - **Dependencies**: [relevant dependencies]
216
+ - **Previous rounds**: [count] completed
217
+ ```
218
+
219
+ ### Step 5: Set Task Status
220
+
221
+ Use MCP `update_task(task_id, status: "in_progress")`.
222
+
223
+ If worktree_id present, include `claim_worktree_id` to auto-claim the checkpoint AND `caller_worktree_id: CALLER_WT` so the MCP server's pre-guard accepts the call (CHK-104 TASK-2 hard-lock).
224
+
225
+ ### Step 6: Auto-trigger Round Start
226
+
227
+ Automatically trigger `/cbp-round-start` for the first round. Do NOT wait for user input.
228
+
229
+ ```
230
+ Starting first round...
231
+ ```
232
+
233
+ Trigger `/cbp-round-start` (which will use task.requirements for round 1).
234
+
235
+ ## Integration
236
+
237
+ - **Reads**: MCP `get_current_task`, `get_tasks`, `get_rounds`
238
+ - **Writes**: MCP `update_task`
239
+ - **Triggers**: `/cbp-round-start` (auto, round 1)
@@ -0,0 +1,277 @@
1
+ ---
2
+ scope: org-shared
3
+ name: cbp-task-testing
4
+ description: Run comprehensive task-level testing after /cbp-task-check passes
5
+ argument-hint: [chk-task | task]
6
+ triggers: [cbp-task-complete]
7
+ effort: xhigh
8
+ ---
9
+
10
+ # Task Testing Command
11
+
12
+ Comprehensive task-level testing — runs all automated tests and walks the user through manual testing one-by-one. Distinct from round-level testing (`testing-qa-agent`): this tests the **entire delivered feature holistically** after all rounds are complete. Runs inline — no sub-agent.
13
+
14
+ ## When Used
15
+
16
+ - After `/cbp-task-check` passes with READY verdict (auto-triggered)
17
+ - Before `/cbp-task-complete`
18
+ - **Never skippable**
19
+
20
+ ## Scope vs Round-Level Validation
21
+
22
+ Per-wave `testing-qa-agent` runs inside `/cbp-round-execute` Step 5. This skill adds the cross-cutting layer that is only visible across the full task diff: full-repo lint, workspace tsc, full test suite, `pnpm audit`, and full-diff security scan — each run once here, not per-round.
23
+
24
+ ## Instructions
25
+
26
+ ### Step 1: Parse `$ARGUMENTS`
27
+
28
+ Parse the argument using the canonical chk-task-round notation (see `.claude/rules/notation-consistency.md`):
29
+
30
+ | Shape | Regex | Resolves to |
31
+ |-------|-------|-------------|
32
+ | `{chk}-{task}` (e.g. `108-1`) | `^[0-9]+-[0-9]+$` | Checkpoint-bound: CHK-{chk} TASK-{task} |
33
+ | `{task}` (e.g. `45`) | `^[0-9]+$` | Standalone: standalone TASK-{task} **only** |
34
+ | _(empty)_ | — | Use MCP `get_current_task` to find the active in-progress task |
35
+
36
+ Anything else is malformed — surface this error and stop:
37
+
38
+ ```
39
+ task-testing: invalid argument `{value}`. Expected:
40
+ 108-1 → CHK-108 TASK-1 (checkpoint-bound)
41
+ 45 → standalone TASK-45
42
+ (empty) → active in-progress task
43
+
44
+ For a specific round, use `/cbp-round-update 108-1-2`.
45
+ ```
46
+
47
+ Error cases: `108-1-2` (that is round-update's shape), `abc`, `108-`, `-1`, `108--1`, anything with whitespace or non-numeric characters.
48
+
49
+ #### Worked examples
50
+
51
+ - `task-testing 108-1` → CHK-108 TASK-1
52
+ - `task-testing 45` → standalone TASK-45
53
+ - `task-testing` (no arg) → active in-progress task via `get_current_task`
54
+ - `task-testing 108-1-2` → error: "use `/cbp-round-update 108-1-2`"
55
+ - `task-testing abc` → error: malformed
56
+
57
+ ### Step 1.5: Get Current Task
58
+
59
+ Given the parse from Step 1:
60
+
61
+ | Parse | Resolution path |
62
+ |-------|-----------------|
63
+ | `{chk}-{task}` | MCP `get_checkpoints(repo_id)` → filter `number === {chk}`. MCP `get_tasks(checkpoint_id)` → filter `number === {task}`. |
64
+ | `{task}` | MCP `get_tasks(repo_id, standalone: true)` → filter `number === {task}`. |
65
+ | _(empty)_ | MCP `get_current_task(repo_id)` — finds the active in-progress task. |
66
+
67
+ If no in-progress task, show error and stop.
68
+
69
+ ### Step 2: Verify All Rounds Complete
70
+
71
+ Use MCP `get_rounds(task_id)`. Verify all rounds are `completed`. If any still `in_progress`:
72
+
73
+ ```
74
+ ## Cannot Run Task Testing
75
+
76
+ TASK-[N] has an active round (Round [N]). Complete it first:
77
+ - Run `/cbp-round-update` to finish the round
78
+ ```
79
+
80
+ Stop.
81
+
82
+ ### Step 3: Verify `/cbp-task-check` Passed
83
+
84
+ Check `task.context.check_verdict`: must exist and have `verdict = "READY"`. Otherwise:
85
+
86
+ ```
87
+ ## Cannot Run Task Testing
88
+
89
+ `/cbp-task-check` has not passed yet. Run `/cbp-task-check` first.
90
+ ```
91
+
92
+ Stop.
93
+
94
+ ### Step 4: Aggregate Files Changed
95
+
96
+ Collect all `files_changed` from all rounds, deduplicate (latest action per path wins). Skip deleted files for file-reading in Step 5.
97
+
98
+ ### Step 5: Read ALL Final Changed Files
99
+
100
+ Read every non-deleted file in the aggregated list. Understand the complete delivered work across all rounds. Build a mental model of what was built and how it connects.
101
+
102
+ ### Step 6: Run Comprehensive Automated Testing
103
+
104
+ Capture stdout and stderr for each check.
105
+
106
+ **Hard-fail tests** (block completion):
107
+
108
+ | Category | Command | Condition |
109
+ | ----------------------- | ------------------------------- | -------------------------------- |
110
+ | Full-repo lint | `pnpm -w lint` | Always |
111
+ | Full-repo types | `pnpm exec tsc --noEmit` | Source files changed |
112
+ | Full-repo unit tests | `pnpm test --run` | Source files in aggregated_files |
113
+ | Full-repo audit | `pnpm audit` | Always |
114
+ | Per-package E2E | `pnpm --filter <pkg> e2e:test` | UI files in aggregated_files |
115
+ | Full-diff security scan | inline grep or `security-agent` | Always |
116
+
117
+ Per-file lint + format are enforced by `lint-format-on-edit.sh` hook per edit. This step catches cross-package issues invisible to per-wave checks.
118
+
119
+ **Soft tests** (report, don't block):
120
+
121
+ | Category | Method | Condition |
122
+ | ---------- | ----------------------------------------- | ---------------------------- |
123
+ | Visual | Screenshot compare via `e2e:visual-check` | UI work + dev server running |
124
+ | API Health | `curl` health endpoint | API routes changed |
125
+
126
+ For each test, record: `category, status (pass|fail|skipped), details, stdout, stderr`.
127
+
128
+ #### Step 6.x: Autonomous Sim Screenshot Validation (mobile / on-device)
129
+
130
+ For mobile rounds (Maestro / XCUITest / Tauri-mobile) where unit tests passed but the round touched component-mount code paths (custom hooks, prop signatures, conditional renders, navigation tabs), unit-test green is NOT sufficient evidence that the screen mounts at runtime. Use the autonomous sim screenshot loop to catch runtime crashes invisible to mocked unit tests.
131
+
132
+ **Procedure** (when iOS Simulator is the target — adapt the screenshot command for Android/Tauri equivalents):
133
+
134
+ 1. Confirm the target screen's default state via `Read` of its parent component or store.
135
+ 2. If the screen is normally gated behind a tab/route the simulator isn't currently on, temporarily flip the gating state's default value at the screen's entry point (`useState(initialTab) → useState('targetTab')` or equivalent) so the screen mounts on the next reload.
136
+ 3. Trigger a Fast Refresh by saving a touched file, then capture: `xcrun simctl io booted screenshot /tmp/codebyplan-task-testing-{task}-{state}.png`.
137
+ 4. Read the screenshot via the multimodal Read tool. Confirm the screen rendered (vs blank/crash/red-box error overlay).
138
+ 5. Revert the state-default flip from step 2. Confirm the file diff is empty (`git diff <path>`) before proceeding.
139
+
140
+ **When to use**: round modifies hook usage, prop signatures, component-tree shape, or store subscriptions on a screen whose unit tests mock the data layer. Skip when the modified code path has no UI surface (pure utilities, server actions).
141
+
142
+ **When NOT to use**: don't flip state defaults on the main app entry / auth gate / feature-flag boundaries — the revert risk is too high. Use storybook or a dedicated `__dev__` tab if the screen has cross-cutting state.
143
+
144
+ Record the result in `task_testing_output.autonomous_sim_check`:
145
+
146
+ ```yaml
147
+ autonomous_sim_check:
148
+ screen: "<screen-name>"
149
+ status: "rendered" | "crashed" | "blank"
150
+ screenshot_path: "/tmp/codebyplan-task-testing-..."
151
+ state_flip_reverted: true
152
+ ```
153
+
154
+ This technique uniquely catches Rules-of-Hooks violations and prop-shape mismatches that mocked unit tests cannot detect — the runtime hook scheduler is the only oracle.
155
+
156
+ ### Step 6.5: Cross-Round Code Review
157
+
158
+ Round-level code review runs per-round via `improve-round` at `/cbp-round-end`. This step adds the cross-round holistic layer — things only visible once all rounds are aggregated.
159
+
160
+ Inline review (no sub-agent) across the aggregated files read in Step 5. Check:
161
+
162
+ | Concern | What to Look For |
163
+ | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
164
+ | Leftover debug | `console.log`, `debugger`, commented-out blocks, `TODO`/`FIXME` added during this task |
165
+ | Cross-round duplication | Same helper/logic written independently in 2+ rounds — candidate for extraction |
166
+ | Convention drift | One round introduces a pattern (error handling, naming, file layout) that contradicts a pattern established in an earlier round of the same task |
167
+ | Incomplete follow-through | A round added a type/field/table column that later rounds never consume |
168
+ | Orphaned additions | Exports or utilities added in an early round with no callers after later rounds refactored past them |
169
+
170
+ For each finding, record: `{category, file, description, severity: 'low'|'medium'|'high', suggested_fix}`.
171
+
172
+ Findings with severity `medium` or `high` feed the Step 9 problem classification. `low` findings are recorded in `task_testing_output` for the record but do not block.
173
+
174
+ If any finding points to a need that exceeds task scope (e.g. a utility worth extracting for the wider codebase, a convention the repo should adopt globally), route per `immediate-issue-capture.md` "How to Capture" — default to a NEW TASK in the current checkpoint, not a standalone task. Standalone routing applies only when the finding is genuinely off-axis from every active checkpoint AND the user has confirmed standalone routing.
175
+
176
+ ### Step 7: Separate Claude-Testable vs User-Testable
177
+
178
+ **Claude handles automatically** (Step 6): build, types, unit tests, E2E tests, visual, API health.
179
+
180
+ **User must verify** (requires human judgment):
181
+
182
+ - Visual appearance quality (does it look good?)
183
+ - UX flow (is the interaction intuitive?)
184
+ - Business logic correctness (does it do the right thing?)
185
+ - Edge cases (unusual inputs, boundary conditions)
186
+ - Cross-browser / real-device behavior
187
+ - Content accuracy (text, labels, messages)
188
+
189
+ Generate user test items based on: task requirements, changed files, round context.
190
+
191
+ ### Step 8: User Testing Walkthrough
192
+
193
+ Present all user-testable items as a **single checklist in one `AskUserQuestion` prompt**. Do not ask one question per item — the batched format is preferred.
194
+
195
+ Format the question so every item is visible in the checklist, with a single overall answer (e.g., "all pass", "minor issues", "major issues"). Provide the description, how-to-test steps, and expected result per item inside the question body. If the user reports mixed results, collect the specifics in a follow-up.
196
+
197
+ Record the aggregate response and any per-item notes.
198
+
199
+ ### Step 9: Classify Problems
200
+
201
+ Collect failures from automated tests (Step 6), cross-round code review (Step 6.5, medium+), and user tests (Step 8). Classify:
202
+
203
+ - **Minor** (round-fixable): styling, small bugs, missing edge cases, localized duplication
204
+ - **Major** (new-task-worthy): architectural issues, missing features, fundamental design problems, convention drift that spans multiple files
205
+
206
+ ### Step 10: Save Results
207
+
208
+ ```ts
209
+ update_task(task_id, {
210
+ context: {
211
+ ...existing,
212
+ task_testing_output: {
213
+ claude_tests: [...],
214
+ cross_round_code_findings: [...], // from Step 6.5
215
+ user_tests: [...],
216
+ problems_found: [...],
217
+ all_passed: boolean,
218
+ summary: { total, passed, failed, pending }
219
+ }
220
+ }
221
+ })
222
+ ```
223
+
224
+ ### Step 11: Route Based on Results
225
+
226
+ **ALL PASS:**
227
+
228
+ ```
229
+ All tests passed for TASK-[N]. Routing to task-complete...
230
+ ```
231
+
232
+ Auto-trigger `/cbp-task-complete`.
233
+
234
+ **Minor problems found:**
235
+
236
+ ---
237
+
238
+ **Next:**
239
+ Run `/cbp-round-input` to:
240
+
241
+ - Address the minor issues found during testing
242
+ - Create a focused round for fixes
243
+
244
+ ---
245
+
246
+ Waiting for user to run `/cbp-round-input`.
247
+
248
+ **Major problems found:**
249
+
250
+ ---
251
+
252
+ **Next:**
253
+ Run `/cbp-task-create` to:
254
+
255
+ - Create a new task for the identified issues
256
+
257
+ ---
258
+
259
+ Waiting for user to run `/cbp-task-create`.
260
+
261
+ **User wants re-test:** Suggest re-running `/cbp-task-testing`.
262
+
263
+ ## Key Rules
264
+
265
+ - **Never skippable** — mandatory before `/cbp-task-complete`
266
+ - **Must loop until everything passes** — problems must be addressed
267
+ - **No file changes** — testing only, never edit
268
+ - **Batch user tests** — present all user-testable items in a single `AskUserQuestion` checklist; never one-per-question
269
+ - **Read actual files** — do not rely on metadata alone
270
+ - **Run actual commands** — capture real stdout/stderr
271
+
272
+ ## Integration
273
+
274
+ - **Reads**: MCP `get_current_task`, `get_rounds`, all aggregated files
275
+ - **Writes**: MCP `update_task` (context.task_testing_output)
276
+ - **Triggers**: `/cbp-task-complete` (auto, when ALL PASS)
277
+ - **Triggered by**: user runs `/cbp-task-testing {chk-task}` per directive from `/cbp-task-check` on READY verdict (after `/cbp-round-execute`-driven validation completed all rounds)
@@ -0,0 +1,97 @@
1
+ ---
2
+ scope: org-shared
3
+ name: cbp-todo
4
+ description: Entry point - what to work on next
5
+ effort: low
6
+ ---
7
+
8
+ # Todo Command
9
+
10
+ Single MCP call to determine next action, then load appropriate context before triggering the command. This is the **sole entry point** after `/clear` — it ensures Claude always has full context before any command runs.
11
+
12
+ ## Instructions
13
+
14
+ ### Step 0: Resolve Caller Worktree
15
+
16
+ Before any MCP call, derive the caller's `worktree_id` at runtime via `npx codebyplan resolve-worktree` so downstream calls can identify this worktree for hard-lock enforcement (CHK-104 TASK-2). The CLI resolves the tuple (device_id, repo path, current branch) against the worktrees table; CHK-108 removed the legacy `worktree_id` field from `.codebyplan/repo.json`.
17
+
18
+ ```bash
19
+ WORKTREE_ID=$(npx codebyplan resolve-worktree 2>/dev/null)
20
+ ```
21
+
22
+ - **`WORKTREE_ID` non-empty** → forward as `worktree_id` to the `get_next_action` call in Step 1.
23
+ - **`WORKTREE_ID` empty** → the current repo path + branch did not match any worktree row. The MCP server's hard-lock will reject mutations on assigned rows; surface a one-line note to the user that the worktree may need registration via `npx codebyplan setup` from this directory.
24
+
25
+ ### Step 1: Get Next Action
26
+
27
+ Use MCP `get_next_action` with `repo_id` and `worktree_id` (if present from Step 0).
28
+
29
+ ### Step 2: Load Context Based on Command
30
+
31
+ Before triggering the command, load the context it needs. This ensures `/clear` + `/cbp-todo` reliably restores full working context.
32
+
33
+ **Use the context loading matrix below.** Match the `command` from the response to determine what to load.
34
+
35
+ | Command Pattern | Context to Load |
36
+ |----------------|-----------------|
37
+ | `/cbp-session-start` | None — `/cbp-session-start` handles its own loading |
38
+ | `/cbp-checkpoint-create` | If checkpoint exists in response context: load checkpoint via MCP `get_checkpoints` (filter by number). Display checkpoint title, goal, ideas summary |
39
+ | `/cbp-task-start [N]` | Load via MCP `get_current_task`. Display checkpoint title + task title/requirements summary |
40
+ | `/cbp-round-start` | Load via MCP `get_current_task` + `get_rounds(task_id)`. Display checkpoint + task + round count + last round summary |
41
+ | `/cbp-round-update` | Load via MCP `get_current_task` + `get_rounds(task_id)`. Display checkpoint + task + files_changed approval summary |
42
+ | `/cbp-round-input` | **Full context load** (see Step 2b) |
43
+ | `/cbp-task-check` | Load via MCP `get_current_task`. Display checkpoint + task + files summary |
44
+ | `/cbp-task-testing` | Load via MCP `get_current_task` + `get_rounds(task_id)`. Display checkpoint + task + testing status summary |
45
+ | `/cbp-task-create` | Load via MCP `get_current_task`. Display checkpoint + task list summary |
46
+ | `/cbp-task-complete` | Load via MCP `get_current_task`. Display checkpoint + task summary |
47
+ | `/cbp-checkpoint-complete` | Load via MCP `get_current_task`. Display checkpoint summary |
48
+ | *(no command / idle)* | See Step 3 — suggest `/cbp-session-end` |
49
+
50
+ **For any unrecognized command:** Load via MCP `get_current_task` as a safe default. Display whatever context is available.
51
+
52
+ ### Step 2b: Full Context Load (for `/cbp-round-input`)
53
+
54
+ This is the most context-dependent command. Load everything:
55
+
56
+ 1. **MCP `get_current_task`** — checkpoint (title, goal, context with decisions/discoveries) + task (title, requirements, context, files_changed, QA)
57
+ 2. **MCP `get_rounds(task_id)`** — all rounds for the task (requirements, context with executor_output/testing_qa_output, QA)
58
+
59
+ Display a brief context summary:
60
+
61
+ ```
62
+ ## Context Loaded
63
+
64
+ **Checkpoint**: CHK-[NNN] - [title]
65
+ **Task**: TASK-[N] - [title]
66
+ **Rounds completed**: [N]
67
+ **Files**: [X] approved / [Y] total
68
+
69
+ ### Key Decisions:
70
+ - [list locked decisions from checkpoint + task context]
71
+
72
+ ### Last Round:
73
+ [Brief: what was done, what passed/failed]
74
+ ```
75
+
76
+ ### Step 3: Suggest Session End When Idle
77
+
78
+ If `get_next_action` returns no actionable `command` (null, empty, or explicit idle/done signal) — i.e. no active checkpoint with pending work — **do not auto-trigger anything**. Instead, suggest ending the session:
79
+
80
+ ```
81
+ No work remaining in the current checkpoint.
82
+
83
+ Run `/cbp-session-end` to finalize the session log and close out.
84
+ Or run `/cbp-checkpoint-create` to start new work.
85
+ ```
86
+
87
+ Wait for the user. Do not auto-trigger `/cbp-session-end` — session wrap-up is a user-driven decision.
88
+
89
+ ### Step 4: Display and Auto-trigger
90
+
91
+ If Step 3 found actionable work, show `instructions` from the get_next_action response (gives user a chance to see what's happening), then auto-trigger the `command`.
92
+
93
+ ## Integration
94
+
95
+ - **Called by**: `/cbp-session-start`, `/cbp-task-complete`, `/cbp-checkpoint-complete`, manual, after `/clear`
96
+ - **Reads**: MCP `get_next_action`, `get_current_task`, `get_rounds`, `get_checkpoints`
97
+ - **Triggers**: `command` from response (auto)