@ritualai/cli 0.7.13 → 0.7.15

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 (62) hide show
  1. package/README.md +44 -0
  2. package/dist/commands/status.js +190 -0
  3. package/dist/commands/status.js.map +1 -0
  4. package/dist/index.js +15 -0
  5. package/dist/index.js.map +1 -1
  6. package/dist/lib/status-formatter.js +162 -0
  7. package/dist/lib/status-formatter.js.map +1 -0
  8. package/package.json +1 -1
  9. package/skills/claude-code/ritual/.ritual-bundle.json +2 -2
  10. package/skills/claude-code/ritual/DESIGN.md +1 -1
  11. package/skills/claude-code/ritual/SKILL.md +59 -2
  12. package/skills/claude-code/ritual/manifest.json +23 -8
  13. package/skills/claude-code/ritual/references/brief-verification-checklist.md +169 -0
  14. package/skills/claude-code/ritual/references/build-flow.md +329 -17
  15. package/skills/claude-code/ritual/references/resume-flow.md +35 -13
  16. package/skills/claude-code/ritual/references/status-flow.md +94 -0
  17. package/skills/claude-code/ritual/references/ui-ux-checklist.md +198 -0
  18. package/skills/codex/ritual/.ritual-bundle.json +2 -2
  19. package/skills/codex/ritual/DESIGN.md +1 -1
  20. package/skills/codex/ritual/SKILL.md +59 -2
  21. package/skills/codex/ritual/manifest.json +23 -8
  22. package/skills/codex/ritual/references/brief-verification-checklist.md +169 -0
  23. package/skills/codex/ritual/references/build-flow.md +329 -17
  24. package/skills/codex/ritual/references/resume-flow.md +35 -13
  25. package/skills/codex/ritual/references/status-flow.md +94 -0
  26. package/skills/codex/ritual/references/ui-ux-checklist.md +198 -0
  27. package/skills/cursor/ritual/.ritual-bundle.json +2 -2
  28. package/skills/cursor/ritual/DESIGN.md +1 -1
  29. package/skills/cursor/ritual/SKILL.md +59 -2
  30. package/skills/cursor/ritual/manifest.json +23 -8
  31. package/skills/cursor/ritual/references/brief-verification-checklist.md +169 -0
  32. package/skills/cursor/ritual/references/build-flow.md +329 -17
  33. package/skills/cursor/ritual/references/resume-flow.md +35 -13
  34. package/skills/cursor/ritual/references/status-flow.md +94 -0
  35. package/skills/cursor/ritual/references/ui-ux-checklist.md +198 -0
  36. package/skills/gemini/ritual/.ritual-bundle.json +2 -2
  37. package/skills/gemini/ritual/DESIGN.md +1 -1
  38. package/skills/gemini/ritual/SKILL.md +59 -2
  39. package/skills/gemini/ritual/manifest.json +23 -8
  40. package/skills/gemini/ritual/references/brief-verification-checklist.md +169 -0
  41. package/skills/gemini/ritual/references/build-flow.md +329 -17
  42. package/skills/gemini/ritual/references/resume-flow.md +35 -13
  43. package/skills/gemini/ritual/references/status-flow.md +94 -0
  44. package/skills/gemini/ritual/references/ui-ux-checklist.md +198 -0
  45. package/skills/kiro/ritual/.ritual-bundle.json +2 -2
  46. package/skills/kiro/ritual/DESIGN.md +1 -1
  47. package/skills/kiro/ritual/SKILL.md +59 -2
  48. package/skills/kiro/ritual/manifest.json +23 -8
  49. package/skills/kiro/ritual/references/brief-verification-checklist.md +169 -0
  50. package/skills/kiro/ritual/references/build-flow.md +329 -17
  51. package/skills/kiro/ritual/references/resume-flow.md +35 -13
  52. package/skills/kiro/ritual/references/status-flow.md +94 -0
  53. package/skills/kiro/ritual/references/ui-ux-checklist.md +198 -0
  54. package/skills/vscode/ritual/.ritual-bundle.json +2 -2
  55. package/skills/vscode/ritual/DESIGN.md +1 -1
  56. package/skills/vscode/ritual/SKILL.md +59 -2
  57. package/skills/vscode/ritual/manifest.json +23 -8
  58. package/skills/vscode/ritual/references/brief-verification-checklist.md +169 -0
  59. package/skills/vscode/ritual/references/build-flow.md +329 -17
  60. package/skills/vscode/ritual/references/resume-flow.md +35 -13
  61. package/skills/vscode/ritual/references/status-flow.md +94 -0
  62. package/skills/vscode/ritual/references/ui-ux-checklist.md +198 -0
