OctiAI

Categories

Incident Triage & Root-Cause Prompt Template

Convert logs, stack traces, diffs and metrics into ranked hypotheses, a minimal reproducible checklist, and an immediate fix plan

What You'll Get

How to Use

Tip — Prioritize smallest-change fixes first

When multiple hypotheses have similar confidence, apply the smallest, lowest-risk code or config change first (single-line guards, config toggles, feature flags). The template forces minimal diffs and includes rollback criteria and quick verification commands to validate impact before broader changes.

Works Best With

Use this prompt when you have concrete artifacts from a recent incident or risky PR

Prompt Template

# Developer Productivity Prompt Blueprint (use EXACT section order)

## Goal
- Produce an engineering-grade diagnosis from logs, stack traces, recent deploy diff, and metrics that yields: ranked root-cause hypotheses (with confidence %), a prioritized minimal reproducible checklist (exact commands/requests/env/data), and three immediate next-action tasks with owner roles and estimated effort. Deliver a minimal patch plan and verification tests that are safe under given constraints.

## Inputs
- Required inputs:
  - code snippets and relevant file paths
  - error logs and stack traces
  - recent deploy diff (files changed, key hunks)
  - metrics snapshot (errors/sec, latency, throughput, resource signals)
  - environment matrix (OS, runtime, versions, config)
  - steps already tried and their results
  - constraints (e.g., no refactor, hotfix only, rollback allowed)
  - repo context (repo root, CI pipeline, test harness)
- If any required input is missing, the prompt must list the minimal missing artifacts and precise commands/queries or files needed to proceed (no broader discovery).

## Prompt
Paste the following as a single copy-paste prompt into the target assistant. It must be executed verbatim; replace only the placeholders with the provided artifacts.

Inputs provided: programming stack: {{programming_stack}}  
Repo context and entry points: {{repo_context}}  
Error logs and stack traces: {{error_logs}}  
Recent deploy diff (summary or patch): {{recent_diff}}  
Metrics snapshot and alerts: {{metrics_snapshot}}  
Constraints and policies (e.g., no refactor, rollback allowed): {{constraints}}  
Desired output format (choose one: checklist / stepwise-plan / rubric): {{desired_output_format}}

Task: From the inputs above, perform an engineering-grade incident analysis and remediation plan. Output the sections listed in the required Output Format exactly and in the given order. Produce concise, ordered, actionable items only. Prioritize minimal-change fixes that meet the constraints.

Requirements (must produce):
- Assumptions / Unknowns: list anything you could not verify from the inputs, with the exact minimal artifact or command to resolve each unknown.
- Likely root causes: produce a ranked list (highest → lowest) of root-cause hypotheses. For each hypothesis include: short description, confidence percentage, supporting evidence from the provided inputs, and how this hypothesis explains the observed metrics/logs/diff.
- Reproducible checklist (minimal): exact steps to reproduce the failure end-to-end in a dev or staging environment. For each step include precise commands, request payloads/URLs, environment variables or seed data, expected observable failure, and any safety notes.
- Fix plan (prioritized, minimal): a short list of concrete steps to resolve the highest-probability cause first. For each step include the required change, exact files or code region (path + function/hunk), estimated patch size (lines), owner role (e.g., backend-dev, SRE), estimated effort (hours), and rollback criteria.
- Patch suggestions: show minimal diff-like guidance (pseudo-diff or single-line change suggestions) that can be applied as a hotfix or quick test. Do not introduce large refactors. If a code snippet is required, include only the minimal lines to change and a one-line rationale.
- Test / verification checklist: automated and manual tests to validate the fix. For each test include exact commands or test names to run, success criteria, and observability checks to verify no regressions.
- Three immediate next-action tasks: for runbooks/triage. For each task include owner role, priority, estimated effort, and exact command(s) or dashboard link to execute.

Additional instructions:
- Do not assume any files or behavior not present in the provided {{repo_context}} or {{recent_diff}}. If you need to speculate, mark it clearly as speculative and give the minimal evidence required to elevate confidence.
- Prefer the smallest possible code/data changes that address the failure. Avoid scope creep or full refactors unless explicitly permitted in {{constraints}}.
- For each recommended code change include a short risk assessment (low/medium/high) and a short verification step.
- If the inputs are insufficient to produce a reproducible checklist, return the minimal list of artifacts/commands (exact file paths, logs, environment dumps) needed and stop.
- Return the final output in the chosen {{desired_output_format}} while preserving the required section order.

Produce ONLY the structured output (no narrative). Use bullet lists and numbered ordered steps where appropriate.

