Inferensys

Prompt

Agent State Reconciliation Prompt After Partition

A practical prompt playbook for infrastructure engineers resolving divergent agent state after network partitions or offline operation. Produces reconciled state with conflict resolutions and merge decisions, with eval for consistency guarantees and data loss prevention.
Data scientist building training data pipeline on laptop, data preprocessing visible, technical workspace.
PROMPT PLAYBOOK

When to Use This Prompt

Defines the job-to-be-done, ideal user, required context, and boundaries for the agent state reconciliation prompt after a network partition.

This prompt is designed for infrastructure engineers and platform operators who must reconcile divergent agent state after a network partition, offline operation, or split-brain scenario. In multi-agent systems, partitions cause agents to operate on stale or isolated copies of shared state. When connectivity is restored, those copies must be merged into a single consistent state without data loss, duplicate work, or conflicting decisions. The prompt takes the pre-partition state, the divergent state copies from each partition side, and a conflict resolution policy, then produces a reconciled state document with explicit merge decisions, conflict resolutions, and an audit trail.

Use this prompt when you have two or more divergent state snapshots that must be merged deterministically after the partition has healed and all copies are available for analysis. The ideal user is a platform engineer or SRE who understands the state schema, the semantics of the data, and the business rules that should govern conflict resolution. Required inputs include the pre-partition baseline state, the divergent state copies from each side of the partition, and a conflict resolution policy that specifies which side wins for each field or how to merge values. The prompt works best when the state is structured (JSON, protobuf, or typed objects) and the conflict rules can be expressed declaratively.

Do not use this prompt for real-time state synchronization, live CRDT-based merges, or scenarios where the partition is still active and writes are ongoing. This prompt is not a substitute for a distributed consensus protocol or a CRDT implementation. It is a post-mortem reconciliation tool for scenarios where automated merge strategies failed or were not available. Avoid using this prompt when the state is unstructured natural language without clear field boundaries, as the model may hallucinate merge decisions. For high-risk domains such as financial ledgers, healthcare records, or safety-critical systems, always require human review of the reconciled output before applying it to the live system. The prompt produces an audit trail, but the final merge decision must be verified by an operator who understands the domain consequences.

PRACTICAL GUARDRAILS

Use Case Fit

Agent state reconciliation after a partition is one of the hardest problems in distributed AI systems. This prompt is designed for infrastructure engineers who need to merge divergent agent states with explicit conflict resolution and auditability. It is not a general-purpose merge tool.

01

Good Fit: Post-Partition Agent Recovery

Use when: A network partition or offline operation caused two or more agents to diverge on shared state, and you now need a single reconciled state with explicit merge decisions. Guardrail: Ensure each agent provides its state with a vector clock or timestamp so the prompt can reason about causal ordering.

02

Bad Fit: Real-Time Conflict-Free Replicated Data Types

Avoid when: You are using CRDTs or other automatic merge strategies that resolve conflicts deterministically without semantic reasoning. This prompt adds latency and cost for problems that don't need LLM-level judgment. Guardrail: Use this prompt only when conflicts require domain reasoning that cannot be encoded in deterministic merge rules.

03

Required Input: Divergent State Snapshots with Provenance

What to watch: The prompt cannot reconcile state it cannot see. Each agent's state must include the last known synchronized point, the operations applied since, and any conflict markers the agent itself detected. Guardrail: Validate that each input includes a last_common_ancestor reference and a change_log before invoking reconciliation.

04

Operational Risk: Silent Data Loss on Unresolvable Conflicts

Risk: The model may discard one agent's changes entirely if it cannot determine a safe merge, leading to data loss without explicit acknowledgment. Guardrail: Require the output schema to include an unresolvable_conflicts array and a data_loss_risk flag. Escalate any output where data_loss_risk is true to a human operator.

05

Operational Risk: Merge Order Sensitivity

Risk: The model's reconciliation decision can be sensitive to the order in which agent states are presented, producing different merge outcomes for the same underlying data. Guardrail: Run the prompt twice with input order reversed and compare the reconciled_state outputs. Flag any semantic divergence for review before committing the merge.

