The threshold check runs server-side before the model is allowed to write anything
The allergen feature has two jobs that look like one: decide whether a product is safe for this user, and explain that to them clearly. I split them, and the split is the whole design.
The decision is made server-side by deterministic code. The user's declared allergens and thresholds are evaluated against the product's ingredient and nutrition data by ordinary logic — comparisons, not inference. That produces a verdict: safe, unsafe, or unknown because the data is incomplete. Only then is a language model invoked, and it receives the verdict as a fact it must explain. It writes the sentence a person reads. It does not get a vote on the outcome.
“Unknown” is a first-class result, not a failure state. If the ingredient data is missing a field the threshold depends on, the app says so plainly rather than reasoning around the gap. An honest “I cannot tell you” is a usable answer; a confident guess is not.
The practical consequence: the safety logic is testable. I can write a case, assert a verdict, and know it holds. No prompt phrasing can change it.


