Every row changed.
Enforced at the database.
Open-source database audit trail engine written in Rust.
Zero daemons, pooler-safe actors, and tamper-resistant diffs.
brew install auditstream/tap/auditstream Zero new infrastructure
Generated database triggers and a commit-safe
export cursor replace 24/7 consumers and replication slots. Schedule
auditstream verify --fix monthly to create partitions.
Safe behind every pooler
Actors travel in trailing SQL comments (AI agents
onBehalfOf users), with 0 leaks across
2.4M PgBouncer transactions.
Tamper-resistant history
Least-privilege application roles get SELECT only (ERROR 42501 on
UPDATE/DELETE). Superusers and the migration role can still change history; check for drift with
auditstream verify.
Four lines to attribute every write.
Wrap a request or tool call in audit.as(). Thin adapters attach
the actor to outgoing SQL, and database triggers capture before/after diffs inside the
same transaction.
import { PrismaClient } from "@prisma/client";
import { PrismaPg } from "@prisma/adapter-pg";
import { audit } from "@auditstream/node";
import { auditstream } from "@auditstream/prisma";
const db = new PrismaClient({
adapter: new PrismaPg(pool),
comments: [auditstream()],
});
await audit.as(
{
type: "ai_agent",
id: "billing-agent",
onBehalfOf: { type: "user", id: "usr_42" },
},
() =>
db.invoice.update({
where: { id: "inv_901" },
data: { status: "paid" },
})
);Measured on PostgreSQL 19. Honest limits.
Waiting for the disk (6.6k tps) or limited by the CPU (189k tps).
PgBouncer 1.26 · 0 failed, 0 leaked actors.
Across 500,000 rows (157k concurrent QPS).
Row-level by design. Bulk INSERT/DELETE reach 211k/s.
Up and running in 60 seconds.
Full Quickstart guide →brew install auditstream/tap/auditstream
auditstream init --migrations prisma \
--table public.invoice --table public.users \
--exclude public.users.password_hash
auditstream export --format jsonl --output audit.jsonl \
--cursor-file cursor.json