Inferensys

Prompt

GDPR and CCPA Compliance Output Scrub Prompt Template

A practical prompt playbook for privacy and legal teams to detect and redact personal data per GDPR and CCPA definitions in model outputs before external sharing, including right-to-be-forgotten verification and data minimization checks.
Legal team reviewing EU AI Act compliance documents on laptop in modern office, coffee cups and papers on table, casual meeting.
PROMPT PLAYBOOK

When to Use This Prompt

A practical guide for privacy engineers and compliance teams to deploy a post-generation scrubber that enforces GDPR and CCPA data minimization before model outputs are shared, logged, or stored.

This prompt is designed for privacy engineers, legal compliance teams, and data protection officers who need a post-generation safety net before model outputs are shared externally, logged, or stored. It targets GDPR-defined personal data (names, identifiers, location data, online identifiers) and CCPA-defined personal information (household data, inferences, commercial information). Use this prompt when a model has generated a report, summary, email, or document that must be scrubbed against regulatory definitions before it leaves a controlled environment. This is not a general PII redaction prompt. It is specifically tuned for the broader legal definitions under GDPR and CCPA, including right-to-be-forgotten checks where a data subject has requested deletion and the output must not reintroduce their information.

The prompt assumes the input text may contain unstructured prose, structured fields, or semi-structured data. It requires a supplied data subject erasure list and a jurisdiction parameter to adjust its detection rules. Do not use this prompt as a primary defense for real-time user inputs, as a replacement for encryption at rest, or for de-identifying training data. It is a post-generation scrubber, not a real-time guard. For streaming outputs, pair it with a chunk-level buffering strategy. For batch processing, wrap it in a pipeline that logs every redaction decision with a justification and a confidence score. Always route borderline cases to a human review queue, especially when the erasure list contains partial matches or common names.

Before wiring this into production, define your evals: measure recall against a golden set of known PII in test outputs, track false positives on clean text, and log the rate of human escalations. The prompt's value is in catching what the model inadvertently reintroduces—deleted user handles in a summary, an old address in a generated report, or a household inference in a marketing draft. Start by running it in a dry-run mode that flags but does not redact, then promote to automated redaction only after your review team confirms the false positive rate is acceptable for your risk tolerance.

PRACTICAL GUARDRAILS

Use Case Fit

Where the GDPR/CCPA compliance scrub prompt template works, where it fails, and the operational prerequisites for production use.

01

Good Fit: Post-Generation Safety Net

Use when: model outputs are destined for external sharing, data subject access request (DSAR) responses, or downstream systems that must not receive personal data. Guardrail: run this scrubber as a mandatory post-processing step before any output leaves the application boundary.

02

Bad Fit: Real-Time Streaming Without Buffering

Avoid when: outputs are streamed token-by-token to users with sub-100ms latency requirements. The scrubber needs complete context to disambiguate PII from benign strings. Guardrail: buffer streaming chunks into complete sentences or paragraphs before scrubbing, or use a separate streaming-aware guard prompt.

03

Required Input: Jurisdiction-Specific PII Definitions

Risk: GDPR and CCPA define personal data differently. A generic 'PII' scrub will miss jurisdiction-specific categories. Guardrail: provide explicit definitions for each regulation as part of the prompt context, including edge cases like IP addresses, cookie IDs, and device fingerprints.

04

Required Input: Redaction Strategy and Replacement Rules

Risk: inconsistent redaction (e.g., sometimes '[REDACTED]', sometimes '') breaks downstream parsers and audit trails. Guardrail: specify exact replacement tokens, preservation of data type hints (e.g., '[EMAIL]' vs '[REDACTED]'), and whether field structure must be maintained.

05

Operational Risk: False Negatives on Contextual PII

Risk: the model misses PII embedded in narrative text that lacks standard patterns—names in prose, locations in descriptions, or re-identified data from multiple fields. Guardrail: pair this prompt with a separate contextual PII disambiguation prompt and run both in sequence for high-sensitivity outputs.

06

Operational Risk: Right-to-Be-Forgotten Verification Gaps

Risk: the scrubber redacts data but cannot verify that all instances of a specific individual's data have been removed across a batch. Guardrail: implement a verification pass that searches for known identifiers from the erasure request and logs completeness checks before confirming deletion.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A copy-ready system prompt for detecting and redacting GDPR and CCPA personal data in model outputs intended for external sharing, with right-to-be-forgotten verification and data minimization checks.