## Output Format
Output:
  1) Assumptions/Unknowns  
  2) Likely root causes (ranked)  
  3) Fix plan (steps)  
  4) Patch suggestions  
  5) Test/verification checklist

Each item must contain acceptance criteria and a short risk check.

## Guardrails
- Do not assume unseen files or infrastructure. If an inference is required, label it "Speculative" with the exact artifact that would confirm it.
- Prefer minimal diffs; propose single-file or single-function changes before broader ones.
- Avoid solutions that violate {{constraints}}.
- Do not propose database schema changes or major library upgrades unless metrics and diff indicate they are necessary and allowed by {{constraints}}.
- Always include rollback criteria and one quick verification command per proposed change.

## Examples
- Mini root-cause + fix excerpt:
  - Root cause (rank #1): Null pointer when user.profile is missing after recent auth change — Confidence 78% — Evidence: stack trace shows NPE at UserController.getProfile referencing user.profile; recent_diff included auth token propagation change in auth/middleware.js.  
  - Minimal patch suggestion: In controllers/user.js change "user.profile.id" to "user.profile?.id ?? null" and add an explicit 400 when profile absent. Risk: low. Verification: reproduce by curl POST to /login with token X and run unit test user_profile_absent.

Variables

Usage Notes

Not for

Do not include

Incident Triage & Root-Cause Prompt Template

Produce an engineering-grade, minimally invasive incident diagnosis: ranked root-cause hypotheses (with confidence %), an exact reproducible checklist (commands/requests/env/data), prioritized minimal fix steps, and three immediate triage tasks.

Turn this into a working asset in minutes.

Import into Workspace to auto-fill variables, adapt output style, and iterate with OctiAI's prompt editor.

What you'll get

Output format

Markdown

Best used when

Avoid when

Sign in to save, like, or rate this prompt.

Made for

What to fill in

Use the guidance below to complete each placeholder with the right level of detail.

Programming Stack

Provide the key details needed for this variable.

Repo Context

Provide the key details needed for this variable.

Error Logs

Provide the key details needed for this variable.

Recent Diff

Provide the key details needed for this variable.

Metrics Snapshot

Provide the key details needed for this variable.

Constraints

Provide the key details needed for this variable.

Desired Output Format

Provide the key details needed for this variable.

Rules

Canonical Examples

Input: Node.js (Express) API started returning 500s after a deploy. Repo context: services/api/ with controllers/user.js and auth/middleware.js. Error log: TypeError: Cannot read property 'id' of undefined at controllers/user.js:45. Recent diff: auth/middleware.js token propagation changed (removed req.user assignment). Metrics: spike from 2 errors/sec → 120 errors/sec and 95th latency ↑ 300ms → 2.1s. Constraints: hotfix-only, no DB/schema changes. Desired output format: checklist.

Loading result...

Failed to load output.

Ranked root causes (missing req.user assignment) → Repro checklist with curl and docker-compose commands → Minimal hotfix patch suggestion (1-2 lines) → Tests and runbook tasks

Why it works: This example maps stack trace location to a recent middleware change in the diff, showing a single-line causal change that can be fixed with minimal code edits or defensive checks. The output provides a short repro checklist, prioritized minimal fixes (hotfix-friendly), rollback criteria, and quick verification commands—exactly the artifacts an engineer needs during triage.

Input: Python Flask service (payments) experienced high latency and occasional 504s after a release. Repo context: services/payments/, DB access through SQLAlchemy. Error logs: 'QueuePool limit overflow' and 'psycopg2.OperationalError: FATAL: remaining connection slots are reserved'. Recent diff: changed DB pool config in services/payments/src/db.py — MAX_OVERFLOW increased from 10 to 1000 and pool_size set to 50. Metrics snapshot: DB connections rose from 60 → 520; request latency p95 rose from 200ms → 1.8s. Constraints: no DB instance resizing allowed (no infra changes). Desired output format: stepwise-plan (but still produce required sections).

Loading result...

Failed to load output.

Root cause: DB connection exhaustion due to aggressive pool sizing → Repro with hey load test → Hotfix: revert pool config or limit concurrency via semaphore → Patch pseudo-diff and tests + runbook items

Why it works: This example ties connection-pool parameter changes in the diff to DB connection exhaustion errors and latency. The output supplies a minimal repro using hey (load test), a prioritized fix plan that reverts pool settings or throttles app concurrency, small patch diffs, tests (integration and metrics checks), and immediate runbook tasks for rollback and mitigations consistent with the 'hotfix-only' constraint.

Works Best With

Use this prompt when you have concrete artifacts from a recent incident or risky PR