Overview & result
This Mastra input processor asks Jev one typed blocking question and one category question about the latest message. The author reports a 0.39–0.44 s median on 58 messages from one production assistant; this is not a general safety benchmark.
From the original post
Input moderation for [Mastra](https://mastra.ai) agents on [TypeSafe Jev](https://typesafe.ai): one file, one request per turn, no text to parse.
How Jev fits in the loop
- Inspect the latest user message, capped at 8,000 characters, in a Mastra input processor.
- Ask Jev for a blocking probability and a logging category in one request.
- Block only when the probability meets the configured threshold; the default is 0.7.
- Pass allowed messages to the Mastra agent; vendor failures fail open with a circuit breaker.
How to reproduce
- Review and copy the repository's jev-moderation.ts into a Mastra project.
- Configure TYPESAFE_API_KEY and register createJevModerationProcessor as an input processor.
- Test both blocked and allowed messages, then calibrate the threshold on your own labelled inputs.
Why this build matters
Shows a concrete typed moderation boundary in a Mastra agent, with a clear fail-open limitation and author-reported test data.
Reported performance
Reported by authorLatency: ~0.4 s median latency
Author-reported test on one production assistant: 58 messages, 9/9 hostile blocked, 0/49 legitimate blocked, median 0.39–0.44 s. Not independently reproduced.
Limitations
- Only the latest message is checked; output moderation is not supported.
- The processor fails open on timeout, HTTP or parse errors, so it cannot be the sole safety control.
- The 58-message result is author-reported and domain-specific, not independently reproduced.