Inspiration

When I first joined a Reddit tech community, I wrote a post I'd been thinking about for a while. Hit submit. It disappeared instantly. No notification. No explanation. No path forward. Just gone.

I spent 20 minutes trying to figure out what happened. Eventually gave up. I almost didn't come back.

That experience stuck with me — not because my post was important, but because the silence was. Reddit communities lose potential members every day not because AutoModerator made the wrong call, but because it made the right call and said nothing. A missing tag. A formatting requirement nobody reads in the rules. A karma threshold that catches genuine users alongside bots.

The violation is fixable in 30 seconds. The user just doesn't know what it is.

Airlock is the tool I wished existed when I was that user.


What It Does

Airlock is a background intelligence layer for subreddit moderation built entirely on Reddit's Devvit platform.

The Airlock Sweeper

Runs as a scheduled cron job every 60 seconds. It scans the Moderation Log for AutoModerator strikes and for each one:

  • Extracts the user's original post title, body, and the exact violation reason from the AutoMod action_reason field
  • Saves the draft securely to the Devvit KV Store, keyed to the author's username
  • Posts a recovery comment on the removed thread with a direct link to the Recovery Portal
  • Marks the log entry as processed to prevent duplicate actions

The Airlock Recovery Portal

A locked Custom Post — one per subreddit, created on app install.

When the user opens it:

  1. They see their exact rule violation highlighted in red — not a generic message, the actual AutoMod action reason
  2. They see a preview of their saved draft (title + truncated body)
  3. They check a single box acknowledging they've read the violation
  4. They click "Request Manual Review" — which transmits their full, untruncated draft directly to the mod team via a structured Mod Discussions thread

The mod receives a labeled thread: violation, title, full body. One click to approve or dismiss.

Impact

Before Airlock: 3–5 minutes per filtered user, ModMail flooded with “why was my post deleted?”

After Airlock: Under 30 seconds. Zero ModMail back-and-forth.


How We Built It

The architecture is a Human-in-the-Loop (HITL) Middleware pattern with four components.

Component A — The Sweeper (Cron Job)

Devvit.addSchedulerJob(...)

Runs on a * * * * * heartbeat.

Responsibilities:

  • Polls getModerationLog
  • Filters for AutoModerator actions
  • Deduplicates via processed_log:{id} keys in KV Store
  • Fetches post content via getPostById
  • Stores structured draft JSON

Component B — The Singleton Portal (Custom Post UI)

One locked Custom Post per subreddit.

Uses:

useAsync(...)
context.reddit.getCurrentUser()

Features:

  • Session-aware authentication
  • Users can only see their own drafts
  • TTL enforcement purges drafts older than 7 days
  • Body preview truncated at 120 characters
  • Full body preserved for recovery submission

Component C — ModMail Handshake

context.reddit.modMail.createConversation(...)

Behavior:

  • Sends complete draft + violation reason
  • Deletes draft after submission
  • Ensures one recovery request per filtered post
  • Prevents duplicate submissions

Component D — Ignition Switches

Three moderator menu actions:

  • Initialize (First Time Setup) — one-click full setup
  • Spawn Recovery Post
  • Ignite Sweeper Engine

Supports both guided onboarding and granular control.


KV Store Schema

singleton_post_id         → Recovery Portal post ID
processed_log:{log_id}    → "true" (deduplication ledger)
draft:{username}          → JSON {
                               title,
                               body,
                               violation,
                               author,
                               savedAt,
                               status
                             }

Challenges We Ran Into

The Webhook Suppression Wall

This was the defining technical challenge of the entire project.

Devvit intentionally suppresses event webhooks for AutoModerator actions to prevent infinite recursive bot loops.

Every direct trigger attempt failed silently:

  • AutomoderatorFilterPost
  • ModAction
  • PostSubmit
  • PostCreate

Three days of debugging before realizing this was a platform-level design decision, not a bug.

The Breakthrough

Stop fighting the platform.

If webhooks are suppressed for AutoModerator events, poll retroactively instead.

The cron sweeper architecture bypassed the limitation entirely — and turned out to be more resilient:

  • Failed heartbeat? Retry next cycle
  • No event dependency
  • Naturally fault tolerant

The Singleton Pattern Under Concurrent Load

Early versions created a new Custom Post for every filtered user.

Problems:

  • Feed clutter
  • State collision
  • Poor UX

The singleton design solved everything.

One permanent locked post acts as a session-aware recovery portal while each user retrieves only their own KV-stored draft via username-keyed access.

Zero collision. Clean subreddit UX.


ID Prefix Inconsistency

Reddit's ModLog sometimes returns post IDs without the t3_ prefix required by getPostById.

Fix:

targetId.startsWith('t3_')
  ? targetId
  : 't3_' + targetId

Accomplishments We're Proud Of

The Full Pipeline Works End-to-End

Confirmed working on a live subreddit:

AutoMod removes post
        ↓
Sweeper detects within 60s
        ↓
Recovery comment appears
        ↓
User opens portal
        ↓
Violation reason displayed
        ↓
Draft recovered
        ↓
User requests review
        ↓
Mods receive structured recovery thread

Every stage validated in production.


The Cron Sweeper Architecture Is Novel

No existing Devvit app uses scheduled Moderation Log polling as an AutoModerator interception mechanism.

This isn't just a workaround.

It's a reusable moderation architecture pattern.


Precise Violation Explanations

Most moderation tools say:

“Your post was removed.”

Airlock says:

“Your post was removed because: Architecture Standard 1.04: Missing mandatory stack tag. Titles must begin with exactly [REACT], [FASTAPI], or [DEVVIT].

That specificity changes user behavior completely.


What We Learned

Platform Constraints Can Improve Architecture

Webhook suppression forced a polling model that ended up being more resilient than event-driven systems.

  • Rate limit failures recover automatically
  • Missed cycles self-correct
  • No dependency on webhook reliability

Silence Is the Real UX Problem

The issue isn't removal.

The issue is unexplained removal.

Airlock's core value isn't recovery tooling — it's restoring communication between AutoModerator systems and genuine users.


Devvit KV Store Is Surprisingly Powerful

Simple primitives enabled sophisticated moderation state management:

  • Username-keyed draft recovery
  • Deduplication ledgers
  • Singleton portal references
  • TTL-based cleanup

No complex database required.


What's Next for Airlock — Submission Recovery Engine

Spam Prevention Layer

  • Exponential cooldowns for repeat offenders
  • Content diff detection
  • Blocks resubmissions with meaningless edits

Mod-Side Diff View

Side-by-side comparison:

Original Corrected
Missing stack tag Fixed title format

Moderators review the actual change instead of rereading full content.


Dedicated Review Queue UI

A custom Devvit moderation dashboard featuring:

  • Pending recovery requests
  • One-click approve/deny
  • Bulk moderation actions
  • Separate from ModMail

AutoMod Rule Auto-Detection

Instead of manual configuration, Airlock will:

  • Parse subreddit AutoModerator config
  • Detect removable rules automatically
  • Suggest interceptable patterns during setup

Built With

Share this project:

Updates