Agentic Reddit Context Guardian

The semantic AI moderation layer built natively for Devvit to catch what AutoModerator misses.


💡 Inspiration

Traditional Reddit AutoModerator relies on rigid, easily bypassed regex text rules. It completely fails against sarcasm, malicious subtext, homoglyphs, and modern leetspeak.

I built Agentic Reddit Context Guardian to inject a human-grade semantic comprehension layer directly into the subreddit moderation loop—analyzing intent, not just keywords.

🔥 What It Does

An autonomous, serverless AI moderator running natively within the Reddit Devvit infrastructure:

  • Instant Triage: Auto-screens incoming comments in real-time (onCommentCreate).
  • Advanced Content Analysis: Detects hidden hate speech and toxic bypasses using Google Gemini 2.5 Flash.
  • Seamless Escalation: Forwards flagged violations straight to Reddit's native mod queue via reddit.report().
  • Full Audit Hub: A gorgeous, dedicated tracking dashboard (React 19 + Tailwind CSS 4) to monitor automated actions.
  • Plug-and-Play: Zero configuration needed—moderators just drop in an API key.

⚡ Production-Grade Resiliency (The Stats)

Serverless systems break under heavy traffic spikes. I engineered this tool with an aggressive 3-tier resilience architecture to withstand viral Reddit threads:

  1. 4s Hard Cutoff: Utilizes an AbortController timeout to prevent serverless execution freezes.
  2. Jittered Exponential Backoff: Gracefully self-recovers from 429/5xx rate limits with smart retry loops.
  3. The Proof: Validated under a brutal 150-request concurrent stress test, maintaining a 100% success rate and 98.7% accuracy without a single crash.

🛠️ How It Was Built

  • Backend Core: TypeScript + Hono compiled inside the native Devvit ecosystem.
  • Deterministic AI: Gemini 2.5 Flash integration using Strict JSON Schema payloads to guarantee structured, predictable data outputs with zero token parsing waste.
  • Lightweight Ledger: High-speed chronological data storage powered entirely by Redis Sorted Sets with auto-expiring 30-day memory horizons.
  • Custom Frontend: Completely custom Web View dashboard crafted with React 19, Vite, and Tailwind CSS 4.0.

🚀 What's Next

  • Per-Subreddit Guidelines: Let moderators inject custom community rule prompts directly into the AI agent.
  • Multimodal Defense: Expand evaluation parameters to catch toxic images, memes, and video posts.
  • Analytics Layer: Add comprehensive visual trends showing moderation history and filter accuracy.

Built With

  • devvit-0.12.24-(reddit-platform)
  • devvit-redis
  • google-gemini-2.5-flash-api
  • hono-4.12.21
  • node.js
  • react-19.2.6
  • tailwind-css-4.3.0
  • typescript-6.0.3
  • vite-8.0.13
Share this project:

Updates