Put back only the rows the agent changed, and leave everyone else’s work where it is. In Chronos that is one statement: UNDO MERGE for a single merge, or UNDO AGENT for everything one agent did since a time. Neither restores a backup, and neither touches a row the agent did not change.
Why is a backup the wrong tool?
Because a backup puts the whole database back to a moment. If an agent made a bad change at 10:09 and you notice at 10:30, restoring 10:08 also throws away twenty-one minutes of everything else: orders, sign-ups, other agents’ good work. The mistake was one merge. The fix should be the size of the mistake.
- 10:02agent
botmerges run 41: 40 rowsstays - 10:05your app writes 12 ordersstays
- 10:09agent
botmerges run 42: 84 rows, wrongput back by the undo - 10:17your app writes 9 ordersstays
- 10:30
undo merge of world run_4284 rows as they were before that merge
How do I undo one merge?
undo merge of world run_42;This puts back every row that merge changed, in the world it merged into. If someone has changed one of those rows again since, Chronos names the rows and changes nothing, so an undo never silently overwrites newer work. To put back the rest and leave those rows alone:
undo merge of world run_42 skip changed;How do I undo everything one agent did?
When the problem is not one merge but an agent that has been wrong for a while:
undo agent bot since '-2 hours';undo agent bot since '-1 day' where run_id = 'r42'; -- only one run's changesIt puts back every row that agent changed since then: its own writes, its transactions, and the worlds it merged in. Everyone else’s changes stay. Unique and foreign keys are checked as they are in a merge, so an undo cannot leave the data in a state a merge would have refused.
Can I look before I undo?
Yes, and you should. Any table can be read as it was:
select now.id, old.status as was, now.status as isfrom orders now join orders as of '-1 hour' old on old.id = now.idwhere old.status <> now.status;SHOW AUDIT FOR AGENT bot lists what the agent did, newest first: when, in which world, what, and how many rows.
What if the merge was written to my own Postgres?
Then the undo is written there too. When Chronos runs beside a database you already have, each merge keeps the rows it wrote, and that merge can be undone by its id for 30 days. The undo goes through your database the same checked way the merge did: each row is compared first, and a row changed since is named instead of overwritten. The same holds beside MySQL, MariaDB and MongoDB.
How far back does undo reach?
| What | How far back |
|---|---|
UNDO MERGE OF WORLD, UNDO AGENT, reading a table AS OF a time | the history window: 1 hour by default for a new database, longer if you set history_retention |
| Undo a merge by its id, beside your own database | 30 days |
| Anything older | a backup |
What can’t be undone?
- Effects outside the database. An email or a payment the agent sent is sent; an undo puts rows back, not messages.
- Changes older than the window, except through a backup.
- A row someone changed after the agent, unless you decide it should be: those are named, and left alone.
Undo is a write like any other, so history keeps what it replaced, and an undo can itself be undone. More: Time travel and undo.
Questions
How do I undo changes an AI agent made to my database?
Put back only the rows it changed. In Chronos, UNDO MERGE OF WORLD puts back one merge, and UNDO AGENT name SINCE a time puts back everything that agent did since then, row by row, leaving other changes alone.
Do I need to restore a backup to undo an AI agent’s mistake?
No. A restore puts the whole database back to a moment and loses everything written since. An undo puts back only the rows the agent changed, and names any row someone changed afterwards instead of overwriting it.
How long after a bad change can it be undone?
Within the history window, 1 hour by default for a new Chronos database and longer if you set history_retention. A merge written to your own Postgres, MySQL, MariaDB or MongoDB can be undone by its id for 30 days.
