Records
Schema reference for all governance, versioning, contract selection, checkpoint, and execution records in a Lema store.
While canonical lema.core/v4 objects represent mathematical definitions, statements, and proofs, store records (crates/lema-store) capture project snapshots, contract selections, revisions, policies, semantic merges, change reports, checkpoints, VM guarantee receipts, and releases.
Every immutable record is serialized as canonical JSON and content-addressed with a dedicated SHA-256 domain separator so that a record ID can never collide with a lema.core/v4 object ID or a record of another schema.
Store records and files at a glance
| Schema or file | Hash domain prefix | Mutability | Purpose |
|---|---|---|---|
aliases.json | None (mutable index) | Mutable | Maps human-readable alias names to 64-hex lema.core/v4 object IDs. |
entries.json | None (mutable index) | Mutable | Maps human-readable entry aliases to lema.exec/v2 record IDs (LEMA-289). |
refs.json | None (mutable index) | Mutable | Maps project reference names (such as main) to {policy, revision, generation}. |
actors.json (lema.actors/v1) | None (store-local) | Append/revoke | Maps actor IDs to SHA-256 bearer token hashes and roles. |
lema.bundle/v1 | LEMA-BUNDLE-v1\0 | Immutable | Named collection of exported aliases (entries: {name: id}). |
lema.binding-map/v1 | LEMA-BINDING-MAP-v1\0 | Immutable | Maps symbolic module imports (alias) to lema.bundle/v1 IDs. |
lema.authoring/v2 | LEMA-AUTHORING-v2\0 | Immutable | Preserves source files, elaboration inputs, symbolic imports, and lema.contract/v1 IDs. |
lema.validation/v1 | LEMA-VALIDATION-v1\0 | Immutable | Store-local validation receipt for a lema.authoring/v2 bundle. |
lema.asset/v1 | LEMA-ASSET-v1\0 | Immutable | Content-addressed non-Lean project file (asset, config, doc, or license). |
lema.snapshot/v2 | LEMA-SNAPSHOT-v2\0 | Immutable | Complete project state: exported entries, bindings, optional authoring, and assets. |
lema.contract/v1 | LEMA-CONTRACT-v1\0 | Immutable | Contract or law selection record with open, checked, or waived status. |
lema.revision/v1 | LEMA-REVISION-v1\0 | Immutable | Commit record binding parent revisions, a snapshot, intent, obligations, and discharged. |
lema.policy/v1 | LEMA-POLICY-v1\0 | Immutable | Governance rules for a project reference (require, protect, review). |
lema.review/v1 | LEMA-REVIEW-v1\0 | Immutable | Actor sign-off on a target revision, policy, or release (approve or reject). |
lema.review-display/v1 | LEMA-REVIEW-DISPLAY-v1\0 | Immutable | Review record binding the exact view::renderer_sha256() digest and displayed text. |
lema.guarantee/v1 / lema.vm-guarantee/v1 | LEMA-GUARANTEE-v1\0 | Immutable | Static analysis receipt for VM resource, constant-time, and secret-flow profiles. |
lema.merge/v1 | LEMA-MERGE-v1\0 | Immutable | Three-way semantic merge record (base, left, right, conflicts, resolutions). |
lema.change-report/v1 | LEMA-CHANGE-REPORT-v1\0 | Immutable | Semantic diff report across seven change categories plus contract status deltas. |
lema.view/v1 | LEMA-VIEW-v1\0 | Immutable | Curated inspection markers (contract, entrypoint, headline_guarantee). |
lema.derivation/v1 | LEMA-DERIVATION-v1\0 | Immutable | Provenance record for rebind and instantiate object derivations. |
lema.checkpoint/v1 | LEMA-CHECKPOINT-v1\0 | Immutable | Self-contained .lemabundle archive of objects, aliases, records, and entries. |
lema.exec/v2 | LEMA-EXEC-v1\0 | Immutable | Resolved VM execution manifest binding root declaration IDs, families, and limits. |
lema.release/v1 | LEMA-RELEASE-v1\0 | Immutable | Production release record binding revision, snapshot, guarantees, reviews, and artifact digests. |
Bundles, binding maps, authoring, assets, and snapshots
lema.bundle/v1 (LEMA-BUNDLE-v1\0)
A bundle groups exported declarations under local names so downstream modules can import them without hardcoding raw object IDs:
{
"entries": {
"Counter": "4a18...90e1",
"advance_law": "9c02...11b4"
},
"schema": "lema.bundle/v1"
}lema.binding-map/v1 (LEMA-BINDING-MAP-v1\0)
Maps symbolic module aliases (Received.<alias>.<member>) to specific lema.bundle/v1 IDs:
{
"bindings": [
{
"alias": "Storage",
"bundle": "7e31...c408"
}
],
"schema": "lema.binding-map/v1"
}lema.authoring/v2 (LEMA-AUTHORING-v2\0)
Records the exact inputs used to elaborate a module or package, including elaboration (source, prefix, roots, seed_salt, seeds, receive), symbolic imports, optional contracts ([<contract_id>, ...]), and metadata. When validated, the store also writes a lema.validation/v1 receipt (LEMA-VALIDATION-v1\0).
lema.asset/v1 (LEMA-ASSET-v1\0)
Stores non-code project files (such as lema-cap.json, documentation, or license texts) alongside code in a snapshot:
| Field | Type | Description |
|---|---|---|
schema | "lema.asset/v1" | Schema identifier. |
kind | "asset" | "config" | "doc" | "license" | Asset classification. |
bytes | Base64 / hex string | Raw file payload. |
sha256 | 64-hex string | SHA-256 digest of the raw file bytes. |
size | Integer | Byte length of the file. |
license | String (optional) | SPDX license identifier when kind == "license". |
covers | Array of strings (optional) | Relative paths covered by a license asset. |
lema.snapshot/v2 (LEMA-SNAPSHOT-v2\0)
Captures the complete state of a project tree at a point in time:
{
"assets": [
{
"id": "5d20...8a11",
"path": "lema-cap.json"
}
],
"authoring": "c841...09f2",
"bindings": "1b09...44e7",
"entries": {
"App.main": "e012...77a3",
"App.spec": "3a99...bc01"
},
"schema": "lema.snapshot/v2"
}Contract selections
lema.contract/v1 records (crates/lema-store/src/records/contract.rs, hash domain LEMA-CONTRACT-v1\0) represent progressive verification targets created via select declarations in .lema files or the contract.select API method.
Because every lema.contract/v1 record is immutable and content-addressed, discharging an open contract or waiving it produces a new lema.contract/v1 record with a new 64-hex ID rather than mutating the existing record in place.
{
"arguments": [
"8b14...e77a"
],
"by": "d409...22c8",
"contract_or_claim": "3f9a...c102",
"laws": [
{
"by": "a117...66f0",
"field": "preserve",
"target": {
"check": "statement",
"statement": "0e55...91d3",
"type": "0e55...91d3"
}
}
],
"schema": "lema.contract/v1",
"scope": {
"kind": "snapshot",
"snapshot": "f920...18b4"
},
"status": "checked",
"target": {
"check": "satisfaction",
"levels": 0,
"realizations": [
{
"from": "3f9a...c102",
"to": "8b14...e77a"
}
],
"statement": "6c44...30a1",
"type": "2b88...71e9"
}
}Key fields of lema.contract/v1
| Field | Type | Description |
|---|---|---|
contract_or_claim | Object ID | The record, declaration, statement, or template being selected. |
levels | Array of strings (optional) | Universe level instantiations (must be monomorphic, levels: 0 in target). |
arguments | Array of Object IDs | Concrete implementation declarations passed to the contract or claim. |
target | Object | Synthesized verification target (levels: 0, type, realizations?, statement, check: "proof" | "satisfaction"). |
laws | Array (optional) | Per-law breakdown (field, target, optional default, optional by witness ID) when selecting a multi-law contract record. |
scope | Object | Either {"kind": "global"} or {"kind": "snapshot", "snapshot": "<id>"}. |
status | "open" | "checked" | "waived" | Current verification state of the selection. |
by | Object ID (optional) | Whole-selection proof or satisfaction witness ID when status == "checked". |
reason | String (optional) | Explicit waiver justification when status == "waived". |
When status is "checked", Store::check_witness verifies that either a whole-selection witness by satisfies target, or every entry in laws has a valid per-law witness by (or verified default law proof) that discharges its synthesized law statement.
Revisions, obligations, and project references
lema.revision/v1 (LEMA-REVISION-v1\0)
A revision is an immutable commit record linking a lema.snapshot/v2 to its parent revisions and tracking proof obligations:
{
"author": "alice",
"discharged": [
{
"by": "d409...22c8",
"obligation": {
"selection": "91a0...55e2"
}
}
],
"intent": "Verify counter conservation law",
"obligations": [],
"parents": [
"6b12...04d9"
],
"schema": "lema.revision/v1",
"snapshot": "f920...18b4"
}Each entry in obligations or discharged identifies either a raw statement ID ({"statement": "<id>"}) or a contract selection ID ({"selection": "<contract_id>"}). An obligation is discharged either by a checked proof/satisfaction ("by": "<id>") or by an explicit recorded waiver ("waiver": {"actor": "<id>", "reason": "<text>"}).
refs.json
Each named project reference in refs.json tracks:
policy: The activelema.policy/v1record ID governing the reference.revision: The current headlema.revision/v1record ID.generation: A monotonically increasing integer incremented on everyref.publishorref.adoptoperation to prevent lost updates.
Policies
lema.policy/v1 records (LEMA-POLICY-v1\0) define what a revision must satisfy before lema commit or ref.publish can advance a project reference.
{
"protect": [
{
"gate": "preserve-law",
"target": "App.spec"
}
],
"require": {
"axioms": [
"propext",
"Quot.sound",
"Classical.choice"
],
"no_obligations": true,
"profiles": [
"ConstantTime"
]
},
"review": {
"actors": [
"alice",
"bob"
],
"threshold": 1
},
"schema": "lema.policy/v1"
}| Section | Field | Enforcement during ref.publish and release.create |
|---|---|---|
require.axioms | Array of axiom names | Every object in the snapshot’s transitive closure must use only a subset of these axioms (always above the fixed floor). |
require.no_obligations | Boolean | When true, refuses publication if the revision has any remaining open obligations or "status": "open" contract selections. |
require.profiles | Array of profile names | Requires matching lema.vm-guarantee/v1 receipts for all entrypoints in the snapshot. |
protect | Array of {target, gate} | Prevents changing or weakening protected aliases (preserve-id, preserve-type, or preserve-law). |
review | {threshold, actors} | Requires at least threshold approving lema.review/v1 records signed by distinct listed actors. |
Reviews, merges, change reports, and guarantees
lema.review/v1 and lema.review-display/v1
lema.review/v1(LEMA-REVIEW-v1\0) records an actor’s"approve"or"reject"decision over a target record (revision,policy, orrelease) with a timestamp and comment.lema.review-display/v1(LEMA-REVIEW-DISPLAY-v1\0,crates/lema-store/src/display.rs) binds a review decision to the exact rendered contract text (displayed), the syntax mode ("lema"or"lean"), andview::renderer_sha256()so auditors can prove what text the reviewer saw.
lema.merge/v1 (LEMA-MERGE-v1\0)
Records a three-way semantic merge between base, left, and right revisions. If structural conflicts occur, conflicts classifies each one into one of five kinds:
collision: Both branches added the same alias or asset path with different IDs.delete-update: One branch deleted an alias while the other modified it.update-update: Both branches modified the same alias to incompatible objects.rename-rename: Both branches renamed the same underlying object ID to different aliases.bundle: Incompatible symbolic binding updates inlema.binding-map/v1.
When obligations from one branch still apply to unchanged statements on the other branch, the merge record tracks proof reuse under reuse.
lema.change-report/v1 (LEMA-CHANGE-REPORT-v1\0)
Produced by lema diff, revision.report, and snapshot.diff. Classifies every semantic change between two snapshots into seven categories:
rename: Same object ID moved to a new alias name.exports: Aliases added or removed from the snapshot surface.rebind: Symbolic dependency bundle updated without changing local source.substitute: Implementation replaced with a definition proven equivalent or refining (Replaces/Refines).evolve: Implementation changed with a new or compatible specification.policy: Governance policy requirements narrowed or widened.material: Unwitnessed behavioral or statement change requiring review.
It also includes a contracts summary listing newly checked, open, or waived lema.contract/v1 selections.
lema.guarantee/v1 and lema.vm-guarantee/v1 (LEMA-GUARANTEE-v1\0)
Records static verification of VM execution properties (scope: "root" | "application", families, profiles, compiler, and receipt). See Execution Manifest for the full list of VM guarantee profiles.
Checkpoints, execution records, and releases
lema.checkpoint/v1 (LEMA-CHECKPOINT-v1\0)
Written to .lemabundle files by lema export (crates/lema-store/src/records/checkpoint.rs). A checkpoint packages a self-contained closure of objects, aliases, bundles, records (snapshots, contracts, revisions, policies, guarantees), excluded boundary object IDs, and entries (entries.json mappings). Importing a checkpoint with lema import replays every object through the Lean kernel before admitting the records.
lema.exec/v2 (LEMA-EXEC-v1\0)
Resolved VM execution record binding an application entry declaration ID (entry.root), its allowed capability families, dependency roots, guarantees, limits, and seconds. See Execution Manifest.
lema.release/v1 (LEMA-RELEASE-v1\0)
Created by lema release (release.create). Binds a published revision, snapshot, policy, exec record ID, guarantees, approving reviews, target kind ("vm"), and the compiled lema.vm-app/v1 artifact digest (sha256). Deployment lifecycle transitions (select, withdraw, supersede) are recorded under LEMA-DEPLOYMENT-v1\0.
Lema v0.3.2 · Updated 29 October 2026 · Version and compatibility