@ritualai/cli 0.7.5 → 0.7.6

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 (37) hide show
  1. package/package.json +1 -1
  2. package/skills/claude-code/ritual/manifest.json +57 -0
  3. package/skills/claude-code/ritual/references/build-flow.md +174 -105
  4. package/skills/claude-code/ritual/references/cli-output-contract.md +89 -0
  5. package/skills/claude-code/ritual/references/context-pulse-flow.md +1 -1
  6. package/skills/claude-code/ritual/references/lineage-flow.md +7 -6
  7. package/skills/claude-code/ritual/references/resume-flow.md +4 -4
  8. package/skills/codex/ritual/manifest.json +57 -0
  9. package/skills/codex/ritual/references/build-flow.md +174 -105
  10. package/skills/codex/ritual/references/cli-output-contract.md +89 -0
  11. package/skills/codex/ritual/references/context-pulse-flow.md +1 -1
  12. package/skills/codex/ritual/references/lineage-flow.md +7 -6
  13. package/skills/codex/ritual/references/resume-flow.md +4 -4
  14. package/skills/cursor/ritual/manifest.json +57 -0
  15. package/skills/cursor/ritual/references/build-flow.md +174 -105
  16. package/skills/cursor/ritual/references/cli-output-contract.md +89 -0
  17. package/skills/cursor/ritual/references/context-pulse-flow.md +1 -1
  18. package/skills/cursor/ritual/references/lineage-flow.md +7 -6
  19. package/skills/cursor/ritual/references/resume-flow.md +4 -4
  20. package/skills/gemini/ritual/manifest.json +57 -0
  21. package/skills/gemini/ritual/references/build-flow.md +174 -105
  22. package/skills/gemini/ritual/references/cli-output-contract.md +89 -0
  23. package/skills/gemini/ritual/references/context-pulse-flow.md +1 -1
  24. package/skills/gemini/ritual/references/lineage-flow.md +7 -6
  25. package/skills/gemini/ritual/references/resume-flow.md +4 -4
  26. package/skills/kiro/ritual/manifest.json +57 -0
  27. package/skills/kiro/ritual/references/build-flow.md +174 -105
  28. package/skills/kiro/ritual/references/cli-output-contract.md +89 -0
  29. package/skills/kiro/ritual/references/context-pulse-flow.md +1 -1
  30. package/skills/kiro/ritual/references/lineage-flow.md +7 -6
  31. package/skills/kiro/ritual/references/resume-flow.md +4 -4
  32. package/skills/vscode/ritual/manifest.json +57 -0
  33. package/skills/vscode/ritual/references/build-flow.md +174 -105
  34. package/skills/vscode/ritual/references/cli-output-contract.md +89 -0
  35. package/skills/vscode/ritual/references/context-pulse-flow.md +1 -1
  36. package/skills/vscode/ritual/references/lineage-flow.md +7 -6
  37. package/skills/vscode/ritual/references/resume-flow.md +4 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ritualai/cli",
3
- "version": "0.7.5",
3
+ "version": "0.7.6",
4
4
  "description": "Ritual CLI — scaffold AI coding agent skills + register MCP servers. Connects Claude Code, Cursor, Windsurf, Kiro, Gemini CLI, VS Code/Copilot, and Codex to Ritual Cloud.",
5
5
  "private": false,
6
6
  "license": "Apache-2.0",
@@ -0,0 +1,57 @@
1
+ [
2
+ {
3
+ "path": "DESIGN.md",
4
+ "lines": 36,
5
+ "bytes": 2226
6
+ },
7
+ {
8
+ "path": "SKILL.md",
9
+ "lines": 72,
10
+ "bytes": 5915
11
+ },
12
+ {
13
+ "path": "agents/openai.yaml",
14
+ "lines": 6,
15
+ "bytes": 213
16
+ },
17
+ {
18
+ "path": "references/async-polling.md",
19
+ "lines": 27,
20
+ "bytes": 1197
21
+ },
22
+ {
23
+ "path": "references/build-flow.md",
24
+ "lines": 1519,
25
+ "bytes": 88142
26
+ },
27
+ {
28
+ "path": "references/cli-output-contract.md",
29
+ "lines": 225,
30
+ "bytes": 11559
31
+ },
32
+ {
33
+ "path": "references/context-pulse-flow.md",
34
+ "lines": 357,
35
+ "bytes": 25358
36
+ },
37
+ {
38
+ "path": "references/discovery-classification.md",
39
+ "lines": 176,
40
+ "bytes": 10275
41
+ },
42
+ {
43
+ "path": "references/lineage-flow.md",
44
+ "lines": 154,
45
+ "bytes": 8774
46
+ },
47
+ {
48
+ "path": "references/resume-flow.md",
49
+ "lines": 157,
50
+ "bytes": 9950
51
+ },
52
+ {
53
+ "path": "references/scoring-fallback.md",
54
+ "lines": 126,
55
+ "bytes": 6494
56
+ }
57
+ ]
@@ -101,12 +101,20 @@ Reply with:
101
101
  If there are **zero existing explorations** and `raw_input = null`, do not say "starting fresh" and do not advance to template selection yet. Ask for the feature/problem first:
