<?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: Vidisha Gupta</title>
    <description>The latest articles on DEV Community by Vidisha Gupta (@vidisha_gupta_).</description>
    <link>https://dev.to/vidisha_gupta_</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4141798%2F9aabbbcb-08ec-4a1d-8314-ea6502d1c0ab.jpg</url>
      <title>DEV Community: Vidisha Gupta</title>
      <link>https://dev.to/vidisha_gupta_</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vidisha_gupta_"/>
    <language>en</language>
    <item>
      <title>The Code Exorcist: an AI agent diagnoses bugs, a human banishes them (Sanity + Next.js)</title>
      <dc:creator>Vidisha Gupta</dc:creator>
      <pubDate>Wed, 30 Sep 2026 22:37:10 +0000</pubDate>
      <link>https://dev.to/vidisha_gupta_/the-code-exorcist-an-ai-agent-diagnoses-bugs-a-human-banishes-them-sanity-nextjs-5hd2</link>
      <guid>https://dev.to/vidisha_gupta_/the-code-exorcist-an-ai-agent-diagnoses-bugs-a-human-banishes-them-sanity-nextjs-5hd2</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 Two: Vibe-Code Something Strange&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;The Code Exorcist&lt;/strong&gt; is a horror-themed AI bug-triage app built with Next.js and Sanity. A developer pastes an error/stack trace and the actual buggy code snippet. A Groq-powered agent reads both together, finds the real root cause, names the "demon" (bug category), assigns a threat level, and writes a concrete fix.&lt;/p&gt;

&lt;p&gt;A human reviewer then makes the final call — directly from Sanity Studio — by clicking either &lt;strong&gt;💀 BANISH&lt;/strong&gt; (approve the fix, close the case) or &lt;strong&gt;🔄 Send Back for Re-analysis&lt;/strong&gt; (reject it, reset the case to &lt;code&gt;uncontained&lt;/code&gt;). Every decision is logged, timestamped, and visible live on the frontend with zero page reloads.&lt;/p&gt;

&lt;p&gt;It's built for the moment right after a bug report lands — when a team wants a fast, structured first pass before anyone commits real review time to it.&lt;/p&gt;

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

&lt;p&gt;🎬 Video walkthrough: &lt;a href="https://youtu.be/HKND1FXQkEo" rel="noopener noreferrer"&gt;https://youtu.be/HKND1FXQkEo&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🔗 Live app: &lt;a href="https://the-code-exorcist.vercel.app/" rel="noopener noreferrer"&gt;https://the-code-exorcist.vercel.app/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The app has one main route (&lt;code&gt;/&lt;/code&gt;) plus the Sanity Studio embedded at &lt;code&gt;/studio&lt;/code&gt; — submit a bug on the homepage, then open Studio to see the human-review side of the workflow.&lt;/p&gt;

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

&lt;p&gt;🔗 Repo: &lt;a href="https://github.com/vidishagupta/the-code-exorcist" rel="noopener noreferrer"&gt;https://github.com/vidishagupta/the-code-exorcist&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tech stack:&lt;/strong&gt; Next.js, React, TypeScript, Sanity (Studio v3, custom document actions, real-time &lt;code&gt;client.listen()&lt;/code&gt; API), Groq AI (Llama), Tailwind CSS, deployed on Vercel.&lt;/p&gt;

&lt;h2&gt;
  
  
  My Build Process
&lt;/h2&gt;

