Release an application
Bind an accepted store closure, compiled LemaIR artifact, VM worker binary, and lema-cap.json deployment configuration into an immutable lema.release/v1 record, and deploy to a VM-only host.
How do you guarantee that the VM application running in production was compiled from the exact mathematical declarations and kernel receipts in your store, passed ConstantTime and SecretFlow static analyses, and runs only against the deployment configuration (lema-cap.json) you approved?
A release record (lema.release/v1, crates/lema-store/src/release.rs) binds all four pieces together under a single content-addressed SHA-256 ID:
- The accepted store closure and its Lean 4.34.1 kernel receipts (
checked). - The compiled
LemaIRcode and any required static guarantee receipts (ConstantTime,SecretFlow.<role>,tested). - The registered
lema-vm-runnerworker binary digest. - The normalized SHA-256 digest of the deployment’s
lema-cap.jsonconfiguration (with secret values kept strictly outside the release bytes).
Every time you run lema run --release, the release gate re-verifies those bindings before starting lema-vm-runner inside the sandbox. Any application that uses secrets (Io::Secret, exchange, or serve) requires a release to run (LEMA-421).
Before you start
- Matching
lemaandlema-vm-runnerbinaries on yourPATH. - Either a
lema.jsonproject (Work with a Lema project) or a store with a built VM artifact (Build a VM application) and a deployment directory containinglema-cap.json(Build an application with capabilities).
Workflow A: One-line project release (lema release and lema run --release)
Inside a Lema project directory, cutting and running a release takes two commands:
lema release
lema run --release --input request.binHere is what those two commands do under the hood (LEMA-375):
lema release [ENTRY]resolves the project’s application entry, verifies that its closure and requiredConstantTime/SecretFlowguarantees hold, compiles or reuses the verified compile memo in.lema/store/vm-code-cache, creates and selects thelema.release/v1record in.lema/store, and writes the 64-character release ID to.lema/last-release.lema run --releasereads.lema/last-releasewhen no explicit release ID is given, runs the full release verification gate against.lema/store, the cachedLemaIRartifact, thelema-vm-runnerbinary, andlema-cap.json, and launches the VM worker. Using the.lema/last-releaseshortcut never bypasses any verification check.
Workflow B: Explicit artifact release and VM-only host deployment
In production, you often want to elaborate and check proofs on a build host (which has the pinned Lean 4.34.1 toolchain installed) and deploy the verified application to a deploy host that has no Lean distribution, no lean/ directory, and no Rust compiler (LEMA-312, docs/deploy.md).
Here is what runs on each host:
| Step | Host | Needs Lean 4.34.1? | Native calls |
|---|---|---|---|
1. Admit modules & replay checkpoint (lema checkpoint import) | Build host | Yes | Lean kernel replay |
2. Build VM artifact (lema build) | Build host | No | None (pure Rust LemaIR) |
3. Register installed worker (lema build --worker) | Deploy host | No | None |
4. lema release create, verify, select, withdraw | Deploy host | No | None |
5. lema run --release | Deploy host | No | One lema-vm-runner worker per run |
1. Stage the store and artifact on the build host
On your build host, import the lema.exec-source/v2 manifest, build the VM artifact in Rust, and export/import the accepted closure into a clean deployment store so its kernel receipts come from a fresh replay:
lema exec import --manifest apps/escrow-ledger-vm.json \
--entry escrow-ledger.vm --expect none --socket $BUILD_SOCK
lema build escrow-ledger.vm --name ledger \
--worker /usr/local/bin/lema-vm-runner --store $BUILD_STORE --runtime $BUILD_CONFIG
lema checkpoint export --root $EXEC_ID --out ledger.lemabundle --socket $BUILD_SOCK
lema checkpoint import ledger.lemabundle --sha256 $BUNDLE_HEX --socket $DEPLOY_PREP_SOCKShip the prepared store directory ($STORE), the lema and lema-vm-runner binaries from your release build, and your deployment configuration directory ($DEPLOYMENT/lema-cap.json) to the deploy host.
2. Configure a VM-only runtime on the deploy host
On the deploy host, write a lema.runtime-linux/v2 configuration file that omits distribution (Write a runtime configuration):
{
"schema": "lema.runtime-linux/v2",
"output": "/srv/lema/output",
"shared_lock": "/srv/lema/native.lock",
"profile": "container"
}Confirm the VM-only configuration with lema check-runtime:
lema check-runtime --runtime /srv/lema/runtime-vm.jsonvm-only: Lean calls refusedA VM-only runtime binds no Lean toolchain into any sandbox and refuses every Lean or checker call before reserving the ledger, while supporting lema build, lema release, and lema run --release.
3. Register the deploy host’s lema-vm-runner worker
An imported store never registers a binary worker automatically. Run lema build once on the deploy host pointing at /usr/local/bin/lema-vm-runner:
lema build escrow-ledger.vm --name ledger \
--worker /usr/local/bin/lema-vm-runner \
--store /srv/lema/store --runtime /srv/lema/runtime-vm.jsonThis makes zero Lean calls, writes /srv/lema/store/vm-workers/<sha256>.json, and produces an artifact whose id matches the build host’s artifact ID.
4. Create, verify, select, and run the release
Now inspect the deployment digest, create the release record, verify it from scratch, select it, and run it:
lema release deployment --deployment /srv/ledger/deploy
lema release create --artifact ledger --deployment /srv/ledger/deploy \
--store /srv/lema/store --runtime /srv/lema/runtime-vm.json
lema release verify --release $RELEASE_ID --artifact ledger --deployment /srv/ledger/deploy \
--store /srv/lema/store --runtime /srv/lema/runtime-vm.json
lema release select --release $RELEASE_ID --artifact ledger --deployment /srv/ledger/deploy \
--store /srv/lema/store --runtime /srv/lema/runtime-vm.json
lema run --release $RELEASE_ID --artifact ledger --deployment /srv/ledger/deploy \
--input request.bin --store /srv/lema/store --runtime /srv/lema/runtime-vm.jsonNotice the difference between create/run and explicit verify:
lema release createandlema run --releaseverify all store receipts, artifact digests, worker registration, andlema-cap.json, and may reuse the store’s validated compile memo (<store>/vm-code-cache) when its inputs match.lema release verifyalways recompiles the accepted store closure toLemaIRfrom scratch in Rust and compares the freshly compiled bytes against the artifact on disk.
5. Inspect, supersede, or withdraw a release
Manage release lifecycles in the store using show, list, supersede, and withdraw:
lema release list --store /srv/lema/store
lema release show --release $RELEASE_ID --store /srv/lema/store
lema release supersede --release $RELEASE_ID --by $NEW_RELEASE_ID \
--reason "Updated TCP deadline limits" --store /srv/lema/store
lema release withdraw --release $RELEASE_ID \
--reason "Retired old endpoint address" --store /srv/lema/store- Superseding (
supersede) records$NEW_RELEASE_IDas the preferred successor while still allowing$RELEASE_IDto be selected and run as an explicit rollback. - Withdrawing (
withdraw) permanently blocks$RELEASE_IDfrom being selected or run in that store. Because a queued run checks the release gate at the moment execution starts, withdrawing a release immediately stops any pending run from launching.
Common refusals
| Refusal message contains | Cause and fix |
|---|---|
missing or different worker registration | Run lema build ENTRY --name NAME --worker /path/to/lema-vm-runner on the target store to register the local worker binary. |
changed artifact bytes | A file inside the artifact directory (manifest.json or compiled code) was modified after building. Re-run lema build. |
changed lema-cap.json | /srv/ledger/deploy/lema-cap.json was edited after lema release create. Restore the file or cut a new release for the updated configuration. |
is withdrawn | The release was withdrawn with lema release withdraw (or a kernel receipt in its closure was withdrawn) and can no longer run. |
block device file ... | A file named in block_devices is not a canonical 0600 regular file with link count 1 under protected parents. Fix its permissions or path. |
Lema v0.3.2 · Updated 29 October 2026 · Version and compatibility