Inferensys

Prompt

User Consent Verification Gate Prompt

A practical prompt playbook for using the User Consent Verification Gate Prompt in production AI workflows.
Operations team reviewing AI workflow automation on laptop, workflow builder visible, casual office setup.
PROMPT PLAYBOOK

When to Use This Prompt

Defines the precise conditions, required inputs, and operational boundaries for embedding the User Consent Verification Gate into an AI product workflow.

Use this prompt when your AI system—whether an autonomous agent, a retrieval-augmented generation pipeline, or a user-facing copilot—is about to execute a data processing action on behalf of a specific user and you need an auditable, pre-execution consent check. The prompt is designed for product engineers and compliance teams who must prevent processing without a valid legal basis under regulations like GDPR, CCPA, or internal data governance policies. It does not replace your legal team's advice; instead, it acts as a structured, programmatic gate that produces a machine-readable consent assessment before any bytes move. The ideal integration point is immediately after intent classification but before the execution layer, such as before sending a marketing email, exporting user data to a third-party API, or training a model on user-provided content.

This prompt is not a general-purpose privacy policy interpreter or a replacement for a Consent Management Platform (CMP). Do not use it to retroactively justify processing that has already occurred, to interpret ambiguous legal text without human review, or to make a final legal determination in isolation. It is specifically scoped to the binary decision of whether valid, in-scope, and unwithdrawn consent exists for a single proposed action. The prompt requires concrete, structured inputs: a machine-readable consent record (including scope, timestamp, and withdrawal status), the proposed processing purpose, the data categories involved, and the identity of the data controller. Without these inputs, the gate cannot function reliably and should default to a blocking state. In high-risk domains like healthcare or finance, the prompt's output must always be routed to a human review queue for final confirmation before the processing action is unblocked.

Before wiring this prompt into production, ensure your application layer can provide the required consent context. If your system stores consent in a database, retrieve the relevant record and pass it into the prompt as a structured JSON object in the [CONSENT_RECORD] placeholder. If consent is managed by an external CMP, call its API first and hydrate the prompt with the result. The prompt's value comes from its ability to catch mismatches—such as a consent scope that covers 'email marketing' but not 'product analytics'—that application code might miss. After integrating, build eval suites that test for common failure modes: assuming consent where none exists, ignoring a withdrawal timestamp, or matching a purpose to an overly broad consent scope. These evals should run as part of your CI/CD pipeline whenever the prompt or the consent schema changes.

PRACTICAL GUARDRAILS

Use Case Fit

Where the User Consent Verification Gate Prompt delivers value and where it introduces risk. Use these cards to decide if this prompt fits your workflow before integrating it into a production pipeline.

01

Good Fit: Pre-Action Consent Gating

Use when: An AI agent or automated workflow is about to execute a data processing action (e.g., sending an email, analyzing a transcript, storing a preference) and must verify that a specific user's consent record is valid, in-scope, and not expired. Guardrail: Wire this prompt as a synchronous gate before the action function is called. The action must be blocked unless the output is consent_status: VALID.

02

Bad Fit: Real-Time Consent Collection

Avoid when: You need to dynamically present a consent form, negotiate terms, or capture a new opt-in from a user during a conversation. This prompt only evaluates existing records. Guardrail: Route new consent collection to a separate, dedicated UI or a strictly bounded form-filling agent. Never let a verification prompt hallucinate a consent grant.

03

Required Inputs: Structured Consent Record

Risk: The model will fail or hallucinate if given only a user ID and a vague description of the action. It needs a machine-readable consent object. Guardrail: The prompt template requires a strict [CONSENT_RECORD] input containing user_id, scope, granted_at, expires_at, and status. Do not pass raw legal documents or privacy policies as the sole input; parse them into this schema first.

04

Operational Risk: Silent False Negatives