102
102
 
103
103
  ```text
104
- No existing explorations in this workspace yet.
104
+ Ritual build
105
+ ● Context ○ Scope ○ Discovery ○ Recommendations ○ Build brief ○ Implementation
105
106
 
106
- What would you like to build or explore? Describe the feature/problem, or run
107
- `/ritual context-pulse <ask>` first if you want a readiness check before planning.
107
+ Using workspace: {workspaceName}.
108
+
109
+ No Ritual history here yet.
110
+
111
+ Next: start with a feature, or let Ritual suggest high-leverage work from the repo.
112
+
113
+ Reply with a feature/problem description, `suggest`, `pulse <ask>`, or `none`.
108
114
  ```
109
115
 
116
+ For `pulse <ask>`, route to `/ritual context-pulse <ask>`. Keep it as an optional side path; do not make context-pulse feel like the required first move for `/ritual build`.
117
+
110
118
  If the user replies `suggest` but the workspace has no prior explorations, explain that suggestions need prior workspace signal and ask for a feature/problem instead.
111
119
 
112
120
  #### Step 1.5 — Resume vs start (cognitive-debt check)
@@ -156,9 +164,9 @@ Steps:
156
164
  |---|---|---|---|
157
165
  | 📍 | `in_progress` | "still in discovery" | "Continue discovery" |
158
166
  | 💬 | `awaiting_admin` | "waiting on admin to accept recommendations" | "Show recommendations for admin review" |
159
- | ✅ | `ready` | "ready to implement" | "Generate the build brief and start coding" |
167
+ | ✅ | `ready` | "ready for build brief" | "Generate the build brief and continue to implementation" |
160
168
  | 🛠 | `in_flight` | "implementation in progress" | "Resume — generate or refresh the build brief on remaining work" |
161
- | ✓ | `done` | "fully shipped" | "Nothing to do here start a new exploration if this is new scope" |
169
+ | ✓ | `done` | "shipped with follow-ups" if open deferrals exist; otherwise "shipped context" | "Address follow-ups or use `/ritual lineage` if relevant. Hide fully complete shipped work by default." |
162
170
  | ⚠ | `implemented_ahead` | "code shipped before admin acceptance" | "Surface to user — ask admin to review the implementation against the un-accepted recs, or update the recs to match what shipped" |
163
171
 
164
172
  The `implemented_ahead` callout is load-bearing: it means a collaborator implemented a recommendation while it was still in `draft` or `pending_review`, and the snapshot column froze that timeline. The user (typically an admin) should know about this BEFORE you do anything else.
@@ -244,27 +252,27 @@ Steps:
244
252
 
245
253
  1. {candidate.title}
246
254
 
247
- {candidate.summary}
255
+ {candidate.summary}
248
256
 
249
- Why high-leverage:
250
- {candidate.rationale — cite the specific RB, deferral, prior decision, shipped PR, or file-level signal.}
257
+ Why high-leverage:
258
+ {candidate.rationale — cite the specific RB, deferral, prior decision, shipped PR, or file-level signal.}
251
259
 
252
- Touches:
253
- {referencesPriorWork — list exploration names/ids, PRs, RB ids, or deferrals. Wrap if long.}
260
+ Touches:
261
+ {referencesPriorWork — list exploration names/ids, PRs, RB ids, or deferrals. Wrap if long.}
254
262
 
255
263
 
256
264
  2. {candidate.title}
257
265
 
258
- {candidate.summary}
266
+ {candidate.summary}
259
267
 
260
- Why high-leverage:
261
- {candidate.rationale}
268
+ Why high-leverage:
269
+ {candidate.rationale}
262
270
 
263
- Touches:
264
- {referencesPriorWork}
271
+ Touches:
272
+ {referencesPriorWork}
265
273
 
266
274
 
