Ghost body edits you can run twice (second time should do nothing)

How I verify automated Ghost body edits safely with idempotence.

Qwayk

Post body edits are the scariest kind of content automation.

So when I automate body transforms, I try to make them safe to run twice: - run once → it changes what you expect - run again → it changes nothing

That second run is a surprisingly strong verification signal.

If you’re about to run body edits in bulk, I recommend doing this “run again” check every time.

Why body edits are risky

  • Rich editors have structure (not just HTML).
  • One bad “search and replace” can break formatting.
  • A small bug can repeat across hundreds of posts.

The safety loop I use

1) Dry-run: show a plan (no writes). 2) Apply: write only with explicit flags. 3) Verify: re-fetch the post. 4) “Run again” check: dry-run again and confirm it would do 0 changes.

Example: “run twice” verification (what it should look like)

First run (plan):

{
  "mode": "plan",
  "would_change": 3,
  "operations": [
    { "action": "replace", "pattern": "<old>", "to": "<new>" }
  ]
}

After apply, second run (plan again):

{
  "mode": "plan",
  "would_change": 0,
  "note": "Second run: no changes needed."
}

Backups on apply

When the tool applies a body change, it should save: - a before snapshot - an after snapshot

That way, if something looks wrong later, you have a path to recover.

Get access