Risk: The model incorrectly classifies valid consent as INVALID or EXPIRED, blocking a legitimate user action and causing friction or support tickets. This often happens with ambiguous scope descriptions. Guardrail: Implement an UNCERTAIN output class that triggers a lightweight human review queue instead of an outright block. Monitor the ratio of UNCERTAIN to INVALID classifications daily.

05

Operational Risk: Scope Creep Acceptance

Risk: The model approves an action because the requested scope (e.g., "product improvement") sounds vaguely similar to the granted scope (e.g., "order fulfillment"), creating a compliance gap. Guardrail: Add a strict scope_match boolean field to the output schema. Use few-shot examples in the prompt that demonstrate non-matching scopes being correctly rejected, even when they sound related.

06

Bad Fit: Unsupervised High-Volume Gating

Avoid when: This prompt is the sole gatekeeper for millions of transactions per day with no human oversight. A systematic error in the prompt could cause a large-scale compliance incident. Guardrail: For high-throughput systems, use this prompt as a secondary check or a sampling audit tool. The primary gate should be a deterministic rules engine that checks exact scope strings, dates, and status flags before calling the LLM for edge cases.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A ready-to-use system prompt for verifying user consent status before executing a proposed AI processing action.

This prompt template implements a consent verification gate for product engineers. It evaluates whether a specific user has provided valid consent for a proposed AI processing action by checking scope match, expiration status, and withdrawal detection. The prompt is designed to be pasted directly into your system instructions or LLM call, with square-bracket placeholders replaced by real data from your consent management platform, user records, and processing request context before sending.

text
You are a consent verification gate. Your job is to determine whether a specific user has provided valid consent for a proposed AI processing action. You must check scope match, expiration, and withdrawal status. Never assume consent where none exists. When consent is unclear or incomplete, default to BLOCKED.

## INPUT DATA

### User Consent Records
[USER_CONSENT_RECORDS]

### Proposed Processing Action
[PROCESSING_ACTION_DESCRIPTION]

### Current Timestamp
[CURRENT_TIMESTAMP]

## CONSENT VERIFICATION RULES

1. **Existence Check**: Verify that at least one consent record exists for this user. If no records exist, status is NO_CONSENT_FOUND.
2. **Scope Match**: The consent scope must cover the proposed processing purpose, data categories, and processing activities. Partial matches are insufficient.
3. **Expiration Check**: Consent must not be expired based on the consent record's expiration date or the jurisdiction's maximum consent validity period.
4. **Withdrawal Detection**: Check for any withdrawal events. A withdrawn consent is invalid even if the record still appears active.
5. **Version Currency**: If the consent was obtained under an older policy version that no longer covers the proposed processing, treat as INSUFFICIENT_SCOPE.
6. **Jurisdictional Requirements**: Apply any jurisdiction-specific consent requirements (explicit vs. implied, age verification, special category data rules) based on [APPLICABLE_JURISDICTIONS].

## OUTPUT SCHEMA

Return a JSON object with exactly this structure:

{
  "consent_status": "VALID_CONSENT" | "NO_CONSENT_FOUND" | "EXPIRED_CONSENT" | "WITHDRAWN_CONSENT" | "INSUFFICIENT_SCOPE" | "JURISDICTION_BLOCKED",
  "decision": "PROCEED" | "BLOCKED" | "NEEDS_HUMAN_REVIEW",
  "matched_consent_id": "string | null",
  "scope_gaps": ["string"],
  "expiration_date": "string | null",
  "withdrawal_evidence": "string | null",
  "jurisdiction_issues": ["string"],
  "reasoning": "string",
  "recommended_action": "string",
  "requires_human_review": true | false
}

## CONSTRAINTS

- Do not fabricate consent records. Only use the provided [USER_CONSENT_RECORDS].
- If multiple consent records exist, evaluate each and select the most applicable one.
- When consent is VALID_CONSENT but close to expiration (within [EXPIRATION_WARNING_DAYS] days), set decision to PROCEED but include a warning in reasoning.
- For any status other than VALID_CONSENT, set decision to BLOCKED or NEEDS_HUMAN_REVIEW.
- Set requires_human_review to true for: WITHDRAWN_CONSENT with recent withdrawal, JURISDICTION_BLOCKED, or any case where scope_gaps might be resolvable with additional context.
- Never output PROCEED when consent_status is not VALID_CONSENT.

