@ritualai/cli 0.7.14 โ†’ 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 (50) hide show
  1. package/README.md +44 -0
  2. package/package.json +1 -1
  3. package/skills/claude-code/ritual/.ritual-bundle.json +2 -2
  4. package/skills/claude-code/ritual/DESIGN.md +1 -1
  5. package/skills/claude-code/ritual/SKILL.md +59 -2
  6. package/skills/claude-code/ritual/manifest.json +18 -8
  7. package/skills/claude-code/ritual/references/brief-verification-checklist.md +169 -0
  8. package/skills/claude-code/ritual/references/build-flow.md +206 -20
  9. package/skills/claude-code/ritual/references/resume-flow.md +35 -13
  10. package/skills/claude-code/ritual/references/status-flow.md +94 -0
  11. package/skills/codex/ritual/.ritual-bundle.json +2 -2
  12. package/skills/codex/ritual/DESIGN.md +1 -1
  13. package/skills/codex/ritual/SKILL.md +59 -2
  14. package/skills/codex/ritual/manifest.json +18 -8
  15. package/skills/codex/ritual/references/brief-verification-checklist.md +169 -0
  16. package/skills/codex/ritual/references/build-flow.md +206 -20
  17. package/skills/codex/ritual/references/resume-flow.md +35 -13
  18. package/skills/codex/ritual/references/status-flow.md +94 -0
  19. package/skills/cursor/ritual/.ritual-bundle.json +2 -2
  20. package/skills/cursor/ritual/DESIGN.md +1 -1
  21. package/skills/cursor/ritual/SKILL.md +59 -2
  22. package/skills/cursor/ritual/manifest.json +18 -8
  23. package/skills/cursor/ritual/references/brief-verification-checklist.md +169 -0
  24. package/skills/cursor/ritual/references/build-flow.md +206 -20
  25. package/skills/cursor/ritual/references/resume-flow.md +35 -13
  26. package/skills/cursor/ritual/references/status-flow.md +94 -0
  27. package/skills/gemini/ritual/.ritual-bundle.json +2 -2
  28. package/skills/gemini/ritual/DESIGN.md +1 -1
  29. package/skills/gemini/ritual/SKILL.md +59 -2
  30. package/skills/gemini/ritual/manifest.json +18 -8
  31. package/skills/gemini/ritual/references/brief-verification-checklist.md +169 -0
  32. package/skills/gemini/ritual/references/build-flow.md +206 -20
  33. package/skills/gemini/ritual/references/resume-flow.md +35 -13
  34. package/skills/gemini/ritual/references/status-flow.md +94 -0
  35. package/skills/kiro/ritual/.ritual-bundle.json +2 -2
  36. package/skills/kiro/ritual/DESIGN.md +1 -1
  37. package/skills/kiro/ritual/SKILL.md +59 -2
  38. package/skills/kiro/ritual/manifest.json +18 -8
  39. package/skills/kiro/ritual/references/brief-verification-checklist.md +169 -0
  40. package/skills/kiro/ritual/references/build-flow.md +206 -20
  41. package/skills/kiro/ritual/references/resume-flow.md +35 -13
  42. package/skills/kiro/ritual/references/status-flow.md +94 -0
  43. package/skills/vscode/ritual/.ritual-bundle.json +2 -2
  44. package/skills/vscode/ritual/DESIGN.md +1 -1
  45. package/skills/vscode/ritual/SKILL.md +59 -2
  46. package/skills/vscode/ritual/manifest.json +18 -8
  47. package/skills/vscode/ritual/references/brief-verification-checklist.md +169 -0
  48. package/skills/vscode/ritual/references/build-flow.md +206 -20
  49. package/skills/vscode/ritual/references/resume-flow.md +35 -13
  50. package/skills/vscode/ritual/references/status-flow.md +94 -0
@@ -85,25 +85,47 @@ If exactly one in-flight exploration is recent and clearly the likely target, le
85
85
  >
86
86
  > Resume this? (Y/n, or `list`)
87
87
 
88
- If there are multiple plausible targets, group by state badge and show:
88
+ If there are multiple plausible targets, group by state badge and show. **One picker number per exploration; continuation prose is plain text under it, never its own list item.** Use the exact shape below:
89
89
 
90
90
  > Here's what you have in flight in **{workspace.name}**:
91
91
  >
92
- > **๐Ÿ“ still in discovery** (1)
93
- > - **{name}** โ€” {first 80 chars of problemStatement}
94
- > *Last touched {N} {days/hours} ago. Next: continue sub-problem generation.*
92
+ > **๐Ÿ“ still in discovery** ({count})
95
93
  >
