@cloverleaf/reference-impl 0.12.0 → 0.13.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.
@@ -68,6 +68,8 @@ Each sub-skill runs from `main`. Between steps, confirm branch is `main` before
68
68
  cloverleaf-cli advance-rfc <repo_root> $RFC_ID gate-pending agent rfc_strategy_gate
69
69
  ```
70
70
 
71
+ **Advisory council (opt-in).** Run `cloverleaf-cli council-plan <repo_root> $RFC_ID rfc.strategy_gate`. If `plan.source === "consumer"` and `plan.profile !== null`, dispatch `plan.rounds` (each member reviews the RFC per its custom-role prompt), reach a verdict, then `cloverleaf-cli apply-council-verdict <repo_root> $RFC_ID rfc.strategy_gate '<verdict>'`. This **posts** the advisory verdict + a feedback envelope and drives NO transition (the RFC stays at `gate-pending`). Surface the verdict + rationale to the human below. The human still decides approve/reject/revise — the council never auto-approves. A repo with no such binding sees `plan.profile === null` → the pre-step is skipped and today's behavior is unchanged.
72
+
71
73
  Prompt human (blocking readline):
72
74
  ```
73
75
  RFC $RFC_ID at rfc_strategy_gate: approve / reject / revise [reason]? > _
@@ -80,7 +82,11 @@ Each sub-skill runs from `main`. Between steps, confirm branch is `main` before
80
82
 
81
83
  7. **Plan breakdown** — invoke `/cloverleaf-breakdown $RFC_ID`. Per-invocation bounce budget (3 bounces inside breakdown). Capture `$PLAN_ID`. On bounce exhaustion: dump state and halt.
82
84
 
83
- 8. **Gate: task_batch_gate** — Plan is already in `gate-pending` (set by breakdown). Prompt:
85
+ 8. **Gate: task_batch_gate** — Plan is already in `gate-pending` (set by breakdown).
86
+
87
+ **Advisory council (opt-in).** Run `cloverleaf-cli council-plan <repo_root> $PLAN_ID plan.task_batch`. If `plan.source === "consumer"` and `plan.profile !== null`, dispatch `plan.rounds` (each member reviews the Plan per its custom-role prompt), reach a verdict, then `cloverleaf-cli apply-council-verdict <repo_root> $PLAN_ID plan.task_batch '<verdict>'`. This **posts** the advisory verdict + a feedback envelope and drives NO transition (the Plan stays at `gate-pending`). Surface the verdict + rationale to the human below. The human still decides approve/reject — the council never auto-approves. A repo with no such binding sees `plan.profile === null` → the pre-step is skipped and today's behavior is unchanged.
88
+
89
+ Prompt:
84
90
  ```
85
91
  PLN $PLAN_ID at task_batch_gate: approve / reject [reason]? > _
86
92
  ```
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: cloverleaf-document
3
- description: Run the Documenter agent on a task in the `implementing` state (full pipeline only). Dispatches a subagent to add doc-only commits to the feature branch, then advances implementing → documenting review. Usage — /cloverleaf-document <TASK-ID>.
3
+ description: Run the Documenter agent on a task in the `implementing` state (high-risk delivery only). Dispatches a subagent to add doc-only commits to the feature branch, then advances implementing → documenting (stops at documenting). Usage — /cloverleaf-document <TASK-ID>.
4
4
  ---
5
5
 
6
6
  # Cloverleaf — document
