codebyplan 1.13.38 → 1.13.40

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 (54) hide show
  1. package/dist/cli.js +25142 -425
  2. package/package.json +4 -2
  3. package/templates/agents/cbp-cc-executor.md +4 -4
  4. package/templates/agents/cbp-map-architecture.md +90 -0
  5. package/templates/agents/cbp-round-executor.md +2 -0
  6. package/templates/agents/cbp-task-check.md +2 -0
  7. package/templates/agents/cbp-task-planner.md +2 -0
  8. package/templates/context/architecture/arch-map-spec.md +204 -0
  9. package/templates/context/architecture-map.md +117 -0
  10. package/templates/hooks/README.md +14 -2
  11. package/templates/hooks/cbp-session-start-hook.sh +32 -0
  12. package/templates/hooks/cbp-test-coverage-gate.sh +20 -6
  13. package/templates/hooks/cbp-test-hooks.sh +72 -0
  14. package/templates/hooks/hooks.json +11 -0
  15. package/templates/hooks/validate-structure.sh +3 -2
  16. package/templates/rules/architecture-map.md +30 -0
  17. package/templates/rules/context-file-loading.md +3 -0
  18. package/templates/rules/supabase-branch-lifecycle.md +1 -1
  19. package/templates/settings.project.base.json +15 -1
  20. package/templates/skills/cbp-checkpoint-check/SKILL.md +10 -10
  21. package/templates/skills/cbp-checkpoint-complete/SKILL.md +7 -7
  22. package/templates/skills/cbp-checkpoint-create/SKILL.md +11 -9
  23. package/templates/skills/cbp-checkpoint-end/SKILL.md +4 -4
  24. package/templates/skills/cbp-checkpoint-plan/SKILL.md +10 -10
  25. package/templates/skills/cbp-checkpoint-start/SKILL.md +6 -6
  26. package/templates/skills/cbp-checkpoint-update/SKILL.md +9 -9
  27. package/templates/skills/cbp-git-commit/SKILL.md +8 -4
  28. package/templates/skills/cbp-git-worktree-remove/SKILL.md +3 -2
  29. package/templates/skills/cbp-map-architecture/SKILL.md +170 -0
  30. package/templates/skills/cbp-merge-main/SKILL.md +2 -5
  31. package/templates/skills/cbp-refresh-arch-map/SKILL.md +191 -0
  32. package/templates/skills/cbp-round-check/SKILL.md +12 -8
  33. package/templates/skills/cbp-round-complete/SKILL.md +16 -10
  34. package/templates/skills/cbp-round-end/SKILL.md +9 -10
  35. package/templates/skills/cbp-round-execute/SKILL.md +7 -6
  36. package/templates/skills/cbp-round-input/SKILL.md +24 -12
  37. package/templates/skills/cbp-round-start/SKILL.md +36 -16
  38. package/templates/skills/cbp-round-update/SKILL.md +14 -10
  39. package/templates/skills/cbp-session-end/SKILL.md +22 -12
  40. package/templates/skills/cbp-session-start/SKILL.md +19 -15
  41. package/templates/skills/cbp-ship/SKILL.md +4 -4
  42. package/templates/skills/cbp-ship/reference/surface-supabase.md +3 -3
  43. package/templates/skills/cbp-ship-configure/SKILL.md +1 -1
  44. package/templates/skills/cbp-ship-configure/reference/railway-backend.md +2 -2
  45. package/templates/skills/cbp-ship-configure/reference/vercel.md +1 -1
  46. package/templates/skills/cbp-ship-main/SKILL.md +2 -2
  47. package/templates/skills/cbp-standalone-task-complete/SKILL.md +3 -2
  48. package/templates/skills/cbp-supabase-migrate/SKILL.md +6 -7
  49. package/templates/skills/cbp-task-check/SKILL.md +10 -10
  50. package/templates/skills/cbp-task-complete/SKILL.md +11 -9
  51. package/templates/skills/cbp-task-create/SKILL.md +7 -5
  52. package/templates/skills/cbp-task-start/SKILL.md +15 -17
  53. package/templates/skills/cbp-task-testing/SKILL.md +18 -18
  54. package/templates/skills/cbp-todo/SKILL.md +21 -21
