@jeiemgi/cckit 0.9.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (305) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/AGENTS.md +169 -21
  3. package/README.md +491 -35
  4. package/SECURITY.md +5 -0
  5. package/bin/cckit +182 -17
  6. package/cckit.config.json +1 -1
  7. package/commands/kit-doctor.md +13 -5
  8. package/commands/kit-export-project.md +0 -2
  9. package/commands/kit-export-training.md +6 -9
  10. package/commands/kit-init.md +43 -13
  11. package/commands/kit-routines.md +1 -1
  12. package/commands/kit-update.md +11 -6
  13. package/databases/supabase/guide.html +106 -0
  14. package/databases/supabase/nextjs/lib/supabase/client.ts +9 -0
  15. package/databases/supabase/nextjs/lib/supabase/server.ts +29 -0
  16. package/databases/supabase.json +70 -0
  17. package/integrations/emil-design-eng.json +41 -0
  18. package/integrations/graft.json +81 -0
  19. package/integrations/impeccable.json +42 -0
  20. package/integrations/integration.schema.json +215 -0
  21. package/integrations/lavish.json +43 -0
  22. package/integrations/mempalace.json +28 -0
  23. package/integrations/mlx-lm.json +32 -0
  24. package/integrations/web-design-guidelines.json +42 -0
  25. package/kit.config.schema.json +183 -5
  26. package/package.json +4 -1
  27. package/profiles/automation.json +7 -1
  28. package/profiles/content.json +10 -2
  29. package/profiles/marketing.json +57 -0
  30. package/profiles/minimal.json +7 -1
  31. package/profiles/research.json +7 -1
  32. package/profiles/software.json +7 -1
  33. package/recipes/nextjs-shadcn.json +49 -0
  34. package/scripts/agent-skills-external.txt +45 -0
  35. package/scripts/agent-skills-lint-test.sh +131 -0
  36. package/scripts/agent-skills-lint.sh +115 -0
  37. package/scripts/agent-template-lint-test.sh +42 -0
  38. package/scripts/agent-template-lint.sh +58 -0
  39. package/scripts/annotate-setup.sh +1 -1
  40. package/scripts/autopilot-run-test.sh +338 -0
  41. package/scripts/autopilot-run.sh +448 -0
  42. package/scripts/autopilot-test.sh +8 -0
  43. package/scripts/autopilot.sh +10 -1
  44. package/scripts/benchmark/benchmark-test.sh +85 -0
  45. package/scripts/benchmark/checkpoint-test.sh +314 -0
  46. package/scripts/benchmark/checkpoint.sh +408 -0
  47. package/scripts/benchmark/lib/model.sh +31 -6
  48. package/scripts/benchmark/report.sh +17 -2
  49. package/scripts/benchmark/run-quality.sh +36 -10
  50. package/scripts/benchmark/verb-timings-test.sh +124 -0
  51. package/scripts/benchmark/verb-timings.sh +149 -0
  52. package/scripts/check.sh +29 -19
  53. package/scripts/content-skills-test.sh +144 -0
  54. package/scripts/copilot-loop-test.sh +25 -0
  55. package/scripts/database-supabase-test.sh +121 -0
  56. package/scripts/docs-marketing-words-test.sh +73 -0
  57. package/scripts/docs-record-tables-test.sh +72 -0
  58. package/scripts/hook-adapter-test.sh +193 -0
  59. package/scripts/init-content-test.sh +225 -0
  60. package/scripts/init-guided-test.sh +474 -0
  61. package/scripts/init-recipes-test.sh +104 -0
  62. package/scripts/init-upgrade-test.sh +341 -2
  63. package/scripts/init.sh +746 -95
  64. package/scripts/instruction-budget-baseline.txt +8 -0
  65. package/scripts/instruction-budget-lint-test.sh +166 -0
  66. package/scripts/instruction-budget-lint.sh +219 -0
  67. package/scripts/integrations-check-test.sh +200 -0
  68. package/scripts/integrations-check.sh +157 -0
  69. package/scripts/kit-add-test.sh +214 -0
  70. package/scripts/kit-add.sh +305 -5
  71. package/scripts/kit-adopt-test.sh +16 -0
  72. package/scripts/kit-adopt.sh +3 -2
  73. package/scripts/kit-digest.sh +2 -2
  74. package/scripts/kit-doctor-test.sh +293 -0
  75. package/scripts/kit-doctor.sh +272 -140
  76. package/scripts/kit-export-project-test.sh +3 -3
  77. package/scripts/kit-remove-test.sh +19 -0
  78. package/scripts/kit-routines.sh +2 -2
  79. package/scripts/kit-self-update.sh +1 -1
  80. package/scripts/kit-version-check-test.sh +4 -0
  81. package/scripts/kit-version-check.sh +4 -2
  82. package/scripts/knowledge-lint.sh +4 -4
  83. package/scripts/leak-fence-test.sh +89 -0
  84. package/scripts/lib/adapter-select-test.sh +136 -0
  85. package/scripts/lib/adapter-select.sh +158 -0
  86. package/scripts/lib/agent-def-test.sh +69 -0
  87. package/scripts/lib/agent-def.sh +106 -0
  88. package/scripts/lib/agent-launch-test.sh +212 -0
  89. package/scripts/lib/agent-launch.sh +335 -0
  90. package/scripts/lib/board-view-test.sh +11 -0
  91. package/scripts/lib/board-view.sh +42 -26
  92. package/scripts/lib/branch-owner-test.sh +26 -0
  93. package/scripts/lib/branch-owner.sh +16 -9
  94. package/scripts/lib/captain-test.sh +105 -0
  95. package/scripts/lib/captain.sh +87 -8
  96. package/scripts/lib/codex-hooks-test.sh +100 -0
  97. package/scripts/lib/codex-hooks.sh +69 -0
  98. package/scripts/lib/commitlint.sh +1 -1
  99. package/scripts/lib/content-kinds-gc-test.sh +88 -0
  100. package/scripts/lib/copilot-test.sh +70 -4
  101. package/scripts/lib/copilot.sh +66 -14
  102. package/scripts/lib/effort-dispatch-test.sh +3 -3
  103. package/scripts/lib/effort-metrics-test.sh +178 -1
  104. package/scripts/lib/effort-metrics.sh +175 -35
  105. package/scripts/lib/effort-ops-test.sh +205 -7
  106. package/scripts/lib/effort-ops.sh +198 -43
  107. package/scripts/lib/effort-parity-test.sh +49 -13
  108. package/scripts/lib/effort-plan-test.sh +337 -0
  109. package/scripts/lib/effort-plan.sh +200 -23
  110. package/scripts/lib/effort.sh +56 -11
  111. package/scripts/lib/errors-header-test.sh +1 -1
  112. package/scripts/lib/gh-project-test.sh +35 -1
  113. package/scripts/lib/gh-project.sh +23 -16
  114. package/scripts/lib/gh-rest-test.sh +32 -3
  115. package/scripts/lib/gh-rest.sh +17 -2
  116. package/scripts/lib/hook-refresh.sh +1 -1
  117. package/scripts/lib/init-github.sh +412 -0
  118. package/scripts/lib/init-guide.sh +630 -0
  119. package/scripts/lib/integration-install-test.sh +343 -0
  120. package/scripts/lib/integration-install.sh +257 -0
  121. package/scripts/lib/integrations-test.sh +366 -0
  122. package/scripts/lib/integrations.sh +244 -0
  123. package/scripts/lib/kinds-test.sh +125 -0
  124. package/scripts/lib/kinds.sh +66 -0
  125. package/scripts/lib/kit-brief-test.sh +22 -3
  126. package/scripts/lib/kit-brief.sh +45 -5
  127. package/scripts/lib/kit-config-resolve.sh +2 -2
  128. package/scripts/lib/kit-config-test.sh +64 -1
  129. package/scripts/lib/kit-config.sh +37 -1
  130. package/scripts/lib/kit-events.sh +7 -0
  131. package/scripts/lib/kit-gc-test.sh +173 -1
  132. package/scripts/lib/kit-gc.sh +226 -37
  133. package/scripts/lib/kit-hotfix.sh +216 -0
  134. package/scripts/lib/kit-interview-test.sh +93 -0
  135. package/scripts/lib/kit-interview.sh +117 -8
  136. package/scripts/lib/kit-lib-test.sh +1 -1
  137. package/scripts/lib/kit-lib.sh +3 -3
  138. package/scripts/lib/kit-local.sh +2 -2
  139. package/scripts/lib/kit-manifest.sh +33 -1
  140. package/scripts/lib/kit-profile-test.sh +3 -3
  141. package/scripts/lib/kit-status-test.sh +112 -4
  142. package/scripts/lib/kit-status.sh +246 -16
  143. package/scripts/lib/kit-task-ops-test.sh +37 -0
  144. package/scripts/lib/kit-task-ops.sh +175 -31
  145. package/scripts/lib/kto-hotfix-test.sh +232 -0
  146. package/scripts/lib/kto-task-close-test.sh +1 -1
  147. package/scripts/lib/kto-task-new-test.sh +95 -0
  148. package/scripts/lib/kto-task-pr-merge-test.sh +37 -3
  149. package/scripts/lib/kto-task-pr-test.sh +70 -0
  150. package/scripts/lib/leak-fence.sh +89 -0
  151. package/scripts/lib/light-task-run-test.sh +255 -0
  152. package/scripts/lib/light-task-test.sh +309 -0
  153. package/scripts/lib/light-task.sh +706 -0
  154. package/scripts/lib/next-test.sh +99 -0
  155. package/scripts/lib/next.sh +9 -3
  156. package/scripts/lib/orchestration-runtime-test.sh +72 -0
  157. package/scripts/lib/orchestration-runtime.sh +57 -5
  158. package/scripts/lib/plan-machine-test.sh +15 -2
  159. package/scripts/lib/plan-machine.sh +20 -7
  160. package/scripts/lib/plan-next-test.sh +1 -1
  161. package/scripts/lib/plan-next.sh +4 -4
  162. package/scripts/lib/pr-evidence-test.sh +3 -3
  163. package/scripts/lib/pr-evidence.sh +1 -1
  164. package/scripts/lib/qa-lane-test.sh +626 -0
  165. package/scripts/lib/qa-lane.sh +1357 -0
  166. package/scripts/lib/qa-lanes-test.sh +175 -0
  167. package/scripts/lib/react-detect.sh +1 -1
  168. package/scripts/lib/render-test.sh +1 -1
  169. package/scripts/lib/review-page-test.sh +318 -0
  170. package/scripts/lib/review-page.sh +369 -0
  171. package/scripts/lib/review-stage-test.sh +62 -11
  172. package/scripts/lib/review-stage.sh +42 -60
  173. package/scripts/lib/role-identity-test.sh +65 -0
  174. package/scripts/lib/role-identity.sh +25 -2
  175. package/scripts/lib/secret-guard.sh +3 -3
  176. package/scripts/lib/session-registry-test.sh +111 -0
  177. package/scripts/lib/session-registry.sh +233 -0
  178. package/scripts/lib/stage-receipt-test.sh +14 -1
  179. package/scripts/lib/stage-receipt.sh +13 -8
  180. package/scripts/lib/task-source-file.sh +309 -0
  181. package/scripts/lib/task-source.sh +130 -0
  182. package/scripts/lib/upgrade-report-test.sh +120 -0
  183. package/scripts/lib/upgrade-report.sh +138 -0
  184. package/scripts/lib/version-bump.sh +3 -3
  185. package/scripts/lib/wave-result-test.sh +80 -0
  186. package/scripts/lib/wave-result.sh +127 -0
  187. package/scripts/lib/worker-brief-test.sh +5 -0
  188. package/scripts/lib/worker-brief.sh +2 -2
  189. package/scripts/lib/worktree-issue-test.sh +30 -1
  190. package/scripts/lib/worktree-issue.sh +82 -12
  191. package/scripts/lib/worktree-ports-test.sh +57 -4
  192. package/scripts/lib/worktree-start-test.sh +197 -0
  193. package/scripts/lib/worktree-start.sh +153 -31
  194. package/scripts/lib/zsh-safety-test.sh +19 -3
  195. package/scripts/marketing-walkthrough-test.sh +152 -0
  196. package/scripts/night-grant-test.sh +37 -0
  197. package/scripts/night-grant.sh +448 -0
  198. package/scripts/night-run-test.sh +8 -0
  199. package/scripts/night-run.mjs +275 -0
  200. package/scripts/night-run.test.mjs +324 -0
  201. package/scripts/orchestrate-test.sh +190 -0
  202. package/scripts/orchestrate.sh +79 -8
  203. package/scripts/portable-test.sh +11 -2
  204. package/scripts/publish.sh +28 -3
  205. package/scripts/review-lint-test.sh +7 -7
  206. package/scripts/review-lint.sh +2 -2
  207. package/scripts/review-rules.conf +8 -0
  208. package/scripts/rule-recipes-test.sh +96 -0
  209. package/scripts/self-install-test.sh +39 -9
  210. package/scripts/setup-labels.sh +18 -1
  211. package/scripts/setup-milestones.sh +1 -1
  212. package/scripts/showcase.sh +1 -1
  213. package/scripts/skill-frontmatter-lint-test.sh +4 -4
  214. package/scripts/skill-frontmatter-lint.sh +1 -1
  215. package/scripts/status-test.sh +113 -2
  216. package/scripts/status.sh +16 -3
  217. package/scripts/task-sync-test.sh +154 -0
  218. package/scripts/task-sync.sh +243 -32
  219. package/scripts/test-runner-test.sh +158 -0
  220. package/scripts/test.sh +131 -23
  221. package/scripts/update-path-test.sh +279 -0
  222. package/scripts/ux-ds-audit.sh +1 -1
  223. package/scripts/ux-graph-scan.sh +6 -6
  224. package/scripts/wave-worker.sh +54 -0
  225. package/skills/kit-add/SKILL.md +77 -0
  226. package/skills/kit-autopilot/SKILL.md +123 -12
  227. package/skills/kit-cleanup/SKILL.md +5 -2
  228. package/skills/kit-contribute/SKILL.md +4 -4
  229. package/skills/kit-docs-writer/SKILL.md +16 -6
  230. package/skills/kit-effort-close/SKILL.md +17 -8
  231. package/skills/kit-effort-new/SKILL.md +15 -9
  232. package/skills/kit-effort-pr/SKILL.md +15 -7
  233. package/skills/kit-effort-start/SKILL.md +5 -2
  234. package/skills/kit-gc/SKILL.md +5 -2
  235. package/skills/kit-next/SKILL.md +5 -1
  236. package/skills/kit-onboard/SKILL.md +3 -3
  237. package/skills/kit-page/SKILL.md +93 -0
  238. package/skills/kit-plan-next/SKILL.md +8 -4
  239. package/skills/kit-security-sweep/SKILL.md +1 -3
  240. package/skills/kit-ship/SKILL.md +2 -3
  241. package/skills/kit-status/SKILL.md +35 -4
  242. package/skills/kit-task-new/SKILL.md +3 -3
  243. package/skills/kit-task-pr/SKILL.md +7 -2
  244. package/skills/kit-task-pr-merge/SKILL.md +7 -2
  245. package/skills/kit-task-start/SKILL.md +7 -7
  246. package/skills/kit-task-sync/SKILL.md +19 -3
  247. package/skills/kit-ux-audit/SKILL.md +3 -2
  248. package/templates/agents/auto-dev.md +5 -4
  249. package/templates/agents/backend.md +1 -1
  250. package/templates/agents/designer.md +2 -0
  251. package/templates/agents/devops.md +1 -1
  252. package/templates/agents/editor.md +9 -1
  253. package/templates/agents/frontend.md +1 -1
  254. package/templates/agents/local-delegate.md +1 -1
  255. package/templates/agents/pm.md +5 -5
  256. package/templates/agents/tech-lead.md +1 -1
  257. package/templates/benchmarks/SCHEMA.md +9 -3
  258. package/templates/codex/hooks.json.tmpl +89 -0
  259. package/templates/hooks/guard-base-branch-commit.sh.tmpl +13 -7
  260. package/templates/hooks/guard-raw-git-ops.sh.tmpl +12 -12
  261. package/templates/hooks/mempal_followup.sh.tmpl +2 -2
  262. package/templates/hooks/mempal_session_start.sh.tmpl +1 -1
  263. package/templates/hooks/prepush_gate.sh.tmpl +4 -2
  264. package/templates/hooks/repo-hygiene.sh.tmpl +3 -2
  265. package/templates/instructions.md.tmpl +174 -0
  266. package/templates/kit.config.json.tmpl +3 -3
  267. package/templates/knowledge-INDEX.md.tmpl +1 -1
  268. package/templates/lib/kit-sigil.sh.tmpl +1 -1
  269. package/templates/rules/authoring.md +106 -0
  270. package/templates/rules/branch-naming.md +40 -4
  271. package/templates/rules/code-retrieval.md +63 -0
  272. package/templates/rules/delegation-brief.md +0 -3
  273. package/templates/rules/design-routing.md +3 -3
  274. package/templates/rules/effort-model.md +14 -10
  275. package/templates/rules/gate-and-review.md +94 -0
  276. package/templates/rules/issue-lifecycle.md +88 -0
  277. package/templates/rules/knowledge-base.md +1 -1
  278. package/templates/rules/mempalace.md +1 -1
  279. package/templates/rules/merge-safety.md +108 -0
  280. package/templates/rules/naming-and-ids.md +23 -17
  281. package/templates/rules/plain-language.md +59 -0
  282. package/templates/rules/plan-next.md +9 -11
  283. package/templates/rules/react-annotate.md +6 -0
  284. package/templates/rules/review-pages.md +49 -0
  285. package/templates/rules/risk-tiered-review.md +13 -4
  286. package/templates/rules/shared-checkout.md +106 -0
  287. package/templates/rules/skill-gaps.md +2 -7
  288. package/templates/rules/task-management.md +13 -1
  289. package/templates/skills/brand-voice/SKILL.md +91 -0
  290. package/templates/skills/brand-voice/references/voice-template.md +61 -0
  291. package/templates/skills/campaign/SKILL.md +123 -0
  292. package/templates/skills/campaign/references/plan-template.md +55 -0
  293. package/templates/skills/concrete/SKILL.md +2 -2
  294. package/templates/skills/copywriting/SKILL.md +8 -1
  295. package/templates/skills/feature-build-refine/SKILL.md +2 -4
  296. package/templates/skills/morning-briefing/SKILL.md +2 -2
  297. package/templates/skills/page-design/SKILL.md +145 -0
  298. package/templates/skills/page-design/add.json +5 -0
  299. package/templates/skills/page-design/references/design-file-template.md +40 -0
  300. package/templates/skills/page-design/references/generic-page-patterns.md +43 -0
  301. package/templates/skills/page-design/references/minimum-rules.md +42 -0
  302. package/templates/skills/speckit/SKILL.md +4 -5
  303. package/templates/skills/supabase-patterns/SKILL.md +1 -1
  304. package/commands/kit-add.md +0 -42
  305. package/templates/CLAUDE.md.tmpl +0 -106
