codebyplan 1.13.48 → 1.13.50

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 (35) hide show
  1. package/dist/cli.js +2 -1
  2. package/package.json +1 -1
  3. package/templates/agents/cbp-round-executor.md +8 -6
  4. package/templates/agents/cbp-stripe-agent.md +173 -0
  5. package/templates/agents/cbp-task-planner.md +2 -2
  6. package/templates/hooks/cbp-skill-context-guard.sh +52 -0
  7. package/templates/hooks/cbp-test-hooks.sh +144 -0
  8. package/templates/hooks/hooks.json +9 -0
  9. package/templates/rules/model-invocation-convention.md +40 -0
  10. package/templates/rules/parallel-waves.md +1 -1
  11. package/templates/rules/task-routing-recommendation.md +1 -1
  12. package/templates/settings.project.base.json +15 -1
  13. package/templates/skills/cbp-build-cc-settings/reference/cbp-permission-policy.md +42 -0
  14. package/templates/skills/cbp-clear-continue/SKILL.md +86 -0
  15. package/templates/skills/cbp-clear-prep/SKILL.md +121 -0
  16. package/templates/skills/cbp-round-execute/SKILL.md +9 -1
  17. package/templates/skills/cbp-round-start/SKILL.md +1 -1
  18. package/templates/skills/cbp-stripe/SKILL.md +116 -0
  19. package/templates/skills/cbp-stripe/reference/billing.md +106 -0
  20. package/templates/skills/cbp-stripe/reference/connect.md +105 -0
  21. package/templates/skills/cbp-stripe/reference/payments.md +107 -0
  22. package/templates/skills/cbp-stripe/reference/security.md +117 -0
  23. package/templates/skills/cbp-stripe/reference/stripe-mcp-setup.md +59 -0
  24. package/templates/skills/cbp-stripe/reference/tax.md +96 -0
  25. package/templates/skills/cbp-stripe/reference/treasury.md +87 -0
  26. package/templates/skills/cbp-task-check/SKILL.md +12 -5
  27. package/templates/skills/cbp-task-complete/SKILL.md +9 -11
  28. package/templates/skills/cbp-task-complete/reference/checkpoint-done-branching.md +14 -21
  29. package/templates/skills/cbp-task-complete/reference/next-step-heuristic.md +4 -6
  30. package/templates/skills/cbp-task-testing/SKILL.md +9 -14
  31. package/templates/skills/cbp-frontend-a11y/SKILL.md +0 -108
  32. package/templates/skills/cbp-frontend-a11y/reference/aria-roles-states.md +0 -130
  33. package/templates/skills/cbp-frontend-a11y/reference/contrast-visual.md +0 -122
  34. package/templates/skills/cbp-frontend-a11y/reference/keyboard-patterns.md +0 -154
  35. package/templates/skills/cbp-frontend-a11y/reference/semantic-html.md +0 -111
