This prompt is designed for investigative RAG systems that must reconstruct a causal chain of events from fragmented evidence across multiple documents. It is built for root cause analysis, incident postmortems, fraud investigation, and any workflow where understanding why something happened is more important than retrieving a single fact. The prompt instructs the model to distinguish correlation from causation, assign confidence levels to each causal link, and produce a directed causal graph or narrative with explicit source grounding. Use this when your system needs to answer questions like 'What sequence of failures led to the outage?' or 'What chain of events caused the supply chain disruption?' rather than simple factoid questions. This prompt assumes you have already retrieved a set of potentially relevant documents and need the model to synthesize a causal structure from them.
Prompt
Causal Chain Reconstruction Prompt from Retrieved Context

When to Use This Prompt
Defines the ideal use case, required inputs, and boundaries for the Causal Chain Reconstruction prompt in investigative RAG systems.
The ideal user is an AI engineer or product team building a system where the cost of a wrong causal attribution is high. This includes site reliability engineers conducting postmortems, fraud analysts reconstructing transaction sequences, or supply chain operators diagnosing disruption root causes. The prompt requires a specific set of inputs: a clear causal question, a set of retrieved documents that contain timestamped events or causal statements, and a defined output schema for the causal graph. Without timestamped or causally-linked evidence in the retrieved context, the model will be forced to speculate, which defeats the purpose. You must also provide explicit constraints that prevent the model from inventing causal links not present in the source material.
Do not use this prompt for simple fact retrieval, summarization, or single-hop Q&A. If the user's question can be answered by extracting a single span of text, a standard RAG answer prompt is more appropriate and less expensive. Avoid this prompt when the retrieved documents lack temporal information or explicit causal language; the model will produce a plausible-sounding but unsupported narrative. In high-risk domains like healthcare or legal investigation, the output of this prompt is a starting point for human analysis, not a final conclusion. Always pair this prompt with a validation harness that checks whether each causal link in the output is directly supported by at least one cited source passage. The next section provides the copy-ready template you can adapt for your own retrieval pipeline.
Use Case Fit
Causal chain reconstruction works well for investigative and root-cause analysis but fails silently when evidence is sparse or correlation is mistaken for causation. These cards define where to apply it and where to pull back.
Strong Fit: Root Cause Analysis
Use when: Fragmented evidence across incident reports, logs, or postmortems must be assembled into a single causal narrative. Guardrail: Require explicit source grounding for every causal link. Flag links based on temporal proximity alone as speculative.
Strong Fit: Multi-Document Investigation
Use when: A single conclusion depends on facts distributed across separate documents that no single passage contains. Guardrail: Validate that each hop in the chain cites a distinct source. Reject chains where all evidence comes from one document unless the question is single-document by design.
Poor Fit: Sparse or Low-Quality Evidence
Avoid when: Retrieved context contains only one or two relevant passages, or documents are low-credibility. Guardrail: Set a minimum evidence threshold before attempting reconstruction. If fewer than three distinct, relevant passages exist, return an abstention with a gap report instead of a forced chain.
Poor Fit: Real-Time or Latency-Sensitive Applications
Avoid when: The system must respond in under two seconds or the retrieval corpus is too large for multi-hop traversal. Guardrail: Use a lightweight classifier to detect multi-hop intent first. Route simple lookups to a single-shot RAG prompt; reserve causal reconstruction for async or batch workflows.
Required Inputs
What you need: A user question implying causation, plus a set of retrieved documents with timestamps or sequence metadata. Guardrail: If temporal metadata is missing, instruct the model to mark ordering as uncertain and request it in the output schema. Never let the model invent event order from document order alone.
Operational Risk: Hallucinated Causality
What to watch: The model confidently asserts causation where only correlation exists, especially with emotionally charged or high-stakes topics. Guardrail: Add a mandatory confidence field per causal link. Require human review for any link scored below 'high confidence' before the output reaches a decision-maker.
Copy-Ready Prompt Template
A reusable prompt for reconstructing causal event chains from fragmented evidence, distinguishing correlation from causation.
This prompt template is designed for root cause analysis and investigative RAG workflows where you need to assemble a coherent causal narrative from evidence scattered across multiple documents. It forces the model to distinguish between correlation and causation, assign confidence levels to each link in the chain, and produce a structured output suitable for downstream processing or human review. Replace each square-bracket placeholder with your specific inputs before sending to the model. The template is model-agnostic but assumes you have already retrieved relevant context chunks and assembled them into the [RETRIEVED_CONTEXT] variable.
textYou are an investigative analyst reconstructing causal chains from retrieved evidence. Your task is to identify a sequence of events where each event causally contributes to the next, producing a directed causal graph or narrative. You must distinguish correlation from causation and assign confidence levels based on evidence strength. ## INPUTS ### Retrieved Context
[RETRIEVED_CONTEXT]
code### Investigation Question [INVESTIGATION_QUESTION] ### Output Schema You must produce valid JSON matching this schema: ```json { "causal_chain": [ { "step_id": "string (e.g., 'C1', 'C2')", "event_description": "string (concise description of what occurred)", "timestamp": "string or null (when this event occurred, if known)", "source_passages": ["string (exact quote or passage ID from context)"], "causal_relationship_to_next": { "mechanism": "string (how this event caused the next: 'direct cause', 'contributing factor', 'necessary precondition', 'triggering event')", "confidence": "high | medium | low", "evidence_summary": "string (brief justification for the causal link)" }, "is_root_cause": false } ], "correlations_without_causation": [ { "event_a": "string", "event_b": "string", "observed_correlation": "string", "why_not_causal": "string (evidence or reasoning for rejecting causation)", "source_passages": ["string"] } ], "alternative_chains": [ { "description": "string (alternative causal explanation)", "supporting_evidence": ["string"], "confidence": "high | medium | low" } ], "evidence_gaps": [ { "gap_description": "string (what missing evidence would strengthen or refute the chain)", "suggested_retrieval_query": "string (query to find the missing evidence)" } ], "overall_confidence": "high | medium | low", "narrative_summary": "string (a prose summary of the most likely causal chain, with confidence caveats)" }
CONSTRAINTS
[CONSTRAINTS]
EXAMPLES
[EXAMPLES]
INSTRUCTIONS
- Read all retrieved context carefully. Identify events that appear causally related to the investigation question.
- For each causal link, explicitly state the mechanism (direct cause, contributing factor, necessary precondition, triggering event). Do not assert causation without clear evidence.
- Flag correlations that might appear causal but lack supporting evidence. Explain why causation is rejected.
- If the evidence supports multiple possible causal chains, include the most plausible alternatives with their supporting evidence.
- Identify specific evidence gaps that prevent higher confidence. Suggest retrieval queries to fill those gaps.
- Assign confidence levels honestly. Use 'low' when evidence is circumstantial or sparse. Use 'high' only when multiple sources converge on the same causal mechanism.
- Every event and causal claim must cite specific source passages from the retrieved context.
- If the retrieved context contains no usable causal evidence, return an empty causal_chain array and explain the insufficiency in the narrative_summary.
RISK LEVEL
[RISK_LEVEL]
If RISK_LEVEL is 'high', you must additionally flag any causal claims that could have significant consequences if incorrect, and recommend human review before action.
To adapt this template for your specific use case, start by populating [RETRIEVED_CONTEXT] with the document chunks your retrieval pipeline returns. The context should be pre-filtered for relevance to the investigation question. The [CONSTRAINTS] placeholder lets you add domain-specific rules—for example, in a manufacturing context you might require that every causal link references a specific sensor reading or log entry. The [EXAMPLES] placeholder is critical for few-shot performance: provide one or two worked examples showing a well-constructed causal chain with proper confidence assignments and correlation-vs-causation distinctions. For the [RISK_LEVEL] field, set it to 'high' when the causal analysis will inform decisions with safety, financial, or legal consequences; this activates additional cautionary output requirements. After generating the output, validate the JSON structure programmatically and verify that every source_passage reference exists in your original retrieved context to catch hallucinated citations.
Prompt Variables
Required and optional inputs for the Causal Chain Reconstruction Prompt. Each placeholder must be populated before the prompt is sent to the model. Validation notes describe how to programmatically verify the input before execution.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[QUESTION] | The root cause or causal investigation question to answer | What caused the payment processing outage on 2024-03-15 between 14:00-16:00 UTC? | Must be non-empty string. Check length > 10 chars. Reject if question is purely definitional or non-causal (e.g., 'What is a server?'). |
[RETRIEVED_CONTEXT] | Fragmented evidence passages from one or more retrieval steps, each with source metadata | [{source: 'incident_report_42.txt', text: 'Database connection pool exhausted at 14:03...'}, {source: 'deploy_log.md', text: 'v2.4.1 deployed to prod at 13:55...'}] | Must be array with at least 2 items. Each item must have non-empty 'source' and 'text' fields. Validate JSON parse succeeds. Reject if all context from single source. |
[TIMELINE_CONSTRAINTS] | Optional temporal bounds to scope the causal analysis | Between 2024-03-15 13:00 UTC and 2024-03-15 17:00 UTC | If provided, must parse as valid ISO 8601 datetime or date range. Null allowed. If present, model should ignore events outside this window. |
[CONFIDENCE_THRESHOLD] | Minimum confidence level required to include a causal link in the output graph | 0.7 | Must be float between 0.0 and 1.0. Default 0.6 if not provided. Links below threshold should be omitted or marked speculative. |
[OUTPUT_SCHEMA] | Expected structure for the causal graph or narrative output | See output-contract table for full schema | Must be valid JSON Schema object or reference to known schema name. Validate schema parse succeeds. Reject if schema lacks 'nodes' and 'edges' or equivalent causal structure fields. |
[MAX_CHAIN_LENGTH] | Maximum number of causal hops allowed in any single chain | 10 | Must be positive integer. Default 8. Prevents unbounded chains. If exceeded, model should truncate and flag the chain as incomplete. |
[REQUIRED_EVIDENCE_LEVEL] | Minimum evidence standard for causal claims: 'direct', 'strong_correlation', 'weak_correlation', or 'speculative' | strong_correlation | Must be one of enum: ['direct', 'strong_correlation', 'weak_correlation', 'speculative']. Default 'strong_correlation'. Controls whether model includes correlation-based links or only direct causation evidence. |
Implementation Harness Notes
How to wire the Causal Chain Reconstruction prompt into a production RAG application with validation, retries, and human review.
Integrating the Causal Chain Reconstruction prompt into an application requires treating it as a multi-step pipeline rather than a single model call. The core workflow begins with a user query (e.g., 'What caused the outage on March 12?') and a retrieval step that fetches relevant documents from your knowledge base. These documents are injected into the [CONTEXT] placeholder. The prompt then produces a structured output—ideally a JSON object containing a list of events, their causal relationships, and confidence scores. This output must be parsed and validated before it reaches a user or triggers any downstream action. The harness should enforce a strict schema on the model's response, using a library like Pydantic or Zod to validate the presence of required fields (events, causal_links, confidence_scores) and their data types immediately after the model returns.
A robust implementation must include a validation and retry layer. After parsing the initial JSON, run a set of automated checks: confirm that every causal_link references valid event_ids present in the output, verify that no event has a confidence score below a configurable threshold (e.g., 0.6), and check that the graph is acyclic to prevent circular logic. If validation fails, construct a retry prompt that feeds the original context and the specific validation errors back to the model, instructing it to correct the structure. Limit retries to a maximum of two attempts to control latency and cost. For high-stakes domains like incident postmortems or financial audits, always route the final validated output to a human review queue. The reviewer should see the original source documents alongside the reconstructed causal graph to quickly verify the model's reasoning. Log every attempt, including the raw model output, validation errors, and retry count, to enable prompt debugging and performance analysis over time.
Model choice significantly impacts this prompt's reliability. Use a model with strong reasoning capabilities and a large context window, as the prompt requires synthesizing information from potentially dozens of retrieved chunks. GPT-4o, Claude 3.5 Sonnet, or Gemini 1.5 Pro are suitable starting points. For cost-sensitive or high-volume applications, consider a two-tier routing strategy: use a faster, cheaper model for an initial draft and a more powerful model for validation and refinement of low-confidence outputs. Avoid using this prompt in real-time chat without a loading state, as the chain-of-thought reasoning can introduce several seconds of latency. Finally, never feed raw, unsanitized documents directly into the context window. Pre-process retrieved chunks to remove irrelevant metadata, truncate to a maximum token limit per source, and deduplicate near-identical passages to ensure the model focuses on the most salient evidence for causal inference.
Expected Output Contract
Defines the required fields, types, and validation rules for the causal chain reconstruction output. Use this contract to parse, validate, and store the model's response before surfacing it to users or downstream systems.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
causal_chain | array of objects | Must be a non-empty array. Each element must conform to the causal_step schema defined in this contract. | |
causal_chain[].step_id | string | Must be a unique identifier within the array. Validate using regex: ^[a-zA-Z0-9_-]+$. | |
causal_chain[].event_description | string | Must be a non-empty string. Length must be between 10 and 500 characters. Cannot be a substring of another event's description. | |
causal_chain[].source_evidence_ids | array of strings | Must be a non-empty array. Each string must match a [DOC_ID] provided in the input context. Validate against the set of valid IDs. | |
causal_chain[].relationship_to_previous | string | Must be one of the allowed enum values: 'causes', 'enables', 'precedes', 'correlates_with', 'is_prerequisite_for'. Default to 'precedes' if relationship is temporal but not causal. | |
causal_chain[].confidence_score | number | Must be a float between 0.0 and 1.0 inclusive. A score below 0.5 must trigger a human review flag if the relationship is 'causes' or 'enables'. | |
overall_narrative | string | Must be a non-empty string summarizing the full chain. Length must be between 50 and 1000 characters. Must not introduce any entity or event not present in the causal_chain array. | |
unresolved_gaps | array of strings | If present, each string must describe a specific missing causal link. If the array is empty, the field must be omitted or set to null. Null is allowed. |
Common Failure Modes
Causal chain reconstruction is one of the hardest RAG tasks. The model must distinguish correlation from causation, handle temporal ambiguity, and resist the narrative fallacy of connecting events that merely co-occur. These are the failures that surface first in production and how to catch them before users do.
Correlation Masquerading as Causation
What to watch: The model links events that co-occur in time or share a common cause but have no direct causal relationship. This is the most common failure in root cause analysis and investigative RAG. The prompt may produce a confident causal graph where edges are actually just temporal adjacency. Guardrail: Require explicit causal language in the output ('caused by', 'led to', 'resulted in') and run a secondary verification pass that asks the model to provide direct evidence for each causal edge. Flag edges where the evidence only shows co-occurrence.
Temporal Ordering Reversal
What to watch: The model reverses the sequence of events, placing an effect before its cause. This happens when documents describe events in non-chronological order or when timestamps are ambiguous or missing. A reconstructed chain that violates basic temporal logic will mislead downstream decisions. Guardrail: Extract all explicit timestamps and temporal markers before chain construction. Add a validation step that checks every causal pair for temporal consistency (cause must precede effect). When timestamps are vague, require the model to flag uncertainty rather than guess.
Missing Intermediate Causes
What to watch: The model jumps directly from an initial event to a final outcome, skipping necessary intermediate steps. This produces a brittle chain that looks plausible but collapses under scrutiny because the mechanism is unexplained. Common when retrieved documents cover the start and end but not the middle. Guardrail: Prompt the model to identify and explicitly label gaps in the causal chain. Add a completeness check that asks: 'Is there a plausible mechanism connecting each adjacent pair of events?' Flag chains with unexplained leaps and trigger additional retrieval for the gap.
Single-Cause Oversimplification
What to watch: The model attributes a complex outcome to a single root cause, ignoring contributing factors, necessary preconditions, and alternative explanations. This is especially dangerous in incident analysis and investigative workflows where the real answer involves multiple interacting causes. Guardrail: Structure the output to require multiple causal factors with confidence weights. Add a counterfactual check: 'If this cause were removed, would the outcome still have occurred?' If yes, the chain is incomplete. Require the model to list at least one alternative causal path.
Evidence Fabrication Under Retrieval Gaps
What to watch: When retrieved context lacks sufficient evidence to build a complete causal chain, the model may fabricate plausible-sounding intermediate events or causal links rather than admitting uncertainty. This is hallucination driven by the pressure to produce a coherent narrative. Guardrail: Require every causal edge in the output to cite a specific source passage. Run a post-generation factuality check that verifies each cited passage actually supports the claimed causal relationship. If a passage only mentions both events without linking them, flag the edge as unsupported.
Directional Ambiguity in Bidirectional Relationships
What to watch: The model fails to recognize feedback loops or bidirectional causation, forcing a linear chain onto a system with mutual influence. This produces a misleadingly simple narrative that misses reinforcing dynamics. Common in socio-technical, economic, and ecological analyses. Guardrail: Prompt the model to explicitly check for reverse causation and feedback loops. Allow the output format to include cyclic graphs, not just directed acyclic graphs. Add a validation question: 'Could the effect also influence the cause?' If yes, require the model to note the bidirectional relationship.
Evaluation Rubric
Use this rubric to evaluate the quality of a causal chain reconstruction before shipping. Each criterion targets a specific failure mode common in multi-hop reasoning over fragmented evidence. Run these checks programmatically or via LLM-as-judge on a golden dataset of known causal scenarios.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Causal Link Grounding | Every causal link in the chain cites at least one specific source passage from [RETRIEVED_CONTEXT] | A causal link is stated without any source citation or with a citation that does not contain the claimed relationship | Parse output for all causal links; for each link, verify that the cited source passage exists in the input and contains language supporting the causal direction |
Directionality Correctness | The direction of causation (A causes B vs. B causes A) matches the evidence in [RETRIEVED_CONTEXT] for all links | A causal arrow is reversed relative to what the source evidence states, or correlation is presented as causation without justification | For each directed edge in the causal graph, extract the supporting passage and check if the passage explicitly states or strongly implies that specific direction |
Correlation vs. Causation Distinction | The output explicitly labels any relationship as 'correlation' when evidence shows association but not a demonstrated causal mechanism | A temporal or statistical association is presented as a causal link without the output noting the distinction or confidence level | Search the output for causal language (causes, leads to, results in); for each instance, check if the source evidence demonstrates mechanism or only association; flag mismatches |
Confidence Calibration | Each causal link includes a confidence level that matches the strength of evidence: 'high' for direct documented causation, 'medium' for strong implication, 'low' for plausible but weakly supported links | All links are assigned 'high' confidence regardless of evidence strength, or confidence levels are absent entirely | Extract all confidence labels; sample 20% of links and have a human or LLM judge rate whether the assigned confidence is appropriate given the cited evidence |
Temporal Ordering Validity | The causal chain respects temporal order: causes precede effects, and the timeline is consistent across all source documents | An effect is placed before its cause in the chain, or timestamps from different documents contradict the proposed ordering | Extract all events with timestamps from [RETRIEVED_CONTEXT]; verify that the causal chain's event sequence does not violate any documented temporal constraints |
Missing Link Detection | The output identifies gaps where evidence is insufficient to connect two events and marks them as 'inferred' or 'missing evidence' rather than fabricating a link | The chain presents a smooth, unbroken causal narrative where source documents actually contain gaps or jumps | Compare the causal chain against a human-annotated reference chain; measure whether the output correctly flags gaps that exist in the evidence set |
Alternative Cause Consideration | When evidence permits multiple causal explanations, the output surfaces the alternatives with their supporting evidence rather than presenting only one path | A single causal chain is presented as definitive when the source documents contain evidence for competing explanations | Check if the output includes an 'alternative explanations' section or notes; if multiple plausible causes exist in [RETRIEVED_CONTEXT], verify at least one alternative is mentioned |
Source Conflict Transparency | When two source documents disagree on a causal relationship, the output explicitly notes the conflict and the sources involved rather than silently picking one | Conflicting evidence is ignored or resolved without acknowledgment, producing a false consensus | Cross-reference all causal claims against all source documents; if any pair of documents supports contradictory causal directions for the same event pair, verify the output flags this conflict |
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 causal chain prompt and a small set of 3-5 documents containing a known causal sequence. Use a frontier model (GPT-4o, Claude 3.5 Sonnet) with default temperature. Run the prompt as a single-turn request with all evidence in context. Focus on getting the output shape right before adding validation.
Simplify the output schema to a basic JSON with events (array of {id, description, sources}) and relationships (array of {from, to, type: "causes"|"correlates_with"|"precedes"}). Skip confidence scores initially.
Watch for
- The model inventing causal links not present in the documents
- Conflating temporal sequence with causation
- Missing events that are spread across non-adjacent chunks
- Output that reads like a summary instead of a structured graph

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