@@ -8,7 +8,7 @@ Canonical naming + merge-order rules so you're never confused about *what a bran
8
8
  <kind>/<issue-number>-<slug>
9
9
  ```
10
10
 
11
- - `<kind>` — one of the closed set below, or one of the two effort prefixes named next. No others.
11
+ - `<kind>` — one of the closed set below, one of the two effort prefixes, or `light` (a light task). No others.
12
12
  - `<issue-number>` — the issue this branch closes. **Always required** for human work.
13
13
  - `<slug>` — short kebab-case description (≤ 5 words).
14
14
 
@@ -31,6 +31,30 @@ it protects any branch whose issue is still open. One trailing letter only — `
31
31
  is not an issue number and gets no protection. (The parser honors the suffix for any kind, not
32
32
  just `sub` — it errs toward protection rather than risk deleting a misnamed live branch.)
33
33
 
34
+ ### Hotfix branches (created by `cckit hotfix`, not by hand)
35
+
36
+ `cckit hotfix <pr|sha> [--base <branch>]` cherry-picks one merged change onto the release branch and
37
+ names its branch after the **source PR**, not an issue — a cherry-pick has no issue of its own:
38
+
39
+ | Pattern | When | `N` |
40
+ | --- | --- | --- |
41
+ | `fix/<N>-hotfix-<base>` | the source is a PR, or a commit whose subject names one | the **source PR's** number |
42
+ | `fix/hotfix-<sha7>-<base>` | the source commit names no PR | none |
43
+
44
+ `<base>` is the target branch, lowercased with every non-alphanumeric run turned into `-`
45
+ (`release/1.x` → `release-1-x`), so the same PR can be carried to two release branches. `N` parses
46
+ as an issue number, and a merged PR reads as closed, so `gc` treats the branch like any other whose
47
+ issue is closed: prunable once its own PR merges. Do not run `cckit pr` in a hotfix worktree — it
48
+ would read the source PR number as the issue to close.
49
+
50
+ ### Light-task branches (created by `cckit task start`, not by hand)
51
+
52
+ A light task is work tracked in the project's task list, with no GitHub issue. `cckit task start
53
+ <id>` cuts `light/<id>-<slug>`. `<id>` starts with a letter (`t3f9a`), so the branch never parses as
54
+ an issue number; `gc` asks the task source and keeps the branch until the task is done on the base
55
+ branch. `light/share-<timestamp>` is the branch `cckit task share` opens its PR from. Do not run
56
+ `cckit pr` in a light worktree: `cckit task finish` opens the PR.
57
+
34
58
  ### Closed set of kinds
35
59
 
36
60
  | Kind | For | Typical risk |
@@ -46,6 +70,12 @@ just `sub` — it errs toward protection rather than risk deleting a misnamed li
46
70
  | `spike` | Time-boxed research (may be thrown away) | low |
47
71
  | `plan` | Plan/report deliverable | low |
48
72
 
73
+ **Content kinds are labels, never branch prefixes.** `post`, `campaign`, `brand` and `research`
74
+ (`KIT_CONTENT_KINDS`, `scripts/lib/kinds.sh`) are `kind:` values for content work. `cckit start` maps
75
+ each onto the set above — `kind:post` and `kind:brand` → `task/`, `kind:campaign` → `plan/`,
76
+ `kind:research` → `spike/` — so the set `gc` and the hygiene hook parse does not grow. A PR opened
77
+ from one is titled `docs:`.
78
+
49
79
  ### Bot branches (do not create by hand)
50
80
 
51
81
  | Pattern | Who | Notes |
@@ -87,6 +117,12 @@ Lockfiles (`pnpm-lock.yaml`, `package-lock.json`, …) and manifest config confl
87
117
  live writer already owns refuses the launch, and the wave's other claims are released. A lease is
88
118
  reclaimed only on positive evidence — its worktree is gone, or its process died on the host that
89
119
  recorded it — never on a process check against another host.
120
+ - **`start` enforces it too, with a session claim.** `orchestrate`'s lease covers a wave; a second
121
+ session running `cckit start <issue>` by hand is outside it. `wt_start` records one claim per
122
+ issue under `<git-common-dir>/kit-sessions/` (`scripts/lib/session-registry.sh`) and refuses a
123
+ start while another live session holds it — before any fetch, branch or worktree. `--force` /
124
+ `KIT_FORCE=1` starts anyway; a claim whose pid is dead is reaped; `cckit claims` lists the live
125
+ ones. A board Status of In Progress or In Review only warns.
90
126
  - Prefer giving local sub-agents their own worktree.
91
127
  - Remote CI agents (Auto-Dev) are isolated per runner — favor them for parallel fixes.
92
128
  - Before editing shared files, check whether another agent is active.
@@ -109,7 +145,7 @@ If the project adopts the kit's PR-automation workflows, these labels are applie
109
145
 
110
146
  One branch = one issue = one PR = **deleted on merge**. A branch is a short-lived container, not a place work lives.
111
147
 
112
- - **No long-lived uncommitted work.** Don't let a working tree sit dirty across sessions. Commit + PR, or discard. A branch sitting many commits behind the base with uncommitted work can silently revert merged work on a bad rebase — exactly the class of problem this section exists to prevent.
148
+ - **No long-lived uncommitted work.** Don't let a working tree sit dirty across sessions. Commit + PR, or discard. A branch sitting many commits behind the base with uncommitted work can silently revert merged work on a bad rebase.
113
149
  - **Never work directly on the base branch (`main`/`develop`).** The `guard-base-branch-commit.sh` hook blocks commits there; start every change with `/kit-task-start <issue>` (it branches from a *fresh* base).
114
150
  - **Delete on merge.** `/kit-task-pr-merge` removes the worktree and deletes the local + remote branch automatically. Never leave a merged branch or its worktree lingering.
115
151
  - **One worktree per branch; remove it when its PR merges.** Parallel agents must use worktrees (never share a checkout).
@@ -120,10 +156,10 @@ One branch = one issue = one PR = **deleted on merge**. A branch is a short-live
120
156
 
121
157
  Local hooks + skills are **fast feedback**; the **durable, everyone-applies enforcement** belongs on GitHub. Move guardrails there as they mature — they then enforce for humans, CI agents (Auto-Dev), and the Claude Action alike, regardless of anyone's local setup.
122
158
 
123
- - **Do first (1 toggle):** repo Settings → **"Automatically delete head branches"** — eliminates remote-branch buildup entirely.
159
+ - **Do first (1 toggle):** repo Settings → **"Automatically delete head branches"** — GitHub then deletes each remote branch when its PR merges.
124
160
  - **Branch protection** on the base branch: require PR, required CI checks, linear history, no direct pushes.
125
161
  - **Stale-branch / stale-PR Action** (scheduled) to flag/close abandoned branches + PRs.
126
162
  - **Scheduled sweep** that flags "PR merged but issue still open" and "branch merged but not deleted".
127
163
  - Extend any adopted `pr-labeler` / `pr-deps` / `pr-automerge` workflows as the enforcement surface.
128
164
 
129
- Principle: **prefer migrating enforcement to GitHub** as it matures; keep only the genuinely local concerns (worktrees, stale base, dirty tree) in hooks.
165
+ Principle: keep only the local concerns (worktrees, stale base, dirty tree) in hooks.
@@ -0,0 +1,63 @@
1
+ # Code retrieval — ask the graph before you search the tree
2
+
3
+ > Active because this project ran `cckit add graft` (`codeGraph.provider` is `graft` in the project
4
+ > config). Graft is third-party software by NanoNets / Trail (MIT); cckit is not affiliated with
5
+ > either and vendors none of its code. To remove: `graft uninstall -y --no-global`, delete this
6
+ > file, and set `codeGraph.provider` to `"none"`.
7
+
8
+ Where a code graph exists, query it. Where one does not, search with Grep/Glob as before. This rule
9
+ says which.
10
+
11
+ ## The routing table
12
+
13
+ Use these when the three conditions under *Fallback* all hold:
14
+
15
+ | What you need | Verb | Instead of |
16
+ | --- | --- | --- |
17
+ | Where is X handled? | `graft ask "<task>"` | grepping a guessed term, opening files, following imports |
18
+ | Every occurrence of a pattern | `graft grep "<regex>"` | a plain regex search — same hits, grouped by enclosing symbol |
19
+ | The API of one file | `graft skeleton <file>` | reading the whole file for its signatures |
20
+ | What breaks if I change X? | `graft callers <symbol> -d 2` | grepping the symbol name and judging the hits |
21
+ | What does this symbol call? | `graft callers <symbol> --direction out` | reading the body and chasing each call |
22
+ | Orient in an unfamiliar repo | `graft map` | listing directories and opening entry points |
23
+ | What does my diff reach? | `graft blast --base origin/<base>` | judgement |
24
+
25
+ `-d N` is the depth of the walk; `-d all` is the full blast radius.
26
+
27
+ These verbs parse with tree-sitter: no model and no API key, so they cost nothing to run.
28
+ `graft build --deep` is the one command that calls an LLM, under the user's own key. Nothing in
29
+ this rule runs it; do not run it unless the user asks.
30
+
31
+ ## Fallback — a hard rule
32
+
33
+ **Fall back to Grep/Glob silently when any one of these is false. Never block work, ask the user,
34
+ or report an error because the graph is missing.**
35
+
36
+ 1. `graft --version` exits 0 (the binary is installed and loads).
37
+ 2. The repo has a `graft/` directory (the graph was built — `graft init` or `graft build`).
38
+ 3. The file or language you are asking about is one Graft indexes.
39
+
40
+ On 3: a file whose extension is not in Graft's list is skipped, not indexed. **There is no shell
41
+ grammar**, nor one for Markdown, YAML, SQL or CSS — on those files every verb above returns
42
+ nothing, and an empty answer from the graph means "not indexed", not "does not exist". Confirm
43
+ with Grep before concluding that something is absent.
44
+
45
+ The same precedent as a linter that is skipped when it is not installed: the graph is an
46
+ accelerator, and its absence changes no exit code and fails no step.
47
+
48
+ ## When not to query the graph at all
49
+
50
+ - **You already know the path.** Read it. A graph query to confirm a path you hold is a wasted turn.
51
+ - **Non-code retrieval** — the doc, rule, or ADR that answers a question. Graft does not index prose.
52
+ - **Text that is not a symbol** — a log message, a config value, a string literal in an unindexed
53
+ file. Grep is the right tool.
54
+
55
+ ## What is and is not claimed
56
+
57
+ Graft's README reports fewer tool calls (46%), fewer tokens (42%) and 54% → 66% on SWE-bench
58
+ Verified. Those are the vendor's own harness numbers. **cckit has not reproduced them** and this
59
+ rule does not assert them. Route through the graph because `callers`, `blast` and symbol-grouped
60
+ `grep` answer questions a text search cannot, not because of a benchmark this project did not run.
61
+
62
+ Graft makes two kinds of network call of its own, per its README: a daily npm version check and one
63
+ batched anonymous usage ping. `graft telemetry disable` or `DO_NOT_TRACK=1` turns the ping off.
@@ -59,9 +59,6 @@ The constraints, so this block is self-sufficient when the skill file is not in
59
59
  fires, the fix is the underlying gap — verify the claim, or make the decision. Rewording it into
60
60
  fluent prose is the failure mode, not the fix.
61
61
 
62
- `communication-style.md` states the mandate; this block is what carries it into a delegated agent's
63
- context.
64
-
65
62
  ## Gate commands (fill in for {{PROJECT_NAME}})
66
63
 
67
64
  - Build / typecheck / lint commands; shell scripts: `bash -n`; any knowledge/plan lint. A green
@@ -15,7 +15,7 @@ Includes (not limited to):
15
15
  - Microcopy and UX writing decisions
16
16
  - Accessibility decisions that affect UI (contrast, focus states, tap targets)
17
17
  - Responsive behavior and breakpoints
18
- - "Adjustments" — any tweak to an existing visual/UX surface, however small
18
+ - "Adjustments" — any tweak to an existing screen or component, however small
19
19
 
20
20
  ## How to route
21
21
 
@@ -26,8 +26,8 @@ Includes (not limited to):
26
26
 
27
27
  ## Why
28
28
 
29
- The Designer is the canonical voice for craft. Centralizing design decisions there keeps the
30
- system coherent and prevents ad-hoc visual calls that contradict the established direction.
29
+ Design decisions made by one agent stay consistent with each other. An ad-hoc visual call made
30
+ elsewhere can contradict the direction the Designer already set.
31
31
 
32
32
  ## Exception
33
33
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  **GitHub is the single source of truth.** An *effort* is the kit's larger unit of work: bigger than
4
4
  a single task, with its own decomposition. The same structure that organizes the work also produces
5
- a clean, per-unit **record** of it (goal → plan → patch → verify) — useful for review, audit, and as
5
+ a per-unit **record** of it (goal → plan → patch → verify) — useful for review, audit, and as
6
6
  a dataset if you train on your own development history.
7
7
 
8
8
  > Two flows coexist in the kit. Use **tasks** (`task-*`) for a single self-contained change; use
@@ -60,9 +60,9 @@ name alone in any flat list.
60
60
  the `/kit-effort-new` skill — call the **same** shared function `effort_new` (`scripts/lib/effort-ops.sh`).
61
61
  That single core fills the four body sections, applies the `ctx/kind/priority/role/flow` label set
62
62
  (`ctx:*` via `effort_ctx_bucket`), lints the parent **and every sub** title up front, links the
63
- native sub-issues, and adds everything to the board. Change the core and both move together; there
64
- is no second implementation. `scripts/setup-labels.sh` provisions every label family the core
65
- applies (`ctx:* flow:* kind:* priority:* role:*`) so creation never fails on a missing label.
63
+ native sub-issues, and adds everything to the board. `scripts/setup-labels.sh` provisions every
64
+ label family the core applies (`ctx:* flow:* kind:* priority:* role:*`) so creation never fails on a
65
+ missing label.
66
66
 
67
67
  ### Title rule, flow tags, relations, session-fit
68
68
 
@@ -104,7 +104,12 @@ how much of one working session it consumes before the context window fills. Der
104
104
  `effort_ctx_bucket` (`scripts/lib/effort-metrics.sh`) from difficulty + sub count: S=1 · M=2 · L=4 ·
105
105
  XL=8 weight. **`kit effort plan`** (`scripts/lib/effort-plan.sh`) reads the open efforts, groups by
106
106
  flow, orders each flow by the `blocked_by` edges, and packs them into **session-sized batches** under
107
- a budget (`KIT_SESSION_BUDGET`, default 4). L/XL efforts are flagged **"→ delegate subs"**:
107
+ a budget (`KIT_SESSION_BUDGET`, default 4). Rows come from GitHub unless `effort.planSource` names
108
+ an executable: it is called as `<source> <owner/repo>` from the project root and prints
109
+ `number<TAB>flow<TAB>ctx<TAB>title[<TAB>blockers]` rows, plus an optional `# age: <text>` line. A
110
+ source that is not executable, exits non-zero or prints no rows falls back to GitHub. The plan's
111
+ `source:` line names the source used, its age when reported, and any fallback — a plan built from a
112
+ snapshot says so. L/XL efforts are flagged **"→ delegate subs"**:
108
113
  delegating an effort's sub-issues to **sub-agents in their own worktrees** keeps the main session
