-
-
Native Swahili Mode (Shows the entire UI, including the welcome message and suggestion chips, translated into Swahili.)
-
Strict Scope Enforcement (Shows the "Refusal Protocol" where the AI declines to answer irrelevant questions like the President of Russia.)
-
AI Safety Guardrails (Demonstrates the app detecting a crisis situation and redirecting to human help instead of just chatting.)
-
Home Page & Country Context
-
Localized Legal Guidance (Shows the AI giving detailed, legally accurate advice in fluent Swahili regarding tenant rights.)
Inspiration
In East Africa, legal services are often expensive, complex, and intimidating for the average citizen ("Wanjiku"). Compounding this issue are literacy barriers and language gaps—while the law is written in English, many people are most comfortable speaking Swahili. We wanted to build a bridge: a tool that doesn't just "chat," but actually sees, listens, and speaks the language of the people to make justice accessible to everyone.
What it does
Sheria Sense EA is a multimodal AI legal assistant tailored for Kenya, Uganda, and Tanzania. It goes beyond simple text responses: Hyper-Localization: It strictly adheres to the specific constitution and laws of the selected country, refusing to answer irrelevant international queries (e.g., US politics). Native Swahili Support: With a single toggle, the entire interface and AI persona switch to fluent Swahili, making it accessible to millions. Voice-First Accessibility: Users can speak their legal problems and listen to the advice, crucial for those with lower literacy. Document Analysis: Users can upload photos of court orders, contracts, or business forms (like CR12), and the AI extracts key details and risks instantly. Safety Guardrails: It detects emergencies (violence, self-harm) and redirects users to human authorities instead of generating text.
How we built it
I built the frontend with Angular for a fast, responsive experience that feels like a native app. The Brain: I used the Google Gemini API (gemini-3-pro-preview) for its superior context window and multimodal capabilities, allowing us to process uploaded images and complex legal queries simultaneously. The Voice: I integrated the native Web Speech API for real-time speech-to-text and text-to-speech, ensuring no expensive external audio APIs were needed. The Guardrails: I implemented a strict system prompting to "jailbreak-proof" the bot against non-East African topics. Hosting: The app is deployed on Firebase Hosting for global availability and speed.
Challenges we ran into
Hallucinations: Early versions would happily answer questions about US law. We had to rigorously tune the system prompts to create a "refusal protocol" that politely declines non-East African queries. Multimodal State Management: Handling the flow between a user uploading a file, switching languages, and then asking a voice question required complex state management in Angular to ensure the AI didn't lose context.
Accomplishments that we're proud of
We are most proud of the Swahili Mode. Seeing the AI not just translate text, but adapt its tone to be empathetic and culturally relevant in Swahili was a huge win. We are also proud of the Document Analysis feature—taking a complex legal PDF and summarizing it in seconds feels like magic.
What we learned
Context is King: We learned that a powerful AI model isn’t enough; it needs strict boundaries. Without our "East Africa Only" guardrails, the AI was just a generic chatbot. Limiting its scope actually made it more powerful and trustworthy for our users. Accessibility is Not Optional: In tech, we often build for people like us—people who read English and type fast. Building for Wanjiku taught us that features like Voice and Swahili aren't just "nice-to-haves"—they are the difference between a tool that works and a tool that is useless to the people who need it most. The Power of Empathy in Code: We discovered that technical problems (like handling state management) often have human solutions. Solving the "hallucination" problem wasn't just about code; it was about understanding that giving bad legal advice can have real-world consequences, which drove us to build safer, stricter systems.
What's next for Sheria Sense EA
WhatsApp Integration: Moving the chat interface to WhatsApp to meet users where they already are. Lawyer Directory: Connecting users with verified human advocates for complex cases. More Dialects: Adding support for Sheng (Kenyan slang) and Luganda.
Built With
- ai
- angular.js
- firebase
- google-gemini
- scss
- typescript
- web-speech-api
Log in or sign up for Devpost to join the conversation.