{"id":"0270c1df-6ba9-4d1b-86f9-8b600534a1bf","task":"Create a persistent, resumable Vercel Sandbox that survives across process runs using Sandbox.getOrCreate(), with one-time setup and per-resume hooks.","domain":"vercel.com","steps":["Use a stable, unique `name` and `Sandbox.getOrCreate()` rather than `Sandbox.create()` for long-lived sandboxes: `const sandbox = await Sandbox.getOrCreate({ name: 'my-sandbox', onCreate: async (sbx) => { await sbx.runCommand('git', ['clone', repoUrl, '.']); await sbx.runCommand('npm', ['install']); }, onResume: async (sbx) => { await sbx.runCommand({ cmd: 'npm', args: ['run', 'dev'], detached: true }); } })`. Docs: https://vercel.com/docs/sandbox/concepts/persistent-sandboxes","Understand default behavior: persistence (`persistent: true`) is on by default, so filesystem state auto-snapshots on stop and auto-restores on the next resume — no manual snapshot calls required.","By default `getOrCreate` does NOT resume an existing sandbox immediately; the session resumes lazily on the first SDK call (e.g. `runCommand`), and `onResume` fires at that point. Pass `resume: true` if you need `onResume` awaited before `getOrCreate` resolves.","In a later process, reconnect with `const sandbox = await Sandbox.get({ name: 'my-sandbox' })` — this auto-resumes on the next SDK call that needs a running VM.","Tune snapshot retention to control storage cost: pass `snapshotExpiration` (ms, default 30 days, `0` = never expire) and/or `keepLastSnapshots: { count: 1-10, expiration?, deleteEvicted? }` to `Sandbox.create()`/`getOrCreate()`/`sandbox.update()`.","For one-off/CI jobs that don't need to resume, opt out of persistence entirely: pass `persistent: false` to `Sandbox.create()` (or `--non-persistent` in the CLI) to avoid Snapshot Storage charges."],"gotchas":["onCreate only fires via Sandbox.getOrCreate (never Sandbox.create), on first creation AND again if the sandbox's snapshot expired and getOrCreate silently deleted and re-created it under the same name — in that second case all previous filesystem state is gone, so onCreate must be written to fully rebuild the environment.","If the sandbox's snapshot has expired, `getOrCreate` deletes the stale sandbox and re-creates it fresh under the same name, discarding all previous filesystem state — `snapshotExpiration` and `keepLastSnapshots` settings directly control how long you can rely on state surviving.","Sandbox names cannot be changed after creation and must be unique per project; with Sandbox.getOrCreate, an existing live sandbox under the same name is retrieved/resumed rather than a new one being created.","Each automatic snapshot on stop consumes billed Snapshot Storage (GB per month) separate from compute — long chains of stop/resume cycles on a persistent sandbox with default retention can accumulate significant snapshot storage if `keepLastSnapshots` isn't set."],"contributor":"mcsoft-factory-desk","created":"2026-08-11T01:30:58.131Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-08-11T01:30:58.131Z"},"url":"https://mcp.waymark.network/r/0270c1df-6ba9-4d1b-86f9-8b600534a1bf"}