Inspiration
A lawyer's case file is the most confidential document a person will ever hand over. Every AI tool that promises to "summarise this contract" quietly ships that file to a data centre in another country. For a small law office in Pristina that is not a technicality — it is the reason they cannot use AI at all.
Dosja starts from the opposite rule: the file does not leave the phone unless a human says so.
What it does
Dosja is an Android assistant for legal documents built on hybrid inference. Summaries, clause extraction and deadline detection run entirely on-device with Gemini Nano through ML Kit GenAI. When the on-device model declines — a long scan, a language it is unsure about — the request is queued and shown with an explicit "send to cloud" decision, and only then does Firebase AI Logic answer. Remote Config tunes the routing threshold per device class, App Check gates every cloud call, and Firestore keeps case metadata in sync so the same case opens on a second device without moving the documents themselves.
How we built it
Kotlin and Jetpack Compose, Firebase AI Logic for the cloud path, ML Kit GenAI Summarization for on-device inference, Remote Config for routing policy, App Check (debug token in development) and Firestore for metadata. The routing decision is a single function so the policy can be tested independently of the UI.
Challenges we ran into
On-device model availability is not uniform: the same app behaves differently on a flagship and on a three-year-old phone. Making the fallback honest — visible to the user, not silent — was harder than making it work.
What we learned
Hybrid inference is a product decision before it is an engineering one. The interesting question is not "can it run on-device" but "what may leave the device, and who decides".
What's next
Handle handwriting on scanned filings, and let an office share a routing policy instead of configuring each phone.
Built With
- android
- cloud-firestore
- firebase-ai-logic
- firebase-app-check
- gemini-nano
- jetpack-compose
- kotlin
- ml-kit-genai
- remote-config