Wrap a call
guard.wrap inspects the payload, then does what onMatch says. The callback receives the payload shaped for both provider specs, so it works with any SDK.
onMatch
Set it for the whole client or for one call:
The blocked response
The body mirrors an OpenAI error envelope, so a client that already handles provider errors needs no new branch.Sanitise instead of block
guard.sanitise redacts every matched span and returns the payload shaped for both providers. Use it when a false positive costs more than a redacted instruction.
openai.messages and also exposed as openai.systemPrompt. Anthropic takes it as a top-level parameter, so it is lifted out of anthropic.messages.
Redaction rules
- It happens on your side. The control plane returns offsets and the SDK cuts your text. The payload is never sent to FrostWolf to be rewritten.
- Overlaps merge. A sentence that trips two rules is replaced once, not twice.
- Structure survives. Images and other non-text parts, and provider parameters such as
temperature,tools, andresponse_format, pass through untouched. - The replacement is configurable. It defaults to
[REDACTED]. Setguard.replacementto change it.
Plan limits
If your plan’s allowance for semantic blocks is spent, a semantic detection is still reported but comes back as an allow, andquota.enforcementWithheld says so. In that state sanitise returns the payload as you submitted it, because the rewrite is the part the plan ran out of. Signature blocks are never withheld.
