@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
package/README.md CHANGED
@@ -6,6 +6,50 @@ Codex, Kiro, Gemini CLI, Windsurf, etc.) to Ritual Cloud via the
6
6
 
7
7
  Docs: [ritual.work/ritual-mcp/docs/](https://ritual.work/ritual-mcp/docs/)
8
8
 
9
+ ## AI coding agents: start here
10
+
11
+ If you are an AI coding agent and a user asked you to "set up Ritual MCP,"
12
+ "install Ritual," or anything similar, follow this script **verbatim**.
13
+ Do not ask the user about their project, their stack, or where to register
14
+ the MCP server — `ritual init` handles all of that.
15
+
16
+ ```text
17
+ 1. Do not scaffold the user's app yet.
18
+
19
+ 2. Install or upgrade the CLI:
20
+ npm install -g @ritualai/cli
21
+
22
+ 3. From the project root, run:
23
+ ritual init
24
+
25
+ 4. If `init` opens a browser for sign-in, tell the user to complete
26
+ it. If they are a brand-new user, they will get a verification email
27
+ — they must click the link. Keep the terminal open while they do.
28
+ If the loopback times out, re-run `ritual init` once.
29
+
30
+ 5. After `init` reports success, run:
31
+ ritual doctor
32
+
33
+ 6. Tell the user to fully close and reopen their coding agent so the
34
+ newly-registered MCP server comes online. Reload / `/clear` is not
35
+ enough — the agent caches MCP config at startup.
36
+
37
+ 7. Once the user is back in the agent, verify the `ritual` MCP server
38
+ is connected (in Claude Code: `/mcp`). Only then offer to start
39
+ product work — typically by running `/ritual build <feature>`.
40
+ ```
41
+
42
+ **Hard rules until `ritual init` succeeds:**
43
+ - Do not ask the user what kind of project they're building.
44
+ - Do not ask which stack to scaffold against.
45
+ - Do not ask whether to register MCP project-local vs user-global — `ritual init` picks the right scope per agent automatically.
46
+ - Do not edit `~/.claude.json`, `.mcp.json`, `.cursor/mcp.json`, or any other agent config file by hand.
47
+ - Do not paste docs URLs into a fetch tool and ask the user to read the rendered marketing site — the bootstrap script above is the authoritative source.
48
+
49
+ **Only escape hatch:** if the user explicitly declines Ritual setup, or if
50
+ `ritual init` fails twice in a row with the same error, ask the user how
51
+ they'd like to proceed. Don't surface the escape hatch unsolicited.
52
+
9
53
  ## Install
10
54
 
11
55
  ```bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ritualai/cli",
3
- "version": "0.7.14",
3
+ "version": "0.7.15",
4
4
  "description": "Ritual CLI — scaffold AI coding agent skills + register MCP servers. Connects Claude Code, Cursor, Windsurf, Kiro, Gemini CLI, VS Code/Copilot, and Codex to Ritual Cloud.",
5
5
  "private": false,
6
6
  "license": "Apache-2.0",
@@ -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.