Closed loop
The agent loop, end-to-end.
Every Mendhelm action is one pass through the same five phases — detect, diagnose, propose, apply, report. Diff first, dry-run, promote, audit, surface it on Monday. No silent fixes; no out-of-band writes; no Monday-morning surprise because the loop closed over the incident overnight.
The loop, visualized
Five phases. One cycle. Closed on every incident.
The closure arrow matters most: every digest.row feeds back into the next evidence.record, so the agent learns the shape of your week rather than responding in isolation.
loop · 5 phases · 1 cycleclosed every incidentSection 01 · The five phases
Every agent action is one pass through the same five phases.
The codes are stable across the site — an audit row, a digest entry, a Slack alert — so when you see 02 · DIAGNOSE on Monday you know what kind of evidence produced it.
step / 01loop · 01DETECT
Diff declared vs. provisioned state across every connected cloud account.
evidence.recordstep / 02loop · 02DIAGNOSE
Read the diff against the last-approved manifest + the change window. Match it to a configured drift-class.
intent.diffstep / 03loop · 03PROPOSE
Generate the dry-run envelope. Pin scope, pin intended diff, pin the reviewer policy.
plan.envelopestep / 04loop · 04APPLY
Promote after the policy window (or human ack). Roll back if the actual diff diverges from intent.
execution.outcomestep / 05loop · 05REPORT
Roll the daily evidence up into the Monday digest row, signed and addressable.
digest.rowSection 02 · End-to-end walkthrough
A security group that tried to drift back into prod at 3 AM.
One incident, walked through all five phases. Timestamps are real-shaped; the resource names are a representative scenario. The same loop runs whether the drift is a security group, a K8s config map, an IAM policy, or a tag that fell off overnight.
walkthrough · eu-west-1 · checkout-prod-rds[03:00:14 UTC]01 · DETECTactual vs. declaredevidence.recordThe
eu-west-1check loop flags that the security group oncheckout-prod-rdshas drifted: ingress rule0.0.0.0/0 :5432reappeared overnight after a Terraform apply outside the change window.[03:00:31 UTC]02 · DIAGNOSEdiff = 1 line addintent.diffAgent fetches the last-approved manifest (signed off 12 days ago) and finds the rule explicitly removed there. Diff = one line add. No PagerDuty search: this matches the configured
drift-class: security-group-regression.[03:00:48 UTC]03 · PROPOSEenvelope · dry-runplan.envelopeProposed envelope: revoke the bad rule, restore
10.0.0.0/16 :5432, attach the diff to an audit recordagent_id=reliability-bot,intent=regression-rollback. Server-side dry-run on the AWS control plane; diff only.[03:01:02 UTC]04 · APPLYobserved · promotedexecution.outcomePromotion policy window for
security-group-regressionis 60s with no human required; agent applies, observes the new rule is gone, and posts a PR titledchore(tf): re-pin checkout-prod-rds ingress to 10.0.0.0/16encoding corrected intent so the next apply can't reintroduce it.[Monday 09:00 local]05 · REPORTrolled up · mondaydigest.rowThe weekly digest rolls this incident up under
Drift items · clearedandHealing actions · patch + roll_back. The audit row links to a representative sample row showing the exact shape on Monday.
Why this is the closed loop: evidence.record from 03:00:14 returned to observation at Monday 09:00. The audit row, the PR, and the digest row point at the same intent — so the next change window can't reintroduce the regression, even if the original Terraform file is touched again.
Continue the loop
See what a Monday digest row actually looks like — and what we promise about scope.
The sample report is the same shape Mendhelm ships every Monday. The trust page is the manifest of what the agent will and won't touch while running this loop on your behalf — and /status is the 90-day uptime envelope of the loop itself.
closed loop · dry-run · audit · monday