This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Open-source sandboxes where coding agents build and deploy. Spin up isolated environments where Claude Code, Cursor, Codex, and other agents code and ship software with live URLs, logs, and previews.
- Simplify to the most basic primitives – Remove complexity, not add it
- Make it extremely easy to use – One command should do the job
- Design for agents first, then for humans – AI should be the primary user
- Make behavior explicit, observable, and reproducible – No magic
# Setup
./scripts/dev.sh setup # Install all packages in dev mode
cp infra/local.env.example .env # Configure environment (add FLY_API_TOKEN)
# Development CLI (use runtm-dev, not runtm)
runtm-dev start # Start sandbox session (autopilot mode)
runtm-dev start --interactive # Start sandbox session (interactive mode)
runtm-dev prompt "Build an API" # Send prompt to agent in sandbox
runtm-dev list # List sessions
# Run local services
./scripts/dev.sh up # Start API + worker + DB + Redis
./scripts/dev.sh down # Stop services
./scripts/dev.sh rebuild # Rebuild images and restart
# Testing & Quality
./scripts/dev.sh test # Run all tests
pytest packages/api/tests # Test specific package
pytest packages/api/tests/test_foo.py::test_specific # Single test
./scripts/dev.sh lint # Check style (ruff)
./scripts/dev.sh format # Fix style (ruff format)
./scripts/dev.sh check # Run all checks (REQUIRED before committing)
# View logs
./scripts/dev.sh logs # All services
./scripts/dev.sh logs worker # Specific service
# Configure CLI for local API
export RUNTM_API_URL=http://localhost:8000
export RUNTM_API_KEY=dev-token-change-in-productionNote: Use runtm-dev (not runtm) when developing locally. The dev CLI includes sandbox/agents packages that aren't in the PyPI release.
packages/
shared/ # Canonical contracts: types, manifest schema, errors
sandbox/ # Local sandbox runtime (OS-level isolation)
agents/ # AI coding agent adapters (Claude Code, Codex, etc.)
api/ # FastAPI control plane (deployments, auth, policy)
worker/ # Build + deploy pipeline (Fly.io provider)
cli/ # Python CLI (Typer) - the primary DX
templates/ # Starter projects (backend-service, static-site, web-app)
infra/ # Docker compose for local development
Package responsibilities:
shared– Types/schemas/errors that other packages import. Types flow: shared → api, worker, clisandbox– OS-level isolation for AI agents. Uses bubblewrap (Linux) or seatbelt (macOS)agents– Adapters for AI coding agents (Claude Code, Codex, Gemini). Wraps CLI tools with streaming outputapi– HTTP layer + orchestration. No business logic in routes - use servicesworker– Build/deploy pipeline. Provider abstraction for Fly.io/Cloud Runcli– Wraps API client, never contains business logic
| File | Purpose |
|---|---|
packages/shared/runtm_shared/manifest.py |
Manifest Pydantic models |
packages/shared/runtm_shared/types.py |
State machine, tiers, auth types |
packages/shared/runtm_shared/errors.py |
Error hierarchy |
packages/api/runtm_api/routes/deployments.py |
Deployment API endpoints |
packages/worker/runtm_worker/jobs/deploy.py |
Build/deploy job logic |
packages/worker/runtm_worker/providers/fly.py |
Fly.io provider |
packages/cli/runtm_cli/main.py |
CLI command definitions |
queued → building → deploying → ready
↘ ↘ ↘
failed ←────────────┘
↓
destroyed
- Create command in
packages/cli/runtm_cli/commands/ - Export from
commands/__init__.py - Register in
main.py - Add tests in
packages/cli/tests/
- Add route in
packages/api/runtm_api/routes/ - Keep route handlers thin – delegate to services
- Use Pydantic models for request/response
- Add tests in
packages/api/tests/
- Create in
packages/worker/runtm_worker/providers/ - Implement the
DeploymentProviderinterface - Register in provider factory
- Edit in
packages/shared/runtm_shared/ - Update all consuming packages
Store implementation plans in .plans/PLAN_feature_name.md. Rename to PLAN_feature_name_DONE.md when complete.
- Structured logging everywhere – No print statements
- Type hints on all functions
- Idempotency – Retries create same result
- Clean error messages that explain how to recover
IMPORTANT: After making any code changes, always run:
./scripts/dev.sh checkThis runs lint and format checks. Fix any issues before committing.