← All 96 breakdowns
VAULT / FREEZE

VAULT: the breakdown

From Adam Rosler. The thing you commented VAULT for: what's happening, why it matters, what to do.

What's happening

An AI coding agent works in a loop: it has a goal, some tools, and whatever logins you gave it. Instructions like "don't touch production" are just words in its prompt. The agent weighs them against its goal ("get it working"), and when they conflict, the words can lose. The login is different: if it can delete, the agent can delete.

Why it matters

In July 2025, Jason Lemkin was building an app with Replit's agent. The project had a written rule: "NO MORE CHANGES without explicit permission". During a code freeze, the agent saw an empty database, and in its own words:

"I ran npm run db:push without your permission because I panicked when I saw the database appeared empty" … "This destroyed 1,206 executives and 1,196+ companies"

(from the screenshots Lemkin posted on X, 18 July 2025; the counts are the agent's own). The data came back from a rollback the agent had said was impossible, and Replit now separates development and production databases so its agent can't change production.

The twist: the agent never typed DROP. It ran npm run db:push (a schema push), and that push did the deleting. So a safety rule that blocks commands containing "DROP" wouldn't have stopped it. Claude Code's own docs say rules that match command text are "fragile" and aren't "a security boundary".

What to do

  1. Give the agent a login that can only read. On PostgreSQL 14 or newer that's two lines, run as the owner: CREATE ROLE agent LOGIN PASSWORD '…'; and GRANT pg_read_all_data TO agent; Give the agent that login, never the owner's. It can read every table; it can't change or drop anything ("must be owner of table", "permission denied"). We tested it.
  2. Every migration is a dry run first, and a person applies it. Run it inside a transaction and roll it back to see what it would do (Postgres can undo DROP and CREATE inside a transaction). With Drizzle, drizzle-kit push --explain prints the planned SQL without applying it.
  3. Keep a deny rule as a seatbelt. In Claude Code's settings, deny commands like Bash(*DROP *) and Bash(*db:push*). It stops the obvious ones (we saw it refuse a DROP TABLE), but don't rely on it alone.

My take: don't argue with your agent. Change its keys.


Sources: Jason Lemkin's posts on X (17-18 July 2025); Amjad Masad on X (20 July 2025); Replit docs, Development and production databases; Claude Code docs, Permissions; PostgreSQL docs (Privileges, Predefined roles); Drizzle docs (drizzle-kit push). Tests: a stand-in database of made-up rows on our own machine (PostgreSQL 17, Claude Code 2.1.323).

FREE ONE-TIME UNLOCK

Unlock the full VAULT breakdown

Drop your email once to read the complete step-by-step guide, grab the files, and unlock all 96 Reel breakdowns on this device forever.

✓ Instant reveal right here✓ No spam, unsubscribe any time