Gnomon 为 Postgres 带来分支与合并能力

原标题:Gnomon: Git for Postgres Data
74AI 研判分

BitsInfra 发布 PostgreSQL 扩展 Gnomon,为数据库引入类似 Git 的分支、历史、三方合并与撤销能力,分支仅记录自身改动、打开即用且不复制数据。它面向智能体场景,让 Agent 通过一个连接串获得真实数据库的独立分支,改动可逐字段 diff、合并回主库或整体回滚。

报道正文

Gnomon is a PostgreSQL extension that gives your database branches, history, merges and undo. Give an agent its own branch of your real database, as nothing more than a connection string. See every field it changed, merge it into main when it's right, and undo it if it wasn't.

Gnomon runs inside the Postgres you already have. One extension, no copies, no second database.

Install the extension, then take a branch, change something on it and look at what changed:

SQL
create extension gnomon;
select gnomon.track('orders');                    -- history starts now, no backfill

select gnomon.create_branch('agent/refunds');
select gnomon.use('agent/refunds');

-- Every query from here on runs on the branch
update orders set status = 'refunded' where id = 4182;

select * from gnomon.diff('agent/refunds');       -- every row and field it changed
select gnomon.merge('agent/refunds');             -- three-way, type-aware, conflicts as rows
select gnomon.undo_merge(1);                      -- and back

A branch reads everything from main and keeps only what it changes, so it opens instantly and copies nothing, however big your database is. Your application doesn't change: point a session at a branch and the queries it already runs read and write the branch instead of main.

Follow the tutorial →

One command gives an agent a database role, a branch of its own and a connection string. It reads and writes its branch, and the database refuses the rest, main included, even when the agent asks for it by name.

gnomon agent create support-bot

Merging is for the people you choose, or for an agent within rules you write: at most twenty rows, only these tables, every check passing. Postgres enforces them, whatever the agent is told.

Agents → · The MCP server →

The TypeScript and Python SDKs give each task your agents take on a run: a branch of its own, with limits already set. Merge it, send it for review, or let it go.

BASH
npm install @bitsinfra/gnomon      # TypeScript
pip install gnomon-postgres        # Python

Bindings for Node, Go, Ruby, Java, Elixir, .NET and PHP put your application's sessions and tests on a branch, through the drivers and ORMs you already use.