Expand description
Two-layer sanitize pipeline for fetched URL content.
Layer order is fixed:
regex_layer::strip— fast, local, Aho-Corasick over a static pattern list. Replaces matches with the literal[STRIPPED].semantic_layer::review— optional LLM review via Anthropic Messages API. Fails open whenANTHROPIC_API_KEYis unset or the API returns non-2xx: regex-only output is passed through unchanged.wrap::envelope— wrap into<untrusted_content>so the caller LLM physically separates instruction from data.
Modules§
- regex_
layer - 1st-layer sanitize: static Aho-Corasick pass over the most common instruction-override / role-token markers.
- semantic_
layer - 2nd-layer sanitize: LLM-backed semantic review via Anthropic Messages API.
- wrap
- Wrap sanitized content into an
<untrusted_content>envelope.
Functions§
- run
- Run the 2-layer sanitize pipeline and return
(envelope, removed).