cohorte 3.0.0-dev.8 → 3.1.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 (251) hide show
  1. package/CHANGELOG.md +1637 -0
  2. package/README.md +322 -62
  3. package/bin/cli.js +213 -0
  4. package/bin/report.js +141 -0
  5. package/core/agents/cohorte-profile-reader.md +40 -0
  6. package/core/agents/cohorte-release.md +61 -0
  7. package/core/agents/cohorte-review.md +200 -0
  8. package/core/agents/implementer.template.md +154 -0
  9. package/core/commands/cohorte-align-ds.md +33 -0
  10. package/core/commands/cohorte-audit.md +74 -0
  11. package/core/commands/cohorte-brainstorm.md +73 -0
  12. package/core/commands/cohorte-build.md +248 -0
  13. package/core/commands/cohorte-doctor.md +135 -0
  14. package/core/commands/cohorte-fix.md +80 -0
  15. package/core/commands/cohorte-fleet.md +111 -0
  16. package/core/commands/cohorte-init-pipeline.md +30 -0
  17. package/core/commands/cohorte-intake.md +92 -0
  18. package/core/commands/cohorte-patch.md +118 -0
  19. package/core/commands/cohorte-refactor.md +122 -0
  20. package/core/commands/cohorte-retro.md +85 -0
  21. package/core/commands/cohorte-revert.md +104 -0
  22. package/core/commands/cohorte-review.md +239 -0
  23. package/core/commands/cohorte-ship.md +167 -0
  24. package/core/commands/cohorte-spec.md +114 -0
  25. package/core/commands/cohorte-update-pipeline.md +119 -0
  26. package/core/commands/cohorte-verify.md +106 -0
  27. package/core/hooks/gate.py +3236 -0
  28. package/core/templates/agent-handoff.md +34 -0
  29. package/core/templates/brainstorm-return.md +42 -0
  30. package/core/templates/decisions.template.md +42 -0
  31. package/core/templates/design-brief.md +37 -0
  32. package/core/templates/patch.template.md +95 -0
  33. package/core/templates/pr-body.md +25 -0
  34. package/core/templates/review-feedback.md +46 -0
  35. package/core/templates/spec.template.md +109 -0
  36. package/core/templates/steps/init-pipeline/01-detect-stack.md +53 -0
  37. package/core/templates/steps/init-pipeline/02-interview-gaps.md +78 -0
  38. package/core/templates/steps/init-pipeline/03-draft-profile.md +10 -0
  39. package/core/templates/steps/init-pipeline/04-write-render.md +95 -0
  40. package/core/templates/steps/init-pipeline/05-report.md +11 -0
  41. package/core/templates/steps/review-pr/01-pr-mode.md +54 -0
  42. package/core/workflows/audit.js +311 -0
  43. package/core/workflows/loop.js +692 -0
  44. package/core/workflows/refactor.js +398 -0
  45. package/core/workflows/review.js +505 -0
  46. package/install.ps1 +72 -0
  47. package/install.sh +69 -0
  48. package/lib/doctor.js +506 -0
  49. package/lib/install.js +386 -0
  50. package/lib/project.js +359 -0
  51. package/lib/render.js +121 -0
  52. package/lib/versions.js +145 -0
  53. package/lib/yaml.js +183 -0
  54. package/package.json +36 -17
  55. package/profile/PIPELINE.template.md +288 -0
  56. package/profile/SCHEMA.md +30 -0
  57. package/profile/cohorte.config.template.yaml +43 -0
  58. package/profile/schema/dead-agents.md +29 -0
  59. package/profile/schema/decisions.md +23 -0
  60. package/profile/schema/deferred.md +22 -0
  61. package/profile/schema/feature-diff.md +20 -0
  62. package/profile/schema/kanban.md +95 -0
  63. package/profile/schema/metrics.md +23 -0
  64. package/profile/schema/output-discipline.md +21 -0
  65. package/profile/schema/preflight.md +81 -0
  66. package/profile/schema/profile-block.md +103 -0
  67. package/profile/schema/project-kinds.md +89 -0
  68. package/profile/schema/readiness.md +17 -0
  69. package/profile/schema/reconcile.md +64 -0
  70. package/profile/schema/release-notes.md +29 -0
  71. package/profile/schema/rendering.md +48 -0
  72. package/profile/schema/retrieval.md +58 -0
  73. package/profile/schema/spec-status.md +79 -0
  74. package/profile/schema/specialization.md +41 -0
  75. package/profile/schema/verify.md +115 -0
  76. package/profile/schema/workflows.md +78 -0
  77. package/scripts/feature-diff.sh +118 -0
  78. package/scripts/kanban-move.sh +349 -0
  79. package/scripts/metrics/collect.mjs +542 -0
  80. package/scripts/metrics/prices.json +42 -0
  81. package/scripts/new-feature.sh.template +122 -0
  82. package/scripts/preflight.sh +114 -0
  83. package/scripts/remove-feature.sh.template +56 -0
  84. package/scripts/verify-run.sh +509 -0
  85. package/assets/manifest.json +0 -203
  86. package/assets/migrations/config/README.md +0 -12
  87. package/assets/migrations/state/0001_init.sql +0 -154
  88. package/assets/prompts/README.md +0 -11
  89. package/assets/prompts/agents/brainstormer.md +0 -3
  90. package/assets/prompts/agents/fixer.md +0 -7
  91. package/assets/prompts/agents/implementer.md +0 -12
  92. package/assets/prompts/agents/reviewer.md +0 -8
  93. package/assets/prompts/agents/security-reviewer.md +0 -7
  94. package/assets/prompts/agents/spec-author.md +0 -3
  95. package/assets/prompts/phases/build.md +0 -5
  96. package/assets/prompts/phases/review.md +0 -5
  97. package/assets/prompts/phases/test.md +0 -5
  98. package/assets/prompts/system.md +0 -11
  99. package/assets/schemas/agent-output.schema.json +0 -225
  100. package/assets/schemas/auth-status.schema.json +0 -87
  101. package/assets/schemas/command-result.schema.json +0 -192
  102. package/assets/schemas/commands.schema.json +0 -959
  103. package/assets/schemas/config.schema.json +0 -2281
  104. package/assets/schemas/doctor-report.schema.json +0 -104
  105. package/assets/schemas/events.schema.json +0 -8514
  106. package/assets/schemas/fake-script.schema.json +0 -549
  107. package/assets/schemas/inspect.schema.json +0 -3133
  108. package/assets/schemas/manifest.schema.json +0 -79
  109. package/assets/schemas/ownership.schema.json +0 -52
  110. package/assets/schemas/policy-verdict.schema.json +0 -282
  111. package/assets/schemas/project-model.schema.json +0 -783
  112. package/assets/schemas/project-status.schema.json +0 -217
  113. package/assets/schemas/reconcile-plan.schema.json +0 -154
  114. package/assets/schemas/run-diff.schema.json +0 -177
  115. package/assets/schemas/run-snapshot-manifest.schema.json +0 -2104
  116. package/assets/schemas/run-state.schema.json +0 -1755
  117. package/assets/schemas/runtime-capabilities.schema.json +0 -1545
  118. package/assets/schemas/sandbox-capabilities.schema.json +0 -116
  119. package/assets/schemas/skill.schema.json +0 -87
  120. package/assets/schemas/spec.schema.json +0 -202
  121. package/assets/schemas/tool-catalogue.schema.json +0 -655
  122. package/assets/schemas/trust-record.schema.json +0 -38
  123. package/assets/skills/README.md +0 -9
  124. package/assets/skills/inspect-surface.md +0 -4
  125. package/dist/agent-host.mjs +0 -2187
  126. package/dist/agent-host.mjs.map +0 -1
  127. package/dist/bundle-manifest.json +0 -128
  128. package/dist/chunks/__host-DgGPyco9.mjs +0 -18
  129. package/dist/chunks/__host-DgGPyco9.mjs.map +0 -1
  130. package/dist/chunks/align-ds-r_X_1aQ_.mjs +0 -93
  131. package/dist/chunks/align-ds-r_X_1aQ_.mjs.map +0 -1
  132. package/dist/chunks/approve-Cv135UqI.mjs +0 -19
  133. package/dist/chunks/approve-Cv135UqI.mjs.map +0 -1
  134. package/dist/chunks/audit-B4ZWQ_DI.mjs +0 -179
  135. package/dist/chunks/audit-B4ZWQ_DI.mjs.map +0 -1
  136. package/dist/chunks/auth-BT5oVp76.mjs +0 -132
  137. package/dist/chunks/auth-BT5oVp76.mjs.map +0 -1
  138. package/dist/chunks/auth-Dnlksuo5.mjs +0 -141
  139. package/dist/chunks/auth-Dnlksuo5.mjs.map +0 -1
  140. package/dist/chunks/brainstorm-SJwOIEif.mjs +0 -123
  141. package/dist/chunks/brainstorm-SJwOIEif.mjs.map +0 -1
  142. package/dist/chunks/build-C_-mbZfD.mjs +0 -19
  143. package/dist/chunks/build-C_-mbZfD.mjs.map +0 -1
  144. package/dist/chunks/cancel-KV_cpsqS.mjs +0 -15
  145. package/dist/chunks/cancel-KV_cpsqS.mjs.map +0 -1
  146. package/dist/chunks/canonical-C8UxeEmB.mjs +0 -57
  147. package/dist/chunks/canonical-C8UxeEmB.mjs.map +0 -1
  148. package/dist/chunks/catalogue-IaCJdfB8.mjs +0 -1549
  149. package/dist/chunks/catalogue-IaCJdfB8.mjs.map +0 -1
  150. package/dist/chunks/compose-DRKjQcn0.mjs +0 -7333
  151. package/dist/chunks/compose-DRKjQcn0.mjs.map +0 -1
  152. package/dist/chunks/config-Cqu5XQoP.mjs +0 -96
  153. package/dist/chunks/config-Cqu5XQoP.mjs.map +0 -1
  154. package/dist/chunks/contract-DjssDPpS.mjs +0 -335
  155. package/dist/chunks/contract-DjssDPpS.mjs.map +0 -1
  156. package/dist/chunks/contract-bQ9FJl4N.mjs +0 -123
  157. package/dist/chunks/contract-bQ9FJl4N.mjs.map +0 -1
  158. package/dist/chunks/deny-ClTxSvHJ.mjs +0 -15
  159. package/dist/chunks/deny-ClTxSvHJ.mjs.map +0 -1
  160. package/dist/chunks/diff-Qw0II0sj.mjs +0 -101
  161. package/dist/chunks/diff-Qw0II0sj.mjs.map +0 -1
  162. package/dist/chunks/discover-BZPolSZG.mjs +0 -21
  163. package/dist/chunks/discover-BZPolSZG.mjs.map +0 -1
  164. package/dist/chunks/doctor-DcDFPvQM.mjs +0 -222
  165. package/dist/chunks/doctor-DcDFPvQM.mjs.map +0 -1
  166. package/dist/chunks/fix-C9roGiQz.mjs +0 -82
  167. package/dist/chunks/fix-C9roGiQz.mjs.map +0 -1
  168. package/dist/chunks/fleet-yWHQY2ya.mjs +0 -297
  169. package/dist/chunks/fleet-yWHQY2ya.mjs.map +0 -1
  170. package/dist/chunks/gc-BBXlBF5w.mjs +0 -161
  171. package/dist/chunks/gc-BBXlBF5w.mjs.map +0 -1
  172. package/dist/chunks/init--FxxkrcT.mjs +0 -63
  173. package/dist/chunks/init--FxxkrcT.mjs.map +0 -1
  174. package/dist/chunks/inspect-Buby4cQD.mjs +0 -22
  175. package/dist/chunks/inspect-Buby4cQD.mjs.map +0 -1
  176. package/dist/chunks/intake-C1pesxCJ.mjs +0 -12
  177. package/dist/chunks/intake-C1pesxCJ.mjs.map +0 -1
  178. package/dist/chunks/logs-Giq5sUau.mjs +0 -25
  179. package/dist/chunks/logs-Giq5sUau.mjs.map +0 -1
  180. package/dist/chunks/loop-BWsUpyus.mjs +0 -212
  181. package/dist/chunks/loop-BWsUpyus.mjs.map +0 -1
  182. package/dist/chunks/migrate-DuYCAbE3.mjs +0 -33
  183. package/dist/chunks/migrate-DuYCAbE3.mjs.map +0 -1
  184. package/dist/chunks/models-Btp6X2YZ.mjs +0 -24
  185. package/dist/chunks/models-Btp6X2YZ.mjs.map +0 -1
  186. package/dist/chunks/obsidian-BHLkXx_H.mjs +0 -235
  187. package/dist/chunks/obsidian-BHLkXx_H.mjs.map +0 -1
  188. package/dist/chunks/patch-sAgVqjpx.mjs +0 -50
  189. package/dist/chunks/patch-sAgVqjpx.mjs.map +0 -1
  190. package/dist/chunks/pause-BASBfKLO.mjs +0 -16
  191. package/dist/chunks/pause-BASBfKLO.mjs.map +0 -1
  192. package/dist/chunks/policy-Du7WVBFX.mjs +0 -139
  193. package/dist/chunks/policy-Du7WVBFX.mjs.map +0 -1
  194. package/dist/chunks/providers-Dx78imKj.mjs +0 -19
  195. package/dist/chunks/providers-Dx78imKj.mjs.map +0 -1
  196. package/dist/chunks/reconcile-BHn66X3C.mjs +0 -50
  197. package/dist/chunks/reconcile-BHn66X3C.mjs.map +0 -1
  198. package/dist/chunks/refactor-DV3RfGjk.mjs +0 -153
  199. package/dist/chunks/refactor-DV3RfGjk.mjs.map +0 -1
  200. package/dist/chunks/render-DyZr5Lgi.mjs +0 -53
  201. package/dist/chunks/render-DyZr5Lgi.mjs.map +0 -1
  202. package/dist/chunks/resume-GJQRb2Eb.mjs +0 -15
  203. package/dist/chunks/resume-GJQRb2Eb.mjs.map +0 -1
  204. package/dist/chunks/retro-Dr-2RTNN.mjs +0 -78
  205. package/dist/chunks/retro-Dr-2RTNN.mjs.map +0 -1
  206. package/dist/chunks/retry-CLrUem1H.mjs +0 -15
  207. package/dist/chunks/retry-CLrUem1H.mjs.map +0 -1
  208. package/dist/chunks/review-ZsBqp3vZ.mjs +0 -35
  209. package/dist/chunks/review-ZsBqp3vZ.mjs.map +0 -1
  210. package/dist/chunks/run-BGabwbDL.mjs +0 -109
  211. package/dist/chunks/run-BGabwbDL.mjs.map +0 -1
  212. package/dist/chunks/run-tool-C3rAv4XF.mjs +0 -26
  213. package/dist/chunks/run-tool-C3rAv4XF.mjs.map +0 -1
  214. package/dist/chunks/scan-C5uDr7Yq.mjs +0 -167
  215. package/dist/chunks/scan-C5uDr7Yq.mjs.map +0 -1
  216. package/dist/chunks/schema-Bq9qtgsd.mjs +0 -583
  217. package/dist/chunks/schema-Bq9qtgsd.mjs.map +0 -1
  218. package/dist/chunks/send-BdnJ85Nz.mjs +0 -19
  219. package/dist/chunks/send-BdnJ85Nz.mjs.map +0 -1
  220. package/dist/chunks/ship-BizfUe62.mjs +0 -140
  221. package/dist/chunks/ship-BizfUe62.mjs.map +0 -1
  222. package/dist/chunks/shutdown-BM92Iyv2.mjs +0 -15
  223. package/dist/chunks/shutdown-BM92Iyv2.mjs.map +0 -1
  224. package/dist/chunks/skip-DZG5kpcH.mjs +0 -18
  225. package/dist/chunks/skip-DZG5kpcH.mjs.map +0 -1
  226. package/dist/chunks/spec-C2h3U64g.mjs +0 -65
  227. package/dist/chunks/spec-C2h3U64g.mjs.map +0 -1
  228. package/dist/chunks/spec-path-tptqR7W8.mjs +0 -10
  229. package/dist/chunks/spec-path-tptqR7W8.mjs.map +0 -1
  230. package/dist/chunks/src-Bfr1yzsn.mjs +0 -1689
  231. package/dist/chunks/src-Bfr1yzsn.mjs.map +0 -1
  232. package/dist/chunks/src-CPW2_Ons.mjs +0 -5487
  233. package/dist/chunks/src-CPW2_Ons.mjs.map +0 -1
  234. package/dist/chunks/src-Cu3TxNob.mjs +0 -783
  235. package/dist/chunks/src-Cu3TxNob.mjs.map +0 -1
  236. package/dist/chunks/src-DNsLSxgm.mjs +0 -928
  237. package/dist/chunks/src-DNsLSxgm.mjs.map +0 -1
  238. package/dist/chunks/src-DbS9gkJy.mjs +0 -117
  239. package/dist/chunks/src-DbS9gkJy.mjs.map +0 -1
  240. package/dist/chunks/src-yi5whv3n.mjs +0 -2118
  241. package/dist/chunks/src-yi5whv3n.mjs.map +0 -1
  242. package/dist/chunks/status-SMjiOMYy.mjs +0 -29
  243. package/dist/chunks/status-SMjiOMYy.mjs.map +0 -1
  244. package/dist/chunks/tail-BuhT-2PH.mjs +0 -25
  245. package/dist/chunks/tail-BuhT-2PH.mjs.map +0 -1
  246. package/dist/chunks/update-BXIppsbi.mjs +0 -16
  247. package/dist/chunks/update-BXIppsbi.mjs.map +0 -1
  248. package/dist/chunks/update-pipeline-Du-Gu1Pl.mjs +0 -56
  249. package/dist/chunks/update-pipeline-Du-Gu1Pl.mjs.map +0 -1
  250. package/dist/cli.mjs +0 -186
  251. package/dist/cli.mjs.map +0 -1