## EXAMPLES

### Example 1: Valid Consent
User Consent Records: [{id: "c1", purpose: "personalization", data_categories: ["browsing_history"], status: "active", granted_at: "2024-11-01", expires_at: "2025-11-01", jurisdiction: "EU", policy_version: "v2.1"}]
Processing Action: "Use browsing history for product recommendations"
Current Timestamp: "2025-01-15"
Applicable Jurisdictions: ["EU"]

Output:
{
  "consent_status": "VALID_CONSENT",
  "decision": "PROCEED",
  "matched_consent_id": "c1",
  "scope_gaps": [],
  "expiration_date": "2025-11-01",
  "withdrawal_evidence": null,
  "jurisdiction_issues": [],
  "reasoning": "Consent c1 covers personalization using browsing history, is active, and expires 2025-11-01. EU jurisdiction requirements met with explicit consent under policy v2.1.",
  "recommended_action": "Proceed with processing. Consent valid until 2025-11-01.",
  "requires_human_review": false
}

### Example 2: Insufficient Scope
User Consent Records: [{id: "c2", purpose: "analytics", data_categories: ["page_views"], status: "active", granted_at: "2024-06-01", expires_at: "2025-06-01", jurisdiction: "US", policy_version: "v1.0"}]
Processing Action: "Use purchase history for targeted advertising"
Current Timestamp: "2025-01-15"
Applicable Jurisdictions: ["US"]

Output:
{
  "consent_status": "INSUFFICIENT_SCOPE",
  "decision": "BLOCKED",
  "matched_consent_id": "c2",
  "scope_gaps": ["Purpose mismatch: consent is for analytics, not advertising", "Data category mismatch: consent covers page_views, not purchase_history"],
  "expiration_date": "2025-06-01",
  "withdrawal_evidence": null,
  "jurisdiction_issues": [],
  "reasoning": "Consent c2 does not cover advertising purposes or purchase history data. No other applicable consent records found.",
  "recommended_action": "Block processing. Request new consent for advertising using purchase history.",
  "requires_human_review": false
}

### Example 3: Withdrawn Consent
User Consent Records: [{id: "c3", purpose: "marketing_emails", data_categories: ["email", "purchase_history"], status: "withdrawn", granted_at: "2024-03-01", withdrawn_at: "2024-12-20", expires_at: "2025-03-01", jurisdiction: "EU", policy_version: "v2.0"}]
Processing Action: "Send promotional email based on purchase history"
Current Timestamp: "2025-01-15"
Applicable Jurisdictions: ["EU"]

Output:
{
  "consent_status": "WITHDRAWN_CONSENT",
  "decision": "BLOCKED",
  "matched_consent_id": "c3",
  "scope_gaps": [],
  "expiration_date": "2025-03-01",
  "withdrawal_evidence": "Consent c3 withdrawn on 2024-12-20",
  "jurisdiction_issues": [],
  "reasoning": "Consent c3 was withdrawn on 2024-12-20. Under GDPR, withdrawn consent cannot be used as a legal basis for processing.",
  "recommended_action": "Block processing. Do not send marketing email. User must re-consent before any marketing communication.",
  "requires_human_review": true
}

To adapt this template for your environment, replace the square-bracket placeholders with real data from your systems. [USER_CONSENT_RECORDS] should contain structured consent data from your consent management platform, including consent IDs, purposes, data categories, status, timestamps, jurisdictions, and policy versions. [PROCESSING_ACTION_DESCRIPTION] should describe the specific AI processing action being proposed, including the purpose and data involved. [CURRENT_TIMESTAMP] ensures consistent expiration evaluation. [APPLICABLE_JURISDICTIONS] and [EXPIRATION_WARNING_DAYS] allow you to tune the gate for your regulatory environment. The examples demonstrate the expected output shape for common scenarios—use them as few-shot references or remove them if your model reliably follows the schema instructions alone. For high-risk processing, always route decisions with requires_human_review: true to a human approval queue before execution proceeds.

