@ritualai/cli 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +120 -0
  2. package/dist/commands/doctor.js +87 -0
  3. package/dist/commands/doctor.js.map +1 -0
  4. package/dist/commands/init.js +158 -0
  5. package/dist/commands/init.js.map +1 -0
  6. package/dist/commands/login.js +63 -0
  7. package/dist/commands/login.js.map +1 -0
  8. package/dist/commands/logout.js +25 -0
  9. package/dist/commands/logout.js.map +1 -0
  10. package/dist/commands/refresh.js +42 -0
  11. package/dist/commands/refresh.js.map +1 -0
  12. package/dist/commands/whoami.js +52 -0
  13. package/dist/commands/whoami.js.map +1 -0
  14. package/dist/index.js +51 -0
  15. package/dist/index.js.map +1 -0
  16. package/dist/lib/agents/configure-mcp.js +127 -0
  17. package/dist/lib/agents/configure-mcp.js.map +1 -0
  18. package/dist/lib/agents/detector.js +32 -0
  19. package/dist/lib/agents/detector.js.map +1 -0
  20. package/dist/lib/agents/providers.js +118 -0
  21. package/dist/lib/agents/providers.js.map +1 -0
  22. package/dist/lib/api-client.js +120 -0
  23. package/dist/lib/api-client.js.map +1 -0
  24. package/dist/lib/config.js +154 -0
  25. package/dist/lib/config.js.map +1 -0
  26. package/dist/lib/oidc.js +213 -0
  27. package/dist/lib/oidc.js.map +1 -0
  28. package/dist/lib/pat-store.js +44 -0
  29. package/dist/lib/pat-store.js.map +1 -0
  30. package/dist/lib/skill-copy.js +57 -0
  31. package/dist/lib/skill-copy.js.map +1 -0
  32. package/package.json +59 -0
  33. package/skills/claude-code/ritual/SKILL.md +271 -0
  34. package/skills/codex/ritual/SKILL.md +271 -0
  35. package/skills/cursor/ritual/SKILL.md +271 -0
  36. package/skills/gemini/ritual/SKILL.md +271 -0
  37. package/skills/kiro/ritual/SKILL.md +271 -0
  38. package/skills/vscode/ritual/SKILL.md +271 -0