96
- > **๐Ÿ’ฌ waiting on admin to accept recommendations** (2)
97
- > - **{name}** โ€” {โ€ฆ}
98
- > *Last touched {N} days ago. Next: admin reviews + accepts in Step 9.*
99
- > - **{name}** โ€” {โ€ฆ}
100
- > *โ€ฆ*
94
+ > 1. **{name}** โ€” {first 80 chars of problemStatement}
95
+ > Last touched {N} {days/hours} ago. Next: continue sub-problem generation.
101
96
  >
102
- > **โœ… ready for build brief** (1)
103
- > - **{name}** โ€” {โ€ฆ}
104
- > *Last touched {N} days ago. Next: generate the build brief.*
97
+ > **๐Ÿ’ฌ waiting on admin to accept recommendations** ({count})
105
98
  >
106
- > **Which one do you want to resume? (give me the number/name, or "none" to exit)**
99
+ > 2. **{name}** โ€” {โ€ฆ}
100
+ > Last touched {N} days ago. Next: admin reviews + accepts in Step 9.
101
+ > 3. **{name}** โ€” {โ€ฆ}
102
+ > Last touched {N} days ago. Next: โ€ฆ
103
+ >
104
+ > **โœ… ready for build brief** ({count})
105
+ >
106
+ > 4. **{name}** โ€” {โ€ฆ}
107
+ > Last touched {N} days ago. Next: generate the build brief.
108
+ >
109
+ > **Which one do you want to resume? Reply with the number, the name, or `none` to exit.**
110
+
111
+ **Rendering anti-pattern (load-bearing) โ€” observed 2026-05-15:**
112
+
113
+ - โŒ Numbering the SAME exploration's continuation lines (summary, "Last touched", "Next") as separate numbered items:
114
+ ```text
115
+ 1. Social shopping โ€” activate wishlist sharing
116
+ 1. Activate dormant wishlist sharing primitives...
117
+ 1. Last touched ~10 min ago. Next: generate the build brief.
118
+ 2. Join while booking โ€” post-order account claim
119
+ 2. Post-checkout account creation flow...
120
+ 2. Last touched ~2 hours ago. Next: admin reviews + accepts.
121
+ ```
122
+ Three `1.` lines + three `2.` lines is wrong. **Each exploration gets ONE picker number on its title line. The summary, last-touched, and next-action lines belong to that exploration as indented continuation prose โ€” never their own numbered or bulleted entries.**
123
+
124
+ - โŒ Using `-` bullets for explorations when the picker tells the user "reply with the number." Bullets have no numbers; the user can't say "I pick `-`."
125
+
126
+ - โŒ Restarting the picker count at each state bucket (`1.` under "still in discovery", then `1.` again under "waiting on admin"). Numbering is **flat across all buckets** so a single number unambiguously identifies one exploration.
127
+
128
+ **The correct shape is exactly:** state-bucket header โ†’ blank line โ†’ `{N}. **{name}** โ€” {summary}` โ†’ indented continuation prose (2-space indent, no leading marker) โ†’ blank line before next exploration. State-bucket count in parens `({count})` is informational and is NEVER a picker number.
107
129
 
108
130
  State badge โ†’ user-facing label + suggested next step (same table as `/ritual build` Step 1.5):
109
131
 
