codebyplan 1.5.1 → 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.
- package/dist/cli.js +4462 -748
- package/package.json +5 -1
- package/templates/.gitkeep +0 -0
- package/templates/README.md +20 -0
- package/templates/agents/cbp-cc-executor.md +213 -0
- package/templates/agents/cbp-database-agent.md +229 -0
- package/templates/agents/cbp-improve-claude.md +245 -0
- package/templates/agents/cbp-improve-round.md +284 -0
- package/templates/agents/cbp-mechanical-edits.md +111 -0
- package/templates/agents/cbp-research.md +282 -0
- package/templates/agents/cbp-round-executor.md +604 -0
- package/templates/agents/cbp-security-agent.md +134 -0
- package/templates/agents/cbp-task-check.md +213 -0
- package/templates/agents/cbp-task-planner.md +582 -0
- package/templates/agents/cbp-test-e2e-agent.md +363 -0
- package/templates/agents/cbp-testing-qa-agent.md +400 -0
- package/templates/context/mcp-docs.md +139 -0
- package/templates/hooks/README.md +236 -0
- package/templates/hooks/cbp-auto-test-hooks.sh +44 -0
- package/templates/hooks/cbp-lint-format-on-edit.sh +159 -0
- package/templates/hooks/cbp-maestro-yaml-validate.sh +100 -0
- package/templates/hooks/cbp-mcp-migration-guard.sh +32 -0
- package/templates/hooks/cbp-mcp-round-sync.sh +79 -0
- package/templates/hooks/cbp-mcp-worktree-inject.sh +76 -0
- package/templates/hooks/cbp-notify.sh +68 -0
- package/templates/hooks/cbp-plugin-dispatch.sh +29 -0
- package/templates/hooks/cbp-pre-commit-quality-gate.sh +204 -0
- package/templates/hooks/cbp-statusline.sh +347 -0
- package/templates/hooks/cbp-subagent-statusline.sh +182 -0
- package/templates/hooks/cbp-test-coverage-gate.sh +144 -0
- package/templates/hooks/cbp-test-hooks.sh +320 -0
- package/templates/hooks/hooks.json +85 -0
- package/templates/hooks/validate-context-usage.sh +59 -0
- package/templates/hooks/validate-git-commit.sh +78 -0
- package/templates/hooks/validate-git-stash-deny.sh +32 -0
- package/templates/hooks/validate-structure-lengths.sh +57 -0
- package/templates/hooks/validate-structure-lib.sh +104 -0
- package/templates/hooks/validate-structure-patterns.sh +54 -0
- package/templates/hooks/validate-structure-scope.sh +33 -0
- package/templates/hooks/validate-structure-smoke.sh +95 -0
- package/templates/hooks/validate-structure-templates.sh +34 -0
- package/templates/hooks/validate-structure.sh +69 -0
- package/templates/rules/.gitkeep +0 -0
- package/templates/rules/README.md +47 -0
- package/templates/rules/context-file-loading.md +52 -0
- package/templates/rules/scope-vocabulary.md +64 -0
- package/templates/rules/todo-backend.md +109 -0
- package/templates/settings.project.base.json +55 -0
- package/templates/settings.user.base.json +25 -0
- package/templates/skills/cbp-build-cc-agent/SKILL.md +139 -0
- package/templates/skills/cbp-build-cc-agent/examples/read-only-reviewer.md +32 -0
- package/templates/skills/cbp-build-cc-agent/examples/with-hooks.md +41 -0
- package/templates/skills/cbp-build-cc-agent/examples/with-skills-preload.md +25 -0
- package/templates/skills/cbp-build-cc-agent/reference/cbp-quality.md +153 -0
- package/templates/skills/cbp-build-cc-agent/reference/frontmatter-fields.md +37 -0
- package/templates/skills/cbp-build-cc-agent/reference/permission-modes.md +18 -0
- package/templates/skills/cbp-build-cc-agent/scripts/validate-agent.sh +67 -0
- package/templates/skills/cbp-build-cc-agent/templates/agent.md +66 -0
- package/templates/skills/cbp-build-cc-claude-file/SKILL.md +178 -0
- package/templates/skills/cbp-build-cc-claude-file/examples/minimal-project.md +33 -0
- package/templates/skills/cbp-build-cc-claude-file/examples/monorepo-with-imports.md +39 -0
- package/templates/skills/cbp-build-cc-claude-file/reference/imports.md +72 -0
- package/templates/skills/cbp-build-cc-claude-file/reference/what-belongs.md +39 -0
- package/templates/skills/cbp-build-cc-claude-file/templates/project-claude-md.md +48 -0
- package/templates/skills/cbp-build-cc-claude-file/templates/user-claude-md.md +22 -0
- package/templates/skills/cbp-build-cc-memory/SKILL.md +201 -0
- package/templates/skills/cbp-build-cc-memory/examples/feedback-memory.md +11 -0
- package/templates/skills/cbp-build-cc-memory/examples/project-memory.md +11 -0
- package/templates/skills/cbp-build-cc-memory/examples/reference-memory.md +13 -0
- package/templates/skills/cbp-build-cc-memory/examples/user-memory.md +14 -0
- package/templates/skills/cbp-build-cc-memory/reference/memory-types.md +59 -0
- package/templates/skills/cbp-build-cc-memory/reference/when-to-save.md +62 -0
- package/templates/skills/cbp-build-cc-memory/templates/MEMORY-index.md +4 -0
- package/templates/skills/cbp-build-cc-memory/templates/memory-entry.md +15 -0
- package/templates/skills/cbp-build-cc-mode/SKILL.md +99 -0
- package/templates/skills/cbp-build-cc-rule/SKILL.md +176 -0
- package/templates/skills/cbp-build-cc-rule/examples/global-rule.md +19 -0
- package/templates/skills/cbp-build-cc-rule/examples/scoped-rule.md +41 -0
- package/templates/skills/cbp-build-cc-rule/reference/paths-patterns.md +48 -0
- package/templates/skills/cbp-build-cc-rule/templates/rule.md +32 -0
- package/templates/skills/cbp-build-cc-settings/SKILL.md +220 -0
- package/templates/skills/cbp-build-cc-settings/examples/hooks-config.json +64 -0
- package/templates/skills/cbp-build-cc-settings/examples/permissions-config.json +34 -0
- package/templates/skills/cbp-build-cc-settings/examples/sandbox-config.json +42 -0
- package/templates/skills/cbp-build-cc-settings/reference/cbp-conventions.md +104 -0
- package/templates/skills/cbp-build-cc-settings/reference/permission-rules.md +61 -0
- package/templates/skills/cbp-build-cc-settings/reference/scope-precedence.md +73 -0
- package/templates/skills/cbp-build-cc-settings/reference/settings-fields.md +166 -0
- package/templates/skills/cbp-build-cc-settings/templates/settings.json +23 -0
- package/templates/skills/cbp-build-cc-settings/templates/settings.local.json +10 -0
- package/templates/skills/cbp-build-cc-skill/SKILL.md +154 -0
- package/templates/skills/cbp-build-cc-skill/examples/dynamic-context.md +31 -0
- package/templates/skills/cbp-build-cc-skill/examples/fork-skill.md +22 -0
- package/templates/skills/cbp-build-cc-skill/examples/knowledge-skill.md +25 -0
- package/templates/skills/cbp-build-cc-skill/examples/task-skill.md +29 -0
- package/templates/skills/cbp-build-cc-skill/reference/cbp-quality.md +157 -0
- package/templates/skills/cbp-build-cc-skill/reference/frontmatter-fields.md +35 -0
- package/templates/skills/cbp-build-cc-skill/reference/string-substitutions.md +60 -0
- package/templates/skills/cbp-build-cc-skill/scripts/validate-skill.sh +90 -0
- package/templates/skills/cbp-build-cc-skill/templates/skill.md +51 -0
- package/templates/skills/cbp-checkpoint-check/SKILL.md +156 -0
- package/templates/skills/cbp-checkpoint-complete/SKILL.md +109 -0
- package/templates/skills/cbp-checkpoint-create/SKILL.md +287 -0
- package/templates/skills/cbp-checkpoint-end/SKILL.md +241 -0
- package/templates/skills/cbp-checkpoint-update/SKILL.md +115 -0
- package/templates/skills/cbp-frontend-a11y/SKILL.md +109 -0
- package/templates/skills/cbp-frontend-a11y/reference/aria-roles-states.md +130 -0
- package/templates/skills/cbp-frontend-a11y/reference/contrast-visual.md +122 -0
- package/templates/skills/cbp-frontend-a11y/reference/keyboard-patterns.md +154 -0
- package/templates/skills/cbp-frontend-a11y/reference/semantic-html.md +111 -0
- package/templates/skills/cbp-frontend-design/SKILL.md +145 -0
- package/templates/skills/cbp-frontend-design/reference/nextjs-scss.md +118 -0
- package/templates/skills/cbp-frontend-design/reference/rn-expo.md +101 -0
- package/templates/skills/cbp-frontend-design/reference/tauri-react.md +82 -0
- package/templates/skills/cbp-frontend-ui/SKILL.md +262 -0
- package/templates/skills/cbp-frontend-ui/reference/ui-label-maps.md +42 -0
- package/templates/skills/cbp-frontend-ui/reference/ui-layout-patterns.md +105 -0
- package/templates/skills/cbp-frontend-ui/reference/variant-defaults.md +149 -0
- package/templates/skills/cbp-frontend-ux/SKILL.md +181 -0
- package/templates/skills/cbp-git-branch-feat-create/SKILL.md +115 -0
- package/templates/skills/cbp-git-commit/SKILL.md +278 -0
- package/templates/skills/cbp-git-worktree-create/SKILL.md +226 -0
- package/templates/skills/cbp-git-worktree-remove/SKILL.md +145 -0
- package/templates/skills/cbp-merge-main/SKILL.md +228 -0
- package/templates/skills/cbp-round-check/SKILL.md +104 -0
- package/templates/skills/cbp-round-end/SKILL.md +183 -0
- package/templates/skills/cbp-round-end/reference/findings-presentation.md +44 -0
- package/templates/skills/cbp-round-end/reference/inline-fallback.md +35 -0
- package/templates/skills/cbp-round-execute/SKILL.md +211 -0
- package/templates/skills/cbp-round-execute/reference/inline-fallback.md +59 -0
- package/templates/skills/cbp-round-input/SKILL.md +165 -0
- package/templates/skills/cbp-round-start/SKILL.md +222 -0
- package/templates/skills/cbp-round-update/SKILL.md +163 -0
- package/templates/skills/cbp-session-end/SKILL.md +187 -0
- package/templates/skills/cbp-session-start/SKILL.md +155 -0
- package/templates/skills/cbp-ship/SKILL.md +332 -0
- package/templates/skills/cbp-ship/reference/changesets-overview.md +120 -0
- package/templates/skills/cbp-ship/reference/eas-cli-overview.md +60 -0
- package/templates/skills/cbp-ship/reference/gh-cli-overview.md +135 -0
- package/templates/skills/cbp-ship/reference/gh-cli-shipment-commands.md +283 -0
- package/templates/skills/cbp-ship/reference/npm-publish-monorepo.md +252 -0
- package/templates/skills/cbp-ship/reference/npm-publish-oidc-trusted.md +157 -0
- package/templates/skills/cbp-ship/reference/npm-publish-overview.md +171 -0
- package/templates/skills/cbp-ship/reference/preflight-checklist.md +88 -0
- package/templates/skills/cbp-ship/reference/railway-nestjs-deployment.md +169 -0
- package/templates/skills/cbp-ship/reference/railway-overview.md +120 -0
- package/templates/skills/cbp-ship/reference/railway-troubleshooting.md +168 -0
- package/templates/skills/cbp-ship/reference/release-please-overview.md +99 -0
- package/templates/skills/cbp-ship/reference/surface-expo-eas.md +155 -0
- package/templates/skills/cbp-ship/reference/surface-npm.md +180 -0
- package/templates/skills/cbp-ship/reference/surface-railway.md +152 -0
- package/templates/skills/cbp-ship/reference/surface-supabase.md +178 -0
- package/templates/skills/cbp-ship/reference/surface-tauri.md +138 -0
- package/templates/skills/cbp-ship/reference/surface-vercel.md +124 -0
- package/templates/skills/cbp-ship/reference/surface-vscode-ext.md +144 -0
- package/templates/skills/cbp-ship/reference/surfaces.md +60 -0
- package/templates/skills/cbp-ship/reference/testflight-automation.md +215 -0
- package/templates/skills/cbp-ship/reference/testflight-internal-vs-external.md +69 -0
- package/templates/skills/cbp-ship/reference/testflight-overview.md +98 -0
- package/templates/skills/cbp-ship/reference/versioning.md +116 -0
- package/templates/skills/cbp-ship/scripts/detect-surfaces.sh +217 -0
- package/templates/skills/cbp-ship/scripts/verify-expo-eas.sh +35 -0
- package/templates/skills/cbp-ship/scripts/verify-npm.sh +21 -0
- package/templates/skills/cbp-ship/scripts/verify-railway.sh +41 -0
- package/templates/skills/cbp-ship/scripts/verify-supabase.sh +19 -0
- package/templates/skills/cbp-ship/scripts/verify-tauri.sh +24 -0
- package/templates/skills/cbp-ship/scripts/verify-vercel.sh +32 -0
- package/templates/skills/cbp-ship/scripts/verify-vscode-ext.sh +25 -0
- package/templates/skills/cbp-ship/templates/eas.json +66 -0
- package/templates/skills/cbp-ship/templates/railway.toml +15 -0
- package/templates/skills/cbp-ship/templates/release-please-config.json +17 -0
- package/templates/skills/cbp-ship/templates/vercel.json +19 -0
- package/templates/skills/cbp-ship/templates/vscodeignore +21 -0
- package/templates/skills/cbp-ship/templates/workflow-changesets.yml +41 -0
- package/templates/skills/cbp-ship/templates/workflow-eas-submit.yml +53 -0
- package/templates/skills/cbp-ship/templates/workflow-npm-publish.yml +36 -0
- package/templates/skills/cbp-ship/templates/workflow-release-please.yml +21 -0
- package/templates/skills/cbp-ship/templates/workflow-tauri-release.yml +69 -0
- package/templates/skills/cbp-ship/templates/workflow-vsce-publish.yml +31 -0
- package/templates/skills/cbp-ship-configure/SKILL.md +296 -0
- package/templates/skills/cbp-ship-configure/reference/expo-mobile.md +204 -0
- package/templates/skills/cbp-ship-configure/reference/npm-package.md +165 -0
- package/templates/skills/cbp-ship-configure/reference/railway-backend.md +199 -0
- package/templates/skills/cbp-ship-configure/reference/supabase.md +200 -0
- package/templates/skills/cbp-ship-configure/reference/tauri-desktop.md +181 -0
- package/templates/skills/cbp-ship-configure/reference/vercel.md +117 -0
- package/templates/skills/cbp-ship-configure/reference/vscode-ext.md +155 -0
- package/templates/skills/cbp-ship-main/SKILL.md +65 -0
- package/templates/skills/cbp-supabase-branch-check/SKILL.md +337 -0
- package/templates/skills/cbp-supabase-branch-check/reference/dag-steps.md +29 -0
- package/templates/skills/cbp-supabase-migrate/SKILL.md +314 -0
- package/templates/skills/cbp-supabase-migrate/reference/advisor-triage.md +70 -0
- package/templates/skills/cbp-supabase-migrate/reference/cli-fallback.md +87 -0
- package/templates/skills/cbp-supabase-migrate/reference/preflight-dry-run.md +58 -0
- package/templates/skills/cbp-supabase-setup/SKILL.md +239 -0
- package/templates/skills/cbp-supabase-setup/reference/branching-setup.md +121 -0
- package/templates/skills/cbp-supabase-setup/reference/cli-fallback.md +109 -0
- package/templates/skills/cbp-task-check/SKILL.md +166 -0
- package/templates/skills/cbp-task-complete/SKILL.md +206 -0
- package/templates/skills/cbp-task-complete/reference/checkpoint-done-branching.md +48 -0
- package/templates/skills/cbp-task-complete/reference/next-step-heuristic.md +56 -0
- package/templates/skills/cbp-task-create/SKILL.md +167 -0
- package/templates/skills/cbp-task-start/SKILL.md +239 -0
- package/templates/skills/cbp-task-testing/SKILL.md +277 -0
- package/templates/skills/cbp-todo/SKILL.md +97 -0
|
@@ -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+)
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
---
|
|
2
|
+
scope: org-shared
|
|
3
|
+
name: cbp-round-update
|
|
4
|
+
description: Check file approvals, complete round, and route to next step
|
|
5
|
+
argument-hint: [chk-task-round | task-round]
|
|
6
|
+
triggers: [cbp-round-input, cbp-task-check]
|
|
7
|
+
effort: low
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Round Update Command
|
|
11
|
+
|
|
12
|
+
Checks file approval status, completes the round, and routes to next step. NEVER asks the user to git add or stage anything — it only reads current state.
|
|
13
|
+
|
|
14
|
+
## HARD GATE — Every Step Must Execute
|
|
15
|
+
|
|
16
|
+
Step 2 (sync-approvals CLI) MUST exit 0. If it fails, do NOT proceed to Step 3. Before completing the round, verify:
|
|
17
|
+
|
|
18
|
+
- [ ] `codebyplan round sync-approvals` exited 0
|
|
19
|
+
|
|
20
|
+
If this is false: DO NOT proceed to Step 3.
|
|
21
|
+
|
|
22
|
+
## Instructions
|
|
23
|
+
|
|
24
|
+
### Step 1: Parse `$ARGUMENTS`
|
|
25
|
+
|
|
26
|
+
Parse the argument using the canonical chk-task-round notation (see `.claude/rules/notation-consistency.md`):
|
|
27
|
+
|
|
28
|
+
| Shape | Regex | Resolves to |
|
|
29
|
+
|-------|-------|-------------|
|
|
30
|
+
| `{chk}-{task}-{round}` (e.g. `108-1-2`) | `^[0-9]+-[0-9]+-[0-9]+$` | Checkpoint-bound: CHK-{chk} TASK-{task} ROUND-{round} |
|
|
31
|
+
| `{task}-{round}` (e.g. `45-2`) | `^[0-9]+-[0-9]+$` | Standalone: standalone TASK-{task} ROUND-{round} |
|
|
32
|
+
| _(empty)_ | — | Use MCP `get_current_task` / `get_rounds` to find the active task and latest round |
|
|
33
|
+
|
|
34
|
+
Anything else is malformed — surface this error and stop:
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
round-update: invalid argument `{value}`. Expected:
|
|
38
|
+
108-1-2 → CHK-108 TASK-1 ROUND-2 (checkpoint-bound)
|
|
39
|
+
45-2 → standalone TASK-45 ROUND-2
|
|
40
|
+
(empty) → active task and latest round
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Error cases: `abc`, `108-`, `-1`, anything with whitespace or non-numeric characters. Note that `108-1` is **valid** here — it resolves to standalone TASK-108 ROUND-1 per the 2-segment task-round form. To target a checkpoint-bound round, use the 3-segment form `108-1-2`.
|
|
44
|
+
|
|
45
|
+
#### Worked examples
|
|
46
|
+
|
|
47
|
+
- `round-update 108-1-2` → CHK-108 TASK-1 ROUND-2
|
|
48
|
+
- `round-update 45-2` → standalone TASK-45 ROUND-2
|
|
49
|
+
- `round-update` (no arg) → active task and latest in-progress round via `get_current_task` + `get_rounds`
|
|
50
|
+
- `round-update abc` → error: malformed
|
|
51
|
+
|
|
52
|
+
### Step 1.5: Get Current Task and Round
|
|
53
|
+
|
|
54
|
+
Given the parse from Step 1:
|
|
55
|
+
|
|
56
|
+
| Parse | Resolution path |
|
|
57
|
+
|-------|-----------------|
|
|
58
|
+
| `{chk}-{task}-{round}` | MCP `get_checkpoints(repo_id)` → filter `number === {chk}`. MCP `get_tasks(checkpoint_id)` → filter `number === {task}`. MCP `get_rounds(task_id)` → filter `number === {round}`. |
|
|
59
|
+
| `{task}-{round}` | MCP `get_tasks(repo_id, standalone: true)` → filter `number === {task}`. MCP `get_rounds(task_id)` → filter `number === {round}`. |
|
|
60
|
+
| _(empty)_ | MCP `get_current_task(repo_id)` to find active task. MCP `get_rounds(task_id)` to find latest round (in-progress or completed). |
|
|
61
|
+
|
|
62
|
+
If no task found: `No active task. Nothing to update.`
|
|
63
|
+
|
|
64
|
+
### Step 2: Sync git diff + approvals via CLI
|
|
65
|
+
|
|
66
|
+
Run:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
npx codebyplan round sync-approvals --round-id <round_id> --task-id <task_id>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
The CLI auto-resolves the worktree id, parses `git status --short`, merges drift + staging + web-UI flag, and writes both round and task.
|
|
73
|
+
|
|
74
|
+
Read the stdout JSON: `{ added, stale_marked, reactivated, total_files }`.
|
|
75
|
+
|
|
76
|
+
If the command exits non-zero, surface the stderr and STOP. Do NOT proceed to Step 3.
|
|
77
|
+
|
|
78
|
+
### Step 3: Complete Round
|
|
79
|
+
|
|
80
|
+
Calculate duration from `started_at` to now in minutes.
|
|
81
|
+
Use MCP `complete_round(round_id, duration_minutes)`.
|
|
82
|
+
|
|
83
|
+
### Step 4: Auto-Loop Decision
|
|
84
|
+
|
|
85
|
+
Read the latest round's `improve_round_findings[]` and `testing_qa_output.totals.hard_fail`. If EITHER is non-clean (findings non-empty OR `hard_fail === true`), the auto-loop must spawn the next round automatically.
|
|
86
|
+
|
|
87
|
+
Procedure:
|
|
88
|
+
|
|
89
|
+
1. Compute `next_index = (round.context.auto_loop_index ?? 0) + 1`.
|
|
90
|
+
2. **If `next_index > (round.context.auto_loop_cap ?? 5)`**: surface the cap-exhausted prompt via AskUserQuestion (options: extend cap, stop loop / drop into round-input, close task as-is). Persist `round.context.auto_loop_cap_exhausted = { user_choice, decided_at }` and route per choice.
|
|
91
|
+
3. **Otherwise**: persist `round.context.auto_loop_decision = { spawned_next: true, next_index, decided_at }` on the CURRENT round via `update_round` (audit trail), then auto-trigger `/cbp-round-input` with NO AskUserQuestion. Pass `auto_loop_mode: true`, `auto_loop_index: next_index`, `auto_loop_cap: (prior cap ?? 5)` forward — round-start Step 4 persists them on the new round.
|
|
92
|
+
|
|
93
|
+
If BOTH signals are clean, fall through to Step 5 (exit routing).
|
|
94
|
+
|
|
95
|
+
### Step 5: Exit Routing
|
|
96
|
+
|
|
97
|
+
**5a: Count files** — Display: `"Files: X total, Y approved, Z pending"`
|
|
98
|
+
|
|
99
|
+
**5b: Route with four branches** (Step 4 already handled the dirty-loop case; Step 5 is the clean-exit path).
|
|
100
|
+
|
|
101
|
+
**Branch D — IF `round.context.round_type === 'survey'` (checked FIRST):**
|
|
102
|
+
|
|
103
|
+
Survey rounds produce no file diff; A/B/C predicates assume `files_changed[]` non-empty. Survey routing is decided by `improve_round_findings[]` instead:
|
|
104
|
+
|
|
105
|
+
- `improve_round_findings[]` non-empty → auto-trigger `/cbp-round-input`
|
|
106
|
+
- `improve_round_findings[]` empty → auto-trigger `/cbp-task-check`
|
|
107
|
+
|
|
108
|
+
Output: `"## Round [N] Complete — Survey Round"` with duration, files=0, findings count, routing message. Skip Branches A/B/C.
|
|
109
|
+
|
|
110
|
+
**Branch A — ELSE IF all files have `user_approved: true`:**
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
## Round [N] Complete - All Files Approved
|
|
114
|
+
|
|
115
|
+
**Duration**: [N] minutes
|
|
116
|
+
**Files**: [X] total, [X] approved, 0 pending
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Surface AskUserQuestion (clean-exit user-gate):
|
|
120
|
+
|
|
121
|
+
- **(a) close & complete round** → auto-trigger `/cbp-task-check`
|
|
122
|
+
- **(b) start new round** → auto-trigger `/cbp-round-input`
|
|
123
|
+
|
|
124
|
+
Persist `round.context.auto_loop_exit = { staged_count, unstaged_count, route, decided_at }`.
|
|
125
|
+
|
|
126
|
+
**Branch B — ELSE IF unapproved files exist AND every unapproved file has `claude_approved: true` AND `testing_qa_output.totals.hard_fail: false` AND no `improve_round_findings[]`:**
|
|
127
|
+
|
|
128
|
+
The clean-but-unstaged staging-gate case. Mode-dependent:
|
|
129
|
+
|
|
130
|
+
- **Auto-loop exit** (the completed round had `auto_loop_mode === true` on its context AND Step 4 fell through here with BOTH signals clean): surface the Branch A clean-exit user-gate — do NOT auto-trigger `/cbp-round-input`. Branch B's entry condition already requires `no improve_round_findings[]`, so the auto-loop's verbatim-from-findings procedure has no input to formulate requirements from; auto-triggering round-input would loop on an empty input. Persist `round.context.auto_loop_exit.degenerate_empty_findings: true` (degenerate sub-case: no findings to feed round-input, so surface the clean-exit user-gate above instead of auto-triggering).
|
|
131
|
+
- **Manual round**: emit staging-gate prompt and STOP. User stages files (never-git-add rule) and re-invokes; command then falls into Branch A.
|
|
132
|
+
|
|
133
|
+
Manual-mode prompt:
|
|
134
|
+
|
|
135
|
+
```
|
|
136
|
+
## Round [N] Complete — Files Pending Staging
|
|
137
|
+
|
|
138
|
+
**Files**: [X] total, [Y] approved, [Z] pending
|
|
139
|
+
|
|
140
|
+
### Pending (passed all checks; not yet staged):
|
|
141
|
+
- [path]
|
|
142
|
+
|
|
143
|
+
Stage them (`git add <path>`) and re-run `/cbp-round-update` to proceed.
|
|
144
|
+
Waiting for user to stage files.
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
**Branch C — ELSE (unapproved AND outstanding findings or `claude_approved: false`):**
|
|
148
|
+
|
|
149
|
+
Unreachable in the auto-loop path — Step 4 catches it first. Retained for MANUAL invocation. Output `## Round [N] Complete - [Z] Files Pending` with file counts and list of unapproved paths; auto-trigger `/cbp-round-input`.
|
|
150
|
+
|
|
151
|
+
## Key Rules
|
|
152
|
+
|
|
153
|
+
- **Step 2 (CLI) must exit 0** — if it fails, STOP. The merge semantics are enforced by the CLI.
|
|
154
|
+
- **Step 4 owns the dirty-loop case**; Step 5 owns the clean-exit case. Step 5 Branch C is for manual invocation only.
|
|
155
|
+
- **NEVER ask user to git add files** — only reads staging status. **NEVER stage files** — Claude does not touch git staging area.
|
|
156
|
+
- Auto-triggered by `/cbp-round-end`, or run manually by user.
|
|
157
|
+
|
|
158
|
+
## Integration
|
|
159
|
+
|
|
160
|
+
- **Triggered by**: `/cbp-round-end` (auto), or user manually
|
|
161
|
+
- **Reads**: MCP `get_current_task`, `get_rounds`; delegates git+approval sync to `npx codebyplan round sync-approvals`
|
|
162
|
+
- **Writes**: MCP `update_round` (auto_loop_decision / auto_loop_exit / auto_loop_cap_exhausted), `complete_round`; round+task files_changed written by CLI
|
|
163
|
+
- **Triggers**: `/cbp-round-input` (Step 4 dirty-loop spawn; Branch A 'b' choice; Branch B auto-loop-exit; Branch C manual), `/cbp-task-check` (Branch A 'a' choice; Branch D survey-clean), staging-gate stop (Branch B manual mode), cap-exhausted prompt routes from Step 4 (any of the three options)
|