@@ -0,0 +1,169 @@
1
+ ## Brief verification — methodology + output schema
2
+
3
+ Reference for `/ritual build` Step 10b.5 (the auto-fire verify-brief pass that runs after the build brief is generated, before the user reviews it at the Step 10d gate).
4
+
5
+ The brief generator runs server-side and **does not have repo access**. It writes assertions about cited files / functions / classes based on the agent's earlier recon summary — which is a text summary, not the actual code. When the brief says *"`is_allowed_to_see` is insufficient — needs token-based access"* but the code actually ships email-allowlist semantics, the contradiction is invisible to the brief generator and to the user reading the brief.
6
+
7
+ Step 10b.5 closes this gap: **the agent (with repo access) reads the bodies of the specific symbols the brief cites and produces a structured list of findings before the user sees the brief.** Findings flow back into the brief via `refine_build_brief` if any contradictions are detected.
8
+
9
+ This is the **non-UI sibling of `references/ui-ux-checklist.md`** (Step 10.5 UX review). Same methodology shape (read brief → identify citations → find in repo → compare → fill schema → surface findings), different targets (functions / data shapes / model fields instead of UI components).
10
+
11
+ ---
12
+
13
+ ### Core principle
14
+
15
+ **The brief's assertions about cited code must be verified against the actual code before the user is asked to approve them.**
16
+
17
+ The brief generator hedges this risk passively with phrases like *"these recommendations may deviate if the codebase has a stronger existing pattern."* That hedge is honest but not actionable — it tells the reader to maybe check, without telling anyone to actually do the checking. Step 10b.5 makes the checking happen.
18
+
19
+ ---
20
+
21
+ ### Methodology (chain of thought — execute in this order)
22
+
23
+ Do NOT skip to the output schema. The schema only gets filled correctly when the analysis upstream is done.
24
+
25
+ **1. Read the brief end-to-end first.**
26
+
27
+ Open `BUILD-BRIEF.md`. The sections most likely to contain verifiable assertions:
28
+
29
+ - **Codebase Anchors** — explicit file/function citations the brief expects you to extend or replace.
30
+ - **RB-N rationale** — review-blocking claims often cite specific primitives ("the existing `X` is insufficient because Y").
31
+ - **Suggested Implementation** — sequencing claims about what's "already present" vs "needs to be added."
32
+ - **Previously Deferred** — references to prior decisions on overlapping files (sourced from KG).
33
+
34
+ Output of this step: a flat list of every specific code citation the brief makes. **Symbol + file + assertion**. If a section says *"the recommendations may deviate if the codebase has a stronger existing pattern,"* that's exactly the kind of hedge this step exists to resolve — treat it as a high-priority verification target.
35
+
36
+ **2. Extract the explicit citations.**
37
+
38
+ For each cited symbol, capture:
39
+
40
+ - `cited_symbol` — function / class / model field / endpoint name.
41
+ - `cited_file` — file path if mentioned; if not, infer from context (Codebase Anchors usually pairs them).
42
+ - `brief_assertion` — the brief's exact claim about this symbol. One sentence.
43
+
44
+ Cap the list at **15 citations** (highest-leverage ones first — primitives the RBs depend on, symbols cited in multiple sections). 15 is enough to cover the load-bearing risks; more bloats the verification time without proportional signal.
45
+
46
+ **3. For each citation, read the actual code.**
47
+
48
+ Use Grep / Glob / Read. For each cited symbol:
49
+
50
+ - Find the file (Grep `def {symbol}` / `class {symbol}` / `const {symbol}` / `function {symbol}`).
51
+ - Read the function body / class definition / data shape. Include surrounding context (~10 lines) so callers and conventions are visible.
52
+ - Note line numbers (`cited_lines.start` / `cited_lines.end`) so the finding pins to a stable location.
53
+
54
+ **Do not fabricate citations.** If `Grep` returns nothing, the verdict is `not_found`, not "I'll infer what it probably does."
55
+
56
+ **4. Compare brief assertion vs code reality. Assign a verdict per citation.**
57
+
58
+ Three verdicts:
59
+
60
+ - **`verified`** — the brief's claim matches what the code actually does. Most common verdict on a well-anchored brief; the agent's recon summary was accurate; the brief generator got it right.
61
+ - **`contradicted`** — the brief's claim is **wrong**. The code does something different. This is the verdict that drives a refinement.
62
+ - **`not_found`** — the brief cited a symbol the agent could not locate in the repo. Either the symbol was renamed, deleted, or never existed. Either way: the brief is asserting against a phantom; surface to user.
63
+
64
+ **5. Fill the output schema with evidence.**
65
+
66
+ Write `BUILD-BRIEF-VERIFICATION.md` to disk alongside `BUILD-BRIEF.md`. Use the schema below. **Each finding cites the file + line range + the actual code snippet that justified the verdict.** The user reading this must be able to verify your verification — no hand-waving, no claims without evidence.
67
+
68
+ **6. If any findings are `contradicted`, surface to the user inline at Step 10d.**
69
+
70
+ The Step 10d gate normally reads *"Reply `go` to implement, `refine` for edits, `drill {N}` to inspect, `pause` to stop."* When `contradicted` findings exist, the gate's CTA shifts to highlight the contradictions:
71
+
72
+ ```text
73
+ ⚠ Verification found {N} contradiction(s) between the brief and the actual code:
74
+
75
+ · "{cited_symbol}" — brief says "{brief_assertion}". Code reality:
76
+ "{code_reality}" (see {cited_file}:{cited_lines}).
77
+ · ...
78
+
79
+ Reply `refine` to apply these corrections, `go` to proceed anyway,
80
+ or `drill {N}` to inspect one rec.
81
+ ```
82
+
83
+ The user can `refine` (recommended) — at which point the SKILL calls `refine_build_brief` with the structured findings array, and the LLM produces an updated brief that incorporates the corrections authoritatively. Or `go` if the user has context the agent doesn't (e.g. "yes the brief is wrong but I want to ship it as-is for now"). The decision stays with the user; the agent surfaces the evidence.
84
+
85
+ ---
86
+
87
+ ### Output schema — `BUILD-BRIEF-VERIFICATION.md`
88
+
89
+ Render exactly the sections below. Every section MUST exist (use `(none)` / `(no contradictions)` for empty cases — do not skip).
90
+
91
+ ```markdown
92
+ <!--
93
+ Generated by Ritual — brief verification pass
94
+ Exploration: https://app.ritualapp.cloud/e/{exploration_id}
95
+ Source brief: BUILD-BRIEF.md
96
+ Do not remove this header.
97
+ -->
98
+
99
+ # Brief Verification — {exploration name}
100
+
101
+ ## Summary
102
+
103
+ Verified: {N} · Contradicted: {M} · Not found: {K}
104
+
105
+ {One-paragraph natural-language summary of the verification result. If
106
+ contradictions exist, lead with the most load-bearing one. If everything
107
+ checked out, state that clearly.}
108
+
109
+ ## ⚠ Contradicted ({M})
110
+
111
+ (one block per contradicted citation, omit section entirely if M=0)
112
+
113
+ ### `{cited_symbol}` — {cited_file}:{lines.start}-{lines.end}
114
+
115
+ - **Brief asserts:** "{brief_assertion}"
116
+ - **Code reality:** "{code_reality}"
117
+ - **Evidence (from the file):**
118
+
119
+ ```{language}
120
+ {actual code snippet, ~10 lines}
121
+ ```
122
+
123
+ - **Recommendation:** {what should change in the brief — concrete next step}
124
+
125
+ ## ❓ Not found ({K})
126
+
127
+ (one block per missing citation, omit section entirely if K=0)
128
+
129
+ ### `{cited_symbol}` — cited in {section}
130
+
131
+ - **Brief asserts:** "{brief_assertion}"
132
+ - **Searched:** {file paths / grep queries the agent tried}
133
+ - **Action:** ask the user whether the cited symbol exists under a different name, or whether the brief is referencing something that was renamed / removed.
134
+
135
+ ## ✅ Verified ({N})
136
+
137
+ (compact list; one bullet per verified citation; no body required)
138
+
139
+ - `{cited_symbol}` — {cited_file}:{lines.start}-{lines.end} — brief assertion matches code.
140
+ - ...
141
+ ```
142
+
143
+ ---
144
+
145
+ ### What this verification step does NOT do
146
+
147
+ - **Verify everything in the brief.** Only the symbol-citation slice. Pose-level claims, framing, and general direction are out of scope.
148
+ - **Read the full file.** Read enough surrounding context to verify the symbol (~10 lines); not the whole file. Capped at ~15 citations total to keep this fast.
149
+ - **Edit the brief directly.** Step 10b.5 only writes `BUILD-BRIEF-VERIFICATION.md`. The user decides whether to call `refine_build_brief` with the findings at Step 10d (recommended) or proceed with the brief as-is.
150
+ - **Persist findings to the KG.** Phase 1 is local-only. Phase 2 (filed at `memory/backlog_brief_verification_findings_kg_promotion.md`) adds the `BriefVerificationFinding` Prisma model + endpoint + priorContext injection so future briefs on overlapping files inherit verified facts.
151
+
152
+ ---
153
+
154
+ ### Anti-patterns
155
+
156
+ - **❌ Fabricating evidence.** Every claim in the output file must trace to a real file + line range that the agent actually Read. If Grep returned nothing, the verdict is `not_found`, NOT "I'll just describe what the function probably does."
157
+ - **❌ Re-deriving the brief.** This step is verification, not authoring. Findings exist on a per-citation basis; the agent does not re-write the brief's framing or add new RBs.
158
+ - **❌ Skipping the step on backend-only features.** Step 10b.5 fires automatically regardless of UI / non-UI shape. UI-shaped features use `references/ui-ux-checklist.md` (Step 10.5) on top of this step for the additional UI-pattern review — but every brief runs through the citation-level verification.
159
+ - **❌ Treating the brief's hedge as authorization to skip.** *"may deviate if codebase has a stronger pattern"* is exactly the case Step 10b.5 exists to resolve. The hedge means "go verify"; don't read it as "no need to verify."
160
+ - **❌ Padding the verified list.** Don't enumerate citations the brief didn't actually make just to inflate the "Verified" count. Only cite what the brief cited.
161
+
162
+ ---
163
+
164
+ ### Failure modes to watch for
165
+
166
+ - **Brief makes ZERO citations.** Some brief generations are framing-only and don't reference specific symbols. The verification pass should write a summary noting *"the brief makes no specific code citations; no verification possible"* and the gate proceeds normally. Phase 2 will treat this as a brief-quality signal (briefs without citations are harder to verify).
167
+ - **Symbol exists in multiple places.** When Grep finds the symbol in N>1 files, capture the file the brief most likely meant (use Codebase Anchors context as the disambiguator). If still ambiguous, render one finding per match with verdict `not_found` and surface the ambiguity to the user.
168
+ - **Code semantics ≠ visible signature.** A function might be named one thing but documented to do another. Read the docstring + the body; trust the body. If the docstring contradicts the body, that's its own finding (`contradicted` with verdict notes).
169
+ - **Brief assertion is too vague to verify.** *"The auth flow needs hardening"* doesn't cite a specific symbol; not verifiable. Skip; verify only the assertions specific enough to check.
@@ -1,6 +1,6 @@
1
1
  ## /ritual build
