Inspiration
For many maize farmers, the most dangerous uncertainty begins after harvest. Grain may look acceptable while moisture, poor drying, damaged kernels, pests, or unsuitable storage conditions quietly increase the risk of spoilage and contamination.
This problem is especially relevant around Eldoret and Kenya's North Rift, where maize supports household income, food security, livestock feed, and local trade. A 212-farm study in the Rift Valley reported that only 17.8% of surveyed farmers practised proper maize drying and only 30.5% used hermetic bags.
Farmers often have to make high-stakes decisions with limited information:
- Is this batch safe to store or sell?
- Should it be separated from other grain?
- Is further drying required?
- Where can it be tested?
- How can its handling history be shared with a buyer?
We created MavunoGuard AI to turn that uncertainty into a clear and responsible next-action plan using a device farmers and cooperative teams already have: a mobile phone.
What it does
MavunoGuard AI is a mobile-first post-harvest decision-support system for maize farmers, cooperatives, extension teams, laboratories, and grain buyers.
A user uploads a photograph of a maize sample and provides practical field information such as:
- Measured moisture
- Storage method
- Number of days stored
- Recent weather
- Musty odour
- Visible mould
- Insect or kernel damage
- Whether the grain was bagged while damp
Gemini reviews the image for visible condition signals and returns structured observations. MavunoGuard then combines those observations with a deterministic risk engine that shows exactly why the score changed.
The application generates:
- An explainable post-harvest risk score
- A review of the visible and farmer-reported evidence
- A list of the factors that increased the score
- A prioritised action sequence
- English and Kiswahili guidance
- A certified-testing recommendation when required
- An illustrative grain-value protection scenario
- A printable and shareable batch passport
- An M-Pesa test-booking simulation
The batch passport helps a farmer or cooperative communicate what was observed, what actions were recommended, and whether certified testing is still required.
MavunoGuard does not claim that a phone photograph can detect aflatoxin. It is a pre-screening and decision-support tool. Suspect batches must be isolated and confirmed through an approved rapid test or laboratory.
How we built it
The frontend is a responsive Progressive Web App built with semantic HTML, CSS, and vanilla JavaScript. It works across desktop and mobile layouts and includes an installable application manifest and offline app-shell caching.
The backend uses a lightweight Node.js server with no runtime package dependencies. It exposes three primary endpoints:
GET /api/healthPOST /api/analyzePOST /api/payments/mpesa
The analysis endpoint validates the submitted information, processes the uploaded image in memory, and sends the evidence to the Gemini API.
We use a constrained JSON response schema and a safety-focused system prompt so Gemini returns predictable findings, confidence information, and recommended actions instead of unrestricted text.
The final risk score is not produced by the model alone. A deterministic scoring engine applies visible weights to moisture, storage conditions, weather, odour, damage, and other field observations. This makes the result easier to understand, explain, and validate.
Completed assessments are stored locally in the user's browser. Users can reopen previous batches, switch recommendations between English and Kiswahili, copy a passport, or print it as a PDF.
The M-Pesa flow is currently a safe simulator. It validates Kenyan phone numbers and demonstrates test booking without initiating a real financial transaction.
We also created a transparent guided-demo mode so the complete application can be demonstrated without an API key or network connection. The interface clearly distinguishes live Gemini analysis from deterministic fallback results.
Challenges we ran into
Our first major challenge was safety. A conventional crop-diagnosis application could easily overstate what a photograph can prove. Aflatoxin cannot be confirmed or ruled out by a normal phone image, so we redesigned the product around risk pre-screening, isolation, and certified testing.
The second challenge was explainability. A model-generated label such as “high risk” would not be sufficient for a farmer making a financial or food-safety decision. We solved this by combining Gemini's visible-condition review with a transparent rules engine and displaying every major score driver.
We also had to design for unreliable connectivity. The guided-demo fallback, locally stored batch passports, service worker, and dependency-free architecture allow the core workflow to remain demonstrable even when external services are unavailable.
Finally, we needed to present agricultural, health, financial, and technical information without overwhelming the user. We addressed this through progressive disclosure, colour-coded evidence, prioritised actions, and bilingual guidance.
Accomplishments that we're proud of
We are proud that MavunoGuard is a complete decision workflow rather than a standalone image classifier.
The application connects evidence capture, multimodal AI, explainable scoring, bilingual guidance, certified-testing referral, payment simulation, and traceable batch records in one coherent experience.
We are especially proud of:
- Building an end-to-end working application
- Establishing a clear safety boundary around aflatoxin
- Making every major risk driver visible
- Supporting English and Kiswahili actions
- Creating printable buyer-ready batch passports
- Providing a transparent offline-friendly demo mode
- Keeping uploaded images in memory rather than storing them
- Building the runtime without third-party npm dependencies
- Delivering responsive desktop and mobile experiences
What we learned
We learned that responsible agricultural AI should operate as a decision-support partner, not as an unquestionable authority.
A photograph becomes much more useful when combined with moisture, storage, weather, and farmer observations. At the same time, the system must clearly communicate uncertainty and know when to defer to certified testing.
We also learned that trust comes from showing why a recommendation was made. Exposing the score drivers and presenting actions in the correct sequence is more useful than providing a single unexplained prediction.
Finally, resilient fallbacks matter. A transparent deterministic mode is safer and more practical than allowing the application to fail silently or pretend that an AI service responded when it did not.
What's next for MavunoGuard AI
The next step is validation with cereal scientists, food-safety specialists, extension officers, laboratories, cooperatives, and farmers in the North Rift.
We plan to:
- Validate and calibrate the risk thresholds using field data
- Pilot the workflow with cooperatives and extension teams
- Build a directory of approved testing providers
- Integrate verified laboratory and rapid-test results
- Add production M-Pesa Daraja payments and reconciliation
- Introduce authenticated cooperative workspaces
- Add encrypted cloud storage and consent controls
- Build a fully offline assessment queue
- Measure reductions in avoidable grain loss and unsafe decisions
- Extend the validated workflow to wheat, sorghum, and animal feed
- Create APIs for warehouses, insurers, laboratories, and grain buyers
Our long-term goal is to create a trusted digital quality layer that helps farmers protect income, helps buyers verify handling history, and helps communities make safer food and feed decisions.
Log in or sign up for Devpost to join the conversation.