@@ -0,0 +1,94 @@
1
+ ## /ritual status
2
+
3
+ Thin in-chat mirror of the terminal CLI command `ritual status [--watch]` (CLI 0.7.14+).
4
+
5
+ The CLI is the primary affordance for the "I walked away from this run; let me check on it" case โ€” it works from any terminal, survives this agent session closing, and supports `--watch` for live tail. **This SKILL subcommand exists for the orthogonal case:** the user is still in the agent session, wants a quick status snapshot, and doesn't want to context-switch to a separate terminal.
6
+
7
+ Same content, two surfaces. Pick whichever fits the user's flow.
8
+
9
+ ### When to use this vs. the terminal CLI
10
+
11
+ | Context | Use |
12
+ |---|---|
13
+ | User is in chat with you and types `/ritual status` | This SKILL subcommand. |
14
+ | User is mid-run and walks away | Tell them about `ritual status --watch` in a separate terminal. Their session can close; the CLI keeps tailing. |
15
+ | User wants to script status / pipe to other tools | Terminal CLI. The SKILL is render-only; the CLI prints to stdout with proper exit codes. |
16
+ | User asks "what's happening?" without typing the slash | Plain English answer โ€” call `mcp__ritual__get_agentic_run` and respond naturally. Don't gratuitously invoke this subcommand. |
17
+
18
+ ### Steps
19
+
20
+ #### Step S1 โ€” Resolve the run
21
+
22
+ The subcommand can be invoked three ways:
23
+
24
+ 1. **`/ritual status`** (no arg) โ€” auto-resolve the current run from workspace context:
25
+ - If `.ritual/config.json` is bound (i.e. `/ritual init` was run in this repo), load `workspaceId` from there.
26
+ - Call `mcp__ritual__list_explorations(workspace_id)`, sort by `updatedAt` desc.
27
+ - For each of the top 5 most-recently-updated, call `mcp__ritual__list_agentic_runs(exploration_id, status='RUNNING', limit=1)` until one returns a run.
28
+ - If none has a RUNNING run, fall back to the most-recently-updated exploration with step != `COMPLETED`.
29
+ - If no workspace is bound to the project, ask the user for an exploration id or to run `/ritual init` first.
30
+
31
+ 2. **`/ritual status <exploration-id>`** โ€” skip auto-resolve, fetch that exploration directly.
32
+
33
+ 3. **`/ritual status --runs`** โ€” list every RUNNING agentic run across the workspace (multi-run case). Render as a numbered picker.
34
+
35
+ #### Step S2 โ€” Fetch state
36
+
37
+ Call in parallel:
38
+
39
+ - `mcp__ritual__get_exploration(exploration_id)` โ†’ exploration name, step, updatedAt, agenticProgress.
40
+ - `mcp__ritual__get_agentic_run(run_id)` IF a RUNNING run was found โ€” gives live progress + run id + status. Read from the **merged view** the MCP tool returns; never from raw `agentic_jobs.totalQuestions` or `agentic_jobs.progress.steps` directly (those fields have a known unwritten-for-`full_exploration_v1` bug).
41
+
42
+ #### Step S3 โ€” Render the run-first layout
43
+
44
+ Mirror the terminal CLI exactly. Run line first, exploration name as a footer parenthetical:
45
+
46
+ ```text
47
+ Run ba4d2b42-โ€ฆ ยท RUNNING for 17m 41s
48
+ Phase answering (58%)
49
+ Questions 42 / 67 ยท 0 failed
50
+ Activity last DB write 1m 12s ago
51
+ Pace ~14s/question ยท ETA ~5m 50s remaining
52
+ Next Recommendations (auto-advances when questions are done)
53
+
54
+ (Exploration: Join while booking โ€” post-order account claim)
55
+ 51f16182-โ€ฆ ยท step: DEVELOPING_ANSWERS
56
+ ```
57
+
58
+ Rendering rules:
59
+
60
+ - **Run line first.** "RUNNING for 17m 41s" is the headline.
61
+ - **Pace + ETA** computed client-side from `(now - run.startedAt) / progress.completedQuestions ร— (totalQuestions - completedQuestions)`. Only show when `completedQuestions >= 3` โ€” below that, render `Pace warming up โ€” check back in 30s`.
62
+ - **Activity** is the freshness signal โ€” if `last write` has been climbing past ~3 min without `completedQuestions` advancing, that's actionable info. Surface it plainly; do not invent a "stuck" diagnosis (that's `RecStallSweeper`'s job, server-side).
63
+ - **Next line** is heuristic based on `progress.phase`:
64
+ - `answering` โ†’ `Recommendations (auto-advances when questions are done)`
65
+ - `submitting` โ†’ `Recommendations`
66
+ - `recommendations` โ†’ `Build brief (after admin review)`
67
+ - `complete` / `failed` โ†’ `โ€”`
68
+ - any unknown โ†’ omit the line entirely
69
+ - **No run, but progress data exists** (run completed or never started): render `Run (no active run)` + phase + Activity. Useful when the user types `/ritual status` after a run finished.
70
+ - **No run, no progress**: render `Run (no run started yet)` + Step + Activity.
71
+
72
+ #### Step S4 โ€” Wrap up
73
+
74
+ After rendering, the agent's job is done. Do NOT auto-poll, do NOT enter a watch loop inside the chat. The CLI's `--watch` is the live-tail surface; this SKILL is a snapshot.
75
+
76
+ If the user wants to check again, they type `/ritual status` again. The agent re-runs S1โ€“S3 from scratch.
77
+
78
+ ### Tools used
79
+
80
+ Read-tier subset of the build-flow tools:
81
+
82
+ 1. `mcp__ritual__list_explorations` (auto-resolve)
83
+ 2. `mcp__ritual__list_agentic_runs` (find RUNNING)
84
+ 3. `mcp__ritual__get_exploration` (S2 โ€” name + step + progress)
85
+ 4. `mcp__ritual__get_agentic_run` (S2 โ€” merged live view)
86
+
87
+ No new MCP tools required. `/ritual status` is a thin orchestration over what already exists.
88
+
89
+ ### Anti-patterns
90
+
91
+ - **Don't introduce a "watch" mode inside this SKILL.** The terminal CLI's `--watch` is the live-tail surface. Re-implementing it in chat doubles the affordance and creates polling loops that survive past the user's intent.
92
+ - **Don't render raw `agentic_jobs` fields.** `AgenticJob.totalQuestions` and `progress.steps[*].status` are not written for `full_exploration_v1` runs. Reading them directly produces the "all-pending" snapshot lie surfaced 2026-05-15. The merged view returned by `get_agentic_run` is the only correct source.
93
+ - **Don't synthesize ETA from `progress.percent` alone.** Use the question-count math (`completedQuestions / elapsed ร— remaining`) because it's more accurate than the coarse percent rounded up at major step boundaries.
94
+ - **Don't gratuitously invoke this subcommand.** If the user asks "what's happening?" without typing `/ritual status`, just answer in plain English using `get_agentic_run`. The slash-command is for explicit status snapshots, not for every progress question.
@@ -1,4 +1,4 @@
1
1
  {
2
- "cliVersion": "0.7.14",
3
- "builtAt": "2026-05-15T16:06:46.162Z"
2
+ "cliVersion": "0.7.15",
3
+ "builtAt": "2026-05-19T15:51:30.453Z"
4
4
  }
