DEV Community

Avery Lin
Avery Lin

Posted on

Opinion: A Free Model Is Most Useful When It Writes the Rollback, Not the Change

The most underused use of a free model in operations is not generating a clever change. It is forcing the model to write the inverse of that change before the change is allowed to run anywhere that matters. The industry spends a great deal of energy on whether an AI agent should be permitted to call a tool, but the more useful gate is smaller and older than an agent framework: a transaction without a reversibility path is a defect, not a feature.

This article argues for a rollback-first discipline when free model access makes iteration cheap. The position is deliberately narrow. Free models are not magically safer than paid ones, and a free server does not turn a hallucinated maintenance script into a trustworthy operation. What the combination does is remove the economic excuse for accepting one-way changes. When producing a second draft costs little and testing it in a disposable host costs little, the only reason to skip the inverse plan is process laziness.

Disclosure: This article was prepared as part of MonkeyCode's product outreach. MonkeyCode offers free model access and a free server option, and those two properties are the only product capabilities I lean on below. Nothing here assumes a particular model name, quota, benchmark, or permanence guarantee. The workflow would still be valid with a locally downloaded model and an old laptop on a separate VLAN.

The rollback gap does not show up in a code review

Code review is structured around the diff a change introduces. A reviewer sees files added, lines moved, and configuration values altered, but the inverse plan is usually absent because it was never requested. The model produces what the prompt asks for, and the default prompt is biased toward forward execution. If you ask a model to "add monitoring user and rotate keys," you should not be surprised that the output tells you how to add a user and rotate keys without telling you how to restore the previous key file or remove the user cleanly.

That asymmetry matters more than the initial correctness rate. Suppose the forward change passes a static check and even a smoke test. The operator still has to recover if the service degrades an hour later, if a scheduled job fails in a different timezone, or if the change interacts badly with a package upgrade that was not part of the plan. A rollback gap converts recoverable mistakes into all-night incidents because the human is now doing inverse engineering under pressure.

A more useful prompt changes the definition of done. The model should return three artifacts: a forward plan, an inverse plan, and the conditions under which the inverse plan is the right action. The forward plan may still be wrong, but the operator now has a way to evaluate reversibility, and reversibility is a property that can be checked without trusting the model's explanation of why the change works.

A small checker that treats reversibility as a testable property

Textual alignment between a forward and inverse plan is not semantic proof. It is, however, cheap evidence that the model paid attention to the cleanup half of the task, and it catches the most common failure mode: a model that adds a resource but never creates the corresponding removal step.

The following checker is deliberately naive. It scans a Markdown plan for forward actions and flags a class of action when no matching inverse verb appears. It does not prove that the inverse plan actually removes the same resource, restores the same bytes, or cleans the same state. Use it as a review aid before a human reads the plan, not as a replacement for that human.

#!/usr/bin/env bash
# reversibility-pair-check.sh
# Usage: bash reversibility-pair-check.sh plan.md
set -euo pipefail

plan="${1:?path to AI-generated plan required}"
pairs=(
  "install|remove"
  "create|delete"
  "add|drop"
  "enable|disable"
)

missing=0
for pair in "${pairs[@]}"; do
  forward="${pair%%|*}"
  reverse="${pair##*|}"
  if grep -Eiq "$forward" "$plan" && ! grep -Eiq "$reverse" "$plan"; then
    echo "FAIL: plan contains '$forward' action but no '$reverse' inverse"
    missing=1
  fi
done

exit "$missing"
Enter fullscreen mode Exit fullscreen mode

An example plan fragment that passes this narrow check might include both directions for each action:

- [forward] add system group: app-audit
- [inverse] remove system group: app-audit

- [forward] install log shipping cron entry
- [inverse] remove log shipping cron entry

- [forward] enable tcp keepalive in service config
- [inverse] restore previous tcp keepalive setting from backup file
Enter fullscreen mode Exit fullscreen mode