@@ -49,23 +49,22 @@ description: Run the Documenter agent on a task in the `implementing` state (ful
49
49
 
50
50
  7. On failure to parse or response with invalid shape: report the response and stop without advancing state.
51
51
 
52
- 8. Advance state:
52
+ 8. Advance state (stop at `documenting` — the delivery council owns `documenting → council`):
53
53
  ```
54
54
  cloverleaf-cli advance-status <repo_root> <TASK-ID> documenting agent
55
- cloverleaf-cli advance-status <repo_root> <TASK-ID> review agent
56
55
  ```
57
56
 
58
57
  9. Commit state changes:
59
58
  ```bash
60
59
  cd <repo_root>
61
60
  git add .cloverleaf/
62
- git commit -m "cloverleaf: <TASK-ID> documented → review"
61
+ git commit -m "cloverleaf: <TASK-ID> documented → documenting"
63
62
  ```
64
63
 
65
64
  10. Report:
66
- - "✓ Documenter done. `<commits_added>` doc commit(s) added. State → review."
65
+ - "✓ Documenter done. `<commits_added>` doc commit(s) added. State → documenting."
67
66
  - "Files changed: `<comma-separated files_changed>`."
68
- - "Next: `/cloverleaf-review <TASK-ID>`."
67
+ - "Next: the delivery council (`/cloverleaf-run <TASK-ID>` advances `documenting → council`)."
69
68
 
70
69
  ## Rules
71
70
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: cloverleaf-implement
3
- description: Run the Implementer agent on a task. Dispatches a subagent to produce code + tests on a new branch, then advances state pending → tactical-plan → implementing documenting review. Usage — /cloverleaf-implement <TASK-ID>.
3
+ description: Run the Implementer agent on a task. Dispatches a subagent to produce code + tests on a new branch, then advances state pending → tactical-plan → implementing (stops at implementing for every risk_class). Usage — /cloverleaf-implement <TASK-ID>.
4
4
  ---
5
5
 
6
6
  # Cloverleaf — implement
@@ -15,7 +15,7 @@ The user has invoked this skill with a TASK-ID (e.g., `DEMO-001`).
15
15
  ```
16
16
  cloverleaf-cli load-task <repo_root> <TASK-ID>
17
17
  ```
18
- Parse the JSON. Verify `status === "pending"` OR `status === "implementing"` (the second case is a re-run after a Reviewer bounce). If neither, report the current status and ask the user to use the correct command for that state.
18
+ Parse the JSON. Verify `status === "pending"` OR `status === "implementing"` (the second case is a re-run after a delivery-council bounce). If neither, report the current status and ask the user to use the correct command for that state.
19
19
 
20
20
  3. Load any outstanding feedback:
21
21
  ```
@@ -58,50 +58,44 @@ The user has invoked this skill with a TASK-ID (e.g., `DEMO-001`).
58
58
 
59
59
  If this fails (uncommitted changes on main, detached HEAD, etc.), report the error and stop without advancing state.
60
60
 
61
- 8. Walk the state machine. Read `task.risk_class` (already captured at step 2).
61
+ 8. Walk the state machine. The walk is the **same for every `risk_class`** the collapsed
62
+ council FSM has a single delivery spine (`pending → tactical-plan → implementing → …`),
63
+ so the Implementer always ends at `implementing`. `risk_class` still selects the
64
+ downstream council profile (delivery-fast / delivery-full); it no longer branches the walk.
62
65
 
63
- **If `risk_class === "low"` (fast lane v0.1.1 behavior):**
66
+ The walk still issues **tactical-plan** and **implement** as two distinct `advance-status`
67
+ calls (below), but both run in this one dispatch with no pause between them — this skill
68
+ does **not** stop at `tactical-plan`. A decisive `task.plan_review` checkpoint between them
69
+ is **not currently wired**: see `/cloverleaf-run` §3a/§3b, which document the limitation and
70
+ do not attempt to bind one against the shipped default.
64
71
 
65
72
  If the current task status is `pending`:
66
73
  ```
67
- cloverleaf-cli advance-status <repo_root> <TASK-ID> tactical-plan agent
68
- cloverleaf-cli advance-status <repo_root> <TASK-ID> implementing agent
69
- cloverleaf-cli advance-status <repo_root> <TASK-ID> documenting agent
70
- cloverleaf-cli advance-status <repo_root> <TASK-ID> review agent
74
+ cloverleaf-cli advance-status <repo_root> <TASK-ID> tactical-plan agent # produce the tactical plan
75
+ cloverleaf-cli advance-status <repo_root> <TASK-ID> implementing agent # implement; STOP here
71
76
  ```
77
+ Stop at `implementing`. The Documenter (high-risk) or the runner (low-risk) advances
78
+ `implementing → documenting` next; the delivery council then owns `documenting → council`.
72
79
 
73
- If the current task status was `implementing` (loop-back after bounce):
74
- ```
75
- cloverleaf-cli advance-status <repo_root> <TASK-ID> documenting agent
76
- cloverleaf-cli advance-status <repo_root> <TASK-ID> review agent
77
- ```
78
-
79
- **If `risk_class === "high"` (full pipeline — new in v0.2):**
80
-
81
- If the current task status is `pending`:
82
- ```
83
- cloverleaf-cli advance-status <repo_root> <TASK-ID> tactical-plan agent
84
- cloverleaf-cli advance-status <repo_root> <TASK-ID> implementing agent
85
- ```
86
- Stop here. Documenter runs next (will advance implementing → documenting → review).
87
-
88
- If the current task status was `implementing` (loop-back after Reviewer/UI/QA bounce):
89
- No state advance — the bouncing skill already moved state back to `implementing`.
80
+ If the current task status was `implementing` (loop-back after a council bounce):
81
+ No state advance — re-implement in place. The council already moved state back to
82
+ `implementing`, and the batched feedback is in `.cloverleaf/feedback/`. The task stays
83
+ at `implementing` after this re-run.
90
84
 
91
85
  9. Commit the state changes:
92
86
  ```
93
87
  cd <repo_root>
94
88
  git add .cloverleaf/
95
- git commit -m "cloverleaf: <TASK-ID> → <new-state>"
89
+ git commit -m "cloverleaf: <TASK-ID> → implementing"
96
90
  ```
97
- where `<new-state>` is `review` for fast lane (`risk_class === "low"`) or `implementing` for full pipeline (`risk_class === "high"`).
91
+ (On a loop-back re-run there may be nothing staged that is expected; skip the commit
92
+ if `git diff --cached --quiet`.)
98
93
 
99
94
  10. Report:
100
- - "✓ Implementer done. Branch `<branch>`. State → <new-state>."
95
+ - "✓ Implementer done. Branch `<branch>`. State → implementing."
101
96
  - "Files changed: <comma-separated>."
102
97
  - "Currently on: `main`."
103
- - **If `risk_class === "low"`:** "Next: `/cloverleaf-review <TASK-ID>`."
104
- - **If `risk_class === "high"`:** "Next: `/cloverleaf-document <TASK-ID>`."
98
+ - "Next: `/cloverleaf-document <TASK-ID>` (high-risk docs) — for low-risk the runner advances `implementing → documenting`; the delivery council then runs."
105
99
 
106
100
  ## Rules
107
101
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: cloverleaf-merge
3
- description: Human gate for merging a Cloverleaf task. Branches on state from `automated-gates` (fast lane) via `human_merge`, or from `final-gate` (full pipeline) via `final_approval_gate`. For full-pipeline tasks, performs a real `git merge --no-ff` of the feature branch into main before advancing state. Requires explicit user confirmation. Usage — /cloverleaf-merge <TASK-ID>.
3
+ description: Human gate for merging a Cloverleaf task. Every task merges at `final-gate` via `final_approval_gate`. Performs a real `git merge --no-ff` of the feature branch into main before advancing state. Requires explicit user confirmation. Usage — /cloverleaf-merge <TASK-ID>.
4
4
  ---
5
5
 
6
6
  # Cloverleaf — merge
@@ -19,23 +19,14 @@ description: Human gate for merging a Cloverleaf task. Branches on state — fro
19
19
 
20
20
  2. Load the task: `cloverleaf-cli load-task <repo_root> <TASK-ID>`. Let `S` = `task.status`.
21
21
 
22
- - If `S === "automated-gates"`: this is a fast-lane merge. Proceed with section 3A.
23
- - If `S === "final-gate"`: this is a full-pipeline merge. Proceed with section 3B.
22
+ - If `S === "final-gate"`: proceed with section 3.
24
23
  - Else: report the current status and stop.
25
24
 
26
- ### 3A. Fast-lane confirmation
25
+ ### 3. Final approval
27
26
 
28
- 3A.1. Show to user:
29
- > "About to merge `<TASK-ID>` (fast lane). Branch `cloverleaf/<TASK-ID>` has been reviewed and passed. Confirm merge? (y/N)"
27
+ The task is at `final-gate` (the council passed). Confirm with the human, then:
30
28
 
31
- 3A.2. On explicit `y`:
32
- - `cloverleaf-cli emit-gate-decision <repo_root> <TASK-ID> human_merge approve human`
33
- - `cloverleaf-cli advance-status <repo_root> <TASK-ID> merged human human_merge fast_lane`
34
- - Commit: `git add .cloverleaf/ && git commit -m "cloverleaf: <TASK-ID> merged (fast lane)"`.
35
-
36
- ### 3B. Full-pipeline final approval
37
-
38
- 3B.1. Collect summaries. Read the latest feedback files:
29
+ 3.1. Collect summaries. Read the latest feedback files:
39
30
  ```bash
40
31
  ls <repo_root>/.cloverleaf/feedback/<TASK-ID>-*.json | sort
41
32
  ```
@@ -44,14 +35,14 @@ description: Human gate for merging a Cloverleaf task. Branches on state — fro
44
35
  - `u*.json` → UI Reviewer
45
36
  - `q*.json` → QA
46
37
 
47
- 3B.2. Show to user:
48
- > "About to merge `<TASK-ID>` (full pipeline). Final approval required. Summaries:
38
+ 3.2. Show to user:
39
+ > "About to merge `<TASK-ID>`. Final approval required. Summaries:
49
40
  > - Reviewer: <summary>
50
41
  > - UI Reviewer: <summary or 'not run'>
51
42
  > - QA: <summary with results>
52
43
  > Confirm merge? (y/N)"
53
44
 
54
- 3B.3. On explicit `y`:
45
+ 3.3. On explicit `y`:
55
46
  - `cloverleaf-cli emit-gate-decision <repo_root> <TASK-ID> final_approval_gate approve human`
56
47
  - Verify we are on main with a clean working tree:
57
48
  ```bash
@@ -63,7 +54,7 @@ description: Human gate for merging a Cloverleaf task. Branches on state — fro
63
54
  If not clean, stop and report.
64
55
  - Perform the real merge — brings the feature branch's Implementer commit, ui-review baseline commit, and any feedback commits into main:
65
56
  ```bash
66
- git merge --no-ff cloverleaf/${TASK_ID} -m "cloverleaf: ${TASK_ID} merged (full pipeline)"
57
+ git merge --no-ff cloverleaf/${TASK_ID} -m "cloverleaf: ${TASK_ID} merged"
67
58
  ```
68
59
  If git reports conflicts: abort and escalate.
69
60
  ```bash
@@ -71,12 +62,12 @@ description: Human gate for merging a Cloverleaf task. Branches on state — fro
71
62
  cloverleaf-cli advance-status <repo_root> ${TASK_ID} escalated agent
72
63
  ```
73
64
  Exit with a human-readable error explaining the conflict.
74
- - Advance task status on main (commits `.cloverleaf/tasks/${TASK_ID}.json` + event). The `final-gate → merged` transition is `allowed_actors: [human]` per the task state machine; the skill passes the gate + path as positional args:
65
+ - Advance task status on main (commits `.cloverleaf/tasks/${TASK_ID}.json` + event). The `final-gate → merged` transition is `allowed_actors: [human]` per the task state machine:
75
66
  ```bash
76
- cloverleaf-cli advance-status <repo_root> ${TASK_ID} merged human final_approval_gate full_pipeline
67
+ cloverleaf-cli advance-status <repo_root> ${TASK_ID} merged human final_approval_gate
77
68
  ```
78
69
 
79
- ### 4. Common: report
70
+ ### 4. Report
80
71
 
81
72
  Report:
82
73
  - "✓ Merged `<TASK-ID>`. Branch `cloverleaf/<TASK-ID>` has been merged into main."
@@ -86,8 +77,8 @@ Report:
86
77
 
87
78
  - Only proceed on explicit `y/Y/yes/YES`. Anything else is treated as either a decline (`n/N/no/NO`) or a clarifying question (see below).
88
79
  - The skill does NOT push the branch or open a PR.
89
- - Fast lane and full pipeline use distinct gates the state machine records which path was taken.
90
- - Full-pipeline merges perform a real `git merge --no-ff` before advancing state — the feature branch's code, baselines, and feedback commits all land on main.
80
+ - Every task merges via `final_approval_gate` there is a single human approval before merge (no separate fast-lane gate).
81
+ - Merges perform a real `git merge --no-ff` before advancing state — the feature branch's code, baselines, and feedback commits all land on main.
91
82
  - If the user declines, no state change and no commit.
92
83
 
93
84
  ## Clarifying questions at final-gate
@@ -32,23 +32,42 @@ The user has invoked this skill with a brief. Your job: turn the brief into a st
32
32
  "owner": { "kind": "agent", "id": "implementer" },
33
33
  "project": "<project>",
34
34
  "title": "<concise title derived from brief>",
35
- "context": <see "context.rfc injection" below>,
35
+ "context": { "rfc": { "project": "<rfc-project-field>", "id": "<RFC-ID>" } },
36
36
  "acceptance_criteria": ["<criterion 1>", "<criterion 2>", "..."],
37
37
  "definition_of_done": ["<terminal statement of completion>"],
38
38
  "risk_class": "low",
39
- "security_class": "<see security_class inference below>"
39
+ "security_class": <see security_class inference below>
40
+ }
41
+ ```
42
+
43
+ A complete, schema-valid example:
44
+
45
+ ```json
46
+ {
47
+ "id": "DEMO-002",
48
+ "type": "task",
49
+ "status": "pending",
50
+ "owner": { "kind": "agent", "id": "implementer" },
51
+ "project": "DEMO",
52
+ "title": "Add a retry budget to the fetch helper",
53
+ "context": { "rfc": { "project": "DEMO", "id": "DEMO-001" } },
54
+ "definition_of_done": ["`fetchWithRetry` retries up to 3 times on 5xx and gives up after that."],
55
+ "acceptance_criteria": ["`npm test` passes.", "A test asserts the 4th attempt is not made."],
56
+ "risk_class": "low",
57
+ "security_class": "low"
40
58
  }