@@ -20,7 +20,7 @@ The split version keeps:
20
20
 
21
21
  ## Retired `/ritual recon`
22
22
 
23
- `/ritual recon` is intentionally not part of the vNext command surface. Its former workspace-history value is covered by `/ritual resume`; its file-decision-history value is covered by `/ritual lineage`; and its repo-reading behavior is normal coding-agent behavior in plain English.
23
+ `/ritual recon` is intentionally not part of the Ritual command surface. Its former workspace-history value is covered by `/ritual resume`; its file-decision-history value is covered by `/ritual lineage`; and its repo-reading behavior is normal coding-agent behavior in plain English.
24
24
 
25
25
  ## Context packet principle
26
26
 
@@ -18,6 +18,36 @@ Before executing any subcommand, read and follow:
18
18
 
19
19
  Do not reintroduce `/ritual recon`. Use plain-language repo inspection, `/ritual resume`, or `/ritual lineage` depending on intent.
20
20
 
21
+ ## Contract strength โ€” load-bearing for all subcommands
22
+
23
+ Every section in this SKILL or its reference files labeled **load-bearing**, **forbidden behavior**, **anti-pattern**, **rendering contract**, or **fire-on-trigger** is **contract-strength**, not guidance.
24
+
25
+ If this SKILL says *"DO NOT do X"*, your default action is to not do X. You may not override based on your in-the-moment assessment that X would be:
26
+
27
+ - helpful
28
+ - clearer
29
+ - shorter
30
+ - more convenient
31
+ - *"obviously what the user really wants"*
32
+ - *"a small improvement on top of the SKILL's contract"*
33
+
34
+ When a local example or your own instinct conflicts with a contract-strength rule, **the contract wins.** Re-read the rule. Trust that the prior version of you also thought the override "feels right" โ€” that's exactly the case the contract exists to prevent.
35
+
36
+ When two contract-strength rules genuinely conflict (rare): **stop, surface the conflict to the user, and ask which to honor.** Do not improvise a resolution.
37
+
38
+ This rule is the meta-pattern that closes the failure class we kept hitting before 2026-05-15: the SKILL named the right behavior in each step (Step 7 picker, Step 9 preview-verbatim, Step 9 action menu, picker numbering, etc.), but the agent treated the prose as advisory and freelanced anyway. Anti-patterns are **executable constraints, not taste guidance.** When an anti-pattern says "agent must NOT", read it as a hard error, not a preference.
39
+
40
+ Examples of contract-strength rules currently in force (non-exhaustive):
41
+
42
+ - `references/build-flow.md` Step 7 transition lock โ€” must NOT skip the Areas picker, must call `accept_discovery_questions` before `start_agentic_run`.
43
+ - `references/build-flow.md` Step 7.3.1 rendering contract โ€” Areas index has NO question previews, single numbering stream.
44
+ - `references/build-flow.md` Step 7.4.5 fire-on-trigger โ€” scope-classification gate is the contract, not a suggestion.
45
+ - `references/build-flow.md` Step 9 action menu lock โ€” blessed set is exactly `accept recommended` / `drop R{N}` / `drill R{N}` / `comment R{N}` / `pause` (+ `request admin review` for collaborators). NO freelance `dedupe` / `open the admin` / invented compound actions.
46
+ - `references/build-flow.md` Step 9 rendering โ€” use the server preview verbatim; no free-form summarization on top.
47
+ - `references/resume-flow.md` ยง R2 picker rendering โ€” ONE picker number per exploration; continuation prose indented; flat numbering across state buckets.
48
+
49
+ When you encounter a rule labeled with any of the marker words above, treat it the same way you'd treat a unit-test assertion: violating it is a regression, not a stylistic choice.
50
+
21
51
  ## Routing
