cohorte 3.0.0 → 3.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.
Files changed (69) hide show
  1. package/CHANGELOG.md +122 -0
  2. package/README.md +16 -10
  3. package/bin/cli.js +2 -1
  4. package/core/agents/cohorte-profile-reader.md +21 -31
  5. package/core/agents/cohorte-release.md +6 -3
  6. package/core/agents/cohorte-review.md +31 -5
  7. package/core/agents/implementer.template.md +13 -5
  8. package/core/commands/cohorte-align-ds.md +1 -1
  9. package/core/commands/cohorte-audit.md +11 -4
  10. package/core/commands/cohorte-brainstorm.md +2 -2
  11. package/core/commands/cohorte-build.md +19 -12
  12. package/core/commands/cohorte-doctor.md +11 -9
  13. package/core/commands/cohorte-fix.md +3 -3
  14. package/core/commands/cohorte-fleet.md +2 -2
  15. package/core/commands/cohorte-init-pipeline.md +2 -2
  16. package/core/commands/cohorte-intake.md +4 -4
  17. package/core/commands/cohorte-patch.md +2 -2
  18. package/core/commands/cohorte-refactor.md +73 -8
  19. package/core/commands/cohorte-retro.md +3 -3
  20. package/core/commands/cohorte-revert.md +104 -0
  21. package/core/commands/cohorte-review.md +32 -17
  22. package/core/commands/cohorte-ship.md +26 -9
  23. package/core/commands/cohorte-spec.md +13 -4
  24. package/core/commands/cohorte-update-pipeline.md +12 -8
  25. package/core/commands/cohorte-verify.md +106 -0
  26. package/core/hooks/gate.py +326 -21
  27. package/core/templates/patch.template.md +11 -2
  28. package/core/templates/spec.template.md +23 -2
  29. package/core/templates/steps/init-pipeline/01-detect-stack.md +14 -5
  30. package/core/templates/steps/init-pipeline/02-interview-gaps.md +26 -3
  31. package/core/templates/steps/init-pipeline/03-draft-profile.md +2 -1
  32. package/core/templates/steps/init-pipeline/04-write-render.md +16 -12
  33. package/core/templates/steps/init-pipeline/05-report.md +1 -1
  34. package/core/workflows/audit.js +9 -4
  35. package/core/workflows/loop.js +15 -10
  36. package/core/workflows/refactor.js +116 -9
  37. package/core/workflows/review.js +24 -10
  38. package/lib/doctor.js +37 -3
  39. package/lib/install.js +68 -33
  40. package/lib/project.js +45 -8
  41. package/lib/render.js +3 -3
  42. package/lib/yaml.js +10 -1
  43. package/package.json +2 -2
  44. package/profile/PIPELINE.template.md +39 -1
  45. package/profile/SCHEMA.md +27 -746
  46. package/profile/cohorte.config.template.yaml +1 -1
  47. package/profile/schema/dead-agents.md +29 -0
  48. package/profile/schema/decisions.md +23 -0
  49. package/profile/schema/deferred.md +22 -0
  50. package/profile/schema/feature-diff.md +20 -0
  51. package/profile/schema/kanban.md +95 -0
  52. package/profile/schema/metrics.md +23 -0
  53. package/profile/schema/output-discipline.md +21 -0
  54. package/profile/schema/preflight.md +81 -0
  55. package/profile/schema/profile-block.md +103 -0
  56. package/profile/schema/project-kinds.md +89 -0
  57. package/profile/schema/readiness.md +17 -0
  58. package/profile/schema/reconcile.md +64 -0
  59. package/profile/schema/release-notes.md +29 -0
  60. package/profile/schema/rendering.md +48 -0
  61. package/profile/schema/retrieval.md +58 -0
  62. package/profile/schema/spec-status.md +79 -0
  63. package/profile/schema/specialization.md +41 -0
  64. package/profile/schema/verify.md +115 -0
  65. package/profile/schema/workflows.md +78 -0
  66. package/scripts/kanban-move.sh +45 -3
  67. package/scripts/new-feature.sh.template +7 -1
  68. package/scripts/remove-feature.sh.template +14 -5
  69. package/scripts/verify-run.sh +509 -0
@@ -24,7 +24,7 @@ fix only with the human's go-ahead (or hand them the command).
24
24
  **2.x leftovers are ⚠️ with a named fix:** a vendored core in this repo (`.claude/pipeline/VERSION`,
25
25
  `.claude/hooks/gate.py`) ⇒ `<sync>` removes it; a 2.x core in `~/.claude/pipeline/` or a gate
26
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
27
+ project in `~/.claude/agents/` ⇒ re-render them into `<agents>/` (`<core>/pipeline/schema/rendering.md`) and delete the global
28
28
  copies. The router commands' step files are present — `<core>/templates/steps/init-pipeline/`
29
29
  non-empty. **Shipped scripts present and executable** in `<core>/pipeline/scripts/`:
30
30
  `kanban-move.sh`, `preflight.sh`, `feature-diff.sh`; the `new-feature.sh.template` and
@@ -33,9 +33,12 @@ fix only with the human's go-ahead (or hand them the command).
33
33
  no-op (no card moves, no error anywhere) — this check is the only thing that sees it;
34
34
  an absent `feature-diff.sh` stops every review and ship (they refuse to fall back to a
35
35
  bare `git diff`, which misses untracked files).
36
- 2. **Profile.** `PIPELINE.md` exists and its `yaml pipeline-profile` block parses. Every
36
+ 2. **Profile.** `PIPELINE.md` exists and its `yaml pipeline-profile` block parses.
37
+ `<state>/profile.json` (the parsed block agents read instead of `PIPELINE.md`) is present and
38
+ matches it (`cohorte doctor`'s `profile-json` row compares them byte for byte); ⚠️
39
+ missing/stale/uncommitted ⇒ fix: `<sync>`, then commit `<state>/profile.json`. Every
37
40
  `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`
41
+ entry — **no orphans either way** (`<core>/pipeline/schema/rendering.md` rule). Each rendered agent's frontmatter `tools`
39
42
  matches its surface's `tools` (incl. `DesignSync` iff `uses_design`, retrieval MCP tools iff
40
43
  `retrieval.provider` ≠ `none`). **Model pins:** each rendered agent's frontmatter `model` matches
41
44
  its `surfaces[].model` — ❌ if missing, mismatched, or a literal `<SURFACE_MODEL>` placeholder
@@ -55,7 +58,7 @@ fix only with the human's go-ahead (or hand them the command).
55
58
  (`git ls-files --error-unmatch .claude/hooks/cohorte-gate.py`), and `.claude/settings.json`
