← sources

Meet Chronos: a database where your agent’s changes land only if they keep your rules

source: reddit (reddit:AI_Agents)published 2026-10-23 18:43ingested 2026-10-24 10:56

retained text

I built Chronos, a Postgres-compatible database for agents that write real data. Rather than list features, here’s one agent’s change, start to finish, so you can see where the safety actually sits. (The example is simplified; the mechanics are real.)

**The setup**

I have an app with `customers`, `orders` and `payments`. I give my coding agent (Claude Code, over MCP) full write access, plus a policy I set once:

* at most 500 rows changed per merge
* no deletes (`max_deletes = 0`)
* never touch `payments`
* schema changes need a person

I also add one merge check, a query the merged result must return nothing for:

    SELECT o.id FROM orders o
    LEFT JOIN customers c ON c.id = o.customer_id
    WHERE c.id IS NULL;   -- no order may lose its customer

**Step 1: The agent gets a task**

“Clean up duplicate customers. A lot of them have the same email.”

**Step 2: It works in its own world**

The first thing the agent does is fork a world: an instant copy-on-write copy of the database, data included. Nothing is copied up front, so a big database forks as fast as a small one. Everything it does from here happens in that world. Production, my app and other agents see none of it.

**Step 3: It does the work, the way an agent does**

    -- find duplicates
    SELECT lower(email), count(*) FROM customers GROUP BY 1 HAVING count(*) > 1;
    
    -- point orders at the oldest record for each email
    UPDATE orders SET customer_id = keep.id FROM ...;
    
    -- remove the extras
    DELETE FROM customers WHERE id IN (...);

It runs my app’s tests against the world, and they pass. From the agent’s point of view, the job is done, so it asks to merge.

**Step 4: The merge**

This is where most setups have nothing. In Chronos, the merge is three-way and row by row:

* If someone changed a customer in production while the agent worked, and the agent changed the same row, that’s a **conflict**, not a silent overwrite.
* Rows only one side touched merge cleanly.

Then, **inside the merge, under its locks**, the database checks the policy and the merge checks against the merged result. They aren’t in the prompt, and they aren’t in a wrapper the agent could skip.

**Step 5: It breaks a rule, so it waits**

The cleanup deletes 412 customer rows, and the policy says at most 0. So the merge doesn’t land. It goes to a review queue, and I get an email:

>held: deletes 412 rows (at most 0)

Production is untouched. The agent didn’t fail silently either: it knows the change is waiting for a person.

**Step 6: A person decides**

I open the review and see exactly what would change: which rows, before and after. Two things matter here:

* **I approve the exact version I read.** If the agent keeps writing to its world after I open the review, my approval doesn’t cover the new changes. It has to be read again.
* **The agent can’t approve its own change.** Approval needs a person signed in to the dashboard. “Approve” in a prompt does nothing.

In this case I notice it merged two customers who share an office email but are different people, so I discard the change and tell the agent to merge only exact name-and-email matches. The second attempt changes 380 rows, still deletes, and is still held. That one I approve.

**Step 7: Something slipped through anyway**

Say I approved something I shouldn’t have, or a rule was too loose. History lets me:

* **undo that one merge**, or
* **undo everything one agent did since a time**, row by row, without touching anyone else’s changes.

I can also read any table as it was at a point in time, to see what changed.

**What it is, technically**

* Its own engine in Rust that speaks the Postgres 16 wire protocol, so psql, Prisma, Drizzle and the rest connect with a normal Postgres URL.
* It’s Postgres-compatible, not Postgres. It matches 83.69% of expected lines on Postgres’s own regression suite. Anything it doesn’t support is an error, never a wrong answer.
* Agents connect over MCP with OAuth. The app gets its own password, and every change is tagged with the agent that made it.

**What it doesn’t solve**

If an agent holds a token with infrastructure rights outside the database (delete the volume, drop the backups), that’s a different problem, and Chronos doesn’t fix it. It keeps the database’s own changes honest.

**Where I’d like feedback**

* Are row and delete limits the right shape for rules? Or do you think in terms of “what it was asked to do” vs “what it did”?
* For eval setups (many runs, keep the best), would you want a world per run and then “merge the winner”?
* What should an agent be allowed to land on its own, and what should always wait for a person?

Free in beta, and the link is in the comments, per the sub’s rules.

document fetched 2026-10-24 10:22 · canonical https://reddit.com/r/AI_Agents/comments/1xdme5o/meet_chronos_a_database_where_your_agents_changes