41
59
  ```
42
60
 
43
61
  **`context.rfc` injection:**
44
62
 
45
63
  - If the brief includes `--rfc=<RFC-ID>` (e.g. `/cloverleaf-new-task --rfc=CLV-9 "Brief text..."`), read `<repo_root>/.cloverleaf/rfcs/<RFC-ID>.json` and inject the workItemRef shape:
64
+ <!-- cloverleaf-schema: task.schema.json#/properties/context -->
46
65
  ```json
47
66
  "context": { "rfc": { "project": "<rfc-project-field>", "id": "<RFC-ID>" } }
48
67
  ```
49
68
  The `project` field comes from the loaded RFC document, NOT the task's own project (a task in project FOO may legitimately reference an RFC in project BAR).
50
69
  - If `<repo_root>/.cloverleaf/rfcs/<RFC-ID>.json` does not exist, abort and ask the user to verify the RFC ID. Do not write the task file.
51
- - If `--rfc=<ID>` is not passed, leave `context` as `{}`same as pre-v0.7.4 behavior.
70
+ - `--rfc=<RFC-ID>` is **required**. `task.schema.json` requires `context.rfc`, so a task without it is schema-invalid and will be rejected at its first `advance-status`. If the brief does not name an RFC, stop and ask the user which RFC this task belongs to do not write the file.
52
71
 
53
72
  Derive 2-5 acceptance criteria from the brief. Each must be verifiable. Derive one or more Definition of Done strings as an array.
54
73
 
@@ -76,7 +95,7 @@ The user has invoked this skill with a brief. Your job: turn the brief into a st
76
95
  ## Rules
77
96
 
78
97
  - Do not guess at acceptance criteria. If the brief is too vague (e.g., "make it faster" with no target), ask the user a clarifying question before writing the file.
79
- - **`--rfc=<ID>` flag:** When the brief includes `--rfc=<RFC-ID>`, the task's `context.rfc` is populated from the on-disk RFC document (see step 4). This is the canonical way to scaffold an **RFC-direct task** (no Plan parent, no `task_batch_gate`) — used for hotfixes after a Plan has delivered, or for incremental RFC progress without forming a Plan. The walker's RFC auto-advance treats RFC-direct tasks as first-class: an in-flight one blocks RFC completion; a merged one counts toward delivery. See `reference-impl/README.md` § "Plans vs RFC-direct tasks" for the full pattern docs and when to pick this over `/cloverleaf-discover`. If `--rfc` is omitted, `context` is left empty.
98
+ - **`--rfc=<ID>` flag:** When the brief includes `--rfc=<RFC-ID>`, the task's `context.rfc` is populated from the on-disk RFC document (see step 4). This is the canonical way to scaffold an **RFC-direct task** (no Plan parent, no `task_batch_gate`) — used for hotfixes after a Plan has delivered, or for incremental RFC progress without forming a Plan. The walker's RFC auto-advance treats RFC-direct tasks as first-class: an in-flight one blocks RFC completion; a merged one counts toward delivery. See `reference-impl/README.md` § "Plans vs RFC-direct tasks" for the full pattern docs and when to pick this over `/cloverleaf-discover`. `--rfc` is required: every task descends from an RFC. A hotfix with no Plan parent is exactly the RFC-direct pattern described above — pass the RFC it belongs to.
80
99
  - **risk_class inference:** `risk_class` determines the Delivery pipeline (`"low"` → fast lane; `"high"` → full pipeline). Rules:
81
100
  1. If the user passed `--risk=high` or `--risk=low` as a flag on the skill invocation, honor it.
82
101
  2. Otherwise, set `risk_class: "high"` when the brief OR any acceptance criterion matches (case-insensitive) any of these keywords:
@@ -1,9 +1,17 @@
1
1
  ---
2
2
  name: cloverleaf-qa
3
- description: Run the QA agent on a task in the `qa` state (full pipeline only). Dispatches a subagent to run per-package test suites against an isolated worktree; emits feedback envelope with results; advances qa final-gate on pass or loops back to implementing on bounce. Usage — /cloverleaf-qa <TASK-ID>.
3
+ description: Run the QA council member on a task's feature branch as a standalone one-off. Dispatches a subagent to run per-package test suites against an isolated worktree. Emit-only — it writes a feedback envelope with the test results and reports the verdict (pass/bounce/escalate) for the delivery council or a human to apply. It does NOT advance the task FSM. Usage — /cloverleaf-qa <TASK-ID>.
4
4
  ---
5
5
 
6
- # Cloverleaf — qa
6
+ # Cloverleaf — qa (emit-only council member)
7
+
8
+ The delivery states `qa`/`final-gate` are no longer entered by a standalone QA gate — the `@cloverleaf/standard`
9
+ task FSM collapsed the delivery gates into a single `council` phase (Council Slice 4). QA is now a **council member**
10
+ that the runner (`/cloverleaf-run`) dispatches and aggregates alongside the other members. A single member cannot
11
+ drive the multi-member council to `final-gate` (that would bypass the others' gating), so this standalone skill is
12
+ **emit-only**: it runs the QA prompt against the task's branch, emits the feedback envelope with the test results,
13
+ and reports the verdict. **It does not advance the FSM** — the council or a human applies the aggregated verdict via
14
+ `apply-council-verdict` (a council pass is what advances `council → final-gate`).
7
15
 
8
16
  ## Steps
9
17
 
@@ -19,7 +27,7 @@ description: Run the QA agent on a task in the `qa` state (full pipeline only).
19
27
  ```
