This prompt is your first diagnostic tool when a user reports an issue and you need to find the exact production trace that corresponds to their session. Before you can diagnose a retrieval gap, a tool-call failure, or a model hallucination, you must identify which trace to inspect. The prompt takes structured feedback data—timestamps, user ID, complaint description, and severity—alongside a set of candidate trace summaries, then outputs a ranked mapping with confidence scores and alignment evidence. This workflow assumes you already have a trace observability system that can return candidate traces filtered by user and time window. If your observability platform supports querying by user_id and a timestamp range, you can feed those results directly into this prompt.
Prompt
Feedback-to-Trace Mapping Prompt

When to Use This Prompt
Learn when to deploy the Feedback-to-Trace Mapping Prompt to connect user-reported issues with specific production traces, and when to choose a different approach.
The ideal user is a product manager, support engineer, or on-call AI engineer who receives a user complaint and needs to locate the corresponding trace without manually scanning dozens of sessions. The prompt works best when the user feedback includes a rough timestamp (within a 15-minute window), a clear description of the unexpected behavior, and a severity classification. For example, a support ticket stating 'The assistant gave me wrong pricing at 3:45 PM' provides enough signal to narrow candidate traces and rank them by how well the trace events align with the reported issue. The prompt evaluates alignment across multiple dimensions: temporal proximity, semantic similarity between the complaint description and trace events, and the presence of error states or unexpected outputs that match the reported severity.
Do not use this prompt when the user cannot provide a rough timestamp, when your trace system lacks user-level filtering, or when the complaint describes a systemic issue rather than a single session failure. If a user reports 'The assistant has been slow all week,' you need aggregate latency analysis, not session-level trace mapping. Similarly, if your trace retention window has already expired for the reported time period, this prompt cannot help—escalate to a broader investigation of system health metrics. For high-severity issues where the trace mapping will drive an incident response, always pair this prompt's output with human review before treating the top-ranked trace as definitive. The confidence scores are advisory, not authoritative, and a misaligned trace can send your diagnosis in the wrong direction.
After you identify the candidate trace, the next step is to feed it into a dedicated diagnosis prompt—such as the End-to-End Trace Reconstruction Prompt or the Hallucination Source Trace Prompt—depending on the complaint type. This mapping prompt is the entry point, not the full investigation. Keep your feedback intake form structured: require a timestamp, a user identifier, a one-sentence description of what went wrong, and a severity level. That discipline makes this prompt reliable and keeps your diagnosis pipeline moving fast.
Use Case Fit
Where the Feedback-to-Trace Mapping Prompt works and where it introduces risk. Use these cards to decide if this prompt fits your operational workflow before wiring it into a production harness.
Good Fit: User-Reported Bug with Timestamp
Use when: A user reports unexpected behavior and provides an approximate timestamp, session ID, or conversation snippet. The prompt excels at correlating the user's description of the problem with specific trace events, tool calls, or model outputs within a narrow time window. Guardrail: Require at least one concrete signal (timestamp, session ID, or quoted text) before invoking the prompt. Vague complaints without temporal anchors produce low-confidence mappings.
Bad Fit: Aggregate Trend Analysis
Avoid when: You need to analyze feedback patterns across hundreds of sessions or generate a dashboard of top failure categories. This prompt is designed for single-session reconstruction, not statistical aggregation. Running it across many traces will produce verbose, unstructured reports that are difficult to compare. Guardrail: Use this prompt only for individual trace diagnosis. For aggregate analysis, route to a separate summarization or clustering prompt that operates on structured trace metadata, not raw spans.
Required Input: User Feedback Signal
What to watch: The prompt requires a structured feedback record containing at minimum a user identifier, a complaint description, and a temporal anchor. Missing or incomplete feedback data leads to speculative mappings that may incorrectly attribute user dissatisfaction to unrelated trace events. Guardrail: Validate that the feedback payload includes a timestamp, user ID, and complaint text before calling the prompt. If any field is missing, return a structured input error rather than attempting a best-guess mapping.
Operational Risk: Misattribution of Cause
What to watch: The prompt may confidently map user feedback to a trace event that is temporally correlated but causally unrelated. For example, a user complaining about slow responses might be mapped to a visible tool-call latency spike when the real cause was a client-side network issue invisible in the trace. Guardrail: Include a confidence score in the output schema and flag mappings below a defined threshold for human review. Never auto-close a user-reported issue based solely on an automated trace mapping without human confirmation.
Data Sensitivity Risk: PII in Feedback
What to watch: User feedback often contains PII, account details, or sensitive complaint language that should not be passed through the prompt unredacted. The prompt's trace reconstruction may also surface sensitive data from the original session. Guardrail: Redact PII from feedback text before passing it to the prompt. Apply the same data handling policies to the mapping report output as you would to the original trace data. Log access to mapping reports for auditability.
Latency Sensitivity: Real-Time Support Use
What to watch: If this prompt is used during a live support interaction, the trace reconstruction and mapping may take too long to return while the user waits. The prompt requires fetching and processing raw trace spans, which can introduce unacceptable latency in synchronous support flows. Guardrail: Run this prompt asynchronously after the support interaction concludes. For live support, surface only pre-computed session summaries or lightweight trace metadata, not full reconstructions.
Copy-Ready Prompt Template
A single-turn mapping prompt that correlates user-reported feedback signals with specific production trace events to produce a structured mapping report.
This prompt template is designed to reconstruct the relationship between a user's complaint—such as a timestamp, description of unexpected behavior, and severity—and the internal events captured in a production trace. It is a single-turn mapping task. Do not use it in a multi-turn conversation without resetting context, as the model may carry forward assumptions from prior turns that corrupt the mapping logic. The prompt expects you to supply the user feedback details, the raw trace data, and the output schema you want the model to populate. Replace every square-bracket placeholder with real data before execution.
textYou are a trace analysis assistant. Your task is to map a user-reported issue to specific events in a production trace. ## INPUT User Feedback: - Timestamp: [USER_REPORTED_TIMESTAMP] - Description: [USER_COMPLAINT_DESCRIPTION] - Severity: [USER_REPORTED_SEVERITY] - User ID: [USER_ID] - Session ID: [SESSION_ID] Production Trace: [RAW_TRACE_DATA] ## OUTPUT SCHEMA Return a JSON object with the following structure: { "mapping_report": { "session_id": "string", "user_feedback_summary": "string", "correlated_events": [ { "trace_span_id": "string", "event_type": "string", "timestamp": "string", "correlation_confidence": "high|medium|low", "correlation_rationale": "string", "event_details": {} } ], "uncorrelated_feedback_signals": ["string"], "overall_alignment_score": "high|medium|low", "recommended_actions": ["string"] } } ## CONSTRAINTS - Only correlate events that have a plausible temporal or semantic link to the user feedback. - If no trace events match a feedback signal, list it under `uncorrelated_feedback_signals`. - Do not invent events. Only reference spans present in the provided trace. - If the trace is incomplete or missing spans, note this in `recommended_actions`. - Set `correlation_confidence` to `low` if the link is speculative. ## RISK_LEVEL [RISK_LEVEL] ## EXAMPLES [EXAMPLES]
To adapt this template, start by replacing [RAW_TRACE_DATA] with the full trace output from your observability platform, ensuring it includes span IDs, timestamps, event types, and payloads. The [USER_REPORTED_TIMESTAMP] should be in ISO 8601 format to enable precise temporal correlation. If your trace data uses a different timestamp format, add a normalization instruction to the [CONSTRAINTS] block. The [RISK_LEVEL] placeholder should be set to high if the user feedback involves a safety incident, billing error, or data loss, which requires human review of the mapping report before any action is taken. For [EXAMPLES], provide one or two few-shot demonstrations showing a user complaint alongside a simplified trace and the expected mapping output. This dramatically improves correlation accuracy, especially for ambiguous feedback descriptions. After generation, validate that every trace_span_id in the output exists in the input trace and that timestamps are within a reasonable window of the user-reported time. If the model produces correlations with low confidence, flag them for human review rather than treating them as definitive.
Prompt Variables
Every placeholder the Feedback-to-Trace Mapping Prompt expects, why it matters, and how to validate it before execution. Use this table to ensure all required signals are present before attempting trace correlation.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[USER_FEEDBACK_TEXT] | The raw, unedited complaint or issue description submitted by the user | The report generated on Tuesday was missing the Q3 revenue column. I need this fixed. | Must be a non-empty string. Check length > 10 characters. If null or whitespace-only, abort mapping and request clarification from the user. |
[FEEDBACK_TIMESTAMP] | The exact UTC timestamp when the user submitted the feedback, used to anchor the trace search window | 2025-01-15T14:32:07Z | Must parse as ISO 8601 UTC. Validate the timestamp is not in the future. If missing, widen the search window to the user's last known session and flag lower confidence. |
[USER_IDENTIFIER] | A stable identifier for the user who reported the issue, used to filter traces to the correct session | user_9a2b7c | Must be a non-empty string matching your internal ID format. Validate against the user directory if available. If anonymous, fall back to session ID or correlation token and note reduced trace confidence. |
[SESSION_ID] | Optional explicit session identifier if the user or system captured it, providing the most direct trace lookup key | sess_f8e3d1a2-4b5c-6d7e-8f9a-0b1c2d3e4f5g | If provided, validate UUID format. If present and valid, use as primary lookup key and skip timestamp-based search. If missing, use [USER_IDENTIFIER] and [FEEDBACK_TIMESTAMP] for windowed search. |
[FEEDBACK_SEVERITY] | The reported impact level, used to prioritize trace review and determine escalation path | high | Must be one of: critical, high, medium, low. Validate against allowed enum. If missing, default to medium and flag for reviewer confirmation. Critical severity should trigger immediate paging. |
[TRACE_SEARCH_WINDOW_MINUTES] | The number of minutes before and after [FEEDBACK_TIMESTAMP] to search for candidate traces | 30 | Must be a positive integer between 5 and 120. Default to 30 if not specified. Larger windows increase recall but may surface irrelevant traces. Validate as integer and log the effective search range. |
[OUTPUT_REPORT_FORMAT] | The desired structure for the mapping report, controlling whether the output is a summary, a detailed trace alignment, or a stakeholder brief | detailed_alignment | Must be one of: summary, detailed_alignment, stakeholder_brief. Validate against allowed enum. If missing, default to detailed_alignment. The format determines which trace fields are included in the output. |
Implementation Harness Notes
How to wire the Feedback-to-Trace Mapping Prompt into a production observability pipeline with validation, retries, and human review.
The Feedback-to-Trace Mapping Prompt is not a standalone script; it is a component that fits inside a larger observability pipeline. When a user reports an issue—via a support ticket, a thumbs-down rating, or an in-app feedback form—the system must first enrich that feedback signal with structured metadata (timestamp, session ID if available, user ID, feedback category, severity, and free-text description) before invoking this prompt. The prompt's job is to take that enriched feedback payload and a set of candidate production traces, then output a ranked mapping report that correlates the complaint to specific trace events. This mapping becomes the entry point for downstream diagnosis: once a trace is identified, other playbooks in this pillar—such as the Tool-Call Sequence Diagnosis Prompt or the Hallucination Source Trace Prompt—can take over for root-cause analysis.
To wire this into an application, build a service function that accepts a feedback_event object and a trace_candidates array. The function should first validate that the feedback event contains at minimum a timestamp, a user_id or session_id, and a description. Traces should be pre-filtered to a reasonable time window around the feedback timestamp (e.g., ±15 minutes) and scoped to the same user or session. Pass these validated inputs into the prompt template as [FEEDBACK_EVENT] and [TRACE_CANDIDATES]. The model should return a JSON object matching the [OUTPUT_SCHEMA] defined in the prompt: a mappings array of candidate traces with trace_id, confidence_score, matched_events, and rationale, plus a review_required boolean and unmatched_signals array. After receiving the response, validate the JSON structure with a schema validator. If parsing fails, retry once with the error message appended to the prompt as additional context. If the review_required flag is true or the top confidence score falls below a configurable threshold (e.g., 0.7), route the mapping to a human reviewer before accepting it as the linked trace.
Logging and observability are critical at every step. Emit structured logs containing the feedback ID, the number of candidate traces evaluated, the top-mapped trace ID, the confidence score, and whether human review was triggered. Store the full prompt request and response in an audit table for later traceability. For high-severity feedback events—such as those involving safety concerns, PII exposure, or regulatory risk—consider requiring mandatory human approval regardless of confidence score. Avoid the temptation to auto-link feedback to traces without this mapping step; timestamp proximity alone is a weak signal in high-throughput systems where multiple traces can occur within seconds. The prompt's real value is its ability to correlate semantic content from the user's description with trace events, tool calls, and model outputs, producing a defensible link that holds up under audit.
Expected Output Contract
The exact JSON structure the Feedback-to-Trace Mapping Prompt must return. Validate every field against these rules before accepting the output in your application harness.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
mapping_id | string (UUID v4) | Must match regex ^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$. Generate if missing. | |
user_feedback_summary | object | Must contain 'complaint_text' (string, non-empty), 'reported_timestamp' (ISO 8601), and 'severity' (enum: low, medium, high, critical). | |
candidate_trace_ids | array of strings | Array must contain 1-5 trace IDs. Each ID must match the trace ID format from the observability platform. Empty array triggers retry. | |
selected_trace_id | string or null | Must be one of the candidate_trace_ids or null if no match found. If null, 'mapping_confidence' must be 'none'. | |
mapping_confidence | enum | Must be one of: 'definitive', 'high', 'moderate', 'low', 'none'. If 'none', 'selected_trace_id' must be null and 'alternative_hypotheses' must contain at least one entry. | |
event_alignment | array of objects | Each object must have 'feedback_signal' (string), 'trace_event_id' (string or null), 'alignment_score' (float 0.0-1.0), and 'rationale' (string). Array must not be empty. | |
temporal_correlation | object | Must contain 'feedback_timestamp' (ISO 8601), 'trace_start' (ISO 8601), 'trace_end' (ISO 8601), and 'delta_seconds' (integer). 'delta_seconds' must equal the absolute difference between 'feedback_timestamp' and the nearest trace boundary. | |
alternative_hypotheses | array of strings | If present, each string must be a non-empty explanation of why the mapping might be incorrect. Required when 'mapping_confidence' is 'low' or 'none'. |
Common Failure Modes
When mapping user feedback to production traces, these failures surface first. Each card pairs a common breakage with a concrete guardrail you can implement before the prompt reaches production.
Timestamp Mismatch and Timezone Drift
What to watch: User-reported timestamps (local device time) don't match trace timestamps (UTC or server time), causing the mapping to miss the correct session or correlate the wrong events. Guardrail: Normalize all timestamps to UTC before comparison and include a timezone-offset field in the feedback payload. Validate that the mapped trace falls within a configurable window around the reported time.
Vague Feedback Descriptors
What to watch: Users report issues like 'it gave a weird answer' or 'the AI was broken,' which lack the specificity needed to isolate a trace event. The prompt maps to the wrong session or flags too many candidates. Guardrail: Require structured feedback fields (category, severity, expected vs. actual behavior) before invoking the mapping prompt. If free-text is the only input, use a pre-pass to extract actionable signals and return a confidence score.
Session Boundary Confusion
What to watch: A user complaint spans multiple turns or sessions, but the prompt maps it to a single trace, missing earlier context that caused the failure. Guardrail: Expand the trace window to include N preceding sessions from the same user identifier. Validate that the mapped trace captures the full conversation prefix, not just the turn where the error surfaced.
Correlation Without Causation
What to watch: The prompt finds a trace that matches the timestamp and user ID but attributes the failure to the wrong event—e.g., blaming a tool call when the real issue was a retrieval gap two steps earlier. Guardrail: Require the output to include a causal chain, not just a correlated trace ID. Validate by replaying the trace and checking whether removing the suspected event would have prevented the failure.
Missing Trace Data or Partial Spans
What to watch: The trace is incomplete due to instrumentation gaps, log sampling, or retention limits. The prompt either fails silently or maps feedback to a trace with missing spans, producing an unreliable diagnosis. Guardrail: Validate trace completeness before mapping. Flag missing spans, truncated context windows, or absent tool-call logs in the output. If critical spans are missing, escalate to a human reviewer instead of returning a low-confidence mapping.
Severity Inflation from Ambiguous Language
What to watch: A user writes 'this is urgent' for a cosmetic issue, or 'minor bug' for a data-loss event. The prompt takes the literal severity label and misprioritizes the incident. Guardrail: Decouple the user's stated severity from the trace-based severity assessment. Use the trace evidence—error codes, retry counts, tool failures—to independently score impact. Flag discrepancies between reported and observed severity for review.
Evaluation Rubric
Run these checks on a golden dataset of known feedback-to-trace mappings before shipping. Each row validates a critical dimension of mapping accuracy.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Trace identification accuracy | Correct trace ID returned for ≥95% of feedback samples with unambiguous timestamps | Wrong trace ID returned or null when a valid trace exists within the time window | Golden dataset: 50 feedback samples with known trace IDs. Compare predicted trace_id to ground truth. Measure exact-match accuracy. |
Timestamp correlation precision | Mapped trace events align within ±2 seconds of the user-reported complaint timestamp | Trace event timestamps differ from complaint timestamp by >10 seconds without explanation in the confidence notes | For each golden sample, extract the complaint timestamp and the mapped trace event timestamp. Calculate absolute delta. Flag deltas exceeding threshold. |
Complaint-to-event mapping relevance | The mapped trace event directly corresponds to the user's described issue (e.g., timeout, wrong answer, tool error) | Mapped event is unrelated to the complaint description (e.g., complaint about a wrong answer but mapped to a successful retrieval event) | Human review or LLM-as-judge: present complaint description and mapped event summary. Binary relevance judgment. Target ≥90% relevance rate. |
Severity alignment | Mapped trace severity level matches user-reported severity within one level on a 4-point scale | Severity mismatch of 2+ levels (e.g., user reports critical outage, trace shows informational event) | Extract severity from feedback and mapped trace. Compute absolute difference. Flag differences ≥2. Validate against golden labels. |
Session reconstruction completeness | All major trace spans (user input, retrieval, tool calls, model output) present in the mapping report | Missing spans: report omits retrieval step when complaint references missing context, or omits tool call when complaint references wrong action | Schema check: verify required span types are present in the output. Golden dataset includes expected span coverage per complaint type. |
Confidence score calibration | Confidence score ≥0.8 for unambiguous mappings; score ≤0.5 when timestamp or description evidence is weak | High confidence (>0.8) on incorrect mappings; low confidence (<0.3) on correct mappings | Binned reliability diagram: group predictions by confidence decile. Plot observed accuracy per bin. Expected monotonic increase. |
Null handling for unmappable feedback | Returns null trace_id with explicit reason when no trace exists within the search window | Returns a trace ID with low confidence for feedback that has no corresponding trace (false positive) | Include 10 unmappable feedback samples in golden set. Measure false-positive rate. Target 0 false positives. |
Output schema compliance | All required fields present and correctly typed per the output contract | Missing trace_id, missing confidence_score, or confidence_score as string instead of float | JSON Schema validation against the defined output contract. Run on all golden dataset outputs. Target 100% schema compliance. |
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 lightweight mapping table. Accept free-text feedback descriptions and timestamps without strict schema enforcement. Focus on getting a plausible trace ID and a narrative correlation before building validation infrastructure.
Simplify the output to a short mapping note:
codeGiven user feedback [FEEDBACK_TEXT] reported at [TIMESTAMP], identify the most likely trace ID and explain the correlation.
Watch for
- Mismatched timestamps when user report time differs from trace event time by minutes or hours
- Vague feedback descriptions that map to multiple traces with no disambiguation logic
- Missing trace metadata that prevents confident correlation

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