&lt;p&gt;I used Claude (chat) as my AI execution partner — working in VS Code with the terminal open side by side, pasting real errors back and forth until they were fixed. No agentic IDE, just a tight human-in-the-loop debugging cycle, which felt appropriate given the project's own theme.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The workflow, modeled as data next to the content:&lt;/strong&gt;&lt;br&gt;
Every &lt;code&gt;haunting&lt;/code&gt; document links to a separate &lt;code&gt;workflowState&lt;/code&gt; document rather than storing status as a flat field. Stages: &lt;code&gt;uncontained → pending_human_review → banished&lt;/code&gt;, with a full history log (actor, action, timestamp, notes).&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A user submits a bug — written to Sanity via a Next.js API route.&lt;/li&gt;
&lt;li&gt;That route triggers a second route that calls Groq with the error trace &lt;strong&gt;and&lt;/strong&gt; the code snippet together, forcing the model to diagnose the actual bug instead of pattern-matching the error text alone.&lt;/li&gt;
&lt;li&gt;The agent patches the document with entity type, threat level, root cause, and a real fix, then moves the workflow to &lt;code&gt;pending_human_review&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;A human opens Sanity Studio. Two custom document actions replace the default publish flow: &lt;strong&gt;BANISH&lt;/strong&gt; (approve) and &lt;strong&gt;Send Back for Re-analysis&lt;/strong&gt; (reject — resets the stage and logs why). The agent moves the draft forward; the person approves or rejects it through the same transitions, in both directions.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Real-time, not read-only:&lt;/strong&gt;&lt;br&gt;
The frontend uses &lt;code&gt;client.listen()&lt;/code&gt; on a GROQ query, so new submissions, AI diagnoses, and Banish/Reject decisions all appear instantly. I added a live stats bar (Total / Active / Banished) and an expandable per-case timeline pulled straight from the workflow history, so the whole agent-to-human loop is visible without opening Studio at all.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Where I got stuck (the honest part):&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Deprecated model names.&lt;/strong&gt; Asked for a Groq model, got &lt;code&gt;llama-3.3-70b-versatile&lt;/code&gt;, then &lt;code&gt;llama-3.1-8b-instant&lt;/code&gt; — both came back &lt;code&gt;model_not_found&lt;/code&gt;. Had to check Groq's actual live model list and swap to &lt;code&gt;openai/gpt-oss-20b&lt;/code&gt; instead of trusting a name that merely sounded plausible.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Silent 401, "Session does not match project host."&lt;/strong&gt; Regenerating the API token didn't fix it — the real cause was a dev server that hadn't picked up an updated &lt;code&gt;.env.local&lt;/code&gt;. A full restart (not just a file save) resolved it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Duplicate schema field.&lt;/strong&gt; A generated edit added a &lt;code&gt;status&lt;/code&gt; field that already existed; Sanity Studio refused to boot until the duplicate was found and removed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deploy broke on Vercel, worked fine locally.&lt;/strong&gt; Windows' case-insensitive filesystem let broken imports inside unused Sanity-starter leftovers (&lt;code&gt;client.ts&lt;/code&gt;, &lt;code&gt;image.ts&lt;/code&gt;, later &lt;code&gt;live.ts&lt;/code&gt; — none ever actually wired into the app) sit unnoticed for days. Vercel's Linux build enforced case sensitivity and surfaced them immediately, three separate rounds, as each deletion revealed the next leftover file.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Every one of these was a real terminal error, pasted back in, fixed, retested — nothing here worked on the first try.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;Project ID:&lt;/strong&gt; &lt;code&gt;1vedw6uo&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;Dataset:&lt;/strong&gt; &lt;code&gt;production&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Structured content: two document types, &lt;code&gt;haunting&lt;/code&gt; and &lt;code&gt;workflowState&lt;/code&gt;, connected by reference rather than embedded, so the workflow can be queried and reasoned about independently of the content it's tracking. &lt;code&gt;haunting&lt;/code&gt; has a custom Studio preview (title + status + threat level) and two custom document actions (&lt;code&gt;banishAction.ts&lt;/code&gt;, &lt;code&gt;rejectAction.ts&lt;/code&gt;) registered in &lt;code&gt;sanity.config.ts&lt;/code&gt;, fully replacing the default publish flow for that document type.&lt;/p&gt;

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

&lt;p&gt;The full build was done in a Claude chat session, used as an iterative execution partner rather than an autonomous agent — paste an error, get a fix, apply it, retest.&lt;/p&gt;

&lt;h2&gt;
  
  
  📄 Curated transcript highlights: &lt;a href="https://drive.google.com/file/d/13z0PqPEzKw9joED9rWbJ2eu2ybeQ06WW/view?usp=drivesdk" rel="noopener noreferrer"&gt;https://drive.google.com/file/d/13z0PqPEzKw9joED9rWbJ2eu2ybeQ06WW/view?usp=drivesdk&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Thanks for checking out my project!&lt;/em&gt; 🖤&lt;/p&gt;

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