This prompt is designed for AI engineers and platform teams who are building chat assistants, copilots, or support agents that must survive long-running sessions. The core job-to-be-done is a context window boundary handler: you have a transcript that is about to exceed the model's token limit, and you need to compress it into a structured, machine-readable state object before pruning the history. The ideal user is someone who already has a working multi-turn system and is now hitting production limits on context length, cost, or latency. You should have a complete transcript segment ready for compression, along with a defined output schema that your application can parse and inject into the next context window as a session state preamble.
Prompt
Structured Session Summary Prompt Template

When to Use This Prompt
Identify the exact production scenarios where structured session summarization solves a context window problem, and recognize the boundaries where it should not be applied.
Use this prompt when you need to persist resolved decisions, pending actions, open questions, and key facts across context window boundaries. It is particularly effective in task-oriented assistants where dropping a commitment or forgetting a user preference has a direct product consequence. For example, a customer support copilot that has gathered troubleshooting steps over 20 turns can use this prompt to produce a JSON summary containing the issue type, steps taken, and unresolved questions before the history is truncated. The output is designed to be injected into the next context window as a session_state object, allowing the model to continue without replaying the full history. This prompt assumes you have a complete transcript segment and a defined output schema; it does not make real-time decisions about when to summarize.
Do not use this prompt for real-time turn-by-turn dialogue state tracking. It is a summarization step, not a dialogue state tracker. If you need slot-filling, intent tracking, or immediate reference resolution, use a dedicated state management prompt from the Turn History and Dialogue State Tracking group instead. Additionally, do not use this prompt on partial or streaming transcripts; it requires a complete segment to produce a faithful summary. For high-risk domains such as healthcare or legal workflows, you must pair this prompt with a faithfulness verification step that compares the generated summary against the source transcript and flags any hallucinated facts or dropped critical information. The companion prompt 'Summary Faithfulness Verification Prompt' in this content group provides a ready-to-use evaluation harness for this purpose. If your session contains PII or sensitive data, ensure redaction occurs before the transcript reaches the model, or use a local deployment where data does not leave your environment.
Use Case Fit
Where this prompt works and where it does not. Use these cards to decide if the Structured Session Summary Prompt Template fits your production context.
Good Fit: Context Window Boundary Crossing
Use when: your chat assistant must persist session state across context window limits, model upgrades, or mid-session deployment restarts. The structured JSON output provides a machine-readable snapshot that can be re-injected as a prefix in the next context window. Avoid when: sessions are short enough to fit entirely within a single context window without compression.
Good Fit: Multi-Turn Task Completion
Use when: users complete complex tasks over many turns (10+), such as troubleshooting, configuration, or research. The prompt extracts resolved decisions, pending actions, and open questions so the assistant does not lose track of progress. Avoid when: interactions are single-turn Q&A or stateless commands where no session continuity is required.
Bad Fit: Real-Time Streaming Without Pause Points
Risk: triggering summarization mid-utterance or during rapid back-and-forth produces incomplete state snapshots that miss in-flight user intent. Guardrail: only invoke this prompt at natural conversation boundaries—after a task completes, when the user explicitly pauses, or when a context budget threshold is crossed. Use a separate trigger decision prompt to gate invocation.
Required Inputs: Full Transcript with Turn Metadata
Use when: you have the complete conversation transcript with speaker labels, timestamps, and turn boundaries. The prompt needs this to correctly attribute decisions, detect unresolved questions, and avoid hallucinating facts from adjacent but unrelated turns. Avoid when: you only have a partial or anonymized transcript that strips speaker identity or temporal ordering.
Operational Risk: Silent Factual Drift Over Multiple Summarization Cycles
Risk: when a summary is generated, then later used as input for the next summarization step, small errors compound. A hallucinated decision in cycle one becomes treated as ground truth in cycle two. Guardrail: always run a faithfulness verification prompt comparing the generated summary against the original transcript before storing it as canonical state. Flag summaries with any hallucinated claims for human review.
Operational Risk: Dropped Action Items in Long Sessions
Risk: the model may omit low-salience but binding commitments (e.g., 'I'll check and get back to you') when compressing a long session. Users later experience broken promises. Guardrail: pair this prompt with a dedicated action item extraction prompt that runs independently and cross-references against the summary output. Any action item present in the extraction but missing from the summary triggers a repair loop.
Copy-Ready Prompt Template
A production-ready prompt for generating structured JSON session summaries that can be directly integrated into your chat application's context management pipeline.
This prompt template is designed to be copied directly into your application code. It instructs the model to analyze a full conversation transcript and produce a structured JSON summary capturing resolved decisions, pending actions, open questions, and key facts. The output is intended for machine consumption—serialized into your session store, passed to downstream agents, or used to prime the system prompt when the context window resets. Before using this template, ensure you have a complete transcript and have defined your token budget for the summary itself.
textSystem: You are a precise session summarization engine. Your task is to read the provided conversation transcript and produce a structured JSON summary. The summary must be factually grounded in the transcript only. Do not infer, assume, or embellish information not explicitly present. Input Transcript: [FULL_TRANSCRIPT] Output Schema: { "session_id": "[SESSION_ID]", "summary_created_at": "[CURRENT_TIMESTAMP]", "participants": [ { "role": "user | assistant | system", "identifier": "[PARTICIPANT_ID]" } ], "resolved_decisions": [ { "decision": "[CLEAR_DECISION_TEXT]", "agreed_by": ["[PARTICIPANT_ID]"], "evidence_turn_ids": ["[TURN_ID]"] } ], "pending_actions": [ { "action": "[ACTION_DESCRIPTION]", "owner": "[PARTICIPANT_ID | 'unassigned']", "deadline": "[DEADLINE_IF_MENTIONED | null]", "status": "pending | in_progress", "source_turn_id": "[TURN_ID]" } ], "open_questions": [ { "question": "[QUESTION_TEXT]", "asked_by": "[PARTICIPANT_ID]", "status": "unanswered | partially_answered", "source_turn_id": "[TURN_ID]" } ], "key_facts": [ { "fact": "[FACT_STATEMENT]", "stated_by": "[PARTICIPANT_ID]", "source_turn_id": "[TURN_ID]" } ], "conversation_summary": "[DENSE_1-3_SENTENCE_SUMMARY]", "unresolved_conflicts": [ { "description": "[CONFLICT_DESCRIPTION]", "conflicting_turn_ids": ["[TURN_ID]", "[TURN_ID]"] } ] } Constraints: [CONSTRAINTS] - Only extract information explicitly stated in the transcript. - If a category has no items, return an empty array. - Use the exact turn IDs provided in the transcript. - Do not alter the wording of decisions, facts, or questions unless necessary for clarity; preserve original meaning. - The conversation_summary field must not introduce new information. Examples of Good Extraction: [FEW_SHOT_EXAMPLES] Risk Level: [RISK_LEVEL]
To adapt this template for your application, replace the square-bracket placeholders with concrete values. [FULL_TRANSCRIPT] should contain the entire conversation, with each turn prefixed by a unique [TURN_ID] and the participant's role. [CONSTRAINTS] can be extended with domain-specific rules, such as 'prioritize safety-related decisions' or 'flag any mention of a legal agreement.' The [FEW_SHOT_EXAMPLES] placeholder is critical for production reliability—provide at least two examples of correctly extracted summaries from representative transcripts to anchor the model's behavior. Set [RISK_LEVEL] to high if the summary will drive automated actions (e.g., creating tickets, sending emails) and low if it is only for human review. For high-risk deployments, always run the output through a schema validator and a faithfulness verification step before acting on the extracted actions.
Prompt Variables
Required inputs for the Structured Session Summary Prompt Template. Each placeholder must be populated before the prompt is sent to the model. Validation notes describe how to verify the input is well-formed before execution.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[SESSION_TRANSCRIPT] | Full conversation transcript to summarize, including speaker labels and timestamps | USER: I need to cancel my order. ASSISTANT: I can help with that. Can you provide your order number? USER: It's ORD-8821. | Must contain at least 2 turns. Check that speaker labels are consistent. Reject if transcript is empty or contains only one participant. |
[SUMMARY_SCHEMA] | JSON schema defining the required output structure for the summary | {"resolved_decisions": [], "pending_actions": [], "open_questions": [], "key_facts": []} | Must be valid JSON Schema or a JSON example object. Parse check before prompt assembly. Reject if schema contains circular references or undefined required fields. |
[MAX_OUTPUT_TOKENS] | Token budget for the generated summary to enforce conciseness | 800 | Must be a positive integer. Validate range: 200-2000 for typical session summaries. Warn if budget exceeds 50% of transcript token count. |
[SESSION_METADATA] | Context about the session: session ID, start time, user ID, channel, and any prior summary if this is a continuation | {"session_id": "sess-441", "start_time": "2025-01-15T14:30:00Z", "user_id": "usr-992", "channel": "chat"} | Parse as JSON. Require session_id and start_time fields. user_id is optional but recommended. If prior_summary is present, validate it conforms to [SUMMARY_SCHEMA]. |
[DOMAIN_TERMINOLOGY] | Optional glossary of domain-specific terms, entity names, or product references to preserve accurately in the summary | {"ORD": "order number prefix", "SKU": "stock keeping unit", "RMA": "return merchandise authorization"} | If provided, must be a valid JSON object mapping term to definition. Null allowed. When present, use for exact-match verification of key terms in output. |
[PRIORITY_WEIGHTS] | Optional weights for salience scoring: decision_importance, action_urgency, question_openness, fact_centrality | {"decision_importance": 0.9, "action_urgency": 0.8, "question_openness": 0.7, "fact_centrality": 0.6} | If provided, all values must be floats between 0.0 and 1.0. Null allowed. When absent, use default equal weighting. Validate sum does not need to equal 1.0. |
[CONFIDENCE_THRESHOLD] | Minimum confidence score for including an extracted item in the summary. Items below threshold are omitted or marked uncertain | 0.7 | Must be a float between 0.0 and 1.0. Default 0.5 if not specified. Lower values increase recall but risk hallucination. Higher values increase precision but risk omission. |
Implementation Harness Notes
How to wire the Structured Session Summary prompt into a production application with validation, retries, and state management.
The Structured Session Summary prompt is designed to be called at a defined trigger point—typically when the conversation context window reaches a threshold (e.g., 80% of the model's limit) or when a session is explicitly paused. The application layer is responsible for assembling the full transcript, injecting it into the [FULL_TRANSCRIPT] placeholder, and providing the [OUTPUT_SCHEMA] as a strict JSON schema. Do not rely on the model to remember the schema from a system prompt; always include the schema inline in the user message or as a structured output constraint via the API's native JSON mode. The model should be instructed to output only the JSON object with no surrounding text or markdown fences.
After receiving the model's response, the application must run a validation pass before accepting the summary as the new session state. First, parse the JSON and validate it against the expected schema—reject any output missing required fields like resolved_decisions, pending_actions, or open_questions. Second, run a faithfulness check: for each claim in the summary, verify it has a corresponding span in the original transcript. A lightweight approach is to use a second LLM call with the Summary Faithfulness Verification Prompt from this pillar, but a deterministic check for hallucinated entity names or dates can catch common failures faster. If validation fails, retry the summarization call once with the error message appended to the prompt, instructing the model to correct the specific violation. If the retry also fails, log the raw transcript and the failed summary for human review and fall back to retaining the full transcript with a truncation warning.
The validated summary must be persisted as the new canonical session state, replacing the full transcript in the active context window. Store the full transcript in cold storage for audit and future fine-tuning data preparation. The application should also update the session's metadata with the summary timestamp, the compression ratio achieved, and the count of pending actions and open questions. This metadata enables downstream monitoring: track the average compression ratio over time to detect drift in summarization aggressiveness, and alert if the count of open questions grows monotonically across summaries, indicating the assistant is failing to resolve user queries. Wire the pending_actions and open_questions fields into the next turn's system prompt so the assistant can proactively re-surface unresolved items without requiring the user to repeat them.
For model choice, prefer models with strong instruction-following and JSON mode support. GPT-4o and Claude 3.5 Sonnet are reliable defaults for this task. If using a smaller model for cost reasons, increase the validation strictness and consider adding few-shot examples of correctly formatted summaries to the prompt. Avoid using this prompt on models without native JSON mode unless you implement a robust JSON extraction and repair layer. For high-stakes domains like healthcare or finance, always route failed validations to a human review queue and never auto-commit a summary that failed faithfulness checks. The summary is the system's memory; a corrupted summary will poison every subsequent turn.
Expected Output Contract
Define the exact JSON schema the model must return. Use this contract to build a server-side validator before the summary enters your state store.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
session_id | string (UUID) | Must match the [SESSION_ID] input exactly; reject on mismatch. | |
summary_timestamp | string (ISO 8601) | Parse as datetime; must be within 5 minutes of server clock. | |
resolved_decisions | array of objects | Each object requires 'decision' (string), 'resolved_at_turn' (int), and 'evidence' (string). Array must not be null. | |
pending_actions | array of objects | Each object requires 'action' (string), 'owner' (string or null), and 'source_turn' (int). Empty array is valid. | |
open_questions | array of strings | Each string must be a non-empty interrogative sentence. Empty array is valid. | |
key_facts | array of objects | Each object requires 'fact' (string) and 'last_mentioned_turn' (int). Fact must be verifiable against [TRANSCRIPT]. | |
summary_text | string | Length must be <= [MAX_SUMMARY_TOKENS] tokens. Must not introduce facts absent from [TRANSCRIPT]. | |
stale_context_flags | array of strings | If present, each string must reference a specific turn ID from [TRANSCRIPT] where context appears superseded. |
Common Failure Modes
Structured session summaries fail in predictable ways. These are the most common production failure modes and the specific guardrails that catch them before they corrupt downstream state.
Hallucinated Decisions
What to watch: The summary invents a decision, commitment, or user preference that never appeared in the transcript. This is the highest-risk failure because downstream agents and humans act on fabricated facts. Guardrail: Run a faithfulness verification pass that compares each extracted decision against the source transcript and flags unsupported claims. Require explicit turn references for every decision in the output schema.
Dropped Action Items
What to watch: Implicit or low-salience action items are omitted from the summary, especially when the user phrased them as statements rather than explicit requests. The assistant forgets to follow up and the user perceives the system as unreliable. Guardrail: Add a completeness check that scans the transcript for commitment language ('I will', 'we need to', 'let's') and cross-references against extracted action items. Flag any unmatched commitments for human review or re-extraction.
Stale Fact Propagation
What to watch: A user corrects a fact mid-session, but the summary retains the original incorrect statement alongside the correction, or worse, omits the correction entirely. Downstream turns use invalidated context. Guardrail: Implement a conflict detection step that identifies when a later turn contradicts an earlier fact. Mark superseded facts explicitly in the summary with a superseded_by field and timestamp. Never include both versions without indicating which is current.
Open Question Amnesia
What to watch: The user asks a question that the assistant defers or cannot answer immediately. The summary omits the unresolved question, and it is never re-surfaced. The user must repeat themselves or the need goes unmet. Guardrail: Maintain a dedicated open_questions array in the summary schema. Require every question that was not explicitly answered to appear with its originating context. Add a staleness check that deprioritizes questions the user has implicitly abandoned after N turns without re-reference.
Over-Compression Information Loss
What to watch: Aggressive summarization to meet a tight token budget strips out nuance, conditional logic, or edge-case details that are critical for correct downstream behavior. The summary is technically faithful but functionally useless. Guardrail: Use a salience scoring pass before compression. Score each turn on decision relevance, factual density, and future utility. Only compress or drop turns below a defined threshold. Validate the compressed output against a minimum information preservation score using an LLM judge.
Schema Drift and Missing Required Fields
What to watch: The model produces valid JSON but omits required fields, uses wrong types, or nests objects incorrectly when the transcript is long or complex. Downstream parsers break silently. Guardrail: Validate the output against the expected JSON schema immediately after generation. On validation failure, run a targeted repair prompt that provides the schema, the validation error, and the original transcript. If repair fails after one retry, escalate to a human reviewer rather than passing partial state forward.
Evaluation Rubric
Use this rubric to test the quality of a generated session summary before shipping it to production. Each criterion targets a specific failure mode common in structured summarization.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Schema Compliance | Output is valid JSON matching the [OUTPUT_SCHEMA] exactly; all required fields are present and non-null where specified. | JSON parse error, missing required field, or null value in a non-nullable field. | Automated schema validation against the target JSON Schema definition. |
Factual Faithfulness | All resolved decisions, key facts, and action items in the summary are directly supported by the [TRANSCRIPT]. | A claim in the summary cannot be mapped to a specific turn in the transcript; hallucinated resolution or fact. | LLM-as-judge pairwise check: for each summary claim, verify a supporting quote exists in the source transcript. |
Action Item Completeness | All explicit and strongly implied action items from the [TRANSCRIPT] are captured in the pending_actions array. | An action item mentioned in the transcript is missing from the summary; no false positives added. | Human-annotated golden set comparison: recall >= 0.95, precision >= 0.90 against labeled action items. |
Open Question Tracking | All unresolved questions from the [TRANSCRIPT] appear in the open_questions array with their originating context. | A user question left unanswered in the transcript is absent from the summary; a resolved question is incorrectly marked open. | Automated diff: extract all question marks from transcript, cross-reference with open_questions list. |
Stale Context Handling | Facts explicitly corrected or superseded in the [TRANSCRIPT] are omitted or marked as superseded in the summary. | A corrected fact appears as a current key_fact without a superseded flag. | Targeted test cases with mid-session corrections; verify the old fact is not present in the active facts list. |
Conciseness vs. Token Budget | Summary fits within the [MAX_OUTPUT_TOKENS] budget while preserving all critical information defined in the schema. | Summary exceeds token budget, or critical information is dropped to meet budget. | Token count check; spot-check that all required schema fields contain substantive, non-truncated values. |
Correction Cascade Integrity | When a user correction invalidates a prior conclusion, dependent conclusions are re-evaluated and not carried forward blindly. | A decision based on a corrected fact remains in the resolved_decisions list without revision. | Test with a multi-step reasoning scenario where step 1 is corrected; verify step 2's conclusion updates accordingly. |
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 frontier model (GPT-4o, Claude 3.5 Sonnet). Remove the strict JSON schema enforcement and replace it with a looser instruction: "Return a JSON object with these approximate fields." Skip the eval harness and manually spot-check 5-10 summaries against transcripts.
Watch for
- Missing fields when the transcript is short or the conversation ends abruptly
- The model inventing "pending actions" that were never discussed
- Overly verbose
key_factsarrays that bloat rather than compress

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