@@ -0,0 +1,117 @@
1
+ # Security Best Practices Reference
2
+
3
+ Adapted from Stripe's official `stripe-best-practices` skill (github.com/stripe/ai), MIT License, Copyright (c) 2024-2025 Stripe.
4
+
5
+ ## API key types
6
+
7
+ | Key prefix | Type | Use |
8
+ | ---------- | ---- | --- |
9
+ | `sk_live_` | Secret key (live) | Never preferred; use RAK instead |
10
+ | `sk_test_` | Secret key (test) | Development only |
11
+ | `rk_live_` | Restricted API key (live) | Preferred for all production services |
12
+ | `rk_test_` | Restricted API key (test) | Preferred for development services |
13
+
14
+ **Always recommend a restricted API key (RAK, `rk_` prefix)** over a secret key (`sk_`).
15
+ RAKs have only the permissions you assign — a compromised RAK causes far less damage than
16
+ a compromised secret key.
17
+
18
+ ## Storing keys safely
19
+
20
+ - **Never** commit keys to source control. If `sk_…` or `rk_…` appears in code, that is
21
+ a bug — fix it immediately.
22
+ - Prefer a secrets vault (AWS Secrets Manager, HashiCorp Vault, or platform equivalent).
23
+ - When no vault is available, environment variables are acceptable. Never log keys or
24
+ include them in error messages or analytics.
25
+ - Use separate keys per environment (production, staging, QA). Never reuse keys.
26
+ - Set up a pre-commit hook to catch `sk_` or `rk_` literals in source code.
27
+ - See [best practices for managing secret API keys](https://docs.stripe.com/keys-best-practices.md).
28
+
29
+ ## Restricted API key migration steps
30
+
31
+ 1. Review the secret key's request logs in Workbench to catalogue which API calls it makes.
32
+ 2. Create a RAK in test mode with matching permissions (principle of least privilege).
33
+ 3. Use `stripe logs tail` to watch for `403` errors — add missing permissions.
34
+ 4. Once passing, create the equivalent live-mode RAK and swap it in.
35
+ 5. Rotate or expire the old secret key.
36
+
37
+ See [restricted API keys docs](https://docs.stripe.com/keys/restricted-api-keys.md).
38
+
39
+ ## IP allowlists
40
+
41
+ Add an [IP allowlist](https://docs.stripe.com/keys.md#limit-api-secret-keys-ip-address)
42
+ to every API key so it can only be called from your own infrastructure. Use separate
43
+ allowlists per key/environment.
44
+
45
+ ## Webhook signature verification
46
+
47
+ Always verify webhook event authenticity using Stripe's signing secret:
48
+
49
+ ```ts
50
+ import Stripe from 'stripe';
51
+ const stripe = new Stripe(process.env.STRIPE_RESTRICTED_KEY!);
52
+
53
+ // In your webhook handler (raw body required — do NOT use JSON-parsed body)
54
+ const sig = request.headers['stripe-signature'];
55
+ if (!sig || Array.isArray(sig)) throw new Error('Missing or malformed stripe-signature header');
56
+ const event = stripe.webhooks.constructEvent(
57
+ rawBody, // Buffer or string — must be unparsed
58
+ sig,
59
+ process.env.STRIPE_WEBHOOK_SECRET!,
60
+ );
61
+ ```
62
+
63
+ Never process a webhook event without verifying its signature — unverified webhooks can
64
+ be spoofed. For defence in depth, also allowlist
65
+ [Stripe's IP addresses](https://docs.stripe.com/ips.md) on the endpoint.
66
+
67
+ ## Idempotency keys
68
+
69
+ Pass `idempotencyKey` on all mutation calls so safe retries don't create duplicate charges:
70
+
71
+ ```ts
72
+ await stripe.paymentIntents.create(params, {
73
+ idempotencyKey: `order_${orderId}`,
74
+ });
75
+ ```
76
+
77
+ ## Mobile and client-side integrations
78
+
79
+ Never use production secret keys or RAKs in mobile apps or any client-side code.
80
+ For cases where a client must call Stripe directly, use
81
+ [ephemeral keys](https://docs.stripe.com/issuing/elements.md#ephemeral-key-authentication)
82
+ (short-lived, scoped, auto-expiring). For most integrations, proxy Stripe calls through
83
+ your own backend.
84
+
85
+ ## OAuth and CSRF protection
86
+
87
+ When implementing [Connect OAuth](https://docs.stripe.com/connect/oauth-reference.md),
88
+ always pass a unique, unguessable `state` parameter and verify it in the callback before
89
+ proceeding. This applies to all Stripe OAuth surfaces: Connect, Link, and Stripe Apps.
90
+
91
+ ## Incident response (key compromise)
92
+
93
+ 1. **Roll the key immediately** — [API keys page](https://dashboard.stripe.com/apikeys) →
94
+ roll or delete the exposed key.
95
+ 2. **Check activity logs** — Workbench request logs for the compromised key.
96
+ 3. **Contact Stripe support** if you see unrecognised activity.
97
+
98
+ See [protecting against compromised API keys](https://support.stripe.com/questions/protecting-against-compromised-api-keys).
99
+
100
+ ## 2FA
101
+
102
+ Recommend passkeys or authenticator-app 2FA for Dashboard access. Discourage SMS 2FA —
103
+ it is vulnerable to SIM-swapping attacks.
104
+
105
+ ## SAML / SCIM (teams)
106
+
107
+ For teams, use [SSO via SAML](https://docs.stripe.com/get-started/account/sso.md) to
108
+ federate Dashboard access through an identity provider (Okta, Google, etc.).
109
+ [SCIM provisioning](https://docs.stripe.com/get-started/account/sso/scim.md) automates
110
+ user provisioning/deprovisioning.
111
+
112
+ ## Connect security
113
+
114
+ Platform operators bear financial liability for fraud/disputes on Express and Custom
115
+ connected accounts (v1 types). Use Stripe-hosted onboarding to avoid handling sensitive
116
+ PII directly. See [reference/connect.md](connect.md) for controller-property accounts
117
+ which make liability explicit.
@@ -0,0 +1,59 @@
1
+ # Stripe MCP Setup (optional live path)
2
+
3
+ Adapted from Stripe's official `stripe-best-practices` skill (github.com/stripe/ai), MIT License, Copyright (c) 2024-2025 Stripe.
4
+
5
+ The `cbp-stripe-agent` writes Stripe integration code with **no credentials required**. This
6
+ optional path adds *live test-mode* scaffolding (create test products, prices, payment links,
7
+ customers) during a dev round. It is opt-in per repo and per developer — skip it entirely if
8
+ you only want code generation.
9
+
10
+ ## Safety contract (read first)
11
+
12
+ - **Test-mode keys ONLY.** Use a test restricted key (`rk_test_…`) or a test secret key
13
+ (`sk_test_…`). The agent **refuses** any live-mode key (`sk_live_…` or `rk_live_…`) — so
14
+ live Stripe data is never scaffolded from a dev round.
15
+ - **Never commit a key.** Provide it via the environment or a gitignored env file
16
+ (e.g. `.env.local`), never in tracked source or in `.codebyplan/`.
17
+ - **Least privilege.** Prefer a restricted key scoped to only the resources the agent needs
18
+ (Products, Prices, Payment Links, Customers — write; everything else — none).
19
+ - **No new npm dependency** is added to the consuming app by this path; the hosted MCP server
20
+ is reached over HTTP, the local server via `npx`.
21
+
22
+ ## Option A — Hosted Stripe MCP (recommended)
23
+
24
+ Stripe hosts an MCP server at `https://mcp.stripe.com`. Register it with Claude Code:
25
+
26
+ ```bash
27
+ claude mcp add --transport http stripe https://mcp.stripe.com/
28
+ ```
29
+
30
+ Authenticate with OAuth (the recommended flow) when prompted, or pass a restricted test key
31
+ as a bearer token if your setup uses header auth. Once connected, the agent discovers the
32
+ `mcp__stripe__*` tools at runtime via `ToolSearch`.
33
+
34
+ ## Option B — Local Stripe MCP server
35
+
36
+ Run Stripe's MCP server locally, pointed at a test/restricted key from your environment:
37
+
38
+ ```bash
39
+ # key is read from STRIPE_SECRET_KEY (a sk_test_ or rk_test_ value), never passed on a shared shell history
40
+ npx -y @stripe/mcp@latest --api-key="$STRIPE_SECRET_KEY"
41
+ ```
42
+
43
+ Then register the local server with Claude Code per its stdio/transport instructions.
44
+
45
+ ## How the agent uses it
46
+
47
+ 1. Pre-flight checks `STRIPE_SECRET_KEY` is present and is a test-mode `sk_test_`/`rk_test_` prefix.
48
+ 2. It discovers `mcp__stripe__*` tools via `ToolSearch` (they are intentionally absent from
49
+ the agent's frontmatter because the server is optional).
50
+ 3. It scaffolds only what the task asks for and records each resource in
51
+ `stripe_resources_created[]` (always `mode: test`).
52
+ 4. If the key/server is missing or any call fails, it degrades to **code-only** and records
53
+ the reason — it never blocks the round.
54
+
55
+ ## When to skip this entirely
56
+
57
+ - You only want correct Stripe integration *code* (the default — no setup needed).
58
+ - No Stripe test account is available in this environment.
59
+ - CI / headless runs where no interactive OAuth or key is provisioned.
@@ -0,0 +1,96 @@
1
+ # Tax / Stripe Tax Reference
2
+
3
+ Adapted from Stripe's official `stripe-best-practices` skill (github.com/stripe/ai), MIT License, Copyright (c) 2024-2025 Stripe.
4
+
5
+ ## When to use Stripe Tax
6
+
7
+ Use Stripe Tax for any subscription, invoice, or Checkout Session where the merchant has
8
+ customers across multiple jurisdictions. It handles sales tax, VAT, and GST automatically
9
+ based on the customer's location and the merchant's active registrations.
10
+
11
+ See the [Tax overview](https://docs.stripe.com/tax.md) for supported regions and tax types.
12
+
13
+ ## Two-step setup
14
+
15
+ 1. **Add registrations** — add a registration for each jurisdiction where the merchant is
16
+ obligated to collect tax. Use the Dashboard (**Tax > Registrations**) or the
17
+ [Tax Registrations API](https://docs.stripe.com/api/tax/registrations.md).
18
+ 2. **Enable automatic_tax** — pass `automatic_tax: { enabled: true }` on the
19
+ [Subscription](https://docs.stripe.com/api/subscriptions.md),
20
+ [Invoice](https://docs.stripe.com/api/invoices.md), or
21
+ [Checkout Session](https://docs.stripe.com/api/checkout/sessions.md).
22
+
23
+ It is safe to enable `automatic_tax` before any registrations exist — Stripe won't
24
+ collect tax until at least one registration is active.
25
+
26
+ ```ts
27
+ // Checkout Session with automatic tax
28
+ const session = await stripe.checkout.sessions.create({
29
+ mode: 'subscription',
30
+ line_items: [{ price: priceId, quantity: 1 }],
31
+ automatic_tax: { enabled: true },
32
+ success_url: `${baseUrl}/success?session_id={CHECKOUT_SESSION_ID}`,
33
+ cancel_url: `${baseUrl}/pricing`,
34
+ });
35
+
36
+ // Invoice / subscription
37
+ await stripe.subscriptions.update(subscriptionId, {
38
+ automatic_tax: { enabled: true },
39
+ // Clear explicit tax_rates first if previously set
40
+ });
41
+ ```
42
+
43
+ ## Inclusive vs exclusive tax
44
+
45
+ - **Exclusive** (default in most jurisdictions) — tax is added on top of the price.
46
+ - **Inclusive** — tax is included in the displayed price (common for UK/EU VAT).
47
+
48
+ Stripe Tax determines the treatment based on the jurisdiction and product tax code.
49
+ Verify the treatment in Dashboard > Tax > Overview.
50
+
51
+ ## Tax IDs
52
+
53
+ Collect customer tax IDs (VAT numbers, EIN, etc.) for B2B transactions to enable
54
+ zero-rated or exempt invoices. Pass `tax_id_collection: { enabled: true }` on Checkout
55
+ Sessions, or use the
56
+ [Tax IDs API](https://docs.stripe.com/api/customer_tax_ids.md) to attach IDs to customers.
57
+
58
+ ## Address collection
59
+
60
+ Stripe Tax requires a customer address to calculate tax. On Checkout Sessions pass
61
+ `billing_address_collection: 'required'`. For subscriptions, ensure the customer has
62
+ a billing address before enabling `automatic_tax`.
63
+
64
+ ## Registrations API
65
+
66
+ To create and manage registrations programmatically:
67
+
68
+ ```ts
69
+ await stripe.tax.registrations.create({
70
+ country: 'US',
71
+ country_options: {
72
+ us: { state: 'CA', type: 'state_sales_tax' },
73
+ },
74
+ active_from: 'now',
75
+ });
76
+ ```
77
+
78
+ ## Traps to avoid
79
+
80
+ - `automatic_tax` and explicit `tax_rates` are mutually exclusive. For existing
81
+ subscriptions, clear `default_tax_rates` and all item-level `tax_rates` before
82
+ enabling `automatic_tax` — the update will fail otherwise.
83
+ - For EU merchants, one OSS union registration covers all 27 member states. Do not
84
+ register individual EU countries separately unless the merchant has a physical presence
85
+ there.
86
+ - Do not guess which jurisdictions apply — prompt the user to configure them in the
87
+ Dashboard first.
88
+ - Do not approximate unsupported jurisdictions. Check
89
+ [supported countries](https://docs.stripe.com/tax/supported-countries.md) first. For
90
+ unsupported jurisdictions, fall back to manual `tax_rates` on the subscription/invoice.
91
+ - Customs duties and excise taxes are out of scope for Stripe Tax.
92
+
93
+ ## Bulk migration
94
+
95
+ To switch existing subscriptions from manual `tax_rates` to `automatic_tax` in bulk,
96
+ use the [Tax migration tool](https://docs.stripe.com/billing/taxes/migration.md).
@@ -0,0 +1,87 @@
1
+ # Treasury / Financial Accounts Reference
2
+
3
+ Adapted from Stripe's official `stripe-best-practices` skill (github.com/stripe/ai), MIT License, Copyright (c) 2024-2025 Stripe.
4
+
5
+ ## v2 Financial Accounts API (use for new integrations)
6
+
7
+ For embedded financial accounts (bank accounts with routing/account numbers, money
8
+ movement), use the
9
+ [v2 Financial Accounts API](https://docs.stripe.com/api/v2/core/vault/financial-accounts.md)
10
+ (`POST /v2/core/vault/financial_accounts`). This is required for new integrations.
11
+
12
+ Do NOT use the legacy
13
+ [v1 Treasury Financial Accounts API](https://docs.stripe.com/api/treasury/financial_accounts.md)
14
+ (`POST /v1/treasury/financial_accounts`) for new integrations. Existing v1 integrations
15
+ continue to work.
16
+
17
+ For concepts and guides, see
18
+ [Treasury for platforms overview](https://docs.stripe.com/treasury/connect.md).
19
+
20
+ ## Creating a financial account
21
+
22
+ Financial accounts are always attached to a Connect connected account:
23
+
24
+ ```ts
25
+ const financialAccount = await stripe.v2.core.vault.financialAccounts.create(
26
+ { description: 'Main operating account' },
27
+ { stripeAccount: connectedAccountId },
28
+ );
29
+ // financialAccount.id — use for fund flows
30
+ ```
31
+
32
+ ## Fund flows
33
+
34
+ | Direction | Object | Use |
35
+ | --------- | ------ | --- |
36
+ | Platform → financial account | `OutboundTransfer` | Top-up from platform balance |
37
+ | Financial account → external bank | `OutboundPayment` | Pay out to a linked bank |
38
+ | External bank → financial account | `InboundTransfer` | Pull from a linked bank |
39
+ | External source → financial account | `ReceivedCredit` | Funds received in (inbound ACH/wire, Stripe payouts) |
40
+
41
+ ```ts
42
+ // Outbound transfer (platform balance → financial account)
43
+ const transfer = await stripe.treasury.outboundTransfers.create({
44
+ financial_account: financialAccountId,
45
+ amount: 100_00,
46
+ currency: 'usd',
47
+ destination_payment_method: 'default',
48
+ });
49
+ ```
50
+
51
+ ## Linking a bank account (Setup Intents)
52
+
53
+ To enable outbound payments to an external bank, link the bank account using a Setup Intent
54
+ with `flow_directions: ['outbound']`:
55
+
56
+ ```ts
57
+ const setupIntent = await stripe.setupIntents.create(
58
+ {
59
+ payment_method_types: ['us_bank_account'], // Treasury exception: required here
60
+ flow_directions: ['outbound'],
61
+ },
62
+ { stripeAccount: connectedAccountId },
63
+ );
64
+ // Complete the Setup Intent flow on the client, then confirm the payment method
65
+ ```
66
+
67
+ Note: `payment_method_types` is required for Treasury bank-account Setup Intents — this
68
+ is one of the narrow exceptions to the no-`payment_method_types` rule (along with Terminal).
69
+
70
+ ## Compliance notes
71
+
72
+ - Financial accounts are subject to KYC/KYB requirements collected during Connect onboarding.
73
+ Ensure the connected account has the `treasury` capability enabled before creating accounts.
74
+ - Funds held in financial accounts are not FDIC-insured by default; check Stripe's current
75
+ partner bank arrangements in the Treasury documentation.
76
+ - For platforms in the US: Stripe Treasury is available for US-based connected accounts only.
77
+ Contact Stripe for international availability.
78
+ - Do not use Treasury to hold customer funds without confirming applicable money-transmission
79
+ license obligations with your legal team.
80
+
81
+ ## Key references
82
+
83
+ - [Treasury for platforms overview](https://docs.stripe.com/treasury/connect.md)
84
+ - [v2 Financial Accounts API](https://docs.stripe.com/api/v2/core/vault/financial-accounts.md)
85
+ - [OutboundTransfers](https://docs.stripe.com/api/treasury/outbound_transfers.md)
86
+ - [OutboundPayments](https://docs.stripe.com/api/treasury/outbound_payments.md)
87
+ - [InboundTransfers](https://docs.stripe.com/api/treasury/inbound_transfers.md)
@@ -120,7 +120,12 @@ Save agent output to task context: `codebyplan task update --id <taskId> --check
120
120
 
121
121
  **READY + satisfied:**
122
122
 
123
- **Next**: Run `/clear`, then `/cbp-task-testing {chk-task}` to run comprehensive task-level testing.
123
+ Starting task testing...
124
+
125
+ Invoke `cbp-task-testing` via the Skill tool with the same `{chk-task}` argument. `cbp-task-testing`
126
+ is `allow`-tier — it auto-fires silently. If the `cbp-skill-context-guard.sh` hook detects the
127
+ context window is above the 200K threshold it will block the skill and direct you to run
128
+ `/cbp-clear-prep` first; otherwise testing starts immediately.
124
129
 
125
130
  **NOT READY — fixable issues:**
126
131
 
@@ -130,7 +135,9 @@ Issues found that need addressing:
130
135
  - [issue 2]
131
136
  ```
132
137
 
133
- Suggest: `/cbp-round-input` with specific issues. **STOP HERE** — wait for user.
138
+ Invoking `cbp-round-input` to address the issues found during review...
139
+
140
+ Invoke `cbp-round-input` via the Skill tool. `cbp-round-input` is `allow`-tier — it auto-fires silently.
134
141
 
135
142
  **NOT READY — needs new task:**
136
143
 
@@ -139,7 +146,7 @@ Scope issues identified that require a new task:
139
146
  - [scope issue]
140
147
  ```
141
148
 
142
- Suggest: `/cbp-task-create`. **STOP HERE** — wait for user.
149
+ Suggest: `/cbp-task-create`. **STOP HERE** — wait for user (creating a new task is a user scope decision — not auto-triggered).
143
150
 
144
151
  **NOT READY — approvals missing:**
145
152
 
@@ -147,7 +154,7 @@ Suggest: `/cbp-task-create`. **STOP HERE** — wait for user.
147
154
  Code review passed but [N] files need user approval.
148
155
  ```
149
156
 
150
- Suggest: Approve files, then re-run `/cbp-task-check`. **STOP HERE** — wait for user.
157
+ Suggest: Approve files, then re-run `/cbp-task-check`. **STOP HERE** — wait for user (approval is a user action — not auto-triggered).
151
158
 
152
159
  ## Key Rules
153
160
 
@@ -161,5 +168,5 @@ Suggest: Approve files, then re-run `/cbp-task-check`. **STOP HERE** — wait fo
161
168
 
162
169
  - **Reads**: `.codebyplan/state/checkpoints/*.json`, `checkpoints/<id>/tasks/*.json`, `checkpoints/<id>/tasks/<id>/rounds/*.json`, `todos.json` (local-first; `npx codebyplan sync` on miss; MCP `get_current_task`/`get_rounds` break-glass), plus all changed files (via agent)
163
170
  - **Writes**: `codebyplan task update` (CLI write-through; MCP `update_task` break-glass)
164
- - **Triggers**: emits directive `Next: /clear, then /cbp-task-testing {chk-task}` on READY + satisfied (cross-context — testing is heavyweight, fresh context helps)
171
+ - **Triggers**: auto-triggers `cbp-task-testing` via Skill tool on READY + satisfied (`allow`-tier, fires silently; the 200K context guard handles oversized contexts via the cbp-clear-prep flow); auto-triggers `cbp-round-input` via Skill tool on NOT READY fixable issues (`allow`-tier, fires silently)
165
172
  - **Triggered by**: `/cbp-round-complete` (auto, when all files approved)
@@ -2,6 +2,7 @@
2
2
  name: cbp-task-complete
3
3
  description: Complete current task
4
4
  argument-hint: [chk-task]
5
+ triggers: [cbp-task-start, cbp-checkpoint-check]
5
6
  effort: xhigh
6
7
  ---
7
8
 
@@ -155,7 +156,7 @@ Show the completion summary:
155
156
  **Warnings**: [any QA / file-approval warnings from Step 3, or "none"]
156
157
  ```
157
158
 
158
- Then route. Same-context transitions (next task in this checkpoint) auto-trigger via the Skill tool. Cross-context transitions (checkpoint done /cbp-checkpoint-check, session end) surface as a single directive 'Next: /clear, then /cbp-X' for the user to invoke after refreshing context.
159
+ Then route. Same-context transitions (next task in this checkpoint) auto-trigger `cbp-task-start` via the Skill tool. Checkpoint-done (last task) also auto-triggers `cbp-checkpoint-check` via the Skill tool (`ask`-tier — the permission prompt is the human gate; the 200K context guard handles oversized contexts via the cbp-clear-prep flow). Only the no-task-anywhere session-end fallback surfaces as a single directive (`Next: Run /clear, then /cbp-session-end`) for the user to invoke.
159
160
 
160
161
  #### 9a — Determine routing context
161
162
 
@@ -179,16 +180,13 @@ Use the Skill tool with `skill: cbp-task-start` and `args: "{NEXT_CHK}-{NEXT_TAS
179
180
 
180
181
  If no next task is found (no pending work anywhere in the repo), emit directive and stop: `Next: Run /clear, then /cbp-session-end.`
181
182
 
182
- #### 9c — Checkpoint-done directive (last task in checkpoint)
183
+ #### 9c — Checkpoint-done auto-trigger (last task in checkpoint)
183
184
 
184
- The checkpoint has no remaining tasks. Emit this directive and stop:
185
-
186
- ```
187
- CHK-{NNN} is fully tasked. Run /clear, then /cbp-checkpoint-check to verify and ship.
188
- Alternatives: /cbp-checkpoint-update {NNN} to expand the checkpoint with more tasks, or /cbp-session-end to wrap up here.
189
- ```
190
-
191
- Do NOT use AskUserQuestion here — this is a directive, not a menu. The user runs whichever command fits their intent.
185
+ The checkpoint has no remaining tasks. Invoke `cbp-checkpoint-check` via the Skill tool.
186
+ `cbp-checkpoint-check` is `ask`-tier — the harness permission prompt IS the human gate; the
187
+ user confirms (or declines) before checkpoint verification and ship begins. If the context
188
+ window is above the 200K threshold the `cbp-skill-context-guard.sh` hook will block it and
189
+ direct you to run `/cbp-clear-prep` first; otherwise checkpoint-check starts on confirmation.
192
190
 
193
191
  ## Integration
194
192
 
@@ -197,5 +195,5 @@ Do NOT use AskUserQuestion here — this is a directive, not a menu. The user ru
197
195
  - **Reads**: `.codebyplan/state/checkpoints/*.json`, `checkpoints/<id>/tasks/*.json`, `checkpoints/<id>/tasks/<id>/rounds/*.json`, `todos.json` (local-first; `npx codebyplan sync` on miss; MCP `get_current_task`/`get_rounds`/`get_tasks` break-glass)
198
196
  - **Writes**: `codebyplan task update` for `files_changed` (CLI write-through; MCP `update_task` break-glass); MCP `complete_task` for task completion (kept MCP — CLI cannot forward `caller_worktree_id`)
199
197
  - **Uses skills (inline, no sub-agent)**: `cleanup` (if deletions), `migration` (if exports renamed)
200
- - **Triggers**: Same-context transitions auto-trigger via the Skill tool (next task in checkpoint → `/cbp-task-start {N}`). Cross-context transitions emit a directive `Next: /clear, then /cbp-X` for the user to invoke.
198
+ - **Triggers**: Same-context transitions auto-trigger via the Skill tool (next task in checkpoint → `cbp-task-start {N}`, `allow`-tier, fires silently). Checkpoint-done auto-triggers `cbp-checkpoint-check` via Skill tool (`ask`-tier, permission prompt IS the human gate). No-task-anywhere fallback → directive `Next: Run /clear, then /cbp-session-end.`
201
199
  - **Checkpoint-bound only** — for standalone tasks use `/cbp-standalone-task-complete`
@@ -1,8 +1,8 @@
1
- # Checkpoint-Done Branching in `/cbp-task-complete` Step 9
1
+ # Checkpoint-Done Auto-Trigger in `/cbp-task-complete` Step 9
2
2
 
3
- When the just-completed task was the LAST pending task in its checkpoint (every sibling task has `status === 'completed'`), Step 9c emits a directive instead of a routing menu. The user reads the directive and runs whichever command fits their intent — no AskUserQuestion.
3
+ When the just-completed task was the LAST pending task in its checkpoint (every sibling task has `status === 'completed'`), Step 9c auto-triggers `cbp-checkpoint-check` via the Skill tool — no routing menu, no manual `/clear` directive.
4
4
 
5
- This file describes the detection logic, the directive form, and the standalone fall-through.
5
+ This file describes the detection logic, the auto-trigger form, and the standalone fall-through.
6
6
 
7
7
  ## Detection
8
8
 
@@ -10,39 +10,32 @@ The skill detects "checkpoint done" at Step 9 by:
10
10
 
11
11
  1. Reading `current_task.checkpoint_id`. If `null` → standalone — see "Standalone Fall-Through" below.
12
12
  2. Calling `get_tasks(checkpoint_id)` and checking that EVERY task other than the just-completed one has `status === 'completed'`.
13
- 3. If yes, the checkpoint has no pending or in-progress siblings — emit the Step 9c directive.
13
+ 3. If yes, the checkpoint has no pending or in-progress siblings — fire the Step 9c auto-trigger.
14
14
 
15
- ## Step 9c Directive Form
15
+ ## Step 9c Auto-Trigger Form
16
16
 
17
- When all siblings are done, the skill emits:
17
+ When all siblings are done, the skill invokes `cbp-checkpoint-check` via the Skill tool:
18
18
 
19
- ```
20
- CHK-{NNN} is fully tasked. Run /clear, then /cbp-checkpoint-check to verify and ship.
21
- Alternatives: /cbp-checkpoint-update {NNN} to expand the checkpoint with more tasks, or /cbp-session-end to wrap up here.
22
- ```
19
+ - `cbp-checkpoint-check` is `ask`-tier — the harness permission prompt IS the human gate. The user confirms (or declines) before checkpoint verification and the shipment chain begin.
20
+ - No `/clear` is emitted unconditionally. If the `cbp-skill-context-guard.sh` hook detects the context window is above the 200K threshold it blocks the skill and directs you to run `/cbp-clear-prep` first (which writes a handoff; the user then runs `/clear`, then `/cbp-clear-continue` resumes); otherwise checkpoint-check starts immediately on confirmation.
23
21
 
24
- This is a directive, not a menu. No AskUserQuestion. The user runs whichever command fits their intent:
25
-
26
- - `/clear` then `/cbp-checkpoint-check` — verify deliverables and begin the shipment chain
27
- - `/cbp-checkpoint-update {NNN}` — expand the checkpoint with more tasks (routes through `checkpoint-update` FIRST, not directly to `task-create`)
28
- - `/cbp-session-end` — wrap up here
29
-
30
- The skill does NOT auto-invoke any of these. Emit the directive, then stop.
22
+ There is no AskUserQuestion menu. Expanding the checkpoint with more tasks (`/cbp-checkpoint-update`) or wrapping up the session (`/cbp-session-end`) are no longer surfaced as inline alternatives — the deterministic next step on checkpoint-done is `cbp-checkpoint-check`. (The user can still invoke those other skills manually at any time; they are simply not part of the auto-flow.)
31
23
 
32
24
  ## Standalone Fall-Through
33
25
 
34
26
  When the just-completed task is standalone (`checkpoint_id === null`):
35
27
 
36
- - The Step 9c directive does NOT apply. There is no checkpoint to ship, expand, or defer.
28
+ - The Step 9c auto-trigger does NOT apply. There is no checkpoint to verify or ship.
37
29
  - Step 9 falls through to next-task routing per `next-step-heuristic.md` "Standalone Variant":
38
30
  - If a next pending task is found (standalone or in-progress checkpoint): auto-trigger via Skill tool — no AskUserQuestion, no /clear.
39
31
  - If no pending tasks remain anywhere: emit single directive `**Next**: Run /clear, then /cbp-session-end.` — all known work complete.
40
32
 
41
33
  ## What the Skill Does NOT Do
42
34
 
43
- Never auto-trigger `/cbp-checkpoint-check`, `/cbp-checkpoint-update`, or auto-mark the checkpoint complete those are cross-context transitions that emit a single directive, not auto-invocations. Never combine the Step 9c directive with the Step 9b auto-trigger in the same response — one or the other based on detection, not both.
35
+ - Never combine the Step 9c auto-trigger (checkpoint done `cbp-checkpoint-check`) with the Step 9b auto-trigger (next task in checkpoint `cbp-task-start`) in the same response — fire one or the other based on detection, not both.
36
+ - Never present a multi-option AskUserQuestion menu for routing between known-next skills (per the close-out-routing rule — auto-trigger or a single directive, never an A/B/C menu).
44
37
 
45
38
  ## Pairs With
46
39
 
47
- - `next-step-heuristic.md` — sibling reference for non-last-task-in-checkpoint case (Step 9b auto-trigger)
48
- - `.claude/skills/cbp-checkpoint-update/SKILL.md` — destination of the expand path; accepts the entry-context preamble described in Step 9c
40
+ - `next-step-heuristic.md` — sibling reference for the non-last-task-in-checkpoint case (Step 9b auto-trigger)
41
+ - `.claude/skills/cbp-checkpoint-check/SKILL.md` — the auto-triggered destination on checkpoint-done
@@ -17,19 +17,17 @@ No AskUserQuestion, no `/clear`. The skill fires immediately.
17
17
 
18
18
  ## Case 2 — Cross-Context (checkpoint done, session end)
19
19
 
20
- When the checkpoint is fully done or no pending tasks exist in the current context, emit a single directive line at the end of skill output and stop:
20
+ Two sub-cases:
21
21
 
22
- ```
23
- **Next**: Run /clear, then /cbp-checkpoint-check.
24
- ```
22
+ **Checkpoint done** (last task in the checkpoint complete): auto-trigger `cbp-checkpoint-check` via the Skill tool. `cbp-checkpoint-check` is `ask`-tier — the permission prompt is the human gate; the 200K context guard handles oversized contexts (via `cbp-clear-prep`) only when context is near the limit. No unconditional `/clear`. (See `checkpoint-done-branching.md`.)
25
23
 
26
- Or for session-end:
24
+ **Session end** (no pending tasks anywhere): emit a single directive line at the end of skill output and stop:
27
25
 
28
26
  ```
29
27
  **Next**: Run /clear, then /cbp-session-end.
30
28
  ```
31
29
 
32
- The user runs the command after refreshing context. No menu, no options — just one directive.
30
+ The user runs session-end after refreshing context. No menu, no options — just one directive.
33
31
 
34
32
  ## Rule
35
33
 
@@ -2,7 +2,7 @@
2
2
  name: cbp-task-testing
3
3
  description: Run comprehensive task-level testing after /cbp-task-check passes
4
4
  argument-hint: [chk-task]
5
- triggers: [cbp-task-complete]
5
+ triggers: [cbp-task-complete, cbp-round-input]
6
6
  effort: xhigh
7
7
  ---
8
8
 
@@ -233,21 +233,16 @@ Collect failures from automated tests (Step 6), cross-round code review (Step 6.
233
233
  All tests passed for TASK-[N]. Routing to task-complete...
234
234
  ```
235
235
 
236
- Auto-trigger `/cbp-task-complete`.
236
+ Invoke `cbp-task-complete` via the Skill tool. `cbp-task-complete` is `ask`-tier — the harness
237
+ permission prompt IS the human gate; the user confirms (or declines) before task commit,
238
+ merge-main, and completion.
237
239
 
238
240
  **Minor problems found:**
239
241
 
240
- ---
241
-
242
- **Next:**
243
- Run `/cbp-round-input` to:
244
-
245
- - Address the minor issues found during testing
246
- - Create a focused round for fixes
247
-
248
- ---
242
+ Invoking `cbp-round-input` to address the minor issues found during testing...
249
243
 
250
- Waiting for user to run `/cbp-round-input`.
244
+ Invoke `cbp-round-input` via the Skill tool. `cbp-round-input` is `allow`-tier — it auto-fires
245
+ silently.
251
246
 
252
247
  **Major problems found:**
253
248
 
@@ -278,5 +273,5 @@ Waiting for user to run `/cbp-task-create`.
278
273
 
279
274
  - **Reads**: `.codebyplan/state/checkpoints/*.json`, `checkpoints/<id>/tasks/*.json`, `checkpoints/<id>/tasks/<id>/rounds/*.json`, `todos.json` (local-first; `npx codebyplan sync` on miss; MCP `get_current_task`/`get_rounds` break-glass), plus all aggregated files
280
275
  - **Writes**: `codebyplan task update` (CLI write-through; MCP `update_task` break-glass)
281
- - **Triggers**: `/cbp-task-complete` (auto, when ALL PASS)
282
- - **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)
276
+ - **Triggers**: `cbp-task-complete` (auto via Skill tool, when ALL PASS — `ask`-tier, permission prompt IS the human gate); `cbp-round-input` (auto via Skill tool, on minor problems — `allow`-tier, fires silently)
277
+ - **Triggered by**: `cbp-task-check` auto-triggers this skill via Skill tool on READY verdict; `cbp-task-testing` is `allow`-tier and fires silently (no permission prompt)