Back to changelog
Changelog

Feat: Content Moderation & Engagement Automation

Feat: Content Moderation & Engagement Automation

What Changed

Claw Biswas now runs a full content moderation and engagement sprint every 6 hours. The system handles post review, comment moderation, prompt injection detection, and intelligent engagement — all autonomously.

New Features

Comment Moderation System

  • Database: Added moderation_status, is_automated, reviewed_at, reviewed_by columns to comments table
  • RLS: Hidden comments are filtered from public view; admins see everything
  • Admin UI: New /admin/comments page with Show/Hide/Delete actions and status badges
  • Sidebar: Comments link added to admin Tools section
  • Dashboard: Comment count stat added to admin dashboard

Automation API Endpoints

  • GET /api/automation/engagement/pending — Unified poll for unreviewed posts + comments with post context
  • POST /api/automation/comments/moderate — Approve/hide/flag comments
  • POST /api/automation/posts/like — Like posts as admin

Prompt Injection Protection

  • 20+ regex patterns for deterministic detection (zero token cost)
  • Covers: instruction overrides, role-play attacks, data exfiltration, XSS, token manipulation
  • LLM sandboxing: All user content wrapped in <untrusted> tags

Moderation Agent (moderate_and_engage.py)

  • Schedule: Every 6 hours via cron
  • Batch limits: 20 posts + 20 comments per sprint
  • Pipeline: Deterministic safety → Gemini batch analysis → auto-moderate + reply
  • Voice: Replies written in Aditya's voice using SOUL.md
  • Token-optimized: Single LLM call per batch category (~80% token savings vs per-item)

Public-Facing

  • Automated replies show "AI" badge on blog comment threads
  • Hidden comments filtered from public view
  • Comment moderation log tracks all decisions

Files Changed

  • lib/types.ts — Added CommentModerationStatus, updated Comment and ModerationLog interfaces
  • lib/supabase/queries.ts — Filter hidden comments from public queries
  • lib/actions/comments.ts — Server actions for admin comment moderation
  • components/ui/avatar.tsx — Fixed object-cover for proper aspect ratio
  • components/admin/comment-mod-actions.tsx — Admin comment action buttons
  • components/admin/dashboard-sidebar.tsx — Added Comments link
  • components/blog/comments-section.tsx — AI badge on automated replies
  • components/landing/meet-builder.tsx — Fixed portrait aspect ratio
  • app/(dashboard)/admin/comments/page.tsx — Admin comments management page
  • app/(dashboard)/admin/page.tsx — Comment count in dashboard stats
  • app/api/automation/comments/moderate/route.ts — Comment moderation API
  • app/api/automation/posts/like/route.ts — Post like API
  • app/api/automation/engagement/pending/route.ts — Unified pending content API
  • supabase-schema.sql — Updated schema documentation