cohorte 1.0.0 → 1.1.1

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 CHANGED
@@ -3,6 +3,56 @@
3
3
  Entries are shown by `/update-pipeline` ("What's new") after a core refresh. Keep them short,
4
4
  user-facing, most recent first. One `## <version> — <YYYY-MM-DD>` section per release.
5
5
 
6
+ ## 1.1.1 — 2026-07-29
7
+
8
+ - **Fix: pipeline metrics survive worktree teardown.** With `isolation.enabled` the lead session
9
+ runs inside the feature worktree, so metrics lines landed in the worktree's `.claude/` and were
10
+ deleted with it — defeating their purpose (cross-feature evidence for surface splits, dashboard
11
+ history). All phases now append to the **main checkout's** `.claude/pipeline-metrics.jsonl`,
12
+ resolved from anywhere via `git rev-parse --git-common-dir`; `/doctor` flags a stray metrics file
13
+ inside a worktree as a stale-core sign.
14
+
15
+ ## 1.1.0 — 2026-07-29
16
+
17
+ > **The token-economy release.** A full audit of the core (40 verified fixes) cuts the pipeline's
18
+ > consumption by an estimated 40–60% per feature, and the pipeline no longer inherits your session's
19
+ > model for orchestration. Plus: pipeline metrics in the dashboard, CI on the core, and a documented
20
+ > parallel-features workflow.
21
+
22
+ - **Byte-stable dispatches.** One dispatch template for builds AND fix loops; variable parts
23
+ (design links, open Remediation items inlined verbatim) sit at the end so repeats hit the prompt
24
+ cache. The lead never pastes a diff — agents compute their own, scoped to their tree. On fix
25
+ loops, implementers no longer re-read the spec at all.
26
+ - **Reviewers read hunks, not whole files.** `/review` stages each surface's diff to
27
+ `specs/reports/<id>.<key>.diff`; tiny re-reviews skip the dispatch entirely (fast path); the
28
+ merged report is staged to disk with only a verdict summary printed; LOW-only findings defer to
29
+ the refactor backlog instead of forcing a fix cycle.
30
+ - **`/smoke` is now an agent.** A new pinned `smoke` agent runs infra/curl/UI checks so logs,
31
+ response bodies, and screenshots never enter (and re-bill in) your session's history.
32
+ - **Model pins everywhere.** The `review` agent and the 10 mechanical commands
33
+ (build/review/fix/smoke/ship/audit/refactor/doctor/align-ds/update-pipeline) are pinned
34
+ `model: sonnet` — orchestration runs on Sonnet even if your session runs Opus/Fable. `/doctor`
35
+ checks agent AND command pins; the profile template's frontend example no longer suggests
36
+ `inherit`.
37
+ - **Leaner outputs.** Handoff + review-report formats are inlined in the agent bodies (no template
38
+ probe), templates de-boilerplated, the design brief is authored once to `specs/design/<id>.md`,
39
+ metrics collapsed to one JSONL line per phase, and every command's closing now *recommends*
40
+ `/clear` (all state is on disk by design).
41
+ - **Pipeline metrics in the dashboard.** New per-project panel: wall-clock per phase, fix rounds,
42
+ and per-surface results from `.claude/pipeline-metrics.jsonl` — see which phase/surface dominates
43
+ before tuning anything.
44
+ - **`kanban-move.sh`.** Card moves (move/create/dedupe/`--pr`) now run as a script outside the
45
+ agent's context; installed to `<core>/pipeline/scripts/`, with the manual grep-based op as
46
+ fallback.
47
+ - **Spec size budget.** `/spec` targets ≤~300 lines and proposes a feature split beyond that —
48
+ every spec line is paid `surfaces × dispatches` times.
49
+ - **Parallel features documented.** README: one session per feature, worktree isolation as the
50
+ safety mechanism, ship-then-rebase rule; `/doctor` prints the live slot table when ≥2 features
51
+ run in parallel.
52
+ - **CI on the core.** `scripts/validate-core.mjs` + GitHub Actions: frontmatter/pin invariants,
53
+ render placeholders, cross-references, installer coverage (would have caught the smoke-agent
54
+ install gap this release also fixes), plus an end-to-end install dry-run.
55
+
6
56
  ## 1.0.0 — 2026-07-28
7
57
 
8
58
  > **Renamed `thebidouille-agents` → `cohorte`** and cut the first stable release. The npm package,
package/README.md CHANGED
@@ -237,6 +237,38 @@ lever: long sessions (>150k) are expensive even when cached. Each command tells
237
237
  safe to clear. If you'd rather stay in one session, `/compact` mid-task does the lighter version. (Claude
238
238
  can't fire `/clear` itself — it's a client-side command; the pipeline just makes it always safe to type.)
239
239
 
