Featured

Deploy OpenClaw in 60 seconds — 20% off logoDeploy OpenClaw in 60 seconds — 20% off

Launch OpenClaw on Hostinger in about 60 seconds and keep your agent live 24/7. Our referral link gives you 20% off, no coupon code needed.

Launch on Hostinger
Run your Hermes agent on Hostinger, fully managed logoRun your Hermes agent on Hostinger, fully managed

Launch Hermes on Hostinger in one click, fully managed, no VPS knowledge needed. Use code ZACAARON10 for 10% off.

Launch on Hostinger
Crawl and scrape any site into clean data, 10% off logoCrawl and scrape any site into clean data, 10% off

Firecrawl crawls and scrapes any site into clean markdown for your agent. Get 1,000 free credits, and new users get 10% off their first purchase.

Try Firecrawl free
Your own AI agent, running 24/7 with QwikClaw logoYour own AI agent, running 24/7 with QwikClaw

QwikClaw sets up and runs an always-on OpenClaw agent for you. One click, no config files, no server setup.

Deploy now
One API to scrape, enrich, and extract the internet. logoOne API to scrape, enrich, and extract the internet.

Context.dev gives your agents a single API to scrape, enrich, and extract live web data — no proxies, no parsers, no maintenance.

Start building free
SetupClaw: done-for-you OpenClaw for founders & exec teams logoSetupClaw: done-for-you OpenClaw for founders & exec teams

White-glove OpenClaw for founders and exec teams (4–50+ employees): we install, harden, integrate your tools, and maintain it — secured from day one.

Get it set up for you
SEO data APIs for your agent, $1 free credit logoSEO data APIs for your agent, $1 free credit

DataForSEO gives your agent live access to SERP results, keyword data, backlinks, and on-page SEO data through one API. New accounts get a $1 credit, good for up to 20,000 keyword or backlink lookups.

Try DataForSEO free
Reach 47,000+ AI builders

A flat monthly placement in front of developers actively installing AI tools. No lock-in, cancel anytime.

Advertise here
l4-computational-law logo

l4-computational-law

legalese

legal-techClaude Codeby Legalese

Summary

L4 programming language for computational law - encode contracts, regulations, and policies as executable, testable, verifiable programs

Install to Claude Code

/plugin install l4-computational-law@legalese

Run in Claude Code. Add the marketplace first with /plugin marketplace add smucclaw/l4-ide if you haven't already.

README.md

L4 with IDE

L4 is a domain-specific programming language for law. It formalizes legal rules and contracts as executable specifications, bringing software engineering rigor to legal drafting and analysis.

This repository contains the L4 compiler, IDE tooling (VS Code extension, LSP, REPL, web editor), and a decision service that exposes L4 rules as REST APIs and MCP tools.

What You Get From a Single L4 File

  • REST APIs — Expose functions as HTTP endpoints with @export annotations
  • AI tool integration — MCP server for Claude, Cursor, and VS Code Copilot; WebMCP for in-browser agents
  • Interactive visualizations — Ladder diagrams and evaluation traces rendered via GraphViz
  • Audit-grade explainability — Every evaluation produces a trace you can follow from the top-level question down to the deciding condition
  • Test suites — Golden-file tests and assertions
  • Generated schemas — OpenAPI 3.0 specs and JSON schemas for integration

Getting Started

Repository Layout

Haskell (Cabal):

| Package | Purpose | | ----------------------------------------- | -------------------------------------------------------- | | jl4-core | Core language (parser, typechecker, evaluator) | | jl4 | CLI tool and JSON schema generator | | jl4-lsp | Language Server Protocol for IDE support | | jl4-repl | Interactive REPL | | jl4-service | REST API for decision evaluation | | jl4-websessions | Session persistence service | | jl4-query-plan | Query planning utilities | | jl4-actus-analyzer | Static analyzer classifying L4 contracts by ACTUS / FIBO | | jl4-wasm | WebAssembly build of L4 for browser/Node.js | | jl4-mlir | MLIR/WASM compiler backend: L4 → .wasm decision binary |

TypeScript (npm workspaces + Turborepo):

| Package | Purpose | | ----------------------------------- | ------------------------------------------ | | ts-apps/vscode | VS Code extension | | ts-apps/jl4-web | Web-based editor (Svelte) | | ts-shared | Shared libraries (RPC client, visualizers) |

Documentation: See doc/ for the language reference, tutorials, courses, and concept guides.

Building From Source

cabal build all          # Haskell
npm ci && npm run build  # TypeScript

See AGENTS.md for repository conventions and workflow, and dev-start.sh for running services locally.

Requirements: GHC 9.10.2, Cabal 3.10+, Node.js ≥ 20, and GraphViz (dot). Nix users can run nix-shell nix/shell.nix for a ready environment.

The REPL

An interactive Read-Eval-Print Loop for exploring L4 code:

cabal run jl4-repl -- path/to/file.l4

The REPL provides live evaluation, module reloading (:load, :reload), query planning (:decides, :queryplan), and trace output (:trace, :traceascii, :tracefile). See jl4-repl/README.md for the full command list.

VS Code Extension

Provides syntax highlighting, type checking, inline evaluation, @export previews, deployment management, and an automatically-registered local MCP server that bridges Claude Code, Cursor, and VS Code Copilot to your L4 code. Connects to Legalese Cloud or a self-hosted jl4-service instance. See ts-apps/vscode/README.md.

Trace Visualization

Every tool in this repo can render an L4 evaluation as a GraphViz diagram:

  • CLI: l4 trace myfile.l4 > trace.dot, then dot -Tsvg trace.dot > trace.svg (or l4 trace myfile.l4 --format svg -o out/ to generate SVG files directly)
  • REPL: :trace <expression>, or :tracefile traces/session to capture numbered .dot files
  • Decision Service: POST /deployments/{id}/functions/{fn}/evaluation?trace=full&graphviz=true

Install GraphViz with brew install graphviz or apt-get install graphviz to render PNG/SVG outputs.

Application Libraries

L4 ships with foundational libraries for building legal and commercial applications:

  • Jurisdiction — ISO 3166 country codes, US states, Canadian provinces, EU
  • Currency — ISO 4217 currency codes with integer minor-unit storage
  • Legal Persons — individuals, corporations, partnerships, LLCs, trusts
  • Holdings — ownership structures and beneficial ownership

Real-World Impact

L4 has been piloted with organizations in both public and private sectors:

  • Government regulatory compliance — encoded secondary legislation to auto-generate citizen-facing web wizards; formal verification discovered a double-bind where contradictory clauses required and prohibited the same action.
  • Insurance policy analysis — formalized contracts from major global providers, uncovering payout-formula ambiguities linked to significant claims leakage.
  • Legislative drafting — working with government drafting offices on rules-as-code initiatives.
  • Commercial agreements — transformed complex fee schedules and payment terms into L4, served via REST for enterprise integration.

Community

L4 is published under the Apache-2.0 License.

Related plugins

Browse all →