@ritualai/cli 0.6.0 → 0.7.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 (71) hide show
  1. package/README.md +45 -16
  2. package/dist/index.js +0 -0
  3. package/dist/lib/oidc.js +60 -3
  4. package/dist/lib/oidc.js.map +1 -1
  5. package/package.json +73 -64
  6. package/skills/claude-code/ritual/DESIGN.md +35 -0
  7. package/skills/claude-code/ritual/SKILL.md +43 -370
  8. package/skills/claude-code/ritual/agents/openai.yaml +5 -0
  9. package/skills/claude-code/ritual/references/async-polling.md +26 -0
  10. package/skills/claude-code/ritual/references/build-flow.md +1449 -0
  11. package/skills/claude-code/ritual/references/cli-output-contract.md +135 -0
  12. package/skills/claude-code/ritual/references/context-pulse-flow.md +356 -0
  13. package/skills/claude-code/ritual/references/discovery-classification.md +175 -0
  14. package/skills/claude-code/ritual/references/lineage-flow.md +152 -0
  15. package/skills/claude-code/ritual/references/resume-flow.md +156 -0
  16. package/skills/claude-code/ritual/references/scoring-fallback.md +125 -0
  17. package/skills/codex/ritual/DESIGN.md +35 -0
  18. package/skills/codex/ritual/SKILL.md +43 -370
  19. package/skills/codex/ritual/agents/openai.yaml +5 -0
  20. package/skills/codex/ritual/references/async-polling.md +26 -0
  21. package/skills/codex/ritual/references/build-flow.md +1449 -0
  22. package/skills/codex/ritual/references/cli-output-contract.md +135 -0
  23. package/skills/codex/ritual/references/context-pulse-flow.md +356 -0
  24. package/skills/codex/ritual/references/discovery-classification.md +175 -0
  25. package/skills/codex/ritual/references/lineage-flow.md +152 -0
  26. package/skills/codex/ritual/references/resume-flow.md +156 -0
  27. package/skills/codex/ritual/references/scoring-fallback.md +125 -0
  28. package/skills/cursor/ritual/DESIGN.md +35 -0
  29. package/skills/cursor/ritual/SKILL.md +43 -370
  30. package/skills/cursor/ritual/agents/openai.yaml +5 -0
  31. package/skills/cursor/ritual/references/async-polling.md +26 -0
  32. package/skills/cursor/ritual/references/build-flow.md +1449 -0
  33. package/skills/cursor/ritual/references/cli-output-contract.md +135 -0
  34. package/skills/cursor/ritual/references/context-pulse-flow.md +356 -0
  35. package/skills/cursor/ritual/references/discovery-classification.md +175 -0
  36. package/skills/cursor/ritual/references/lineage-flow.md +152 -0
  37. package/skills/cursor/ritual/references/resume-flow.md +156 -0
  38. package/skills/cursor/ritual/references/scoring-fallback.md +125 -0
  39. package/skills/gemini/ritual/DESIGN.md +35 -0
  40. package/skills/gemini/ritual/SKILL.md +43 -370
  41. package/skills/gemini/ritual/agents/openai.yaml +5 -0
  42. package/skills/gemini/ritual/references/async-polling.md +26 -0
  43. package/skills/gemini/ritual/references/build-flow.md +1449 -0
  44. package/skills/gemini/ritual/references/cli-output-contract.md +135 -0
  45. package/skills/gemini/ritual/references/context-pulse-flow.md +356 -0
  46. package/skills/gemini/ritual/references/discovery-classification.md +175 -0
  47. package/skills/gemini/ritual/references/lineage-flow.md +152 -0
  48. package/skills/gemini/ritual/references/resume-flow.md +156 -0
  49. package/skills/gemini/ritual/references/scoring-fallback.md +125 -0
  50. package/skills/kiro/ritual/DESIGN.md +35 -0
  51. package/skills/kiro/ritual/SKILL.md +43 -370
  52. package/skills/kiro/ritual/agents/openai.yaml +5 -0
  53. package/skills/kiro/ritual/references/async-polling.md +26 -0
  54. package/skills/kiro/ritual/references/build-flow.md +1449 -0
  55. package/skills/kiro/ritual/references/cli-output-contract.md +135 -0
  56. package/skills/kiro/ritual/references/context-pulse-flow.md +356 -0
  57. package/skills/kiro/ritual/references/discovery-classification.md +175 -0
  58. package/skills/kiro/ritual/references/lineage-flow.md +152 -0
  59. package/skills/kiro/ritual/references/resume-flow.md +156 -0
  60. package/skills/kiro/ritual/references/scoring-fallback.md +125 -0
  61. package/skills/vscode/ritual/DESIGN.md +35 -0
  62. package/skills/vscode/ritual/SKILL.md +43 -370
  63. package/skills/vscode/ritual/agents/openai.yaml +5 -0
  64. package/skills/vscode/ritual/references/async-polling.md +26 -0
  65. package/skills/vscode/ritual/references/build-flow.md +1449 -0
  66. package/skills/vscode/ritual/references/cli-output-contract.md +135 -0
  67. package/skills/vscode/ritual/references/context-pulse-flow.md +356 -0
  68. package/skills/vscode/ritual/references/discovery-classification.md +175 -0
  69. package/skills/vscode/ritual/references/lineage-flow.md +152 -0
  70. package/skills/vscode/ritual/references/resume-flow.md +156 -0
  71. package/skills/vscode/ritual/references/scoring-fallback.md +125 -0