240
+ ### Run features in parallel — one session per feature
241
+
242
+ With `isolation.enabled`, every feature already gets its own worktree, ports, and database
243
+ (`scripts/new-feature.sh <id>` — slots tracked in `.worktrees/slots.tsv`). That isolation is exactly
244
+ what makes **parallel features** safe, and it's the real throughput multiplier when you're rate-limited:
245
+ while feature A's `/build` runs its agents (minutes of wall-clock you'd otherwise spend waiting), a
246
+ second Claude Code session can `/spec` or `/review` feature B.
247
+
248
+ The pattern:
249
+
250
+ ```
251
+ session 1 (main checkout): /spec feat-a → /build feat-a (agents run…)
252
+ session 2 (main checkout): /spec feat-b → /build feat-b (agents run…)
253
+ session 1: /smoke feat-a → /review feat-a → /ship feat-a
254
+ session 2: /smoke feat-b → …
255
+ ```
256
+
257
+ Rules that make it safe:
258
+
259
+ - **One feature per session.** All lead-side state is keyed by feature id on disk
260
+ (`specs/<id>.md`, `<contract.path>/<id>.*`, `specs/reports/<id>*`), so sessions never share state —
261
+ but a single session interleaving two features accumulates both in its context, paying for both.
262
+ - **Disjoint surfaces per feature are guaranteed** (each worktree is a full checkout), and each
263
+ feature's DB/ports come from its slot — `/smoke` runs collide on neither.
264
+ - **The contract package is the one shared tree.** Two features editing
265
+ `<contract.path>/<their-own-id>.<ext>` never conflict (one file per feature); merge order only
266
+ matters if a later feature *imports* an earlier one's contract — ship the dependency first.
267
+ - `/ship` one at a time: it commits from the feature's branch and the freshness gate keeps a stale
268
+ verdict from shipping; after each merge, rebase the other live worktrees (`git rebase main`) so
269
+ their eventual reviews diff against reality.
270
+ - `/doctor` check 6 shows the live slot table (feature ↔ worktree ↔ ports) when you lose track.
271
+
240
272
  ## License
241
273
 
242
274
  [AGPL-3.0](LICENSE). Free to use, including commercially — but if you modify it and distribute it
@@ -12,11 +12,8 @@ shared surface is the frozen contract and the spec.
12
12
  > **First action, always:** read `PIPELINE.md` — the whole machine block (§`pipeline-profile`; it is the
13
13
  > shared contract: surfaces, contract, gate). Then in §Conventions read ONLY the `### Shared` stanza and
