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
@@ -7,14 +7,14 @@ You run the **spec** step in the main thread — interactive, with the human. Pa
7
7
 
8
8
  **$ARGUMENTS**
9
9
 
10
- > Read `PIPELINE.md` first: `contract` (mechanism/path — so §5 names the right schema types),
11
- > `design.enabled` (whether §8 matters), and §Conventions. Use `specs/_template.md` as the section list.
10
+ > Read `.claude/profile.json` first (the parsed `pipeline-profile` block; absent ⇒ read that block in `PIPELINE.md`): `contract` (mechanism/path — so §5 names the right schema types),
11
+ > `design.enabled` (whether §8 matters); then `PIPELINE.md` §Conventions. Use `specs/_template.md` as the section list.
12
12
  >
13
- > **Decision journal** (SCHEMA.md §Decisions): read `specs/_decisions.md` §Live if it exists — one
13
+ > **Decision journal** (`<core>/pipeline/schema/decisions.md`): read `specs/_decisions.md` §Live if it exists — one
14
14
  > line per standing decision, so it is cheap. It is the ONLY place the project's transverse rules
15
15
  > live; a spec that contradicts one silently un-decides it. Absent ⇒ nothing to honour yet.
16
16
  >
17
- > **Kanban** (SCHEMA.md §Kanban): when the spec opens, run
17
+ > **Kanban** (`<core>/pipeline/schema/kanban.md`): when the spec opens, run
18
18
  > `<core>/pipeline/scripts/kanban-move.sh auto <feature_id> spec --title "<human title>"`; on freeze
19
19
  > (`status: frozen`, Mode A), the same call with `ready`. `auto` resolves the board from the config itself and exits 0 with a
20
20
  > `kanban: <reason>` line when there is none — so **never decide "no board is configured" without
@@ -53,6 +53,15 @@ Detect the mode from the pasted content:
53
53
  owns (a new service/app/top-level module), note it in the spec (a line in the relevant task section:
54
54
  `> needs new surface: <proposed key/path>`). Don't render agents here — `/cohorte-build` §1.5 auto-reconciles
55
55
  it. This is just so the human isn't surprised when `/cohorte-build` proposes a new agent.
