Drupal is a registered trademark of Dries Buytaert
drupal 10.6.11 Update released for Drupal core (10.6.11)! drupal 11.3.12 Update released for Drupal core (11.3.12)! drupal 11.2.14 Update released for Drupal core (11.2.14)! drupal 10.5.12 Update released for Drupal core (10.5.12)! cms 2.1.3 Update released for Drupal core (2.1.3)! drupal 10.5.11 Update released for Drupal core (10.5.11)! drupal 11.3.11 Update released for Drupal core (11.3.11)! drupal 11.2.13 Update released for Drupal core (11.2.13)! drupal 10.6.10 Update released for Drupal core (10.6.10)! cms 2.1.2 Update released for Drupal core (2.1.2)! drupal 11.1.10 Update released for Drupal core (11.1.10)! drupal 10.5.10 Update released for Drupal core (10.5.10)! drupal 10.4.10 Update released for Drupal core (10.4.10)! drupal 11.2.12 Update released for Drupal core (11.2.12)! drupal 11.3.10 Update released for Drupal core (11.3.10)! drupal 10.6.9 Update released for Drupal core (10.6.9)! drupal 10.6.8 Update released for Drupal core (10.6.8)! drupal 11.3.9 Update released for Drupal core (11.3.9)! drupal 11.3.8 Update released for Drupal core (11.3.8)! drupal 11.3.7 Update released for Drupal core (11.3.7)!

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, 11, and 12

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

Total releases
1
First release
Jun 2026
Latest release
14 hours ago
Release cadence
Stability
100% stable

Releases

Version Type Release date
1.0.0 Stable Jun 18, 2026