@ritualai/cli 0.36.11 → 0.36.22

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 (43) hide show
  1. package/dist/commands/lite.js +102 -0
  2. package/dist/commands/lite.js.map +1 -0
  3. package/dist/commands/project.js +82 -0
  4. package/dist/commands/project.js.map +1 -0
  5. package/dist/index.js +21 -0
  6. package/dist/index.js.map +1 -1
  7. package/dist/lib/agents/launch.js +21 -5
  8. package/dist/lib/agents/launch.js.map +1 -1
  9. package/dist/lib/okf-projection.js +118 -0
  10. package/dist/lib/okf-projection.js.map +1 -0
  11. package/dist/lib/worktree.js +87 -0
  12. package/dist/lib/worktree.js.map +1 -0
  13. package/package.json +1 -1
  14. package/skills/claude-code/ritual/.ritual-bundle.json +3 -3
  15. package/skills/claude-code/ritual/SKILL.md +1 -1
  16. package/skills/claude-code/ritual/references/build-flow.md +85 -43
  17. package/skills/claude-code/ritual/references/cli-output-contract.md +3 -6
  18. package/skills/claude-code/ritual/references/lite-flow.md +134 -44
  19. package/skills/codex/ritual/.ritual-bundle.json +3 -3
  20. package/skills/codex/ritual/SKILL.md +1 -1
  21. package/skills/codex/ritual/references/build-flow.md +85 -43
  22. package/skills/codex/ritual/references/cli-output-contract.md +3 -6
  23. package/skills/codex/ritual/references/lite-flow.md +134 -44
  24. package/skills/cursor/ritual/.ritual-bundle.json +3 -3
  25. package/skills/cursor/ritual/SKILL.md +1 -1
  26. package/skills/cursor/ritual/references/build-flow.md +85 -43
  27. package/skills/cursor/ritual/references/cli-output-contract.md +3 -6
  28. package/skills/cursor/ritual/references/lite-flow.md +134 -44
  29. package/skills/gemini/ritual/.ritual-bundle.json +3 -3
  30. package/skills/gemini/ritual/SKILL.md +1 -1
  31. package/skills/gemini/ritual/references/build-flow.md +85 -43
  32. package/skills/gemini/ritual/references/cli-output-contract.md +3 -6
  33. package/skills/gemini/ritual/references/lite-flow.md +134 -44
  34. package/skills/kiro/ritual/.ritual-bundle.json +3 -3
  35. package/skills/kiro/ritual/SKILL.md +1 -1
  36. package/skills/kiro/ritual/references/build-flow.md +85 -43
  37. package/skills/kiro/ritual/references/cli-output-contract.md +3 -6
  38. package/skills/kiro/ritual/references/lite-flow.md +134 -44
  39. package/skills/vscode/ritual/.ritual-bundle.json +3 -3
  40. package/skills/vscode/ritual/SKILL.md +1 -1
  41. package/skills/vscode/ritual/references/build-flow.md +85 -43
  42. package/skills/vscode/ritual/references/cli-output-contract.md +3 -6
  43. package/skills/vscode/ritual/references/lite-flow.md +134 -44
@@ -46,7 +46,7 @@ When **not** to use:
46
46
 
47
47
  Use explicit **[USER PAUSE]** only at decision gates. Pause when the user must choose among options, approve creation or acceptance, resolve ambiguity, authorize implementation, accept cost/time, or provide missing non-code context. Do **not** pause for status-only steps, safe defaults, internal recon, or silent checks.
48
48
 
49
- **Pauses are not optional even in auto-mode** (load-bearing). When the host agent has auto-accept / bypass-permissions enabled, the SKILL must still honor every `[USER PAUSE]` as a hard stop. Inferring an answer from context, choosing a default, or pressing on without an actual user reply defeats the build flow's value: Ritual is producing aligned recommendations because the human shaped the inputs, not because the agent guessed plausibly. The auto-mode reminder in Step 0 below is informational only it does not relax this rule; it's a heads-up to the user, not permission to bypass pauses.
49
+ **Pauses are not optional even in auto-mode** (load-bearing). When the host agent has auto-accept / bypass-permissions enabled, the SKILL must still honor every `[USER PAUSE]` as a hard stop. Inferring an answer from context, choosing a default, or pressing on without an actual user reply defeats the build flow's value: Ritual is producing aligned recommendations because the human shaped the inputs, not because the agent guessed plausibly. We do not surface a heads-up about this to the user (Step 0) we simply enforce the gates regardless of the host's auto-accept mode.
50
50
 
51
51
  ---
52
52
 
@@ -60,19 +60,18 @@ Follow `references/cli-output-contract.md` for terminal output, dense-list forma
60
60
  >
61
61
  > The new shape: one informational line in the FIRST user-visible message of the flow. No pause. No `[USER PAUSE]` here. If the user IS in auto-mode, the next genuine decision pause (workspace pick, scope pick, etc.) is the natural place they'll notice it racing past. The line below gives them the right cue + remediation.
62
62
 
63
- The SKILL MUST include the following one-line heads-up at the top of the **first** user-visible message in a `/ritual build` flow (typically the workspace summary in Step 1, or the no-args prompt in Step 1.1). Include it once per flow only:
63
+ Do NOT show an auto-mode / "~N decisions" / Shift+Tab heads-up. It reads as meta-instruction clutter at the start of the flow just begin the flow plainly. (The pausing discipline below is enforced regardless of the host's auto-accept mode; we simply don't preface it with a lecture.)
64
64
 
65
- ```text
66
- Heads-up: Ritual's build flow needs ~5 real decisions from you (workspace,
67
- scope, discovery picks, rec acceptance, implementation approval). If your
68
- agent is in auto-accept / bypass-permissions mode, those pauses won't
69
- actually pause for you — toggle off first (Claude Code: Shift+Tab to cycle
70
- back to "default").
71
- ```
65
+ Pausing discipline is still load-bearing — every `[USER PAUSE]` later in the flow is a hard stop regardless of whether the user reads it. The agent's contract is unchanged from the preamble: never infer an answer, never pick a default, never press on without an actual user reply. Auto-mode collapsing those pauses is the user's risk to accept; the SKILL enforces the gates regardless.
72
66
 
73
- That's it. No menu. No required reply. Just inform.
67
+ <!-- skill-options:no-gate-change: voice/copy cleanup — removes the auto-mode "~5 decisions" heads-up, adds a no-preamble/no-editorializing/render-verbatim voice rule, replaces job-gate + run-gate copy with plainer wording, and moves the context pulse to the bottom (above the CTA) starting only at the curate-questions step. No tracked pause gate, option, or Step header is added, removed, or changed. -->
74
68
 
