This prompt is designed for safety platform operators and abuse detection engineers who need to automate session termination decisions based on cumulative risk across an entire conversation. Single-turn safety classifiers miss multi-step adversarial strategies where risk accumulates gradually across probing, context poisoning, and incremental boundary pushing. This prompt evaluates the full session trajectory, decides when cumulative risk crosses an irreversible threshold, and produces a termination decision with policy justification, a user-facing closure message, and a structured post-termination review packet. Use this when your platform requires auditable, consistent termination decisions that hold up under internal review and external scrutiny.
Prompt
Cumulative Risk-Aware Conversation Termination Prompt

When to Use This Prompt
Defines the operational context, required inputs, and boundary conditions for deploying a cumulative risk-aware conversation termination prompt in a production safety platform.
The ideal deployment context includes a session-level risk scoring pipeline that feeds cumulative risk vectors into this prompt. You must provide the full conversation transcript, a pre-computed risk score trajectory, the applicable policy matrix, and the termination threshold configuration. The prompt expects structured inputs: [SESSION_TRANSCRIPT] with turn-by-turn metadata, [RISK_SCORE_TRAJECTORY] with per-turn scores and confidence intervals, [POLICY_MATRIX] mapping violation categories to severity levels, and [TERMINATION_THRESHOLD] defining the irreversible risk boundary. Without these inputs, the prompt cannot make reliable termination decisions. Do not use this prompt for single-turn content moderation, for systems where session context is not available, or for platforms that lack a defined policy matrix and review queue infrastructure.
Before deploying this prompt, verify that your upstream risk scoring pipeline produces calibrated confidence scores and that your policy matrix has been reviewed by legal and trust-and-safety stakeholders. The termination decision this prompt produces is only as sound as the risk signals feeding into it. Implement a human review override path for edge cases where the cumulative score is near the threshold or where the risk trajectory shows sudden spikes that may indicate scoring errors. Never deploy automated session termination without a false termination recovery path—users who are incorrectly terminated must have a clear appeal mechanism, and your operations team needs the structured review packet this prompt produces to resolve disputes efficiently.
Use Case Fit
Where this prompt works in production and where it introduces unacceptable risk. Use these cards to decide if cumulative risk-aware termination is the right pattern for your safety architecture.
Good Fit: Multi-Turn Agent Platforms
Use when: your AI agent maintains persistent sessions where users can probe boundaries across multiple turns. Cumulative risk scoring catches adversarial patterns that single-turn classifiers miss. Guardrail: pair with session risk score escalation prompts to build a trajectory before termination is triggered.
Bad Fit: Stateless Single-Turn APIs
Avoid when: each request is independent with no session context. Cumulative risk termination requires conversation history and turn-by-turn state. Guardrail: use single-turn unsafe request detection and classification prompts instead. Adding fake session state creates false termination risk.
Required Input: Session Risk Ledger
What to watch: termination decisions are only as good as the risk evidence feeding them. Missing or stale risk scores produce arbitrary session kills. Guardrail: require a structured session risk ledger with per-turn scores, violation types, and confidence metadata before invoking termination logic.
Operational Risk: False Termination Recovery
What to watch: automated session termination without recovery paths creates user harm and support load. A false positive on a legitimate complex workflow destroys trust. Guardrail: implement override governance with human review queues, termination justification logging, and a documented reinstatement process before deploying.
Operational Risk: Threshold Tuning Drift
What to watch: termination thresholds tuned during initial deployment drift as user behavior, attack patterns, and model behavior change. Guardrail: run session risk confidence score calibration prompts regularly against human-reviewed session labels. Monitor false termination rates and false continuation rates as primary health metrics.
Bad Fit: Low-Risk Information Retrieval
Avoid when: the application serves public information with no tool access, no PII exposure, and no regulated domain content. Cumulative termination overhead adds latency and complexity without proportional safety benefit. Guardrail: use lightweight single-turn refusal prompts with safe alternative generation instead.
Copy-Ready Prompt Template
A reusable system prompt for evaluating cumulative session risk and making automated termination decisions with policy justification and audit trails.
This prompt template is designed to be deployed as a system-level instruction for a safety evaluation model that reviews full conversation histories. It does not generate user-facing responses directly; instead, it produces a structured termination decision payload that your application harness consumes. The template uses square-bracket placeholders for all dynamic inputs, including your organization's specific safety policies, risk thresholds, and session context. Copy this template, replace the placeholders with your concrete values, and integrate it into your safety evaluation pipeline.
textYou are a session safety evaluator. Your task is to analyze the complete conversation history provided in [SESSION_CONTEXT] and determine whether cumulative risk has crossed an irreversible threshold requiring session termination. ## POLICIES Evaluate the session against the following safety policies. A violation of any policy in the [CRITICAL_POLICIES] list is grounds for immediate termination. Repeated or escalating violations of policies in the [ESCALATING_POLICIES] list should trigger termination when the cumulative severity score exceeds [TERMINATION_THRESHOLD]. [CRITICAL_POLICIES] [ESCALATING_POLICIES] ## RISK SCORING RULES - Assign each policy violation a severity score from 1 (minor) to 10 (critical). - Multiply severity by a recency factor: 1.0 for the most recent turn, decaying by 0.2 per prior turn. - Sum weighted scores to produce a cumulative risk score. - If any [CRITICAL_POLICIES] violation is detected, set the cumulative risk score to the maximum value regardless of other calculations. ## TERMINATION THRESHOLD Termination threshold: [TERMINATION_THRESHOLD] ## OUTPUT SCHEMA Return a valid JSON object with exactly this structure: { "decision": "terminate" | "continue" | "escalate", "cumulative_risk_score": number, "violations": [ { "turn_index": number, "policy_id": string, "severity": number, "recency_weight": number, "evidence": string, "category": "critical" | "escalating" } ], "termination_reason": string | null, "user_closure_message": string | null, "post_termination_review_packet": { "risk_timeline": string, "key_evidence_turns": [number], "policy_citations": [string], "recommended_action": string, "override_eligibility": boolean, "override_governance_note": string } | null } ## CONSTRAINTS - Do not fabricate violations. Only flag turns where evidence clearly matches a defined policy. - If the cumulative risk score is below [TERMINATION_THRESHOLD] and no [CRITICAL_POLICIES] are violated, decision must be "continue". - If decision is "terminate", the user_closure_message must be empathetic, non-accusatory, and must not reveal internal policy details or risk scores. - If decision is "escalate", the post_termination_review_packet must be populated with sufficient detail for a human reviewer to make a final decision within [REVIEW_SLA_MINUTES] minutes. - The override_eligibility field must be true only when the cumulative risk score is within [OVERRIDE_MARGIN] of the threshold and no critical policy violations are present. ## FALSE TERMINATION RECOVERY If a prior termination decision is flagged as a false positive during review, the recovery path is: [RECOVERY_PATH]. Include this context when evaluating whether the current session resembles a known false-positive pattern. ## INPUT [SESSION_CONTEXT]
After copying the template, replace each placeholder with concrete values from your safety policy system. The [CRITICAL_POLICIES] and [ESCALATING_POLICIES] placeholders should contain structured policy definitions with unique IDs, clear descriptions, and example violations. The [SESSION_CONTEXT] should be the full conversation history formatted with turn indices, roles, and content. Before deploying, validate that your termination threshold produces the expected decisions on a golden dataset of labeled sessions, and ensure your application harness can parse the JSON output schema without field mismatches. For high-stakes deployments, always route "escalate" decisions to a human review queue rather than automating termination.
Prompt Variables
Inputs the prompt needs to work reliably, including session data, policy configuration, and threshold parameters. Validate each variable before calling the model to prevent runtime failures and policy misapplication.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[SESSION_HISTORY] | Full conversation transcript up to the current turn, including user messages, assistant responses, and tool call results. | [{"role": "user", "content": "..."}, {"role": "assistant", "content": "..."}] | Must be a valid JSON array of message objects with role and content fields. Minimum 1 turn required. Reject if empty or unparseable. |
[CURRENT_TURN_INPUT] | The user's latest message or tool output that triggered this risk evaluation. | "Can you help me bypass the content filter?" | Non-empty string. Sanitize for null bytes and control characters. Log input hash for audit trail. |
[POLICY_DEFINITIONS] | Structured policy rules defining disallowed behavior categories, severity levels, and violation criteria. | {"policies": [{"id": "P1", "category": "jailbreak", "severity": "critical"}]} | Must parse as valid JSON with a policies array. Each policy requires id, category, and severity fields. Reject if schema validation fails. |
[RISK_THRESHOLDS] | Numerical thresholds for cumulative risk score that trigger escalate, warn, or terminate decisions. | {"warn": 0.4, "escalate": 0.7, "terminate": 0.9} | Must contain warn, escalate, and terminate keys with float values between 0.0 and 1.0. Terminate must be greater than escalate, escalate greater than warn. Reject inverted thresholds. |
[TURN_RISK_SCORES] | Array of per-turn risk scores from the single-turn classifier, aligned with SESSION_HISTORY turns. | [0.1, 0.3, 0.65, 0.85] | Array length must match the number of user turns in SESSION_HISTORY. Each element must be a float between 0.0 and 1.0. Reject on length mismatch or out-of-range values. |
[OVERRIDE_AUTHORITY_LIST] | List of user roles or IDs authorized to override termination decisions, with required approval count. | ["admin", "safety-lead"] | Must be a non-empty array of strings. If empty, no overrides are permitted and the prompt must enforce termination without appeal path. |
[POST_TERMINATION_TEMPLATE] | Template for the user-facing closure message, with placeholders for policy citation and review reference. | "This conversation has been ended per policy {policy_id}. Reference: {review_id}" | Must contain at least {policy_id} and {review_id} placeholders. Validate template syntax before injection. Reject templates missing required placeholders. |
[REVIEW_QUEUE_ENDPOINT] | Identifier or URL for the review queue where termination packets are submitted for human audit. | "safety-review-queue-us-east" | Non-empty string. Validate against allowed queue identifiers if using an allowlist. Log all submissions with endpoint for traceability. |
Implementation Harness Notes
How to wire the Cumulative Risk-Aware Conversation Termination Prompt into a production safety platform with validation, retry, logging, and human override governance.
This prompt is not a standalone safety filter; it is a decision endpoint in a larger safety platform. It should be invoked after each user turn by a session-level orchestrator that maintains the full conversation history, the cumulative risk score vector, and the policy configuration. The orchestrator is responsible for assembling the prompt's required inputs—[SESSION_HISTORY], [CUMULATIVE_RISK_VECTOR], [POLICY_CONFIG], and [OVERRIDE_STATE]—from upstream detection systems and policy stores. The prompt's output is a structured termination decision that downstream enforcement logic acts upon, not a direct user-facing message.
Validation and Enforcement: The model's JSON output must pass a strict schema validator before any action is taken. If the termination_decision field is not one of the allowed enum values (terminate, warn, restrict_tools, continue), or if required fields like policy_justification are missing, the response is rejected. On validation failure, implement a single retry with the validation error message injected into the prompt's [PREVIOUS_ERROR] placeholder. If the retry also fails, escalate to a human reviewer and default to the safest action configured for the current risk tier (typically restrict_tools or terminate). Never default to continue on a failed validation.
Logging and Audit Trail: Log the full prompt payload, the raw model response, the validated decision, and the enforcement action taken. This log entry becomes the core of the post-termination review packet. Include a unique session_id and decision_id in every log. For terminate decisions, automatically generate a review ticket in your trust-and-safety queue with the logged evidence attached. This ensures that every automated termination is auditable and reversible by a human reviewer without requiring them to reconstruct the session from scratch.
Human Override Governance: The [OVERRIDE_STATE] input allows authorized human operators to pre-empt or reverse automated decisions. If an override is active (e.g., a safety analyst has marked a session as under_review or override_continue), the prompt must acknowledge this state and produce a decision that respects the override while still documenting what the automated system would have recommended. This dual-output pattern—
automated recommendation" vs. "effective decision"—preserves the audit trail and prevents the override from masking systemic failures in the risk scoring pipeline."
Model Choice and Latency: This prompt requires strong instruction-following and structured output reliability. Use a model with proven JSON mode or function-calling capabilities. Latency is critical because this decision gates the user's next interaction. If the model call exceeds a 2-second timeout, fall back to a cached risk-threshold decision matrix that maps the current [CUMULATIVE_RISK_VECTOR] to a pre-configured action. Log the timeout and fallback decision. Do not leave the user waiting indefinitely for a safety decision.
What to Avoid: Do not wire this prompt directly to a user-facing chat interface. The user_facing_closure_message field is a draft for review, not a message to send unmodified. Always route termination messages through a templating layer that can adjust tone, apply branding, and strip any internal rationale before display. Do not use this prompt for single-turn content moderation; it is designed for cumulative session risk and will produce false positives on isolated benign turns if used without the session risk vector context.
Expected Output Contract
Fields, data types, validation rules, and pass/fail conditions for the cumulative risk-aware conversation termination decision payload. Use this contract to validate model output before acting on a termination decision.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
termination_decision | enum: terminate | warn | continue | escalate | Must be one of four allowed values. If risk_score exceeds [TERMINATION_THRESHOLD], decision must be terminate or escalate. Reject any other string. | |
risk_score | number (0.0–1.0) | Must be a float between 0.0 and 1.0 inclusive. Parse check: reject non-numeric, null, or out-of-range values. Must be monotonically non-decreasing relative to prior turn risk_score in the same session. | |
risk_trajectory | enum: escalating | stable | decreasing | unknown | Must match one of four allowed values. If fewer than 2 scored turns exist, trajectory must be unknown. Reject on mismatch. | |
policy_violations | array of objects | Each object must contain policy_id (string), violation_turn (integer >= 1), severity (enum: low | medium | high | critical), and evidence_summary (string, max 500 chars). Empty array allowed if no violations detected. | |
termination_reason | string | true if termination_decision is terminate | Required when terminating. Must cite at least one policy_id from policy_violations array. Max 300 characters. Reject if present for non-termination decisions. |
user_facing_message | string | true if termination_decision is terminate | Required when terminating. Must not reveal internal policy thresholds, risk_score, or detection methods. Max 500 characters. Tone must be neutral and non-accusatory. |
review_packet | object | true if termination_decision is terminate or escalate | Must contain session_id (string), termination_turn (integer), full_risk_timeline (array of per-turn scores), and escalated_to (string: human_queue_id or null). Reject if missing required subfields. |
override_governance | object | If present, must contain overridden_by (string: operator_id), override_reason (string, max 300 chars), and original_decision (enum: terminate | warn | continue | escalate). Reject if override fields are incomplete. |
Common Failure Modes
What breaks first when cumulative risk-aware termination prompts run in production, and how to guard against false terminations, missed escalation, and audit gaps.
False Termination on Benign Multi-Step Workflows
What to watch: Legitimate complex user journeys (e.g., debugging a sensitive codebase, multi-step medical inquiry) accumulate risk scores that mimic adversarial probing patterns, triggering premature session termination. Guardrail: Implement a risk velocity dampener that distinguishes between slow, coherent topic exploration and rapid boundary pushing. Require at least one explicit policy warning before termination for non-critical risk categories.
Risk Score Drift Without Ground Truth Calibration
What to watch: The cumulative risk score increments correctly per turn but the baseline drifts over sessions, causing either increasingly aggressive termination or gradual threshold erosion. Guardrail: Anchor the risk score to a calibrated reference distribution using a golden dataset of labeled sessions. Run a calibration check every N sessions and trigger a human review if the score distribution shifts beyond a predefined KL divergence threshold.
Missed Escalation Due to Ambiguous Intent Accumulation
What to watch: The model fails to escalate when a user slowly pivots from a benign topic to a disallowed one, because each individual turn stays just below the single-turn classification threshold. Guardrail: Track topic trajectory vectors, not just turn-level scores. If the semantic distance from the initial topic crosses a predefined boundary, force a re-evaluation of the entire session intent before the cumulative score triggers.
Audit Trail Gaps in Termination Justification
What to watch: The termination decision is made but the evidence packet is incomplete, missing the specific turns that contributed most to the risk score or lacking policy citations for the final decision. Guardrail: Require a structured termination justification object that includes the top-K contributing turns, their individual risk vectors, and the specific policy clauses violated. Validate this object's completeness before executing the termination action.
Override Governance Bypass via Social Engineering
What to watch: An attacker, after termination, opens a new session and socially engineers a human reviewer into overriding the automated decision by providing a curated, benign-looking subset of the conversation. Guardrail: Tie every override request to the immutable session risk report. Require the reviewer to acknowledge the full risk timeline and flagged turns before granting an override. Log the reviewer's identity and timestamp immutably.
False Recovery Paths After Erroneous Termination
What to watch: A legitimate user is terminated and the provided recovery path is a generic support link, causing churn and failure to restore the session context. Guardrail: Generate a cryptographically signed recovery token that encodes the session state at termination. When the user appeals, the token allows a reviewer to restore the exact pre-termination context and resume the session without loss of work, after manual clearance.
Evaluation Rubric
Use this rubric to test the Cumulative Risk-Aware Conversation Termination Prompt before deployment. Each criterion targets a specific failure mode observed in production safety systems, including false termination, missed escalation, and justification quality.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Termination Accuracy at Threshold | Termination decision matches human-labeled ground truth for sessions crossing the defined cumulative risk threshold with >= 95% recall | Prompt fails to terminate when cumulative risk score exceeds [RISK_THRESHOLD] in labeled adversarial sessions | Run against golden dataset of 50+ sessions with known termination labels; measure recall and precision at threshold boundary |
False Positive Rate on Benign Complex Sessions | False termination rate below 2% on sessions containing legitimate multi-step requests, clarifications, and topic shifts | Prompt terminates session on benign sequences that include policy-adjacent vocabulary or legitimate probing for clarification | Test against curated benign session library with complex but policy-compliant interactions; count false terminations |
Justification Quality and Policy Grounding | Termination justification cites specific policy clauses from [POLICY_DOCUMENT] and references the turn(s) that triggered the breach | Justification uses vague language like 'violated safety policy' without citing which policy or which turn evidence | LLM-as-judge eval comparing justification against policy document; check for clause citation, turn reference, and specificity score >= 4/5 |
User-Facing Closure Message Appropriateness | Closure message is professional, non-inflammatory, and includes a clear reason without revealing internal risk scores or detection methods | Closure message leaks internal risk scores, uses accusatory language, or provides no actionable path for legitimate users | Human review panel rates closure messages on professionalism and information leakage; pass if >= 90% rated acceptable |
Post-Termination Review Packet Completeness | Review packet includes risk timeline, key evidence turns, policy citations, confidence score, and recommended reviewer actions | Review packet missing any required field: risk timeline, evidence turns, policy citations, or confidence score | Schema validation against [REVIEW_PACKET_SCHEMA]; automated check that all required fields are present and non-null |
Override Governance Adherence | Prompt respects [OVERRIDE_POLICY] when present: only authorized roles can override, and override reason is logged in review packet | Prompt accepts override from unauthorized role or fails to log override reason in review packet | Test with override requests from authorized and unauthorized roles; verify logging behavior matches policy |
False Termination Recovery Path | When [FALSE_TERMINATION_FLAG] is set, prompt generates a recovery message acknowledging the error and offering session resumption | Prompt ignores false termination flag, generates no recovery message, or recovery message is dismissive | Inject false termination flag into terminated session context; verify recovery message presence and tone via automated check |
Confidence Score Calibration | Termination confidence score correlates with human reviewer agreement: high-confidence terminations (>0.9) have >= 95% human agreement | High-confidence terminations are frequently overturned by human reviewers, indicating overconfidence | Compare confidence scores against human reviewer decisions on 100+ termination cases; measure calibration error |
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 simplified risk model. Replace the full policy matrix with a single [RISK_THRESHOLD] variable and a binary terminate/continue decision. Skip the post-termination review packet and user-facing closure message generation. Focus on getting the cumulative risk score calculation and termination trigger logic correct before adding governance layers.
Simplify the output schema to:
json{ "decision": "terminate" | "continue", "cumulative_risk_score": [SCORE], "primary_trigger_turn": [TURN_NUMBER] }
Watch for
- False positives on benign multi-step requests that happen to touch sensitive topics
- Score inflation when the same risk factor is double-counted across turns
- Missing the difference between a user exploring a topic legitimately and adversarial probing

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