First-consultation intake agent for Leal Abogados
Outcome: The agent runs the first conversation, flags what's urgent and hands the lawyer a ready-to-use brief.
evidence: 30-case evaluation report (30/30 rule checks in simulation, 1 of 30 approved end to end with the real model) and 78 offline tests; the lawyer panel below runs on fictional data ⓘ
- Dismissal: October 3, 2026
- Pregnant: 4 months, employer informed
- Documents to bring: 3
- Time to brief: 48 s
For the owner
Business outcome
- Employment-law inquiries arrive on WhatsApp at all hours.
- Working demo on fictional data: 30 acceptance cases, 78 offline tests and a browser review. Pilot metrics defined. Pilot proposal under discussion with the firm.
- I know where AI helps and where to take it out. Hard rules don't depend on the model.
The short version
Employment-law inquiries reach Leal Abogados, a law firm in Bogotá, on WhatsApp at all hours. The agent runs the first conversation, asks for data-privacy consent before anything else, flags urgent cases with hard rules on top of the AI, and leaves the lawyer a brief: summary, key dates, documents to bring and pending questions. It is a working demo on fictional data. The pilot proposal is under discussion with the firm.
Context
The firm already had a chat on its website. It answered from the first second, never asked for consent, and if the person did not click through to WhatsApp, the conversation was lost: no brief, no alert, no count. The firm could not tell how many consultations arrived or how many were urgent.
The demo was built to show what a pilot would look like: the same first conversation, but with consent, hard rules, a guard on every answer and a panel for the lawyer.
The problem
- A dismissal during pregnancy and a question about overtime arrive in the same inbox and look the same.
- Someone at the firm reads the chat the next day, asks the basics again and only then decides if it is urgent.
- People type their ID number and bank account without being asked. That data should never reach an AI provider.
- A generic chatbot will happily calculate a severance payment or cite an article. A law firm cannot let that happen.
The approach
Consent first. The server rejects any message before the person accepts the data-privacy notice (Colombian Law 1581). Date, time and the version of the notice are stored with the brief.
Hard rules above the model. Pregnancy, medical leave, protected status, threats, a hearing in the next days or facts close to the three-year mark are always marked urgent, whatever the model says. The highest urgency wins. The alert reaches the lawyer’s panel before the conversation ends.
A guard on every answer. Before showing a reply, the guard checks for amounts and formulas, promises, legal deadlines, citations of articles, final advice, requests for ID numbers or files, and any wording that presents the assistant as a lawyer. If something slips through, it asks the model for another wording; if it persists, the sentence is removed.
Minimal data. ID, account and card numbers are masked before storing anything or sending it to the AI. The assistant never cites laws to the client; the brief adds verified references for the lawyer only.
What I built
- A client screen, styled like WhatsApp, that introduces the assistant as automated, asks for consent and then one question at a time.
- A lawyer panel with pilot indicators (briefs, urgent cases, complete briefs, time to brief) and each brief with summary, contact, urgency and why, pending questions, documents to bring, verified references and the full conversation.
- Hard rules for urgency and for out-of-scope topics (the agent only handles employment law and sends the rest to a human).
- Three pre-recorded guided cases so the demo runs without internet or an API key.
- A brief code at the end of every conversation, so the person can refer to it.
Evaluation
The 30 acceptance cases cover dismissals, unpaid wages, harassment, a workplace accident, a minor, a domestic worker, people who demand an exact amount or a legal deadline, an attempt to manipulate the assistant into acting as a lawyer, and two cases where the person types an ID and an account number.
| Check | Result |
|---|---|
| Urgency by hard rules | 30 of 30 |
| Escalation to a human without waiting for the end | 30 of 30 |
| Out-of-scope topics sent to a human, exactly once per session | 30 of 30 |
| Guard against amounts, promises, deadlines, citations, final advice, ID or file requests, posing as a lawyer | 30 of 30 |
| Masking of ID and account numbers in history, brief and stored file | 30 of 30 |
| No brief and no history without consent | 30 of 30 |
| Required brief fields | 30 of 30 |
| Fields that depend on the real model (key facts, documents, contract type) | 1 approved, 29 pending the real-AI run |
Plus 78 offline tests where the Claude SDK is replaced by a fake transport, and 23 browser checks in Edge on desktop and mobile. The evaluator uses an adversarial simulated engine that tries to give advice, amounts and file requests, so the guard has to stop them. What it does not test yet: semantic quality, which needs the real model and the lawyer’s review. The pilot only goes live if 27 of 30 cases pass, all urgent cases are escalated and there is zero prohibited answers.
What broke and how I found it
- A bank account that looked like a phone number was not masked. Case CP-29: ten digits, no bank words nearby. The masking rule treated it as a phone and let it through. Fixed: a number identified as an account is masked even when its length and prefix look like a mobile number; mobiles without bank context are kept.
- The out-of-scope card appeared more than once. When both the rules and the engine detected another legal area, the session showed two referral cards. Fixed in the conversation flow: one card per session, whatever the history says.
- The guard missed requests for audio and bank data. It caught requests for documents but not “send me the audio” or “give me your account”. Extended with new patterns and a regression test for each.
- The honest number is 1 of 30, not 30 of 30. The simulated run approves every rule check, but only one case (consent refused) is fully provable without the real model. I report it that way.
What I learned
- Rules first, model second. The parts that protect the firm do not depend on the model being right that day.
- An evaluator that cannot fail is useless. The regressions include deliberately altered expectations: if the guard or the masking is turned off, the evaluator must fail. It does.
- Say what is pending. 29 cases still need the real-AI run and the lawyer’s review of the 30 expected answers. That is written in the demo and in this page.
Same pain in your firm?
If first conversations eat your team’s time and urgent cases get mixed with the rest, let’s talk. I’ll show you the demo with fictional cases before quoting anything.
For the team that hires
Technical notes
- Architecture
- Python standard-library server with plain HTML and JavaScript, two screens (client chat and lawyer panel), running on 127.0.0.1; three pre-recorded guided cases work without internet.
- Data
- Briefs stored locally as files; ID, account and card numbers masked before storing or sending; consent logged with date, time and notice version; "Reset" wipes the demo data.
- Tests
- 78 offline tests (the Claude SDK replaced by a fake transport), 30 acceptance cases with an adversarial simulated engine, 23 browser checks in Edge on desktop and mobile.
- Where AI runs and its guards
- Claude (claude-opus-5-5, low effort, structured output) only drafts the conversation; hard rules decide urgency and scope; a guard checks every reply for amounts, promises, deadlines, citations, final advice, ID or file requests and posing as a lawyer, with retry and trim.
- Monthly running cost
- Estimated, not measured: USD 0.05 to 0.15 per full conversation at the published token rates; the pilot adds a spending cap.
- Repo and status
- Private repo. Working demo on fictional data. Pilot proposal under discussion with the firm; 29 of 30 cases pending the real-AI run and the lawyer's review.
Stack