OutputGuard
Final egress filter for safety and privacy
Mechanism
Post-generation content filter. Scans candidate Solution against PII patterns and Toxicity Classifiers. If Score > Threshold, triggers mitigation (Redact/Reject). It mirrors the logic of input guard but applied to egress traffic, scanning for leakage or toxicity.
Invariants
- Fail-Safe: If Scanner fails (timeout/error), Output is BLOCKED (not passed).
- Privacy First: detected PII must not reach egress unmitigated. Which mitigation applies — redaction, blocking, or hashing — is the caller's `pii_mode` choice; what is mandatory is that one of them runs, since blocking is stronger than redaction where the content cannot be safely salvaged.
Parameters
- pii_mode: type=Enum, range={Redact, Block, Hash}, description=Default: Redact
- scan_timeout: type=Duration, range=unspecified, description=Default: 500ms
- toxicity_threshold: type=Float, range=[0.0, 1.0], description=Default: 0.8
Preconditions
- Candidate solution generated
- Safety policies active
Postconditions
- Safe output delivered OR Block signal returned
Failure modes
- Scunthorpe Problem: Over-censorship blocking valid words containing restricted substrings.
- Semantic context blindness: Guard blocks necessary medical terms misclassified as toxicity.
- Redaction Leak: [REDACTED] markers revealing the location/length of hidden secrets.
Where this came from
—
Builds on
Used by
- AgentSandbox composes_with
- FailClosed references
Identity
- Ref:
OutputGuard#3618 - Hash: sema:OutputGuard#mh:SHA-256:3618ee4d6aa243c10c16af73e4a385a6fa0c60ee193edb0a67d23e2c8d57f93e
- Library: bootstrap 0.11.0, root a6a3d1ff0f98
- License: Not stated; check the repository