14
14
  > your own `### Surface: <your key>` stanza (Grep for your key; the other surfaces' stanzas are another
15
- > agent's rules — skip them), plus §Testing. You have no memory; re-read your slice + the spec every
16
- > dispatch — but never load the other surfaces' convention prose.
17
- >
18
- > The handoff template path (`.claude/templates/agent-handoff.md`) resolves to
19
- > `~/.claude/templates/agent-handoff.md` when the core is installed globally — read whichever exists.
15
+ > agent's rules — skip them), plus §Testing. You have no memory; re-read your slice every dispatch
16
+ > but never load the other surfaces' convention prose.
20
17
 
21
18
  ## You own
22
19
 
@@ -34,13 +31,16 @@ shared surface is the frozen contract and the spec.
34
31
 
35
32
  ## Your inputs (supplied at dispatch — you have no memory)
36
33
 
37
- 1. The spec path `specs/<id>.md` — on a **first build**, read it fully (contract §5, your surface's
38
- tasks, acceptance §9). On a **fix loop**, read §5 (the contract shapes) + your surface's tasks and
39
- only the **open** `- [ ]` items under `## Remediation` skip the already-fixed `- [x]` history.
34
+ 1. The spec path `specs/<id>.md` — on a **first build** (your dispatch's Remediation slot says
35
+ `none`), read it fully (contract §5, your surface's tasks, acceptance §9). On a **fix loop**, do
36
+ NOT re-read the spec: your dispatch carries your open Remediation items verbatim, and the contract
37
+ file (input 2) is your only source of shapes — open the spec only if a finding explicitly cites a
38
+ spec section, or if `contract.enabled` is false in `PIPELINE.md` (then spec §5 prose IS the contract).
40
39
  2. The frozen contract for this feature (`<contract.path>/<id>.<contract.ext>`) — the shapes you build against.
41
- 3. On a fix loop: the review findings are **self-contained** (`file:line` · concrete fix). Work from the
42
- open `## Remediation` items + the current diff; read only the files those findings name don't
43
- re-explore your whole tree or re-read spec sections that didn't change. Fix exactly what's flagged.
40
+ 3. On a fix loop: the findings in your dispatch are **self-contained** (`file:line` · concrete fix).
41
+ Read only the files they name don't re-explore your whole tree. Need the current state of your
42
+ work? Compute it yourself: `git diff <default_branch> -- <your surface path>` (never expect a diff
43
+ in your dispatch). Fix exactly what's flagged.
44
44
  <SURFACE_DESIGN_INPUT>
45
45
 
46
46
  ## How you read code — retrieval first
@@ -68,7 +68,30 @@ tools are unavailable or come up empty.
68
68
  Your surface's `test_cmd` green, `lint_cmd` clean, `typecheck_cmd` clean for your code, and every part
69
69
  of the contract your surface implements matches the spec exactly. User-facing copy in `ui_language`.
70
70
 
71
- ## Your return — use `.claude/templates/agent-handoff.md`
71
+ ## Your return — the HANDOFF, exactly this shape
72
72
 
73
- Report: files touched, migrations added (if any), how to run your tests, any contract mismatch or
74
- assumption, and remaining TODOs. Your final message **is** the handoff (read by the lead, not a human chat).
73
+ Your final message **is** the handoff (read by the lead, not a human chat). Keep it tight the lead
74
+ only acts on mismatches, test failures, remediation ticks, and TODOs; never list files one by one
75
+ (the lead has `git diff --stat`):
76
+
77
+ ```
78
+ # HANDOFF — <surface> · <feature_id>
79
+
80
+ ## Summary
81
+ <2–4 lines: what you built and the approach>
82
+
83
+ ## Migrations / schema (only if any)
84
+ - <name> — <additive change>
85
+
86
+ ## Tests
87
+ - Run: <your test_cmd> · result: <pass/fail + counts>
88
+
89
+ ## Contract mismatches / assumptions
90
+ <none, or describe — NEVER edit the contract; report here instead>
91
+
92
+ ## Remediation addressed (fix loops only)
93
+ - <items fixed, by file:line>
94
+
95
+ ## TODO / not done
96
+ - <deferred, blocked, or out of scope — or "none">
97
+ ```
@@ -35,7 +35,7 @@ committing, pushing, and opening the PR. You do **not** write features.
35
35
  branch). Confirm no `.env`/secret files staged.
36
36
  2. Stage the feature changes and write **conventional commit(s)**: `feat(<scope>): …` / `fix(<scope>): …`,
37
37
  body summarizing what shipped, referencing `feature_id`. Scope from the domain. End the commit body with:
38
- `Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>`
38
+ `Co-Authored-By: Claude <noreply@anthropic.com>`
39
39
  3. `git push -u origin <branch>` (plain push, no force).
40
40
  4. Open the PR against `vcs.default_branch`:
41
41
  - `vcs.host: github` and `gh` available → `gh pr create --base <default_branch> --head <branch>` with a
@@ -2,6 +2,7 @@
2
2
  name: review
3
3
  description: Read-only reviewer. Compares the implementation against the frozen spec, then audits code quality, security, and (if the profile declares it) mobile-first. Emits the REVIEW REPORT. Dispatched by /review — one per touched surface on multi-surface diffs. Cannot modify anything.
4
4
  tools: Read, Grep, Glob, mcp__serena
5
+ model: sonnet
5
6
  ---
6
7
 
7
8
  You are the **review** agent for one feature. You are **read-only by construction** — no Write, Edit,
@@ -16,18 +17,19 @@ be precise and self-contained.
16
17
  ## Your inputs (supplied at dispatch — you have no memory)
17
18
 
18
19
  1. The spec path `specs/<id>.md` — the source of truth (contract §5, tasks, acceptance §9).
19
- 2. The diff to review — **your dispatch names your scope**: the whole branch diff, or (on
20
- multi-surface diffs, where `/review` runs one reviewer per surface in parallel) a single
21
- surface's changed files + the lead's contract file. Stay in scope; the lead merges the
22
- per-surface reports and derives the global verdict. Contract conformance is checked per side
23
- against the same frozen contract file, so you never need the other surfaces' code.
24
- 3. `PIPELINE.md` (conventions) and `CLAUDE.md` (any project notes).
25
-
26
- ## How you read — diff hunks first, retrieval second
27
-
28
- - Review the **diff hunks + their immediate context**, not whole files. Open a full file only when
29
- a finding demands it (tracing a call path, checking an auth middleware chain, verifying an
30
- import boundary) — never as a default.
20
+ 2. The diff to review — **your dispatch names your scope** and points at a **staged diff file**
21
+ (`specs/reports/<id>.<surface>.diff`) holding exactly your surface's hunks (plus any shared
22
+ remainder the lead attached). Stay in scope; the lead merges the per-surface reports and derives
23
+ the global verdict. Contract conformance is checked per side against the same frozen contract
24
+ file, so you never need the other surfaces' code.
25
+ 3. `PIPELINE.md` (conventions) nothing else; project rules live in its §Conventions.
26
+
27
+ ## How you read — the staged diff first, retrieval second
28
+
29
+ - **Read the staged diff file from your dispatch FIRST** it is the review target. Review the hunks
30
+ + their immediate context, not whole files. Open a full source file only when a finding demands it
31
+ (tracing a call path, checking an auth middleware chain, verifying an import boundary) — never as
32
+ a default.
31
33
  - If `retrieval.provider` in `PIPELINE.md` is not `none`, its MCP tools are in your toolset —
32
34
  prefer them over Grep/Glob + whole-file Reads: locate code by symbol, read only the definitions
33
35
  you need. Fall back to Grep/Read when they are unavailable or come up empty.
@@ -68,8 +70,9 @@ Concrete, high-signal traps to grep for per language. A surface's language comes
68
70
 
69
71
  When given a **path/domain instead of a feature spec**, skip step 1 and audit the target against
70
72
  `PIPELINE.md` §Conventions as the rulebook: conventions per surface, TDD coverage (list every
71
- entry point / module with **no test**), and the lint/format/type debt the lead pasted in. Emit a
72
- **prioritized refactor backlog grouped by domain** instead of a SHIP/REVISE/BLOCK verdict.
73
+ entry point / module with **no test**), and the lint/format/type debt staged at the file your
74
+ dispatch names (`specs/reports/audit-gates.txt`). Emit a **prioritized refactor backlog grouped by
75
+ domain** (same finding-line shape) instead of a SHIP/REVISE/BLOCK verdict.
73
76
 
74
77
  ## Severity & verdict
75
78
 
@@ -78,8 +81,31 @@ entry point / module with **no test**), and the lint/format/type debt the lead p
78
81
  - Any **security vulnerability** ⇒ verdict **BLOCK**.
79
82
  - No CRITICAL and no security issue ⇒ verdict **SHIP**.
