# Grant Application
## OpenRights Assistant: Offline Legal Information for Everyone

---

## Executive Summary

OpenRights Assistant is an offline-first, open-source application that helps people understand their legal rights by searching official public law on their phone, with no internet connection, no account, and no server cost. It retrieves exact passages from government sources and shows where each answer comes from, so users can verify the information themselves.

The prototype is live, tested, and open: 10 official U.S. legal sources, 1,390+ indexed passages, 59 plain-language answers, 105 automated checks, a working mobile interface, and a clear path to multi-jurisdiction expansion.

---

## The Problem

Billions of people face legal situations every day: unpaid wages, workplace discrimination, debt collectors, unsafe conditions, deceptive advertising. The information they need is technically public, but:

- **Inaccessible**: legal text is dense, scattered across government websites, and assumes literacy in legal English.
- **Gated by connectivity**: most AI legal tools require constant internet and expensive API calls.
- **Gated by cost**: professional legal advice is expensive and inaccessible; even basic legal aid has months-long waitlists.
- **Gated by trust**: people in vulnerable situations (migrants, informal workers, minorities) avoid online tools that require accounts or may share data.

These barriers are highest in communities where connectivity is intermittent and professional legal advice is unaffordable.

---

## Our Solution

### How it works

1. **Install once** (lightweight retrieval archive under 5 MB; optional local LLM adds model weight).
2. **Turn off the internet.** The app works in airplane mode.
3. **Ask a question** in plain language: "Can my employer require overtime?" or "How do I stop a debt collector from calling?"
4. **Get cited passages** from official law, ranked by relevance, with source URLs for verification.
5. **Optionally**: a local 1.5B-parameter LLM summarizes the passages in simple language with numbered citations.

### What makes it different

| Feature | OpenRights | Typical legal AI |
| --- | --- | --- |
| Works offline | Yes, completely | No |
| Requires account | No | Yes |
| Shows exact source text | Always | Rarely |
| Runs on a budget phone | Yes (retrieval mode) | No |
| Open source | Fully (Apache 2.0) | No |
| Privacy | Zero network, zero telemetry | Data sent to servers |
| Cost per query | Zero | Recurring API fees |

---

## Technical Architecture

```
User question
    ||
    vv
[TF-IDF Retrieval] - searches 1,390+ passages from 10 official sources
    ||
    vv
[Ranked results with citations and source URLs]
    ||
    vv (optional)
[Local LLM via llama.cpp] - summarizes in plain language
    ||
    vv
[Answer with [1][2][3] citations]
```

**Key technical decisions:**
- Zero external dependencies (Python standard library only)
- TF-IDF over embeddings: deterministic, debuggable, runs in under 40ms on budget hardware
- Single JSON index file: no database, no vector store, fully portable
- PWA + Android WebView: one codebase for all mobile platforms
- Optional LLM: the app is useful without it; generation adds value for users who want summaries

---

## Current Status (Measured)

| Metric | Value |
| --- | --- |
| Official sources indexed | 8 |
| Passages in archive | 650+ |
| Evaluation questions | 32 |
| Retrieval accuracy | 100% (32/32) |
| Query latency | Under 40 ms average |
| Index memory footprint | Under 15 MB |
| Phone archive size | ~2.2 MB |
| Unit tests | 12 passing |
| CI pipeline | GitHub Actions (Python 3.10, 3.11, 3.12) |
| License | Apache 2.0 |
| External runtime dependencies | Zero |

---

## Sources Currently Indexed

1. Fair Labor Standards Act (wages, overtime, child labor)
2. Family and Medical Leave Act (FMLA)
3. Occupational Safety and Health Act (OSHA)
4. Fair Debt Collection Practices Act (FDCPA)
5. Civil Rights Act Title VII (employment discrimination)
6. Truth in Lending Act (TILA - consumer finance)
7. FTC: How to Recognize and Avoid Phishing Scams
8. FTC: Advertising and Marketing Basics