75
- Pausing discipline is still load-bearing every `[USER PAUSE]` later in the flow is a hard stop regardless of whether the user reads or ignores this heads-up. The agent's contract is unchanged from the preamble: never infer an answer, never pick a default, never press on without an actual user reply. Auto-mode collapsing those pauses is the user's risk to accept; the SKILL's job is just to surface that risk visibly once, then enforce the gates regardless.
69
+ **Voice render gates plainly, add NOTHING (load-bearing, applies to EVERY message in the flow).** Output the gate copy this skill prescribes and nothing else. In particular, NEVER:
70
+ - **Preface a tool call with narration.** Don't say "I'll start by classifying the job…", "Let me kick off an exploration…", "I'll create the exploration and pull questions…". Just make the tool call; report the result plainly after.
71
+ - **Editorialize about the work.** Don't add commentary like "this is exactly the kind of ambiguous, cross-cutting work where it pays to surface context before writing code", "the design decisions still aren't settled", or any "here's why this step matters" justification. The user knows why they ran `/ritual build`.
72
+ - **Narrate internal mechanics or paraphrase the gate copy into process-talk.** Don't say "You're framed. Grounding in the codebase, then I'll…" or describe what Ritual's research agents do under the hood. Lead with the plain meaning for the user; surface mechanism only if they ask.
73
+
74
+ Every message should be the prescribed gate copy (rail + content + CTA) — terse, plain, no preamble, no sign-off commentary.
76
75
 
77
76
  **Per-agent indicators** (informational, for the SKILL's own awareness — NOT to gate behavior):
78
77
 
@@ -139,8 +138,9 @@ When this gate runs:
139
138
  ● Job ○ Scope ○ Discovery ○ Recommendations ○ {Deliverable} ○ Implementation (Your agent)
140
139
 
141
140
  You're looking to: {restate the ask in one short clause}
142
- The job to be done: {workItemLabel} — {why}
143
- Deliverable: {deliverableTemplate}
141
+
142
+ Once you run the exploration and review recommendations, a {deliverableTemplate} will be
143
+ created as context for your coding agent.
144
144
 
145
145
  Reply `proceed` to frame the problem (sub-problems + problem statement), or tell me what the
146
146
  job actually is.
@@ -235,10 +235,8 @@ Resolution order:
235
235
  - **Not found** (deleted, access revoked, wrong id in config): pause with a clear error and offer `workspace: list` to re-bind. Don't fall through to `list_explorations` later — it errors with a less actionable message.
236
236
  - **Found:** store `workspace.explorationCount` for Step 1.5. The SKILL never maintains a local "empty workspace" cache because that goes stale against anything that mutates the workspace outside this CLI's view.
237
237
 
238
- User-visible (per Step 0, prepend the one-line auto-mode heads-up — once per flow):
238
+ User-visible:
239
239
 
240
- > Heads-up: Ritual's build flow needs ~5 real decisions from you (workspace, scope, discovery picks, rec acceptance, implementation approval). If your agent is in auto-accept / bypass-permissions mode, those pauses won't actually pause for you — toggle off first (Claude Code: Shift+Tab to cycle back to "default").
241
- >
242
240
  > Using workspace: **{workspaceName}** from `.ritual/config.json`.
243
241
  > Override with `workspace: list`.
244
242
 
@@ -303,12 +301,6 @@ If there are **zero existing explorations** and `raw_input = null`, do not say "
303
301
  Ritual build
304
302
  ✓ Job ● Scope ○ Discovery ○ Recommendations ○ Build brief ○ Implementation (Your agent)
305
303
 
306
- Heads-up: Ritual's build flow needs ~5 real decisions from you (workspace,
307
- scope, discovery picks, rec acceptance, implementation approval). If your
308
- agent is in auto-accept / bypass-permissions mode, those pauses won't
309
- actually pause for you — toggle off first (Claude Code: Shift+Tab to cycle
310
- back to "default").
311
-
312
304
  Using workspace: {workspaceName}.
313
305
 
314
306
  No Ritual history here yet.
@@ -554,7 +546,33 @@ Steps:
554
546
  f. **If the user picks one (1-N):**
555
547
  - Set the chosen candidate's `summary` as the `raw_input` for the rest of the flow.
556
548
  - **Skip Step 1.5 step 8 (overlap check)** — the user just picked from system suggestions explicitly grounded in workspace state; a fresh overlap pass would be redundant noise.