IMPLEMENTATION TABLE

Prompt Variables

Required inputs for the User Consent Verification Gate Prompt. Each variable must be populated before the prompt is assembled and sent. Missing or malformed inputs will cause the gate to fail closed.

PlaceholderPurposeExampleValidation Notes

[USER_IDENTIFIER]

Unique identifier for the user whose consent is being verified

user_829104 or auth0|abc123

Must be a non-empty string. Validate against the identity provider before passing to the prompt.

[PROCESSING_ACTION]

Description of the specific AI processing action being proposed

Generate personalized product recommendations using purchase history

Must be a concrete action description. Reject generic inputs like 'do AI stuff'. Max 500 characters.

[DATA_CATEGORIES]

List of data categories the proposed action will access or process

["purchase_history", "browsing_behavior", "email_address"]

Must be a valid JSON array of strings. Each category must match an entry in the organization's data taxonomy.

[PURPOSE_SPECIFICATION]

The stated purpose for which consent was originally collected

Marketing personalization and product recommendations

Must be a non-empty string. Compare against the consent record's purpose field. Null allowed only if consent record has no purpose field.

[CONSENT_RECORD]

The stored consent record for this user, including scope, timestamp, and status

{"consent_id": "c_456", "scope": ["marketing"], "granted_at": "2024-01-15T10:30:00Z", "status": "active"}

Must be valid JSON. Required fields: consent_id, status. If status is 'withdrawn', the gate must return DENIED regardless of other fields.

[JURISDICTION]

The applicable legal jurisdiction for consent requirements

GDPR-EU or CCPA-CA or LGPD-BR

Must match a value from the allowed jurisdiction enum. Controls expiration window and explicit consent requirements. Reject unknown jurisdictions.

[CURRENT_TIMESTAMP]

The current time in ISO 8601 format, used for expiration checks

2025-03-15T14:22:00Z

Must be a valid ISO 8601 datetime string. Compare against consent_record.granted_at plus jurisdiction-specific expiration window. System-generated, not user-provided.

[PROCESSING_CONTEXT]

Additional context about how the processing will occur, including third-party involvement

{"third_party_processors": ["AnalyticsCo"], "cross_border_transfer": true, "automated_decision_making": false}

Must be valid JSON. If cross_border_transfer is true, flag for additional review. If automated_decision_making is true, require explicit consent confirmation.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the consent verification prompt into a product workflow with validation, logging, and human review for high-risk or ambiguous cases.

The User Consent Verification Gate Prompt is designed to be called synchronously before any AI processing action that requires a lawful basis. In a typical implementation, the application layer first retrieves the user's consent records from the consent management platform (e.g., OneTrust, Transcend, or an internal database), then assembles the prompt with the proposed action details and the retrieved consent evidence. The prompt returns a structured JSON determination that the application must validate before proceeding. This gate should be treated as a blocking precondition: if the consent status is anything other than valid, the processing action must not execute automatically.

