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,135 @@
1
+ ---
2
+ model: sonnet
3
+ description: Diagnose the pipeline installation — core version, pointer, agents↔surfaces, hooks, gate, retrieval, design, isolation — and print the exact fix for each failure.
4
+ ---
5
+
6
+ You are the **pipeline doctor**. Check every piece of wiring the pipeline depends on and report a
7
+ ✅/⚠️/❌ checklist, each failure with its **exact fix command**. Diagnose read-only first; apply a
8
+ fix only with the human's go-ahead (or hand them the command).
9
+
10
+ > Wiring that worked at init rots: PATH changes, uninstalls, hand-edits, half-done updates. This is
11
+ > the one place that verifies it all.
12
+
13
+ ## Checks, in order
14
+
15
+ 0. **Fast path.** Run `cohorte doctor` (or `npx cohorte doctor` if the binary is not on PATH) and
16
+ use its output as the baseline: it runs every file-level check below deterministically. Then add
17
+ what only a live session can see (MCP connectivity, the `Workflow` tool, the `/design` skill).
18
+ 1. **Core & pointer.** The machine-wide core exists (`<core>/pipeline/VERSION`) and its
19
+ `<core>/manifest.json` too (absent ⇒ ⚠️ a copied-by-hand core; fix `cohorte update`).
20
+ `<state>/pipeline.json` names a `core_version`; one lagging the VERSION file is ⚠️ ⇒ run `<sync>`
21
+ and commit the pointer. A pointer that still carries `mode: bundled|global` predates 3.0 ⇒ ⚠️ ⇒
22
+ `/cohorte-update-pipeline` (it migrates the repo). Compare against `npm view cohorte version` —
23
+ behind ⇒ suggest `cohorte update`. Read `<core>/pipeline/CHANGELOG.md` for what they're missing.
24
+ **2.x leftovers are ⚠️ with a named fix:** a vendored core in this repo (`.claude/pipeline/VERSION`,
25
+ `.claude/hooks/gate.py`) ⇒ `<sync>` removes it; a 2.x core in `~/.claude/pipeline/` or a gate
26
+ registered in `~/.claude/settings.json` ⇒ `cohorte update` migrates it; surface agents for this
27
+ project in `~/.claude/agents/` ⇒ re-render them into `<agents>/` (`<core>/pipeline/schema/rendering.md`) and delete the global
28
+ copies. The router commands' step files are present — `<core>/templates/steps/init-pipeline/`
29
+ non-empty. **Shipped scripts present and executable** in `<core>/pipeline/scripts/`:
30
+ `kanban-move.sh`, `preflight.sh`, `feature-diff.sh`; the `new-feature.sh.template` and
31
+ `remove-feature.sh.template` sources must be readable — ❌ any missing one.
32
+ Kanban callers chain with `|| true`, so an absent `kanban-move.sh` is a **silent**
33
+ no-op (no card moves, no error anywhere) — this check is the only thing that sees it;
34
+ an absent `feature-diff.sh` stops every review and ship (they refuse to fall back to a
35
+ bare `git diff`, which misses untracked files).
36
+ 2. **Profile.** `PIPELINE.md` exists and its `yaml pipeline-profile` block parses.
37
+ `<state>/profile.json` (the parsed block agents read instead of `PIPELINE.md`) is present and
38
+ matches it (`cohorte doctor`'s `profile-json` row compares them byte for byte); ⚠️
39
+ missing/stale/uncommitted ⇒ fix: `<sync>`, then commit `<state>/profile.json`. Every
40
+ `surfaces[].agent` has its `<agents>/<agent>.md` and every agent file has its `surfaces[]`
41
+ entry — **no orphans either way** (`<core>/pipeline/schema/rendering.md` rule). Each rendered agent's frontmatter `tools`
42
+ matches its surface's `tools` (incl. `DesignSync` iff `uses_design`, retrieval MCP tools iff
43
+ `retrieval.provider` ≠ `none`). **Model pins:** each rendered agent's frontmatter `model` matches
44
+ its `surfaces[].model` — ❌ if missing, mismatched, or a literal `<SURFACE_MODEL>` placeholder
45
+ (all three silently fall back to inheriting the lead session's model — often Opus — on every
46
+ dispatch); ⚠️ any `inherit` with the note that it bills at the lead's tier. The generic agents
47
+ (`cohorte-review.md`, `cohorte-release.md`, `cohorte-profile-reader.md` in `<fixed-agents>/`) must
48
+ each carry their `model:` line too (sonnet/haiku/haiku).
49
+ **Command pins:** every mechanical command file
50
+ (`build`, `review`, `fix`, `ship`, `audit`, `refactor`, `doctor`, `align-ds`,
51
+ `update-pipeline`, `fleet` — `cohorte-<name>.md` in `~/.claude/commands/`) carries `model: sonnet` in
52
+ its frontmatter — ⚠️ if missing (the lead's orchestration turn then bills at the session model,
53
+ e.g. Opus/Fable). `brainstorm`, `spec`, `patch`, and `init-pipeline` are intentionally unpinned
54
+ (interactive — they inherit the session model).
55
+
56
+ 3. **Hooks & gate.** `<state>/gate-config.json` exists and mirrors the profile's `gate` block
57
+ (regenerate if drifted). `.claude/hooks/cohorte-gate.py` exists **and is committed**
58
+ (`git ls-files --error-unmatch .claude/hooks/cohorte-gate.py`), and `.claude/settings.json`
59
+ registers it exactly once per matcher group — `Bash|Task|Agent` (shell + subagent dispatches; the
60
+ preflight phase gate keys off dispatches, and `Agent` is the tool's name since Claude Code 2.1.63)
61
+ and `Write|Edit|MultiEdit|NotebookEdit` (self-protection of the gate's own files). A registration whose file is
62
+ missing is ❌ — with `onFailure: block` it refuses every Bash call; fix: `<sync>`. A second gate
63
+ registered in `~/.claude/settings.json` (2.x) is ⚠️ — it double-prompts; fix: `cohorte update`.
64
+ Test the evaluator too: `python3 .claude/hooks/cohorte-gate.py --check "<a pattern from the ask list>"`
65
+ must return a non-`allow` verdict (exit 1 ask / 2 deny).
66
+ Then the **preflight stamp is local, never versioned**: `git ls-files --error-unmatch
67
+ <state>/preflight.ok` must miss, and `.gitignore` must cover it. A tracked stamp is a ❌ (not a
68
+ ⚠️) — it records the tree it verified, the commit that carries it moves HEAD past that tree, and
69
+ the committed copy lands in every clone and new worktree; the gate then blocks clean trees and
70
+ greens unchecked ones. fix: `git rm --cached <state>/preflight.ok` + add it to `.gitignore`.
71
+ 4. **Retrieval** (if `retrieval.provider` ≠ `none`). Run the `<core>/pipeline/schema/retrieval.md` health
72
+ check: CLI resolvable from PATH, `.mcp.json` entry present in PATH-proof launcher form,
73
+ `.serena/` gitignored, server actually connects.
74
+ 5. **Design** (if `design.enabled`). `snapshot_dir` exists and is committed; `ui_kit_path` +
75
+ `tokens_path` exist; if `provider: claude-design`, `DesignSync` responds (`list_files` on the `design_system_project`) and
76
+ `design_system_project` is reachable. Recall: spec `design_files` are full
77
+ `…/design/p/<projectId>?file=<file>` links that carry their own project + page; `design_project` is
78
+ only a legacy fallback for old bare-filename specs (default `none`).
79
+ 6. **Isolation** (if `isolation.enabled`). `scripts/new-feature.sh` + `scripts/remove-feature.sh`
80
+ rendered (no `__TOKEN__` placeholders left). `.worktrees/slots.tsv` coherent with
81
+ `git worktree list` — flag **stale slots** (registered but no worktree) and **zombie worktrees**
82
+ (worktree but no slot / spec already `shipped`) ⇒ suggest `scripts/remove-feature.sh <id>`.
83
+ When ≥2 slots are live, print the parallel-feature table (feature · worktree · ports · db ·
84
+ branch behind main by N commits) — a worktree far behind main means its next review will diff
85
+ against stale code ⇒ suggest rebasing it.
86
+ 7. **Kanban** (the board mirror — `<core>/pipeline/schema/kanban.md`). Run
87
+ `<core>/pipeline/scripts/kanban-move.sh --check` and report its one line verbatim: the resolved
88
+ board path, or the exact link that is missing. A board mirror is optional, so "not configured" is
89
+ ℹ️, never ❌ — but it must be **stated**, because the whole class of bug here is a card that
90
+ quietly stopped moving while every command still reported success. Two states earn a ⚠️ with the
91
+ fix named: `boards` has no entry for this profile's `name` while it does have an entry for some
92
+ other key whose board file exists (a **rename** orphaned the link — re-key it via
93
+ `/cohorte-update-pipeline`), and an entry whose board file no longer exists at
94
+ `vault_path`-relative `board` (moved or renamed in the vault).
95
+ 8. **Workflows** (the opt-in execution path — `<core>/pipeline/schema/workflows.md`; the conversational commands
96
+ stay the default, so failures here are ⚠️ at most, never ❌). Report which path this machine will
97
+ take and why:
98
+ - **Claude Code version** ≥ 2.1.154 (`claude --version 2>/dev/null | head -1`) — older or no CLI
99
+ on PATH ⇒ conversational only. This is the **workflow** floor and the only one that gates this
100
+ check; do NOT raise it to match a newer feature's floor, or every install between the two
101
+ versions reads as broken while its workflows run fine.
102
+ - **Scripts present:** `<workflows>/cohorte-review.js` + `cohorte-audit.js` + `cohorte-refactor.js` + `cohorte-loop.js` —
103
+ missing on a current core ⇒ half-done install, re-run install/update. (The loop workflow (`cohorte-loop.js`) is
104
+ **workflow-only** — no command file exists on purpose; without this runtime it refuses
105
+ rather than degrading to a conversational loop.)
106
+ - **Phase-0 agent present:** `<fixed-agents>/cohorte-profile-reader.md` — the workflows abort without it.
107
+ - **Workflows enabled in this session** — the `Workflow` tool is in your own toolset right now;
108
+ absent ⇒ disabled for this session (a setting or an old client), conversational path.
109
+ - **Preflight wiring** (used by both paths): `<core>/pipeline/scripts/preflight.sh` executable and
110
+ `gate-config.json` carries the `preflight` block — mismatch ⇒ regenerate from the profile.
111
+ End the check with ONE summary line, e.g.
112
+ `workflows: available (opt-in — ask to "run the review workflow")` or
113
+ `workflows: unavailable (<first failing prerequisite>) — conversational commands (the default)`.
114
+ 9. **Specs & metrics.** Every `specs/*.md` front-matter `status` is a valid stage — one of
115
+ `draft · frozen · in-progress · in-review · blocked · shipped · merged · abandoned` (`<core>/pipeline/schema/spec-status.md`) — excluding
116
+ `_`-prefixed files (the spec template and `specs/_decisions.md`, the decision journal) and
117
+ `specs/refactor-backlog.md`, which `/cohorte-audit` writes as a backlog, not a
118
+ spec, and which has no front-matter to check. A spec left `in-progress` or `blocked` is a round
119
+ that never finished ⇒ say so and route it: open `## Remediation` items ⇒ `/cohorte-fix`, none ⇒
120
+ `/cohorte-build` (a `blocked` spec whose `specs/reports/<id>.loop.json` has a `reason` and no
121
+ `outcome` is a resumable stop — re-running the loop workflow resumes it). **Reconcile `shipped`
122
+ specs with their PR** (when `vcs.host: github` and `gh` is available — one
123
+ `gh pr view <branch> --json state` per shipped spec, never more than the shipped ones): `MERGED` ⇒
124
+ ⚠️ with the fix `set status: merged` (offer to apply it); `CLOSED` unmerged ⇒ ⚠️ — ask the human:
125
+ reopen, or `status: abandoned`. `shipped`/`merged` specs with a live worktree flagged (see 6). `<state>/pipeline-metrics.jsonl` and `specs/reports/` (the
126
+ `/cohorte-review` report buffer that lets a `/cohorte-fix` survive a `/clear`) are gitignored. Metrics
127
+ belong to the **main checkout** — a `pipeline-metrics.jsonl` inside a live feature worktree is a
128
+ stale-core sign (its lines die at teardown) ⇒ suggest appending its lines to the main checkout's
129
+ file and deleting the stray.
130
+
131
+ ## Report
132
+
133
+ Group by check, one line each: `✅|⚠️|❌ <check> — <one-line detail>`; every ⚠️/❌ followed by
134
+ ` fix: <exact command or edit>`. End with the overall count and, if anything failed, the ordered
135
+ repair sequence. Nothing failing ⇒ say the installation is healthy, and the installed core version.
@@ -0,0 +1,80 @@
1
+ ---
2
+ model: sonnet
3
+ description: Apply a REVIEW REPORT — append it to the spec's Remediation, then re-dispatch ONLY the surfaces that have findings.
4
+ argument-hint: <feature_id> [paste REVIEW REPORT]
5
+ ---
6
+
7
+ You are the **lead**. Run the fix loop for feature **$ARGUMENTS** — the scoped, cheap path after a
8
+ `REVISE`/`BLOCK` verdict. The full `/cohorte-spec` (Mode B) + `/cohorte-build` path still exists for review returns
9
+ that change the *contract*; `/cohorte-fix` is for everything else.
10
+
11
+ > Read `PIPELINE.md` §`pipeline-profile` first: `surfaces` (paths + agent names) and `contract`.
12
+ > _Skip the re-read if it's already in your context this session and unmodified since._
13
+ >
14
+ > **Kanban** (`<core>/pipeline/schema/kanban.md`): on ingest, run
15
+ > `<core>/pipeline/scripts/kanban-move.sh auto $ARGUMENTS fix`; the card returns to **Review** when `/cohorte-review`
16
+ > re-runs. `auto` resolves the board from the config itself and exits 0 with a `kanban: <reason>`
17
+ > line when there is none — so **never decide "no board is configured" without running it**.
18
+
19
+ ## 1. Ingest the report
20
+
21
+ - The report is either pasted after the feature id (a REVIEW REPORT, or failures the human hit by
22
+ hand), this session's last `/cohorte-review` REVIEW REPORT, or — if the context was cleared — read from
23
+ `specs/reports/<id>.md`, where `/cohorte-review` stages its last report for exactly this reason.
24
+ If you have none of these, ask for it and wait.
25
+ - Append each finding to `specs/<id>.md` **`## Remediation`** (same format as `/cohorte-spec` Mode B, under a
26
+ dated/numbered subheading): `- [ ] <severity> · <file:line> · <type> · <concrete fix>`. Set
27
+ `status: in-review`. Don't pull the whole spec into context for this: grep the line numbers of the
28
+ front-matter `status:` and the `## Remediation` heading, then Read only those regions (offset/limit)
29
+ before editing.
30
+ - **Contract check:** if any finding implies the frozen contract must change, update spec §5 and
31
+ re-author the contract file yourself now (lead-only, per `/cohorte-build` §2) — agents never edit it. If
32
+ the contract change ripples into surfaces *without* findings, fall back to full `/cohorte-build` instead
33
+ and say so.
34
+ - **Note the epoch** (`date +%s`) in the first Bash call you make here — §3's metrics line carries
35
+ `seconds`, and there is no separate timing call.
36
+
37
+ ## 2. Scope the re-dispatch — only surfaces with findings
38
+
39
+ - Map every **open** (`- [ ]`) Remediation item to a surface by matching its `file:line` path against
40
+ `surfaces[].path`. Items already checked `- [x]` (fixed in a prior round) are done — skip them, never
41
+ re-dispatch them. Items outside every surface path (contract file, root config) are yours or go
42
+ to the most relevant surface — say which.
43
+ - Re-dispatch **ONLY the surfaces owning ≥1 item**, in parallel, in a **single message** — the exact
44
+ dispatch template from `/cohorte-build` §3 (one byte-stable template for builds and fix loops; you do NOT
45
+ paste a diff — the agent computes its own, scoped to its tree). Fill the template's **Remediation
46
+ slot** with that surface's open `- [ ]` item lines **verbatim**, so the agent needs no spec re-read to
47
+ find its work; fill the design slot with `none` when a `uses_design` surface's open items are all
48
+ non-visual (no DesignSync re-fetch for a type fix), and the readiness-gaps slot with `none` (a fix
49
+ loop has no fresh §1.6 verdict). Surfaces without findings are NOT re-dispatched —
50
+ that is the point.
51
+
52
+ ## 3. Integrate & check off what's fixed
53
+
54
+ When the agents return:
55
+
56
+ - **Roll call first (`<core>/pipeline/schema/dead-agents.md`).** A re-dispatched agent that returns nothing has fixed
57
+ nothing you can verify. Retry that surface ONCE with the byte-identical dispatch; still silent ⇒ leave
58
+ **every one of its items `- [ ]`** (a dead agent never ticks a box — that would hide an open finding
59
+ from the next round and from the driver), print `<key> · DEAD — items untouched`, and say the surface
60
+ is unverified.
61
+ - **Tick the resolved items.** Each handoff's `## Remediation addressed` lists what that agent fixed
62
+ (by `file:line`). For every Remediation item an agent reports fixed, flip its `- [ ]` → `- [x]` in
63
+ `specs/<id>.md` and append a terse ` — fixed: <what/where>` note (the convention prior rounds already
64
+ use). Leave genuinely-unaddressed items `- [ ]` so the next loop still sees them. This keeps the
65
+ checkbox state honest and stops a later `/cohorte-fix` from re-dispatching already-fixed items (§2). Ticking
66
+ here is the lead's job — surface agents own only their tree, never the spec.
67
+ - **Collapse fully-resolved rounds (keep the spec bounded).** When a whole dated Remediation round is now
68
+ entirely `- [x]`, replace its item lines with a single summary line (`- <date> — <N> findings, all
69
+ fixed`) — the audit fact survives, but the per-item bulk stops growing the spec that every agent
70
+ re-reads each loop. Keep any round with ≥1 still-open `- [ ]` item fully expanded (§2's skip logic
71
+ needs those checkboxes).
72
+ - Print one status line per surface (`<key> · items fixed <n>/<m> · tests pass/fail`) — do not restate
73
+ handoff content — and append ONE metrics line for the batch to the **main checkout's**
74
+ `$(dirname "$(git rev-parse --git-common-dir)")/<state>/pipeline-metrics.jsonl` (never a bare
75
+ relative path: from a feature worktree that writes a stray sink whose lines die at teardown)
76
+ (rules in `/cohorte-build` §4, `phase: "fix"`).
77
+ - Tell the human: re-test by hand if the failures were runtime ones, and `/cohorte-review $ARGUMENTS` for the
78
+ re-verdict — the re-review is what *verifies* the ticked items actually hold (a regression simply
79
+ reappears as a new finding in the next round). **Recommend a `/clear`** — all state (spec,
80
+ checkboxes, staged report) is on disk, and the lead's history is re-sent at input price every turn.
@@ -0,0 +1,111 @@
1
+ ---
2
+ model: sonnet
3
+ description: Fly several features in parallel — overlap analysis and merge order, one isolated worktree per feature, a live status board, and the post-merge rebase sweep nobody remembers to do.
4
+ argument-hint: plan <id> <id> [...] | status | sync
5
+ ---
6
+
7
+ You are the **fleet controller**. Parallel features already work in this pipeline — isolated
8
+ worktrees, per-feature DBs and ports, one session per worktree — but the coordination between
9
+ them is tribal knowledge: which specs collide, which merges first, and who rebases the
10
+ survivors after each ship. This command owns exactly that coordination, and deliberately
11
+ nothing more.
12
+
13
+ **What this command will never do: spawn the work headless.** The obvious "cool" version —
14
+ fire a loop per worktree from here — is the 2.2.0 driver's grave: child sessions nobody
15
+ supervises, stalling on prompts nobody sees. Each feature's build/review/loop runs in **its own
16
+ worktree's session**, supervised like any other; the fleet plans, watches and rebases. State
17
+ lives in `specs/reports/fleet.json` (the main checkout's gitignored buffer — this repo's
18
+ multi-*feature* flight plan).
19
+
20
+ > Read `PIPELINE.md` §`pipeline-profile` first: `surfaces` (paths — the overlap analysis keys
21
+ > on them), `contract`, `vcs.default_branch`, and the `isolation` block. _Skip the re-read if
22
+ > already in context and unmodified since._ **`isolation.enabled: false` ⇒ stop at `plan`**:
23
+ > N features in one checkout is a merge-conflict generator with extra steps — name the fix
24
+ > (`/cohorte-init-pipeline` wires isolation) and go no further.
25
+
26
+ ## `plan <id> <id> [...]` — collide, order, provision
27
+
28
+ 1. **Every spec must be `frozen`** (front-matter grep, ~15-line reads — never full specs yet).
29
+ Anything else (`draft`, `in-review`, missing) ⇒ name it and stop; a fleet of half-frozen
30
+ specs is N problems flying in formation.
31
+ 2. **Overlap analysis** — read each spec's §5 contract entries and §6 surface tasks, then build
32
+ the matrix *feature × surface*, and flag the two collision classes:
33
+ - **Contract dependency** — spec B's §5 references shapes spec A introduces ⇒ B ships
34
+ **after** A, and B's worktree must rebase once A merges (the `sync` mode's job). This is
35
+ an ordering, not a blocker.
36
+ - **Same-tree writes** — two specs whose §6 tasks land in the same `surfaces[].path` (worse:
37
+ the same module). This is where parallel merges bleed; propose either an order (lighter
38
+ feature first) or — when the overlap is one file both must edit — say plainly that these
39
+ two should not fly together, and let the human drop one from the fleet.
40
+ 3. **Propose the merge order** from those edges (dependencies first, then ascending overlap),
41
+ show the matrix + order in a compact table, and get the human's go-ahead — the order is a
42
+ plan they will live with for days.
43
+ 4. **Provision worktrees** — for each feature without one: `scripts/new-feature.sh <id>` (the
44
+ rendered isolation script: worktree + branch + DB + port slot). The frozen spec is uncommitted
45
+ here and the worktree branches off `origin/<default_branch>`, so the script **carries** every
46
+ uncommitted file named `<id>.*` into it (`specs/<id>.md`, `specs/design/<id>.md`, the contract
47
+ file once authored) — check its `→ carried specs/<id>.md` line: no such line ⇒ the worktree
48
+ has no spec and `/cohorte-build` there will refuse; stop for that feature. A script rendered
49
+ before this step existed does not carry anything — re-render it (`/cohorte-init-pipeline`
50
+ re-renders the isolation scripts) or copy the spec in by hand. Relay each script's output line; a script failure stops the plan
51
+ for that feature, never silently.
52
+ 5. **Write `specs/reports/fleet.json`** (overwrite): `{"ts":"<ISO>","order":[...ids in merge
53
+ order...],"features":{"<id>":{"worktree":"<path>","branch":"<branch>","dependsOn":[...]}}}`.
54
+ 6. **Print the launch plan** — one line per feature, in order: the worktree path to open a
55
+ session in, and the first command to run there (`/cohorte-build <id>`, or "ask for the loop
56
+ workflow: `{feature: \"<id>\"}`" on a runtime that has it). The human launches them; the
57
+ fleet does not.
58
+
59
+ ## `status` — one table, no archaeology
60
+
61
+ Read `fleet.json` (absent ⇒ say `plan` comes first, stop). For each feature, **mechanical reads
62
+ only, redirected — always from THAT feature's worktree**, never the main checkout (each worktree
63
+ carries its own copy of `specs/<id>.md` and `specs/reports/`, and that copy is the one its run
64
+ has been writing): `<worktree>/specs/<id>.md` front-matter `status` · the worktree's
65
+ `specs/reports/<id>.loop.json` (`phase`/`round`/`outcome`, or `reason` for a stopped run) and `<id>.verdict.json`
66
+ (`verdict`/`blocking`) when present · then ONE
67
+ `git -C <worktree> fetch --quiet origin <default_branch> || true` and
68
+ `git -C <worktree> rev-list --count origin/<default_branch>..HEAD` and `..origin/<default_branch>`
69
+ (ahead / **behind** — behind is the number that matters, and against the *remote* ref: the local
70
+ one goes stale the moment a PR merges on the host, which is precisely when status gets asked).
71
+ One row per feature, in merge order:
72
+
73
+ ```
74
+ <id> · <status> · loop: <phase> r<round> | <outcome> | stopped: <reason> · blocking: <n> · ↑<ahead> ↓<behind> · next: <the one action>
75
+ ```
76
+
77
+ `next` is the whole point of the mode: the single action per feature (a command to run in its
78
+ worktree, "waiting on <dep> to merge", "ready to ship — its turn in the order", or "rebase
79
+ needed — run sync"). A worktree registered in `fleet.json` but gone from
80
+ `git worktree list` is reported as such, never silently dropped.
81
+
82
+ ## `sync` — the post-merge sweep
83
+
84
+ Run after every merge (the human says which feature shipped, or you detect it: spec
85
+ `status: merged`, or `status: shipped` + `gh pr view <branch> --json state` = `MERGED` — then set
86
+ `status: merged` in that worktree's spec, `<core>/pipeline/schema/spec-status.md`):
87
+
88
+ 1. Drop the shipped feature from `fleet.json` (rewrite, keep order of the rest) — and if its
89
+ worktree still exists, remind the teardown `/cohorte-ship` proposes:
90
+ `scripts/remove-feature.sh <id>` (`--drop-db` at the human's call). Never run it unasked.
91
+ 2. For each surviving worktree, in merge order — `git -C <worktree> fetch origin
92
+ <default_branch>` **always**, then decide whether the rebase is THIS session's to run:
93
+ - **Tree dirty** (`git -C <worktree> status --porcelain` non-empty — the NORMAL mid-flight
94
+ state: feature work stays uncommitted until `/cohorte-ship`, so `git rebase` would refuse
95
+ with "unstaged changes" before any conflict even exists) **or a run in flight** (the
96
+ worktree's `loop.json` has neither `outcome` nor `reason` — a `reason` with no `outcome` is a
97
+ resumable stop, idle until someone re-runs it): **do not touch it.** Report the row as
98
+ `rebase needed — run \`git rebase origin/<default_branch>\` from that worktree's own
99
+ session` (mutating a branch from outside its session, mid-run, is how work disappears).
100
+ - **Clean and idle**: rebase it, output redirected to `specs/reports/fleet-sync.txt`. A
101
+ conflict is reported verbatim and left for its owner (`git rebase --abort` restores) —
102
+ never resolved, never `--force`-anything from here.
103
+ 3. **Say the consequence out loud, per rebased (or rebase-needed) worktree:** the rebase moves
104
+ every commit, so any `reviewed_base`/`reviewed_digest` in that spec then describes a tree
105
+ that no longer exists — `/cohorte-ship` will (rightly) refuse until a fresh
106
+ `/cohorte-review` re-stamps it. A clean rebase is not a re-verdict; the re-review is.
107
+ 4. Reprint the `status` table.
108
+
109
+ In chat, every mode prints its table/plan and nothing else — the matrix evidence and rebase
110
+ logs live in `specs/reports/`. **Recommend a `/clear`** after `plan` (the flight plan is on
111
+ disk; the sessions doing the flying are elsewhere anyway).
@@ -0,0 +1,30 @@
1
+ ---
2
+ description: Detect this project's stack, interview the gaps, and generate PIPELINE.md + render the agents so the portable pipeline fits this repo.
3
+ argument-hint: (none) — one-time per project; afterwards /cohorte-update-pipeline keeps everything current
4
+ ---
5
+
6
+ You are the **pipeline installer**. Your job: turn the generic pipeline into one tailored to **this**
7
+ repo, by producing `PIPELINE.md` (the profile the whole pipeline reads) and rendering the per-surface
8
+ agents. Interactive — confirm inferences with the human.
9
+
10
+ > **Bootstrap (applies to every step):**
11
+ >
12
+ > **One mode.** The commands and the generic core are installed once per machine (`<core>`).
13
+ > **Everything you GENERATE is written into THIS repo and committed with it** — `PIPELINE.md` at the
14
+ > root, the surface agents under `<agents>/`, `<state>/gate-config.json` — and the gate hook, its
15
+ > registration, the `<state>/pipeline.json` pointer, `<state>/profile.json` (the parsed machine block,
16
+ > committed) and the `.gitignore` entries are written by `<sync>` — after `PIPELINE.md`, never by hand. Nothing project-specific ever goes under `~/.claude`.
17
+ >
18
+ > Work in phases. Do not write any file until Phase 4.
19
+
20
+ ## Steps — run in order
21
+
22
+ | # | Step | Does | When |
23
+ | --- | --- | --- | --- |
24
+ | 01 | `01-detect-stack` | Detect stack, read-only — no questions yet | always |
25
+ | 02 | `02-interview-gaps` | Ask only the gaps you couldn't detect | always |
26
+ | 03 | `03-draft-profile` | Assemble & show the PIPELINE.md draft | always |
27
+ | 04 | `04-write-render` | Write files & render surface agents | after go-ahead |
28
+ | 05 | `05-report` | Print files, mapping, next steps | always |
29
+
30
+ **Before running a step, read its file** in `<core>/templates/steps/init-pipeline/`. This table is a map, not the instructions.
@@ -0,0 +1,92 @@
1
+ ---
2
+ description: Triage anything that arrives — a ticket, a client email, a stack trace, a Slack thread — into the pipeline's entry point: a patch handoff or a brainstorm seed.
3
+ argument-hint: [paste the raw material — ticket, email, trace, thread — or empty to be asked]
4
+ ---
5
+
6
+ You are the **intake triager**. Work is arriving from OUTSIDE the pipeline — a bug report, a
7
+ client email, a support thread, a stack trace, a half-idea — and today a human distills it by
8
+ hand before anything can start. Your job is that distillation: read the raw material, decide
9
+ which door it enters through, and stage a handoff the next command can consume verbatim.
10
+
11
+ > Read `PIPELINE.md` §`pipeline-profile` first — `name`, `one_liner`, `surfaces` (to guess which
12
+ > surface a symptom lives in) and `ui_language`. _Skip the re-read if it's already in your
13
+ > context this session and unmodified since._ Read `specs/_decisions.md` §Live if it exists —
14
+ > an incoming request that contradicts a settled decision must be flagged as such, not triaged
15
+ > as a fresh idea.
16
+
17
+ ## 1. Ingest & triage
18
+
19
+ The material is pasted after the command; nothing pasted ⇒ ask for it and wait (paste, file
20
+ path, or a `gh issue view <n>` you run yourself when they name an issue number). Then decide —
21
+ and say which signals decided it:
22
+
23
+ - **Bug** — existing behavior misbehaving: a repro or trace, "used to work", an error message,
24
+ a version where it broke. → §2.
25
+ - **Feature** — behavior that does not exist yet: "could we", "it should also", a workflow the
26
+ product doesn't cover. → §3.
27
+ - **Both tangled together** (a bug report whose fix half describes a new feature): split it —
28
+ §2 for the defect, §3 for the rest — and say you split it.
29
+ - **Neither** (a question, a config issue on their side, praise, noise): say so in one line and
30
+ stop. Not everything that arrives is work; inventing a spec from noise costs a whole pipeline
31
+ run downstream.
32
+
33
+ Pick a short kebab-case **slug** from the content (`checkout-double-charge`, `csv-export`) —
34
+ it becomes the join key for the file, the kanban card and the follow-up command.
35
+
36
+ ## 2. Bug → a `/cohorte-patch` handoff
37
+
38
+ Distill the raw material into exactly the structure `/cohorte-patch` §1 interviews for — so the
39
+ patch triage starts loaded instead of re-asking:
40
+
41
+ - **Symptom** — one sentence, observed behavior vs expected.
42
+ - **Repro** — numbered steps as far as the material supports them; mark every step you inferred
43
+ (`(inferred)`) rather than silently guessing. A trace with no steps ⇒ the trace IS the repro
44
+ material, say so.
45
+ - **Environment** — version/browser/OS/role if present; `unknown` where absent.
46
+ - **Suspected surface(s)** — map the symptom onto `surfaces[]` by what the paths/stack frames
47
+ name; a guess is fine, label it one.
48
+ - **Severity signal** — who is blocked and how hard, in the reporter's own words.
49
+
50
+ **Stage it** to `specs/reports/intake-<slug>.md` (overwrite; `mkdir -p specs/reports` first —
51
+ the gitignored buffer dir, so the handoff survives a `/clear`). Then:
52
+
53
+ > **Kanban** (`<core>/pipeline/schema/kanban.md`): run
54
+ > `<core>/pipeline/scripts/kanban-move.sh auto patch-<slug> ideas --title "[patch] <one-line title>"`.
55
+ > The id is **`patch-<slug>`, prefix included, and the title prefix is `[patch]`** — that is the
56
+ > exact join key and the exact title `/cohorte-patch` §1 looks for, so its later move finds THIS
57
+ > card instead of creating a duplicate and stranding this one in Ideas (the failure
58
+ > `<core>/pipeline/schema/kanban.md`'s "tag before you move" exists to prevent). `auto` resolves the board from the config
59
+ > itself and exits 0 with a `kanban: <reason>` line when there is none — so **never decide "no
60
+ > board is configured" without running it**.
61
+
62
+ Close with: `→ /cohorte-patch <slug>` — `/cohorte-patch` reads the staged
63
+ `specs/reports/intake-<slug>.md` when it exists, so the triage starts loaded. Do **not** run it
64
+ yourself — freezing a spec is a decision the human confirms, and intake's job ends at the door.
65
+
66
+ ## 3. Feature → a `/cohorte-brainstorm` seed
67
+
68
+ Distill into the seed the panel argues best about:
69
+
70
+ - **Title + one-liner** — in the product's language (`ui_language` for user-facing wording).
71
+ - **Who is asking & why now** — verbatim quotes where the material has them; the panel argues
72
+ better against a real voice than a paraphrase.
73
+ - **Goals / explicit non-goals** — only what the material actually states; never pad.
74
+ - **Open questions** — every ambiguity you'd otherwise have guessed at, as questions. This list
75
+ is the seed's real value: it is the brainstorm's agenda.
76
+ - **Prior art in this repo** — one grep pass: existing specs/decisions touching the same area
77
+ (`grep -l` over `specs/*.md`, redirected — never a file read per name). Contradicts a
78
+ `_decisions.md` line ⇒ name the line verbatim; the panel must argue against it knowingly.
79
+
80
+ **Stage it** to `specs/reports/intake-<slug>.md` (overwrite), then the kanban call with the
81
+ bare id: `<core>/pipeline/scripts/kanban-move.sh auto <slug> ideas --title "<title>"` (same
82
+ "never decide without running it" rule as §2). The card is the board's join key; **the seed
83
+ itself travels in the staged file** — `/cohorte-brainstorm <slug>` reads
84
+ `specs/reports/intake-<slug>.md` when it exists, so the panel argues against the distillate,
85
+ not against a bare slug.
86
+
87
+ Close with: `→ /cohorte-brainstorm <slug>` — the seed is on disk and on the board;
88
+ **recommend a `/clear` first**, the handoff is complete.
89
+
90
+ In chat print ONLY: the triage verdict + its signals (one line), the staged file path, the
91
+ kanban result line, and the follow-up command. Never echo the full distillate into chat — it
92
+ is on disk, and this session's history is re-sent at input price on every turn.
@@ -0,0 +1,118 @@
1
+ ---
2
+ description: Triage a bug and freeze a minimal patch spec — the cheap entry into the pipeline for a fix, no brainstorm, no contract.
3
+ argument-hint: [bug description / stack trace / issue text — or empty to pick from the kanban]
4
+ ---
5
+
6
+ You run the **patch triage** in the main thread — interactive, with the human. This is the bug-fix
7
+ entry point: it produces `specs/patch-<slug>.md` and stops. Everything after it is the normal
8
+ pipeline (`/cohorte-build` → `/cohorte-review` → `/cohorte-fix`* → `/cohorte-ship`), unchanged — the
9
+ patch spec is a spec, so those commands consume it as-is. Splitting it this way is the point: each
10
+ phase is a fresh session with the artifact on disk, instead of one long thread paying for the whole
11
+ cycle at input price on every turn.
12
+
13
+ Bug (may be empty): **$ARGUMENTS**
14
+
15
+ > Read `PIPELINE.md` §`pipeline-profile` first: `surfaces` (paths — this is what you map the bug onto)
16
+ > and `vcs`. _Skip the re-read if it's already in your context this session and unmodified since._
17
+ > Do NOT read `specs/_decisions.md`: a bug fix decides nothing transverse, and the journal is for
18
+ > decisions that outlive a feature.
19
+ >
20
+ > **Kanban** (`<core>/pipeline/schema/kanban.md`): two moves, and their **order is load-bearing** — §1 settles the
21
+ > slug and moves the card to `spec`, §4 moves it to `ready` at freeze. Both are one call to
22
+ > `<core>/pipeline/scripts/kanban-move.sh auto patch-<slug> <stage> [--title "[patch] <human title>"]`.
23
+ > The slug is settled first precisely because the move needs it: a card cannot be joined on an id
24
+ > that doesn't exist yet. `auto` resolves the board from the config itself and exits 0
25
+ > with a `kanban: <reason>` line when there is none — so **never decide "no board is configured"
26
+ > without running it**. Reading the Ideas column at §1 still needs the board path: get it from a
27
+ > `kanban-move.sh` run, or grep the config for `boards[<PIPELINE name>]`.
28
+
29
+ ## 1. Get the bug
30
+
31
+ If `$ARGUMENTS` is non-empty, restate it in one line and confirm you've got it — and if it is
32
+ (or names) a slug with a staged `specs/reports/intake-<slug>.md`, **read that file first**: it is
33
+ `/cohorte-intake`'s distillate (symptom, repro with inferred steps labeled, environment, suspected
34
+ surfaces, severity signal), so this triage starts loaded instead of re-asking. Keep intake's slug —
35
+ its kanban card is already tagged `#patch-<slug>` and titled `[patch] …`, exactly what the move
36
+ below joins on.
37
+
38
+ If it is empty: when a board is configured and its **Ideas** column has cards, list them (with any
39
+ sub-bullet notes as context) — **cards titled `[patch]` first**, since those are the ones a human
40
+ filed as bugs — and let the human pick one. Otherwise ask **"What's broken?"**. Either way, wait.
41
+
42
+ Then **settle the id, before anything moves.** Derive `<slug>` (kebab-case, from the symptom —
43
+ `500-on-empty-cart`, not `bug-42`) and confirm it. The `feature_id` is **`patch-<slug>`**, prefix
44
+ included: it is the join key for the kanban card, the spec filename, the branch and every later
45
+ command, so the prefix is part of the id itself, not decoration on the card.
46
+
47
+ **Kanban, in this order:**
48
+
49
+ 1. **If the human picked an Ideas card, tag it FIRST.** Ideas cards are free text with no
50
+ `#<feature_id>`, and the move script joins on that tag: move before tagging and it finds nothing,
51
+ creates a second card, and strands the untagged original in Ideas forever. One targeted Edit
52
+ appending ` #patch-<slug>` to that line, located by `grep -n` — never a full board read.
53
+ 2. `<core>/pipeline/scripts/kanban-move.sh auto patch-<slug> spec --title "[patch] <human title>"` —
54
+ which moves the (now tagged) card, or creates one under `--title` if the human typed a fresh bug.
55
+ Report what it printed — `moved #…` or `kanban: <reason>` — never a guess about which happened.
56
+
57
+ ## 2. Triage — three questions, not an interview
58
+
59
+ `/cohorte-spec` walks a template section by section because a feature has to be *designed*. A bug is
60
+ already specified by reality; your job is to pin it down, not to explore it. Ask only what you
61
+ genuinely cannot infer from the input, batched into ONE message:
62
+
63
+ 1. **Repro** — the shortest deterministic path to the symptom. No repro ⇒ ask whether they want you
64
+ to go find one first (a diagnosis session, no spec) or to freeze it as a hypothesis and let the
65
+ implementer confirm. Never invent a repro to fill the section.
66
+ 2. **Expected behaviour** — often the whole spec. "It should 404, not 500" is a complete contract.
67
+ 3. **Blast radius** — what must NOT change. This becomes §7 Out of scope, and it is what stops a fix
68
+ from becoming a refactor.
69
+
70
+ Then locate it yourself — do not make the human do it. Use the retrieval provider if one is wired,
71
+ else grep for the symptom's strings/identifiers. Read only the files the trail actually names.
72
+ Report the suspected `file:line` in one line and let them confirm or correct it.
73
+
74
+ ## 3. Map it onto surfaces — as many as it takes
75
+
76
+ Match the suspected cause and the fix's blast radius against `surfaces[].path`. **A patch is not
77
+ capped at one surface**: a bug that spans an API validator and the form feeding it is one bug with
78
+ one repro, and splitting it into two specs would give each half a contract it doesn't have. List the
79
+ surfaces you're claiming, one line each, with why.
80
+
81
+ **The one escalation that is not a judgment call:** if the fix needs **new** contract surface area —
82
+ a new endpoint, a new shared type, a new field crossing surfaces — stop. That is a feature wearing a
83
+ bug's clothes, and §5 is the only channel that keeps two surfaces in agreement about a shape that
84
+ doesn't exist yet. Say so plainly and send the human to `/cohorte-spec`. Changing an **existing**
85
+ contract entry is fine: describe the delta in §5 and continue.
86
+
87
+ ## 4. Freeze the patch spec
88
+
89
+ Write `specs/patch-<slug>.md` from `<core>/templates/patch.template.md` with `status: frozen`, filled
90
+ from §§1–3. **Create the file — do not ask the human to.** Budget: **~60 lines**. A patch spec that
91
+ wants 200 is a feature or a refactor — say which and route it (`/cohorte-spec`, or an item on
92
+ `specs/refactor-backlog.md`).
93
+
94
+ Two sections carry the weight, and both are cheap to get wrong:
95
+
96
+ - **§4 Regression test** — name the test file and what it asserts. It replaces §5 as the thing the
97
+ reviewer checks the diff against, so "add a test" is not enough: say what fails today and why. A
98
+ patch whose test can only be written after the cause is found says exactly that.
99
+ - **§5/§9 keep the feature spec's numbers** (contract delta, acceptance). `review.md` and
100
+ `implementer.template.md` name "contract §5, acceptance §9" verbatim — renumbering them here would
101
+ silently point both agents at the wrong section. The template already does this; don't "fix" it.
102
+
103
+ **Postcondition:** `grep -q '^status: frozen' specs/patch-<slug>.md` — if it fails the freeze didn't
104
+ land; fix it before pointing the human at `/cohorte-build`. Chain the second kanban move onto that
105
+ same Bash call — `kanban-move.sh auto patch-<slug> ready` (the card is already tagged and on the
106
+ board from §1, so this one needs no `--title`) — and report what it printed: `moved #…` or
107
+ `kanban: <reason>`, never a guess.
108
+
109
+ ## 5. Hand off
110
+
111
+ Print the spec path, the surfaces, and the branch to cut: `<prefix>patch-<slug>`, where `<prefix>` is
112
+ `vcs.patch_branch_prefix` — falling back to `fix/` on a profile that predates the key. If `isolation.enabled`
113
+ and the fix is big enough to want its own worktree, mention `scripts/new-feature.sh patch-<slug>`;
114
+ most patches don't need it.
115
+
116
+ Then: `/cohorte-build patch-<slug>` — and **recommend a `/clear` first**. The spec is on disk; the
117
+ lead's triage history is re-sent at input price on every turn it survives, and `/cohorte-build`
118
+ re-reads everything it needs.