This prompt is for governance, compliance, and safety engineering teams that need structured, auditable records of every safety decision an AI system makes. It takes the output of an upstream safety classifier—a classification label, confidence score, and policy reference—and produces a complete audit trail entry suitable for regulatory review, internal investigations, or model improvement analysis. Use this prompt when your platform must demonstrate why a request was blocked, flagged, or allowed, and when that decision must be traceable to a specific policy version and reviewer. This is not a classification prompt. It assumes classification has already occurred and focuses entirely on evidence packaging and decision documentation.
Prompt
Unsafe Request Audit Trail Generation Prompt

When to Use This Prompt
Defines the precise job-to-be-done, the ideal user, and the operational boundaries for the Unsafe Request Audit Trail Generation Prompt.
The ideal user is a safety platform engineer or compliance architect integrating this prompt into a post-classification pipeline. The required context includes the raw user input, the classifier's output payload, the active policy document version, and any session or user metadata needed for traceability. Do not use this prompt for real-time enforcement gating—it is a documentation step, not a decision step. Do not use it to second-guess or override the classifier's decision; its job is to record the decision, not to re-litigate it. If the classifier's output is missing required fields or contains ambiguous labels, fix the classifier first. Feeding incomplete classification data into this prompt will produce incomplete audit records that fail regulatory scrutiny.
Before wiring this prompt into production, define the downstream consumer of the audit trail: a compliance database, a review queue, a monitoring dashboard, or a regulatory filing system. The output schema must match that consumer's requirements exactly. If your use case involves legally mandated reporting (e.g., CSAM, financial fraud, imminent harm), add a human-review step after audit generation and before any external submission. The prompt produces documentation, not legal filings. When in doubt, escalate to human review rather than relying on automated audit generation for high-severity incidents.
Use Case Fit
Where the Unsafe Request Audit Trail Generation Prompt works and where it introduces risk. This prompt is designed for governance and compliance workflows, not real-time enforcement or user-facing interactions.
Good Fit: Post-Hoc Compliance Review
Use when: safety, legal, or compliance teams need a structured, timestamped record of why a specific request was classified as unsafe, which policy it violated, and what action was taken. Guardrail: The prompt should be triggered by a review queue event, not by the end-user request itself, to avoid adding latency to real-time safety decisions.
Bad Fit: Real-Time Safety Enforcement
Avoid when: you need to block, flag, or redirect a user request in under 200ms. This prompt is designed for thorough, multi-field record generation, which adds unacceptable latency to the critical path. Guardrail: Use a lightweight classification prompt for the real-time decision and generate the audit trail asynchronously from the stored decision record.
Required Inputs: The Raw Safety Decision
What to watch: Generating an audit trail without the original user input, the classifier's output, and the policy version active at the time of the decision produces an incomplete and potentially non-compliant record. Guardrail: The prompt template must require placeholders for [ORIGINAL_USER_INPUT], [SAFETY_CLASSIFICATION_RESULT], [ACTIVE_POLICY_VERSION], and [ENFORCEMENT_ACTION_TAKEN] to ensure a complete evidence chain.
Operational Risk: Hallucinated Policy Citations
What to watch: The model may generate plausible-sounding but incorrect policy clause numbers, regulatory references, or decision rationales to fill gaps in the provided context. This creates a false sense of audit-readiness. Guardrail: The prompt must instruct the model to only cite policy references from a provided [POLICY_DOCUMENT] context and to use an explicit [UNKNOWN_REFERENCE] token when a citation cannot be grounded in the source material.
Operational Risk: Inconsistent Record Structure
What to watch: Without a strict output schema, audit trails for the same type of violation may have different fields, formats, or levels of detail, making batch review and regulatory reporting difficult. Guardrail: Enforce a strict JSON output schema with required fields for classification_id, policy_references, decision_rationale, and reviewer_context. Validate the schema in the application layer before storing the record.
Bad Fit: User-Facing Explanation
Avoid when: the output is intended to be shown directly to the end-user to explain why their request was refused. Audit trails contain internal policy references, risk scores, and enforcement logic that can be adversarial gold for bad actors. Guardrail: Maintain a strict separation between the internal audit record and the user-facing refusal message. Use a separate Refusal Explanation prompt for user communication.
Copy-Ready Prompt Template
A production-ready prompt template for generating structured audit trail records from safety classification inputs, suitable for regulatory review.
The following prompt template is designed to be integrated directly into your safety decision pipeline. It takes the output of upstream classification systems—harm category, confidence score, policy references, and input context—and produces a structured, timestamped audit record. The record is designed to satisfy governance reviewers who need to understand what was detected, why a decision was made, and who or what system was involved. Copy this template into your prompt management system and replace the square-bracket placeholders with your application's runtime values.
textSYSTEM: You are an audit trail generator for an AI safety platform. Your output must be a complete, structured record suitable for regulatory review. You must not omit any required fields. If any input value is missing or uncertain, you must flag it explicitly rather than inventing a value. USER: Generate a structured audit trail record from the following safety classification inputs. INPUT: - Request ID: [REQUEST_ID] - Timestamp: [TIMESTAMP] - User/Session Context: [USER_CONTEXT] - Raw Input Excerpt: [RAW_INPUT_EXCERPT] - Classification Result: [CLASSIFICATION_RESULT] - Harm Categories Detected: [HARM_CATEGORIES] - Confidence Score: [CONFIDENCE_SCORE] - Severity Level: [SEVERITY_LEVEL] - Policy References: [POLICY_REFERENCES] - Decision: [DECISION] - Decision Rationale: [DECISION_RATIONALE] - Reviewer Context: [REVIEWER_CONTEXT] OUTPUT_SCHEMA: { "audit_record": { "record_id": "string, unique identifier for this audit entry", "generated_at": "string, ISO 8601 timestamp of audit record generation", "request": { "request_id": "string", "timestamp": "string, ISO 8601", "user_context": "string, anonymized session or user identifier", "raw_input_excerpt": "string, the portion of user input that triggered classification" }, "classification": { "result": "string, the classification outcome", "harm_categories": ["string, array of detected harm categories"], "confidence_score": "number, between 0.0 and 1.0", "severity_level": "string, one of: LOW, MEDIUM, HIGH, CRITICAL" }, "policy": { "references": ["string, array of policy IDs or section names"], "decision": "string, one of: BLOCK, FLAG, ALLOW, ESCALATE", "rationale": "string, explanation of why the decision was reached" }, "review": { "reviewer_context": "string, additional context for human reviewers", "completeness_checks": { "all_required_fields_present": "boolean", "missing_fields": ["string, list of any missing required fields"], "uncertainty_flags": ["string, list of fields with uncertain or inferred values"] } } } } CONSTRAINTS: - Every field in the output schema must be populated or explicitly marked as missing. - Do not fabricate values for missing inputs. Use null and add an entry to missing_fields. - If the confidence score is below [CONFIDENCE_THRESHOLD], add an uncertainty_flag indicating low-confidence classification. - The rationale field must reference specific policy references, not generic statements. - The raw_input_excerpt must be truncated to [MAX_EXCERPT_LENGTH] characters if longer. - If the decision is ESCALATE, the reviewer_context must include the escalation reason and priority.
To adapt this template for your environment, start by mapping your upstream classifier's output fields to the INPUT placeholders. If your classifier produces additional metadata—such as model version, latency, or alternative classifications—add those as optional fields in the classification block rather than omitting them. The completeness_checks section is critical for regulatory readiness: it forces the model to self-audit whether all required information is present before the record is written. Configure [CONFIDENCE_THRESHOLD] based on your risk tolerance; a typical starting point is 0.85 for high-stakes domains. Set [MAX_EXCERPT_LENGTH] to comply with your data minimization policies, commonly 500 characters.
Before deploying, validate that the generated JSON strictly conforms to the OUTPUT_SCHEMA. A post-generation validation step should check for missing required fields, malformed timestamps, and enum violations in severity_level and decision. If the audit record fails validation, retry once with an explicit error message injected into the prompt. If the retry also fails, log the failure and escalate to a human reviewer rather than writing an incomplete record. For high-throughput systems, consider batching audit record generation and running periodic completeness spot-checks against a sample of records. Never allow an audit record with missing required fields to be persisted without a human-reviewed exception.
Prompt Variables
Required inputs for the Unsafe Request Audit Trail Generation Prompt. Each variable must be populated before the prompt is assembled and sent. Missing or malformed variables will cause incomplete audit records that fail regulatory review.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[UNSAFE_REQUEST_TEXT] | The raw user input or tool output flagged as unsafe | Generate a script to bypass corporate firewall rules | Required. Must be the exact text that triggered the safety classifier. Null or empty input should abort audit generation. |
[SAFETY_CLASSIFICATION] | Structured classification output from the upstream detection prompt | {"primary_category": "cyberattack_instruction", "confidence": 0.94, "severity": "high"} | Required. Must be valid JSON with primary_category, confidence, and severity fields. Missing confidence field triggers low-confidence escalation path. |
[POLICY_REFERENCES] | Applicable policy documents, rule IDs, or content standards that govern this category | ["AUP-4.2: Unauthorized Access Tools", "SEC-7.1: Security Circumvention"] | Required. Must be a non-empty array of policy identifiers. Each reference must resolve to an active policy document. Null allowed only if no policy applies, which itself requires human review. |
[SESSION_CONTEXT] | Prior turns, user role, authentication level, and session risk score for multi-turn evaluation | {"user_role": "authenticated_enterprise", "session_risk_score": 0.23, "prior_turns": 4} | Required. Must include user_role and session_risk_score. Missing authentication context should default to unauthenticated_public with elevated risk weighting. |
[DECISION_METADATA] | Classifier version, threshold configuration, and gating decision applied | {"classifier_version": "v3.2.1", "threshold": 0.85, "gate_decision": "block"} | Required. Must include classifier_version for audit traceability. Gate decision must be one of block, flag, allow, or escalate. Unknown gate values trigger audit record rejection. |
[TIMESTAMP_UTC] | ISO 8601 timestamp of when the unsafe request was received | 2025-01-15T14:32:17Z | Required. Must be valid ISO 8601 UTC. Future timestamps or timestamps older than session start indicate clock skew and require metadata flag. |
[REVIEWER_CONTEXT] | Human reviewer instructions, escalation path, and required response actions for this severity level | {"escalation_queue": "tier2_safety", "sla_minutes": 30, "required_actions": ["temporary_suspension", "manual_review"]} | Required for escalate gate decisions. Null allowed for block and allow decisions. Missing escalation path on escalate-gated records is a compliance gap. |
[EVIDENCE_SNIPPETS] | Specific excerpts from the request that support the classification decision | ["bypass corporate firewall rules", "undetected access"] | Required. Must be a non-empty array of direct quotes from [UNSAFE_REQUEST_TEXT]. Snippets not found verbatim in source text indicate hallucinated evidence and must trigger audit record rejection. |
Implementation Harness Notes
How to wire the audit trail generation prompt into a production safety pipeline with validation, retries, and human review gates.
The audit trail generation prompt is not a standalone classifier—it is the final documentation step in a safety decision pipeline. Wire it after an upstream classification prompt has already produced a harm category, risk score, and policy reference. The audit prompt consumes that structured classification output plus the original user request and any session context, then produces a human-readable, evidence-anchored record suitable for compliance review. Do not use this prompt as the primary safety gate; it is too verbose and too slow for real-time blocking decisions. Its job is to create the paper trail that explains why a decision was made.
In a typical implementation, the audit prompt receives a JSON input payload containing [ORIGINAL_REQUEST], [CLASSIFICATION_RESULT], [POLICY_REFERENCES], [SESSION_ID], and [REVIEWER_CONTEXT]. Validate the upstream classification result before calling the audit prompt—if the classifier returned low confidence or an abstention, route to human review first and only generate the audit trail after a human decision is recorded. The audit prompt should be called with temperature=0 and a strict JSON output schema to enforce field completeness. Implement a retry loop with up to 3 attempts if the output fails schema validation, checking for missing required fields like decision_rationale, policy_citations, or evidence_excerpts. Log every audit record immutably with a timestamp, model version, and prompt version hash. For regulated domains, store the full prompt input and output as a signed record in a write-once data store.
Model choice matters for audit quality. Use a model with strong instruction-following and low hallucination rates on structured generation tasks—frontier models with JSON mode support are preferred. Avoid small or quantized models that may drop required fields or fabricate policy citations. The audit prompt includes a completeness self-check instruction; validate this self-check against your own schema validator rather than trusting it blindly. If the self-check claims completeness but your validator finds missing fields, escalate the record for human review and log the discrepancy as a prompt reliability incident. For high-volume systems, batch audit generation during off-peak hours rather than blocking the user-facing response path. Never expose raw audit trails to end users—these are internal governance artifacts and may contain sensitive policy reasoning that should not be disclosed.
Expected Output Contract
Fields, types, and validation rules for the structured audit trail object. Use this contract to parse, validate, and store each generated record before it enters the audit system of record.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
audit_id | string (UUID v4) | Must parse as valid UUID v4. Reject on format mismatch. | |
timestamp | string (ISO 8601 UTC) | Must parse as valid ISO 8601 datetime in UTC. Reject if missing timezone or unparseable. | |
request_id | string | Must match the [REQUEST_ID] input exactly. Fail if missing or mismatched. | |
classification | object | Must contain category, severity, and confidence fields. Schema check required. | |
classification.category | string (enum) | Must match one of the allowed harm taxonomy values from [POLICY_TAXONOMY]. Reject unknown values. | |
classification.severity | string (enum) | Must be one of: low, medium, high, critical. Reject on any other value. | |
classification.confidence | number (0.0-1.0) | Must be a float between 0.0 and 1.0 inclusive. Flag values below [CONFIDENCE_THRESHOLD] for human review. | |
policy_references | array of strings | Each element must match a policy ID from [POLICY_IDS]. Reject if empty or any ID is unknown. | |
decision | string (enum) | Must be one of: blocked, flagged, allowed, escalated. Reject on any other value. | |
decision_rationale | string | Must be non-empty and between 50 and 500 characters. Flag for review if shorter or longer. | |
evidence_excerpt | string or null | If present, must be a substring of [USER_INPUT]. Reject if not found in input. Null allowed when no direct evidence exists. | |
reviewer_context | object | Must contain reviewer_urgency and recommended_action fields. Schema check required. | |
reviewer_context.reviewer_urgency | string (enum) | Must be one of: immediate, within_hour, within_day, none. Reject on any other value. | |
reviewer_context.recommended_action | string | Must be non-empty and between 20 and 200 characters. Flag for review if outside bounds. | |
model_version | string | Must match the [MODEL_VERSION] input exactly. Reject if missing or mismatched. |
Common Failure Modes
What breaks first when generating unsafe request audit trails and how to guard against it.
Incomplete Audit Records
What to watch: The model omits required fields such as policy references, reviewer context, or decision rationale, producing audit trails that fail regulatory review. This often happens when the prompt does not enforce completeness checks or when the input lacks sufficient detail. Guardrail: Implement a post-generation validator that checks for all mandatory fields before the audit record is written. Use a structured output schema with required field enforcement and a completeness scoring step.
Vague or Unsubstantiated Rationale
What to watch: The model produces generic justifications like 'violates policy' without citing the specific policy clause, evidence from the request, or the reasoning chain. Auditors and reviewers cannot verify the decision. Guardrail: Require the prompt to extract and quote the specific policy text, the offending request segment, and a step-by-step reasoning trace. Add an eval check that flags rationales shorter than a minimum length or lacking direct quotes.
Timestamp and Sequence Gaps
What to watch: Audit records lack precise timestamps, session IDs, or turn sequence numbers, making it impossible to reconstruct the chronological order of events during an investigation. Guardrail: Inject session metadata (timestamp, session ID, turn number) from the application layer into the prompt as non-negotiable fields. Never rely on the model to generate or infer temporal data.
Classification Drift Across Batches
What to watch: The same type of unsafe request receives different classification labels or severity scores when processed in different batches or at different times, undermining audit consistency. Guardrail: Use a fixed taxonomy with clear definitions and few-shot examples in the prompt. Periodically run a golden set of cases through the audit trail generator and measure label stability.
Reviewer Context Omission
What to watch: The generated audit trail assumes the reviewer has full context, omitting the conversation history, user role, or prior safety decisions that led to the current state. A reviewer looking at a single record cannot understand the full picture. Guardrail: Include a dedicated 'reviewer context' section in the output schema that summarizes relevant session history, prior escalations, and user metadata. Make this section mandatory.
Over-Classification of Benign Edge Cases
What to watch: The model flags benign requests as unsafe because they contain keywords that overlap with harmful categories (e.g., medical discussion triggering regulated-content flags). This creates audit noise and erodes trust in the safety system. Guardrail: Add a calibration step that requires the model to distinguish between informational queries and actionable harmful requests. Include counterexample demonstrations in the prompt and measure false-positive rates against a labeled benign dataset.
Evaluation Rubric
Criteria for testing audit trail quality before deployment. Each row defines a pass standard, a failure signal, and a concrete test method.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Schema Completeness | All required fields in [OUTPUT_SCHEMA] are present and non-null unless explicitly nullable | Missing required fields or null values in non-nullable fields | JSON Schema validation against the defined output contract; run on 50 diverse audit samples |
Policy Reference Accuracy | Every policy citation in the audit record maps to an actual policy ID in [POLICY_CATALOG] with correct version | Fabricated policy IDs, stale version references, or missing policy grounding | Cross-reference extracted policy IDs against the source policy catalog; flag any ID not found in the catalog |
Classification Justification | The rationale field contains at least one specific evidence quote from [USER_INPUT] supporting the classification decision | Vague rationales with no quoted evidence, circular reasoning, or justification that contradicts the classification label | Regex check for quoted substrings present in the original input; manual review of 20 borderline cases |
Decision Traceability | The audit record includes all required decision context: classifier version, threshold values, and reviewer identity when human review occurred | Missing classifier version, absent threshold values, or null reviewer field when [REVIEW_FLAG] is true | Field presence check with conditional validation: if REVIEW_FLAG is true, reviewer field must be non-null and match valid reviewer ID format |
Timestamp and Sequence Integrity | All timestamps are ISO 8601 format, monotonically increasing within the session, and within 5 seconds of server time | Malformed timestamps, timestamps in the future, or sequence order violations within a session | ISO 8601 regex validation; sort by session ID and verify timestamp ordering; compare terminal timestamp against system clock |
Confidence Score Calibration | Confidence scores for classifications fall within 0.0-1.0 range and low-confidence scores (<0.6) correlate with [REVIEW_FLAG] = true | Scores outside valid range, high-confidence scores on known-ambiguous test cases, or low-confidence scores without review flag | Range validation; run calibration test set with 30 known-ambiguous inputs and verify review flag activation rate >= 90% for scores <0.6 |
Multi-Turn Context Preservation | For session-based audits, the record references prior turn classifications when [SESSION_TURN] > 1 and risk escalation is detected | Isolated turn records that fail to reference prior classifications when cumulative risk score increased | Session reconstruction test: feed 10 multi-turn probing sequences and verify that escalation turn records contain prior-turn references |
Regulatory Readiness | The audit record survives a completeness check: all fields required by [COMPLIANCE_STANDARD] are populated and the record is self-contained without external lookups | Records that require querying external systems to understand the decision, or missing fields mandated by the compliance standard | Compliance schema validation against [COMPLIANCE_STANDARD] requirements; spot-check 10 records for self-contained readability by a compliance reviewer |
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
Start with the base audit trail prompt but relax strict schema enforcement. Use a simpler JSON structure with only the required fields: request_id, classification, policy_violated, decision, and rationale_summary. Skip the completeness checks and evidence chain requirements.
codeGenerate an audit record for this safety decision: [REQUEST] [CLASSIFICATION_RESULT] Return JSON with: request_id, classification, policy_violated, decision, rationale_summary
Watch for
- Missing
timestamporreviewer_contextfields that regulators expect - Rationale summaries that are too vague to reconstruct the decision later
- No unique
audit_idgeneration, making records hard to reference in downstream systems

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