Inspiration - Pakistan's social safety net distributes billions of rupees every year through BISP, Ehsaas, Sehat Sahulat, and dozens of related programmes. Yet millions of eligible citizens never receive what they're entitled to — not because they don't qualify, but because they don't know where to start. The system is fragmented across departments, written in bureaucratic language, and nearly impossible to navigate without a case worker.We thought about a widow in Rawalpindi supporting five children on no income. She's heard of BISP but doesn't know if she qualifies, what documents to bring, or which office to visit. She has a CNIC, 20 minutes, and a phone — but no guide. Rahnuma was built to be that guide.

What it does - Rahnuma is a bilingual AI-powered benefits navigation portal that helps Pakistani citizens discover and access government welfare programmes they may qualify for.A citizen signs in with their CNIC, fills a short profile covering province, income, family size, and special circumstances, then converses with an AI assistant in English, Urdu, or mixed Pakistani conversational language. The assistant — trained on the exact rules, income thresholds, and documentation requirements of 8+ major programmes — gives personalised, programme-specific guidance the way a knowledgeable case worker would.The portal also includes a client-side eligibility pre-screener that runs instant match estimates across all programmes simultaneously, an application status tracker, and a directory of 27 real BISP, Ehsaas, and Sehat Sahulat offices across all provinces — auto-filtered to the user's saved location.

How we built it - Frontend: Six interconnected HTML pages sharing a single CSS design system and a shared.js file that acts as the single source of truth for programme data, eligibility logic, application records, and user profile helpers. All citizen data is stored in browser localStorage — nothing personal ever hits a server.Backend: A Flask server hosted on Railway handles a single /chat route that receives the user's conversation history, prepends a 1,200-word expert system prompt encoding Pakistan's welfare rules, and forwards the request to the Groq API.AI: LLaMA 3.3 70B via Groq powers the chatbot with temperature set to 0.2 for factual consistency. The system prompt enforces a staged intake protocol — gather missing profile details first, then recommend programmes — and hard-codes guardrails including probabilistic language, a mandatory disclaimer, and a strict topic boundary.Eligibility engine: A parallel client-side JavaScript engine runs deterministic check() methods against the user's saved profile for all 8 programmes simultaneously, giving instant sidebar estimates before the AI even responds.

Challenges we ran into - Getting the AI to know its limits. The hardest part wasn't making the AI helpful — it was making it appropriately cautious. A welfare chatbot that confidently tells someone they qualify, when actual eligibility requires a formal NSER survey and document verification, causes real harm. Engineering the system prompt so the model consistently uses probabilistic language, never skips the verification disclaimer, and resists prompt injections took significant iteration.

Bilingual consistency. The AI needed to detect whether a user was writing in English, Urdu, or mixed language and respond in kind — naturally, not robotically. Getting this right without making it feel forced required careful prompt design and testing across different input styles. Cross-page data coherence. With six HTML pages sharing a single localStorage schema, inconsistencies crept in — mismatched application counts in nav badges, two different profile completion formulas producing different percentages on different pages, a sign-out function that cleared the login flag but left sensitive profile data behind. Consolidating all shared logic into one shared.js file resolved this but required a full audit of every page. Islamabad province matching. The user profile saves the province as 'ICT' but the offices page was matching province tabs by visible label text ("Islamabad"), causing the auto-filter to silently fail for users who selected Islamabad during login. A small bug with a disproportionate impact on the capital's users.

Accomplishments that we're proud of - The profile-to-AI handoff. The moment a user lands on the Eligibility Check page, their entire saved profile is automatically injected into the first message sent to the AI — so the conversation starts from context, not from zero. No user has to repeat their income or family size. That seamless handoff between the static profile form and the live AI chat is the feature we're proudest of.

A real, deployed system. Rahnuma isn't a mockup or a prototype — it's a fully deployed, publicly accessible web application at https://rahnuma-production.up.railway.app with a live AI backend, real office directory data, and a coherent multi-page user experience. Responsible AI that's actually enforced. Our guardrails aren't UI disclaimers slapped on afterward — they're structural. The probabilistic language rule, the mandatory verification disclaimer, and the topic boundary are all encoded into the system prompt and enforced on every response, not just occasionally. Urdu-first design in a welfare context. Building a portal where a user can ask "BISP ke liye kya documents chahiye?" and receive a natural, structured response in Urdu — with correct programme names, benefit amounts, and next steps — felt meaningful. The target audience deserves a tool that speaks their language.

What we learned - System prompts are product design. The quality of the AI's output was almost entirely determined by how carefully the system prompt was structured — the staged intake protocol, the bolding rules, the length caps, the topic guardrail. Investing time in prompt engineering produced bigger improvements than any model change.

localStorage as a privacy-first architecture. Keeping all citizen data in the browser rather than a server database wasn't just a technical shortcut — it turned out to be the right design choice. Citizens sharing sensitive income and CNIC data deserve to know exactly where it lives. "In your browser only" is a cleaner, more trustworthy answer than any privacy policy. The difference between navigational AI and decision AI. We came in thinking the AI's job was to tell users whether they qualify. We left understanding that its real job is to tell users what to bring, where to go, and what to expect — and to hand the eligibility determination back to the human government officer who has the verified data to make it. That reframe shaped every design decision.

What's next for Rahnuma — Benefits Navigator

SMS / WhatsApp interface. The majority of Pakistan's low-income population accesses the internet via mobile data, not broadband. A WhatsApp or SMS integration using the same Groq backend would remove the browser dependency entirely and reach users where they already are. Real NSER status lookup. With official API access from BISP, Rahnuma could tell users whether they're already registered in the National Socioeconomic Registry — the single most common eligibility blocker — directly from the chat interface. Provincial programme expansion. Rahnuma currently covers national programmes. Each province has its own schemes — Punjab Ration Card, Sindh People's Support Programme, KPK Ehsas Imdad — that could be added to the programme knowledge base with province-aware routing. Application submission assistance. Rather than linking out to government portals, Rahnuma could walk users through filling out actual application forms step by step, checking that every required field is completed and every document is accounted for before they make the trip to the office. Offline mode. For users in low-connectivity areas, a Progressive Web App with cached programme data and offline eligibility checking (using the existing client-side engine) would make Rahnuma accessible even without a live internet connection.

Built With

Share this project:

Updates