@@ -1,398 +1,71 @@
1
1
  ---
2
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')"
3
+ description: "Use when an engineer wants a coding agent to plan or build a feature, refactor, or implementation-heavy change that depends on context the agent can't infer on its own — strategic intent, constraints, prior decisions, and trade-offs that live in the user's head. Ritual runs a structured exploration to surface that context through targeted discovery questions, combines it with codebase signals and prior explorations, and delivers a validated build brief (sub-problems, recommendations, dependencies) before the agent writes code. Prefer this over jumping straight to implementation when the problem is ambiguous, cross-cutting, or has non-obvious constraints. Subcommands: build (full planning-to-sync cycle — default for new features), resume (continue an in-flight exploration), lineage (file-path KG history — what decisions shaped this code), context-pulse (readiness and context-debt scoring — is this safe to build yet?)."
4
+ argument-hint: "[subcommand] <args> (e.g. 'build Reduce T2 churn in Q3', 'resume', 'lineage src/checkout/views.py', 'context-pulse Add billing export')"
5
5
  user-invocable: true
6
6
  ---
7
7
 
8
8
  # /ritual
9
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.
10
+ Top-level dispatcher for Ritual coding-agent workflows. Designed primarily for Claude Code-style sessions with filesystem, git, shell, and MCP access; adapt commands as needed for Cursor or other agents with equivalent tools.
11
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 — 9 phases (Phase 8 happens after the engineer ships the work)
55
-
56
- Each phase has explicit **[USER PAUSE]** points — never skip them.
57
-
58
- #### Phase 1 — Pick a workspace
59
-
60
- Resolution order:
61
-
62
- 1. **Project-bound workspace (preferred).** Check for a `.ritual/config.json` at the project root (you can use the Read tool — the file is a small JSON with `workspaceId` + `workspaceName`). If it exists, that's the workspace this repo is bound to. Surface it to the user: "Using workspace **`{workspaceName}`** (bound to this repo). Sound right?" — wait for **[USER PAUSE]**.
63
- 2. **List existing project workspaces.** If no `.ritual/config.json`, call `mcp__ritual__list_workspaces` — this returns project-type workspaces (the General workspace is excluded by default; agents never use it). Present as a numbered list (id, name). **[USER PAUSE]** for selection.
64
- 3. **Create a new one if none exist or user wants a fresh one.** Call `mcp__ritual__create_workspace` with a name — convention is to name it after the repo (basename of cwd, or origin remote). Confirm the name with the user first. **[USER PAUSE]**
65
-
66
- Store `workspace_id` for the rest of the flow.
67
-
68
- If you created a new workspace, suggest the user run `ritual init` to persist the binding into `.ritual/config.json` for next time (or write it yourself if the user is in a Claude Code session that can edit files).
69
-
70
- #### Phase 1.5 — Code reconnaissance
71
-
72
- **Skip only if the user explicitly asks ("just generate, don't read the code") OR if you're operating outside a codebase context.**
73
-
74
- Before generating considerations, do a structured scan of the codebase so the sub-problems land specific to *this* code, not generic. The legacy system shipped considerations that read like a textbook table of contents because it skipped this step; the difference between "Conversion Timing, Trust Signals, Recovery Paths" (generic) and "Leverage `apps/checkout/session.py` anonymous-checkout path vs. adding a new step in `CheckoutSessionMixin`" (codebase-specific) is whether you did Phase 1.5.
75
-
76
- Steps:
77
-
78
- 1. **Read the README + top-level project structure.** Use `ls` / Glob to see top-level files (5–10 lines). Identify the language, framework, key directories.
79
-
80
- 2. **Glob for relevance.** Derive patterns from the user's problem. Examples:
81
- - User says "auth flow" → `**/auth/**`, `**/login*`, `**/user*`, `**/session*`
82
- - User says "checkout" → `**/checkout/**`, `**/cart/**`, `**/order/**`, `**/payment*`
83
- - User says "notifications" → `**/notif*`, `**/email/**`, `**/sms/**`, `**/push/**`
84
- Cap at ~15 hits per pattern.
85
-
86
- 3. **Skim 3–5 most-relevant files.** For each, read the first ~100 lines + scan for class/function names. Triangulate: "is the behavior we care about actually here, or does it call into somewhere else?"
87
-
88
- 4. **Build a recon summary** — 5–10 lines, concrete file paths, key abstractions, observed constraints. Examples of GOOD summaries:
89
-
90
- > Codebase recon (django-oscar, Django 5.0):
91
- > - Booking flow lives in `apps/checkout/views.py` (`CheckoutSessionMixin` orchestrates the step chain)
92
- > - Anonymous checkout already supported via `apps/checkout/session.py:CheckoutSessionData`
93
- > - Account creation entry point: `apps/customer/forms.py:RegisterUserForm`
94
- > - Strategy classes (`apps/partner/strategy.py`) are the conventional pluggability pattern
95
- > - User-model split: `auth.User` is the Django auth user; `apps/customer/models.py:Customer` is the order-attached profile — they can be linked or anonymous
96
-
97
- 5. **Surface to the user as a [USER PAUSE]**:
98
-
99
- > Reading the codebase I see:
100
- > <recon summary>
101
- >
102
- > Anything I'm missing about design intent or constraints I won't find by reading the code (e.g. business decisions, prod incidents, in-flight migrations)?
103
-
104
- Wait for confirmation or additional context. The user's reply (if any) becomes part of the input to Phase 2.
105
-
106
- 6. **Compose the augmented `raw_input` for Phase 2.** Concatenate:
107
- - The user's original problem (verbatim, top)
108
- - A `--- Codebase context ---` section with the recon summary
109
- - The user's reply from step 5 if non-empty
110
- - Phase 1.5 IS the difference between "generic considerations" and "considerations that name actual files and reference existing patterns". Don't skip the recon step. Don't compress the summary to one line.
111
-
112
- 7. **Collect the `sources` array.** The file paths you read in step 3 — exactly as they appear in the repo (e.g. `"apps/checkout/views.py"`, NOT `"./apps/checkout/views.py"` or absolute paths). This list is passed alongside `raw_input` to `generate_considerations` and `generate_problem_statement` so the API can auto-inject **prior knowledge-graph context** for overlapping files. Keep the list focused — only files you actually read and consider load-bearing for this problem. 5–10 is the sweet spot; >20 dilutes the KG signal.
113
-
114
- **[USER PAUSE]** confirmation of recon is required before proceeding.
115
-
116
- #### Phase 2 — Generate sub-problems
117
-
118
- ##### 2.1 First draft
119
-
120
- Call `mcp__ritual__generate_considerations` with:
121
- - `workspace_id`
122
- - `raw_input` (the user's problem + the Phase 1.5 codebase recon, concatenated as described above)
123
- - `template_id` (omit unless the user specified one)
124
- - `sources` (the file path list from Phase 1.5 step 7 — file-path strings only, e.g. `["apps/checkout/views.py", ...]`)
125
-
126
- LLM call, ~5–10s. Returns 5–6 sub-problems — different framing axes the agent should investigate. Track each one as `{ text, version: 1 }` in your working memory.
127
-
128
- **If the response includes `kg_context_used` with `implementationCount > 0`:** surface this to the user BEFORE presenting the considerations. It's the visible signal that prior team decisions shaped this draft.
129
-
130
- > Reading the codebase I overlapped with 3 prior Ritual explorations on these files:
131
- > - **"Anonymous checkout opt-in"** (shipped 2026-04-12) — 2 decisions, 1 deferral
132
- > - **"Payment-method routing"** (shipped 2026-03-22) — 4 decisions
133
- > - **"Session-data persistence"** (shipped 2026-02-08) — 1 decision
134
- >
135
- > I factored those into the sub-problems below.
136
-
137
- If `implementationCount === 0`: don't mention the KG check (silent — would just be noise on a cold KG).
138
-
139
- **[USER PAUSE]** Present as a numbered list and ask which to include:
140
-
141
- > Sub-problems the system identified (v1):
142
- >
143
- > 1. {sub-problem 1}
144
- > 2. {sub-problem 2}
145
- > ...
146
- >
147
- > Which should we factor into the scope? Pick any subset, "all", or ask for a different framing (e.g. "make them more technical", "drop the measurement angle", "focus on enterprise").
148
-
149
- ##### 2.2 Iteration loop
150
-
151
- If the user asks for a refinement (anything that isn't "all" / specific picks / "these are good"):
152
-
153
- Call `mcp__ritual__refine_considerations` with:
154
- - `workspace_id`, `raw_input`, `template_id`, `sources` — unchanged from the generate call. Critical: pass the SAME `sources` array each iteration so the KG-injected priorContext stays consistent.
155
- - `change_prompt`: the user's request verbatim
156
- - `selected`: items from prior versions the user kept (track `{ text, from_version }`, send just `text`)
157
- - `dismissed`: items the user explicitly rejected
158
- - `session_id`: omitted on the first refinement; pass the `session_id` from the previous refine response on subsequent ones to chain context
159
-
160
- Track the new items as `{ text, version: N+1 }`. Present **alongside** the prior versions, not replacing them — the user can mix selections across versions.
161
-
162
- Loop until the user says "these are good" or picks a subset.
163
-
164
- **Critical**: never re-call `generate_considerations` for a refinement. That endpoint is stateless and re-rolls a fresh seed; you'll lose what the user just told you. The whole point of `refine_*` is the LLM sees the iteration context.
165
-
166
- Store the final picked sub-problems for Phase 3 — they go into `considerations[]`.
167
-
168
- #### Phase 3 — Generate scope
169
-
170
- ##### 3.1 First draft
171
-
172
- Call `mcp__ritual__generate_problem_statement` with:
173
- - `workspace_id`
174
- - `raw_input` (same augmented version from Phase 2)
175
- - `considerations` (the picks from Phase 2)
176
- - `template_id` (same as Phase 2 if used)
177
- - `sources` (the same file-path list passed to generate_considerations — keeps the KG anchor consistent)
178
-
179
- Returns a polished "How might we ..." style scope (typically <800 chars) plus optional follow-up questions and quality scores. Treat this as **v1** of the problem statement.
180
-
181
- If the response includes `kg_context_used` with `implementationCount > 0`, prepend a note to the scope presentation:
182
-
183
- > *(Grounded in {N} prior implementation{s}: {top match name}, …)*
12
+ ## Always apply
184
13
 
185
- **[USER PAUSE]** Present and ask:
14
+ Before executing any subcommand, read and follow:
186
15
 
187
- > Here's the scope (v1):
188
- >
189
- > > **{generated scope}**
190
- >
191
- > Looks good? Want to tighten / broaden / change the audience / focus on a specific tier? Or "ship it" to lock it in.
16
+ - `references/cli-output-contract.md` terminal output, vocabulary, readability, pause policy
17
+ - `references/async-polling.md` — harness-safe polling and timeout recovery
192
18
 
193
- ##### 3.2 Iteration loop
19
+ Do not reintroduce `/ritual recon`. Use plain-language repo inspection, `/ritual resume`, or `/ritual lineage` depending on intent.
194
20
 
195
- If the user asks for a refinement:
196
-
197
- Call `mcp__ritual__refine_problem_statement` with:
198
- - `workspace_id`, `raw_input`, `considerations`, `template_id`, `sources` — unchanged. (Same `sources` as the original generate call — keeps the KG anchor stable.)
199
- - `previous_problem_statement`: the FULL TEXT of the current best draft (the v1 you just showed)
200
- - `change_prompt`: the user's request verbatim ("tighten and drop the audience clause")
201
- - `version`: optional label like `"v2"` — purely for telemetry
202
- - `session_id`: omitted on the first refinement; chain on subsequent ones
203
-
204
- The returned text becomes `v2`. Show it. The user can iterate v2 → v3 → ... by calling refine again with `previous_problem_statement` set to the latest draft.
205
-
206
- **Critical**: each refinement's `previous_problem_statement` is the LATEST draft, not the original v1. Otherwise the LLM keeps refining the same starting point and the user can't compose multiple refinements ("tighter, AND drop the audience clause, AND make it past-tense").
207
-
208
- When the user accepts ("ship it" / "looks good"), store the final text as `problem_statement` for Phase 4.
209
-
210
- #### Phase 4 — Create the exploration
211
-
212
- 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)`.
213
-
214
- **[USER PAUSE]** "I'll create the exploration as **T2 churn reduction (Q3)**. Proceed?"
215
-
216
- Call `mcp__ritual__create_exploration` with:
217
- - `workspace_id`
218
- - `name`
219
- - `problem_statement` (the scope from Phase 3)
220
- - `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.
221
-
222
- Store `exploration_id`. Show the URL:
223
-
224
- > Exploration created. Track progress at https://dev.ritualapp.cloud/e/{exploration_id}
225
-
226
- #### Phase 5 — Discovery questions
227
-
228
- Longest phase because generation is async + the user picks per-matter.
229
-
230
- ##### 5.1 — Kick off
231
-
232
- Call `mcp__ritual__suggest_discovery_questions(exploration_id)`. Returns immediately with `task_id`. Tell the user:
233
-
234
- > Generating discovery questions for each matter… 30-120 seconds.
235
-
236
- ##### 5.2 — Poll until ready
237
-
238
- Loop:
239
- - Call `mcp__ritual__get_discovery_state(exploration_id)`
240
- - If `ready: false`, wait 5 seconds, poll again
241
- - If `ready: true`, exit loop
242
-
243
- Don't poll faster than every 5 seconds. Update the user every ~30 seconds so they know you haven't stalled.
244
-
245
- ##### 5.3 — Present matters and collect picks
246
-
247
- The state contains `matters[]`, each with `id`, `name`, and `questions[]`. Walk through them **one matter at a time**:
248
-
249
- > **{matter.name}** — {matter.questions.length} discovery questions:
250
- >
251
- > 1. {question 1}
252
- > 2. {question 2}
253
- > ...
254
- >
255
- > Which should the agent investigate? Pick any subset, "all", or "skip" to skip this matter.
256
-
257
- **[USER PAUSE]** Wait per matter.
258
-
259
- ##### 5.4 — Commit picks per-matter
260
-
261
- For each matter where the user picked at least one question, call `mcp__ritual__accept_discovery_questions` with:
262
- - `state_id` (from the discovery state)
263
- - `matter_id`
264
- - `question_ids[]` (the picks for THIS matter)
265
-
266
- This MUST be one call per matter — the API enforces per-matter atomicity. Don't bundle across matters.
267
-
268
- ##### 5.5 — Optional: capture out-of-scope items
269
-
270
- If the user mentioned things they DON'T want investigated ("don't touch enterprise SSO", "skip pricing"), capture them as anti-goals.
271
-
272
- Call `mcp__ritual__set_anti_goals(exploration_id, [{ text, reason? }, ...])`.
273
-
274
- Skip silently if no anti-goals were mentioned.
275
-
276
- #### Phase 6 — Run the agentic pipeline
277
-
278
- Call `mcp__ritual__start_agentic_run` with:
279
- - `scope_type: 'exploration'`
280
- - `exploration_id`
281
-
282
- Returns `run_id`. Starts the full pipeline (sourcing → answers → recommendations) in the background. Typical runtime: 3-8 minutes.
283
-
284
- Poll `mcp__ritual__get_agentic_run(run_id)` every 15 seconds. Show progress when it changes:
285
-
286
- > Agentic run: {progress_pct}% — {current_step}
287
-
288
- When `status` is `COMPLETED`: continue to Phase 7.
289
- When `status` is `COMPLETED_WITH_ERRORS`: tell the user, but proceed — partial recommendations may still be useful.
290
- When `status` is `FAILED`: surface the error message, ask if they want to retry (`start_agentic_run` again with same exploration_id) or stop.
291
-
292
- If user wants to abort mid-flight: `mcp__ritual__cancel_agentic_run(run_id)`.
293
-
294
- #### Phase 7 — Review and accept recommendations
295
-
296
- Call `mcp__ritual__get_recommendations(exploration_id)`. Response is an array of recommendations with id, title, status, content, reasoning.
297
-
298
- **[USER PAUSE]** Present as a numbered list with title + 1-line summary:
299
-
300
- > {N} recommendations:
301
- >
302
- > 1. **{title}** — {one-line from content}
303
- > 2. **{title}** — {one-line from content}
304
- > ...
305
- >
306
- > Want detail on any of them? Or ready to accept the set?
307
-
308
- If detail requested: show full `content` and `reasoning_chain` (if present). Loop until done.
309
-
310
- When the user is ready:
311
-
312
- **[USER PAUSE]** "Accept all and mark the exploration complete?"
313
-
314
- If yes, call `mcp__ritual__accept_recommendations(exploration_id)`. Response includes counts (`promoted`, `alreadyApproved`, `skipped`, `transitionedToComplete`).
315
-
316
- Show the final state:
317
-
318
- > Done. {N} recommendations accepted. Exploration is now COMPLETE.
319
- >
320
- > View at: https://dev.ritualapp.cloud/e/{exploration_id}
321
-
322
- #### Phase 8 — After shipping: close the loop with `sync_implementation`
323
-
324
- This phase happens *outside* the `/ritual build` chat — after the engineer has taken the accepted recommendations into their coding work and the implementation has actually landed (PR merged, etc.). The agent in that follow-up session should call `mcp__ritual__sync_implementation` to register what shipped, which decisions were made, and what was deliberately deferred.
325
-
326
- When sync_implementation succeeds, the response now includes:
327
-
328
- - `decisions: [{ decisionId, area, choice }, ...]` — IDs of every architectural decision logged
329
- - `deferrals: [{ deferralId, rbId, severity }, ...]` — IDs of every deferral
330
- - `decisionsCount`, `deferralsCount` — totals for the summary line
331
- - `webUrl` — clickable link to the exploration's implementation record in the web UI
332
-
333
- **Surface ALL of this to the user**, not just "ok logged." This is the visible signal that the loop closed. Format:
334
-
335
- > ✓ Logged implementation for **{exploration name}**
336
- > - {decisionsCount} decision{s} registered: {first 2 decisions, e.g. "auth: OAuth not SAML; data-model: tenant-scoped indexes"}
337
- > - {deferralsCount} deferral{s} registered: {first 1, e.g. "[major] Rate-limit per-tenant — out of scope for v1"}
338
- > - View: {webUrl}
339
- >
340
- > Future `/ritual build` calls touching `{first 2 of filesChanged}` will now see this implementation in their priorContext block.
341
-
342
- The closing sentence is the most important one: it tells the user **what just happened in the system** in product-level terms. Without it, sync_implementation feels like a write-only black hole. With it, the user understands they just contributed to the workspace's memory.
343
-
344
- If they want to check the state at any time, point them at:
345
-
346
- > `ritual graph status` (in their CLI) — shows the workspace's current KG counts + recent implementations.
347
-
348
- ### Failure modes & recovery
349
-
350
- **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)?
21
+ ## Routing
351
22
 
