Stage 1: Context discovery and target confirmation
Before drafting an edit, the agent calls wp_site_context to verify the site version, active plugins, theme, and transport health. It reads the exact post ID, post type, and status to ensure it targets the correct asset rather than an unassociated revision.
Stage 2: Dry-run change packet generation
The agent calls the modification tool with apply=False. WPGuard reads the current stored database record, performs the proposed change in memory, and returns a structured packet containing the original value, the proposed value, a cryptographic state tag, and the results of all active correction checks.
Stage 3: Deterministic correction rule enforcement
WPGuard evaluates the proposed string against registered correction checks. If a mandatory phrase—such as a booking cancellation policy, affiliate disclosure, or required header—is absent from the proposed text, WPGuard immediately rejects the change packet and halts the write.
Stage 4: State-hash verification and write execution
When the approved change packet is submitted with apply=True, WPGuard recalculates the current database record’s hash. If a human editor or background cron job edited the post between the preview and apply steps, the state check fails and prevents a stale overwrite.