1. Introduction

Lemma is a language for writing business rules. It allows you to write rules with conditions and certain outcomes. You, your applications, or your AI agents send data in, Lemma evaluates the rules against it, and you get decisions back. The spec is versioned, shareable, and queryable over HTTP without writing any code.

The core idea is separation. Your rules live in Lemma, not scattered across application code. When the rules change, you update the spec. The rest of your system doesn't need to know.

A rule looks like this

A rule has a name, a default value, and zero or more conditions that override it.

rule needs_umbrella:
  no
  unless forecast is "rain"  then yes
  unless forecast is "storm" then yes
  unless forecast is "snow"  then yes

The rule needs_umbrella returns no by default. It returns yes if the forecast is rain, storm, or snow. You send in a value for forecast and get a yes or no back.

Rules live inside a spec. A spec is a named, versioned collection of rules and data definitions. You publish a spec to make it available for querying.

spec weather_advice

data forecast: text
  -> options "sunny" "cloudy" "rain" "storm" "snow"

data temperature: scale
  -> minimum -90
  -> maximum 60
  -> unit celsius 1.0

rule needs_umbrella:
  no
  unless forecast is "rain"  then yes
  unless forecast is "storm" then yes
  unless forecast is "snow"  then yes

What it's for

Lemma is for rules that change. Loan eligibility criteria, pricing tiers, compliance checks, content moderation thresholds: any logic that non-engineers need to understand, audit, or modify without a deployment.

If your rules are buried in code, Lemma gives them a home. If your rules are in spreadsheets, Lemma gives them a structure. If your rules are in your head, Lemma forces you to write them down.

What comes next

The rest of this guide walks through installing Lemma, writing your first spec, and publishing it. Each section builds on the previous one. If you want to follow along interactively, install the CLI first. If you want to try it without installing anything, LemmaBase.com runs Lemma in your browser.