352
- **Agentic run fails or stalls**: surface the error, offer retry or stop.
23
+ Parse the first token of the argument:
353
24
 
354
- **Discovery state ready=true with zero matters**: rare but possible if the LLM produced a malformed state. Retry by calling `suggest_discovery_questions` again.
25
+ | First token | Route to | One-liner |
26
+ |---|---|---|
27
+ | `build` | `references/build-flow.md` | Free-form problem → recommendations → build brief → code → sync. The full cycle. |
28
+ | `resume` | `references/resume-flow.md` | "Pick up where I left off." Lists in-flight explorations with state badges and jumps to the right step. |
29
+ | `lineage` | `references/lineage-flow.md` | Paste a file path (or set of paths); see every prior exploration / decision / deferral that touched those files. |
30
+ | `context-pulse` | `references/context-pulse-flow.md` | Score readiness / context debt for a feature ask or exploration. Can seed a `CONTEXT-<feature>.md` file with relevant codebase + KG context that `/ritual build` picks up automatically. Also surfaces inline during build so the user watches debt drop. |
31
+ | (anything else, OR no subcommand) | default to `build` and treat the entire argument as the problem statement | |
355
32
 
356
- **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).
33
+ The vNext CLI surface is intentionally **just these four**. Legacy exposed `explore`, `run`, `brief`, `gate`, `spec`, `questions`, `gherkin`, `status`, `recs` — all of which mapped 1:1 to MCP tool calls and provided no agent-CLI value over plain English. We don't replicate them; the agent can call any MCP tool directly when the user asks for "the recs on exp-X" or "status of exp-Y". (`/ritual recon` shipped briefly in PR #174 as a fifth command — retired in this PR because its unique value duplicated `/ritual resume` (workspace history) + `/ritual lineage` (decisions on files), and its non-duplicate parts (map repo, trace flow, explain file) are exactly what the agent does fluently in plain English without needing a SKILL-defined menu.)
357
34
 
