I Open-Sourced My Own AFK Software Factory

The creator developed Sand Castle, a TypeScript library that enables autonomous AI coding agents to run safely within isolated sandboxes, automating tasks like planning, implementation, review, and merging through GitHub issue-driven workflows. This open-source tool enhances development efficiency by allowing parallel agent execution without third-party dependencies, offering a secure, customizable framework for building AI-driven software factories.

The creator has spent the last six months developing autonomous coding agents capable of running completely AFK (away from keyboard), handling backlog tasks, implementing features, performing QA, and running in parallel. A key challenge was managing permissions requests from these agents without constant interruptions. Simply bypassing permissions is risky, as agents like Claude could perform harmful actions such as deleting important files or leaking data. To address this, sandboxing is essential, but existing solutions, including Docker sandboxes, proved problematic or overly complex. The creator desired a simple, TypeScript-based function to run prompts inside isolated sandboxes with chosen agents, without relying on third-party services.

This need led to the development of Sand Castle, a TypeScript library designed to orchestrate AI coding agents within isolated sandboxes. Sand Castle allows users to write scripts that run agents inside sandboxes with a simple function call, enabling complex workflows such as parallel agent execution, self-review, and code merging. The library supports multiple sandbox providers, with Docker currently available and plans to add more. It also integrates a backlog manager, with GitHub issues as the preferred method for task scheduling, filtering issues by a specific label to control what agents work on.

Setting up Sand Castle involves installing the library, initializing it in a repository, selecting an agent (like Claude Code), and choosing a sandbox provider. The system scaffolds necessary files, including a Dockerfile that sets up the sandbox environment with dependencies like GitHub CLI and the chosen agent. Environment variables such as API keys and GitHub tokens are configured to enable agent operation. Once set up, users can create GitHub issues describing tasks, which the agents pick up and work on autonomously, running through planning, implementation, review, and merging stages.

The workflow demonstrated includes a planner agent that analyzes open issues and generates a plan, implementer agents that work on individual tasks in isolated sandboxes, reviewer agents that check code quality and adherence to standards, and merger agents that handle merging changes back into the main branch, resolving conflicts if necessary. This multi-agent system runs concurrently, significantly increasing development velocity and reducing manual intervention. The modular design allows users to customize prompts, agents, and workflows, supporting various use cases such as pull request creation or direct merges.

Overall, Sand Castle offers a powerful, flexible framework for building AI-driven software factories that automate coding workflows safely and efficiently. By owning the entire process and avoiding third-party dependencies, users maintain control and security. The creator expresses enthusiasm about the tool’s potential and encourages others to explore it, sharing additional resources through a newsletter focused on practical AI engineering skills. Sand Castle represents a significant contribution to the AI coding ecosystem, enabling developers to harness autonomous agents effectively in real-world projects.