109
114
  light (a sub-agent reads/writes in its own context; only a summary returns) — the lever that lets
110
115
  more efforts fit one session (`rules/agent-execution-routing.md`).
@@ -119,10 +124,10 @@ The parent carries the rich narrative; the **PR** carries the human-facing revie
119
124
  |------|------|
120
125
  | `effort-new` | parent issue (4-section body **filled** + `ctx/kind/priority/role/flow` labels) + native sub-issues, every title linted; optional `--slug` sets the handle |
121
126
  | `cckit effort chain <a> <b> …` | declare a running order over EXISTING issues: each successor `blocked_by` its predecessor + a `- Depends on #<predecessor>` line. Idempotent, additive, cycle-refusing (nothing is written on a refusal) |
122
- | `effort-start [--force] <slug\|N>` | `effort/<N>` branch + worktree; board → In Progress. **WIP-limited** — see below |
127
+ | `effort-start [--force] <slug\|N>` | `effort/<N>` branch + worktree; board → In Progress. Creating the branch stamps the start time for the metrics record. **WIP-limited** — see below |
123
128
  | orchestrate | sub-issues in own worktrees (file-disjoint) → merge into `effort/<N>`; each closes + board Done as it lands |
124
129
  | `effort-pr <slug\|N>` | ONE PR `effort/<N>` → {{BASE_BRANCH}} (rich body + `## For agents`) |