@@ -0,0 +1,23 @@
1
+ ## Decisions — the transverse decision journal
2
+
3
+ `PIPELINE.md` is a **stack profile** (surfaces, commands, conventions); it says nothing about what this
4
+ project has *decided*. Without somewhere for those, every `/cohorte-spec` re-discovers or contradicts them.
5
+ `specs/_decisions.md` (from `core/templates/decisions.template.md`) is that place, deliberately small:
6
+
7
+ - **Append-only, one line per decision, ≤ ~160 chars:**
8
+ `- <YYYY-MM-DD> · <area> · <decision> — because <reason> · <origin>`, where `<origin>` is the
9
+ `feature_id` that decided it — or the originating command (`retro`) when no single feature owns
10
+ it. Reversal never edits a line:
11
+ append a superseding one (`· supersedes <date> <area>`) and move the old one to `## Superseded`. When
12
+ `## Live` passes ~100 lines, sweep the superseded ones down.
13
+ - **Written by** `/cohorte-spec` at freeze (the decisions that outlive the feature — typically 0–3 lines, and
14
+ zero is a normal outcome), `/cohorte-build` §1.5 when it adds or splits a surface, and
15
+ `/cohorte-retro` §4 when the human ratifies a convention rule (one line per adopted rule).
16
+ - **Read by the deciding stages only** — `/cohorte-brainstorm` (so the panel argues about the idea, not about
17
+ settled ground), `/cohorte-spec` (so a new spec does not silently un-decide something), `/cohorte-audit` (standing
18
+ decisions are part of the rulebook it audits against).
19
+ - **Never read by implementers or reviewers.** They work from the frozen contract, which already tells
20
+ them what to do; shipping them the rationale would cost `surfaces × dispatches` tokens per feature
21
+ for a fact they cannot act on. This is what keeps the journal cheap enough to be worth having.
22
+ - The `_` prefix is load-bearing: `/cohorte-doctor`, the `cohorte specs` scanner and the kanban backfill all skip
23
+ `specs/_*.md`, so the journal is never mistaken for a spec (no phantom card, no bogus stage).
@@ -0,0 +1,22 @@
1
+ ## Deferred findings — real, but not this feature's problem
2
+
3
+ `/cohorte-review` ends on "zero blocking findings", so everything non-blocking used to be discarded with the
4
+ report. A **deferred** finding is one the reviewer judges true and **out of this feature's scope**
5
+ (pre-existing code the staged diff never touched, adjacent debt the spec never claims to fix). The
6
+ review agent returns them in their own `## Deferred` section — never in `findings` — each carrying its
7
+ own out-of-scope reason.
8
+
9
+ - They count in **no** severity row, enter **no** verdict, and are **never** cross-checked: a deferred
10
+ item cannot cost a fix loop an iteration, and refuting one would spend an agent arguing about
11
+ something that cannot change the outcome.
12
+ - **Not deferrable, ever:** anything the diff touched or introduced, any spec violation, any security
13
+ issue on a path this feature adds, calls or modifies.
14
+ - `/cohorte-review` §3.5 routes them, **on every verdict**, into `specs/refactor-backlog.md` under the
15
+ `## <domain>` heading of the owning surface, tagged `deferred:<feature_id>` — the same grouping
16
+ `/cohorte-audit` writes, so `/cohorte-refactor <domain>` picks them up with no extra plumbing. Never into the spec's
17
+ `## Remediation`, which is what `/cohorte-fix` re-dispatches.
18
+ - `/cohorte-audit` (both paths) **rewrites only the sections of the domains it audited**, carrying their
19
+ open `deferred:` items over, and leaves every other domain's section untouched — overwriting the
20
+ file with one run's items is the one way they silently vanish.
21
+ - The verdict JSON carries `deferred: <n>` (informational, outside `blocking`), so a driver can name
22
+ them in its closing line without reading a report.
@@ -0,0 +1,20 @@
1
+ ## Feature diff — what "the feature changed" means
2
+
3
+ Every diff the pipeline reads — the review's changed-path list and per-surface hunks, an
4
+ implementer's self-diff, the freshness digest `/cohorte-review` stamps and `/cohorte-ship` re-checks —
5
+ comes from ONE shipped script, `<core>/pipeline/scripts/feature-diff.sh`, never a bare `git diff`:
6
+
7
+ ```
8
+ feature-diff.sh --default <default_branch> (--numstat|--name-only|--patch|--digest|--base-only) [-- <pathspec>…]
9
+ feature-diff.sh --base <sha> (same modes)
10
+ ```
11
+
12
+ - **Untracked files are in.** Feature work stays uncommitted until `/cohorte-ship`, and `git diff <ref>`
13
+ never shows an untracked file — new modules escaped review, and an adds-only feature reviewed as an
14
+ empty diff that scored SHIP. The script diffs a **throwaway index** (seeded from the real one,
15
+ `git add -A` on the copy); the human's index and what they staged are never touched.
16
+ - **The base is the merge-base**, not the default branch's tip (which blames the feature for every
17
+ file `main` gained since). Local `<branch>` and `origin/<branch>` are both tried; the newer
18
+ merge-base wins (fleet worktrees branch off the remote ref).
19
+ - **`.claude/` and `specs/` are always excluded** (the pipeline's own writes), gitignored files never
20
+ enter. Exit 3 = the base cannot be resolved: the caller stops — it never falls back to `git diff`.
@@ -0,0 +1,95 @@
1
+ ## Kanban — mirroring the pipeline onto an Obsidian board
2
+
3
+ An **optional, user-scoped** mirror of the dev flow: each pipeline stage moves a card across an
4
+ [Obsidian Kanban](https://github.com/mgmeyers/obsidian-kanban) board, one board per project. Config
5
+ lives in the consolidated global config `<config>` §`kanban` (NOT in
6
+ `PIPELINE.md` — the board path points at the user's personal vault, so it is machine-specific and must
7
+ not be committed). Everything below **no-ops silently** when the config is absent, `kanban.enabled` is
8
+ false, no board is configured for the current project, or the board file is missing — the pipeline never
9
+ blocks on the board.
10
+
11
+ **Config & board resolution.** `kanban.boards` is keyed by the project's `PIPELINE.md` `name`. To resolve
12
+ the current project's board: read `name` from `PIPELINE.md`, look up `kanban.boards[name]`. Found ⇒ the
13
+ board file is `<obsidian.vault_path>/<boards[name].board>`, its columns are `boards[name].columns` if
14
+ present else `kanban.columns`. Not found ⇒ kanban off for this project.
15
+
16
+ **Card format.** A card is a Kanban list item under a `## <column>` heading:
17
+ `- [ ] <human title> #<feature_id>`. The `#<feature_id>` tag is the join key between a card and its
18
+ `specs/<feature_id>.md`; it is how every stage finds *its* card (Grep the board for `#<id>`). Free-text
19
+ notes a human writes as sub-bullets under an Ideas card are seed context for `/cohorte-brainstorm`. Never touch
20
+ the trailing `%% kanban:settings … %%` block or the `kanban-plugin: board` front-matter.
21
+
22
+ Once shipped, `/cohorte-ship` appends the **PR number** to the card — `- [ ] <title> #<feature_id> — PR #<num>`.
23
+ The bare `#<num>` is what a board reader renders as a clickable link to the GitHub PR, so `/cohorte-ship` always
24
+ writes it when a PR was actually created.
25
+
26
+ **Move a card (the core op).** One call — the script does resolution AND the move outside the
27
+ agent's context (find, dedupe, sub-notes carried along, settings block preserved):
28
+
29
+ ```
30
+ <core>/pipeline/scripts/kanban-move.sh auto <id> <stage> [--pr <num>] [--title <title>]
31
+ ```
32
+
33
+ It creates
34
+ the card in the target column when none exists, keeps the first and drops duplicates, and appends
35
+ ` — PR #<num>` with `--pr`.
36
+
37
+ **`auto` is not a convenience, it is the contract.** It reads `name` from `PIPELINE.md`, then
38
+ `kanban.enabled` / `obsidian.vault_path` / `boards[name]` from `<config>`
39
+ (override with `COHORTE_CONFIG`, or skip the profile with `--project <name>`), and it maps the
40
+ **stage key** (`ideas` · `brainstorm` · `spec` · `ready` · `building` · `review` · `fix` · `ship` ·
41
+ `shipped`) to that board's heading through `boards[name].columns` → `kanban.columns` → the built-in
42
+ default. An explicit `<board.md>` path and a literal heading both still work, for one-off and
43
+ non-pipeline moves.
44
+
45
+ **Never conclude "no board is configured" without running it.** The command that resolves nothing
46
+ prints `kanban: <reason>` — naming the missing link (no config file, `enabled: false`, no entry for
47
+ this project, vault unset, board file gone) — and exits **0**. A configured board that cannot be
48
+ moved is loud instead: exit 2 on usage, exit 3 on an unknown column — or on an explicit
49
+ `<board.md>` path that does not exist (under `auto`, a configured board file that is gone is one of
50
+ the `kanban: board file not found` no-ops above, exit 0). Both readings are printed, so a caller
51
+ reports which one it got. This exists because inference was the
52
+ actual failure mode: with only "no-op silently if no board" to go on, a fresh phase session (every
53
+ phase runs after a `/clear`) decided there was no board without ever opening the config, and cards
54
+ stopped moving mid-pipeline while every command still reported success.
55
+
56
+ **Fallback when the script is absent** (older core): do it by hand, but never read the whole board
57
+ into context — it grows with every feature ever tracked: `grep -n` for `#<id>` and the `## ` headings
58
+ to locate lines, then use offset-limited Reads + targeted Edits around the matches. Either way: one
59
+ card per `#<id>`, whole line moved tag-preserved, card created in the target column if missing.
60
+
61
+ **Tag before you move.** The join key is the `#<id>` tag, and an **Ideas** card a human typed by hand
62
+ does not have one. Moving it first finds nothing, creates a second card, and strands the original in
63
+ Ideas — so `/cohorte-brainstorm` appends the tag to the picked line before its first move.
64
+
65
+ **Stage → column**, used both by each pipeline command (to move its card live) and by backfill:
66
+
67
+ | Pipeline moment | Column |
68
+ | --------------------------------------- | --------------- |
69
+ | human drops a raw idea (manual) | `ideas` |
70
+ | `/cohorte-brainstorm` picks it up | `brainstorm` |
71
+ | `/cohorte-spec` opens (draft) | `spec` |
72
+ | `/cohorte-spec` freezes (`status: frozen`) | `ready` |
73
+ | `/cohorte-patch` triages / freezes | `spec` → `ready` (card titled `[patch] <title>`, tag `#patch-<slug>`) |
74
+ | `/cohorte-refactor` freezes its round spec | `ready` (card titled `[refactor] <domains>`, tag `#refactor-<domains>-<date>`) |
75
+ | `/cohorte-build` | `building` |
76
+ | `/cohorte-review` | `review` |
77
+ | `/cohorte-fix` | `fix` |
78
+ | loop workflow, per phase (`in-progress`) | `building` → `review` → `fix`, as each phase starts |
79
+ | a round gave up (`blocked`) | `fix` |
80
+ | `/cohorte-ship` starts | `ship` |
81
+ | PR opened (`status: shipped`) | `shipped` (+ `PR #<num>` on the card) |
82
+
83
+ **Backfill / sync from specs (reconcile).** `specs/*.md` is the source of truth. For each spec, read its
84
+ `feature_id` (front-matter or filename) and `status`, map `status`→column — `frozen`→`ready`,
85
+ `in-progress`→`building` (the phase is unknown from the status alone; the next live move corrects it),
86
+ `in-review`→`review`, `blocked`→`fix`, `shipped`/`merged`/`abandoned`→`shipped`, anything else / a spec with no
87
+ status→`spec` — then **full
88
+ sync**: card absent ⇒ add it in that column; card present ⇒ **move it** to that column so the board
89
+ always reflects the specs (this repositions cards the human may have moved by hand). Report cards
90
+ added vs. moved vs. already-correct.
91
+
92
+ **Create a board.** When linking a project with no board file yet: write
93
+ `<obsidian.vault_path>/<folder>/Tasks.md` with the `kanban-plugin: board` front-matter, one `## <heading>`
94
+ per configured column in pipeline order, and the closing `%% kanban:settings %%` block
95
+ (`{"kanban-plugin":"board","list-collapse":[false,…]}` with one `false` per column).
@@ -0,0 +1,23 @@
1
+ ## Measuring cost — what's slow vs what's expensive
2
+
3
+ `pipeline-metrics.jsonl` records **wall-clock seconds** per phase batch (§Specialization, `<core>/pipeline/schema/specialization.md`) — it tells you
4
+ what's SLOW. Tokens are recorded only where they can be read honestly: the **workflow paths**
5
+ (`loop.js`, `review.js`) stamp an approximate `tokens` field per batch from the runtime's own
6
+ counter (`budget.spent()` deltas), and the loop's return carries a per-round breakdown in its
7
+ `history`. The **conversational** commands still record none — a lead cannot reliably read a
8
+ subagent's token count, and a guessed number is worse than a missing one. `cohorte metrics` sums
9
+ whatever is stamped (a token-less line aggregates as 0, rendered as absent, never as "free").
10
+ For exact spend, use Claude Code's own accounting:
11
+
12
+ - **`/cost`** (built-in, zero setup) — reports per-**subagent** and per-**slash-command** share of your usage
13
+ over the last 24 h / 7 d (e.g. _"Top subagents: frontend 7 %, backend 4 % · Top skills: /cohorte-build 1 %,
14
+ /cohorte-review 1 %"_). That IS the per-phase ledger — approximate (share-of-total, machine-local, not exact
15
+ tokens). Read it to see which surface/command actually dominates the bill before you tune a `model` tier.
16
+
17
+ **Lead context discipline — the silent bill.** The lead session's conversation history is re-sent as
18
+ input on EVERY turn; a session that spans spec→build→review→fix without clearing re-pays the
19
+ accumulated spec walk-through, handoffs, and reports on each turn. The pipeline is built so this is
20
+ never necessary: every phase handoff (spec, contract, diff, staged reports) lives on disk, so `/clear`
21
+ at each phase boundary is always safe — each command's closing line recommends it. Corollaries the
22
+ commands enforce: never paste a diff into a dispatch (agents compute their own, scoped); never echo a
23
+ staged report or design brief into chat; redirect bulky command output to a file and grep it.
@@ -0,0 +1,21 @@
1
+ ## Output discipline — quiet commands
2
+
3
+ A test runner's default output is written for a human watching a terminal: one line per test, banners,
4
+ timing tables. An agent pays input price for every one of those lines, on every turn they survive in its
5
+ context. The profile therefore stores **two forms of each noisy command**:
6
+
7
+ - `test_cmd` / `lint_cmd` — the full form, for a human running it by hand.
8
+ - `test_quiet_cmd` / `lint_quiet_cmd` (per surface) and `commands.test_quiet` / `commands.lint_quiet`
9
+ (repo-wide) — the **bridled** form agents actually execute: dot/failures-only reporter
10
+ (`--reporter=dot`, `--quiet`, `-q`, `--silent`, framework equivalent) so a green run costs lines,
11
+ not pages, and a red run prints only the failures.
12
+
13
+ Rules for every consumer (implementers, preflight, `/cohorte-audit` gates, workflow agents):
14
+
15
+ 1. Run the quiet variant when set.
16
+ 2. Quiet variant empty/absent (older profile) ⇒ run `<full cmd> 2>&1 | tail -40` — never the bare
17
+ command into your context.
18
+ 3. Need the full log? Redirect it to a file and grep it; never print it.
19
+
20
+ `/cohorte-init-pipeline` **asks** for these variants (detected defaults offered first) instead of silently
21
+ storing a bare `pnpm test` as the thing agents execute; `/cohorte-update-pipeline` tops up older profiles.
@@ -0,0 +1,81 @@
1
+ ## Preflight — the deterministic phase gate
2
+
3
+ `/cohorte-review` starts by running `pipeline/scripts/preflight.sh` — a plain shell script (no
4
+ agent) that executes the profile's mechanical checks in order (typecheck → lint → tests, quiet
5
+ variants, then any `commands.security` scans — below) with all output redirected to `specs/reports/<id>.preflight.txt`:
6
+
7
+ - **Any check red** ⇒ the script prints the last 40 lines raw and exits 1. The command **aborts
8
+ there: zero agents are spawned.** A reviewer dispatched onto code that doesn't compile burns its
9
+ whole run rediscovering what `tsc` already printed for free — the failure goes straight to the
10
+ human (or `/cohorte-fix`) instead.
11
+ - **All green** ⇒ the script stamps `<state>/preflight.ok` (`<epoch> <HEAD sha> <tree digest>` —
12
+ local and **gitignored**; a versioned stamp describes the tree *before* its own commit and rides
13
+ into every clone and worktree, which breaks the gate both ways).
14
+
15
+ `hooks/gate.py` enforces the stamp as a **phase gate** (the `preflight` block of `gate-config.json`,
16
+ generated from `gate.preflight`): an `Agent` (formerly `Task`) dispatch of a listed `subagent_type` (default
17
+ `cohorte-review`) with a missing/stale stamp — older than `max_age_minutes`, or the digest no longer
18
+ matches the working tree (`.claude` and `specs` excluded, so the pipeline's own writes and a
19
+ commit of already-verified code do not invalidate it) — gets an
20
+ "ask", so a lead can't accidentally skip the gate but a human can consciously override it. The gate
21
+ hook fires for **every** agent in the session, including subagents spawned by the Workflow runtime
22
+ (they run in `acceptEdits` whatever the session mode — Write/Edit auto-approved — but Bash and Agent
23
+ still pass through hooks). In `bypassPermissions` (headless runs) every gate "ask" is escalated to a
24
+ hard deny, because nobody is there to answer a prompt.
25
+
26
+ ### Security scans — `commands.security`
27
+
28
+ `commands.security: []` is a list of shell commands, empty by default. The preflight runs them
29
+ **after** typecheck → lint → tests, in the same script call, into the same report. They are just
30
+ more arguments to `preflight.sh`. The caller passes a no-op marker, `: cohorte-security-scans`,
31
+ ahead of them. The marker shows up in the report as the line `$ : cohorte-security-scans`, which
32
+ opens the **security section**.
33
+
34
+ - **A scan is a gate like any other check.** A non-zero exit means a dependency advisory at the
35
+ command's threshold or a secret in the feature's diff. It turns the preflight red, the review
36
+ aborts, and no agent is spawned. So pick thresholds that the default branch passes today.
37
+ Otherwise every review is blocked by debt the feature didn't add.
38
+ - **Green scans still leave output behind**, such as advisories below the threshold. The
39
+ `cohorte-review` agent's security pass reads the security section, found by grepping for the
40
+ marker. The threshold is the project's choice, so nothing below it blocks. An advisory on a
41
+ dependency that the reviewer's own staged diff adds or bumps becomes one non-blocking
42
+ `quality` finding. Advisories on untouched dependencies are ignored: they are neither findings
43
+ nor backlog items.
44
+ - **Quoting.** Pass each command as one argument. Single-quote any command that contains `$`,
45
+ a backtick or `\` (a `'` inside becomes `'\''`). Inside double quotes the calling shell would
46
+ expand the command's own variables before `preflight.sh` ever ran it.
47
+ - **A command path must be static.** A command name computed at run time (`"$CORE/x.sh"`,
48
+ `"${CLAUDE_CONFIG_DIR:-…}/…"`) gets **ask** from the gate hook, and ask becomes deny in
49
+ headless runs. Write `~/.claude/cohorte/…`. If `CLAUDE_CONFIG_DIR` is set, write its literal
50
+ value instead.
51
+ - **Secret scans target the feature only, never history.** Feature work is uncommitted until
52
+ `/cohorte-ship`, so `gitleaks git`, `trufflehog git --since-commit …` and any other log-based
53
+ scan see none of it, and a whole-history scan reports every old leak on every review. Scan the
54
+ `feature-diff.sh --patch` output (`<core>/pipeline/schema/feature-diff.md`): untracked files are
55
+ included, the base is the merge-base, and `.claude/` and `specs/` are excluded. Keep only the
56
+ added lines (`grep '^+'`), so that a feature *removing* a secret does not fail. Write the patch
57
+ only under `specs/reports/`: it is gitignored and excluded from both the stamp digest and the
58
+ feature diff, so it changes neither. The recipe deletes it on a pass. On a hit it keeps
59
+ `security-scan.patch` and `.patch.added`, because the scanner read only the added lines and its
60
+ line numbers point into `.added`. Use the patch to find the file. Never pipe `feature-diff.sh`
61
+ straight into the scanner. In `sh`, a pipeline's status is its last command's, so an exit 3
62
+ (no base) would hand the scanner an empty input that passes.
63
+
64
+ **Detected defaults** `/cohorte-init-pipeline` proposes, one per detected manifest or tool.
65
+ Never add one silently. `<default_branch>` is filled in at init.
66
+
67
+ | Detected | Command | Threshold / scope |
68
+ | --- | --- | --- |
69
+ | `package-lock.json` | `npm audit --omit=dev --audit-level=high` | production deps, high+ |
70
+ | `pnpm-lock.yaml` | `pnpm audit --prod --audit-level high` | production deps, high+ |
71
+ | `yarn.lock` (Yarn ≥ 2) | `yarn npm audit --all --recursive --environment production --severity high` | all workspaces, transitive, production, high+ |
72
+ | `yarn.lock` (Yarn 1) | `yarn audit --groups dependencies --level high` | the exit code is a severity bitmask, so check it on the project before relying on it |
73
+ | `requirements*.txt` / `pyproject.toml` | `pip-audit -r requirements.txt` (or `pip-audit` in the project env) | no severity filter, so any known vuln is red |
74
+ | `go.mod` | `govulncheck ./...` | only vulnerabilities the code actually reaches |
75
+ | `Cargo.lock` | `cargo audit` | needs `cargo install cargo-audit` |
76
+ | `gitleaks` on PATH | `P=specs/reports/security-scan.patch; ~/.claude/cohorte/pipeline/scripts/feature-diff.sh --default <default_branch> --patch > "$P" \|\| exit 2; grep '^+' "$P" > "$P.added"; gitleaks stdin --redact --no-banner < "$P.added" && rm -f "$P" "$P.added"` | the feature diff only, secrets redacted from the report |
77
+ | `trufflehog` on PATH | the same line with `trufflehog stdin --fail --no-update --results=verified,unknown < "$P.added"` in place of `gitleaks …` | `--fail` exits 183 on a result. Without `--fail` it always exits 0 |
78
+
79
+ Offer at most one secret scanner. A scanner that isn't installed is not proposed. Say how to
80
+ install it, and let the human decide. The release agent's own check (no `.env` or credential
81
+ file staged at ship) still applies; these scans don't replace it.
@@ -0,0 +1,103 @@
1
+ # PIPELINE.md profile — field reference
2
+
3
+ `/cohorte-init-pipeline` fills the `yaml pipeline-profile` block in `PIPELINE.md` (from
4
+ `PIPELINE.template.md`) plus the prose sections. This documents every field and how the
5
+ generic pipeline uses it, so a stateless agent can read/regenerate the profile correctly.
6
+
7
+ ## `yaml pipeline-profile` block
8
+
9
+ | Field | Type | Used by | Meaning |
10
+ | ------------------------------------ | ------------ | --------------------------------- | ------------------------------------------------------------- |
11
+ | `name` | string | all | Project name, used in agent prose + commit scopes. |
12
+ | `one_liner` | string | brainstorm/spec | One-sentence product description. |
13
+ | `ui_language` | string | implementer, review | Language of ALL user-facing copy. |
14
+ | `package_manager` | enum | all | `pnpm`/`npm`/`yarn`/`bun`/`pip`/`cargo`/`go`. |
15
+ | `vcs.host` | enum | release | `github`→use `gh`; else emit compare URL. |
16
+ | `vcs.remote` | string | release | `owner/repo` for the PR/compare URL. |
17
+ | `vcs.default_branch` | string | build, review, release | Base branch for diffs + PRs. |
18
+ | `vcs.feature_branch_prefix` | string | ship, isolation script | `feature/` → branch `feature/<id>`. |
19
+ | `vcs.patch_branch_prefix` | string | ship | Same, for a `kind: patch` spec: `fix/` → branch `fix/patch-<slug>`. Optional — a profile that predates it falls back to `fix/`. |
20
+ | `project.kind` | enum | init, spec, review | What the repo delivers: `web`/`api`/`cli`/`library`/`mobile`/`data`/`other`. Selects the spec's DoD defaults, the review's kind-specific checks and whether the design step applies (`<core>/pipeline/schema/project-kinds.md`). Optional — absent ⇒ `web` (top-up default). |
21
+ | `repo.layout` | enum | build, audit | `monorepo` (many surfaces) or `single`. |
22
+ | `repo.workspace_tool` | enum | audit | `turborepo`/`nx`/`none`. |
23
+ | `retrieval.provider` | enum | init, update-pipeline, implementer | `serena` (default) / `graphify` / `none` — see §Code retrieval (`<core>/pipeline/schema/retrieval.md`). |
24
+ | **`surfaces[]`** | list | **build, review, refactor, init** | One per independently-built area. Grows via reconcile (`<core>/pipeline/schema/rendering.md`). |
25
+ | `surfaces[].key` | string | build | Short id + review scope. |
26
+ | `surfaces[].path` | string | implementer | The ONLY tree that surface's agent may touch. |
27
+ | `surfaces[].owns_also` | list | hooks/gate.py | Optional. Extra root-relative paths (file, directory, or glob where `*` matches `/`) this surface's agent may also write, e.g. `[db/migrations]`. Default `[]`. |
28
+ | `surfaces[].label` | string | build, init (`<SURFACE_LABEL>`) | Human label + framework, e.g. `frontend (React)`. |
29
+ | `surfaces[].agent` | string | build (`subagent_type`) | Rendered agent file name. |
30
+ | `surfaces[].tools` | list | init | Frontmatter `tools:` for the rendered agent. |
31
+ | `surfaces[].model` | enum | init (`<SURFACE_MODEL>`) | Frontmatter `model:` tier — `sonnet`/`haiku`/`inherit`. Default `sonnet` (implementers mostly apply a frozen contract — far cheaper than the Opus lead the dispatcher runs on, and Sonnet handles it well); `haiku` for purely mechanical surfaces (scaffolding); `inherit` only for surfaces with real design decisions worth the lead's model. |
32
+ | `surfaces[].*_cmd` | string | implementer | test/lint/format/typecheck/build commands. |
33
+ | `surfaces[].test_quiet_cmd` `.lint_quiet_cmd` | string | implementer, preflight, workflows | Bridled variants agents actually run (dot reporter / `--quiet` / failures-only). `""` ⇒ `<cmd> 2>&1 \| tail -40`. See §Output discipline (`<core>/pipeline/schema/output-discipline.md`). |
34
+ | `surfaces[].uses_design` | bool | build, frontend | Whether this surface consumes designs. |
35
+ | `contract.enabled` | bool | build | `false` ⇒ skip contract authoring (§2 of /cohorte-build). |
36
+ | `contract.mechanism` | enum | build, lead | `shared-types-zod`/`openapi`/`protobuf`/`json-schema`/`none`. |
37
+ | `contract.path` `.ext` `.index` | string | build | Where `<feature_id>` contract is authored + barrel. |
38
+ | `contract.authored_by` | const `lead` | build | Implementers import it read-only, never edit. |
39
+ | `ownership.enforce` | bool | hooks/gate.py | Default `true`: the gate denies a surface agent's Write/Edit outside its `path` + `owns_also` + `ownership.shared_writable` and any write to `contract.path`/`.index`. For Bash it is best effort. The lead and non-surface agents are never restricted. `false` turns it off. Read from `.claude/profile.json`, so it is inert until `cohorte sync` writes that file. Inert also when that file is unreadable. |
40
+ | `ownership.shared_writable` | list | hooks/gate.py | Root-relative paths every surface agent may write, typically lockfiles (`pnpm-lock.yaml`). Same forms as `owns_also`. Default `[]`. |
41
+ | `release_notes.enabled` | bool | ship | `false` ⇒ skip note authoring (§2b of /cohorte-ship). See §Release notes (`<core>/pipeline/schema/release-notes.md`). |
42
+ | `release_notes.tool` | enum | ship | `changesets`/`none` — what consumes the file. |
43
+ | `release_notes.dir` `.filename` | string | ship | Where the per-feature note is authored, e.g. `.changeset/<feature_id>.md`. |
44
+ | `release_notes.anchor_package` | string | ship | Sole key in the note's front-matter; a lockstep/`fixed` group propagates the bump. |
45
+ | `release_notes.language` | string | ship | Language of the note's prose — usually `ui_language`. |
46
+ | `release_notes.forbid_levels` | list | ship | Bump levels project policy refuses, e.g. `[major]` while `0.x`. |
47
+ | `release_notes.empty_cmd` | string | ship | Escape hatch when no version should move; `""` if none. |
48
+ | `release_notes.ci_job` | string | ship | CI job that fails on a missing note — lets §5 name the red check. |
49
+ | `release_notes.guidance` | string | ship | Project policy the lead follows when picking the bump + writing the prose. |
50
+ | `commands.*` | string | all | Repo-wide install/dev/lint/format/typecheck/test + migrate. |
51
+ | `commands.test_quiet` `.lint_quiet` | string | review, audit, workflows | Repo-wide bridled variants — what the `/cohorte-review` pre-flight runs. Same fallback as the per-surface ones. |
52
+ | `commands.security` | list | review, workflows (preflight) | Dependency audits and a feature-diff secret scan, run by the `/cohorte-review` pre-flight after typecheck/lint/tests. A red scan aborts the review, and the reviewer reads the green output. Default `[]`. A single string is read as a one-item list. Recipes and rules (static paths, feature diff only): `<core>/pipeline/schema/preflight.md` §Security scans. |
53
+ | `commands.migrate_down` | string | verify, revert | Undo the last migration on the **dev** DB. `/cohorte-verify` checks down-then-up with it; `/cohorte-revert` runs it (`commands.rollback` is read as an alias when this is absent). `""` ⇒ rollback not verified; a command in `gate.deny` is never run. |
54
+ | `commands.dev_ready` | string | verify | Says `commands.dev` is up: an http(s) URL answering 2xx/3xx, or a shell probe exiting 0. `dev` without it doesn't count as runtime-verifiable. |
55
+ | `commands.smoke` `.e2e` | string | verify | Quick checks / the end-to-end suite (e.g. Playwright), run against the started app. All runtime commands `""` ⇒ verify skipped silently. See `<core>/pipeline/schema/verify.md`. |
56
+ | `verify.enabled` | bool | verify, ship | `false` ⇒ `/cohorte-verify` is a no-op and `/cohorte-ship` never asks about it. Default `true`. |
57
+ | `verify.db` | enum | verify, revert | `local` (default — the dev DB is yours) / `shared` (others use it ⇒ migrations refused unless `isolation.db_per_worktree`, in a feature worktree). |
58
+ | `verify.ready_timeout_seconds` `.check_timeout_seconds` | number | verify | Ready-probe window (default 90) and per-check limit (default 600). |
59
+ | `verify.screenshots` | enum | verify | `auto` (default — when `node_modules/.bin/playwright` resolves; never `npx`-installs) / `off`. |
60
+ | `verify.surfaces.<key>` | map | verify | Optional per-surface hints: `base_url`, `paths[]` (screenshotted), `smoke` (an extra check `smoke:<key>`). Only touched surfaces are used. |
61
+ | `rbac.enabled` | bool | brainstorm, review | Toggle RBAC personas + authz audit. |
62
+ | `rbac.hierarchy` | list | review | Highest→lowest role list. |
63
+ | `design.enabled` | bool | build, frontend, align-ds | `false` ⇒ design steps are no-ops. |
64
+ | `design.provider` | enum | frontend, align-ds | `claude-design`/`figma`/`none`. |
65
+ | `design.design_system_project` | id | align-ds, frontend | UI-kit source of truth. |
66
+ | `design.design_project` | id | build, frontend | Legacy fallback for bare-filename `design_files` only; default `none`. New specs use full `…/design/p/<projectId>?file=<file>` links that carry their own project + page (nothing to go stale on a DS rebuild). |
67
+ | `design.snapshot_dir` | path | align-ds | Committed DS snapshot for diffing. |
68
+ | `design.ui_kit_path` `.tokens_path` | path | align-ds, frontend | Where the kit + tokens live in code. |
69
+ | `isolation.enabled` | bool | new-feature script | `false` ⇒ build in main checkout. |
70
+ | `isolation.db_per_worktree` | bool | new-feature script | Create `<name>_<id>` DB per worktree. |
71
+ | `isolation.db_name_pattern` | string | new-feature script | `<name>_<id>`. |
72
+ | `isolation.port_base` | map | new-feature script | `api`/`web` base ports; +slot per worktree. |
73
+ | `isolation.compose_file` `.registry` | path | new-feature script | Docker stack + slot registry. |
74
+ | `gate.deny[]` | list | hooks/gate.py, settings | Command substrings hard-denied, on any branch. |
75
+ | `gate.ask[]` | list | hooks/gate.py, settings | Command substrings that require confirm, on any branch. |
76
+ | `gate.ask_on_default_branch[]` | list | hooks/gate.py | Confirm ONLY on `default_branch`; free on feature branches. |
77
+ | `gate.default_branch` | string | hooks/gate.py | Protected branch (default `main`); gate resolves via git. |
78
+ | `gate.preflight.enabled` | bool | hooks/gate.py, review | Phase gate: review dispatches need a fresh preflight stamp. See §Preflight (`<core>/pipeline/schema/preflight.md`). |
79
+ | `gate.preflight.agents[]` | list | hooks/gate.py | `subagent_type`s the stamp gates (default `[cohorte-review]`; `review` still accepted). |
80
+ | `gate.preflight.max_age_minutes` | number | hooks/gate.py | Stamp freshness window (default 30). |
81
+
82
+ ## Prose sections
83
+
84
+ - **Conventions** — per-surface rules the implementer follows and review audits.
85
+ - **Testing** — the TDD contract per surface (what a test must cover, DB isolation).
86
+ - **Design brief note** — feeds `/cohorte-spec` §8 and the Claude Design step.
87
+ - **Personas** — the `/cohorte-brainstorm` panel; include one per RBAC role when `rbac.enabled`.
88
+
89
+ ## How the pieces reference this file
90
+
91
+ - **Agents** (`implementer`, `review`, `release`) are told at dispatch: _read `PIPELINE.md`
92
+ §Commands / §Conventions / §Surfaces first._ They have `Read`, so they load it live.
93
+ - **Commands** (`/cohorte-build`, `/cohorte-review`, …) parse the `yaml pipeline-profile` block to know how
94
+ many surfaces to dispatch, the contract mechanism, the commands, and the capability flags.
95
+ - **`<state>/profile.json`** is this block parsed to JSON by `<sync>` (committed, regenerated by
96
+ every sync — so every command that edits the block runs `<sync>` after it). Agents that need only
97
+ the machine block — the implementers, `cohorte-review`, `cohorte-release`, the workflows'
98
+ `cohorte-profile-reader` — read it instead of `PIPELINE.md`, falling back to the fenced block when
99
+ it is absent. `cohorte doctor` warns when it no longer matches `PIPELINE.md`.
100
+ - **Hook** (`gate.py`) reads `gate.deny`/`gate.ask`/`gate.ask_on_default_branch`/`gate.default_branch`
101
+ from a generated `<state>/gate-config.json`. The last two make git + docker free on feature branches
102
+ but confirm-gated on the default branch (branch resolved at run time via `git rev-parse`).
103
+ - **Scripts** (`new-feature.sh`) read the `isolation` block (rendered in at init).
@@ -0,0 +1,89 @@
1
+ ## Project kinds — `project.kind` presets
2
+
3
+ `project.kind` (`web` · `api` · `cli` · `library` · `mobile` · `data` · `other`) tells the pipeline
4
+ what the repo **delivers**, so the spec's DoD, the review's checks and the design step fit it. It is
5
+ detected by `/cohorte-init-pipeline` (01) and confirmed there (02). **Absent ⇒ `web`** — the
6
+ behaviour every profile had before the field existed. The spec **`kind`** (`feature` · `patch` ·
7
+ `refactor`, front-matter) is a different axis: what one change *is*, not what the repo is.
8
+
9
+ **Read only your section.** `/cohorte-spec` (§9 defaults) and the review agent (checks) Grep `^## `
10
+ here and Read the one `## <kind>` range. On `web` the review agent does not open this file at all.
11
+
12
+ ### Detection (init 01) — first match wins, top to bottom
13
+
14
+ | signal | kind |
15
+ | --- | --- |
16
+ | `react-native`, `expo`, `*.xcodeproj` / `Package.swift` app target, Android `build.gradle` app, `flutter` | `mobile` |
17
+ | a browser UI framework (`react-dom`, next, vue, nuxt, svelte, angular…) in any app surface — even beside a `bin` or a server | `web` |
18
+ | `dbt_project.yml`, Airflow/Dagster/Prefect DAGs, a notebooks-first tree, warehouse SQL as the product | `data` |
19
+ | a `bin` entry (`package.json` `bin`, `[project.scripts]`, `cmd/*`, `[[bin]]`) and no UI deps | `cli` |
20
+ | a published package (`exports`/`main` + no `private: true`, a PyPI/crates manifest) with no app entry | `library` |
21
+ | a server framework (express, fastify, nestjs, adonis, django, fastapi, rails, net/http) and no UI | `api` |
22
+ | none of the above | `other` |
23
+
24
+ A mixed monorepo resolves to the **first row it matches** (an app with a UI is `web` even when it also
25
+ ships a CLI; web + mobile apps ⇒ `mobile`, whose checks include web's). Mobile comes first because
26
+ every react-native app also depends on `react`. The kind also decides two init defaults: where the design row below says **no**, init
27
+ sets `design.enabled: false` and every `uses_design: false`, and skips the design question; where
28
+ RBAC is **no**, it defaults `rbac.enabled: false`. The build gate, `/cohorte-align-ds` and spec §8
29
+ already key off those flags — nothing else reads the kind for design.
30
+
31
+ | kind | design step | RBAC / mobile-first checks (review 5–6) |
32
+ | --- | --- | --- |
33
+ | `web` | yes | RBAC if `rbac.enabled`; mobile-first if `uses_design` |
34
+ | `mobile` | yes | RBAC if `rbac.enabled`; screen-size + platform layout if `uses_design` |
35
+ | `api` | no | RBAC if `rbac.enabled`; no mobile-first |
36
+ | `cli` · `library` · `data` · `other` | no | neither |
37
+
38
+ ## web
39
+
40
+ - **DoD:** the spec template's five lines as they are — nothing to add.
41
+ - **Review:** checks 5–6 exactly as the agent states them. No extra checks.
42
+
43
+ ## api
44
+
45
+ - **DoD** (add): `- [ ] No breaking change to an existing endpoint (removed field, narrowed type, new required input, changed status) — or the version bump / deprecation is stated`
46
+ · `- [ ] Error responses follow the existing envelope and status conventions`.
47
+ Drop the mobile-first line.
48
+ - **Review:** skip 6. Add **API compatibility** — a diff that removes or renames a response field,
49
+ tightens a request type, adds a required parameter or changes a status code on an existing route is
50
+ a CRITICAL `spec-violation` unless the spec states the break.
51
+
52
+ ## cli
53
+
54
+ - **DoD** (add): `- [ ] --help text covers every new flag/subcommand` · `- [ ] Exit codes documented and tested (0 success, non-zero per failure class)`
55
+ · `- [ ] Results on stdout, diagnostics on stderr — nothing else on stdout`. Drop the mobile-first line.
56
+ - **Review:** skip 5–6. Add **CLI discipline** — a new flag missing from `--help`, an error path that
57
+ exits 0, or log/progress output on stdout is a HIGH `quality` finding; a renamed or removed flag is a
58
+ CRITICAL break unless the spec states it.
59
+
60
+ ## library
61
+
62
+ - **DoD** (add): `- [ ] Every new public export documented (doc comment or README)` · `- [ ] Semver impact stated (patch / minor / major)`
63
+ · `- [ ] No breaking change to the public API without a major bump`. Drop the mobile-first line and
64
+ the `ui_language` line.
65
+ - **Review:** skip 5–6. Add **public-API compatibility** — a removed/renamed export, a narrowed
66
+ parameter type or a changed return shape is a CRITICAL `spec-violation` unless the spec states a
67
+ major bump; an undocumented new export is MEDIUM.
68
+
69
+ ## mobile
70
+
71
+ - **DoD** (add): `- [ ] Platform matrix stated and covered (iOS / Android, min OS versions)` · `- [ ] Offline / flaky-network behaviour defined`
72
+ · `- [ ] New permissions declared and requested at point of use`. Replace the mobile-first line with
73
+ `- [ ] Layout holds on the smallest supported screen`.
74
+ - **Review:** 5 as stated; 6 reads as small-screen/safe-area layout rather than `sm:/md:` breakpoints.
75
+ Add — a permission used without its manifest/Info.plist entry, or a network call with no offline or
76
+ error state, is a HIGH `quality` finding.
77
+
78
+ ## data
79
+
80
+ - **DoD** (add): `- [ ] Idempotent — a re-run produces the same result, no duplicates` · `- [ ] Backfill path stated (or "not needed" and why)`
81
+ · `- [ ] Schema evolution is additive; downstream consumers named`. Drop the mobile-first line.
82
+ - **Review:** skip 5–6. Add — a non-idempotent write (plain `INSERT` with no merge key, append without
83
+ dedupe), a dropped/renamed column with downstream readers, or a model with no test/assertion is a
84
+ HIGH `quality` finding (CRITICAL when it loses data).
85
+
86
+ ## other
87
+
88
+ - **DoD:** the template's lines minus mobile-first; add what the spec's §1 makes verifiable.
89
+ - **Review:** skip 5–6. No extra checks.
@@ -0,0 +1,17 @@
1
+ ## Readiness — the gate between a frozen spec and N implementers
2
+
3
+ `/cohorte-build` §1.6 scores the frozen spec on **implementability** before authoring the contract and before
4
+ dispatching anything, and writes `specs/reports/<id>.readiness.json`
5
+ (`verdict`: `READY` · `RESERVATIONS` · `NOT-READY`, plus `gaps[]`). It costs **zero extra agents** — the
6
+ lead already holds the spec, the profile and the reconciled surface list — which is the whole economics
7
+ of the step: a spec that cannot be built does not get cheaper by being built on N surfaces in parallel.
8
+
9
+ - Five checks: contract completeness · surface coverage · dependencies exist · residual ambiguity ·
10
+ the design gate. Each maps to `NOT-READY` (a surface would have to invent the answer) or
11
+ `RESERVATIONS` (a surface can proceed on a stated assumption).
12
+ - **`NOT-READY` aborts the build with no agent spawned** and sends the human to `/cohorte-spec`.
13
+ A driver reads the same file and must stop rather than retry — it is the one outcome more passes
14
+ cannot fix.
15
+ - **`RESERVATIONS` never blocks.** Each gap is inlined verbatim into the dispatch of the surface it
16
+ affects, as an assumption the implementer must apply *and* flag in its handoff. A gate that stalled a
17
+ sound build on a missing error case would cost more human round-trips than it saves.
@@ -0,0 +1,64 @@
1
+ ## Reconcile — bringing generated files up to the current core
2
+
3
+ `/cohorte-init-pipeline` is **one-time per project**. Afterwards, `/cohorte-update-pipeline` runs this procedure so a
4
+ core upgrade never requires re-running init — new pipeline features flow into the repo's generated
5
+ files automatically. It works because every generated artifact is a **deterministic function of
6
+ (current template × the profile's data)**; nothing needs re-detecting or re-interviewing.
7
+
8
+ 1. **Profile top-up.** Diff `PIPELINE.md`'s machine block against the current
9
+ `pipeline/PIPELINE.template.md`: every block/field the template has and the profile lacks is added
10
+ with its documented default (e.g. `surfaces[].model: sonnet`, `retrieval.provider: serena`).
11
+ **Ask only when a new field is a genuine human decision** (batch into ONE question set); never
12
+ change a value the profile already sets; never rewrite the prose sections. `release_notes` is one
13
+ such decision and must not be defaulted blind: detect a versioning tool / note-enforcing CI job per
14
+ `/cohorte-init-pipeline` Phase 1, and if there is one, ask Phase 2's release-notes question (anchor
15
+ package, language, bump policy, forbidden levels). No tool found ⇒ top up with `enabled: false`.
16
+ Same for the 3.1 decisions: `commands.security` (ask init Phase 2's security question when a
17
+ scanner is detected, else `[]`), `commands.dev_ready` / `smoke` / `e2e` / `migrate_down` +
18
+ `verify.db` (ask the runtime-verification question when a dev server or e2e runner is detected,
19
+ else leave `dev_ready` empty), and `project.kind` (top up as `web`; ask only if Phase 1 detection
20
+ disagrees).
21
+ 2. **Re-render agent frontmatter + body.** For each `surfaces[]` entry, re-render
22
+ `<agents>/<agent>.md` from the current `implementer.template.md` per §Rendering (`<core>/pipeline/schema/rendering.md`). Safe by
23
+ doctrine: rendered agents are regenerable artifacts — hand-written rules belong in `PIPELINE.md`
24
+ §Conventions (which reconcile never touches), NOT in agent files, where they'd be clobbered here.
25
+ 3. **Additive settings patch.** Run `<sync>` (it owns the gate hook, the pointer,
26
+ `<state>/profile.json` and the `.gitignore` entries — so it runs AFTER step 1's top-up, and again
27
+ if anything later edits the machine block), then bring `<state>/gate-config.json` and the `settings.json` permissions up
28
+ to the current init spec (missing `allow` entries): add what's missing, never remove or rewrite
29
+ existing/custom keys.
30
+ 4. **Capability wiring.** If a top-up added a capability needing external setup (e.g. a `retrieval`
31
+ provider whose MCP server isn't registered yet), run its wiring step from `/cohorte-init-pipeline` Phase 4.
32
+ Even when nothing new was added, re-run the provider's health check (§Code retrieval, `<core>/pipeline/schema/retrieval.md`) — wiring
33
+ rots (PATH changes, uninstalls, hand-edits) — and repair whatever fails.
34
+ 5. **Global config seed.** If `<config>` is absent, seed it from the template
35
+ (`profile/cohorte.config.template.yaml`) so the kanban + shared-vault config has a home. Never
36
+ clobber an existing filled file; report what was seeded. Then **scrub the retired `telemetry:`
37
+ block** if the file still carries one (every install seeded before 2.3.0 does): delete the block
38
+ and its comment header, leaving the rest byte-identical. It is dead config — the sender is gone
39
+ and nothing reads it — but a `telemetry.enabled: true` sitting in a file the human may open reads
40
+ as "this is still sending", which is the one thing it must not imply. This is the single
41
+ exception to "never rewrite the config": a targeted deletion of a block the core no longer
42
+ defines, never a re-seed.
43
+ 6. **Kanban sync.** Run the §Kanban reconcile (`<core>/pipeline/schema/kanban.md`): link/create the project's board if configured, verify
44
+ its columns, and backfill/sync cards from `specs/*.md`.
45
+ 7. **Spec-template top-up.** `specs/_template.md` is seeded once at install and then **never**
46
+ refreshed, so a repo keeps whatever front-matter the core shipped the day it was installed (a
47
+ pre-1.6 copy's `status` comment still lists four states). Top it up the same way as the profile:
48
+ add the **front-matter fields** the current `templates/spec.template.md` has and the repo's copy
49
+ lacks, with their documented defaults, drop `loop_pass`/`loop_phase` (retired with the 2.2.0
50
+ conversational loop driver), and refresh the `status:` comment. Never rewrite its body — the section list is the human's to shape,
51
+ and some repos have deliberately trimmed it. Nothing breaks without this (the fields are written on
52
+ demand when a driver needs them); it just keeps a new spec's front-matter honest about the states
53
+ the pipeline can put it in.
54
+
55
+ 8. **Local-artifact hygiene.** The pipeline's own runtime files must stay out of git:
56
+ `<state>/preflight.ok`, `<state>/pipeline-metrics.jsonl`, `specs/reports/`. Add any missing entry to
57
+ `.gitignore`, and **untrack** what a pre-2.0.0 install let slip in —
58
+ `git rm --cached --ignore-unmatch <state>/preflight.ok` (repeat per stray path). The stamp is the
59
+ one that actively breaks: it records the tree it verified, the commit carrying it moves HEAD past
60
+ that tree, and the committed copy lands in every clone and worktree — so the phase gate ends up
61
+ blocking clean trees and greening unchecked ones. Report what was untracked; the human commits it.
62
+
63
+ Re-running `/cohorte-init-pipeline` remains possible (it reconciles too) but is only *needed* when the stack
64
+ itself changes in ways `/cohorte-build` §1.5 can't auto-grow (e.g. package manager or contract mechanism swap).
@@ -0,0 +1,29 @@
1
+ ## Release notes — the per-feature note the versioning tool consumes
2
+
3
+ Many repos gate merges on a **per-feature release note**: Changesets' `changeset` CI job fails any PR
4
+ that touches product code without a `.changeset/*.md`. That file is **not** something the release
5
+ agent can invent — picking the bump level is project policy (semver over an API vs. over a product,
6
+ a `0.x` rule forbidding `major`, what counts as user-visible), and the prose is outward-facing copy.
7
+ It is the **lead's** to write, exactly like the contract.
8
+
9
+ The failure mode this block exists to prevent is silent and reproducible: the requirement lives in the
10
+ project's `CLAUDE.md`, which the ship flow never reads, so `/cohorte-ship` completes, opens the PR,
11
+ moves the kanban card to **Shipped** — and CI goes red on a job nobody looked at. The feature reads as
12
+ shipped while being unmergeable. Encoding it in the profile is what makes the step survive a stateless
13
+ lead.
14
+
15
+ - **Authored before the dispatch**, next to the `status: shipped` flip (`/cohorte-ship` §2b), so the note
16
+ lands **inside** the release commit. Written after the fact it needs a second commit, and the PR is
17
+ already open and red.
18
+ - **One key in the front-matter** — `anchor_package`. Lockstep/`fixed` version groups propagate the bump
19
+ from it to every other workspace; listing more is how a repo ends up with a package bumped twice.
20
+ - **`forbid_levels`** encodes policy the tool itself may not enforce. The common one: while the product
21
+ is `0.y.z`, a `major` changeset makes Changesets jump to `1.0.0` with no human deciding it — so `0.x`
22
+ repos forbid `major` and declare a breaking change as `minor`.
23
+ - **Ask, don't guess, on an ambiguous bump.** Between two defensible levels (a refactor that also changes
24
+ what the user sees), state the reading and let the human pick — a wrong bump is a published version
25
+ number, not a fixable draft.
26
+ - **`empty_cmd`** covers the honest no-op: a PR that touches product code but must move no version.
27
+ Prefer it to skipping the step; the CI job wants a file, not a version.
28
+
29
+ `enabled: false` (or `tool: none`) ⇒ §2b is a no-op and nothing below applies.