@@ -0,0 +1,170 @@
1
+ ---
2
+ scope: org-shared
3
+ name: cbp-map-architecture
4
+ description: Orchestrate architecture map generation for one or all modules. Spawns the cbp-map-architecture agent per module, writes per-module .md files to .claude/architecture/, regenerates INDEX.md and graph.md, and stamps each module via the CLI. Idempotent — safe to re-run.
5
+ argument-hint: '[--module <path>] [--deep <path,...>]'
6
+ allowed-tools: Read, Write, Edit, Glob, Grep, Bash, Task
7
+ ---
8
+
9
+ # Map Architecture
10
+
11
+ Generate or refresh the `.claude/architecture/` map for one or all repository modules.
12
+ Idempotent — re-running regenerates stale or missing maps without touching fresh ones.
13
+
14
+ Distinct from `/cbp-refresh-arch-map` (TASK-3: drift-scoped refresh that only re-runs
15
+ modules whose stamped SHA has since changed). This skill maps **all** target modules
16
+ unconditionally, or a specific subset when `--module` is given.
17
+
18
+ ## Arguments
19
+
20
+ `$ARGUMENTS` accepts:
21
+
22
+ | Flag | Description |
23
+ |------|-------------|
24
+ | `--module <path>` | Map a single module (e.g. `apps/web`). Omit to map all discovered modules. |
25
+ | `--deep <path,...>` | Comma-separated list of modules to map at `deep` depth. All others default to `skeleton`. |
26
+
27
+ ## Instructions
28
+
29
+ ### Step A: Discover target modules
30
+
31
+ 1. Run `codebyplan arch-map status` (Bash) to enumerate all discovered modules and their
32
+ current map presence + freshness. Capture the output.
33
+ 2. If `--module <path>` was given, restrict the target list to that one module.
34
+ 3. Parse `--deep <path,...>` into a set of paths that should be mapped at `deep` depth.
35
+ All other targets default to `skeleton`.
36
+
37
+ Output:
38
+ ```yaml
39
+ targets:
40
+ - path: string # module path relative to repo root
41
+ depth: skeleton|deep
42
+ has_map: boolean # from arch-map status output
43
+ ```
44
+
45
+ ### Step B: Spawn the cbp-map-architecture agent per module
46
+
47
+ For each module in `targets[]`:
48
+
49
+ 1. Derive the map-file slug from the module path:
50
+ - Replace `/` with `-`
51
+ - Normalize a leading `.` to `dot-` (e.g. `.github` → `dot-github.md`)
52
+ - Example: `apps/web` → `apps-web.md`
53
+
54
+ 2. Spawn the `cbp-map-architecture` agent (via Task tool) with input:
55
+ ```yaml
56
+ module_path: <path>
57
+ depth: skeleton|deep
58
+ ```
59
+
60
+ 3. Receive the agent's returned map content (a full `.claude/architecture/<slug>.md`
61
+ text block, starting with `---` YAML frontmatter).
62
+
63
+ 4. Write the content to `.claude/architecture/<slug>.md` using the Write tool.
64
+ Create the `.claude/architecture/` directory if it does not yet exist.
65
+
66
+ Modules may be spawned concurrently (parallel Task calls) when there are multiple targets
67
+ with no inter-module dependency. The agent is read-only and safe to parallelize.
68
+
69
+ ### Step C: Regenerate INDEX.md and graph.md
70
+
71
+ After all per-module map files are written:
72
+
73
+ **INDEX.md** — regenerate `.claude/architecture/INDEX.md` from scratch:
74
+
75
+ 1. Read all `.claude/architecture/*.md` files (excluding INDEX.md and graph.md).
76
+ 2. For each file, parse the YAML frontmatter fields: `module`, `depth`,
77
+ `generated_from_sha`, `generated_at`.
78
+ 3. Derive the short SHA: first 8 chars of `generated_from_sha`, or `unset` if null.
79
+ 4. Derive the date: `YYYY-MM-DD` portion of `generated_at`, or `unset` if null.
80
+ 5. Write INDEX.md following the canonical format from `context/architecture/arch-map-spec.md`:
81
+
82
+ ```markdown
83
+ # Architecture Map Index
84
+
85
+ Grep-friendly registry of per-module architecture maps. Layout convention in `context/architecture/arch-map-spec.md`.
86
+
87
+ | Module | Depth | SHA | Generated | Map File |
88
+ |--------|-------|-----|-----------|----------|
89
+ | <module> | <depth> | <sha_short> | <date> | <map_file> |
90
+ ```
91
+
92
+ **graph.md** — regenerate `.claude/architecture/graph.md` from scratch:
93
+
94
+ 1. For each map file, read the `## 4. Dependencies (In / Out)` section.
95
+ 2. Extract "Consumes" entries — each named module becomes an edge: `<module> -> <dependency>`.
96
+ 3. Collect all edges into a Set keyed on the exact `"<from> -> <to>"` string, then write each unique edge once. graph.md lists each directed edge exactly once — duplicate declarations across multiple maps are deduplicated at write time.
97
+ 4. Write graph.md following the canonical format from `context/architecture/arch-map-spec.md`:
98
+
99
+ ```markdown
100
+ # Architecture Dependency Graph
101
+
102
+ Adjacency list of cross-module edges. Each entry: `<from> -> <to>`.
103
+ Generated from the `Dependencies (In / Out)` sections of individual map files
104
+ (first-party `@codebyplan/*` workspace imports, verified against each module's `package.json`).
105
+
106
+ Scope: edges are TypeScript workspace package imports only. Runtime/service dependencies
107
+ (shared schema directories, HTTP calls between apps) are documented per-map in
108
+ `## 4. Dependencies (In / Out)` and are intentionally NOT graphed here — a module with
109
+ no edge is not necessarily isolated; consult its map file for runtime coupling.
110
+
111
+ ## Edges
112
+
113
+ <module-A> -> <module-B>
114
+ <module-A> -> <module-C>
115
+ <module-B> -> <module-D>
116
+ ```
117
+
118
+ If no dependency edges are found, write the header only (empty Edges section is valid).
119
+
120
+ ### Step D: Stamp each freshly written module
121
+
122
+ For each module written in Step B, run:
123
+
124
+ ```bash
125
+ codebyplan arch-map stamp <module-path>
126
+ ```
127
+
128
+ This updates `.codebyplan/architecture.json` with the current git SHA and timestamp,
129
+ and mirrors those values into the map file's YAML frontmatter.
130
+
131
+ If `--depth` should be recorded explicitly (e.g. `deep`), pass `--depth <deep|skeleton>`:
132
+
133
+ ```bash
134
+ codebyplan arch-map stamp <module-path> --depth <depth>
135
+ ```
136
+
137
+ ### Step E: Report
138
+
139
+ Print a summary:
140
+ - Modules mapped (count + list)
141
+ - INDEX.md row count
142
+ - graph.md edge count
143
+ - Any modules that were skipped or blocked (with reason)
144
+
145
+ ## Idempotency Notes
146
+
147
+ - Re-running this skill over an already-mapped module regenerates the map from scratch.
148
+ There is no "skip if fresh" logic here — use `/cbp-refresh-arch-map` (TASK-3) when
149
+ you want drift-scoped re-runs that skip fresh modules.
150
+ - `codebyplan arch-map stamp` is idempotent — stamping the same SHA twice is a no-op in
151
+ practice (the values overwrite with the same content).
152
+
153
+ ## Failure Modes
154
+
155
+ | Condition | Action |
156
+ |-----------|--------|
157
+ | `cbp-map-architecture` agent returns `blocked` for a module | Write a warning to INDEX.md row; continue with remaining modules |
158
+ | `.claude/architecture/` directory creation fails | Surface as blocked — check file-system permissions |
159
+ | `codebyplan arch-map status` not available | Surface as blocked — run `npx codebyplan arch-map status` to verify CLI is installed |
160
+
161
+ ## Integration
162
+
163
+ - **Triggered by**: user invocation (`/cbp-map-architecture [args]`)
164
+ - **Spawns**: `cbp-map-architecture` agent (one per module)
165
+ - **Calls**: `codebyplan arch-map status`, `codebyplan arch-map stamp`
166
+ - **Writes**: `.claude/architecture/<slug>.md`, `.claude/architecture/INDEX.md`, `.claude/architecture/graph.md`
167
+ - **Updates**: `.codebyplan/architecture.json` (via stamp CLI)
168
+ - **Consultation contract**: `.claude/context/architecture-map.md`
169
+ - **Artifact spec**: `.claude/context/architecture/arch-map-spec.md`
170
+ - **Related skill**: `/cbp-refresh-arch-map` — drift-scoped refresh (TASK-3)
@@ -122,10 +122,7 @@ This check is intentionally placed BEFORE Step 2's `git merge`: catching collisi
122
122
 
123
123
  1. List conflicted files and lock the count: `N=$(git diff --name-only --diff-filter=U | wc -l)`. `N` is the canonical conflict count used by Step 3.5 fallback message and Step 5 output; it stays fixed at the initial value across loop-backs.
124
124
 
125
- 2. Load cross-reference context. Via MCP, gather all active CHK/TASK file ownership:
126
- - `get_checkpoints(repo_id)` filtered to `status IN ('pending', 'active', 'in_progress')`.
127
- - For each active checkpoint, also call `get_tasks(checkpoint_id)` and collect every `task.files_changed[].path` — checkpoint-bound task file ownership lives here, NOT on the checkpoint itself.
128
- - `get_tasks(repo_id, standalone: true)` filtered to `status IN ('pending', 'in_progress')` — adds standalone-task file ownership.
125
+ 2. Load cross-reference context. Read local state files for per-task file ownership: `.codebyplan/state/checkpoints/<id>.json` (filtered to `status IN ('pending', 'active', 'in_progress')`) and `.codebyplan/state/checkpoints/<id>/tasks/*.json` (collect every `task.files_changed[].path`). On miss run `npx codebyplan sync` once and re-read. Use MCP `get_checkpoints` (active-filter multi-checkpoint scan) / `get_tasks` as documented break-glass when the state dir is absent and sync fails — the full cross-checkpoint scan requires MCP when local state is unavailable.
129
126
 
130
127
  Build a map `path -> [referencing CHK-NNN TASK-N + brief context]` by matching each conflicted path against:
131
128
  - `checkpoint.context.files_to_change[]` (checkpoint-level plan)
@@ -221,7 +218,7 @@ Return control to the caller. **This skill NEVER pushes** — the caller decides
221
218
  - `/cbp-task-complete` Step 5.5 (mandatory pre-push, after task commit)
222
219
  - `/cbp-checkpoint-end` Step 0 (mandatory pre-shipment)
223
220
  - User-invocable manually
224
- - **Reads**: `.codebyplan/git.json`, MCP `get_checkpoints`, MCP `get_tasks`, git state
221
+ - **Reads**: `.codebyplan/git.json`, local state `.codebyplan/state/checkpoints/<id>.json` + `.../tasks/<id>.json`; on miss `npx codebyplan sync` once; MCP `get_checkpoints` (active-filter multi-checkpoint scan) / MCP `get_tasks` as documented break-glass when the state dir is absent and sync fails (full cross-checkpoint scan). Git state.
225
222
  - **Writes**: git merge commit (no MCP writes; no remote push)
226
223
  - **Spawns**: none (`/cbp-git-commit` is inline-triggered at Step 0 dirty-tree handling)
227
224
  - **Network**: contacts `origin` via `git fetch`. Offline = abort.
@@ -0,0 +1,191 @@
1
+ ---
2
+ scope: org-shared
3
+ name: cbp-refresh-arch-map
4
+ description: Drift-scoped refresh of the .claude/architecture/ map — re-runs the cbp-map-architecture agent for ONLY the modules whose stamped git SHA has changed, regenerates INDEX.md + graph.md, and re-stamps. Idempotent; no-op when no module has drifted.
5
+ argument-hint: '[--module <path>]'
6
+ allowed-tools: Read, Write, Edit, Glob, Grep, Bash, Task
7
+ ---
8
+
9
+ # Refresh Architecture Map (drift-scoped)
10
+
11
+ Re-generate ONLY the architecture maps that have gone stale. A module is **stale**
12
+ when its source has been committed past the git SHA recorded in
13
+ `.codebyplan/architecture.json` — exactly what `codebyplan arch-map drift` reports.
14
+
15
+ Distinct from `/cbp-map-architecture` (which maps **all** target modules
16
+ unconditionally, or a named subset). This skill is the cheap incremental path: it
17
+ touches nothing that is already fresh, preserving each stale module's existing
18
+ depth (`skeleton` / `deep`) from the manifest.
19
+
20
+ This is the freshness loop the session-start drift nudge points at — when a session
21
+ starts and N modules are stale, you run this to bring the maps current in one pass.
22
+
23
+ ## Arguments
24
+
25
+ `$ARGUMENTS` accepts:
26
+
27
+ | Flag | Description |
28
+ |------|-------------|
29
+ | `--module <path>` | Refresh a single module even if drift does not flag it (force re-run). When omitted, the drifted set from `codebyplan arch-map drift` is the target list. |
30
+
31
+ ## Instructions
32
+
33
+ ### Step A: Compute the stale set
34
+
35
+ 1. Run `codebyplan arch-map drift` (Bash) and capture the output. Each drifted module
36
+ is printed on a `DRIFTED <path>` line (the CLI is hook-safe — it exits 0 and prints
37
+ `All stamped modules are fresh.` when nothing has drifted).
38
+ 2. Read `.codebyplan/architecture.json` (Read) to recover each module's stored `depth`
39
+ and `map_file`. The manifest is the source of truth for depth — a drift refresh MUST
40
+ preserve the depth the module was originally mapped at, never silently downgrade a
41
+ `deep` map to `skeleton`.
42
+ 3. Build the target list:
43
+ - Default: every `DRIFTED <path>` module from Step A.1.
44
+ - `--module <path>` given: just that one module (look up its depth in the manifest;
45
+ default `skeleton` if it has no manifest entry yet).
46
+
47
+ ```yaml
48
+ targets:
49
+ - path: string # module path relative to repo root
50
+ depth: skeleton|deep # preserved from architecture.json
51
+ map_file: string # .claude/architecture/<slug>.md from the manifest
52
+ ```
53
+
54
+ ### Step B: No-op short-circuit
55
+
56
+ If the target list is empty (drift reported `All stamped modules are fresh.` and no
57
+ `--module` override was given), print and STOP:
58
+
59
+ ```
60
+ ✓ All architecture maps are fresh — nothing to refresh.
61
+ ```
62
+
63
+ Do NOT spawn agents, regenerate INDEX/graph, or re-stamp. An empty drift set is a
64
+ legitimate success state, not an error.
65
+
66
+ ### Step C: Re-run the agent for each stale module
67
+
68
+ For each module in `targets[]`:
69
+
70
+ 1. Spawn the `cbp-map-architecture` agent (via Task tool) with input:
71
+ ```yaml
72
+ module_path: <path>
73
+ depth: <preserved depth from the manifest>
74
+ ```
75
+ 2. Receive the agent's returned map content (a full `.claude/architecture/<slug>.md`
76
+ text block, opening with `---` YAML frontmatter).
77
+ 3. Write the content to the module's `map_file` path using the Write tool (overwrites
78
+ the stale map). The agent returns `generated_from_sha: null` / `generated_at: null`
79
+ in the frontmatter — Step E's `stamp` fills those in.
80
+
81
+ Stale modules are independent and read-only to analyze, so spawn them concurrently
82
+ (parallel Task calls) when there is more than one.
83
+
84
+ If the agent returns `blocked` for a module (e.g. the module path no longer exists),
85
+ skip it, record the reason for Step F, and continue with the rest.
86
+
87
+ ### Step D: Regenerate INDEX.md and graph.md (wholesale)
88
+
89
+ INDEX.md and graph.md are derived from the FULL set of map files, so regenerate both
90
+ from scratch after the stale maps are rewritten — unaffected rows/edges are reproduced
91
+ unchanged because their source map files did not move.
92
+
93
+ **INDEX.md** — rebuild `.claude/architecture/INDEX.md`:
94
+
95
+ 1. Read all `.claude/architecture/*.md` files (excluding INDEX.md and graph.md).
96
+ 2. Parse each file's frontmatter: `module`, `depth`, `generated_from_sha`, `generated_at`.
97
+ Note: freshly-rewritten maps still carry `null` SHA/date here — that is corrected by
98
+ Step E (stamp), so regenerate INDEX.md AFTER stamping, or re-read post-stamp.
99
+ 3. Short SHA = first 8 chars of `generated_from_sha`, or `unset` if null. Date =
100
+ `YYYY-MM-DD` of `generated_at`, or `unset` if null.
101
+ 4. Write the canonical header + one row per module (format in
102
+ `context/architecture/arch-map-spec.md`):
103
+
104
+ ```markdown
105
+ # Architecture Map Index
106
+
107
+ Grep-friendly registry of per-module architecture maps. Layout convention in `context/architecture/arch-map-spec.md`.
108
+
109
+ | Module | Depth | SHA | Generated | Map File |
110
+ |--------|-------|-----|-----------|----------|
111
+ | <module> | <depth> | <sha_short> | <date> | <map_file> |
112
+ ```
113
+
114
+ **graph.md** — rebuild `.claude/architecture/graph.md`:
115
+
116
+ 1. For each map file, read its `## 4. Dependencies (In / Out)` section.
117
+ 2. Each "Consumes" entry becomes a directed edge `<from> -> <to>`.
118
+ 3. Deduplicate edges by the exact `"<from> -> <to>"` string — each unique edge once.
119
+ 4. Write the canonical format (header only is valid when there are no edges):
120
+
121
+ ```markdown
122
+ # Architecture Dependency Graph
123
+
124
+ Adjacency list of cross-module edges. Each entry: `<from> -> <to>`.
125
+ Generated from the `Dependencies (In / Out)` sections of individual map files
126
+ (first-party `@codebyplan/*` workspace imports, verified against each module's `package.json`).
127
+
128
+ Scope: edges are TypeScript workspace package imports only. Runtime/service dependencies
129
+ (shared schema directories, HTTP calls between apps) are documented per-map in
130
+ `## 4. Dependencies (In / Out)` and are intentionally NOT graphed here — a module with
131
+ no edge is not necessarily isolated; consult its map file for runtime coupling.
132
+
133
+ ## Edges
134
+
135
+ <module-A> -> <module-B>
136
+ <module-A> -> <module-C>
137
+ <module-B> -> <module-D>
138
+ ```
139
+
140
+ ### Step E: Re-stamp each refreshed module
141
+
142
+ For each successfully rewritten module, run:
143
+
144
+ ```bash
145
+ codebyplan arch-map stamp <module-path> --depth <preserved-depth>
146
+ ```
147
+
148
+ This records the current git SHA + timestamp in `.codebyplan/architecture.json` and
149
+ mirrors them into the map file's frontmatter, clearing the drift. Pass `--depth` so a
150
+ `deep` map is never re-recorded as `skeleton`.
151
+
152
+ After stamping, regenerate INDEX.md once more (or re-read the now-stamped frontmatter)
153
+ so its SHA/date columns reflect the fresh stamps rather than the transient `null` state.
154
+
155
+ ### Step F: Report
156
+
157
+ Print a summary:
158
+ - Modules refreshed (count + list, with depth)
159
+ - Modules skipped/blocked (with reason), if any
160
+ - INDEX.md row count, graph.md edge count
161
+ - A final `codebyplan arch-map drift` run confirming zero remaining drift
162
+
163
+ ## Idempotency Notes
164
+
165
+ - Running this skill twice in a row is safe: the second run finds zero drift and
166
+ short-circuits at Step B.
167
+ - `codebyplan arch-map stamp` is idempotent — re-stamping the same SHA overwrites with
168
+ identical values.
169
+ - This skill never touches fresh modules — that is the entire point of the drift gate.
170
+ Use `/cbp-map-architecture` when you want to regenerate everything regardless of drift.
171
+
172
+ ## Failure Modes
173
+
174
+ | Condition | Action |
175
+ |-----------|--------|
176
+ | `codebyplan arch-map drift` reports `No stamped modules found` | No maps exist yet — direct the user to `/cbp-map-architecture` to generate the initial maps, then STOP |
177
+ | `cbp-map-architecture` agent returns `blocked` for a module | Skip it, record the reason in the Step F report, continue with the rest |
178
+ | `.codebyplan/architecture.json` missing or unparseable | Surface as blocked — the manifest is required to recover per-module depth; run `/cbp-map-architecture` first |
179
+ | `codebyplan arch-map` CLI not available | Surface as blocked — run `npx codebyplan arch-map status` to verify the CLI is installed |
180
+
181
+ ## Integration
182
+
183
+ - **Triggered by**: user invocation (`/cbp-refresh-arch-map [--module <path>]`); nudged by the `/cbp-session-start` Step 1.55 architecture-map drift line
184
+ - **Spawns**: `cbp-map-architecture` agent (one per stale module)
185
+ - **Calls**: `codebyplan arch-map drift`, `codebyplan arch-map stamp`
186
+ - **Reads**: `.codebyplan/architecture.json` (per-module depth + map_file)
187
+ - **Writes**: `.claude/architecture/<slug>.md` (stale modules only), `.claude/architecture/INDEX.md`, `.claude/architecture/graph.md`
188
+ - **Updates**: `.codebyplan/architecture.json` (via stamp CLI)
189
+ - **Consultation contract**: `.claude/context/architecture-map.md`
190
+ - **Artifact spec**: `.claude/context/architecture/arch-map-spec.md`
191
+ - **Related skill**: `/cbp-map-architecture` — full (non-drift) generation
@@ -15,14 +15,14 @@ Inspect the resolved identifier from argument parsing to determine the task kind
15
15
  |-----------------|------|
16
16
  | `{task}-{round}` (2-segment, e.g. `45-2`) | `standalone` |
17
17
  | `{chk}-{task}-{round}` (3-segment, e.g. `141-3-1`) | `checkpoint` |
18
- | _(empty / free-text)_ | Check `get_current_standalone_task` first; if found → `standalone`. Else → `checkpoint` via `get_current_task`. |
18
+ | _(empty / free-text)_ | Check `get_current_standalone_task` first; if found → `standalone`. Else → `checkpoint` via `get_current_task`. (Kind-detection is MCP-unavoidable — no identifier yet means no local path to probe; subsequent operations are local-first per the rows below.) |
19
19
 
20
20
  Set `KIND` for the rest of this skill. MCP tool names vary by KIND:
21
21
 
22
22
  | Operation | `checkpoint` KIND | `standalone` KIND |
23
23
  |-----------|------------------|-------------------|
24
- | Get task | `get_current_task(repo_id)` | `get_current_standalone_task(repo_id)` |
25
- | Get rounds | `get_rounds(task_id)` | `get_standalone_rounds(standalone_task_id)` |
24
+ | Get task | local state (break-glass: `get_current_task`) | `get_current_standalone_task(repo_id)` |
25
+ | Get rounds | local state (break-glass: `get_rounds`) | `get_standalone_rounds(standalone_task_id)` |
26
26
  | Add round | `add_round(task_id, ...)` | `add_standalone_round(standalone_task_id, ...)` |
27
27
  | Update round | `update_round(round_id, ...)` | `update_standalone_round(standalone_round_id, ...)` |
28
28
  | Complete round | `complete_round(round_id, duration_minutes?)` | `complete_standalone_round(standalone_round_id, duration_minutes?, caller_worktree_id)` ⚠️ `caller_worktree_id` is REQUIRED for standalone |
@@ -38,8 +38,8 @@ Run automated checks independently with mandatory execution. Updates round QA. H
38
38
 
39
39
  Use Kind Detection above to set KIND. Then:
40
40
 
41
- - **checkpoint KIND**: MCP `get_current_task(repo_id)` to find active task, then `get_rounds(task_id)` to find the in-progress round.
42
- - **standalone KIND**: MCP `get_current_standalone_task(repo_id)` to find active task, then `get_standalone_rounds(standalone_task_id)` to find the in-progress round.
41
+ - **checkpoint KIND**: Read `.codebyplan/state/checkpoints/<checkpointId>/tasks/<taskId>.json` (local-first) to find active task, then read `.codebyplan/state/checkpoints/<checkpointId>/tasks/<taskId>/rounds/<roundId>.json` to find the in-progress round. If missing/stale, run `npx codebyplan sync` once and re-read. Break-glass fallback: MCP `get_current_task(repo_id)` + `get_rounds(task_id)` when state dir is absent and sync fails.
42
+ - **standalone KIND**: MCP `get_current_standalone_task(repo_id)` to find active task, then `get_standalone_rounds(standalone_task_id)` to find the in-progress round. (Standalone KIND still uses MCP until a later task.)
43
43
 
44
44
  ### Step 2: Determine Project Root
45
45
 
@@ -83,7 +83,9 @@ Scan all captured output for:
83
83
 
84
84
  ### Step 6: Save QA Results
85
85
 
86
- Update round QA via MCP `update_round(round_id, qa: ...)` (checkpoint KIND) or `update_standalone_round(standalone_round_id, qa: ...)` (standalone KIND):
86
+ Update round QA:
87
+ - **checkpoint KIND**: `codebyplan round update --id <round_id> --task-id <task_id> --checkpoint-id <checkpoint_id> --qa '<json>'` (CLI write-through: local state file + REST). Break-glass fallback: MCP `update_round(round_id, qa: ...)` when the CLI is unavailable.
88
+ - **standalone KIND**: MCP `update_standalone_round(standalone_round_id, qa: ...)`. (Standalone KIND still uses MCP until a later task.)
87
89
 
88
90
  ```json
89
91
  {
@@ -123,6 +125,8 @@ If soft failures only: `Run /cbp-round-start to trigger auto-fix, or fix manuall
123
125
 
124
126
  ## Integration
125
127
 
126
- - **Reads**: MCP `get_current_task` / `get_current_standalone_task`, `get_rounds` / `get_standalone_rounds` (per KIND)
127
- - **Writes**: MCP `update_round` / `update_standalone_round` (qa field) per KIND
128
+ - **Reads (checkpoint KIND)**: `.codebyplan/state/checkpoints/<id>.json`, `checkpoints/<id>/tasks/<id>.json`, `checkpoints/<id>/tasks/<id>/rounds/<id>.json` (local-first; run `npx codebyplan sync` if missing; break-glass: MCP `get_current_task` / `get_rounds`)
129
+ - **Reads (standalone KIND)**: MCP `get_current_standalone_task` / `get_standalone_rounds` (standalone KIND still uses MCP until a later task)
130
+ - **Writes (checkpoint KIND)**: `codebyplan round update` (qa field). Break-glass: MCP `update_round`.
131
+ - **Writes (standalone KIND)**: MCP `update_standalone_round` (qa field). (Standalone KIND still uses MCP until a later task.)
128
132
  - **Standalone**: Can be run independently at any time
@@ -15,14 +15,14 @@ Inspect the resolved identifier from argument parsing to determine the task kind
15
15
  |-----------------|------|
16
16
  | `{task}-{round}` (2-segment, e.g. `45-2`) | `standalone` |
17
17
  | `{chk}-{task}-{round}` (3-segment, e.g. `141-3-1`) | `checkpoint` |
18
- | _(empty / free-text)_ | Check `get_current_standalone_task` first; if found → `standalone`. Else → `checkpoint` via `get_current_task`. |
18
+ | _(empty / free-text)_ | Check `get_current_standalone_task` first; if found → `standalone`. Else → `checkpoint` via `get_current_task`. (Kind-detection is MCP-unavoidable — no identifier yet means no local path to probe; subsequent operations are local-first per the rows below.) |
19
19
 
20
20
  Set `KIND` for the rest of this skill. MCP tool names vary by KIND:
21
21
 
22
22
  | Operation | `checkpoint` KIND | `standalone` KIND |
23
23
  |-----------|------------------|-------------------|
24
- | Get task | `get_current_task(repo_id)` | `get_current_standalone_task(repo_id)` |
25
- | Get rounds | `get_rounds(task_id)` | `get_standalone_rounds(standalone_task_id)` |
24
+ | Get task | local state (break-glass: `get_current_task`) | `get_current_standalone_task(repo_id)` |
25
+ | Get rounds | local state (break-glass: `get_rounds`) | `get_standalone_rounds(standalone_task_id)` |
26
26
  | Update round | `update_round(round_id, ...)` | `update_standalone_round(standalone_round_id, ...)` |
27
27
  | Complete round | `complete_round(round_id, duration_minutes?)` | `complete_standalone_round(standalone_round_id, duration_minutes?, caller_worktree_id)` ⚠️ `caller_worktree_id` is REQUIRED for standalone |
28
28
 
@@ -69,9 +69,9 @@ Given the parse from Step 1:
69
69
 
70
70
  | Parse | Resolution path |
71
71
  |-------|-----------------|
72
- | `{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}`. |
73
- | `{task}-{round}` | MCP `get_standalone_rounds` via `get_current_standalone_task` or direct task lookup → filter `number === {round}`. |
74
- | _(empty)_ | Use Kind Detection: checkpoint KIND → MCP `get_current_task(repo_id)` + `get_rounds(task_id)`; standalone KIND → MCP `get_current_standalone_task(repo_id)` + `get_standalone_rounds(standalone_task_id)`. |
72
+ | `{chk}-{task}-{round}` | **checkpoint KIND** — Read `.codebyplan/state/checkpoints/<checkpointId>.json` (local-first). If missing/stale, run `npx codebyplan sync` once and re-read. Break-glass fallback: MCP `get_checkpoints(repo_id)` → `get_tasks` `get_rounds` when state dir is absent and sync fails. Filter by `number` fields to match `{chk}`, `{task}`, `{round}`. |
73
+ | `{task}-{round}` | **standalone KIND** — MCP `get_standalone_rounds` via `get_current_standalone_task` or direct task lookup → filter `number === {round}`. (Standalone KIND still uses MCP until a later task.) |
74
+ | _(empty)_ | Use Kind Detection: **checkpoint KIND**Read `.codebyplan/state/` local files for active task + latest round (break-glass: MCP `get_current_task(repo_id)` + `get_rounds(task_id)`); **standalone KIND** → MCP `get_current_standalone_task(repo_id)` + `get_standalone_rounds(standalone_task_id)`. |
75
75
 
76
76
  If no task found: `No active task. Nothing to complete.`
77
77
 
@@ -108,7 +108,7 @@ This is the **single** explicit reconcile owned by this skill. (The `cbp-mcp-rou
108
108
 
109
109
  Calculate duration from the round's `started_at` to now in minutes.
110
110
 
111
- - **checkpoint KIND**: MCP `complete_round(round_id, duration_minutes)`.
111
+ - **checkpoint KIND**: `codebyplan round complete --id <round_id> --task-id <task_id> --checkpoint-id <checkpoint_id>` (CLI write-through: local state file + REST). Break-glass fallback: MCP `complete_round(round_id, duration_minutes)` when the CLI is unavailable. Note: the CLI does not accept `duration_minutes`; the backend computes duration server-side.
112
112
  - **standalone KIND**: MCP `complete_standalone_round(standalone_round_id, duration_minutes, caller_worktree_id)`. ⚠️ `caller_worktree_id` is REQUIRED — resolve via `CALLER_WT=$(npx codebyplan resolve-worktree 2>/dev/null)`. If `CALLER_WT` is empty, surface this warning and ask the user to confirm before proceeding:
113
113
 
114
114
  ```
@@ -145,7 +145,11 @@ Calculate duration from the round's `started_at` to now in minutes.
145
145
  another round.
146
146
  ```
147
147
 
148
- Persist a breadcrumb on the round via `update_round` / `update_standalone_round` per KIND: `round.context.round_complete = { staged_count, unstaged_count, route, decided_at }`.
148
+ Persist a breadcrumb on the round:
149
+ - **checkpoint KIND**: `codebyplan round update --id <round_id> --task-id <task_id> --checkpoint-id <checkpoint_id> --context '<json>'` (CLI write-through). Break-glass fallback: MCP `update_round(round_id, ...)` when the CLI is unavailable.
150
+ - **standalone KIND**: MCP `update_standalone_round(standalone_round_id, ...)` (standalone KIND still uses MCP until a later task).
151
+
152
+ Payload: `round.context.round_complete = { staged_count, unstaged_count, route, decided_at }`.
149
153
 
150
154
  ## Key Rules
151
155
 
@@ -159,6 +163,8 @@ Persist a breadcrumb on the round via `update_round` / `update_standalone_round`
159
163
 
160
164
  - **Gates**: `ask`-tier `Skill(cbp-round-complete)` permission prompt — the harness confirms before the skill runs; a decline makes NO writes. There is no in-skill AskUserQuestion.
161
165
  - **Triggered by**: `/cbp-round-update` (auto, clean triage), or user manually
162
- - **Reads**: MCP `get_current_task` / `get_current_standalone_task`, `get_rounds` / `get_standalone_rounds` (per KIND); delegates git+approval sync to `npx codebyplan round sync-approvals`
163
- - **Writes**: MCP `complete_round` / `complete_standalone_round` (per KIND); `update_round` / `update_standalone_round` (`round_complete` breadcrumb); round+task `files_changed` written by the CLI
166
+ - **Reads (checkpoint KIND)**: `.codebyplan/state/checkpoints/<id>.json`, `.codebyplan/state/checkpoints/<id>/tasks/<id>.json`, `.codebyplan/state/checkpoints/<id>/tasks/<id>/rounds/<id>.json` (local-first; run `npx codebyplan sync` if missing; break-glass: MCP `get_current_task` / `get_rounds`). Delegates git+approval sync to `npx codebyplan round sync-approvals`.
167
+ - **Reads (standalone KIND)**: MCP `get_current_standalone_task` / `get_standalone_rounds` (standalone KIND still uses MCP until a later task).
168
+ - **Writes (checkpoint KIND)**: `codebyplan round complete` (Step 3); `codebyplan round update` (Step 4 breadcrumb). Break-glass: MCP `complete_round` / `update_round`. Round+task `files_changed` written by the CLI sync-approvals.
169
+ - **Writes (standalone KIND)**: MCP `complete_standalone_round` / `update_standalone_round` (standalone KIND still uses MCP until a later task).
164
170
  - **Triggers**: `/cbp-task-check` (checkpoint KIND, all files approved), `/cbp-standalone-task-check` (standalone KIND, all files approved), `/cbp-round-input` (some files unapproved — fires independent of staging count)
@@ -27,8 +27,9 @@ This skill operates on the **active** task/round resolved via MCP `get_current_t
27
27
 
28
28
  ### Step 1: Get Current Task and Round
29
29
 
30
- Use MCP `get_current_task` with repo_id (pass `checkpoint_id` if known to avoid disambiguation) to find the active task.
31
- Use MCP `get_rounds` for the task to find the in-progress round.
30
+ Read `.codebyplan/state/checkpoints/<checkpointId>/tasks/<taskId>.json` (local-first) to find the active task. If missing/stale, run `npx codebyplan sync` once and re-read. Break-glass fallback: MCP `get_current_task` when the state dir is absent and sync fails (daemon-dead + CLI-unavailable).
31
+
32
+ Read `.codebyplan/state/checkpoints/<checkpointId>/tasks/<taskId>/rounds/<roundId>.json` (local-first) to find the in-progress round. Same sync / break-glass pattern (MCP `get_rounds` as fallback).
32
33
 
33
34
  Load round context with all outputs (executor_output, testing_qa_output, reviewer_output).
34
35
 
@@ -70,11 +71,9 @@ Merge with previous rounds (supersede items for re-modified files, preserve veri
70
71
 
71
72
  ### Step 4: Update Task Files and QA
72
73
 
73
- Update via MCP:
74
-
75
- - `update_task(task_id, files_changed: [...])` merge with existing
76
- - `update_round(round_id, files_changed: [...], qa: {items: [auto_qa items + default_checklist items]})` — round-specific
77
- - `update_task(task_id, qa: {items: [auto_qa items + default_checklist items]})` — aggregated
74
+ - **Round files + QA**: `codebyplan round update --id <round-id> --task-id <uuid> --checkpoint-id <uuid> --files-changed <json> --qa <json>` (CLI write-through: local state at `.codebyplan/state/checkpoints/<checkpointId>/tasks/<taskId>/rounds/<roundId>.json` + REST). Break-glass fallback: MCP `update_round` when the CLI is unavailable.
75
+ - **Task files_changed merge**: `codebyplan task update --id <task-id> --checkpoint-id <uuid> --files-changed <json>` (CLI write-through: local state at `.codebyplan/state/checkpoints/<checkpointId>/tasks/<taskId>.json` + REST). Break-glass fallback: MCP `update_task` when the CLI is unavailable.
76
+ - **Task QA aggregated**: `codebyplan task update --id <task-id> --checkpoint-id <uuid> --qa <json>` (same CLI write-through). Break-glass: MCP `update_task`.
78
77
 
79
78
  ### Step 5: Present Summary
80
79
 
@@ -149,7 +148,7 @@ Example tables and the in-scope/out-of-scope classification: see `reference/find
149
148
  Step 7 already auto-applied in-scope findings and logged them to `round.context.inline_fix_log`. Now record any out-of-scope findings and route:
150
149
 
151
150
  1. **Polish-spiral stop-gate** (round 2+ only): if this is round 2 or later AND the prior round also ended with code-review fixes, surface a one-line stop-gate via AskUserQuestion — *defer remaining polish to a follow-up task* vs *continue with another round*. This is a genuine user decision about scope (it guards against endless low-value polish loops), not a flow-control prompt. Skip on round 1.
152
- 2. Save out-of-scope findings (those NOT auto-applied in Step 7) to round context via MCP `update_round`:
151
+ 2. Save out-of-scope findings (those NOT auto-applied in Step 7) to round context via `codebyplan round update --id <round-id> --task-id <uuid> --checkpoint-id <uuid> --context <json>` (break-glass: MCP `update_round`):
153
152
  ```json
154
153
  {
155
154
  "context": {
@@ -169,7 +168,7 @@ Step 7 already auto-applied in-scope findings and logged them to `round.context.
169
168
  ## Integration
170
169
 
171
170
  - **Triggered by**: `/cbp-round-execute` (auto, after all waves + testing complete)
172
- - **Reads**: MCP `get_current_task`, `get_rounds`, round context
173
- - **Writes**: MCP `update_round`, `update_task` (files_changed, qa, findings)
171
+ - **Reads**: `.codebyplan/state/checkpoints/<id>/tasks/<id>.json`, `checkpoints/<id>/tasks/<id>/rounds/<id>.json` (local-first; `npx codebyplan sync` on miss; MCP `get_current_task` / `get_rounds` as break-glass)
172
+ - **Writes**: `codebyplan round update` (Step 4 round files/QA, Step 8 findings; break-glass: MCP `update_round`), `codebyplan task update` (Step 4 files_changed + QA aggregated; break-glass: MCP `update_task`)
174
173
  - **Spawns**: `cbp-improve-round` (code quality review)
175
174
  - **Triggers**: `/cbp-round-update` (auto, after findings handled)
@@ -27,8 +27,9 @@ This skill operates on the **active** task/round resolved via MCP `get_current_t
27
27
 
28
28
  ### Step 1: Get Current Task and Round
29
29
 
30
- Use MCP `get_current_task` with repo_id (pass checkpoint_id if known) to find the active task.
31
- Use MCP `get_rounds` for the task to find the in-progress round.
30
+ Read `.codebyplan/state/checkpoints/<checkpointId>/tasks/<taskId>.json` (local-first) to find the active task. If missing/stale, run `npx codebyplan sync` once and re-read. Break-glass fallback: MCP `get_current_task` when the state dir is absent and sync fails (daemon-dead + CLI-unavailable).
31
+
32
+ Read `.codebyplan/state/checkpoints/<checkpointId>/tasks/<taskId>/rounds/<roundId>.json` (local-first) to find the in-progress round. Same sync / break-glass pattern (MCP `get_rounds` as fallback).
32
33
 
33
34
  If no in-progress round: `No active round. Run /cbp-round-start first.`
34
35
 
@@ -182,7 +183,7 @@ Per-wave hard-fail signal — true when ANY hold:
182
183
  **All waves hard_fail: false** → proceed to Step 7. **Any wave hard_fail: true**:
183
184
 
184
185
  - **Simple fixes** (type errors, lint, missing imports, test assertion fixes, e2e `real`-category with clear code-side root cause, no prior re-trigger this round) → save failure details to round context; retrigger the failing wave's executor; re-run testing-qa AND the eligible `cbp-e2e-*` specialists for that wave.
185
- - **Structural OR already re-triggered once OR e2e preflight aborts OR `e2e_eligible_skipped`** → save failure context via MCP `update_round`; auto-trigger `/cbp-round-input`. STOP.
186
+ - **Structural OR already re-triggered once OR e2e preflight aborts OR `e2e_eligible_skipped`** → save failure context via `codebyplan round update` (break-glass: MCP `update_round`); auto-trigger `/cbp-round-input`. STOP.
186
187
 
187
188
  ## Inline execution fallback
188
189
 
@@ -194,7 +195,7 @@ When `cbp-testing-qa-agent` spawn fails OR the resolved `testing_profile` is `cl
194
195
 
195
196
  ### Step 7: Save Executor Output
196
197
 
197
- Update round context via MCP `update_round`:
198
+ `codebyplan round update --id <round-id> --task-id <uuid> --checkpoint-id <uuid> --context <json>` (CLI write-through: local state at `.codebyplan/state/checkpoints/<checkpointId>/tasks/<taskId>/rounds/<roundId>.json` + REST). Break-glass fallback: MCP `update_round` when the CLI is unavailable.
198
199
 
199
200
  - `context`: { ...existing, executor_output, testing_qa_output, e2e_eligible, e2e_outputs, frontend_ui_review }
200
201
 
@@ -220,8 +221,8 @@ Trigger `/cbp-round-end`.
220
221
 
221
222
  ## Integration
222
223
 
223
- - **Reads**: MCP `get_current_task`, `get_rounds`
224
- - **Writes**: MCP `update_round` (context with executor_output + testing_qa_output + e2e_eligible + e2e_outputs + frontend_ui_review)
224
+ - **Reads**: `.codebyplan/state/checkpoints/<id>/tasks/<id>.json`, `checkpoints/<id>/tasks/<id>/rounds/<id>.json` (local-first; `npx codebyplan sync` on miss; MCP `get_current_task` / `get_rounds` as break-glass)
225
+ - **Writes**: `codebyplan round update --id <uuid> --task-id <uuid> --checkpoint-id <uuid>` (Steps 6+7 — context with executor_output + testing_qa_output + e2e_eligible + e2e_outputs + frontend_ui_review; break-glass: MCP `update_round`)
225
226
  - **Spawns**: `cbp-round-executor` (per wave or single), `cbp-testing-qa-agent` (per wave, parallel sibling of the `cbp-e2e-*` specialists), the `cbp-e2e-*` specialists (config-driven dispatch per `context/testing/e2e.md`, one per eligible framework in `.codebyplan/e2e.json`), `cbp-database-agent` (if DB work), `cbp-security-agent` (if security review needed)
226
227
  - **Skill invocations**: `cbp-frontend-ui` at Step 5b with `phase: 'screenshot_review'` (post-e2e)
227
228
  - **Triggers**: `/cbp-round-end` (auto)