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,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
model: sonnet
|
|
3
|
+
description: Audit the existing codebase (or a domain) against PIPELINE.md conventions + TDD coverage; produce a prioritized refactor backlog.
|
|
4
|
+
argument-hint: [path or domain, default = whole repo]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You are the **lead**. Audit **$ARGUMENTS** (default: whole repo) to drive it to a clean base. Read +
|
|
8
|
+
analyze only — no fixes (those go through `/cohorte-refactor`).
|
|
9
|
+
|
|
10
|
+
> Read `PIPELINE.md` §`commands` (the mechanical gates), `surfaces`, and §Conventions — plus
|
|
11
|
+
> `specs/_decisions.md` §Live if it exists (SCHEMA.md §Decisions): those standing decisions are part
|
|
12
|
+
> of the rulebook you audit against, and code that contradicts one is a finding like any other.
|
|
13
|
+
>
|
|
14
|
+
> **Workflow variant** (opt-in — SCHEMA.md §Workflows): on Claude Code ≥ 2.1.154 with workflows
|
|
15
|
+
> enabled, the human can ask to "run the audit workflow" (`<core>/workflows/audit.js` — one auditor
|
|
16
|
+
> per domain, concurrent). This conversational path stays the default and the fallback.
|
|
17
|
+
|
|
18
|
+
## 1. Mechanical gates (you run these — Bash)
|
|
19
|
+
|
|
20
|
+
Run the profile's checks **scoped to `$ARGUMENTS`** when a path/domain is given (lint/format/typecheck
|
|
21
|
+
on that path, tests via that surface's `test_cmd`); repo-wide only for the default whole-repo audit.
|
|
22
|
+
Use the quiet variants (`commands.lint_quiet`/`test_quiet`, else the `2>&1 | tail -40` fallback —
|
|
23
|
+
SCHEMA.md §Output discipline) and redirect every command's output into
|
|
24
|
+
`specs/reports/audit-gates.txt` in ONE call — truncate it first (`: > specs/reports/audit-gates.txt`,
|
|
25
|
+
so a previous run's output is never read as this one's), then per command
|
|
26
|
+
`printf '\n$ %s\n' "<cmd>" >> specs/reports/audit-gates.txt; <cmd> >> specs/reports/audit-gates.txt 2>&1`
|
|
27
|
+
(a `>` per command would keep only the last one) — so the bulk never sits in your history, then grep
|
|
28
|
+
it for the `file:line` of every failure:
|
|
29
|
+
`commands.format` in check mode (e.g. `prettier --check .` / `ruff format --check`),
|
|
30
|
+
`commands.lint`, `commands.typecheck`, `commands.test`.
|
|
31
|
+
|
|
32
|
+
## 2. Convention + TDD audit (dispatch `cohorte-review` in audit mode)
|
|
33
|
+
|
|
34
|
+
Dispatch `cohorte-review` (read-only; static prompt first, variable slot last — prompt-cache prefix):
|
|
35
|
+
"Audit a target against `PIPELINE.md` (no spec — **audit mode**). Check conventions (§Conventions
|
|
36
|
+
per surface), TDD coverage (untested entry points / modules per surface), over-engineering (§8,
|
|
37
|
+
widened per your audit-mode rules — ranked biggest cut first, closing `net:` line), and — if the
|
|
38
|
+
profile enables them — mobile-first + design-system usage. Mechanical findings from the gates: read
|
|
39
|
+
`specs/reports/audit-gates.txt`. Emit a prioritized refactor backlog (capped finding-line format
|
|
40
|
+
from your instructions), grouped by domain (one group per surface + shared). — Target: `$ARGUMENTS`
|
|
41
|
+
(default: whole repo)."
|
|
42
|
+
|
|
43
|
+
## 3. Write the backlog — only the audited domains' sections
|
|
44
|
+
|
|
45
|
+
Merge mechanical + convention findings into one prioritized list per domain, each item:
|
|
46
|
+
`- [ ] <SEVERITY> · <file:line> · <rule|tdd|lint|format|type|security|complexity> · <concrete fix>`
|
|
47
|
+
|
|
48
|
+
`specs/refactor-backlog.md` is **shared state**, not this run's report: it holds other domains' items
|
|
49
|
+
and the `deferred:` lines `/cohorte-review` §3.5 parked there. So **rewrite only the `## <domain>`
|
|
50
|
+
sections this audit covered** — a scoped audit (`$ARGUMENTS` = one domain or path) touches that
|
|
51
|
+
domain's section and leaves every other section byte-for-byte as it is (ticked lines included); a
|
|
52
|
+
whole-repo audit rewrites every surface's section plus `shared`, and still keeps a section for a
|
|
53
|
+
domain the profile no longer has. Locate sections with `grep -n '^## '` and edit them in place (Edit
|
|
54
|
+
per section, or one `awk` that swaps the audited sections) — never regenerate the whole file from
|
|
55
|
+
this run's findings.
|
|
56
|
+
|
|
57
|
+
`complexity` items are the over-engineering cuts, ranked biggest first inside their domain — they are
|
|
58
|
+
the cheapest wins in the backlog (deleting code needs no new tests) but they never outrank a
|
|
59
|
+
security, correctness or `tdd` item.
|
|
60
|
+
|
|
61
|
+
**Carry over the deferred items** of every section you rewrite: `grep -n 'deferred:' specs/refactor-backlog.md`
|
|
62
|
+
and re-emit every **open** (`- [ ]`) match of that domain verbatim, tag included. Those lines were
|
|
63
|
+
put there by `/cohorte-review` §3.5 — a real finding a feature deliberately did not own — and an audit that
|
|
64
|
+
blindly overwrites a section is the one way they silently disappear. Already-ticked (`- [x]`) ones in a
|
|
65
|
+
rewritten section are done: drop them.
|
|
66
|
+
Print a short summary (counts per domain + top items). Tell the human: refactor a domain with
|
|
67
|
+
`/cohorte-refactor <domain>`.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Interactive multi-persona panel that challenges and clarifies a feature idea before speccing.
|
|
3
|
+
argument-hint: [one-line idea (optional)]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
You are facilitating an **interactive brainstorm** for a new feature. This runs in the main thread — a
|
|
7
|
+
back-and-forth with the human, NOT a one-shot. Do not write any files — the TWO exceptions are staging
|
|
8
|
+
the return at Finish (`specs/reports/<feature_id>-brainstorm.md`) and moving this feature's kanban card
|
|
9
|
+
at Finish, when a board is configured.
|
|
10
|
+
|
|
11
|
+
> Read `PIPELINE.md` §Personas (the panel) and §`rbac` first. If `rbac.enabled`, the panel must
|
|
12
|
+
> pressure-test the idea so it serves **every** role, not just admins.
|
|
13
|
+
>
|
|
14
|
+
> Also read `specs/_decisions.md` §Live if it exists (SCHEMA.md §Decisions) — one line per standing
|
|
15
|
+
> decision. The panel argues about the idea, not about settled ground: a persona that proposes
|
|
16
|
+
> something a live line already decided must be told so by another persona, and an idea that genuinely
|
|
17
|
+
> needs to overturn one must say which line, out loud, so the human decides it here rather than
|
|
18
|
+
> discovering the contradiction at `/cohorte-spec`.
|
|
19
|
+
>
|
|
20
|
+
> **Kanban** (SCHEMA.md §Kanban): every card move below is one call —
|
|
21
|
+
> `<core>/pipeline/scripts/kanban-move.sh auto <feature_id> <stage> [--title "<human title>"]`, with
|
|
22
|
+
> `auto` resolves the
|
|
23
|
+
> board from `<config>` itself and exits 0 with a `kanban: <reason>` line when
|
|
24
|
+
> none resolves — so **never decide "no board is configured" without running it**. Reading the Ideas
|
|
25
|
+
> column at Start still needs the board path: get it from a `kanban-move.sh` run, or grep the config
|
|
26
|
+
> for `boards[<PIPELINE name>]`.
|
|
27
|
+
|
|
28
|
+
Idea (may be empty): **$ARGUMENTS**
|
|
29
|
+
|
|
30
|
+
## Start
|
|
31
|
+
|
|
32
|
+
If the idea is empty: when a board is configured and its **Ideas** column has cards, list them (with any
|
|
33
|
+
sub-bullet notes as seed context) and let the human pick one — otherwise ask **"What are we building?"**.
|
|
34
|
+
Either way, wait. If the idea is non-empty, restate it in one line and confirm you've got it — and
|
|
35
|
+
**if `specs/reports/intake-<idea>.md` exists, read it FIRST**: it is `/cohorte-intake`'s staged seed
|
|
36
|
+
(who is asking with verbatim quotes, goals/non-goals, an open-questions list that is this panel's
|
|
37
|
+
agenda, prior art incl. any `_decisions.md` line the request contradicts). The panel argues against
|
|
38
|
+
the distillate, never against the bare slug.
|
|
39
|
+
|
|
40
|
+
## Run the panel
|
|
41
|
+
|
|
42
|
+
Role-play the roundtable defined in `PIPELINE.md` §Personas — each member with a job AND a personality
|
|
43
|
+
who challenges the idea from their angle. They must **disagree** with each other and the human; never
|
|
44
|
+
just transcribe. If the profile has no personas, use a default panel (PM · skeptical senior engineer ·
|
|
45
|
+
UX/product designer · security). When `rbac.enabled`, ensure a voice for each role so the feature isn't
|
|
46
|
+
single-role.
|
|
47
|
+
|
|
48
|
+
Each round: 2–4 named personas speak, surface tensions + open questions, then **ask the human a focused
|
|
49
|
+
question** and wait. Iterate until the idea is genuinely clear: scope, affected roles, rough data +
|
|
50
|
+
screens, risks, and what's explicitly out.
|
|
51
|
+
|
|
52
|
+
## Finish
|
|
53
|
+
|
|
54
|
+
When the human is satisfied, produce the **brainstorm return** by filling
|
|
55
|
+
`<core>/templates/brainstorm-return.md` and **staging it to
|
|
56
|
+
`specs/reports/<feature_id>-brainstorm.md`** (the gitignored buffer dir — `/cohorte-spec` reads it from there
|
|
57
|
+
when invoked with no paste). In chat print only a 3-line summary + the path. Tell them to run `/cohorte-spec`
|
|
58
|
+
— **recommend a `/clear` first**, the return is staged on disk (pasting it remains a fallback).
|
|
59
|
+
|
|
60
|
+
**Settle the `feature_id` first and write it into the return's front-matter** — it is the card's join
|
|
61
|
+
key and `/cohorte-spec` takes it from there verbatim. Started from an `/cohorte-intake` seed
|
|
62
|
+
(`specs/reports/intake-<slug>.md`, or a bare slug as the idea)? **Keep that slug** — intake already
|
|
63
|
+
created the card `#<slug>`; a new id would strand it and fork a second card. Otherwise derive a
|
|
64
|
+
kebab-case slug and confirm it. Then, in this order:
|
|
65
|
+
|
|
66
|
+
1. **If the human picked an Ideas card, tag it first.** Ideas cards are free text a human typed, with
|
|
67
|
+
no `#<feature_id>` on them, and the move script joins on that tag: move before tagging and it
|
|
68
|
+
finds nothing, creates a second card, and leaves the untagged original sitting in Ideas forever.
|
|
69
|
+
One targeted Edit appending ` #<feature_id>` to that line, located by `grep -n`, never a full
|
|
70
|
+
board read.
|
|
71
|
+
2. `<core>/pipeline/scripts/kanban-move.sh auto <feature_id> brainstorm --title "<human title>"` —
|
|
72
|
+
which moves the (now tagged) card, or creates one under `--title` if the human typed a fresh
|
|
73
|
+
idea. Read its output: `moved #…` or `kanban: <reason>`. Never assume either.
|
|
@@ -0,0 +1,241 @@
|
|
|
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> [--readiness-only]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You are the **lead**. Build feature **$ARGUMENTS** from its frozen spec.
|
|
8
|
+
|
|
9
|
+
**Arguments: `<feature_id> [--readiness-only]`.** Strip the flag first — every `$ARGUMENTS` below
|
|
10
|
+
means the **bare feature id** (in paths, kanban calls, JSON). `--readiness-only` runs §1 → §2 (checks,
|
|
11
|
+
reconcile, readiness verdict, contract) and **stops before §3**: no dispatch, no `build.json`, no
|
|
12
|
+
metrics line, no kanban move. It exists to refresh what the loop workflow's preconditions read
|
|
13
|
+
(`readiness.json` newer than the spec, the contract on disk) without a full build — the loop then
|
|
14
|
+
builds itself. Say which mode you ran in your last line.
|
|
15
|
+
|
|
16
|
+
> Read `PIPELINE.md` §`pipeline-profile` first: the `surfaces` list (how many implementers to
|
|
17
|
+
> dispatch + their agent names), `contract` (mechanism + path), and the `design` flag. _Skip the
|
|
18
|
+
> re-read if it's already in your context this session and unmodified since._
|
|
19
|
+
>
|
|
20
|
+
> **Kanban** (SCHEMA.md §Kanban): once §1 confirms the frozen spec, run
|
|
21
|
+
> `<core>/pipeline/scripts/kanban-move.sh auto $ARGUMENTS building`. `auto` resolves the board from the config itself and
|
|
22
|
+
> exits 0 with a `kanban: <reason>` line when there is none — so **never decide "no board is
|
|
23
|
+
> configured" without running it**. That inference, not a missing board, is what used to freeze
|
|
24
|
+
> cards mid-pipeline.
|
|
25
|
+
|
|
26
|
+
## 1. Load & check
|
|
27
|
+
|
|
28
|
+
- Check the spec front-matter FIRST — `grep '^status:' specs/$ARGUMENTS.md` (or Read with a ~15-line
|
|
29
|
+
limit) — before any full read. Buildable statuses are `frozen`, `in-review` and `in-progress`
|
|
30
|
+
(SCHEMA.md §Spec status). `blocked` means a loop round gave up here: say so with the `reason` from
|
|
31
|
+
`specs/reports/$ARGUMENTS.loop.json` (a reason with no `outcome` is a resumable stop — re-running the
|
|
32
|
+
loop workflow resumes it), and route by the spec's `## Remediation` — open items ⇒ `/cohorte-fix`
|
|
33
|
+
(or `--readiness-only`, to hand them back to the loop), none ⇒ continue this build. `shipped` / `merged` / `abandoned` ⇒ done, say so and stop. Anything
|
|
34
|
+
else (`draft`, missing) ⇒ stop and tell the human to run `/cohorte-spec` first. Only then read the body, selectively: front-matter, §5 contract, the surface
|
|
35
|
+
task sections, and `## Remediation` (fall back to a full read if the spec doesn't follow the
|
|
36
|
+
template's headings).
|
|
37
|
+
- **Feature branch — when nothing else made it.** With `isolation.enabled`, `new-feature.sh` already
|
|
38
|
+
created `<prefix>$ARGUMENTS` with its worktree: confirm you are in it. With isolation **off**,
|
|
39
|
+
nothing does, yet `/cohorte-ship` refuses any other branch: `git rev-parse --abbrev-ref HEAD`, and
|
|
40
|
+
on `<default_branch>` run `git switch <prefix>$ARGUMENTS 2>/dev/null || git switch -c <prefix>$ARGUMENTS`
|
|
41
|
+
(uncommitted work carries over). `<prefix>` = `vcs.patch_branch_prefix` (else `fix/`) for
|
|
42
|
+
`kind: patch`, `vcs.feature_branch_prefix` otherwise. On some *other* branch ⇒ say which and ask.
|
|
43
|
+
- **`kind: patch` in the front-matter ⇒ this is a bug fix** frozen by `/cohorte-patch`, and it is
|
|
44
|
+
built by this command like any other spec, with two differences called out where they apply: §1.6
|
|
45
|
+
judges it against its regression test instead of a contract, and §2 authors no contract unless §5
|
|
46
|
+
carries a delta. Everything else — surface mapping, parallel dispatch, roll call, metrics — is
|
|
47
|
+
identical, and `kind` absent means feature, so nothing changes for existing specs.
|
|
48
|
+
- **Route check** (skipped under `--readiness-only`, which dispatches nothing — the loop workflow
|
|
49
|
+
then routes those items through its own fix rounds) — if `## Remediation` has open `- [ ]` items and none requires a contract change,
|
|
50
|
+
stop and tell the human to run `/cohorte-fix $ARGUMENTS` instead: it re-dispatches only the surfaces with
|
|
51
|
+
findings. A full build with open items is only right when the contract change ripples into clean
|
|
52
|
+
surfaces (the case `/cohorte-fix` §1 falls back here for).
|
|
53
|
+
- **Design gate** — only if `design.enabled` and the feature has UI (some surface `uses_design`): if the
|
|
54
|
+
spec front-matter `design_files` is empty, ask the human for the feature's design **links** and store
|
|
55
|
+
them in `design_files`, then continue. Each entry is a full self-contained link of the form
|
|
56
|
+
`https://claude.ai/design/p/<projectId>?file=<file>` — it carries its own project (the `/p/<projectId>`
|
|
57
|
+
path segment) and page (the `?file=` query), so nothing needs a stored project id and the reference
|
|
58
|
+
survives a design-system rebuild (a new DS ⇒ just paste the new links, no profile change). _Legacy bare
|
|
59
|
+
file names still resolve against the optional `design.design_project` fallback, but new specs use links._
|
|
60
|
+
Skip if the feature is backend-only / no UI.
|
|
61
|
+
- If this is a fix loop (`## Remediation` has unchecked items), map each open item to a surface by its
|
|
62
|
+
`file:line` path — each agent gets ONLY its own surface's items, inlined in its dispatch (§3).
|
|
63
|
+
|
|
64
|
+
## 1.5 Reconcile surfaces — auto-grow / specialize agents
|
|
65
|
+
|
|
66
|
+
Map every area the spec touches (§5 contract + each surface's tasks + touched paths) onto the
|
|
67
|
+
`surfaces[]` in `PIPELINE.md`. Two triggers add an agent — handle them BEFORE authoring the contract:
|
|
68
|
+
|
|
69
|
+
- **Unowned area → new agent.** If the spec introduces work in a tree that falls under NO existing
|
|
70
|
+
`surfaces[].path` (a genuinely new thing — a new service, a new app, a new top-level area), that work
|
|
71
|
+
has no owner. Auto-detect it and propose a new surface for it.
|
|
72
|
+
- **Bottleneck area → specialize.** If one existing surface carries a large, cleanly-separable chunk of
|
|
73
|
+
this feature (e.g. a whole new feature-module) that would dominate build time, propose splitting that
|
|
74
|
+
chunk into its own specialized surface. Use the heuristic in SCHEMA.md §Specialization — only when the
|
|
75
|
+
boundary is clean; skip when tangled or tiny.
|
|
76
|
+
|
|
77
|
+
For each surface to add: infer its `key`, `path`, `label`, `agent`, `tools`, `model`, `*_cmd`s, and
|
|
78
|
+
`uses_design` (mirror a sibling surface), show the human a one-line proposal, and on go-ahead **render it now** per
|
|
79
|
+
SCHEMA.md §"Rendering / reconciling a surface agent" — write the `surfaces[]` entry + §Conventions/§Testing
|
|
80
|
+
stanza into `PIPELINE.md`, render `<agents>/<agent>.md` from the implementer template, applying the
|
|
81
|
+
shared-code rule (shared trees get a single-owner surface; cross-slice shapes go through the contract).
|
|
82
|
+
This is the automatic path: you don't send the human back to `/cohorte-init-pipeline`. If nothing new is needed,
|
|
83
|
+
say so and continue. Dispatch (§3) then covers the reconciled surface list.
|
|
84
|
+
|
|
85
|
+
**Adding or splitting a surface is an architectural decision** — append ONE line for it to
|
|
86
|
+
`specs/_decisions.md` §Live (SCHEMA.md §Decisions; create from `<core>/templates/decisions.template.md`
|
|
87
|
+
if absent), area `surfaces`, e.g.
|
|
88
|
+
`- <date> · surfaces · <key> owns <path>, single owner of <what> — because <the boundary reason> · $ARGUMENTS`.
|
|
89
|
+
One `>>` in the Bash call you're already making. Nothing added ⇒ nothing to append.
|
|
90
|
+
|
|
91
|
+
## 1.6 Readiness verdict — the gate before N dispatches
|
|
92
|
+
|
|
93
|
+
**Zero extra agents: you already hold the spec, the profile and the reconciled surface list.** The
|
|
94
|
+
whole point is that a bancal spec costs one verdict here instead of N implementers discovering it in
|
|
95
|
+
parallel. Judge the frozen contract on **implementability only** — never on whether the feature is a
|
|
96
|
+
good idea (that was `/cohorte-brainstorm`), never by re-reading files you don't already need:
|
|
97
|
+
|
|
98
|
+
1. **Contract completeness** (§5) — every endpoint/interface has method+path (or signature), auth,
|
|
99
|
+
request fields with types + validation, the success shape, and its error cases. A missing
|
|
100
|
+
**request or success shape** ⇒ `NOT-READY` (an implementer would invent it, and the other surface
|
|
101
|
+
would invent a different one). A missing **error case** ⇒ `RESERVATIONS`.
|
|
102
|
+
**On a `kind: patch` spec this check is replaced, not skipped** — a patch has no contract to be
|
|
103
|
+
complete, so judge §1 Symptom & repro + §4 Regression test instead: no stated expected behaviour,
|
|
104
|
+
or a §4 that names no test and no reason the fix would be verifiable ⇒ `NOT-READY` (an implementer
|
|
105
|
+
would fix whatever it guessed the bug was, and nothing would catch a wrong guess). A repro
|
|
106
|
+
explicitly frozen as a hypothesis, or a cause left to the implementer to find, is
|
|
107
|
+
`RESERVATIONS` — normal for a patch, never a blocker. Then judge §5 as above **only** if it
|
|
108
|
+
carries a delta rather than `none`.
|
|
109
|
+
2. **Surface coverage** — every §6 task maps to a surface in the reconciled list, and every contract
|
|
110
|
+
entry has an owner **on each side it names** (producer and consumer). A contract entry no surface
|
|
111
|
+
owns ⇒ `NOT-READY`.
|
|
112
|
+
3. **Dependencies exist** — for the modules, packages, tables, env vars and shared helpers the spec
|
|
113
|
+
names as *pre-existing*: verify them in ONE Bash call (`test -f` / `grep -l` / a package-manifest
|
|
114
|
+
grep, output redirected — never a file read per name). Named as pre-existing but absent, and not
|
|
115
|
+
listed as created by this feature ⇒ `NOT-READY`.
|
|
116
|
+
4. **Residual ambiguity** (§10) — an open question a surface would have to *guess* at: blocks a
|
|
117
|
+
contract decision ⇒ `NOT-READY`; merely narrows an implementation choice ⇒ `RESERVATIONS`.
|
|
118
|
+
5. **Design gate** — a `uses_design` surface in scope with `design_files` still empty ⇒ `NOT-READY`
|
|
119
|
+
(this is §1's gate restated as a verdict, so an automated driver sees the same fact).
|
|
120
|
+
|
|
121
|
+
Write the machine-readable verdict to `specs/reports/$ARGUMENTS.readiness.json` (overwrite,
|
|
122
|
+
`mkdir -p specs/reports` first — the same gitignored buffer dir `/cohorte-review` stages into, which may not
|
|
123
|
+
exist yet on a first build) — on **every** build, including `READY`. It is the only channel between
|
|
124
|
+
this gate and any automated driver, which parses no prose:
|
|
125
|
+
|
|
126
|
+
```json
|
|
127
|
+
{ "id": "$ARGUMENTS", "phase": "readiness", "ts": "<ISO>", "verdict": "RESERVATIONS",
|
|
128
|
+
"gaps": ["contract|POST /orders|no 409 case for a duplicate id"],
|
|
129
|
+
"surfaces": ["backend", "frontend"] }
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
- **`gaps`** — one normalized string per gap, `<check>|<where>|<what is missing>`: `<check>` is
|
|
133
|
+
`contract` · `coverage` · `dependency` · `ambiguity` · `design` — plus `repro` on a `kind: patch`
|
|
134
|
+
spec, for a gap check 1 raised against §1/§4; `<where>` is the contract entry,
|
|
135
|
+
surface key or dependency name (no `:line` — it shifts on every edit); `<what>` is the gap, not the
|
|
136
|
+
fix. `READY` ⇒ `[]`.
|
|
137
|
+
- **`NOT-READY` ⇒ STOP: author no contract and spawn NO agent.** Print the gaps and send the human to
|
|
138
|
+
`/cohorte-spec $ARGUMENTS` to patch the contract, then re-run `/cohorte-build`. This abort is the whole point of the
|
|
139
|
+
step — a spec that cannot be built does not get cheaper by being built N times in parallel.
|
|
140
|
+
- **`RESERVATIONS` ⇒ continue.** It never blocks (a gate that stalls a sound build on a missing error
|
|
141
|
+
case would cost more human round-trips than it saves): inline each gap verbatim into the dispatch of
|
|
142
|
+
the surface it affects, as an explicit assumption the agent must implement *and* flag in its handoff,
|
|
143
|
+
and relay the list to the human in one line each.
|
|
144
|
+
- **`READY` ⇒ continue silently** — one line, no restatement.
|
|
145
|
+
|
|
146
|
+
A `blocked` spec (§1) re-entered here is unblocked by the run itself: once the readiness verdict is
|
|
147
|
+
written (and is not `NOT-READY`), set `status: in-review` — the loop workflow and `/cohorte-doctor`
|
|
148
|
+
read a `blocked` spec whose readiness is newer than its `loop.json` as "a human re-entered".
|
|
149
|
+
|
|
150
|
+
## 2. Author the contract (lead-only — the single sync channel)
|
|
151
|
+
|
|
152
|
+
_Skipped entirely on a `kind: patch` spec whose §5 Contract delta is `none`_ — which is the usual
|
|
153
|
+
case: a bug fix corrects behaviour behind a shape that already exists, and re-authoring that shape
|
|
154
|
+
would put the contract file in the diff for nothing. Say you skipped it and why, in one line. A patch
|
|
155
|
+
whose §5 **does** carry a delta is authored exactly as below, from the delta, against the existing
|
|
156
|
+
file — never rewritten from scratch. (A patch needing *new* contract surface area never reaches here:
|
|
157
|
+
`/cohorte-patch` §3 routes it to `/cohorte-spec`.) When you skip, still run `date +%s` on its own —
|
|
158
|
+
the skipped postcondition is where §4's wall-clock start comes from, and a build with no start epoch
|
|
159
|
+
writes a metrics line with no duration.
|
|
160
|
+
|
|
161
|
+
_Only if `contract.enabled`._ From §5 of the spec, write/update the feature's contract file at
|
|
162
|
+
`<contract.path>/$ARGUMENTS.<contract.ext>` in the profile's `mechanism` (e.g. Zod v4 schemas + inferred
|
|
163
|
+
types for `shared-types-zod`). Export it from `contract.index` if set. This is the ONLY file the agents
|
|
164
|
+
share; they import it read-only and must not edit it. If `contract.enabled` is false, the spec prose is
|
|
165
|
+
the sync channel — say so and skip, but still run `date +%s` on its own (same as the patch skip
|
|
166
|
+
above: §4's wall-clock start comes from here, and a build with no start epoch writes a metrics
|
|
167
|
+
line with no duration). **Postcondition (if `contract.enabled`):**
|
|
168
|
+
`test -f <contract.path>/$ARGUMENTS.<contract.ext> && date +%s` — the contract file must exist before
|
|
169
|
+
you dispatch §3, or the stateless agents have nothing to build against (the epoch output is §4's
|
|
170
|
+
wall-clock start — no separate timing call).
|
|
171
|
+
|
|
172
|
+
**`--readiness-only` stops here** — print the readiness verdict + contract path and point at the
|
|
173
|
+
loop workflow (`{feature: "$ARGUMENTS"}`) or a plain `/cohorte-build $ARGUMENTS`.
|
|
174
|
+
|
|
175
|
+
## 3. Dispatch one implementer per surface — IN PARALLEL
|
|
176
|
+
|
|
177
|
+
Spawn every surface's agent in a **single message** (one dispatch each) so they run concurrently —
|
|
178
|
+
NEVER serially: build wall-clock must be the slowest surface, not the sum. Use
|
|
179
|
+
the reconciled `surfaces` list from §1.5 (existing + any just-rendered). Give EACH only what a stateless
|
|
180
|
+
agent needs — re-supply everything every time, as **exact file paths** (spec, contract, the surface's
|
|
181
|
+
tree), never "find the relevant files". Keep the dispatch prompt **byte-identical across dispatches
|
|
182
|
+
and fix loops** except the two variable slots, which sit at the END of the prompt so every repeat hits
|
|
183
|
+
the prompt-cache prefix. Never paste a diff into a dispatch — the agent computes its own, scoped to its
|
|
184
|
+
tree. For each surface in `surfaces`:
|
|
185
|
+
|
|
186
|
+
> `subagent_type: <surface.agent>` — "Implement the **<surface.key>** surface for feature `$ARGUMENTS`.
|
|
187
|
+
> Read `PIPELINE.md` first. Spec: `specs/$ARGUMENTS.md`. Contract: `<contract.path>/$ARGUMENTS.<ext>`
|
|
188
|
+
> (import read-only). Work test-first. Touch only `<surface.path>`. Need the current state of your
|
|
189
|
+
> tree? Compute it yourself: `<core>/pipeline/scripts/feature-diff.sh --default <default_branch> --patch -- <surface.path>`. Return the handoff in the
|
|
190
|
+
> format your agent instructions define. Design files: <the spec's `design_files` links — each
|
|
191
|
+
> `https://claude.ai/design/p/<projectId>?file=<file>` carries its own project + page, fetch read-only
|
|
192
|
+
> via `DesignSync get_file`, build mobile-first · or `none` (non-design surface, or a fix loop whose
|
|
193
|
+
> open items are all non-visual)>. Open Remediation items for YOUR surface (self-contained — fix
|
|
194
|
+
> exactly these, reading only the files they name; `none` ⇒ first build, implement the spec's tasks
|
|
195
|
+
> for your surface): <the surface's open `- [ ]` lines verbatim, or `none`>. Readiness gaps for YOUR
|
|
196
|
+
> surface (§1.6 `RESERVATIONS` — the spec is silent here: implement the stated assumption and flag what
|
|
197
|
+
> you assumed in your handoff): <that surface's `gaps` entries verbatim, or `none`>."
|
|
198
|
+
|
|
199
|
+
## 3.5 Roll call — account for EVERY dispatch before integrating
|
|
200
|
+
|
|
201
|
+
A surface's work can die: a rate limit mid-run, a transport error after retries, context exhausted.
|
|
202
|
+
When it does, it returns **nothing** — and nothing is byte-identical to "a clean surface with nothing
|
|
203
|
+
to report". Silence is not a green light; treat it as the failure it is (SCHEMA.md §Dead agents).
|
|
204
|
+
|
|
205
|
+
- **Roll call.** Every surface handled in §3 must come back with a handoff in the format its
|
|
206
|
+
agent instructions define. Missing, empty, or truncated mid-sentence ⇒ that surface is **dead**.
|
|
207
|
+
- **Never infer success from silence,** and never speak for a dead agent — you did not see its work.
|
|
208
|
+
- **Retry that surface ONCE, alone.** Re-dispatch it with the byte-identical §3 prompt. The other
|
|
209
|
+
surfaces' work is already on disk and untouched, so this costs one agent, not a rebuild — and most
|
|
210
|
+
deaths are transient. Never retry a surface that *did* answer.
|
|
211
|
+
- **Died twice ⇒ stop guessing and look.** Run that surface's own quiet commands
|
|
212
|
+
(`<surface>.typecheck_cmd`, `lint_quiet_cmd`, `test_quiet_cmd`) with output redirected to
|
|
213
|
+
`specs/reports/$ARGUMENTS.<key>.deadcheck.txt`, then grep it — never into your context. Report the
|
|
214
|
+
three results plus which of the spec's tasks for that surface actually landed, checked against the
|
|
215
|
+
tree, not against a handoff you never got. Say plainly that the surface is **unverified**.
|
|
216
|
+
|
|
217
|
+
## 4. Integrate
|
|
218
|
+
|
|
219
|
+
When all return, flag any contract mismatch or failing test from the handoffs; otherwise print one
|
|
220
|
+
status line per surface (`<key> · tests pass/fail · <n> TODOs`) — do not restate handoff content.
|
|
221
|
+
A dead surface (§3.5) prints `<key> · DEAD — unverified` and **the batch is never reported as ok**.
|
|
222
|
+
Append **ONE line for the batch** to the **main checkout's** `<state>/pipeline-metrics.jsonl` —
|
|
223
|
+
NOT the worktree's, which dies at teardown while metrics must accumulate across features. Resolve
|
|
224
|
+
it from anywhere: `$(dirname "$(git rev-parse --git-common-dir)")/<state>/pipeline-metrics.jsonl`
|
|
225
|
+
(in the main checkout this resolves to itself). Create it if absent; it must be gitignored.
|
|
226
|
+
Compute the elapsed time in the same Bash call
|
|
227
|
+
(`echo "{...\"seconds\":$(($(date +%s)-<start epoch from §2>)),...}" >> …`):
|
|
228
|
+
`{"ts":"<ISO date>","feature":"$ARGUMENTS","phase":"build","seconds":<wall-clock>,"surfaces":{"<key>":"ok|error|dead",…}}`
|
|
229
|
+
— **write this line even when a surface died.** An incomplete batch is exactly the batch worth having
|
|
230
|
+
in the record; skipping the append to "wait until it's complete" silently deletes the evidence that
|
|
231
|
+
anything went wrong. In the same call write the machine-readable batch result to
|
|
232
|
+
`specs/reports/$ARGUMENTS.build.json` (overwrite) — the channel an automated driver reads, since it
|
|
233
|
+
never sees your chat:
|
|
234
|
+
`{"id":"$ARGUMENTS","phase":"build","ts":"<ISO>","surfaces":{"<key>":"ok|error|dead",…},"dead":["<key>",…]}`
|
|
235
|
+
— this is the evidence SCHEMA.md §Specialization asks for before splitting a surface.
|
|
236
|
+
Then tell the human: exercise the feature by hand if it's worth it, then run `/cohorte-review $ARGUMENTS` —
|
|
237
|
+
unless a surface is dead, in which case say so first and let them decide whether to re-run `/cohorte-build`
|
|
238
|
+
(a dead surface has no findings, so `/cohorte-fix` has nothing to re-dispatch).
|
|
239
|
+
Do not run the app or migrations yourself here — building is not running.
|
|
240
|
+
**Recommend a `/clear` now** — the spec, contract and diff are all on
|
|
241
|
+
disk, and the lead's history is re-sent at input price on every turn it survives.
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
---
|
|
2
|
+
model: sonnet
|
|
3
|
+
description: Diagnose the pipeline installation — core version, pointer, agents↔surfaces, hooks, gate, retrieval, design, isolation — and print the exact fix for each failure.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
You are the **pipeline doctor**. Check every piece of wiring the pipeline depends on and report a
|
|
7
|
+
✅/⚠️/❌ checklist, each failure with its **exact fix command**. Diagnose read-only first; apply a
|
|
8
|
+
fix only with the human's go-ahead (or hand them the command).
|
|
9
|
+
|
|
10
|
+
> Wiring that worked at init rots: PATH changes, uninstalls, hand-edits, half-done updates. This is
|
|
11
|
+
> the one place that verifies it all.
|
|
12
|
+
|
|
13
|
+
## Checks, in order
|
|
14
|
+
|
|
15
|
+
0. **Fast path.** Run `cohorte doctor` (or `npx cohorte doctor` if the binary is not on PATH) and
|
|
16
|
+
use its output as the baseline: it runs every file-level check below deterministically. Then add
|
|
17
|
+
what only a live session can see (MCP connectivity, the `Workflow` tool, the `/design` skill).
|
|
18
|
+
1. **Core & pointer.** The machine-wide core exists (`<core>/pipeline/VERSION`) and its
|
|
19
|
+
`<core>/manifest.json` too (absent ⇒ ⚠️ a copied-by-hand core; fix `cohorte update`).
|
|
20
|
+
`<state>/pipeline.json` names a `core_version`; one lagging the VERSION file is ⚠️ ⇒ run `<sync>`
|
|
21
|
+
and commit the pointer. A pointer that still carries `mode: bundled|global` predates 3.0 ⇒ ⚠️ ⇒
|
|
22
|
+
`/cohorte-update-pipeline` (it migrates the repo). Compare against `npm view cohorte version` —
|
|
23
|
+
behind ⇒ suggest `cohorte update`. Read `<core>/pipeline/CHANGELOG.md` for what they're missing.
|
|
24
|
+
**2.x leftovers are ⚠️ with a named fix:** a vendored core in this repo (`.claude/pipeline/VERSION`,
|
|
25
|
+
`.claude/hooks/gate.py`) ⇒ `<sync>` removes it; a 2.x core in `~/.claude/pipeline/` or a gate
|
|
26
|
+
registered in `~/.claude/settings.json` ⇒ `cohorte update` migrates it; surface agents for this
|
|
27
|
+
project in `~/.claude/agents/` ⇒ re-render them into `<agents>/` (§Rendering) and delete the global
|
|
28
|
+
copies. The router commands' step files are present — `<core>/templates/steps/init-pipeline/`
|
|
29
|
+
non-empty. **Shipped scripts present and executable** in `<core>/pipeline/scripts/`:
|
|
30
|
+
`kanban-move.sh`, `preflight.sh`, `feature-diff.sh`; the `new-feature.sh.template` and
|
|
31
|
+
`remove-feature.sh.template` sources must be readable — ❌ any missing one.
|
|
32
|
+
Kanban callers chain with `|| true`, so an absent `kanban-move.sh` is a **silent**
|
|
33
|
+
no-op (no card moves, no error anywhere) — this check is the only thing that sees it;
|
|
34
|
+
an absent `feature-diff.sh` stops every review and ship (they refuse to fall back to a
|
|
35
|
+
bare `git diff`, which misses untracked files).
|
|
36
|
+
2. **Profile.** `PIPELINE.md` exists and its `yaml pipeline-profile` block parses. Every
|
|
37
|
+
`surfaces[].agent` has its `<agents>/<agent>.md` and every agent file has its `surfaces[]`
|
|
38
|
+
entry — **no orphans either way** (SCHEMA.md rule). Each rendered agent's frontmatter `tools`
|
|
39
|
+
matches its surface's `tools` (incl. `DesignSync` iff `uses_design`, retrieval MCP tools iff
|
|
40
|
+
`retrieval.provider` ≠ `none`). **Model pins:** each rendered agent's frontmatter `model` matches
|
|
41
|
+
its `surfaces[].model` — ❌ if missing, mismatched, or a literal `<SURFACE_MODEL>` placeholder
|
|
42
|
+
(all three silently fall back to inheriting the lead session's model — often Opus — on every
|
|
43
|
+
dispatch); ⚠️ any `inherit` with the note that it bills at the lead's tier. The generic agents
|
|
44
|
+
(`cohorte-review.md`, `cohorte-release.md`, `cohorte-profile-reader.md` in `<fixed-agents>/`) must
|
|
45
|
+
each carry their `model:` line too (sonnet/haiku/haiku).
|
|
46
|
+
**Command pins:** every mechanical command file
|
|
47
|
+
(`build`, `review`, `fix`, `ship`, `audit`, `refactor`, `doctor`, `align-ds`,
|
|
48
|
+
`update-pipeline`, `fleet` — `cohorte-<name>.md` in `~/.claude/commands/`) carries `model: sonnet` in
|
|
49
|
+
its frontmatter — ⚠️ if missing (the lead's orchestration turn then bills at the session model,
|
|
50
|
+
e.g. Opus/Fable). `brainstorm`, `spec`, `patch`, and `init-pipeline` are intentionally unpinned
|
|
51
|
+
(interactive — they inherit the session model).
|
|
52
|
+
|
|
53
|
+
3. **Hooks & gate.** `<state>/gate-config.json` exists and mirrors the profile's `gate` block
|
|
54
|
+
(regenerate if drifted). `.claude/hooks/cohorte-gate.py` exists **and is committed**
|
|
55
|
+
(`git ls-files --error-unmatch .claude/hooks/cohorte-gate.py`), and `.claude/settings.json`
|
|
56
|
+
registers it exactly once per matcher group — `Bash|Task|Agent` (shell + subagent dispatches; the
|
|
57
|
+
preflight phase gate keys off dispatches, and `Agent` is the tool's name since Claude Code 2.1.63)
|
|
58
|
+
and `Write|Edit|MultiEdit` (self-protection of the gate's own files). A registration whose file is
|
|
59
|
+
missing is ❌ — with `onFailure: block` it refuses every Bash call; fix: `<sync>`. A second gate
|
|
60
|
+
registered in `~/.claude/settings.json` (2.x) is ⚠️ — it double-prompts; fix: `cohorte update`.
|
|
61
|
+
Test the evaluator too: `python3 .claude/hooks/cohorte-gate.py --check "<a pattern from the ask list>"`
|
|
62
|
+
must return a non-`allow` verdict (exit 1 ask / 2 deny).
|
|
63
|
+
Then the **preflight stamp is local, never versioned**: `git ls-files --error-unmatch
|
|
64
|
+
<state>/preflight.ok` must miss, and `.gitignore` must cover it. A tracked stamp is a ❌ (not a
|
|
65
|
+
⚠️) — it records the tree it verified, the commit that carries it moves HEAD past that tree, and
|
|
66
|
+
the committed copy lands in every clone and new worktree; the gate then blocks clean trees and
|
|
67
|
+
greens unchecked ones. fix: `git rm --cached <state>/preflight.ok` + add it to `.gitignore`.
|
|
68
|
+
4. **Retrieval** (if `retrieval.provider` ≠ `none`). Run the SCHEMA.md §Code retrieval health
|
|
69
|
+
check: CLI resolvable from PATH, `.mcp.json` entry present in PATH-proof launcher form,
|
|
70
|
+
`.serena/` gitignored, server actually connects.
|
|
71
|
+
5. **Design** (if `design.enabled`). `snapshot_dir` exists and is committed; `ui_kit_path` +
|
|
72
|
+
`tokens_path` exist; if `provider: claude-design`, `DesignSync` responds (`list_files` on the `design_system_project`) and
|
|
73
|
+
`design_system_project` is reachable. Recall: spec `design_files` are full
|
|
74
|
+
`…/design/p/<projectId>?file=<file>` links that carry their own project + page; `design_project` is
|
|
75
|
+
only a legacy fallback for old bare-filename specs (default `none`).
|
|
76
|
+
6. **Isolation** (if `isolation.enabled`). `scripts/new-feature.sh` + `scripts/remove-feature.sh`
|
|
77
|
+
rendered (no `__TOKEN__` placeholders left). `.worktrees/slots.tsv` coherent with
|
|
78
|
+
`git worktree list` — flag **stale slots** (registered but no worktree) and **zombie worktrees**
|
|
79
|
+
(worktree but no slot / spec already `shipped`) ⇒ suggest `scripts/remove-feature.sh <id>`.
|
|
80
|
+
When ≥2 slots are live, print the parallel-feature table (feature · worktree · ports · db ·
|
|
81
|
+
branch behind main by N commits) — a worktree far behind main means its next review will diff
|
|
82
|
+
against stale code ⇒ suggest rebasing it.
|
|
83
|
+
7. **Kanban** (the board mirror — SCHEMA.md §Kanban). Run
|
|
84
|
+
`<core>/pipeline/scripts/kanban-move.sh --check` and report its one line verbatim: the resolved
|
|
85
|
+
board path, or the exact link that is missing. A board mirror is optional, so "not configured" is
|
|
86
|
+
ℹ️, never ❌ — but it must be **stated**, because the whole class of bug here is a card that
|
|
87
|
+
quietly stopped moving while every command still reported success. Two states earn a ⚠️ with the
|
|
88
|
+
fix named: `boards` has no entry for this profile's `name` while it does have an entry for some
|
|
89
|
+
other key whose board file exists (a **rename** orphaned the link — re-key it via
|
|
90
|
+
`/cohorte-update-pipeline`), and an entry whose board file no longer exists at
|
|
91
|
+
`vault_path`-relative `board` (moved or renamed in the vault).
|
|
92
|
+
8. **Workflows** (the opt-in execution path — SCHEMA.md §Workflows; the conversational commands
|
|
93
|
+
stay the default, so failures here are ⚠️ at most, never ❌). Report which path this machine will
|
|
94
|
+
take and why:
|
|
95
|
+
- **Claude Code version** ≥ 2.1.154 (`claude --version 2>/dev/null | head -1`) — older or no CLI
|
|
96
|
+
on PATH ⇒ conversational only. This is the **workflow** floor and the only one that gates this
|
|
97
|
+
check; do NOT raise it to match a newer feature's floor, or every install between the two
|
|
98
|
+
versions reads as broken while its workflows run fine.
|
|
99
|
+
- **Scripts present:** `<workflows>/cohorte-review.js` + `cohorte-audit.js` + `cohorte-refactor.js` + `cohorte-loop.js` —
|
|
100
|
+
missing on a current core ⇒ half-done install, re-run install/update. (The loop workflow (`cohorte-loop.js`) is
|
|
101
|
+
**workflow-only** — no command file exists on purpose; without this runtime it refuses
|
|
102
|
+
rather than degrading to a conversational loop.)
|
|
103
|
+
- **Phase-0 agent present:** `<fixed-agents>/cohorte-profile-reader.md` — the workflows abort without it.
|
|
104
|
+
- **Workflows enabled in this session** — the `Workflow` tool is in your own toolset right now;
|
|
105
|
+
absent ⇒ disabled for this session (a setting or an old client), conversational path.
|
|
106
|
+
- **Preflight wiring** (used by both paths): `<core>/pipeline/scripts/preflight.sh` executable and
|
|
107
|
+
`gate-config.json` carries the `preflight` block — mismatch ⇒ regenerate from the profile.
|
|
108
|
+
End the check with ONE summary line, e.g.
|
|
109
|
+
`workflows: available (opt-in — ask to "run the review workflow")` or
|
|
110
|
+
`workflows: unavailable (<first failing prerequisite>) — conversational commands (the default)`.
|
|
111
|
+
9. **Specs & metrics.** Every `specs/*.md` front-matter `status` is a valid stage — one of
|
|
112
|
+
`draft · frozen · in-progress · in-review · blocked · shipped · merged · abandoned` (SCHEMA.md
|
|
113
|
+
§Spec status) — excluding
|
|
114
|
+
`_`-prefixed files (the spec template and `specs/_decisions.md`, the decision journal) and
|
|
115
|
+
`specs/refactor-backlog.md`, which `/cohorte-audit` writes as a backlog, not a
|
|
116
|
+
spec, and which has no front-matter to check. A spec left `in-progress` or `blocked` is a round
|
|
117
|
+
that never finished ⇒ say so and route it: open `## Remediation` items ⇒ `/cohorte-fix`, none ⇒
|
|
118
|
+
`/cohorte-build` (a `blocked` spec whose `specs/reports/<id>.loop.json` has a `reason` and no
|
|
119
|
+
`outcome` is a resumable stop — re-running the loop workflow resumes it). **Reconcile `shipped`
|
|
120
|
+
specs with their PR** (when `vcs.host: github` and `gh` is available — one
|
|
121
|
+
`gh pr view <branch> --json state` per shipped spec, never more than the shipped ones): `MERGED` ⇒
|
|
122
|
+
⚠️ with the fix `set status: merged` (offer to apply it); `CLOSED` unmerged ⇒ ⚠️ — ask the human:
|
|
123
|
+
reopen, or `status: abandoned`. `shipped`/`merged` specs with a live worktree flagged (see 6). `<state>/pipeline-metrics.jsonl` and `specs/reports/` (the
|
|
124
|
+
`/cohorte-review` report buffer that lets a `/cohorte-fix` survive a `/clear`) are gitignored. Metrics
|
|
125
|
+
belong to the **main checkout** — a `pipeline-metrics.jsonl` inside a live feature worktree is a
|
|
126
|
+
stale-core sign (its lines die at teardown) ⇒ suggest appending its lines to the main checkout's
|
|
127
|
+
file and deleting the stray.
|
|
128
|
+
|
|
129
|
+
## Report
|
|
130
|
+
|
|
131
|
+
Group by check, one line each: `✅|⚠️|❌ <check> — <one-line detail>`; every ⚠️/❌ followed by
|
|
132
|
+
` fix: <exact command or edit>`. End with the overall count and, if anything failed, the ordered
|
|
133
|
+
repair sequence. Nothing failing ⇒ say the installation is healthy, and the installed core version.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
---
|
|
2
|
+
model: sonnet
|
|
3
|
+
description: Apply a REVIEW REPORT — append it to the spec's Remediation, then re-dispatch ONLY the surfaces that have findings.
|
|
4
|
+
argument-hint: <feature_id> [paste REVIEW REPORT]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You are the **lead**. Run the fix loop for feature **$ARGUMENTS** — the scoped, cheap path after a
|
|
8
|
+
`REVISE`/`BLOCK` verdict. The full `/cohorte-spec` (Mode B) + `/cohorte-build` path still exists for review returns
|
|
9
|
+
that change the *contract*; `/cohorte-fix` is for everything else.
|
|
10
|
+
|
|
11
|
+
> Read `PIPELINE.md` §`pipeline-profile` first: `surfaces` (paths + agent names) and `contract`.
|
|
12
|
+
> _Skip the re-read if it's already in your context this session and unmodified since._
|
|
13
|
+
>
|
|
14
|
+
> **Kanban** (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.
|