Inferensys

Prompt

Root Cause Hypothesis Generation Prompt

A practical prompt playbook for generating ranked, evidence-backed root cause hypotheses from defect symptoms and system knowledge in production QA workflows.
Knowledge manager reviewing enterprise knowledge management system on laptop, document library visible, casual office.
PROMPT PLAYBOOK

When to Use This Prompt

Understand the job-to-be-done, ideal user, required context, and when not to use this prompt.

This prompt is for senior QA engineers and developers who need to move from a defect report to a set of testable root cause hypotheses. It takes structured defect symptoms, system architecture knowledge, and recent change context as inputs, then produces ranked hypotheses with supporting evidence, contradicting evidence, and concrete next investigative steps. Use this prompt when you have a reproducible or well-documented defect and need to narrow the search space before diving into logs or debuggers. It is not a replacement for debugging tools or postmortem processes; it is a reasoning accelerator that makes investigative thinking explicit and reviewable.

The ideal user brings three things to this prompt: a detailed defect record (symptoms, reproduction steps, environment, observed vs. expected behavior), architectural knowledge of the affected system (component boundaries, data flow, dependency graph), and awareness of recent changes (deployments, config updates, dependency bumps, traffic shifts). The prompt works best when the defect is reproducible or at least well-characterized—intermittent failures with no pattern will produce weak hypotheses with low confidence scores. Before using this prompt, confirm you have enough symptom data to constrain the hypothesis space. If all you have is 'the app crashed once for a user,' start with a defect reproduction prompt instead.

Do not use this prompt as a substitute for systematic debugging, log analysis, or postmortem processes. It does not access production systems, query observability data, or run diagnostic commands. The hypotheses it generates are reasoning artifacts—they need empirical validation before they become conclusions. In regulated environments (healthcare, finance, safety-critical systems), treat the output as investigation guidance, not as a root cause determination. Always review hypotheses against actual evidence before acting on them, and maintain a clear audit trail of which hypotheses were tested and what evidence confirmed or ruled them out.

PRACTICAL GUARDRAILS

Use Case Fit

Where this prompt delivers value and where it falls short. Use these cards to decide if the Root Cause Hypothesis Generation Prompt fits your current defect investigation workflow.

01

Good Fit: Evidence-Rich Defects

Use when: you have stack traces, logs, reproduction steps, and system knowledge available. The prompt excels at synthesizing multiple evidence sources into ranked, testable hypotheses. Avoid when: the defect report is a one-line complaint with no technical artifacts.

02

Bad Fit: Novel or Zero-Knowledge Systems

Avoid when: the system under investigation is entirely new to the team or the model has no architectural context. Without system knowledge, hypotheses become generic guesses. Guardrail: provide architecture diagrams, module descriptions, or dependency maps as [CONTEXT] before invoking this prompt.

03

Required Inputs

Must have: defect symptoms, observed behavior, expected behavior, and relevant log or trace excerpts. Strongly recommended: system architecture context, recent change history, and known failure patterns. Guardrail: validate that all [EVIDENCE] placeholders are populated before generation; missing evidence degrades hypothesis quality.

04

Operational Risk: Confirmation Bias

Risk: the model may generate plausible-sounding hypotheses that match the engineer's pre-existing suspicion, skipping contradictory evidence. Guardrail: require the prompt to output both supporting and contradicting evidence for each hypothesis, and have a second engineer review the output before acting.

05

Operational Risk: Untestable Hypotheses

Risk: the prompt may produce hypotheses that sound reasonable but cannot be tested with available tools or access. Guardrail: include a [CONSTRAINTS] block listing available investigation methods, and validate that each hypothesis includes a concrete, executable next step within those constraints.

06

Escalation Boundary

Risk: teams may treat the top-ranked hypothesis as a confirmed root cause and skip verification. Guardrail: the prompt output must include a confidence score and explicit verification steps. Escalate to human review when confidence is below threshold or when multiple hypotheses tie for top rank.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A copy-ready template for generating ranked, evidence-backed root cause hypotheses from defect symptoms and system knowledge.

This prompt template is designed to be pasted directly into your AI harness. It instructs the model to act as a senior QA architect, consuming structured defect information and producing a ranked list of root cause hypotheses. Each hypothesis must be supported by the provided evidence, acknowledge any contradicting evidence, and propose the next investigative step. The placeholders, marked with square brackets, must be replaced with real data from your defect tracking system, logs, and architectural documentation before execution.

