Inferensys

Prompt

Terms of Service Violation Detection Prompt

A practical prompt playbook for trust and safety engineers screening AI-generated content or proposed actions against platform terms of service. Produces a violation assessment with specific clause references, severity classification, and recommended enforcement action.
Developer doing prompt engineering on laptop, prompt variations visible on screen, casual coding session.
PROMPT PLAYBOOK

When to Use This Prompt

A practical guide for trust and safety engineers who need to screen AI-generated content against platform Terms of Service before publication or execution.

This prompt is designed for trust and safety engineering teams who need to screen AI-generated content, user-facing outputs, or proposed automated actions against a platform's Terms of Service before those items are published, executed, or delivered to end users. It functions as a compliance gate: the model receives the full ToS text as grounding context along with the content to evaluate, and it returns a structured violation assessment that your application can act on programmatically. Use this prompt when you need clause-level traceability, severity classification, and a clear enforcement recommendation rather than a simple pass/fail flag.

The ideal user is an engineer or operator integrating this prompt into a content pipeline, agent workflow, or moderation queue. Required context includes the complete and current ToS text, the content or proposed action to evaluate, and a defined output schema that your downstream systems expect. The prompt works best when the ToS contains explicit, rule-like clauses that can be matched against specific content attributes. It is less reliable for vague policy language like 'objectionable content' or 'spirit of the rules' unless those terms are operationally defined in the provided context. Always include the full relevant ToS sections rather than summaries, as paraphrased policies introduce interpretation drift.

This prompt does not replace legal review for novel or high-severity cases, and it should not be used as the sole decision-maker for account-level enforcement actions such as permanent bans. It is a screening and triage tool, not a final adjudicator. When the model flags a high-severity violation or encounters ambiguous policy language, route the case to a human review queue with the full violation assessment attached. For low-severity, clear-cut violations with high model confidence, you may configure automated enforcement actions, but always log the assessment for audit. Never use this prompt to evaluate content where the ToS itself is disputed, incomplete, or subject to active legal interpretation without human oversight.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Terms of Service Violation Detection Prompt works and where it does not. Use these cards to decide if this prompt fits your workflow before integrating it into a compliance pipeline.

01

Good Fit: Structured Policy Enforcement

Use when: You have a static, well-defined Terms of Service document and need to screen user-generated content or AI outputs against specific clauses. Guardrail: Always provide the full ToS text as grounding context; never rely on the model's internal knowledge of a platform's policies.

02

Bad Fit: Real-Time Content Firewall

Avoid when: You need sub-50ms latency to block content before it is posted. Guardrail: Use this prompt for asynchronous review queues or batch processing. For real-time enforcement, combine it with a fast keyword/embedding filter that escalates ambiguous cases to this prompt.

03

Required Input: Ground-Truth Policy Text

What to watch: The model hallucinates plausible-sounding but non-existent clause numbers or invents policies for edge cases. Guardrail: The prompt must receive the exact ToS text as a quoted input variable. Validate that every cited clause reference exists in the source document before accepting the output.

04

Operational Risk: Severity Drift

What to watch: The model classifies a minor profanity as a 'Critical' violation or downgrades a credible threat to 'Low' severity based on subtle phrasing. Guardrail: Implement a calibration step with few-shot examples that define each severity level (Critical, High, Medium, Low) with concrete, policy-specific scenarios.

05

Operational Risk: Over-Censorship

What to watch: The model flags legitimate criticism, parody, or policy discussion as a violation, creating a chilling effect on user speech. Guardrail: Add a specific instruction to distinguish between discussing a violation and committing one. Route all 'High' and 'Critical' flags to a human review queue before taking enforcement action.

06

Bad Fit: Ambiguous or Unwritten Rules

Avoid when: Your enforcement depends on unwritten community norms, evolving case law, or subjective 'I know it when I see it' standards. Guardrail: The prompt requires explicit textual grounding. If your policy is not fully documented, use this prompt only as a draft triage tool and always require human adjudication for final decisions.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A production-ready prompt template for detecting Terms of Service violations in AI-generated content or proposed actions, with structured output for enforcement workflows.