56
59
  registers it exactly once per matcher group — `Bash|Task|Agent` (shell + subagent dispatches; the
57
60
  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
61
+ and `Write|Edit|MultiEdit|NotebookEdit` (self-protection of the gate's own files). A registration whose file is
59
62
  missing is ❌ — with `onFailure: block` it refuses every Bash call; fix: `<sync>`. A second gate
60
63
  registered in `~/.claude/settings.json` (2.x) is ⚠️ — it double-prompts; fix: `cohorte update`.
61
64
  Test the evaluator too: `python3 .claude/hooks/cohorte-gate.py --check "<a pattern from the ask list>"`
@@ -65,7 +68,7 @@ fix only with the human's go-ahead (or hand them the command).
65
68
  ⚠️) — it records the tree it verified, the commit that carries it moves HEAD past that tree, and
66
69
  the committed copy lands in every clone and new worktree; the gate then blocks clean trees and
67
70
  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
71
+ 4. **Retrieval** (if `retrieval.provider` ≠ `none`). Run the `<core>/pipeline/schema/retrieval.md` health
69
72
  check: CLI resolvable from PATH, `.mcp.json` entry present in PATH-proof launcher form,
70
73
  `.serena/` gitignored, server actually connects.
71
74
  5. **Design** (if `design.enabled`). `snapshot_dir` exists and is committed; `ui_kit_path` +
@@ -80,7 +83,7 @@ fix only with the human's go-ahead (or hand them the command).
80
83
  When ≥2 slots are live, print the parallel-feature table (feature · worktree · ports · db ·
81
84
  branch behind main by N commits) — a worktree far behind main means its next review will diff
82
85
  against stale code ⇒ suggest rebasing it.
83
- 7. **Kanban** (the board mirror — SCHEMA.md §Kanban). Run
86
+ 7. **Kanban** (the board mirror — `<core>/pipeline/schema/kanban.md`). Run
84
87
  `<core>/pipeline/scripts/kanban-move.sh --check` and report its one line verbatim: the resolved
85
88
  board path, or the exact link that is missing. A board mirror is optional, so "not configured" is
86
89
  ℹ️, never ❌ — but it must be **stated**, because the whole class of bug here is a card that
@@ -89,7 +92,7 @@ fix only with the human's go-ahead (or hand them the command).
89
92
  other key whose board file exists (a **rename** orphaned the link — re-key it via
90
93
  `/cohorte-update-pipeline`), and an entry whose board file no longer exists at
91
94
  `vault_path`-relative `board` (moved or renamed in the vault).
92
- 8. **Workflows** (the opt-in execution path — SCHEMA.md §Workflows; the conversational commands
95
+ 8. **Workflows** (the opt-in execution path — `<core>/pipeline/schema/workflows.md`; the conversational commands
93
96
  stay the default, so failures here are ⚠️ at most, never ❌). Report which path this machine will
94
97
  take and why:
95
98
  - **Claude Code version** ≥ 2.1.154 (`claude --version 2>/dev/null | head -1`) — older or no CLI
@@ -109,8 +112,7 @@ fix only with the human's go-ahead (or hand them the command).
109
112
  `workflows: available (opt-in — ask to "run the review workflow")` or
110
113
  `workflows: unavailable (<first failing prerequisite>) — conversational commands (the default)`.
111
114
  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
115
+ `draft · frozen · in-progress · in-review · blocked · shipped · merged · abandoned` (`<core>/pipeline/schema/spec-status.md`) — excluding
114
116
  `_`-prefixed files (the spec template and `specs/_decisions.md`, the decision journal) and
115
117
  `specs/refactor-backlog.md`, which `/cohorte-audit` writes as a backlog, not a
116
118
  spec, and which has no front-matter to check. A spec left `in-progress` or `blocked` is a round
@@ -8,10 +8,10 @@ You are the **lead**. Run the fix loop for feature **$ARGUMENTS** — the scoped
8
8
  `REVISE`/`BLOCK` verdict. The full `/cohorte-spec` (Mode B) + `/cohorte-build` path still exists for review returns
9
9
  that change the *contract*; `/cohorte-fix` is for everything else.
10
10
 
11
- > Read `PIPELINE.md` §`pipeline-profile` first: `surfaces` (paths + agent names) and `contract`.
11
+ > Read `.claude/profile.json` first (the parsed `pipeline-profile` block; absent ⇒ read that block in `PIPELINE.md`): `surfaces` (paths + agent names) and `contract`.
12
12
  > _Skip the re-read if it's already in your context this session and unmodified since._
13
13
  >
14
- > **Kanban** (SCHEMA.md §Kanban): on ingest, run
14
+ > **Kanban** (`<core>/pipeline/schema/kanban.md`): on ingest, run
15
15
  > `<core>/pipeline/scripts/kanban-move.sh auto $ARGUMENTS fix`; the card returns to **Review** when `/cohorte-review`
16
16
  > re-runs. `auto` resolves the board from the config itself and exits 0 with a `kanban: <reason>`
17
17
  > line when there is none — so **never decide "no board is configured" without running it**.
@@ -53,7 +53,7 @@ that change the *contract*; `/cohorte-fix` is for everything else.
53
53
 
54
54
  When the agents return:
55
55
 
56
- - **Roll call first (SCHEMA.md §Dead agents).** A re-dispatched agent that returns nothing has fixed
56
+ - **Roll call first (`<core>/pipeline/schema/dead-agents.md`).** A re-dispatched agent that returns nothing has fixed
57
57
  nothing you can verify. Retry that surface ONCE with the byte-identical dispatch; still silent ⇒ leave
58
58
  **every one of its items `- [ ]`** (a dead agent never ticks a box — that would hide an open finding
59
59
  from the next round and from the driver), print `<key> · DEAD — items untouched`, and say the surface
@@ -17,7 +17,7 @@ worktree's session**, supervised like any other; the fleet plans, watches and re
17
17
  lives in `specs/reports/fleet.json` (the main checkout's gitignored buffer — this repo's
18
18
  multi-*feature* flight plan).
19
19
 
20
- > Read `PIPELINE.md` §`pipeline-profile` first: `surfaces` (paths — the overlap analysis keys
20
+ > Read `.claude/profile.json` first (the parsed `pipeline-profile` block; absent ⇒ read that block in `PIPELINE.md`): `surfaces` (paths — the overlap analysis keys
21
21
  > on them), `contract`, `vcs.default_branch`, and the `isolation` block. _Skip the re-read if
22
22
  > already in context and unmodified since._ **`isolation.enabled: false` ⇒ stop at `plan`**:
23
23
  > N features in one checkout is a merge-conflict generator with extra steps — name the fix
@@ -83,7 +83,7 @@ needed — run sync"). A worktree registered in `fleet.json` but gone from
83
83
 
84
84
  Run after every merge (the human says which feature shipped, or you detect it: spec
85
85
  `status: merged`, or `status: shipped` + `gh pr view <branch> --json state` = `MERGED` — then set
86
- `status: merged` in that worktree's spec, SCHEMA.md §Spec status):
86
+ `status: merged` in that worktree's spec, `<core>/pipeline/schema/spec-status.md`):
87
87
 
88
88
  1. Drop the shipped feature from `fleet.json` (rewrite, keep order of the rest) — and if its
89
89
  worktree still exists, remind the teardown `/cohorte-ship` proposes:
@@ -12,8 +12,8 @@ agents. Interactive — confirm inferences with the human.
12
12
  > **One mode.** The commands and the generic core are installed once per machine (`<core>`).
13
13
  > **Everything you GENERATE is written into THIS repo and committed with it** — `PIPELINE.md` at the
14
14
  > root, the surface agents under `<agents>/`, `<state>/gate-config.json` — and the gate hook, its
15
- > registration, the `<state>/pipeline.json` pointer and the `.gitignore` entries are written by
16
- > `<sync>`, never by hand. Nothing project-specific ever goes under `~/.claude`.
15
+ > registration, the `<state>/pipeline.json` pointer, `<state>/profile.json` (the parsed machine block,
16
+ > committed) and the `.gitignore` entries are written by `<sync>` — after `PIPELINE.md`, never by hand. Nothing project-specific ever goes under `~/.claude`.
17
17
  >
18
18
  > Work in phases. Do not write any file until Phase 4.
19
19
 
@@ -8,7 +8,7 @@ client email, a support thread, a stack trace, a half-idea — and today a human
8
8
  hand before anything can start. Your job is that distillation: read the raw material, decide
9
9
  which door it enters through, and stage a handoff the next command can consume verbatim.
10
10
 
11
- > Read `PIPELINE.md` §`pipeline-profile` first — `name`, `one_liner`, `surfaces` (to guess which
11
+ > Read `.claude/profile.json` first (the parsed `pipeline-profile` block; absent ⇒ read that block in `PIPELINE.md`) — `name`, `one_liner`, `surfaces` (to guess which
12
12
  > surface a symptom lives in) and `ui_language`. _Skip the re-read if it's already in your
13
13
  > context this session and unmodified since._ Read `specs/_decisions.md` §Live if it exists —
14
14
  > an incoming request that contradicts a settled decision must be flagged as such, not triaged
@@ -50,12 +50,12 @@ patch triage starts loaded instead of re-asking:
50
50
  **Stage it** to `specs/reports/intake-<slug>.md` (overwrite; `mkdir -p specs/reports` first —
51
51
  the gitignored buffer dir, so the handoff survives a `/clear`). Then:
52
52
 
53
- > **Kanban** (SCHEMA.md §Kanban): run
53
+ > **Kanban** (`<core>/pipeline/schema/kanban.md`): run
54
54
  > `<core>/pipeline/scripts/kanban-move.sh auto patch-<slug> ideas --title "[patch] <one-line title>"`.
55
55
  > The id is **`patch-<slug>`, prefix included, and the title prefix is `[patch]`** — that is the
56
56
  > exact join key and the exact title `/cohorte-patch` §1 looks for, so its later move finds THIS
57
- > card instead of creating a duplicate and stranding this one in Ideas (the failure SCHEMA
58
- > §Kanban's "tag before you move" exists to prevent). `auto` resolves the board from the config
57
+ > card instead of creating a duplicate and stranding this one in Ideas (the failure
58
+ > `<core>/pipeline/schema/kanban.md`'s "tag before you move" exists to prevent). `auto` resolves the board from the config
59
59
  > itself and exits 0 with a `kanban: <reason>` line when there is none — so **never decide "no
60
60
  > board is configured" without running it**.
61
61
 
@@ -12,12 +12,12 @@ cycle at input price on every turn.
12
12
 
13
13
  Bug (may be empty): **$ARGUMENTS**
14
14
 
15
- > Read `PIPELINE.md` §`pipeline-profile` first: `surfaces` (paths — this is what you map the bug onto)
15
+ > Read `.claude/profile.json` first (the parsed `pipeline-profile` block; absent ⇒ read that block in `PIPELINE.md`): `surfaces` (paths — this is what you map the bug onto)
16
16
  > and `vcs`. _Skip the re-read if it's already in your context this session and unmodified since._
17
17
  > Do NOT read `specs/_decisions.md`: a bug fix decides nothing transverse, and the journal is for
18
18
  > decisions that outlive a feature.
19
19
  >
20
- > **Kanban** (SCHEMA.md §Kanban): two moves, and their **order is load-bearing** — §1 settles the
20
+ > **Kanban** (`<core>/pipeline/schema/kanban.md`): two moves, and their **order is load-bearing** — §1 settles the
21
21
  > slug and moves the card to `spec`, §4 moves it to `ready` at freeze. Both are one call to
22
22
  > `<core>/pipeline/scripts/kanban-move.sh auto patch-<slug> <stage> [--title "[patch] <human title>"]`.
23
23
  > The slug is settled first precisely because the move needs it: a card cannot be joined on an id
@@ -1,22 +1,29 @@
1
1
  ---
2
2
  model: sonnet
3
- description: Apply the refactor backlog for one or more domains via the surface implementer agents (TDD-first, parallel across independent surfaces), then re-verify.
3
+ description: Apply the refactor backlog for one or more domains via the surface implementer agents (TDD-first, parallel across independent surfaces), re-verify, then freeze a refactor spec for /cohorte-review → /cohorte-ship.
4
4
  argument-hint: <domain…> (one or more surface keys, "shared", or "all")
5
5
  ---
6
6
 
7
7
  You are the **lead**. Refactor domain **$ARGUMENTS** to match `PIPELINE.md`, using the `/cohorte-audit` backlog.
8
8
 
9
- > Read `PIPELINE.md` §`surfaces` (map the domain → a surface + its agent + commands) and §`contract`.
9
+ > Read `.claude/profile.json` `surfaces` (map the domain → a surface + its agent + commands), `contract`
10
+ > and `vcs` (§4's branch) (the parsed `pipeline-profile` block; absent ⇒ read that block in `PIPELINE.md`).
10
11
  >
11
- > **Workflow variant** (opt-in — SCHEMA.md §Workflows): for BIG domains (many open backlog items
12
+ > **Kanban** (`<core>/pipeline/schema/kanban.md`): §4 runs
13
+ > `<core>/pipeline/scripts/kanban-move.sh auto <spec id> ready --title "[refactor] <domains>"`. `auto`
14
+ > resolves the board from the config itself and exits 0 with a `kanban: <reason>` line when there is
15
+ > none — so **never decide "no board is configured" without running it**.
16
+ >
17
+ > **Workflow variant** (opt-in — `<core>/pipeline/schema/workflows.md`): for BIG domains (many open backlog items
12
18
  > across several surfaces), on Claude Code ≥ 2.1.154 with workflows enabled, the human can ask to
13
19
  > "run the refactor workflow" (`<core>/workflows/refactor.js`). For a handful of items this
14
20
  > conversational path is cheaper — and it stays the default and the fallback.
15
21
 
16
22
  ## 1. Gather
17
23
 
18
- - Read `specs/refactor-backlog.md`; select the items for `$ARGUMENTS` (`all` = every domain with
19
- open items).
24
+ - Read `specs/refactor-backlog.md`; select the **open** (`- [ ]`) items for `$ARGUMENTS` (`all` =
25
+ every domain with open items). A ticked line carrying `· refactor:<id>` is done and in flight in
26
+ that spec — never re-dispatch it.
20
27
  - Map each domain to a surface. `shared` = the contract package (`contract.path`), owned by you/lead —
21
28
  refactor it directly, don't dispatch.
22
29
 
@@ -49,9 +56,67 @@ slices import it, so refactor it alone, first.
49
56
  ## 3. Verify & loop
50
57
 
51
58
  After each agent returns: its surface's `test_quiet_cmd`/`lint_quiet_cmd` (else the `tail -40`
52
- fallback — SCHEMA.md §Output discipline), `commands.typecheck`, `commands.format --check` (redirect
59
+ fallback — `<core>/pipeline/schema/output-discipline.md`), `commands.typecheck`, `commands.format --check` (redirect
53
60
  output to a file and grep it — don't print gate output into your context). Then verify each backlog item cleared by checking its `file:line` directly — do NOT re-run
54
61
  `/cohorte-audit` per round (that repeats the repo-wide gates + a review dispatch you don't need); one optional
55
62
  final `/cohorte-audit` once ALL dispatched domains are clean is enough. Check cleared items off in
56
- `specs/refactor-backlog.md`. Loop until each dispatched domain is clean. Verification is per-domain
57
- even when the dispatch was parallel — one failing surface loops alone, the others don't redo work.
63
+ `specs/refactor-backlog.md` (`- [ ]` → `- [x]`) as they verify — whatever happens next. Loop until
64
+ each dispatched domain is clean. Verification is per-domain even when the dispatch was parallel — one failing surface loops
65
+ alone, the others don't redo work.
66
+
67
+ ## 4. Deliver — freeze a `kind: refactor` spec, then review → ship
68
+
69
+ The round is code in the working tree with no route to a PR: `/cohorte-ship` ships a spec. So once
70
+ the gates are green and ≥ 1 item cleared (red gates ⇒ no spec — `/cohorte-review`'s preflight would
71
+ abort it anyway), write **one spec for the whole round** — review's diff, the freshness digest and
72
+ the release commit all cover the whole tree, so per-domain specs would each claim the others' code.
73
+
74
+ - **One open refactor spec per branch.** Already on `<feature_branch_prefix>refactor-…` with that
75
+ spec unshipped (`status: frozen`/`in-review`) ⇒ append this round's items to its §6 (new
76
+ `### <domain>` as needed) and skip to linking the ticks — whatever the domains.
77
+ - **Id** otherwise `refactor-<domains>-<YYYY-MM-DD>` (`date +%F`): `<domains>` = the cleared domains'
78
+ keys lowercased, every run of non-`[a-z0-9]` turned into `-`, joined by `-` — or `all` past three.
79
+ A spec of that id already shipped ⇒ suffix `-2`, `-3`…
80
+ - **Branch** — `/cohorte-ship` refuses any branch but `<vcs.feature_branch_prefix><id>`: on
81
+ `<default_branch>`, `git switch -c <prefix><id>` (uncommitted work carries over); already on it ⇒
82
+ fine; on some other branch ⇒ say which and ask.
83
+ - **Write `specs/<id>.md`** — create it, don't ask the human to. No §5: there is no contract, and the
84
+ numbers `/cohorte-review` and `/cohorte-ship` read (§1/§2, §9, `## Remediation`) are kept:
85
+
86
+ ```
87
+ ---
88
+ feature_id: <id>
89
+ kind: refactor # behaviour-preserving backlog pass — no contract; commit as refactor(<scope>)
90
+ title: Refactor <domains> — <n> backlog items
91
+ status: frozen
92
+ branch: <feature_branch_prefix><id>
93
+ created: <YYYY-MM-DD>
94
+ reviewed_base:
95
+ reviewed_digest:
96
+ ---
97
+ # Refactor <domains> — <n> backlog items
98
+ ## 1. Goal
99
+ Clear <n> `specs/refactor-backlog.md` items on <domains> with no change of public behaviour.
100
+ ## 2. Scope
101
+ **In:** the §6 items, verbatim. **Out:** any behaviour change; the items §7 lists.
102
+ ## 6. Surface tasks
103
+ ### <domain>
104
+ - <cleared item, `- [ ] ` prefix dropped>
105
+ ## 7. Out of scope
106
+ - <items still open in the backlog for these domains — not claimed by this spec> (or `none`)
107
+ ## 9. Acceptance criteria / DoD
108
+ - [ ] Public behaviour preserved — no exported signature, route, response shape, CLI flag or persisted format changed (unless an item marks it a bug)
109
+ - [ ] Each §6 item cleared at its file:line
110
+ - [ ] All tests green — behaviour pinned by tests added first; no existing test loosened
111
+ - [ ] `PIPELINE.md` commands.lint · typecheck · test green
112
+ - [ ] Nothing outside §6's surfaces changed
113
+ ## Remediation
114
+ ```
115
+
116
+ - **Link the ticks** — append ` · refactor:<id>` to each line §3 ticked this round, so the backlog
117
+ says where the item went (and `/cohorte-audit` keeps it until that spec merges).
118
+ - `grep -q '^kind: refactor' specs/<id>.md` (the postcondition), then the kanban move above, in the
119
+ same Bash call — report what it printed: `moved #…` or `kanban: <reason>`, never a guess.
120
+ - **Hand off:** `/cohorte-review <id>` → (`/cohorte-fix <id>` → `/cohorte-review <id>`)* →
121
+ `/cohorte-ship <id>` — **recommend a `/clear` first**. Never `/cohorte-build` it, nor the loop
122
+ workflow: both treat any non-patch spec as contract-bearing.
@@ -11,7 +11,7 @@ each surface agent at render time. This command closes that loop: findings → p
11
11
  ratified rules → re-rendered agents. The next build then never produces the finding again —
12
12
  which is cheaper than any number of review rounds catching it.
13
13
 
14
- > Read `PIPELINE.md` §`pipeline-profile` (`surfaces`, and skim the existing §Conventions
14
+ > Read `.claude/profile.json` `surfaces` (the parsed `pipeline-profile` block; absent ⇒ read that block in `PIPELINE.md`), and skim `PIPELINE.md`'s existing §Conventions
15
15
  > stanzas — a rule that already exists is a finding about *enforcement*, not a missing rule)
16
16
  > and `specs/_decisions.md` §Live. _Skip the re-read if already in context and unmodified._
17
17
 
@@ -67,14 +67,14 @@ For each adopted rule, in this order:
67
67
 
68
68
  1. Append it to `PIPELINE.md` §Conventions under its stanza (create the `### Surface: <key>`
69
69
  stanza if absent; keep it rule-shaped, one line each).
70
- 2. **Re-render every affected surface agent** per SCHEMA.md §Rendering step 2 — the
70
+ 2. **Re-render every affected surface agent** per `<core>/pipeline/schema/rendering.md` step 2 — the
71
71
  `<SURFACE_CONVENTIONS>` slice is **baked at render time**, so a §Conventions edit without a
72
72
  re-render produces the worst outcome available: reviewers (who read the prose live) enforce
73
73
  a rule implementers (who carry the stale bake) have never seen, and every future review
74
74
  round re-finds the pattern this retro just paid to close. If you cannot re-render on this
75
75
  runtime, say so and route to `/cohorte-update-pipeline` (its reconcile step 2 re-renders) —
76
76
  but then the rule is **pending**, and you say that too.
77
- 3. Append ONE line per adopted rule to `specs/_decisions.md` §Live (SCHEMA.md §Decisions):
77
+ 3. Append ONE line per adopted rule to `specs/_decisions.md` §Live (`<core>/pipeline/schema/decisions.md`):
78
78
  `- <date> · conventions · <rule, compressed> — because <kind>×<n> across <features> · retro`.
79
79
  A retro rule is a standing decision; the journal is where the next `/cohorte-spec` learns it
80
80
  without re-mining the reports.
@@ -0,0 +1,104 @@
1
+ ---
2
+ model: sonnet
3
+ description: Prepare the revert of a merged feature — a revert branch and PR, its down migration run only on a dev database. Never pushes to the default branch.
4
+ argument-hint: <feature_id>
5
+ ---
6
+
7
+ You are the **lead**. Prepare the revert of feature **$ARGUMENTS**. The output is a branch and a PR
8
+ that a human reviews and merges. Rules: `<core>/pipeline/schema/verify.md` (§Databases, §Revert).
9
+
10
+ > **Never push to the default branch, never force-push, never merge.** The revert lands the way
11
+ > every change does, through a PR, and the gate confirms git writes on the default branch anyway.
12
+ > **No kanban move.** The board has no revert column, so the card stays in Shipped. This command
13
+ > calls no `kanban-move.sh` on purpose.
14
+ > Never run a migration outside `<core>/pipeline/scripts/verify-run.sh`, never against a
15
+ > shared, staging or production database, and never edit an `.env` to reach one.
16
+
17
+ ## 1. What landed
18
+
19
+ - `grep -E '^(status|branch|pr|migrations|title):' specs/$ARGUMENTS.md`.
20
+ - `merged` ⇒ continue.
21
+ - `shipped` ⇒ check it the way `/cohorte-ship` §0 does (`gh pr view <branch> --json state`).
22
+ `MERGED` ⇒ continue, and leave the status line to `/cohorte-doctor`'s reconcile, because §2
23
+ needs a clean tree. `OPEN` ⇒ there is nothing to revert: the human closes the PR.
24
+ - Anything else ⇒ stop, because nothing merged.
25
+ - **Read `## Rollback` now and keep it.** The revert deletes the spec from the tree (the release
26
+ commit added it). `migrations: true` with an empty Rollback
27
+ (`<core>/pipeline/scripts/verify-run.sh rollback-check specs/$ARGUMENTS.md` exits 1) ⇒ stop and
28
+ have the human fill it. A migration nobody knows how to undo is not reverted blind.
29
+ - Find the PR: the spec's `pr:` if present, else
30
+ `gh pr list --state merged --head <branch> --json number,url,title,mergeCommit --limit 1`.
31
+ No `gh`, or not `vcs.host: github` ⇒ ask the human for the merge commit SHA.
32
+ - `git fetch origin <default_branch>`, then
33
+ `git merge-base --is-ancestor <sha> origin/<default_branch>`. If it is not an ancestor, stop.
34
+ - Work out how the PR merged: `git rev-list --parents -n 1 <sha>`.
35
+ - **Two parents** ⇒ a merge commit: `git revert -m 1`.
36
+ - **One parent** ⇒ compare `git diff-tree --no-commit-id --name-only -r <sha>` with
37
+ `gh pr view <num> --json files --jq '.files[].path'`. The same set ⇒ a squash: a plain
38
+ `git revert`.
39
+ - A different set ⇒ a rebase-merge, with several commits on the default branch. Show
40
+ `git log --oneline -<commits+1> <sha>` and have the human name the range. **Never guess it.**
41
+
42
+ ## 2. A branch off the default branch
43
+
44
+ `git status --porcelain` must be empty, otherwise stop.
45
+ - `isolation.enabled` ⇒ `scripts/new-feature.sh revert-$ARGUMENTS`. It creates its own worktree and
46
+ branch `<feature_branch_prefix>revert-$ARGUMENTS` off `origin/<default_branch>`, plus its own
47
+ database when `isolation.db_per_worktree` is set. Do the rest in that worktree.
48
+ - Otherwise ⇒ `git switch -c revert/$ARGUMENTS origin/<default_branch>`.
49
+
50
+ ## 3. The down migration, on a dev database, before the revert
51
+
52
+ Do this only when `migrations: true`. The down step runs **while the migration files still exist**,
53
+ since the revert deletes them. The step is Rollback's **Migration down** line. Fall back to
54
+ `commands.migrate_down` (or `commands.rollback`) only after the human confirms that this feature's
55
+ migrations are still the newest on the default branch. "Undo the last migration" otherwise undoes
56
+ a later feature's. Run one Bash call with the timeout at 600000 ms:
57
+
58
+ ```
59
+ <core>/pipeline/scripts/verify-run.sh run $ARGUMENTS --phase revert \
60
+ [--migrate "<commands.migrate>"] --migrate-down "<down step>" \
61
+ --db <verify.db, default local> --db-per-worktree <isolation.db_per_worktree, default false> \
62
+ --slots <isolation.registry, default .worktrees/slots.tsv>
63
+ ```
64
+
65
+ Pass `--migrate` when the database is fresh (an isolated worktree's), so that it first reaches the
66
+ default branch's schema. Route on the exit code:
67
+ - **4** ⇒ show the human the gate's list. On yes, re-run with `--confirmed`.
68
+ - **0** ⇒ the down step worked on dev.
69
+ - **1** ⇒ stop and relay `tail -40` of the `migrate-down` log. A down step that fails on dev will
70
+ fail in production, and the human decides what happens next.
71
+ - **3** ⇒ refused or denied: a shared DB, or the step is in `gate.deny`. Carry on, but the PR body
72
+ must say that the down step was **not** exercised.
73
+
74
+ The verdict is in `specs/reports/$ARGUMENTS.revert.json`.
75
+
76
+ ## 4. The revert commit
77
+
78
+ 1. Run `git revert --no-commit [-m 1] <sha>` (or the human's range).
79
+ 2. Keep the spec as history: `git checkout HEAD -- specs/$ARGUMENTS.md`, plus `specs/design/$ARGUMENTS.md`
80
+ if it exists. This also resolves the conflict a later `status: merged` commit causes.
81
+ 3. Any other conflict (`git diff --name-only --diff-filter=U`): a consumed release note is
82
+ `git rm`'d. For everything else, stop, list the files, and leave the tree to the human
83
+ (`git revert --abort` is theirs to run).
84
+ 4. Ask whether the spec becomes `status: abandoned` in this commit. It only says so if the revert
85
+ merges, and it is the human's call (`<core>/pipeline/schema/spec-status.md`).
86
+ 5. `release_notes.enabled` ⇒ write the note yourself per `<core>/pipeline/schema/release-notes.md`,
87
+ describing the removal for the user, and ask the human for the level.
88
+ 6. Commit with `revert: <title> (#<num>)` and the body `This reverts <sha> (PR #<num>).`
89
+
90
+ ## 5. Confirm, push the revert branch, open the PR
91
+
92
+ Show `git show --stat HEAD` and the down-step result, then **ask the human** to confirm the push.
93
+ On yes:
94
+ 1. `git push -u origin <the revert branch>` (never `<default_branch>`, never `--force`).
95
+ 2. `gh pr create --base <default_branch> --head <the revert branch> --title "revert: <title>"`.
96
+ The body has three parts:
97
+ - what is reverted, with a link to the original PR;
98
+ - `## Rollback` verbatim, because these are the steps the operator runs on production
99
+ **before or with** the deploy, in the order it gives;
100
+ - whether the down step was exercised on dev (from `revert.json`).
101
+ 3. No `gh` ⇒ print the compare URL and that body instead.
102
+
103
+ Report the branch, commit SHA, PR URL and down-step verdict. Once the revert PR merges, propose
104
+ `scripts/remove-feature.sh revert-$ARGUMENTS` when a worktree was made.
@@ -6,16 +6,16 @@ argument-hint: <feature_id> | --pr <num>
6
6
 
7
7
  You are the **lead**. Dispatch the review for feature **$ARGUMENTS**.
8
8
 
9
- > Read `PIPELINE.md` §`vcs.default_branch` (diff base) and the `surfaces`/`contract`/`commands` fields.
9
+ > Read `.claude/profile.json` `vcs.default_branch` (diff base) and the `surfaces`/`contract`/`commands` fields (the parsed `pipeline-profile` block; absent ⇒ read that block in `PIPELINE.md`).
10
10
  > _Skip the re-read if it's already in your context this session and unmodified since._
11
11
  >
12
- > **Kanban** (SCHEMA.md §Kanban): run
12
+ > **Kanban** (`<core>/pipeline/schema/kanban.md`): run
13
13
  > `<core>/pipeline/scripts/kanban-move.sh auto $ARGUMENTS review`. `auto` resolves the board from the config itself and
14
14
  > exits 0 with a `kanban: <reason>` line when there is none — so **never decide "no board is
15
15
  > configured" without running it**. _(PR mode — `--pr` below — skips this entirely: an incoming
16
16
  > PR is not a pipeline feature and has no card.)_
17
17
  >
18
- > **Workflow variant** (opt-in — SCHEMA.md §Workflows): on Claude Code ≥ 2.1.154 with workflows
18
+ > **Workflow variant** (opt-in — `<core>/pipeline/schema/workflows.md`): on Claude Code ≥ 2.1.154 with workflows
19
19
  > enabled, the human can ask to "run the review workflow" (`<core>/workflows/review.js`) instead.
20
20
  > This conversational path stays the default and the fallback; `/cohorte-doctor` shows which is available.
21
21
 
@@ -36,9 +36,16 @@ metrics line needs it:
36
36
 
37
37
  ```
38
38
  <core>/pipeline/scripts/preflight.sh specs/reports/$ARGUMENTS.preflight.txt \
39
- "<commands.typecheck>" "<commands.lint_quiet, else lint>" "<commands.test_quiet, else test>"
39
+ "<commands.typecheck>" "<commands.lint_quiet, else lint>" "<commands.test_quiet, else test>" \
40
+ [": cohorte-security-scans" '<commands.security[0]>' '<commands.security[1]>' …]
40
41
  ```
41
42
 
43
+ The bracketed tail is passed only when `commands.security` (a list, or one string) has entries.
44
+ The marker comes first, then each command in order. Drop empty and `<placeholder>` entries. Any
45
+ command containing `$`, a backtick or `\` is **single-quoted** (a `'` inside becomes `'\''`). In
46
+ double quotes this shell would expand the scan's own variables first. Scans are checks like the
47
+ others: a red one aborts below (`<core>/pipeline/schema/preflight.md` §Security scans).
48
+
42
49
  - **Non-zero exit** ⇒ the script already printed the raw last-40 lines. **STOP: relay them verbatim
43
50
  and spawn NO agent** — a compiler/test failure needs `/cohorte-fix` (or the human), not a review that
44
51
  rediscovers it at agent prices. This abort is the whole point of the step. Before stopping, write
@@ -47,15 +54,19 @@ metrics line needs it:
47
54
  `{"id":"$ARGUMENTS","phase":"review","ts":"<ISO>","aborted":"preflight","verdict":"BLOCK","blocking":null}`
48
55
  → `specs/reports/$ARGUMENTS.verdict.json`. One `printf`, in the same Bash call.
49
56
  - **Zero exit** ⇒ it stamped `<state>/preflight.ok`, which the gate hook checks before letting
50
- `cohorte-review` dispatches through (SCHEMA.md §Preflight). Continue.
51
- - Script absent (older core) ⇒ run the three commands yourself, each redirected into
52
- `specs/reports/$ARGUMENTS.preflight.txt`, aborting on the first failure the same way.
57
+ `cohorte-review` dispatches through (`<core>/pipeline/schema/preflight.md`). Continue.
58
+ - Script absent (older core) ⇒ run the same commands yourself (marker and security scans
59
+ included), each appended to `specs/reports/$ARGUMENTS.preflight.txt` after a `$ <cmd>` line,
60
+ aborting on the first failure the same way.
53
61
 
54
62
  ## 1. Gather the inputs for stateless reviewers
55
63
 
56
- - Confirm `specs/$ARGUMENTS.md` exists.
64
+ - Confirm `specs/$ARGUMENTS.md` exists. Front-matter **`kind: refactor`** (written by
65
+ `/cohorte-refactor` at the end of a round) ⇒ no contract: the reviewer checks behaviour
66
+ preservation, conventions and over-engineering against §6's backlog items instead of a contract
67
+ (its own check 1). Everything else below is unchanged.
57
68
  - **Every diff comes from `<core>/pipeline/scripts/feature-diff.sh`, never a bare `git diff`**
58
- (SCHEMA.md §Feature diff): feature work is uncommitted until ship, and `git diff <ref>` drops
69
+ (`<core>/pipeline/schema/feature-diff.md`): feature work is uncommitted until ship, and `git diff <ref>` drops
59
70
  every untracked file and diffs against the branch tip, not the merge-base. Non-zero exit ⇒ **stop
60
71
  and relay it** (exit 3 = base unresolvable); script absent ⇒ stop (`cohorte update`). Never fall
61
72
  back to `git diff`.
@@ -90,19 +101,22 @@ reviewed surface:
90
101
  Keep the dispatch prompt **byte-identical across features and rounds** except the variable block,
91
102
  which sits at the END so every repeat hits the prompt-cache prefix:
92
103
 
93
- > `subagent_type: cohorte-review` — "Review one feature surface against its frozen spec. Read `PIPELINE.md`
94
- > first (flags + the §Conventions/§Testing slice for your scope). Check spec conformance first, then
104
+ > `subagent_type: cohorte-review` — "Review one feature surface against its frozen spec. Read `.claude/profile.json`
105
+ > first (flags), then `PIPELINE.md`'s §Conventions/§Testing slice for your scope. Check spec conformance first, then
95
106
  > correctness, security, conventions, RBAC/mobile-first _if the profile enables them_, and TDD
96
107
  > coverage. Your dispatch names a staged diff file — read it FIRST; open a full source file only when
97
108
  > a finding demands it. Emit the REVIEW REPORT in the capped format your agent instructions define —
98
109
  > every finding self-sufficient (`file:line` · severity · type · one-line concrete fix), no code
99
110
  > excerpts. — Variable slots: feature `$ARGUMENTS` · scope: the `<surface.key>` surface only · spec:
100
- > `specs/$ARGUMENTS.md` (source of truth) · contract: `<contract.path>/$ARGUMENTS.<ext>` · staged
101
- > diff: `specs/reports/$ARGUMENTS.<surface.key>.diff` · changed files: <list>."
111
+ > `specs/$ARGUMENTS.md` (source of truth) · contract: `<contract.path>/$ARGUMENTS.<ext>` (`none` on `kind: refactor`) · staged
112
+ > diff: `specs/reports/$ARGUMENTS.<surface.key>.diff` · changed files: <list>[ · preflight report:
113
+ > `specs/reports/$ARGUMENTS.preflight.txt` (security section from the line `$ : cohorte-security-scans`)]."
114
+
115
+ The bracketed preflight-report slot is added only when `commands.security` has entries.
102
116
 
103
117
  ## 3. Merge & relay the verdict
104
118
 
105
- **Roll call FIRST — a dead reviewer is not a clean surface** (SCHEMA.md §Dead agents: its zero
119
+ **Roll call FIRST — a dead reviewer is not a clean surface** (`<core>/pipeline/schema/dead-agents.md`: its zero
106
120
  findings are byte-identical to a clean surface's). Every surface dispatched in §2 must come back
107
121
  with a REVIEW REPORT:
108
122
 
@@ -211,9 +225,10 @@ surviving severity** — exactly one row applies:
211
225
  - **Tick the DoD**: in `specs/$ARGUMENTS.md` §`Acceptance criteria / DoD`, flip `- [ ]` → `- [x]`
212
226
  for the criteria the pipeline actually verified — spec conformance + `ui_language` copy (this
213
227
  review), tests · lint · typecheck (a green `/cohorte-build`), mobile-first as far as the code
214
- shows it. **Leave `- [ ]` (and say which) any item no stage verified** — nothing in the pipeline
215
- *runs* the feature, so a criterion that needs the app up stays open unless the human says they
216
- exercised it by hand. Ticking is the lead's job (the reviewer is read-only).
228
+ shows it. On `kind: refactor`: behaviour preserved + items cleared (this review), tests · lint ·
229
+ typecheck green (§0's preflight — no `/cohorte-build` ran). **Leave `- [ ]` (and say which) any item no stage verified** — review never *runs* the
230
+ feature: a criterion tagged `· runtime` stays open for `/cohorte-verify` (which ticks it on a
231
+ passing check) or for the human who exercised it by hand. Ticking is the lead's job (the reviewer is read-only).
217
232
  - **Stamp the freshness gate** so `/cohorte-ship` can refuse code edited after this verdict:
218
233
  `BASE=$(<core>/pipeline/scripts/feature-diff.sh --default <default_branch> --base-only)`, then
219
234
  write into the spec front-matter `reviewed_base: $BASE` and
@@ -6,11 +6,11 @@ argument-hint: <feature_id>
6
6
 
7
7
  You are the **lead**. Ship feature **$ARGUMENTS**. This is the outward-facing gate.
8
8
 
9
- > Read `PIPELINE.md` §`vcs` (host, remote, default_branch, feature_branch_prefix) **and
9
+ > Read `.claude/profile.json` `vcs` (host, remote, default_branch, feature_branch_prefix) (the parsed `pipeline-profile` block; absent ⇒ read that block in `PIPELINE.md`) **and
10
10
  > §`release_notes`** — §2b below is skipped or required based on it, and skipping it when it is
11
11
  > required opens a PR that CI fails on arrival.
12
12
  >
13
- > **Kanban** (SCHEMA.md §Kanban) is mirrored in **explicit steps** below, not as an afterthought:
13
+ > **Kanban** (`<core>/pipeline/schema/kanban.md`) is mirrored in **explicit steps** below, not as an afterthought:
14
14
  > §1 moves the card → **Ship**; §4 moves it → **Shipped** and writes the PR number. Both are one
15
15
  > call to `<core>/pipeline/scripts/kanban-move.sh auto …`, which resolves the board from the config itself and exits 0 with a
16
16
  > `kanban: <reason>` line when there is none. **Never decide "no board is configured" without running
@@ -22,7 +22,7 @@ You are the **lead**. Ship feature **$ARGUMENTS**. This is the outward-facing ga
22
22
  `grep '^status:' specs/$ARGUMENTS.md` first. `shipped` means a PR is (or was) open — reconcile it
23
23
  instead of shipping twice: `gh pr view <the branch §1 resolves> --json state,mergedAt,url` (no `gh` /
24
24
  not github ⇒ ask the human what happened to the PR):
25
- - `MERGED` ⇒ set `status: merged` (SCHEMA.md §Spec status) and say so; go straight to §5's teardown.
25
+ - `MERGED` ⇒ set `status: merged` (`<core>/pipeline/schema/spec-status.md`) and say so; go straight to §5's teardown.
26
26
  - `OPEN` ⇒ nothing to ship again: go to §5's CI watch (a red check routes per §5).
27
27
  - `CLOSED` (not merged) ⇒ ask the human: reopen and continue (`/cohorte-fix` on what killed it), or
28
28
  drop it — then set `status: abandoned`. Never decide that alone.
@@ -57,7 +57,19 @@ not github ⇒ ask the human what happened to the PR):
57
57
  after review — the verdict is **stale**: stop and tell the human to re-run
58
58
  `/cohorte-review $ARGUMENTS`. A stamp written before `feature-diff.sh` existed was computed without
59
59
  untracked files and will mismatch once — the re-review re-stamps it.
60
- - **DoD gate (verify, don't tick — `/cohorte-review` owns the ticking).** Read `specs/$ARGUMENTS.md`
60
+ - **Migrations need a way back.** `<core>/pipeline/scripts/verify-run.sh rollback-check specs/$ARGUMENTS.md`
61
+ — exit 1 (`migrations: true` with an empty `## Rollback`) ⇒ **refuse**: back to `/cohorte-spec` to
62
+ fill it. No human override: a migration nobody can undo is decided before ship, not at it.
63
+ - **Runtime gate** (`<core>/pipeline/schema/verify.md` §Ship). Not configured — `verify.enabled: false`, or
64
+ none of `commands.smoke`/`commands.e2e`/`commands.dev`+`commands.dev_ready` (and no `migrations: true`
65
+ with a `commands.migrate`) ⇒ skip silently. Otherwise read `specs/reports/$ARGUMENTS.verify.json`:
66
+ - `verdict` `FAIL` ⇒ **refuse**, stale or not, naming the failing checks: `/cohorte-fix`, then
67
+ `/cohorte-review` and `/cohorte-verify` again. Only a newer run clears it.
68
+ - `PASS` and its `digest` equals the spec's `reviewed_digest` ⇒ proceed silently.
69
+ - Absent, `SKIPPED`, or a `PASS` whose `digest` differs ⇒ ask: **"not verified at runtime — ship
70
+ anyway?"** (say which case, and that `/cohorte-verify $ARGUMENTS` would settle it). Ship only on yes.
71
+ - **DoD gate (verify, don't tick — `/cohorte-review` owns the ticking, `/cohorte-verify` the
72
+ `· runtime` items).** Read `specs/$ARGUMENTS.md`
61
73
  §`Acceptance criteria / DoD`; if any item is still `- [ ]`, list the open ones and ask the human to
62
74
  confirm shipping anyway (they may be deferred on purpose — e.g. a UI item on a backend-only feature).
63
75
  All `- [x]` ⇒ proceed silently.
@@ -82,7 +94,7 @@ uncommitted after the PR opens). Only flip after the human's "yes"; if they decl
82
94
 
83
95
  Otherwise **you** write it — never the release agent, never the implementers. Picking the bump is
84
96
  project policy and the prose is outward-facing copy; both are the lead's, exactly like the contract.
85
- See SCHEMA.md §Release notes.
97
+ See `<core>/pipeline/schema/release-notes.md`.
86
98
 
87
99
  - Write `<release_notes.dir>/<release_notes.filename>` (`<feature_id>` substituted), front-matter
88
100
  carrying the **single** key `release_notes.anchor_package` and the chosen level, then the prose body
@@ -110,7 +122,7 @@ See SCHEMA.md §Release notes.
110
122
 
111
123
  Spawn one agent (`subagent_type: cohorte-release`):
112
124
  "Release feature `$ARGUMENTS` on branch
113
- `<the branch §1 resolved>`. Read `PIPELINE.md` §vcs first. Spec: `specs/$ARGUMENTS.md` (already
125
+ `<the branch §1 resolved>`. Read `.claude/profile.json` `vcs` first. Spec: `specs/$ARGUMENTS.md` (already
114
126
  `status: shipped` — stage it). Write conventional commit(s), push (no force), open the PR (use `gh` if
115
127
  `host: github` + available; else emit the compare URL + drafted PR body from `<core>/templates/pr-body.md`).
116
128
  Stage **all** the feature's changes including `specs/$ARGUMENTS.md` and, if `release_notes.enabled`, the
@@ -145,11 +157,16 @@ under the `shipped` heading — never re-read the whole board into context.
145
157
  **except** a red `release_notes.ci_job`: that one is this command's own miss, not a code finding —
146
158
  write the note per §2b, commit, push, and re-watch. Never send a missing release note through `/cohorte-fix`.
147
159
  - Once the PR is **merged** (the human says so, or §0's `gh pr view` shows `MERGED`): set the spec's
148
- `status: merged` and commit that one line on the default branch when the human next commits there
160
+ `status: merged` (and `pr: <num>` — `/cohorte-revert` finds the merge commit from it) and commit that one line on the default branch when the human next commits there
149
161
  (or leave it to `/cohorte-doctor`'s reconcile — it does the same check). If `isolation.enabled`, propose the teardown —
150
162
  `scripts/remove-feature.sh $ARGUMENTS` (add `--drop-db` to also drop the feature db; kept by
151
163
  default). It removes the worktree, deletes the merged branch, frees the slot. Never run it before
152
164
  the merge is confirmed, and only with the human's go-ahead (the gate will ask anyway).
165
+ - **Clear the report buffer** once the merge is confirmed (never before — `/cohorte-fix` and a
166
+ re-review read it): in the main checkout, one Bash call —
167
+ `rm -f specs/reports/$ARGUMENTS.verify/* 2>/dev/null; rmdir specs/reports/$ARGUMENTS.verify 2>/dev/null; rm -f specs/reports/$ARGUMENTS.* specs/reports/$ARGUMENTS-brainstorm.md`
168
+ (plain `rm -f` + `rmdir`, never `rm -rf`, which many profiles' gate denies).
169
+ These are gitignored, derived files: the spec, its `## Remediation` history and the merged code keep
170
+ everything worth keeping. Say how many files went.
153
171
  - Feature closed — **recommend a `/clear`** before starting the next one; nothing from this session
154
- is needed again (spec `merged`, board updated). `specs/reports/$ARGUMENTS.*` is a gitignored
155
- buffer and can be deleted now.
172
+ is needed again (spec `merged`, board updated, buffer cleared).