cd /news/ai-products/an-ai-legal-assistant-that-refuses-t… · home › topics › ai-products › article
[ARTICLE · art-152989] src=dev.to ↗ pub= topic=ai-products verified=true sentiment=↑ positive

An AI legal assistant that refuses to cite law it can't verify

A team of developers built AILegal, a legal assistant that enforces a rule of never stating a legal fact it hasn't verified against an official source. The system stores each of its 53 norms as a structured record with a source URL, source hash and human-set verified flag, and a scheduled job re-fetches every official source every three days to detect changes. The team reported that a soft paraphrase classifier reached roughly 57% precision and is therefore restricted to asking clarifying questions rather than producing verdicts.

by read3 min views11 publishedOct 19, 2026

We built AILegal — a legal assistant for people who can't afford a lawyer — around a single rule: never state a legal fact we haven't verified against the official source. This post is about the engineering that makes the rule enforceable, and about what still doesn't work.

Early versions used the usual approach: a careful prompt, a corpus in the context window, "answer only from these sources". It failed in ways that are easy to miss if you don't check:

Neither answer looked wrong. That's the dangerous part: a plausible citation is worse than an obvious refusal.

Every norm in the corpus is a record, not a paragraph in a prompt:

Norm(
    id="us-cares-4024c",
    code="15 U.S.C. § 9058(c)",
    jurisdiction="us",
    summary="...",              # plain-language, human-reviewed
    source_url="https://...",   # official text
    source_hash="...",          # hash of the checked version
    checked_at="2026-10-18",
    verified=True,              # human review passed
)

The corpus currently has 53 norms: 11 Russian, 26 US, 9 UK, 7 Canadian.

A scheduled job runs every three days. It fetches every official source, requires that the numbers and terms from our summary actually appear in the fetched text, and stores a hash of the version it checked. If the hash changes, the norm is flagged for a human re-check.

verified is deliberately not set by the machine. The script proves "the text says what we claim"; a human decides "this norm is usable for a deadline". Those are different claims, and conflating them is how legal AI ends up inventing law.

At answer time the rule is boring on purpose: if a norm isn't verified, the assistant does not name deadlines or article numbers derived from it. It says what it can't confirm and asks for the missing fact.

We also measured a "soft" classifier that catches paraphrases by word-stem similarity. The exact stage resolved 12 of 31 test paraphrases; the soft stage added hints for 14 more, of which 8 were correct — roughly 57% precision. That is nowhere near enough to answer a legal question: every other hint would be about a different problem. So the soft stage only asks a clarifying question. It never produces a verdict.

Synonyms. "вычисли" vs "посчитай", "списали" vs "удержали" — different words, same meaning. Without a source of synonymy, similarity scoring can't tell them apart. We tried local embedding models (nomic-embed-text, qwen3-embedding) on a canonical paraphrase; the results were top-3/top-4 with cosine gaps of 0.001–0.03 — noise. The real fix is not a better model but a semantic representation of the norms themselves: everyday search phrasings, written and reviewed per norm. That's legal work, not a prompt tweak.

If you ask a legal assistant "what's the deadline?" and it answers confidently, you can't tell a verified answer from a hallucinated one. The gate makes the failure mode boring: "I can't confirm this from the official text." Boring is what you want when the cost of a wrong answer is a missed court deadline.

Try to break it: ailegal.legal — take any norm, compare it with the source it links to, and try to make the assistant state something the source doesn't.

Not legal advice. Legal content is RU/EN; the interface speaks more languages.

── more in #ai-products 4 stories · sorted by recency
── more on @ailegal 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/an-ai-legal-assistan…] indexed:0 read:3min 2026-10-19 · —