06

Bad Fit: High-Throughput Streaming State

Avoid when: Agents are producing state updates at sub-second intervals where reconciliation latency would create backpressure. This prompt is designed for infrequent, high-stakes reconciliation events. Guardrail: Batch updates and trigger reconciliation only on partition heal events or at defined checkpoints, not on every state change.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A copy-ready prompt template for reconciling divergent agent state after a network partition or offline operation.

This prompt template is the core instruction set you will send to a reconciliation agent. It is designed to ingest two or more divergent state snapshots, identify conflicts, and produce a single, authoritative reconciled state. The template uses square-bracket placeholders for all dynamic inputs. Before executing, you must replace every placeholder with concrete values from your system, such as the actual agent states, the priority rules for your domain, and the required output schema.

text
You are a State Reconciliation Agent. Your task is to resolve divergent state snapshots from multiple agent instances that were separated by a network partition or offline operation. Produce a single, reconciled state object that represents the most accurate and complete truth.

## INPUT STATE SNAPSHOTS
[AGENT_STATE_SNAPSHOTS]

## RECONCILIATION RULES
Apply the following rules in order of priority to resolve conflicts:
[RECONCILIATION_RULES]

## OUTPUT SCHEMA
Your entire response must be a single JSON object conforming to this schema:
{
  "reconciled_state": {
    // The final, merged state object. Include all fields from the input schema.
  },
  "conflict_resolutions": [
    {
      "field_path": "string", // e.g., 'user_profile.email'
      "conflict_type": "string", // e.g., 'UPDATE_CONFLICT', 'DELETE_UPDATE_CONFLICT'
      "winning_value": "any",
      "losing_values": ["any"],
      "resolution_strategy": "string", // e.g., 'LAST_WRITER_WINS', 'CUSTOM_RULE', 'MANUAL_REVIEW_REQUIRED'
      "rule_applied": "string" // The specific rule from RECONCILIATION_RULES that decided this
    }
  ],
  "manual_review_required": [
    {
      "field_path": "string",
      "reason": "string",
      "conflicting_values": ["any"]
    }
  ],
  "data_loss_risk": "string", // 'NONE', 'LOW', 'MEDIUM', 'HIGH'
  "reconciliation_summary": "string" // A brief natural language summary of actions taken
}

## CONSTRAINTS
- Do not invent data. If a value cannot be resolved with high confidence, flag it for manual review.
- Preserve the full audit trail of which agent contributed which value.
- If a delete operation conflicts with an update, apply the rule set but explicitly log the risk.
- The reconciled_state must be a complete, valid object according to the application's state schema.

To adapt this template, start by replacing [AGENT_STATE_SNAPSHOTS] with a structured list of the divergent states, including a unique agent ID and a vector clock or timestamp for each. The [RECONCILIATION_RULES] placeholder should be replaced with a clear, ordered list of your business logic, such as 'Last Writer Wins based on timestamp' or 'Agent A's state is authoritative for financial fields.' After running this prompt, always validate the output against your application's state schema before persisting it. For high-risk domains, the manual_review_required list must be surfaced to a human operator for approval before any state is merged.

IMPLEMENTATION TABLE

Prompt Variables

Every placeholder required by the Agent State Reconciliation Prompt After Partition. Use this table to prepare inputs, validate data before injection, and catch missing or malformed values before they cause merge failures.

PlaceholderPurposeExampleValidation Notes

[PARTITION_EVENT_LOG]

Raw log of events that occurred on each side of the partition, including timestamps, agent IDs, and operation types.

{"side_a": [{"agent": "agent-3", "op": "write", "key": "order-42", "value": "confirmed", "ts": "2025-01-15T10:23:00Z"}], "side_b": [{"agent": "agent-7", "op": "write", "key": "order-42", "value": "cancelled", "ts": "2025-01-15T10:24:00Z"}]}

Must be valid JSON with at least two sides. Each event requires agent, op, key, value, and ts fields. Reject if timestamps are missing or unparseable.

[PRE_PARTITION_STATE_SNAPSHOT]

The last known consistent state before the partition occurred, used as the baseline for conflict detection.

