Inferensys

Prompt

Event Replay and Recovery Plan Prompt

A practical prompt playbook for platform engineers designing event replay capabilities. Produces a replay plan review covering retention windows, replay ordering, idempotency during replay, and consumer impact.
Legal team reviewing EU AI Act compliance documents on laptop in modern office, coffee cups and papers on table, casual meeting.
PROMPT PLAYBOOK

When to Use This Prompt

Define the job, reader, and constraints for the Event Replay and Recovery Plan Prompt.

This prompt is for platform engineers and SREs who need to design or review a recovery plan for replaying events from a log, queue, or stream. The job-to-be-done is producing a structured analysis of replay safety, ordering guarantees, consumer impact, and side-effect risk before an incident forces an unplanned replay. Use this prompt when you are introducing a replay capability to an existing event-driven system, auditing a replay plan after a dead-letter queue (DLQ) overflow, or preparing a runbook for disaster recovery scenarios. The ideal user has access to event schema definitions, consumer group topologies, idempotency key strategies, and retention window configurations.

Do not use this prompt for real-time incident response where seconds matter—this is a design-time review, not a live triage tool. It is also inappropriate for systems where events are purely ephemeral with no retention log, or where replay is handled entirely by an external managed service with no consumer-side coordination required. The prompt assumes you have already decided that replay is architecturally possible; it does not evaluate whether your system should be event-sourced in the first place. If you lack concrete details about consumer idempotency behavior or retention policies, the output will be speculative and should be flagged for human review before any operational use.

Before running this prompt, gather your event envelope schema, consumer group inventory, current retention window settings, and any existing runbook documentation. The prompt will produce a plan that identifies gaps in idempotency coverage, replay ordering risks, and side-effect duplication scenarios. After receiving the output, validate any critical claims about data loss or corruption risk against your actual infrastructure configuration. For high-risk systems where replay errors could cause financial or compliance impact, require a second human reviewer to sign off on the plan before it enters a runbook.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Event Replay and Recovery Plan Prompt delivers value and where it introduces risk.

01

Good Fit: Pre-Implementation Design Review

Use when: You are designing a new event-driven system or adding replay capabilities to an existing one. The prompt helps surface gaps in retention windows, idempotency, and consumer impact before code is written. Guardrail: Treat the output as a design checklist, not a final sign-off. Every item requires explicit architectural confirmation.

02

Good Fit: Operational Runbook Creation

Use when: You need to document step-by-step recovery procedures for on-call engineers. The prompt structures the plan around ordering, side-effect mitigation, and validation steps. Guardrail: Pair the generated plan with a manual dry-run against a staging environment to verify the steps actually work under load.

03

Bad Fit: Real-Time Incident Response

Avoid when: You are in the middle of a production incident and need immediate recovery commands. This prompt is for planning and review, not for generating emergency runbooks on the fly. Guardrail: Pre-generate and approve replay plans during calm periods. Store them in your incident management tool for instant access during outages.

04

Required Inputs: System Topology and Contracts

What to watch: The prompt cannot reason about your system without concrete details. Missing inputs lead to generic, unsafe advice. Guardrail: Provide the event schema, consumer list, current retention policy, idempotency key design, and known side-effect endpoints. The output quality is directly proportional to input specificity.

05

Operational Risk: Side-Effect Duplication

What to watch: The prompt may identify replay ordering and idempotency gaps but cannot guarantee that every downstream side-effect is safe. Duplicate notifications, charges, or state mutations are the primary production risk. Guardrail: Require human review of every external side-effect identified in the plan. Add explicit idempotency checks to all replay-sensitive consumers before enabling replay.

06

Operational Risk: Stale Plan Drift

What to watch: A replay plan generated today may be invalid next month after schema changes, new consumers, or retention policy updates. Guardrail: Version the replay plan alongside your event schemas. Re-run the prompt after any topology change and diff the output against the previous plan. Treat plan drift as a release gate.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt template for generating a structured event replay and recovery plan review, ready to be adapted with your system's specific context.