2
2
 
3
- Walks the engineer from a free-form problem statement to vetted, accepted Ritual recommendations using the vNext MCP tool surface.
3
+ Walks the engineer from a free-form problem statement to vetted, accepted Ritual recommendations using the Ritual MCP tool surface.
4
4
 
5
5
  Output: a fully-closed loop — **exploration in COMPLETE state, recommendations accepted (or explicitly handed off to an admin), build brief generated, code implemented, and `sync_implementation` called to register the result in the knowledge graph**. The engineer stays in the driver's seat through concise status updates and explicit pauses only at real decision gates.
6
6
 
@@ -191,10 +191,11 @@ Steps:
191
191
 
192
192
  > I see {N} exploration{s} already in this workspace:
193
193
  >
194
- > **{state_glyph} {state_label}**
195
- > - **{name}** — {short scope summary, first 80 chars of problemStatement}
196
- > - {recommendationCount} rec{s} ({accepted}/{total} approved{implementationSegment}), {openDeferralsCount} open deferral{s}
197
- > - {state-specific call-to-action see table below}
194
+ > **{state_glyph} {state_label}** ({count})
195
+ >
196
+ > 1. **{name}** {short scope summary, first 80 chars of problemStatement}
197
+ > {recommendationCount} rec{s} ({accepted}/{total} approved{implementationSegment}), {openDeferralsCount} open deferral{s}.
198
+ > Next: {state-specific call-to-action — see table below}.
198
199
  >
199
200
  > Recommended: resume one if it matches this work.
200
201
  > Reply with a number/name to resume, `suggest` to find high-leverage candidates from repo + workspace history, `delete N` to remove a duplicate/misfire, or `proceed` to start fresh.
@@ -203,10 +204,11 @@ Steps:
203
204
 
204
205
  > I can help you continue existing work or find the next high-leverage thing.
205
206
  >
206
- > **{state_glyph} {state_label}**
207
- > - **{name}** — {short scope summary, first 80 chars of problemStatement}
208
- > - {recommendationCount} rec{s} ({accepted}/{total} approved{implementationSegment}), {openDeferralsCount} open deferral{s}
209
- > - {state-specific call-to-action see table below}
207
+ > **{state_glyph} {state_label}** ({count})
208
+ >
209
+ > 1. **{name}** {short scope summary, first 80 chars of problemStatement}
210
+ > {recommendationCount} rec{s} ({accepted}/{total} approved{implementationSegment}), {openDeferralsCount} open deferral{s}.
211
+ > Next: {state-specific call-to-action — see table below}.
210
212
  >
211
213
  > Reply with:
212
214
  > - a number/name to resume
@@ -215,6 +217,8 @@ Steps:
215
217
  > - a feature/problem description to start fresh
216
218
  > - `none` to exit
217
219
 
220
+ **Picker rendering anti-pattern (load-bearing) — observed 2026-05-15 in `/ritual resume`, same shape applies here:** each exploration gets ONE picker number `{N}.` on its title line. The summary, recommendation count, and Next-line are indented continuation prose under that number, NEVER their own numbered or bulleted list items. Picker numbering is **flat across all state buckets** (1, 2, 3, … regardless of which `{state_glyph}` header they sit under), so a single number unambiguously picks one exploration. The `({count})` in parens after each state-bucket header is informational and is NEVER a picker number. See `references/resume-flow.md` § R2 for the full anti-pattern with a worked example.
221
+
218
222
  **`{implementationSegment}` resolution rule** — derive from `implementationStatus.implementationRecord` on the listing response:
219
223
 
220
224
  | Condition | Render |
@@ -1118,6 +1122,24 @@ Then summarize the created siblings in the dense-list format. Do not pause after
1118
1122
 
1119
1123
  Longest phase because generation is async + the user picks per-Area. (Internally the API field is `matter_id`; user-facing copy always says Area.)
1120
1124
 
1125
+ **Step 6 → Step 7 transition anti-pattern (load-bearing):** after `create_exploration` succeeds in Step 6, you MUST NOT render Step 8's *"Reply `run` to continue"* CTA. Required next actions, in order, before Step 8 is allowed:
1126
+
1127
+ 1. Call `mcp__ritual__suggest_discovery_questions(exploration_id)` (Step 7.1) — no user input needed; just kick it off.
1128
+ 2. Poll `mcp__ritual__get_discovery_state(exploration_id)` until `ready: true` (Step 7.2).
1129
+ 3. Render the Areas index per § 7.3.1 (NOT a free-form list — see § 7.3.1 rendering anti-pattern below).
1130
+ 4. `[USER PAUSE]` — the user picks Areas + questions, or types `accept shortlist` / `skip discovery`.
1131
+ 5. Call `mcp__ritual__accept_discovery_questions` for each picked Area (Step 7.4).
1132
+ 6. Evaluate Step 7.4.5 triggers; render the scope-classification gate if any fire.
1133
+ 7. ONLY THEN proceed to Step 8 and render the *"Reply `run` to continue"* CTA.
1134
+
1135
+ **Forbidden behaviors:**
1136
+
1137
+ - Calling `start_agentic_run` before `accept_discovery_questions` has been called at least once for this exploration. (`skip discovery` is the explicit exception — it intentionally takes the no-picks path through 7.4.5.)
1138
+ - Silently auto-picking all generated questions and proceeding to Step 8 — observed in agent output 2026-05-15 as "the engineering-mode default is to run, which skips the per-question picker." There is no such default; the picker is mandatory.
1139
+ - Rendering "Next: run discovery through recommendations / Reply `run` to continue" anywhere in the chat before Step 7.4 has completed.
1140
+
1141
+ The picker is **not** a UI suggestion — it's the load-bearing decision gate where the user expresses what to investigate. Skipping it converts the agentic run into an automated "answer everything" pass and erases the user's judgment.
1142
+
1121
1143
  ##### 7.1 — Kick off
