{"id":25861253,"url":"https://github.com/smucclaw/l4-ide","last_synced_at":"2026-04-11T02:28:58.793Z","repository":{"id":279349697,"uuid":"894353215","full_name":"smucclaw/l4-ide","owner":"smucclaw","description":"L4 - rules-as-code - is an open-source functional specification language for business rules, legal contracts, and legislation/regulation, with a CNL syntax for isomorphism.","archived":false,"fork":false,"pushed_at":"2026-01-31T07:09:09.000Z","size":62861,"stargazers_count":21,"open_issues_count":93,"forks_count":6,"subscribers_count":4,"default_branch":"main","last_synced_at":"2026-01-31T17:56:24.867Z","etag":null,"topics":["contracts","l4","legal","legislation","regulation","rules","rules-as-code"],"latest_commit_sha":null,"homepage":"https://legalese.com/l4","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/smucclaw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2024-11-26T07:57:58.000Z","updated_at":"2026-01-31T07:09:12.000Z","dependencies_parsed_at":"2025-06-04T16:36:51.212Z","dependency_job_id":"8af1ea01-f9f4-41de-92cb-4f4c475034c8","html_url":"https://github.com/smucclaw/l4-ide","commit_stats":null,"previous_names":["smucclaw/l4-ide"],"tags_count":37,"template":false,"template_full_name":null,"purl":"pkg:github/smucclaw/l4-ide","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smucclaw%2Fl4-ide","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smucclaw%2Fl4-ide/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smucclaw%2Fl4-ide/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smucclaw%2Fl4-ide/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smucclaw","download_url":"https://codeload.github.com/smucclaw/l4-ide/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smucclaw%2Fl4-ide/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29035531,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-03T02:28:16.591Z","status":"ssl_error","status_checked_at":"2026-02-03T02:27:48.904Z","response_time":96,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["contracts","l4","legal","legislation","regulation","rules","rules-as-code"],"created_at":"2025-03-01T23:33:08.533Z","updated_at":"2026-04-11T02:28:58.786Z","avatar_url":"https://github.com/smucclaw.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# L4 with IDE\n\n**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.\n\nThis 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.\n\n## What You Get From a Single L4 File\n\n- **REST APIs** — Expose functions as HTTP endpoints with `@export` annotations\n- **AI tool integration** — MCP server for Claude, Cursor, and VS Code Copilot; WebMCP for in-browser agents\n- **Interactive visualizations** — Ladder diagrams and evaluation traces rendered via GraphViz\n- **Audit-grade explainability** — Every evaluation produces a trace you can follow from the top-level question down to the deciding condition\n- **Test suites** — Golden-file tests and assertions\n- **Generated schemas** — OpenAPI 3.0 specs and JSON schemas for integration\n\n## Getting Started\n\n- **Install the VS Code extension:** [L4 Rules-as-code on the Marketplace](https://marketplace.visualstudio.com/items?itemName=Legalese.l4-vscode)\n- **Try the web editor:** \u003chttps://jl4.legalese.com/\u003e\n- **Learn L4:** [Foundation Course](doc/courses/foundation/README.md) — no prior programming experience required\n- **Full documentation:** [doc/README.md](doc/README.md)\n\n## Repository Layout\n\n**Haskell (Cabal):**\n\n| Package                                   | Purpose                                                  |\n| ----------------------------------------- | -------------------------------------------------------- |\n| [jl4-core](jl4-core/)                     | Core language (parser, typechecker, evaluator)           |\n| [jl4](jl4/)                               | CLI tool and JSON schema generator                       |\n| [jl4-lsp](jl4-lsp/)                       | Language Server Protocol for IDE support                 |\n| [jl4-repl](jl4-repl/)                     | Interactive REPL                                         |\n| [jl4-service](jl4-service/)               | REST API for decision evaluation                         |\n| [jl4-websessions](jl4-websessions/)       | Session persistence service                              |\n| [jl4-query-plan](jl4-query-plan/)         | Query planning utilities                                 |\n| [jl4-actus-analyzer](jl4-actus-analyzer/) | Static analyzer classifying L4 contracts by ACTUS / FIBO |\n| [jl4-wasm](jl4-wasm/)                     | WebAssembly build of L4 for browser/Node.js              |\n\n**TypeScript (npm workspaces + Turborepo):**\n\n| Package                             | Purpose                                    |\n| ----------------------------------- | ------------------------------------------ |\n| [ts-apps/vscode](ts-apps/vscode/)   | VS Code extension                          |\n| [ts-apps/jl4-web](ts-apps/jl4-web/) | Web-based editor (Svelte)                  |\n| [ts-shared](ts-shared/)             | Shared libraries (RPC client, visualizers) |\n\n**Documentation:** See [doc/](doc/) for the language reference, tutorials, courses, and concept guides.\n\n## Building From Source\n\n```bash\ncabal build all          # Haskell\nnpm ci \u0026\u0026 npm run build  # TypeScript\n```\n\nSee [AGENTS.md](AGENTS.md) for repository conventions and workflow, and [dev-start.sh](dev-start.sh) for running services locally.\n\n**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.\n\n## The REPL\n\nAn interactive Read-Eval-Print Loop for exploring L4 code:\n\n```bash\ncabal run jl4-repl -- path/to/file.l4\n```\n\nThe REPL provides live evaluation, module reloading (`:load`, `:reload`), query planning (`:decides`, `:queryplan`), and trace output (`:trace`, `:traceascii`, `:tracefile`). See [jl4-repl/README.md](jl4-repl/README.md) for the full command list.\n\n## VS Code Extension\n\nProvides 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](https://legalese.cloud) or a self-hosted `jl4-service` instance. See [ts-apps/vscode/README.md](ts-apps/vscode/README.md).\n\n## Trace Visualization\n\nEvery tool in this repo can render an L4 evaluation as a GraphViz diagram:\n\n- **CLI:** `jl4-cli --graphviz myfile.l4 \u003e trace.dot`, then `dot -Tsvg trace.dot \u003e trace.svg`\n- **REPL:** `:trace \u003cexpression\u003e`, or `:tracefile traces/session` to capture numbered `.dot` files\n- **Decision Service:** `POST /deployments/{id}/functions/{fn}/evaluation?trace=full\u0026graphviz=true`\n\nInstall GraphViz with `brew install graphviz` or `apt-get install graphviz` to render PNG/SVG outputs.\n\n## Application Libraries\n\nL4 ships with foundational libraries for building legal and commercial applications:\n\n- [Jurisdiction](jl4-core/libraries/jurisdiction.l4) — ISO 3166 country codes, US states, Canadian provinces, EU\n- [Currency](jl4-core/libraries/currency.l4) — ISO 4217 currency codes with integer minor-unit storage\n- [Legal Persons](jl4-core/libraries/legal-persons.l4) — individuals, corporations, partnerships, LLCs, trusts\n- [Holdings](jl4-core/libraries/holdings.l4) — ownership structures and beneficial ownership\n\n## Real-World Impact\n\nL4 has been piloted with organizations in both public and private sectors:\n\n- **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.\n- **Insurance policy analysis** — formalized contracts from major global providers, uncovering payout-formula ambiguities linked to significant claims leakage.\n- **Legislative drafting** — working with government drafting offices on rules-as-code initiatives.\n- **Commercial agreements** — transformed complex fee schedules and payment terms into L4, served via REST for enterprise integration.\n\n## Community\n\n- **[Discord](https://discord.gg/Q7a7NSEdNy)** — chat with the community\n- **[GitHub Issues](https://github.com/smucclaw/l4-ide/issues)** — report bugs, request features\n- **[Legalese](https://legalese.com)** — professional implementation services\n\nL4 is published under the [Apache-2.0 License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmucclaw%2Fl4-ide","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmucclaw%2Fl4-ide","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmucclaw%2Fl4-ide/lists"}