{"order-42": {"value": "pending", "version": 12, "last_agent": "agent-3", "last_modified": "2025-01-15T10:20:00Z"}}

Must be a valid JSON object with versioned entries. Reject if version numbers are missing or if snapshot timestamp is after any partition event timestamp.

[CONFLICT_RESOLUTION_POLICY]

Declared rules for resolving write-write conflicts: last-write-wins, majority-vote, agent-priority, or custom merge function.

{"strategy": "agent-priority", "priority_order": ["agent-3", "agent-7"], "custom_merge": null}

Must specify a valid strategy enum. If agent-priority, priority_order must be a non-empty array. If custom_merge, a function reference must be provided and validated at the application layer.

[AGENT_CAPABILITY_MANIFEST]

Declared capabilities and authority scopes for each agent involved in the partition, used to validate whether an agent was authorized to perform an operation.

{"agent-3": {"scopes": ["order.write", "order.cancel"], "priority": 1}, "agent-7": {"scopes": ["order.read"], "priority": 2}}

Must map every agent appearing in the event log to a scopes array. Reject if an agent performed an operation outside its declared scopes; flag for human review.

[RECONCILIATION_OUTPUT_SCHEMA]

The exact JSON schema the reconciled state must conform to, including required fields, types, and conflict resolution metadata.

{"type": "object", "required": ["reconciled_state", "conflicts", "merge_decisions"], "properties": {"reconciled_state": {"type": "object"}, "conflicts": {"type": "array"}, "merge_decisions": {"type": "array"}}}

Must be a valid JSON Schema draft. Validate output against this schema post-generation. Reject output that omits required fields or includes extra top-level keys.

[DATA_LOSS_PREVENTION_RULES]

Explicit rules for what must never be silently discarded: tombstone preservation, audit trail retention, and mandatory human review triggers.

{"preserve_tombstones": true, "retain_audit_trail": true, "human_review_triggers": ["value_conflict", "scope_violation", "missing_event"]}

Must be a valid JSON object with boolean and array fields. If human_review_triggers is non-empty, the application layer must route matching conflicts to a review queue before finalizing state.

[MAX_RECONCILIATION_LATENCY_MS]

The maximum acceptable time in milliseconds for the reconciliation process, used to trigger fallback or escalation if the prompt or merge takes too long.

5000

Must be a positive integer. Application layer must enforce a timeout. If reconciliation exceeds this threshold, abort and escalate with partial results and a timeout flag.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire this prompt into a production reconciliation pipeline.

The reconciliation prompt is the decision core of a larger state-recovery pipeline. It should never run in isolation. Surround it with pre-processing that collects divergent state snapshots, post-processing that validates the merged output against a known schema, and a persistence layer that writes the reconciled state only after all checks pass. The prompt itself is stateless; the harness owns state, idempotency keys, and retry decisions.

Before calling the model, assemble the two divergent state objects, the partition event metadata (start time, end time, affected agents), and any pre-merge conflict flags from deterministic checks. Pass these as [STATE_A], [STATE_B], and [PARTITION_CONTEXT]. After the model returns, run a schema validator against the reconciled output to confirm required fields exist, timestamps are monotonic, and no data was silently dropped. If validation fails, retry once with the validator error message appended to [CONSTRAINTS]. If it fails again, log the full input/output pair and escalate to a human operator. For high-risk domains such as financial ledgers or clinical records, require a human approval step before the reconciled state is committed—the model's output becomes a proposal, not the final state.

Model choice matters here. Use a model with strong structured-output support and a context window large enough to hold both full state objects plus instructions. GPT-4o and Claude 3.5 Sonnet are good defaults. Avoid smaller models that may hallucinate merge operations or drop fields. Set temperature=0 to reduce variance in conflict-resolution decisions. Log every reconciliation attempt with the partition ID, model version, input hashes, output diff from previous state, and the final merge decision. This audit trail is essential for debugging silent data corruption and proving consistency guarantees to compliance reviewers. Wire the harness to a dead-letter queue for any reconciliation that fails validation after retries—never silently discard a failed merge.

