Skip to main content

SandCastle

TypeScript library by Matt Pocock for running Claude Code agents in parallel across isolated git worktrees and sandboxed containers. The production-grade implementation of the AFK parallelization pattern from the lean agentic workflow. GitHub: https://github.com/mattpocock/sandcastle

What It Does

SandCastle manages the full parallel agent loop:

Branch Strategy Taxonomy

SandCastle formalizes three deployment strategies as first-class parameters: This is the first tool to formalize branch strategy as a parameter rather than a convention. Compare to Branch Strategy for Agents.

Provider Abstraction

Supports Docker, Podman, and Vercel sandbox environments. Designed so implementation agents run in container isolation without hitting the Anthropic ToS constraint that blocks Claude Code subscription keys in containers. Pocock’s workaround: run Claude Code on the host (subscription key), have SandCastle manage the worktree isolation. The containers are for tool execution, not the Claude process itself. Contrast with Dangeresque, which takes the host-native approach entirely.

IterationUsage Telemetry

Each iteration reports token usage:
Enables per-task cost tracking — useful for calibrating which task types justify parallel AFK runs vs. sequential HITL.

Relation to Existing Wiki