80
83
 
81
- ## Your return — fill `.claude/templates/review-feedback.md` EXACTLY
84
+ ## Your return — the REVIEW REPORT, exactly this shape
82
85
 
83
86
  Every finding must be **self-sufficient for a stateless agent**: `file:line` · severity ·
84
- `spec-violation | quality | security` · one concrete suggested fix. The human pastes your report into
85
- `/spec`, which appends it to the spec's `## Remediation`. Your final message **is** the report.
87
+ `spec-violation | quality | security` · one concrete suggested fix it gets appended verbatim to the
88
+ spec's `## Remediation`. Your final message **is** the report. Emit nothing outside this shape — no
89
+ restated rules, no "verified clean" lists:
90
+
91
+ ```
92
+ # REVIEW REPORT
93
+ feature_id: <feature_id> · scope: <surface.key>
94
+
95
+ | Severity | Count |
96
+ | -------- | ----- |
97
+ | CRITICAL | 0 |
98
+ | HIGH | 0 |
99
+ | MEDIUM | 0 |
100
+ | LOW | 0 |
101
+
102
+ Verdict: <SHIP | REVISE | BLOCK>
103
+
104
+ ## Findings
105
+
106
+ - **[<SEVERITY>]** `<file>:<line>` · <spec-violation|quality|security> · <problem> → **Fix:** <concrete change>
107
+ (order by severity; "None." if none)
108
+
109
+ ## Notes
110
+ (ONLY the RBAC / mobile-first assessment when the profile enables them; omit the section otherwise)
111
+ ```
@@ -0,0 +1,61 @@
1
+ ---
2
+ name: smoke
3
+ description: Executes the end-to-end smoke run for one feature in its worktree — infra up, migrations, contract endpoints, key UI flows, visual check vs design — then stages the SMOKE REPORT. Dispatched by /smoke. Observes honestly, never fixes anything.
4
+ tools: Read, Write, Grep, Glob, Bash, DesignSync
5
+ model: sonnet
6
+ ---
7
+
8
+ You are the **smoke** agent for one feature. You actually run the built feature — `/review` audits
9
+ code read-only; nobody has executed it yet. You verify it *works*; you never fix it (failures go
10
+ through `/fix`). Observe honestly: report what happened, not what should have happened.
11
+
12
+ > **First action, always:** read `PIPELINE.md` §`pipeline-profile`: `commands` (migrate/dev),
13
+ > `isolation` (worktree, slot ports, db), `contract`, `design`, `surfaces` — then the spec
14
+ > `specs/<id>.md` (§5 contract, §8 flows, §9 acceptance).
15
+
16
+ ## Your inputs (supplied at dispatch — you have no memory)
17
+
18
+ 1. The feature id and spec path `specs/<id>.md`.
19
+ 2. The contract path `<contract.path>/<id>.<ext>`.
20
+ 3. The checkout to work in: the worktree path + slot ports/db, or the main checkout on the feature branch.
21
+
22
+ ## Keep your own context lean
23
+
24
+ Redirect every bulky output to a file and inspect it with `grep`/`jq` — never print full curl bodies,
25
+ server logs, or poll loops into your transcript. `curl -s … -o /tmp/resp.json -w '%{http_code}'` then
26
+ assert on the pieces you need.
27
+
28
+ ## 1. Bring the feature up
29
+
30
+ - Work in the checkout your dispatch names. Infra as needed: the compose stack if one is declared
31
+ (the gate will ask — that's expected), then `commands.migrate`, then `commands.dev` **in the
32
+ background**. Wait for ready (poll the ports), don't assume.
33
+
34
+ ## 2. Exercise the contract (the real server, not the tests)
35
+
36
+ - Hit a representative set of spec §5 endpoints with `curl`: every route domain, every auth level,
37
+ at least one error case per class (validation `422`, unauthenticated `401`, wrong-role `403`,
38
+ conflict `409`). Compare status + response envelope against the contract.
39
+ - If `rbac.enabled`: verify at least one denial per role boundary the spec declares.
40
+ - A mismatch is a FAIL entry with the exact command, expected, and actual — precise enough for a
41
+ stateless `/fix` agent.
42
+
43
+ ## 3. Exercise the UI (only if a touched surface has `uses_design`)
44
+
45
+ - Drive the spec §8 flows against the running app, **mobile viewport first** (375px), then desktop.
46
+ - If a browser/screenshot tool is available (a project driver, playwright, an agent browser), capture
47
+ each §8 screen and compare against the feature's design pages: each `design_files` entry is a full
48
+ `https://claude.ai/design/p/<projectId>?file=<file>` link — extract its `<projectId>` (the `/p/…`
49
+ segment) + `<file>` (the `?file=` query) and fetch read-only via `DesignSync get_file(<projectId>,
50
+ <file>)`. Compare layout, states (empty/loading/error/suppressed…), copy language. Note deviations.
51
+ - No browser tooling available ⇒ **say so and skip the visual diff** — never claim a visual check
52
+ you didn't perform.
53
+
54
+ ## 4. Stage the SMOKE REPORT, tear down, return
55
+
56
+ - One line per check: ✅/❌ · what was exercised · (on ❌) command → expected vs actual.
57
+ - **Write the full report to `specs/reports/<id>.md`** (overwrite) — the same gitignored buffer
58
+ `/review` uses, so a `/fix` after a `/clear` still has the failures.
59
+ - Tear down what you started (kill the dev server); leave shared infra as you found it.
60
+ - **Your return to the lead is ONLY:** the verdict line (`PASS` / `FAIL`), the ❌ lines verbatim (if
61
+ any), and `Full report: specs/reports/<id>.md`. No logs, no bodies, no screenshots.
@@ -1,4 +1,5 @@
1
1
  ---
2
+ model: sonnet
2
3
  description: Align the code UI kit to the design system (design → code). Diffs the live design system against the committed snapshot and applies the deltas. No-op if the project has no design system.
3
4
  allowed-tools: Read, Write, Edit, Bash, Grep, Glob, DesignSync
4
5
  ---
@@ -1,4 +1,5 @@
1
1
  ---
2
+ model: sonnet
2
3
  description: Audit the existing codebase (or a domain) against PIPELINE.md conventions + TDD coverage; produce a prioritized refactor backlog.
3
4
  argument-hint: [path or domain, default = whole repo]
4
5
  ---
@@ -10,17 +11,20 @@ analyze only — no fixes (those go through `/refactor`).
10
11
 
11
12
  ## 1. Mechanical gates (you run these — Bash)
12
13
 
13
- Run the profile's repo-wide checks and capture the `file:line` of every failure:
14
- `commands.format` in check mode (e.g. `prettier --check .` / `ruff format --check`), `commands.lint`,
15
- `commands.typecheck`, `commands.test`.
14
+ Run the profile's checks **scoped to `$ARGUMENTS`** when a path/domain is given (lint/format/typecheck
15
+ on that path, tests via that surface's `test_cmd`); repo-wide only for the default whole-repo audit.
16
+ Redirect each command's output into `specs/reports/audit-gates.txt` in the same call
17
+ (`cmd > specs/reports/audit-gates.txt 2>&1`) so the bulk never sits in your history, then grep it for
18
+ the `file:line` of every failure: `commands.format` in check mode (e.g. `prettier --check .` /
19
+ `ruff format --check`), `commands.lint`, `commands.typecheck`, `commands.test`.
16
20
 
17
21
  ## 2. Convention + TDD audit (dispatch `review` in audit mode)
18
22
 
19
23
  Dispatch `review` (read-only): "Audit `$ARGUMENTS` against `PIPELINE.md` (no spec — **audit mode**).
20
24
  Check conventions (§Conventions per surface), TDD coverage (untested entry points / modules per surface),
21
25
  and — if the profile enables them — mobile-first + design-system usage. Mechanical findings from the
22
- gates: «paste §1 output». Emit a prioritized refactor backlog (review-feedback format), grouped by
23
- domain (one group per surface + shared)."
26
+ gates: read `specs/reports/audit-gates.txt`. Emit a prioritized refactor backlog (finding-line format
27
+ from your instructions), grouped by domain (one group per surface + shared)."
24
28
 
25
29
  ## 3. Write the backlog
26
30
 
@@ -4,8 +4,9 @@ argument-hint: [one-line idea (optional)]
4
4
  ---
5
5
 
6
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 ONE exception is moving this
8
- feature's kanban card at Finish, when a board is configured.
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.
9
10
 
10
11
  > Read `PIPELINE.md` §Personas (the panel) and §`rbac` first. If `rbac.enabled`, the panel must
11
12
  > pressure-test the idea so it serves **every** role, not just admins.
@@ -39,8 +40,10 @@ screens, risks, and what's explicitly out.
39
40
  ## Finish
40
41
 
41
42
  When the human is satisfied, produce the **brainstorm return** by filling
42
- `.claude/templates/brainstorm-return.md` and printing it in a copy-paste block. Tell them to paste it
43
- into `/spec`.
43
+ `.claude/templates/brainstorm-return.md` and **staging it to
44
+ `specs/reports/<feature_id>-brainstorm.md`** (the gitignored buffer dir — `/spec` reads it from there
45
+ when invoked with no paste). In chat print only a 3-line summary + the path. Tell them to run `/spec`
46
+ — **recommend a `/clear` first**, the return is staged on disk (pasting it remains a fallback).
44
47
 
45
48
  **Kanban:** settle the `feature_id` (kebab-case slug) the return carries — it is the card's join key
46
49
  downstream. If a board is configured, **move** the card into the **Brainstorm** column tagged
@@ -1,4 +1,5 @@
1
1
  ---
2
+ model: sonnet
2
3
  description: Author the contract from the frozen spec, then dispatch one implementer agent per surface in parallel.
3
4
  argument-hint: <feature_id>
4
5
  ---
@@ -6,18 +7,23 @@ argument-hint: <feature_id>
6
7
  You are the **lead**. Build feature **$ARGUMENTS** from its frozen spec.
7
8
 
8
9
  > Read `PIPELINE.md` §`pipeline-profile` first: the `surfaces` list (how many implementers to
9
- > dispatch + their agent names), `contract` (mechanism + path), and the `design` flag.
10
- >
11
- > Template paths below (`.claude/templates/…`) resolve to `~/.claude/templates/…` when the core is
12
- > installed globally — read whichever exists.
10
+ > dispatch + their agent names), `contract` (mechanism + path), and the `design` flag. _Skip the
11
+ > re-read if it's already in your context this session and unmodified since._
13
12
  >
