cohorte 2.10.1 → 3.0.0-dev.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 (211) hide show
  1. package/README.md +7 -0
  2. package/assets/manifest.json +193 -0
  3. package/assets/migrations/config/README.md +12 -0
  4. package/assets/migrations/state/0001_init.sql +154 -0
  5. package/assets/prompts/README.md +11 -0
  6. package/assets/prompts/agents/fixer.md +7 -0
  7. package/assets/prompts/agents/implementer.md +12 -0
  8. package/assets/prompts/agents/reviewer.md +8 -0
  9. package/assets/prompts/agents/security-reviewer.md +7 -0
  10. package/assets/prompts/phases/build.md +5 -0
  11. package/assets/prompts/phases/review.md +5 -0
  12. package/assets/prompts/phases/test.md +5 -0
  13. package/assets/prompts/system.md +11 -0
  14. package/assets/schemas/agent-output.schema.json +225 -0
  15. package/assets/schemas/auth-status.schema.json +87 -0
  16. package/assets/schemas/command-result.schema.json +192 -0
  17. package/assets/schemas/commands.schema.json +952 -0
  18. package/assets/schemas/config.schema.json +2259 -0
  19. package/assets/schemas/doctor-report.schema.json +104 -0
  20. package/assets/schemas/events.schema.json +8514 -0
  21. package/assets/schemas/fake-script.schema.json +549 -0
  22. package/assets/schemas/inspect.schema.json +3133 -0
  23. package/assets/schemas/manifest.schema.json +79 -0
  24. package/assets/schemas/ownership.schema.json +52 -0
  25. package/assets/schemas/policy-verdict.schema.json +282 -0
  26. package/assets/schemas/project-model.schema.json +783 -0
  27. package/assets/schemas/project-status.schema.json +217 -0
  28. package/assets/schemas/reconcile-plan.schema.json +155 -0
  29. package/assets/schemas/run-diff.schema.json +177 -0
  30. package/assets/schemas/run-snapshot-manifest.schema.json +2104 -0
  31. package/assets/schemas/run-state.schema.json +1755 -0
  32. package/assets/schemas/runtime-capabilities.schema.json +1545 -0
  33. package/assets/schemas/sandbox-capabilities.schema.json +116 -0
  34. package/assets/schemas/skill.schema.json +87 -0
  35. package/assets/schemas/spec.schema.json +202 -0
  36. package/assets/schemas/tool-catalogue.schema.json +655 -0
  37. package/assets/schemas/trust-record.schema.json +38 -0
  38. package/assets/skills/README.md +9 -0
  39. package/assets/skills/inspect-surface.md +4 -0
  40. package/dist/agent-host.mjs +50 -0
  41. package/dist/agent-host.mjs.map +1 -0
  42. package/dist/bundle-manifest.json +102 -0
  43. package/dist/chunks/__host-DgGPyco9.mjs +18 -0
  44. package/dist/chunks/__host-DgGPyco9.mjs.map +1 -0
  45. package/dist/chunks/approve-Cv135UqI.mjs +19 -0
  46. package/dist/chunks/approve-Cv135UqI.mjs.map +1 -0
  47. package/dist/chunks/auth-BT5oVp76.mjs +132 -0
  48. package/dist/chunks/auth-BT5oVp76.mjs.map +1 -0
  49. package/dist/chunks/auth-D8rCVY33.mjs +84 -0
  50. package/dist/chunks/auth-D8rCVY33.mjs.map +1 -0
  51. package/dist/chunks/brainstorm-CU10T1tm.mjs +7 -0
  52. package/dist/chunks/brainstorm-CU10T1tm.mjs.map +1 -0
  53. package/dist/chunks/cancel-KV_cpsqS.mjs +15 -0
  54. package/dist/chunks/cancel-KV_cpsqS.mjs.map +1 -0
  55. package/dist/chunks/canonical-C8UxeEmB.mjs +57 -0
  56. package/dist/chunks/canonical-C8UxeEmB.mjs.map +1 -0
  57. package/dist/chunks/catalogue-BvwSrM_j.mjs +1549 -0
  58. package/dist/chunks/catalogue-BvwSrM_j.mjs.map +1 -0
  59. package/dist/chunks/compose-Cr0hP0qm.mjs +7303 -0
  60. package/dist/chunks/compose-Cr0hP0qm.mjs.map +1 -0
  61. package/dist/chunks/config-DefHA2Lw.mjs +96 -0
  62. package/dist/chunks/config-DefHA2Lw.mjs.map +1 -0
  63. package/dist/chunks/contract-B0ra2-bm.mjs +295 -0
  64. package/dist/chunks/contract-B0ra2-bm.mjs.map +1 -0
  65. package/dist/chunks/contract-vYbwYr0Y.mjs +123 -0
  66. package/dist/chunks/contract-vYbwYr0Y.mjs.map +1 -0
  67. package/dist/chunks/deny-ClTxSvHJ.mjs +15 -0
  68. package/dist/chunks/deny-ClTxSvHJ.mjs.map +1 -0
  69. package/dist/chunks/diff-Qw0II0sj.mjs +101 -0
  70. package/dist/chunks/diff-Qw0II0sj.mjs.map +1 -0
  71. package/dist/chunks/discover-30Ciya_0.mjs +20 -0
  72. package/dist/chunks/discover-30Ciya_0.mjs.map +1 -0
  73. package/dist/chunks/doctor-DfCrKpfT.mjs +222 -0
  74. package/dist/chunks/doctor-DfCrKpfT.mjs.map +1 -0
  75. package/dist/chunks/fix-D4Tj8RVA.mjs +18 -0
  76. package/dist/chunks/fix-D4Tj8RVA.mjs.map +1 -0
  77. package/dist/chunks/gc-BBXlBF5w.mjs +161 -0
  78. package/dist/chunks/gc-BBXlBF5w.mjs.map +1 -0
  79. package/dist/chunks/init-Okz4mlhW.mjs +30 -0
  80. package/dist/chunks/init-Okz4mlhW.mjs.map +1 -0
  81. package/dist/chunks/inspect-Buby4cQD.mjs +22 -0
  82. package/dist/chunks/inspect-Buby4cQD.mjs.map +1 -0
  83. package/dist/chunks/logs-Giq5sUau.mjs +25 -0
  84. package/dist/chunks/logs-Giq5sUau.mjs.map +1 -0
  85. package/dist/chunks/migrate-DRoFUg53.mjs +19 -0
  86. package/dist/chunks/migrate-DRoFUg53.mjs.map +1 -0
  87. package/dist/chunks/models-Btp6X2YZ.mjs +24 -0
  88. package/dist/chunks/models-Btp6X2YZ.mjs.map +1 -0
  89. package/dist/chunks/pause-BASBfKLO.mjs +16 -0
  90. package/dist/chunks/pause-BASBfKLO.mjs.map +1 -0
  91. package/dist/chunks/policy-DUIgzF3W.mjs +139 -0
  92. package/dist/chunks/policy-DUIgzF3W.mjs.map +1 -0
  93. package/dist/chunks/providers-Dx78imKj.mjs +19 -0
  94. package/dist/chunks/providers-Dx78imKj.mjs.map +1 -0
  95. package/dist/chunks/reconcile-BfD785gd.mjs +26 -0
  96. package/dist/chunks/reconcile-BfD785gd.mjs.map +1 -0
  97. package/dist/chunks/render-DyZr5Lgi.mjs +53 -0
  98. package/dist/chunks/render-DyZr5Lgi.mjs.map +1 -0
  99. package/dist/chunks/resume-GJQRb2Eb.mjs +15 -0
  100. package/dist/chunks/resume-GJQRb2Eb.mjs.map +1 -0
  101. package/dist/chunks/retry-CLrUem1H.mjs +15 -0
  102. package/dist/chunks/retry-CLrUem1H.mjs.map +1 -0
  103. package/dist/chunks/review-BDdjb6kB.mjs +17 -0
  104. package/dist/chunks/review-BDdjb6kB.mjs.map +1 -0
  105. package/dist/chunks/run-CgTWYlcd.mjs +82 -0
  106. package/dist/chunks/run-CgTWYlcd.mjs.map +1 -0
  107. package/dist/chunks/run-tool-C3rAv4XF.mjs +26 -0
  108. package/dist/chunks/run-tool-C3rAv4XF.mjs.map +1 -0
  109. package/dist/chunks/schema-C9QbUW4H.mjs +578 -0
  110. package/dist/chunks/schema-C9QbUW4H.mjs.map +1 -0
  111. package/dist/chunks/send-BdnJ85Nz.mjs +19 -0
  112. package/dist/chunks/send-BdnJ85Nz.mjs.map +1 -0
  113. package/dist/chunks/ship-DTuLGoaJ.mjs +19 -0
  114. package/dist/chunks/ship-DTuLGoaJ.mjs.map +1 -0
  115. package/dist/chunks/shutdown-BM92Iyv2.mjs +15 -0
  116. package/dist/chunks/shutdown-BM92Iyv2.mjs.map +1 -0
  117. package/dist/chunks/skip-DZG5kpcH.mjs +18 -0
  118. package/dist/chunks/skip-DZG5kpcH.mjs.map +1 -0
  119. package/dist/chunks/spec-Bq0P3jVh.mjs +20 -0
  120. package/dist/chunks/spec-Bq0P3jVh.mjs.map +1 -0
  121. package/dist/chunks/src-CId6kMsY.mjs +1689 -0
  122. package/dist/chunks/src-CId6kMsY.mjs.map +1 -0
  123. package/dist/chunks/src-CfAOde7C.mjs +5403 -0
  124. package/dist/chunks/src-CfAOde7C.mjs.map +1 -0
  125. package/dist/chunks/src-Cu3TxNob.mjs +783 -0
  126. package/dist/chunks/src-Cu3TxNob.mjs.map +1 -0
  127. package/dist/chunks/src-DcU4IXMe.mjs +117 -0
  128. package/dist/chunks/src-DcU4IXMe.mjs.map +1 -0
  129. package/dist/chunks/src-JxawBQBn.mjs +446 -0
  130. package/dist/chunks/src-JxawBQBn.mjs.map +1 -0
  131. package/dist/chunks/src-s7YRvk0t.mjs +2116 -0
  132. package/dist/chunks/src-s7YRvk0t.mjs.map +1 -0
  133. package/dist/chunks/status-SMjiOMYy.mjs +29 -0
  134. package/dist/chunks/status-SMjiOMYy.mjs.map +1 -0
  135. package/dist/chunks/tail-BuhT-2PH.mjs +25 -0
  136. package/dist/chunks/tail-BuhT-2PH.mjs.map +1 -0
  137. package/dist/chunks/update-BXIppsbi.mjs +16 -0
  138. package/dist/chunks/update-BXIppsbi.mjs.map +1 -0
  139. package/dist/cli.mjs +175 -0
  140. package/dist/cli.mjs.map +1 -0
  141. package/package.json +17 -32
  142. package/CHANGELOG.md +0 -1461
  143. package/bin/cli.js +0 -817
  144. package/bin/report.js +0 -141
  145. package/core/adapter/render.js +0 -415
  146. package/core/agents/implementer.template.md +0 -142
  147. package/core/agents/profile-reader.md +0 -50
  148. package/core/agents/release.md +0 -58
  149. package/core/agents/review.md +0 -179
  150. package/core/commands/cohorte-align-ds.md +0 -33
  151. package/core/commands/cohorte-audit.md +0 -58
  152. package/core/commands/cohorte-brainstorm.md +0 -70
  153. package/core/commands/cohorte-build.md +0 -219
  154. package/core/commands/cohorte-doctor.md +0 -194
  155. package/core/commands/cohorte-fix.md +0 -80
  156. package/core/commands/cohorte-fleet.md +0 -103
  157. package/core/commands/cohorte-init-pipeline.md +0 -31
  158. package/core/commands/cohorte-intake.md +0 -92
  159. package/core/commands/cohorte-patch.md +0 -118
  160. package/core/commands/cohorte-refactor.md +0 -59
  161. package/core/commands/cohorte-retro.md +0 -85
  162. package/core/commands/cohorte-review.md +0 -270
  163. package/core/commands/cohorte-ship.md +0 -122
  164. package/core/commands/cohorte-spec.md +0 -101
  165. package/core/commands/cohorte-update-pipeline.md +0 -165
  166. package/core/hooks/gate.py +0 -588
  167. package/core/runtimes/claude.json +0 -74
  168. package/core/runtimes/codex.json +0 -85
  169. package/core/runtimes/cursor.json +0 -76
  170. package/core/runtimes/gemini.json +0 -76
  171. package/core/runtimes/opencode.json +0 -73
  172. package/core/templates/agent-handoff.md +0 -34
  173. package/core/templates/brainstorm-return.md +0 -36
  174. package/core/templates/decisions.template.md +0 -42
  175. package/core/templates/design-brief.md +0 -44
  176. package/core/templates/patch.template.md +0 -86
  177. package/core/templates/pr-body.md +0 -25
  178. package/core/templates/review-feedback.md +0 -38
  179. package/core/templates/spec.template.md +0 -87
  180. package/core/templates/steps/init-pipeline/01-detect-stack.md +0 -44
  181. package/core/templates/steps/init-pipeline/02-interview-gaps.md +0 -55
  182. package/core/templates/steps/init-pipeline/03-draft-profile.md +0 -10
  183. package/core/templates/steps/init-pipeline/04-write-render.md +0 -145
  184. package/core/templates/steps/init-pipeline/05-report.md +0 -12
  185. package/core/workflows/audit.js +0 -240
  186. package/core/workflows/loop.js +0 -641
  187. package/core/workflows/refactor.js +0 -276
  188. package/core/workflows/review.js +0 -456
  189. package/install.ps1 +0 -103
  190. package/install.sh +0 -114
  191. package/lib/doctor.js +0 -534
  192. package/lib/runtime.js +0 -139
  193. package/lib/versions.js +0 -149
  194. package/lib/yaml.js +0 -129
  195. package/profile/PIPELINE.template.md +0 -259
  196. package/profile/SCHEMA.md +0 -735
  197. package/profile/cohorte.config.template.yaml +0 -43
  198. package/scripts/assert-gate-hook.mjs +0 -75
  199. package/scripts/kanban-move.sh +0 -313
  200. package/scripts/metrics/collect.mjs +0 -531
  201. package/scripts/metrics/prices.json +0 -42
  202. package/scripts/new-feature.sh.template +0 -98
  203. package/scripts/preflight.sh +0 -124
  204. package/scripts/remove-feature.sh.template +0 -56
  205. package/scripts/test-adapter.mjs +0 -437
  206. package/scripts/test-gate.mjs +0 -443
  207. package/scripts/test-kanban.mjs +0 -304
  208. package/scripts/test-lib.mjs +0 -356
  209. package/scripts/test-metrics.mjs +0 -156
  210. package/scripts/test-workflows.mjs +0 -758
  211. package/scripts/validate-core.mjs +0 -325