This prompt template is designed to be embedded directly into your trust and safety pipeline. It accepts the content or action to be screened, the relevant Terms of Service text as grounding context, and a defined output schema. The model's job is to act as a compliance gate: it must identify violations, cite the specific clause breached, classify severity, and recommend an enforcement action. The template uses square-bracket placeholders for all dynamic inputs—replace each before sending the prompt to the model. No placeholder should remain unresolved in production traffic.

text
You are a trust and safety compliance reviewer. Your task is to evaluate the provided [CONTENT_OR_ACTION] against the [TERMS_OF_SERVICE_TEXT] and determine whether a violation exists.

# INPUT
[CONTENT_OR_ACTION]

# POLICY CONTEXT
[TERMS_OF_SERVICE_TEXT]

# OUTPUT SCHEMA
Return a single JSON object with the following structure:
{
  "violation_detected": boolean,
  "violations": [
    {
      "clause_reference": "string (exact section or clause identifier from the ToS)",
      "violation_summary": "string (one-sentence description of the violation)",
      "severity": "critical | high | medium | low",
      "recommended_action": "block | quarantine | flag_for_review | warn | allow",
      "rationale": "string (explanation linking the content to the specific clause)"
    }
  ],
  "overall_severity": "critical | high | medium | low | none",
  "overall_recommendation": "block | quarantine | flag_for_review | warn | allow",
  "uncertainty_notes": "string or null (describe any ambiguity, missing context, or borderline cases that warrant human review)"
}

# CONSTRAINTS
- Only flag violations where the [CONTENT_OR_ACTION] clearly matches a clause in the [TERMS_OF_SERVICE_TEXT].
- If no violation is detected, return an empty violations array, overall_severity of "none", and overall_recommendation of "allow".
- Do not invent clauses or policies not present in the provided ToS text.
- If the ToS text is ambiguous on a point, note this in uncertainty_notes and recommend "flag_for_review" rather than "block".
- For any severity of "critical" or "high", overall_recommendation must be "block" or "quarantine".
- Cite clause references exactly as they appear in the provided ToS text.

# RISK LEVEL
[RISK_LEVEL]

Adaptation guidance: Replace [CONTENT_OR_ACTION] with the raw text, generated output, or action description under review. Replace [TERMS_OF_SERVICE_TEXT] with the full, unredacted ToS document—do not summarize or truncate it, as clause-level citation accuracy depends on complete context. The [RISK_LEVEL] placeholder accepts a value like "high", "medium", or "low" to adjust the model's sensitivity; at high risk, the model should default to flagging borderline cases for human review. After receiving the output, validate the JSON structure programmatically before acting on the recommendation. For any overall_recommendation of "block" or "quarantine", route the decision to a human reviewer with the full violation payload attached. Never automate blocking actions without a human-in-the-loop checkpoint for critical or high-severity violations.

IMPLEMENTATION TABLE

Prompt Variables

Each placeholder the Terms of Service Violation Detection Prompt requires, its purpose, an example value, and actionable validation notes for your integration harness.

PlaceholderPurposeExampleValidation Notes

[CONTENT_TO_SCREEN]

The AI-generated text, proposed action description, or user submission to evaluate for ToS violations.

User comment: "I'll sell you this banned substance for $50, DM me."

Required. Must be a non-empty string. Truncate to model context window minus grounding text length. Log content hash for audit trail.

[TOS_GROUNDING_TEXT]

The full text of the relevant Terms of Service sections to use as grounding evidence for violation detection.

Section 4.2: Prohibited Content. Users may not post content that facilitates illegal transactions, including the sale of controlled substances.

Required. Must be a non-empty string. Source from a versioned document store, not hardcoded. Validate that the text contains clause identifiers for citation. If null, block screening and escalate.

[TOS_VERSION_ID]

An identifier for the specific version of the Terms of Service being enforced, used for auditability.

tos_v2025.03.15_sections_4-6

Required. Must match a known version in your policy registry. Reject screening if version is deprecated. Include in all output records for compliance review.

[CONTENT_SOURCE]