267
- Pick 1, 2, 3, or 4. Or say none and describe what you want directly.
275
+ Reply with a number to lock that scope, `suggest` to regenerate candidates, or describe a different problem to start fresh.
268
276
  ```
269
277
 
270
278
  If one candidate would resume an existing in-flight exploration rather than create a duplicate, add a short note after the picker:
@@ -344,7 +352,8 @@ Resolution order:
344
352
  User-visible:
345
353
 
346
354
  > Template
347
- > Using **{templateName}** from `.ritual/config.json`.
355
+ > Using **{templateName}**, pinned in `.ritual/config.json`.
356
+ > Ritual will use this to turn the candidate into implementation-ready sub-problems, recommendations, and a build brief for the coding agent.
348
357
  > Override anytime with `template: list` or `template: {name}`.
349
358
 
350
359
  2. **Pick a recommended default + offer alternatives.** If no `.ritual/config.json` pin exists, call `mcp__ritual__list_templates`. From the response, pick the first template matching this fallback chain:
@@ -366,16 +375,16 @@ Resolution order:
366
375
 
367
376
  5. **Remember `template_id`.** It passes through every subsequent phase — `generate_considerations`, `refine_considerations`, `generate_problem_statement`, `refine_problem_statement`, and ultimately `create_exploration`. The API uses it to load template-specific anti-patterns + focus keywords into the LLM prompt, so it materially shapes output quality.
368
377
 
369
- 6. **Track role silently; surface only the operational default.** Infer `role` from the selected template and carry it forward for:
378
+ 6. **Track role silently.** Infer `role` from the selected template and carry it forward for:
370
379
  - recommendation tone
371
380
  - sibling exploration cap
372
381
  - Step 8 run-mode default
373
382
 
374
- Do **not** explain the inference or ask for role confirmation by default.
383
+ Do **not** explain the inference or ask for role confirmation by default. Do not print a happy-path line like "Defaulting to engineering flow."
375
384
 
376
- User-visible after the template is selected:
385
+ Only surface role when the template or task is ambiguous, or when the user asks how the flow is being biased. If needed, use one compact line:
377
386
 
378
- > Defaulting to **{role}** flow. Override with `role: product`, `role: design`, etc.
387
+ > Using **{role}** defaults. Override with `role: product` if needed.
379
388
 
380
389
  Recognized roles (use the role keyword the API returns, not a paraphrase):
381
390
  - `engineering` — code-aware, technical depth
@@ -572,11 +581,21 @@ Knowledge sources are a feature multiplier, not a mandatory gate. Ask for PRDs/t
572
581
  - the feature has legal, privacy, billing, permissions, enterprise, analytics, migration, or compliance constraints,
573
582
  - code recon found implementation surfaces but not product intent.
574
583
 
575
- When triggered, surface a single ask (CLI Tenet #2 one recommended action with a cheap escape):
584
+ When triggered, frame references as an optional booster, not a mandatory phase. The happy path is to continue. Render this prompt:
585
+
586
+ ```text
587
+ Optional: add non-code context before scope generation.
588
+
589
+ Because this touches {legal/privacy/billing/permissions/analytics/migration/etc.}, PRDs, tickets, designs, chat excerpts, prior incidents, or customer requests may change what we prioritize.
590
+
591
+ Next: we'll generate a list of suggested problems to pick from.
576
592
 
