An on-device AI legal assistant for Indian citizens — ask about your rights by typing or speaking (English · Hindi · Hinglish) and get a clear, grounded answer with the exact law behind it.
Install → open once on WiFi to fetch the AI model → use it fully offline.
|
Every question, transcript & answer stays on the device. Network is used once — to download the model. |
Sub-second retrieval from a local law database; the AI runs on-device after setup. |
Every answer links to the exact bare-act text + the official PDF at the right page. |
🏠 README · 📐 Architecture · 🤝 Contributing · 📚 Knowledge · 🧠 Cognee
flowchart LR
A["🙋 'article 15 kya hain'<br/>'police slapped me'<br/>🎙 or typed"] --> B["Janadhikar"]
B --> C["📄 Clear answer<br/>quote → meaning → why it matters"]
B --> D["🔗 Exact law + official PDF"]
B --> E["🌐 English · Hindi · Hinglish"]
- Ask anything, any way — type or speak; English, Hindi, or Hinglish
(
article 15 kya hain→ answered in Hindi). - Rich, ChatGPT-style answers — the exact wording quoted, what it means in simple words, how it's interpreted, and why it matters — rendered as decorative Markdown (bold, blockquotes, highlights).
- Always shows the real law — a collapsible Sources card with the verbatim section, page, and a "📄 Read the official law" button that opens the government PDF in-app at the exact page.
- Smart routing —
article 21,section 302,fundamental rights,how many articles, orexplain this simplerare each handled the right way. - 📖 Constitution overview — dates, drafters (Dr. B. R. Ambedkar), the original-vs-today structure table, the three pillars, borrowed sources.
- 🕘 History, ✎ new chat, select-a-word → meaning, copy, and a model picker (Fast / Balanced / Gemma).
- Never fails open — if the model errors or times out, you still get the exact verified law, never a hallucination.
- Download
janadhikar-v1.0.0.apkand install it (allow install from unknown sources). - Open it once on WiFi — it downloads the ~350 MB AI model with a progress bar.
- Done — it now works fully offline. Type or tap the mic and ask.
First run needs internet + ~1 GB free storage. After that, no network is used. Requires Android 8.0+ (arm64). The APK is signed with the Janadhikar release key.
Verify the download (optional):
shasum -a 256 janadhikar-v1.0.0.apk→526b801b994b65ee788428ab220eb165151e6219c0fcc6ef3e37f3b9f084a82b
git clone --recurse-submodules git@github.com:FiscalMindset/JanAdhikar.git
cd JanAdhikar
./gradlew :app:assembleDebug # builds native (llama.cpp + whisper.cpp + sqlite-vec)
adb install app/build/outputs/apk/debug/app-debug.apk
# Optional: push models over USB instead of downloading in-app
HF_TOKEN=hf_xxx ./scripts/fetch_models.sh
./scripts/push_models.shA signed release build (
./gradlew :app:assembleRelease) needs akeystore.propertiesat the repo root (gitignored) — see the release notes.
| Model | Runtime | Download | Speed | Best for |
|---|---|---|---|---|
| Balanced — Qwen 2.5 1.5B (default) | llama.cpp (CPU, Q4_0) | auto, ~1 GB | Moderate | Best accuracy & Hindi, richest answers |
| ⚡ Fast — Qwen 2.5 0.5B | llama.cpp (CPU, Q4_0) | auto, ~350 MB | Quick | Speed on budget phones (lower accuracy) |
| Gemma 3 1B / 4B | MediaPipe (accelerated) | manual .task |
Fast | Devices without CPU dot-product |
The 1.5B is the default because it follows the retrieved bare-act text faithfully — the 0.5B is faster per token but drifts and can mix up provisions, which is unacceptable for legal answers. Speed comes from Q4_0 repacking + Flash Attention + ARM dot-product kernels (≈ 4× faster than a naïve build) plus live token streaming — the answer is written out word-by-word as it generates, so it feels responsive instead of a long silent wait. On CPUs without dot-product the app safely falls back to Gemma / verbatim.
| Area | Technology |
|---|---|
| UI | Kotlin · Jetpack Compose · Material 3 |
| LLM | llama.cpp (Qwen 2.5 GGUF) · MediaPipe GenAI (Gemma) — via JNI |
| Voice (STT) | whisper.cpp (small, multilingual) |
| Retrieval | SQLite + sqlite-vec (vector KNN) + FTS5 (keyword), fused in one native lib |
| Embedder | paraphrase-multilingual-MiniLM-L12-v2 → TFLite (LiteRT), pure-Kotlin SentencePiece |
| Knowledge | Offline Python pipeline over official India Code / Constitution PDFs |
See ARCHITECTURE.md for the full diagrams (startup, routing, retrieval, model selection, voice, native build, distribution).
5 statutes · ~1,742 provisions — the Constitution of India (466 articles),
Bharatiya Nyaya Sanhita, Bharatiya Nagarik Suraksha Sanhita, Bharatiya
Sakshya Adhiniyam, and the Motor Vehicles Act, 1988 — all with verbatim
English + Hindi text, page numbers, and official source links.
See knowledge_database.md.
- Your questions never leave the phone. The only network call is the one-time model download from Hugging Face.
- Grounded, not fabricated. Answers are built from the retrieved law; the exact verified text is always one tap away; if the model produces garbage, the app shows the raw law instead.
- Auditable. The manifest, the prompt builder (
PromptContract), and the output guard (OutputSanitizer) are small and reviewable.