The origin of the content being screened: user-generated, AI-generated, third-party API, or internal tool output.

user_generated

Required. Must be one of an allowed enum: user_generated, ai_generated, third_party_api, internal_tool. Routing and severity weighting may depend on this value. Reject unknown sources.

[USER_ID]

An anonymized or pseudonymous identifier for the user associated with the content, for repeat-offender tracking.

user_8a7f3c2b

Optional. If provided, must conform to your internal ID format. Null allowed for anonymous content. Never pass raw PII. Hash before logging if used in enforcement decisions.

[PREVIOUS_VIOLATION_COUNT]

The number of prior confirmed ToS violations for this user, used to influence severity classification.

2

Optional. Must be an integer >= 0 if provided. Null allowed for first-time or unknown users. Do not fabricate. Source from your enforcement database. Used by severity logic, not the prompt directly.

[ENFORCEMENT_ACTIONS_CATALOG]

The list of available enforcement actions the system can take, with their escalation levels.

["warn", "content_removal", "temporary_suspension", "permanent_ban"]

Required. Must be a valid JSON array of strings. The prompt uses this to recommend an action within your actual capabilities. Do not allow the model to invent actions outside this catalog.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Terms of Service Violation Detection prompt into a production trust and safety pipeline.

This prompt is not a standalone classifier; it is a gate in a larger enforcement pipeline. The implementation harness must treat the model's output as a recommendation, not a final enforcement action. The harness is responsible for providing the correct ToS text as grounding context, validating the output schema, enforcing severity thresholds, and routing violations to the appropriate enforcement queue or human review. A well-built harness prevents the model from hallucinating policy clauses, misclassifying severity, or taking automated action on high-severity violations without human approval.

Input assembly is the first critical step. The harness must retrieve the correct version of the platform's Terms of Service and inject it into the [TOS_TEXT] placeholder. This retrieval should be version-pinned and auditable; never rely on the model's parametric knowledge of a ToS. The [CONTENT_TO_CHECK] should be the raw text or structured representation of the user-generated content, proposed action, or AI-generated output under review. If the content is multimodal (images, video), extract a text description or transcript before passing it to this prompt. The harness should also inject a unique review_id and timestamp into the context for traceability. For high-throughput systems, consider batching multiple content items into a single request with a clear array structure in [CONTENT_TO_CHECK] and an explicit instruction to return an array of assessments, but monitor for attention dilution across long batches.

Output validation and enforcement routing form the core of the harness. The model returns a JSON object with violation_detected (boolean), violated_clauses (array of clause references), severity (enum: low, medium, high, critical), reasoning (string), and recommended_action (enum: allow, flag_for_review, block, escalate). The harness must validate that every violated_clause reference exists in the provided ToS text—hallucinated clause numbers are a common failure mode. Implement a post-processing check that searches for each cited clause reference in the source document; if a reference is not found, downgrade the confidence and flag the item for human review. Severity routing logic should be configurable: for example, low severity violations might be logged and allowed with a warning, medium routed to a review queue, and high or critical violations blocked pending human adjudication. Never automate enforcement on critical severity findings without human approval.

Retry and fallback logic must account for model failures and edge cases. If the model returns malformed JSON, use a repair prompt or a lighter-weight model to restructure the output before failing. If the model returns a severity value outside the defined enum, map it to flag_for_review and log the anomaly. If the model's reasoning field is empty or nonsensical, treat the assessment as unreliable and escalate. Implement a circuit breaker: if the violation rate suddenly spikes beyond a configurable threshold (e.g., >30% of items flagged in a 5-minute window), halt automated processing and alert the trust and safety team—this may indicate a prompt regression, a coordinated attack, or a ToS update that the model is misinterpreting.

Logging and audit trail requirements are non-negotiable for this workflow. Every assessment must be logged with the review_id, the full prompt (including the ToS version hash), the raw model output, the post-validation result, the enforcement decision, and the human reviewer's identity if manual review occurred. This audit trail serves three purposes: defending enforcement decisions during user appeals, detecting prompt drift over time, and providing evidence for regulatory inquiries. Store these logs immutably and retain them in line with your platform's data retention policy. For high-stakes platforms, consider running a second model (or the same model with a different temperature) as a shadow evaluator and comparing disagreement rates as a quality signal.

