Inspiration

In Kenya, and across the Global South, land fraud is an epidemic. Innocent buyers lose life savings to "Air Supply"—land that doesn't exist, is double-sold, or is owned by the government. The problem isn't a lack of data; it's that the data is fragmented across dusty registries, complex legal statutes, and the physical ground itself.

We asked: What if you had a Senior Forensic Auditor, a Constitutional Lawyer, and a Surveyor in your pocket, working 24/7?

TitleTrust is the answer. It is not just a database wrapper; it is an Autonomous Agent powered by Gemini 3 that "thinks," "sees," and "verifies" reality against the record.

What it does

TitleTrust replaces the expensive, opaque 30-day due diligence process with a 3-minute AI audit. It works through three specialized AI agents:

  1. The Digital Lawyer (Deep Thinking): It doesn't just read documents; it reasons through them. It checks if a Title Deed's "Grant Number" matches the historical timeline of the Land Act, spotting forgeries that look perfect to the naked eye.
  2. The Omniscient Surveyor (Multimodal Live Vision): Users stand on the land and stream video. The agent identifies boundary beacons, neighbor encroachments, and "Warning" signs in real-time, cross-referencing GPS data with satellite imagery to prove "Active Possession."
  3. The Forensic Auditor (Agentic Search): A background agent that tirelessly scours the "Kenya Gazette" and online legal notices for mention of the specific Title Number in previous fraud cases or "Lost Title" claims.

How we built it

We built a clean, cloud-native hybrid architecture to ensure reliability in low-bandwidth execution environments:

  • Frontend: Flutter (Dart) for a high-performance, cross-platform mobile experience that handles the device sensors (Camera, GPS).
  • Backend: FastAPI (Python) acting as the central neural orchestration layer.
  • Orchestration: Firebase for real-time state syncing between the AI agents and the mobile user. ### Visible "Thought Signatures" TitleTrust is not a black box. We implemented Visible Thought Signatures using Gemini 3. Every action taken by the backend is preceded by a structured reasoning step stored in Firestore. The agent self-reflects: if a government portal is down, it writes a log entry "Portal unresponsive, thinking... I will sleep for 30 mins and retry," proving autonomous resilience in the face of failure.

Serverless "Wake-Up" Mechanism

Unlike standard chatbots that die when the tab closes, TitleTrust utilizes a serverless Heartbeat via Cloud Tasks. The agent creates its own cron jobs dynamically based on the task difficulty. If an audit requires 24 hours, the agent schedules itself to wake up, check status, and notify the user via FCM, truly defining the Action Era of "Fire-and-Forget" applications. We didn't just use Gemini 3 as a chatbot; we leveraged its native cognitive architecture to solve problems that were previously impossible for AI:

1. "Deep Thinking" for Legal Reasoning

Legal due diligence is not about retrieval; it's about conflict resolution.

  • Challenge: A County Zoning map might say "Residential," but the National Land Act says "Riparian Reserve."
  • Gemini Solution: We use Gemini 3 Pro's "Thinking" mode (include_thoughts=True). It parses the hierarchy of laws, explicitly reasoning that "National Law overrides County Law," and flags the land as high-risk. Standard LLMs would just hallucinate a compromise; Gemini 3 judges.

2. Multimodal Live API for Zero-Trust Verification

Photos can be old. Metadata can be spoofed.

  • Challenge: Proving a user is physically present on the land right now.
  • Gemini Solution: We utilized the Gemini 3 Multimodal Live API. The user scans the environment, and the model verbally confirms, "I see the boundary beacon to your left, but it appears shifted compared to the satellite map." This low-latency, real-time visual reasoning is the game-changer for remote verification.

Challenges we ran into

Prompting "Abductive Reasoning": Getting an AI to think like a detective (looking for what is missing) was hard. We successfully engineered "Thinking" prompts that force the model to identify negative evidence (e.g., "The lack of a stamp on this page is suspicious").

  • Live API Latency: Streaming video from rural Kenya to the Gemini API required aggressive optimization of our WebSocket frame handling, but seeing the AI recognize a specific type of "Concrete Beacon" in real-time was a magic moment.

Accomplishments that we're proud of

Visible "Thought Signatures": We implemented a transparent AI reasoning engine. In backend/services/sync_service.py , every cognitive step taken by the agent is structured and written to Firestore ( update_session_state ). This allows the frontend (InvestigationScreen.dart) to render a "Matrix-style" live feed of the agent's internal monologue, demystifying the black box. Serverless "Heartbeat" Architecture: To ensure the agent can handle long-running audits without timing out, we built a custom self-healing mechanism in backend/services/cloud_tasks.py . The agent schedules its own wake-up calls using Google Cloud Tasks ( schedule_next_tick ). If the runtime environment kills the process, the Cloud Task triggers a resurrection at the exact checkpoint, ensuring 99.9% reliability for long-duration forensic tasks. Resilient Forensic Engine: We engineered a robust ForensicEngine (refactored for the hackathon) that implements sophisticated retry logic using tenacity and secure file handling. It features a custom sanitize_path security control to prevent directory traversal attacks during document analysis, proving that AI agents can be both powerful and secure. Hybrid State Management: We achieved seamless synchronization between a Python/FastAPI backend and a Flutter/Riverpod frontend. The JobTrackerWidget and InvestigationScreen in Flutter react in real-time to Firestore streams, creating an app experience that feels instantly responsive despite the heavy asynchronous processing happening in the cloud.

What we learned

The "Stateless" Trap: We initially relied on simple in-memory state for the agent, but quickly learned that serverless environments (like Cloud Run) are ephemeral. We had to refactor our entire architecture ( marathon_loop.py ) to persist the AgentState to Firestore after every action, effectively building a custom "save game" system for the AI. Handling Multimodal Chaos: integrating the Gemini Live API taught us that real-world data is messy. We had to implement robust type checking in Dart (InvestigationReportView.dart) to handle dynamic JSON responses from the AI, where a "finding" could arrive as a simple string or a complex nested object depending on the model's confidence level. Security First: Implementing the ForensicEngine taught us the dangers of aggressive AI. We learned that an agent given file system access will try to read everything. We had to implement strict sandboxing and path validation (SecurityUtils.sanitize_path) to ensure the agent only touched the files it was explicitly authorized to audit.

What's next for Title Trust

Video Processing Pipeline: We have placeholder logic in backend/agent/context_loader.py (# TODO: If video, wait for processing) to handle heavy video files asynchronously. The next step is to fully implement a queue-based video processor for the "Omniscient Surveyor" feature. Platform Specific Optimizations: Our build configuration ( CMakeLists.txt , build.gradle.kts ) contains TODOs for finalizing application IDs and signing configs. We plan to streamline the release pipeline for both Android and iOS stores. Enhanced "Thinking" Visualization: We want to expand the InvestigationScreen to visualize the branching nature of the agent's thoughts, showing parallel lines of reasoning rather than just a linear log. Offline-First Mode: While we use Firestore, we plan to implement fully offline capabilities (using path_provider and local database encryption) to allow surveyors to collect data in remote areas with zero connectivity and sync later.

Built With

Share this project:

Updates