Definition
A generator does not run on Lemma. It is a descriptor: inputsSpec (the inputs the script expects), outputsSpec (the rawDoc shape it returns and the schema it targets), and source (a URL or other location where the script itself lives). Registration stores this descriptor under your scope.
Keeping the generation logic off-platform means document production stays on developer-controlled infrastructure — external APIs, private data sources, and proprietary assembly steps never touch Lemma's servers. Lemma records only what is needed to reference and verify the generator later.
The generatorId and the hash of its descriptor are treated as ZK public inputs. A proof can therefore attest that a given rawDoc was produced by a specific, registered generator — binding the document's origin into the verifiable record without revealing the generation logic itself.
Lemma implementation
A generator is registered against a scope and tied to a schema through its outputsSpec. The dashboard's Overview tab lists generators alongside other registered artifacts; the workers API exposes generators.register and generators.getById.
Because the generator hash is a public input, the same descriptor anchors both the document's provenance and any downstream ZK proof that references how the document was produced — without exposing the script or its private inputs.
When a produced document is later disclosed selectively, the generator that built it remains referenceable as the document's origin, so the disclosure and its provenance resolve to the same registered descriptor.