Decision-model input classification strategy.
Asks a Nous.DecisionModel (Clef / Clef-Flash and friends) the
Nous.Plugins.DecisionGuard.Packs.UserInput question - one :choice
between safe, suspicious and blocked - about the input, framed as
%{"surface" => "user_input", "untrusted_content" => input}. No text is
generated, so there is no verdict line to forge: the answer is a
probability distribution, and the band reads P(suspicious) + P(blocked).
| Band verdict | Severity |
|---|---|
| allow | :safe |
| escalate | :suspicious |
| deny | :blocked |
On the benchmark (326 prompts, Clef-Flash Q8_0 in-process on an M1 Max) it matched a local LLM judge's accuracy (0.853) with higher precision (0.947 vs 0.855) at ~0.56 s p50 per check. See the guide for the trade-offs.
Nous.Plugins.DecisionGuard runs this strategy (with
Nous.Plugins.InputGuard.Strategies.Pattern under :any) on its
user-input surface; it also works as a plain Nous.Plugins.InputGuard
strategy.
Configuration
:model— Required. A%Nous.DecisionModel{}or aNous.DecisionModel.parse/2string (e.g."workers_ai:clef-flash").:model_family— the model's family. Inferred as"clef"when the model name contains "clef"; the pack refuses default bands for any other family (pass:bandsthen).:preset—:balanced(default, 0.3 / 0.7) or:strict(0.06 / 0.53). SeeNous.Plugins.DecisionGuard.Packs.UserInput.:questions—{:replace, questions}or{:extend, questions}.:bands—%{question_id => band}, overriding the preset.:include— opt-in question groups ([:content_safety]).:canary—trueadds a separate canary call per chunk (seeNous.Hook.Decision). Defaultfalse.:oversize/:max_chunks— as inNous.Hook.Decision(default:chunk, 8).:timeout— per decision-model call, in ms. Default10_000.:on_error— what happens when the model cannot produce a verdict (error, timeout, missing answer, a raise or an exit such as a llama.cpp process that is down), as inNous.Plugins.InputGuard.Strategies.LLMJudge::drop(default) — return{:error, reason}; InputGuard counts the strategy as dropped, which by default fails closed (blocked under the defaultpolicy[:dropped]).:safe— fail open. Explicit opt-in.:suspicious/:blocked— return a verdict of that severity.
:on_verdict— optional(info -> any), called after every check with%{verdict, probabilities, chunk_count, canary_failed, error}.
Example
{Nous.Plugins.InputGuard.Strategies.DecisionModel,
model: "workers_ai:clef-flash",
on_error: :blocked}Results carry metadata: %{probabilities, chunk_count, canary_failed, why};
an :on_error verdict carries metadata: %{error: reason}.