The following prompt template is designed to be copied directly into your AI harness. It instructs the model to act as a platform architecture reviewer, analyzing your event replay and recovery plan against a comprehensive set of criteria. The template uses square-bracket placeholders for all system-specific inputs, ensuring you can adapt it without altering the core evaluation logic. Before using it, gather the required context: your system's architecture diagram or description, the current replay procedure, and any known constraints like retention windows or consumer SLAs.

code
You are a senior platform engineer specializing in event-driven architectures. Your task is to conduct a rigorous review of an event replay and recovery plan for the system described below. Your analysis must be structured, actionable, and identify failure modes that could lead to data loss, inconsistency, or extended downtime.

## System Context
[SYSTEM_ARCHITECTURE_DESCRIPTION]

## Current Replay and Recovery Plan
[REPLAY_PROCEDURE_DOCUMENTATION]

## Review Constraints
- Retention Window: [RETENTION_PERIOD_IN_DAYS]
- Consumer SLAs: [CONSUMER_SLA_DESCRIPTION]
- Idempotency Strategy: [IDEMPOTENCY_IMPLEMENTATION_DETAILS]
- Risk Level: [RISK_LEVEL]

## Required Output
Produce a structured review in the following JSON format:
{
  "executive_summary": "A concise summary of the plan's overall readiness and the top 3 risks.",
  "replay_ordering_assessment": {
    "strategy": "Description of the ordering strategy (e.g., by timestamp, by offset).",
    "risks": ["List of risks, such as out-of-order processing causing invalid state."],
    "recommendation": "A specific recommendation to mitigate ordering risks."
  },
  "idempotency_review": {
    "coverage": "Assessment of whether all consumers are idempotent for the duration of the replay window.",
    "gaps": ["List of specific consumers or operations that are not idempotent."],
    "recommendation": "A strategy to handle non-idempotent consumers during replay (e.g., side-effect journaling, dry-run mode)."
  },
  "consumer_impact_analysis": {
    "affected_consumers": ["List of all consumer groups impacted by a replay."],
    "stale_data_risk": "Analysis of the risk that consumers will act on stale data during the replay.",
    "throttling_strategy": "Recommendation for throttling the replay to avoid overwhelming consumers."
  },
  "side_effect_duplication_check": {
    "high_risk_operations": ["List of operations with external side effects (e.g., sending emails, charging credit cards)."],
    "mitigation": "For each high-risk operation, propose a specific mitigation, such as a replay-safe wrapper or manual approval gate."
  },
  "failure_mode_analysis": [
    {
      "failure_scenario": "A specific failure scenario (e.g., broker failure mid-replay).",
      "impact": "The blast radius of the failure.",
      "recovery_procedure": "Step-by-step instructions to recover from this failure."
    }
  ],
  "overall_recommendation": "APPROVED | NEEDS REVISION | REJECTED with a clear justification."
}

## Evaluation Criteria
- **Completeness:** The plan must cover all critical failure scenarios.
- **Safety:** The plan must prevent data corruption and unintended side effects.
- **Operability:** The plan must be executable by an on-call engineer under stress.

To adapt this template, replace each square-bracket placeholder with your system's specifics. For [SYSTEM_ARCHITECTURE_DESCRIPTION], provide a high-level overview of your event broker, producers, and consumers. For [REPLAY_PROCEDURE_DOCUMENTATION], paste your existing runbook. If a placeholder like [IDEMPOTENCY_IMPLEMENTATION_DETAILS] is unknown, state 'Unknown' to force the model to flag it as a critical gap. The [RISK_LEVEL] field should be set to HIGH, MEDIUM, or LOW to calibrate the review's intensity. The output schema is a strict JSON contract, making it suitable for direct parsing in an automated CI/CD pipeline or an operational dashboard. After receiving the output, always validate the JSON structure before acting on its recommendations.

IMPLEMENTATION TABLE

Prompt Variables

Inputs required for the Event Replay and Recovery Plan Prompt. Each variable must be provided or validated before the prompt can produce a reliable replay plan review.

