A Claude Code plugin that provides comprehensive support for L4, the programming language for computational law. Write legal rules, contracts, and regulations as executable, type-checked, formally verifiable code.
- L4 Language Skill: Expert guidance for encoding legal logic in L4
- LSP Integration: Real-time code intelligence via cloud-based Language Server
- Syntax highlighting and validation
- Type checking and error diagnostics
- Code completion and navigation
- Cloud Validation: Validate L4 code against the production LSP server at
wss://jl4.legalese.com/lsp - Comprehensive Documentation: Syntax references, workflow guides, and examples
-
Add the Legalese marketplace:
/plugin marketplace add legalese/l4-ide -
Install the L4 plugin:
/plugin install l4-computational-law@legalese
- Download the latest
l4.skillfrom GitHub Releases - Extract to your Claude Code skills directory:
- Personal:
~/.claude/skills/l4/ - Project:
.claude/skills/l4/
- Personal:
Once installed, the L4 skill automatically activates when you:
- Mention L4, legal rules, contracts, or regulations
- Work with
.l4or.yamlfiles containing L4 code - Ask about computational law or formal legal specification
- "Help me encode this insurance policy in L4"
- "Write an L4 program for this contract clause"
- "Validate my L4 code for syntax errors"
- "Generate a web app from this L4 rule"
The L4 cloud services operate on a tiered access model:
- Cloud validation via LSP WebSocket
- Basic type checking and syntax validation
- Community support via GitHub issues
- Fair use limits apply
- Higher API rate limits for intensive validation
- Priority support
- Advanced features:
- Formal verification
- Test case generation
- Multi-file project analysis
- Commercial use license
Authentication and billing are handled transparently when connecting to cloud services. Contact hello@legalese.com for premium tier access.
- Syntax Quick Reference:
skill/references/syntax-quick-ref.md - Workflow Guide:
skill/references/workflow-guide.md - GitHub Resources:
skill/references/github-resources.md - Complete Skill Guide:
skill/SKILL.md
The plugin connects to the L4 Language Server at wss://jl4.legalese.com/lsp for:
- Real-time syntax validation
- Type checking
- Semantic analysis
- Code intelligence features
No local Haskell toolchain required! Validation runs entirely in the cloud.
For standalone validation outside Claude Code:
# Validate an L4 file via WebSocket
cd skill/scripts
npm install
node validate-cloud.mjs ../path/to/your/file.l4L4 is a statically-typed functional programming language inspired by Haskell, designed specifically for encoding legal and regulatory logic. It enables:
- Isomorphic formalization: Map legal text structure directly to code
- Type safety: Catch logical errors at compile time
- Formal verification: Prove properties about legal rules
- Executable specifications: Generate web apps and decision services from legal code
- Traceable reasoning: Audit-grade execution traces with citations back to source rules
DECLARE PolicyStatus IS ONE OF
Active
Suspended
Cancelled
DECIDE eligibleForClaim
GIVEN policy HAS status IS A PolicyStatus
IF policy's status IS Active
THEN True
ELSE False
DEFINE calculatePremium
GIVEN
driver HAS
age IS A NUMBER
yearsLicensed IS A NUMBER
accidentCount IS A NUMBER
RETURN A NUMBER
AS
LET baseRate IS 1000
LET ageFactor IS IF driver's age < 25 THEN 1.5 ELSE 1.0
LET experienceFactor IS IF driver's yearsLicensed < 3 THEN 1.3 ELSE 1.0
LET accidentPenalty IS driver's accidentCount * 200
baseRate * ageFactor * experienceFactor + accidentPenalty
- Documentation: https://github.com/legalese/l4-ide
- Issues: https://github.com/legalese/l4-ide/issues
- Email: hello@legalese.com
- Website: https://legalese.com
BSD-3-Clause
Developed by Legalese