A government legal-AI service should be able to prove its own consistency. Now one can.
Today we released OxigenAI 0.1.0 — a Pure Rust reimplementation of the Japan Digital Agency’s government legal-AI system “源内 / GenAI”, rebuilt on the Legalis-RS computational-law framework and the OxiZ SMT solver.
No C. No C++. No Fortran. No opaque Python service you must trust on faith. OxigenAI keeps the original system’s law-report API surface but replaces “a probabilistic LLM that sounds confident” with a stack that can actually check what it says: it compiles to a single static oxigenai binary that serves both the HTTP API and a full set of CLI subcommands, and every legal-consistency claim it makes is backed by an SMT proof, not a vibe.
Why 0.1.0 matters
The Digital Agency’s GenAI is, at its core, a cloud-native LLM + RAG application: Vertex AI Gemini for generation, BigQuery vector search over the e-Gov statutory XML corpus, web grounding for law-name inference. It produces fluent legal reports — but a fluent report is not a verified one. When an LLM says “there is no contradiction between these provisions,” nothing in the pipeline has actually checked that claim. Discretionary judgment and deterministic rule-application blur together in the prose.
OxigenAI inherits the useful parts of that architecture and adds the missing layer — formal verification:
- It detects contradictions, formally. Selected statutory provisions are handed to OxiZ, an SMT solver, via
legalis-verifier. Logical contradictions between articles are found automatically (with complementary-provision patterns filtered out), and every generated report gains a “legal-consistency verification” section grounded in an actual SMT result rather than the model’s say-so. - It separates deterministic from discretionary outcomes. Legalis-RS’s
LegalResult<T>classification splits what the law determines from what it leaves to discretion, with a quality grade attached — so a reader can see exactly where the answer is rule-bound and where judgment enters. - It keeps full API compatibility. The
POST /law-report endpoint speaks the same request/response schema as the original system (inputs.input_textin,outputs+usageMetadataout), so it’s a drop-in for existing clients — it just returns more: a verification section the original never had. - It runs as one sovereign binary. Server and CLI are the same executable.
oxigenai servelaunches the HTTP API; the same binary answers ad-hoc queries, compiles statutes, runs simulations, and formalizes legal facts from the command line.
This is the debut — a 0.1.0 — and it’s deliberately a real, working MVP rather than a teaser: six report modes, four endpoints, and a policy simulator are all here on day one.
Technical Deep Dive: the pipeline
OxigenAI is an Axum + Tokio service whose request pipeline threads the LLM/RAG world through the Legalis-RS verification core:
- Law-name inference & retrieval. Gemini plus Google-Search grounding infers which statute the question is about; BigQuery vector search retrieves candidate articles from the e-Gov statutory XML corpus.
- Verification (
legalis-verifier+ OxiZ). The selected provisions are formalized and checked by the OxiZ SMT solver for logical contradictions. This is the step the original system simply does not have. - Outcome classification (
legalis-core). Results are wrapped inLegalResult<T>, separating deterministic application from discretionary judgment and grading the outcome. - Report generation (Gemini 2.5 Flash). A final, sourced legal report is produced — now carrying the verification section and the deterministic/discretionary breakdown.
Around that core sit the rest of the Legalis-RS crates that make OxigenAI more than a chatbot:
legalis-dslpowersPOST /compile(andoxigenai compile): it turns statutory XML — or a search query — into Legalis DSL, emitting per-articleSTATUTEdefinitions.legalis-simpowersPOST /simulate(andoxigenai simulate): an ECS-based policy simulator running over a Japan-2024-census population model (up to 100,000 agents), reporting per-article deterministic-application, discretionary, and contradiction rates.legalis-jpanchors the whole thing in the Japanese legal jurisdiction.POST /formalize(andoxigenai formalize) takes a plain legal fact plus a person’s attributes (age, employment type, years employed, …) and determines applicability.
The Legalis-RS framework (legalis-core, legalis-verifier, legalis-dsl, legalis-sim, legalis-jp, all at 0.1.5) and OxiZ are the foundation that turns the familiar GenAI API into genuine computational law.
Getting Started
cargo install oxigenai
The unified binary is both the server and the CLI. To run the HTTP API:
# query / compile / simulate / formalize need Google Cloud (Vertex AI + BigQuery)
gcloud auth application-default login
# launch the API (default port 8080)
PORT=8080 oxigenai serve
# health check
curl -s http://localhost:8080/health
# law report — same schema as the original GenAI system
curl -s -X POST http://localhost:8080/ \
-H 'Content-Type: application/json' \
-d '{"inputs":{"input_text":"What is the definition of personal information under the Act on the Protection of Personal Information?"}}'
Or use the CLI directly — the default subcommand is query:
oxigenai "Explain the overtime-hours cap under the Labor Standards Act"
oxigenai q "Subcontract Act payment-deadline rules?" # short alias
# compile a statute to Legalis DSL
oxigenai compile --query "Labor Standards Act" --dsl-only
# run a policy simulation
oxigenai simulate "Labor Standards Act application" --population 500
# formalize a legal fact and test applicability
oxigenai formalize "Right to convert to indefinite term after 5+ years fixed-term" \
--age 35 \
--attr employment_type=fixed_term \
--attr years_employed=6
What’s inside
- Axum REST API with full endpoint compatibility with the Digital Agency’s GenAI system.
- Six legal-report modes — definition, procedure, comparison, interpretation, policy research, and comprehensive analysis.
- OxiZ SMT contradiction detection — automatic logical-contradiction checking of statutory provisions (with complementary-pattern filtering).
LegalResult<T>classification — deterministic vs. discretionary outcome separation via Legalis-RS, with a quality grade.- BigQuery vector search over the e-Gov statutory XML corpus, plus web grounding via Google Search for law-name inference.
- Statute → Legalis DSL compiler —
POST /compileandoxigenai compile. - Policy simulation engine —
POST /simulate/oxigenai simulate, backed by a Japan-2024-census population model (up to 100,000 agents), with per-article deterministic/discretionary/contradiction statistics. - Legal-fact formalization —
POST /formalize/oxigenai formalizefor applicability determination. - Unified single binary serving the HTTP server and all CLI subcommands, with short aliases (
q,sim,eval) and a--jsonmode that mirrors the API schema. - Token-usage and cost tracking per request, and Vertex AI Gemini 2.5 Flash integration for generation and law-name inference.
This is the foundation
OxigenAI is what happens when a real piece of GovTech meets the COOLJAPAN computational-law stack. It builds directly on Legalis-RS — the statute parser/verifier/simulator framework — and on OxiZ, the Pure Rust SMT solver that does the contradiction detection. Where the original GenAI is a probabilistic LLM service, OxigenAI is a verifiable platform: same API, but every legal-consistency claim is backed by a proof.
Repository: https://github.com/cool-japan/oxigenai
Star the repo if you believe government legal AI should be able to prove what it claims.
Pure Rust computational law is here — fast, safe, and sovereign.
— KitaSan at COOLJAPAN OÜ May 7, 2026