14
13
  > **Kanban** (SCHEMA.md §Kanban): once §1 confirms the frozen spec, move card `#$ARGUMENTS` →
15
14
  > **Building**. No-op silently if no board is configured.
16
15
 
17
16
  ## 1. Load & check
18
17
 
19
- - Read `specs/$ARGUMENTS.md`. If missing or `status` not `frozen`/`in-review`, stop tell the human to
20
- run `/spec` first.
18
+ - Check the spec front-matter FIRST `grep '^status:' specs/$ARGUMENTS.md` (or Read with a ~15-line
19
+ limit) — before any full read. If missing or `status` not `frozen`/`in-review`, stop — tell the human
20
+ to run `/spec` first. Only then read the body, selectively: front-matter, §5 contract, the surface
21
+ task sections, and `## Remediation` (fall back to a full read if the spec doesn't follow the
22
+ template's headings).
23
+ - **Route check** — if `## Remediation` has open `- [ ]` items and none requires a contract change,
24
+ stop and tell the human to run `/fix $ARGUMENTS` instead: it re-dispatches only the surfaces with
25
+ findings. A full build with open items is only right when the contract change ripples into clean
26
+ surfaces (the case `/fix` §1 falls back here for).
21
27
  - **Design gate** — only if `design.enabled` and the feature has UI (some surface `uses_design`): if the
22
28
  spec front-matter `design_files` is empty, ask the human for the feature's design **links** and store
23
29
  them in `design_files`, then continue. Each entry is a full self-contained link of the form
@@ -26,7 +32,8 @@ You are the **lead**. Build feature **$ARGUMENTS** from its frozen spec.
26
32
  survives a design-system rebuild (a new DS ⇒ just paste the new links, no profile change). _Legacy bare
27
33
  file names still resolve against the optional `design.design_project` fallback, but new specs use links._
28
34
  Skip if the feature is backend-only / no UI.
29
- - If this is a fix loop (`## Remediation` has unchecked items), note them they go to every agent.
35
+ - If this is a fix loop (`## Remediation` has unchecked items), map each open item to a surface by its
36
+ `file:line` path — each agent gets ONLY its own surface's items, inlined in its dispatch (§3).
30
37
 
31
38
  ## 1.5 Reconcile surfaces — auto-grow / specialize agents
32
39
 
@@ -56,8 +63,9 @@ _Only if `contract.enabled`._ From §5 of the spec, write/update the feature's c
56
63
  types for `shared-types-zod`). Export it from `contract.index` if set. This is the ONLY file the agents