code
SYSTEM: You are a senior QA architect specializing in root cause analysis for distributed systems. Your task is to generate evidence-backed root cause hypotheses from defect symptoms, system logs, and architectural context. You must reason step-by-step, ground every hypothesis in the provided evidence, and explicitly state your assumptions. Do not fabricate evidence or system behavior not present in the input.

USER:
**Defect ID:** [DEFECT_ID]
**Title:** [DEFECT_TITLE]
**Observed Behavior:** [OBSERVED_BEHAVIOR]
**Expected Behavior:** [EXPECTED_BEHAVIOR]
**Environment:** [ENVIRONMENT_DETAILS]
**Logs & Stack Traces:**

[LOGS_AND_STACK_TRACES]

code
**System Context:** [SYSTEM_ARCHITECTURE_CONTEXT]
**Recent Changes:** [RECENT_CODE_OR_CONFIG_CHANGES]
**Reproduction Rate:** [REPRODUCTION_RATE]

**Instructions:**
1.  Analyze the defect symptoms, logs, and system context.
2.  Generate a ranked list of 3-5 root cause hypotheses, ordered from most to least likely.
3.  For each hypothesis, provide:
    - **Hypothesis:** A clear, concise statement of the potential root cause.
    - **Supporting Evidence:** Specific evidence from the input (e.g., log lines, stack trace frames, recent changes) that supports this hypothesis.
    - **Contradicting Evidence:** Any evidence from the input that weakens or contradicts this hypothesis. If none, state "None found."
    - **Confidence Score:** A score from 1 (low) to 5 (high) indicating your confidence in this hypothesis based on the available evidence.
    - **Next Investigative Step:** A concrete, actionable step to validate or invalidate this hypothesis (e.g., a specific log query, a code inspection point, a test to run).
4.  Output the result as a JSON object matching the [OUTPUT_SCHEMA].

[OUTPUT_SCHEMA]:
{
  "defect_id": "string",
  "analysis_summary": "string",
  "hypotheses": [
    {
      "rank": "number",
      "hypothesis": "string",
      "supporting_evidence": ["string"],
      "contradicting_evidence": ["string"],
      "confidence_score": "number",
      "next_investigative_step": "string"
    }
  ]
}

[CONSTRAINTS]:
- Do not invent evidence. If the input lacks information, state your assumptions explicitly in the `analysis_summary`.
- The `next_investigative_step` must be a specific, executable action, not a vague suggestion.
- If the logs contain a clear exception, the top hypothesis must address it directly.

To adapt this template, replace the placeholders with data from your specific workflow. The [SYSTEM_ARCHITECTURE_CONTEXT] is critical for high-quality hypotheses; provide a brief description of the relevant services, data flow, and dependencies. For high-risk or regulated environments, ensure a human reviews the generated hypotheses before any action is taken based on them. The JSON output schema is designed for direct ingestion into an incident management or QA dashboard, enabling automated routing of the next investigative steps.

IMPLEMENTATION TABLE

Prompt Variables

Each placeholder required by the Root Cause Hypothesis Generation Prompt. Use this table to prepare inputs, validate data types, and ensure the prompt receives grounded, testable information before execution.

PlaceholderPurposeExampleValidation Notes

[DEFECT_SYMPTOMS]

Detailed description of the observed failure, including exact error messages, stack traces, and unexpected behavior.

Users cannot complete checkout; POST /api/cart/checkout returns 500 error with 'NullReferenceException' in payment service.

Must not be empty. Check for presence of specific error codes, timestamps, or stack traces. If only vague user report, flag as low-confidence input and require human enrichment.

[EXPECTED_BEHAVIOR]

Clear statement of what the system should have done under the same conditions.

Checkout should complete, deduct inventory, and redirect to order confirmation page with 200 OK.

Must be a concrete, verifiable statement. Reject inputs that are vague (e.g., 'it should work'). Validate against acceptance criteria or spec if available.

[SYSTEM_ARCHITECTURE_CONTEXT]

Relevant component topology, service dependencies, data flow, and recent deployment history.