To wire this into production, implement a pre-action hook in your AI orchestration layer. Before any model call that processes user data, call the consent verification function with the following inputs: user_id, action_type, data_categories, purpose, and jurisdiction. The function retrieves the consent record, populates the prompt template, and calls the LLM. The output must pass through a strict JSON schema validator that checks for the required fields (consent_status, scope_match, expiration_check, withdrawal_detected, determination, blocking_reason). If validation fails, retry once with a repair prompt; if it fails again, block the action and log the failure for review. For high-risk processing categories (e.g., health data, financial data, children's data), always require human review when the determination is conditional or expired, even if the model returns valid. Log every gate decision—including the prompt version, consent record hash, model response, and reviewer decision—to create an auditable trail.

Model choice matters here. Use a model with strong instruction-following and low hallucination rates on structured legal reasoning tasks. GPT-4o, Claude 3.5 Sonnet, or equivalent models are appropriate. Avoid smaller or older models that may conflate no_record_found with implied_consent. Set temperature=0 to maximize determinism. If your system processes consent at high volume, consider caching consent determinations for identical (user_id, action_type, purpose) tuples with a short TTL (e.g., 5 minutes), but invalidate the cache immediately on any consent withdrawal event. Never cache determinations that returned conditional, expired, or withdrawn.

The most dangerous failure mode is a false positive—the model returning valid when consent is missing, expired, or out of scope. To guard against this, implement eval assertions that run on a golden test set before any prompt version ships. Your eval suite should include cases where: consent is explicitly withdrawn, consent exists for a different purpose, consent has expired by one day, no consent record exists, and consent is present but the data categories don't match. Assert that each case returns the correct non-valid status. Additionally, implement a periodic audit job that samples recent gate decisions, re-evaluates them with a human reviewer, and measures the false-positive rate. If the rate exceeds your risk tolerance (typically <0.1% for regulated domains), escalate to the prompt engineering team and consider adding explicit negative examples to the prompt template.

IMPLEMENTATION TABLE

Expected Output Contract

The model must return a structured consent determination. Use this contract to validate the response before allowing the proposed processing action to proceed.

Field or ElementType or FormatRequiredValidation Rule

consent_status

enum: granted | denied | not_found | withdrawn | expired | scope_mismatch

Must be exactly one of the six enum values. Reject any other string.

user_identifier

string matching [USER_IDENTIFIER]

Must match the provided [USER_IDENTIFIER] exactly. Reject if missing or altered.

processing_purpose

string matching [PROCESSING_PURPOSE]

Must match the provided [PROCESSING_PURPOSE] exactly. Reject if missing or altered.

scope_match

boolean

Must be true if consent_status is granted, false otherwise. Reject if granted but scope_match is false.

expiration_check

object with fields: is_expired (boolean), expiration_date (string or null)

If is_expired is true, consent_status must be expired. If false, expiration_date must be an ISO 8601 date or null.

withdrawal_detected

boolean

Must be true if consent_status is withdrawn, false otherwise. Reject if withdrawn but withdrawal_detected is false.

evidence_summary

string citing specific records from [CONSENT_RECORDS]

Must contain at least one direct quote or record ID from [CONSENT_RECORDS]. Reject if summary is generic or lacks source grounding.

requires_human_review

boolean

Must be true if consent_status is not_found, scope_mismatch, or if any validation field is null. Reject if false for ambiguous cases.

PRACTICAL GUARDRAILS

Common Failure Modes

What breaks first when verifying user consent and how to guard against it.

01

Assuming Consent from Silence

What to watch: The model treats an absent consent record or a non-response as implied consent, especially when the user has an active account. Guardrail: Require an explicit, affirmative consent record with a timestamp. If no record is found, the gate must return status: NO_CONSENT and block processing.

02

Ignoring Scope Mismatch

What to watch: A valid consent exists for 'analytics' but the proposed action is 'marketing emails'. The model approves the action based on the general presence of consent. Guardrail: Extract the specific processing purpose from the request and perform an exact or semantic match against the consent_scope array. Reject on any mismatch.

03

Overlooking Consent Withdrawal

What to watch: A historical consent record exists, but a more recent withdrawal event is missed, causing the gate to approve a revoked action. Guardrail: Sort consent events by timestamp descending. The gate must check the latest event first. If the most recent event is a withdrawal, the status is REVOKED regardless of prior grants.

04

Expiration Date Blindness

What to watch: The model checks for the existence of consent but fails to compare the expiration_date against the current timestamp, approving expired consent. Guardrail: Inject the current UTC timestamp into the prompt context. Add a hard constraint: IF consent.expiration_date < current_timestamp THEN status = EXPIRED.

05

Hallucinating Regulatory Justifications

What to watch: When consent is missing, the model invents a 'legitimate interest' or 'contractual necessity' basis to approve the action without evidence. Guardrail: Strictly forbid the model from introducing legal bases not present in the input context. If consent is the required basis and is missing, the output must be BLOCKED with a null legal basis.

06

User Identity Resolution Failure

What to watch: The prompt receives a user_id but the consent record is stored under a different identifier (e.g., email vs. UUID). The gate returns NO_CONSENT for a user who has actually consented. Guardrail: Pre-process identity resolution in the application layer before calling the prompt. The prompt should receive a unified resolved_user_id and a list of associated_identifiers to check against.

IMPLEMENTATION TABLE

Evaluation Rubric

Criteria for evaluating the quality and safety of the User Consent Verification Gate Prompt's output before deployment. Each criterion includes a pass standard, a failure signal, and a concrete test method.

CriterionPass StandardFailure SignalTest Method

Consent Status Accuracy

Correctly identifies 'granted', 'denied', 'withdrawn', or 'not_found' based on the provided [CONSENT_RECORD] and [PROCESSING_PURPOSE].

Output status contradicts the explicit grant/denial/withdrawal fields in the input record.

Unit test with 10 golden consent records covering all statuses and edge cases like expired grants.

Scope Match Precision

Correctly determines if the [PROCESSING_PURPOSE] falls within the scope of a granted consent's purpose and data_categories fields.

Approves processing for a purpose or data category explicitly excluded in the consent record's scope.

Test with purpose/data-category pairs that are exact matches, subsets, supersets, and disjoint sets.

Expiration Logic

Correctly flags a consent as 'expired' if the current [TIMESTAMP] is past the record's expiry_date.

Treats an expired consent as still valid, or flags a valid consent as expired prematurely.

Test with timestamps exactly at, one second before, and one second after the expiry_date.

Withdrawal Detection

Correctly identifies a consent as 'withdrawn' if the status is 'withdrawn' or a withdrawn_at timestamp is present and before [TIMESTAMP].

Ignores a 'withdrawn' status and approves processing, or misinterprets a past withdrawal.

Test with records where status is 'withdrawn' and where a withdrawn_at date exists but status is stale.

Handling of Missing Input

If [CONSENT_RECORD] is null or empty, the output status is 'not_found' and the blocked field is true.

Assumes consent ('granted') or hallucinates a record when none is provided.

Provide a null or {} value for [CONSENT_RECORD] and verify the not_found determination.

Justification Grounding

The reasoning field directly quotes the specific field from [CONSENT_RECORD] that led to the determination (e.g., 'status: denied').

The reasoning is generic ('based on policy') or references information not present in the input.

Parse the output reasoning and check for exact string matches with values in the provided [CONSENT_RECORD].

Output Schema Compliance

The output is valid JSON matching the [OUTPUT_SCHEMA] with all required fields present and correctly typed.

Output is missing the blocked boolean, status is not one of the allowed enums, or reasoning is an object instead of a string.

Validate the raw output string against the expected JSON Schema definition programmatically.

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Start with the base consent gate prompt and a simple JSON schema for the output. Use a frontier model with minimal temperature. Provide the user's consent record and the proposed processing action as plain text. Skip the expiration math and scope-matching logic in the prompt—let the model reason over the raw text.

code
You are a consent verification gate. Given a user consent record and a proposed processing action, determine if valid consent exists.

User Consent Record:
[CONSENT_RECORD_TEXT]

Proposed Action:
[PROCESSING_ACTION]

Return JSON with status (valid|invalid|needs_review), reason, and evidence.

Watch for

  • The model assuming consent where none is explicitly stated
  • Missing scope checks—consent for analytics does not imply consent for marketing
  • No withdrawal detection if the record contains a later opt-out
  • Overly permissive interpretations of vague consent language
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.