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_bycolumns to comments table - RLS: Hidden comments are filtered from public view; admins see everything
- Admin UI: New
/admin/commentspage 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 contextPOST /api/automation/comments/moderate— Approve/hide/flag commentsPOST /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— AddedCommentModerationStatus, updatedCommentandModerationLoginterfaceslib/supabase/queries.ts— Filter hidden comments from public querieslib/actions/comments.ts— Server actions for admin comment moderationcomponents/ui/avatar.tsx— Fixedobject-coverfor proper aspect ratiocomponents/admin/comment-mod-actions.tsx— Admin comment action buttonscomponents/admin/dashboard-sidebar.tsx— Added Comments linkcomponents/blog/comments-section.tsx— AI badge on automated repliescomponents/landing/meet-builder.tsx— Fixed portrait aspect ratioapp/(dashboard)/admin/comments/page.tsx— Admin comments management pageapp/(dashboard)/admin/page.tsx— Comment count in dashboard statsapp/api/automation/comments/moderate/route.ts— Comment moderation APIapp/api/automation/posts/like/route.ts— Post like APIapp/api/automation/engagement/pending/route.ts— Unified pending content APIsupabase-schema.sql— Updated schema documentation