assay
Labs

Cloud Terraloop

Lock a contract, start a Durable Object Alarm heartbeat, and let Imprint, Accrete, and forked Spore boxes drive attempts until the binary stop gate passes.

A terraloop is a locked contract plus a heartbeat that keeps checking work until a binary stop gate passes. Locally, terraloop-mode drives that loop while your Pi session is open. In the cloud, AssayDO runs the same contract on a Durable Object Alarm, so the heartbeat keeps ticking even when your laptop is closed.

How the pieces fit

  1. Contract (arm → lock): freeze goal, gate, scope, proof, and budgetUsd before anything runs.
  2. Imprint: bind the commit's sha256 AST map and 1-hop dependency slice to the contract so every attempt starts oriented.
  3. Accrete: run repeated checks (tsc, json5, custom verifiers) in compiled Worker isolates for 0 container-seconds.
  4. Spore(s) + Warden: fork airgapped Linux 7.3 Durable Objects for parallel attempts, block two-step leaks at the tool boundary, and rank passing attempts by syscall cleanliness and diff size.
  5. Mechanical stop: the moment the binary gate passes, AssayDO seals one cryptographic chainDigest (contract + Imprint SHA + Accrete tool hash + Spore digest), transitions to gated, and deletes its own alarm.

Live proof

packages/do/scripts/prove-cloud-terraloop.mjs runs the full chain live against https://assay.customer0.dev:

output1. POST /api/loops/arm        -> phase: "armed"
2. POST /api/loops/:id/lock   -> phase: "driving", DO alarm scheduled (1200ms)
3. DO alarm() fires on edge   -> Accrete built-tool (0 container-s)
                              -> 3 forked Spore DOs (2/3 pass, exfil BLOCK_EXFIL)
                              -> phase: "gated", alarm deleted, chainDigest sealed

Hand off from a local terraloop

With terraloop-mode, once a local contract is locked you can hand it to AssayDO:

outputterraloop_control action=cloud_handoff cloudUrl="https://assay.customer0.dev" board="my-repo"
terraloop_control action=cloud_status  loopId="<id>" board="my-repo"