Payment service (v2.3.1) calls Inventory API (v1.8.0) synchronously. Deployed to prod at 14:00 UTC today. Uses Redis cache for session state.

Check for version numbers, dependency names, and timestamps. If architecture context is missing, flag that hypotheses will be speculative and require manual verification.

[LOG_EVIDENCE]

Relevant log excerpts from application, infrastructure, and database layers covering the failure window.

payment-service.log: 'NullReferenceException at PaymentProcessor.ValidateCart() line 142'. inventory-api.log: 'Connection timeout to Redis at 14:03:22 UTC'.

Validate that logs include timestamps, service identifiers, and error-level entries. Reject logs that are truncated or missing timestamps. Require correlation IDs if available.

[RECENT_CHANGES]

List of recent deployments, configuration changes, feature flags, or infrastructure modifications.

Payment service v2.3.1 deployed 13:45 UTC. Redis cluster failover at 14:00 UTC. Feature flag 'new-checkout-flow' enabled for 10% of users at 13:00 UTC.

Check for change timestamps that precede the incident window. If no recent changes are provided, prompt should note that change history is unknown and hypotheses may miss deployment-related causes.

[ENVIRONMENT_DETAILS]

Environment where the defect occurred: region, instance type, browser, OS, device, or tenant context.

Production us-east-1, affected tenant IDs: T-4821, T-3912. Browser: Chrome 122.0.

Validate that environment matches the log evidence and defect report. Flag mismatches (e.g., logs from staging but defect reported in production). Require tenant or user identifiers for multi-tenant systems.

[CONSTRAINTS]

Boundaries for hypothesis generation: maximum number of hypotheses, required evidence fields, excluded components, or confidence thresholds.

Generate maximum 5 hypotheses. Each must include supporting evidence, contradicting evidence, and a testable next step. Exclude database schema changes as a hypothesis category.

Parse for numeric limits and required fields. If constraints are missing, apply safe defaults (max 5 hypotheses, require evidence for each). Reject contradictory constraints (e.g., 'unlimited hypotheses' with 'high confidence only').

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Root Cause Hypothesis Generation prompt into a QA or incident analysis application with validation, retries, and human review gates.

This prompt is designed to sit inside a defect analysis or incident review pipeline, not as a standalone chat interface. The application should collect structured defect symptoms, system knowledge (architecture docs, recent changes, known issues), and environment data before assembling the prompt. The model receives a complete evidence packet and returns ranked hypotheses, not a conversation. This means the harness must own input collection, prompt assembly, output validation, and the decision about what happens next with each hypothesis.

Input assembly: Before calling the model, gather the defect record (title, observed behavior, expected behavior, reproduction steps, stack traces, log excerpts), system context (affected service, recent deployments, dependency graph, known issues from a bug tracker or incident database), and any constraints (time window, environment scope). Map these into the [DEFECT_RECORD], [SYSTEM_CONTEXT], and [CONSTRAINTS] placeholders. If using retrieval-augmented generation, query your incident database and change logs for related failures and inject the top results into [SYSTEM_CONTEXT] with source timestamps. Model choice: Use a model with strong reasoning capabilities (GPT-4o, Claude 3.5 Sonnet, or equivalent) because hypothesis generation requires causal reasoning across multiple evidence sources. Lighter models tend to produce shallow or generic hypotheses. Set temperature low (0.1–0.3) to reduce creative speculation while still allowing ranked alternatives.

Output validation: Parse the model response against the expected schema: each hypothesis must have a hypothesis_statement, supporting_evidence (array of specific observations), contradicting_evidence (array), confidence_score (0.0–1.0), and next_investigative_steps (array). Reject any hypothesis missing required fields or with empty evidence arrays. Validate that supporting_evidence items reference concrete symptoms, logs, or system facts from the input—not vague assertions. If confidence scores are all below 0.3 or all above 0.9 without justification, flag the output for human review. Retry logic: If validation fails (malformed JSON, missing fields, ungrounded evidence), retry once with the validation errors appended to the prompt as [PREVIOUS_OUTPUT_ERRORS]. If the second attempt also fails, escalate to a human analyst with the partial output and error details. Do not loop beyond two attempts.

