@rune-kit/rune 2.2.6 → 2.3.1

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 (91) hide show
  1. package/README.md +395 -389
  2. package/compiler/__tests__/tier-override.test.js +158 -0
  3. package/compiler/adapters/antigravity.js +3 -8
  4. package/compiler/adapters/codex.js +3 -8
  5. package/compiler/adapters/cursor.js +3 -8
  6. package/compiler/adapters/generic.js +3 -8
  7. package/compiler/adapters/openclaw.js +4 -9
  8. package/compiler/adapters/opencode.js +3 -8
  9. package/compiler/adapters/windsurf.js +3 -8
  10. package/compiler/bin/rune.js +34 -1
  11. package/compiler/emitter.js +94 -5
  12. package/compiler/transforms/branding.js +10 -3
  13. package/docs/ARCHITECTURE.md +3 -3
  14. package/docs/SKILL-TEMPLATE.md +15 -0
  15. package/docs/VISION.md +3 -3
  16. package/docs/guides/index.html +14 -14
  17. package/docs/index.html +82 -13
  18. package/docs/script.js +33 -6
  19. package/docs/skills/index.html +832 -832
  20. package/docs/style.css +62 -0
  21. package/extensions/ai-ml/PACK.md +7 -0
  22. package/extensions/content/PACK.md +7 -0
  23. package/extensions/mobile/PACK.md +9 -9
  24. package/extensions/zalo/PACK.md +9 -0
  25. package/package.json +8 -6
  26. package/skills/adversary/SKILL.md +12 -0
  27. package/skills/audit/SKILL.md +526 -467
  28. package/skills/autopsy/SKILL.md +12 -0
  29. package/skills/ba/SKILL.md +349 -342
  30. package/skills/brainstorm/SKILL.md +11 -0
  31. package/skills/completion-gate/SKILL.md +260 -249
  32. package/skills/context-engine/SKILL.md +77 -1
  33. package/skills/context-pack/SKILL.md +160 -0
  34. package/skills/cook/SKILL.md +648 -958
  35. package/skills/cook/references/deviation-rules.md +19 -0
  36. package/skills/cook/references/error-recovery.md +37 -0
  37. package/skills/cook/references/exit-conditions.md +31 -0
  38. package/skills/cook/references/loop-detection.md +39 -0
  39. package/skills/cook/references/mid-run-signals.md +31 -0
  40. package/skills/cook/references/output-format.md +40 -0
  41. package/skills/cook/references/pack-detection.md +82 -0
  42. package/skills/cook/references/pause-resume-template.md +38 -0
  43. package/skills/cook/references/rfc-template.md +52 -0
  44. package/skills/cook/references/sharp-edges.md +24 -0
  45. package/skills/cook/references/subagent-status.md +38 -0
  46. package/skills/db/SKILL.md +12 -0
  47. package/skills/debug/SKILL.md +392 -362
  48. package/skills/deploy/SKILL.md +10 -0
  49. package/skills/deploy/references/post-deploy-integration.md +192 -0
  50. package/skills/design/SKILL.md +9 -0
  51. package/skills/docs/SKILL.md +12 -0
  52. package/skills/docs-seeker/SKILL.md +11 -0
  53. package/skills/fix/SKILL.md +281 -249
  54. package/skills/incident/SKILL.md +10 -0
  55. package/skills/launch/SKILL.md +12 -0
  56. package/skills/logic-guardian/SKILL.md +11 -0
  57. package/skills/marketing/SKILL.md +13 -0
  58. package/skills/mcp-builder/SKILL.md +13 -0
  59. package/skills/onboard/SKILL.md +50 -2
  60. package/skills/perf/SKILL.md +11 -0
  61. package/skills/plan/SKILL.md +342 -688
  62. package/skills/plan/references/completeness-scoring.md +36 -0
  63. package/skills/plan/references/outcome-block.md +40 -0
  64. package/skills/plan/references/plan-templates.md +193 -0
  65. package/skills/plan/references/wave-planning.md +44 -0
  66. package/skills/plan/references/workflow-registry.md +52 -0
  67. package/skills/preflight/SKILL.md +360 -280
  68. package/skills/rescue/SKILL.md +11 -0
  69. package/skills/research/SKILL.md +149 -150
  70. package/skills/retro/SKILL.md +11 -0
  71. package/skills/review/SKILL.md +489 -396
  72. package/skills/review-intake/SKILL.md +11 -0
  73. package/skills/safeguard/SKILL.md +12 -0
  74. package/skills/scaffold/SKILL.md +10 -0
  75. package/skills/scope-guard/SKILL.md +11 -0
  76. package/skills/scout/SKILL.md +9 -0
  77. package/skills/sentinel/SKILL.md +296 -425
  78. package/skills/sentinel/references/config-protection.md +52 -0
  79. package/skills/sentinel/references/destructive-commands.md +39 -0
  80. package/skills/sentinel/references/domain-hooks.md +73 -0
  81. package/skills/sentinel/references/framework-patterns.md +46 -0
  82. package/skills/sentinel/references/owasp-patterns.md +69 -0
  83. package/skills/sentinel/references/secret-patterns.md +40 -0
  84. package/skills/sentinel/references/skill-content-guard.md +54 -0
  85. package/skills/session-bridge/SKILL.md +56 -2
  86. package/skills/skill-forge/SKILL.md +47 -2
  87. package/skills/skill-router/{SKILL.md → skill.md} +446 -365
  88. package/skills/surgeon/SKILL.md +12 -0
  89. package/skills/team/SKILL.md +34 -1
  90. package/skills/test/SKILL.md +585 -427
  91. package/skills/watchdog/references/webhook-health-checks.md +243 -0
