COOLJAPAN
← All posts

Legalis-RS 0.1.4 Released — One Engine, 23 Jurisdictions: Proof That Law Is Universal Computation

Pure-Rust legal statute engine. 0.1.4 adds 5 new jurisdictions (Korea, Mexico, Malaysia, Russia, Saudi Arabia) for 23 total, 6 production examples proving one generic engine handles Civil/Common/Supranational law, real-time self-healing verification on the OxiZ SMT solver, and auto-generated TypeScript/Python SDKs. 14,705 tests passing.

release legalis legal-tech legal-dx rust smt compliance govtech

A statute is just a function. We proved it — across four legal traditions, three languages, and one engine.

Today we released Legalis-RS 0.1.4 — the release where the legal computation engine stops being “a Japanese legaltech library” and becomes a universal one: 5 new jurisdictions (South Korea, Mexico, Malaysia, Russia, Saudi Arabia) bring the total to 23, alongside 6 production examples that prove a single generic engine handles Civil Law, Common Law, and Supranational law without special-casing any of them.

No C. No Fortran. No Z3 binary to install. No country-by-country rewrite, no bespoke SIer system per ministry, no waiting weeks for a manual legal review pass to confirm what a machine could have checked in milliseconds. Legalis-RS compiles to a single static binary — or to WASM for the browser — and carries 23 jurisdictions, an SMT verifier, and an LLM firewall inside it. This is Governance as Code, Justice as Narrative: the automatable parts of law become executable artifacts, and the parts that demand human judgment stay visibly, deliberately human.

Why Legalis-RS 0.1.4 is a game changer

The incumbent model of legaltech is structurally broken. Every jurisdiction is a separate codebase. Every amendment is a manual diff someone reads by hand. Every cross-border data question routes through a slow, expensive legal review that produces a PDF, not an artifact you can test. When a regulator updates a threshold, downstream systems learn about it in a meeting three weeks later.

Legalis-RS 0.1.4 attacks that head-on:

Technical Deep Dive: the four layers

Core Layer — legalis-core. The keystone is LegalResult<T>, which refuses to pretend everything is computable. A result is one of three things: Deterministic(T) for the genuinely automatable (age >= 18, income < threshold), JudicialDiscretion { .. } for what must stay human (just cause, public welfare, proportionality), or Void { reason } for logical contradictions. On top of Statute / Condition / Effect, 0.1.4 adds two ambitious modules: Quantum-Ready Legal Logic (quantum-circuit generation for legal decision problems — Hadamard / Pauli / CNOT / Toffoli gates, quantum-inspired optimization via annealing and QAOA, export to Qiskit / Cirq / Q#) and Autonomous Legal Agents (negotiation agents with Cooperative / Competitive / Mixed strategies, multi-agent systems, a legal chatbot framework, and self-improving reasoning via reinforcement learning).

Intelligence Layer — legalis-llm + legalis-verifier. legalis-llm gained Advanced Prompt Engineering (Chain-of-Thought, few-shot prompting, self-consistency voting), Performance Optimizations (request batching, response caching with TTL, streaming, token tracking), and Security & Privacy (PII detection/redaction, secure API-key management, output filtering, differential privacy). legalis-verifier gained Real-Time Verification (<10ms target latency, an event-driven update queue, automatic conflict detection), Self-Healing Systems (auto conflict-resolution suggestions — Harmonize / Repeal / Clarify / Prioritize / CreateException — each confidence-scored against a 0.6 threshold), and Cross-Domain Verification (multi-jurisdiction conflict detection, cross-border data-transfer validation). The verifier runs on OxiZ, a Pure Rust SMT solver — so formal verification needs no external library and no environment setup.

Knowledge & Output — legalis-registry + legalis-chain. legalis-registry adds a Legal Knowledge Base: ontology-based knowledge representation, semantic reasoning, knowledge-graph construction, and a SPARQL-like query interface. legalis-chain received comprehensive enhancements for multi-blockchain smart-contract generation with gas optimization, so a verified statute can be exported as on-chain logic.

API / SDK Layer — legalis-api. A new SDK Generation Framework introspects the Rust types and auto-generates fully typed TypeScript and Python SDKs (Python with asyncio). Define a statute once in Rust; ship clients to your web and data teams without hand-writing a line of glue.

Across all four layers, the Deterministic vs JudicialDiscretion split is the architectural keystone: it is what keeps Legalis-RS from becoming an “AI theocracy” that quietly automates judgments that belong to a human.

Getting Started

Add the core crate:

cargo add legalis-core

Build a statute programmatically:

use legalis_core::{Statute, Condition, Effect, EffectType, ComparisonOp};

// Build a statute programmatically: "voting rights at 18"
let statute = Statute::new(
    "voting-rights",
    "Voting Rights Act",
    Effect::new(EffectType::Grant, "Right to vote in elections"),
)
.with_precondition(Condition::Age {
    operator: ComparisonOp::GreaterOrEqual,
    value: 18,
});

Prefer to author statutes as law-like text? The DSL parser produces the same structures:

use legalis_dsl::LegalDslParser;

let parser = LegalDslParser::new();
let statute = parser.parse_statute(r#"
    STATUTE adult-rights: "Adult Rights Act" {
        WHEN AGE >= 18
        THEN GRANT "Full legal capacity"
    }
"#)?;

And when you want to see how a statute lands across a population, run a simulation:

use legalis_sim::{SimEngine, PopulationBuilder};

let population = PopulationBuilder::new()
    .generate_random(1000)
    .build();

let mut engine = SimEngine::new(vec![statute], population);
let metrics = engine.run_simulation().await?;

println!("{}", metrics.summary());

What’s New in 0.1.4

This release ships 14,705 tests passing (up from 13,083 in 0.1.3), across 46 workspace crates (17 core + 23 jurisdictions + 6 examples), with 92 property-based tests, 42 Criterion benchmark groups, and 343 doc tests. MSRV is Rust 1.86, Edition 2024, licensed Apache-2.0 (dual MIT OR Apache-2.0). Pure Rust throughout; the few optional C dependencies are feature-gated and off by default.

Tips

This is the foundation

Legalis-RS does not stand alone. Its formal verification rides on OxiZ, the Pure Rust SMT solver that replaces Z3 — which is why cargo build --features smt-solver needs nothing from the host system. Its Japanese-text anonymization (judgment-anonymization) uses MeCrab, the Pure Rust MeCab replacement, for the morphological NER that pushes accuracy to 95%. Both are COOLJAPAN siblings, both are Pure Rust, and both ship today — so the whole stack stays sovereign from statute text to verified result.

Repository: https://github.com/cool-japan/legalis

Star the repo if you believe legal infrastructure should be open, testable, and free of the bespoke per-country rewrite — and if you believe that not everything in law should be computable.

Pure Rust legal DX is here — fast, safe, and sovereign.

KitaSan at COOLJAPAN OÜ January 29, 2026

↑ Back to all posts