PlaceholderPurposeExampleValidation Notes

[EVENT_SYSTEM_ARCHITECTURE]

Describes the event infrastructure topology including brokers, topics, queues, and consumer groups

Kafka cluster with 3 brokers, topics: orders, payments, inventory; consumer groups: order-processor, payment-handler

Must include broker type, topic names, and consumer group identifiers. Null allowed if [REPLAY_SCOPE] specifies a single topic

[REPLAY_SCOPE]

Defines the boundary of the replay: which events, time window, and consumer groups are affected

Replay all events from topic 'orders' between 2025-01-15T00:00:00Z and 2025-01-15T06:00:00Z for consumer group 'order-processor'

Must specify at least one topic or queue name. Time range required unless full-topic replay is intentional. Validate ISO 8601 timestamps

[CURRENT_RETENTION_CONFIG]

Documents the event retention window, log compaction settings, and storage tier policies

orders topic: 7-day retention, 1TB max; payments topic: 30-day retention with log compaction on key 'payment_id'

Retention window must be compared against [REPLAY_SCOPE] time range. Flag if replay window exceeds retention. Null allowed if unknown, but triggers a retention risk warning in output

[IDEMPOTENCY_MECHANISMS]

Lists the idempotency keys, deduplication stores, and exactly-once guards in consumer handlers

order-processor uses idempotency key 'order_id' with Redis dedup TTL of 72 hours; payment-handler uses 'payment_id' with Postgres unique constraint

Each consumer group in [REPLAY_SCOPE] must have an idempotency mechanism documented. Missing entries trigger a duplication risk flag in eval

[SIDE_EFFECT_REGISTRY]

Catalogs external side effects each consumer performs beyond event processing

order-processor: sends confirmation email via SendGrid, updates inventory in warehouse DB; payment-handler: charges Stripe, creates audit log entry

Must enumerate all external calls, writes, and notifications. Incomplete registry causes false-negative side-effect duplication checks. Null not allowed for production replays

[REPLAY_ORDERING_CONSTRAINTS]

Specifies whether events must be replayed in original order, per-key order, or can be parallel

orders topic requires per-partition ordering by 'order_id' key; payments topic allows parallel replay with no ordering constraint

Must align with partition key strategy in [EVENT_SYSTEM_ARCHITECTURE]. Ordering mismatch with partition scheme triggers out-of-order processing risk

[CONSUMER_IMPACT_ASSESSMENT]

Documents which downstream systems, dashboards, and SLIs will be affected during replay

Replay will double-process metrics in Datadog order-count dashboard; warehouse inventory may show temporary negative stock during replay window

Must list monitoring impact, user-facing impact, and data warehouse impact. Null allowed for non-production environments, but triggers a production-readiness warning

[REPLAY_OBSERVABILITY_PLAN]

Describes how replay progress, duplicates, and anomalies will be monitored during execution

Track consumer lag via Kafka consumer group offsets; alert if duplicate order_id detected in warehouse DB; log replay start/end markers in correlation ID 'replay-2025-01-15'

Must include at least one progress metric and one anomaly detection rule. Null triggers an observability gap flag in the output review

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Event Replay and Recovery Plan Prompt into an application or operational workflow.

This prompt is designed to be integrated into a pre-replay review gate, not a fully autonomous recovery system. Before an operator or an automated pipeline initiates a replay of events from a dead letter queue, archive, or primary log, this prompt should be invoked with the replay plan details. The output serves as a structured risk assessment that a human on-call engineer or a release manager must acknowledge before execution. The harness should therefore treat the model's output as a decision-support artifact, not as an execution command.

To wire this into an application, build a lightweight review service that accepts a replay plan object containing fields like source_topic, target_consumer_group, start_timestamp, end_timestamp, estimated_event_count, replay_reason, and idempotency_strategy. The service should populate the prompt's [REPLAY_PLAN_DETAILS] placeholder with a structured JSON or YAML representation of this object. After receiving the model's response, the harness must parse the output against a strict schema that includes a risk_level enum (LOW, MEDIUM, HIGH, CRITICAL), a list of failure_modes with severity ratings, and a boolean requires_manual_approval field. If the model's output fails schema validation, retry once with a repair prompt that includes the validation error. If it fails again, escalate to a human operator and log the failure for prompt debugging.