Model choice and latency considerations directly impact this harness. For real-time content screening (e.g., before a post is published), latency must be under 2 seconds, favoring smaller, faster models like Claude Haiku or GPT-4o-mini. For asynchronous batch review of existing content, larger models like Claude Sonnet or GPT-4o provide better clause-level reasoning at higher cost and latency. If your ToS document is long (>50 pages), use a RAG retrieval step to pull only the most relevant sections before passing them as [TOS_TEXT]; do not stuff the entire document into the context window and hope the model attends to the right clauses. Test your harness with adversarial content designed to probe the boundaries of your policies—content that is technically compliant but violates the spirit of the rules, or content that uses obfuscation to hide violations. These edge cases will reveal where your prompt and harness need reinforcement.

IMPLEMENTATION TABLE

Expected Output Contract

Defines the structured JSON payload the model must return after evaluating [USER_CONTENT] against [TOS_TEXT]. Use this contract to validate the response before routing to a human reviewer or enforcement system.

Field or ElementType or FormatRequiredValidation Rule

violation_detected

boolean

Must be true or false. If true, at least one violation object must exist in the violations array.

violations

array of objects

Must be a JSON array. If violation_detected is false, the array must be empty. If true, the array must contain at least one item.

violations[].clause_reference

string

Must be a direct quote or a specific section number (e.g., 'Section 3.2(a)') found verbatim in [TOS_TEXT]. Reject if hallucinated.

violations[].violation_summary

string

Must be a single sentence describing the violation. Must not exceed 280 characters. Must not contain markdown.

violations[].severity

enum: CRITICAL, HIGH, MEDIUM, LOW

Must be one of the four defined enum values. CRITICAL is reserved for illegal content or immediate safety risks.

violations[].recommended_action

enum: BLOCK, QUARANTINE, FLAG_FOR_REVIEW, WARN

Must be one of the four defined enum values. BLOCK requires a severity of CRITICAL or HIGH.

violations[].violating_excerpt

string

Must be a substring extracted directly from [USER_CONTENT]. If the excerpt is not found in the input, the entire violation object must be rejected.

confidence_score

number (0.0 - 1.0)

Must be a float between 0.0 and 1.0. If below 0.7, the entire output must be routed to a human review queue regardless of violation_detected status.

PRACTICAL GUARDRAILS

Common Failure Modes

What breaks first when screening content against Terms of Service and how to guard against it.

01

Hallucinated Clause References

What to watch: The model invents section numbers, clause titles, or policy language that doesn't exist in the provided ToS text. This creates false violation flags or, worse, false passes that leave actual violations undetected. Guardrail: Require exact quote extraction from the provided ToS text for every violation claim. Add a validator that checks whether each cited clause string appears verbatim in the source document. If no match, flag for human review.

02

Over-Flagging Benign Content

What to watch: The model classifies borderline or completely acceptable content as a violation, flooding review queues with false positives. This erodes trust in the system and wastes reviewer time. Common triggers include sarcasm, hypotheticals, and quoted text from other sources. Guardrail: Add a severity threshold that only escalates 'High' or 'Critical' classifications automatically. Route 'Low' and 'Medium' findings to a sampling queue. Include a 'benign interpretation' check in the prompt that asks the model to argue against its own classification before finalizing.

03

Context Window Truncation

What to watch: Long ToS documents combined with lengthy user content exceed the context window, causing the model to screen against only the first portion of the policy. Violations in later sections are silently missed. Guardrail: Chunk the ToS document by major section and run parallel screens, then aggregate results. Alternatively, use a retrieval step to pull only the most relevant policy sections before the classification prompt. Log which sections were actually included in the context for auditability.

04

Policy Update Drift

