<?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: Steven Nguyen</title>
    <description>The latest articles on DEV Community by Steven Nguyen (@tunabearfish).</description>
    <link>https://dev.to/tunabearfish</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3837723%2F823e054f-7101-49d3-85d4-06105a74698e.png</url>
      <title>DEV Community: Steven Nguyen</title>
      <link>https://dev.to/tunabearfish</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tunabearfish"/>
    <language>en</language>
    <item>
      <title># Bug Ticket Agent — AI-Powered Sentry Triage into Notion</title>
      <dc:creator>Steven Nguyen</dc:creator>
      <pubDate>Sun, 29 Mar 2026 03:49:02 +0000</pubDate>
      <link>https://dev.to/tunabearfish/-bug-ticket-agent-ai-powered-sentry-triage-into-notion-1moh</link>
      <guid>https://dev.to/tunabearfish/-bug-ticket-agent-ai-powered-sentry-triage-into-notion-1moh</guid>
      <description>&lt;p&gt;Bug Ticket Agent — AI-Powered Sentry Triage into Notion&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This is a submission for the Notion MCP Challenge.&lt;/em&gt;&lt;/p&gt;




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

&lt;p&gt;Every time an error fires in production, someone on your team has to open Sentry, read through the stack trace, decide how urgent it is, and manually write a ticket. That happens at 2am. People skip steps. Duplicates pile up.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bug Ticket Agent&lt;/strong&gt; automates the entire triage workflow. It listens for Sentry webhooks, runs a Claude AI agent to analyze each error, and writes a structured, prioritized ticket directly into a Notion database — including deduplication, AI-generated summaries, and suggested fixes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Key Capabilities
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Automatic intake&lt;/strong&gt; — receives Sentry webhook events and queues them for processing&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Intelligent deduplication&lt;/strong&gt; — searches Notion before creating anything; updates existing tickets instead of duplicating&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AI priority assignment&lt;/strong&gt; — Claude assigns P0–P3 based on environment, user impact, and frequency&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Structured tickets&lt;/strong&gt; — every ticket gets an error type, stack trace, affected users, AI summary, and a concrete fix suggestion&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Escalation alerts&lt;/strong&gt; — P0/P1 production errors are flagged immediately for PagerDuty/Slack wiring&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Queue-based processing&lt;/strong&gt; — serialized job queue prevents race conditions when Sentry fires bursts of events&lt;/li&gt;
&lt;/ul&gt;




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



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;[Terminal A — server running]
🐛 bug-ticket-agent running on http://localhost:3000

[Terminal B — send a P0]
&lt;/span&gt;&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;npm run demo &lt;span class="nt"&gt;--&lt;/span&gt; &lt;span class="nt"&gt;--scenario&lt;/span&gt; p0
&lt;span class="go"&gt;
→ Webhook received: "TypeError: Cannot read properties of undefined (reading 'charge')"
→ Triage started...
→ Searching Notion for duplicates... none found
→ Assigning priority: P0 (payment service, 247 affected users, production)
→ Writing summary and suggested fix...
→ Creating Notion ticket... ✓ page_id: abc123

⚠️  ESCALATION ALERT: P0 detected in production — notify on-call immediately

[Notion database — ticket appears]
Title:    TypeError: Cannot read properties of undefined (reading 'charge')
Priority: P0
Env:      production
Users:    247
Summary:  "Payment processing failed due to a null reference on the charge object..."
Fix:      "Add a null check for stripe.charge in src/payments/processor.ts:88"
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;[Send the same error again]
&lt;/span&gt;&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;npm run demo &lt;span class="nt"&gt;--&lt;/span&gt; &lt;span class="nt"&gt;--scenario&lt;/span&gt; duplicate
&lt;span class="go"&gt;
→ Searching Notion for duplicates... found existing ticket (page_id: abc123)
→ Updating frequency: 12 → 18 occurrences, last seen: now
→ Done. No duplicate created.
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Show Us the Code
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;GitHub:&lt;/strong&gt; &lt;a href="https://github.com/tunabearfish/bug-ticket-agent" rel="noopener noreferrer"&gt;bug-ticket-agent&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Sentry Webhook
     │
     ▼
Express Server  ──→  Job Queue (serialized)
                          │
                          ▼
                   Claude Triage Agent
                    ├── Search Notion (duplicate check)
                    ├── Assign P0–P3 priority
                    ├── Write summary + fix suggestion
                    └── Create or Update Notion page
                              │
                              ▼
                       Notion Database
                     (Bug Tracker, live)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Tech stack:&lt;/strong&gt; TypeScript · Express · Claude claude-sonnet-4-6 · Notion MCP Server · Zod&lt;/p&gt;




&lt;h2&gt;
  
  
  How I Used Notion MCP
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Claude Discovers Tools at Runtime
&lt;/h3&gt;

&lt;p&gt;Instead of hardcoding Notion API calls, I spin up the official Notion MCP server over stdio and let Claude fetch the available tools on startup. Claude then decides which tools to call and in what order — &lt;code&gt;search-database&lt;/code&gt;, &lt;code&gt;create-page&lt;/code&gt;, &lt;code&gt;update-page&lt;/code&gt; — based on what it finds.&lt;/p&gt;

&lt;p&gt;This means zero Notion API wrapper code on my end. If Notion adds new MCP tools, the agent gets them for free.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Deduplication via MCP Search
&lt;/h3&gt;

&lt;p&gt;The first thing Claude does in every triage loop is call the Notion search tool with the error title. If it finds a matching ticket, it updates frequency and last-seen instead of creating a new one. This logic lives entirely in the agent prompt — not in hand-written code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1. Search the database for an existing ticket matching this error title.
2. If duplicate found: update frequency and last seen. Report the page ID.
3. If no duplicate: assign priority, write summary and fix, create a new page.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. Structured Tickets via MCP Create
&lt;/h3&gt;

&lt;p&gt;When Claude creates a ticket, it maps the error data to Notion's property schema — priority as a select, environment as a multi-select, stack trace as a code block, summary and fix as rich text. The Notion MCP server handles all the property formatting; Claude just fills in the values.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. The Priority Rubric
&lt;/h3&gt;

&lt;p&gt;Claude doesn't guess — it applies a deterministic rubric from the system prompt:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Priority&lt;/th&gt;
&lt;th&gt;Criteria&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;P0&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Production down, data loss, auth/payment broken, or &amp;gt;100 affected users&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;P1&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Major feature broken, &amp;gt;10 affected users, recurring in production&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;P2&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Minor degradation, &amp;lt;10 users, workaround exists, or staging&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;P3&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Cosmetic, single user, dev environment, very low frequency&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbt41x2ja5grp8bz6ypzm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbt41x2ja5grp8bz6ypzm.png" alt=" "&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  What This Unlocks
&lt;/h2&gt;

&lt;p&gt;Before this: an engineer gets paged, opens Sentry, reads the error, manually creates a Notion ticket, assigns a priority based on gut feel, and hopes they didn't miss a duplicate.&lt;/p&gt;

&lt;p&gt;After this: the ticket is already in Notion by the time the engineer opens Slack. It has a priority, a summary, a suggested fix, and no duplicate. The engineer can go straight to fixing instead of triaging.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpiqia93vq2k229ex5myb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpiqia93vq2k229ex5myb.png" alt=" "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Notion MCP server made this possible without building a custom Notion integration. Claude handled all the tool orchestration — I just described what I wanted in the system prompt.&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>notionchallenge</category>
      <category>mcp</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
