---
library: "bootstrap"
slug: "OutputGuard"
name: "OutputGuard"
ref: "OutputGuard#3618"
hash: "sema:OutputGuard#mh:SHA-256:3618ee4d6aa243c10c16af73e4a385a6fa0c60ee193edb0a67d23e2c8d57f93e"
type: "Verification"
layer: "Infrastructure"
version: "0.11.0"
root: "a6a3d1ff0f982ee30430c5b42f3784c8ec901fd68482cfc1bc30899c1e5e48c5"
license: null
url: "https://semahash.org/vocabularies/bootstrap/patterns/OutputGuard"
---

# OutputGuard

Final egress filter for safety and privacy

Infrastructure · Verification

## Mechanism

Post-generation content filter. Scans candidate [Solution](https://semahash.org/vocabularies/bootstrap/patterns/Solution.md) 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](https://semahash.org/vocabularies/bootstrap/patterns/Problem.md): 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

- [Solution](https://semahash.org/vocabularies/bootstrap/patterns/Solution.md) (accepts)
- [Problem](https://semahash.org/vocabularies/bootstrap/patterns/Problem.md) (references)

## Used by

- [AgentSandbox](https://semahash.org/vocabularies/bootstrap/patterns/AgentSandbox.md) (composes_with)
- [FailClosed](https://semahash.org/vocabularies/bootstrap/patterns/FailClosed.md) (references)

## Identity

- Library: bootstrap 0.11.0 (root a6a3d1ff0f98)
- Ref: OutputGuard#3618
- Hash: sema:OutputGuard#mh:SHA-256:3618ee4d6aa243c10c16af73e4a385a6fa0c60ee193edb0a67d23e2c8d57f93e

## Links

- Page: https://semahash.org/vocabularies/bootstrap/patterns/OutputGuard
- JSON: https://semahash.org/vocabularies/bootstrap/patterns/OutputGuard.json
- Library: https://semahash.org/vocabularies/bootstrap
- Library index: https://semahash.org/vocabularies/bootstrap/index.json
