AI Detector (based on AI writing patterns, not watermarks)

AI-generated summary

Judith introduced the Discourse AI Detector, a plugin that analyzes new posts using Claude to estimate the probability of AI generation. Posts exceeding a user-defined threshold (default 75%) receive a banner warning readers, with staff able to expand the banner to see the model’s reasoning. The detector compares text against signs of AI and human writing, ignoring quoted content and grammar errors from non-native speakers. Checks run in the background to avoid slowing down posting, with edited posts rechecked 10 minutes after changes. Private messages, staff posts, and excluded categories are never scanned. Users can customize the banner text, threshold, and model via site settings. A rake task with a dry-run mode allows admins to test the detector on older posts before enabling it live. The plugin requires an Anthropic API key, with costs approximately $6 per 1,000 posts using the default Claude Opus model. Installation involves adding the repository link, configuring the API key, and running the plugin as the discourse user to avoid database errors. The summary emphasizes that the score is an estimate for caution, not a definitive verdict.

:information_source: Summary Each new public post is rated on probability of it being AI written. If the probability is over a user-defined threshold, the post gets a banner informing readers of this. Moderators can access reasoning.
:hammer_and_wrench: Repository Link GitHub - Sprachprofi/discourse-ai-detector: Discourse plugin that flags likely AI-generated posts using Claude · GitHub
:open_book: Install Guide How to install plugins in Discourse

Features

Discourse AI Detector asks Claude how likely each new post is to be AI-generated. Posts at or above a threshold you choose (75% by default) get a banner above the text, by default it is “An automated check estimates a 85% chance that this post was written by AI. The check can be wrong.” Staff can expand the banner to see Claude’s reasoning, such as which typical AI phrasings it found. Claude compares each post against Wikipedia’s list of signs of AI writing and against signs of human writing. Quoted text is removed first, and grammar mistakes from non-native speakers don’t count as a sign of AI.

The check runs in the background, so posting is never slowed down or blocked, and readers see the banner appear without reloading. Edited posts are checked again 10 minutes after the edit, and only if the text changed. Private messages, staff posts and excluded categories are never checked. The banner text, threshold and model are site settings. A rake task scores older posts if desired, and it has a dry-run mode for trying the detector without anything appearing on the forum.

You need an Anthropic API key. With the default model, Claude Opus 5.5, a check costs about 0.6 cents per post, or around $6 per 1,000 posts. The score is an estimate, not proof: treat a banner as a reason to read more carefully, not as a verdict on the author.

Configuration

  1. Install the plugin as you would any other, using GitHub - Sprachprofi/discourse-ai-detector: Discourse plugin that flags likely AI-generated posts using Claude · GitHub , then rebuild.
  2. Get an API key from console.anthropic.com and enter it in the settings as ai_detector_anthropic_api_key.
  3. Optional: see what the detector makes of your forum before anyone else does. Inside the container, run a dry run on your latest posts. It prints each post’s score and link but saves nothing, so no banners appear:

cd /var/discourse
./launcher enter app
cd /var/www/discourse
su discourse -c 'bundle exec rake "ai_detector:check_latest[50,dry_run]"'

You can also run this before saving a key in the admin panel by passing one on the command line: su discourse -c 'ANTHROPIC_API_KEY=sk-ant-... bundle exec rake "ai_detector:check_latest[50,dry_run]"' . Without ANTHROPIC_API_KEY, the task uses the site setting.
4. Adjust the threshold and excluded categories if needed, then turn on ai_detector_enabled. From then on, new and edited posts are checked automatically.
5. To score older posts for real, run the same task without dry_run. Posts that have already been scored aren’t sent again, so running it again costs little.

The task must run as the discourse user, as shown above. Run as root, it fails with a misleading “Database not found” error.

Settings

Include a table of settings and setting descriptions

Name Description
anthropic_api_key Anthropic API key
model Any Claude model ID. Opus works well, Haiku does not, in my experience
threshold Default: 75. The banner shows on posts scoring at or above this percentage. Scores are stored as they are, so a new threshold also applies to posts already checked.
banner_text Custom banner text. {probability} is replaced by the score
excluded_categories Posts in these categories and their subcategories aren’t checked, e.g. for private subforums that should not be shared with an LLM

Note that changing these settings doesn’t clean up existing banners.

1 Like