577
- > Any PRDs, tickets, designs, transcripts, or chat excerpts that should shape this? Paste paths / URLs now, or say `skip`.
593
+ Press Enter or type `g` to generate the list.
594
+ Or paste files/text/URLs to attach context first.
595
+ Type `pause` to stop here.
596
+ ```
578
597
 
579
- Wait for the user to either provide refs or skip.
598
+ Accept empty input, `g`, `go`, `generate`, `continue`, `skip`, or `none` as proceed. Wait only if the user provides refs, asks a question, or types `pause` / `stop`.
580
599
 
581
600
  If none of the triggers apply, do **not** block. Print a non-blocking line and proceed:
582
601
 
@@ -683,15 +702,33 @@ The coding agent's packet is context, not authority. Do not pre-rank or collapse
683
702
 
684
703
  If `implementationCount === 0`: don't mention the KG check (silent — would just be noise on a cold KG).
685
704
 
686
- **[USER PAUSE]** Present as a numbered list and ask which to include:
705
+ **[USER PAUSE]** Present as `Problems to solve for`, never as versioned sub-problem headings:
687
706
 
688
- > Sub-problems the system identified (v1):
689
- >
690
- > 1. {sub-problem 1}
691
- > 2. {sub-problem 2}
692
- > ...
693
- >
694
- > 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").
707
+ ```text
708
+ Ritual build
709
+ Context ● Scope ○ Discovery ○ Recommendations ○ Build brief ○ Implementation
710
+
711
+ Problems to solve for
712
+
713
+ Pick which problems should shape the scope.
714
+ Ritual will turn your selection into a tight problem frame that tells the coding agent what to optimize for.
715
+
716
+ 1. {Title}
717
+
718
+ {Short explanation, wrapped for terminal width.}
719
+
720
+ 2. {Title}
721
+
722
+ {Short explanation, wrapped for terminal width.}
723
+
724
+ Reply with:
725
+ - `all` to solve for everything listed
726
+ - numbers like `1,2,5`
727
+ - a different framing, e.g. `more technical`, `add fraud angle`, `drop observability`
728
+ - `pause` to stop here
729
+ ```
730
+
731
+ Only the title line gets the number. Put a blank line between candidates. Do not show version labels like `(v1)` in CLI output.
695
732
 
696
733
  ##### 4.2 Iteration loop
697
734
 
@@ -712,7 +749,7 @@ Loop until the user says "these are good" or picks a subset.
712
749
 
713
750
  Store the final picked sub-problems for Step 5 — they go into `considerations[]`.
714
751
 
715
- #### Step 5 — Generate scope
752
+ #### Step 5 — Generate problem frame
716
753
 
717
754
  ##### 5.1 First draft
718
755
 
@@ -723,19 +760,43 @@ Call `mcp__ritual__generate_problem_statement` with:
723
760
  - `template_id` (same as Step 4 — the one picked in Step 2)
724
761
  - `sources` (the same file-path list passed to generate_considerations — keeps the KG anchor consistent)
725
762
 
726
- 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.
763
+ Returns a candidate problem statement plus optional follow-up questions and quality scores. For engineering / agentic-coding templates, translate the returned statement into a developer-oriented **problem frame** before showing it. Do not default to "How might we…" unless the selected template is product/design oriented or the user asks for HMW phrasing.
727
764
 
728
- If the response includes `kg_context_used` with `implementationCount > 0`, prepend a note to the scope presentation:
765
+ Engineering style:
766
+ - `Problem frame: {verb/outcome} while preserving {constraints}.`
767
+ - `Build/enable {capability} without {key failure modes}.`
768
+ - `Scope: {implementation objective} across {surfaces}.`
729
769
 
730
- > *(Grounded in {N} prior implementation{s}: {top match name}, …)*
770
+ Keep RB IDs, recommendation IDs, prior exploration IDs, and source links out of the main frame sentence. Put provenance underneath in `References:`.
731
771
 
732
- **[USER PAUSE]** Present and ask:
772
+ If the response includes `kg_context_used` with `implementationCount > 0`, include that signal in the `References:` block rather than as a parenthetical in the frame.
733
773
 
734
- > Here's the scope (v1):
735
- >
736
- > > **{generated scope}**
737
- >
738
- > Looks good? Want to tighten / broaden / change the audience / focus on a specific tier? Or "ship it" to lock it in.
774
+ **[USER PAUSE]** Present like this:
775
+
776
+ ```text
777
+ Problem frame
778
+
779
+ {developer-oriented problem frame}
780
+
781
+ Optimize for:
782
+ - {load-bearing constraint}
783
+ - {load-bearing constraint}
784
+ - {load-bearing constraint}
785
+
786
+ References:
787
+ - {RB/decision/exploration label} — {one-line meaning}
788
+ Source: {exploration title or id}{ optional ': https://dev.ritualapp.cloud/e/{exploration_id}' if available}
789
+ - {reference}
790
+
791
+ Press Enter or type `lock` to use this frame and review discovery questions.
792
+ Or reply with edits, e.g. `tighten`, `broaden`, `focus on outbox`, `drop dashboard`, or `pause`.
793
+ ```
794
+
795
+ Rules:
796
+ - Do not show the old versioned scope heading.
797
+ - Do not show `Engineering problem:` as the heading; use `Problem frame`.
798
+ - Do not say `ship it` unless the user used that language first.
799
+ - Accept empty input, `lock`, `l`, `go`, `continue`, or `next` as lock/proceed.
739
800
 
740
801
  ##### 5.2 Iteration loop
741
802
 
@@ -743,24 +804,30 @@ If the user asks for a refinement:
743
804
 
744
805
  Call `mcp__ritual__refine_problem_statement` with:
745
806
  - `workspace_id`, `raw_input`, `considerations`, `template_id`, `sources` — unchanged. (Same `sources` as the original generate call — keeps the KG anchor stable.)
746
- - `previous_problem_statement`: the FULL TEXT of the current best draft (the v1 you just showed)
747
- - `change_prompt`: the user's request verbatim ("tighten and drop the audience clause")
748
- - `version`: optional label like `"v2"` purely for telemetry
807
+ - `previous_problem_statement`: the FULL TEXT of the current best draft
808
+ - `change_prompt`: the user's request verbatim
809
+ - `version`: optional telemetry only; do not show version labels to the user
749
810
  - `session_id`: omitted on the first refinement; chain on subsequent ones
750
811
 
751
- 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.
812
+ The returned text becomes the new current draft. Show it using the same `Problem frame` format above, still without version labels.
752
813
 
753
- **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").
814
+ **Critical**: each refinement's `previous_problem_statement` is the LATEST draft, not the original. Otherwise the LLM keeps refining the same starting point and the user can't compose multiple refinements.
754
815
 
755
- When the user accepts ("ship it" / "looks good"), store the final text as `problem_statement` for Step 6.
816
+ When the user locks the frame, store the final text as `problem_statement` for Step 6.
756
817
 
757
- **Pulse (Step 5 done):** Emit a pulse — feature clarity just jumped (problem statement accepted; actor / behavior / acceptance signals are now scorable). Compute per `/ritual context-pulse` § Step CP3. Render full if this crosses Raw ask → Under-specified, else compact.
818
+ **Pulse (Step 5 done):** Emit a pulse — feature clarity just jumped. Compute per `/ritual context-pulse` § Step CP3. Render full if this crosses Raw ask → Under-specified, else compact. In inline build output, translate raw tier labels into user-friendly labels (for example, `Initial ask + code recon` instead of `RAW_ASK`).
758
819
 
759
820
  #### Step 6 — Create the exploration
760
821
 
761
822
  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)`.
