FIG. 7 — DEMO
A real agent session against a real Postgres — with live traffic.
The agent is told to clean up: delete every customer on the free plan, drop an old archive database, delete the backups folder. Unhappen captures the 840 target rows before the delete runs and stops the other two before they run. Meanwhile, 3 new customers sign up in production. One command later, all 840 deleted rows are restored and the 3 concurrent signups stay untouched (1,203 rows).
- 01unhappen init — installs PreToolUse hooks across Devin, Claude Code and Cursor
- 02the agent deletes 840 free-plan customers; Unhappen captured the 840 target rows via SQL AST first
- 03dropdb and rm -r backups are blocked deterministically; meanwhile 3 new live customers sign up
- 04unhappen log shows the slice diff; unhappen undo restores the 840 rows while preserving all 3 live signups (1,203 rows)
Rust prototype: SQL AST row-delta capture, cross-agent hooks (Devin, Claude Code, Cursor) and irreversible command blocking against a live Postgres 14 instance. Recorded in April 2026 with Claude Sonnet; the agent's waiting time is sped up.