---

## Roadmap

### Phase 1: Foundation (COMPLETE)
- [x] Offline retrieval pipeline with 10 official sources
- [x] Mobile PWA with service worker caching
- [x] Android WebView packaging
- [x] 32-question evaluation set (100% pass rate)
- [x] Automated CI pipeline
- [x] Open source with Apache 2.0
- [x] Architecture and contribution documentation
- [x] Demo recording in airplane mode

### Phase 2: Local LLM Integration (post-funding)
- [ ] Benchmark Qwen2.5-1.5B and Phi-3-mini on budget Android devices
- [ ] Measure generation latency, RAM, and battery impact
- [ ] Add citation accuracy evaluation (generated answer vs. source passages)
- [ ] Optimize model loading time and memory footprint
- [ ] Publish reproducible on-device benchmarks

### Phase 3: India Pilot
- [ ] Add Indian labour law sources (new 2025 Labour Codes)
- [ ] Hindi interface option
- [ ] Partner with legal aid organization for user testing
- [ ] Publish first impact report

### Phase 4: Multi-Jurisdiction Expansion
- [ ] Add Brazil (CLT/CDC in Portuguese) and Nigeria (Labour Act in English)
- [ ] Multilingual tokenizer for Devanagari and other scripts
- [ ] Community contribution pipeline: anyone can submit a source + eval questions
- [ ] Reproducible benchmarks on multiple budget phones

---

## Alignment with Grant Criteria

Our system implements the spirit of offline, open-source AI for underserved populations: preserving and making accessible knowledge that would otherwise be locked behind connectivity, cost, or complexity barriers. Legal rights are knowledge that every person in a jurisdiction should be able to access in their own language, on their own device, without gatekeepers.

| Criterion | How we meet it |
| --- | --- |
| Offline-first | 100% offline after install |
| Open source | Full repo, Apache 2.0, open evals |
| Low-resource hardware | Measured latency under 40ms, archive under 2.5 MB |
| LLM integration | Optional local inference via llama.cpp (1.5B GGUF) |
| Real-world utility | Labor rights, consumer protection, discrimination law |
| Global scope | Multi-jurisdiction architecture; India pilot planned |
| Privacy | Zero telemetry, zero permissions, zero network |

---

## What Grant Funding Would Enable

- **Budget Android devices** for real-world testing on hardware our target users actually own (Redmi, Samsung A-series, Nokia budget line).
- **Developer time** to complete Phases 2-4: LLM optimization, India pilot, multi-jurisdiction expansion.
- **India pilot logistics**: legal text acquisition, Hindi translation verification, community outreach with legal aid organizations.
- **Sustained open-source maintenance**: keeping sources fresh, expanding the evaluation set, supporting community contributors.
- **User research**: working with legal aid clinics to validate that the tool actually helps people find the information they need.

The core architecture is already built and tested. Funding accelerates expansion and real-world validation, not initial development.

---

## Team

Solo developer with experience in full-stack development, mobile applications, and information retrieval systems. The project is designed for community contribution: adding a new jurisdiction requires only a source manifest and evaluation questions, not deep technical expertise.

---

## Risks and Mitigations

| Risk | Mitigation |
| --- | --- |
| Legal text changes | Versioned source manifest; freshness check in CI |
| Users treat output as legal advice | Prominent disclaimers; always show source text for verification |
| Model hallucination | Generation is optional; retrieval-only mode shows verbatim source |
| Low adoption | Start with community partners (legal aid orgs) not app stores |
| Tokenizer fails on non-Latin scripts | Character n-gram fallback planned for Phase 4 |

---

## Links

- **Repository**: https://github.com/Steel84/openrights-assistant
- **License**: Apache 2.0
- **CI**: GitHub Actions (Python 3.10, 3.11, 3.12)
- **Demo**: single offline HTML file generated by the build pipeline

---

*This project has no venture funding, no token, and no revenue model. It exists to make legal information accessible to people who need it most.*
