Skip to content

Cards schema reference

The canonical wire format for Lemma cards is defined as a single JSON Schema document at schema/card.v0.1.json. This page summarises the shape of every variant; the schema file itself is the authority.

IdentifierValue
$idhttps://openlemma.dev/schema/card.v0.1.json
Spec versionJSON Schema 2020-12
Discriminatortop-level kind field
LicenceMIT

A card is a oneOf over four variants — principle, ops, hypothesis, unidentified. Every variant is closed (additionalProperties: false); unknown fields fail validation.


PrincipleCard

The structural shape used for physics, chemistry, biology, climate, mathematics, engineering, and numerical methods. The discriminator is structural, not subject-area — the actual domain lives in the domain field.

FieldTypeRequiredNotes
kindconst "principle"yesVariant discriminator
idstring, kebab-caseyesPattern ^[a-z][a-z0-9-]*$. Stable and never reused once published.
versionsemver stringyesMAJOR for breaking convention changes, MINOR for added limits, PATCH for typos / refs.
namestringyesHuman-readable title.
domainstringnoSubject area, e.g. "physics-condensed-matter", "chemistry-electrochemistry". Conventional values are listed in the schema.
principlesstring arrayyesThe underlying physical / mathematical principles in plain English.
formulaTeXstringyesCanonical equation in LaTeX. KaTeX-renderable.
conventionsstring arrayyesSign conventions, unit conventions, coordinate frames.
expectedLimitsstring arrayyesPlain-English asymptotic / boundary expectations.
referencesstring arrayyesCanonical sources — textbooks, papers, official documentation.
validationEnvelopesobjectnoNumerical bounds asserted at runtime. Keys are domain-conventional (e.g. gEarth_m_per_s2); values are either [min, max] tuples or richer objects.

OpsCard

Parameterised templates for scripting and job-submission tasks (SLURM, Snakemake, Singularity recipes).

FieldTypeRequiredNotes
kindconst "ops"yesVariant discriminator
idstring, kebab-caseyesSame pattern as PrincipleCard.id
versionsemver stringyes
namestringyes
descriptionstringyesOne-paragraph plain-English summary.
parametersarray of OpsParameteryesEach entry: { key, label, defaultValue, required, note? }
validationstring arrayyesValidation rules in plain English.
referencesstring arrayyesSources.

OpsParameter

FieldTypeRequiredNotes
keystringyesIdentifier used by the template engine.
labelstringyesHuman-readable label.
defaultValuestringyesDefault; empty string allowed.
requiredbooleanyesWhether the template requires this parameter at instantiation.
notestringnoFree-form explanation, rendered alongside the label.

HypothesisCard

Proposed extensions to the corpus — generated by an LLM, by a human, or by symbolic regression. Explicitly not yet verified; the cross-check engine consumes the declared checks to decide whether the hypothesis can be promoted to a principle.

FieldTypeRequiredNotes
kindconst "hypothesis"yes
idstring, kebab-caseyes
versionsemver stringyes
namestringyes
proposalstringyesPlain-English statement of what the hypothesis claims.
proposedFormulaTeXstringyesThe proposed equation in LaTeX.
derivedFromobjectno{ cardId: string, relationship: "extends" | "replaces" | "complements" }
checksHypothesisChecksSpecyesThe cross-checks the engine should run.
referencesstring arrayyes
originenumyes"llm", "human", or "symbolic-regression".
rationalestringnoWhy this hypothesis was proposed.

HypothesisChecksSpec

FieldTypeNotes
dimensionalobjectlhsLabel/lhsDims/rhsLabel/rhsDims (canonical DimVecs). Optionally expr (a plain-ASCII RHS expression, e.g. "(1/2)*m*v**2") + symbols (map of symbol → DimVec): when both are present the engine derives the RHS dimensions from the formula and checks them against lhsDims, instead of trusting the declared rhsDims.
limitsarrayEach entry: { name, regime, expectedReducesTo }. Currently warn pending symbolic verification.
conservationLawsarrayEach entry: { law, statement }. law is one of energy, momentum, charge, particle-number, total-spin, parity.
referenceCorpusobject{ mustAgreeWith?: string[], mayContradict?: string[] }. The engine resolves every id against the live corpus.

DimVec

Canonical dimension vector. Each axis is an integer exponent on a primitive dimension. Omitted axes default to zero.

AxisMeaningNotes
Llength
Ttime
Mmass
Eenergy
Qcharge
ThetatemperatureRenders as Greek capital Θ in human output.
Nparticle count

UnidentifiedCard

Sentinel returned by the IDENTIFY phase when no card honestly matches the request. Surfaced verbatim instead of fabricating a fallback.

FieldValueNotes
kindconst "unidentified"
idconst "none"
versionconst "0.0.0"
namestring
reasonstringWhy nothing matched.

Validating a card

Terminal window
npx ajv-cli@5 validate --spec=draft2020 \
-s schema/card.v0.1.json \
-d "cards/**/*.json"

or in Python:

from artano_lemma import validate_card_payload, parse_card
# Strict validation against the schema:
validate_card_payload(my_card_dict)
# Or validate + parse to a typed model in one call:
card = parse_card(my_card_dict)

See the Python SDK page for the typed models and the validator.