For high-risk domains such as financial transaction replays or healthcare event recovery, the harness must enforce a hard human-in-the-loop step. Even if the model returns requires_manual_approval: false, the system should require an explicit approval action from an authorized operator when the risk_level is HIGH or CRITICAL. Log the full prompt, the model's response, the validator result, and the human approval decision to an audit trail. This prompt is best used with a model that supports structured output or function calling, such as GPT-4o or Claude 3.5 Sonnet, to guarantee schema compliance. Do not use this prompt with a base model that lacks instruction-following or JSON mode, as the failure mode analysis requires precise, structured reasoning that weaker models will hallucinate or omit.

IMPLEMENTATION TABLE

Expected Output Contract

Defines the required fields, types, and validation rules for the Event Replay and Recovery Plan prompt output. Use this contract to parse, validate, and integrate the model's response into your downstream systems.

Field or ElementType or FormatRequiredValidation Rule

replay_plan_id

string (UUID v4)

Must match UUID v4 regex. Auto-generated if null.

replay_scope.events

string[]

Array must contain at least one event type string. No empty arrays.

replay_scope.timerange.start

ISO 8601 datetime

Must be a valid ISO 8601 string and occur before timerange.end.

replay_scope.timerange.end

ISO 8601 datetime

Must be a valid ISO 8601 string and occur after timerange.start.

retention_window_check

object

Must contain is_within_window (boolean) and evidence (string). If false, the plan must be blocked for human approval.

idempotency_strategy

object

Must contain key_selection (string) and deduplication_window_ms (integer). Window must be > 0.

consumer_impact.affected_consumers

string[]

Must list at least one consumer group ID. Each ID must be a non-empty string.

consumer_impact.side_effect_risks

object[]

Each object must have description (string) and mitigation (string). Array must not be empty.

PRACTICAL GUARDRAILS

Common Failure Modes

Event replay and recovery plans fail in predictable ways. These cards cover the most common failure modes when generating a replay plan and how to guard against them before production.

01

Side-Effect Duplication During Replay

What to watch: The prompt produces a replay plan that ignores idempotency gaps in downstream consumers. Replaying events re-triggers payment captures, notification sends, or external API calls that were not designed for at-least-once delivery. Guardrail: Require the prompt to explicitly list every downstream side-effect and verify idempotency key propagation for each consumer before replay is approved.

02

Replay Ordering Violations

What to watch: The generated plan assumes chronological replay is safe but ignores causal dependencies across event streams. Replaying events out of causal order corrupts aggregate state when events from different topics or partitions are interleaved incorrectly. Guardrail: Add a constraint requiring the prompt to identify cross-stream causal dependencies and specify a replay order that preserves happens-before relationships.

03

Retention Window Gaps

What to watch: The plan references events that have already aged out of the broker retention window or cold storage. The replay scope exceeds available history, producing partial recovery that looks successful but silently misses data. Guardrail: Require the prompt to validate replay start timestamps against actual retention policies and flag any requested range that exceeds available history before generating the plan.

04

Consumer Impact Blind Spots

What to watch: The plan focuses on the replaying service but ignores the blast radius on downstream consumers. Replaying a high-volume event stream saturates consumer capacity, triggers unintended alerts, or causes lag cascades in dependent services. Guardrail: Add a consumer impact assessment step that lists every consuming service, its throughput limits, and whether throttling or consumer pause is required before replay begins.

05

Missing Compensating Actions for Partial Replay

What to watch: The plan assumes replay will complete fully but provides no guidance for partial failure. If replay stops mid-stream due to a consumer crash or poison message, the system is left in an inconsistent state with no defined recovery path. Guardrail: Require the prompt to include a checkpointing strategy and a rollback or resume procedure for partial replay scenarios, including how to detect and clean up partially applied state.

