<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Anuj Jain</title>
    <description>The latest articles on DEV Community by Anuj Jain (@anujjainaj16).</description>
    <link>https://dev.to/anujjainaj16</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F99mvlsfu5tfj9m7ku25d.png</url>
      <title>DEV Community: Anuj Jain</title>
      <link>https://dev.to/anujjainaj16</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/anujjainaj16"/>
    <language>en</language>
    <item>
      <title>USHER-Know before you watch</title>
      <dc:creator>Anuj Jain</dc:creator>
      <pubDate>Fri, 02 Oct 2026 23:20:22 +0000</pubDate>
      <link>https://dev.to/anujjainaj16/usher-know-before-you-watch-2hon</link>
      <guid>https://dev.to/anujjainaj16/usher-know-before-you-watch-2hon</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/sanity-2026-09-16"&gt;Sanity Challenge, Path One: Ship an Agent That Queries Real Content&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;USHER is a statutory and medical compliance gatekeeper for films and TV series.&lt;/p&gt;

&lt;p&gt;A streaming catalog's age rating tells you who a title is &lt;em&gt;legally&lt;/em&gt; suitable for. It doesn't tell you that a "U" rated family film contains a flashing-screen sequence that can trigger seizures. Disney issued theatrical seizure notices for &lt;em&gt;Incredibles 2&lt;/em&gt; in 2018 over exactly this. Real viewers also don't ask single-field questions. They say things like:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"I'm 14, have photosensitive epilepsy and auditory hyperacusis, and want a thriller."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;USHER doesn't just fetch rows. Once the Sanity graph is loaded, the agent:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Resolves multiple constraints at once.&lt;/strong&gt; Age, medical hazards, and genre are checked together. In this example it disqualifies &lt;em&gt;Oppenheimer&lt;/em&gt; and &lt;em&gt;Euphoria&lt;/em&gt; on statutory age (CBFC A, 18+). It disqualifies &lt;em&gt;Inception&lt;/em&gt; because, although it is UA 13+, its 18-24Hz strobe sequence violates ITU-R BT.1702 photic limits. It recommends &lt;em&gt;The Dark Knight&lt;/em&gt;, which is UA 13+ compliant with no photic warnings on record.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Overrides misleading ratings with clinical evidence.&lt;/strong&gt; &lt;em&gt;Incredibles 2&lt;/em&gt; is rated U (all ages), but the retrieved trigger data records the 6Hz Screenslaver sequence, so the verdict moves from safe to &lt;strong&gt;PROHIBITED for photosensitive viewers&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Turns clinical data into practical directives.&lt;/strong&gt; Instead of "118.5 dB surge at 20ms transition," the viewer gets a plain instruction with exact runtime windows, such as mute or look away between 01:54:30 and 01:56:00.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cites its legal and clinical authority.&lt;/strong&gt; Verdicts reference the Cinematograph Act 1952, CBFC Guidelines 2023, ITU-R BT.1702-2, and the WHO 85 dB listening standard, and resolve to one of &lt;code&gt;[SAFE]&lt;/code&gt;, &lt;code&gt;[RESTRICTED]&lt;/code&gt;, &lt;code&gt;[PROHIBITED]&lt;/code&gt;, or &lt;code&gt;[DATA UNAVAILABLE]&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Refuses to guess.&lt;/strong&gt; If a title or hazard isn't certified in Sanity, USHER returns &lt;code&gt;[VERDICT: DATA UNAVAILABLE]&lt;/code&gt; and advises withholding viewing until it's certified, instead of improvising safety advice from model memory.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The catalog covers 42 titles across 8 genres, with a dual-theme UI (Space Black &amp;amp; Metallic Slate, or Warm Coffee &amp;amp; Mocha Beige).&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Data transparency:&lt;/strong&gt; While film classifications and hazard designations reflect real statutory records and documented public media advisories (e.g., Disney's theatrical seizure notices for &lt;em&gt;Incredibles 2&lt;/em&gt;), specific scene timestamps and decibel measurements are curated demonstration models created for this challenge rather than laboratory-certified clinical datasets. USHER is a demonstration of the architecture, not medical advice.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Live project:&lt;/strong&gt; &lt;a href="https://usher-liart.vercel.app/" rel="noopener noreferrer"&gt;https://usher-liart.vercel.app/&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;

