4lun.net
008 · 2026-08-14
Light Light Dark Dark Auto

Giving every AI agent its own disposable workspace

Most of my projects now have multiple Claude Code sessions on the go at once. Git worktrees cover the code side of that nicely, but a worktree on its own isn't a runnable app. Each session really wants an entirely isolated environment: its own copy of the database (one agent running migrate:fresh shouldn't wipe out another's data), its own services, and a reachable URL so I can actually look at what it's built.

As a result I ended up building slate to fill that gap (open source, single Go binary). Each workspace is a git worktree with its own Docker containers, database and HTTPS URL: slate new some-feature and shortly after there's a https://myproject--some-feature.test serving that branch. The code stays on the host, everything else runs in containers.

One workspace per change

Every change, whether it's a feature, a fix or experiment, happens in a workspace on its own branch and lands via a PR. Parallel agents each get a full environment of their own rather than just a branch, and because the tooling runs in the workspace's containers (slate artisan test, slate npm run check, etc.) there's no host PHP or Node requirement at all.

The per-workspace URL turns out to be the bit I use most. Checking an agent's work is opening https://myproject--some-feature.test in a browser, not juggling ports or stashing whatever I'm doing and switching branches.

The agent runs on the host, not in the container

Originally tried the other way first: slate briefly gained the ability to run Claude Code inside the workspace container, and I ended up ripping it out after a few days. It was just too painful - shared MCPs and agent instructions on the host couldn't reach the container without a lot of drilling and copying, commits couldn't be made from inside without giving away a lot of permissions, and none of my skills or global config existed in there without a ton of copying and workarounds. In the end I settled on the inverse: have the agent always running on the host with the worktree as its working directory, but all project dependencies and runtimes, run in containers. This at least adds some protection from supply chain attacks, which is what I'm most concerned with these days.

Slate launches the agent for a fresh workspace via an agent: command in the project config.

Tearing down without losing work

When done with a workspace, I call slate done, this refuses to destroy anything until the work has provably landed: the worktree is clean, and the branch is merged.