125
- | `effort-close <slug\|N>` | **snapshot sub-diffs pre-squash** → merge → close parent + subs → board Done(all) → GC prune → kit-sync drift check |
130
+ | `effort-close <slug\|N>` | **snapshot sub-diffs pre-squash** → append the metrics record (`build_seconds` and `tokens_real` each name their source; with no source the field is `null`, never an estimate) → re-target open PRs based on the effort branch (refuses if one fails) → merge → close parent + subs → board Done(all) → GC prune → kit-sync drift check |
126
131
 
127
132
  Board + record state are correct **by construction** — the close op owns them. Never rely on a
128
133
  separate, skippable "mark done" step.
@@ -131,7 +136,7 @@ separate, skippable "mark done" step.
131
136
  effort once `effort.wipLimit` (default **2**) are already in progress. **In progress** means an
132
137
  `effort/<N>-<slug>` branch exists — a local head (`effort_branch_rows_local`) **or** a branch origin
133
138
  has right now (`effort_branch_rows_origin`, a `git ls-remote` read), unioned by
134
- `effort_wip_rows`. That is the kit's one definition of a started effort, not a second one:
139
+ `effort_wip_rows`. That is the kit's one definition of a started effort:
135
140
  `effort_start` creates the branch and `effort_close` deletes it, so the set is exactly "started and
