-
-
The desk lists every open matter by the deadline that closes next. All the matters here are sample data.
-
Code reads the notice and counts deadlines, and Gemini Nano weighs the grounds in Chrome. A person approves every letter.
-
Rules read the notice with no model. The deadline is counted from the day it was served, with day one included.
-
Gemini Nano checks what the client said against all eight grounds, next to the firm's record with this council.
-
The real grounds panel on the demo page. The loading exemption won 2 of 3 times against Kingsmere.
-
Nano writes the body and code adds the letterhead and sign-off. The ledger shows nothing left the laptop.
-
On a laptop without Nano, names and references become placeholders before anything goes to the cloud.
Inspiration
High-street solicitors and advice agencies in the UK handle a steady stream of small disputes with councils, mostly parking tickets and council tax, plus the odd bin penalty. Each one is worth £50 to £300 in fees and runs to a strict 14- or 28-day deadline, and the arguments barely change from case to case. The firm already knows how to win them, because the answers are in its own past letters. They're worth fighting too. In 2025-26, councils didn't contest two in three of the appeals they lost at the Traffic Penalty Tribunal.
What stops firms using AI here is confidentiality, since a client's notice can't just be pasted into a chatbot. Hybrid inference fixes that. When the notice is read on the fee earner's own laptop, the cloud never has to see who the client is.
What it does
Matter Desk is a desk for those disputes. You paste a notice or drop in a PDF or a photo. A rules engine reads what it can and works out the statutory deadline in plain code, from the deemed date of service, counting England and Wales working days. Gemini fills in only the fields the rules missed, then rates each legal ground against what the client said, next to the firm's own record with that council.
The fee earner ticks the grounds and the model drafts the body of the letter. Code adds the letterhead and the right addressee for that stage, from the council up to the Traffic Enforcement Centre.
Approval is refused while the letter has gaps or no grounds. A privileged matter never uses a cloud model. Every model call goes into an append-only ledger that shows where it ran and the exact masked text that was sent. There's no chat box.
How we built it
The app is React 19 and TypeScript on Vite, hosted on Vercel. On the Firebase side it uses Authentication, Firestore with an offline cache, App Check and Remote Config.
Every model call goes through one module built on Firebase AI Logic (getAI, getGenerativeModel, initializeDeviceModel, generateContent, response.inferenceSource).
- Reading a notice uses
ONLY_ON_DEVICEwhen Gemini Nano is available, so raw text and photos stay on the computer. Without Nano it usesONLY_IN_CLOUDon a masked copy, and only when the firm's policy allows it and the addressee is known. Photos never go to the cloud. - Rating grounds and drafting use
PREFER_ON_DEVICEorPREFER_IN_CLOUDdepending on the firm's setting, andONLY_ON_DEVICEfor a privileged matter.
Structured output uses responseConstraint on the device and responseSchema in the cloud, and zod checks both. The deadlines and grounds, with their citations, live in a typed rules module. 209 unit tests cover date maths, the reader, masking, routing, the ledger and the approval rules.
Challenges we ran into
- Masking needs to know whom to mask. Until the client's name or address is known, a "masked" copy can still name them. So a matter stays on the device until the addressee is found.
- A model's guess must never beat a matched fact. The model is asked only for the fields the rules missed, into a schema built for that one request.
- Deadlines can't be approximate. Every window is counted in code from the deemed date of service. Bank holidays are skipped and the count always errs early, so the date shown is never later than the real one. No model is involved.
- Approving takes one keystroke, so it has to be able to say no. It refuses a letter with a gap or with no ground, and one whose grounds changed after it was drafted.
- The app has to work with no model at all. Without Gemini Nano and with the cloud off, the rules engine still reads the notice and builds the letter from the grounds the fee earner ticks.
Accomplishments that we're proud of
- Where inference runs is decided per task by a privacy rule, and anyone can check it in the ledger.
- The firm's own outcomes feed the product. Closing a matter updates the record shown on the next one against that council.
- A demo page plays one matter through all five steps and shows what leaves the computer at each one.
- Every main step has a keyboard shortcut, from N for a new matter to Ctrl+Enter to approve.
What we learned
Gemini Nano is the right place for raw, identifying text and short structured answers. The cloud model is better at longer drafting, and it only ever sees text that was masked first. Drawing that line early shaped the whole architecture.
What's next for Matter Desk
- A practising solicitor's review. We wrote the grounds and deadlines from the statutes ourselves, along with the letter wording, and none of us is a lawyer. Nothing goes in front of a real client until one has checked every rule.
- A pilot with one advice centre, to measure how many minutes a matter takes with and without the desk. We can't measure that on our own.
- More kinds of notice. The rules engine is a typed module, so adding private parking charges or bus lane penalties outside London means adding data. Benefit overpayment letters work the same way.
- More work on the device. Today Gemini Nano reads the notice and drafts the letter. Next we want it to check the finished letter against the facts before anyone approves it.
- A test set for the masking, built from notices designed to trip it up, so we can put a measured number on "no name leaves the computer".
- Firm accounts, so several fee earners share one precedent bank and the AI ledger can be exported for a compliance audit.
Built With
- chrome
- firebase
- firebase-ai-logic
- firebase-app-check
- firebase-authentication
- firebase-remote-config
- firestore
- gemini
- gemini-nano
- react
- typescript
- vercel
- vite
- vitest
- zod