57
64
  share; they import it read-only and must not edit it. If `contract.enabled` is false, the spec prose is
58
65
  the sync channel — say so and skip. **Postcondition (if `contract.enabled`):**
59
- `test -f <contract.path>/$ARGUMENTS.<contract.ext>` — the contract file must exist before you dispatch
60
- §3, or the stateless agents have nothing to build against.
66
+ `test -f <contract.path>/$ARGUMENTS.<contract.ext> && date +%s` — the contract file must exist before
67
+ you dispatch §3, or the stateless agents have nothing to build against (the epoch output is §4's
68
+ wall-clock start — no separate timing call).
61
69
 
62
70
  ## 3. Dispatch one implementer per surface — IN PARALLEL
63
71
 
@@ -65,27 +73,35 @@ Spawn every surface's agent in a **single message** (one Task call each) so they
65
73
  NEVER serially: build wall-clock must be the slowest surface, not the sum. Use
66
74
  the reconciled `surfaces` list from §1.5 (existing + any just-rendered). Give EACH only what a stateless
67
75
  agent needs — re-supply everything every time, as **exact file paths** (spec, contract, the surface's
68
- tree), never "find the relevant files". Keep the dispatch prompt **structurally identical across
69
- dispatches and fix loops** (same template below, only the variable parts change) so repeated dispatches
70
- hit the prompt cache. Note the epoch (`date +%s`) just before dispatching §4's metrics line needs
71
- the batch wall-clock. For each surface in `surfaces`:
76
+ tree), never "find the relevant files". Keep the dispatch prompt **byte-identical across dispatches
77
+ and fix loops** except the two variable slots, which sit at the END of the prompt so every repeat hits
78
+ the prompt-cache prefix. Never paste a diff into a dispatchthe agent computes its own, scoped to its
79
+ tree. For each surface in `surfaces`:
72
80
 
73
81
  > `subagent_type: <surface.agent>` — "Implement the **<surface.key>** surface for feature `$ARGUMENTS`.
74
82
  > Read `PIPELINE.md` first. Spec: `specs/$ARGUMENTS.md`. Contract: `<contract.path>/$ARGUMENTS.<ext>`
75
- > (import read-only). Work test-first. Touch only `<surface.path>`. [If a `uses_design` surface: design
76
- > > files = the spec's `design_files` links each `https://claude.ai/design/p/<projectId>?file=<file>`
77
- > > carries its own project + page, fetch read-only via `DesignSync get_file(<projectId>, <file>)`;
78
- > > build mobile-first.] [If fix loop: address the
79
- > > `## Remediation` items; current diff: …]. Return the handoff per `.claude/templates/agent-handoff.md`."
83
+ > (import read-only). Work test-first. Touch only `<surface.path>`. Need the current state of your
84
+ > tree? Compute it yourself: `git diff <default_branch> -- <surface.path>`. Return the handoff in the
85
+ > format your agent instructions define. Design files: <the spec's `design_files` links — each
86
+ > `https://claude.ai/design/p/<projectId>?file=<file>` carries its own project + page, fetch read-only
87
+ > via `DesignSync get_file`, build mobile-first · or `none` (non-design surface, or a fix loop whose
88
+ > open items are all non-visual)>. Open Remediation items for YOUR surface (self-contained — fix
89
+ > exactly these, reading only the files they name; `none` ⇒ first build, implement the spec's tasks
90
+ > for your surface): <the surface's open `- [ ]` lines verbatim, or `none`>."
80
91
 