The third inverse is intentionally not a one-word verb. A good inverse plan often needs to restore rather than delete, and the checker above will miss that distinction. That limitation is acceptable if the checker is treated as a trigger for human attention. If the plan says "enable" without a clear "disable" or "restore" step, a reviewer should stop reading and ask for the inverse. The point is not to automate approval; it is to make missing reversibility loud.

Rehearsing both directions on a free server

A reversibility pair that looks complete on paper can still fail at runtime. The only way to test an inverse plan without risking production is to run the forward change in a disposable environment and then execute the inverse plan against the same host. A free server option changes the economics of that rehearsal. When the host costs nothing and can be discarded after the test, there is very little reason to accept a rollback script that has never actually rolled anything back.

The following two-sided smoke test assumes that you have generated a forward.sh, a rollback.sh, and a smoke.sh that checks the functional state. It copies all three to a disposable host, runs forward, runs smoke, runs rollback, and runs smoke again. The last run is the one that matters.

#!/usr/bin/env bash
# two-sided-rehearse.sh
# Requires ssh access to a disposable host and scp access.
set -euo pipefail

host="${1:?disposable host required}"
workdir="/tmp/rollback-rehearsal-$$"

ssh "$host" "mkdir -p '$workdir'"
scp -q forward.sh rollback.sh smoke.sh "$host:$workdir/"

echo "== forward =="
ssh "$host" "bash '$workdir/forward.sh'"

echo "== smoke after forward =="
ssh "$host" "bash '$workdir/smoke.sh'"

echo "== rollback =="
ssh "$host" "bash '$workdir/rollback.sh'"

echo "== smoke after rollback =="
ssh "$host" "bash '$workdir/smoke.sh'"

ssh "$host" "rm -rf '$workdir'"
Enter fullscreen mode Exit fullscreen mode

This rehearsal is useful even when the change is a small configuration edit rather than an application deployment. Running forward and then rollback in a clean host exposes two common problems that no static review can catch. The first is an inverse plan that assumes a previous state the rollback script did not capture. The second is an inverse plan that destroys data or files created after the forward step, because the model wrote the undo action as a blunt delete instead of a restore. Both problems are visible only when the inverse plan is executed against a host that has actually been changed.

What this does and does not protect

This workflow protects against the class of failures where a change can be undone if the inverse plan exists and was rehearsed. It does not make an irreversible action safe. If the forward plan deletes the only copy of a customer record, sends an external notification, rotates a signing key without preserving the old key, or mutates a third-party service, no rollback script will restore trust. In those cases the correct gate is prevention, not reversibility. The model should not be allowed to produce the forward plan until the irreversible side effects are isolated or removed.

The approach is also not a replacement for infrastructure-as-code. A firm that already manages servers with reviewed declarative configuration should use its normal review and apply path. Pair-checking an AI-generated imperative script is a stopgap for environments where a solo operator or small team has to reason about one-off maintenance tasks. Teams with regulated workloads, strict change windows, or immutable infrastructure should not import this workflow without adapting it to their control framework.

Who should not bother

If every change you make is already captured in versioned configuration and your rollback is git revert, this article is not aimed at you. If you are not allowed to throw away a host after a test, the free server rehearsal half of the argument does not apply. If your operations are mostly irreversible external side effects, the correct project is to build a human approval gate around those side effects, not to spend time validating inverse scripts.

The smallest useful version is a single rule: after a model writes a change, require it to write the inverse before you read the forward plan carefully. That one rule costs almost nothing and changes what you notice. It also creates a natural place for a disposable host, because the inverse plan is only worth something after it has been executed once. The free model makes the extra generation cheap enough to demand, and the free server makes the execution cheap enough to actually perform. The discipline remains yours.

There is no hard CTA here. If you want to try the same shape, start with one maintenance task, decide what your forward and inverse artifacts will be, and rehearse both in a disposable host before changing anything that matters.

Top comments (0)