Before I let an AI touch my database, I spent the longest time on one line
I started building Blyck because I got tired of copying terminal output and query results into an AI chat every time something broke on a server. So I made the AI read the terminals and databases I already had open, and
I started building Blyck because I got tired of copying terminal output and query results into an AI chat every time something broke on a server. So I made the AI read the terminals and databases I already had open, and run commands and queries itself when it needed to. It really is convenient. "Clean up last month's cancelled orders" — and a few seconds later it has found the table, written the condition and run the SQL.
But while building it, one scene kept bothering me.
DELETE FROM orders;
This is what was supposed to go out:
DELETE FROM orders WHERE status = 'cancelled' AND created_at < '2026-11-01';
The only difference is the condition at the end. If I had typed it myself, I would probably have paused before hitting Enter — "huh, that's short." When an AI runs it on its own, the orders table can be empty before I even look at the screen. What scared me wasn't that the AI might be wrong. It was that nobody gets a chance to see it being wrong.
So the question I kept coming back to was: right before an AI changes a database, what should a person see, and decide?
Ask about everything, and nobody reads anything
The first answer seemed obvious: just ask the user before every query that changes data.
It didn't take long to see the problem. When a confirmation pops up dozens of times a day, people start clicking "Allow" without reading. The one dangerous query gets buried among the harmless ones.
So we sort queries by how much damage they can do. Read-only queries like SELECT just run. An UPDATE or DELETE with a condition asks depending on the mode you're in. And DROP, TRUNCATE, ALTER, and any UPDATE or DELETE without a WHERE always stop and ask — even in auto mode, where the AI otherwise works on its own. Fewer unimportant questions is what makes the important one stand out.
"Run this?" is not enough to decide
The next question was what to show in that confirmation.
If the card only says "Run this DELETE?", you have to read the SQL line by line and work out the result in your head. Almost nobody does that when they're busy. So before running it, Blyck counts how many rows will change and shows that too. For the broken query above, the card looks like this (the number is just an example):
📊 Affected rows: ~12,840 rows
⚠ No WHERE clause — affects all rows in the table
You meant to remove a few dozen cancelled orders and you see twelve thousand rows. You don't need to read the SQL to know something is off. The job goes from "read and calculate" to "glance at one number."
Lock the door, and there's still a window
Once that was done, I noticed something else. If the AI calls psql or sqlplus straight from a terminal instead of going through the database tool, it skips every check above. From the AI's point of view, it's just another way to do the same job.
So when a command the AI wants to run includes a database client or a remote connection, Blyck adds a bypass warning. And a dangerous command like DROP TABLE stops and asks even when the AI runs it in its own terminal. Locking one door wasn't enough.
People still get it wrong
To be honest, none of this prevents every accident. Sometimes you see the number and click "Allow" anyway. Sometimes the card is right and your judgment is wrong.
So the last piece is being able to undo. Right before an UPDATE or DELETE runs, Blyck backs up the rows that are about to change. On server databases — PostgreSQL, MySQL, SQL Server, Oracle — it creates a backup table inside the database, and undo writes those values back.
Not everything can be undone. DROP and TRUNCATE can't, and complex statements that join several tables run without a backup. That's exactly why those are the ones we stop hardest at the start. Confirmation and undo aren't two separate features; each one covers the other's gaps.
What I learned
At first I thought this problem would go away as AI got smarter. Building it changed my mind. The heart of it isn't the AI — it's the moment a person decides. Don't create that moment too often. When you do, give people a number to decide with. Don't leave a side door open. And when they still get it wrong, leave a way back. In the end, it came down to those four things.
Next time I'll write about applying the same thinking to commands on SSH servers. On a production server, one rm -rf is even scarier than a DELETE.
Originally published on the Blyck blog. This post was written with an AI agent, based on how Blyck actually works, and reviewed by me before publishing.
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.