1122
1144
 
1123
1145
  Call `mcp__ritual__suggest_discovery_questions(exploration_id)`. Returns immediately with `task_id`. Tell the user with the full rail (we just entered the Discovery phase):
@@ -1193,6 +1215,35 @@ Inside an Area, use `show more` to see the rest.
1193
1215
 
1194
1216
  Number alignment: right-pad the Area name to a consistent column so the counts line up vertically. Drop the `accept shortlist` token when no Area has recommendations (rare; just show the area-number + `skip discovery` CTAs).
1195
1217
 
1218
+ **Rendering anti-pattern (load-bearing) — the Areas index renders ONLY area names + counts. Observed violations 2026-05-15:**
1219
+
1220
+ - ❌ Question previews under each area:
1221
+ ```text
1222
+ 1. Wishlist Visibility Contract (10 qs)
1223
+
1224
+ 1. How PUBLIC/SHARED behave across owner controls...
1225
+ 2. Shared Wishlist Surfaces (8 qs)
1226
+
1227
+ 2. Which entry points light up first...
1228
+ ```
1229
+ No. This invents question previews the SKILL never asked for, AND uses overlapping numbering (`1. {area}` and `1. {question preview}`) that creates ambiguity — when the user replies `5`, neither side can tell what they meant. Single numbering stream: areas only.
1230
+
1231
+ - ❌ Free-form bullet lists, "for your convenience" question summaries, or any text under the area line beyond `{N} recommended · {N} total`.
1232
+
1233
+ - ❌ Adding a "TL;DR" / "highlights" section above or below the Areas list.
1234
+
1235
+ **The correct shape is exactly** (no exceptions):
1236
+
1237
+ ```
1238
+ Areas:
1239
+
1240
+ 1. {Area name} {N} recommended · {N} total
1241
+ 2. {Area name} {N} recommended · {N} total
1242
+ ...
1243
+ ```
1244
+
1245
+ If the user wants to see questions, they pick an Area number — that's what § 7.3.2 (Area detail) is for. **Do not pre-empt their drill choice with question previews.** Same rule as Step 9.1's "use server preview verbatim, do not free-form-summarize on top."
1246
+
1196
1247
  **Why `accept shortlist`, not `accept recommended`:**
1197
1248
 
1198
1249
  - "Recommended" is ambiguous (recommended per Area? globally? by category? recommended *recs* later in the flow?). The discovery picker uses **shortlist** explicitly because the shortlist is global (6–10 questions across all Areas, computed in § 7.3.0) — distinct from per-Area recommended counts shown alongside each Area, and distinct from the later `accept recommended` action that accepts implementation themes in Step 9.
@@ -1327,6 +1378,12 @@ After question picking, check for scope mismatch only when one of these triggers
1327
1378
 
1328
1379
  If no trigger fires, proceed silently to anti-goals.
1329
1380
 
1381
+ **Fire-on-trigger anti-pattern (load-bearing):** after `accept_discovery_questions` returns, you MUST evaluate the four trigger conditions before proceeding to Step 8. If ANY trigger matches, you MUST render the scope-classification gate. Skipping the gate when a trigger fires — including the "the picks look reasonable to me" / "the user seems decisive" / "they probably know what they're doing" judgment call — is a SKILL violation. The decision signal is the user's **actual pick distribution**, not the agent's confidence in it.
1382
+
1383
+ Concretely: at 5 picks out of 70 total questions = 7.1% pick-rate, the < 40% trigger fires. The gate MUST be rendered. Observed violation 2026-05-15: agent proceeded directly to Step 8 after a 5/70 acceptance, never showed the scope-classification gate — silently locking the user into a broad scope while their actual investigation was tightly focused on 5 questions.
1384
+
1385
+ This is the same gap as the Step 9 "freelance dedupe action" anti-pattern: the SKILL specifies the behavior; the agent must not override based on its own assessment of whether the gate "feels needed."
1386
+
1330
1387
  If a trigger fires, summarize the pattern in plain language and ask the user to classify unpicked areas. This is a top-level decision gate that closes the picker sub-views, so the full rail returns:
1331
1388
 