@@ -1,396 +1,489 @@
1
- ---
2
- name: review
3
- description: Code quality review — patterns, security, performance, correctness. Finds bugs, suggests improvements, triggers fix for issues found. Escalates to opus for security-critical code.
4
- metadata:
5
- author: runedev
6
- version: "0.3.0"
7
- layer: L2
8
- model: sonnet
9
- group: development
10
- tools: "Read, Glob, Grep"
11
- ---
12
-
13
- # review
14
-
15
- ## Purpose
16
-
17
- Code quality analysis. Review finds bugs, bad patterns, security issues, and untested code. It does NOT fix anything — it reports findings and delegates: bugs go to rune:fix, untested code goes to rune:test, security-critical code goes to rune:sentinel.
18
-
19
- <HARD-GATE>
20
- A review that says "LGTM" or "code looks good" without specific file:line references is NOT a review.
21
- Every review MUST cite at least one specific concern, suggestion, or explicit approval per file changed.
22
- </HARD-GATE>
23
-
24
- ## Triggers
25
-
26
- - Called by `cook` Phase 5 REVIEW — after implementation complete
27
- - Called by `fix` for self-review on complex fixes
28
- - `/rune review` — manual code review
29
- - Auto-trigger: when PR is created or significant code changes committed
30
-
31
- ## Calls (outbound)
32
-
33
- - `scout` (L2): find related code for fuller context during review
34
- - `test` (L2): when untested edge cases found — write tests for them
35
- - `fix` (L2): when bugs found during review — trigger fix
36
- - `sentinel` (L2): when security-critical code detected (auth, input, crypto)
37
- - `docs-seeker` (L3): verify API usage is current and correct
38
- - `hallucination-guard` (L3): verify imports and API calls in reviewed code
39
- - `design` (L2): when UI anti-patterns suggest missing design system — recommend design skill invocation
40
- - `perf` (L2): when performance patterns detected in frontend diff
41
- - `review-intake` (L2): structured intake for complex multi-file reviews
42
- - `sast` (L3): static analysis security scan on reviewed code
43
- - L4 extension packs: domain-specific review patterns when context matches (e.g., @rune/ui for frontend, @rune/security for auth code)
44
- - `neural-memory` | After review complete | Capture code quality insight
45
-
46
- ## Called By (inbound)
47
-
48
- - `cook` (L1): Phase 5 REVIEW — post-implementation quality check
49
- - `fix` (L2): complex fix requests self-review
50
- - User: `/rune review` direct invocation
51
- - `surgeon` (L2): review refactored code quality
52
- - `rescue` (L1): review refactored code quality
53
-
54
- ## Cross-Hub Connections
55
-
56
- - `review` → `test` — untested edge case found → test writes it
57
- - `review` → `fix` — bug found during review → fix applies correction
58
- - `review` → `scout` — needs more context → scout finds related code
59
- - `review` ← `fix` — complex fix requests self-review
60
- - `review` → `sentinel` — security-critical code → sentinel deep scan
61
-
62
- ## Execution
63
-
64
- ### Step 1: Scope
65
-
66
- Determine what to review.
67
-
68
- - If triggered by a commit or PR: use `Bash` with `git diff main...HEAD` or `git diff HEAD~1` to see exactly what changed
69
- - If triggered by a specific file or feature: use `Read` on each named file
70
- - If context is unclear: use `rune:scout` to identify all files touched by the change
71
- - List every file in scope before proceeding — do not review files outside the stated scope
72
-
73
- ### Step 2: Logic Check (Production-Critical Focus)
74
-
75
- Read each changed file. Prioritize bugs that **pass CI but break production** — these are the highest-value findings because linters and type checkers already catch the rest.
76
-
77
- - Use `Read` on every file in scope
78
- - **Race conditions**: async operations without proper sequencing, shared mutable state, missing locks
79
- - **State corruption**: mutations that affect other consumers, cache invalidation gaps, stale closures
80
- - **Silent failures**: caught errors that swallow context, empty catch blocks, promises without rejection handling
81
- - **Data loss paths**: write operations without confirmation, delete without soft-delete, truncation without backup
82
- - **Edge cases**: empty input, null/undefined, zero, negative numbers, empty arrays, Unicode, timezone boundaries
83
- - Check for: logic errors, off-by-one errors, incorrect conditionals, broken async/await patterns
84
- - Flag each finding with file path, line number, and severity
85
-
86
- **Common patterns to flag:**
87
-
88
- ```typescript
89
- // BAD — missing await causes race condition
90
- async function saveUser(data) {
91
- db.users.create(data); // caller proceeds before save completes
92
- return { success: true };
93
- }
94
- // GOOD
95
- async function saveUser(data) {
96
- await db.users.create(data);
97
- return { success: true };
98
- }
99
- ```
100
-
101
- ```typescript
102
- // BAD null deref crash
103
- function getUsername(user) {
104
- return user.profile.name.toUpperCase(); // crashes if profile or name is null
105
- }
106
- // GOOD safe access
107
- function getUsername(user) {
108
- return user?.profile?.name?.toUpperCase() ?? 'Anonymous';
109
- }
110
- ```
111
-
112
- ### Step 3: Pattern Check
113
-
114
- Check consistency with project conventions.
115
-
116
- - Compare naming against existing codebase patterns (use `Grep` to sample similar code)
117
- - Check file structure: is it in the right layer/directory per project conventions?
118
- - Check for mutations — all state changes should use immutable patterns
119
- - Check for hardcoded values that should be constants or config
120
- - Check TypeScript: no `any`, full type coverage, no non-null assertions without justification
121
- - Flag inconsistencies as MEDIUM or LOW depending on impact
122
-
123
- **Common patterns to flag:**
124
-
125
- ```typescript
126
- // BADmutation
127
- function addItem(cart, item) {
128
- cart.items.push(item); // mutates in place
129
- return cart;
130
- }
131
- // GOOD — immutable
132
- function addItem(cart, item) {
133
- return { ...cart, items: [...cart.items, item] };
134
- }
135
- ```
136
-
137
- ```typescript
138
- // BADany defeats TypeScript's purpose
139
- function process(data: any): any {
140
- return data.items.map((i: any) => i.value);
141
- }
142
- // GOOD — typed
143
- function process(data: { items: Array<{ value: string }> }): string[] {
144
- return data.items.map(i => i.value);
145
- }
146
- ```
147
-
148
- ### Step 4: Security Check
149
-
150
- Check for security-relevant issues.
151
-
152
- - Scan for: hardcoded secrets, API keys, passwords in code or comments
153
- - Scan for: unvalidated user input passed to queries, file paths, or shell commands
154
- - Scan for: missing authentication checks on new routes or functions
155
- - Scan for: XSS vectors (unsanitized HTML output), CSRF exposure, open redirects
156
- - If any security-sensitive code found (auth logic, input handling, crypto, payment): call `rune:sentinel` for deep scan
157
- - Sentinel escalation is mandatory — do not skip it for auth or crypto code
158
-
159
- ### Step 5: Test Coverage
160
-
161
- Identify gaps in test coverage.
162
-
163
- - Use `Bash` to check if a test file exists for each changed file
164
- - Use `Glob` to find test files: `**/*.test.ts`, `**/*.spec.ts`, `**/__tests__/**`
165
- - Read the test file and verify: are the new functions covered? are edge cases tested?
166
- - If untested code found: call `rune:test` with specific instructions on what to test
167
- - Flag as HIGH if business logic is untested, MEDIUM if utility code is untested
168
-
169
- ### Step 5.5: Two-Stage Review Gate
170
-
171
- Separate spec compliance from code quality. Most reviews conflate both — this gate forces the distinction.
172
-
173
- **Stage 1 Spec Compliance (check FIRST)**
174
-
175
- Before evaluating code quality, verify the implementation matches what was asked:
176
-
177
- - Load the originating plan, task, ticket, or `requirements.md` if available
178
- - Does the implementation cover every acceptance criterion? Check each one explicitly
179
- - Is there **under-engineering** — requirements stated but not implemented?
180
- - Is there **over-engineering** — abstractions, generalization, or features beyond scope?
181
- - Does the file/function structure match what the plan specified?
182
-
183
- Flag spec deviations as HIGH clean code that misses requirements ships broken products.
184
-
185
- ```
186
- # Spec Compliance Checklist
187
- [ ] All acceptance criteria from plan/ticket covered
188
- [ ] No stated requirements missing from implementation
189
- [ ] No unrequested features added (scope creep)
190
- [ ] API surface matches what was specified (signatures, endpoints, return types)
191
- [ ] File structure matches plan (no renamed or relocated files without justification)
192
- ```
193
-
194
- If spec violations found: document them separately from code quality findings in the report. Label as `SPEC-MISS` or `SPEC-CREEP`.
195
-
196
- **Stage 2 — Code Quality**
197
-
198
- Proceed to Step 6 only after Stage 1 passes. Code quality findings (bugs, patterns, security, coverage) are the existing Steps 2–5 above.
199
-
200
- The review report MUST show both stages: spec compliance verdict first, then code quality findings.
201
-
202
- ### Step 6: Report
203
-
204
- Produce a structured severity-ranked report.
205
-
206
- **Before reporting, apply confidence filter:**
207
- - Only report findings with >80% confidence it is a real issue
208
- - Consolidate similar issues: "8 functions missing error handling in src/services/" — not 8 separate findings
209
- - Skip stylistic preferences unless they violate conventions found in `.eslintrc`, `CLAUDE.md`, or `CONTRIBUTING.md`
210
- - Adapt to project type: a `console.log` in a CLI tool is fine; in a production API handler it is not
211
-
212
- - Group findings by severity: CRITICAL → HIGH → MEDIUM → LOW
213
- - Include file path and line number for every finding
214
- - Include a Positive Notes section (good patterns observed)
215
- - Include a Verdict: APPROVE | REQUEST CHANGES | NEEDS DISCUSSION
216
-
217
- After reporting:
218
- - If any CRITICAL findings: call `rune:fix` immediately with the finding details
219
- - If any HIGH findings: call `rune:fix` with the finding details
220
- - If untested code: call `rune:test` with specific coverage gaps identified
221
- - Call `neural-memory` (Capture Mode) to save any novel code quality patterns or recurring issues found.
222
-
223
- ## Framework-Specific Checks
224
-
225
- Apply **only** if the framework is detected in the changed files. Skip if not relevant.
226
-
227
- **React / Next.js** (detect: `import React` or `.tsx` files)
228
- - `useEffect` with missing dependencies (stale closure) → flag HIGH
229
- - List items using index as key on reorderable lists: `key={i}` → flag MEDIUM
230
- - Props drilled through 3+ levels without Context or composition flag MEDIUM
231
- - Client-side hooks (`useState`, `useEffect`) in Server Components (Next.js App Router) → flag HIGH
232
-
233
- **Node.js / Express** (detect: `import express` or `require('express')`)
234
- - Missing rate limiting on public endpoints flag MEDIUM
235
- - `req.body` passed directly to DB without validation schema → flag HIGH
236
- - Synchronous operations blocking the event loop inside async handlers flag HIGH
237
-
238
- **Python** (detect: `.py` files with `django`, `flask`, or `fastapi` imports)
239
- - `except:` bare catch without specific exception type → flag MEDIUM
240
- - Mutable default arguments: `def func(items=[])` → flag HIGH
241
- - Missing type hints on public functions (if project uses mypy/pyright) → flag LOW
242
-
243
- ## UI/UX Anti-Pattern Checks
244
-
245
- Apply **only** when `.tsx`, `.jsx`, `.svelte`, `.vue`, or `.html` files are in the diff. Skip for backend-only changes.
246
-
247
- These are the **"AI UI signature"** — patterns that make AI-generated frontends visually identifiable as non-human-designed. Flag each as MEDIUM severity.
248
-
249
- **AI_ANTIPATTERN Purple/indigo default accent with no domain justification:**
250
- ```tsx
251
- // BAD: LLM default color bias signals "AI-generated" to experienced designers
252
- className="bg-indigo-600 text-white" // every button/CTA is indigo
253
- // GOOD: domain-appropriate — trading → neutral dark, healthcare → trust blue,
254
- // e-commerce conversion-optimized warm. Purple is only appropriate for
255
- // AI-native tools and creative platforms.
256
- ```
257
-
258
- **AI_ANTIPATTERN — Card-grid monotony (every section is 3-col cards, zero layout variation):**
259
- ```tsx
260
- // BAD: every section uses the same grid pattern
261
- <div className="grid grid-cols-3 gap-6"> // features
262
- <div className="grid grid-cols-3 gap-6"> // testimonials
263
- <div className="grid grid-cols-3 gap-6"> // pricing
264
- // GOOD: mix layouts split sections, bento grids, full-bleed hero, list+detail
265
- ```
266
-
267
- **AI_ANTIPATTERN Centeritis (everything centered, no directional flow):**
268
- ```tsx
269
- // BAD: no visual tension, no reading direction
270
- <div className="text-center flex flex-col items-center"> // hero
271
- <div className="text-center"> // every feature section
272
- // GOOD: left-align body copy, use centering intentionally for hero/CTAs only
273
- ```
274
-
275
- **AI_ANTIPATTERN Numeric/financial values in non-monospace font:**
276
- ```tsx
277
- // BAD: prices, stats, metrics in Inter/Roboto
278
- <span className="text-2xl font-bold">${price}</span>
279
- // GOOD: monospace for all numbers that need alignment
280
- <span className="font-mono text-2xl font-bold">${price}</span>
281
- ```
282
-
283
- **AI_ANTIPATTERNMissing UI states (only happy path rendered):**
284
- ```tsx
285
- // BAD: data rendering without empty/error/loading states
286
- {data.map(item => <Card key={item.id} {...item} />)}
287
- // GOOD: all 4 states covered
288
- {isLoading && <CardSkeleton />}
289
- {error && <ErrorState message={error.message} />}
290
- {!data.length && <EmptyState />}
291
- {data.map(item => <Card key={item.id} {...item} />)}
292
- ```
293
-
294
- **Accessibilityflag as HIGH (these are WCAG 2.2 failures):**
295
- ```tsx
296
- // BAD: icon button with no accessible name
297
- <button onClick={close}><XIcon /></button>
298
- // GOOD
299
- <button onClick={close} aria-label="Close dialog"><XIcon aria-hidden="true" /></button>
300
-
301
- // BAD: placeholder as label
302
- <input placeholder="Email address" type="email" />
303
- // GOOD
304
- <label htmlFor="email">Email address</label>
305
- <input id="email" type="email" />
306
-
307
- // BAD: removes focus ring without replacement
308
- className="focus:outline-none"
309
- // GOOD: must have focus-visible replacement
310
- className="focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500"
311
-
312
- // BAD: color as sole information conveyor
313
- <span className="text-red-500">{errorMessage}</span>
314
- // GOOD: icon + color + text
315
- <span className="text-red-500 flex gap-1"><ErrorIcon aria-hidden />Error: {errorMessage}</span>
316
- ```
317
-
318
- **WCAG 2.2 New Rules — flag as MEDIUM:**
319
- - `position: sticky` or `position: fixed` header/footer without `scroll-padding-top` → Focus Not Obscured (2.4.11)
320
- - Interactive elements with `width < 24px` or `height < 24px` without 8px spacing → Target Size (2.5.8)
321
- - Multi-step form re-asking for previously entered data Redundant Entry (3.3.7)
322
-
323
- **Platform-Specific flag as MEDIUM when platform is detectable:**
324
- - iOS target: solid-background cards (iOS 26 Liquid Glass deprecates this visual language) — should use translucent/blur surfaces
325
- - Android target: hardcoded hex colors instead of `MaterialTheme.colorScheme` tokens → not adaptive to dynamic color
326
-
327
- ## Severity Levels
328
-
329
- ```
330
- CRITICAL security vulnerability, data loss risk, crash bug
331
- HIGH — logic error, missing validation, broken edge case
332
- MEDIUM — code smell, performance issue, missing error handling
333
- LOW — style inconsistency, naming suggestion, minor refactor opportunity
334
- ```
335
-
336
- ## Output Format
337
-
338
- ```
339
- ## Code Review Report
340
- - **Files Reviewed**: [count]
341
- - **Findings**: [count by severity]
342
- - **Overall**: APPROVE | REQUEST CHANGES | NEEDS DISCUSSION
343
-
344
- ### CRITICAL
345
- - `path/to/file.ts:42` [description of critical issue]
346
-
347
- ### HIGH
348
- - `path/to/file.ts:85` [description of high-severity issue]
349
-
350
- ### MEDIUM
351
- - `path/to/file.ts:120` [description of medium issue]
352
-
353
- ### Positive Notes
354
- - [good patterns observed]
355
-
356
- ### Verdict
357
- [Summary and recommendation]
358
- ```
359
-
360
- ## Constraints
361
-
362
- 1. MUST read the full diff — not just the files the user pointed at
363
- 2. MUST reference specific file:line for every finding
364
- 3. MUST NOT rubber-stamp with generic praise ("well-structured", "clean code") without evidence
365
- 4. MUST check: correctness, security, performance, conventions, test coverage
366
- 5. MUST categorize findings: CRITICAL (blocks commit) / HIGH / MEDIUM / LOW
367
- 6. MUST escalate to sentinel if auth/crypto/secrets code is touched
368
- 7. MUST flag untested code paths and recommend tests via rune:test
369
-
370
- ## Sharp Edges
371
-
372
- | Failure Mode | Severity | Mitigation |
373
- |---|---|---|
374
- | Finding flood — 20+ findings overwhelm developer | MEDIUM | Confidence filter: only >80% confidence, consolidate similar issues per file |
375
- | "LGTM" without file:line evidence | HIGH | HARD-GATE blocks this — cite at least one specific item per changed file |
376
- | Expanding review scope beyond the diff | MEDIUM | Limit to `git diff` scope — do not creep into adjacent unchanged files |
377
- | Security finding without sentinel escalation | HIGH | Any auth/crypto/payment code touched MUST call rune:sentinel |
378
- | Skipping UI anti-pattern checks for frontend changes | MEDIUM | Any .tsx/.jsx/.svelte/.vue in diff → MUST run UI/UX Anti-Pattern Checks section |
379
- | Skipping spec compliance check (Step 5.5 Stage 1) | HIGH | Code quality without spec check ships clean code that does the wrong thing — always load the plan/ticket before reviewing quality |
380
- | Treating purple/indigo accent as "just a color choice" | MEDIUM | It is a documented AI-generated UI signature — always flag for domain justification |
381
- | Suggesting "add X" without checking if X is used | MEDIUM | YAGNI pushback: grep codebase for the suggested feature → if uncalled anywhere → respond "Not called anywhere. Remove? (YAGNI)". Valid pushback, not laziness |
382
- | Adding abstractions "for future flexibility" | MEDIUM | Three similar lines > premature abstraction. Only abstract when there are 3+ concrete callers today |
383
- | Missing cross-phase integration check at phase boundary | MEDIUM | When reviewing a phase completion: check orphaned exports, uncalled routes, auth gaps, E2E flow continuity. Delegate to completion-gate Step 4.5 |
384
-
385
- ## Done When
386
-
387
- - All changed files in the diff read and analyzed
388
- - Every finding references specific file:line with severity label
389
- - Security-critical code escalated to sentinel (or confirmed not present)
390
- - Test coverage gaps identified and documented
391
- - UI anti-pattern checks ran for any frontend files in diff (or confirmed not applicable)
392
- - Structured report emitted with APPROVE / REQUEST CHANGES / NEEDS DISCUSSION verdict
393
-
394
- ## Cost Profile
395
-
396
- ~3000-6000 tokens input, ~1000-2000 tokens output. Sonnet default, opus for security-critical reviews. Runs once per implementation cycle.
1
+ ---
2
+ name: review
3
+ description: Code quality review — patterns, security, performance, correctness. Finds bugs, suggests improvements, triggers fix for issues found. Escalates to opus for security-critical code.
4
+ metadata:
5
+ author: runedev
6
+ version: "0.5.0"
7
+ layer: L2
8
+ model: sonnet
9
+ group: development
10
+ tools: "Read, Glob, Grep"
11
+ ---
12
+
13
+ # review
14
+
15
+ ## Purpose
16
+
17
+ Code quality analysis. Review finds bugs, bad patterns, security issues, and untested code. It does NOT fix anything — it reports findings and delegates: bugs go to rune:fix, untested code goes to rune:test, security-critical code goes to rune:sentinel.
18
+
19
+ <HARD-GATE>
20
+ A review that says "LGTM" or "code looks good" without specific file:line references is NOT a review.
21
+ Every review MUST cite at least one specific concern, suggestion, or explicit approval per file changed.
22
+ </HARD-GATE>
23
+
24
+ ## Triggers
25
+
26
+ - Called by `cook` Phase 5 REVIEW — after implementation complete
27
+ - Called by `fix` for self-review on complex fixes
28
+ - `/rune review` — manual code review
29
+ - Auto-trigger: when PR is created or significant code changes committed
30
+
31
+ ## Calls (outbound)
32
+
33
+ - `scout` (L2): find related code for fuller context during review
34
+ - `test` (L2): when untested edge cases found — write tests for them
35
+ - `fix` (L2): when bugs found during review — trigger fix
36
+ - `sentinel` (L2): when security-critical code detected (auth, input, crypto)
37
+ - `docs-seeker` (L3): verify API usage is current and correct
38
+ - `hallucination-guard` (L3): verify imports and API calls in reviewed code
39
+ - `design` (L2): when UI anti-patterns suggest missing design system — recommend design skill invocation
40
+ - `perf` (L2): when performance patterns detected in frontend diff
41
+ - `review-intake` (L2): structured intake for complex multi-file reviews
42
+ - `sast` (L3): static analysis security scan on reviewed code
43
+ - L4 extension packs: domain-specific review patterns when context matches (e.g., @rune/ui for frontend, @rune/security for auth code)
44
+ - `neural-memory` | After review complete | Capture code quality insight
45
+
46
+ ## Called By (inbound)
47
+
48
+ - `cook` (L1): Phase 5 REVIEW — post-implementation quality check
49
+ - `fix` (L2): complex fix requests self-review
50
+ - User: `/rune review` direct invocation
51
+ - `surgeon` (L2): review refactored code quality
52
+ - `rescue` (L1): review refactored code quality
53
+
54
+ ## Cross-Hub Connections
55
+
56
+ - `review` → `test` — untested edge case found → test writes it
57
+ - `review` → `fix` — bug found during review → fix applies correction
58
+ - `review` → `scout` — needs more context → scout finds related code
59
+ - `review` ← `fix` — complex fix requests self-review
60
+ - `review` → `sentinel` — security-critical code → sentinel deep scan
61
+
62
+ ## Execution
63
+
64
+ ### Step 1: Scope
65
+
66
+ Determine what to review.
67
+
68
+ - If triggered by a commit or PR: use `Bash` with `git diff main...HEAD` or `git diff HEAD~1` to see exactly what changed
69
+ - If triggered by a specific file or feature: use `Read` on each named file
70
+ - If context is unclear: use `rune:scout` to identify all files touched by the change
71
+ - List every file in scope before proceeding — do not review files outside the stated scope
72
+
73
+ ### Step 1.5: Blast Radius Assessment
74
+
75
+ For each modified function/class, estimate its blast radius before reviewing.
76
+
77
+ ```
78
+ Use Grep to count direct callers/importers of each modified symbol:
79
+ blast_radius = count(files importing or calling this symbol)
80
+ ```
81
+
82
+ | Blast Radius | Risk | Review Depth |
83
+ |-------------|------|-------------|
84
+ | 1-5 callers | Low | Standard review |
85
+ | 6-20 callers | Medium | Check all callers for compatibility |
86
+ | 21-50 callers | High | Thorough review + regression test check |
87
+ | 50+ callers | Critical | MUST escalate to adversarial analysis (rune:adversary) even in quick triage |
88
+
89
+ <HARD-GATE>
90
+ Modifying a symbol with 50+ callers + HIGH severity change (logic, types, behavior) → adversarial analysis REQUIRED. Quick review is NOT sufficient for high-blast-radius changes.
91
+ </HARD-GATE>
92
+
93
+ ### Step 2: Logic Check (Production-Critical Focus)
94
+
95
+ Read each changed file. Prioritize bugs that **pass CI but break production** — these are the highest-value findings because linters and type checkers already catch the rest.
96
+
97
+ - Use `Read` on every file in scope
98
+ - **Race conditions**: async operations without proper sequencing, shared mutable state, missing locks
99
+ - **State corruption**: mutations that affect other consumers, cache invalidation gaps, stale closures
100
+ - **Silent failures**: caught errors that swallow context, empty catch blocks, promises without rejection handling
101
+ - **Data loss paths**: write operations without confirmation, delete without soft-delete, truncation without backup
102
+ - **Edge cases**: empty input, null/undefined, zero, negative numbers, empty arrays, Unicode, timezone boundaries
103
+ - Check for: logic errors, off-by-one errors, incorrect conditionals, broken async/await patterns
104
+ - Flag each finding with file path, line number, and severity
105
+
106
+ **Common patterns to flag:**
107
+
108
+ ```typescript
109
+ // BAD — missing await causes race condition
110
+ async function saveUser(data) {
111
+ db.users.create(data); // caller proceeds before save completes
112
+ return { success: true };
113
+ }
114
+ // GOOD
115
+ async function saveUser(data) {
116
+ await db.users.create(data);
117
+ return { success: true };
118
+ }
119
+ ```
120
+
121
+ ```typescript
122
+ // BAD — null deref crash
123
+ function getUsername(user) {
124
+ return user.profile.name.toUpperCase(); // crashes if profile or name is null
125
+ }
126
+ // GOODsafe access
127
+ function getUsername(user) {
128
+ return user?.profile?.name?.toUpperCase() ?? 'Anonymous';
129
+ }
130
+ ```
131
+
132
+ ### Step 3: Pattern Check
133
+
134
+ Check consistency with project conventions.
135
+
136
+ - Compare naming against existing codebase patterns (use `Grep` to sample similar code)
137
+ - Check file structure: is it in the right layer/directory per project conventions?
138
+ - Check for mutations all state changes should use immutable patterns
139
+ - Check for hardcoded values that should be constants or config
140
+ - Check TypeScript: no `any`, full type coverage, no non-null assertions without justification
141
+ - Flag inconsistencies as MEDIUM or LOW depending on impact
142
+
143
+ **Common patterns to flag:**
144
+
145
+ ```typescript
146
+ // BAD — mutation
147
+ function addItem(cart, item) {
148
+ cart.items.push(item); // mutates in place
149
+ return cart;
150
+ }
151
+ // GOOD — immutable
152
+ function addItem(cart, item) {
153
+ return { ...cart, items: [...cart.items, item] };
154
+ }
155
+ ```
156
+
157
+ ```typescript
158
+ // BAD — any defeats TypeScript's purpose
159
+ function process(data: any): any {
160
+ return data.items.map((i: any) => i.value);
161
+ }
162
+ // GOOD — typed
163
+ function process(data: { items: Array<{ value: string }> }): string[] {
164
+ return data.items.map(i => i.value);
165
+ }
166
+ ```
167
+
168
+ ### Step 4: Security Check
169
+
170
+ Check for security-relevant issues.
171
+
172
+ - Scan for: hardcoded secrets, API keys, passwords in code or comments
173
+ - Scan for: unvalidated user input passed to queries, file paths, or shell commands
174
+ - Scan for: missing authentication checks on new routes or functions
175
+ - Scan for: XSS vectors (unsanitized HTML output), CSRF exposure, open redirects
176
+ - If any security-sensitive code found (auth logic, input handling, crypto, payment): call `rune:sentinel` for deep scan
177
+ - Sentinel escalation is mandatory do not skip it for auth or crypto code
178
+
179
+ ### Step 4.5: API Pit-of-Success Check
180
+
181
+ For code that exposes APIs, shared utilities, or reusable interfaces, evaluate through 3 adversary personas:
182
+
183
+ | Adversary | Mindset | What They Reveal |
184
+ |-----------|---------|-----------------|
185
+ | **The Scoundrel** | Malicious — controls config, crafts inputs, exploits edge cases | Security holes, privilege escalation, injection surfaces |
186
+ | **The Lazy Developer** | Copy-pastes from docs, skips error handling, uses defaults | Unsafe defaults, missing validation, footgun APIs |
187
+ | **The Confused Developer** | Misunderstands API semantics, passes wrong types, ignores return values | Ambiguous interfaces, poor naming, missing type safety |
188
+
189
+ **Pit-of-Success principle**: Secure, correct usage should be the path of least resistance. If the API makes it EASIER to use it wrong than right → WARN.
190
+
191
+ Check: Does the API have sensible defaults? Does misuse fail loudly (not silently)? Is the happy path obvious from the signature?
192
+
193
+ **Skip if**: Code is internal-only (no external consumers), single-use utility, or test-only.
194
+
195
+ ### Step 5: Test Coverage
196
+
197
+ Identify gaps in test coverage.
198
+
199
+ - Use `Bash` to check if a test file exists for each changed file
200
+ - Use `Glob` to find test files: `**/*.test.ts`, `**/*.spec.ts`, `**/__tests__/**`
201
+ - Read the test file and verify: are the new functions covered? are edge cases tested?
202
+ - If untested code found: call `rune:test` with specific instructions on what to test
203
+ - Flag as HIGH if business logic is untested, MEDIUM if utility code is untested
204
+
205
+ ### Step 5.5: Two-Stage Review Gate
206
+
207
+ Separate spec compliance from code quality. Most reviews conflate both this gate forces the distinction.
208
+
209
+ **Stage 1 Spec Compliance (check FIRST)**
210
+
211
+ Before evaluating code quality, verify the implementation matches what was asked:
212
+
213
+ - Load the originating plan, task, ticket, or `requirements.md` if available
214
+ - Does the implementation cover every acceptance criterion? Check each one explicitly
215
+ - Is there **under-engineering** requirements stated but not implemented?
216
+ - Is there **over-engineering** — abstractions, generalization, or features beyond scope?
217
+ - Does the file/function structure match what the plan specified?
218
+
219
+ Flag spec deviations as HIGH clean code that misses requirements ships broken products.
220
+
221
+ ```
222
+ # Spec Compliance Checklist
223
+ [ ] All acceptance criteria from plan/ticket covered
224
+ [ ] No stated requirements missing from implementation
225
+ [ ] No unrequested features added (scope creep)
226
+ [ ] API surface matches what was specified (signatures, endpoints, return types)
227
+ [ ] File structure matches plan (no renamed or relocated files without justification)
228
+ ```
229
+
230
+ If spec violations found: document them separately from code quality findings in the report. Label as `SPEC-MISS` or `SPEC-CREEP`.
231
+
232
+ **Stage 2 — Code Quality**
233
+
234
+ Proceed to Step 6 only after Stage 1 passes. Code quality findings (bugs, patterns, security, coverage) are the existing Steps 2–5 above.
235
+
236
+ The review report MUST show both stages: spec compliance verdict first, then code quality findings.
237
+
238
+ ### Step 6: Report
239
+
240
+ Produce a structured severity-ranked report.
241
+
242
+ **Before reporting, apply confidence filter:**
243
+ - Only report findings with >80% confidence it is a real issue
244
+ - Consolidate similar issues: "8 functions missing error handling in src/services/" — not 8 separate findings
245
+ - Skip stylistic preferences unless they violate conventions found in `.eslintrc`, `CLAUDE.md`, or `CONTRIBUTING.md`
246
+ - Adapt to project type: a `console.log` in a CLI tool is fine; in a production API handler it is not
247
+
248
+ - Group findings by severity: CRITICAL → HIGH → MEDIUM → LOW
249
+ - Include file path and line number for every finding
250
+ - Include a Positive Notes section (good patterns observed)
251
+ - Include a Verdict: APPROVE | REQUEST CHANGES | NEEDS DISCUSSION
252
+
253
+ After reporting:
254
+ - If any CRITICAL findings: call `rune:fix` immediately with the finding details
255
+ - If any HIGH findings: call `rune:fix` with the finding details
256
+ - If untested code: call `rune:test` with specific coverage gaps identified
257
+ - Call `neural-memory` (Capture Mode) to save any novel code quality patterns or recurring issues found.
258
+
259
+ ## Framework-Specific Checks
260
+
261
+ Apply **only** if the framework is detected in the changed files. Skip if not relevant.
262
+
263
+ **React / Next.js** (detect: `import React` or `.tsx` files)
264
+ - `useEffect` with missing dependencies (stale closure) flag HIGH
265
+ - List items using index as key on reorderable lists: `key={i}` → flag MEDIUM
266
+ - Props drilled through 3+ levels without Context or composition → flag MEDIUM
267
+ - Client-side hooks (`useState`, `useEffect`) in Server Components (Next.js App Router) → flag HIGH
268
+
269
+ **Node.js / Express** (detect: `import express` or `require('express')`)
270
+ - Missing rate limiting on public endpoints → flag MEDIUM
271
+ - `req.body` passed directly to DB without validation schema → flag HIGH
272
+ - Synchronous operations blocking the event loop inside async handlers → flag HIGH
273
+
274
+ **Python** (detect: `.py` files with `django`, `flask`, or `fastapi` imports)
275
+ - `except:` bare catch without specific exception type → flag MEDIUM
276
+ - Mutable default arguments: `def func(items=[])` → flag HIGH
277
+ - Missing type hints on public functions (if project uses mypy/pyright) → flag LOW
278
+
279
+ ## UI/UX Anti-Pattern Checks
280
+
281
+ Apply **only** when `.tsx`, `.jsx`, `.svelte`, `.vue`, or `.html` files are in the diff. Skip for backend-only changes.
282
+
283
+ These are the **"AI UI signature"** patterns that make AI-generated frontends visually identifiable as non-human-designed. Flag each as MEDIUM severity.
284
+
285
+ **AI_ANTIPATTERN Purple/indigo default accent with no domain justification:**
286
+ ```tsx
287
+ // BAD: LLM default color bias — signals "AI-generated" to experienced designers
288
+ className="bg-indigo-600 text-white" // every button/CTA is indigo
289
+ // GOOD: domain-appropriate trading → neutral dark, healthcare → trust blue,
290
+ // e-commerce → conversion-optimized warm. Purple is only appropriate for
291
+ // AI-native tools and creative platforms.
292
+ ```
293
+
294
+ **AI_ANTIPATTERNCard-grid monotony (every section is 3-col cards, zero layout variation):**
295
+ ```tsx
296
+ // BAD: every section uses the same grid pattern
297
+ <div className="grid grid-cols-3 gap-6"> // features
298
+ <div className="grid grid-cols-3 gap-6"> // testimonials
299
+ <div className="grid grid-cols-3 gap-6"> // pricing
300
+ // GOOD: mix layouts — split sections, bento grids, full-bleed hero, list+detail
301
+ ```
302
+
303
+ **AI_ANTIPATTERN — Centeritis (everything centered, no directional flow):**
304
+ ```tsx
305
+ // BAD: no visual tension, no reading direction
306
+ <div className="text-center flex flex-col items-center"> // hero
307
+ <div className="text-center"> // every feature section
308
+ // GOOD: left-align body copy, use centering intentionally for hero/CTAs only
309
+ ```
310
+
311
+ **AI_ANTIPATTERN — Numeric/financial values in non-monospace font:**
312
+ ```tsx
313
+ // BAD: prices, stats, metrics in Inter/Roboto
314
+ <span className="text-2xl font-bold">${price}</span>
315
+ // GOOD: monospace for all numbers that need alignment
316
+ <span className="font-mono text-2xl font-bold">${price}</span>
317
+ ```
318
+
319
+ **AI_ANTIPATTERN Missing UI states (only happy path rendered):**
320
+ ```tsx
321
+ // BAD: data rendering without empty/error/loading states
322
+ {data.map(item => <Card key={item.id} {...item} />)}
323
+ // GOOD: all 4 states covered
324
+ {isLoading && <CardSkeleton />}
325
+ {error && <ErrorState message={error.message} />}
326
+ {!data.length && <EmptyState />}
327
+ {data.map(item => <Card key={item.id} {...item} />)}
328
+ ```
329
+
330
+ **Accessibility flag as HIGH (these are WCAG 2.2 failures):**
331
+ ```tsx
332
+ // BAD: icon button with no accessible name
333
+ <button onClick={close}><XIcon /></button>
334
+ // GOOD
335
+ <button onClick={close} aria-label="Close dialog"><XIcon aria-hidden="true" /></button>
336
+
337
+ // BAD: placeholder as label
338
+ <input placeholder="Email address" type="email" />
339
+ // GOOD
340
+ <label htmlFor="email">Email address</label>
341
+ <input id="email" type="email" />
342
+
343
+ // BAD: removes focus ring without replacement
344
+ className="focus:outline-none"
345
+ // GOOD: must have focus-visible replacement
346
+ className="focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500"
347
+
348
+ // BAD: color as sole information conveyor
349
+ <span className="text-red-500">{errorMessage}</span>
350
+ // GOOD: icon + color + text
351
+ <span className="text-red-500 flex gap-1"><ErrorIcon aria-hidden />Error: {errorMessage}</span>
352
+ ```
353
+
354
+ **WCAG 2.2 New Rules — flag as MEDIUM:**
355
+ - `position: sticky` or `position: fixed` header/footer without `scroll-padding-top` → Focus Not Obscured (2.4.11)
356
+ - Interactive elements with `width < 24px` or `height < 24px` without 8px spacing → Target Size (2.5.8)
357
+ - Multi-step form re-asking for previously entered data → Redundant Entry (3.3.7)
358
+
359
+ **Platform-Specific — flag as MEDIUM when platform is detectable:**
360
+ - iOS target: solid-background cards (iOS 26 Liquid Glass deprecates this visual language) — should use translucent/blur surfaces
361
+ - Android target: hardcoded hex colors instead of `MaterialTheme.colorScheme` tokens → not adaptive to dynamic color
362
+
363
+ ## Weighted Composite Scoring
364
+
365
+ When a review is part of a recurring quality-gate cycle (e.g., sprint review, pre-release gate), produce a **composite quality score** alongside the findings list. This makes review output numeric and comparable across runs.
366
+
367
+ ### Formula
368
+
369
+ ```
370
+ Quality Score = (Correctness × 0.35) + (Security × 0.30) + (Test Coverage × 0.20) + (Conventions × 0.15)
371
+ ```
372
+
373
+ Each dimension is scored 0–100 based on findings count and severity:
374
+ - 0 CRITICAL/HIGH findings 100 for that dimension
375
+ - 1 CRITICAL dimension capped at 40
376
+ - 1 HIGH dimension capped at 70
377
+ - Each additional MEDIUMsubtract 5 (floor: 50)
378
+
379
+ ### Grade Thresholds
380
+
381
+ | Score | Grade | Verdict |
382
+ |-------|-------|---------|
383
+ | 90–100 | Excellent | APPROVE |
384
+ | 75–89 | Good | APPROVE with notes |
385
+ | 60–74 | Fair | REQUEST CHANGES (MEDIUM issues) |
386
+ | 40–59 | Poor | REQUEST CHANGES (HIGH issues present) |
387
+ | 0–39 | Critical | REQUEST CHANGES (CRITICAL present) |
388
+
389
+ **When to include**: Only when `mode: "scored"` is passed by the caller, or when invoked by `audit`. Default review output uses the standard severity-ranked report without the score.
390
+
391
+
392
+ ## Severity Levels
393
+
394
+ ```
395
+ CRITICAL — security vulnerability, data loss risk, crash bug
396
+ HIGH — logic error, missing validation, broken edge case
397
+ MEDIUM — code smell, performance issue, missing error handling
398
+ LOW — style inconsistency, naming suggestion, minor refactor opportunity
399
+ ```
400
+
401
+ ## Output Format
402
+
403
+ ```
404
+ ## Code Review Report
405
+ - **Files Reviewed**: [count]
406
+ - **Findings**: [count by severity]
407
+ - **Review Commit**: [git hash at time of review]
408
+ - **Overall**: APPROVE | REQUEST CHANGES | NEEDS DISCUSSION
409
+
410
+ ### Spec Compliance
411
+ - [PASS/FAIL]: [acceptance criteria coverage]
412
+
413
+ ### CRITICAL
414
+ - `path/to/file.ts:42` — [description of critical issue]
415
+
416
+ ### HIGH
417
+ - `path/to/file.ts:85` — [description of high-severity issue]
418
+
419
+ ### MEDIUM
420
+ - `path/to/file.ts:120` — [description of medium issue]
421
+
422
+ ### Blast Radius
423
+ - [High-impact symbols with caller counts]
424
+
425
+ ### Positive Notes
426
+ - [good patterns observed]
427
+
428
+ ### Verdict
429
+ [Summary and recommendation]
430
+ ```
431
+
432
+ ### Review Staleness Detection
433
+
434
+ Track the git commit hash at review time. If code changes after review → review is STALE.
435
+
436
+ ```
437
+ Review commit: abc123 → Code changed to def456 → Review is STALE, re-review required
438
+ ```
439
+
440
+ When `cook` or `ship` checks review status: compare review commit hash with current HEAD. If different → WARN: "Review is stale — code changed since last review."
441
+
442
+
443
+ ## Constraints
444
+
445
+ 1. MUST read the full diff — not just the files the user pointed at
446
+ 2. MUST reference specific file:line for every finding
447
+ 3. MUST NOT rubber-stamp with generic praise ("well-structured", "clean code") without evidence
448
+ 4. MUST check: correctness, security, performance, conventions, test coverage
449
+ 5. MUST categorize findings: CRITICAL (blocks commit) / HIGH / MEDIUM / LOW
450
+ 6. MUST escalate to sentinel if auth/crypto/secrets code is touched
451
+ 7. MUST flag untested code paths and recommend tests via rune:test
452
+
453
+ ## Returns
454
+
455
+ | Artifact | Format | Location |
456
+ |----------|--------|----------|
457
+ | Code review report | Markdown | inline (chat output) |
458
+ | Severity-ranked findings | Markdown table | inline |
459
+ | Spec compliance verdict | Markdown | inline |
460
+ | Composite quality score | Markdown table | inline (when `mode: "scored"`) |
461
+ | Blast radius assessment | Markdown table | inline |
462
+
463
+ ## Sharp Edges
464
+
465
+ | Failure Mode | Severity | Mitigation |
466
+ |---|---|---|
467
+ | Finding flood — 20+ findings overwhelm developer | MEDIUM | Confidence filter: only >80% confidence, consolidate similar issues per file |
468
+ | "LGTM" without file:line evidence | HIGH | HARD-GATE blocks this — cite at least one specific item per changed file |
469
+ | Expanding review scope beyond the diff | MEDIUM | Limit to `git diff` scope — do not creep into adjacent unchanged files |
470
+ | Security finding without sentinel escalation | HIGH | Any auth/crypto/payment code touched → MUST call rune:sentinel |
471
+ | Skipping UI anti-pattern checks for frontend changes | MEDIUM | Any .tsx/.jsx/.svelte/.vue in diff → MUST run UI/UX Anti-Pattern Checks section |
472
+ | Skipping spec compliance check (Step 5.5 Stage 1) | HIGH | Code quality without spec check ships clean code that does the wrong thing — always load the plan/ticket before reviewing quality |
473
+ | Treating purple/indigo accent as "just a color choice" | MEDIUM | It is a documented AI-generated UI signature — always flag for domain justification |
474
+ | Suggesting "add X" without checking if X is used | MEDIUM | YAGNI pushback: grep codebase for the suggested feature → if uncalled anywhere → respond "Not called anywhere. Remove? (YAGNI)". Valid pushback, not laziness |
475
+ | Adding abstractions "for future flexibility" | MEDIUM | Three similar lines > premature abstraction. Only abstract when there are 3+ concrete callers today |
476
+ | Missing cross-phase integration check at phase boundary | MEDIUM | When reviewing a phase completion: check orphaned exports, uncalled routes, auth gaps, E2E flow continuity. Delegate to completion-gate Step 4.5 |
477
+
478
+ ## Done When
479
+
480
+ - All changed files in the diff read and analyzed
481
+ - Every finding references specific file:line with severity label
482
+ - Security-critical code escalated to sentinel (or confirmed not present)
483
+ - Test coverage gaps identified and documented
484
+ - UI anti-pattern checks ran for any frontend files in diff (or confirmed not applicable)
485
+ - Structured report emitted with APPROVE / REQUEST CHANGES / NEEDS DISCUSSION verdict
486
+
487
+ ## Cost Profile
488
+
489
+ ~3000-6000 tokens input, ~1000-2000 tokens output. Sonnet default, opus for security-critical reviews. Runs once per implementation cycle.