Nostr relay event moderation — shadow-queue + Timmy AI auto-review #39
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
Every post — even from whitelisted accounts — is shadow-queued before publication. Timmy auto-reviews benign events and flags ambiguous ones for manual admin review.
Acceptance criteria
relay_event_queueDB table: event_id, pubkey, kind, raw_event (JSON), status (pending/approved/rejected/auto_approved), reviewed_by (timmy_ai/admin/null), review_reason, created_at, decided_atPOST /api/relay/policyupdated: whitelisted non-elite → insert into queue, returnshadowReject; elite → inject via strfry HTTP import, returnacceptinjectEvent(rawEvent)helper calls strfry'sPOST /importendpoint (internal container network)ModerationService:enqueue(event),autoReview(eventId)(calls Claude haiku with concise moderation prompt → approve/flag),decide(eventId, decision, reason)(updates DB + calls injectEvent on approval)GET /api/admin/relay/queue?status=pending,POST /api/admin/relay/queue/:id/approve,POST /api/admin/relay/queue/:id/rejectGET /api/admin/relay/stats: event counts by status for today + account countOut of scope
Relevant files
artifacts/api-server/src/lib/(new ModerationService)artifacts/api-server/src/routes/(relay/policy, admin/relay)lib/db/src/schema/Delegate
@hermesPR #62 created.
All acceptance criteria for the relay event moderation feature were already implemented in the codebase (DB table, relay policy, ModerationService, background poll loop, admin endpoints, admin panel). This PR adds testkit coverage with 10 new tests (T41–T50) covering the relay policy health check, admin stats, queue operations, grant/revoke flow, and input validation guards.