Inspiration

Reddit moderation in 2025 is broken. AI-generated content has flooded subreddits at a scale no mod team was built to handle content that passes every keyword filter, looks grammatically perfect, and buries genuine human posts. Mod teams are overwhelmed, under-tooled, and burning out. The most powerful external moderation tool available ContextMod by @FoxxMD requires a self-hosted server, a Docker setup, and YAML configuration files just to get started. It's powerful but inaccessible to the average moderator. Thousands of subreddits that desperately need automation can't get it because the barrier is too high. Reddit's native AutoModerator has no AI awareness, no analytics, and no team coordination. Mods working the same queue duplicate each other's work, make decisions without knowing a user's history, and have no visibility into whether their rules are actually working. We asked: what if there was a single Devvit app that brought AI content scoring, visual rule automation, collaborative team tools, and community health analytics together — installable in two minutes, zero infrastructure, zero YAML? That's ModSentinel.

What it does

ModSentinel is a complete AI-powered moderation command center running natively inside Reddit via Devvit. Six integrated capabilities, one install: 1. AI Triage Queue Every new post and comment is automatically scored for AI-generated content probability and spam likelihood using the Anthropic API. The queue displays risk levels from CRITICAL to SAFE with human-readable signals like "repetitive phrasing", "generic positive sentiment", "lacks personal voice". Mods take action — remove, approve, hold, ban, mute, lock — in one click or one keypress. A keyword heuristic fallback keeps scores flowing when the API is unavailable.

2. Visual Rule Builder (ContextMod Port) A no-code rule editor built on a direct port of ContextMod's evaluation engine. Eight condition fields: accountAge, karma, aiScore, spamScore, postsLast24h, commentsLast24h, reportCount, uniqueSubsLast24h. Nine action types. AND/OR condition logic. Priority-ordered evaluation with live match counters so mods know which rules carry the most weight. The rule schema is intentionally ContextMod-compatible — existing ContextMod users can recreate their YAML rules in the visual UI without learning anything new.

3. Collaborative Mod Notes Shared notes on users, posts, and comments — synced across the entire mod team via Devvit Redis and written to Reddit's native mod notes API. Six label types (spam, abuse, warning, helpful, watch, info). Every note is visible to every mod immediately.

4. Community Health Pulse 7-day trend charts tracking total content reviewed, AI content rate, spam rate, top rule violations, mod team activity breakdown, and average review time. Every Monday at 9 AM, a distinguished mod post is auto-published with the weekly health digest — mods get the report automatically, no dashboard visit required.

5. User Profile View One click on any username opens a full risk profile: account age, karma, risk level badge, spam signals, AI generation signals, behavior pattern badges, a timeline of recent subreddit activity with individual AI scores, and the complete mod action history for that user.

6. Context Menu Actions Five mod menu items work from any Reddit page - "Score This Post", "Score This Comment", "View User in ModSentinel" giving mods AI-powered context directly from the Reddit UI without opening the dashboard.

How we built it

Backend Devvit v0.11 (TypeScript) The core is a Devvit app (src/) registering five event triggers (AppInstall, PostCreate, CommentCreate, PostReport, CommentReport), a weekly cron job (0 9 * * 1), five context menu items, three app settings, and a custom post type hosting the WebView. All state lives in Devvit Redis across eight namespaces: ms:queue, ms:rules, ms:notes, ms:health, ms:score, ms:config, ms:actions, and ms:act24. Rolling 24-hour activity counters use timestamp arrays filtering by Date.now() - 86_400_000 so spam burst detection never breaks near midnight boundaries. The rule engine (ruleEngine.ts) is a full port of ContextMod's evaluation logic: rules load from Redis, filter by enabled and appliesTo, sort by priority, and evaluate against a lazy-fetched context. Activity counters only fetch when a rule actually needs them, keeping trigger latency minimal.

AI Scoring Anthropic API aiScorer.ts calls the Anthropic messages API with a structured JSON scoring prompt. The response returns aiScore, spamScore, riskLevel, signals[], and reasoning. A keyword heuristic fallback activates automatically when the API is unavailable.

Frontend - React 18 + Vite 5 + Tailwind CSS The WebView (web/src/) is a full React 18 SPA with a typed postMessage bridge (useDevvit.ts) handling 14 message types in each direction. Vite manual chunks split the bundle into a 79KB app shell, a 517KB Recharts chunk, and a 23KB Lucide chunk — fast initial load inside Reddit's WebView constraint.

Demo Vercel webroot/ deploys to Vercel as a static site. devtest.html contains a complete mock backend handling all 14 message types with realistic queue data, user profiles, health stats, and rules — judges can evaluate every feature at webroot-wheat.vercel.app with no Reddit account or API key required.

Challenges we ran into

TriggerContext vs Context typing Devvit's trigger handlers receive TriggerContext = Omit. Every utility function we wrote was typed to Context. We had to cast at each trigger boundary — a subtle mismatch that caused confusing TypeScript errors until we understood the platform distinction.