56
+ 4c. **Migrations → a way back.** If §4 adds or alters a migration (or the contract changes what is
57
+ persisted), set `migrations: true` in the front-matter and fill `## Rollback` with the human —
58
+ what to revert, what data is lost or irreversible, the exact down step on the dev DB
59
+ (`commands.migrate_down` when it fits). `<core>/pipeline/schema/verify.md` §Migrations. Before the
60
+ freeze, `<core>/pipeline/scripts/verify-run.sh rollback-check specs/<id>.md` must exit 0 —
61
+ `/cohorte-ship` refuses the spec otherwise. Tag DoD lines only a running app can prove
62
+ `· runtime: <check>` (see the template's §9 note), and drop the template's runtime lines that
63
+ do not apply: `rollback` without `migrations: true`, and `e2e` when the profile has no
64
+ `commands.e2e` (retag it `smoke`, or bare `· runtime` for a human check).
56
65
  5. When the human validates, **freeze**: write `specs/<id>.md` (`status: frozen`, front-matter filled).
57
66
  Create the file — do not ask the human to. **Postcondition:** `grep -q '^status: frozen' specs/<id>.md`
58
67
  — if it fails the freeze didn't land; fix it before pointing the human at `/cohorte-build`.
@@ -29,8 +29,9 @@ nothing if `~/.claude/settings.json` is not valid JSON: show the error and stop.
29
29
  ## 2b. Re-wire this repo — run `<sync>`
30
30
 
31
31
  Always, from the repo root (one Bash call), and show its output. It refreshes the committed gate
32
- (`.claude/hooks/cohorte-gate.py`) and its registration, bumps the `<state>/pipeline.json` pointer, and
33
- keeps the `.gitignore` entries. On a **2.x repo** it also removes the vendored core (`.claude/pipeline/`,
32
+ (`.claude/hooks/cohorte-gate.py`) and its registration, bumps the `<state>/pipeline.json` pointer,
33
+ writes `<state>/profile.json` from the current `PIPELINE.md`, and keeps the `.gitignore` entries.
34
+ On a **2.x repo** it also removes the vendored core (`.claude/pipeline/`,
34
35
  `.claude/templates/`, `.claude/workflows/`, `.claude/commands/cohorte-*.md`, `.claude/agents/{review,release,profile-reader}.md`,
35
36
  `.claude/hooks/gate.py`): files git tracks unmodified are deleted (git keeps them), anything else is moved
36
37
  to `.claude/cohorte-legacy-backup/`. Tell the human to commit the result.
@@ -51,10 +52,10 @@ skip silently.
51
52
  ## 3.5 Reconcile this repo's generated files
52
53
 
53
54
  Only when the current repo has a `PIPELINE.md`: run the **Reconcile procedure** from the installed
54
- `pipeline/SCHEMA.md` §Reconcile — top up the profile's machine block with new fields at their defaults
55
+ `<core>/pipeline/schema/reconcile.md` — top up the profile's machine block with new fields at their defaults
55
56
  (one batched question set for any genuinely new human decision — e.g. choosing a `retrieval` provider,
56
57
  or the **quiet command variants**: `test_quiet_cmd`/`lint_quiet_cmd` + `commands.test_quiet`/
57
- `lint_quiet`, proposing the detected bridled forms per §Output discipline; `gate.preflight` tops up
58
+ `lint_quiet`, proposing the detected bridled forms per `<core>/pipeline/schema/output-discipline.md`; `gate.preflight` tops up
58
59
  silently at its defaults), re-render the surface agents from the current `implementer.template.md`
59
60
  (this refreshes each agent's **baked §Conventions slice** — required after any hand-edit of the
60
61
  profile's prose).
@@ -63,10 +64,12 @@ block and the workflow-agent `allow` entries from init step 5) — never the gat
63
64
  owns those — and run any newly-added capability's wiring (e.g. Serena's project-scope `claude mcp add`).
64
65
  Verify the refreshed core actually carries `<workflows>/cohorte-review.js` + `<fixed-agents>/cohorte-profile-reader.md`
65
66
  — missing means the update half-ran: re-run `cohorte update`. Even when no capability is new, **re-run the retrieval provider's
66
- health check** (SCHEMA.md §Code retrieval: CLI resolvable from PATH, `.mcp.json` entry present —
67
+ health check** (`<core>/pipeline/schema/retrieval.md`: CLI resolvable from PATH, `.mcp.json` entry present —
67
68
  upgrading a bare `serena` entry to the PATH-proof launcher form, `.serena/` gitignored, server
68
69
  actually connected) and repair whatever fails — wiring that worked at
69
- init can rot (PATH changes, uninstalls, hand-edits). Report what was reconciled; if nothing was
70
+ init can rot (PATH changes, uninstalls, hand-edits). **Then run `<sync>` once more** — §2b ran it
71
+ before the top-up, so `<state>/profile.json` (the parsed machine block the agents read) still
72
+ describes the old profile; this second run regenerates it. Report what was reconciled; if nothing was
70
73
  missing, say so. This is why `/cohorte-init-pipeline` never needs re-running for a core upgrade.
71
74
 
72
75
  Four of the §Reconcile steps matter specifically here:
@@ -91,7 +94,7 @@ Four of the §Reconcile steps matter specifically here:
91
94
  - **Kanban sync** (§Reconcile step 6): resolve this project's board with
92
95
  `<core>/pipeline/scripts/kanban-move.sh --check` — it prints either the board path or the exact
93
96
  missing link. **Not linked** → offer to link/create a board (confirm the vault + `<folder>/Tasks.md`,
94
- write the `boards` entry, create the board file per §Kanban). **Linked** → verify the board file
97
+ write the `boards` entry, create the board file per `<core>/pipeline/schema/kanban.md`). **Linked** → verify the board file
95
98
  exists (recreate if the human confirms) and its columns match `kanban.columns` (repair drift). Either
96
99
  way, run the §Kanban **full sync/backfill** from `specs/*.md` — one
97
100
  `kanban-move.sh auto <id> <stage>` per spec, `<stage>` from the status mapping — this is what adds
@@ -109,7 +112,8 @@ Four of the §Reconcile steps matter specifically here:
109
112
  newly-registered MCP server.
110
113
  - **Other repos using the global core:** their core is already fresh, but reconcile is per-repo — run
111
114
  `/cohorte-update-pipeline` inside each (it will skip the already-done core update and just reconcile).
112
- - **Commit** the reconciled files (`PIPELINE.md`, `.claude/`, `.mcp.json` if added) so teammates get them.
115
+ - **Commit** the reconciled files (`PIPELINE.md`, `.claude/` — including `.claude/profile.json` —,
116
+ `.mcp.json` if added) so teammates get them.
113
117
  - The kanban config is global and user-scoped
114
118
  (`<config>`) — never committed. The core update never touches it; only the
115
119
  reconcile above seeds the file and writes kanban board links (into that global file, not the repo).
@@ -0,0 +1,106 @@
1
+ ---
2
+ model: sonnet
3
+ description: Run the app between review and ship (migrations, dev server, smoke/e2e, screenshots) and tick only the runtime DoD items it has evidence for.
4
+ argument-hint: <feature_id>
5
+ ---
6
+
7
+ You are the **lead**. Verify feature **$ARGUMENTS** at runtime, which is the step that actually
8
+ runs the app. Rules: `<core>/pipeline/schema/verify.md`. Read it before §2's call if it is not in
9
+ your context already.
10
+
11
+ > **No kanban move.** The board has no verify column and the card stays in Review. This command
12
+ > calls no `kanban-move.sh` on purpose.
13
+ >
14
+ > **The script does the process work.** Everything below goes through
15
+ > `<core>/pipeline/scripts/verify-run.sh`:
16
+ > - Never start, probe or kill a server yourself, and never run a migration outside it.
17
+ > - Never touch git (no checkout, commit, push or merge).
18
+ > - Never point an `.env` at another database.
19
+ > - A server left behind is stopped with `verify-run.sh stop $ARGUMENTS`, not with `kill`.
20
+
21
+ ## 0. Configured?
22
+
23
+ Read `<state>/profile.json` (fall back to `PIPELINE.md`'s `yaml pipeline-profile` block). Verify
24
+ applies only when both hold:
25
+ - `verify.enabled` is not `false`;
26
+ - the profile has `commands.smoke`, `commands.e2e`, or `commands.dev` **with** `commands.dev_ready`,
27
+ or the spec has `migrations: true` and the profile has a `commands.migrate`.
28
+
29
+ Otherwise say "no runtime commands in the profile, so there is nothing to verify (and `/cohorte-ship`
30
+ will not ask)" and stop.
31
+
32
+ ## 1. Inputs
33
+
34
+ - `specs/$ARGUMENTS.md` must exist. `status: merged` or `abandoned` ⇒ stop (a merged feature is
35
+ undone with `/cohorte-revert`, not re-verified). Any other status is fine. Verify normally follows
36
+ a `SHIP` verdict, but nothing forbids an earlier run.
37
+ - From the front-matter, take `migrations` (absent means `false`) and `reviewed_base`.
38
+ - `reviewed_base` present ⇒ pass it as `--digest-base`; `/cohorte-ship` compares that digest
39
+ with `reviewed_digest`.
40
+ - Absent ⇒ omit `--digest-base`, and say that ship will treat this run as unanchored.
41
+ - Touched surfaces: `<core>/pipeline/scripts/feature-diff.sh --default <default_branch> --name-only`,
42
+ grouped by `surfaces[].path`. Only their `verify.surfaces.<key>` hints are used.
43
+ - **In a feature worktree** (`git rev-parse --git-dir` ≠ `--git-common-dir`) with
44
+ `isolation.enabled`, substitute the slot's ports into every URL, as described in
45
+ `<core>/pipeline/schema/verify.md` §Ports.
46
+
47
+ ## 2. One call
48
+
49
+ Build it from the profile and leave out each bracketed part whose input is `""` or absent. Run it
50
+ in one Bash call with the **timeout at 600000 ms**:
51
+
52
+ ```
53
+ <core>/pipeline/scripts/verify-run.sh run $ARGUMENTS --digest-base <reviewed_base> \
54
+ [--migrate "<commands.migrate>" [--migrate-down "<commands.migrate_down, else commands.rollback>"] \
55
+ --db <verify.db, default local> --db-per-worktree <isolation.db_per_worktree, default false> \
56
+ --slots <isolation.registry, default .worktrees/slots.tsv>] \
57
+ [--dev "<commands.dev>" --ready "<commands.dev_ready>"] \
58
+ [--check "smoke=<commands.smoke>"] [--check "smoke:<key>=<verify.surfaces.<key>.smoke>"]… \
59
+ [--check "e2e=<commands.e2e>"] \
60
+ [--screenshot "<key><path>=<base_url><path>"]… \
61
+ [--skip "rollback=no commands.migrate_down in the profile"] \
62
+ --ready-timeout <verify.ready_timeout_seconds, 90> --check-timeout <verify.check_timeout_seconds, 600>
63
+ ```
64
+
65
+ - The `--migrate…` group goes in **only** when the spec says `migrations: true`. Add `--skip
66
+ "rollback=…"` when it does but the profile has no down command.
67
+ - `--screenshot` is left out when `verify.screenshots: off`. Use one per `verify.surfaces.<key>.paths`
68
+ entry of a touched surface. The `base_url` defaults to `dev_ready`'s origin.
69
+ - `--dev` without `--ready` is a usage error by design.
70
+
71
+ Route on the exit code:
72
+ - **4**: the gate would ask. The script printed the commands and started nothing. Show the human
73
+ that list and ask once. On yes, re-run the identical call plus `--confirmed`. On no, stop.
74
+ - **2**: usage. Fix the call. Never improvise the steps by hand.
75
+ - **0 / 1 / 3** (PASS / FAIL / SKIPPED): read `specs/reports/$ARGUMENTS.verify.json`. Keep only
76
+ `verdict`, `reason` and each check's `name · status · note` in context. On a FAIL, `tail -40` the
77
+ failing check's `log` and nothing else.
78
+
79
+ ## 3. Tick the runtime DoD items it proved
80
+
81
+ Go through the spec's `## 9. Acceptance criteria / DoD`, handling only the `- [ ]` lines that carry
82
+ `· runtime`:
83
+ - A line with `· runtime: <check>` ⇒ tick it (`- [x]`) **only** if verify.json has at least one
84
+ check named `<check>` or `<check>:…`, and all of them are `PASS`. Leave everything else alone. A
85
+ `SKIPPED` check proves nothing.
86
+ - A bare `· runtime` is never ticked. It needs a human eye.
87
+ - Never tick an untagged line, never untick a line, and edit nothing else in the spec.
88
+
89
+ Append to `specs/reports/$ARGUMENTS.verify.md`, under `## DoD`, one line per runtime item:
90
+ - a ticked item: `- [x] <item> — evidence: <log path>`;
91
+ - an open item: `- [ ] <item> — needs a human eye (evidence: <screenshot paths, or none>)`.
92
+
93
+ ## 4. Report
94
+
95
+ One line for the verdict and one per check (`<name> · <status> · <note>`), then the items you
96
+ ticked. Then route:
97
+ - **PASS** ⇒ `/cohorte-ship $ARGUMENTS`. Name any bare `· runtime` items the human should look at
98
+ first, with their screenshot paths.
99
+ - **FAIL** ⇒ a runtime finding. Have the human run `/cohorte-fix $ARGUMENTS` with the failing
100
+ check's line and log path pasted. After the fix, `/cohorte-review` and then `/cohorte-verify`
101
+ again (the code changed, so both verdicts are stale). `/cohorte-ship` blocks until a newer run
102
+ passes.
103
+ - **SKIPPED** ⇒ say why (the `reason`, or the gate-denied checks). `/cohorte-ship` will ask the
104
+ human whether to ship unverified.
105
+
106
+ **Recommend a `/clear`.** The verdict, logs and ticks are all on disk.