Tutorials
Step-by-step guides for getting a task done with L4: from installing it and writing a first rule, to testing and publishing rules, to using them from AI agents and applications. Each guide stands on its own; for the exact meaning of a keyword, follow its links into the reference.
Start here
- Install L4 and write your first rule: set up VS Code or the web editor, write a rule and run it.
- Draft rules with Legalese AI: turn a policy or contract into checked L4 with the AI assistant in VS Code.
Write and check rules
- Test your rules: check outcomes with
#EVALand#ASSERT, and simulate obligations with#TRACE. - Fix errors: read a diagnostic, and fix the errors that come up most.
- Encode legislation: turn a statutory provision into a tested rule, alone or with an AI assistant.
- Make rules read like law: infix and mixfix names, and rules that render as readable documents.
- Common patterns: recipes for records, decisions, calculations, lists, dates and obligations.
Publish rules
- Deploy your rules: mark rules with
@export, deploy them to Legalese Cloud and call them.
Use deployed rules
- Choose an integration: compare the ways to use a deployment; addresses, API keys and permissions.
- Connect an AI agent: Claude, Codex, Cursor, VS Code and other MCP clients, with skills and plugins.
- Chat with your rules: ask a deployment questions from an OpenAI or Anthropic client.
- Call rules over REST: run rules from your own application, and generate a client from OpenAPI.
- Embed rules in a website: one script tag lets visitors' browser agents use your rules.
Advanced
- Using the l4 CLI: check, run, batch-evaluate, render and deploy rules from the command line.
- Manage rules in git and CI: commits, review, automatic checks and safe redeployment.