sandcastle README

The project's README from github.com/mattpocock/sandcastle. As one markdown file: README.md.

Sandcastle

What is Sandcastle?

A TypeScript library for orchestrating AI coding agents in isolated sandboxes:

  1. You invoke agents with a single sandcastle.run().
  2. Sandcastle handles sandboxing the agent with a configurable branch strategy.
  3. The commits made on the branches get merged back.

Sandcastle is provider-agnostic. It ships with native sandboxes that use your OS's own process sandbox (Bubblewrap on Linux and WSL2, Seatbelt on macOS), image-based providers for Docker and Podman, and cloud providers for Daytona, E2B, Fly.io Sprites, Modal and Vercel, and you can create your own. Great for parallelizing multiple AFK agents, creating review pipelines, or even just orchestrating your own agents.

Documentation

The docs live in docs/guide, one page per major term, with every term defined in the Glossary, and are published at aihero.dev/sandcastle.

Development

npm install
npm run build    # Bundle with tsup
npm test         # Run tests with vitest
npm run typecheck # Type-check

License

MIT

sandcastle (mattpocock/sandcastle)

Searching Database…

What is this?Sandcastle is a TypeScript library for orchestrating AI coding agents, like Claude Code, inside isolated sandboxes: you kick off a run with a single sandcastle.run() call and the resulting commits get merged back to your repo automatically.
Is this a library I call from code, or a standalone CLI app?It is mainly a TypeScript library you call programmatically with run(), interactive(), or createSandbox(); the only CLI part is the init scaffolder that sets up config files for you.
How do I get it running?Install the package, run npx @ai-hero/sandcastle init to scaffold a .sandcastle directory, fill in your tokens in .sandcastle/.env, then run .sandcastle/main.ts with npx tsx.
What do I need installed before I start?You need Git plus a sandbox provider such as Docker Desktop, Podman, or Vercel's Firecracker microVMs, and either a CLAUDE_CODE_OAUTH_TOKEN (from claude setup-token) or an Anthropic API key.
Can I skip the sandbox entirely if I don't want container isolation?Yes, the noSandbox() provider lets the agent run directly on the host instead of inside a container, which is convenient but drops the isolation safety net the project is built around.
What built-in sandbox providers does it ship with?Docker, Podman, and Vercel (Firecracker microVMs via @vercel/sandbox) are built in, and you can create your own using createBindMountSandboxProvider or createIsolatedSandboxProvider.
What's the point of createSandbox() instead of just run()?createSandbox() spins up one container you reuse across multiple agent runs on the same branch, keeping installed dependencies and build artifacts alive between calls, while run() is for a single one-shot invocation.
How do changes from the agent get back into my repo?Commits made in the sandbox on its branch merge back to the host repo; using await using triggers automatic cleanup, preserving the worktree if changes are uncommitted or removing it when clean.
Creator
mattpocock
Size
6 MB
Stars
9.2K
Age
8mo
Commits · 90 Days