762
823
 
763
- **[USER PAUSE]** "I'll create the exploration as **T2 churn reduction (Q3)**. Proceed?"
824
+ Do not add another confirmation if the user just locked the problem frame. Create the exploration immediately after lock/proceed. If a name is ambiguous, use one compact proposal and proceed on Enter.
825
+
826
+ User-visible before the call, if needed:
827
+
828
+ ```text
829
+ Creating exploration: **T2 churn reduction (Q3)**
830
+ ```
764
831
 
765
832
  Call `mcp__ritual__create_exploration` with:
766
833
  - `workspace_id`
@@ -768,9 +835,16 @@ Call `mcp__ritual__create_exploration` with:
768
835
  - `problem_statement` (the scope from Step 5)
769
836
  - `agentic: false` — **do NOT** pass `agentic: true`. We want explicit per-step control so the user gets to pick discovery questions in Step 7. Auto-agentic skips that.
770
837
 
771
- Store `exploration_id`. Show the URL:
838
+ Store `exploration_id`. Move the progress header from Scope to Discovery:
839
+
840
+ ```text
841
+ Ritual build
842
+ ✓ Context ✓ Scope ● Discovery ○ Recommendations ○ Build brief ○ Implementation
772
843
 
773
- > Exploration created. Track progress at https://dev.ritualapp.cloud/e/{exploration_id}
844
+ Exploration created. Track progress at https://dev.ritualapp.cloud/e/{exploration_id}
845
+
846
+ Next: generate discovery questions to resolve the implementation trade-offs.
847
+ ```
774
848
 
775
849
  ##### 6.1 — Promote the pre-build seed (if one was consumed in Step 3.0)
776
850
 
@@ -824,7 +898,7 @@ Longest phase because generation is async + the user picks per-matter.
824
898
 
825
899
  Call `mcp__ritual__suggest_discovery_questions(exploration_id)`. Returns immediately with `task_id`. Tell the user:
826
900
 
827
- > Generating discovery questions for each matter 30-120 seconds.
901
+ > Generating discovery questions for each area
828
902
 
829
903
  ##### 7.2 — Poll until ready
830
904
 
@@ -839,13 +913,16 @@ Don't poll faster than every 5 seconds. Follow the global polling rule above: si
839
913
 
840
914
  The state contains `matters[]`, each with `id`, `name`, and `questions[]`. Walk through them **one matter at a time**:
841
915
 
842
- > **{matter.name}** — {matter.questions.length} discovery questions:
843
- >
844
- > 1. {question 1}
845
- > 2. {question 2}
846
- > ...
847
- >
848
- > Which should the agent investigate? Pick any subset, "all", or "skip" to skip this matter.
916
+ ```text
917
+ Discovery area: {matter.name}
918
+
919
+ Pick the questions Ritual should answer before recommendations.
920
+ Choose `all`, numbers like `1,3`, or `skip`.
921
+
922
+ 1. {question 1}
923
+ 2. {question 2}
924
+ ...
925
+ ```
849
926
 
850
927
  **[USER PAUSE]** Wait per matter.
851
928
 
@@ -905,61 +982,50 @@ Skip silently if no anti-goals were mentioned.
905
982
 
906
983
  **Pulse (Step 7.4 done — and again after 7.5 if anti-goals were set):** Emit a pulse — decision resolution and (if 7.5 ran) assumption safety just moved. Compact format unless this crosses Under-specified → Exploration-safe.
907
984
 
908
- #### Step 8 — Run the agentic pipeline (role-aware pause point)
909
-
910
- The agentic pipeline runs sourcing → answers → recommendations. Two run modes are supported (2026-05-12, PR 4):
985
+ #### Step 8 — Run discovery through recommendations
911
986
 
912
- **Mode A Full agentic to recommendations (DEFAULT for engineering / delivery / operations / marketing roles, and the **skip** path):**
987
+ The agentic pipeline runs sourcing answers → recommendations. For engineering / agentic-coding flows, do **not** offer an answers-only mode; the happy path is to run through recommendations.
913
988
 
914
- Call `mcp__ritual__start_agentic_run` with:
915
- - `scope_type: 'exploration'`
916
- - `exploration_id`
989
+ For `engineering`, `delivery`, and `operations` roles, show:
917
990
 