IMPLEMENTATION TABLE

Expected Output Contract

Fields, types, and validation rules for the reconciled state object produced after resolving divergent agent partitions. Use this contract to validate outputs before merging into the authoritative state store.

Field or ElementType or FormatRequiredValidation Rule

reconciled_state

object

Must be a valid JSON object matching the application state schema. Reject if missing or not parseable.

reconciled_state.entities

array<object>

Each entity must have a unique [ENTITY_ID] field. Array must not be empty unless all partitions were empty. Validate uniqueness.

reconciled_state.entities[*].version

integer

Must be a positive integer greater than the maximum version from input partitions. Used as the new authoritative version.

conflict_resolutions

array<object>

One entry per detected conflict. Each entry must contain conflict_type, entity_id, chosen_source, and resolution_strategy. Reject if conflicts exist but this array is empty.

conflict_resolutions[*].conflict_type

string (enum)

Must be one of: write_write, delete_update, schema_mismatch, tombstone_violation. Reject unknown values.

conflict_resolutions[*].resolution_strategy

string (enum)

Must be one of: last_write_wins, partition_priority, merge_fields, manual_review_required. If manual_review_required, set output.human_approval_required to true.

lost_data_risk

boolean

Set to true if any entity present in a partition is absent from reconciled_state without an explicit tombstone or delete marker. False otherwise. Must be consistent with conflict_resolutions.

human_approval_required

boolean

Set to true if any resolution_strategy is manual_review_required or if lost_data_risk is true and confidence_score is below [CONFIDENCE_THRESHOLD]. Validate against conflict_resolutions and confidence_score.

PRACTICAL GUARDRAILS

Common Failure Modes

State reconciliation after a partition is a high-stakes merge operation. These are the most common production failure modes and how to guard against them before they corrupt shared state.

01

Silent Data Loss on Last-Write-Wins

What to watch: When two agents modify the same record during a partition, a naive last-write-wins merge silently discards one agent's valid state changes. The system appears consistent but has lost critical updates. Guardrail: Implement a three-way merge prompt that compares both divergent states against the last known common ancestor. Require the model to output explicit conflict_resolved and discarded_fields arrays in the schema so no data disappears without an audit trail.

02

Merge Artifact Hallucination

What to watch: The model invents a compromise value that exists in neither divergent state, creating plausible but fabricated data. This is common when the prompt asks the model to 'reconcile' without strict grounding constraints. Guardrail: Add a hard constraint to the prompt: 'Every field in the reconciled state MUST originate from either State A, State B, or the common ancestor. If no value can be selected, set the field to null and flag it in unresolved_fields.' Validate output with a deterministic diff checker before accepting the merge.

03

Temporal Ordering Confusion

What to watch: The model misinterprets which state is newer when timestamps are missing, clocks are skewed, or vector clocks are malformed. It merges in the wrong direction, reverting intentional updates. Guardrail: Provide explicit Lamport timestamps or hybrid logical clocks in the prompt context. Instruct the model to treat clock values as authoritative ordering signals and to flag any state pair where clock comparison is ambiguous as requiring human review rather than guessing.

04

Schema Drift Between Partitions

What to watch: One agent operated under an updated schema during the partition while the other used an older version. The model attempts to merge structurally incompatible fields, producing malformed output that fails downstream validation. Guardrail: Include the schema version in every state payload. Add a pre-merge check step that detects version mismatches and routes to a schema migration prompt before reconciliation. If migration is impossible, escalate to a human operator with both raw states preserved.

05

Incomplete Conflict Resolution

What to watch: The model resolves some conflicts but silently skips others, especially when the prompt context is long and conflicts appear late in the input. The output passes validation but contains unresolved divergent values. Guardrail: Require the output schema to include a conflict_summary object with an explicit count: total_conflicts_detected, conflicts_resolved, and conflicts_escalated. Add an eval assertion that conflicts_resolved + conflicts_escalated == total_conflicts_detected. If the counts don't match, reject the merge and retry with explicit attention drawn to unresolved items.

06

Context Window Truncation on Large State