20
28
  cloverleaf-cli load-task <repo_root> <TASK-ID>
21
29
  ```
22
- Verify `status === "qa"`. If not, report and stop.
30
+ Light guard only: confirm the task exists and is not terminal (`merged`/`rejected`/`escalated`). Do NOT hard-require any particular state — this skill reviews the branch, not a specific FSM state. If the task is terminal, report and stop.
23
31
 
24
32
  3. Confirm feature branch exists: `git rev-parse --verify cloverleaf/<TASK-ID>`.
25
33
 
@@ -51,36 +59,29 @@ description: Run the QA agent on a task in the `qa` state (full pipeline only).
51
59
 
52
60
  **Dispatch conventions:** invoke the Task tool in foreground mode (its default — do NOT pass `run_in_background: true`). The Task tool returns the subagent's final message as a string in the result. Do NOT use Bash `sleep` to poll an output file — the harness blocks foreground `sleep`, and background dispatch is unnecessary here because the foreground Task tool already blocks until the subagent finishes.
53
61
 
54
- 8. Parse response: expect `{"verdict": "pass"|"bounce"|"escalate", "summary", "findings", "results"}`.
55
-
56
- 9. Branch on verdict:
62
+ 8. Parse response: expect `{"verdict": "pass"|"bounce"|"escalate", "summary", "findings"}`. There is no separate `results` field — the aggregate test counts are folded into the end of `summary` (e.g., "Test counts: passed 153, failed 0, total 153.").
57
63
 
58
- **Pass:**
59
- ```
60
- cloverleaf-cli advance-status <repo_root> <TASK-ID> final-gate agent --path=full_pipeline
61
- ```
62
- Commit: `git add .cloverleaf/ && git commit -m "cloverleaf: <TASK-ID> qa passed → final-gate"`.
63
- Report: "✓ QA passed (`<passed>/<total>` tests). State → final-gate. Next: `/cloverleaf-merge <TASK-ID>`."
64
+ 9. **Emit the envelope + report the verdict (no FSM advance).**
64
65
 
65
- **Bounce:**
66
- 1. Write feedback envelope: `echo '<json>' > /tmp/cloverleaf-fb-q.json`
66
+ Persist the feedback envelope — verdict, summary (including the aggregate test counts), and findings — so the council/human can read it, regardless of verdict:
67
+ 1. Write the feedback envelope: `echo '<json>' > /tmp/cloverleaf-fb-q.json`
67
68
  2. `cloverleaf-cli write-feedback <repo_root> <TASK-ID> /tmp/cloverleaf-fb-q.json --prefix=q`
68
- 3. Commit the persisted feedback file (was missing pre-v0.4.1 — bug #3):
69
+ 3. Commit the persisted feedback file:
69
70
  ```bash
