From e5d0c595cf143fb9c52ed1bfdfc6606ef8dc19a0 Mon Sep 17 00:00:00 2001 From: ARIA Date: Wed, 20 May 2026 09:37:59 +0000 Subject: [PATCH] ARIA self-improvement: allowlist important no-reply domains in promo filter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds IMPORTANT_NOREPLY_DOMAINS allowlist to backend/brain-prompt.ts seeded with mijn.overheid.nl. isPromoSender() now checks the allowlist first and returns false when the sender domain matches (or is a subdomain of) an allowlisted entry — short-circuiting both the /no-?reply@/i local-part regex and the PROMO_DOMAIN_KEYWORDS check. Also removes 'mijn.overheid' from PROMO_DOMAIN_KEYWORDS since the allowlist now handles it. Drift audit 2026-05-20 flagged this: MijnOverheid notifications carry real government correspondence (BRP, tax, RDW, gemeente) that belongs in the active-threads surface. Simply removing the keyword was insufficient because the no-reply@ pattern would still match noreply@mijn.overheid.nl. The allowlist generalises the rule: no-reply is a delivery mechanism, not a signal of unimportance. Intent-summary: Active-threads promo filter suppresses important no-reply senders (e.g. MijnOverheid government mail) because no-reply@ and a 'mijn.overheid' keyword both match, hiding real correspondence Gillis cares about. Intent-tokens: noreply, allowlist, false-positive, government, mijnoverheid, promo-filter, active-threads Co-Authored-By: Claude Opus 4.7 --- backend/brain-prompt.ts | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/backend/brain-prompt.ts b/backend/brain-prompt.ts index 53be8e90..b4b8c5a9 100644 --- a/backend/brain-prompt.ts +++ b/backend/brain-prompt.ts @@ -56,10 +56,16 @@ function timeAgo(ts: number): string { return `${days}d ago`; } -// Promo / routine notification sender patterns. Used to drop noise participants -// from the active-threads surface — many of these accumulate under a single -// gmail: thread key and crowd out real conversations. Raw observations -// remain logged; only the prompt-side aggregation is filtered. +// Filter senders from the active-threads surface so routine notifications don't +// crowd out real conversations. Raw observations stay logged; only the prompt-side +// aggregation is filtered. +// IMPORTANT_NOREPLY_DOMAINS: allowlist — domains where no-reply is the only channel for genuinely important mail (government, banks, employer HR). Checked first; overrides both lists below. +// PROMO_LOCAL_PATTERNS: local-part regexes matching routine/automated senders. +// PROMO_DOMAIN_KEYWORDS: domain substrings for known promo/marketplace senders. +const IMPORTANT_NOREPLY_DOMAINS: Set = new Set([ + "mijn.overheid.nl", +]); + const PROMO_LOCAL_PATTERNS: RegExp[] = [ /no-?reply@/i, /do-?not-?reply@/i, @@ -75,7 +81,6 @@ const PROMO_DOMAIN_KEYWORDS: string[] = [ "autoscout24", "glassdoor", "ferrari", - "mijn.overheid", "marktplaats", "quora", ]; @@ -84,8 +89,11 @@ function isPromoSender(sender: string): boolean { if (!sender) return false; const match = /<([^>]+)>/.exec(sender); const addr = (match ? match[1] : sender).trim().toLowerCase(); - if (PROMO_LOCAL_PATTERNS.some(re => re.test(addr))) return true; const domain = addr.includes("@") ? addr.split("@")[1] || "" : addr; + for (const allowed of IMPORTANT_NOREPLY_DOMAINS) { + if (domain === allowed || domain.endsWith("." + allowed)) return false; + } + if (PROMO_LOCAL_PATTERNS.some(re => re.test(addr))) return true; if (PROMO_DOMAIN_KEYWORDS.some(kw => domain.includes(kw))) return true; return false; }