How it works

Copy-on-write isolation with shadow tables.

Flow

1

Create session

Schema session_{id} created

2

Agent works

Reads: production + staged. Writes: shadow tables.

3

Propose

Submit for review. Writes blocked.

4

Approve/Reject

Merge atomically or drop schema.

Key concepts

Shadow Tables

First write creates _shadow_{table}. All writes go there.

Union Views

Reads combine production + shadow. Agent sees consistent state.

Advisory Locks

Prevent race conditions during merge.

Row Hash Tracking

Detects conflicts by comparing hashes at merge time.

Routing

SELECTUnion view (production + shadow)
INSERTShadow table
UPDATEEach affected row copied to shadow, then updated
DELETEMark deleted in shadow metadata

Conflicts

Row hashes are compared at merge. If production changed, you can force apply, reject, or review per-row.

Merge

1. Acquire lock→2. Verify hashes→3. Check FKs→4. Apply→5. Drop schema