918
- Runs through sourcing → answers → recommendations end-to-end. Typical runtime: 3-8 minutes. Poll, show progress, proceed to Step 9 when COMPLETED.
991
+ ```text
992
+ Next: run discovery through recommendations.
919
993
 
920
- **Mode B Stop after answers (RECOMMENDED DEFAULT for product / PRD / design roles):**
994
+ Press Enter or type `run` to continue.
995
+ Type `pause` to stop here.
996
+ ```
921
997
 
922
- For PRD-style flows the user often wants to iterate on the v1 answers before recommendations are synthesized — the answers ARE the substance of the PRD; refining them lifts rec quality dramatically.
998
+ Accept empty input, `run`, `r`, `go`, `continue`, or `next` as proceed.
923
999
 
924
1000
  Call `mcp__ritual__start_agentic_run` with:
925
1001
  - `scope_type: 'exploration'`
926
1002
  - `exploration_id`
927
- - `stop_after: 'answers'`
928
-
929
- The pipeline halts after Phase 3 (answering). Run lands in `PAUSED_FOR_REVIEW`. Continue with Step 8.5 instead of Step 9.
930
1003
 
931
- **Which mode to offer:**
1004
+ For `product`, `design`, or explicitly PRD-style flows, answer review may be useful. Offer two choices without time estimates:
932
1005
 
933
- Use the **role** inferred at Step 2 step 6b:
934
- - `engineering`, `delivery`, `operations` → default Mode A; offer Mode B as opt-in
935
- - `product`, `design`, `marketing` → default Mode B; offer Mode A as opt-in
936
- - Otherwise → ask the user
937
-
938
- Phrase the offer plainly. For product roles:
1006
+ ```text
1007
+ Next: run discovery.
939
1008
 
940
- > I'll start the agentic pipeline. Two options:
941
- >
942
- > 1. **Stop after answers** *(recommended for PRD)* — I'll generate v1 answers for each matter (~3-5 min). You review and refine each one before I run recommendations. Highest-quality PRD output but takes longer overall.
943
- > 2. **Skip the pause — run all the way to recommendations** — fastest end-to-end (~3-8 min). You can still edit answers later in the web UI, but recs will already exist.
944
- >
945
- > Pick 1 or 2.
1009
+ 1. Stop after answers — review and refine the generated answers before recommendations.
1010
+ 2. Run through recommendations — fastest path to a recommendation set.
946
1011
 
947
- For engineering roles, flip the order — Mode A first.
1012
+ Pick 1 or 2.
1013
+ ```
948
1014
 
949
- **Common behavior for both modes:**
1015
+ If they pick 1, call `start_agentic_run` with `stop_after: 'answers'` and continue to Step 8.5 when it pauses. If they pick 2, call without `stop_after` and continue to Step 9 when complete.
950
1016
 
951
- Poll `mcp__ritual__get_agentic_run(run_id)` using the standard async polling rule: one `Bash sleep 5` per iteration, then a fresh status call. Print progress only when `progress_pct` or `current_step` changes, or every ~15 seconds if the status is unchanged:
1017
+ Poll `mcp__ritual__get_agentic_run(run_id)` using `references/async-polling.md`: one `Bash sleep 5` per iteration, then a fresh status call. Print progress only when `progress_pct` or `current_step` changes, or every ~3 polls if unchanged:
952
1018
 
953
1019
  > Agentic run: {progress_pct}% — {current_step}
954
1020
 
955
1021
  When `status` is `COMPLETED`: continue to Step 9.
956
1022
  When `status` is `COMPLETED_WITH_ERRORS`: tell the user, but proceed — partial recommendations may still be useful.
957
1023
  When `status` is `FAILED`: surface the error message, ask if they want to retry (`start_agentic_run` again with same exploration_id) or stop.
958
- When `status` is `PAUSED_FOR_REVIEW` (Mode B only): continue to Step 8.5.
1024
+ When `status` is `PAUSED_FOR_REVIEW` (product/design answer-review mode only): continue to Step 8.5.
959
1025
 
960
1026
  If user wants to abort mid-flight: `mcp__ritual__cancel_agentic_run(run_id)`.
961
1027
 
962
- #### Step 8.5 — Agent-driven per-answer iteration (Mode B only)
1028
+ #### Step 8.5 — Agent-driven per-answer iteration (product/design answer-review mode only)
963
1029
 
964
1030
  When the pipeline pauses at `PAUSED_FOR_REVIEW`, the exploration is at step `REVIEWING_ANSWERS`. Every matter's questions have v1 answers + at least one clarifying question per consideration, but nothing has been committed for recommendation generation yet.
965
1031
 