136
141
  not yet closed". The board Status is deliberately **not** the signal — it is written by the
137
142
  `/kit-effort-start` skill's board step, never by the verb, and it is empty whenever Projects v2 is
@@ -145,8 +150,7 @@ off.
145
150
  network-free. Resolution as a whole is not: with no branch matching the slug it falls through to
146
151
  `gh`, so a WIP refusal on a slug input can still make a GitHub read.
147
152
  - **At** the limit refuses; only strictly under it starts. `0` refuses every ordinary start of a NEW
148
- effort — `--force` / `KIT_FORCE=1` still start, and a re-start of an effort already in progress is
149
- never gated.
153
+ effort — `--force` / `KIT_FORCE=1` still start.
150
154
  - Re-running `effort start` on an effort already in progress is never gated — it adds no WIP, so the
151
155
  op stays safe to re-run.
152
156
  - The check runs **before** the fetch, branch, worktree and bootstrap — a refusal makes no branch,
@@ -0,0 +1,94 @@
1
+ # Gate and review — the gate blocks the push, every reviewer finding gets an answer
2
+
3
+ Two conventions about what stands between a commit and a merge. Each was a correction the kit's
4
+ maintainer repeated across projects before it was written down; they were recorded as cckit effort
5
+ `E231` on 2026-09-07.
6
+
7
+ Complements `risk-tiered-review.md` (who reads a PR once the gates are green), `merge-safety.md`
8
+ (the gate re-run on a current base and on the integration branch) and `issue-lifecycle.md` § 2 (an
9
+ approved plan is merged without re-confirming). A profile may install only some of those; the
10
+ precedence stated under each convention applies to whichever are present.
11
+
12
+ ## 1. The gate blocks the push, and the PR carries the exit evidence
13
+
14
+ **The project's gate — the one command that proves a change is sound — runs before `git push` and
15
+ blocks the push when it exits non-zero. The PR then carries that run's output and exit code.** A CI
16
+ job that runs the same command is the second observation, not the gate.
17
+
18
+ - **Origin:** a stated preference of the maintainer, repeated across projects: the gate is a
19
+ blocking pre-push hook plus exit evidence on the PR, not a CI lint job.
20
+ - **Why not CI alone:** a CI job reports after the branch is on the remote and the PR is open for
21
+ review. A red run then costs a fix commit, a second push and a second read of the PR. A gate
22
+ that blocks the push fails before any of that exists.
23
+ - **Why evidence and not a sentence:** "checks pass" in a PR body is a claim. The log and its exit
24
+ code are what a reviewer — or a captain merging unattended — can read.
25
+ - **One command.** The hook, the evidence and CI all run the same command, so a green in one means
26
+ the same thing in the others.
27
+
28
+ **What the kit enforces, and what it leaves to you.**
29
+
30
+ | Surface | What it does | On by default? |
31
+ | --- | --- | --- |
32
+ | `prePush.enabled` + `prePush.command` in the kit config, read by `.claude/hooks/prepush_gate.sh` | a Claude Code `PreToolUse` hook on Bash: when a command contains `git push`, it runs `prePush.command` and stops the push if that exits non-zero | **No — opt-in.** `cckit init --prepush "<command>"` writes the hook and sets both keys; without the flag no profile installs it and `prePush.enabled` is `false` |
33
+ | `scripts/lib/pr-evidence.sh` — `pr_attach_evidence <pr> <file> [caption]` | posts a log (or an image) as a PR comment, one comment per caption, edited in place on a re-run | a helper `cckit init` copies into the project's `scripts/lib/`, listed by `cckit lib`; a project scaffolded before it shipped gets it from `cckit init --upgrade`. No verb calls it: attach the gate's log yourself after the PR opens |
34
+ | `captain.mergePolicy.requireChecks` | `cckit watch --merge` reads a PR with **no checks at all** as `CHECKS_MISSING` → `verify` instead of green, and does not merge it | **No.** Default `false`; `KIT_CAPTAIN_REQUIRE_CHECKS=1` sets it for one run |
35
+
36
+ - **The hook gates the agent, not the terminal.** It is a Claude Code hook, not a git hook: a
37
+ `git push` typed in a shell outside the agent session is not checked. Whoever pushes that way
38
+ runs the gate by hand first.
39
+ - **No hook installed?** The convention still binds: run the gate, see exit 0, then push.
40
+ - **Attach the evidence** right after the PR opens:
41
+
42
+ ```bash
43
+ <your gate command> > gate.log 2>&1; echo "exit $?" >> gate.log
44
+ source scripts/lib/pr-evidence.sh # from the project root; `cckit init` copies it there
45
+ pr_attach_evidence <pr-number> gate.log "gate"
46
+ ```
47
+
48
+ **Precedence — `risk-tiered-review.md` § *The gates (what "green" means)*.** That section lists a
49
+ build and a local `typecheck` + `lint` "run before push" as examples of the gates. This rule is the
50
+ stricter form and wins on *when* and *how* the gate runs: before the push, blocking, with its output
51
+ on the PR. `risk-tiered-review.md` still decides *who reads the PR* once the gate is green.
52
+ **`merge-safety.md`** adds two further runs of the same gate (on a current base, and on the
53
+ integration branch); neither replaces the pre-push run.
54
+
55
+ ## 2. Every AI-reviewer finding is fixed or rebutted before the merge
56
+
57
+ **When an AI reviewer has commented on a PR, each finding is assessed before the PR merges. A
58
+ finding ends one of two ways: a commit that fixes it, or a reply on its thread saying why it is
59
+ wrong or out of scope. Silence is never an outcome.**
60
+
61
+ - **Origin — measured:** five review rounds collapsed to one when the reviewer's pass ran locally
62
+ before the push instead of on the open PR.
63
+ - **Run the pass before the push** when the reviewer can run locally. A finding answered before the
64
+ PR opens never becomes a thread.
65
+ - **A rebuttal names its reason** on the finding's own thread — the input the reviewer got wrong,
66
+ the line that already handles the case, or the issue that tracks it. "Won't fix" with no reason
67
+ is silence with more words.
68
+ - **Assess, do not obey.** A reviewer's finding is a claim to verify. Applying a wrong finding
69
+ without checking it is the same failure as ignoring a right one.
70
+ - **A finding that recurs belongs in the gate.** A defect class that is wrong every time it appears
71
+ becomes a `scripts/review-lint.sh` rule, so convention 1 catches it and no reviewer has to
72
+ find it again.
73
+
74
+ **What the kit enforces, and what it leaves to you.**
75
+
76
+ | Surface | What it does | On by default? |
77
+ | --- | --- | --- |
78
+ | `review.command` in the kit config | `cckit watch --merge` pipes a brief to that command for each PR it would merge and records the verdict. A recorded `gate: fail` reads `REVIEW_FAILING` → `fix` and always blocks the merge | **No.** Unset is the off switch |
79
+ | `captain.mergePolicy.requireReview` | a PR with **no** verdict recorded reads `REVIEW_MISSING` → `verify` and is not merged | implied on when `review.command` is set, off otherwise; `KIT_CAPTAIN_REQUIRE_REVIEW=1` sets it for one run |
80
+ | `cckit status` | lists each open PR's unresolved review threads under "PRs waiting on a human" | always — a report, not a block |
81
+
82
+ - **The per-finding answer is not enforced by any verb.** The captain reads one verdict per PR, not
83
+ one answer per thread. To make an unanswered thread block a merge, turn on *Require conversation
84
+ resolution before merging* in the base branch's protection on GitHub.
85
+ - **Resolve a thread only after its fix is pushed or its rebuttal is posted** — resolving is what
86
+ takes it off `cckit status`.
87
+
88
+ **Precedence — `risk-tiered-review.md`.** Its `risk:low` tier auto-passes once the gates are green,
89
+ and its § *Scope* exempts an approved plan's merges from the tiers. This rule wins over both for a
90
+ PR that carries reviewer findings: an auto-pass, and a captain merging an approved wave
91
+ (`issue-lifecycle.md` § 2), each wait until every finding is fixed or rebutted. An open finding is
92
+ not the "genuine blocker" that pings the human — the author answers it and the merge proceeds.
93
+ Everything else in `risk-tiered-review.md` stands: which tier needs a human read, and its
94
+ always-human list.
@@ -0,0 +1,88 @@
1
+ # Issue lifecycle — deliverables, planned merges, explicit closes
2
+
3
+ Three conventions about when an issue is open, who merges, and what closes it. Each was a
4
+ correction the kit's maintainer repeated across projects before it was written down; they were
5
+ recorded as cckit effort `E231` on 2026-09-07.
6
+
7
+ Complements `task-management.md` (the loop), `effort-model.md` (the unit of work),
8
+ `plan-output-format.md` (plans as files) and `risk-tiered-review.md` (who reviews). A profile may
9
+ install only some of those; the precedence stated under each convention applies to whichever are
10
+ present.
11
+
12
+ ## 1. A deliverable is a native sub-issue, never a body checkbox
13
+
14
+ **Every deliverable of a multi-part issue is its own GitHub issue, linked as a native sub-issue of
15
+ the parent.** A `- [ ]` list in an issue body is not tracking.
16
+
17
+ - **Origin:** issues whose deliverables were body checkboxes were closed with boxes still
18
+ unchecked. A closed issue leaves every open-issue view, so the unfinished items left with it and
19
+ the work was lost until someone re-read the closed body.
20
+ - **Why a sub-issue fixes it:** an open sub-issue stays in every open-issue list and on the board
21
+ after its parent closes, and the parent shows a completed count (`2/5`) that GitHub computes. A
22
+ checkbox has no state outside the body that contains it.
23
+ - **How:** `cckit effort new "<name>" "sub :: desc" …` creates the parent and links each sub
24
+ natively. `cckit effort close` closes the parent and every native sub-issue in one op.
25
+ - **Not covered:** a checklist that is not a deliverable — the `## Verification` checklist in a PR
26
+ body, review steps, a reproduction recipe. Those describe one change and die with it.
27
+
28
+ **Precedence — `plan-output-format.md` § *Deliverables section*.** That table stays: it is the
29
+ plan file's index of the PRs that complete it. It is an index, not the tracker. Every row needs an
30
+ issue behind it, and when the table's `Status` column and the issue state disagree, the issue state
31
+ wins — re-read it from `gh`, then correct the table.
32
+
33
+ ## 2. An approved plan is executed, not re-confirmed
34
+
35
+ **On a plan the owner already approved, the captain decides, merges each wave and continues. It
36
+ pings the human only on a genuine blocker.** The captain is whoever drives the plan: `cckit watch
37
+ --merge`, `/kit-autopilot`, or an orchestrating session.
38
+
39
+ - **Origin:** an approved plan stalled because the agent stopped to ask "merge or review?" for a
40
+ routine planned merge. The owner had already answered that question by approving the plan.
41
+ - **An approved plan is** an explicit instruction to run named efforts, an approved
42
+ `cckit effort plan`, or a wave the owner told the captain to drive. A plan the agent proposed and
43
+ nobody approved is not one.
44
+ - **Execution means** build a wave → merge its PRs once the gate is green → close subs and parent →
45
+ clean up → start the next wave, with a report at the end rather than a question in the middle.
46
+
47
+ A **genuine blocker** is one of these four, and nothing else:
48
+
49
+ - a merge conflict the captain cannot safely resolve;
50
+ - an always-human change the plan did not call for — a new dependency or lockfile change, an auth,
51
+ secret or security edit, a `.github/workflows/**` edit;
52
+ - an ambiguity the approved scope is silent on;
53
+ - a destructive or irreversible step outside the plan.
54
+
55
+ A red gate is not on that list: the captain does not merge it and does not ask — it fixes the cause
56
+ or reports the failure.
57
+
58
+ **Precedence — `risk-tiered-review.md`.** Its tiers govern ad-hoc PRs; its § *Scope — ad-hoc PRs,
59
+ not approved-plan execution* says so, and this rule is the other half. For a merge the plan
60
+ covers, this rule wins: a `risk:med` change inside the approved scope is not re-gated per PR. For a
61
+ change the plan did **not** imply, that rule's *Always-human* list wins and the captain stops.
62
+
63
+ ## 3. `Closes #N` links the PR; a close op closes the issue
64
+
65
+ **GitHub auto-closes an issue from `Closes #N` only when the PR merges into the repository's
66
+ default branch.** This project integrates on `{{BASE_BRANCH}}`. Whenever `{{BASE_BRANCH}}` is not
67
+ the GitHub default branch, a merged PR leaves its issue open, and nothing reports it.
68
+
69
+ - **Origin:** projects integrating on a non-default branch accumulated issues that stayed open
70
+ after their PR merged, so the board showed finished work as open.
71
+ - **What it costs beyond the board:** `cckit gc` keeps a branch whose issue is still open as
72
+ PROTECTED, so a merged branch with an unclosed issue is never offered for cleanup.
73
+ - **Close with the kit's verbs, which close explicitly:**
74
+
75
+ | Merged with | What closes the issue |
76
+ | --- | --- |
77
+ | `cckit merge` / `/kit-task-pr-merge` | the op closes every issue the PR links, after the merge |
78
+ | `cckit effort close` | the op closes the parent and every native sub-issue |
79
+ | the GitHub UI, or a raw `gh pr merge` | nothing, off the default branch — run `cckit close <N> "<summary>"` |
80
+
81
+ - **Check:** `cckit doctor` warns when `github.baseBranch` differs from the GitHub default branch.
82
+ After any merge the kit did not perform, read the issue state with `gh issue view <N>` — do not
83
+ infer it from the merged PR.
84
+
85
+ **Precedence — `task-management.md`** (*PR title = issue title · body includes `Closes #N`*).
86
+ Keep writing `Closes #N`: GitHub uses it to link the PR to the issue, and the kit's merge op reads
87
+ it to find which issues to close. On the question of whether an issue is closed, this rule wins —
88
+ the keyword is a link, and the close is an explicit op.
@@ -1,7 +1,7 @@
1
1
  # Knowledge base — governance
