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
- Steve Yegge after a year of software factories: the last bottleneck is human attention — Steve_Yegge · 2026-12-02
- AI models a full sunset train car in Blender via MCP, 60% done — minchoi · 2026-12-02
- Swarms v18 "Multiplex" Ships Self-Organizing Swarms, Async Agents, A2A — KyeGomezB · 2026-12-02
- ASCII-only Minecraft: Gemini 4 Neon renders the whole game world in text characters — minchoi · 2026-12-02
- Two prompts in Antigravity auto-generate a full AI music video — minchoi · 2026-12-02
- How to rebuild TradingView's $2,399/year terminal free with Gemini 4 Neon, OpenBB and Lightweight Charts — minchoi · 2026-12-02