22
52
 
23
53
  Parse the first token of the argument:
@@ -28,9 +58,10 @@ Parse the first token of the argument:
28
58
  | `resume` | `references/resume-flow.md` | "Pick up where I left off." Lists in-flight explorations with state badges and jumps to the right step. |
29
59
  | `lineage` | `references/lineage-flow.md` | Paste a file path (or set of paths); see every prior exploration / decision / deferral that touched those files. |
30
60
  | `context-pulse` | `references/context-pulse-flow.md` | Score readiness / context debt for a feature ask or exploration. Can seed a `CONTEXT-<feature>.md` file with relevant codebase + KG context that `/ritual build` picks up automatically. Also surfaces inline during build so the user watches debt drop. |
61
+ | `status` | `references/status-flow.md` | Read-only mirror of the `ritual status` terminal CLI command (CLI 0.7.14+) for users who want a quick run-progress check inside the agent session instead of in a separate terminal. Calls `mcp__ritual__get_agentic_run` + renders the same run-first layout the CLI uses. |
31
62
  | (anything else, OR no subcommand) | default to `build` and treat the entire argument as the problem statement | |
32
63
 
33
- The vNext CLI surface is intentionally **just these four**. Legacy exposed `explore`, `run`, `brief`, `gate`, `spec`, `questions`, `gherkin`, `status`, `recs` โ€” all of which mapped 1:1 to MCP tool calls and provided no agent-CLI value over plain English. We don't replicate them; the agent can call any MCP tool directly when the user asks for "the recs on exp-X" or "status of exp-Y". (`/ritual recon` shipped briefly in PR #174 as a fifth command โ€” retired in this PR because its unique value duplicated `/ritual resume` (workspace history) + `/ritual lineage` (decisions on files), and its non-duplicate parts (map repo, trace flow, explain file) are exactly what the agent does fluently in plain English without needing a SKILL-defined menu.)
64
+ The Ritual CLI surface is intentionally narrow: `build`, `resume`, `lineage`, `context-pulse`, plus the read-only `status` mirror. Legacy exposed `explore`, `run`, `brief`, `gate`, `spec`, `questions`, `gherkin`, `recs` โ€” all of which mapped 1:1 to MCP tool calls and provided no agent-CLI value over plain English. We don't replicate them; the agent can call any MCP tool directly when the user asks for "the recs on exp-X" or "decisions on file Y". (`/ritual recon` shipped briefly in PR #174 as a fifth command โ€” retired because its unique value duplicated `/ritual resume` (workspace history) + `/ritual lineage` (decisions on files), and its non-duplicate parts (map repo, trace flow, explain file) are exactly what the agent does fluently in plain English without needing a SKILL-defined menu.)
34
65
 
35
66
 
36
67
  ## Subcommand reference files
@@ -67,5 +98,31 @@ When the user says things like *"what's the status of exp-X?"*, *"show me the re
67
98
  | Kick off / re-run the agentic pipeline | `mcp__ritual__start_agentic_run(exploration_id, โ€ฆ)` |
68
99
  | Did anyone implement something on these files? | `mcp__ritual__query_knowledge_graph(sources=[โ€ฆ])` โ€” same plumbing as `/ritual lineage` |
69
100
 
