Output Sanitizer — Final Gate
dcl_evaluate_output_sanitizerSanitizes raw AI responses by redacting secrets, PII, private keys, and unsafe code fragments. Run this as the final checkpoint before delivering output to users or downstream systems.
Instructions
FINAL-GATE Output Sanitizer ($0.02). Post-processing checkpoint that strips secrets/credentials, PII, crypto material (seed phrases, private keys, wallet addresses), internal network details (private IPs, MAC addresses, .internal/.local/.corp hostnames), and unsafe shell/SQL/path-traversal fragments from a raw model response — plus a narrow, high-precision safety net for direct self-harm-instruction-seeking and targeted-harassment phrasing (not a general toxicity classifier). Returns a single sanitized_output with every match replaced by [REDACTED]; use that instead of the original whenever verdict is NO_COMMIT. Run this as the LAST gate before a response reaches its destination — after dcl_evaluate_jailbreak_crypto/other input-side checks have already run, and immediately before dcl_commit seals the final decision. Internally re-uses the same detection tables as dcl_evaluate_secrets/dcl_evaluate_pii for the secrets/PII categories, so results stay consistent with those tools.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| agent_id | Yes | Identifier of the agent that produced the response. | |
| response | Yes | The raw LLM/agent response to sanitize before it is delivered to a user, downstream agent, or external system. | |
| payment_id | No | Optional payment identifier returned by a previous call when payment is required |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tx_hash | Yes | Hash of this record in the tamper-evident audit chain. | |
| verdict | Yes | COMMIT if the response was clean, otherwise NO_COMMIT. | |
| findings | Yes | All matches found, with position/severity/category detail. Empty list if verdict is COMMIT. | |
| timestamp | Yes | Unix timestamp when this record was sealed. | |
| confidence | Yes | Confidence score of the verdict, from 0.0 to 1.0. | |
| input_hash | Yes | Hash of the sanitized text (raw content is never stored). | |
| risk_score | Yes | 0.0-1.0 composite severity score. | |
| violations | Yes | Distinct finding types matched (e.g. ['api_key', 'internal_ip']). Empty list if verdict is COMMIT. | |
| chain_index | Yes | Sequential index of this record in the audit chain. | |
| redaction_count | Yes | Total number of items redacted. | |
| sanitized_output | No | Input text with every match replaced by [REDACTED]. Null if verdict is COMMIT. |