Five Agents, One Dev Database: Clone a Postgres per Worktree With Postgres 18
Book: Database Playbook Also by me: Thinking in Go (2-book series) — Complete Guide to Go Programming + Hexagonal Architecture in Go My project: Hermes IDE | GitHub — an IDE for developers who ship with Claude Code and other AI coding tools Me: xgabriel.com | GitHub One agent is in ../app-auth , renaming users.email to users.login_email . Another is in ../app-invoices , about to run its test…
Five agents collaborated on a project by creating individual databases for each worktree within a Postgres 18 environment. Each worktree, which had its own branch, files, and dependencies, was assigned a unique database copy. This approach eliminated the need for separate Postgres servers per worktree, instead utilizing the file_copy_method set to clone on a copy-on-write filesystem.
The clone command created a database named after the worktree's branch and stored the database URL in the respective .env file. This setup enabled each agent to work independently without interfering with one another, as worktrees isolated files but not databases. The clone method, introduced in Postgres 18, shared blocks on the filesystem until a write occurred, resulting in significant time and resource savings compared to traditional database per branch approaches.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.