557
- - Continue to Step 2 (template selection).
549
+ - **Run the unchosen-candidates gate (f.1) BEFORE continuing**, then continue to Step 2.
550
+
551
+ <!-- skill-options:no-gate-change: f.1 is an OPTIONAL skippable sub-prompt nested in Step 1.5 step 6 (default skip); adds no tracked pause gate or Step header, so the structural fingerprint is unchanged (check-skill-options-contract green). -->
552
+ f.1 **Unchosen-candidates gate (2026-06-14, unchosen-options → discovery worktrees).** The candidates the user did NOT pick are paths worth not silently dropping. Render ONE compact, SKIPPABLE prompt — for each unchosen candidate, the user can spin up **discovery now** (a background worktree reasons it to a build brief) or **log it as a future job**. Promote DELIBERATELY: the default is to drop. (This gate is itself skipped in autonomous/worktree mode — never spawn discovery recursively.)
553
+
554
+ ```text
555
+ You picked #{k}. The other {M} — want to keep any going?
556
+ • `discover <nums>` — spin up discovery NOW in a background git worktree: an agent reasons it
557
+ end-to-end to a build brief (reasoning only, no code). e.g. `discover 1`
558
+ • `next-job <nums>` — just log it as a future job (a draft exploration in this workspace; nothing runs)
559
+ • `skip` — drop them (default)
560
+ ```
561
+
562
+ Resolve the reply, then continue to Step 2 for the picked candidate:
563
+ - **`discover <nums>`** → for each, run `ritual lite "{candidate.summary}" --worktree` **in the
564
+ BACKGROUND** (do not block the build — use your shell's background/async execution). It spins a
565
+ git worktree and runs autonomous discovery to a brief there; tell the user where (`<repo>.ritual-discover/<slug>`).
566
+ The result is an exploration with `spawn_origin: 'discovery_worktree'`; its brief is
567
+ agent-authored, not human-reviewed. (See `references/unchosen-options-discovery-worktrees.md` in `documents/architecture/`.)
568
+ - **`next-job <nums>`** → for each, call `mcp__ritual__create_exploration` with the candidate's
569
+ `title` as `name`, its `summary` as `problem_statement`, `spawn_origin: 'next_job'`, and NO
570
+ `agentic` flag — a NOT_STARTED draft that shows in the workspace roster as a future job. Cheap; nothing runs.
571
+ - **`skip` / no reply about them** → drop silently.
572
+
573
+ Keep it ONE prompt, never per-candidate pauses. If the user just proceeds without addressing it, treat as `skip`.
574
+
575
+ f.2 **Continue to Step 2 (template selection)** for the picked candidate.
558
576
 
559
577
  g. **If the user says "none" / "let me describe":** continue to Step 2 normally; treat as if they had originally picked "start fresh" with no raw_input yet (they'll provide one at Step 3-4 time).
560
578
 
@@ -887,7 +905,7 @@ The returned text becomes the new current draft. Show it using the same `Problem
887
905
 
888
906
  When the user locks the frame, store the final text as `problem_statement` for Step 6.
889
907
 
890
- **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. Translate raw tier labels into user-facing copy per `references/cli-output-contract.md` § Pulse tier labels never expose `RAW_ASK` / `UNDER_SPECIFIED` / etc. directly.
908
+ **No pulse here.** The context pulse appears only from the curate-questions step onward (cli-output-contract § Inline pulses) early on the score is low/noisy and the line clutters the gate. The first pulse is at Step 7.4.
891
909
 
892
910
  #### Step 5.7 — Ground the exploration (silent recon — runs AFTER the frame locks)
893
911
 
@@ -1030,11 +1048,6 @@ If no seed file is found, OR the seed's `## The ask` doesn't match the current `
1030
1048
  Scope correction:
1031
1049
  - I did not find `guest_session_id` in the inspected models.
1032
1050
 
1033
- Pulse: Reasoning Readiness ~55% · Context Debt 45% · +12% (initial ask + code recon)
1034
-
1035
- (lift bridge — renders right above the next action) Most of the gap left is
1036
- unsettled design decisions — that's exactly what the next step, discovery, resolves.
1037
-
1038
1051
  Next: attach PRDs/tickets if they should shape scope, or `proceed` to continue.
1039
1052
  ```
1040
1053
 
@@ -1111,7 +1124,7 @@ If no seed file is found, OR the seed's `## The ask` doesn't match the current `
1111
1124
 
1112
1125
  If the user explicitly asks "what did you find?", you may show a tight digest then — otherwise stay silent.
1113
1126
 
1114
- **Pulse (recon done):** Emit a pulse line — repo grounding just moved meaningfully (sources collected, agent inspected files, possibly KG hits). Compute per `/ritual context-pulse` § Step CP3 and render compact unless this is the FIRST pulse of the build flow, in which case use full.
1127
+ **No pulse here** (pre-curate see cli-output-contract § Inline pulses; the first pulse is at Step 7.4).
1115
1128
 
1116
1129
  ##### 5.7.3 — Collect the `sources` array
1117
1130
 
@@ -1316,9 +1329,8 @@ Ritual build
1316
1329
  Discovery questions ready — {M} generated across {N} areas.
1317
1330
 
1318
1331
  These 12 questions target where this problem is hardest — the tradeoffs,
1319
- constraints, and unknowns that decide the design. When you proceed, Ritual
1320
- dispatches its research agents to answer them against this codebase and your
1321
- sources; those answers become the spine of the {Deliverable}.
1332
+ constraints, and unknowns that decide the design. Next, agents will develop
1333
+ answers and generate recommendations.
1322
1334
 
1323
1335
  {Area name 1}
1324
1336
  ✓ 1. {question, full text, wrapped readably}
@@ -1540,7 +1552,21 @@ Skip silently if no anti-goals were mentioned. (No mention = nothing to confirm;
1540
1552
 
1541
1553
  #### Step 8 — Run discovery through recommendations
1542
1554
 
1543
- 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.
1555
+ The pipeline runs answers → recommendations. **Choose the answerer by whether you
1556
+ actually have the code to ground answers in — this is NOT decided by the fact
1557
+ it's `/ritual build`.**
1558
+
1559
+ - **You're genuinely repo-linked** — Step 5.7 recon ran and you read real files
1560
+ (you have a `sources` list / codebase context packet, and filesystem access to
1561
+ the repo): **YOU answer the picked questions** yourself. You're closest to the
1562
+ code, so the answers are grounded in what you actually read.
1563
+ - **You're not** — recon was skipped (Step 5.7.6), no repo is open, or the ask
1564
+ isn't a codebase task: use the **server agentic run** (`start_agentic_run`),
1565
+ which sources answers from the knowledge graph + registered sources instead.
1566
+
1567
+ Pick the path honestly; don't claim to answer from code you didn't read.
1568
+
1569
+ <!-- skill-options:no-gate-change: Step 8 answerer is chosen by real repo-linkage (recon ran / code open), not by the /ritual build invocation; agent-answers when repo-linked, server-run fallback. Includes prose guidance on answer length (~300-600 words), that attached code is OPTIONAL illustrative reference (not part of the answer, not a verbatim copy), and a hard no-secrets/no-PII redaction rule for the BYO answerer. The run/pause gate + its options are unchanged — no new pause gate or Step header. -->
1544
1570
 
1545
1571
  For `engineering`, `delivery`, and `operations` roles, show:
1546
1572
 
@@ -1550,20 +1576,28 @@ Ritual build
1550
1576
 
1551
1577
  Run discovery
1552
1578
 
1553
- Ritual will source answers for the picked questions, then generate
1579
+ I'll answer the picked questions from the codebase, then generate
1554
1580
  recommendations. This usually takes a few minutes.
1555
1581
 
1556
- Reply `run` to source answers → generate recommendations.
1582
+ Reply `run` to answer → generate recommendations.
1557
1583
  Reply `pause` to stop here.
1558
1584
  ```
1559
1585
 
1586
+ (Match the first line to the path you'll actually take: repo-linked → "I'll answer the picked questions from the codebase…"; fallback → "Ritual will source answers for the picked questions…". Don't claim to answer from code if you're taking the server path.)
1587
+
1560
1588
  Visible CTA is `run`. Accept `r`, `go`, `continue`, or `next` as aliases. Per `references/cli-output-contract.md` § Surface-aware continuation prompts, do NOT treat empty input as proceed inside agent chat.
1561
1589
 
1562
- Call `mcp__ritual__start_agentic_run` with:
1563
- - `scope_type: 'exploration'`
1564
- - `exploration_id`
1590
+ On `run`, **if you're genuinely repo-linked (per the check above), answer the questions yourself** (BYO-answerer; do NOT call `start_agentic_run`):
1591
+ 1. The Step 7.4 accept (`accept_discovery_questions_batch`) returned `materialized[]` — the committed questions with their row `id`s. (If you didn't keep them, the same ids are what you passed to accept.)
1592
+ 2. For each committed question, call `mcp__ritual__write_answer_context(question_id, content)` with an answer grounded in your codebase recon — the files you read at Step 5.7, the actual code, real constraints. Answer in PARALLEL where your agent supports it (e.g. one subagent per Area). The content is provisional + provenance-tagged agentic until committed; only the final committed set drives recommendations.
1593
+ - **Length:** keep each answer to **~300–600 words by default** — tight and grounded, not an essay. Go longer only when the question genuinely needs it.
1594
+ - **Code:** the answer itself is **prose** — keep it that way. Code is **optional reference, not part of the answer**: attach a snippet only when it would help a future reader or agent reason about your answer (a key type, contract, or call site worth pointing back to), never to complete the answer. When you do, `content` is **markdown** — add it as a **fenced code block with a language tag** (e.g. ` ```ts `) with the `file/path` and the minimal illustrative lines, never a whole-file paste. Spark lifts these fences out of the prose into a collapsed "View details" reference beside the answer, and markdown keeps them portable to the `.ritual/` projection.
1595
+ - **Never leak secrets or sensitive data.** A snippet is **illustrative, not a verbatim copy** — it only has to convey the shape/idea, so simplify and elide freely. **NEVER** include API keys, tokens, passwords, connection strings, credentials, `.env` values, real customer data, or PII — even if they're literally in the file you read. Replace them with obvious placeholders (`process.env.X`, `"<api-key>"`, `"user@example.com"`). The same goes for the prose: describe constraints without pasting secret values.
1596
+ 3. When every committed question has answer context, call `mcp__ritual__submit_all_answers(exploration_id)` — it commits the set and triggers recommendation generation. Then go to the recommendation wait (Step 8.1, agent-answered path).
1597
+
1598
+ **Fallback — server answers (no repo / nothing to ground in):** call `mcp__ritual__start_agentic_run` with `scope_type: 'exploration'` + `exploration_id`, then follow the server polling path (8.0 → 8.1).
1565
1599
 
1566
- For `product`, `design`, or explicitly PRD-style flows, answer review may be useful. Offer two choices without time estimates:
1600
+ For `product`, `design`, or explicitly PRD-style flows where answer review is useful, offer two choices without time estimates (this path uses the SERVER answer engine so the user can review each generated answer — Step 8.5):
1567
1601
 
1568
1602
  ```text
1569
1603
  Ritual build
@@ -1582,9 +1616,11 @@ Reply `1` or `2`. Reply `pause` to stop here.
1582
1616
 
1583
1617
  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.
1584
1618
 
1585
- ##### 8.0 — "You're unblocked" pre-roll (right after `start_agentic_run` returns the run_id)
1619
+ ##### 8.0 — "You're unblocked" pre-roll (once server-side work is running)
1620
+
1621
+ This pre-roll is for the **rec-generation wait** — fire it once server-side work is running: on the agent-answered path, right after `submit_all_answers` returns (recommendation generation is now queued); on the server fallback, right after `start_agentic_run` returns the run_id. (On the agent-answered path the *answering itself* is your active work — don't show the pre-roll until you've submitted.)
1586
1622
 
1587
- **Lock the product promise BEFORE you enter the polling loop.** The run continues server-side; the user is free to step away. The polling loop becomes the agent's job, not the user's obligation.
1623
+ **Lock the product promise BEFORE you enter the polling loop.** Recommendation generation continues server-side; the user is free to step away. The polling loop becomes the agent's job, not the user's obligation.
1588
1624
 
1589
1625
  Tier the pre-roll by projected duration. Latency baseline: ~15s/question (V5.2 + KG injection, calibrate quarterly against `recs-pipeline.ts` eval results). Multiply the picked-question count by 15s, divide by 60 to get minutes.
1590
1626
 
@@ -1634,7 +1670,13 @@ Pick whichever fits the user's flow — they're equivalent in content. Do not in
1634
1670
 
1635
1671
  ##### 8.1 — Polling loop
1636
1672
 
1637
- Poll `mcp__ritual__get_agentic_run(run_id)` using `references/async-polling.md`: **`Bash sleep 20` (constant 20 — matches Spark's 20s agentic cadence; never escalate)** per iteration, then a fresh status call. Even if the run takes 2+ minutes, the sleep value stays a constant 20; the harness blocks chained-shorter-sleeps-at-increasing-N just like it blocks `sleep 30`, but a fixed `20` is non-escalating and under 30 → guard-safe. Agentic runs CAN exceed 5 min for large explorations if you see status still running past ~5 min of polling, switch to the `Monitor` + `until <check>; do sleep 2; done` pattern from `references/async-polling.md` § Long waits.
1673
+ <!-- skill-options:no-gate-change: adds a convergence note at the top of the rec-wait both answerers (local coding agent vs Ritual server) poll get_recommendations_preview until1 rec; the only difference is who produced the answers. No new pause gate or Step header; the run/pause gate + its options are unchanged. -->
1674
+
1675
+ **Both answerers converge here — once the run is underway, poll until recommendations exist.** The job from this point on is the SAME regardless of who produced the answers: poll `mcp__ritual__get_recommendations_preview(exploration_id)` until it returns **at least one recommendation**, then continue to Step 9. The *only* difference between the two paths is the **answerer** — the **local coding agent** (you, when repo-linked) vs **Ritual's server agentic run** — and that only changes how you reach this wait (agent-answered → straight to the rec poll; server → poll the run to `COMPLETED` first, then the recs). Never render the Step 9 landing, and never call `accept_recommendations`, from a zero-rec read.
1676
+
1677
+ **Agent-answered path (default):** you already wrote + `submit_all_answers`'d, so there's no agentic run to poll — go straight to the recommendation wait: poll `mcp__ritual__get_recommendations_preview(exploration_id)` (`Bash sleep 20` per iteration, a "still generating recommendations…" line every ~3 polls) until it returns **at least one recommendation**, then continue to Step 9. NEVER render the Step 9 landing — and never call `accept_recommendations` — from a zero-rec read; if 10+ min pass with zero rows, surface it as an anomaly. (Skip the `get_agentic_run` polling below — that's the server-fallback path.)
1678
+
1679
+ **Server fallback path** (you called `start_agentic_run`): poll `mcp__ritual__get_agentic_run(run_id)` using `references/async-polling.md`: **`Bash sleep 20` (constant 20 — matches Spark's 20s agentic cadence; never escalate)** per iteration, then a fresh status call. Even if the run takes 2+ minutes, the sleep value stays a constant 20; the harness blocks chained-shorter-sleeps-at-increasing-N just like it blocks `sleep ≥ 30`, but a fixed `20` is non-escalating and under 30 → guard-safe. Agentic runs CAN exceed 5 min for large explorations — if you see status still running past ~5 min of polling, switch to the `Monitor` + `until <check>; do sleep 2; done` pattern from `references/async-polling.md` § Long waits.
1638
1680
 
1639
1681
  **On the FIRST poll only** (not every poll), prepend one line that locks the "background execution is default" mental model:
1640
1682
 
@@ -310,19 +310,16 @@ This rule applies to: Step 9.5 (`get_requirement_set_status`), Step 10b (`get_bu
310
310
 
311
311
  #### Inline pulses — surface reasoning readiness climbing as context debt drops
312
312
 
313
- After **Steps 3, 5, 7.4, 8, 9, and 10**, emit a one-line **context pulse** showing how the score moved. This is the visible encouragement loop — the user watches **reasoning readiness** climb (or equivalently, **context debt** drop) with each step instead of just feeling like the agent is asking for more inputs.
313
+ The context pulse appears **only from the curate-questions step onward** — emit it after **Steps 7.4, 8, 9, and 10**, the FIRST one being when the user proceeds from curating discovery questions. Do NOT emit a pulse at the Job gate, the Scope gate, or after recon (Steps 3/5) — early on the score is low and noisy and the line just clutters the gate. This is the visible encouragement loop once the build is genuinely moving — the user watches **reasoning readiness** climb (context debt drop) as discovery recommendations brief land.
314
314
 
315
315
  The pulse rule and visual specs live in the [§ /ritual context-pulse](#ritual-context-pulse) section below — see *Step CP5 — visual modes*. TL;DR:
316
316
 
317
- The pulse has TWO parts, and they sit in DIFFERENT places the score at the top of the message (status: where you are), and the **lift bridge** immediately above the action line (motivation: why your next move matters).
317
+ **Placement always at the BOTTOM of the message, never the first line.** The pulse score line sits **immediately above the action/CTA line** (with the one-sentence lift bridge), so the message leads with the step's actual content and ends with the progress signal + the next move. Never open a message with the pulse.
318
318
 
319
319
  ```text
320
- Pulse: Reasoning Readiness 58% · Context Debt 42% · +3% (scope locked)
321
-
322
320
  {…the step's content…}
323
321
 
324
- Most of the gap left is unsettled design decisions that's exactly what
325
- the next step, discovery, resolves.
322
+ Pulse: Reasoning Readiness 58% · Context Debt 42% · +3% (scope locked)
326
323
  Reply proceed (run discovery → recommendations) · expert · pause
327
324
  ```
328
325
 
@@ -1,5 +1,5 @@
1
1
  <!-- GENERATED from references/build-flow.md by apps/cli/scripts/generate-lite-flow.js — DO NOT EDIT. -->
2
- <!-- source-sha: bc6ea52efd75e1c7 -->
2
+ <!-- source-sha: 49db57c7a618c67e -->
3
3
 
4
4
  # /ritual lite — fast build (generated; do not edit)
5
5
 
@@ -40,6 +40,54 @@ Follow build-flow.md's steps below EXACTLY, with these **LITE OVERRIDES**:
40
40
  UX brief review, plan-fidelity audit, and sibling-exploration forks are omitted
41
41
  (they're removed from the flow below).
42
42
 
43
+ ## Autonomous worktree mode (discovery — no human, stop at the brief)
44
+ **Trigger:** the invocation carries the `--worktree` flag (you were launched by
45
+ `ritual lite --worktree "<ask>"` — a git worktree was spun up and you are running
46
+ HEADLESS inside it, with no human present). A developer parked an unchosen option
47
+ for background discovery (unchosen-options → discovery worktrees). When you see
48
+ `--worktree`, apply these EXTRA rules on top of the lite overrides above:
49
+ - **There is no human, so auto-resolve EVEN the two touchpoints.** Accept the
50
+ classified job (Step 0.7) and the recommendations (Step 9) without waiting —
51
+ take the default at every gate, including those two. (If the job comes back
52
+ generic, proceed as the generic `Feature Brief` build; there's no one to
53
+ clarify with.)
54
+ - **Create the exploration with `spawn_origin: 'discovery_worktree'`** (Step 6,
55
+ `create_exploration`) so `get_exploration_status` reports
56
+ `autonomousDiscovery: true`.
57
+ - **Answer the discovery questions YOURSELF (Step 8 override) — do NOT call
58
+ `start_agentic_run`.** You have the repo open; you are the best answerer. The
59
+ accept call (Step 7.4, `accept_discovery_questions_batch`) returns
60
+ `materialized[]` — the committed questions with their row `id`s. For each, call
61
+ `mcp__ritual__write_answer_context(question_id, content)` with an answer
62
+ grounded in your codebase recon — answer in PARALLEL where your agent supports
63
+ it (e.g. one subagent per Area). Keep each answer to **~300–600 words by
64
+ default**. The answer is **prose**; code is **optional reference, not part of
65
+ the answer** — attach a snippet only when it would help a future reader/agent
66
+ reason about your answer (a key type/contract/call site), never to complete it.
67
+ When you do, `content` is **markdown**: add it as a **fenced code block with a
68
+ language tag** (minimal lines + a `file/path`, never a whole-file paste — Spark
69
+ lifts these into a collapsed "View details" reference and markdown stays
70
+ portable to the `.ritual/` projection). A snippet is **illustrative, not a
71
+ verbatim copy** — simplify/elide freely, and **NEVER** include secrets, API
72
+ keys, tokens, credentials, `.env` values, real customer data, or PII (use
73
+ placeholders like `process.env.X` / `"<api-key>"`); the same goes for the prose.
74
+ The content is provisional + provenance-tagged agentic until committed. When
75
+ every committed question has answer context, call
76
+ `mcp__ritual__submit_all_answers(exploration_id)` — it commits the set and
77
+ triggers recommendation generation (the BYO-answerer flow; `start_agentic_run`
78
+ is unnecessary). Then poll `get_recommendations_preview` until ≥1 recommendation
79
+ and continue to the brief.
80
+ - **Materialize the reasoning as files (OKF projection).** Once the brief is
81
+ written, run `ritual project <exploration-id>` — it projects the exploration
82
+ (index + build-brief + scope-contract + recommendations) into `.ritual/` in
83
+ this worktree, so the developer who `cd`s in reads the reasoning as files, not
84
+ just a graph id. Projection, not replica: the live graph stays authoritative.
85
+ - **STOP there.** Do NOT branch, plan, implement, or open a PR — that is the
86
+ developer's call when they land in the worktree. The brief is **agent-authored
87
+ and NOT human-reviewed**; surface it as such so it's read with skepticism.
88
+ This mode adds no new skill — it IS `lite`, just with no human to pause for and a
89
+ hard stop at the brief. A normal (attended) `lite` run ignores this section.
90
+
43
91
  ---
44
92
 
45
93
  ## /ritual build
@@ -90,7 +138,7 @@ When **not** to use:
90
138
 
91
139
  Use explicit **[LITE AUTO — no pause; auto-pick the recommended default]** only at decision gates. Pause when the user must choose among options, approve creation or acceptance, resolve ambiguity, authorize implementation, accept cost/time, or provide missing non-code context. Do **not** pause for status-only steps, safe defaults, internal recon, or silent checks.
92
140
 
93
- **Pauses are not optional even in auto-mode** (load-bearing). When the host agent has auto-accept / bypass-permissions enabled, the SKILL must still honor every `**[LITE AUTO — no pause; auto-pick the recommended default]**` as a hard stop. Inferring an answer from context, choosing a default, or pressing on without an actual user reply defeats the build flow's value: Ritual is producing aligned recommendations because the human shaped the inputs, not because the agent guessed plausibly. The auto-mode reminder in Step 0 below is informational only it does not relax this rule; it's a heads-up to the user, not permission to bypass pauses.
141
+ **Pauses are not optional even in auto-mode** (load-bearing). When the host agent has auto-accept / bypass-permissions enabled, the SKILL must still honor every `**[LITE AUTO — no pause; auto-pick the recommended default]**` as a hard stop. Inferring an answer from context, choosing a default, or pressing on without an actual user reply defeats the build flow's value: Ritual is producing aligned recommendations because the human shaped the inputs, not because the agent guessed plausibly. We do not surface a heads-up about this to the user (Step 0) we simply enforce the gates regardless of the host's auto-accept mode.
94
142
 
95
143
  ---
96
144
 
@@ -104,19 +152,18 @@ Follow `references/cli-output-contract.md` for terminal output, dense-list forma
104
152
  >
105
153
  > The new shape: one informational line in the FIRST user-visible message of the flow. No pause. No `**[LITE AUTO — no pause; auto-pick the recommended default]**` here. If the user IS in auto-mode, the next genuine decision pause (workspace pick, scope pick, etc.) is the natural place they'll notice it racing past. The line below gives them the right cue + remediation.
106
154
 
107
- The SKILL MUST include the following one-line heads-up at the top of the **first** user-visible message in a `/ritual build` flow (typically the workspace summary in Step 1, or the no-args prompt in Step 1.1). Include it once per flow only:
155
+ Do NOT show an auto-mode / "~N decisions" / Shift+Tab heads-up. It reads as meta-instruction clutter at the start of the flow just begin the flow plainly. (The pausing discipline below is enforced regardless of the host's auto-accept mode; we simply don't preface it with a lecture.)
108
156
 
109
- ```text
110
- Heads-up: Ritual's build flow needs ~5 real decisions from you (workspace,
111
- scope, discovery picks, rec acceptance, implementation approval). If your
112
- agent is in auto-accept / bypass-permissions mode, those pauses won't
113
- actually pause for you — toggle off first (Claude Code: Shift+Tab to cycle
114
- back to "default").
115
- ```
157
+ Pausing discipline is still load-bearing — every `**[LITE AUTO — no pause; auto-pick the recommended default]**` later in the flow is a hard stop regardless of whether the user reads it. The agent's contract is unchanged from the preamble: never infer an answer, never pick a default, never press on without an actual user reply. Auto-mode collapsing those pauses is the user's risk to accept; the SKILL enforces the gates regardless.
158
+
159
+ <!-- skill-options:no-gate-change: voice/copy cleanup — removes the auto-mode "~5 decisions" heads-up, adds a no-preamble/no-editorializing/render-verbatim voice rule, replaces job-gate + run-gate copy with plainer wording, and moves the context pulse to the bottom (above the CTA) starting only at the curate-questions step. No tracked pause gate, option, or Step header is added, removed, or changed. -->
116
160
 
117
- That's it. No menu. No required reply. Just inform.
161
+ **Voice render gates plainly, add NOTHING (load-bearing, applies to EVERY message in the flow).** Output the gate copy this skill prescribes and nothing else. In particular, NEVER:
162
+ - **Preface a tool call with narration.** Don't say "I'll start by classifying the job…", "Let me kick off an exploration…", "I'll create the exploration and pull questions…". Just make the tool call; report the result plainly after.
163
+ - **Editorialize about the work.** Don't add commentary like "this is exactly the kind of ambiguous, cross-cutting work where it pays to surface context before writing code", "the design decisions still aren't settled", or any "here's why this step matters" justification. The user knows why they ran `/ritual build`.
164
+ - **Narrate internal mechanics or paraphrase the gate copy into process-talk.** Don't say "You're framed. Grounding in the codebase, then I'll…" or describe what Ritual's research agents do under the hood. Lead with the plain meaning for the user; surface mechanism only if they ask.
118
165
 
119
- Pausing discipline is still load-bearing — every `**[LITE AUTO — no pause; auto-pick the recommended default]**` later in the flow is a hard stop regardless of whether the user reads or ignores this heads-up. The agent's contract is unchanged from the preamble: never infer an answer, never pick a default, never press on without an actual user reply. Auto-mode collapsing those pauses is the user's risk to accept; the SKILL's job is just to surface that risk visibly once, then enforce the gates regardless.
166
+ Every message should be the prescribed gate copy (rail + content + CTA) terse, plain, no preamble, no sign-off commentary.
120
167
 
121
168
  **Per-agent indicators** (informational, for the SKILL's own awareness — NOT to gate behavior):
122
169
 
@@ -183,8 +230,9 @@ When this gate runs:
183
230
  ● Job ○ Scope ○ Discovery ○ Recommendations ○ {Deliverable} ○ Implementation (Your agent)
184
231
 
185
232
  You're looking to: {restate the ask in one short clause}
186
- The job to be done: {workItemLabel} — {why}
187
- Deliverable: {deliverableTemplate}
233
+
234
+ Once you run the exploration and review recommendations, a {deliverableTemplate} will be
235
+ created as context for your coding agent.
188
236
 
189
237
  Reply `proceed` to frame the problem (sub-problems + problem statement), or tell me what the
190
238
  job actually is.
@@ -279,10 +327,8 @@ Resolution order:
279
327
  - **Not found** (deleted, access revoked, wrong id in config): pause with a clear error and offer `workspace: list` to re-bind. Don't fall through to `list_explorations` later — it errors with a less actionable message.
280
328
  - **Found:** store `workspace.explorationCount` for Step 1.5. The SKILL never maintains a local "empty workspace" cache because that goes stale against anything that mutates the workspace outside this CLI's view.
281
329
 
282
- User-visible (per Step 0, prepend the one-line auto-mode heads-up — once per flow):
330
+ User-visible:
283
331
 
284
- > Heads-up: Ritual's build flow needs ~5 real decisions from you (workspace, scope, discovery picks, rec acceptance, implementation approval). If your agent is in auto-accept / bypass-permissions mode, those pauses won't actually pause for you — toggle off first (Claude Code: Shift+Tab to cycle back to "default").
285
- >
286
332
  > Using workspace: **{workspaceName}** from `.ritual/config.json`.
287
333
  > Override with `workspace: list`.
288
334
 
@@ -347,12 +393,6 @@ If there are **zero existing explorations** and `raw_input = null`, do not say "
347
393
  Ritual build
348
394
  ✓ Job ● Scope ○ Discovery ○ Recommendations ○ Build brief ○ Implementation (Your agent)
349
395
 
350
- Heads-up: Ritual's build flow needs ~5 real decisions from you (workspace,
351
- scope, discovery picks, rec acceptance, implementation approval). If your
352
- agent is in auto-accept / bypass-permissions mode, those pauses won't
353
- actually pause for you — toggle off first (Claude Code: Shift+Tab to cycle
354
- back to "default").
355
-
356
396
  Using workspace: {workspaceName}.
357
397
 
358
398
  No Ritual history here yet.
@@ -598,7 +638,33 @@ Steps:
598
638
  f. **If the user picks one (1-N):**
599
639
  - Set the chosen candidate's `summary` as the `raw_input` for the rest of the flow.
600
640
  - **Skip Step 1.5 step 8 (overlap check)** — the user just picked from system suggestions explicitly grounded in workspace state; a fresh overlap pass would be redundant noise.
601
- - Continue to Step 2 (template selection).
641
+ - **Run the unchosen-candidates gate (f.1) BEFORE continuing**, then continue to Step 2.
642
+
643
+ <!-- skill-options:no-gate-change: f.1 is an OPTIONAL skippable sub-prompt nested in Step 1.5 step 6 (default skip); adds no tracked pause gate or Step header, so the structural fingerprint is unchanged (check-skill-options-contract green). -->
644
+ f.1 **Unchosen-candidates gate (2026-06-14, unchosen-options → discovery worktrees).** The candidates the user did NOT pick are paths worth not silently dropping. Render ONE compact, SKIPPABLE prompt — for each unchosen candidate, the user can spin up **discovery now** (a background worktree reasons it to a build brief) or **log it as a future job**. Promote DELIBERATELY: the default is to drop. (This gate is itself skipped in autonomous/worktree mode — never spawn discovery recursively.)
645
+
646
+ ```text
647
+ You picked #{k}. The other {M} — want to keep any going?
648
+ • `discover <nums>` — spin up discovery NOW in a background git worktree: an agent reasons it
649
+ end-to-end to a build brief (reasoning only, no code). e.g. `discover 1`
650
+ • `next-job <nums>` — just log it as a future job (a draft exploration in this workspace; nothing runs)
651
+ • `skip` — drop them (default)
652
+ ```
653
+
654
+ Resolve the reply, then continue to Step 2 for the picked candidate:
655
+ - **`discover <nums>`** → for each, run `ritual lite "{candidate.summary}" --worktree` **in the
656
+ BACKGROUND** (do not block the build — use your shell's background/async execution). It spins a
657
+ git worktree and runs autonomous discovery to a brief there; tell the user where (`<repo>.ritual-discover/<slug>`).
658
+ The result is an exploration with `spawn_origin: 'discovery_worktree'`; its brief is
659
+ agent-authored, not human-reviewed. (See `references/unchosen-options-discovery-worktrees.md` in `documents/architecture/`.)
660
+ - **`next-job <nums>`** → for each, call `mcp__ritual__create_exploration` with the candidate's
661
+ `title` as `name`, its `summary` as `problem_statement`, `spawn_origin: 'next_job'`, and NO
662
+ `agentic` flag — a NOT_STARTED draft that shows in the workspace roster as a future job. Cheap; nothing runs.
663
+ - **`skip` / no reply about them** → drop silently.
664
+
665
+ Keep it ONE prompt, never per-candidate pauses. If the user just proceeds without addressing it, treat as `skip`.
666
+
667
+ f.2 **Continue to Step 2 (template selection)** for the picked candidate.
602
668
 
603
669
  g. **If the user says "none" / "let me describe":** continue to Step 2 normally; treat as if they had originally picked "start fresh" with no raw_input yet (they'll provide one at Step 3-4 time).
604
670
 
@@ -931,7 +997,7 @@ The returned text becomes the new current draft. Show it using the same `Problem
931
997
 
932
998
  When the user locks the frame, store the final text as `problem_statement` for Step 6.
933
999
 
934
- **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. Translate raw tier labels into user-facing copy per `references/cli-output-contract.md` § Pulse tier labels never expose `RAW_ASK` / `UNDER_SPECIFIED` / etc. directly.
1000
+ **No pulse here.** The context pulse appears only from the curate-questions step onward (cli-output-contract § Inline pulses) early on the score is low/noisy and the line clutters the gate. The first pulse is at Step 7.4.
935
1001
 
936
1002
  #### Step 5.7 — Ground the exploration (silent recon — runs AFTER the frame locks)
937
1003
 
@@ -1074,11 +1140,6 @@ If no seed file is found, OR the seed's `## The ask` doesn't match the current `
1074
1140
  Scope correction:
1075
1141
  - I did not find `guest_session_id` in the inspected models.
1076
1142
 
1077
- Pulse: Reasoning Readiness ~55% · Context Debt 45% · +12% (initial ask + code recon)
1078
-
1079
- (lift bridge — renders right above the next action) Most of the gap left is
1080
- unsettled design decisions — that's exactly what the next step, discovery, resolves.
1081
-
1082
1143
  Next: attach PRDs/tickets if they should shape scope, or `proceed` to continue.
1083
1144
  ```
1084
1145
 
@@ -1155,7 +1216,7 @@ If no seed file is found, OR the seed's `## The ask` doesn't match the current `
1155
1216
 
1156
1217
  If the user explicitly asks "what did you find?", you may show a tight digest then — otherwise stay silent.
1157
1218
 
1158
- **Pulse (recon done):** Emit a pulse line — repo grounding just moved meaningfully (sources collected, agent inspected files, possibly KG hits). Compute per `/ritual context-pulse` § Step CP3 and render compact unless this is the FIRST pulse of the build flow, in which case use full.
1219
+ **No pulse here** (pre-curate see cli-output-contract § Inline pulses; the first pulse is at Step 7.4).
1159
1220
 
1160
1221
  ##### 5.7.3 — Collect the `sources` array
1161
1222
 
@@ -1332,9 +1393,8 @@ Ritual build
1332
1393
  Discovery questions ready — {M} generated across {N} areas.
1333
1394
 
1334
1395
  These 12 questions target where this problem is hardest — the tradeoffs,
1335
- constraints, and unknowns that decide the design. When you proceed, Ritual
1336
- dispatches its research agents to answer them against this codebase and your
1337
- sources; those answers become the spine of the {Deliverable}.
1396
+ constraints, and unknowns that decide the design. Next, agents will develop
1397
+ answers and generate recommendations.
1338
1398
 
1339
1399
  {Area name 1}
1340
1400
  ✓ 1. {question, full text, wrapped readably}
@@ -1556,7 +1616,21 @@ Skip silently if no anti-goals were mentioned. (No mention = nothing to confirm;
1556
1616
 
1557
1617
  #### Step 8 — Run discovery through recommendations
1558
1618
 
1559
- 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.
1619
+ The pipeline runs answers → recommendations. **Choose the answerer by whether you
1620
+ actually have the code to ground answers in — this is NOT decided by the fact
1621
+ it's `/ritual build`.**
1622
+
1623
+ - **You're genuinely repo-linked** — Step 5.7 recon ran and you read real files
1624
+ (you have a `sources` list / codebase context packet, and filesystem access to
1625
+ the repo): **YOU answer the picked questions** yourself. You're closest to the
1626
+ code, so the answers are grounded in what you actually read.
1627
+ - **You're not** — recon was skipped (Step 5.7.6), no repo is open, or the ask
1628
+ isn't a codebase task: use the **server agentic run** (`start_agentic_run`),
1629
+ which sources answers from the knowledge graph + registered sources instead.
1630
+
1631
+ Pick the path honestly; don't claim to answer from code you didn't read.
1632
+
1633
+ <!-- skill-options:no-gate-change: Step 8 answerer is chosen by real repo-linkage (recon ran / code open), not by the /ritual build invocation; agent-answers when repo-linked, server-run fallback. Includes prose guidance on answer length (~300-600 words), that attached code is OPTIONAL illustrative reference (not part of the answer, not a verbatim copy), and a hard no-secrets/no-PII redaction rule for the BYO answerer. The run/pause gate + its options are unchanged — no new pause gate or Step header. -->
1560
1634
 
1561
1635
  For `engineering`, `delivery`, and `operations` roles, show:
1562
1636
 
@@ -1566,20 +1640,28 @@ Ritual build
1566
1640
 
1567
1641
  Run discovery
1568
1642
 
1569
- Ritual will source answers for the picked questions, then generate
1643
+ I'll answer the picked questions from the codebase, then generate
1570
1644
  recommendations. This usually takes a few minutes.
1571
1645
 
1572
- Reply `run` to source answers → generate recommendations.
1646
+ Reply `run` to answer → generate recommendations.
1573
1647
  Reply `pause` to stop here.
1574
1648
  ```
1575
1649
 
1650
+ (Match the first line to the path you'll actually take: repo-linked → "I'll answer the picked questions from the codebase…"; fallback → "Ritual will source answers for the picked questions…". Don't claim to answer from code if you're taking the server path.)
1651
+
1576
1652
  Visible CTA is `run`. Accept `r`, `go`, `continue`, or `next` as aliases. Per `references/cli-output-contract.md` § Surface-aware continuation prompts, do NOT treat empty input as proceed inside agent chat.
1577
1653
 
1578
- Call `mcp__ritual__start_agentic_run` with:
1579
- - `scope_type: 'exploration'`
1580
- - `exploration_id`
1654
+ On `run`, **if you're genuinely repo-linked (per the check above), answer the questions yourself** (BYO-answerer; do NOT call `start_agentic_run`):
1655
+ 1. The Step 7.4 accept (`accept_discovery_questions_batch`) returned `materialized[]` — the committed questions with their row `id`s. (If you didn't keep them, the same ids are what you passed to accept.)
1656
+ 2. For each committed question, call `mcp__ritual__write_answer_context(question_id, content)` with an answer grounded in your codebase recon — the files you read at Step 5.7, the actual code, real constraints. Answer in PARALLEL where your agent supports it (e.g. one subagent per Area). The content is provisional + provenance-tagged agentic until committed; only the final committed set drives recommendations.
1657
+ - **Length:** keep each answer to **~300–600 words by default** — tight and grounded, not an essay. Go longer only when the question genuinely needs it.
1658
+ - **Code:** the answer itself is **prose** — keep it that way. Code is **optional reference, not part of the answer**: attach a snippet only when it would help a future reader or agent reason about your answer (a key type, contract, or call site worth pointing back to), never to complete the answer. When you do, `content` is **markdown** — add it as a **fenced code block with a language tag** (e.g. ` ```ts `) with the `file/path` and the minimal illustrative lines, never a whole-file paste. Spark lifts these fences out of the prose into a collapsed "View details" reference beside the answer, and markdown keeps them portable to the `.ritual/` projection.
1659
+ - **Never leak secrets or sensitive data.** A snippet is **illustrative, not a verbatim copy** — it only has to convey the shape/idea, so simplify and elide freely. **NEVER** include API keys, tokens, passwords, connection strings, credentials, `.env` values, real customer data, or PII — even if they're literally in the file you read. Replace them with obvious placeholders (`process.env.X`, `"<api-key>"`, `"user@example.com"`). The same goes for the prose: describe constraints without pasting secret values.
1660
+ 3. When every committed question has answer context, call `mcp__ritual__submit_all_answers(exploration_id)` — it commits the set and triggers recommendation generation. Then go to the recommendation wait (Step 8.1, agent-answered path).
1661
+
1662
+ **Fallback — server answers (no repo / nothing to ground in):** call `mcp__ritual__start_agentic_run` with `scope_type: 'exploration'` + `exploration_id`, then follow the server polling path (8.0 → 8.1).
1581
1663
 
1582
- For `product`, `design`, or explicitly PRD-style flows, answer review may be useful. Offer two choices without time estimates:
1664
+ For `product`, `design`, or explicitly PRD-style flows where answer review is useful, offer two choices without time estimates (this path uses the SERVER answer engine so the user can review each generated answer — Step 8.5):
1583
1665
 
1584
1666
  ```text
1585
1667
  Ritual build
@@ -1598,9 +1680,11 @@ Reply `1` or `2`. Reply `pause` to stop here.
1598
1680
 
1599
1681
  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.
1600
1682
 
1601
- ##### 8.0 — "You're unblocked" pre-roll (right after `start_agentic_run` returns the run_id)
1683
+ ##### 8.0 — "You're unblocked" pre-roll (once server-side work is running)
1684
+
1685
+ This pre-roll is for the **rec-generation wait** — fire it once server-side work is running: on the agent-answered path, right after `submit_all_answers` returns (recommendation generation is now queued); on the server fallback, right after `start_agentic_run` returns the run_id. (On the agent-answered path the *answering itself* is your active work — don't show the pre-roll until you've submitted.)
1602
1686
 
1603
- **Lock the product promise BEFORE you enter the polling loop.** The run continues server-side; the user is free to step away. The polling loop becomes the agent's job, not the user's obligation.
1687
+ **Lock the product promise BEFORE you enter the polling loop.** Recommendation generation continues server-side; the user is free to step away. The polling loop becomes the agent's job, not the user's obligation.
1604
1688
 
1605
1689
  Tier the pre-roll by projected duration. Latency baseline: ~15s/question (V5.2 + KG injection, calibrate quarterly against `recs-pipeline.ts` eval results). Multiply the picked-question count by 15s, divide by 60 to get minutes.
1606
1690
 
@@ -1650,7 +1734,13 @@ Pick whichever fits the user's flow — they're equivalent in content. Do not in
1650
1734
 
1651
1735
  ##### 8.1 — Polling loop
1652
1736
 
1653
- Poll `mcp__ritual__get_agentic_run(run_id)` using `references/async-polling.md`: **`Bash sleep 20` (constant 20 — matches Spark's 20s agentic cadence; never escalate)** per iteration, then a fresh status call. Even if the run takes 2+ minutes, the sleep value stays a constant 20; the harness blocks chained-shorter-sleeps-at-increasing-N just like it blocks `sleep 30`, but a fixed `20` is non-escalating and under 30 → guard-safe. Agentic runs CAN exceed 5 min for large explorations if you see status still running past ~5 min of polling, switch to the `Monitor` + `until <check>; do sleep 2; done` pattern from `references/async-polling.md` § Long waits.
1737
+ <!-- skill-options:no-gate-change: adds a convergence note at the top of the rec-wait both answerers (local coding agent vs Ritual server) poll get_recommendations_preview until1 rec; the only difference is who produced the answers. No new pause gate or Step header; the run/pause gate + its options are unchanged. -->
1738
+
1739
+ **Both answerers converge here — once the run is underway, poll until recommendations exist.** The job from this point on is the SAME regardless of who produced the answers: poll `mcp__ritual__get_recommendations_preview(exploration_id)` until it returns **at least one recommendation**, then continue to Step 9. The *only* difference between the two paths is the **answerer** — the **local coding agent** (you, when repo-linked) vs **Ritual's server agentic run** — and that only changes how you reach this wait (agent-answered → straight to the rec poll; server → poll the run to `COMPLETED` first, then the recs). Never render the Step 9 landing, and never call `accept_recommendations`, from a zero-rec read.
1740
+
1741
+ **Agent-answered path (default):** you already wrote + `submit_all_answers`'d, so there's no agentic run to poll — go straight to the recommendation wait: poll `mcp__ritual__get_recommendations_preview(exploration_id)` (`Bash sleep 20` per iteration, a "still generating recommendations…" line every ~3 polls) until it returns **at least one recommendation**, then continue to Step 9. NEVER render the Step 9 landing — and never call `accept_recommendations` — from a zero-rec read; if 10+ min pass with zero rows, surface it as an anomaly. (Skip the `get_agentic_run` polling below — that's the server-fallback path.)
1742
+
1743
+ **Server fallback path** (you called `start_agentic_run`): poll `mcp__ritual__get_agentic_run(run_id)` using `references/async-polling.md`: **`Bash sleep 20` (constant 20 — matches Spark's 20s agentic cadence; never escalate)** per iteration, then a fresh status call. Even if the run takes 2+ minutes, the sleep value stays a constant 20; the harness blocks chained-shorter-sleeps-at-increasing-N just like it blocks `sleep ≥ 30`, but a fixed `20` is non-escalating and under 30 → guard-safe. Agentic runs CAN exceed 5 min for large explorations — if you see status still running past ~5 min of polling, switch to the `Monitor` + `until <check>; do sleep 2; done` pattern from `references/async-polling.md` § Long waits.
1654
1744
 
1655
1745
  **On the FIRST poll only** (not every poll), prepend one line that locks the "background execution is default" mental model:
1656
1746
 
@@ -1,5 +1,5 @@
1
1
  {
2
- "cliVersion": "0.36.11",
3
- "builtAt": "2026-06-14T18:50:01.090Z",
4
- "skillsHash": "39dbaf6dbdf9"
2
+ "cliVersion": "0.36.22",
3
+ "builtAt": "2026-06-15T13:28:31.790Z",
4
+ "skillsHash": "8a8905aae549"
5
5
  }