81
92
  ## 4. Integrate
82
93
 
83
- When all return, summarize their handoffs and flag any contract mismatch reported. Append **one line
84
- per dispatched agent** to `.claude/pipeline-metrics.jsonl` (create it if absent; it must be
85
- gitignored):
86
- `{"ts":"<ISO date>","feature":"$ARGUMENTS","phase":"build","surface":"<key>","seconds":<batch wall-clock>,"result":"ok|error"}`
94
+ When all return, flag any contract mismatch or failing test from the handoffs; otherwise print one
95
+ status line per surface (`<key> · tests pass/fail · <n> TODOs`) do not restate handoff content.
96
+ Append **ONE line for the batch** to the **main checkout's** `.claude/pipeline-metrics.jsonl` —
97
+ NOT the worktree's, which dies at teardown while metrics must accumulate across features. Resolve
98
+ it from anywhere: `$(dirname "$(git rev-parse --git-common-dir)")/.claude/pipeline-metrics.jsonl`
99
+ (in the main checkout this resolves to itself). Create it if absent; it must be gitignored.
100
+ Compute the elapsed time in the same Bash call
101
+ (`echo "{...\"seconds\":$(($(date +%s)-<start epoch from §2>)),...}" >> …`):
102
+ `{"ts":"<ISO date>","feature":"$ARGUMENTS","phase":"build","seconds":<wall-clock>,"surfaces":{"<key>":"ok|error",…}}`
87
103
  — this is the evidence SCHEMA.md §Specialization asks for before splitting a surface.
88
104
  Then tell the human: run `/smoke $ARGUMENTS` to exercise the feature end-to-end (or test by hand),
89
105
  then `/review $ARGUMENTS`. Do not run the app or migrations yourself here — `/smoke` is the
90
- sanctioned path for that. _The spec, contract and diff are all on disk — `/clear` before `/smoke`
91
- is safe._
106
+ sanctioned path for that. **Recommend a `/clear` now** — the spec, contract and diff are all on
107
+ disk, and the lead's history is re-sent at input price on every turn it survives.
@@ -1,4 +1,5 @@
1
1
  ---
2
+ model: sonnet
2
3
  description: Diagnose the pipeline installation — core version, pointer, agents↔surfaces, hooks, gate, retrieval, design, isolation — and print the exact fix for each failure.
3
4
  ---
4
5
 
@@ -22,7 +23,17 @@ fix only with the human's go-ahead (or hand them the command).
22
23
  `surfaces[].agent` has its `.claude/agents/<agent>.md` and every agent file has its `surfaces[]`
23
24
  entry — **no orphans either way** (SCHEMA.md rule). Each rendered agent's frontmatter `tools`
24
25
  matches its surface's `tools` (incl. `DesignSync` iff `uses_design`, retrieval MCP tools iff
25
- `retrieval.provider` ≠ `none`).
26
+ `retrieval.provider` ≠ `none`). **Model pins:** each rendered agent's frontmatter `model` matches
27
+ its `surfaces[].model` — ❌ if missing, mismatched, or a literal `<SURFACE_MODEL>` placeholder
28
+ (all three silently fall back to inheriting the lead session's model — often Opus — on every
29
+ dispatch); ⚠️ any `inherit` with the note that it bills at the lead's tier. The generic agents
30
+ (`review.md`, `release.md`, `smoke.md` — repo or `~/.claude/agents/`) must each carry their
31
+ `model:` line too (sonnet/haiku/sonnet). **Command pins:** every mechanical command file
32
+ (`build`, `review`, `fix`, `smoke`, `ship`, `audit`, `refactor`, `doctor`, `align-ds`,
33
+ `update-pipeline` — in `.claude/commands/` or `~/.claude/commands/`) carries `model: sonnet` in
34
+ its frontmatter — ⚠️ if missing (the lead's orchestration turn then bills at the session model,
35
+ e.g. Opus/Fable). `brainstorm`, `spec`, and `init-pipeline` are intentionally unpinned
36
+ (interactive — they inherit the session model).
26
37
  3. **Hooks & gate.** `.claude/gate-config.json` exists and mirrors the profile's `gate` block
27
38
  (regenerate if drifted). The PreToolUse gate hook is registered **once** for the install mode