1332
1389
  ```text
@@ -1416,7 +1473,65 @@ Reply `1` or `2`. Reply `pause` to stop here.
1416
1473
 
1417
1474
  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.
1418
1475
 
1419
- Poll `mcp__ritual__get_agentic_run(run_id)` using `references/async-polling.md`: **`Bash sleep 5` (always 5 never escalate to 15/20/25)** per iteration, then a fresh status call. Even if the run takes 2+ minutes, the sleep value stays 5; the harness blocks chained-shorter-sleeps-at-increasing-N just like it blocks `sleep 30`. 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. Print progress only when `progress_pct` or `current_step` changes, or every ~3 polls if unchanged:
1476
+ ##### 8.0"You're unblocked" pre-roll (right after `start_agentic_run` returns the run_id)
1477
+
1478
+ **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.
1479
+
1480
+ 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.
1481
+
1482
+ **Projected ≤ 2 min** — skip the pre-roll entirely. The polling micro-copy below covers the framing.
1483
+
1484
+ **Projected 2–20 min** — warm framing:
1485
+
1486
+ ```text
1487
+ Deep reasoning run started — this may take ~{minutes} minutes.
1488
+
1489
+ You're unblocked: the run continues server-side while you do other work.
1490
+ Grab coffee, switch tasks, or close the terminal safely.
1491
+
1492
+ For live progress, open a NEW terminal and run:
1493
+ ritual status --watch # terminal command, not a slash-command
1494
+
1495
+ Or check inside this session:
1496
+ /ritual status # SKILL subcommand (in-chat)
1497
+
1498
+ Come back later:
1499
+ /ritual resume
1500
+ ```
1501
+
1502
+ **Projected 20+ min** — longer framing:
1503
+
1504
+ ```text
1505
+ Long reasoning run started — this one may take 20+ minutes.
1506
+
1507
+ You can safely step away; the run continues server-side even if this terminal
1508
+ closes. For live progress:
1509
+
1510
+ ritual status --watch # in a separate terminal (not /ritual status)
1511
+
1512
+ Or check inside this session:
1513
+ /ritual status # SKILL subcommand for in-chat status
1514
+
1515
+ To come back later:
1516
+ /ritual resume
1517
+ ```
1518
+
1519
+ **Two surfaces, two contexts:**
1520
+
1521
+ - `ritual status [--watch]` — **terminal command** (CLI 0.7.14+). Run from a separate shell. Survives this session closing; supports `--watch` for live tail.
1522
+ - `/ritual status` — **SKILL subcommand** inside Claude Code / Cursor / your agent. Read-only mirror; useful when the user wants a quick check without context-switching to a terminal. Defined in `references/status-flow.md`.
1523
+
1524
+ Pick whichever fits the user's flow — they're equivalent in content. Do not introduce a `reply watch` mode in this SKILL; the CLI command IS the live-tail affordance.
1525
+
1526
+ ##### 8.1 — Polling loop
1527
+
1528
+ Poll `mcp__ritual__get_agentic_run(run_id)` using `references/async-polling.md`: **`Bash sleep 5` (always 5 — never escalate to 15/20/25)** per iteration, then a fresh status call. Even if the run takes 2+ minutes, the sleep value stays 5; the harness blocks chained-shorter-sleeps-at-increasing-N just like it blocks `sleep ≥ 30`. 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.
1529
+
1530
+ **On the FIRST poll only** (not every poll), prepend one line that locks the "background execution is default" mental model:
1531
+
1532
+ > I'll keep working in the background. For a live tail, run `ritual status --watch` in a separate terminal — or type `/ritual status` here for an in-chat snapshot.
1533
+
1534
+ Then print progress only when `progress_pct` or `current_step` changes, or every ~3 polls if unchanged:
1420
1535
 
1421
1536
  > Agentic run: {progress_pct}% — {current_step}
1422
1537
 
@@ -1531,6 +1646,28 @@ If you don't already know the user's role on this workspace, prefer the workspac
1531
1646
 
1532
1647
  **Vocabulary**: do NOT use "Reasoning chain" or "reasoning_chain" in user-facing copy. The user-visible label is **"Why this"** — a 4-line Problem / Discovery / Tradeoff / Recommendation breakdown derived from the rationale field. "Reasoning chain" sounds like internal model chain-of-thought; "Why this" is product-native.
1533
1648
 
1649
+ **Vocabulary anti-pattern — load-bearing**: recommendations are grouped by **category** (`metadata.category.name`). They are **NEVER** grouped by `matter` or by `Area`. Those are **discovery-phase concepts** — the matter / Area is where DISCOVERY QUESTIONS live; recommendations are synthesized across all matters and grouped by the category the LLM assigns (themes like "Token security & replay", "Atomicity & architecture", etc.). The internal DB field `matter_id` does not appear in the recommendation surface and **must never appear in user-facing copy** at this step. Anti-pattern observed in agent output: *"44 recs grouped by matter"* — the right framing is *"44 recs grouped by category"* (with categoryGroups returned by the preview API doing the work). If you find yourself referring to recommendation groups as "Areas" or "matters," stop and re-read this paragraph.
1650
+
1651
+ **Action-menu anti-pattern — load-bearing**: the **blessed action set at the Step 9 acceptance gate** is exactly:
1652
+
1653
+ - `accept recommended` — admin path, accepts all on-screen recs
1654
+ - `request admin review` — collaborator path, notifies workspace admin
1655
+ - `drop R{N}` — remove one rec from the set before accepting
1656
+ - `drill R{N}` — show one rec's full detail card
1657
+ - `comment R{N}` — leave feedback on a specific rec
1658
+ - `pause` — stop here; user can resume via `/ritual resume`
1659
+
1660
+ Plus the `continue` (implement-ahead) escape hatch for collaborators with explicit authorization.
1661
+
1662
+ **Do NOT freelance other actions.** Anti-patterns observed in agent output:
1663
+
1664
+ - ❌ `dedupe` — there is no de-dupe action. The system produces a non-duplicated rec set by design (single-flight rec-generation, V5 cap-enforcer, Stage A.2 quality audit). If duplicates appear, that's a system regression — file a bug, don't offer a workaround.
1665
+ - ❌ `open the admin` / "open the admin UI to reject one pass" — there is no admin UI surface invoked from `/ritual build`. The CLI is the surface; the action set above is the contract.
1666
+ - ❌ `reject one pass` / `accept the survivors` — assumes a duplicate-pass shape that should not exist post-PR #345.
1667
+ - ❌ Any invented compound action (`accept and dedupe`, `merge similar`, etc.) — drives the user into a workflow the system doesn't support.
1668
+
1669
+ If the rec set looks wrong, the right responses are: surface the anomaly explicitly, ask the user how to proceed, and consult `mcp__ritual__get_recommendation_attestation` for the quality audit's `duplicateTitlePrefixes` signal. Don't paper over with an invented action.
1670
+
1534
1671
  ##### 9.1 — Landing screen: server-rendered preview (primary path)
1535
1672
 
1536
1673
  The recommendations review is the most-read screen in the whole build flow.
@@ -1569,6 +1706,16 @@ The recommendations review is the most-read screen in the whole build flow.
1569
1706
 
1570
1707
  The server controls the rendering shape (category numbering, R-IDs, titles-only, 78-col wrap, role-aware action hint). Your job is to print and look up — not to invent labels, re-group, or add commentary.
1571
1708
 
1709
+ **Rendering anti-pattern — DO NOT DO THIS:** the most-seen Step 9 regression is the agent printing the preview AND THEN free-form-listing the recs themselves as a bulleted summary "for the user's convenience." This is wrong on three axes:
1710
+
1711
+ 1. **Doubles the content** — preview already has titles + R-IDs + action hint at 78-col wrap. A second free-form list is redundant and pushes the action hint off-screen on small terminals.
1712
+ 2. **Drops the R-IDs** — a free-form bullet list erases the stable `R{N}` references the user needs to reply with `accept R3` / `drill R7` / `comment R12`. The user then types `view 10` (positional) thinking that's stable; it's not.
1713
+ 3. **Invents grouping labels** — free-form rendering tempts the agent to label groups as "Areas" or "matters" (already covered by the vocabulary anti-pattern above).
1714
+
1715
+ If the user wants more detail than the preview shows, they use `drill R{N}` — that's what the action menu is for. Do not pre-empt their drill choice with a wall of free-form bullets.
1716
+
1717
+ **"Many recs" rule — load-bearing for high-count sets**: when `response.uiPreview.stats.totalCount > 20`, the preview is **especially** the right surface to use; do NOT compensate by dumping the rec content inline. The server preview keeps high-count sets navigable (R-IDs + titles + compact category groups). If a 40+ rec set ever lands, the right reaction is to investigate WHY (single-flight regression? cap-enforcer bypass?) — see Stage A.2 audit signals via `get_recommendation_attestation` — not to add helpful free-form rendering on top.
1718
+
1572
1719
  **Fallback path — if the preview tool is unavailable or returns a non-200**: render per the contract block below. The contract is the same shape the server uses, so a mismatch between server-rendered and agent-rendered output is unlikely. The fallback exists for older MCP servers that haven't deployed the preview endpoint yet.
1573
1720
 
1574
1721
  ```text
