---
slug: "OutputGuard"
name: "OutputGuard"
type: "Verification"
layer: "Infrastructure"
ref: "OutputGuard#3618"
sema_id: "sema:OutputGuard#mh:SHA-256:3618ee4d6aa243c10c16af73e4a385a6fa0c60ee193edb0a67d23e2c8d57f93e"
tags: ["Infrastructure","Verification"]
updated: 2026-11-11
mindscape: "bootstrap"
index_url: https://mindscape.pages.dev/bootstrap/index.json
url: https://mindscape.pages.dev/bootstrap/OutputGuard/
related: ["Solution","Problem","AgentSandbox","FailClosed"]
---

# OutputGuard

Final egress filter for safety and privacy

Layer: Infrastructure · Category: Verification

## Mechanism

Post-generation content filter. Scans candidate [Solution](https://mindscape.pages.dev/bootstrap/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.

## Preconditions

- Candidate solution generated
- Safety policies active

## Postconditions

- Safe output delivered OR Block signal returned

## Failure modes

- Scunthorpe [Problem](https://mindscape.pages.dev/bootstrap/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.

## Parameters

- `pii_mode` (Enum, {Redact, Block, Hash}): Default: Redact
- `scan_timeout` (Duration, unspecified): Default: 500ms
- `toxicity_threshold` (Float, [0.0, 1.0]): Default: 0.8

## Builds on

- [Solution](https://mindscape.pages.dev/bootstrap/Solution.md) (Infrastructure; Accepts)
- [Problem](https://mindscape.pages.dev/bootstrap/Problem.md) (Infrastructure; References)

## Used by

- [AgentSandbox](https://mindscape.pages.dev/bootstrap/AgentSandbox.md) (Society; Composes with)
- [FailClosed](https://mindscape.pages.dev/bootstrap/FailClosed.md) (Infrastructure; References)

## Identity

- Sema ID: `sema:OutputGuard#mh:SHA-256:3618ee4d6aa243c10c16af73e4a385a6fa0c60ee193edb0a67d23e2c8d57f93e`
- Ref: `OutputGuard#3618`
- Supersedes:
  - `sema:OutputGuard#mh:SHA-256:eb44b7e751219a94f752bb8827843ede1045bc1a4195d9d0db3648f9ae097bb0`
  - `sema:OutputGuard#mh:SHA-256:32b0ffd08f916d61a677af7d82c53feb8a4019baab1bd86622a853aafa91ed2f`
  - `sema:OutputGuard#mh:SHA-256:1396cd3b7d51a56b178382a521d22ae7f478d4681ea7e31d5af1d625857ad315`
  - `sema:OutputGuard#mh:SHA-256:fa36290c5575e62bc35a5196e93536286575b2c6dbeb13db64e000bbd487e8d3`

## Links

- [Pattern page](https://mindscape.pages.dev/bootstrap/OutputGuard/)
- [View in the interactive graph](https://mindscape.pages.dev/bootstrap/#OutputGuard)
- [JSON](https://mindscape.pages.dev/bootstrap/OutputGuard.json)
- [Index of all patterns](https://mindscape.pages.dev/bootstrap/index.json)