@@ -0,0 +1,271 @@
1
+ ---
2
+ name: ritual
3
+ description: "Top-level Ritual workflow dispatcher. Use when the engineer wants to start, run, check, or accept a Ritual exploration. Subcommands today: `build` (free-form problem → accepted recommendations, end-to-end). More land as they're built."
4
+ argument-hint: "[subcommand] <args> (e.g. 'build Reduce T2 churn in Q3')"
5
+ user-invocable: true
6
+ ---
7
+
8
+ # /ritual
9
+
10
+ Top-level dispatcher for vNext Ritual workflows. The first whitespace-delimited token of the argument selects a subcommand; everything after is passed to that subcommand.
11
+
12
+ ## Routing
13
+
14
+ Parse the first token of the argument:
15
+
16
+ | First token | Route to |
17
+ |---|---|
18
+ | `build` | the [build flow](#ritual-build) below |
19
+ | (anything else, OR no subcommand) | default to `build` and treat the entire argument as the problem statement |
20
+
21
+ Future subcommands (`run`, `status`, `recs`) will be added as their workflows are built. When you add a new subcommand, extend the routing table above and add a `## /ritual <subcommand>` section below.
22
+
23
+ ---
24
+
25
+ ## /ritual build
26
+
27
+ Walks the engineer from a free-form problem statement to vetted, accepted Ritual recommendations using the vNext MCP tool surface.
28
+
29
+ Output: **an exploration in COMPLETE state with accepted recommendations**, suitable as input to downstream implementation skills.
30
+
31
+ ### Vocabulary mapping (engineer-tone)
32
+
33
+ The Ritual data model uses product-research terminology. This skill translates to engineer-natural terms when speaking to the user. The underlying API still uses original names — keep this table mental when you read tool inputs / outputs:
34
+
35
+ | User-facing term (the skill says) | Tool field name (the API uses) |
36
+ |---|---|
37
+ | **scope** | `problemStatement` |
38
+ | **sub-problem** | `consideration` |
39
+ | **matter** | `matter` (no rename — already the right word) |
40
+ | **discovery question** | `question` |
41
+ | **recommendation** | `recommendation` |
42
+
43
+ When the user says "tighten the scope," call `generate_problem_statement(...)` with their refinement. When you tell the user "I picked these sub-problems," you mean the items you put in `considerations[]`. The tools don't change; only the language to the user does.
44
+
45
+ ### When to use
46
+
47
+ - The user describes a problem they want explored ("we need to figure out X", "let's scope Y", "I want recommendations on Z")
48
+ - The user wants the full pipeline — sub-problems → scope → discovery → recommendations — not just one step
49
+
50
+ When **not** to use:
51
+ - An exploration already exists with recommendations — fetch directly via `get_exploration` + `get_recommendations`
52
+ - The user wants to *implement* a feature from existing recommendations — use `/ritual-builder-spec` (from `@ritual-ai/cli`)
53
+
54
+ ### Workflow — 7 phases
55
+
56
+ Each phase has explicit **[USER PAUSE]** points — never skip them.
57
+
58
+ #### Phase 1 — Pick a workspace
59
+
60
+ Call `mcp__ritual__list_workspaces`. Present as a numbered list (id, name).
61
+
62
+ If the user only has one project workspace, confirm it directly: "I'll create this in *Acme Engineering*. Sound right?" — but still wait for **[USER PAUSE]**.
63
+
64
+ Store `workspace_id`.
65
+
66
+ #### Phase 2 — Generate sub-problems
67
+
68
+ Call `mcp__ritual__generate_considerations` with:
69
+ - `workspace_id`
70
+ - `raw_input` (the problem from the slash-command argument or chat)
71
+ - `template_id` (omit unless the user specified one)
72
+
73
+ LLM call, ~5-10s. Returns 5-6 sub-problems — different framing axes the agent should investigate.
74
+
75
+ **[USER PAUSE]** Present as a numbered list and ask which to include:
76
+
77
+ > Sub-problems the system identified:
78
+ >
79
+ > 1. {sub-problem 1}
80
+ > 2. {sub-problem 2}
81
+ > ...
82
+ >
83
+ > Which should we factor into the scope? Pick any subset, or "all".
84
+
85
+ Store the picked sub-problems (text strings — they'll go into `considerations[]` next call).
86
+
87
+ #### Phase 3 — Generate scope
88
+
89
+ Call `mcp__ritual__generate_problem_statement` with:
90
+ - `workspace_id`
91
+ - `raw_input`
92
+ - `considerations` (the picks from Phase 2 — these are the sub-problems we just discussed)
93
+ - `template_id` (same as Phase 2 if used)
94
+
95
+ Returns a polished "How might we ..." style scope (typically <800 chars) plus optional follow-up questions and quality scores.
96
+
97
+ **[USER PAUSE]** Present and ask:
98
+
99
+ > Here's the scope:
100
+ >
101
+ > > **{generated scope}**
102
+ >
103
+ > Looks good? Want to tighten / broaden / change the audience? Or "ship it" to lock it in.
104
+
105
+ If refinement requested: regenerate with the refinement appended to `raw_input`. Iterate until accepted.
106
+
107
+ Store the final scope as `problem_statement` for the next call.
108
+
109
+ #### Phase 4 — Create the exploration
110
+
111
+ Generate a short name (≤60 chars) from the scope — typically the noun phrase, not the full HMW. E.g. "Reduce T2 customer churn in Q3" → name `T2 churn reduction (Q3)`.
112
+
113
+ **[USER PAUSE]** "I'll create the exploration as **T2 churn reduction (Q3)**. Proceed?"
114
+
115
+ Call `mcp__ritual__create_exploration` with:
116
+ - `workspace_id`
117
+ - `name`
118
+ - `problem_statement` (the scope from Phase 3)
119
+ - `agentic: false` — **do NOT** pass `agentic: true`. We want explicit per-step control so the user gets to pick discovery questions in Phase 5. Auto-agentic skips that.
120
+
121
+ Store `exploration_id`. Show the URL:
122
+
123
+ > Exploration created. Track progress at https://dev.ritualapp.cloud/e/{exploration_id}
124
+
125
+ #### Phase 5 — Discovery questions
126
+
127
+ Longest phase because generation is async + the user picks per-matter.
128
+
129
+ ##### 5.1 — Kick off
130
+
131
+ Call `mcp__ritual__suggest_discovery_questions(exploration_id)`. Returns immediately with `task_id`. Tell the user:
132
+
133
+ > Generating discovery questions for each matter… 30-120 seconds.
134
+
135
+ ##### 5.2 — Poll until ready
136
+
137
+ Loop:
138
+ - Call `mcp__ritual__get_discovery_state(exploration_id)`
139
+ - If `ready: false`, wait 5 seconds, poll again
140
+ - If `ready: true`, exit loop
141
+
142
+ Don't poll faster than every 5 seconds. Update the user every ~30 seconds so they know you haven't stalled.
143
+
144
+ ##### 5.3 — Present matters and collect picks
145
+
146
+ The state contains `matters[]`, each with `id`, `name`, and `questions[]`. Walk through them **one matter at a time**:
147
+
148
+ > **{matter.name}** — {matter.questions.length} discovery questions:
149
+ >
150
+ > 1. {question 1}
151
+ > 2. {question 2}
152
+ > ...
153
+ >
154
+ > Which should the agent investigate? Pick any subset, "all", or "skip" to skip this matter.
155
+
156
+ **[USER PAUSE]** Wait per matter.
157
+
158
+ ##### 5.4 — Commit picks per-matter
159
+
160
+ For each matter where the user picked at least one question, call `mcp__ritual__accept_discovery_questions` with:
161
+ - `state_id` (from the discovery state)
162
+ - `matter_id`
163
+ - `question_ids[]` (the picks for THIS matter)
164
+
165
+ This MUST be one call per matter — the API enforces per-matter atomicity. Don't bundle across matters.
166
+
167
+ ##### 5.5 — Optional: capture out-of-scope items
168
+
169
+ If the user mentioned things they DON'T want investigated ("don't touch enterprise SSO", "skip pricing"), capture them as anti-goals.
170
+
171
+ Call `mcp__ritual__set_anti_goals(exploration_id, [{ text, reason? }, ...])`.
172
+
173
+ Skip silently if no anti-goals were mentioned.
174
+
175
+ #### Phase 6 — Run the agentic pipeline
176
+
177
+ Call `mcp__ritual__start_agentic_run` with:
178
+ - `scope_type: 'exploration'`
179
+ - `exploration_id`
180
+
181
+ Returns `run_id`. Starts the full pipeline (sourcing → answers → recommendations) in the background. Typical runtime: 3-8 minutes.
182
+
183
+ Poll `mcp__ritual__get_agentic_run(run_id)` every 15 seconds. Show progress when it changes:
184
+
185
+ > Agentic run: {progress_pct}% — {current_step}
186
+
187
+ When `status` is `COMPLETED`: continue to Phase 7.
188
+ When `status` is `COMPLETED_WITH_ERRORS`: tell the user, but proceed — partial recommendations may still be useful.
189
+ When `status` is `FAILED`: surface the error message, ask if they want to retry (`start_agentic_run` again with same exploration_id) or stop.
190
+
191
+ If user wants to abort mid-flight: `mcp__ritual__cancel_agentic_run(run_id)`.
192
+
193
+ #### Phase 7 — Review and accept recommendations
194
+
195
+ Call `mcp__ritual__get_recommendations(exploration_id)`. Response is an array of recommendations with id, title, status, content, reasoning.
196
+
197
+ **[USER PAUSE]** Present as a numbered list with title + 1-line summary:
198
+
199
+ > {N} recommendations:
200
+ >
201
+ > 1. **{title}** — {one-line from content}
202
+ > 2. **{title}** — {one-line from content}
203
+ > ...
204
+ >
205
+ > Want detail on any of them? Or ready to accept the set?
206
+
207
+ If detail requested: show full `content` and `reasoning_chain` (if present). Loop until done.
208
+
209
+ When the user is ready:
210
+
211
+ **[USER PAUSE]** "Accept all and mark the exploration complete?"
212
+
213
+ If yes, call `mcp__ritual__accept_recommendations(exploration_id)`. Response includes counts (`promoted`, `alreadyApproved`, `skipped`, `transitionedToComplete`).
214
+
215
+ Show the final state:
216
+
217
+ > Done. {N} recommendations accepted. Exploration is now COMPLETE.
218
+ >
219
+ > View at: https://dev.ritualapp.cloud/e/{exploration_id}
220
+
221
+ ### Failure modes & recovery
222
+
223
+ **Discovery generation hangs (>5 min polling without `ready: true`)**: ask the user — wait longer? retry (`suggest_discovery_questions` again, new task)? or skip discovery entirely (proceed to Phase 6 without picked questions)?
224
+
225
+ **Agentic run fails or stalls**: surface the error, offer retry or stop.
226
+
227
+ **Discovery state ready=true with zero matters**: rare but possible if the LLM produced a malformed state. Retry by calling `suggest_discovery_questions` again.
228
+
229
+ **LLM-cost / quota errors (HTTP 429)**: tell the user explicitly. Do NOT auto-retry — quota issues need a human decision (different model tier, wait, top up).
230
+
231
+ ### Tools used
232
+
233
+ This subcommand exclusively uses vNext MCP tools, in the order they appear:
234
+
235
+ 1. `mcp__ritual__list_workspaces` (Phase 1)
236
+ 2. `mcp__ritual__generate_considerations` (Phase 2)
237
+ 3. `mcp__ritual__generate_problem_statement` (Phase 3)
238
+ 4. `mcp__ritual__create_exploration` (Phase 4)
239
+ 5. `mcp__ritual__suggest_discovery_questions` (Phase 5.1)
240
+ 6. `mcp__ritual__get_discovery_state` (Phase 5.2)
241
+ 7. `mcp__ritual__accept_discovery_questions` (Phase 5.4)
242
+ 8. `mcp__ritual__set_anti_goals` (Phase 5.5, optional)
243
+ 9. `mcp__ritual__start_agentic_run` (Phase 6)
244
+ 10. `mcp__ritual__get_agentic_run` (Phase 6 polling)
245
+ 11. `mcp__ritual__cancel_agentic_run` (Phase 6, only on user abort)
246
+ 12. `mcp__ritual__get_recommendations` (Phase 7)
247
+ 13. `mcp__ritual__accept_recommendations` (Phase 7)
248
+
249
+ 13 of the 19 vNext tools. The other 6 (`ping`, `get_exploration`, `list_templates`, `list_agentic_runs`, `add_collaborator`, `check_anti_goals`) are situational, not part of the linear build flow.
250
+
251
+ ### After this subcommand
252
+
253
+ When `/ritual build` completes, the exploration is in COMPLETE state with accepted recommendations. Downstream:
254
+
255
+ 1. `/ritual-builder-spec <feature description>` — generates a build brief from the recommendations + a codebase-grounded plan
256
+ 2. `/ritual-build <feature description>` (legacy variant from `@ritual-ai/cli`) — implements the plan, commits per logical unit, drafts a PR description
257
+
258
+ Naming overlap note: the legacy `/ritual-build` (in the public CLI package) is the *implementation* skill — feature description → committed code. This new `/ritual build` is the *exploration* skill — problem statement → accepted recommendations. Different scopes, similar names. Future cleanup may align them.
259
+
260
+ ---
261
+
262
+ ## /ritual run, /ritual status, /ritual recs
263
+
264
+ Not yet built. When they are, add a `## /ritual <name>` section to this file and update the routing table at the top.
265
+
266
+ Conceptual scope (when built):
267
+ - `/ritual run <exploration_id>` — kick off agentic run on an existing exploration, poll, present recommendations. Subset of `build` starting at Phase 6.
268
+ - `/ritual status <id>` — quick status check on an exploration or run. No interaction.
269
+ - `/ritual recs <exploration_id>` — fetch + present recommendations. No interaction.
270
+
271
+ For now, if the user asks for these, tell them politely: "That subcommand isn't built yet — for status, use `mcp__ritual__get_exploration` directly; for recs, use `mcp__ritual__get_recommendations` directly."
@@ -0,0 +1,271 @@
1
+ ---
2
+ name: ritual
3
+ description: "Top-level Ritual workflow dispatcher. Use when the engineer wants to start, run, check, or accept a Ritual exploration. Subcommands today: `build` (free-form problem → accepted recommendations, end-to-end). More land as they're built."
4
+ argument-hint: "[subcommand] <args> (e.g. 'build Reduce T2 churn in Q3')"
5
+ user-invocable: true
6
+ ---
7
+
8
+ # /ritual
9
+
10
+ Top-level dispatcher for vNext Ritual workflows. The first whitespace-delimited token of the argument selects a subcommand; everything after is passed to that subcommand.
11
+
12
+ ## Routing
13
+
14
+ Parse the first token of the argument:
15
+
16
+ | First token | Route to |
17
+ |---|---|
18
+ | `build` | the [build flow](#ritual-build) below |
19
+ | (anything else, OR no subcommand) | default to `build` and treat the entire argument as the problem statement |
20
+
21
+ Future subcommands (`run`, `status`, `recs`) will be added as their workflows are built. When you add a new subcommand, extend the routing table above and add a `## /ritual <subcommand>` section below.
22
+
23
+ ---
24
+
25
+ ## /ritual build
26
+
27
+ Walks the engineer from a free-form problem statement to vetted, accepted Ritual recommendations using the vNext MCP tool surface.
28
+
29
+ Output: **an exploration in COMPLETE state with accepted recommendations**, suitable as input to downstream implementation skills.
30
+
31
+ ### Vocabulary mapping (engineer-tone)
32
+
33
+ The Ritual data model uses product-research terminology. This skill translates to engineer-natural terms when speaking to the user. The underlying API still uses original names — keep this table mental when you read tool inputs / outputs:
34
+
35
+ | User-facing term (the skill says) | Tool field name (the API uses) |
36
+ |---|---|
37
+ | **scope** | `problemStatement` |
38
+ | **sub-problem** | `consideration` |
39
+ | **matter** | `matter` (no rename — already the right word) |
40
+ | **discovery question** | `question` |
41
+ | **recommendation** | `recommendation` |
42
+
43
+ When the user says "tighten the scope," call `generate_problem_statement(...)` with their refinement. When you tell the user "I picked these sub-problems," you mean the items you put in `considerations[]`. The tools don't change; only the language to the user does.
44
+
45
+ ### When to use
46
+
47
+ - The user describes a problem they want explored ("we need to figure out X", "let's scope Y", "I want recommendations on Z")
48
+ - The user wants the full pipeline — sub-problems → scope → discovery → recommendations — not just one step
49
+
50
+ When **not** to use:
51
+ - An exploration already exists with recommendations — fetch directly via `get_exploration` + `get_recommendations`
52
+ - The user wants to *implement* a feature from existing recommendations — use `/ritual-builder-spec` (from `@ritual-ai/cli`)
53
+
54
+ ### Workflow — 7 phases
55
+
56
+ Each phase has explicit **[USER PAUSE]** points — never skip them.
57
+
58
+ #### Phase 1 — Pick a workspace
59
+
60
+ Call `mcp__ritual__list_workspaces`. Present as a numbered list (id, name).
61
+
62
+ If the user only has one project workspace, confirm it directly: "I'll create this in *Acme Engineering*. Sound right?" — but still wait for **[USER PAUSE]**.
63
+
64
+ Store `workspace_id`.
65
+
66
+ #### Phase 2 — Generate sub-problems
67
+
68
+ Call `mcp__ritual__generate_considerations` with:
69
+ - `workspace_id`
70
+ - `raw_input` (the problem from the slash-command argument or chat)
71
+ - `template_id` (omit unless the user specified one)
72
+
73
+ LLM call, ~5-10s. Returns 5-6 sub-problems — different framing axes the agent should investigate.
74
+
75
+ **[USER PAUSE]** Present as a numbered list and ask which to include:
76
+
77
+ > Sub-problems the system identified:
78
+ >
79
+ > 1. {sub-problem 1}
80
+ > 2. {sub-problem 2}
81
+ > ...
82
+ >
83
+ > Which should we factor into the scope? Pick any subset, or "all".
84
+
85
+ Store the picked sub-problems (text strings — they'll go into `considerations[]` next call).
86
+
87
+ #### Phase 3 — Generate scope
88
+
89
+ Call `mcp__ritual__generate_problem_statement` with:
90
+ - `workspace_id`
91
+ - `raw_input`
92
+ - `considerations` (the picks from Phase 2 — these are the sub-problems we just discussed)
93
+ - `template_id` (same as Phase 2 if used)
94
+
95
+ Returns a polished "How might we ..." style scope (typically <800 chars) plus optional follow-up questions and quality scores.
96
+
97
+ **[USER PAUSE]** Present and ask:
98
+
99
+ > Here's the scope:
100
+ >
101
+ > > **{generated scope}**
102
+ >
103
+ > Looks good? Want to tighten / broaden / change the audience? Or "ship it" to lock it in.
104
+
105
+ If refinement requested: regenerate with the refinement appended to `raw_input`. Iterate until accepted.
106
+
107
+ Store the final scope as `problem_statement` for the next call.
108
+
109
+ #### Phase 4 — Create the exploration
110
+
111
+ Generate a short name (≤60 chars) from the scope — typically the noun phrase, not the full HMW. E.g. "Reduce T2 customer churn in Q3" → name `T2 churn reduction (Q3)`.
112
+
113
+ **[USER PAUSE]** "I'll create the exploration as **T2 churn reduction (Q3)**. Proceed?"
114
+
115
+ Call `mcp__ritual__create_exploration` with:
116
+ - `workspace_id`
117
+ - `name`
118
+ - `problem_statement` (the scope from Phase 3)
119
+ - `agentic: false` — **do NOT** pass `agentic: true`. We want explicit per-step control so the user gets to pick discovery questions in Phase 5. Auto-agentic skips that.
120
+
121
+ Store `exploration_id`. Show the URL:
122
+
123
+ > Exploration created. Track progress at https://dev.ritualapp.cloud/e/{exploration_id}
124
+
125
+ #### Phase 5 — Discovery questions
126
+
127
+ Longest phase because generation is async + the user picks per-matter.
128
+
129
+ ##### 5.1 — Kick off
130
+
131
+ Call `mcp__ritual__suggest_discovery_questions(exploration_id)`. Returns immediately with `task_id`. Tell the user:
132
+
133
+ > Generating discovery questions for each matter… 30-120 seconds.
134
+
135
+ ##### 5.2 — Poll until ready
136
+
137
+ Loop:
138
+ - Call `mcp__ritual__get_discovery_state(exploration_id)`
139
+ - If `ready: false`, wait 5 seconds, poll again
140
+ - If `ready: true`, exit loop
141
+
142
+ Don't poll faster than every 5 seconds. Update the user every ~30 seconds so they know you haven't stalled.
143
+
144
+ ##### 5.3 — Present matters and collect picks
145
+
146
+ The state contains `matters[]`, each with `id`, `name`, and `questions[]`. Walk through them **one matter at a time**:
147
+
148
+ > **{matter.name}** — {matter.questions.length} discovery questions:
149
+ >
150
+ > 1. {question 1}
151
+ > 2. {question 2}
152
+ > ...
153
+ >
154
+ > Which should the agent investigate? Pick any subset, "all", or "skip" to skip this matter.
155
+
156
+ **[USER PAUSE]** Wait per matter.
157
+
158
+ ##### 5.4 — Commit picks per-matter
159
+
160
+ For each matter where the user picked at least one question, call `mcp__ritual__accept_discovery_questions` with:
161
+ - `state_id` (from the discovery state)
162
+ - `matter_id`
163
+ - `question_ids[]` (the picks for THIS matter)
164
+
165
+ This MUST be one call per matter — the API enforces per-matter atomicity. Don't bundle across matters.
166
+
167
+ ##### 5.5 — Optional: capture out-of-scope items
168
+
169
+ If the user mentioned things they DON'T want investigated ("don't touch enterprise SSO", "skip pricing"), capture them as anti-goals.
170
+
171
+ Call `mcp__ritual__set_anti_goals(exploration_id, [{ text, reason? }, ...])`.
172
+
173
+ Skip silently if no anti-goals were mentioned.
174
+
175
+ #### Phase 6 — Run the agentic pipeline
176
+
177
+ Call `mcp__ritual__start_agentic_run` with:
178
+ - `scope_type: 'exploration'`
179
+ - `exploration_id`
180
+
181
+ Returns `run_id`. Starts the full pipeline (sourcing → answers → recommendations) in the background. Typical runtime: 3-8 minutes.
182
+
183
+ Poll `mcp__ritual__get_agentic_run(run_id)` every 15 seconds. Show progress when it changes:
184
+
185
+ > Agentic run: {progress_pct}% — {current_step}
186
+
187
+ When `status` is `COMPLETED`: continue to Phase 7.
188
+ When `status` is `COMPLETED_WITH_ERRORS`: tell the user, but proceed — partial recommendations may still be useful.
189
+ When `status` is `FAILED`: surface the error message, ask if they want to retry (`start_agentic_run` again with same exploration_id) or stop.
190
+
191
+ If user wants to abort mid-flight: `mcp__ritual__cancel_agentic_run(run_id)`.
192
+
193
+ #### Phase 7 — Review and accept recommendations
194
+
195
+ Call `mcp__ritual__get_recommendations(exploration_id)`. Response is an array of recommendations with id, title, status, content, reasoning.
196
+
197
+ **[USER PAUSE]** Present as a numbered list with title + 1-line summary:
198
+
199
+ > {N} recommendations:
200
+ >
201
+ > 1. **{title}** — {one-line from content}
202
+ > 2. **{title}** — {one-line from content}
203
+ > ...
204
+ >
205
+ > Want detail on any of them? Or ready to accept the set?
206
+
207
+ If detail requested: show full `content` and `reasoning_chain` (if present). Loop until done.
208
+
209
+ When the user is ready:
210
+
211
+ **[USER PAUSE]** "Accept all and mark the exploration complete?"
212
+
213
+ If yes, call `mcp__ritual__accept_recommendations(exploration_id)`. Response includes counts (`promoted`, `alreadyApproved`, `skipped`, `transitionedToComplete`).
214
+
215
+ Show the final state:
216
+
217
+ > Done. {N} recommendations accepted. Exploration is now COMPLETE.
218
+ >
219
+ > View at: https://dev.ritualapp.cloud/e/{exploration_id}
220
+
221
+ ### Failure modes & recovery
222
+
223
+ **Discovery generation hangs (>5 min polling without `ready: true`)**: ask the user — wait longer? retry (`suggest_discovery_questions` again, new task)? or skip discovery entirely (proceed to Phase 6 without picked questions)?
224
+
225
+ **Agentic run fails or stalls**: surface the error, offer retry or stop.
226
+
227
+ **Discovery state ready=true with zero matters**: rare but possible if the LLM produced a malformed state. Retry by calling `suggest_discovery_questions` again.
228
+
229
+ **LLM-cost / quota errors (HTTP 429)**: tell the user explicitly. Do NOT auto-retry — quota issues need a human decision (different model tier, wait, top up).
230
+
231
+ ### Tools used
232
+
233
+ This subcommand exclusively uses vNext MCP tools, in the order they appear:
234
+
235
+ 1. `mcp__ritual__list_workspaces` (Phase 1)
236
+ 2. `mcp__ritual__generate_considerations` (Phase 2)
237
+ 3. `mcp__ritual__generate_problem_statement` (Phase 3)
238
+ 4. `mcp__ritual__create_exploration` (Phase 4)
239
+ 5. `mcp__ritual__suggest_discovery_questions` (Phase 5.1)
240
+ 6. `mcp__ritual__get_discovery_state` (Phase 5.2)
241
+ 7. `mcp__ritual__accept_discovery_questions` (Phase 5.4)
242
+ 8. `mcp__ritual__set_anti_goals` (Phase 5.5, optional)
243
+ 9. `mcp__ritual__start_agentic_run` (Phase 6)
244
+ 10. `mcp__ritual__get_agentic_run` (Phase 6 polling)
245
+ 11. `mcp__ritual__cancel_agentic_run` (Phase 6, only on user abort)
246
+ 12. `mcp__ritual__get_recommendations` (Phase 7)
247
+ 13. `mcp__ritual__accept_recommendations` (Phase 7)
248
+
249
+ 13 of the 19 vNext tools. The other 6 (`ping`, `get_exploration`, `list_templates`, `list_agentic_runs`, `add_collaborator`, `check_anti_goals`) are situational, not part of the linear build flow.
250
+
251
+ ### After this subcommand
252
+
253
+ When `/ritual build` completes, the exploration is in COMPLETE state with accepted recommendations. Downstream:
254
+
255
+ 1. `/ritual-builder-spec <feature description>` — generates a build brief from the recommendations + a codebase-grounded plan
256
+ 2. `/ritual-build <feature description>` (legacy variant from `@ritual-ai/cli`) — implements the plan, commits per logical unit, drafts a PR description
257
+
258
+ Naming overlap note: the legacy `/ritual-build` (in the public CLI package) is the *implementation* skill — feature description → committed code. This new `/ritual build` is the *exploration* skill — problem statement → accepted recommendations. Different scopes, similar names. Future cleanup may align them.
259
+
260
+ ---
261
+
262
+ ## /ritual run, /ritual status, /ritual recs
263
+
264
+ Not yet built. When they are, add a `## /ritual <name>` section to this file and update the routing table at the top.
265
+
266
+ Conceptual scope (when built):
267
+ - `/ritual run <exploration_id>` — kick off agentic run on an existing exploration, poll, present recommendations. Subset of `build` starting at Phase 6.
268
+ - `/ritual status <id>` — quick status check on an exploration or run. No interaction.
269
+ - `/ritual recs <exploration_id>` — fetch + present recommendations. No interaction.
270
+
271
+ For now, if the user asks for these, tell them politely: "That subcommand isn't built yet — for status, use `mcp__ritual__get_exploration` directly; for recs, use `mcp__ritual__get_recommendations` directly."