&lt;p&gt;GitHub repository: &lt;a href="https://github.com/An16og/usher" rel="noopener noreferrer"&gt;https://github.com/An16og/usher&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;studio/&lt;/code&gt;: Sanity Studio schemas and the seeding script&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;web/&lt;/code&gt;: Next.js app, &lt;code&gt;/api/chat&lt;/code&gt; route, and the Sanity query client (&lt;code&gt;mcp-client.ts&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How I Used Sanity
&lt;/h2&gt;

&lt;p&gt;Sanity is the only source of truth for every safety claim USHER makes. I modeled compliance data as typed, connected documents:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Movie&lt;/strong&gt;: the title being audited (42)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CBFC Rating&lt;/strong&gt;: its statutory classification (5)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Trigger Warning&lt;/strong&gt;: hazard, severity (Mild / Severe / Critical), clinical description, timestamps, and affected demographics (13)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Accessibility Rule&lt;/strong&gt;: governing standards, with restriction level and trigger condition (7)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Retrieval.&lt;/strong&gt; I used GROQ over the Sanity Content Lake HTTP Query API as the primary retrieval engine, exposed to the model as a custom Vercel AI SDK tool named &lt;code&gt;search_knowledge_base&lt;/code&gt;. One query dereferences the full relational path, &lt;code&gt;Movie → CBFC Rating → Trigger Warnings → Accessibility Rules&lt;/code&gt;, in a single round trip:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;*[_type == "movie"]{
  _id, title, releaseYear, synopsis,
  cbfcRating-&amp;gt;{ ratingCode, minimumAge, description },
  triggerWarnings[]-&amp;gt;{
    hazard, severity, category, clinicalDescription,
    timestamps, affectedDemographics
  },
  "applicableRules": *[_type == "accessibilityRule"
    &amp;amp;&amp;amp; references(^.triggerWarnings[]._ref)]{
    ruleCode, title, targetDemographic, restrictionLevel,
    triggerCondition, restrictionDetails, source
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I chose structured GROQ traversal over vector search deliberately. Embeddings are known to blur negation ("contains strobe" vs. "does not contain strobe"), which is unacceptable for a safety use case. GROQ returns verified, typed entities with exact timestamps and statutory clauses, with no chunking or similarity guesswork.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What the agent does with the content.&lt;/strong&gt; The retrieved graph is the only context the model reasons over. It performs the constraint resolution, rating-versus-clinical-evidence overrides, scene-skip directives, and verdict synthesis described above. If nothing certified comes back, it refuses.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sanity Context MCP.&lt;/strong&gt; The codebase also includes a JSON-RPC 2.0 adapter (&lt;code&gt;callSanityContextMcp&lt;/code&gt;) for Sanity's MCP endpoint, kept behind a fallback condition. The live app currently retrieves through the direct GROQ path.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reliability.&lt;/strong&gt; The gateway uses Gemini with multi-key failover, plus a deterministic fallback engine, so users still get a grounded answer from Sanity data if the model is unavailable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sanity Project Details
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Project ID:&lt;/strong&gt; &lt;code&gt;ntxlr356&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dataset:&lt;/strong&gt; &lt;code&gt;production&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Contains 42 titles, 13 trigger warnings, 7 accessibility rules, and 5 CBFC ratings.&lt;/p&gt;

&lt;h2&gt;
  
  
  Agent Session
&lt;/h2&gt;

&lt;p&gt;USHER was built iteratively in Google Antigravity as the AI-native development environment, covering schema design, the seeding script, the GROQ query layer, the agent's guardrails, and the UI. A transcript isn't included because Antigravity isn't currently supported by the DEV Agent Sessions uploader.&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>sanitychallenge</category>
      <category>sanity</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