70
71
  cd <repo_root>
71
72
  git add .cloverleaf/feedback/
72
- git commit -m "cloverleaf: <TASK-ID> qa feedback"
73
+ git commit -m "cloverleaf: <TASK-ID> qa verdict (emit-only)"
73
74
  ```
74
- 4. `cloverleaf-cli advance-status <repo_root> <TASK-ID> implementing agent --path=full_pipeline`
75
- 5. Commit: `git add .cloverleaf/ && git commit -m "cloverleaf: <TASK-ID> qa bounced → implementing"`.
76
- 6. Report: "✗ QA bounced. `<failed>/<total>` tests failed. State → implementing. Next: `/cloverleaf-implement <TASK-ID>`."
77
75
 
78
- **Escalate:**
79
- 1. `cloverleaf-cli advance-status <repo_root> <TASK-ID> escalated agent`
80
- 2. Commit: `git add .cloverleaf/ && git commit -m "cloverleaf: <TASK-ID> qa escalated"`.
81
- 3. Report: "✗ QA escalated. Review infrastructure and retry manually."
76
+ Then report the verdict — do **NOT** run `advance-status`:
77
+
78
+ **Pass:** "✓ QA verdict: **pass** `<summary>`. Feedback emitted to `.cloverleaf/feedback/<TASK-ID>-q<N>.json`. This is one council member's verdict — the delivery council (`/cloverleaf-run <TASK-ID>`) or a human applies the aggregated verdict (`apply-council-verdict`, a council pass advances `council → final-gate`); this skill does not advance the FSM."
79
+
80
+ **Bounce:** "✗ QA verdict: **bounce** — `<summary>`. Feedback emitted to `.cloverleaf/feedback/<TASK-ID>-q<N>.json`. The delivery council or a human applies the verdict (a council bounce loops the task back to `implementing`); this skill does not advance the FSM."
81
+
82
+ **Escalate:** "✗ QA verdict: **escalate** (infrastructure issue) — `<summary>`. Feedback emitted to `.cloverleaf/feedback/<TASK-ID>-q<N>.json`. The council or a human applies the verdict (a council escalate → `escalated`); this skill does not advance the FSM. Review infrastructure and retry manually."
82
83
 
83
84
  ## Rules
84
85
 
85
86
  - Never push. Read-only. Do not modify source.
86
- - On illegal state transition, report and stop.
87
+ - Emit-only: never call `advance-status`. This is one council member's verdict; the council/human applies it.
@@ -1,9 +1,17 @@
1
1
  ---
2
2
  name: cloverleaf-review
3
- description: Run the Reviewer agent on a task in the `review` state. Emits a feedback envelope; advances to `automated-gates` on pass or loops back to `implementing` on bounce. Usage — /cloverleaf-review <TASK-ID>.
3
+ description: Run the Reviewer council member on a task's feature branch as a standalone one-off. Emit-only — it dispatches the reviewer prompt against `main..cloverleaf/<TASK-ID>`, writes a feedback envelope, and reports the verdict (pass/bounce) for the delivery council or a human to apply. It does NOT advance the task FSM. Usage — /cloverleaf-review <TASK-ID>.
4
4
  ---
5
5
 
6
- # Cloverleaf — review
6
+ # Cloverleaf — review (emit-only council member)
7
+
8
+ The delivery states `review`/`automated-gates` no longer exist — the `@cloverleaf/standard` task FSM
9
+ collapsed them into a single `council` phase (Council Slice 4). The Reviewer is now a **council member**
10
+ that the runner (`/cloverleaf-run`) dispatches and aggregates alongside the other members. A single member
11
+ cannot drive the multi-member council to merge (that would bypass the others' gating), so this standalone
12
+ skill is **emit-only**: it runs the reviewer prompt against the task's branch, emits the feedback envelope,
13
+ and reports the verdict. **It does not advance the FSM** — the council or a human applies the aggregated
14
+ verdict via `apply-council-verdict`.
7
15
 
8
16
  ## Steps
9
17
 
@@ -27,7 +35,9 @@ description: Run the Reviewer agent on a task in the `review` state. Emits a fee
27
35
  ```