@@ -1003,7 +1069,6 @@ When the pipeline pauses at `PAUSED_FOR_REVIEW`, the exploration is at step `REV
1003
1069
 
1004
1070
  **Abandon:** `cancel_agentic_run(run_id)`. The exploration stays at `REVIEWING_ANSWERS` — the user can come back later and either resume or start fresh.
1005
1071
 
1006
- **Performance note:** each iteration is 1 LLM call (~3-5s). For 20 questions × 2 iterations average × 1 call = 40 LLM calls (~$0.04). The skip path is ~$0. Bounded by user choice per-question.
1007
1072
 
1008
1073
  **Pulse (Step 8 done):** Emit a pulse — decision resolution moved significantly (answers complete, draft recommendations now exist). Render full if this crosses Under-specified → Exploration-safe, else compact.
1009
1074
 
@@ -1018,7 +1083,10 @@ If you don't already know the user's role on this workspace, prefer the workspac
1018
1083
  Present recommendations in a compact, scannable form and give one recommended action:
1019
1084
 
1020
1085
  ```text
1021
- Recommendations ready: {N}
1086
+ Ritual recommendations are ready.
1087
+
1088
+ Next: accept them to generate an implementation-ready build brief.
1089
+ Signal: discovery has completed and recommendations now exist for this scope.
1022
1090
 
1023
1091
  1. {title}
1024
1092
 
@@ -1028,7 +1096,6 @@ Recommendations ready: {N}
1028
1096
 
1029
1097
  {one-line summary}
1030
1098
 
1031
- Recommended: accept all and generate the build brief.
1032
1099
  Reply `accept`, `detail 2`, or `hold`.
1033
1100
  ```
1034
1101
 
@@ -1065,7 +1132,7 @@ Steps:
1065
1132
 
1066
1133
  1. **Tell the user once** that requirements are being generated:
1067
1134
 
1068
- > Generating requirements for the build brief… usually 20-60s.
1135
+ > Generating requirements for the build brief…
1069
1136
 
1070
1137
  2. **Poll `mcp__ritual__get_requirement_set_status(exploration_id)` every ~5s.** The response shape:
1071
1138
 
@@ -1079,14 +1146,14 @@ Steps:
1079
1146
 
1080
1147
  Polling rules in this harness:
1081
1148
  - Use a **single `Bash sleep 5`** call per poll iteration — don't chain sleeps or use `sleep ≥30`. The harness blocks chained sleeps; one short sleep per turn dodges that AND keeps the user-facing progress feel live.
1082
- - **Update the user every ~3 polls (~15s)** with a "still generating…" line so they know you haven't stalled.
1149
+ - **Update the user every ~3 polls** with a "still generating…" line so they know you haven't stalled.
1083
1150
 
1084
1151
  3. **Exit conditions:**
1085
1152
 
1086
1153
  | Response | Action |
1087
1154
  |---|---|
1088
1155
  | `status === 'READY'` | Proceed to Step 10 |
1089
- | `exists === false` (still null) for 3+ polls (~15s) | The fire-and-forget hasn't reached the DB yet, OR Branch B was just hit (no LLM call yet). After ~15s either keep polling OR proceed to Step 10 — the API auto-triggers generation inline if the set is still missing when the brief is requested (adds ~30s to the brief call but never hard-fails). |
1156
+ | `exists === false` (still null) for 3+ polls | The fire-and-forget hasn't reached the DB yet, OR Branch B was just hit (no LLM call yet). After several polls either keep polling OR proceed to Step 10 — the API auto-triggers generation inline if the set is still missing when the brief is requested (adds ~30s to the brief call but never hard-fails). |
1090
1157
  | `status === 'GENERATING'` | Keep polling |
1091
1158
  | `status === 'FAILED'` | Surface `errorMessage` to the user; offer to retry by calling `generate_build_brief` directly (which will auto-trigger a fresh generation), OR by hitting `POST /requirements?force=true` via the web UI |
1092
1159
 
@@ -1119,17 +1186,17 @@ Returns the brief markdown + an `id` + `kgContextUsed` block. The brief is **ide
1119
1186
 
1120
1187
  ##### 10b — Timeout-recovery polling (CLI Tenet #8)
1121
1188
 
1122
- `generate_build_brief` can take **30–90s** in the cold-start case: the API auto-triggers RequirementSet generation inline (~30s) if one doesn't exist, then synthesizes the brief on top (~20-60s). MCP clients enforce a hard **30s timeout** on the request — you will sometimes see a local-timeout error while the server-side work is still running.
1189
+ `generate_build_brief` can outlive the local MCP request timeout, especially when the API auto-triggers RequirementSet generation inline. You may see a local-timeout error while server-side work is still running.
1123
1190
 
1124
1191
  **Don't give up and don't blindly regenerate.** Instead, fall back to status polling:
1125
1192
 
1126
1193
  1. On timeout/error from `generate_build_brief`, call `mcp__ritual__get_build_brief_status(exploration_id, icp)` immediately.
1127
- 2. Poll every **~5s** for up to **2min** total. Polling rule (CLI Tenet #7): a single `Bash sleep 5` call per turn the harness blocks chained sleeps and `sleep 30`. Update the user with a "still generating…" line every ~3 polls (~15s).
1194
+ 2. Poll using the standard async polling rule: one `Bash sleep 5` per poll iteration, then a fresh status call. Print a brief "still generating…" update every ~3 polls when the status is unchanged.
1128
1195
  3. Exit conditions:
1129
1196
 
1130
1197
  | Response | Action |
1131
1198
  |---|---|
1132
- | `exists === false` for 3+ polls (~15s) | The fire-and-forget never landed — try calling `generate_build_brief` once more (it will likely succeed now that requirements are ready). |
1199
+ | `exists === false` for 3+ polls | The fire-and-forget never landed — try calling `generate_build_brief` once more (it will likely succeed now that requirements are ready). |
1133
1200
  | `status === 'GENERATING'` | Keep polling. |
1134
1201
  | `status === 'READY'` | Read `content` field — proceed to Step 10c as if generate had completed. |
1135
1202
  | `status === 'FAILED'` | Surface `errorMessage` to the user. Propose a single action (CLI Tenet #2): *"The brief failed: {errorMessage}. Retry with a fresh generation? (y/N)"*. On yes: call `generate_build_brief` again with `force: true`. |
@@ -1158,8 +1225,10 @@ When the brief content is in hand (from generate OR polling), **don't dump 300 l
1158
1225
  2. **Print a compact CLI summary** — the top-of-mind information plus a single line pointing at the file:
1159
1226
 
1160
1227
  ```
