This prompt is designed for safety engineers, policy managers, and AI product leads who need to systematically identify weaknesses in their model's safety policy by analyzing patterns in production refusal logs. The job-to-be-done is converting a batch of unstructured refusal events into a structured gap analysis that reveals missing coverage areas, inconsistent enforcement, and high-priority policy additions. You should use this prompt when you have accumulated a meaningful volume of refusal data—typically from production monitoring, user appeals, or red-teaming exercises—and you need to move beyond anecdotal fixes toward evidence-based policy improvement.
Prompt
Safety Policy Gap Detection Prompt

When to Use This Prompt
Define the job, reader, and constraints for the Safety Policy Gap Detection Prompt.
The ideal input is a curated set of refused requests paired with the model's refusal responses and, where available, the specific policy rule that triggered the refusal. The prompt works best when the input includes both clear-cut correct refusals and ambiguous or contested cases, because the gap detection logic relies on contrastive analysis. Do not use this prompt for real-time refusal decisions, for individual request recovery, or when you lack a defined safety policy to evaluate against. It is an offline analytical tool, not a runtime classifier. The output is a structured gap analysis document, not a modified model behavior or a new system prompt.
Before running this prompt, ensure you have a representative sample of refusals spanning at least several hundred examples across different policy categories. The prompt requires a [POLICY_DOCUMENT] that defines your current safety rules, a [REFUSAL_LOG] containing the requests and responses to analyze, and a [RISK_LEVEL] parameter that sets the sensitivity threshold for flagging gaps. The analysis will be only as good as the input data—if your refusal logs are dominated by a single policy category or lack edge cases, the gap detection will be narrow. After receiving the output, you should validate the identified gaps against a human-reviewed sample before committing to policy changes, and you should track whether policy additions reduce the gap rate without increasing false positives in production.
Use Case Fit
Where the Safety Policy Gap Detection Prompt delivers value and where it introduces risk. This prompt analyzes refusal patterns to identify missing or inconsistent safety policies, but it requires production log access and human safety expertise to be effective.
Good Fit: Post-Deployment Policy Audits
Use when: you have accumulated real refusal logs from production traffic and need to identify systematic gaps before the next policy update. Guardrail: feed the prompt structured refusal records with original requests, refusal reasons, and timestamps, not raw chat logs.
Good Fit: Inconsistent Enforcement Detection
Use when: similar requests receive different refusal outcomes and you need to surface policy ambiguity. Guardrail: provide the prompt with request pairs and their actual outcomes; require it to cite specific policy clauses that explain the inconsistency.
Bad Fit: Real-Time Refusal Decisions
Avoid when: you need to decide whether to refuse a single request in production. This prompt is for offline analysis of patterns, not online safety decisions. Guardrail: route real-time decisions through your existing safety classifier or policy engine, not this analysis prompt.
Bad Fit: No Production Refusal Data
Avoid when: you lack real refusal logs and want to simulate policy gaps from synthetic examples. The prompt detects gaps from observed patterns, not hypothetical ones. Guardrail: deploy and collect at least one week of production refusals before running gap detection.
Required Input: Structured Refusal Records
Risk: unstructured chat logs produce noisy gap analysis with false positives. Guardrail: preprocess refusal events into a schema with fields for request text, refusal reason code, policy reference cited, confidence score, and session context before feeding to the prompt.
Operational Risk: Policy Overcorrection
Risk: gap detection may surface edge cases that tempt teams to add overly broad policy rules, increasing false-positive refusals. Guardrail: require human safety review of every proposed policy addition; regression-test against known legitimate requests before deployment.
Copy-Ready Prompt Template
A reusable prompt template for analyzing refusal logs to detect safety policy gaps, missing coverage areas, and inconsistent enforcement patterns.
This prompt template is designed to be dropped into a safety review pipeline that processes batches of production refusal logs. It expects structured refusal records as input and produces a gap analysis that safety engineers can use to prioritize policy updates. The template uses square-bracket placeholders for all variable inputs, making it straightforward to wire into an automated harness or a manual review workflow.
textYou are a safety policy analyst reviewing production refusal logs to identify gaps in the current safety policy coverage. Your task is to analyze the provided refusal records and produce a structured gap analysis that identifies: 1. Missing coverage areas where legitimate policy gaps exist. 2. Inconsistent enforcement where similar requests received different outcomes. 3. Over-refusal patterns where the policy is too conservative. 4. Under-refusal patterns where unsafe requests were not caught. 5. Recommended policy additions or modifications with clear rationale. [INPUT] [CONTEXT] [OUTPUT_SCHEMA] [CONSTRAINTS] [EXAMPLES] [RISK_LEVEL]
To adapt this template, replace each placeholder with concrete content. [INPUT] should contain the refusal records in a structured format, typically JSON with fields for request text, refusal reason, policy citation, timestamp, and model version. [CONTEXT] should include the current safety policy document and any known policy exceptions. [OUTPUT_SCHEMA] should define the exact JSON structure you expect for the gap analysis, including fields for gap category, affected request volume, risk severity, and recommended action. [CONSTRAINTS] should specify any domain-specific rules, such as privacy requirements or regulatory boundaries. [EXAMPLES] should include one or two annotated examples of correct gap analyses to guide the model's output style and depth. [RISK_LEVEL] should indicate the risk tolerance for the analysis, such as "high-stakes production system with regulatory oversight" or "internal safety review for prioritization."
Before deploying this prompt into an automated pipeline, validate the output against your expected schema and run a set of known gap scenarios to confirm the model correctly identifies missing coverage, inconsistent enforcement, and over-refusal patterns. For high-risk safety systems, always route the gap analysis through human review before updating production policies. Avoid using this prompt to generate policy changes that bypass existing safety review processes.
Prompt Variables
Required inputs for the Safety Policy Gap Detection Prompt. Each placeholder must be populated before the prompt is sent. Validation notes describe how to verify the input is fit for purpose.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[REFUSAL_LOG_SAMPLE] | A representative batch of refusal records from production logs, including the original request, the model's refusal response, and any metadata | 500 refusal records from the last 7 days, each containing request text, refusal text, timestamp, and model version | Must be a valid JSON array. Each record must have non-empty request and refusal fields. Reject if fewer than 50 records or if all records share the same refusal reason code. |
[POLICY_DOCUMENT] | The current safety policy document that the model is supposed to follow, including allowed and disallowed categories | A markdown document with sections for prohibited content categories, edge-case guidance, and refusal criteria | Must contain explicit category definitions. Reject if document is empty, contains only generic language like 'be safe', or lacks any disallowed-category enumeration. |
[COVERAGE_CATEGORIES] | A structured list of safety categories the policy is expected to cover, used as the baseline for gap detection | ['violence', 'hate speech', 'self-harm', 'sexual content', 'harassment', 'illegal activities', 'misinformation', 'privacy violations'] | Must be a valid JSON array of strings. Each category must be a distinct, non-empty string. Reject if fewer than 3 categories or if categories overlap semantically without disambiguation. |
[VOLUME_THRESHOLD] | The minimum number of refusal occurrences for a pattern to be considered a significant gap rather than noise | 50 | Must be a positive integer. Reject if less than 10 or greater than the total number of records in [REFUSAL_LOG_SAMPLE]. Null allowed if volume-based filtering is not desired. |
[RISK_SEVERITY_SCALE] | A mapping of severity levels to definitions, used to prioritize gaps by potential harm | {'critical': 'imminent physical harm or illegal activity', 'high': 'significant policy violation with user impact', 'medium': 'policy boundary ambiguity', 'low': 'minor inconsistency'} | Must be a valid JSON object with at least 2 severity levels. Each level must have a non-empty definition string. Reject if definitions are circular or reference undefined levels. |
[OUTPUT_SCHEMA] | The expected structure for the gap analysis output, including required fields and their types | A JSON Schema object with fields: gap_id, category, description, affected_request_count, severity, recommended_policy_addition, inconsistent_enforcement_examples | Must be a valid JSON Schema. Required fields must include at minimum: category, description, and severity. Reject if schema allows empty descriptions or missing severity assignments. |
[INCONSISTENCY_THRESHOLD] | The minimum ratio of similar requests with different refusal outcomes to flag as inconsistent enforcement | 0.3 | Must be a float between 0.0 and 1.0. Reject if less than 0.1 or greater than 0.9. Null allowed if inconsistency detection is not required for this analysis run. |
[HUMAN_REVIEW_FLAG] | A boolean indicating whether the output should include a flag for gaps that require human policy review before action | Must be true or false. When true, the prompt must include instructions to mark gaps exceeding [RISK_SEVERITY_SCALE] critical or high levels for human review. When false, the prompt should still note severity but not require explicit review flags. |
Implementation Harness Notes
How to wire the Safety Policy Gap Detection Prompt into a production safety review pipeline with validation, human review, and policy update workflows.
The Safety Policy Gap Detection Prompt is designed to run as a batch analysis step, not a real-time request handler. It consumes structured refusal logs and produces a gap analysis document that safety engineers review before updating policy definitions. The implementation harness must collect refusal records with sufficient metadata—original request, refusal reason, policy citation, timestamp, and user context—and feed them into the prompt in batches organized by policy category or time window. Because the output directly influences safety policy changes, the harness must include mandatory human review gates before any gap analysis results in policy modifications.
Wire the prompt into a scheduled analysis pipeline that triggers after a configurable volume of refusals accumulates or on a fixed cadence (weekly, per-policy-area). The harness should pre-process refusal logs into the [REFUSAL_LOG] input format, grouping records by detected policy category and including request volume counts and risk severity tags. After the model returns the gap analysis, run a structured validation step that checks for required output fields: gap_id, policy_area, gap_description, affected_request_patterns, observed_volume, risk_severity, recommended_policy_addition, and inconsistent_enforcement_examples. Reject and retry outputs that fail schema validation or omit required sections. Log every gap analysis run with a unique analysis_id, the input batch range, model version, and full output for auditability. Implement a retry budget of 2 attempts for malformed outputs before escalating to a human operator with the raw refusal sample.
The human review stage is the critical safety control. Each detected gap must be reviewed by a safety engineer who can accept, reject, or modify the recommendation before it enters the policy update workflow. Build a review queue that presents the gap analysis alongside a random sample of the underlying refusal records so reviewers can verify the pattern. Track reviewer decisions and use them to measure the prompt's precision and recall over time—gaps accepted versus rejected, and gaps missed entirely (discovered through other channels). Never automate policy changes directly from model output. The harness should also maintain a suppression list for known false-positive gap patterns to prevent the prompt from re-flagging issues that have already been reviewed and intentionally left unaddressed. Finally, version the prompt template alongside your safety policy versions so you can trace which prompt version produced which gap analysis, enabling regression testing when policies change.
Expected Output Contract
Fields, types, and validation rules for the Safety Policy Gap Detection Prompt output. Use this contract to build a parser, validator, or eval harness before integrating the prompt into a production pipeline.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
gap_id | string (kebab-case) | Must match pattern ^GAP-[A-Z]{2,4}-\d{4}$. Must be unique per analysis run. | |
gap_title | string (max 120 chars) | Must be a concise, descriptive title. Not empty. No trailing punctuation. | |
policy_area | string (enum) | Must match one of the allowed policy area values defined in [POLICY_TAXONOMY]. Reject unknown values. | |
gap_description | string (max 500 chars) | Must describe the missing or inconsistent coverage. Must reference at least one specific policy document or section from [POLICY_DOCS]. | |
evidence_summary | array of objects | Each object must contain 'refusal_id' (string), 'request_snippet' (string, max 300 chars), and 'observed_pattern' (string). Array must have 1-5 items. Validate each refusal_id exists in [REFUSAL_LOG]. | |
severity | string (enum) | Must be one of: 'critical', 'high', 'medium', 'low'. Severity must be consistent with [RISK_MATRIX] definitions for observed harm potential. | |
request_volume_estimate | object | Must contain 'count' (integer, >=0) and 'period' (string enum: 'daily', 'weekly', 'monthly'). Count must not exceed total refusal log size for the period. | |
recommended_policy_addition | string (max 1000 chars) | Must propose actionable policy language. Must not contradict existing [POLICY_DOCS]. Must include explicit inclusion and exclusion criteria. Human approval required before policy update. |
Common Failure Modes
Safety policy gap detection prompts fail in predictable ways. These cards cover the most common failure modes, why they happen, and how to guard against them before they reach production.
Overfitting to Recent Refusal Patterns
What to watch: The prompt identifies gaps based only on the most frequent or recent refusal patterns, missing low-volume but high-severity policy gaps that appear sporadically. This creates a false sense of coverage completeness. Guardrail: Require the prompt to stratify analysis by severity tier and time window, explicitly calling out low-frequency categories. Add a dedicated output field for 'rare but critical gaps' with a minimum count threshold of one.
Policy Language Misinterpretation in Gap Analysis
What to watch: The model misinterprets existing policy language when comparing refusal patterns against policy coverage, flagging gaps that don't exist or missing gaps because it reads policy too narrowly. This produces false-positive gap reports that waste safety team cycles. Guardrail: Include verbatim policy excerpts in the prompt context and require the model to quote the specific policy clause it believes is missing or ambiguous. Add a validation step where a second prompt checks gap claims against policy text.
Volume-Weighted Prioritization Without Severity Adjustment
What to watch: The prompt prioritizes policy gaps by observed request volume alone, pushing a high-volume low-risk gap above a low-volume safety-critical gap. This misaligns remediation effort with actual risk. Guardrail: Require separate priority scores for volume and severity, with a combined risk score that weights severity higher. Include explicit instructions that severity-5 gaps always rank above severity-1 gaps regardless of volume.
Inconsistent Enforcement Pattern Detection Failure
What to watch: The prompt fails to detect that the same policy is being applied inconsistently across similar requests, missing enforcement drift that signals policy ambiguity rather than a coverage gap. The analysis treats each refusal as independent. Guardrail: Add a clustering instruction that groups refusals by semantic similarity before analyzing policy coverage. Require the output to include an 'enforcement consistency' section that flags cases where similar requests received different outcomes.
Recommended Policy Addition Without Edge-Case Testing
What to watch: The prompt proposes new policy language that closes the identified gap but introduces over-refusal on legitimate edge cases. The recommendation looks correct in isolation but fails when tested against the full request distribution. Guardrail: Require each recommended policy addition to include explicit inclusion criteria, exclusion criteria, and three edge-case examples. Add a follow-up validation step that tests proposed policy against a holdout set of known-legitimate requests before acceptance.
Gap Analysis Drift Across Policy Versions
What to watch: The prompt produces gap analyses that reference outdated policy versions or mix interpretations from different policy iterations, creating confusion about which gaps are current. This happens when policy change history isn't provided or the model doesn't anchor to the active version. Guardrail: Include the active policy version number and effective date as a required input field. Instruct the model to reject analysis if the policy version is missing and to flag any gap that might be resolved by a recent policy change. Add a 'policy version anchor' field in the output.
Evaluation Rubric
Criteria for evaluating the quality of a Safety Policy Gap Detection output before shipping the prompt to production. Use this rubric to score outputs, calibrate human review, and set pass/fail gates.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Gap Identification | Output identifies at least one specific policy gap with a clear missing coverage area label. | Output returns no gaps, describes only existing policy, or lists generic categories like 'more policies needed'. | Parse output for gap list. Assert length > 0. Check that each gap has a non-empty 'missing_coverage_area' field. |
Evidence Grounding | Each gap is supported by at least one concrete refusal example from the provided [REFUSAL_LOG]. | Gaps cite no examples, use fabricated examples, or reference examples not present in the input log. | For each gap, verify that its 'example_ids' field maps to valid entries in [REFUSAL_LOG]. Cross-reference IDs programmatically. |
Inconsistency Detection | Output flags at least one pair of similar requests where one was refused and the other was fulfilled, with a clear explanation of the inconsistency. | Output claims perfect consistency, ignores provided borderline cases, or flags inconsistencies without explaining the policy difference. | Scan output for 'inconsistent_enforcement_examples'. Assert at least one entry has both a 'refused_request_id' and a 'fulfilled_request_id' from the log. |
Policy Addition Quality | Each recommended policy addition includes a draft policy statement, scope boundary, and at least one test scenario. | Recommendations are vague ('clarify policy'), lack testable boundaries, or propose rules that would break existing safe behavior. | Validate each entry in 'recommended_policy_additions' has non-empty 'draft_statement', 'inclusion_criteria', and 'test_scenarios' fields. Schema check required. |
Prioritization Logic | Gaps are prioritized using both 'observed_request_volume' and 'risk_severity' from the input data, with explicit scores. | Prioritization is arbitrary, uses only one dimension, ignores provided volume data, or assigns identical priority to all gaps. | Check that 'priority_score' is present and derived from [REQUEST_VOLUME] and [RISK_SEVERITY] fields. Assert at least two distinct priority values across gaps. |
False Positive/False Negative Analysis | Output distinguishes between gaps causing false refusals (over-blocking) and gaps causing missed unsafe content (under-blocking). | Output treats all gaps as the same type, conflates over-refusal with under-blocking, or omits directionality entirely. | Check 'gap_type' field for each gap. Assert that both 'false_positive_gap' and 'false_negative_gap' values appear at least once across the output. |
Actionable Output Schema | Output is valid JSON matching the [OUTPUT_SCHEMA] with all required fields present and correctly typed. | Output is malformed JSON, missing required fields, contains string values where arrays are expected, or adds undocumented fields. | Validate output against [OUTPUT_SCHEMA] using a JSON Schema validator. Assert no validation errors. Reject on schema mismatch. |
No Hallucinated Policies | Output references only policies present in [EXISTING_POLICIES] or explicitly labels new recommendations as additions. | Output cites policies not in the provided policy set, confuses recommendations with existing rules, or fabricates policy version numbers. | Extract all policy references from output. Diff against [EXISTING_POLICIES] list. Flag any reference not found and not marked as 'recommended_addition'. |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Use the base prompt with a small sample of refusal logs. Focus on gap discovery rather than prioritization precision. Replace the structured output schema with a simpler markdown report if you're iterating quickly.
codeAnalyze the following refusal records and identify policy gaps. [REFUSAL_LOG_SAMPLE] For each gap, describe: - What request pattern is being refused - Which existing policy (if any) covers it - Whether the refusal appears correct or overly conservative
Watch for
- Over-indexing on rare edge cases that don't represent real volume
- Missing gaps because the sample is too small or homogenous
- No severity or volume weighting, making findings hard to prioritize

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.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us