2
2
 
3
3
  The project's knowledge base lives in `knowledge/` (config: `knowledge.dir` in
4
- `.claude/kit.config.json`). It is the durable, agent-readable source of truth for product and
4
+ `{{CONFIG_REL}}`). It is the durable, agent-readable source of truth for product and
5
5
  project knowledge: brand, design system, decisions, research, reference docs.
6
6
 
7
7
  ## Hard rules
@@ -46,7 +46,7 @@ write the session to memory **before** the closing summary — every time:
46
46
  "resume here" follow-up: `mempalace_add_drawer` (`wing={{WING}}`, room `planning`) with the branch,
47
47
  what's uncommitted/unpushed, the next step, and any open PR/issue refs — so the next session resumes
48
48
  cheaply instead of re-deriving context. Prefer committing/pushing the work; the drawer is for what
49
- genuinely can't land yet.
49
+ can't land yet.
50
50
 
51
51
  (The `Stop` hook files the raw transcript; the `SessionEnd` hook is the safety net that captures
52
52
  unsynced work if you forgot step 4 — this is the curated, decision-level summary.)
@@ -0,0 +1,108 @@
1
+ # Merge safety — current base, coupled chains, the gate on the integration branch
2
+
3
+ Three conventions about what a branch must pass before it lands. Each was a correction the kit's
4
+ maintainer repeated across projects before it was written down; they were recorded as cckit effort
5
+ `E231` on 2026-09-07.
6
+
7
+ Complements `branch-naming.md` § *Merge order* (which PR lands first), `task-management.md` § *Rules*
8
+ (one PR per issue, and its coupled-chain exception) and `effort-model.md` (subs merge into one
9
+ integration branch). A profile may install only some of those; the precedence stated under each
10
+ convention applies to whichever are present.
11
+
12
+ ## 1. `MERGEABLE` is not safe — bring the branch onto the current base first
13
+
14
+ **Before a PR merges, its branch contains the tip of `{{BASE_BRANCH}}` and the gate has passed on
15
+ that tree.** `MERGEABLE` is not that evidence.
16
+
17
+ - **Origin:** a PR cut from a base that had since moved was merged because GitHub reported it
18
+ mergeable. It reverted a sibling PR that had landed in between: 7,285 lines removed, with no
19
+ conflict and no failing check to announce it.
20
+ - **What `MERGEABLE` says:** git can combine the branch and the base without a textual conflict.
21
+ It does not say the PR's diff leaves a sibling's lines alone, and it does not say the combined
22
+ tree passes the gate — a check run reports the tree it ran on, and the base has moved since.
23
+ - **Behind?** `git fetch origin {{BASE_BRANCH}}`, then
24
+ `git rev-list --count HEAD..origin/{{BASE_BRANCH}}`. Anything but `0` means the branch is stale.
25
+
26
+ The steps, from the branch's own worktree:
27
+
28
+ ```bash
29
+ git fetch origin {{BASE_BRANCH}}
30
+ git rebase origin/{{BASE_BRANCH}} # or: git merge origin/{{BASE_BRANCH}}
31
+ git diff --stat origin/{{BASE_BRANCH}}...HEAD # read the deletions
32
+ # run the project's gate here
33
+ git push --force-with-lease # a plain push after a merge
34
+ ```
35
+
36
+ - **Read the deletions.** A file or a block the issue never asked to remove, showing as deleted in
37
+ that diff, is the revert. Stop and restore it before pushing.
38
+ - **Merge instead of rebase** when other branches are cut from this one (an effort branch with live
39
+ sub-branches): a rebase rewrites the commits they sit on.
40
+ - **After every landing, the remaining open PRs are stale again.** Repeat for the next one in
41
+ `branch-naming.md`'s merge order; do not merge a batch that was current only before the first of
42
+ them landed.
43
+
44
+ **What the kit's merge ops do today.** Neither makes a stale, conflict-free branch current — that
45
+ is why this is a rule for whoever merges, not a description of the tooling.
46
+
47
+ | Op | What it merges | What it rebases |
48
+ | --- | --- | --- |
49
+ | `cckit watch --merge` (the captain) | a PR it classifies `CLEAN`: `mergeable` is `MERGEABLE`, `mergeStateStatus` is `CLEAN`, `UNSTABLE`, `HAS_HOOKS` or empty, no check is failing or pending, no review verdict is failing, and no policy floor trips | nothing. `BEHIND` is classified `BLOCKED` and skipped — not merged, not rebased |
50
+ | `cckit merge` / `/kit-task-pr-merge` | the PR as GitHub has it | only a PR GitHub reports `CONFLICTING`, and only when run from the PR's own head branch: `git rebase origin/<base>`, then `git push --force-with-lease`. A branch that is behind but conflict-free is merged as it stands |
51
+
52
+ GitHub reports `BEHIND` only when the base branch's protection requires branches to be up to date
53
+ before merging. With that setting off, a stale branch reads `CLEAN` and the captain merges it. Turn
54
+ the setting on for `{{BASE_BRANCH}}` and the captain's `BLOCKED` becomes the enforcement of this
55
+ convention.
56
+
57
+ **Precedence — `branch-naming.md` § *Merge order*.** That section decides the order; this rule
58
+ decides what each PR passes before its turn. They do not conflict on order. Its lockfile rule
59
+ (*merge one, then rebase the others*) is this convention applied to lockfiles; this rule extends it
60
+ to every PR, so where that section is silent about rebasing a non-lockfile PR, this rule wins.
61
+
62
+ ## 2. A coupled chain ships as ONE PR
63
+
64
+ **Changes that only work together land as one PR — and ideally one issue — not one PR per step.**
65
+ A chain is coupled when any step merged alone leaves `{{BASE_BRANCH}}` broken, or when each step
66
+ edits what the step before it wrote: a sequenced migration set, a rename plus its call sites, a
67
+ schema change plus the code that reads it.
68
+
69
+ - **Origin:** the incident class of convention 1. The PRs of a chain are siblings cut from the
70
+ same base, and each one is stale the moment the one before it lands. A single PR has no siblings
71
+ to revert.
72
+ - **Split only when** a step is independent of the others, or needs its own review gate — a data
73
+ backfill, an access-policy change.
74
+ - **Inside the PR, keep one commit per step.** The review still reads step by step; the merge is
75
+ atomic.
76
+
77
+ **Precedence — `task-management.md` § *Rules*** (*One PR per issue — no monster PRs*, with its
78
+ exception for a coupled migration/DDL chain) **and `branch-naming.md`** (*One PR per issue. No
79
+ monster PRs*, *Smaller before larger*). `task-management.md` states the exception for migrations;
80
+ this rule is the general form and wins on scope — any coupled chain qualifies, not only DDL. Its
81
+ split criteria are the same ones listed above and stand. Against the size guidance, this rule wins
82
+ for a coupled chain: a large diff is not a reason to split steps that cannot land apart. For
83
+ independent changes, one PR per issue still holds.
84
+
85
+ ## 3. Re-run the gate on the integration branch after the subs merge
86
+
87
+ **After the last sub-branch merges into the integration branch, the gate runs on the integration
88
+ branch itself, before its PR opens.** A green gate on every sub is not a green gate on the merge
89
+ of them.
90
+
91
+ - **Origin:** a correction the maintainer repeated — the gate had been run on each sub and not
92
+ again on the integration branch once the subs were merged into it.
93
+ - **Why per-sub green is not enough:** each sub's gate ran on that sub's tree. Two subs can each
94
+ pass and still break together — one renames a helper the other calls, both add the same key to
95
+ a config file — and no sub's gate saw the combination.
96
+ - **Where it applies:** an effort's `effort/<N>` branch after its `sub/<N><letter>` branches merge
97
+ in (`effort-model.md`), and any other branch that collects several branches before one PR.
98
+ Sequential subs committed straight onto the integration branch are covered once the gate has
99
+ run on its final commit.
100
+ - **No kit verb runs it for you.** `cckit effort pr` opens the PR and `cckit effort close` merges
101
+ it; neither runs the project's gate. Run it by hand, then open the PR. The PR's CI is the
102
+ second run, not a substitute for the first: it reports after the PR is already up for review.
103
+ - **Then convention 1 applies to the integration branch** like any other: it is brought onto the
104
+ current `{{BASE_BRANCH}}` and the gate passes there before it merges.
105
+
106
+ **Precedence — `effort-model.md` § *Lifecycle*.** Its table lists `orchestrate → effort-pr →
107
+ effort-close` with no gate step between them. This rule adds that step and wins where the table is
108
+ read as "merge the subs, open the PR".