1161
- ✓ Build brief ready — {exploration_name} ({N} recs accepted, {M} requirements)
1162
- BUILD-BRIEF.md ({line_count} lines, {file_kb_size} KB)
1228
+ ✓ Build brief ready — discovery has become an implementation path.
1229
+
1230
+ Signal: {N} accepted recommendations were converted into {M} code-time requirements.
1231
+ File: BUILD-BRIEF.md ({line_count} lines, {file_kb_size} KB)
1163
1232
 
1164
1233
  Goal: {first line of Goal section, ≤ 100 chars}
1165
1234
 
@@ -1206,7 +1275,7 @@ Branch by user response:
1206
1275
  - **refine**: ask what's off, then call `generate_build_brief` with `force: true` after applying their feedback to the exploration (typically a recommendation re-accept or a requirement adjustment via the web UI).
1207
1276
  - **drill into X**: open the specific section in the markdown, discuss inline, then loop back to "Ready to implement?".
1208
1277
 
1209
- **Pulse (Step 10 done):** Emit a pulse — this often crosses into **Implementation-ready** (90%+). Render full when that crossing happens — *"safe to code"* is the celebration line. If still below 90% (e.g. brief flagged residual debt), surface that in the pulse line itself and propose addressing it before coding.
1278
+ **Pulse (Step 10 done):** Emit a pulse — this often crosses into **Implementation-ready** (90%+). Render full when that crossing happens. Use the build-brief celebration line: `✓ Build brief ready discovery has become an implementation path.` If still below 90% (e.g. brief flagged residual debt), surface that in the pulse line itself and propose addressing it before coding.
1210
1279
 
1211
1280
  #### Step 11 — Implement
1212
1281
 
@@ -1419,10 +1488,10 @@ This subcommand exclusively uses vNext MCP tools, in the order they appear:
1419
1488
  14. `mcp__ritual__get_discovery_state` (Step 7.2)
1420
1489
  15. `mcp__ritual__accept_discovery_questions` (Step 7.4)
1421
1490
  16. `mcp__ritual__set_anti_goals` (Step 7.5, optional)
1422
- 17. `mcp__ritual__start_agentic_run` (Step 8 — accepts `stop_after='answers'` for PRD/product flows)
1491
+ 17. `mcp__ritual__start_agentic_run` (Step 8 — engineering runs through recommendations; product/design may use `stop_after='answers'`)
1423
1492
  18. `mcp__ritual__get_agentic_run` (Step 8 / Step 8.5 polling)
1424
1493
  19. `mcp__ritual__cancel_agentic_run` (Step 8, only on user abort)
1425
- 20. `mcp__ritual__resume_agentic_run` (Step 8.5, only when stop_after='answers' was used)
1494
+ 20. `mcp__ritual__resume_agentic_run` (Step 8.5, only when product/design answer-review mode was used)
1426
1495
  20a. `mcp__ritual__get_answer_state` (Step 8.5 per-question read)
1427
1496
  20b. `mcp__ritual__iterate_answer` (Step 8.5 — user picked "iterate")
1428
1497
  20c. `mcp__ritual__submit_answer` (Step 8.5 — user picked "submit")