This prompt is designed for RAG system operators and AI engineers who manage long-running chat or copilot sessions where the full conversation history exceeds the model's context window. The core job-to-be-done is to produce a lossy, structured compression of a dialogue that preserves resolved questions, outstanding items, key facts, and user intent. The ideal user is someone integrating this into a context assembly pipeline—they need a summary that can be injected into future turns as a stable, high-signal prefix without breaking citation chains or introducing hallucinated facts. You should use this prompt when a session has more than 10-15 turns, when token budgets are tight, or when you need to checkpoint state before a context window reset.
Prompt
Session Summarization Prompt for Long Conversations

When to Use This Prompt
Define the job, ideal user, and constraints for the session summarization prompt.
Do not use this prompt for short conversations where the full history fits comfortably in context; the compression overhead and risk of information loss outweigh the benefit. It is also unsuitable for real-time streaming applications where latency is critical, as summarization adds a non-trivial processing step. The prompt assumes you have access to the full conversation transcript and any previously generated summaries. It does not perform retrieval or answer questions—it only compresses existing dialogue. If your system requires evidence re-retrieval after summarization, pair this with a stale context expiration check. The output must be treated as a lossy artifact; always preserve the original transcript for audit trails and debugging.
Before implementing this prompt, define your compression ratio target and the specific information categories your application cannot lose—such as user PII, unresolved action items, or source citations. Build eval checks that compare answer quality with and without the summary injected into context. Test for information preservation by asking the model questions about facts from the compressed portion of the conversation and measuring recall. The next step is to wire this prompt into your context assembly harness with validation that the output schema is respected and that no hallucinated turns appear in the summary.
Use Case Fit
Where the Session Summarization Prompt works, where it fails, and what you must provide before deploying it in a production RAG system.
Good Fit: Long Multi-Turn Sessions
Use when: conversations exceed 20 turns and the context window cannot hold the full history. Guardrail: set a minimum turn threshold before triggering summarization to avoid unnecessary compression on short sessions.
Bad Fit: Real-Time Streaming
Avoid when: the system must respond with zero added latency. Summarization adds a non-trivial inference step. Guardrail: run summarization asynchronously after the assistant's response is sent, or gate it behind a session-end event.
Required Input: Structured Turn History
Risk: the prompt fails silently if fed raw, unstructured logs. Guardrail: require a pre-processed array of turns with role, content, and resolved fields. Validate the schema before calling the summarization prompt.
Operational Risk: Silent Fact Omission
What to watch: the summary drops a critical fact that a future turn depends on, causing a downstream answer to be wrong. Guardrail: implement a post-summarization eval that checks if key entities from the original turns are present in the summary.
Bad Fit: Single-Turn Q&A
Avoid when: the system handles isolated questions with no conversational state. Guardrail: bypass summarization entirely for single-turn interactions. Use a turn counter to gate the summarization step.
Required Input: Compression Ratio Target
Risk: the summary is either too verbose to save tokens or too compressed to be useful. Guardrail: pass an explicit [COMPRESSION_RATIO] parameter and validate the output token count against the input token count before injecting the summary into the next context window.
Copy-Ready Prompt Template
A reusable prompt template for compressing long RAG conversations into structured session summaries that preserve resolved questions, outstanding items, and key facts for future context windows.
This prompt template produces a structured session summary from a long conversation transcript and its associated RAG evidence. It is designed to be injected into future context windows so the assistant can maintain continuity without carrying the full conversation history. The template uses square-bracket placeholders that you replace with actual values before each call. Every placeholder represents a variable your application layer must supply—do not leave them unresolved in production requests.
codeYou are a session summarization system for a RAG assistant. Your task is to compress a long conversation into a structured summary that preserves essential information for future context windows. ## INPUT ### Conversation Transcript [CONVERSATION_TRANSCRIPT] ### Previously Retrieved Evidence (if any) [RETRIEVED_EVIDENCE] ### Prior Session Summary (if any) [PRIOR_SESSION_SUMMARY] ## OUTPUT SCHEMA Return a JSON object with the following structure: { "session_id": "[SESSION_ID]", "summary_timestamp": "[CURRENT_TIMESTAMP]", "resolved_questions": [ { "question": "string", "answer_summary": "string", "source_citations": ["citation_id_1", "citation_id_2"], "resolution_confidence": "high|medium|low" } ], "outstanding_items": [ { "item": "string describing unresolved question or task", "reason_unresolved": "insufficient_evidence|user_deferred|clarification_needed|out_of_scope", "partial_progress": "string or null" } ], "key_facts_established": [ { "fact": "string", "source": "citation_id or 'user_stated'", "relevance": "high|medium|low" } ], "user_intent_summary": "string describing the user's overall goal and any shifts in intent", "conversation_turns_summarized": <integer>, "compression_notes": { "original_turns": <integer>, "summarized_turns": <integer>, "information_loss_risk": "low|medium|high", "dropped_topics": ["string"] or [] } } ## CONSTRAINTS [CONSTRAINTS] ## INSTRUCTIONS 1. Read the full conversation transcript and any prior session summary. 2. Identify which questions have been definitively answered with cited evidence. 3. Identify which questions remain unresolved and why. 4. Extract key facts that were established during the conversation, noting their source. 5. Summarize the user's overall intent and any topic shifts. 6. Count the conversation turns and note any information that could not be preserved. 7. If a prior session summary exists, merge it with new information rather than duplicating. 8. Do not fabricate answers or citations. If evidence is missing, mark the item as unresolved. 9. Keep the summary concise but complete. Prefer precision over brevity. 10. Return ONLY the JSON object. No markdown fences, no commentary. ## EXAMPLES [EXAMPLES]
Adapting the template: Replace [CONVERSATION_TRANSCRIPT] with the full dialogue history, including user messages, assistant responses, and any tool outputs. [RETRIEVED_EVIDENCE] should contain the passages that were retrieved during the session, with their citation IDs preserved. [PRIOR_SESSION_SUMMARY] is optional—pass null or an empty object if this is the first summarization. The [CONSTRAINTS] placeholder lets you inject domain-specific rules such as maximum summary length, required fields, or compliance requirements. [EXAMPLES] should contain one or two few-shot examples showing correct output format for your domain.
Validation and risk: After the model returns the JSON, validate that resolved_questions entries include source citations and that outstanding_items have a non-empty reason_unresolved field. For high-stakes domains such as healthcare or legal, route summaries with information_loss_risk: "high" to human review before they enter the next context window. Track compression ratio (summarized_turns / original_turns) over time—if it drops below 0.3, your summary may be too lossy and you should increase the token budget or adjust the constraints. Always log the summary alongside the original transcript for auditability.
Prompt Variables
Required and optional inputs for the session summarization prompt. Each variable must be validated before injection to prevent context corruption and ensure reliable compression.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[CONVERSATION_HISTORY] | Full transcript of the multi-turn session to summarize, including user messages, assistant responses, and any system or tool messages | USER: What's the latency p99 for service A?\nASSISTANT: Based on the dashboard, p99 latency is 245ms [source: metrics-dashboard].\nUSER: And how does that compare to last week? | Must be non-empty string. Validate minimum 2 turns present. Check for proper role labeling (USER, ASSISTANT, SYSTEM, TOOL). Strip any PII before injection. Max 32K tokens; truncate oldest turns first if exceeded. |
[SESSION_METADATA] | Structured object containing session identifiers, timestamps, user context, and any pre-existing session state | {"session_id": "sess-9a3f2", "start_time": "2025-03-15T14:30:00Z", "user_role": "developer", "prior_summary": null} | Must be valid JSON object. Required fields: session_id (string), start_time (ISO 8601). Optional fields: user_role, prior_summary, topic_tags. Reject if session_id is missing or empty. Parse check before injection. |
[SUMMARY_SCHEMA] | JSON schema or structured format definition that constrains the output shape of the summary | {"resolved_questions": [{"question": "string", "answer": "string", "sources": ["string"]}], "outstanding_items": ["string"], "key_facts": ["string"], "compression_ratio": "float"} | Must be valid JSON Schema or TypeScript interface definition. Validate parseable as schema. Required top-level fields: resolved_questions, outstanding_items, key_facts. Reject schemas that allow unbounded arrays without maxItems constraint. |
[MAX_SUMMARY_LENGTH] | Token or word budget for the compressed summary output | 2048 | Must be positive integer. Validate range 256-4096 tokens. Reject values below 256 (insufficient for meaningful summary) or above 8192 (defeats compression purpose). Convert string inputs to integer and validate. |
[COMPRESSION_TARGET] | Desired compression ratio as a percentage of original conversation length | 0.15 | Must be float between 0.05 and 0.50. Validate as number, not string. Reject targets below 0.05 (risk of information loss) or above 0.50 (insufficient compression). Default to 0.20 if not specified. |
[PRIORITY_WEIGHTS] | Optional object defining which conversation elements to prioritize during compression | {"unresolved_questions": 0.9, "key_decisions": 0.8, "small_talk": 0.1, "tool_outputs": 0.6} | Must be valid JSON object if provided. All weight values must be floats between 0.0 and 1.0. Sum of weights need not equal 1.0. Validate no negative values. Null allowed if using default equal weighting. |
[OUTPUT_FORMAT] | Specification for whether the summary should be plain text, markdown, or structured JSON matching the summary schema | json | Must be one of: 'json', 'markdown', 'plain_text'. Case-insensitive validation. Default to 'json' if not specified. Reject unknown format strings. When 'json' selected, validate that [SUMMARY_SCHEMA] is also provided. |
[FAILURE_MODE_INSTRUCTIONS] | Instructions for how the summarizer should handle edge cases: empty conversations, single-turn sessions, or conversations with only tool calls | If conversation has fewer than 3 turns, return the full conversation as summary with compression_ratio of 1.0. If no questions were asked, set resolved_questions to empty array. | Must be non-empty string if provided. Validate minimum 20 characters. Null allowed if using default failure mode behavior. Check for contradictory instructions against [SUMMARY_SCHEMA] constraints. Human review required for custom failure modes in production. |
Implementation Harness Notes
How to wire the session summarization prompt into a production RAG application with validation, retries, and context budget controls.
The session summarization prompt is not a standalone feature; it is a context management utility that runs as a background step inside a multi-turn RAG application. Its job is to compress a long conversation history into a structured summary that can be injected into future context windows, preserving resolved questions, outstanding items, and key facts while discarding redundant turns. The implementation harness must treat this prompt as a deterministic pipeline stage with measurable success criteria: information preservation rate, compression ratio, and downstream answer quality after summary injection.
Wire the prompt into your application as a scheduled or threshold-triggered step. When the conversation token count exceeds a configured limit (e.g., 80% of the model's context window), extract the full dialogue history and pass it to the summarization prompt along with a structured output schema. Validate the returned JSON for required fields such as resolved_items, outstanding_questions, key_facts, and compression_metadata. If validation fails, retry once with a stricter schema reminder in the prompt. Log every summary generation event with the input token count, output token count, compression ratio, and validation status for observability. For high-stakes domains, route summaries flagged with low confidence or missing fields to a human review queue before they enter the active context window.
Model choice matters here. Use a model with strong instruction-following and structured output capabilities for the summarization step, even if your primary RAG model is different. The summary must be injected into subsequent turns as a system-level context block, clearly demarcated from live retrieved evidence and the current user query. Never allow the summary to silently overwrite or contradict freshly retrieved passages. Implement a stale-summary check: if the summary is more than N turns old or the user has explicitly corrected information contained in it, trigger a re-summarization. Avoid the temptation to summarize too aggressively; a summary that drops critical unresolved questions will silently degrade answer quality across future turns, and this failure mode is hard to detect without explicit eval checks on downstream answer accuracy.
Common Failure Modes
Session summarization prompts fail in predictable ways. These are the most common failure modes when compressing long conversations for RAG context windows, along with practical mitigations.
Resolved Questions Reappear as Active
What to watch: The summary treats questions that were definitively answered and acknowledged by the user as still open. This bloats the summary with stale items and causes downstream retrieval to pull irrelevant evidence. Guardrail: Add an explicit instruction to mark each item as resolved or outstanding, and include a post-processing check that removes any resolved item still tagged as active.
Key Facts Detached from Their Sources
What to watch: The summary extracts factual claims but drops the citation or source document reference. Downstream turns then treat these as ground truth without any way to verify or re-retrieve the original evidence. Guardrail: Require every fact in the summary to carry a source reference, even if compressed. Validate the output by checking that fact-to-source ratios match between the original conversation and the summary.
Compression Ratio Achieved at the Cost of Distinction
What to watch: The summary hits the target token budget but collapses distinct user questions into vague categories like 'the user asked about pricing.' This loses the specific intent needed for accurate follow-up retrieval. Guardrail: Test for semantic preservation by running the original questions and the summary's question descriptions through an embedding similarity check. Flag summaries where similarity drops below a defined threshold.
User Corrections Are Summarized as Final Answers
What to watch: When a user corrects a previous AI response, the summary records the corrected fact but drops the fact that a correction occurred. This erases the error signal and prevents the system from learning or escalating. Guardrail: Add a dedicated 'Corrections and Revisions' section to the summary schema. Require the prompt to explicitly log the original claim, the correction, and the turn where it happened.
Outstanding Items Silently Dropped
What to watch: The model prioritizes narrative coherence and drops open questions, unfulfilled user requests, or pending clarifications that don't fit a clean summary arc. These lost items break continuity in later turns. Guardrail: Use a structured output schema with a required outstanding_items array. Add a post-generation validator that counts the number of open questions in the original turns and compares it to the summary's outstanding count.
Temporal Ordering Collapses into Topic Grouping
What to watch: The summary reorganizes the conversation by topic rather than preserving the chronological sequence. This destroys the causal chain—why the user asked a follow-up, what evidence changed their mind, and when corrections occurred. Guardrail: Instruct the prompt to preserve turn order within each topic group and include turn indices. Validate by checking that the summary's event sequence is topologically consistent with the original conversation log.
Evaluation Rubric
Use this rubric to test the quality of session summaries before injecting them into future context windows. Each criterion targets a specific failure mode in long-conversation compression.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Resolved Question Completeness | All questions marked as resolved in the conversation are present in the summary with their final answers | A resolved question is missing from the summary or its answer is truncated | Diff the list of resolved questions from the full transcript against the summary output; flag any missing |
Outstanding Item Preservation | All unanswered questions, pending action items, and user requests not yet fulfilled appear in the outstanding section | An open question from turn 3 is absent from the summary while a less important detail is included | Maintain a running list of unresolved items during the conversation; assert all appear in the summary |
Key Fact Accuracy | Every factual statement in the summary can be directly attributed to a specific turn in the source conversation | The summary states a user preference that was never expressed or contradicts the transcript | For each factual claim in the summary, require a citation to a turn number; flag unsupported claims |
Compression Ratio Target | Summary token count is between 15% and 30% of the original conversation token count | Summary exceeds 40% of original length or drops below 10% with information loss | Calculate token counts for full transcript and summary; assert ratio falls within [0.15, 0.30] |
Entity and Identifier Stability | All named entities, product names, ticket IDs, and user references match the original conversation exactly | A ticket ID is truncated, a product name is paraphrased incorrectly, or a person reference is ambiguous | Extract all capitalized entities and identifiers from both transcript and summary; assert exact string match |
Temporal Sequence Integrity | The chronological order of events, decisions, and questions is preserved in the summary | A decision made in turn 7 appears before a question asked in turn 3 in the summary timeline | Map each summary event to its source turn number; assert turn numbers are monotonically increasing |
Ambiguity and Uncertainty Retention | Hedged statements, user uncertainty, and model confidence caveats from the original conversation are preserved | A user's tentative preference is summarized as a firm decision without the original hedging language | Search summary for hedging terms from the transcript; assert they appear or are explicitly noted as resolved |
Irrelevant Detail Exclusion | No small talk, greetings, repeated information, or conversational filler appears in the summary | The summary includes 'How are you?' from turn 1 or repeats the same fact across multiple sections | Manual review of summary for non-substantive turns; automated check for duplicate sentences within summary |
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 prompt and a single long conversation transcript. Remove strict output schema requirements initially. Use a simple instruction: "Summarize this conversation. Include resolved questions, outstanding items, and key facts." Test with 3-5 conversations of varying length before adding constraints.
Watch for
- Summary length growing with input length instead of compressing
- Missing outstanding items when the conversation ends mid-topic
- Key facts extracted without source turn references
- No compression ratio measurement in place

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