Session
The AI must not invent the law: stopping fabricated facts in an AI-built legal SaaS
Everyone worries about hallucinations in chat. The quieter version lives in the code your agent writes: a plausible default, a field name copied from a test fixture, a status the source never sent. In most apps that is a bug. In a legal SaaS, it is a missed deadline or an invoice with the wrong tax.
PS JUS is a practice-management SaaS for Brazilian law firms, built entirely with Claude Code by a small studio. It reads court publications, tracks deadlines and issues service invoices in a country with 5,570 municipalities, each with its own tax rules. Here are five places where agent-written code invented a fact, and the rule that now makes it impossible:
1. **Problem:** every case found in the court gazette was saved as "active", and the source never said so. **Solution:** store only what the source said; an empty value with a recorded origin means "we asked, and the source doesn't say".
2. **Problem:** the code read the field name the test fixture used, not the one the court API sends. The incremental sync silently stopped, and the suite stayed green because the fixture agreed with the bug. **Solution:** one owner per source field, fixtures that carry both spellings and must declare themselves fake.
3. **Problem:** a verifier read a proxy's 403 as "the court API is reachable". **Solution:** a 4xx doesn't prove the source answered; the verdict stays PENDING until a real call lands.
4. **Problem:** tax rates and municipal rules written from memory look exactly like facts. **Solution:** no numeric tax rate anywhere in the code (a scan fails the build), a missing rate is empty and never zero, the municipality list starts nearly empty, and an official layout only counts with a government source, date and hash.
5. **Problem:** "connected successfully" from something that never called anyone. **Solution:** simulated never becomes certified, and a receipt protocol is not an issued invoice.
The same rule applies to the AI feature inside the product, and the record shows why. Generative models invent citations to back up what they were about to say: fake precedents, fake statutes, fake quotes. Courts have sanctioned lawyers for filing them, from New York (Mata v. Avianca, 2023) to Wyoming (eight non-existent cases from a law firm's in-house AI, 2025) to Brazil, where a state court fined a lawyer 10% of the case value for ChatGPT-invented precedents and a federal court fined another 20 minimum wages for a made-up "procedural law of time" (both 2025). One tracker counts roughly 1,490 such court decisions worldwide. So the assistant in PS JUS never searches, never cites precedent and never argues a thesis. It reads one court publication it is given, explains in plain language what it says and what it requires, quotes deadlines exactly as written without calculating them, and receives only that text, never the client's records. Its answer comes in a fixed format, is born labeled "AI-generated, review", and only counts after a lawyer approves it, with the model, who generated it and who approved it on record.
The takeaway is a pattern for any domain whose facts come from outside, like law, tax, health or finance: your code may say "I don't know". It may never guess.
Please note that Sessionize is not responsible for the accuracy or validity of the data provided by speakers. If you suspect this profile to be fake or spam, please let us know.
Jump to top