70
- This is intentional. Legacy exposed each of these as its own slash-command (`/ritual status`, `/ritual recs`, `/ritual run`) and the surface area ballooned without adding agent value. In vNext we keep the slash-commands narrow (`build`, `resume`, `lineage`, `context-pulse`) and let the agent fluently call MCP tools for everything else. Do not reintroduce `/ritual recon`: its former workspace-history value is covered by `/ritual resume`; its file-decision-history value is covered by `/ritual lineage`; and repo-reading behaviors are normal coding-agent behavior in plain English.
101
+ This is intentional. Legacy exposed each of these as its own slash-command (`/ritual recs`, `/ritual run`, etc.) and the surface area ballooned without adding agent value. We keep the slash-commands narrow (`build`, `resume`, `lineage`, `context-pulse`, plus the read-only `status` mirror) and let the agent fluently call MCP tools for everything else. Note: `/ritual status` is the one deliberate exception โ€” it exists as a thin SKILL mirror of the terminal CLI command so users who want an in-chat status check don't have to context-switch to a separate terminal. Do not reintroduce `/ritual recon`: its former workspace-history value is covered by `/ritual resume`; its file-decision-history value is covered by `/ritual lineage`; and repo-reading behaviors are normal coding-agent behavior in plain English.
102
+
103
+ ---
104
+
105
+ ## Before this skill is installed โ€” bootstrap context
106
+
107
+ This SKILL only governs behavior **after** `ritual init` has run and the
108
+ `/ritual` skill has been copied into the agent's skills directory. Before
109
+ that, the agent has no Ritual-specific instructions in scope.
110
+
111
+ If you are reading this file by browsing the repo, or as part of a
112
+ post-mortem on why a user's "set up Ritual MCP" request went sideways:
113
+ the **pre-install** instruction surface lives in three places, in priority
114
+ order:
115
+
116
+ 1. **`learn.ritual.work/llms.txt`** โ€” canonical machine-readable bootstrap script. Served as plain text. WebFetch-safe.
117
+ 2. **`ritual.work/llms.txt`** โ€” identical bytes to (1). Served from the marketing site so an agent handed any `ritual.work/...` URL can find it without knowing about `learn.ritual.work`.
118
+ 3. **`apps/cli/README.md`** in this repo (ships to npmjs.com via `@ritualai/cli`) โ€” has the same "AI coding agents: start here" block at the top.
119
+
120
+ All three sources must say the same thing. The canonical content is the
121
+ 7-step `npm install -g @ritualai/cli` โ†’ `ritual init` โ†’ `ritual doctor`
122
+ โ†’ restart-agent โ†’ verify-MCP โ†’ `/ritual build` flow, with explicit
123
+ "do not ask the user about their project until init succeeds" rules.
124
+
125
+ When updating one, update all three. The cross-repo sync is intentional
126
+ duplication โ€” agents need the bootstrap visible at whichever URL they
127
+ happen to be handed.
71
128
 
@@ -1,13 +1,13 @@
1
1
  [
2
2
  {
3
3
  "path": "DESIGN.md",
4
- "lines": 36,
5
- "bytes": 2226
4
+ "lines": 35,
5
+ "bytes": 2227
6
6
  },
7
7
  {
8
8
  "path": "SKILL.md",
9
- "lines": 72,
10
- "bytes": 5915
9
+ "lines": 102,
10
+ "bytes": 9156
11
11
  },
12
12
  {
13
13
  "path": "agents/openai.yaml",
@@ -21,8 +21,13 @@
21
21
  },
22
22
  {
23
23
  "path": "references/build-flow.md",
24
- "lines": 2466,
25
- "bytes": 148766
24
+ "lines": 2652,
25
+ "bytes": 165455
26
+ },
27
+ {
28
+ "path": "references/brief-verification-checklist.md",
29
+ "lines": 169,
30
+ "bytes": 10820
26
31
  },
27
32
  {
28
33
  "path": "references/cli-output-contract.md",
@@ -46,14 +51,19 @@
46
51
  },
47
52
  {
48
53
  "path": "references/resume-flow.md",
49
- "lines": 157,
50
- "bytes": 9950
54
+ "lines": 225,
55
+ "bytes": 14048
51
56
  },
52
57
  {
53
58
  "path": "references/scoring-fallback.md",
54
59
  "lines": 126,
55
60
  "bytes": 6494
56
61
  },
62
+ {
63
+ "path": "references/status-flow.md",
64
+ "lines": 94,
65
+ "bytes": 6096
66
+ },
57
67
  {
58
68
  "path": "references/ui-ux-checklist.md",
59
69
  "lines": 198,
@@ -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.