This prompt is for incident commanders and AI SREs who need to convert a raw, timestamp-ordered set of production traces into a human-readable incident narrative. Use it during postmortem construction or stakeholder handoff when you must explain what failed first, how the failure propagated, which components were affected, and when recovery occurred. The primary job-to-be-done is transforming machine-generated span data into a coherent, evidence-backed story that engineering leads, product managers, and executives can understand without reading raw traces.
Prompt
Incident Timeline Reconstruction Prompt from Traces

When to Use This Prompt
Defines the precise conditions, required inputs, and user context for the incident timeline reconstruction prompt, and clarifies when it should not be used.
The prompt requires pre-sorted trace data with span-level detail and expects the model to ground every timeline entry in specific trace IDs and span timestamps. The input must be a complete, closed dataset from a defined incident window—do not use this prompt during active incident triage when traces are still arriving. It is designed for retrospective reconstruction after the incident window is closed and all relevant traces have been collected. The ideal user has access to an observability backend, has already isolated the traces relevant to the incident, and needs a structured output that can be pasted into a postmortem document or incident review ticket.
Do not use this prompt when traces are incomplete, when the incident is still unfolding, or when you need real-time alerting rather than a narrative. It is not a substitute for an anomaly detection system or a live dashboard. If your traces lack span-level timestamps or trace IDs, the output will be vague and ungrounded, violating the core requirement that every timeline entry be trace-backed. For ambiguous failure modes where infrastructure, model, and prompt causes are intertwined, run the Infrastructure vs. Model Failure Classification Prompt first to categorize each trace before attempting timeline reconstruction. The next step after reading this section is to prepare your trace dataset, ensure it is sorted by timestamp, and review the prompt template for required placeholders.
Use Case Fit
Where the Incident Timeline Reconstruction Prompt delivers value and where it introduces unacceptable risk. Use this card grid to decide whether this prompt fits your incident response workflow.
Good Fit: Structured Postmortem Authoring
Use when: You have a closed incident with a complete set of ordered traces and need a stakeholder-ready narrative. Guardrail: The prompt requires timestamps and trace IDs as mandatory inputs; never run it on a live, unresolved incident where the full trace set is still growing.
Bad Fit: Real-Time Incident Command
Avoid when: The incident is active and traces are still arriving. The prompt assumes a complete dataset and will fabricate a false 'recovery' marker if run prematurely. Guardrail: Gate execution behind an incident-state check; only run when the incident status is 'resolved' or 'closed.'
Required Input: Timestamp-Ordered Trace Set
Risk: Feeding the prompt unordered or partial traces produces a causally incoherent timeline that misleads stakeholders. Guardrail: The harness must sort traces by span timestamp and validate that the earliest trace contains the initial failure event before invoking the prompt.
Operational Risk: Evidence Fabrication
Risk: The model may invent plausible-sounding propagation steps or recovery actions not present in the traces. Guardrail: Every timeline entry must include a mandatory trace_evidence field with a specific trace ID and span ID. Post-generation, run a validator that rejects any entry without a resolvable trace reference.
Operational Risk: Stakeholder Over-Trust
Risk: Executives may treat the generated narrative as the definitive incident record without human review. Guardrail: The output schema must include a human_review_required boolean and a reviewer_notes field. The prompt's system instructions must state that the output is a draft for human approval, not the final postmortem.
Bad Fit: Low-Severity or Single-Trace Incidents
Avoid when: The incident involves a single trace or is a routine, low-severity event. The prompt's overhead of narrative construction is disproportionate. Guardrail: Add a pre-flight check that requires a minimum of three distinct traces and a severity label of 'major' or 'critical' before the prompt is invoked.
Copy-Ready Prompt Template
A reusable prompt template with square-bracket placeholders for reconstructing an incident timeline from production traces.
This section provides a copy-ready prompt template you can paste directly into your observability harness, postmortem tool, or AI orchestration layer. The template is designed to ingest a chronologically ordered set of production traces and produce a structured, human-readable incident narrative. Each output entry is backed by trace evidence, making the timeline suitable for stakeholder handoff, postmortem documentation, and compliance review. The template uses square-bracket placeholders exclusively—replace each one with actual trace data, constraints, and output format requirements before execution.
textYou are an incident timeline reconstruction specialist. Your task is to analyze a set of production traces ordered by timestamp and produce a structured incident narrative. For every event in the timeline, you must cite the specific trace ID, span ID, or log line that supports it. Do not infer events without trace evidence. If evidence is ambiguous, flag it as uncertain. [TRACES] <!-- Insert chronologically ordered trace data here. Each trace should include: trace_id, timestamp, service, operation, status, error_message (if any), latency_ms, and any relevant span or log details. --> [/TRACES] [CONSTRAINTS] <!-- Specify any constraints such as: maximum timeline entries, required sections, severity thresholds, or components to focus on. --> [/CONSTRAINTS] [OUTPUT_SCHEMA] <!-- Define the exact output structure. Example: { "incident_id": "string", "generated_at": "ISO8601 timestamp", "timeline": [ { "timestamp": "ISO8601", "event_type": "failure|propagation|recovery|annotation", "component": "string", "description": "string", "trace_evidence": ["trace_id:span_id"], "confidence": "high|medium|low", "impact": "string" } ], "summary": "string", "open_questions": ["string"] } --> [/OUTPUT_SCHEMA] [RISK_LEVEL] <!-- Specify the risk context: low, medium, high, critical. High or critical risk levels should trigger additional human review flags in the output. --> [/RISK_LEVEL] [HUMAN_REVIEW_FLAG] <!-- Set to true if the output must include explicit markers for entries that require human verification before stakeholder distribution. --> [/HUMAN_REVIEW_FLAG] Instructions: 1. Parse all traces and order them by timestamp. 2. Identify the initial failure event—the first trace indicating an anomaly, error, or threshold breach. 3. Trace the propagation path: which components were affected, in what order, and with what latency. 4. Identify recovery markers: the first trace indicating service restoration, failover completion, or error rate normalization. 5. For each timeline entry, include at least one trace_evidence reference. 6. If multiple traces corroborate an event, include the strongest evidence. 7. Flag any gaps in the trace data where the timeline is incomplete. 8. If [RISK_LEVEL] is high or critical, or [HUMAN_REVIEW_FLAG] is true, append a "requires_human_review" boolean to each timeline entry and set it to true for any entry with low confidence or ambiguous evidence. 9. Output ONLY valid JSON conforming to [OUTPUT_SCHEMA]. Do not include commentary outside the JSON.
To adapt this template, replace each bracketed section with production data and configuration. The [TRACES] block should contain the raw trace data—this can be JSON, structured logs, or a formatted table, but consistency across traces is critical for reliable reconstruction. The [OUTPUT_SCHEMA] block defines the exact JSON structure your downstream tooling expects; modify it to match your postmortem system's schema. The [CONSTRAINTS] block lets you scope the analysis to specific components, time windows, or severity levels. Set [RISK_LEVEL] and [HUMAN_REVIEW_FLAG] based on your incident response policy—for customer-facing outages or regulated systems, always require human review of low-confidence entries before the timeline is shared externally. After pasting, validate that the model's output conforms to your schema using a JSON validator before ingestion into your postmortem tool. If the model produces malformed JSON or entries without trace evidence, use a retry prompt with stricter instructions or escalate to a human responder.
Prompt Variables
Inputs the prompt needs to reconstruct a reliable incident timeline. Validate each before sending to the model to prevent hallucinated events or missing trace evidence.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[TRACE_SET] | Ordered collection of trace objects representing the incident window | [{"trace_id": "abc123", "timestamp": "2024-01-15T10:03:22Z", "spans": [...]}, {"trace_id": "def456", "timestamp": "2024-01-15T10:03:25Z", "spans": [...]}] | Must be a non-empty array. Each object requires trace_id, timestamp, and spans fields. Reject if timestamp ordering is inconsistent with provided sequence. |
[INCIDENT_BOUNDARY_START] | ISO-8601 timestamp marking the earliest point to include in the timeline | 2024-01-15T10:03:00Z | Must parse as valid ISO-8601. Must be earlier than [INCIDENT_BOUNDARY_END]. Reject if any trace timestamp falls outside this window without explicit inclusion flag. |
[INCIDENT_BOUNDARY_END] | ISO-8601 timestamp marking the latest point to include in the timeline | 2024-01-15T10:45:00Z | Must parse as valid ISO-8601. Must be later than [INCIDENT_BOUNDARY_START]. Used to filter noise from traces outside the incident window. |
[KNOWN_COMPONENTS] | List of system components to track for propagation analysis | ["api-gateway", "auth-service", "vector-store", "model-inference", "tool-executor"] | Must be a non-empty array of strings. Each component name should match span attributes in traces. Missing components will produce gaps in propagation path. |
[RECOVERY_MARKERS] | Keywords or status codes that indicate recovery events in trace spans | ["200 OK", "healthy", "connection restored", "circuit closed"] | Must be a non-empty array. Used to identify recovery points. Null allowed if incident is ongoing. Validate that at least one marker appears in traces if incident is declared resolved. |
[OUTPUT_SCHEMA] | Expected JSON schema for the reconstructed timeline | {"type": "object", "properties": {"timeline": {"type": "array", "items": {"type": "object", "properties": {"timestamp": {"type": "string"}, "event": {"type": "string"}, "affected_components": {"type": "array"}, "trace_evidence": {"type": "array"}, "event_type": {"enum": ["failure", "propagation", "recovery", "observation"]}}}}}} | Must be a valid JSON Schema object. Every timeline entry must map to at least one trace span. Reject output that contains events without trace_evidence array populated. |
[MAX_TIMELINE_ENTRIES] | Upper bound on timeline entries to prevent overly granular or verbose output | 50 | Must be a positive integer. Default to 50 if not specified. Enforce truncation with a warning if exceeded, prioritizing failure and recovery events over observation events. |
[HUMAN_REVIEW_THRESHOLD] | Confidence level below which timeline entries require human verification before stakeholder handoff | 0.7 | Must be a float between 0.0 and 1.0. Entries with trace evidence spanning fewer than 2 traces or with ambiguous span attributes should be flagged. Null allowed if all entries go to human review. |
Implementation Harness Notes
How to wire the Incident Timeline Reconstruction Prompt into an observability or postmortem workflow with validation, retries, and human review gates.
This prompt is designed to be invoked as part of a post-incident automation pipeline, not as a one-off chat interaction. The primary integration point is your observability platform's API or a batch processing script that collects trace spans from your tracing backend (e.g., Datadog, Honeycomb, OpenTelemetry collector) and feeds them into the prompt. The input must be a chronologically ordered array of trace objects, each containing at minimum a timestamp, span_id, service, operation, status_code, and any associated error_message or metadata fields. Before calling the LLM, validate that the trace list is non-empty, sorted ascending by timestamp, and contains no duplicate span IDs. A pre-processing step should also truncate or summarize excessively large metadata blobs to avoid context-window overflow, keeping the total input under roughly 60% of the model's context limit to leave room for the output timeline.
The implementation should follow a validate → generate → validate → escalate pattern. After the model returns the structured timeline JSON, run a post-generation validator that checks: (1) every timeline entry has a non-null timestamp and evidence_trace_ids array, (2) each referenced trace ID exists in the input set, (3) the timeline is still sorted chronologically, and (4) the propagation_path field forms a connected graph (no orphaned services unless marked as the initial failure). If validation fails, retry once with the validation errors appended to the prompt as [CONSTRAINTS] feedback. If the second attempt also fails, escalate to a human incident commander with the raw traces and the partial timeline for manual reconstruction. Log every attempt—including input trace count, output timeline length, validation pass/fail, and retry count—to your incident management channel for auditability.
Model choice matters here. Use a model with strong structured output capabilities and a large context window (e.g., Claude 3.5 Sonnet or GPT-4o with structured outputs enabled). Set temperature=0 or near-zero to maximize factual consistency across trace evidence. If your traces contain sensitive data, run the prompt in a private deployment or use a redaction proxy to strip PII, secrets, and internal hostnames before the data reaches the model. For high-severity incidents, always require a human reviewer to approve the final timeline before it is shared with stakeholders or attached to the postmortem document. The prompt's [RISK_LEVEL] parameter should be set to high for any incident involving data loss, security impact, or customer-facing downtime, which triggers the mandatory human-approval gate in your workflow.
Expected Output Contract
Defines the structured timeline object the model must return. Use this contract to validate the response before it enters a postmortem document or stakeholder report.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
timeline_title | string | Must be a single sentence summarizing the incident scope and timeframe. Reject if empty or >200 characters. | |
incident_id | string | Must match the [INCIDENT_ID] input exactly. Reject on mismatch or null. | |
entries | array of objects | Must contain at least 1 entry. Reject if empty array or not present. | |
entries[].timestamp | ISO 8601 string | Must parse to a valid datetime. Must be within the [OBSERVATION_WINDOW] range. Reject on parse failure or out-of-bounds. | |
entries[].event_type | enum string | Must be one of: 'initial_failure', 'propagation', 'affected_component', 'recovery_marker', 'human_action'. Reject unknown values. | |
entries[].description | string | Must be a single sentence (10-200 chars). Reject if empty or exceeds limit. | |
entries[].trace_evidence | array of strings | Each string must be a valid trace ID from the [TRACE_SET]. At least one trace ID required per entry. Reject if any ID is not in the input set. | |
entries[].confidence | string | Must be one of: 'high', 'medium', 'low'. Reject if missing or invalid. |
Common Failure Modes
When reconstructing an incident timeline from traces, these failure patterns surface most often. Each card explains what breaks and how to guard against it before the timeline reaches stakeholders.
Timestamp Ordering Gaps
What to watch: Traces with missing, skewed, or out-of-order timestamps produce a timeline that misrepresents the actual sequence of events. Clock drift across services, batched ingestion delays, or spans logged in different time zones can place a recovery marker before the failure event. Guardrail: Validate and normalize all timestamps to a single time source before ordering. Flag spans where start_time exceeds end_time or where the delta exceeds a configured threshold. Require the prompt to output a timestamp_confidence field for each timeline entry.
Causal Chain Fabrication
What to watch: The model infers a causal relationship between two trace events simply because they appear close in time or share a component name, even when no actual dependency exists in the span context. This produces a plausible but incorrect propagation path. Guardrail: Require each causal link in the timeline to cite a specific trace_id, span_id, or error field that demonstrates the dependency. Add an explicit instruction: 'Do not infer causation from temporal proximity alone. If no trace evidence links two events, mark the relationship as UNKNOWN.'
Recovery Marker Omission
What to watch: The timeline captures the initial failure and propagation steps but omits recovery events—service restarts, failover completions, manual interventions—because the model treats the last error as the end of the story. Stakeholders receive an incident narrative with no resolution. Guardrail: Explicitly instruct the prompt to scan for recovery signals: status code transitions from 5xx to 2xx, deployment timestamps, circuit-breaker close events, or human-action annotations. Require a recovery_marker section in the output schema and flag timelines where it is absent.
Trace Selection Bias
What to watch: The model reconstructs the timeline from only the loudest or most recent traces, ignoring low-volume but critical failure paths. A rare authentication failure that triggered the cascade may be drowned out by the downstream timeout errors it caused. Guardrail: Pre-process traces to group by error type and sample evenly across groups before feeding them to the prompt. Include a trace_diversity_check instruction: 'Confirm that the timeline draws from at least N distinct error signatures. If not, request additional traces.'
Stakeholder-Ready Overconfidence
What to watch: The model produces a clean, confident narrative that hides ambiguity, conflicting trace evidence, or gaps in observability coverage. Incident commanders may accept the timeline as definitive and make decisions on an incomplete picture. Guardrail: Require the output to include an evidence_gaps section listing time windows with no trace coverage, conflicting span data, or assumptions the model made. Add a human-review flag for any timeline entry built from fewer than two corroborating traces.
Component Name Ambiguity
What to watch: Traces reference the same logical component by different names—auth-svc, authentication-service, auth.internal—and the model treats them as separate entities, fragmenting the timeline or duplicating failure entries. Guardrail: Provide a component name mapping table as part of the prompt input. Instruct the model to normalize all component references against this table before constructing the timeline. Flag any unmapped component names in the output for manual review.
Evaluation Rubric
Run these checks on a sample of 5-10 incidents with known timelines before shipping the postmortem. Each criterion targets a specific failure mode in timeline reconstruction.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Event Ordering Accuracy | All reconstructed events appear in the same chronological order as the source trace timestamps | Two or more events are transposed relative to trace timestamps | Compare reconstructed event sequence against ground-truth trace timestamps for 5-10 known incidents; count ordering errors |
Trace Evidence Grounding | Every reconstructed event cites at least one specific trace span ID or log line | An event appears in the timeline with no trace reference or with a fabricated span ID | Parse each event's evidence field; verify span IDs exist in the input trace set using exact match |
Missing Event Recall | All ground-truth incident milestones (initial failure, propagation, recovery) appear in the output | A known milestone from the ground-truth timeline is absent from the reconstructed output | Maintain a checklist of required milestone types per incident; compare output events against checklist |
Hallucinated Event Rate | Zero events describe occurrences not present in any input trace | An event describes a failure, component, or action with no corresponding trace evidence | For each output event, require at least one trace span that contains the described component name and action; flag unmatched events |
Timestamp Precision Preservation | All output timestamps match source trace timestamps to the same precision level (millisecond or microsecond) | Timestamps are truncated, rounded, or shifted relative to source traces | Parse output timestamps and compare string length and value against corresponding trace span timestamps |
Propagation Path Completeness | The output identifies the sequence of affected components in the correct causal order | A component in the propagation chain is skipped or the causal direction is reversed | Extract the component sequence from the output; compare against a ground-truth propagation graph derived from trace parent-child span relationships |
Recovery Marker Accuracy | All recovery events are labeled with the correct recovery type (automatic, manual, partial, full) and match trace evidence | A recovery event is mislabeled or attributed to the wrong component or time window | Check recovery event labels against trace spans showing health-check restoration, failover completion, or human intervention markers |
Stakeholder Readability Threshold | A non-engineer reviewer can correctly answer 4 out of 5 comprehension questions about the incident from the output alone | Reviewers misinterpret the cause, timeline, or affected scope on 2 or more comprehension questions | Administer a 5-question comprehension quiz to one stakeholder per incident; score pass if 4+ correct |
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 small batch of traces (3–5) and lighter validation. Replace strict schema enforcement with a looser markdown timeline. Focus on narrative coherence over trace-backed evidence for every entry.
Watch for
- Missing trace ID references in timeline entries
- Overly broad propagation paths without specific span evidence
- Timeline entries that sound plausible but aren't grounded in the provided traces

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