358
- ### Tools used
359
35
 
360
- This subcommand exclusively uses vNext MCP tools, in the order they appear:
36
+ ## Subcommand reference files
361
37
 
362
- 1. `mcp__ritual__list_workspaces` (Phase 1)
363
- 2. `mcp__ritual__generate_considerations` (Phase 2)
364
- 3. `mcp__ritual__generate_problem_statement` (Phase 3)
365
- 4. `mcp__ritual__create_exploration` (Phase 4)
366
- 5. `mcp__ritual__suggest_discovery_questions` (Phase 5.1)
367
- 6. `mcp__ritual__get_discovery_state` (Phase 5.2)
368
- 7. `mcp__ritual__accept_discovery_questions` (Phase 5.4)
369
- 8. `mcp__ritual__set_anti_goals` (Phase 5.5, optional)
370
- 9. `mcp__ritual__start_agentic_run` (Phase 6)
371
- 10. `mcp__ritual__get_agentic_run` (Phase 6 polling)
372
- 11. `mcp__ritual__cancel_agentic_run` (Phase 6, only on user abort)
373
- 12. `mcp__ritual__get_recommendations` (Phase 7)
374
- 13. `mcp__ritual__accept_recommendations` (Phase 7)
38
+ Load only the reference file needed for the selected subcommand:
375
39
 
