Skip to content

Sandbox Architecture

Looplia creates isolated sandbox directories for each workflow execution. This architecture ensures clean separation between runs and enables debugging, resumption, and auditing.

Each sandbox contains:

~/.looplia/sandbox/{sandbox-id}/
├── inputs/ # Input files (run command only)
│ └── content.md # Copied from --file
├── outputs/ # Generated artifacts
│ ├── summary.json
│ ├── ideas.json
│ └── writing-kit.json
├── logs/ # Execution logs
│ └── query-*.log
└── validation.json # Step completion tracking

Different commands use different sandbox ID formats:

CommandFormatExample
run{slug}-{YYYY-MM-DD}-{random}article-2026-01-12-xk7m
buildbuild-{YYYY-MM-DD}-{random}build-2026-01-12-a1b2

The random suffix is a 4-character hex string for uniqueness.

A new sandbox is automatically created when you run a workflow:

Terminal window
# Creates sandbox like: my-article-2026-01-12-ab3f
looplia run writing-kit --file ./my-article.md

Use --sandbox-id to continue from an existing sandbox:

Terminal window
# Resume the previous run
looplia run writing-kit --sandbox-id my-article-2026-01-12-ab3f

List sandbox directories with:

Terminal window
# List all sandboxes
ls ~/.looplia/sandbox/
# Find most recent sandbox
ls -t ~/.looplia/sandbox/ | head -1

Each sandbox contains a validation.json file that tracks step completion:

{
"workflow": "writing-kit",
"version": "1.2.0",
"sandboxId": "article-2026-01-12-xk7m",
"steps": {
"summary": {
"output": "outputs/summary.json",
"validated": true
},
"ideas": {
"output": "outputs/ideas.json",
"validated": true
},
"writing-kit": {
"output": "outputs/writing-kit.json",
"validated": false
}
}
}

Steps with validated: true are skipped when resuming a workflow. See Validation System for details on how validation criteria work and how the stop-guard enforces completion.

The build command (v0.7.1+) also creates sandboxes for logging:

~/.looplia/sandbox/build-2026-01-12-a1b2/
├── logs/
│ └── query-*.log
└── outputs/

View build logs for debugging:

Terminal window
# Watch build logs in real-time
tail -f ~/.looplia/sandbox/build-*/logs/*.log

Looplia uses shared utility functions for consistent sandbox management:

FunctionPurpose
generateSandboxId(slug)Create ID with format {slug}-{date}-{random}
createSandboxDirectories(workspace, sandboxId)Create standard directory structure

These utilities ensure consistent behavior across all commands.

Sandboxes persist after execution for debugging and auditing. Clean up old sandboxes manually:

Terminal window
# Remove specific sandbox
rm -rf ~/.looplia/sandbox/my-article-2026-01-12-ab3f
# Remove all sandboxes older than 7 days
find ~/.looplia/sandbox -maxdepth 1 -type d -mtime +7 -exec rm -rf {} \;