This prompt is for operations teams, platform engineers, and SREs who need to detect and analyze configuration drift across environments. It compares an intended configuration state—sourced from a Git repository, a configuration management database, or an Infrastructure as Code (IaC) definition—against an actual configuration state pulled from a running environment via an API, CLI tool, or monitoring agent. The primary job-to-be-done is turning raw, unstructured diffs into a structured drift analysis that identifies discrepancies, assesses their operational risk, and recommends reconciliation actions. Use this prompt when manual diffing is too slow, when you need a consistent format for drift tickets, or when you are building an automated configuration compliance workflow that feeds into your incident management or change control systems.
Prompt
Configuration Drift Detection Prompt Template

When to Use This Prompt
Determine if the Configuration Drift Detection Prompt Template fits your operational workflow and environment constraints.
This prompt is most effective when you already have a reliable mechanism for extracting both the intended and actual configuration states. The intended state should come from a single source of truth, such as a Terraform state file, a Kubernetes manifest in a Git repository, or a CMDB record. The actual state should be pulled from the live system using a command like kubectl get deployment -o yaml, an AWS Config snapshot, or an agent query. The prompt acts as an analysis layer that sits between this raw configuration data and the human or system that must act on it. It is not a replacement for a configuration management tool like Ansible, Puppet, or Crossplane; it will not remediate drift automatically. Instead, it produces a risk-scored, human-readable report that can be used to open a ticket, trigger a notification, or inform a manual reconciliation decision.
Do not use this prompt when the configuration states are too large for a single context window without chunking, when the drift is expected and intentional (such as during a canary deployment), or when you need real-time enforcement rather than post-hoc analysis. For high-risk environments—such as healthcare, finance, or critical infrastructure—always require human review of the drift analysis before any automated reconciliation action is taken. The prompt's risk assessment is a heuristic, not a guarantee. If you are building a fully automated closed-loop remediation system, this prompt should be one component in a pipeline that includes policy-as-code validation, approval gates, and rollback safeguards.
Use Case Fit
Where this prompt works and where it does not. Configuration drift detection requires structured inputs and clear reconciliation authority. Use these cards to decide if this prompt fits your operational context.
Good Fit: Structured Config Sources
Use when: you have machine-readable intended state (Terraform, Kubernetes manifests, Ansible inventory, JSON/YAML config files) and machine-readable actual state (API responses, CLI output, agent-collected snapshots). The prompt compares structured representations, not free-text descriptions. Avoid when: intended state exists only in runbooks, wiki pages, or tribal knowledge.
Bad Fit: Real-Time Enforcement
Avoid when: you need sub-second drift detection with automated remediation. This prompt produces a human-readable analysis, not a control loop. Use instead: a reconciliation controller (e.g., Kubernetes operator, Terraform apply) for enforcement. The prompt is for audit, investigation, and pre-remediation review.
Required Inputs
Must provide: intended configuration state, actual configuration state, environment identifier, and drift tolerance thresholds. Optional but recommended: previous drift reports for trend analysis, known safe deltas (expected differences), and reconciliation workflow constraints. Missing intended state makes the prompt produce speculation, not analysis.
Operational Risk: False-Positive Noise
Risk: dynamic fields (timestamps, ephemeral ports, auto-scaling counts, lease IDs) generate noise that obscures real drift. Guardrail: pre-process inputs to normalize or exclude known-dynamic fields before the prompt sees them. Include a [NOISE_FILTER_RULES] section listing fields to ignore or tolerance windows for numeric variance.
Operational Risk: Reconciliation Safety
Risk: the prompt recommends reconciliation actions that could cause outages if applied blindly (e.g., restarting stateful services, dropping connections). Guardrail: require the output to classify each drift item by remediation risk (safe/requires-drain/requires-outage) and include a [RECONCILIATION_CONSTRAINTS] input listing forbidden actions during business hours.
Operational Risk: Cross-Environment Confusion
Risk: comparing configs from different environment types (prod vs. staging) without accounting for intentional differences produces false drift alerts. Guardrail: include an [ENVIRONMENT_CONTEXT] section specifying the environment type, its expected baseline differences, and whether this is a peer comparison or a compliance check against a golden template.
Copy-Ready Prompt Template
A reusable prompt template for detecting configuration drift between intended and actual states across environments, with placeholders for your specific infrastructure context.
This prompt template is designed to compare an intended configuration specification against an actual observed state from a target environment. It produces a structured drift analysis that identifies discrepancies, assesses their severity, and recommends remediation actions. The template uses square-bracket placeholders that you must replace with data from your configuration management system, infrastructure-as-code repository, or monitoring tools before sending to the model. Each placeholder represents a critical input that shapes the accuracy and actionability of the drift report.
textYou are a configuration drift detection analyst. Your task is to compare the intended configuration state against the actual observed state for a specific environment and produce a structured drift analysis. ## INTENDED CONFIGURATION [INTENDED_CONFIG] ## ACTUAL OBSERVED STATE [ACTUAL_STATE] ## ENVIRONMENT CONTEXT - Environment Name: [ENVIRONMENT_NAME] - Configuration Source: [CONFIG_SOURCE] - Observation Timestamp: [OBSERVATION_TIMESTAMP] - Previous Drift Status: [PREVIOUS_DRIFT_STATUS] ## ANALYSIS CONSTRAINTS - Severity Classification Rules: [SEVERITY_RULES] - Known Acceptable Drift Patterns: [ACCEPTABLE_DRIFT_PATTERNS] - Reconciliation Workflow Safety Checks: [RECONCILIATION_SAFETY_CHECKS] - Noise Filtering Rules: [NOISE_FILTERING_RULES] ## OUTPUT SCHEMA Produce a JSON object with the following structure: { "drift_detected": boolean, "drift_summary": { "total_discrepancies": number, "critical_count": number, "warning_count": number, "info_count": number }, "discrepancies": [ { "id": "string", "config_path": "string", "intended_value": "string or object", "actual_value": "string or object", "severity": "critical|warning|info", "category": "missing|mismatch|extra|stale", "reconciliation_risk": "safe|requires_drain|requires_freeze|destructive", "recommended_action": "string", "false_positive_likelihood": "low|medium|high", "evidence": "string" } ], "reconciliation_plan": { "safe_to_proceed": boolean, "recommended_order": ["string"], "rollback_plan": "string", "estimated_duration_minutes": number }, "noise_analysis": { "filtered_discrepancies": number, "filtering_rationale": "string" } } ## INSTRUCTIONS 1. Compare every config path present in the intended configuration against the actual state. 2. Flag any config path present in actual state but missing from intended configuration as "extra" category. 3. Flag any config path present in intended configuration but missing from actual state as "missing" category. 4. Apply noise filtering rules to suppress known false positives before reporting. 5. Classify each discrepancy using the provided severity rules. 6. For each discrepancy, assess reconciliation risk based on the provided safety checks. 7. If previous drift status exists, highlight any newly introduced or resolved discrepancies. 8. Do not fabricate discrepancies. Only report differences supported by the provided data. 9. If the intended and actual states are identical, set drift_detected to false and return empty discrepancies array. ## HUMAN REVIEW REQUIRED If any discrepancy has severity "critical" or reconciliation_risk "destructive", append a prominent warning to the reconciliation_plan indicating that human approval is mandatory before remediation.
To adapt this template, replace each square-bracket placeholder with data from your configuration sources. The [INTENDED_CONFIG] should contain the desired state from your infrastructure-as-code repository, configuration management database, or approved specification. The [ACTUAL_STATE] should contain the observed state collected from your monitoring agents, API queries, or configuration audit tools. The [SEVERITY_RULES] placeholder should define your organization's classification criteria, such as treating security group changes as critical and log-level changes as info. The [NOISE_FILTERING_RULES] are essential for suppressing known transient states, auto-scaling variations, or timestamp differences that would otherwise flood the report with false positives. After generating the drift analysis, validate the JSON output against the schema before feeding it into your reconciliation workflow or ticketing system. For high-risk environments, always route discrepancies with reconciliation_risk: "destructive" through a human approval queue before any automated remediation executes.
Prompt Variables
Each variable must be validated before the prompt is sent. Missing or malformed inputs are the most common cause of drift detection false negatives and reconciliation failures.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[INTENDED_CONFIG] | The desired configuration state for the target environment | {"db.max_connections": 200, "cache.ttl_seconds": 3600} | Must be valid JSON. Schema must match [CONFIG_SCHEMA]. Reject if empty or unparseable. |
[ACTUAL_CONFIG] | The observed configuration state pulled from the running environment | {"db.max_connections": 150, "cache.ttl_seconds": 3600} | Must be valid JSON. Source must be traceable to a specific collection timestamp. Reject if null. |
[CONFIG_SCHEMA] | The expected schema for both intended and actual configs, including types and required fields | {"type": "object", "properties": {"db.max_connections": {"type": "integer"}}, "required": ["db.max_connections"]} | Must be valid JSON Schema draft-07 or later. Reject if schema does not cover all keys present in [INTENDED_CONFIG]. |
[ENVIRONMENT_LABEL] | The target environment identifier for this drift check | "production-us-east-1" | Must be a non-empty string. Must match a known environment in the deployment registry. Reject if ambiguous or missing. |
[DRIFT_TOLERANCE_RULES] | Thresholds and rules that define acceptable variance before flagging drift | {"db.max_connections": {"tolerance_percent": 5}, "cache.ttl_seconds": {"exact_match": true}} | Must be valid JSON. Keys must be a subset of [CONFIG_SCHEMA] keys. Reject if tolerance rules reference unknown keys. |
[PREVIOUS_DRIFT_REPORT] | The most recent drift report for this environment, used to suppress persistent false positives | {"report_id": "drift-2025-03-15-001", "unresolved_drifts": ["db.max_connections"]} | Nullable. If provided, must be valid JSON with report_id and unresolved_drifts fields. Used for noise filtering, not required for first run. |
[RECONCILIATION_WINDOW_HOURS] | The time window in hours within which a detected drift should have been reconciled before escalating | 24 | Must be a positive integer. Reject if zero or negative. Used to suppress alerts for in-progress reconciliations. |
[OUTPUT_FORMAT] | The desired output structure for the drift report | "structured_json" | Must be one of: "structured_json", "markdown_table", "slack_mrkdwn". Reject if unrecognized. Determines downstream integration path. |
Implementation Harness Notes
How to wire the configuration drift detection prompt into an automated reconciliation pipeline with validation, retries, and human review gates.
This prompt is designed to be called by an automated drift detection pipeline, not as a one-off manual review. The harness should fetch the intended state from your infrastructure-as-code repository or configuration management database and the actual state from your live environment's API or agent-collected snapshots. Both must be normalized into a consistent schema before injection into the [INTENDED_CONFIG] and [ACTUAL_CONFIG] placeholders. The prompt expects structured JSON inputs; passing raw YAML or untyped key-value dumps will degrade output quality and increase false positives.
After the model returns a drift analysis, the harness must validate the output against the expected [OUTPUT_SCHEMA] before acting on it. At minimum, confirm that every drift entry includes a resource identifier, the specific parameter that diverged, intended and actual values, a severity classification, and a reconciliation action. Drift entries missing any of these fields should trigger a retry with a more constrained prompt variant. For high-severity drifts—especially those involving security group rules, IAM policies, or encryption settings—route the finding to a human review queue rather than auto-remediating. The harness should log the full prompt, model response, validation result, and reviewer decision for auditability.
Model choice matters here. Use a model with strong structured output support and a large context window if you are comparing hundreds of resources in a single call. For production pipelines, prefer models that support JSON mode or tool-calling with a strict schema. Implement exponential backoff retries for malformed responses, and set a maximum of three retry attempts before escalating the entire batch to a human operator. Avoid wiring this prompt directly to an auto-remediation webhook without a human-in-the-loop gate for any drift classified as CRITICAL or HIGH severity. Start with a dry-run mode that logs intended actions without executing them, and only enable automated reconciliation for LOW severity, well-understood parameter classes after at least two weeks of clean dry-run results.
Expected Output Contract
Fields, format, and validation rules for the JSON output produced by the Configuration Drift Detection Prompt Template. Use this contract to parse, validate, and route the model response before surfacing it to downstream systems or human reviewers.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
drift_summary | object | Must contain total_checks, drifted_count, compliant_count, and unknown_count as integers. Sum of drifted, compliant, and unknown must equal total_checks. | |
drift_summary.severity | string enum | Must be one of: critical, high, medium, low, none. If any drift_item has severity critical, this field must be critical. | |
drift_items | array of objects | Array must not be empty when drift_summary.drifted_count > 0. Each item must have resource_id, config_key, intended_value, actual_value, severity, and reconciliation_risk fields. | |
drift_items[].resource_id | string | Must match the resource identifier format from [CONFIGURATION_SOURCE]. Non-empty, trimmed, and unique within the array. | |
drift_items[].config_key | string | Must be a dot-notation path matching the configuration schema from [INTENDED_STATE]. Example: cluster.autoscaling.min_nodes. | |
drift_items[].intended_value | string or number or boolean or null | Must be the exact value from [INTENDED_STATE] for the given config_key. Null allowed only if intended state explicitly sets null. | |
drift_items[].actual_value | string or number or boolean or null | Must be the exact value from [ACTUAL_STATE] for the given config_key. Null allowed only if the key is absent or explicitly null in actual state. | |
drift_items[].severity | string enum | Must be one of: critical, high, medium, low. Severity must align with [SEVERITY_RUBRIC] rules. Critical requires reconciliation_risk to be high. | |
drift_items[].reconciliation_risk | string enum | Must be one of: high, medium, low. High risk requires a non-empty reconciliation_note explaining the danger. Low risk items may omit reconciliation_note. | |
drift_items[].reconciliation_note | string or null | Required when reconciliation_risk is high. Must describe the specific danger of auto-remediation. Null or omitted for low-risk items. | |
false_positive_candidates | array of objects or null | If present, each object must have resource_id, config_key, and reason. Reason must explain why this drift may be intentional or a monitoring artifact. | |
reconciliation_workflow_safe | boolean | Must be true only if no drift_item has reconciliation_risk high and no false_positive_candidate has unresolved ambiguity. Otherwise false. | |
generated_at | string (ISO 8601) | Must be a valid ISO 8601 timestamp in UTC. Parse and verify it is within 5 minutes of the request time. Stale outputs should trigger a retry. |
Common Failure Modes
Configuration drift detection prompts fail in predictable ways. These cards cover the most common failure modes and the guardrails that prevent them from reaching production.
False-Positive Noise Flood
What to watch: The prompt flags every whitespace difference, timestamp, or ephemeral runtime value as a drift violation, overwhelming operators with noise. This happens when the model lacks explicit instructions about which fields are transient or expected to vary. Guardrail: Provide a [DRIFT_IGNORE_PATTERNS] list in the prompt that explicitly names fields, keys, and value patterns to exclude. Require the model to classify each finding as 'actionable' or 'informational' before output.
Reconciliation Workflow Blindness
What to watch: The prompt identifies drift correctly but recommends unsafe reconciliation actions—such as overwriting production configs from staging or applying changes without ordering dependencies. The model treats all drift as equally urgent and reversible. Guardrail: Include a [RECONCILIATION_CONSTRAINTS] block that specifies safe reconciliation order, required approval gates, and immutable fields. Instruct the model to flag any drift that requires cross-team coordination before recommending action.
Environment Context Collapse
What to watch: The model conflates intended state across environments, treating a staging-specific value as the intended production state or vice versa. This occurs when the prompt does not clearly separate the source of truth from comparison targets. Guardrail: Use explicit [INTENDED_STATE_SOURCE] and [COMPARISON_TARGETS] fields. Require the model to label which environment each finding originates from and never assume one environment's config is authoritative for another without explicit instruction.
Secret and Credential Leakage in Output
What to watch: The prompt includes configuration values that contain secrets, tokens, or credentials, and the model reproduces them verbatim in the drift report. This turns a monitoring tool into a secret exfiltration vector. Guardrail: Pre-process all inputs to redact secrets before they reach the prompt. Add a [SECRET_REDACTION_CHECK] instruction that tells the model to never output values matching secret patterns and to replace them with '<REDACTED>' in any generated summary.
Schema Version Mismatch Misattribution
What to watch: The model flags legitimate schema version differences between environments as drift violations, failing to recognize that staging may intentionally run a newer schema version ahead of production. This generates false urgency and unnecessary rollback requests. Guardrail: Include a [SCHEMA_VERSION_POLICY] section that defines which version differences are expected and which constitute real drift. Instruct the model to cross-reference version metadata before classifying a structural difference as a violation.
Inheritance and Override Confusion
What to watch: The model fails to understand configuration inheritance hierarchies, flagging an inherited default value in one environment as missing when compared to an override in another. This produces drift reports that are technically correct but operationally misleading. Guardrail: Provide an [INHERITANCE_MODEL] description that explains how defaults, overrides, and environment-specific values compose. Require the model to trace each value to its resolution source before declaring drift.
Evaluation Rubric
Criteria for testing the Configuration Drift Detection Prompt before production deployment. Each row defines a pass standard, a failure signal, and a concrete test method.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Drift completeness | All non-compliant resources from [INTENDED_STATE] and [ACTUAL_STATE] are listed with a unique resource identifier | Output omits a resource that appears in a manual diff of the two state inputs | Run the prompt with a known pair of state files containing exactly 3 intentional drifts; assert output contains exactly 3 drift items |
Severity classification accuracy | Each drift item is assigned exactly one severity from the allowed enum: CRITICAL, HIGH, MEDIUM, LOW | A drift item is assigned a severity outside the allowed enum or is missing a severity field | Validate output JSON against the [OUTPUT_SCHEMA] enum constraint; flag any severity value not in the allowed set |
False-positive noise filtering | Resources with identical configuration across both states produce zero drift items | Output includes a drift item where the intended and actual values are identical or differ only in whitespace | Inject a state pair where 5 resources are identical; assert the drift_items array length is 0 |
Reconciliation workflow safety | Each CRITICAL or HIGH severity drift includes a non-empty reconciliation_notes field with a rollback-safe action | A CRITICAL drift item has an empty or missing reconciliation_notes field | Parse output; for every item with severity CRITICAL or HIGH, assert reconciliation_notes is a non-empty string |
Output schema compliance | Output is valid JSON matching the [OUTPUT_SCHEMA] exactly, including all required fields and correct types | Output fails JSON parse, is missing a required field, or contains an extra top-level key | Validate output with a JSON Schema validator using the provided [OUTPUT_SCHEMA]; reject on any validation error |
Source grounding | Every drift item references the specific resource path or identifier from the input state files | A drift item contains a resource_id that does not appear in either [INTENDED_STATE] or [ACTUAL_STATE] | Extract all resource_id values from the output; assert each is present in at least one of the input state files |
Summary token budget | The executive_summary field is under 150 tokens and contains no markdown formatting | The executive_summary exceeds 150 tokens or contains markdown syntax like bold or - bullets | Count tokens in the executive_summary field using the target model's tokenizer; assert count <= 150 and no markdown characters present |
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
Start with the base drift detection prompt but relax the output schema. Accept a free-text summary of differences instead of a strict JSON diff. Use a single environment pair (e.g., staging vs. production) and limit the configuration scope to one service. Skip the reconciliation workflow safety checks and false-positive filtering instructions initially.
Watch for
- The model hallucinating configuration values it cannot see
- Missing critical drift because the prompt doesn't enforce exhaustive comparison
- Overly verbose output that's hard to scan during incident response
- No baseline for what 'intended state' means, leading to ambiguous comparisons

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