376
- 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.
40
+ | Subcommand | Runtime file |
41
+ |---|---|
42
+ | `build` | `references/build-flow.md` |
43
+ | `resume` | `references/resume-flow.md` |
44
+ | `lineage` | `references/lineage-flow.md` |
45
+ | `context-pulse` | `references/context-pulse-flow.md` |
377
46
 
378
- ### After this subcommand
47
+ Additional runtime references:
379
48
 
380
- When `/ritual build` completes, the exploration is in COMPLETE state with accepted recommendations. Downstream:
49
+ - `references/discovery-classification.md` only when build question picking triggers scope classification
50
+ - `references/scoring-fallback.md` — only if `mcp__ritual__score_context_pulse` is unavailable or errors
381
51
 
382
- 1. `/ritual-builder-spec <feature description>` — generates a build brief from the recommendations + a codebase-grounded plan
383
- 2. `/ritual-build <feature description>` (legacy variant from `@ritual-ai/cli`) — implements the plan, commits per logical unit, drafts a PR description
52
+ ## Routing behavior
384
53
 
385
- 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.
54
+ - If the first token is one of the four subcommands, load the matching runtime file and follow it.
55
+ - If there is no subcommand or the token is unknown, default to `build` and treat the full argument as the problem statement.
56
+ - If the user asks for retired or unsupported subcommands, answer in plain English and call the relevant MCP tool directly when appropriate; do not expand the slash-command surface.
386
57
 
