Golden Flow: FLOW-04

Drift Detection & Recovery

Detecting when an agent's execution diverges from the original plan and automatically triggering a recovery or replanning sequence.

Goal

Validate that the runtime can detect when the PSG state does not match reality (e.g., file deleted).

Success Criteria

DriftDetected event emitted, Recovery Plan generated.

Sequence

Execution Steps

The normative sequence of operations for this flow.

1

State Snapshot

Periodic snapshot of system state.

2

Drift Analysis

Comparison of actual vs. expected state.

3

Alert Generation

Drift event triggers system alert.

4

Recovery Plan

Agent generates plan to fix drift.

5

State Rollback

Optional rollback to last known good state.

Normative

Normative Scope

This flow normatively aggregates and enforces existing constraints from the following MPLP modules.

Core Module

The runtime MUST continuously monitor for state divergence from the expected plan.

Trace Module

All drift detection and recovery events MUST be recorded in the Trace.

Validation

Failure Conditions

Execution of this flow MUST be considered non-conformant if any of the following conditions occur.

State divergence occurs but is not detected by the runtime.

DriftDetected event is not emitted when drift occurs.

Recovery plan is not generated or is invalid.

Drift recovery events are not recorded in the Trace.

Protocol Compliance Requirement

Any MPLP-conformant runtime is expected to pass this flow without violating any of the normative constraints defined above.

Failure to satisfy this flow results in a non-conformant MPLP implementation.