What to watch: The ToS document changes but the prompt template continues referencing an outdated version cached in the system prompt or a stale retrieval index. Violations against new clauses go undetected. Guardrail: Embed the ToS version date and a content hash in the prompt metadata. Add a pre-check that compares the hash of the retrieved document against the expected hash. If they differ, halt screening and alert the ops team. Never hardcode policy text in the system prompt.

05

Multilingual Evasion

What to watch: Users submit violating content in a language the model doesn't screen effectively, or mix languages to confuse the classifier. The model may pass content that would be flagged in the primary language. Guardrail: Add a language detection pre-step. If the content language doesn't match the ToS language, route to a translation step before screening, or escalate directly to a human reviewer with language noted. Test the pipeline with code-switched and non-English adversarial examples.

06

Enforcement Action Inconsistency

What to watch: The model recommends different enforcement actions for similar violations across different runs, creating an unfair and legally risky moderation pattern. One user gets a warning while another gets a suspension for the same behavior. Guardrail: Include a few-shot example set with calibrated enforcement mappings. Add a post-processing step that normalizes recommended actions against a predefined enforcement matrix. Log all enforcement decisions for weekly consistency audits by the trust and safety team.

IMPLEMENTATION TABLE

Evaluation Rubric

Test output quality before shipping the Terms of Service Violation Detection prompt to production. Each criterion targets a known failure mode in automated policy enforcement.

CriterionPass StandardFailure SignalTest Method

Clause Reference Accuracy

Every violation cites a specific, verbatim clause from the provided [TOS_TEXT]

Citation paraphrases or invents clause language not present in [TOS_TEXT]

Diff cited text against source document; flag any edit distance > 5 characters per clause

Severity Classification Consistency

Severity matches the rubric defined in [SEVERITY_RUBRIC] for the identified violation type

Severity is assigned without reference to the rubric or contradicts the rubric's examples

Spot-check 20 outputs against rubric; require > 95% agreement with human rubric application

False Positive Rate on Clean Content

Flags zero violations when [USER_CONTENT] contains no ToS-breaching material

Returns any violation with confidence > 0.3 for content that two human reviewers agree is compliant

Run on a golden set of 50 clean examples; require 0 false positives at the 'violation' threshold

False Negative Rate on Known Violations

Detects all seeded violations in a test suite covering hate speech, spam, impersonation, and IP infringement

Misses a seeded violation that matches a clause explicitly listed in [TOS_TEXT]

Run on a golden set of 30 seeded violations; require > 95% recall

Enforcement Action Appropriateness

Recommended action matches [ENFORCEMENT_POLICY] for the given severity and violation history

Recommends permanent ban for first-offense low-severity violation or warning for severe repeat offense

Validate action against policy decision tree; flag any deviation from prescribed escalation path

Confidence Score Calibration

Confidence < 0.5 correlates with ambiguous or edge-case content; confidence > 0.9 correlates with clear-cut violations

High confidence assigned to content where two human reviewers disagree on violation presence

Compare confidence distribution against inter-rater agreement on 40 borderline cases; require AUC > 0.85

Output Schema Compliance

Response validates against [OUTPUT_SCHEMA] with all required fields present and correctly typed

Missing violation_clauses array, severity field is string instead of enum, or confidence is out of 0-1 range

Automated JSON Schema validation in CI; reject any output that fails structural validation

Handling of Empty or Malformed Input

Returns empty violations array with confidence 0 when [USER_CONTENT] is null, empty, or unparseable

Hallucinates violations from empty input or crashes on malformed content

Unit test with null, empty string, base64 garbage, and truncated JSON; require graceful empty response

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Start with the base prompt and a single ToS document. Use a frontier model with a simple pass/fail/violation structure. Skip severity scoring and enforcement recommendations initially. Focus on getting accurate clause citation before adding complexity.

Prompt snippet

code
You are a trust and safety reviewer. Given the [CONTENT_TO_CHECK] and the [TOS_DOCUMENT], determine if the content violates any clause. Return JSON with `violation_found`, `clause_reference`, and `explanation`.

Watch for

  • Hallucinated clause numbers that don't exist in the provided ToS
  • Over-flagging borderline content without clear clause matches
  • Missing the distinction between "violates spirit" and "violates letter"
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.