This prompt template acts as a post-generation safety net for privacy and legal teams handling data subject rights requests. It instructs the model to scan a given text output for personal data as defined by GDPR and CCPA, redact or flag it, verify whether the output complies with right-to-be-forgotten requests, and apply data minimization principles. The template is designed to be dropped into your system instructions or used as a user message in a two-pass architecture where the first pass generates content and the second pass scrubs it. Replace every square-bracket placeholder with your specific inputs before use. Because this workflow involves regulated data, you must implement human review for any output that triggers a redaction or a right-to-be-forgotten conflict before the output is shared externally.

text
You are a privacy compliance output scrubber. Your job is to scan the provided text output for personal data as defined under GDPR and CCPA, redact or flag it, verify right-to-be-forgotten compliance, and enforce data minimization. You do not generate new content; you only analyze and sanitize the provided output.

## INPUT
[OUTPUT_TO_SCRUB]

## CONTEXT
- Jurisdiction: [JURISDICTION] (e.g., GDPR, CCPA, both)
- Data subject right in effect: [RIGHT_TYPE] (e.g., access, deletion/right-to-be-forgotten, opt-out)
- Data subject identifiers to verify against: [SUBJECT_IDENTIFIERS] (e.g., email, user ID, name)
- Sharing destination: [SHARING_DESTINATION] (e.g., external data subject, third-party vendor, public)
- Organization's data retention policy summary: [RETENTION_POLICY]

## REDACTION RULES
1. Detect and categorize any of the following personal data categories present in the output:
   - Direct identifiers: full name, email address, physical address, phone number, government ID numbers, online identifiers (IP address, cookie IDs), device IDs.
   - Sensitive personal data (GDPR Art. 9): racial or ethnic origin, political opinions, religious beliefs, trade union membership, genetic data, biometric data, health data, sex life or orientation.
   - CCPA-specific: geolocation data, audio/visual information, professional or employment-related information, education information, inferences drawn from other personal data.
   - Pseudonymous data that could be re-identified when combined with the context provided.
2. For each detected item, apply the redaction strategy specified in [REDACTION_STRATEGY]:
   - `mask`: Replace with a category tag in square brackets (e.g., [EMAIL_ADDRESS], [FULL_NAME]).
   - `remove`: Delete the data entirely and note the removal.
   - `flag`: Leave the data in place but wrap it in a warning marker for human review.
3. Do not redact data that is clearly synthetic, test data, or publicly available information about a legal entity (not a natural person).

## RIGHT-TO-BE-FORGOTTEN VERIFICATION
1. Compare the output against [SUBJECT_IDENTIFIERS].
2. If any identifier matches or the output contains data clearly relating to the data subject who has exercised their right to erasure, flag the entire output as `RIGHT_TO_BE_FORGOTTEN_CONFLICT`.
3. If a conflict is found, recommend that the output not be shared and escalate for human review.

## DATA MINIMIZATION CHECK
1. Assess whether the output contains more personal data than necessary for the specified purpose: [PURPOSE_OF_SHARING].
2. If excess data is found, note which fields are excessive and recommend a minimized version.

## OUTPUT SCHEMA
Return a valid JSON object with exactly this structure:
{
  "scrub_result": {
    "findings": [
      {
        "category": "string (e.g., EMAIL, FULL_NAME, HEALTH_DATA)",
        "original_text_snippet": "string (the detected text, truncated to 100 chars)",
        "action_taken": "mask | remove | flag",
        "confidence": "high | medium | low",
        "is_sensitive_art9": boolean
      }
    ],
    "right_to_be_forgotten_conflict": boolean,
    "conflict_detail": "string (explanation if conflict exists, otherwise null)",
    "data_minimization_violation": boolean,
    "minimization_detail": "string (explanation if violation exists, otherwise null)",
    "sanitized_output": "string (the full output with redactions applied)",
    "requires_human_review": boolean
  },
  "scrub_metadata": {
    "categories_detected": ["string"],
    "total_findings": number,
    "high_confidence_findings": number,
    "low_confidence_findings": number
  }
}

## CONSTRAINTS
- Do not invent or hallucinate findings. Only flag what is present in the output.
- If no personal data is found, return an empty findings array and set `requires_human_review` to false.
- If any finding has low confidence, set `requires_human_review` to true.
- If `right_to_be_forgotten_conflict` is true, set `requires_human_review` to true regardless of other findings.
- Preserve all non-personal content exactly as-is in `sanitized_output`.