PostV2 proto field gaps event.post.subredditName doesn't exist on the proto type at runtime. We discovered through testing that event.subreddit?.name is the correct path — nothing in the docs called this out explicitly.

UserNoteLabel enum values Reddit's native mod notes API only accepts eight specific label strings: BOT_BAN, PERMA_BAN, BAN, ABUSE_WARNING, SPAM_WARNING, SPAM_WATCH, SOLID_CONTRIBUTOR, HELPFUL_USER. Our initial label mapping used shorter names that silently failed. We built a mapping layer to translate our UI labels (spam, abuse, warning, helpful, watch, info) to the correct API values.

Vite emptyOutDir deleting Vercel config Every frontend build wiped webroot/ including the vercel.json we'd placed there. The fix: move vercel.json into web/public/ which Vite automatically copies into the output directory on every build.

WebView message wrapping Devvit wraps incoming WebView messages in production: { type: 'devvit-message', data: { message: payload } }. The devtest harness sends unwrapped messages. The useDevvit.ts bridge had to handle both formats transparently — otherwise features would silently break in one environment or the other.

Rolling 24h activity counters Simple daily-reset Redis counters break near midnight — a post at 11:58 PM and a post at 12:02 AM appear to be on separate days. We replaced all counters with Redis arrays of timestamps and filter by Date.now() - 86_400_000 to get true rolling 24-hour windows.

Accomplishments that we're proud of First Devvit app with LLM-powered content moderation. No prior Devvit app uses a large language model to score content. Catching AI-generated posts that pass every keyword filter is a genuinely new capability on the platform. Complete ContextMod port. Every PRAW call translated to Devvit API. Every YAML config translated to a visual UI. SQLite → Redis. Self-hosted webhook server → Devvit serverless triggers. The port is so faithful that existing ContextMod YAML rules map directly to our condition schema. Zero TypeScript errors across the full stack. Backend Devvit code and frontend React code both pass tsc --noEmit cleanly. Type-safe postMessage protocol with 14 discriminated union types in each direction. Fully functional demo with no external dependencies. Any judge can open the live demo, triage a queue, build rules, view user profiles, and check health charts — no Reddit account, no API key, no install. 6 features shipping as a single install. Previously a mod team would need AutoModerator + ContextMod + a separate notes tool + a separate analytics dashboard. ModSentinel replaces all of them in one install.

What we learned

Devvit Redis is a full application database, not just a cache. With careful key design and TTL management, it handles queue state, rule definitions, action logs, rolling counters, and cached analytics without any external storage. Serverless triggers require different latency thinking. Every PostCreate trigger must score content, update Redis, evaluate rules, and optionally take action — all within Devvit's execution budget. Lazy evaluation, aggressive caching, and graceful fallbacks aren't optional, they're architectural requirements. The WebView Devvit message boundary is the hardest part of Devvit development. Type-safe discriminated unions for both directions, handling the production wrapper vs devtest format, and keeping the mock backend in sync with the real one this is where most complexity lives. Prompt engineering for structured JSON output requires defensive parsing. LLMs occasionally wrap responses in markdown fences or add prose. Every response path needs fence stripping, JSON extraction, and schema validation before being trusted. ContextMod's rule schema is elegantly portable. The condition-operator-value pattern maps cleanly to a visual UI without losing expressive power. The hardest part wasn't the logic — it was replacing PRAW's synchronous polling model with Devvit's event-driven trigger architecture.

What's next for ModSentinel

Multi-subreddit dashboard Power mods managing 5-10+ subreddits need a unified view. A cross-subreddit queue aggregator with per-sub filters would let large mod teams work from a single interface.

Appeal queue A structured workflow for users to appeal removals — with mod response templates, appeal status tracking, and automatic resolution timers. Closes the feedback loop that currently leaves users in the dark.

Rule templates marketplace Pre-built rule packs for common community types (gaming, support, news, NSFW) that mods can install with one click. Community-contributed templates shareable across subreddits.

Expanded AI models Support for multiple AI providers and models — lighter models for high-volume subreddits, more capable models for nuanced policy enforcement — with per-rule model selection.

Mod performance insights Per-moderator action stats, response time tracking, and workload distribution heatmaps to help mod teams identify burnout risk and balance the queue fairly.

Webhook integrations Push mod action alerts and health reports to Discord, Slack, or custom endpoints — so mod teams living in external tools still get ModSentinel's signal.

Built With

  • anthropic-messages-api
  • contextmod
  • css
  • devvit-cli
  • devvit-redis
  • devvit-scheduler
  • devvit-serverless-triggers
  • devvit-settings-api
  • devvit-webview
  • git
  • github
  • html
  • lucide-react
  • node.js
  • npm
  • react-18
  • recharts
  • reddit-context-menu-api
  • reddit-developer-platform
  • reddit-mod-notes
  • tailwind-css-3
  • tsx
  • typescript
  • vercel
  • vite-5
Share this project:

Updates