Human review gate: Root cause hypotheses are high-stakes outputs—acting on a wrong hypothesis wastes investigation time and can delay real fixes. After validation passes, route hypotheses with confidence_score below 0.6 to a review queue where a senior engineer confirms or rejects the hypothesis before it drives action. For hypotheses above 0.6, the system can auto-create investigation tickets or link them to the defect record, but always preserve the full hypothesis payload (including contradicting evidence) so the next investigator sees the model's uncertainty, not just its top guess. Logging: Record the full prompt, model response, validation results, and review decision for auditability. This trace is essential for retrospective analysis when a hypothesis proves wrong and the team needs to understand why the model missed the real cause.

IMPLEMENTATION TABLE

Expected Output Contract

Fields, types, and validation rules for the JSON output generated by the Root Cause Hypothesis Generation Prompt. Use this contract to parse, validate, and integrate the model's response into your QA workflow.

Field or ElementType or FormatRequiredValidation Rule

hypotheses

Array of objects

Array length must be between 1 and 5. Each element must be a valid object with all required sub-fields.

hypotheses[].rank

Integer

Must be a positive integer starting at 1, unique within the array, and sequential without gaps.

hypotheses[].hypothesis

String

Must be a non-empty string between 20 and 500 characters. Must state a causal claim linking an observed symptom to a proposed root cause.

hypotheses[].supporting_evidence

Array of strings

Array must contain at least 1 item. Each string must reference a specific log line, metric, stack trace element, or system behavior from [INPUT_CONTEXT].

hypotheses[].contradicting_evidence

Array of strings

If empty or null, validator must confirm the field is present. Each string must reference a specific observation from [INPUT_CONTEXT] that weakens the hypothesis.

hypotheses[].confidence_score

Number

Must be a float between 0.0 and 1.0. Scores above 0.9 require at least 3 supporting evidence items. Scores below 0.3 require at least 1 contradicting evidence item.

hypotheses[].next_investigation_steps

Array of strings

Array must contain between 1 and 5 items. Each step must describe a concrete, executable action such as a log query, test to run, or metric to check.

generation_notes

Object

Must contain a 'data_sources_used' array of strings listing the specific inputs consumed and an 'abstention_flag' boolean set to true if no plausible hypothesis could be formed.

PRACTICAL GUARDRAILS

Common Failure Modes

Root cause hypothesis generation fails in predictable ways. These cards help you catch the most common failure modes before they reach a triage meeting.

01

Untestable Hypotheses

What to watch: The model proposes root causes that cannot be verified or falsified with available logs, metrics, or reproduction steps. Hypotheses like 'a race condition in the event loop' without a specific module, timing window, or observable signal are useless to an on-call engineer. Guardrail: Require each hypothesis to include a concrete test that would confirm or rule it out. Add a testability_check field to your output schema and reject hypotheses that lack a specific, executable verification step.

02

Evidence Fabrication

What to watch: The model cites log lines, error codes, stack traces, or metric values that do not exist in the provided input. This is especially dangerous when the fabricated evidence looks plausible and the hypothesis is technically sound. Guardrail: Require every piece of supporting evidence to include a direct quote or a line-number reference from the provided source material. Add a post-generation validation step that scans for citations not present in the input context.

03

Single-Hypothesis Anchoring

What to watch: The model latches onto the first plausible explanation and ignores contradictory evidence or alternative causes. This mirrors the human cognitive bias of anchoring and produces overconfident, narrow investigations. Guardrail: Explicitly instruct the prompt to generate a minimum number of ranked hypotheses and to include a 'contradicting evidence' section for each. If the model cannot find contradicting evidence, it should state that explicitly rather than omit the section.

04

Missing Component Boundaries

What to watch: The hypothesis blames 'the backend' or 'the database' without specifying which service, API endpoint, query pattern, or infrastructure component is the likely culprit. This shifts the investigation burden without reducing the search space. Guardrail: Include a component_boundary constraint in the prompt that requires each hypothesis to name the specific system component, its owning team or repository, and the interface boundary where the failure likely originates.

05

Ignoring Temporal Sequence

What to watch: The model treats all symptoms as simultaneous and misses the causal chain implied by timestamps, event ordering, or deployment sequences. A hypothesis that ignores that the CPU spike happened three minutes before the OOM kill is actively misleading. Guardrail: Require the prompt to ingest and reason over a timeline of events. Add a temporal_consistency check that verifies each hypothesis respects the observed event ordering. Flag hypotheses that reverse cause and effect.

