refactor(automod): remove regex classifier — LLM is the sole judge
Build & Deploy (Nix) / build-and-deploy (backend) (push) Successful in 3m2s
Build & Deploy (Nix) / build-and-deploy (discord-gateway) (push) Successful in 2m20s
Build & Deploy (Nix) / build-and-deploy (proxy) (push) Successful in 2m26s

Delete fastClassifier.ts (manual regex patterns for phone/email/IP/crypto/
spam/toxicity) and simpleFallback.ts. These hardcoded patterns were the
source of false positives (Discord emoji snowflakes matched phone_number,
URL digits matched phone, etc.) and produced heuristic verdicts whenever
the LLM failed.

New flow: Message → LLM (with conversation context, media evidence, user
reputation) → verdict. On LLM failure the message is marked 'error' and
retried by the recovery worker — no heuristic verdicts, ever.

Discord markdown tokens (custom emoji/mentions/timestamps) are normalized
to readable placeholders ([emoji:name], @user, @role, #channel, [time])
before reaching the LLM via discordTokens.ts.
This commit is contained in:
Developer
2026-07-31 17:55:02 +07:00
parent a2cda745f7
commit 0bd4369ae9
8 changed files with 112 additions and 797 deletions
@@ -7,6 +7,7 @@
import { messageStore } from "../message-capture/messageStore.js";
import type { MessageRecord } from "../message-capture/types.js";
import { sanitizeDiscordTokens } from "./discordTokens.js";
/** Simple XML-escaping for content text. */
export function escapeXml(s: string): string {
@@ -29,7 +30,7 @@ export function getAnalysisContent(message: MessageRecord): string {
/\[(?:Attachment|Sticker):[^\]]*\]|\[Embed\]/g,
"",
);
return stripped.trim();
return sanitizeDiscordTokens(stripped).trim();
}
/**