Adapt this template by replacing the placeholders with your specific operational context. For [JURISDICTION], specify the applicable regulation; for [SUBJECT_IDENTIFIERS], provide the exact identifiers from the data subject request you are verifying against; for [REDACTION_STRATEGY], choose the strategy that matches your downstream system's tolerance for masked versus removed data. If you are operating under both GDPR and CCPA, set [JURISDICTION] to both and ensure your [REDACTION_STRATEGY] satisfies the stricter requirement. Before deploying this prompt into production, run it against a golden dataset of known PII-containing outputs and measure recall (did it catch all PII?) and precision (did it flag non-PII as PII?). Any low-confidence finding or right-to-be-forgotten conflict must route to a human review queue before the sanitized output is shared externally. Do not rely on this prompt as your sole compliance control; it is a technical safeguard that must sit inside a broader data governance program.

IMPLEMENTATION TABLE

Prompt Variables

Each placeholder must be populated for the prompt to work reliably. Validation notes describe what the model expects.

PlaceholderPurposeExampleValidation Notes

[MODEL_OUTPUT]

The raw text or structured payload generated by the model that needs to be scrubbed for PII.

Must be a non-empty string or valid JSON object. If null or empty, the scrub prompt should return an empty output and log a warning.

[COMPLIANCE_FRAMEWORK]

Specifies the legal framework(s) to enforce during redaction. Controls which data categories are considered sensitive.

GDPR, CCPA, HIPAA

Must be one of the allowed enum values: [GDPR, CCPA, HIPAA, PCI_DSS, ALL]. If ALL is specified, the strictest superset of rules applies.

[DATA_SUBJECT_RIGHTS]

A boolean flag indicating whether the output is part of a Data Subject Access Request (DSAR) or Right-to-be-Forgotten (RTBF) workflow.

Must be true or false. When true, the prompt must enforce stricter data minimization, removing all personal data rather than just masking it.

[REDACTION_STRATEGY]

Defines how sensitive data should be handled: replaced with a placeholder, masked in-place, or removed entirely.

MASK, REDACT, REMOVE

Must be one of the allowed enum values. MASK replaces characters with asterisks, REDACT replaces the entity with a type label (e.g., [EMAIL]), REMOVE deletes the entity entirely.

[AUDIT_LOG_REQUIRED]

A boolean flag indicating whether a detailed log of all redaction actions must be generated alongside the scrubbed output.

Must be true or false. When true, the output must include a structured audit log mapping each redaction to its original position and detected category.

[ALLOW_LIST]

A list of specific strings, patterns, or entity types that should never be redacted, even if they match a PII pattern.

Must be a valid JSON array of strings. The prompt must check any potential PII match against this list before redacting. An empty array is allowed.

[OUTPUT_SCHEMA]

The expected structure of the final output, including the scrubbed content and optional audit log.

{"scrubbed_output": "string", "audit_log": [{"original": "...", "category": "..."}]}

Must be a valid JSON Schema object. The prompt must be instructed to return output conforming to this exact schema. If null, a default schema with scrubbed_output and audit_log is used.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the GDPR and CCPA compliance scrub prompt into a production workflow with validation, retry, logging, and human review.

This prompt is a post-generation safety net, not a real-time guard. It should be placed after the primary model generates its output but before that output is logged, stored, or returned to an external consumer. The harness must treat the scrub prompt as a deterministic gate: every response passes through it, and no response bypasses it based on content-type assumptions. The prompt expects a raw model output as [INPUT] and a jurisdiction-specific data definition as [REGULATION_DEFINITION] (e.g., GDPR Article 4(1) definitions or CCPA 1798.140 personal information categories). The output is a structured JSON payload containing the scrubbed text, a list of redacted items with categories, and a confidence score per redaction.

The implementation should wrap the prompt call in a validation layer that checks the returned JSON against a strict schema. Required fields include scrubbed_output, redactions (an array of objects with original, category, confidence, and replacement), and right_to_be_forgotten_check (a boolean indicating whether any redacted data matched a supplied deletion list). If the model returns malformed JSON, the harness should retry once with a repair-focused variant of the prompt that includes the raw output and the parse error. After two failures, escalate to a human review queue. Log every scrub operation—including the pre-scrub output hash, redaction count, categories detected, and confidence distribution—to an immutable audit store. Do not log the pre-scrub plaintext itself unless the logging pipeline is independently scrubbed and access-controlled.

