cohorte 3.0.0-dev.8 → 3.0.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.
- package/CHANGELOG.md +1532 -0
- package/README.md +316 -62
- package/bin/cli.js +212 -0
- package/bin/report.js +141 -0
- package/core/agents/cohorte-profile-reader.md +50 -0
- package/core/agents/cohorte-release.md +58 -0
- package/core/agents/cohorte-review.md +174 -0
- package/core/agents/implementer.template.md +146 -0
- package/core/commands/cohorte-align-ds.md +33 -0
- package/core/commands/cohorte-audit.md +67 -0
- package/core/commands/cohorte-brainstorm.md +73 -0
- package/core/commands/cohorte-build.md +241 -0
- package/core/commands/cohorte-doctor.md +133 -0
- package/core/commands/cohorte-fix.md +80 -0
- package/core/commands/cohorte-fleet.md +111 -0
- package/core/commands/cohorte-init-pipeline.md +30 -0
- package/core/commands/cohorte-intake.md +92 -0
- package/core/commands/cohorte-patch.md +118 -0
- package/core/commands/cohorte-refactor.md +57 -0
- package/core/commands/cohorte-retro.md +85 -0
- package/core/commands/cohorte-review.md +224 -0
- package/core/commands/cohorte-ship.md +155 -0
- package/core/commands/cohorte-spec.md +105 -0
- package/core/commands/cohorte-update-pipeline.md +115 -0
- package/core/hooks/gate.py +2931 -0
- package/core/templates/agent-handoff.md +34 -0
- package/core/templates/brainstorm-return.md +42 -0
- package/core/templates/decisions.template.md +42 -0
- package/core/templates/design-brief.md +37 -0
- package/core/templates/patch.template.md +86 -0
- package/core/templates/pr-body.md +25 -0
- package/core/templates/review-feedback.md +46 -0
- package/core/templates/spec.template.md +88 -0
- package/core/templates/steps/init-pipeline/01-detect-stack.md +44 -0
- package/core/templates/steps/init-pipeline/02-interview-gaps.md +55 -0
- package/core/templates/steps/init-pipeline/03-draft-profile.md +9 -0
- package/core/templates/steps/init-pipeline/04-write-render.md +91 -0
- package/core/templates/steps/init-pipeline/05-report.md +11 -0
- package/core/templates/steps/review-pr/01-pr-mode.md +54 -0
- package/core/workflows/audit.js +306 -0
- package/core/workflows/loop.js +687 -0
- package/core/workflows/refactor.js +291 -0
- package/core/workflows/review.js +491 -0
- package/install.ps1 +72 -0
- package/install.sh +69 -0
- package/lib/doctor.js +472 -0
- package/lib/install.js +377 -0
- package/lib/project.js +322 -0
- package/lib/render.js +121 -0
- package/lib/versions.js +145 -0
- package/lib/yaml.js +174 -0
- package/package.json +36 -17
- package/profile/PIPELINE.template.md +250 -0
- package/profile/SCHEMA.md +749 -0
- package/profile/cohorte.config.template.yaml +43 -0
- package/scripts/feature-diff.sh +118 -0
- package/scripts/kanban-move.sh +307 -0
- package/scripts/metrics/collect.mjs +542 -0
- package/scripts/metrics/prices.json +42 -0
- package/scripts/new-feature.sh.template +122 -0
- package/scripts/preflight.sh +114 -0
- package/scripts/remove-feature.sh.template +56 -0
- package/assets/manifest.json +0 -203
- package/assets/migrations/config/README.md +0 -12
- package/assets/migrations/state/0001_init.sql +0 -154
- package/assets/prompts/README.md +0 -11
- package/assets/prompts/agents/brainstormer.md +0 -3
- package/assets/prompts/agents/fixer.md +0 -7
- package/assets/prompts/agents/implementer.md +0 -12
- package/assets/prompts/agents/reviewer.md +0 -8
- package/assets/prompts/agents/security-reviewer.md +0 -7
- package/assets/prompts/agents/spec-author.md +0 -3
- package/assets/prompts/phases/build.md +0 -5
- package/assets/prompts/phases/review.md +0 -5
- package/assets/prompts/phases/test.md +0 -5
- package/assets/prompts/system.md +0 -11
- package/assets/schemas/agent-output.schema.json +0 -225
- package/assets/schemas/auth-status.schema.json +0 -87
- package/assets/schemas/command-result.schema.json +0 -192
- package/assets/schemas/commands.schema.json +0 -959
- package/assets/schemas/config.schema.json +0 -2281
- package/assets/schemas/doctor-report.schema.json +0 -104
- package/assets/schemas/events.schema.json +0 -8514
- package/assets/schemas/fake-script.schema.json +0 -549
- package/assets/schemas/inspect.schema.json +0 -3133
- package/assets/schemas/manifest.schema.json +0 -79
- package/assets/schemas/ownership.schema.json +0 -52
- package/assets/schemas/policy-verdict.schema.json +0 -282
- package/assets/schemas/project-model.schema.json +0 -783
- package/assets/schemas/project-status.schema.json +0 -217
- package/assets/schemas/reconcile-plan.schema.json +0 -154
- package/assets/schemas/run-diff.schema.json +0 -177
- package/assets/schemas/run-snapshot-manifest.schema.json +0 -2104
- package/assets/schemas/run-state.schema.json +0 -1755
- package/assets/schemas/runtime-capabilities.schema.json +0 -1545
- package/assets/schemas/sandbox-capabilities.schema.json +0 -116
- package/assets/schemas/skill.schema.json +0 -87
- package/assets/schemas/spec.schema.json +0 -202
- package/assets/schemas/tool-catalogue.schema.json +0 -655
- package/assets/schemas/trust-record.schema.json +0 -38
- package/assets/skills/README.md +0 -9
- package/assets/skills/inspect-surface.md +0 -4
- package/dist/agent-host.mjs +0 -2187
- package/dist/agent-host.mjs.map +0 -1
- package/dist/bundle-manifest.json +0 -128
- package/dist/chunks/__host-DgGPyco9.mjs +0 -18
- package/dist/chunks/__host-DgGPyco9.mjs.map +0 -1
- package/dist/chunks/align-ds-r_X_1aQ_.mjs +0 -93
- package/dist/chunks/align-ds-r_X_1aQ_.mjs.map +0 -1
- package/dist/chunks/approve-Cv135UqI.mjs +0 -19
- package/dist/chunks/approve-Cv135UqI.mjs.map +0 -1
- package/dist/chunks/audit-B4ZWQ_DI.mjs +0 -179
- package/dist/chunks/audit-B4ZWQ_DI.mjs.map +0 -1
- package/dist/chunks/auth-BT5oVp76.mjs +0 -132
- package/dist/chunks/auth-BT5oVp76.mjs.map +0 -1
- package/dist/chunks/auth-Dnlksuo5.mjs +0 -141
- package/dist/chunks/auth-Dnlksuo5.mjs.map +0 -1
- package/dist/chunks/brainstorm-SJwOIEif.mjs +0 -123
- package/dist/chunks/brainstorm-SJwOIEif.mjs.map +0 -1
- package/dist/chunks/build-C_-mbZfD.mjs +0 -19
- package/dist/chunks/build-C_-mbZfD.mjs.map +0 -1
- package/dist/chunks/cancel-KV_cpsqS.mjs +0 -15
- package/dist/chunks/cancel-KV_cpsqS.mjs.map +0 -1
- package/dist/chunks/canonical-C8UxeEmB.mjs +0 -57
- package/dist/chunks/canonical-C8UxeEmB.mjs.map +0 -1
- package/dist/chunks/catalogue-IaCJdfB8.mjs +0 -1549
- package/dist/chunks/catalogue-IaCJdfB8.mjs.map +0 -1
- package/dist/chunks/compose-DRKjQcn0.mjs +0 -7333
- package/dist/chunks/compose-DRKjQcn0.mjs.map +0 -1
- package/dist/chunks/config-Cqu5XQoP.mjs +0 -96
- package/dist/chunks/config-Cqu5XQoP.mjs.map +0 -1
- package/dist/chunks/contract-DjssDPpS.mjs +0 -335
- package/dist/chunks/contract-DjssDPpS.mjs.map +0 -1
- package/dist/chunks/contract-bQ9FJl4N.mjs +0 -123
- package/dist/chunks/contract-bQ9FJl4N.mjs.map +0 -1
- package/dist/chunks/deny-ClTxSvHJ.mjs +0 -15
- package/dist/chunks/deny-ClTxSvHJ.mjs.map +0 -1
- package/dist/chunks/diff-Qw0II0sj.mjs +0 -101
- package/dist/chunks/diff-Qw0II0sj.mjs.map +0 -1
- package/dist/chunks/discover-BZPolSZG.mjs +0 -21
- package/dist/chunks/discover-BZPolSZG.mjs.map +0 -1
- package/dist/chunks/doctor-DcDFPvQM.mjs +0 -222
- package/dist/chunks/doctor-DcDFPvQM.mjs.map +0 -1
- package/dist/chunks/fix-C9roGiQz.mjs +0 -82
- package/dist/chunks/fix-C9roGiQz.mjs.map +0 -1
- package/dist/chunks/fleet-yWHQY2ya.mjs +0 -297
- package/dist/chunks/fleet-yWHQY2ya.mjs.map +0 -1
- package/dist/chunks/gc-BBXlBF5w.mjs +0 -161
- package/dist/chunks/gc-BBXlBF5w.mjs.map +0 -1
- package/dist/chunks/init--FxxkrcT.mjs +0 -63
- package/dist/chunks/init--FxxkrcT.mjs.map +0 -1
- package/dist/chunks/inspect-Buby4cQD.mjs +0 -22
- package/dist/chunks/inspect-Buby4cQD.mjs.map +0 -1
- package/dist/chunks/intake-C1pesxCJ.mjs +0 -12
- package/dist/chunks/intake-C1pesxCJ.mjs.map +0 -1
- package/dist/chunks/logs-Giq5sUau.mjs +0 -25
- package/dist/chunks/logs-Giq5sUau.mjs.map +0 -1
- package/dist/chunks/loop-BWsUpyus.mjs +0 -212
- package/dist/chunks/loop-BWsUpyus.mjs.map +0 -1
- package/dist/chunks/migrate-DuYCAbE3.mjs +0 -33
- package/dist/chunks/migrate-DuYCAbE3.mjs.map +0 -1
- package/dist/chunks/models-Btp6X2YZ.mjs +0 -24
- package/dist/chunks/models-Btp6X2YZ.mjs.map +0 -1
- package/dist/chunks/obsidian-BHLkXx_H.mjs +0 -235
- package/dist/chunks/obsidian-BHLkXx_H.mjs.map +0 -1
- package/dist/chunks/patch-sAgVqjpx.mjs +0 -50
- package/dist/chunks/patch-sAgVqjpx.mjs.map +0 -1
- package/dist/chunks/pause-BASBfKLO.mjs +0 -16
- package/dist/chunks/pause-BASBfKLO.mjs.map +0 -1
- package/dist/chunks/policy-Du7WVBFX.mjs +0 -139
- package/dist/chunks/policy-Du7WVBFX.mjs.map +0 -1
- package/dist/chunks/providers-Dx78imKj.mjs +0 -19
- package/dist/chunks/providers-Dx78imKj.mjs.map +0 -1
- package/dist/chunks/reconcile-BHn66X3C.mjs +0 -50
- package/dist/chunks/reconcile-BHn66X3C.mjs.map +0 -1
- package/dist/chunks/refactor-DV3RfGjk.mjs +0 -153
- package/dist/chunks/refactor-DV3RfGjk.mjs.map +0 -1
- package/dist/chunks/render-DyZr5Lgi.mjs +0 -53
- package/dist/chunks/render-DyZr5Lgi.mjs.map +0 -1
- package/dist/chunks/resume-GJQRb2Eb.mjs +0 -15
- package/dist/chunks/resume-GJQRb2Eb.mjs.map +0 -1
- package/dist/chunks/retro-Dr-2RTNN.mjs +0 -78
- package/dist/chunks/retro-Dr-2RTNN.mjs.map +0 -1
- package/dist/chunks/retry-CLrUem1H.mjs +0 -15
- package/dist/chunks/retry-CLrUem1H.mjs.map +0 -1
- package/dist/chunks/review-ZsBqp3vZ.mjs +0 -35
- package/dist/chunks/review-ZsBqp3vZ.mjs.map +0 -1
- package/dist/chunks/run-BGabwbDL.mjs +0 -109
- package/dist/chunks/run-BGabwbDL.mjs.map +0 -1
- package/dist/chunks/run-tool-C3rAv4XF.mjs +0 -26
- package/dist/chunks/run-tool-C3rAv4XF.mjs.map +0 -1
- package/dist/chunks/scan-C5uDr7Yq.mjs +0 -167
- package/dist/chunks/scan-C5uDr7Yq.mjs.map +0 -1
- package/dist/chunks/schema-Bq9qtgsd.mjs +0 -583
- package/dist/chunks/schema-Bq9qtgsd.mjs.map +0 -1
- package/dist/chunks/send-BdnJ85Nz.mjs +0 -19
- package/dist/chunks/send-BdnJ85Nz.mjs.map +0 -1
- package/dist/chunks/ship-BizfUe62.mjs +0 -140
- package/dist/chunks/ship-BizfUe62.mjs.map +0 -1
- package/dist/chunks/shutdown-BM92Iyv2.mjs +0 -15
- package/dist/chunks/shutdown-BM92Iyv2.mjs.map +0 -1
- package/dist/chunks/skip-DZG5kpcH.mjs +0 -18
- package/dist/chunks/skip-DZG5kpcH.mjs.map +0 -1
- package/dist/chunks/spec-C2h3U64g.mjs +0 -65
- package/dist/chunks/spec-C2h3U64g.mjs.map +0 -1
- package/dist/chunks/spec-path-tptqR7W8.mjs +0 -10
- package/dist/chunks/spec-path-tptqR7W8.mjs.map +0 -1
- package/dist/chunks/src-Bfr1yzsn.mjs +0 -1689
- package/dist/chunks/src-Bfr1yzsn.mjs.map +0 -1
- package/dist/chunks/src-CPW2_Ons.mjs +0 -5487
- package/dist/chunks/src-CPW2_Ons.mjs.map +0 -1
- package/dist/chunks/src-Cu3TxNob.mjs +0 -783
- package/dist/chunks/src-Cu3TxNob.mjs.map +0 -1
- package/dist/chunks/src-DNsLSxgm.mjs +0 -928
- package/dist/chunks/src-DNsLSxgm.mjs.map +0 -1
- package/dist/chunks/src-DbS9gkJy.mjs +0 -117
- package/dist/chunks/src-DbS9gkJy.mjs.map +0 -1
- package/dist/chunks/src-yi5whv3n.mjs +0 -2118
- package/dist/chunks/src-yi5whv3n.mjs.map +0 -1
- package/dist/chunks/status-SMjiOMYy.mjs +0 -29
- package/dist/chunks/status-SMjiOMYy.mjs.map +0 -1
- package/dist/chunks/tail-BuhT-2PH.mjs +0 -25
- package/dist/chunks/tail-BuhT-2PH.mjs.map +0 -1
- package/dist/chunks/update-BXIppsbi.mjs +0 -16
- package/dist/chunks/update-BXIppsbi.mjs.map +0 -1
- package/dist/chunks/update-pipeline-Du-Gu1Pl.mjs +0 -56
- package/dist/chunks/update-pipeline-Du-Gu1Pl.mjs.map +0 -1
- package/dist/cli.mjs +0 -186
- package/dist/cli.mjs.map +0 -1
|
@@ -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, SCHEMA.md §Spec status):
|
|
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 and the `.gitignore` entries are written by
|
|
16
|
+
> `<sync>`, 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** (SCHEMA.md §Kanban): 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 SCHEMA
|
|
58
|
+
> §Kanban'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** (SCHEMA.md §Kanban): 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.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
---
|
|
2
|
+
model: sonnet
|
|
3
|
+
description: Apply the refactor backlog for one or more domains via the surface implementer agents (TDD-first, parallel across independent surfaces), then re-verify.
|
|
4
|
+
argument-hint: <domain…> (one or more surface keys, "shared", or "all")
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You are the **lead**. Refactor domain **$ARGUMENTS** to match `PIPELINE.md`, using the `/cohorte-audit` backlog.
|
|
8
|
+
|
|
9
|
+
> Read `PIPELINE.md` §`surfaces` (map the domain → a surface + its agent + commands) and §`contract`.
|
|
10
|
+
>
|
|
11
|
+
> **Workflow variant** (opt-in — SCHEMA.md §Workflows): for BIG domains (many open backlog items
|
|
12
|
+
> across several surfaces), on Claude Code ≥ 2.1.154 with workflows enabled, the human can ask to
|
|
13
|
+
> "run the refactor workflow" (`<core>/workflows/refactor.js`). For a handful of items this
|
|
14
|
+
> conversational path is cheaper — and it stays the default and the fallback.
|
|
15
|
+
|
|
16
|
+
## 1. Gather
|
|
17
|
+
|
|
18
|
+
- Read `specs/refactor-backlog.md`; select the items for `$ARGUMENTS` (`all` = every domain with
|
|
19
|
+
open items).
|
|
20
|
+
- Map each domain to a surface. `shared` = the contract package (`contract.path`), owned by you/lead —
|
|
21
|
+
refactor it directly, don't dispatch.
|
|
22
|
+
|
|
23
|
+
## 2. Dispatch the surface's implementer agent — TDD-first, stateless
|
|
24
|
+
|
|
25
|
+
Spawn the matching `<surface.agent>` with the template below (as `subagent_type: <surface.agent>`).
|
|
26
|
+
Keep it **byte-identical across loop
|
|
27
|
+
rounds** (only the final items slot varies — it sits at the end so repeats hit the prompt cache), and
|
|
28
|
+
never paste a diff — the agent computes its own, scoped to its tree:
|
|
29
|
+
|
|
30
|
+
> "Refactor pass on your surface (no feature spec). Read
|
|
31
|
+
> `PIPELINE.md` first. **Add the missing tests FIRST** (pin current behavior / cover the entry
|
|
32
|
+
> points), watch them pass, **then** refactor to clear each item. Preserve current public behavior
|
|
33
|
+
> unless an item marks it a bug. Migrations stay additive. Need the current state of your tree?
|
|
34
|
+
> Compute it yourself: `<core>/pipeline/scripts/feature-diff.sh --default <default_branch> --patch -- <surface.path>`. Lint + format before handoff;
|
|
35
|
+
> return the handoff in the format your agent instructions define. Backlog items for YOUR surface
|
|
36
|
+
> (self-contained — clear exactly these, reading only the files they name): <the domain's open
|
|
37
|
+
> `- [ ]` lines verbatim, with exact file paths>."
|
|
38
|
+
|
|
39
|
+
**Parallel when domains are independent:** if the human passed several domains (or `all`), dispatch
|
|
40
|
+
their implementers **concurrently in a single message** — surface trees are disjoint by construction,
|
|
41
|
+
so parallel is safe. Exception: `shared` (the contract package) never joins a parallel batch — the
|
|
42
|
+
slices import it, so refactor it alone, first.
|
|
43
|
+
|
|
44
|
+
- **Preserve current public behavior** unless a finding marks it a bug/convention violation — existing
|
|
45
|
+
code has no contract spec, so don't silently change shapes.
|
|
46
|
+
- Migrations stay **additive**; never `PIPELINE.md` §`gate.deny` commands.
|
|
47
|
+
- Touch only its surface; lint + format before handoff.
|
|
48
|
+
|
|
49
|
+
## 3. Verify & loop
|
|
50
|
+
|
|
51
|
+
After each agent returns: its surface's `test_quiet_cmd`/`lint_quiet_cmd` (else the `tail -40`
|
|
52
|
+
fallback — SCHEMA.md §Output discipline), `commands.typecheck`, `commands.format --check` (redirect
|
|
53
|
+
output to a file and grep it — don't print gate output into your context). Then verify each backlog item cleared by checking its `file:line` directly — do NOT re-run
|
|
54
|
+
`/cohorte-audit` per round (that repeats the repo-wide gates + a review dispatch you don't need); one optional
|
|
55
|
+
final `/cohorte-audit` once ALL dispatched domains are clean is enough. Check cleared items off in
|
|
56
|
+
`specs/refactor-backlog.md`. Loop until each dispatched domain is clean. Verification is per-domain
|
|
57
|
+
even when the dispatch was parallel — one failing surface loops alone, the others don't redo work.
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Mine the accumulated review findings across features for repeating patterns, and turn the ones the human ratifies into PIPELINE.md §Conventions rules the next build already follows.
|
|
3
|
+
argument-hint: [last <n> | all] (default: every feature with a report on disk)
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
You are running the **retrospective**. Every review this pipeline has run left structured
|
|
7
|
+
residue on disk — verdicts, Remediation rounds, deferred backlog items. A finding that shows up
|
|
8
|
+
once is a bug; the same finding shape across features is a **missing rule**, and the pipeline
|
|
9
|
+
has a place for rules the implementers actually read: `PIPELINE.md` §Conventions, baked into
|
|
10
|
+
each surface agent at render time. This command closes that loop: findings → patterns →
|
|
11
|
+
ratified rules → re-rendered agents. The next build then never produces the finding again —
|
|
12
|
+
which is cheaper than any number of review rounds catching it.
|
|
13
|
+
|
|
14
|
+
> Read `PIPELINE.md` §`pipeline-profile` (`surfaces`, and skim the existing §Conventions
|
|
15
|
+
> stanzas — a rule that already exists is a finding about *enforcement*, not a missing rule)
|
|
16
|
+
> and `specs/_decisions.md` §Live. _Skip the re-read if already in context and unmodified._
|
|
17
|
+
|
|
18
|
+
## 1. Collect — mechanical, redirected, no judgment yet
|
|
19
|
+
|
|
20
|
+
Scope: `all` (default), or `last <n>` features by spec mtime. In as few Bash calls as possible,
|
|
21
|
+
**always redirected to `specs/reports/retro-scan.txt` and grepped — never into your context**:
|
|
22
|
+
|
|
23
|
+
- `specs/reports/*.verdict.json` — per feature: `blocking_items` (normalized identities),
|
|
24
|
+
`severity`, per-surface counts. The freshest machine record, one per feature.
|
|
25
|
+
- Every non-`_` spec's `## Remediation` section — the **persistent** history (verdict.json is
|
|
26
|
+
overwritten per round; Remediation accumulates, and collapsed rounds still carry their
|
|
27
|
+
count line). Grep the item lines: `- [x?] <SEVERITY> · <file:line> · <kind> · <fix>`.
|
|
28
|
+
- `specs/refactor-backlog.md` — the `deferred:<id>` tagged items: debt reviews kept finding
|
|
29
|
+
but no feature owned.
|
|
30
|
+
|
|
31
|
+
A repo with fewer than two features' worth of residue ⇒ say the retro has nothing statistical
|
|
32
|
+
to stand on yet, name what exists, and stop — one feature's findings are that feature's story,
|
|
33
|
+
not a pattern.
|
|
34
|
+
|
|
35
|
+
## 2. Patterns — what repeats, with the evidence attached
|
|
36
|
+
|
|
37
|
+
A **pattern** is a finding shape that recurs where recurrence means something:
|
|
38
|
+
|
|
39
|
+
- same `kind` × same surface across **≥ 2 features** (e.g. `security` findings on `backend`
|
|
40
|
+
twice running — the strongest signal there is);
|
|
41
|
+
- the same file/module named by findings from **≥ 2 features** (a hotspot no single fix loop
|
|
42
|
+
owns);
|
|
43
|
+
- the same *fix wording* family recurring (e.g. three "add the authz check" fixes = one
|
|
44
|
+
missing authorization convention);
|
|
45
|
+
- a `deferred:` cluster in one domain — debt the reviews keep re-discovering because no rule
|
|
46
|
+
makes the implementers avoid adding to it.
|
|
47
|
+
|
|
48
|
+
For each pattern, produce: the evidence lines **verbatim** (`<feature> · <severity> · <file> ·
|
|
49
|
+
<problem/fix>`), the count, and ONE drafted convention rule — **rule-shaped**: a sentence an
|
|
50
|
+
implementer can follow and a reviewer can test a diff against, placed under `### Shared` or the
|
|
51
|
+
owning `### Surface: <key>`. Not advice ("be careful with auth") — a rule ("every route under
|
|
52
|
+
`apps/api/src/routes/` calls `authorize()` before its handler; no exceptions without a spec
|
|
53
|
+
§5 note"). Skip any pattern the existing §Conventions already covers — report those separately
|
|
54
|
+
as **enforcement gaps** (the rule exists and reviews keep finding violations: that is input for
|
|
55
|
+
the human, not a new rule).
|
|
56
|
+
|
|
57
|
+
## 3. Ratify — the human picks; nothing lands without them
|
|
58
|
+
|
|
59
|
+
Present a compact table: pattern → evidence count → drafted rule → target stanza. Then **stop
|
|
60
|
+
and ask** which to adopt (all / some / none — none is a fine outcome and says the rulebook fits
|
|
61
|
+
the codebase). Rules are standing law every future dispatch pays tokens to carry: the human
|
|
62
|
+
decides what becomes law, exactly as they freeze specs.
|
|
63
|
+
|
|
64
|
+
## 4. Apply — and keep the baked slices honest
|
|
65
|
+
|
|
66
|
+
For each adopted rule, in this order:
|
|
67
|
+
|
|
68
|
+
1. Append it to `PIPELINE.md` §Conventions under its stanza (create the `### Surface: <key>`
|
|
69
|
+
stanza if absent; keep it rule-shaped, one line each).
|
|
70
|
+
2. **Re-render every affected surface agent** per SCHEMA.md §Rendering step 2 — the
|
|
71
|
+
`<SURFACE_CONVENTIONS>` slice is **baked at render time**, so a §Conventions edit without a
|
|
72
|
+
re-render produces the worst outcome available: reviewers (who read the prose live) enforce
|
|
73
|
+
a rule implementers (who carry the stale bake) have never seen, and every future review
|
|
74
|
+
round re-finds the pattern this retro just paid to close. If you cannot re-render on this
|
|
75
|
+
runtime, say so and route to `/cohorte-update-pipeline` (its reconcile step 2 re-renders) —
|
|
76
|
+
but then the rule is **pending**, and you say that too.
|
|
77
|
+
3. Append ONE line per adopted rule to `specs/_decisions.md` §Live (SCHEMA.md §Decisions):
|
|
78
|
+
`- <date> · conventions · <rule, compressed> — because <kind>×<n> across <features> · retro`.
|
|
79
|
+
A retro rule is a standing decision; the journal is where the next `/cohorte-spec` learns it
|
|
80
|
+
without re-mining the reports.
|
|
81
|
+
|
|
82
|
+
In chat print ONLY: patterns found / adopted / skipped (one line each), enforcement gaps, which
|
|
83
|
+
agents were re-rendered (or the pending route), and the decisions lines appended. The evidence
|
|
84
|
+
stays in `specs/reports/retro-scan.txt`. **Recommend a `/clear`** — everything that matters is
|
|
85
|
+
now in `PIPELINE.md`, the rendered agents, and the journal.
|