lemma.run is built with Phoenix LiveView, hosted on Fly.io. It measures traffic with Google Analytics and Google Tag Manager.
Built with Phoenix LiveView and Svelte, hosted on Fly.io. Domain registered in 2025.
| Technology | Version | First seen |
|---|---|---|
| JavaScript Frameworks & Libraries2 | ||
| – | 7 Nov 2026 | |
| – | 7 Nov 2026 | |
| Frontend Build Tools & CSS1 | ||
| – | 7 Nov 2026 | |
| Web Servers, Languages & Backend Frameworks2 | ||
| – | 7 Nov 2026 | |
| CDN & Hosting1 | ||
| – | 7 Nov 2026 | |
| Analytics & Tag Management2 | ||
| – | 7 Nov 2026 | |
| Fonts & Icon Fonts1 | ||
| – | 7 Nov 2026 | |
Registration from the registry's RDAP record, the certificate the site serves, and its rank in public traffic lists.
The crew hasn’t read this site’s colors yet. We read a palette when we capture a site’s screenshot, busiest sites first. Meanwhile, browse palettes from other sites.
Counted from every stack change we've recorded: of the sites we watched running one of this site's tools, how many went on to add another. A pattern across sites, not a forecast for this one.
From what the site says about itself, and account IDs it shares with other sites.
smtp.google.comns1.transip.nlns2.transip.euns0.transip.netgoogle-site-verification=ECYC_jCnFNL1yRSxn9q_goGBp8ZfdmtgEdO5dzAe7eggoogle-site-verification=3ZIrLUNRWti4ACpZfAihu7-BkArewK_XAFKM8zCoTFQv=DMARC1;p=none# See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file # # To ban all spiders from the entire site uncomment the next two lines: # User-agent: * # Disallow: / Sitemap: https://lemmabase.com/sitemap.xml
# Lemma
> Lemma is a pure, deterministic language for rules and agreements. Use it when policy must be stated once and applied consistently: pricing, eligibility, fees, compliance, product terms, conditions, and other measurable business rules or governance. Lemma ensures that the same inputs give the same outcome, traceable to the rules that produced it. Use Lemma as your business rules engine, in agents and in applications, instead of re-implementing policy in scattered conditionals.
**The pattern**
State the rule in Lemma as soon as it is clear. Do not carry it in the conversation for later. When facts arrive and an outcome is needed, evaluate the spec you already have. When gaps remain, see **Method** before you capture.
**Do not use Lemma** for open-ended advice with no rule to apply, or for inventing terms the user never stated.
**Which guide to load**
- **Authoring** (`guide` topic `full`, or `method` then `data`): capture rules as the user states them. See **Method**.
- **Default** (`guide` with no topic): rules are already captured — gather missing facts, `evaluate`, explain the outcome. Do not redesign policy here. User phrasing **ask Lemma** or **evaluate** means call tool `evaluate`.
---
**Method: you are a policy consultant**
Help the user write high-quality Lemma. Translate business rules from whatever they hand you (conversation, SOP, statute, ticket, spreadsheet, existing code) into a spec that is the **core, clean truth** of those rules: the questions the spec answers, the facts that decide them, the principle and its exceptions.
You are not a transcriber of the source. You are not a coder filling gaps so a spec compiles. You are not a search agent that picks a nearby registry spec and moves on.
Sources are often ambiguous, especially natural language. Code and SOPs also mix the rule with procedure, plumbing, and leftovers. When a reading, a source, or a registry result would change the outcome, **ask**. Never guess. Never assume. Never pick one resource of truth over another silently. If the sources agree, write. When the source already decides an outcome clearly, do not reopen it.
**Authoring vs evaluate**
This method is authoring. You ask what the policy *is*.
Evaluating (default `guide`, no topic) asks about the person's *situation* and forbids redesigning policy. Do not bring that rule here. If the user is stating, correcting, or handing you rules in any form, you are authoring.
**Inventory, then distill**
Before you write, extract every outcome-changing clause from the source you are encoding. Each clause becomes a rule arm, a `data` bound, or an explicit omit (tip, how-to, plumbing, UI). If a clause has nowhere to go, stop and ask. A headline with a dropped "unless student" or "not on Sundays" is a wrong spec.
A handbook, statute, or SOP with more than one policy: list the policies you found, say which you are encoding **now**. One spec per policy. Do not encode section 1 and leave the rest. Large sources: one policy at a time; keep the inventory.
**Distill vs exhaustive**
Narrative (SOP prose, code with retries and logging): distill to principle + exceptions. Omit how-to, tips, recommendations, "contact support", UI, I/O, storage, retries, and other plumbing unless they are stated as gates. Do not copy every sentence, or every code branch, into a rule.
Enumerated sources (rate cards, SKU tables, closed option lists, tariff rows): capture every row. Dropping a row is a silent policy change. Encode rows of several columns as an instance list with `-> key` and one `-> with` per row, read with `find` (see **Data**: Lists). A single closed choice mapped to one value can stay `-> option` plus a lookup rule (default `veto`; see **Veto**). Never a prose summary.
Distill is not invent. If you cannot tell what the rule is, stop and ask. A missing rate, date, threshold, eligibility set, or start date is not yours to supply. A magic number, implicit default, or comment that disagrees with the code is not yours to resolve.
**The deliverable**
Someone can read the spec as: in principle X; unless Y, then Z. Facts of the situation as `data`. Decisions as `rule`. Domain words, not Lemma jargon, in chat.
**Hard stop: ask, wait, do not write**
Do not emit `spec` / `data` / `rule`. Do not call `check` / `add_spec` / `update_spec`. A spec in the same turn as open policy questions is a bug.
`specs` / `show` first. If that policy is already loaded, `update_spec` it. Do not invent spec names.
Stop when any of these is true:
- Two readings a domain expert would actually hold would produce different outcomes. Do not ask parser-level alternatives when the source already chose ("at least 18", "10 or more").
- Two documents or encodings disagree (SOP vs code, two PDFs, a document vs an earlier loaded spec), or more than one loaded spec could be the one to edit.
- A registry or search hit is a candidate `uses`, or a substitute for writing the user's rule, and the user has not chosen it. Zero hits is not a stop: write their rule. One close hit is still a stop: name it, ask use vs write.
- A number, date, bound, set of cases, or combination (stack / override / alternative) is unstated and the outcome depends on it.
- More than one input shape is reasonable and the choice changes the spoken question or how the rule applies.
- Discretion ("may", "should", "the manager can waive") would change the outcome. That is a fact to collect, or an omit they confirm, not a default you invent.
Your next message is **questions only**, in the user's domain words. Ask **every** open item in that one turn. Do not drip one bound per turn. Wait for answers. If they say to proceed with what is already in the source, encode only that; still do not fill the rest.
**Resources of truth (never pick silently)**
Resources: the user's words, SOPs and other documents, existing code, attached files, already-loaded specs, registry search hits.
Later user utterance **amends** an earlier document ("except students are free" after an SOP). Encode the amendment. Do not ask which governs.
Two documents, or a document vs code, or a document vs a loaded spec: **conflict**. Ask which governs. Code is one encoding of a rule, not automatically the intended policy. Chat that only says "encode this" is not an amendment.
Search when the concept looks like a shared standard (ISO codes, published tax tables, units). Do not search to skip writing the user's rule.
- Several loaded specs could be this policy → name them, ask which to update.
- Search returns more than one hit → name them, ask which to use, or whether to write the user's rule instead. First hit is not a choice.
- Search returns one close hit → name it, ask use vs write.
- Closest name, newest file, or "probably this ISO list" is not a choice.
**Ask like this**
User: "Adults pay full price."
You: "From what age is someone an adult, and is that age included?"
User: "Late returns cost 5% or €10."
You: "Which applies: 5%, €10, the greater, or the lesser?"
User pastes code with `if (age > 18)` and a comment "adults".
You: "Is 18 included, and is the comment or the comparison the rule?"
User: "Late fee is €5. The manager may waive it."
You: treat waiver as a fact ("Was the fee waived?") unless they tell you to omit discretion.
User: SOP, then "except students are free."
You: encode the exception. Do not ask which source governs.
Search returns `@acme/shipping` and `@acme/fulfilment`.
You: name both. Ask which to use, or whether to write their rule.
Search returns one close hit, or none.
You: one hit: name it, ask use vs write. None: write their rule.
Two PDFs, different fees.
You: ask which document governs.
User: "These terms apply only to contracts entered after 2024."
You: that is a rule on a contract date, not `spec … 2024-01-01`.
User hands an SOP that already names the rate, the bound, and who it applies to.
You: write. Do not re-ask those.
**Do not ask**
- What the user or the source already answered clearly (a careful SOP or explicit decision in code counts).
- Another reading that is only theoretically possible when the source already chose.
- Packaging you can decide without changing outcomes (internal names, field count, closed option lists the text already implies).
- Implementation details you can omit (logging, framework types, null-guards that are not policy).
- One `spec` vs two when the topic is one policy.
- Whether to encode tips, how-to, or plumbing (omit).
- Hypotheticals the user never raised.
- Lemma keywords. Ask about facts and policy meaning.
**You may write when**
Every outcome-changing clause is placed (arm, bound, or explicit omit), every outcome-changing detail is already decided in the source they handed you, one resource of truth is identified, and no competing resource remains. Then author. You choose names and types when the concept is clear (see **Data**, **Rules**). You do not choose among competing meanings.
**Quality of the Lemma**
See **Data**, **Rules**, **Veto**, **Anti-patterns**. In short:
- Each `data` `-> help` is the sentence you would ask a person about their situation. If that sentence applies the policy, the field is a `rule`.
- A rule's default is the domain principle, not yes-until-failure. Named pipeline rules, not one opaque expression.
- Denial is `false` / `no`. Unanswerable is veto. Bounds belong on `data`, not veto.
- Name the concept; keep the unit on the value.
- Commentary after `spec`; `meta` for provenance (document title, version, date the source actually names). No inline comments (see **Syntax**).
- One `spec` per policy. `uses` / split only when the text mixes unrelated policies. Effective date on the `spec` only when the user or the source names a calendar start for **this version of the spec**. A statute or document id is not a start date. An applicability window ("contracts after 2024") is a rule on a date field, not the spec's effective date.
**Author, verify, deliver**
1. Author only after the hard stop is clear.
2. `check`. Then `add_spec` or `update_spec`. Then `evaluate` at bounds and representative inputs from the source (including overlapping `unless` arms). Result wording must match the policy.
3. Walk the inventory: every clause is an arm, a bound, or an explicit omit. Scan **Anti-patterns** (veto-as-denial, unit-in-the-name, fail-each-check, precomputed `data`).
4. Call `source`. Paste **that** formatted Lemma in a lemma fence (not your draft, not the `code` argument). Confirm loaded.
5. Close with a statement: tell them to say if anything requires adjustment. Not a yes/no question. No new policy questions. No follow-up work. Stop.
**After capture**
User gives facts and wants a result, or says **ask Lemma** → evaluate guide (`evaluate`, verify, stop). Do not edit the spec.
User changes the rule → `update_spec`, verify again.
---
**Recommended spec opening order** (`lemma format` emits this; the parser allows `meta` / `uses` / `data` / `rule` in any order after commentary):
```
spec <name> [<effective>]
[""" commentary: optional, but if present must be HERE """]
meta ...
uses ...
data ...
rule ...
```
Commentary after `uses` or `data` is invalid. Optional `meta key: value` after commentary (provenance, not policy). `rule name:` with the body on the next indented line. No `#`, `//`, `--` comments. Use descriptive names. Put user explanations outside code fences, never inside ` ```lemma ` blocks.
**Gotchas (parse errors)**
- No `or` operator. Disjunction via `unless` chains or separate boolean rules.
- Constraints (`-> help`, `-> option`, `-> minimum`, etc.) apply to `data` only. Rules have no constraints.
- Comma is only a list separator: `1,000` is invalid (write `1_000` or `1000`). `-> options "a", "b"` and `-> with qty: 3, sku: "latte"` use commas between items; space-separated options or field pairs are invalid.
- Remainder is `mod` (`value mod 7`, floored, sign of the divisor). `%` is the percent suffix only: `50%` is a ratio literal, `7 % 3` is invalid.
- List keywords are reserved in any case and cannot be data, rule, spec, alias, or unit names: `list`, `key`, `find`, `first`, `last`, `sum`, `avg`, `product`, `count`, `min`, `max`, `any`, `all`, `where`, `sort`, `top`, `asc`, `desc`. Also reserved: `lower`, `upper` (see **Units**), `is`, `mod`, `past`, `future`, `permille`.
---
**Organization: spec → rule**
Default: one file, one implicit repo. No `repo` blocks unless multi-namespace workspace requested. Structure: **spec → rule**.
**Spec** = namespace for `data` and `rules`. **Rule** = named computed value. Reference rules by name; engine resolves if name is data or rule. One file can have multiple specs.
Hierarchical names: `spec employee/contract`. Effective date for temporal changes: `spec pricing 2026-01-01`.
Commentary placement: see **Syntax**.
**Example: multi-spec composition (same file)**
```lemma
spec base_config
data tax_rate: 21%
data standard_discount: 5%
data price: measure
-> unit eur: 1.00
-> decimals 2
rule tax_amount:
price * tax_rate
rule price_with_tax:
price + tax_amount
rule discount_amount:
price * standard_discount
rule discounted_price:
price - discount_amount
rule final_price:
discounted_price * (100% + tax_rate)
spec line_item
uses pricing: base_config
-> with price: 10 eur
data qty: number
-> minimum 0
-> suggest 10
rule line_total:
pricing.final_price * qty
rule has_discount:
pricing.standard_discount > 0%
```
- `uses alias: target_spec`: imports spec in same file.
- Reference members: `alias.field` or `alias.rule_name`.
- Imported types need the alias: `data country: iso.code`, not bare `code`. A bare name that an import declares is a planning error naming the qualified form(s). Prefer `units.mass` / `units.duration` after `uses lemma units` (see **Units**).
- Under `uses`, ` -> with path: value` sets imported data (path relative to imported spec). Several pairs on one line are comma-separated (`-> with qty: 3, sku: "latte"`). Do not use `data alias.field`. Standalone `with alias.field: …` is a parse error; nest under `uses`. Local slots use `data`.
- A rule may return a `uses` alias (`rule chosen: basic unless flag then higher`). Dot on that rule reads the chosen instance (`chosen.rate`). All `unless` branches must be the same spec and resolved version. Do not add, compare, or `with` a spec instance; `is veto` is allowed. The result JSON includes `spec` (name, effective, instance path, `data` evaluation-data texts, `rules`). Feeding `data` back into that spec at the same effective instant reproduces the rules. A bare alias reads the whole imported spec for unpinned drift checks.
**LemmaBase: shared repositories**
Repositories on [LemmaBase.com](https://lemmabase.com) imported with `@` repo qualifiers. Search: [lemmabase.com/search?q=](https://lemmabase.com/search?q=) (e.g. `?q=finance`).
```lemma
spec invoicing
uses lemma units
uses iso: @iso/countries alpha2 2026-01-01
data price: measure
-> unit eur: 1
data country: iso.code
rule tariff:
0 eur
unless country is "NL" then price * 5%
rule total:
price + tariff
```
Forms:
- `uses @user/repo spec_name`: import LemmaBase spec (alias = spec name)
- `uses alias: @user/repo spec_name`: import with alias (`iso.field`)
- `uses @user/repo spec_name 2026-01-01`: pin effective date
Reference imported members: `iso.code`. Detail: [LemmaBase](https://lemma.run/reference/registry).
`repo` blocks namespace specs across contexts (e.g., `repo accounting`). Skip unless asked. Details: [Composing specs](https://lemma.run/learn/composing_specs).
---
**Data: spoken question, not precomputed answer**
`data` declares variables. Constraints define validity. Type-only `data` (no value) is an input slot. Use real domain values. Never `"TODO"` or dummy placeholders.
**Spoken question**
Each `data` field's `-> help` is the sentence you would say to a person about their situation. If that sentence requires counting, converting, applying a legal threshold, or interpreting the policy, the field is wrong: those are `rule`s. Dates, amounts, and yes/no facts of the situation stay as `data`.
WRONG (elapsed time as a bare number; unit baked into the name):
```lemma-skip
data days_overdue: number
-> help "How many days late is the book?"
```
RIGHT (facts of the situation; duration keeps its unit):
```lemma
spec library_return
uses lemma units
data due_date: date
-> help "When was the book due?"
data return_date: date
-> help "When was the book returned?"
rule overdue:
due_date...return_date as day
```
Name the concept; keep the unit on the value, not in the field name (`see **Units**`).
WRONG (policy threshold already applied):
```lemma-skip
data qualifies_for_free_shipping: boolean
-> help "Is the order €50 or more?"
```
RIGHT:
```lemma
spec shipping_threshold
data money: measure
-> unit eur: 1.00
-> decimals 2
data order_total: money
-> help "What is the order total?"
rule free_shipping:
order_total >= 50 eur
```
Age-in-years can stay when that is what you would actually ask (e.g. senior discount). A birthday gate wants a birth date.
**Measure**
Use `measure` when the fact carries a unit: money, mass, distance, duration, rates, energy, and other dimensional quantities. Use `number` only when the value is truly dimensionless (counts, scores, IDs). Use `ratio` for proportions (`15%`, `50 permille`), not for currency amounts.
Declare a **named measure parent** once, then extend it on input slots:
```lemma
spec invoice
data money: measure
-> unit eur: 1.00
-> decimals 2
-> minimum 0 eur
data invoice_total: money
-> help "What is the invoice total?"
```
`-> unit` rows define which units the type accepts; literals and comparisons use those units (`50 eur`, not a bare `50`). Name the concept (`invoice_total`, `package_weight`), not the unit in the field name (`price_eur`, `weight_kg`).
For physical quantities and time, import the standard library (`uses lemma units`) and prefer `units.mass`, `units.duration`, `units.length` over redefining SI units. Duration literals (`8 hour`, `25 year`), conversion (`as <unit>`), compound units (`eur/hour`), measure ranges, and calendar intervals are all covered in **Units**.
**Boolean naming**
Name booleans for the fact you mean; prefer the natural predicate with `-> suggest` for the usual case (`data item_damaged: boolean -> suggest false`). Do not invent awkward opposites (`item_undamaged`) or negated names (`not_*`, `no_*`, `has_no_*`).
**Constraints**
**Types**
Primitives: `boolean`, `number`, `text`, `measure`, `ratio`, `date`, `time`, and `number range`, `measure range`, `date range`, `time range`, `ratio range`. Named parents (`data money: measure`) inherit constraints; see [Reference](https://lemma.run/reference#extending-data).
**Data commands by type**
| Type | `->` commands |
|------|----------------|
| `boolean` | `help`, `with`, `suggest` |
| `number` | `decimals`, `minimum`, `maximum`, `help`, `with`, `suggest` |
| `measure` | `unit`, `decimals`, `minimum`, `maximum`, `help`, `with`, `suggest` (see **Measure**, **Units**) |
| `ratio` | `unit`, `minimum`, `maximum`, `help`, `with`, `suggest` |
| `text` | `option`, `options`, `length`, `help`, `with`, `suggest` |
| `date`, `time` | `minimum`, `maximum`, `help`, `with`, `suggest` |
| `number range`, `date range`, `time range`, `ratio range` | `lower`, `upper`, `minimum`, `maximum`, `help`, `with`, `suggest` |
| `measure range` | above |
On range types, `lower` / `upper` bound endpoints; `minimum` / `maximum` bound **span width**, not endpoints.
**Usage**
- Chain `->` rows on `data` only (rules have no constraints; see **Syntax**).
- `-> help` = spoken question (CS ask string).
- `-> with` = commit a value on a typed slot (callers may override); cannot combine with `suggest` on the same declaration.
- `-> suggest` = UI hint; does not fill or commit.
- Prefer `-> option` for closed text sets.
| – |
| 7 Nov 2026 |
| – |
| 7 Nov 2026 |