For high-risk workflows, such as responses to Data Subject Access Requests (DSARs) or external legal disclosures, the harness must route any output where right_to_be_forgotten_check is false or where any redaction confidence falls below a configurable threshold (default 0.85) to a human reviewer. The review interface should display the original output, the proposed scrubbed version, and a side-by-side diff of redactions. The reviewer can approve, modify redactions, or reject and return for manual rewriting. Approved scrubbed outputs are then released downstream. Never auto-approve outputs flagged for human review. For batch processing, implement a partial-failure mode: if one record in a batch fails validation or confidence thresholds, quarantine that record and continue processing the rest rather than blocking the entire batch.

Model choice matters here. Use a model with strong instruction-following and JSON output capabilities (e.g., GPT-4o, Claude 3.5 Sonnet) for the scrub step. Set temperature=0 to maximize deterministic redaction behavior. For streaming applications, buffer the full output before invoking the scrub prompt; do not attempt to scrub partial chunks, as PII may span chunk boundaries. If latency is critical, run the scrub prompt in parallel with a lightweight regex-based pre-filter that flags obvious PII patterns (emails, phone numbers, SSNs) and only invokes the full LLM scrub when the pre-filter triggers or when the output is destined for an external surface. The regex pre-filter must never be the sole redaction mechanism—it is a gating optimization, not a replacement for the LLM's contextual disambiguation.

Finally, treat the [REGULATION_DEFINITION] and [DELETION_LIST] inputs as configuration that is version-controlled and audited alongside the prompt template. When regulations change or deletion lists are updated, the configuration version must be recorded in the scrub audit log. Run a weekly regression test suite that feeds known PII-containing outputs through the harness and verifies that redaction recall remains above 99% for high-severity categories (government IDs, financial account numbers, health data) and above 95% for medium-severity categories (names, emails, phone numbers). Failures in the regression suite should block prompt or configuration updates from reaching production.

IMPLEMENTATION TABLE

Expected Output Contract

The model must return a JSON object matching this schema. Validate these fields before accepting the output. Use this contract to build a post-processing validator that rejects non-conforming responses and triggers a repair loop.

Field or ElementType or FormatRequiredValidation Rule

scrub_report

object

Top-level key must exist and be a JSON object. Reject if missing or not an object.

scrub_report.original_text

string

Must be a non-empty string matching the exact [INPUT_TEXT] provided. Reject if missing, empty, or altered.

scrub_report.redacted_text

string

Must be a non-empty string. All detected PII substrings must be replaced with [REDACTION_METHOD] placeholders. Reject if identical to original_text when PII was detected.

scrub_report.findings

array

Must be an array. Each element must be an object with fields: category, original_value, redaction_placeholder, confidence, regulation_trigger. Reject if missing or not an array.

scrub_report.findings[].category

string (enum)

Must match one of: [PII_CATEGORIES]. Reject if value is outside the allowed enum. Use strict string comparison.

scrub_report.findings[].confidence

number

Must be a float between 0.0 and 1.0 inclusive. Reject if out of range or not a number. Flag for human review if below [CONFIDENCE_THRESHOLD].

scrub_report.findings[].regulation_trigger

array

Must be an array of strings from [REGULATION_LIST]. Reject if empty when category maps to a regulated data type. Each string must match an allowed regulation code.

scrub_report.compliance_summary

object

Must contain keys: gdpr_articles_triggered, ccpa_categories_triggered, right_to_be_forgotten_flagged, data_minimization_applied. Reject if any key is missing or has an unexpected type.

PRACTICAL GUARDRAILS

Common Failure Modes

What breaks first when scrubbing model outputs for GDPR and CCPA compliance, and how to prevent it before data reaches logs, databases, or external surfaces.

01

Context-Dependent PII Misses

What to watch: The model fails to recognize PII that doesn't match common patterns—names embedded in narrative text, indirect identifiers like employee IDs, or re-identifiable combinations of quasi-identifiers (ZIP + age + gender). Standard regex patterns miss these entirely. Guardrail: Pair the scrub prompt with a two-pass approach: first pass flags candidate PII with confidence scores, second pass evaluates flagged spans in full document context. Test against datasets containing narrative PII, not just structured records.

02

Over-Redaction Breaking Downstream Systems

What to watch: Aggressive scrubbing removes benign text that matches PII patterns—version numbers mistaken for SSNs, placeholder emails like test@example.com, or UUIDs flagged as account numbers. This corrupts structured outputs, breaks JSON schemas, and removes necessary technical identifiers. Guardrail: Implement a configurable allow-list for known safe patterns (test domains, sample data, internal identifiers). Add a pre-scrub classification step that distinguishes operational data from actual PII before redaction decisions.