@@ -1,219 +0,0 @@
1
- ---
2
- model: sonnet
3
- description: Author the contract from the frozen spec, then dispatch one implementer agent per surface in parallel.
4
- argument-hint: <feature_id>
5
- ---
6
-
7
- You are the **lead**. Build feature **$ARGUMENTS** from its frozen spec.
8
-
9
- > Read `PIPELINE.md` §`pipeline-profile` first: the `surfaces` list (how many implementers to
10
- > dispatch + their agent names), `contract` (mechanism + path), and the `design` flag. _Skip the
11
- > re-read if it's already in your context this session and unmodified since._
12
- >
13
- > **Kanban** (SCHEMA.md §Kanban): once §1 confirms the frozen spec, run
14
- > `<core>/pipeline/scripts/kanban-move.sh auto $ARGUMENTS building`. `auto` resolves the board from the config itself and
15
- > exits 0 with a `kanban: <reason>` line when there is none — so **never decide "no board is
16
- > configured" without running it**. That inference, not a missing board, is what used to freeze
17
- > cards mid-pipeline.
18
-
19
- ## 1. Load & check
20
-
21
- - Check the spec front-matter FIRST — `grep '^status:' specs/$ARGUMENTS.md` (or Read with a ~15-line
22
- limit) — before any full read. Buildable statuses are `frozen`, `in-review` and `in-progress`
23
- (SCHEMA.md §Spec status). `blocked` means a previous round gave up here: say so, and route by the
24
- spec's `## Remediation` — open items ⇒ `/cohorte-fix`, none ⇒
25
- continue this build. Anything else (`draft`, missing, `shipped`) ⇒ stop and tell the human to run
26
- `/cohorte-spec` first. Only then read the body, selectively: front-matter, §5 contract, the surface
27
- task sections, and `## Remediation` (fall back to a full read if the spec doesn't follow the
28
- template's headings).
29
- - **`kind: patch` in the front-matter ⇒ this is a bug fix** frozen by `/cohorte-patch`, and it is
30
- built by this command like any other spec, with two differences called out where they apply: §1.6
31
- judges it against its regression test instead of a contract, and §2 authors no contract unless §5
32
- carries a delta. Everything else — surface mapping, parallel dispatch, roll call, metrics — is
33
- identical, and `kind` absent means feature, so nothing changes for existing specs.
34
- - **Route check** — if `## Remediation` has open `- [ ]` items and none requires a contract change,
35
- stop and tell the human to run `/cohorte-fix $ARGUMENTS` instead: it re-dispatches only the surfaces with
36
- findings. A full build with open items is only right when the contract change ripples into clean
37
- surfaces (the case `/cohorte-fix` §1 falls back here for).
38
- - **Design gate** — only if `design.enabled` and the feature has UI (some surface `uses_design`): if the
39
- spec front-matter `design_files` is empty, ask the human for the feature's design **links** and store
40
- them in `design_files`, then continue. Each entry is a full self-contained link of the form
41
- `https://claude.ai/design/p/<projectId>?file=<file>` — it carries its own project (the `/p/<projectId>`
42
- path segment) and page (the `?file=` query), so nothing needs a stored project id and the reference
43
- survives a design-system rebuild (a new DS ⇒ just paste the new links, no profile change). _Legacy bare
44
- file names still resolve against the optional `design.design_project` fallback, but new specs use links._
45
- Skip if the feature is backend-only / no UI.
46
- - If this is a fix loop (`## Remediation` has unchecked items), map each open item to a surface by its
47
- `file:line` path — each agent gets ONLY its own surface's items, inlined in its dispatch (§3).
48
-
49
- ## 1.5 Reconcile surfaces — auto-grow / specialize agents
50
-
51
- Map every area the spec touches (§5 contract + each surface's tasks + touched paths) onto the
52
- `surfaces[]` in `PIPELINE.md`. Two triggers add an agent — handle them BEFORE authoring the contract:
53
-
54
- - **Unowned area → new agent.** If the spec introduces work in a tree that falls under NO existing
55
- `surfaces[].path` (a genuinely new thing — a new service, a new app, a new top-level area), that work
56
- has no owner. Auto-detect it and propose a new surface for it.
57
- - **Bottleneck area → specialize.** If one existing surface carries a large, cleanly-separable chunk of
58
- this feature (e.g. a whole new feature-module) that would dominate build time, propose splitting that
59
- chunk into its own specialized surface. Use the heuristic in SCHEMA.md §Specialization — only when the
60
- boundary is clean; skip when tangled or tiny.
61
-
62
- For each surface to add: infer its `key`, `path`, `label`, `agent`, `tools`, `model`, `*_cmd`s, and
63
- `uses_design` (mirror a sibling surface), show the human a one-line proposal, and on go-ahead **render it now** per
64
- SCHEMA.md §"Rendering / reconciling a surface agent" — write the `surfaces[]` entry + §Conventions/§Testing
65
- stanza into `PIPELINE.md`, render `<agents>/<agent>.md` from the implementer template, applying the
66
- shared-code rule (shared trees get a single-owner surface; cross-slice shapes go through the contract).
67
- This is the automatic path: you don't send the human back to `/cohorte-init-pipeline`. If nothing new is needed,
68
- say so and continue. Dispatch (§3) then covers the reconciled surface list.
69
-
70
- **Adding or splitting a surface is an architectural decision** — append ONE line for it to
71
- `specs/_decisions.md` §Live (SCHEMA.md §Decisions; create from `<core>/templates/decisions.template.md`
72
- if absent), area `surfaces`, e.g.
73
- `- <date> · surfaces · <key> owns <path>, single owner of <what> — because <the boundary reason> · $ARGUMENTS`.
74
- One `>>` in the Bash call you're already making. Nothing added ⇒ nothing to append.
75
-
76
- ## 1.6 Readiness verdict — the gate before N dispatches
77
-
78
- **Zero extra agents: you already hold the spec, the profile and the reconciled surface list.** The
79
- whole point is that a bancal spec costs one verdict here instead of N implementers discovering it in
80
- parallel. Judge the frozen contract on **implementability only** — never on whether the feature is a
81
- good idea (that was `/cohorte-brainstorm`), never by re-reading files you don't already need:
82
-
83
- 1. **Contract completeness** (§5) — every endpoint/interface has method+path (or signature), auth,
84
- request fields with types + validation, the success shape, and its error cases. A missing
85
- **request or success shape** ⇒ `NOT-READY` (an implementer would invent it, and the other surface
86
- would invent a different one). A missing **error case** ⇒ `RESERVATIONS`.
87
- **On a `kind: patch` spec this check is replaced, not skipped** — a patch has no contract to be
88
- complete, so judge §1 Symptom & repro + §4 Regression test instead: no stated expected behaviour,
89
- or a §4 that names no test and no reason the fix would be verifiable ⇒ `NOT-READY` (an implementer
90
- would fix whatever it guessed the bug was, and nothing would catch a wrong guess). A repro
91
- explicitly frozen as a hypothesis, or a cause left to the implementer to find, is
92
- `RESERVATIONS` — normal for a patch, never a blocker. Then judge §5 as above **only** if it
93
- carries a delta rather than `none`.
94
- 2. **Surface coverage** — every §6 task maps to a surface in the reconciled list, and every contract
95
- entry has an owner **on each side it names** (producer and consumer). A contract entry no surface
96
- owns ⇒ `NOT-READY`.
97
- 3. **Dependencies exist** — for the modules, packages, tables, env vars and shared helpers the spec
98
- names as *pre-existing*: verify them in ONE Bash call (`test -f` / `grep -l` / a package-manifest
99
- grep, output redirected — never a file read per name). Named as pre-existing but absent, and not
100
- listed as created by this feature ⇒ `NOT-READY`.
101
- 4. **Residual ambiguity** (§10) — an open question a surface would have to *guess* at: blocks a
102
- contract decision ⇒ `NOT-READY`; merely narrows an implementation choice ⇒ `RESERVATIONS`.
103
- 5. **Design gate** — a `uses_design` surface in scope with `design_files` still empty ⇒ `NOT-READY`
104
- (this is §1's gate restated as a verdict, so an automated driver sees the same fact).
105
-
106
- Write the machine-readable verdict to `specs/reports/$ARGUMENTS.readiness.json` (overwrite,
107
- `mkdir -p specs/reports` first — the same gitignored buffer dir `/cohorte-review` stages into, which may not
108
- exist yet on a first build) — on **every** build, including `READY`. It is the only channel between
109
- this gate and any automated driver, which parses no prose:
110
-
111
- ```json
112
- { "id": "$ARGUMENTS", "phase": "readiness", "ts": "<ISO>", "verdict": "RESERVATIONS",
113
- "gaps": ["contract|POST /orders|no 409 case for a duplicate id"],
114
- "surfaces": ["backend", "frontend"] }
115
- ```
116
-
117
- - **`gaps`** — one normalized string per gap, `<check>|<where>|<what is missing>`: `<check>` is
118
- `contract` · `coverage` · `dependency` · `ambiguity` · `design` — plus `repro` on a `kind: patch`
119
- spec, for a gap check 1 raised against §1/§4; `<where>` is the contract entry,
120
- surface key or dependency name (no `:line` — it shifts on every edit); `<what>` is the gap, not the
121
- fix. `READY` ⇒ `[]`.
122
- - **`NOT-READY` ⇒ STOP: author no contract and spawn NO agent.** Print the gaps and send the human to
123
- `/cohorte-spec $ARGUMENTS` to patch the contract, then re-run `/cohorte-build`. This abort is the whole point of the
124
- step — a spec that cannot be built does not get cheaper by being built N times in parallel.
125
- - **`RESERVATIONS` ⇒ continue.** It never blocks (a gate that stalls a sound build on a missing error
126
- case would cost more human round-trips than it saves): inline each gap verbatim into the dispatch of
127
- the surface it affects, as an explicit assumption the agent must implement *and* flag in its handoff,
128
- and relay the list to the human in one line each.
129
- - **`READY` ⇒ continue silently** — one line, no restatement.
130
-
131
- ## 2. Author the contract (lead-only — the single sync channel)
132
-
133
- _Skipped entirely on a `kind: patch` spec whose §5 Contract delta is `none`_ — which is the usual
134
- case: a bug fix corrects behaviour behind a shape that already exists, and re-authoring that shape
135
- would put the contract file in the diff for nothing. Say you skipped it and why, in one line. A patch
136
- whose §5 **does** carry a delta is authored exactly as below, from the delta, against the existing
137
- file — never rewritten from scratch. (A patch needing *new* contract surface area never reaches here:
138
- `/cohorte-patch` §3 routes it to `/cohorte-spec`.) When you skip, still run `date +%s` on its own —
139
- the skipped postcondition is where §4's wall-clock start comes from, and a build with no start epoch
140
- writes a metrics line with no duration.
141
-
142
- _Only if `contract.enabled`._ From §5 of the spec, write/update the feature's contract file at
143
- `<contract.path>/$ARGUMENTS.<contract.ext>` in the profile's `mechanism` (e.g. Zod v4 schemas + inferred
144
- types for `shared-types-zod`). Export it from `contract.index` if set. This is the ONLY file the agents
145
- share; they import it read-only and must not edit it. If `contract.enabled` is false, the spec prose is
146
- the sync channel — say so and skip, but still run `date +%s` on its own (same as the patch skip
147
- above: §4's wall-clock start comes from here, and a build with no start epoch writes a metrics
148
- line with no duration). **Postcondition (if `contract.enabled`):**
149
- `test -f <contract.path>/$ARGUMENTS.<contract.ext> && date +%s` — the contract file must exist before
150
- you dispatch §3, or the stateless agents have nothing to build against (the epoch output is §4's
151
- wall-clock start — no separate timing call).
152
-
153
- ## 3. Dispatch one implementer per surface — IN PARALLEL
154
-
155
- Spawn every surface's agent in a **single message** (one dispatch each) so they run concurrently —
156
- NEVER serially: build wall-clock must be the slowest surface, not the sum. Use
157
- the reconciled `surfaces` list from §1.5 (existing + any just-rendered). Give EACH only what a stateless
158
- agent needs — re-supply everything every time, as **exact file paths** (spec, contract, the surface's
159
- tree), never "find the relevant files". Keep the dispatch prompt **byte-identical across dispatches
160
- and fix loops** except the two variable slots, which sit at the END of the prompt so every repeat hits
161
- the prompt-cache prefix. Never paste a diff into a dispatch — the agent computes its own, scoped to its
162
- tree. For each surface in `surfaces`:
163
-
164
- > `subagent_type: <surface.agent>` — "Implement the **<surface.key>** surface for feature `$ARGUMENTS`.
165
- > Read `PIPELINE.md` first. Spec: `specs/$ARGUMENTS.md`. Contract: `<contract.path>/$ARGUMENTS.<ext>`
166
- > (import read-only). Work test-first. Touch only `<surface.path>`. Need the current state of your
167
- > tree? Compute it yourself: `git diff <default_branch> -- <surface.path>`. Return the handoff in the
168
- > format your agent instructions define. Design files: <the spec's `design_files` links — each
169
- > `https://claude.ai/design/p/<projectId>?file=<file>` carries its own project + page, fetch read-only
170
- > via `DesignSync get_file`, build mobile-first · or `none` (non-design surface, or a fix loop whose
171
- > open items are all non-visual)>. Open Remediation items for YOUR surface (self-contained — fix
172
- > exactly these, reading only the files they name; `none` ⇒ first build, implement the spec's tasks
173
- > for your surface): <the surface's open `- [ ]` lines verbatim, or `none`>. Readiness gaps for YOUR
174
- > surface (§1.6 `RESERVATIONS` — the spec is silent here: implement the stated assumption and flag what
175
- > you assumed in your handoff): <that surface's `gaps` entries verbatim, or `none`>."
176
-
177
- ## 3.5 Roll call — account for EVERY dispatch before integrating
178
-
179
- A surface's work can die: a rate limit mid-run, a transport error after retries, context exhausted.
180
- When it does, it returns **nothing** — and nothing is byte-identical to "a clean surface with nothing
181
- to report". Silence is not a green light; treat it as the failure it is (SCHEMA.md §Dead agents).
182
-
183
- - **Roll call.** Every surface handled in §3 must come back with a handoff in the format its
184
- agent instructions define. Missing, empty, or truncated mid-sentence ⇒ that surface is **dead**.
185
- - **Never infer success from silence,** and never speak for a dead agent — you did not see its work.
186
- - **Retry that surface ONCE, alone.** Re-dispatch it with the byte-identical §3 prompt. The other
187
- surfaces' work is already on disk and untouched, so this costs one agent, not a rebuild — and most
188
- deaths are transient. Never retry a surface that *did* answer.
189
- - **Died twice ⇒ stop guessing and look.** Run that surface's own quiet commands
190
- (`<surface>.typecheck_cmd`, `lint_quiet_cmd`, `test_quiet_cmd`) with output redirected to
191
- `specs/reports/$ARGUMENTS.<key>.deadcheck.txt`, then grep it — never into your context. Report the
192
- three results plus which of the spec's tasks for that surface actually landed, checked against the
193
- tree, not against a handoff you never got. Say plainly that the surface is **unverified**.
194
-
195
- ## 4. Integrate
196
-
197
- When all return, flag any contract mismatch or failing test from the handoffs; otherwise print one
198
- status line per surface (`<key> · tests pass/fail · <n> TODOs`) — do not restate handoff content.
199
- A dead surface (§3.5) prints `<key> · DEAD — unverified` and **the batch is never reported as ok**.
200
- Append **ONE line for the batch** to the **main checkout's** `<state>/pipeline-metrics.jsonl` —
201
- NOT the worktree's, which dies at teardown while metrics must accumulate across features. Resolve
202
- it from anywhere: `$(dirname "$(git rev-parse --git-common-dir)")/<state>/pipeline-metrics.jsonl`
203
- (in the main checkout this resolves to itself). Create it if absent; it must be gitignored.
204
- Compute the elapsed time in the same Bash call
205
- (`echo "{...\"seconds\":$(($(date +%s)-<start epoch from §2>)),...}" >> …`):
206
- `{"ts":"<ISO date>","feature":"$ARGUMENTS","phase":"build","seconds":<wall-clock>,"surfaces":{"<key>":"ok|error|dead",…}}`
207
- — **write this line even when a surface died.** An incomplete batch is exactly the batch worth having
208
- in the record; skipping the append to "wait until it's complete" silently deletes the evidence that
209
- anything went wrong. In the same call write the machine-readable batch result to
210
- `specs/reports/$ARGUMENTS.build.json` (overwrite) — the channel an automated driver reads, since it
211
- never sees your chat:
212
- `{"id":"$ARGUMENTS","phase":"build","ts":"<ISO>","surfaces":{"<key>":"ok|error|dead",…},"dead":["<key>",…]}`
213
- — this is the evidence SCHEMA.md §Specialization asks for before splitting a surface.
214
- Then tell the human: exercise the feature by hand if it's worth it, then run `/cohorte-review $ARGUMENTS` —
215
- unless a surface is dead, in which case say so first and let them decide whether to re-run `/cohorte-build`
216
- (a dead surface has no findings, so `/cohorte-fix` has nothing to re-dispatch).
217
- Do not run the app or migrations yourself here — building is not running.
218
- **Recommend a `/clear` now** — the spec, contract and diff are all on
219
- disk, and the lead's history is re-sent at input price on every turn it survives.
@@ -1,194 +0,0 @@
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. **Runtime.** Say which coding agent you are running as and what it can enforce — every check
16
- below is read through it. **You already know which one**: the Runtime preamble at the top of
17
- this file names it. Read `<core>/pipeline/runtimes.json` for the details — a map of every
18
- runtime installed against this core, since they share one core. Report one line:
19
- `runtime: <label> · scope <global|project> · hooks <yes|no> · workflows <yes|no>`,
20
- and name the other installed runtimes if there are any (they share `<state>` and `<config>`, so
21
- a board or a gate config wired from one is seen by all — that is intended, and worth stating).
22
- File absent ⇒ a core installed before the adapter existed ⇒ ⚠️, fix by re-running the installer.
23
- A runtime without hooks makes check 3's gate **advisory** — say so there rather than
24
- reporting a false ✅.
25
- 1. **Core & pointer.** A core exists (`<core>/pipeline/VERSION`); `<state>/pipeline.json` names a mode + `core_version`
26
- coherent with the VERSION file. A **global**-mode pointer lagging the VERSION file is ⚠️, not ❌:
27
- nothing bumped that field before 1.2.5, so the core itself is fine and only the pointer is stale
28
- ⇒ fix by running `/cohorte-update-pipeline` (§3 syncs it now), or by editing the one field. Compare
29
- against `npm view cohorte version` — behind ⇒ suggest `/cohorte-update-pipeline`. Read `pipeline/CHANGELOG.md` for what they're missing. The router
30
- commands' step files are present — `templates/steps/init-pipeline/` non-empty (a router whose
31
- `templates/steps/<cmd>/` dir is missing is a partial/stale install ⇒
32
- re-run install/update). **Shipped scripts present and executable** in `<core>/pipeline/scripts/`:
33
- `kanban-move.sh`, `preflight.sh`; the `new-feature.sh.template` and
34
- `remove-feature.sh.template` sources must be readable, not executable — ❌ any missing one.
35
- Every caller chains these with `|| true`, so an absent script is a **silent**
36
- no-op (no kanban card moves, no error anywhere) — this check is the only thing
37
- that sees it. Also flag ❌ a `VERSION` **newer than** the other `pipeline/` files (compare mtimes):
38
- a version bumped without a full re-copy is a half-done update ⇒ re-run install/update.
39
- 2. **Profile.** `PIPELINE.md` exists and its `yaml pipeline-profile` block parses. Every
40
- <!-- cohorte:if runtime:codex -->
41
- `surfaces[].agent` has a valid `.codex/agents/<agent>.toml` in this project, regardless of
42
- core scope. Check `name`, `description`, `developer_instructions` and no unfilled placeholders.
43
- Reconcile only this project's agents; never treat unrelated global agents as orphans.
44
- Generic `review.toml`, `release.toml`, `profile-reader.toml` live under `<fixed-agents>/`.
45
- The read-only generic agents must carry `sandbox_mode = "read-only"`.
46
- Missing `model` means inheritance, not an error. Reject Anthropic aliases; compare explicit
47
- Codex model pins with the profile when supplied. Claude `tools:` is not a Codex TOML field.
48
- Flag project launchers that redefine `CODEX_HOME` just to discover local agents; native
49
- project discovery needs no auth symlink. Do not delete global agents without checking ownership.
50
- <!-- cohorte:else -->
51
- `surfaces[].agent` has its `<agents>/<agent>.md` and every agent file has its `surfaces[]`
52
- entry — **no orphans either way** (SCHEMA.md rule). Each rendered agent's frontmatter `tools`
53
- matches its surface's `tools` (incl. `DesignSync` iff `uses_design`, retrieval MCP tools iff
54
- `retrieval.provider` ≠ `none`). **Model pins:** each rendered agent's frontmatter `model` matches
55
- its `surfaces[].model` — ❌ if missing, mismatched, or a literal `<SURFACE_MODEL>` placeholder
56
- (all three silently fall back to inheriting the lead session's model — often Opus — on every
57
- dispatch); ⚠️ any `inherit` with the note that it bills at the lead's tier. The generic agents
58
- (`review.md`, `release.md`, `profile-reader.md` in `<agents>/`) must
59
- each carry their `model:` line too (sonnet/haiku/haiku).
60
- <!-- cohorte:endif -->
61
- <!-- cohorte:if runtime:claude -->
62
- **Command pins:** every mechanical command file
63
- (`build`, `review`, `fix`, `ship`, `audit`, `refactor`, `doctor`, `align-ds`,
64
- `update-pipeline` — in `<commands>/`) carries `model: sonnet` in
65
- its frontmatter — ⚠️ if missing (the lead's orchestration turn then bills at the session model,
66
- e.g. Opus/Fable). `brainstorm`, `spec`, `patch`, and `init-pipeline` are intentionally unpinned
67
- (interactive — they inherit the session model).
68
- <!-- cohorte:endif -->
69
-
70
- 3. **Hooks & gate.** `<state>/gate-config.json` exists and mirrors the profile's `gate` block
71
- (regenerate if drifted).
72
- <!-- cohorte:if hooks -->
73
- The gate hook is registered **once** in the config file the Runtime preamble names — flag a
74
- double registration, it double-prompts — and its `command` points at a `gate.py` that exists.
75
- Check the **matcher** actually covers what it must: on Claude Code that means both `Bash` and
76
- `Task`, since the preflight phase gate keys off `Task` dispatches and a `Bash`-only matcher
77
- leaves it silently dead (the 1.3.0–1.3.1 regression).
78
- <!-- cohorte:if runtime:codex -->
79
- Codex's matcher must cover `Bash` plus `spawn_agent`/`Agent`, and
80
- `gate.py` must read `tool_input.agent_type`. With preflight enabled and no fresh stamp,
81
- a synthetic `spawn_agent` review payload must be denied. Check client hook enablement/trust
82
- separately; a direct script check is not proof the client invoked it.
83
- <!-- cohorte:endif -->
84
- Test the evaluator too: `python3 <core>/hooks/gate.py --check "<a pattern from the ask list>"` must
85
- return a non-`allow` verdict. If the Runtime preamble said this runtime has **no confirmation
86
- tier**, state it here too: every `ask` pattern behaves as a `deny`, which is safe but stricter
87
- than the profile reads, and a human who expects a prompt will read the refusal as a bug.
88
- <!-- cohorte:endif -->
89
- <!-- cohorte:if !hooks -->
90
- This runtime has **no blocking hook**, so the gate is **advisory**: it only fires when the agent
91
- calls it. Say that in one line rather than reporting ✅ — the enforcement property genuinely is
92
- weaker here, and a human who thinks otherwise will approve less carefully. Verify what CAN be
93
- verified: `<core>/hooks/gate.py` exists and `python3 <core>/hooks/gate.py --check "git push"`
94
- returns a verdict line (a non-`allow` on a gated pattern proves config + script are wired). ❌ if
95
- the script is missing or errors; ℹ️ "advisory (this runtime has no hooks)" otherwise.
96
- <!-- cohorte:endif -->
97
- Then the **preflight stamp is local, never versioned**: `git ls-files --error-unmatch
98
- <state>/preflight.ok` must miss, and `.gitignore` must cover it. A tracked stamp is a ❌ (not a
99
- ⚠️) — it records the tree it verified, the commit that carries it moves HEAD past that tree, and
100
- the committed copy lands in every clone and new worktree; the gate then blocks clean trees and
101
- greens unchecked ones. fix: `git rm --cached <state>/preflight.ok` + add it to `.gitignore`.
102
- 4. **Retrieval** (if `retrieval.provider` ≠ `none`). Run the SCHEMA.md §Code retrieval health
103
- <!-- cohorte:if runtime:codex -->
104
- check: CLI resolvable from PATH, `[mcp_servers.<provider>]` in `.codex/config.toml`,
105
- `.serena/` gitignored, and tools actually connected in this session. A standalone
106
- `.mcp.json` is not Codex project registration.
107
- <!-- cohorte:else -->
108
- check: CLI resolvable from PATH, `.mcp.json` entry present in PATH-proof launcher form,
109
- `.serena/` gitignored, server actually connects.
110
- <!-- cohorte:endif -->
111
- 5. **Design** (if `design.enabled`). `snapshot_dir` exists and is committed; `ui_kit_path` +
112
- `tokens_path` exist; if `provider: claude-design`, `DesignSync` responds (`list_files` on the `design_system_project`) and
113
- `design_system_project` is reachable. Recall: spec `design_files` are full
114
- `…/design/p/<projectId>?file=<file>` links that carry their own project + page; `design_project` is
115
- only a legacy fallback for old bare-filename specs (default `none`).
116
- 6. **Isolation** (if `isolation.enabled`). `scripts/new-feature.sh` + `scripts/remove-feature.sh`
117
- rendered (no `__TOKEN__` placeholders left). `.worktrees/slots.tsv` coherent with
118
- `git worktree list` — flag **stale slots** (registered but no worktree) and **zombie worktrees**
119
- (worktree but no slot / spec already `shipped`) ⇒ suggest `scripts/remove-feature.sh <id>`.
120
- When ≥2 slots are live, print the parallel-feature table (feature · worktree · ports · db ·
121
- branch behind main by N commits) — a worktree far behind main means its next review will diff
122
- against stale code ⇒ suggest rebasing it.
123
- 7. **Kanban** (the board mirror — SCHEMA.md §Kanban). Run
124
- `<core>/pipeline/scripts/kanban-move.sh --check` and report its one line verbatim: the resolved
125
- board path, or the exact link that is missing. A board mirror is optional, so "not configured" is
126
- ℹ️, never ❌ — but it must be **stated**, because the whole class of bug here is a card that
127
- quietly stopped moving while every command still reported success. Two states earn a ⚠️ with the
128
- fix named: `boards` has no entry for this profile's `name` while it does have an entry for some
129
- other key whose board file exists (a **rename** orphaned the link — re-key it via
130
- `/cohorte-update-pipeline`), and an entry whose board file no longer exists at
131
- `vault_path`-relative `board` (moved or renamed in the vault).
132
- <!-- cohorte:if workflows -->
133
- 8. **Workflows** (the opt-in execution path — SCHEMA.md §Workflows; the conversational commands
134
- stay the default, so failures here are ⚠️ at most, never ❌). Report which path this machine will
135
- take and why:
136
- - **Claude Code version** ≥ 2.1.154 (`claude --version 2>/dev/null | head -1`) — older or no CLI
137
- on PATH ⇒ conversational only. This is the **workflow** floor and the only one that gates this
138
- check; do NOT raise it to match a newer feature's floor, or every install between the two
139
- versions reads as broken while its workflows run fine. When `design.inline` is on, report the
140
- design floor (≥ 2.1.234) as its own line under check 8b — separate prerequisite, separate verdict.
141
- - **Scripts present:** `<core>/workflows/review.js` + `audit.js` + `refactor.js` + `loop.js` —
142
- missing on a current core ⇒ half-done install, re-run install/update. (`/cohorte-loop` is
143
- **workflow-only** — no command file exists on purpose; without this runtime it refuses
144
- rather than degrading to a conversational loop.)
145
- - **Phase-0 agent present:** `<agents>/profile-reader.md` — the workflows abort without it.
146
- - **Workflows enabled in this session** — the `Workflow` tool is in your own toolset right now;
147
- absent ⇒ disabled for this session (a setting or an old client), conversational path.
148
- - **Preflight wiring** (used by both paths): `pipeline/scripts/preflight.sh` executable and
149
- `gate-config.json` carries the `preflight` block — mismatch ⇒ regenerate from the profile.
150
- End the check with ONE summary line, e.g.
151
- `workflows: available (opt-in — ask to "run the review workflow")` or
152
- `workflows: unavailable (<first failing prerequisite>) — conversational commands (the default)`.
153
- <!-- cohorte:if inline_design -->
154
- 8b. **Inline design** (`design.inline: true` — the `/design` artboard step between spec and build).
155
- A research preview, so every failure here is ⚠️, never ❌: the design brief still exists on disk
156
- at `specs/design/<feature_id>.md` and can be carried to the design tool by hand, which is what
157
- every install did before this flag. Report:
158
- - **Claude Code version** ≥ 2.1.234 — `/design` ships as a skill and is simply absent below it.
159
- Older CLI ⇒ say so and name `npm i -g cohorte@latest`'s sibling, `claude update`.
160
- - **The `/design` skill resolves in this session** — absent ⇒ the preview is off for this account
161
- or plan (Pro/Max/Team/Enterprise are the eligible ones), not a cohorte defect.
162
- - **`design.enabled` is true and `provider` is `claude-design`** — `inline` on top of a `figma` or
163
- `none` provider is a profile contradiction; name it and point at `/cohorte-update-pipeline`.
164
- - **Artboards are not persisted for you.** State it every run, unconditionally, even when all
165
- three checks pass: the preview hands designs to the build step but does not save them, so an
166
- artboard nobody exported dies with the session. This is the single thing most likely to lose
167
- work, and it is not detectable after the fact.
168
- One summary line: `inline design: available (preview — export artboards yourself)` or
169
- `inline design: unavailable (<first failing prerequisite>) — design brief on disk, carry it over by hand`.
170
- <!-- cohorte:endif -->
171
- <!-- cohorte:else -->
172
- 8. **Preflight wiring.** `<core>/pipeline/scripts/preflight.sh` is executable and
173
- `gate-config.json` carries the `preflight` block — mismatch ⇒ regenerate from the profile.
174
- (The workflow execution path does not exist on this runtime; the conversational commands are
175
- the only path, which is also the default everywhere else. Not a defect — state it and move on.)
176
- <!-- cohorte:endif -->
177
- 9. **Specs & metrics.** Every `specs/*.md` front-matter `status` is a valid stage — one of
178
- `draft · frozen · in-progress · in-review · shipped · blocked` (SCHEMA.md §Spec status) — excluding
179
- `_`-prefixed files (the spec template and `specs/_decisions.md`, the decision journal) and
180
- `specs/refactor-backlog.md`, which `/cohorte-audit` writes as a backlog, not a
181
- spec, and which has no front-matter to check. A spec left `in-progress` or `blocked` is a round
182
- that never finished ⇒ say so and route it: open `## Remediation` items ⇒ `/cohorte-fix`, none ⇒
183
- `/cohorte-build`. `shipped` specs
184
- with a live worktree flagged (see 6). `<state>/pipeline-metrics.jsonl` and `specs/reports/` (the
185
- `/cohorte-review` report buffer that lets a `/cohorte-fix` survive a `/clear`) are gitignored. Metrics
186
- belong to the **main checkout** — a `pipeline-metrics.jsonl` inside a live feature worktree is a
187
- stale-core sign (its lines die at teardown) ⇒ suggest appending its lines to the main checkout's
188
- file and deleting the stray.
189
-
190
- ## Report
191
-
192
- Group by check, one line each: `✅|⚠️|❌ <check> — <one-line detail>`; every ⚠️/❌ followed by
193
- ` fix: <exact command or edit>`. End with the overall count and, if anything failed, the ordered
194
- repair sequence. Nothing failing ⇒ say the installation is healthy, and the installed core version.
@@ -1,80 +0,0 @@
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** (SCHEMA.md §Kanban): 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 (SCHEMA.md §Dead agents).** 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.
@@ -1,103 +0,0 @@
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). Relay each script's output
45
- line; a script failure stops the plan for that feature, never silently.
46
- 5. **Write `specs/reports/fleet.json`** (overwrite): `{"ts":"<ISO>","order":[...ids in merge
47
- order...],"features":{"<id>":{"worktree":"<path>","branch":"<branch>","dependsOn":[...]}}}`.
48
- 6. **Print the launch plan** — one line per feature, in order: the worktree path to open a
49
- session in, and the first command to run there (`/cohorte-build <id>`, or "ask for the loop
50
- workflow: `{feature: \"<id>\"}`" on a runtime that has it). The human launches them; the
51
- fleet does not.
52
-
53
- ## `status` — one table, no archaeology
54
-
55
- Read `fleet.json` (absent ⇒ say `plan` comes first, stop). For each feature, **mechanical reads
56
- only, redirected — always from THAT feature's worktree**, never the main checkout (each worktree
57
- carries its own copy of `specs/<id>.md` and `specs/reports/`, and that copy is the one its run
58
- has been writing): `<worktree>/specs/<id>.md` front-matter `status` · the worktree's
59
- `specs/reports/<id>.loop.json` (`phase`/`round`/`outcome`) and `<id>.verdict.json`
60
- (`verdict`/`blocking`) when present · then ONE
61
- `git -C <worktree> fetch --quiet origin <default_branch> || true` and
62
- `git -C <worktree> rev-list --count origin/<default_branch>..HEAD` and `..origin/<default_branch>`
63
- (ahead / **behind** — behind is the number that matters, and against the *remote* ref: the local
64
- one goes stale the moment a PR merges on the host, which is precisely when status gets asked).
65
- One row per feature, in merge order:
66
-
67
- ```
68
- <id> · <status> · loop: <phase> r<round> | <outcome> · blocking: <n> · ↑<ahead> ↓<behind> · next: <the one action>
69
- ```
70
-
71
- `next` is the whole point of the mode: the single action per feature (a command to run in its
72
- worktree, "waiting on <dep> to merge", "ready to ship — its turn in the order", or "rebase
73
- needed — run sync"). A worktree registered in `fleet.json` but gone from
74
- `git worktree list` is reported as such, never silently dropped.
75
-
76
- ## `sync` — the post-merge sweep
77
-
78
- Run after every merge (the human says which feature shipped, or you detect it: spec
79
- `status: shipped` + branch merged into `<default_branch>`):
80
-
81
- 1. Drop the shipped feature from `fleet.json` (rewrite, keep order of the rest) — and if its
82
- worktree still exists, remind the teardown `/cohorte-ship` proposes:
83
- `scripts/remove-feature.sh <id>` (`--drop-db` at the human's call). Never run it unasked.
84
- 2. For each surviving worktree, in merge order — `git -C <worktree> fetch origin
85
- <default_branch>` **always**, then decide whether the rebase is THIS session's to run:
86
- - **Tree dirty** (`git -C <worktree> status --porcelain` non-empty — the NORMAL mid-flight
87
- state: feature work stays uncommitted until `/cohorte-ship`, so `git rebase` would refuse
88
- with "unstaged changes" before any conflict even exists) **or a run in flight** (the
89
- worktree's `loop.json` has no `outcome`): **do not touch it.** Report the row as
90
- `rebase needed — run \`git rebase origin/<default_branch>\` from that worktree's own
91
- session` (mutating a branch from outside its session, mid-run, is how work disappears).
92
- - **Clean and idle**: rebase it, output redirected to `specs/reports/fleet-sync.txt`. A
93
- conflict is reported verbatim and left for its owner (`git rebase --abort` restores) —
94
- never resolved, never `--force`-anything from here.
95
- 3. **Say the consequence out loud, per rebased (or rebase-needed) worktree:** the rebase moves
96
- every commit, so any `reviewed_base`/`reviewed_digest` in that spec then describes a tree
97
- that no longer exists — `/cohorte-ship` will (rightly) refuse until a fresh
98
- `/cohorte-review` re-stamps it. A clean rebase is not a re-verdict; the re-review is.
99
- 4. Reprint the `status` table.
100
-
101
- In chat, every mode prints its table/plan and nothing else — the matrix evidence and rebase
102
- logs live in `specs/reports/`. **Recommend a `/clear`** after `plan` (the flight plan is on
103
- disk; the sessions doing the flying are elsewhere anyway).
@@ -1,31 +0,0 @@
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
- > **Where the core lives (bundled vs global).** `<core>` above already names it — the adapter
13
- > resolved the scope at install time, so nothing here probes. Read it once to learn WHICH mode you
14
- > are in (`<core>` inside this repo ⇒ `bundled`; `<core>` under your home ⇒ `global`) and remember
15
- > it — Phase 4 branches on it. **Everything you GENERATE is always written into THIS repo**
16
- > (`PIPELINE.md` at the root, agents under `<agents>/`, config under `<state>/`), never into the
17
- > global core.
18
- >
19
- > Work in phases. Do not write any file until Phase 4.
20
-
21
- ## Steps — run in order
22
-
23
- | # | Step | Does | When |
24
- | --- | --- | --- | --- |
25
- | 01 | `01-detect-stack` | Detect stack, read-only — no questions yet | always |
26
- | 02 | `02-interview-gaps` | Ask only the gaps you couldn't detect | always |
27
- | 03 | `03-draft-profile` | Assemble & show the PIPELINE.md draft | always |
28
- | 04 | `04-write-render` | Write files & render surface agents | after go-ahead |
29
- | 05 | `05-report` | Print install mode, files, mapping | always |
30
-
31
- **Before running a step, read its file** in `<core>/templates/steps/init-pipeline/`. This table is a map, not the instructions.