28
36
  cloverleaf-cli load-task <repo_root> <TASK-ID>
29
37
  ```
30
- Verify `status === "review"`. If not, report the current status and stop.
38
+ Light guard only: confirm the task exists and is not in a terminal status (`merged`/`rejected`/`escalated`).
39
+ Do NOT hard-require any particular state — this skill reviews the branch, not a specific FSM state.
40
+ If the task is terminal, report the current status and stop.
31
41
 
32
42
  3. The Implementer's branch is `cloverleaf/<TASK-ID>`. Confirm it exists: `git rev-parse --verify cloverleaf/<TASK-ID>`. If missing, report the discrepancy and stop. Do NOT check out this branch; stay on main.
33
43
 
@@ -56,30 +66,26 @@ description: Run the Reviewer agent on a task in the `review` state. Emits a fee
56
66
 
57
67
  6. Parse the subagent's response. Expect a feedback envelope JSON of the form `{"verdict": "pass"|"bounce", "summary": "...", "findings": [...]}`. Validate shape: verdict must be `pass` or `bounce`; if `bounce`, findings must have at least one entry with `severity` (one of `blocker|error|warning|info`) and `message`.
58
68
 
59
- 7. Branch on verdict:
60
-
61
- **Pass:**
62
- ```
63
- cloverleaf-cli advance-status <repo_root> <TASK-ID> automated-gates agent
64
- ```
65
- Commit: `git add .cloverleaf/ && git commit -m "cloverleaf: <TASK-ID> review passed → automated-gates"`.
66
- Report: "✓ Review passed. State → automated-gates. Next: `/cloverleaf-merge <TASK-ID>`."
69
+ 7. **Emit the envelope + report the verdict (no FSM advance).**
67
70
 
68
- **Bounce:**
71
+ Persist the feedback envelope so the council/human can read it, regardless of verdict:
69
72
  1. Write the feedback envelope to a temp file: `echo '<envelope-json>' > /tmp/cloverleaf-fb-r.json`.
70
73
  2. `cloverleaf-cli write-feedback <repo_root> <TASK-ID> /tmp/cloverleaf-fb-r.json` — captures the path like `.cloverleaf/feedback/<TASK-ID>-r<N>.json`.
71
- 3. Commit the persisted feedback file (was missing pre-v0.4.1 — bug #3):
74
+ 3. Commit the persisted feedback file:
72
75
  ```bash
