An agent you can undo

AI agents are starting to make bulk changes to the records a business runs on. I designed one that shows each step before it runs and can undo any of them, on a supplier master of 48,212 records.

The goal
Let the agent do the work, and let a person check each step and take any of it back.
The problem
An agent can change thousands of rows in one go. Undo usually means the last thing, and a later step may have built on the one you want back.
What came of it
A working demo on this page. Claude writes plans on request, and an engine I wrote checks every step against all 48,212 records before you see it.
Try it

Built for a laptop. It takes about a minute.

A cream keyboard key printed with Command Z, the shortcut for undo.

The problem

A bulk clean-up by an agent goes wrong in three ways.

  1. 1

    It runs blind.

    A bulk change says what it did after it ran, not before.

  2. 2

    Undo only goes back in time.

    Take back an early step and every later one goes with it, even the ones that never touched its records.

  3. 3

    Some steps can’t come back.

    A sent email is sent, but it looks like every other step.

What I designed

The agent’s plan beside the records, in three moves.

1 Before: see the step first

Each step says what it will change and to how many records, with examples. Its columns are marked in the table before anything runs.

The plan's first step, Merge duplicate suppliers. It says it will merge 1,284 duplicate pairs into one record each, explains why, and offers Run this step or Skip it.

2 Undo follows what depended on it

Undo the merge and the two steps that read its records come back with it. The steps that didn’t stay done.

The supplier table after the undo. Restored cells are marked in blue: phone numbers back in their old formats and blank countries back to blank.
Blue cells are the ones the undo restored.

3 What can’t come back looks different

Emailing suppliers has no undo. That step has an orange edge, says No undo, and asks before it sends.

The plan's fifth step, Email active suppliers with no bank record, with an orange edge, the words No undo, and a Send button.

How I worked

Two days with Claude Code building beside me. It went live on November 1.

October 29
Four rounds. The first showed every step at once and was too busy to follow. The second read as a toy. The last two became this supplier master: 48,212 records in a worker thread.
October 30
Claude writes a plan on request and my engine checks it. I picked the model with an eval, and set the limits before it went live.

Try it

Supplier masterProduction
AP West
All suppliers
Select
Connecting…

Built for a laptop, where the plan sits beside the table. On a phone it sits under it.

More detail

More detail: the decisions and how it’s built
  1. 1

    A step is a diff with its inverse.

    Each change is a cell, what it held and what it became. A step keeps every one it makes and undo replays them backwards, so it is exact at any size.

  2. 2

    Undo follows dependence, not time.

    Each step declares what it reads. Undo one and only a later step that read or changed what it changed comes back with it.

  3. 3

    The database is a worker, and the grid does not know.

    The records sit in a thread of their own and the grid pages through them the way it would page through a server. A real database behind an API could take its place without a change to the grid.

  4. 4

    Claude writes, the engine has the last word.

    Pick a goal and Claude writes a plan in the same small language as my five steps. The engine runs it against all 48,212 suppliers before you see it and sends back what is wrong, three tries at most. Every count on a card is the engine’s.

  5. 5

    A limit comes before the model.

    Five plans an hour for each visitor and a dollar a day for the site. Past either the page keeps my plan and says why.

The records live in a worker thread in your browser, generated from one seed in about 150 milliseconds, so every visitor gets the same 48,212 suppliers and no record is stored or sent anywhere. The grid draws only the rows in view and asks the worker for a page of a hundred as each comes into reach.

Steps are written in a small plan language: merge, rewrite, fill in, mark, set and email. Pick a goal and only the goal goes to a Cloudflare Worker at ai.voigt.work, where Claude Haiku 5.5 writes a plan in the same language. A Durable Object there runs the plan through the same engine on the same records. A step that touches nothing, reaches past a quarter of the master or sends an email before a fix it depends on goes back to the model, three tries at most.

I picked the model with an eval: each goal four times, graded by code. Haiku 5.5 and Sonnet 5.5 both passed 12 of 12. Haiku did it for a tenth of a cent a plan against nearly a cent. The eval also caught me out. I had made it fail any audit plan that didn’t chase missing tax ids. In these records every one of them is half of a duplicate. The merge fills them all and the engine had already told the model so.

Every record is generated from a seed: the phone numbers are in ranges reserved for fiction and the addresses end in .example. No record leaves your browser, and when you ask Claude for a plan only the goal you picked is sent. The five steps you start with are mine.

Ask Alex

What would you like to see?

Type / for the kinds of work.