SafeRata: AI-Powered Migration Safety & Scam Prevention Inspiration Every year, over 300,000 Sri Lankans seek foreign employment in the Middle East, Southeast Asia, and Europe, sending home billions in vital remittances. However, this lifeline is deeply vulnerable. Unregistered middlemen and predatory recruiters exploit job seekers through tourist-visa traps, fabricated agency credentials, and exorbitant upfront fees.

Recently, hundreds of Sri Lankan youth were lured into cyber-scam trafficking compounds in Myanmar, Cambodia, and Thailand under the guise of lucrative "IT customer service" jobs. Migrant workers frequently take high-interest loans to pay agency charges, only to arrive abroad stranded without contracts, legal visas, or recourse.

We asked ourselves: Why should vulnerable workers navigate complex cross-border employment decisions in the dark when AI and connected knowledge graphs can verify an offer in seconds? This inspired SafeRata—a civic AI platform built with the Jac programming language and Jaseci graph engine to give workers an unyielding digital shield before they pay recruiters or sign their lives away.

What It Does SafeRata provides a comprehensive verification and discovery ecosystem for overseas employment:

Autonomous Scam Investigation (walker:pub Investigate): Workers can paste suspicious WhatsApp messages, Facebook recruiting flyers, or contract drafts. A Lead ReAct Investigator orchestrates live verification tools, checks government records, and analyzes the text. Adversarial Tri-Agent Courtroom: Rather than relying on a single fallible prompt, SafeRata pits an AI Prosecutor (identifying worst-case exploitation patterns) against an AI Defense Advocate (validating genuine SLBFE agency registrations). An independent Presiding Judge synthesizes both sides to output a balanced Risk Score: $$\text{Risk Score} \in [0, 100], \quad \text{Band} = \begin{cases} \text{LOOKS SAFE} & \text{if } \text{Score} < 40 \ \text{BE CAREFUL} & \text{if } 40 \le \text{Score} < 70 \ \text{DANGER} & \text{if } \text{Score} \ge 70 \end{cases}$$ Deterministic Quote Critic (Anti-Hallucination): Every single red flag emitted by the LLM must match a verbatim substring from the input text ($S_{\text{evidence}} \subseteq S_{\text{input}}$). Any ungrounded hallucination or prompt injection is automatically purged. Active Clarification Loop (ask_user): When critical terms are missing (e.g. visa type), the agent does not guess—it pauses the workflow and interacts directly with the worker to gather facts before rendering judgment. Pre-Screened Civic Job Board: Aggregates legitimate openings from verified SLBFE agencies, calculating foreign salaries into monthly Sri Lankan Rupees (LKR) and computing realistic net take-home pay: $$\text{Take-Home}{\text{LKR}} = (\text{Salary}{\text{Foreign}} \times \text{Rate}) - \text{Deductions}{\text{LKR}} - \left(\frac{\text{Worker Fee}{\text{LKR}}}{\text{Contract Months}}\right)$$ 1-Click Side-by-Side Comparison: Workers can compare multiple job listings across contracts, food/accommodation provisions, and safety indices simultaneously. Cross-User Fraud Intelligence & Impersonation Defense: When scammers steal a licensed agency's name but substitute their own WhatsApp contact, SafeRata traverses the graph ($\text{Contact} \leftarrow \text{Offer} \leftarrow \text{Alert}$) to instantly warn all prior searchers. How We Built It SafeRata was architected and built almost entirely in Jac ($\ge 89%$ Jac code share), utilizing the native paradigms of the Jaseci ecosystem:

Jac Language & Walkers as APIs: We decoupled business logic from HTTP routing by writing native walker:pub endpoints (Investigate, PostJob, MatchJobs, AddReview, ListAgencies). ReAct Lead Supervisor: Constructed using Jac’s by llm(tools=[...]) capability, dynamically selecting between 6 specialized tools: lookup_licence, check_contacts, community_reports, country_guidance, salary_in_lkr, and ask_user. Multi-Model Fallback Pool (ModelPool): High-availability LLM resilience configured with Ollama Cloud gemma4:31b as the primary reasoning engine, falling back seamlessly to Google Gemini 2.5 Flash and local Ollama nodes. Persistent Knowledge Graph: Built on Jaseci’s rooted object graph (root ++> Offer, root ++> Job, root ++> Agency, root ++> Contact, root ++> Alert) backed by an embedded SQLite engine operating in Write-Ahead Logging (WAL) mode for concurrent graph traversals. Live SLBFE Government Integration: An intelligent scraper with robust fallback caches interfacing directly with the Sri Lanka Bureau of Foreign Employment (SLBFE) registry. Tailwind v4 & React UI in Jac: Full-stack client UI rendered using native Jac JSX components, ensuring rich typography, smooth transitions, and a built-in Agent Web visual orchestration canvas. Challenges We Faced Enforcing Pure Verbatim Evidence: Early LLM prompts frequently hallucinated dates or invented fees that were not present in the user’s raw WhatsApp text. We solved this by creating a deterministic Python/Jac critic (evidence_in_text) that enforces zero-tolerance: if the evidence quote isn't an exact character-for-character match in the source input, the flag is discarded. Preventing Slander & Impersonation Scams: Malicious actors often use legitimate agency licence numbers while providing fraudulent contact details. If our system blindly penalized the agency, honest recruiters would suffer from "review bombing." We resolved this by isolating the Agency node from unauthorized Contact nodes in the graph, issuing dynamic impersonator warnings without polluting the registered agency's safety score. Data Loss & Graph Durability: Managing persistent Jaseci graphs across rapid worker submissions required meticulous transaction handling. We configured SQLite WAL mode and verified multi-client concurrency without database lock contention. Preserving $\ge 80%$ Jac Share: Maintaining a modern, beautiful UI while keeping non-Jac code under $20%$ required us to port UI components directly into native Jac JSX rather than relying on bloated external JavaScript frameworks. What We Learned Graph-Native AI Outperforms Stateless Prompts: Structuring data as persistent nodes and edges enables memory across unrelated users. A scam number spotted in one city instantly protects a worker querying the same number on the other side of the island. Adversarial Debates Prevent False Positives: Having a Prosecutor and a Defense advocate debate an offer before the Presiding Judge provides balanced, nuanced scoring that builds user trust far better than a simple binary classifier. Jac's Conciseness: Expressing complex autonomous workflows, typing schemas with sem, and graph-walking walkers in Jac eliminated thousands of lines of boilerplate that would have been required in traditional Python/FastAPI stacks. What's Next for SafeRata Multilingual Voice & Sinhala/Tamil Audio Support: Adding native voice-in/voice-out capabilities so low-literacy rural workers can speak their contract details over WhatsApp or phone hotlines. SLBFE API Partnership: Moving from register scraping to a certified, bilateral webhook integration with the Sri Lankan Ministry of Foreign Employment. Cross-Border Escrow & Digital Contracts: Expanding into cryptographic contract signing and regulated fee escrows to eliminate cash-based extortion entirely.

Built With

Share this project:

Updates

Submission history