What to watch: When both divergent states are large, the combined prompt exceeds the context window. The model receives truncated input and reconciles from incomplete data, producing a merge that looks valid but is missing entire sections of state. Guardrail: Implement a pre-flight context budget check. If the combined state exceeds a safe threshold, split reconciliation by state section (e.g., reconcile goals separately from observations) and merge the results deterministically. Log a warning whenever sectioned reconciliation is used so operators can audit for cross-section dependency errors.

IMPLEMENTATION TABLE

Evaluation Rubric

Criteria for testing the reconciled state output before shipping the Agent State Reconciliation Prompt to production. Each row defines a pass standard, a failure signal, and a concrete test method.

CriterionPass StandardFailure SignalTest Method

Conflict Resolution Completeness

Every conflict marker in [DIVERGENT_STATES] has a corresponding resolution entry in the output

Output is missing a resolution for one or more identified conflicts

Parse output JSON and assert that the set of resolved conflict IDs matches the set of input conflict IDs

Data Loss Prevention

All non-conflicting fields from both partitions are preserved in the reconciled state

A field present in [PARTITION_A] or [PARTITION_B] is absent from the reconciled state without an explicit deletion justification

Diff the union of input partition keys against the reconciled state keys; flag any missing keys not listed in a resolved conflict

Merge Strategy Adherence

Each resolution applies a strategy from [ALLOWED_STRATEGIES] and includes a human-readable justification

A resolution uses an undefined strategy or omits the justification field

Validate that each resolution object's 'strategy' field is in the allowed enum and 'justification' is a non-empty string

Schema Compliance

The reconciled state conforms exactly to [OUTPUT_SCHEMA] with all required fields present

Output fails JSON Schema validation against [OUTPUT_SCHEMA]

Run a programmatic JSON Schema validator against the output; fail on any validation errors

Source Provenance

Every field in the reconciled state includes a 'source' attribute tracing back to [PARTITION_A], [PARTITION_B], or 'merged'

A field is missing the 'source' attribute or has an unrecognized source value

Traverse the reconciled state object and assert that every leaf field has a 'source' key with a value in ['partition_a', 'partition_b', 'merged']

Timestamp Consistency

The reconciled state's 'last_updated' timestamp is later than both partition timestamps

The output timestamp is earlier than or equal to either [PARTITION_A_TIMESTAMP] or [PARTITION_B_TIMESTAMP]

Parse timestamps as epoch values and assert output_timestamp > max(partition_a_timestamp, partition_b_timestamp)

Conflict Explanation Quality

Each conflict resolution justification references the specific divergent values and explains why the chosen value was selected

A justification is generic (e.g., 'resolved conflict') without mentioning the conflicting values or selection rationale

Use an LLM-as-judge check with a rubric requiring mention of both original values and a reason for the choice; fail if score below threshold

No Hallucinated Data

The reconciled state contains no fields or values not present in either partition or explicitly derived by a declared merge rule

Output introduces a novel value not traceable to input partitions or a documented merge computation

Compute the set difference between output field paths and the union of input partition field paths; flag any novel paths not generated by a declared merge function

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Add strict schema validation, retry logic with conflict-escalation paths, structured logging of every reconciliation decision, and a pre-defined eval suite. Wire the prompt into a reconciliation service that enforces [OUTPUT_SCHEMA] before accepting state. Include a human-review queue for unresolved conflicts.

Prompt modification

  • Add to [CONSTRAINTS]: "Every field in reconciled_state must include a 'source' attribute indicating which partition(s) contributed the value and a 'confidence' score."
  • Add to [OUTPUT_SCHEMA]: a required merge_audit array with entries for every merged field, including field_path, partition_a_value, partition_b_value, resolved_value, resolution_strategy, and timestamp.
  • Add to [CONFLICT_RESOLUTION_RULES]: "When LWW is insufficient, apply domain-specific resolution: for counters use sum, for sets use union, for status fields use the most terminal state."

Watch for

  • Silent format drift when model outputs valid JSON that doesn't match the schema
  • Missing human review triggers for high-impact state conflicts
  • Reconciliation loops where a bad merge triggers another partition event
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.