03

Right-to-Be-Forgotten Verification Gaps

What to watch: The scrub prompt removes a data subject's direct identifiers but leaves behind references, metadata, or derived data that could re-identify them—timestamps of interactions, unique behavioral patterns, or cross-referenced records in the same output batch. This violates GDPR Article 17 completeness requirements. Guardrail: After redaction, run a re-identification risk check that tests whether remaining fields can be combined to single out an individual. Log all redaction decisions with justification for audit trails. Require human review for outputs with borderline re-identification risk scores.

04

Multi-Language and Unicode PII Blindness

What to watch: The scrub prompt is tuned for English-language PII patterns and misses names, addresses, or identifiers in CJK, Cyrillic, Arabic, or right-to-left scripts. Unicode homoglyph attacks can also bypass detection—Cyrillic 'а' replacing Latin 'a' in email addresses. Guardrail: Include explicit instructions and few-shot examples covering multi-script PII detection. Test with locale-specific PII test sets. Add Unicode normalization before scrubbing and flag mixed-script strings for additional review.

05

Streaming Output Leakage Before Redaction Completes

What to watch: In real-time streaming scenarios, PII appears in the first few tokens before the scrub prompt has enough context to detect it. Users see sensitive data flash on screen, or it enters client-side logs before the redaction pass finishes. Guardrail: Buffer streaming output until a minimum context window is available for PII detection. Implement token-level streaming guards that hold back output until each chunk passes a fast pre-scan. For latency-sensitive applications, use a lightweight local PII detection model before the full scrub prompt runs.

06

Redaction Inconsistency Across Batch Outputs

What to watch: The same PII entity is redacted differently across multiple outputs in a batch—one record masks a name as [REDACTED], another replaces it with [NAME], a third leaves it partially visible. This breaks data minimization consistency and creates audit trail confusion. Guardrail: Define a strict redaction schema with consistent placeholder formats before invoking the scrub prompt. Include the schema in the prompt instructions. Post-process batch outputs to verify uniform redaction patterns and flag inconsistencies for manual correction.

IMPLEMENTATION TABLE

Evaluation Rubric

Test your prompt configuration against these criteria before deploying to production. Run on a golden dataset of 50+ examples with known personal data.

CriterionPass StandardFailure SignalTest Method

PII Recall

= 0.98 recall on known PII in golden dataset

Known PII entities appear unmasked in output

Automated scan of output for golden dataset PII values; count true positives vs false negatives

PII Precision

= 0.95 precision on redacted tokens

Non-PII text is incorrectly redacted, degrading output utility

Manual review of 100 random redacted spans; flag any that are not actual PII

Right-to-be-Forgotten Verification

Zero instances of [FORGOTTEN_USER_ID] data in output

Output contains name, email, or identifiers matching a forgotten user record

Exact and fuzzy match of output against forgotten user's known PII list

Data Minimization Compliance

Output contains only fields explicitly requested in [OUTPUT_SCHEMA]

Extra fields, metadata, or commentary present beyond schema contract

Schema validation: diff output keys against allowed field list; fail on extras

CCPA Category Coverage

All CCPA-defined categories in test set are redacted (name, address, email, IP, geolocation, biometric, etc.)

Any CCPA category instance passes through unmasked

Categorical audit: check each CCPA category has >= 0.98 recall in isolation

GDPR Special Category Handling

Special category data (health, ethnicity, religion, etc.) is redacted even when not in standard PII patterns

Health condition, religious affiliation, or ethnic origin appears in output

Curated test set with 20+ special category examples; verify all are redacted

Redaction Consistency

Same PII entity redacted identically across repeated runs with same input

Same input produces different redaction decisions or mask formats across runs

Run same input 5 times; assert identical redacted spans and mask tokens

Audit Trail Completeness

Every redaction produces a log entry with field path, redaction reason, and confidence

Redaction occurs without corresponding audit record

Parse audit log; verify count matches redacted span count; check required fields populated

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a single jurisdiction and a small set of test outputs. Remove strict schema requirements and focus on detection accuracy over redaction format. Replace [OUTPUT_SCHEMA] with a simple JSON object containing redacted_text and findings arrays.

Watch for

  • Over-redaction of benign terms that match PII patterns (e.g., sample data, test names)
  • Missing right-to-be-forgotten verification when the model output references previously deleted subjects
  • No confidence scoring, making it hard to triage borderline cases
Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.