DEV Community

Cover image for Breaking the AI Slop: Building a Real-time Content Detector
Harish Kotra (he/him)
Harish Kotra (he/him)

Posted on

Breaking the AI Slop: Building a Real-time Content Detector

In the age of generative AI, developer communities and blogging platforms are increasingly becoming filled with "AI slop", content that is technically correct but lacks soul, personality, and genuine human insight. Today, we're diving into the technical architecture of SlopSentry, a Chrome extension designed to help users identify AI-generated noise on Dev.to, Hashnode, and Medium.

The Problem: The Infinite Scroll of Generic Content

LLMs are great at writing, but they have distinct patterns:

  • Over-reliance on transition words ("Furthermore", "In conclusion").
  • Perfect but hollow sentence structures.
  • A lack of specific, messy human anecdotes.

SlopSentry uses these very LLMs to detect their own kind.

Technical Architecture

1. The DOM Observer (Content Script)

The biggest challenge in social media extensions is handling dynamic content. Platforms like X and LinkedIn use infinite scrolling. We implemented a MutationObserver that watches for new nodes being added to the DOM.

// Simplified observer logic
const observer = new MutationObserver(() => {
  const posts = document.querySelectorAll(PLATFORM_SELECTORS[platform]);
  posts.forEach(post => {
    if (!post.dataset.slopChecked) {
      analyzePost(post);
    }
  });
});

observer.observe(document.body, { childList: true, subtree: true });
Enter fullscreen mode Exit fullscreen mode

2. The Detection Engine (Background Worker)

To keep the UI responsive and bypass CORS restrictions, all API calls happen in a background service worker. This worker acts as a secure proxy between the content script and the AI providers.

We use a "BYOK" (Bring Your Own Key) model, allowing users to choose their provider:

  • OpenAI (GPT-4o-mini)
  • Claude (Haiku)
  • OpenRouter (For access to Llama 3, etc.)

3. The Prompt Engineering

The core of the detection is the prompt. We don't just ask "Is this AI?". We ask the model to look for specific "slop" markers:

const DETECTION_PROMPT = `
Analyze the following text and determine the probability (0-100%) that it was generated by an AI. 
Consider "AI slop" patterns: 
- Overly formal or generic language
- Repetitive sentence structures
- Lack of specific personal anecdotes
- Common LLM transition words

Return ONLY a JSON object with the key "percentage" and "reason".
`;
Enter fullscreen mode Exit fullscreen mode

Visual Feedback Loop

Once the background worker returns a score, the content script injects visual indicators directly into the feed:

  • Green Border: < 20% AI probability.
  • Yellow Border: 20-50% AI probability.
  • Red Border: > 50% AI probability.

Example Output 1

Example Output 2

Privacy and Security

One of my core principles was Zero Data Storage.

  • API keys are stored in chrome.storage.sync (encrypted by the browser).
  • No telemetry is sent to our servers.
  • The extension acts as a pure proxy.

SlopSentry is more than just a detector; it's a tool for digital mindfulness. By highlighting AI-generated content, we encourage users to seek out and engage with genuine human voices.

Github Repo: https://github.com/harishkotra/slopsentry

Top comments (0)