codebyplan 1.13.29 → 1.13.31
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 +728 -18
- package/package.json +1 -1
- package/templates/README.md +16 -13
- package/templates/agents/cbp-cc-executor.md +6 -9
- package/templates/agents/cbp-round-executor.md +1 -2
- package/templates/hooks/cbp-mcp-caller-worktree-inject.sh +79 -0
- package/templates/hooks/cbp-test-hooks.sh +81 -0
- package/templates/hooks/hooks.json +9 -0
- package/templates/rules/README.md +13 -8
- package/templates/rules/cbp-operating-gotchas.md +64 -0
- package/templates/settings.project.base.json +0 -1
- package/templates/skills/cbp-build-cc-agent/SKILL.md +3 -4
- package/templates/skills/cbp-build-cc-agent/examples/with-skills-preload.md +2 -3
- package/templates/skills/cbp-build-cc-agent/reference/frontmatter-fields.md +0 -1
- package/templates/skills/cbp-build-cc-agent/scripts/validate-agent.sh +0 -6
- package/templates/skills/cbp-build-cc-agent/templates/agent.md +1 -2
- package/templates/skills/cbp-build-cc-claude-file/SKILL.md +16 -2
- package/templates/skills/cbp-build-cc-claude-file/reference/what-belongs.md +1 -1
- package/templates/skills/cbp-build-cc-mode/SKILL.md +1 -1
- package/templates/skills/cbp-build-cc-rule/SKILL.md +2 -2
- package/templates/skills/cbp-checkpoint-start/SKILL.md +2 -2
- package/templates/skills/cbp-task-complete/SKILL.md +1 -1
- package/templates/skills/cbp-task-start/SKILL.md +2 -2
- package/templates/skills/cbp-build-cc-memory/SKILL.md +0 -201
- package/templates/skills/cbp-build-cc-memory/examples/feedback-memory.md +0 -11
- package/templates/skills/cbp-build-cc-memory/examples/project-memory.md +0 -11
- package/templates/skills/cbp-build-cc-memory/examples/reference-memory.md +0 -13
- package/templates/skills/cbp-build-cc-memory/examples/user-memory.md +0 -14
- package/templates/skills/cbp-build-cc-memory/reference/memory-types.md +0 -59
- package/templates/skills/cbp-build-cc-memory/reference/when-to-save.md +0 -62
- package/templates/skills/cbp-build-cc-memory/templates/MEMORY-index.md +0 -4
- package/templates/skills/cbp-build-cc-memory/templates/memory-entry.md +0 -15
package/package.json
CHANGED
package/templates/README.md
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
|
-
#
|
|
1
|
+
# .claude/
|
|
2
2
|
|
|
3
|
-
This directory
|
|
3
|
+
This directory is **managed by the `codebyplan` package** and refreshed by:
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
```sh
|
|
6
|
+
npx codebyplan claude update
|
|
7
|
+
```
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
## Do not hand-edit managed files
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
Files installed here (skills, agents, hooks, rules) are owned by the `codebyplan` package. Running `codebyplan claude update` will overwrite any local changes to managed files.
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
| --------- | ------------------------------------ | ----------------------------------------------------------------------------------------------- |
|
|
13
|
-
| `skills/` | 41 folders | each is a `SKILL.md` plus optional `templates/`, `reference/`, `examples/`, `scripts/` siblings |
|
|
14
|
-
| `agents/` | 16 files | flat `.md` agent prompts (NOT `AGENT.md` subdirs) |
|
|
15
|
-
| `hooks/` | 20 `.sh` + `hooks.json` + `README.md` | event hooks and manifest |
|
|
16
|
-
| `rules/` | 1+ files | flat `<name>.md` rule files; see `rules/README.md` for bar and format |
|
|
13
|
+
To change managed behaviour, make the change upstream in the `codebyplan` package and publish a new version.
|
|
17
14
|
|
|
18
|
-
##
|
|
15
|
+
## Repo-specific additions
|
|
19
16
|
|
|
20
|
-
|
|
17
|
+
Additions that belong only to this repo go in repo-scoped files that `codebyplan` does not touch:
|
|
18
|
+
|
|
19
|
+
- **Root `CLAUDE.md`** — repo-level context and instructions always loaded by Claude Code.
|
|
20
|
+
- **`rules/` files with `scope: repo-only:<repo-name>`** — behavioral constraints specific to this repo.
|
|
21
|
+
- **`context/` and `docs/`** — repo-specific reference material referenced by your own agents or skills.
|
|
22
|
+
|
|
23
|
+
Repo-scoped files coexist with managed files and are never overwritten by `codebyplan claude update`.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
scope: org-shared
|
|
3
3
|
name: cbp-cc-executor
|
|
4
|
-
description: Authoring executor for `.claude/` infrastructure. Applies approved changes across rules, skills, agents, context, CLAUDE.md, settings,
|
|
4
|
+
description: Authoring executor for `.claude/` infrastructure. Applies approved changes across rules, skills, agents, context, CLAUDE.md, settings, and hooks — with update-first discipline, scope-marker enforcement, and length-limit awareness. Callable by the main conversation, `/cbp-checkpoint-end`, and `round-executor` (for in-scope `.claude/` infra deliverables).
|
|
5
5
|
tools: Read, Write, Edit, Glob, Grep, Skill, Task, AskUserQuestion, mcp__codebyplan__create_task
|
|
6
6
|
model: sonnet
|
|
7
7
|
effort: xhigh
|
|
@@ -40,7 +40,7 @@ input:
|
|
|
40
40
|
source: 'main' | 'checkpoint-end' | 'round-executor' # additional internal sources may exist in your CBP setup; extend as needed
|
|
41
41
|
changes:
|
|
42
42
|
- id: string | number
|
|
43
|
-
type: 'rule' | 'skill' | 'agent' | 'context' | 'architecture' | 'CLAUDE.md' | 'settings' | 'hook'
|
|
43
|
+
type: 'rule' | 'skill' | 'agent' | 'context' | 'architecture' | 'CLAUDE.md' | 'settings' | 'hook'
|
|
44
44
|
target: string # Path under .claude/ (or CLAUDE.md)
|
|
45
45
|
action: 'create' | 'update' | 'delete'
|
|
46
46
|
description: string # What the change is
|
|
@@ -121,13 +121,12 @@ Per validated change, route to the correct authoring path:
|
|
|
121
121
|
| CLAUDE.md | `/cbp-build-cc-claude-file` (only for a non-root CLAUDE.md — root exists) | Direct Edit |
|
|
122
122
|
| settings | `/cbp-build-cc-settings` | `/cbp-build-cc-settings` (schema-critical — always route) |
|
|
123
123
|
| hook | Direct Write with `# @scope:` header | Direct Edit |
|
|
124
|
-
| memory | `/cbp-build-cc-memory` | `/cbp-build-cc-memory` (MEMORY.md index must update) |
|
|
125
124
|
|
|
126
125
|
Routing rules:
|
|
127
126
|
|
|
128
127
|
- **Creates always go through the build-cc skill** when one exists — the skill embeds the signature (`scope:` / `$schema:` / `type:`) the build-cc skills require.
|
|
129
128
|
- **Updates use direct Edit** on already-signed files. The signature travels with the file; editing preserves it.
|
|
130
|
-
- **Settings
|
|
129
|
+
- **Settings always route** — their schema semantics are non-trivial.
|
|
131
130
|
|
|
132
131
|
Record every applied change with `authored_via` and `status`.
|
|
133
132
|
|
|
@@ -143,9 +142,8 @@ Record every applied change with `authored_via` and `status`.
|
|
|
143
142
|
After all changes applied:
|
|
144
143
|
|
|
145
144
|
1. For every touched file, re-check: still within length limit? scope marker still present?
|
|
146
|
-
2. If `
|
|
147
|
-
3.
|
|
148
|
-
4. Report any drift as `status: 'partial'` and list in `applied_changes[].note`.
|
|
145
|
+
2. If `settings.json` touched: valid JSON? Re-read the file and validate syntax — matched braces/brackets, quoted keys, no trailing commas. Reject the change if invalid.
|
|
146
|
+
3. Report any drift as `status: 'partial'` and list in `applied_changes[].note`.
|
|
149
147
|
|
|
150
148
|
### Phase 6: Return
|
|
151
149
|
|
|
@@ -164,7 +162,6 @@ Every managed file must carry its scope marker — checked by `validate-structur
|
|
|
164
162
|
| agent | `scope: {value}` | YAML frontmatter |
|
|
165
163
|
| hook | `# @scope: {value}` | Header comment |
|
|
166
164
|
| settings | `$schema: {url}` (implicit scope via filename) | JSON field |
|
|
167
|
-
| memory | `type: {user\|feedback\|project\|reference}` | YAML frontmatter |
|
|
168
165
|
| context | _(signatureless)_ | n/a |
|
|
169
166
|
| architecture | _(signatureless)_ | n/a |
|
|
170
167
|
| CLAUDE.md | _(plain markdown)_ | n/a |
|
|
@@ -208,6 +205,6 @@ Block-limit violations are non-negotiable — split before applying.
|
|
|
208
205
|
- **Spawned by**: main conversation (ad-hoc), `/cbp-checkpoint-end` (future), `round-executor` (in-scope `.claude/` infra deliverables, `source: 'round-executor'`)
|
|
209
206
|
- **Reads**: `.claude/` inventory, `validate-structure-lengths.sh`, target files
|
|
210
207
|
- **Writes**: `.claude/` files (via `/cbp-build-cc-*` skills for creates, direct Edit for updates)
|
|
211
|
-
- **Calls skills**: `/cbp-build-cc-rule`, `/cbp-build-cc-skill`, `/cbp-build-cc-claude-file`, `/cbp-build-cc-settings
|
|
208
|
+
- **Calls skills**: `/cbp-build-cc-rule`, `/cbp-build-cc-skill`, `/cbp-build-cc-claude-file`, `/cbp-build-cc-settings`
|
|
212
209
|
- **Creates tasks**: via MCP `create_task` when a change exceeds invocation scope
|
|
213
210
|
- **Enforced by**: `validate-structure-lengths.sh` (length), `validate-structure-scope.sh` (scope marker), `validate-structure-patterns.sh` (path layout)
|
|
@@ -98,7 +98,7 @@ output:
|
|
|
98
98
|
|
|
99
99
|
**Key Principle:** If something is unclear or you're blocked, ASK the user. Don't make assumptions.
|
|
100
100
|
|
|
101
|
-
**Routing Principle:** For managed files requiring routing commands (`/cbp-build-cc-rule`, `/cbp-build-cc-agent`, `/cbp-build-cc-skill`, `/cbp-build-cc-claude-file`, `/cbp-build-cc-settings
|
|
101
|
+
**Routing Principle:** For managed files requiring routing commands (`/cbp-build-cc-rule`, `/cbp-build-cc-agent`, `/cbp-build-cc-skill`, `/cbp-build-cc-claude-file`, `/cbp-build-cc-settings`), use Skill tool. For other managed files (templates, architecture, research, stack docs), use direct Write/Edit.
|
|
102
102
|
|
|
103
103
|
## Execution Workflow
|
|
104
104
|
|
|
@@ -124,7 +124,6 @@ Skill tool: skill="cbp-build-cc-agent" # for .claude/agents/
|
|
|
124
124
|
Skill tool: skill="cbp-build-cc-skill" # for .claude/skills/
|
|
125
125
|
Skill tool: skill="cbp-build-cc-claude-file" # for .claude/CLAUDE.md
|
|
126
126
|
Skill tool: skill="cbp-build-cc-settings" # for .claude/settings*.json
|
|
127
|
-
Skill tool: skill="cbp-build-cc-memory" # for ~/.claude/projects/<project>/memory/
|
|
128
127
|
Direct Write/Edit # for templates, docs/
|
|
129
128
|
```
|
|
130
129
|
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# @scope: org-shared
|
|
3
|
+
# @hook: PreToolUse mcp__codebyplan__(update_checkpoint|complete_checkpoint|update_task|complete_task|add_round|update_round|complete_round|create_standalone_task|update_standalone_task|complete_standalone_task|add_standalone_round|update_standalone_round|complete_standalone_round|update_standalone_file_change)
|
|
4
|
+
# Hook: PreToolUse for MCP write tools
|
|
5
|
+
#
|
|
6
|
+
# Purpose: Inject caller_worktree_id into MCP mutation tool inputs when the
|
|
7
|
+
# field is absent. Reads the worktree.local.json branch-keyed cache
|
|
8
|
+
# first (fast path); falls back to `codebyplan resolve-worktree --cache`.
|
|
9
|
+
#
|
|
10
|
+
# Fail-open: ALL exit paths exit 0. A hook failure must never block a tool call.
|
|
11
|
+
# Use explicit guards rather than set -euo pipefail (which would exit
|
|
12
|
+
# non-zero on the first failing command before the final exit 0).
|
|
13
|
+
|
|
14
|
+
# C0 — require jq; if absent, emit nothing and exit 0 (fail-open).
|
|
15
|
+
if ! command -v jq > /dev/null 2>&1; then
|
|
16
|
+
exit 0
|
|
17
|
+
fi
|
|
18
|
+
|
|
19
|
+
# Read stdin once into a variable.
|
|
20
|
+
INPUT=$(cat)
|
|
21
|
+
|
|
22
|
+
# C6 — if caller_worktree_id is already a non-empty string, do not overwrite.
|
|
23
|
+
# (jq '// empty' already maps JSON null to an empty string, so a plain -n test suffices.)
|
|
24
|
+
EXISTING=$(echo "$INPUT" | jq -r '.tool_input.caller_worktree_id // empty' 2>/dev/null)
|
|
25
|
+
if [ -n "$EXISTING" ]; then
|
|
26
|
+
# Already populated — plain allow (exit 0 with no output).
|
|
27
|
+
exit 0
|
|
28
|
+
fi
|
|
29
|
+
|
|
30
|
+
# C5 — resolve worktree id, fast path first.
|
|
31
|
+
RESOLVED_WT=""
|
|
32
|
+
|
|
33
|
+
# Determine repo root: prefer $CLAUDE_PROJECT_DIR, fall back to PWD.
|
|
34
|
+
REPO_ROOT="${CLAUDE_PROJECT_DIR:-$PWD}"
|
|
35
|
+
CACHE_FILE="$REPO_ROOT/.codebyplan/worktree.local.json"
|
|
36
|
+
|
|
37
|
+
if [ -f "$CACHE_FILE" ]; then
|
|
38
|
+
CACHED_WT=$(jq -r '.worktree_id // empty' "$CACHE_FILE" 2>/dev/null)
|
|
39
|
+
CACHED_BRANCH=$(jq -r '.branch // empty' "$CACHE_FILE" 2>/dev/null)
|
|
40
|
+
|
|
41
|
+
if [ -n "$CACHED_WT" ] && [ "$CACHED_WT" != "null" ] && \
|
|
42
|
+
[ -n "$CACHED_BRANCH" ] && [ "$CACHED_BRANCH" != "null" ]; then
|
|
43
|
+
# Validate branch matches current git branch.
|
|
44
|
+
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)
|
|
45
|
+
if [ -n "$CURRENT_BRANCH" ] && [ "$CURRENT_BRANCH" = "$CACHED_BRANCH" ]; then
|
|
46
|
+
RESOLVED_WT="$CACHED_WT"
|
|
47
|
+
fi
|
|
48
|
+
fi
|
|
49
|
+
fi
|
|
50
|
+
|
|
51
|
+
# Fallback to CLI resolution if cache miss or branch mismatch.
|
|
52
|
+
if [ -z "$RESOLVED_WT" ]; then
|
|
53
|
+
RESOLVED_WT=$(codebyplan resolve-worktree --cache 2>/dev/null \
|
|
54
|
+
|| npx --no-install codebyplan resolve-worktree --cache 2>/dev/null \
|
|
55
|
+
|| true)
|
|
56
|
+
fi
|
|
57
|
+
|
|
58
|
+
# UUID guard — accept only a canonical UUID (8-4-4-4-12 hex).
|
|
59
|
+
UUID_PATTERN='^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$'
|
|
60
|
+
if [ -z "$RESOLVED_WT" ] || ! echo "$RESOLVED_WT" | grep -qE "$UUID_PATTERN"; then
|
|
61
|
+
# Unresolved or invalid — plain allow, no updatedInput.
|
|
62
|
+
exit 0
|
|
63
|
+
fi
|
|
64
|
+
|
|
65
|
+
# C3 — emit updatedInput as the FULL tool_input with caller_worktree_id added.
|
|
66
|
+
# Claude Code's PreToolUse updatedInput REPLACES tool_input wholesale (it is not a
|
|
67
|
+
# partial merge), so we must echo back every existing field merged with the new
|
|
68
|
+
# caller_worktree_id — otherwise the tool loses round_id/duration_minutes/etc.
|
|
69
|
+
echo "$INPUT" | jq \
|
|
70
|
+
--arg wt "$RESOLVED_WT" \
|
|
71
|
+
'{
|
|
72
|
+
hookSpecificOutput: {
|
|
73
|
+
hookEventName: "PreToolUse",
|
|
74
|
+
permissionDecision: "allow",
|
|
75
|
+
updatedInput: (.tool_input + { caller_worktree_id: $wt })
|
|
76
|
+
}
|
|
77
|
+
}'
|
|
78
|
+
|
|
79
|
+
exit 0
|
|
@@ -374,6 +374,87 @@ fi
|
|
|
374
374
|
|
|
375
375
|
echo ""
|
|
376
376
|
|
|
377
|
+
# ===== HOOK SMOKE TESTS — cbp-mcp-caller-worktree-inject =====
|
|
378
|
+
echo "## Hook Smoke Tests — cbp-mcp-caller-worktree-inject (CHK-198)"
|
|
379
|
+
|
|
380
|
+
INJECT_HOOK="$HOOKS_DIR/cbp-mcp-caller-worktree-inject.sh"
|
|
381
|
+
# Absolute path — the fail-open test runs the hook from a temp cwd (to isolate it
|
|
382
|
+
# from this repo's git context), where the relative "$HOOKS_DIR" no longer resolves.
|
|
383
|
+
INJECT_HOOK_ABS="$(cd "$HOOKS_DIR" 2>/dev/null && pwd)/cbp-mcp-caller-worktree-inject.sh"
|
|
384
|
+
|
|
385
|
+
if [ ! -f "$INJECT_HOOK" ]; then
|
|
386
|
+
test_result "cbp-mcp-caller-worktree-inject.sh present" "passed" "missing"
|
|
387
|
+
else
|
|
388
|
+
test_result "cbp-mcp-caller-worktree-inject.sh present" "passed" "passed"
|
|
389
|
+
|
|
390
|
+
FIRST_LINE=$(head -1 "$INJECT_HOOK")
|
|
391
|
+
if echo "$FIRST_LINE" | grep -q '^#!/'; then
|
|
392
|
+
test_result "cbp-mcp-caller-worktree-inject.sh has shebang" "passed" "passed"
|
|
393
|
+
else
|
|
394
|
+
test_result "cbp-mcp-caller-worktree-inject.sh has shebang" "passed" "missing"
|
|
395
|
+
fi
|
|
396
|
+
|
|
397
|
+
if grep -q '@scope: org-shared' "$INJECT_HOOK"; then
|
|
398
|
+
test_result "cbp-mcp-caller-worktree-inject.sh has @scope: org-shared" "passed" "passed"
|
|
399
|
+
else
|
|
400
|
+
test_result "cbp-mcp-caller-worktree-inject.sh has @scope: org-shared" "passed" "missing"
|
|
401
|
+
fi
|
|
402
|
+
|
|
403
|
+
# Fail-open: run from a non-repo temp dir with no worktree cache and no
|
|
404
|
+
# CLAUDE_PROJECT_DIR — neither the cache nor the CLI fallback can resolve a
|
|
405
|
+
# worktree, so the hook must exit 0 with empty stdout (no updatedInput).
|
|
406
|
+
ISO=$(mktemp -d)
|
|
407
|
+
OUTPUT=$( (cd "$ISO" && env -u CLAUDE_PROJECT_DIR bash "$INJECT_HOOK_ABS" <<< '{"tool_input":{"task_id":"x"}}') 2>/dev/null )
|
|
408
|
+
EXIT_CODE=$?
|
|
409
|
+
if [ "$EXIT_CODE" = "0" ] && [ -z "$OUTPUT" ]; then
|
|
410
|
+
test_result "cbp-mcp-caller-worktree-inject.sh fail-open (unresolvable) exits 0 + empty stdout" "passed" "passed"
|
|
411
|
+
else
|
|
412
|
+
test_result "cbp-mcp-caller-worktree-inject.sh fail-open (unresolvable) exits 0 + empty stdout" "passed" "failed (exit=$EXIT_CODE)"
|
|
413
|
+
fi
|
|
414
|
+
rm -rf "$ISO"
|
|
415
|
+
|
|
416
|
+
# C6 — input already carries a non-empty caller_worktree_id → never overwrite;
|
|
417
|
+
# early-return with exit 0 and empty stdout (no resolution attempted).
|
|
418
|
+
OUTPUT=$(echo '{"tool_input":{"caller_worktree_id":"11111111-1111-1111-1111-111111111111"}}' | bash "$INJECT_HOOK" 2>/dev/null)
|
|
419
|
+
EXIT_CODE=$?
|
|
420
|
+
if [ "$EXIT_CODE" = "0" ] && [ -z "$OUTPUT" ]; then
|
|
421
|
+
test_result "cbp-mcp-caller-worktree-inject.sh C6 keeps existing caller_worktree_id (exit 0 + empty stdout)" "passed" "passed"
|
|
422
|
+
else
|
|
423
|
+
test_result "cbp-mcp-caller-worktree-inject.sh C6 keeps existing caller_worktree_id (exit 0 + empty stdout)" "passed" "failed (exit=$EXIT_CODE)"
|
|
424
|
+
fi
|
|
425
|
+
|
|
426
|
+
# Injection — a worktree.local.json whose .branch matches the current git branch
|
|
427
|
+
# makes the cache fast-path resolve. Use a synthetic UUID so the assertion proves
|
|
428
|
+
# the cache value (not the live CLI) was injected. Skipped when no concrete git
|
|
429
|
+
# branch resolves (detached HEAD / non-git checkout) or jq is unavailable.
|
|
430
|
+
CUR_BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)
|
|
431
|
+
if [ -n "$CUR_BRANCH" ] && [ "$CUR_BRANCH" != "HEAD" ] && command -v jq >/dev/null 2>&1; then
|
|
432
|
+
ISO=$(mktemp -d)
|
|
433
|
+
mkdir -p "$ISO/.codebyplan"
|
|
434
|
+
FAKE_WT="abcdef01-2345-6789-abcd-ef0123456789"
|
|
435
|
+
jq -n --arg b "$CUR_BRANCH" --arg w "$FAKE_WT" \
|
|
436
|
+
'{worktree_id:$w, branch:$b}' > "$ISO/.codebyplan/worktree.local.json"
|
|
437
|
+
OUTPUT=$(CLAUDE_PROJECT_DIR="$ISO" bash "$INJECT_HOOK" <<< '{"tool_input":{"task_id":"x"}}' 2>/dev/null)
|
|
438
|
+
EXIT_CODE=$?
|
|
439
|
+
INJECTED=$(echo "$OUTPUT" | jq -r '.hookSpecificOutput.updatedInput.caller_worktree_id // empty' 2>/dev/null)
|
|
440
|
+
# Sibling-key survival — CC's updatedInput REPLACES tool_input wholesale (it is
|
|
441
|
+
# not a partial merge), so the hook must echo back every original field merged
|
|
442
|
+
# with caller_worktree_id. Assert the non-target sibling key (task_id) survives;
|
|
443
|
+
# this is the assertion gap that let the replace-vs-merge bug ship in round 2.
|
|
444
|
+
PRESERVED=$(echo "$OUTPUT" | jq -r '.hookSpecificOutput.updatedInput.task_id // empty' 2>/dev/null)
|
|
445
|
+
if [ "$EXIT_CODE" = "0" ] && [ "$INJECTED" = "$FAKE_WT" ] && [ "$PRESERVED" = "x" ]; then
|
|
446
|
+
test_result "cbp-mcp-caller-worktree-inject.sh injects caller_worktree_id AND preserves sibling keys" "passed" "passed"
|
|
447
|
+
else
|
|
448
|
+
test_result "cbp-mcp-caller-worktree-inject.sh injects caller_worktree_id AND preserves sibling keys" "passed" "failed (exit=$EXIT_CODE injected=$INJECTED preserved=$PRESERVED)"
|
|
449
|
+
fi
|
|
450
|
+
rm -rf "$ISO"
|
|
451
|
+
else
|
|
452
|
+
test_result "cbp-mcp-caller-worktree-inject.sh injection test (no branch resolvable — skipped)" "passed" "passed"
|
|
453
|
+
fi
|
|
454
|
+
fi
|
|
455
|
+
|
|
456
|
+
echo ""
|
|
457
|
+
|
|
377
458
|
# ===== SUMMARY =====
|
|
378
459
|
echo "=== TEST SUMMARY ==="
|
|
379
460
|
echo -e "Passed: ${GREEN}$PASSED${NC}"
|
|
@@ -45,6 +45,15 @@
|
|
|
45
45
|
"command": "bash ${CLAUDE_PLUGIN_ROOT}/hooks/cbp-mcp-migration-guard.sh"
|
|
46
46
|
}
|
|
47
47
|
]
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"matcher": "mcp__codebyplan__(update_checkpoint|complete_checkpoint|update_task|complete_task|add_round|update_round|complete_round|create_standalone_task|update_standalone_task|complete_standalone_task|add_standalone_round|update_standalone_round|complete_standalone_round|update_standalone_file_change)",
|
|
51
|
+
"hooks": [
|
|
52
|
+
{
|
|
53
|
+
"type": "command",
|
|
54
|
+
"command": "bash ${CLAUDE_PLUGIN_ROOT}/hooks/cbp-mcp-caller-worktree-inject.sh"
|
|
55
|
+
}
|
|
56
|
+
]
|
|
48
57
|
}
|
|
49
58
|
],
|
|
50
59
|
"PostToolUse": [
|
|
@@ -34,14 +34,19 @@ The `install`/`update`/`uninstall` flow handles these files identically to how i
|
|
|
34
34
|
|
|
35
35
|
## Current status
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
| Rule file | Summary |
|
|
40
|
-
|
|
41
|
-
| `scope-vocabulary.md` | Canonical scope-marker enum (`org-shared` / `project-shared` / `repo-only:<name>`) enforced by three validators |
|
|
42
|
-
| `context-file-loading.md` | Context-file load contract — who loads what, when, and how missing files are handled |
|
|
43
|
-
| `todo-backend.md` | Todos queue contract, six DB-layer workflow invariants, and writer obligations for MCP mutators |
|
|
44
|
-
| `supabase-branch-lifecycle.md` | Supabase preview-branch lifecycle mirrors the git feat-branch lifecycle — lazy create on first DB change, delete wherever the git branch is removed |
|
|
37
|
+
Nine rules are shipped:
|
|
38
|
+
|
|
39
|
+
| Rule file | Scope | Summary |
|
|
40
|
+
|---|---|---|
|
|
41
|
+
| `scope-vocabulary.md` | `org-shared` | Canonical scope-marker enum (`org-shared` / `project-shared` / `repo-only:<name>`) enforced by three validators |
|
|
42
|
+
| `context-file-loading.md` | `org-shared` | Context-file load contract — who loads what, when, and how missing files are handled |
|
|
43
|
+
| `todo-backend.md` | `org-shared` | Todos queue contract, six DB-layer workflow invariants, and writer obligations for MCP mutators |
|
|
44
|
+
| `supabase-branch-lifecycle.md` | `org-shared` | Supabase preview-branch lifecycle mirrors the git feat-branch lifecycle — lazy create on first DB change, delete wherever the git branch is removed |
|
|
45
|
+
| `agent-claim-verification.md` | `org-shared` | Verify an agent's claimed outcomes against ground truth (git, filesystem, tool results) before trusting them |
|
|
46
|
+
| `e2e-mandatory.md` | `org-shared` | E2E is opt-out: an eligible framework whose source changed in a round must run its specialist or record a valid skip |
|
|
47
|
+
| `parallel-waves.md` | `org-shared` | Wave-dispatch contract for parallel round execution — topological ordering and per-wave testing |
|
|
48
|
+
| `task-routing-recommendation.md` | `repo-only:codebyplan` | Two-family command surface (checkpoint-bound vs standalone) and identifier-format routing — installed only in codebyplan-family repos |
|
|
49
|
+
| `cbp-operating-gotchas.md` | `org-shared` | Cross-repo CBP-tooling traps (ship/timeout/MCP-replace/worktree/lint-baseline/approval-reconcile) + behavioral prefs, inherited once by all consumers |
|
|
45
50
|
|
|
46
51
|
## Contributing a rule
|
|
47
52
|
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
scope: org-shared
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# CBP Operating Gotchas
|
|
6
|
+
|
|
7
|
+
Cross-repo traps in the CodeByPlan tooling surface (CLI, MCP, git, host platform) that
|
|
8
|
+
recur in every consuming repo. They are recorded **once** here so consumers inherit them via
|
|
9
|
+
`npx codebyplan claude update` instead of re-learning each one per repo. This file is for
|
|
10
|
+
SHARED tooling behavior only — repo-specific gotchas belong in that repo's own `CLAUDE.md`
|
|
11
|
+
(root or nested), never here.
|
|
12
|
+
|
|
13
|
+
## Tooling Traps
|
|
14
|
+
|
|
15
|
+
- **`codebyplan ship` can report a false `checks_failed`.** The CLI polls
|
|
16
|
+
`gh pr checks --json name,state,conclusion` and treats a check as failed when its `state` is
|
|
17
|
+
`COMPLETED` and its `conclusion` is non-null and not a success value — but `gh` does not always
|
|
18
|
+
populate `conclusion` for every check type, so a green PR can be misread as failed. Do not trust
|
|
19
|
+
the CLI verdict alone: confirm with `gh pr checks <pr> --watch`, then merge manually with
|
|
20
|
+
`gh pr merge <pr> --merge`.
|
|
21
|
+
|
|
22
|
+
- **macOS has no `timeout` binary.** Wrapping a build/lint/test in `timeout …` fails with
|
|
23
|
+
`command not found: timeout` — meaning the wrapped command **never ran** (a misleading
|
|
24
|
+
"exit 127", not a real result). Never shell-wrap with `timeout`; use the Bash tool's own
|
|
25
|
+
`timeout` parameter to bound a command.
|
|
26
|
+
|
|
27
|
+
- **MCP `update_checkpoint` / `update_task` / `update_round` are REPLACE, not merge.** The
|
|
28
|
+
`context` JSONB and `files_changed[]` array overwrite wholesale — a partial write silently
|
|
29
|
+
clobbers existing `decisions` / `discoveries` / `check_results`. Always read the current row,
|
|
30
|
+
merge your change into the full object/array, then write the whole thing back.
|
|
31
|
+
|
|
32
|
+
- **`resolve-worktree` empty output = a NULL `(device, path, branch)` tuple, not a broken
|
|
33
|
+
resolver.** When identity is unresolved the server can collapse the caller to the repo's main
|
|
34
|
+
worktree, so feat-locked writes get rejected. Pass `caller_worktree_id` on every MCP mutation,
|
|
35
|
+
and confirm ownership by matching the row's repo path + branch to the current directory before
|
|
36
|
+
mutating.
|
|
37
|
+
|
|
38
|
+
- **Full-repo lint/type baselines are often pre-existing red.** A round must gate on the files
|
|
39
|
+
it changed, not the whole-repo baseline — scope lint/tsc checks to the round's changed set so a
|
|
40
|
+
pre-existing baseline error outside that set never fails the round.
|
|
41
|
+
|
|
42
|
+
- **`complete_task` checks file approval on the round's `files_changed`, not the task's.**
|
|
43
|
+
Reconcile approvals via `update_round` (set each entry `user_approved: true`), not
|
|
44
|
+
`update_task` alone — updating only the task leaves the round entries unapproved and
|
|
45
|
+
`complete_task` rejects with "files are not approved".
|
|
46
|
+
|
|
47
|
+
- **CLI transport uses REST (reads) and OAuth+MCP (writes) — a 502 from `codebyplan round sync-approvals` is transient MCP churn, not an outage.** The CLI exits 0 with a warning and MCP tools still work. A missing `CODEBYPLAN_API_KEY` surfaces as an `ApiError`, not a 502. `sync-approvals` can also drag untracked per-device dirs into `files_changed` — run it from the repo root or pass `--caller-worktree-id`.
|
|
48
|
+
|
|
49
|
+
- **`codebyplan claude update` requires a TTY.** On non-TTY stdin (CI, piped) it half-applies then errors. Re-run with `--yes` to accept defaults non-interactively.
|
|
50
|
+
|
|
51
|
+
- **Checkpoint locks are invisible until a mutation they block.** `get_checkpoints` / `get_tasks` succeed even when another worktree holds the lock; the 403 fires only on `update_*` / `complete_*`. Verify the row's `worktree_id` matches the caller before mutating. A null-`worktree_id` checkpoint can still be actively shipped by whichever worktree physically holds its feat branch — check `git worktree list` first.
|
|
52
|
+
|
|
53
|
+
- **`update_task` accepts `caller_worktree_id` for lock-verify only — it does NOT assign ownership.** Ownership assignment goes through the web UI or the dedicated assignment path. Don't conflate `caller_worktree_id` with `assigned_worktree_id`.
|
|
54
|
+
|
|
55
|
+
- **Re-run config-driven gates after merging main into a feat branch.** A merge can add or change `.codebyplan/shipment.json`, ports, branch config, `e2e.json`, and `eslint.json` — treat the post-merge state as a fresh baseline before continuing.
|
|
56
|
+
|
|
57
|
+
## Behavioral Preferences
|
|
58
|
+
|
|
59
|
+
- **Never `git stash`** — for any reason. To inspect or compare other state use
|
|
60
|
+
`git diff <ref>`, `git show <ref>:<path>`, or `git worktree add`.
|
|
61
|
+
|
|
62
|
+
- **During MCP instability, verify tool results over narration.** When responses lag, servers
|
|
63
|
+
cycle, or calls 502, never state an expected output as fact — confirm against git and the
|
|
64
|
+
filesystem, which are the source of truth.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
scope: org-shared
|
|
3
3
|
name: cbp-build-cc-agent
|
|
4
|
-
description: Build a Claude Code subagent at .claude/agents/{name}.md (flat form, per the official sub-agents spec) following the official sub-agents spec (frontmatter, tools, model,
|
|
5
|
-
argument-hint: "[agent-name] [--scope=project|user] [--
|
|
4
|
+
description: Build a Claude Code subagent at .claude/agents/{name}.md (flat form, per the official sub-agents spec) following the official sub-agents spec (frontmatter, tools, model, hooks, skills preload, permission modes, isolation).
|
|
5
|
+
argument-hint: "[agent-name] [--scope=project|user] [--isolation=worktree]"
|
|
6
6
|
allowed-tools: Read, Write, Edit, Glob, Grep, Bash(mkdir *), Bash(chmod *)
|
|
7
7
|
effort: xhigh
|
|
8
8
|
---
|
|
@@ -15,7 +15,7 @@ Create a Claude Code subagent following the official Claude Code sub-agents spec
|
|
|
15
15
|
|
|
16
16
|
## Arguments
|
|
17
17
|
|
|
18
|
-
`$ARGUMENTS` — agent name (kebab-case, required). Flags: `--scope=project|user` (default `project`), `--
|
|
18
|
+
`$ARGUMENTS` — agent name (kebab-case, required). Flags: `--scope=project|user` (default `project`), `--isolation=worktree`.
|
|
19
19
|
|
|
20
20
|
## When to Use
|
|
21
21
|
|
|
@@ -70,7 +70,6 @@ Check each against the task and include only when they add value:
|
|
|
70
70
|
|
|
71
71
|
| Capability | Field | When to include |
|
|
72
72
|
| -------------------- | --------------------------------------------------------------- | ------------------------------------------------------ |
|
|
73
|
-
| Persistent memory | `memory: project\|user\|local` | Agent should accumulate learnings across conversations |
|
|
74
73
|
| Preloaded skills | `skills: [skill-a, skill-b]` | Domain knowledge the agent needs every run |
|
|
75
74
|
| Scoped MCP servers | `mcpServers: [...]` | Tools the parent session shouldn't have in context |
|
|
76
75
|
| Lifecycle hooks | `hooks: { PreToolUse: [...], PostToolUse: [...], Stop: [...] }` | Need to validate tool calls or trigger side-effects |
|
|
@@ -4,7 +4,6 @@ description: Implement API endpoints following team conventions. Use when adding
|
|
|
4
4
|
tools: Read, Write, Edit, Grep, Glob, Bash
|
|
5
5
|
model: sonnet
|
|
6
6
|
effort: xhigh
|
|
7
|
-
memory: project
|
|
8
7
|
skills:
|
|
9
8
|
- api-conventions
|
|
10
9
|
- error-handling-patterns
|
|
@@ -13,11 +12,11 @@ skills:
|
|
|
13
12
|
You are an API developer. Follow the conventions and patterns preloaded via the `skills` field — they define the project's RESTful naming, error format, and validation rules.
|
|
14
13
|
|
|
15
14
|
When invoked:
|
|
16
|
-
1. Read `
|
|
15
|
+
1. Read the nearest folder-local `CLAUDE.md` (e.g. `src/api/CLAUDE.md`) for conventions specific to this area
|
|
17
16
|
2. Locate the handler directory (`src/api/handlers/`)
|
|
18
17
|
3. Implement the endpoint per the preloaded conventions
|
|
19
18
|
4. Write or update tests in the matching `*.test.ts` file
|
|
20
|
-
5.
|
|
19
|
+
5. When you discover a durable pattern worth remembering, record it in the folder-local `CLAUDE.md` via `/cbp-build-cc-claude-file`
|
|
21
20
|
|
|
22
21
|
Return:
|
|
23
22
|
- Files created/modified
|
|
@@ -14,7 +14,6 @@ Source: official Claude Code sub-agents spec. Only `name` and `description` are
|
|
|
14
14
|
| `skills` | list | Skills to preload — full content injected at startup |
|
|
15
15
|
| `mcpServers` | list | String references (shared) or inline defs (scoped to this agent) |
|
|
16
16
|
| `hooks` | object | Lifecycle hooks — `PreToolUse`, `PostToolUse`, `Stop` (→ `SubagentStop`) |
|
|
17
|
-
| `memory` | string | `user` \| `project` \| `local` — persistent MEMORY.md directory |
|
|
18
17
|
| `background` | boolean | Always run concurrent to the main thread |
|
|
19
18
|
| `effort` | string | `low` \| `medium` \| `high` \| `xhigh` \| `max`. **Plugin agents authored in CBP MUST set this explicitly** (no commented-out placeholder); see [/cbp-build-cc-mode](../../build-cc-mode/SKILL.md) for the matrix |
|
|
20
19
|
| `isolation` | string | `worktree` — gives the agent a temporary git worktree |
|
|
@@ -54,12 +54,6 @@ if [ -n "$pm" ] && [[ ! "$pm" =~ ^(default|acceptEdits|auto|dontAsk|bypassPermis
|
|
|
54
54
|
err "permissionMode invalid: got '$pm'"
|
|
55
55
|
fi
|
|
56
56
|
|
|
57
|
-
# Memory scope check
|
|
58
|
-
mem=$(grep -E '^memory:' <<< "$fm" | head -1 | sed -E 's/^memory:[[:space:]]*//; s/[[:space:]]*$//; s/^"(.*)"$/\1/' || true)
|
|
59
|
-
if [ -n "$mem" ] && [[ ! "$mem" =~ ^(user|project|local)$ ]]; then
|
|
60
|
-
err "memory must be user|project|local: got '$mem'"
|
|
61
|
-
fi
|
|
62
|
-
|
|
63
57
|
if [ "$errors" -gt 0 ]; then
|
|
64
58
|
echo "validation FAILED ($errors issue(s)) for $FILE" >&2
|
|
65
59
|
exit 1
|
|
@@ -12,7 +12,6 @@ effort: xhigh
|
|
|
12
12
|
# color: blue # red | blue | green | yellow | purple | orange | pink | cyan
|
|
13
13
|
# background: false
|
|
14
14
|
# isolation: worktree # only if the agent should work in an isolated git worktree
|
|
15
|
-
# memory: project # project | user | local — enables persistent MEMORY.md
|
|
16
15
|
# skills:
|
|
17
16
|
# - api-conventions
|
|
18
17
|
# - error-handling-patterns
|
|
@@ -33,7 +32,7 @@ effort: xhigh
|
|
|
33
32
|
# hooks:
|
|
34
33
|
# - type: command
|
|
35
34
|
# command: "./scripts/run-linter.sh"
|
|
36
|
-
# initialPrompt: "Start by reading
|
|
35
|
+
# initialPrompt: "Start by reading the project CLAUDE.md, then wait for instructions." # only used when run as main thread via --agent
|
|
37
36
|
---
|
|
38
37
|
|
|
39
38
|
You are a [role] specialising in [domain].
|
|
@@ -28,12 +28,12 @@ Actions:
|
|
|
28
28
|
- Adding a new project-level fact (build command, architecture decision)
|
|
29
29
|
- Restructuring when CLAUDE.md grows past ~200 lines
|
|
30
30
|
- Migrating from AGENTS.md to CLAUDE.md (or bridging them)
|
|
31
|
+
- Capturing a folder-local learning (a `project`/`feedback` insight tied to one area of the tree) → author a **nested CLAUDE.md** next to that code (see "Authoring a nested CLAUDE.md" below). This is the home for durable learnings that previously went to auto-memory.
|
|
31
32
|
|
|
32
33
|
Do NOT use this skill for:
|
|
33
34
|
|
|
34
35
|
- Workflow details or behavioural rules → `/cbp-build-cc-rule`
|
|
35
36
|
- Reusable step-by-step procedures → `/cbp-build-cc-skill`
|
|
36
|
-
- Personal learnings across projects → `/cbp-build-cc-memory`
|
|
37
37
|
|
|
38
38
|
## Instructions
|
|
39
39
|
|
|
@@ -48,6 +48,20 @@ Do NOT use this skill for:
|
|
|
48
48
|
|
|
49
49
|
Default: project. Either `./CLAUDE.md` or `./.claude/CLAUDE.md` works; pick one and stick to it.
|
|
50
50
|
|
|
51
|
+
### Step 1.5 — Authoring a nested CLAUDE.md
|
|
52
|
+
|
|
53
|
+
A **nested** CLAUDE.md lives in a subdirectory (e.g. `apps/web/src/lib/CLAUDE.md`) rather than the repo root. It is the home for a folder-local learning — a `project`/`feedback` insight that only matters when working in that part of the tree (what previously went to auto-memory). Prefer a nested CLAUDE.md over the root file whenever the fact is scoped to one area: it keeps the root high-signal and loads the detail only when relevant.
|
|
54
|
+
|
|
55
|
+
**Discovery (how nested files load).** At session start Claude Code loads every `CLAUDE.md` on the path from the working directory **up** to the repo root. Files in subdirectories **below** the working directory load **on-demand** — the moment Claude reads any file inside that subdirectory. Unlike the root file, nested CLAUDE.md content does **not** survive compaction — it reloads when Claude next touches a matching subdirectory file. So a nested file is self-contained context for its folder, not a place for repo-wide rules.
|
|
56
|
+
|
|
57
|
+
**Placement.** Put the file in the shallowest directory that fully contains the concern:
|
|
58
|
+
|
|
59
|
+
- A gotcha about one package's build → that package root (`packages/foo/CLAUDE.md`)
|
|
60
|
+
- A convention for a feature area → that feature dir (`apps/web/src/lib/CLAUDE.md`)
|
|
61
|
+
- A repo-wide fact → the root CLAUDE.md, not a nested file
|
|
62
|
+
|
|
63
|
+
**Authoring.** Same quality gates as the root file (specific > vague, no duplication, keep it stable), but scope every line to the folder. Open with one line naming the area the file governs. Cross-link the root file or a rule with `@path` imports instead of repeating their content. To create one, run this skill with `create --scope=project` and write to the nested path.
|
|
64
|
+
|
|
51
65
|
### Step 2 — Read existing CLAUDE.md (for update/check)
|
|
52
66
|
|
|
53
67
|
```bash
|
|
@@ -165,7 +179,7 @@ Run `/memory` to confirm the file is loaded. The list shows all CLAUDE.md, CLAUD
|
|
|
165
179
|
- **Triggered by**: user invocation
|
|
166
180
|
- **Reads**: `${CLAUDE_SKILL_DIR}/templates/*.md`, `${CLAUDE_SKILL_DIR}/reference/*.md`, current CLAUDE.md, `.claude/rules/*.md`
|
|
167
181
|
- **Writes**: CLAUDE.md at the chosen scope
|
|
168
|
-
- **Related skills**: `/cbp-build-cc-rule` (behavioural constraints), `/cbp-build-cc-
|
|
182
|
+
- **Related skills**: `/cbp-build-cc-rule` (behavioural constraints), `/cbp-build-cc-settings` (for `claudeMdExcludes`)
|
|
169
183
|
|
|
170
184
|
## Key Rules
|
|
171
185
|
|
|
@@ -15,7 +15,7 @@ Source: official Claude Code memory spec — *Write effective instructions*.
|
|
|
15
15
|
|-------------|------------------|
|
|
16
16
|
| Multi-step procedure | Skill (`.claude/skills/{name}/SKILL.md`) |
|
|
17
17
|
| File-specific constraint | Path-scoped rule (`.claude/rules/{name}.md` with `paths:`) |
|
|
18
|
-
|
|
|
18
|
+
| Folder-local learning (project/feedback) | Nested CLAUDE.md placed next to the code it concerns (see SKILL.md "Authoring a nested CLAUDE.md") |
|
|
19
19
|
| API endpoint documentation | `docs/` |
|
|
20
20
|
| Architecture deep-dive | `docs/architecture/` |
|
|
21
21
|
| Framework usage guide | `docs/stack/{framework}/` |
|
|
@@ -23,7 +23,7 @@ Audit or apply the canonical `model:` + `effort:` frontmatter convention across
|
|
|
23
23
|
|
|
24
24
|
`model: sonnet` + `effort: xhigh`
|
|
25
25
|
|
|
26
|
-
Fifteen of the 16 authoring agents take the default (`cbp-cc-executor`, `cbp-database-agent`, `cbp-improve-claude`, `cbp-improve-round`, `cbp-research`, `cbp-round-executor`, `cbp-security-agent`, `cbp-task-check`, `cbp-task-planner`, `cbp-testing-qa-agent`, `cbp-e2e-playwright`, `cbp-e2e-maestro`, `cbp-e2e-tauri`, `cbp-e2e-vscode`, `cbp-e2e-xcuitest`). The 16th — `cbp-mechanical-edits` — is an explicit haiku-low exception (see below).
|
|
26
|
+
Fifteen of the 16 authoring agents take the default (`cbp-cc-executor`, `cbp-database-agent`, `cbp-improve-claude`, `cbp-improve-round`, `cbp-research`, `cbp-round-executor`, `cbp-security-agent`, `cbp-task-check`, `cbp-task-planner`, `cbp-testing-qa-agent`, `cbp-e2e-playwright`, `cbp-e2e-maestro`, `cbp-e2e-tauri`, `cbp-e2e-vscode`, `cbp-e2e-xcuitest`). The 16th — `cbp-mechanical-edits` — is an explicit haiku-low exception (see below). 26 skills take the default: cbp-round-start, cbp-round-input, cbp-round-execute, cbp-task-create, cbp-task-start, cbp-task-complete, cbp-task-testing, cbp-checkpoint-create, cbp-checkpoint-check, cbp-checkpoint-end, cbp-build-cc-mode, cbp-build-cc-agent, cbp-build-cc-skill, cbp-build-cc-rule, cbp-build-cc-claude-file, cbp-build-cc-settings, cbp-frontend-a11y, cbp-frontend-design, cbp-frontend-ui, cbp-frontend-ux, cbp-session-end, cbp-ship, cbp-ship-configure, cbp-supabase-setup, cbp-supabase-migrate, cbp-supabase-branch-check.
|
|
27
27
|
|
|
28
28
|
### Effort-lowered skills (5)
|
|
29
29
|
|
|
@@ -25,7 +25,7 @@ Create a rule at `.claude/rules/{name}.md` per the official Claude Code memory s
|
|
|
25
25
|
|
|
26
26
|
- Step-by-step workflows → use `/cbp-build-cc-skill` (loads on invoke, doesn't burn context)
|
|
27
27
|
- Project-level facts always needed → CLAUDE.md (use `/cbp-build-cc-claude-file`)
|
|
28
|
-
- Accumulating learnings →
|
|
28
|
+
- Accumulating learnings → nested CLAUDE.md (use `/cbp-build-cc-claude-file`)
|
|
29
29
|
|
|
30
30
|
## Instructions
|
|
31
31
|
|
|
@@ -164,7 +164,7 @@ Use the `InstructionsLoaded` hook if you need to debug exactly when and why a ru
|
|
|
164
164
|
- **Triggered by**: user invocation
|
|
165
165
|
- **Reads**: `${CLAUDE_SKILL_DIR}/templates/rule.md`, `${CLAUDE_SKILL_DIR}/reference/paths-patterns.md`
|
|
166
166
|
- **Writes**: `.claude/rules/{name}.md` or `~/.claude/rules/{name}.md`
|
|
167
|
-
- **Related skills**: `/cbp-build-cc-claude-file` (project facts
|
|
167
|
+
- **Related skills**: `/cbp-build-cc-claude-file` (project facts + nested-folder learnings), `/cbp-build-cc-skill` (workflows)
|
|
168
168
|
|
|
169
169
|
## Key Rules
|
|
170
170
|
|
|
@@ -57,7 +57,7 @@ This mirrors the CHK-104 hard-lock model — never wrest a checkpoint from a liv
|
|
|
57
57
|
|
|
58
58
|
If the checkpoint is already `active` AND `worktree_id` already equals `CALLER_WT` (the Step 3 no-op row), skip this step entirely and proceed to Step 5 — nothing to write.
|
|
59
59
|
|
|
60
|
-
Otherwise set the checkpoint `active` via MCP `update_checkpoint(checkpoint_id, status: "active"`, plus `worktree_id: CALLER_WT` when claiming per Step 3.
|
|
60
|
+
Otherwise set the checkpoint `active` via MCP `update_checkpoint(checkpoint_id, status: "active"`, plus `worktree_id: CALLER_WT` when claiming per Step 3. `caller_worktree_id` (CHK-140 TASK-7) identifies the calling worktree and is auto-injected by the `cbp-mcp-caller-worktree-inject.sh` PreToolUse hook (CHK-198 TASK-2); the server falls back to the repo `main` worktree only when it is absent. If the checkpoint was already `active` but a claim is still needed, skip the status write and only write `worktree_id`.
|
|
61
61
|
|
|
62
62
|
### Step 5: Route
|
|
63
63
|
|
|
@@ -78,7 +78,7 @@ Show a one-line confirmation before routing:
|
|
|
78
78
|
## Integration
|
|
79
79
|
|
|
80
80
|
- **Reads**: MCP `get_checkpoints`, `get_tasks`; `npx codebyplan resolve-worktree`
|
|
81
|
-
- **Writes**: MCP `update_checkpoint` (status + worktree_id;
|
|
81
|
+
- **Writes**: MCP `update_checkpoint` (status + worktree_id; `caller_worktree_id` auto-injected by the cbp-mcp-caller-worktree-inject.sh hook, CHK-198 TASK-2; server falls back to repo `main` only when absent)
|
|
82
82
|
- **Triggered by**: `/cbp-checkpoint-plan` (auto when claimed at create), `/cbp-todo` (planned-but-pending gate), or user directly
|
|
83
83
|
- **Triggers**: `/cbp-task-start` (auto when claimed), or `/cbp-checkpoint-plan` (when the checkpoint is unplanned)
|
|
84
84
|
- **Never**: plans or creates tasks — that is `/cbp-checkpoint-plan`
|