@@ -1907,6 +2054,73 @@ Returns the brief markdown + an `id` + `kgContextUsed` block. The brief is **ide
1907
2054
 
1908
2055
  You can ALSO call `get_build_brief_status` **proactively** before `generate_build_brief` — if `exists === true && status === 'READY'` and the hashes haven't changed, you've saved a write-tool roundtrip. Tradeoff: tiny read cost for skipping a maybe-slow write.
1909
2056
 
2057
+ ##### 10b.5 — Verify brief assertions against the actual code
2058
+
2059
+ **This step is mandatory, not opt-in.** The brief generator runs server-side and does NOT have repo access — it writes assertions about cited files / functions / classes based on the agent's earlier recon summary (which is text, not code). Brief assertions that contradict the actual code are invisible to the brief generator AND to the user reading the brief. Step 10b.5 closes that gap before the user is asked to approve the brief at Step 10d.
2060
+
2061
+ This step is **SKILL-only — no MCP tool, no LLM cost on Ritual's API.** The verification happens locally in the calling agent because the agent is the one with repo access. The canonical instruction set is at `references/brief-verification-checklist.md` (methodology + output schema + worked example). This Step 10b.5 prose is the thin orchestration layer.
2062
+
2063
+ Steps:
2064
+
2065
+ 1. **Tell the user what's about to happen** (one line, not a multi-line pre-roll):
2066
+
2067
+ > Verifying brief assertions against the actual codebase. Reading cited functions / classes / files, comparing against the brief's claims — about 20–60 seconds.
2068
+
2069
+ 2. **Read `references/brief-verification-checklist.md`** for the methodology, output schema, and verdict definitions. **Walk the methodology in order — do NOT skip to the output schema.**
2070
+
2071
+ 3. **Read `BUILD-BRIEF.md`** (the version just generated in Step 10a/10b but NOT YET written to disk — keep it in-memory; you'll write to disk AFTER verification at Step 10c). Extract every specific code citation: symbol + file + assertion. Cap at 15 citations (highest-leverage first).
2072
+
2073
+ 4. **For each citation, read the actual code** via Grep / Glob / Read. Assign a verdict per citation:
2074
+ - `verified` — brief claim matches the code.
2075
+ - `contradicted` — brief claim is wrong; the code does something different.
2076
+ - `not_found` — symbol couldn't be located.
2077
+
2078
+ 5. **Write `BUILD-BRIEF-VERIFICATION.md`** to disk alongside `BUILD-BRIEF.md` using the schema in `references/brief-verification-checklist.md`. Cite file + line range + actual code snippet on every contradiction. Do not fabricate evidence.
2079
+
2080
+ 6. **Sync the verification to Ritual's KG** — call `mcp__ritual__sync_brief_review` with:
2081
+
2082
+ ```
2083
+ {
2084
+ exploration_id,
2085
+ review_type: 'BRIEF_VERIFICATION',
2086
+ content: <full BUILD-BRIEF-VERIFICATION.md markdown>,
2087
+ cited_files: <union of every file path cited across the verification>,
2088
+ }
2089
+ ```
2090
+
2091
+ This persists the verification as a durable `BriefReview` row attached to the exploration. Future briefs on overlapping files will inherit the verified facts via `priorContext`; `/ritual lineage` on any cited file will surface this verification.
2092
+
2093
+ 7. **Print a compact CLI summary** (≤ 8 lines, CLI Tenet #1, #6):
2094
+
2095
+ ```text
2096
+ ✓ Verification complete — `BUILD-BRIEF-VERIFICATION.md` on disk; synced to KG.
2097
+
2098
+ Verified: {N} · Contradicted: {M} · Not found: {K}
2099
+
2100
+ {If M > 0:}
2101
+ Top contradictions:
2102
+ ⚠ {cited_symbol} — brief says "{brief_assertion[0:60]}…"
2103
+ actual: "{code_reality[0:60]}…"
2104
+ ⚠ {next contradiction, if M > 1}
2105
+ ```
2106
+
2107
+ Rules:
2108
+ - **If M = 0 AND K = 0:** print one line, *"✓ Verification complete — N citations checked, all verified. `BUILD-BRIEF-VERIFICATION.md` synced."*
2109
+ - **If M > 0:** print up to 3 top contradictions inline; rest are in the file. At the Step 10d gate, surface the contradictions count + note that plan mode will read them via KG priorContext.
2110
+ - **If brief made zero citations:** print *"✓ Verification skipped — the brief makes no specific code citations to verify."* Skip the sync call (nothing to persist). Proceed to Step 10c.
2111
+
2112
+ 8. **Continue to Step 10c** with `BUILD-BRIEF.md` + `BUILD-BRIEF-VERIFICATION.md` both ready to write to disk and the verification synced to KG.
2113
+
2114
+ **Step 10d integration:** when contradictions exist, Step 10d's gate prepends an inline summary so the user sees *what the agent learned about the brief* before they decide whether to proceed. The brief itself is NOT rewritten — it stays the historical artifact Ritual generated. The KG carries the truth via the synced `BriefReview` row, and **plan mode (Step 11.1) reads the brief + KG-persisted reviews via `priorContext`** so the implementation incorporates the corrections without the brief content needing to change.
2115
+
2116
+ **Anti-patterns:**
2117
+
2118
+ - ❌ Skipping Step 10b.5 because "the brief looks fine." Brief-quality is invisible from reading the brief alone — the verification compares against the code.
2119
+ - ❌ Treating the brief's hedge ("*may deviate if codebase has a stronger pattern*") as license to skip. The hedge means *"go verify"* — exactly what this step does.
2120
+ - ❌ Padding the `verified` list. Only enumerate citations the brief actually made.
2121
+ - ❌ Re-writing the brief at Step 10b.5. The verification produces findings; the brief stays as-is. Plan mode reconciles via KG priorContext.
2122
+ - ❌ Skipping the `sync_brief_review` call. The local `BUILD-BRIEF-VERIFICATION.md` alone benefits this session only; the KG sync is what lets future briefs on overlapping files inherit the verified facts.
2123
+
1910
2124
  ##### 10c — Write to `BUILD-BRIEF.md` + CLI summary (CLI Tenet #1, #5)
1911
2125
 
1912
2126
  When the brief content is in hand (from generate OR polling), **don't dump 300 lines of markdown into the terminal**. The brief belongs in a file the user can open, search, share, and revisit; the CLI surface is for the decision.
@@ -1980,21 +2194,118 @@ Build brief ready
1980
2194
  `BUILD-BRIEF.md` is on disk. Skim the RBs + anchors, then decide:
1981
2195
 
1982
2196
  · `go` — ready to implement; move to coding
1983
- · `refine` — something's off; tell me what and I'll regenerate
1984
2197
  · `drill {N}` — drill into RB-{N} before deciding
1985
2198
 
1986
- Reply `pause` to stop here.
2199
+ Before `go`, you can run `ux-review` for a design-quality pass on the brief (recommended for UI/UX features — produces `UX-REVIEW.md` and a tailored plan-mode prompt so plan mode stops asking you the same UX questions it always does). Reply `pause` to stop here.
1987
2200
  ```
1988
2201
 
1989
2202
  Branch by user response. Accept `go`, `y`, `yes`, `proceed`, `continue`, `next` as the visible-CTA path (do not display all aliases):
1990
2203
 
1991
- - **`go` / proceed / yes / y**: continue to Step 11.
1992
- - **`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).
2204
+ - **`go` / proceed / yes / y**: continue to Step 11. Plan mode will read `BUILD-BRIEF.md` + any synced reviews (verify-brief from Step 10b.5; UX review from Step 10.5 if it ran) via KG `priorContext`. If verify-brief produced contradictions, plan mode picks them up there — the brief content itself stays as Ritual's historical artifact.
2205
+ - **`ux-review` / review / `ux`**: continue to Step 10.5 (writes `UX-REVIEW.md`, syncs it to KG via `sync_brief_review`, then continues to Step 11 with the tailored plan-mode prompt). Opt-in; absence is the existing path.
1993
2206
  - **`drill {N}`**: open RB-{N} in the markdown, discuss inline, then loop back to the gate above.
1994
2207
  - **`pause`**: stop here. The brief is on disk; the user can resume with `/ritual resume`.
1995
2208
 
2209
+ **No `refine` action at Step 10d.** The brief is read-only after generation. Two reasons:
2210
+
2211
+ 1. **Verification findings reach plan mode via KG, not via brief rewrites.** Step 10b.5 syncs `BriefReview` rows via `sync_brief_review`; plan mode reads them via `priorContext`. Re-rewriting the brief content adds LLM cost for zero implementation-correctness gain — the implementation is governed by plan mode + KG, not by the brief text itself.
2212
+ 2. **The brief stays as the historical record** of what Ritual generated. If the user wants new content (because underlying recs / requirements actually changed), call `generate_build_brief` with `force: true` — that's full regen with new source data. Don't conflate that with editing existing brief content.
2213
+
1996
2214
  **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.
1997
2215
 
2216
+ #### Step 10.5 — Optional UX brief review (entered ONLY when the user picks `ux-review` at Step 10d)
2217
+
2218
+ This step is opt-in. If the user picked `go` at Step 10d, skip directly to Step 11. The `ux-review` path is reached only when the user explicitly asks for it at the Step 10d gate — there is no auto-gating in this MVP (later iterations may use Stage E's UI-surface classifier to suggest the path automatically; see `backlog_design_recon_stage_e.md`).
2219
+
2220
+ Purpose: make the coding agent reason about the experience BEFORE it reasons about files. Plan mode otherwise interrogates the user for the same 10-question UX checklist on every UI-shaped feature. Paying for it once at the right moment — with the brief and the codebase both available — is cheaper than paying it implicitly through plan-mode interrogation.
2221
+
2222
+ This step is **SKILL-only — no MCP tool, no LLM-cost on Ritual's API.** The analysis happens locally in the calling agent because the agent is the one with repo access. The reference `references/ui-ux-checklist.md` is the canonical instruction set (methodology + output schema + plan-mode prompt template); this Step 10.5 is the thin orchestration layer that drives the agent through it.
2223
+
2224
+ Steps:
2225
+
2226
+ 1. **Tell the user what's about to happen** (one line, not a multi-line pre-roll):
2227
+
2228
+ > Running a design-quality pass on the brief. Reading `BUILD-BRIEF.md`, mining the repo for existing UI patterns, writing `UX-REVIEW.md` — about 30–60 seconds.
2229
+
2230
+ 2. **Read `references/ui-ux-checklist.md`** for the methodology, output schema, and plan-mode prompt template. **Walk the methodology in order — do not skip to the output schema.** The methodology's six steps (read brief → identify UI surfaces → find repo analogues → compare brief vs analogues → fill schema with evidence → generate tailored plan-mode prompt) are load-bearing; the output schema only gets filled correctly when the analysis upstream is done.
2231
+
2232
+ 3. **Read `BUILD-BRIEF.md`** end-to-end. Classify what it covers vs what it's silent on. The brief itself is the input signal — the review's value is on the gaps and codebase-grounding, not on re-deriving brief content.
2233
+
2234
+ 4. **Mine the repo for existing UI analogues.** Use Grep / Glob / Read against the implied UI surfaces from the brief. Cite file paths in the review; every claim must trace back to either a brief line or a real repo file. **Do not fabricate analogues** — if `Grep` returns nothing, the surface is "new work," not a hallucinated path.
2235
+
2236
+ 5. **Write `UX-REVIEW.md`** to disk alongside `BUILD-BRIEF.md` (same directory — repo root or `.ritual/`, whichever the brief landed in). Use the exact output schema from the reference file. Prepend the Ritual attribution header:
2237
+
2238
+ ```markdown
2239
+ <!--
2240
+ Generated by Ritual — UX brief review
2241
+ Exploration: https://app.ritualapp.cloud/e/{exploration_id}
2242
+ Source brief: BUILD-BRIEF.md
2243
+ Do not remove this header; it preserves implementation lineage.
2244
+ -->
2245
+ ```
2246
+
2247
+ If a `UX-REVIEW.md` already exists:
2248
+ - **Same exploration**: silent overwrite + one-line note in the summary.
2249
+ - **Different exploration**: confirm before overwriting (same convention as `BUILD-BRIEF.md` in Step 10c — *"A `UX-REVIEW.md` already exists from `{previous}`. Overwrite, or save-to-`UX-REVIEW-{slug}.md`?"*).
2250
+
2251
+ 5a. **Sync the UX review to Ritual's KG** — call `mcp__ritual__sync_brief_review` with:
2252
+
2253
+ ```
2254
+ {
2255
+ exploration_id,
2256
+ review_type: 'UX_REVIEW',
2257
+ content: <full UX-REVIEW.md markdown>,
2258
+ cited_files: <union of every file path cited across the review's Screen/Component, Design System Fit, and other sections>,
2259
+ }
2260
+ ```
2261
+
2262
+ Persists the UX review as a durable `BriefReview` row attached to the exploration. Plan mode reads it via `priorContext` so the plan-mode prompt's mismatches / gaps / new-work items are KG-grounded, not just session-local. `/ritual lineage` on any cited UI file surfaces this review.
2263
+
2264
+ **Anti-pattern:** skipping the sync because *"UX-REVIEW.md is right here on disk."* The local file benefits this session only; the KG sync is what lets future briefs / explorations on overlapping files inherit the findings.
2265
+
2266
+ 6. **Print a compact CLI summary** — the file path + the load-bearing findings only, capped at ≤ 10 lines (CLI Tenet #1, #6):
2267
+
2268
+ ```
2269
+ ✓ UX review ready — `UX-REVIEW.md` is on disk.
2270
+
2271
+ Mismatches surfaced: {N}
2272
+ {first mismatch one-liner — brief X vs analogue Y}
2273
+ {second mismatch one-liner}
2274
+
2275
+ Gaps surfaced: {M}
2276
+ {first gap one-liner — brief silent on Z, codebase default is W}
2277
+
2278
+ New-work surfaces: {K}
2279
+ {first new-work surface one-liner}
2280
+
2281
+ Plan mode will read this first when you proceed to `go`.
2282
+ ```
2283
+
2284
+ Rules:
2285
+ - Cap each list at 3 entries. The full set is in the file.
2286
+ - Omit any list that's empty (e.g. "Mismatches surfaced: 0" → don't print the line).
2287
+ - If ALL THREE lists are empty: the brief is unusually complete. Print one line: *"Brief is unusually complete — no mismatches, gaps, or new-work surfaces. Plan mode will verify state coverage against codebase."*
2288
+
2289
+ 7. **Offer to open the file** — same OS-aware affordance as Step 10c (VS Code → idea → $EDITOR → macOS open). Single yes/no, never a multi-way picker.
2290
+
2291
+ 8. **Return to the Step 10d gate** with the updated framing — `UX-REVIEW.md` is now part of the implementation context:
2292
+
2293
+ ```text
2294
+ Reply `go` to start implementation with the UX review as plan-mode input,
2295
+ or `refine` / `drill {N}` / `pause` per the earlier options.
2296
+ ```
2297
+
2298
+ When the user replies `go`, continue to Step 11 with the explicit instruction (passed to plan mode) to read both `BUILD-BRIEF.md` AND `UX-REVIEW.md`, and to use the "Plan Mode Prompt" block at the bottom of `UX-REVIEW.md` as its first numbered list — not a generic plan.
2299
+
2300
+ **Anti-patterns to avoid in this step:**
2301
+
2302
+ - **Don't render the full `UX-REVIEW.md` to the terminal.** It belongs in the file; the CLI surface is the summary plus the path.
2303
+ - **Don't auto-`go` after writing the file.** The user explicitly opted into the review — let them open the file and decide when to proceed.
2304
+ - **Don't enter plan mode mid-step.** Plan mode is Step 11. This step writes the artifact plan mode will read.
2305
+ - **Don't propose visual designs.** This is a planning packet, not a design tool. Where the codebase has no design system, surface that fact and route back to the user.
2306
+
2307
+ **Pulse (Step 10.5 done):** Re-emit the Step 10 pulse if the review surfaced material gaps or mismatches — Readiness can dip back below 90% when significant UX work is flagged that the brief didn't capture. If the review came back clean (zero mismatches, zero gaps, zero new-work), keep the existing pulse — the brief was already implementation-ready.
2308
+
1998
2309
  #### Step 11 — Implement
1999
2310
 
2000
2311
  This step happens **inside** the same `/ritual build` chat if the agent is also the coding agent (Claude Code / Cursor / etc.), or hand-off if the user is implementing themselves.
@@ -2045,7 +2356,7 @@ Next: I'll create a feature branch, then start on RB-1.
2045
2356
 
2046
2357
  ##### 11.1 — Implement
2047
2358
 
2048
- 1. Take the build brief as input.
2359
+ 1. Take the build brief as input. **If `UX-REVIEW.md` also exists alongside `BUILD-BRIEF.md` (the user opted into Step 10.5), read it too.** When both files are present, use the "Plan Mode Prompt" block at the bottom of `UX-REVIEW.md` as the FIRST input to plan mode — its numbered list of mismatches / gaps / new-work surfaces is the tailored agenda. The generic plan-mode template is the fallback for when only the brief exists.
2049
2360
  2. Use the standard coding-loop tools (Edit/Write/Bash/etc.) to make the code change.
2050
2361
  3. Run tests, lint, build per the repo's conventions.
2051
2362
  4. Track each architectural decision as you go — the input to Step 12's `sync_implementation` call. Per decision, write down: `area`, `choice`, `alternatives_considered`, `rationale`, `source_recommendation_id` (the RB-N or recommendation id the decision implements). This is what makes lineage queryable later — don't skip it.
@@ -2291,7 +2602,7 @@ Or: re-run `/ritual build` in this workspace later — the existing-work check w
2291
2602
 
2292
2603
  ### Tools used
2293
2604
 
2294
- This subcommand exclusively uses vNext MCP tools, in the order they appear:
2605
+ This subcommand exclusively uses Ritual MCP tools, in the order they appear:
2295
2606
 
2296
2607
  1. `mcp__ritual__list_workspaces` (Step 1)
2297
2608
  2. `mcp__ritual__create_workspace` (Step 1, only if no workspace exists)
@@ -2322,11 +2633,12 @@ This subcommand exclusively uses vNext MCP tools, in the order they appear:
2322
2633
  23. `mcp__ritual__get_requirement_set_status` (Step 9.5 polling)
2323
2634
  24. `mcp__ritual__generate_build_brief` (Step 10a)
2324
2635
  24a. `mcp__ritual__get_build_brief_status` (Step 10b — timeout-recovery polling, OR proactive cache-hit check before 10a)
2636
+ 24d. `mcp__ritual__sync_brief_review` (Step 10b.5 — sync `BUILD-BRIEF-VERIFICATION.md` to KG; AND Step 10.5 — sync `UX-REVIEW.md` to KG)
2325
2637
  24b. `mcp__ritual__add_knowledge_source` (Step 3.5 — register PRDs / tickets / transcripts / etc. provided by the user)
2326
2638
  24c. `mcp__ritual__list_knowledge_sources` (used inline by Step 3.5 to show already-attached refs on resume; also called by `/ritual context-pulse` CP2 for Reference Grounding count)
2327
2639
  25. `mcp__ritual__sync_implementation` (Step 12)
2328
2640
 
2329
- 32 of the 43 vNext tools. The other 11 (`ping`, `get_exploration`, `list_agentic_runs`, `add_collaborator`, `check_anti_goals`, `query_knowledge_graph`, `get_workspace_overview`, `get_knowledge_source`, `remove_knowledge_source`, `get_recommendation_attestation`, `score_context_pulse`) are situational, not part of the linear build flow.
2641
+ 33 of the 44 Ritual MCP tools. The other 11 (`ping`, `get_exploration`, `list_agentic_runs`, `add_collaborator`, `check_anti_goals`, `query_knowledge_graph`, `get_workspace_overview`, `get_knowledge_source`, `remove_knowledge_source`, `get_recommendation_attestation`, `score_context_pulse`) are situational, not part of the linear build flow.
2330
2642
 
2331
2643
  ### After this subcommand
2332
2644