After an agent deleted their CRM leads, dev ships a trusted merge layer for Postgres
Antique-Willow-5841 · reddit · 2026-10-17
After an AI agent with CRM write access deleted all their lead lists, the author set out to replace Postgres with a branch-per-run database — but community feedback ("the branch is easy, the merge is what must be trusted"; "nobody's moving their CRM") pivoted the first release to a sidecar beside your existing Postgres.
Each agent run gets its own branch of copied tables; merges write back in one transaction only after: verifying every changed row is unchanged (row and read-set checks for concurrent edits), running your SQL checks on the merged result, and applying rules like no deletes without a human, max-row limits and mandatory-review tables — with limits counted across the whole run so split deletes can't bypass them. Failed merges wait with reasons; Postgres is untouched.
Build lessons: the hard part was making "is this row still the same?" never false-alarm across timezones/float formats/triggers (let Postgres do the comparing); serial ids collide so ids are reserved from your own sequence; PgBouncer in transaction mode breaks session-state assumptions, so every setting must be per-transaction. Honest status: one-person beta for staging copies, no external real agents yet.
Related event: Developer Builds Git-Style Branched Postgres After AI Agent Wipes CRM Data(3 posts)→
More from coding & agent
- Computer-use agent consensus: escalate from weak to strong models instead of running frontier everywhere — xwang_lk · 2026-10-17
- Claude Code refuses tasks directly—but happily delegates them to Codex — AIFlow_ML · 2026-10-17
- 99% of the code written by Opus: solo dev ships a 20MB multiplayer mecha game — m0dE · 2026-10-17
- shadcn begs for early access to Anthropic's internal Claude Code model: 'progress has been ridiculous' — shadcn · 2026-10-17
- Perplexity reveals pplx-decider: reranker with zero reranking supervision, private MTEB-style eval — bo_wangbo · 2026-10-17
- Anthropic's code-review skill helps Opus 5.5 fix 5.5 more planted bugs at lower cost — PawelHuryn · 2026-10-17