387
- ---
58
+ ## Asks that don't map to a subcommand
388
59
 
389
- ## /ritual run, /ritual status, /ritual recs
60
+ When the user says things like *"what's the status of exp-X?"*, *"show me the recs on exp-Y"*, or *"kick off the agentic run on exp-Z"* — those don't need a dedicated slash-command. Just call the MCP tool directly:
390
61
 
391
- Not yet built. When they are, add a `## /ritual <name>` section to this file and update the routing table at the top.
62
+ | User asks for… | Call this MCP tool |
63
+ |---|---|
64
+ | Status of one exploration | `mcp__ritual__get_exploration(exploration_id)` |
65
+ | Status across many explorations | `mcp__ritual__list_explorations(workspace_id)` (returns state badges) |
66
+ | The recommendations on an exploration | `mcp__ritual__get_recommendations(exploration_id)` |
67
+ | Kick off / re-run the agentic pipeline | `mcp__ritual__start_agentic_run(exploration_id, …)` |
68
+ | Did anyone implement something on these files? | `mcp__ritual__query_knowledge_graph(sources=[…])` — same plumbing as `/ritual lineage` |
392
69
 
393
- Conceptual scope (when built):
394
- - `/ritual run <exploration_id>` — kick off agentic run on an existing exploration, poll, present recommendations. Subset of `build` starting at Phase 6.
395
- - `/ritual status <id>` — quick status check on an exploration or run. No interaction.
396
- - `/ritual recs <exploration_id>` — fetch + present recommendations. No interaction.
70
+ This is intentional. Legacy exposed each of these as its own slash-command (`/ritual status`, `/ritual recs`, `/ritual run`) and the surface area ballooned without adding agent value. In vNext we keep the slash-commands narrow (`build`, `resume`, `lineage`, `context-pulse`) and let the agent fluently call MCP tools for everything else. Do not reintroduce `/ritual recon`: its former workspace-history value is covered by `/ritual resume`; its file-decision-history value is covered by `/ritual lineage`; and repo-reading behaviors are normal coding-agent behavior in plain English.
397
71
 