73
76
  cd <repo_root>
74
77
  git add .cloverleaf/feedback/
75
- git commit -m "cloverleaf: <TASK-ID> review feedback"
78
+ git commit -m "cloverleaf: <TASK-ID> reviewer verdict (emit-only)"
76
79
  ```
77
- 4. `cloverleaf-cli advance-status <repo_root> <TASK-ID> implementing agent` — loops back.
78
- 5. Commit: `git add .cloverleaf/ && git commit -m "cloverleaf: <TASK-ID> review bounced → implementing"`.
79
- 6. Report: "✗ Review bounced. Findings: <summarize findings by severity>. State → implementing. Next: `/cloverleaf-implement <TASK-ID>`."
80
+
81
+ Then report the verdict do **NOT** run `advance-status`:
82
+
83
+ **Pass:** "✓ Reviewer verdict: **pass**. Feedback emitted to `.cloverleaf/feedback/<TASK-ID>-r<N>.json`. This is one council member's verdict — the delivery council (`/cloverleaf-run <TASK-ID>`) or a human applies the aggregated verdict (`apply-council-verdict`); this skill does not advance the FSM."
84
+
85
+ **Bounce:** "✗ Reviewer verdict: **bounce**. Findings: <summarize findings by severity>. Feedback emitted to `.cloverleaf/feedback/<TASK-ID>-r<N>.json`. The delivery council or a human applies the verdict (a council bounce loops the task back to `implementing`); this skill does not advance the FSM."
80
86
 
81
87
  ## Rules
82
88
 
83
89
  - Never push.
84
90
  - Do not modify source code — the reviewer is read-only.
85
- - On illegal state transition, report and stop without partial commits.
91
+ - Emit-only: never call `advance-status`. This is one council member's verdict; the council/human applies it.