06

Over-Indexing on Recent Changes

What to watch: The model defaults to blaming the most recent deployment, configuration change, or feature flag toggle without evaluating whether the symptom pattern matches the change's blast radius. This is a high-recall, low-precision heuristic that wastes investigation time. Guardrail: Add a change_analysis constraint that requires the model to compare the timing, scope, and expected impact of recent changes against the observed symptom pattern. If no change aligns, the model should explicitly state that and explore systemic or external causes.

IMPLEMENTATION TABLE

Evaluation Rubric

Score each criterion on a pass/fail basis against a representative set of defect samples before shipping this prompt to production. Each row defines a specific quality dimension, the standard for passing, what failure looks like, and how to test it.

CriterionPass StandardFailure SignalTest Method

Hypothesis Testability

Each hypothesis is stated as a falsifiable claim that can be investigated with a specific test or log query

Hypotheses are vague (e.g., 'something is wrong with the database') or cannot be mapped to a concrete investigative action

For each hypothesis in the output, verify that an engineer can identify a specific test, query, or observation that would confirm or refute it

Evidence Grounding

Every hypothesis cites at least one specific piece of evidence from [DEFECT_SYMPTOMS] or [SYSTEM_KNOWLEDGE]

Hypotheses appear speculative without linking to provided symptoms, log excerpts, stack traces, or system behavior descriptions

Trace each hypothesis back to explicit evidence in the input; flag any hypothesis that lacks a direct citation to input data

Ranking Rationale

Hypotheses are ordered by likelihood with explicit reasoning for the rank order (e.g., 'most likely because symptom X is a known signature of Y')

Ranking appears arbitrary, all hypotheses are labeled equally likely, or ranking contradicts the evidence presented

Check that the output includes a rank order with a brief rationale per position; verify the top-ranked hypothesis aligns with the strongest evidence in the input

Contradicting Evidence Coverage

Each hypothesis acknowledges evidence that contradicts or weakens it, if any exists in the input

Hypotheses ignore contradictory symptoms, log entries, or system facts that would reduce their likelihood

For each hypothesis, scan the input for evidence that conflicts with it; confirm the output either addresses the conflict or explicitly states no contradicting evidence was found

Next Steps Actionability

Each hypothesis includes at least one concrete next investigative step (e.g., 'check the auth service logs between 14:00-14:05 UTC for token validation errors')

Next steps are generic (e.g., 'investigate further') or missing entirely

Verify that every hypothesis has an associated next step with a specific action, target system, and time window or scope where applicable

Confidence Calibration

The output includes a confidence indicator (e.g., High/Medium/Low) per hypothesis that reflects evidence strength and gaps

Confidence is uniformly high without justification, or confidence claims contradict the amount and quality of evidence cited

Review confidence labels against the quantity and specificity of supporting evidence; flag any High-confidence hypothesis with thin or ambiguous evidence

Unknown and Assumption Transparency

The output explicitly lists unknown factors, missing data, or assumptions that affect hypothesis strength

The output presents hypotheses as definitive without acknowledging gaps in logs, environment details, or reproduction steps

Check for an explicit 'Unknowns' or 'Assumptions' section; verify that any gap in the input data is reflected there rather than silently filled

Output Schema Compliance

The output strictly matches the [OUTPUT_SCHEMA] with all required fields present and correctly typed

Output is missing required fields, uses wrong types, or adds unsolicited sections outside the schema contract

Validate the output against the [OUTPUT_SCHEMA] using a schema validator; reject any output that fails structural or type checks

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt\nUse the base prompt with a single model call. Accept plain-text hypothesis output without strict schema enforcement. Focus on getting plausible hypotheses fast.\n\n```markdown\n[SYSTEM]\nYou are a senior QA engineer. Given the defect symptoms and system context below, generate 3-5 ranked root cause hypotheses. For each hypothesis, include: a short label, supporting evidence from the defect, and one next investigative step.\n\n[DEFECT_SYMPTOMS]\n[SYSTEM_CONTEXT]\n```\n\n### Watch for\n- Hypotheses that sound plausible but lack any evidence grounding\n- Missing confidence indicators or ranking rationale\n- Overly broad hypotheses that can't be tested in one step

Prasad Kumkar

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.