398
- 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,5 @@
1
+ interface:
2
+ display_name: Ritual
3
+ short_description: Plan and build implementation-heavy changes with Ritual context, discovery, build briefs, lineage, and context-pulse scoring.
4
+ icon: 🪷
5
+ color: "#7C3AED"
@@ -0,0 +1,26 @@
1
+ # Async polling contract
2
+
3
+ Use this for every long-running Ritual/MCP operation: discovery generation, agentic runs, requirement generation, build brief generation, and future async status surfaces.
4
+
5
+ ## Standard poll loop
6
+
7
+ - Use a single `Bash sleep 5` per poll iteration.
8
+ - Do not chain sleeps (`sleep 5; sleep 5`).
9
+ - Do not use `sleep >= 30`.
10
+ - Between polls, take a fresh turn: sleep, call status, decide continue/exit.
11
+ - Print progress only when status/progress/current_step changes, or every ~3 polls (~15s).
12
+ - Keep updates to one line unless an error occurs.
13
+
14
+ ## Long waits
15
+
16
+ For genuinely long waits (>5 minutes), use the harness's `Monitor` tool with an `until <check>; do sleep 2; done` pattern rather than the standard poll loop.
17
+
18
+ ## Timeout recovery
19
+
20
+ If a write/generate call times out locally but server-side work may still be running, do not blindly regenerate. Call the matching status tool first and poll:
21
+
22
+ - `get_requirement_set_status` after requirement generation
23
+ - `get_build_brief_status` after build brief generation
24
+ - `get_agentic_run` after agentic run start/resume
25
+
26
+ Regenerate only when status proves work did not start, failed, or the user explicitly requests a fresh roll.