Drupal is a registered trademark of Dries Buytaert
Release: Paragraphs 8.x-1.22 Minor update available for module paragraphs (8.x-1.22). Release: Menu Item Extras 3.1.2 Minor update available for module menu_item_extras (3.1.2). Release: Emulsify Tools 2.2.0 Minor update available for module emulsify_tools (2.2.0). Release: REST OAI-PMH 2.3.3 Minor update available for module rest_oai_pmh (2.3.3). Release: highlight.js Input Filter 2.0.0 Major update available for module highlightjs_input_filter (2.0.0). Release: REMP Paywall 2.0.1 Minor update available for module remp (2.0.1). Module Revived: oEmbed Providers 2.2.4 Module oembed_providers updated after 7 months of inactivity (2.2.4). Release: Vartheme Bs5 5.0.0-rc1 First release candidate for theme vartheme_bs5 (5.0.0-rc1). Release: Webshare 2.0.0-beta1 First beta version released for module webshare (2.0.0-beta1). Security Coverage: REMP Paywall Module remp now has official Drupal security advisory coverage.

This module uses AI to automatically detect and handle abusive or harmful content in Drupal comments. It can flag comments for review, replace offensive phrases, or block the entire comment based on AI analysis.

Overview

AI Comment Guard automatically detects and handles abusive,
offensive, or harmful language in Drupal comments using the
Anthropic Claude AI API. Instead of
relying on static word lists or manual moderation queues, it sends each
comment through a large language model that understands context — catching
subtle harassment, coded language, and policy violations that keyword filters
miss entirely.

The Problem

Comment sections on high-traffic Drupal sites attract spam, hate speech, and
abusive content. Manual moderation does not scale, and traditional keyword
blocklists are trivially bypassed. Site administrators need an intelligent,
low-maintenance solution that acts before harmful content ever reaches other
readers.

What This Module Does

Every comment is evaluated by Claude AI before it is published. Based on the
result, the module can take one of three configurable actions:

  • Flag — unpublish the comment silently and place it in the
    moderation queue for an administrator to review.
  • Replace — keep the comment published but replace harmful
    phrases with [removed], preserving the rest of the author's
    message.
  • Block — replace the entire comment body with a
    configurable policy message and unpublish it.

Key Features

  • AI-powered moderation using Anthropic Claude — understands context, not just keywords
  • Three action modes: Flag, Replace, Block
  • Configurable sensitivity levels: Low, Medium, High
  • Custom rules field — extend the AI prompt with site-specific policy in plain language
  • Bypass permission — trusted roles (editors, admins) skip AI review entirely
  • Optional email notification to comment authors when their comment is flagged
  • Violation logging to Drupal watchdog with severity level and AI-generated reason
  • Status Report integration — warns on the admin dashboard if the API key is missing
  • Compatible with Drupal 10 and 11

Requirements

  • Drupal core comment module
  • An Anthropic API key (paid, usage-based)
  • PHP 8.1 or higher
  • Outbound HTTPS access from your server to api.anthropic.com

Installation

Install as you would any contributed Drupal module:

composer require drupal/ai_comment_guard
drush en ai_comment_guard
drush cr

Then navigate to Administration → Configuration → Content authoring
→ AI Comment Guard
and enter your Anthropic API key.

Configuration

All settings are managed through a single admin form. Choose your moderation
mode, set the AI sensitivity level, and optionally write custom rules in
plain English — for example: "Also flag any comments promoting competitor
products"
or "Flag comments that include external links." No
code changes are required.

Privacy Consideration

Comment text is sent to Anthropic's API for analysis. Ensure your site's
privacy policy and terms of service reflect this. Do not use this module on
sites where comment content is confidential or subject to data residency
requirements without reviewing
Anthropic's privacy policy.

Similar Modules

If you need AI moderation for node content or other entity types, consider
pairing this module with
Drupal AI, which provides a
provider-agnostic AI abstraction layer for the broader Drupal ecosystem.

Activity

Tracked releases
2
Tracked since
Jun 2026
Latest release
1 month ago
Releases (12 mo)
2 ▲ from 0
Maintenance
Active

Releases

Version Type Release date
1.1.0 Stable Jun 18, 2026
1.0.0 Stable Jun 18, 2026