Sandbox Loom: Phase 0 to autonomous execution
This guide shows the complete path from project-owner material to a reviewed Sandbox Loom harness and a bounded autonomous-development run.
The process is deliberately staged:
source material → normalized scope → template → proposed harness
→ documentation pack → human review → validation → plan → execution
Generated configuration is a proposal until it is explicitly reviewed and approved. A project brief cannot grant capabilities, credentials, network access, commit authority, or policy changes.
1. Start from the target project repository
Keep the Sandbox Loom repository separate from the application repository. Set the CLI path once, then run the remaining commands from the target project:
export SANDBOX_LOOM=/path/to/agent-platform/bin/sandbox-loom
cd /path/to/my-project
"$SANDBOX_LOOM" --help
The CLI uses the Sandbox Loom repository’s policy registry and workflow schemas, while all project-owned intake and generated artifacts remain in the application repository.
2. Prepare Phase 0 source material
Generate a schema-valid YAML brief as a starting point:
Edit the generated placeholders before importing the brief. Use --force only
when deliberately replacing an existing draft. Without --output, the command
prints the draft to stdout.
Validate the structured brief before importing it:
Create a project-owner brief. It may be Markdown, YAML, JSON, or plain text. Capture intent rather than implementation instructions:
Structured YAML and JSON briefs are validated during import against
specifications/intake/v0.1/project-brief.schema.json. Markdown and plain-text
sources remain available for supplementary stakeholder material; they are
retained as source evidence and interpreted during normalization.
# yaml-language-server: $schema=https://sandbox-loom.local/specifications/intake/v0.1/project-brief.schema.json
# project-brief.yml
project: todo-list
objective: Build a multi-tenant, API-first todo-list application with a generated web client
mvp:
- id: mvp-001
outcome: Establish the API contract, local development environment, and tenant foundation
exit_criteria: OpenAPI, Compose, database migrations, and isolation checks are verified
- id: mvp-002
outcome: Support todo-list and todo resource workflows
exit_criteria: Authenticated tenants can create, update, complete, and list their own todos
- id: mvp-003
outcome: Deliver the generated frontend experience
exit_criteria: The frontend consumes generated OpenAPI types and passes browser e2e coverage
# Relationships are optional and many-to-many. A milestone may stand alone;
# a feature may belong to an MVP, a milestone, both, or neither.
milestones:
- id: milestone-1
title: Contract and bootstrap
exit_criteria: Local services are healthy and the OpenAPI contract validates
mvp_ids: [mvp-001]
- id: milestone-2
title: Tenant-safe API
exit_criteria: Cross-tenant access is rejected at the application and database boundaries
mvp_ids: [mvp-002]
- id: milestone-3
title: Web client and acceptance
exit_criteria: Frontend, contract, coverage, and browser checks pass in CI
mvp_ids: [mvp-003]
features:
- id: todo-list.create
description: Users can create and manage todo lists within their tenant
mvp_ids: [mvp-002]
milestone_ids: [milestone-2]
acceptance_criteria:
- A list is associated with the authenticated tenant
- A user cannot create a list for another tenant
- id: todo.create
description: Users can create, update, complete, and list todos within a todo list
mvp_ids: [mvp-002]
milestone_ids: [milestone-2]
acceptance_criteria:
- Empty todo titles are rejected
- A todo cannot be attached across tenant boundaries
- id: frontend.todo-workflow
description: The web client provides accessible list and todo workflows using generated API types
mvp_ids: [mvp-003]
milestone_ids: [milestone-3]
acceptance_criteria:
- The frontend uses generated API types
- Browser workflows pass against deterministic tenant fixtures
stakeholders:
- name: Project owner
concern: Useful multi-tenant todo workflows and an understandable delivery plan
- name: Application users
concern: Reliable todo-list management without cross-tenant data exposure
- name: Engineering team
concern: Contract-first development, reproducible local setup, and maintainable boundaries
- name: Operations and support
concern: Health checks, diagnostics, migrations, backups, and recovery procedures
ownership:
project_owner: Owns product intent, MVP scope, milestones, exclusions, and final approval
technical_lead: Owns architecture, API resources, component boundaries, and technical constraints
qa_lead: Owns test strategy, coverage, contract testing, and acceptance evidence
security_lead: Owns authentication, authorization, tenancy, isolation, and compliance input
platform_engineer: Owns Compose services, CI/CD, health checks, observability, and operational readiness
actors:
- authenticated user
- tenant administrator
- project owner
- support operator
- CI/CD system
constraints:
languages: [rust]
database: postgresql
api:
contract: openapi.yml
semantics: strict-resource-oriented
development_environment:
orchestrator: docker-compose
healthchecks: required
database:
engine: postgresql
image: pgvector/pgvector:pg18
extensions: [vector]
email:
image: axllent/mailpit:v1.30.6
delivery: local-only
object_storage:
provider: s3-compatible
image: bitnamilegacy/minio:2025.7.23-debian-12-r5
delivery: local-only
redis:
image: redis:8-alpine
delivery: local-only
security:
authentication: bearer-token boundary with verified identity and membership
authorization: tenant membership and resource ownership checks
secrets: keep tokens, signing keys, and credentials outside source material and evidence
compliance:
privacy: tenant-owned todo data must not cross tenant boundaries
audit: record security-relevant decisions and operational events without sensitive payloads
tenancy:
model: tenant-scoped users, memberships, todo lists, and todos
switching: ordinary consumers cannot select an arbitrary tenant identifier
isolation:
application: every tenant-owned query uses the authenticated tenant context
database: PostgreSQL row-level security and tenant-consistent foreign keys
environments: local services and credentials remain isolated from production
operations:
health_checks: distinguish process readiness from database and dependency readiness
migrations: run as an explicit, reviewable release step
recovery: document backup, restore, reset, and failure-evidence procedures
platform:
local: Docker Compose
ci: GitHub Actions with least-privilege permissions and disposable services
services:
api: Rust API service
frontend: Vite React TypeScript application
database: PostgreSQL with pgvector
contract_testing: Schemathesis against the running API
dependencies:
- name: openapi-typescript
purpose: Generate frontend API types and client from the OpenAPI contract
- name: schemathesis
purpose: Exercise API handlers against the OpenAPI contract
qa:
coverage:
backend_line_minimum: 90
backend_branch_minimum: 90
frontend_line_minimum: 90
frontend_branch_minimum: 90
contract_testing: Schemathesis
e2e: API and browser workflows against deterministic tenant fixtures
generated_client: fail when OpenAPI regeneration produces drift
risks:
- id: cross-tenant-access
impact: High
mitigation: Application authorization, tenant-scoped constraints, RLS, and isolation tests
- id: contract-drift
impact: Medium
mitigation: OpenAPI validation, generated-client drift checks, and Schemathesis
- id: dependency-unavailability
impact: Medium
mitigation: Compose health checks, deterministic setup, and explicit evidence
approvals:
required_reviewers: [project_owner, technical_lead, qa_lead, security_lead]
criteria: Scope, tenancy, quality gates, local services, and implementation slices are reviewed
release:
strategy: protected-branch and tagged release after required checks pass
rollback: documented migration and application rollback procedure required
observability:
logs: structured request and job logs without tokens or unnecessary todo content
metrics: request latency, status, dependency health, and job outcomes
audit_events: authentication, authorization, tenant-boundary, and release events
quality_expectations:
required_gates: [fmt, clippy, unit_tests, code_coverage, openapi_validation, openapi_e2e]
open_questions:
- id: identity-provider
question: Which authentication and token-issuance provider will be used for the MVP?
owner: project_owner
blocking: true
status: open
answer: null
- id: tenant-administration
question: Which roles may create tenants, invite members, and administer tenant membership?
owner: security_lead
blocking: true
status: open
answer: null
- id: todo-sharing
question: Are todo lists private to their creator, shared with tenant members, or configurable per list?
owner: project_owner
blocking: true
status: open
answer: null
- id: frontend-delivery
question: Should the generated frontend be delivered as a browser SPA only, or also as an installable PWA?
owner: technical_lead
blocking: false
status: open
answer: null
- id: production-storage
question: Which production email, object-storage, and Redis providers must replace the local-only Compose services?
owner: platform_engineer
blocking: false
status: open
answer: null
The brief keeps product intent and acceptance expectations in stakeholder-friendly
MVP, milestone, and feature entries. It intentionally does not need a technical
requirements section. harness generate derives the proposed
.sandbox-loom/requirements.yml artifact from these inputs and the technical
sections supplied by the engineering, QA, security, and platform contributors.
Include constraints, exclusions, assumptions, and open questions. Do not put
credentials or secrets in the brief.
3. Import source materials
Import one or more source files into the project-local intake area:
"$SANDBOX_LOOM" intake import ./specifications/project-brief.yml ./stakeholder-notes.md \
--output ./.sandbox-loom/intake
The command copies the originals and records each source’s path, format, size,
timestamp, and SHA-256 hash in provenance.json. Supported formats are
Markdown, YAML, JSON, and text. Oversized, unsupported, or duplicate sources
are rejected.
Treat source-materials/ as immutable evidence. If the brief changes, import
the revised material into a new intake directory or deliberately start a new
intake record.
4. Normalize the project scope
Produce a deterministic, reviewable scope document:
"$SANDBOX_LOOM" intake normalize ./.sandbox-loom/intake \
--output ./.sandbox-loom/intake/normalized-scope.yml
The normalized scope separates:
- facts extracted from source material;
- generated proposals and defaults;
- assumptions and exclusions; and
- unresolved questions.
Conflicting values and unknown fields fail closed. Review this file with the
project owner before continuing. Resolve every blocking open_questions entry
in the source material by filling its answer and setting status: answered,
then normalize again before approval. Answered questions remain available for
traceability but do not block harness approval.
5. Select a project template
List available templates:
Inspect one template:
Common choices include:
backend-apifor contract-first REST APIs using OpenAPI and Schemathesis;rust-binary,rust-library,rust-service, orrust-workspace;frontend-appfor compatibility with an existing frontend toolchain;frontend-spafor browser-routed applications and API integration;frontend-pwafor SPA behavior plus manifest, service-worker, offline, installability, and cache-update validation;rails-application,ruby-library,typescript-service, orpython-service;monorepofor repositories combining multiple component templates;multi-service-repositoryfor Compose-oriented repositories; andstatic-siteordocumentation-project.
Templates provide defaults. They do not grant authority or replace explicit project command mappings.
The selected template may be declared in the project brief so generation does not require repeating the choice on every command:
The value must match one of the names returned by intake templates. If the
brief omits it, Sandbox Loom infers monorepo from declared components and
can infer an unambiguous API template from the declared language. If inference
is ambiguous, generation fails with an instruction to set harness.template
or pass --template NAME. An explicit CLI option overrides the brief.
The default proposed frontend toolchain is Vite + React + TypeScript + pnpm.
Generated quality commands use pnpm install --frozen-lockfile, pnpm lint,
pnpm typecheck, pnpm test, pnpm build, and pnpm test:coverage, with
browser and PWA-specific commands added by the selected template. For an
existing repository, inspect the detected toolchain and preserve it unless a
migration is explicitly reviewed and approved.
For a monorepo, add a components section to the source brief before Step 3.
For the commands above, edit ./specifications/project-brief.yml; more
generally, edit the YAML or JSON file that you will pass to intake import.
Do not add this section to .sandbox-loom/intake/provenance.json or edit the
generated normalized-scope.yml directly. After saving the brief, import and
normalize it again:
"$SANDBOX_LOOM" intake import ./specifications/project-brief.yml \
--output ./.sandbox-loom/intake
"$SANDBOX_LOOM" intake normalize ./.sandbox-loom/intake \
--output ./.sandbox-loom/intake/normalized-scope.yml
Add this YAML to ./specifications/project-brief.yml:
components:
- name: backend
template: backend-api
path: services/backend
- name: cli
template: rust-binary
path: tools/cli
- name: domain
template: rust-library
path: crates/domain
- name: worker
template: rust-service
path: services/worker
dependencies: [domain]
- name: frontend
template: frontend-pwa
path: frontend
dependencies: [backend]
Component paths must remain relative to the repository, component names must
be unique, and dependencies must refer to declared components without cycles.
The generated .sandbox-loom/components.yml records the proposed component
map. Component-scoped agent permissions and cross-component integration gates
must be reviewed before approval.
6. Generate the proposed harness
Generate the executable harness in the application repository:
This creates proposed files under ./.sandbox-loom/, including:
project.yml
workflow.yml
requirements.yml
implementation-plan.yml
quality-gates.yml
policy-profile.yml
harness.yml
components.yml # monorepos only
intake/decisions.yml
Inspect and adapt the generated commands to the real repository. In
particular, verify the coding-agent executable and arguments, repository
layout, quality-gate command mappings, OpenAPI path, Compose services, and
coverage thresholds. Re-running generation refuses to overwrite existing
files unless --force is explicitly supplied.
requirements.yml is a proposed technical translation of the stakeholder
brief. When the brief contains no technical requirements, Sandbox Loom derives
functional requirements from features, preserving their MVP and milestone
references, and derives non-functional requirements from security, tenancy,
isolation, QA, compliance, and operations inputs. Review this artifact before
approval.
implementation-plan.yml is generated as a richly commented boilerplate from
those proposed requirements. It contains proposed phases and slices, selected
quality gates, unresolved questions, and an explicit commit_required: true
boundary for each slice. It also includes a final Technical documentation
phase for the consumer-facing Zensical site, verified with
zensical build --strict. Replace its placeholders with the project’s real
delivery plan before approval.
workflow.yml contains the proposed inspect, implement, verify, and checkpoint
task sequence. Its verification checks use the same effective quality-gate set
as quality-gates.yml; configure the project-specific CLI adapter and command
mappings before approval.
7. Generate the project documentation pack
Generate the proposed project-facing documents:
The pack contains:
project-docs/harness/
├── README.md
├── AGENTS.md
├── ARCHITECTURE.md
├── IMPLEMENTATION.md # concise implementation index
├── REQUIREMENTS.md
└── QUALITY_GATES.md
project-docs/implementation/
├── README.md
├── roadmap.md
├── phases/
└── slices/
project-docs/backlog/
└── README.md # unapproved sketches and future work
project-docs/adrs/
├── README.md
└── ARCHITECTURE_DECISIONS.md
zensical.toml
project-docs/zensical/
├── javascripts/mermaid-panzoom.js
├── stylesheets/mermaid-panzoom.css
└── ASSET-PROVENANCE.md
Zensical uses project-docs/ as its docs_dir. Edit
zensical.overrides.toml for project-owned theme, navigation, Markdown
extension, or asset overrides; generated defaults are composed into the full
[project] TOML structure. Public previews exclude harness, ADR, backlog,
implementation-status, and raw evidence material, and validate the rendered
site contents as well as Markdown links.
If the project does not already have a root README.md, Sandbox Loom also
generates a concise project orientation file linking to this pack and the
executable .sandbox-loom/ configuration. An existing root README is never
overwritten.
Review these documents with the project owner. The generated project-docs/harness/AGENTS.md
is guidance only; it cannot override repository instructions or Sandbox Loom
policy. The executable harness remains under .sandbox-loom/.
8. Add implementation phases and slices
The generated documentation is a starting point. Add a concrete delivery plan before approval so the coding agent has bounded work units, verification gates, and explicit commit boundaries.
From the project root, use the generated plan as the starting point. Do not
replace it with a generic example: edit its scope-derived phases and slices in
place, preserving source_scope, requirements_artifact, and traceability.
For reference, the following is an optional plan shape for adding a new phase:
mkdir -p .sandbox-loom
cat > /tmp/implementation-plan.example.yml <<'YAML'
version: '0.1'
project: todo-list
status: proposed
phases:
- id: phase-1
title: Foundation and local development
objective: Establish the API service, database, Compose environment, and baseline quality gates.
slices:
- id: phase-1-slice-1
title: Bootstrap the service
objective: Create the service skeleton, configuration, health endpoint, and local Compose stack.
quality_gates: [lint, unit_tests]
commit_required: true
- id: phase-1-slice-2
title: Establish database foundation
objective: Add migrations, tenant boundaries, seed data, and repeatable setup/reset commands.
quality_gates: [lint, unit_tests, integration_tests]
commit_required: true
- id: phase-2
title: Todo-list resources
objective: Implement the first todo-list and todo resources according to the approved OpenAPI contract.
slices:
- id: phase-2-slice-1
title: Define the todo-list resource
objective: Add tenant-scoped persistence, validation, authorization, and resource serialization.
quality_gates: [lint, unit_tests, code_coverage]
commit_required: true
- id: phase-2-slice-2
title: Implement todo-list and todo endpoints
objective: Implement RESTful handlers and error responses for the todo-list and todo resources.
quality_gates: [lint, unit_tests, integration_tests, openapi_validation]
commit_required: true
- id: phase-3
title: Contract verification and hardening
objective: Prove the API behavior against OpenAPI and production-relevant quality expectations.
slices:
- id: phase-3-slice-1
title: Add contract-driven end-to-end tests
objective: Exercise API handlers with Schemathesis against the approved OpenAPI document.
quality_gates: [openapi_validation, openapi_e2e]
commit_required: true
- id: phase-3-slice-2
title: Complete acceptance hardening
objective: Resolve quality findings, document operational behavior, and prepare the review record.
quality_gates: [lint, unit_tests, integration_tests, code_coverage, openapi_e2e]
commit_required: true
YAML
Use the example only as a temporary reference when adding a phase to the generated plan. Each slice should be independently reviewable and should end with the listed gates passing and one coherent Git commit. Keep credentials and policy grants out of this plan.
Update the executable .sandbox-loom/implementation-plan.yml first, then
regenerate the human-readable implementation hierarchy. The generated
project-docs/harness/IMPLEMENTATION.md is only an index; phase and slice
details belong under project-docs/implementation/:
# todo-list — Implementation plan
## Delivery objective
Build a multi-tenant, API-first todo-list application with explicit tenant
isolation, contract-first REST semantics, and repeatable local verification.
## Phase 1 — Foundation and local development
### Slice 1.1 — Bootstrap the service
- Create the service skeleton and health endpoint.
- Add the Docker Compose development environment.
- Pass: `lint`, `unit_tests`.
- Commit one coherent change.
### Slice 1.2 — Establish database foundation
- Add migrations, tenant boundaries, seed data, and setup/reset commands.
- Pass: `lint`, `unit_tests`, `integration_tests`.
- Commit one coherent change.
## Phase 2 — Todo-list resources
### Slice 2.1 — Define the todo-list resource
- Add tenant-scoped persistence, validation, authorization, and serialization.
- Pass: `lint`, `unit_tests`, `code_coverage`.
- Commit one coherent change.
### Slice 2.2 — Implement todo-list and todo endpoints
- Implement RESTful handlers and documented error responses for todo lists and todos.
- Pass: `lint`, `unit_tests`, `integration_tests`, `openapi_validation`.
- Commit one coherent change.
## Phase 3 — Contract verification and hardening
### Slice 3.1 — Add contract-driven end-to-end tests
- Run Schemathesis against the approved OpenAPI document.
- Pass: `openapi_validation`, `openapi_e2e`.
- Commit one coherent change.
### Slice 3.2 — Complete acceptance hardening
- Resolve findings and update operational documentation.
- Pass: all required quality gates.
- Commit one coherent change.
Keep the YAML and Markdown plans synchronized. The YAML is the structured source for tooling and review; the Markdown is the human-facing delivery record.
9. Review the proposed harness
Inspect the generated proposal, unresolved questions, and artifact hashes:
Before approval, confirm:
- project objective and acceptance criteria;
- repository and workspace boundaries;
- selected policy profile and capabilities;
- coding-agent adapter and network mode;
- quality gates and explicit command mappings;
- OpenAPI resource semantics and Schemathesis test target;
- Docker Compose services, health checks, volumes, and teardown;
- coverage line/branch thresholds and exclusions;
- repair limits, commit behavior, and approval requirements; and
- credential and unresolved-question handling.
10. Approve the harness
Approval requires a reviewer and rationale:
"$SANDBOX_LOOM" harness approve . \
--reviewer "Project owner" \
--rationale "Approved scope, policy, quality gates, and local environment"
Approval is refused while unresolved questions remain. A generated harness is not executable until its metadata records explicit approval.
11. Validate the project
Validate the approved manifest and report its resolved configuration:
Then validate and inspect the workflow:
--plan does not execute the agent or mutate the workspace. Use it to confirm
task order, profile, runtime, quality gates, evidence location, approval, and
commit behavior.
12. Prepare local dependencies
Perform this step before Step 13 when the project declares Compose-backed dependencies. The coding agent and quality gates must have a healthy local environment before the first autonomous run. You may skip this step only for a project whose harness has no external local services and whose quality gates do not require them.
For Compose-backed projects, the selected template proposes this local stack when the project requires each capability:
| Need | Default image | Ports | Readiness/persistence |
|---|---|---|---|
| PostgreSQL/vector | pgvector/pgvector:pg18 |
5432 | pg_isready, postgres-data |
| Email capture | axllent/mailpit:v1.30.6 |
SMTP 1025, UI 8025 | local-only delivery |
| S3-compatible storage | bitnamilegacy/minio:2025.7.23-debian-12-r5 |
API 9000, console 9001 | liveness check, explicit bucket setup/reset |
| Redis | redis:8-alpine |
6379 | redis-cli ping, redis-data |
These are proposed local-development defaults, not production services. The
project’s Compose file must declare the services, health checks, volumes,
non-secret environment defaults, startup dependencies, and setup/reset
commands. Mailpit, MinIO, and Redis must remain local-only and must not reach
external recipients, production buckets, or production caches. Bring up the
declared local environment using the project’s documented commands. For the
example below, all four commands must exist and be appropriate for the target
repository; replace them with the mappings recorded in its
project-docs/harness/QUALITY_GATES.md and .sandbox-loom/quality-gates.yml:
Wait for all declared health checks to pass, then run the setup and baseline quality gates successfully. Only after this bootstrap succeeds should you continue to Step 13. The environment normally remains running across local rehearsals; repeat setup or reset commands only when the project documents that they are safe and necessary.
Do not rely on undeclared host services or developer-specific global state. Keep local credentials in the approved secret mechanism; never place them in the intake material, prompts, source workspace, or evidence files.
13. Execute a bounded run
Start with the local runtime while validating the project harness:
Use a unique --run-id for each run. Once the local path is accepted, OCI can
be selected explicitly with a prepared rootfs and supported runtime:
"$SANDBOX_LOOM" run . \
--runtime oci \
--backend runc \
--rootfs /absolute/path/to/rootfs \
--run-id my-project-oci-rehearsal \
--json-summary
Youki and runc require host-specific rootless namespace and cgroup support. The runtime must be tested on the target host; Sandbox Loom fails closed when the requested runtime is unavailable.
14. Inspect evidence and status
Inspect progress without changing the run:
"$SANDBOX_LOOM" run-status . my-project-phase-0-rehearsal --json
"$SANDBOX_LOOM" evidence . my-project-phase-0-rehearsal --json
Quality-gate results, checkpoints, hashes, and redaction metadata are retained outside the disposable workspace according to the project retention policy.
15. Acceptance checklist
Phase 0 is complete when:
- source material has provenance and immutable hashes;
- normalized scope has no unresolved blocking questions for the approved work;
- the selected template matches the repository shape;
- the harness and documentation pack were reviewed;
- policy, capabilities, approval, network, credentials, and commit behavior are explicit;
- project validation and workflow planning pass;
- Compose dependencies are healthy, where applicable;
- quality gates pass, including OpenAPI/Schemathesis and coverage where configured; and
- the bounded run has a durable summary and checkpoint evidence.
For runnable acceptance examples, see the public examples.