Shazil Khan

Experiments

Undo for database actions, tested as a working spike.

A PostgreSQL and MCP experiment that records database changes and reverses them, including related deletions. Built and checked a working database spike rather than a complete agent recovery product.

Project
Agent Undo
My role
Project owner and developer

The problem.

An AI agent can change related records through one database action. Reversing that action needs the before-state of affected rows, including cascading deletions, while protecting later human edits.

My role.

I created and built the PostgreSQL and MCP spike.

What I built.

Trigger-based recording

I recorded before and after row states under an action identifier, including rows removed by cascading deletes.

Conflict-aware reversal

I implemented undo with later-edit checks, savepoints and foreign-key-aware restoration. Undo actions are recorded too.

A bounded MCP gateway

I built the gateway and statement restrictions, then exercised the workflow with a scripted MCP client.

The results.

Seven spike checks were recorded as passing. A cascade-delete test restored table fingerprints exactly. End-to-end operation with a real language-model agent was not established.

Scope & credits

Project owner and developer

Next case study

Personal OpenClaw deployment

AI & automation

Let’s talk about your project

What are you
building next?

A new website. A product taking shape. A workflow that could work better.

Tell me what you have in mind, what you want to change, and the timeline you’re working toward.

shazil@shazil.tech

You’ll be talking directly with me.

Connect on LinkedIn