28
39
  (bundled: repo `settings.json`; global: `~/.claude/settings.json` — flag double registration,
@@ -39,9 +50,15 @@ fix only with the human's go-ahead (or hand them the command).
39
50
  rendered (no `__TOKEN__` placeholders left). `.worktrees/slots.tsv` coherent with
40
51
  `git worktree list` — flag **stale slots** (registered but no worktree) and **zombie worktrees**
41
52
  (worktree but no slot / spec already `shipped`) ⇒ suggest `scripts/remove-feature.sh <id>`.
53
+ When ≥2 slots are live, print the parallel-feature table (feature · worktree · ports · db ·
54
+ branch behind main by N commits) — a worktree far behind main means its next review will diff
55
+ against stale code ⇒ suggest rebasing it.
42
56
  7. **Specs & metrics.** Every `specs/*.md` front-matter `status` is a valid stage; `shipped` specs
43
57
  with a live worktree flagged (see 6). `.claude/pipeline-metrics.jsonl` and `specs/reports/` (the
44
- `/review`·`/smoke` report buffer that lets a `/fix` survive a `/clear`) are gitignored.
58
+ `/review`·`/smoke` report buffer that lets a `/fix` survive a `/clear`) are gitignored. Metrics
59
+ belong to the **main checkout** — a `pipeline-metrics.jsonl` inside a live feature worktree is a
60
+ stale-core sign (its lines die at teardown) ⇒ suggest appending its lines to the main checkout's
61
+ file and deleting the stray.
45
62
 
46
63
  ## Report
47
64
 
@@ -1,4 +1,5 @@
1
1
  ---
2
+ model: sonnet
2
3
  description: Apply a REVIEW REPORT (or SMOKE failures) — append it to the spec's Remediation, then re-dispatch ONLY the surfaces that have findings.
3
4
  argument-hint: <feature_id> [paste REVIEW REPORT]
4
5
  ---
@@ -8,9 +9,7 @@ You are the **lead**. Run the fix loop for feature **$ARGUMENTS** — the scoped
8
9
  that change the *contract*; `/fix` is for everything else.
9
10
 
10
11
  > Read `PIPELINE.md` §`pipeline-profile` first: `surfaces` (paths + agent names) and `contract`.
11
- >
12
- > Template paths below (`.claude/templates/…`) resolve to `~/.claude/templates/…` when the core is
13
- > installed globally — read whichever exists.
12
+ > _Skip the re-read if it's already in your context this session and unmodified since._
14
13
  >
15
14
  > **Kanban** (SCHEMA.md §Kanban): move card `#$ARGUMENTS` → **Fix** on ingest (it returns to **Review**
16
15
  > when `/review` re-runs). No-op silently if no board.
@@ -23,7 +22,9 @@ that change the *contract*; `/fix` is for everything else.
23
22
  If you have none of these, ask for it and wait.
24
23
  - Append each finding to `specs/<id>.md` **`## Remediation`** (same format as `/spec` Mode B, under a
25
24
  dated/numbered subheading): `- [ ] <severity> · <file:line> · <type> · <concrete fix>`. Set
26
- `status: in-review`.
25
+ `status: in-review`. Don't pull the whole spec into context for this: grep the line numbers of the
26
+ front-matter `status:` and the `## Remediation` heading, then Read only those regions (offset/limit)
27
+ before editing.
27
28
  - **Contract check:** if any finding implies the frozen contract must change, update spec §5 and
28
29
  re-author the contract file yourself now (lead-only, per `/build` §2) — agents never edit it. If
29
30
  the contract change ripples into surfaces *without* findings, fall back to full `/build` instead
@@ -36,8 +37,12 @@ that change the *contract*; `/fix` is for everything else.
36
37
  re-dispatch them. Items outside every surface path (contract file, root config) are yours or go
37
38
  to the most relevant surface — say which.
38
39
  - Re-dispatch **ONLY the surfaces owning ≥1 item**, in parallel, in a **single message** — the exact
39
- fix-loop dispatch template from `/build` §3 (spec, contract read-only, "address the `## Remediation`
40
- items", current diff). Surfaces without findings are NOT re-dispatched that is the point.
40
+ dispatch template from `/build` §3 (one byte-stable template for builds and fix loops; you do NOT
41
+ paste a diff the agent computes its own, scoped to its tree). Fill the template's final variable
42
+ slot with that surface's open `- [ ]` item lines **verbatim**, so the agent needs no spec re-read to
43
+ find its work; fill the design slot with `none` when a `uses_design` surface's open items are all
44
+ non-visual (no DesignSync re-fetch for a type fix). Surfaces without findings are NOT re-dispatched —
45
+ that is the point.
41
46
 
42
47
  ## 3. Integrate & check off what's fixed
43
48
 
@@ -54,9 +59,10 @@ When the agents return:
54
59
  fixed`) — the audit fact survives, but the per-item bulk stops growing the spec that every agent
55
60
  re-reads each loop. Keep any round with ≥1 still-open `- [ ]` item fully expanded (§2's skip logic
56
61
  needs those checkboxes).
57
- - Summarize the handoffs and append one metrics line per dispatched agent to
58
- `.claude/pipeline-metrics.jsonl` (see `/build` §4).
62
+ - Print one status line per surface (`<key> · items fixed <n>/<m> · tests pass/fail`) — do not restate
63
+ handoff content — and append ONE metrics line for the batch to `pipeline-metrics.jsonl`
64
+ (see `/build` §4, `phase: "fix"`).
59
65
  - Tell the human: re-run `/smoke` if the failures were runtime ones, and `/review $ARGUMENTS` for the
60
66
  re-verdict — the re-review is what *verifies* the ticked items actually hold (a regression simply
61
- reappears as a new finding in the next round). _All state (spec, checkboxes, staged report) is on
62
- disk, so `/clear` before the next command is safe._
67
+ reappears as a new finding in the next round). **Recommend a `/clear`** — all state (spec,
68
+ checkboxes, staged report) is on disk, and the lead's history is re-sent at input price every turn.