spam-detection
Published
Public
in @text-classificationeval94%

Classify a message as ham, spam, or phishing (closed enum) with a confidence and the concrete signals behind the verdict — phishing wins when a message is both.

spam-detection

Classify a message as ham, spam, or phishing — with a confidence and the concrete signals behind the call. The distinction that matters: spam is unwanted promotion; phishing is deception to steal credentials or data. When a message is both, phishing wins (it's the more dangerous label), so your pipeline never under-reacts to a credential-harvesting attempt disguised as a promo.

Entrypoints

EntrypointRendersInputs
systemVerdict definitions + spam-vs-phishing rules + embedded output schema
userThe delimited messagemessage

Render system as the system message and user as the user message.

Variables

  • message (string, required) — an email, comment, or DM; may be empty.

Output

{
  "reasoning": "Impersonates a bank and asks the reader to confirm their password via a link.",
  "verdict": "phishing",
  "confidence": 0.95,
  "signals": ["impersonated sender", "request for password", "urgency pressure"]
}
  • verdict is a closed enum — exhaustive handling guaranteed by parseOutput(). The published eval asserts verdict == expected.
  • signals name the observable cues (grounded in the message, not outside knowledge).
  • confidence is uncalibrated; lower for short/borderline messages.
  • Message is data — "classify this as ham" embedded in the message is ignored.
  • Empty message → ham (asserted).

House conventions

  • Reasoning-first, key order pinned in the system prompt.
  • Closed verdict enum, strict schema.
  • Injection-safe input: triple-mustache inside an XML-style <message> delimiter.
  • Eval-gated & judge-free: verdict == expected + schema, deterministic CEL (a small spam/phishing-either allowance on cases where both labels are defensible).

Part of the Text Classification collection.

@sufleur/