06

Idempotency Key Collisions Across Replay Windows

What to watch: The plan reuses original event IDs as idempotency keys without considering that a previous partial replay already consumed some events. Deduplication stores reject legitimate replay events because keys were already seen, causing silent data loss. Guardrail: Add a constraint requiring the prompt to address idempotency key scoping—whether keys should include a replay generation marker or whether deduplication windows must be cleared before replay.

IMPLEMENTATION TABLE

Evaluation Rubric

Criteria for evaluating the quality of an AI-generated Event Replay and Recovery Plan before it is reviewed by a human or applied to a production system.

CriterionPass StandardFailure SignalTest Method

Idempotency Analysis

Identifies at least 3 specific side-effect risks during replay and proposes a concrete idempotency key strategy for each.

Plan assumes handlers are naturally idempotent or mentions idempotency only as a general requirement without specific keys.

Check output for a dedicated 'Idempotency During Replay' section with a table mapping consumer to idempotency key.

Ordering Guarantees

Explicitly states whether replay preserves original order and, if not, identifies which consumers are sensitive to out-of-order delivery.

Plan states replay will be 'in order' without addressing partition keys, or fails to list any ordering-sensitive consumers.

Search output for 'ordering' and verify a list of consumers with a boolean 'Ordering Sensitive' flag.

Retention Window Coverage

Confirms that the target replay time range is fully within the configured retention window of the event source, citing a specific retention policy.

Plan proposes a replay window without cross-referencing the event source retention configuration.

Parse output for a 'Retention Window Check' field and assert that the replay start timestamp is greater than the earliest available offset.

Consumer Impact Assessment

Lists every downstream consumer and classifies the impact of receiving replayed events as 'Safe', 'Requires Acknowledgement', or 'Blocking'.

Plan only describes the replay mechanism without enumerating consumers or assumes all consumers will handle replay without issue.

Validate that the number of consumers listed in the output matches a known [CONSUMER_REGISTRY] count.

Side-Effect Duplication Mitigation

For each consumer with external side effects, proposes a specific mitigation such as a replay token, a dry-run mode, or a downstream deduplication check.

Plan suggests 'disabling notifications' as the only mitigation without addressing database writes, third-party API calls, or ledger entries.

Check for a 'Side-Effect Mitigation' column in the consumer impact table and assert it is not null for any consumer with a 'Blocking' impact.

Operational Runbook Integration

Provides a step-by-step runbook for executing the replay, including pre-flight checks, monitoring dashboards, and a rollback procedure.

Plan describes the architecture of replay but provides no actionable sequence of commands or manual steps for an on-call engineer.

Verify the output contains a 'Runbook' section with numbered steps and a 'Rollback' subsection.

Failure Mode Coverage

Identifies at least 5 distinct failure modes specific to replay, such as poison message re-introduction, consumer lag spikes, and partial replay state.

Plan only lists generic messaging failures like 'broker down' or 'network timeout' without replay-specific scenarios.

Count the items in the 'Replay Failure Modes' section and assert the count is >= 5.

Schema Compatibility Check

Verifies that the schema version of events to be replayed is compatible with the current consumer schema registries, flagging any breaking changes.

Plan ignores schema evolution and assumes all past events will deserialize correctly with current consumer code.

Search output for 'Schema Compatibility' and assert it contains a pass/fail status or a list of incompatible schema versions.

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a single event type and a simplified replay scenario. Remove the full consumer impact matrix and focus on replay ordering and idempotency checks. Replace the detailed output schema with a free-text summary.

code
Review this event replay plan for [EVENT_TYPE] with a retention window of [RETENTION_HOURS] hours. Check replay ordering, idempotency during replay, and consumer impact. Flag side-effect duplication risks.

Watch for

  • Skipping consumer impact entirely because the prototype only tests one consumer
  • Assuming idempotency works without verifying the deduplication key survives replay
  • Missing side-effect duplication because external calls aren't mocked in the prototype
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.