DEV Community

Cover image for I Built an AI Security Coach for People Who Can't Afford to Get Hacked
Linford
Linford

Posted on

I Built an AI Security Coach for People Who Can't Afford to Get Hacked

CyberBuddy is a gamified Android app that guides everyday users through personal cybersecurity using a Gemini A2A agent. Here's the full build story.

CyberBuddy
š—œ š—Æš˜‚š—¶š—¹š˜ š˜š—µš—¶š˜€ š—Æš—²š—°š—®š˜‚š˜€š—² š˜€š—¼š—ŗš—²š—¼š—»š—² š—®š˜€š—øš—²š—± š—ŗš—² š—® š—¾š˜‚š—²š˜€š˜š—¶š—¼š—» š—œ š—°š—¼š˜‚š—¹š—±š—»'š˜ š—®š—»š˜€š˜„š—²š—æ š—¶š—» š—® š—Ŗš—µš—®š˜š˜€š—”š—½š—½ š—ŗš—²š˜€š˜€š—®š—“š—².

"How do I know if I am safe online?"

She was a student I mentor through Linfy Academy in Strand, Cape Town. Smart. Motivated. Using the same password for her email, her banking app, and her school portal.

There was no simple answer. So I built one.


š—Ŗš—µš—®š˜ š—¶š˜€ š—–š˜†š—Æš—²š—æš—•š˜‚š—±š—±š˜†?

CyberBuddy is an Android app that acts as a personal cybersecurity coach.

It guides users through building their own š—£š—²š—æš˜€š—¼š—»š—®š—¹ š—¦š—²š—°š˜‚š—æš—¶š˜š˜† š—£š—¹š—®š—» (PSP) - covering password health, device security, and two-factor authentication. It tracks daily security habits through streaks and badges. And it monitors whether your email has appeared in known data breaches.

The AI coaching layer is powered by š—šš—²š—ŗš—¶š—»š—¶ via an š—”šŸ®š—” (š—”š—“š—²š—»š˜-š˜š—¼-š—”š—“š—²š—»š˜) š—®š—æš—°š—µš—¶š˜š—²š—°š˜š˜‚š—æš—². More on that below.


š—Ŗš—µš—¼ š—œš˜'š˜€ š—™š—¼š—æ

Most cybersecurity tools are built for enterprises with IT departments and budgets.

CyberBuddy is built for three people:

  • The š˜€š˜š˜‚š—±š—²š—»š˜ who just got their first smartphone
  • The š—²š—±š˜‚š—°š—®š˜š—¼š—æ managing a WhatsApp group for parents
  • The š—½š—æš—¼š—³š—²š˜€š˜€š—¶š—¼š—»š—®š—¹ who knows their passwords are a problem but has no idea where to start

These are the people who get phished. These are the people whose credentials appear in breach databases. These are the people nobody is building for.


š—§š—µš—² š—§š—²š—°š—µ š—¦š˜š—®š—°š—ø

Language:       Kotlin
UI:             Jetpack Compose (Material3)
Architecture:   Clean Architecture + MVVM
Database:       Room (offline-first)
DI:             Hilt
AI Layer:       Gemini API via A2A Protocol
Testing:        JUnit5 + Kotest (property-based)
Dev Tools:      Gemini in Android Studio + Claude Code (JetBrains)
Enter fullscreen mode Exit fullscreen mode

The architecture was designed to be offline-first from day one. Room handles all local state. Gemini enhances the experience - it does not gate it.


š—§š—µš—² š—”šŸ®š—” š—Ÿš—®š˜†š—²š—æ (š—§š—µš—¶š˜€ š—¶š˜€ š˜š—µš—² š—¶š—»š˜š—²š—æš—²š˜€š˜š—¶š—»š—“ š—½š—®š—æš˜)

Instead of calling the Gemini API directly from every screen, I built a š—¦š—²š—°š˜‚š—æš—¶š˜š˜†š—¢š—æš—°š—µš—²š˜€š˜š—æš—®š˜š—¼š—æ class that acts as the host agent.

It delegates structured tasks to a Gemini-powered coaching agent using Google's A2A protocol.

data class SecurityAgentTask(
    val taskType: String,     // "psp_guidance" | "breach_explain" | "daily_tip"
    val userRole: String,     // "student" | "professional" | "educator"
    val context: Map<String, Any>
)
Enter fullscreen mode Exit fullscreen mode

The benefit: the AI backend is completely decoupled from the Android layer. I can upgrade the Gemini model, swap the agent, or change the coaching logic without touching a single Compose screen.

That is the architectural decision I am most proud of.


š—Ŗš—µš—®š˜ š—Ŗš—²š—»š˜ š—Ŗš—æš—¼š—»š—“

šŸ­. š—” š—½š—æš—¼š—½š—²š—æš˜š˜†-š—Æš—®š˜€š—²š—± š˜š—²š˜€š˜ š˜š—µš—®š˜ š˜š—®š˜‚š—“š—µš˜ š—ŗš—² š—ŗš—¼š—æš—² š˜š—µš—®š—» š—®š—»š˜† š—¹š—¶š—»š˜š—²š—æ.

I was using Arb.string(minSize = 1, maxSize = 100) to generate random test inputs for the source field in breach results. The test asserted breach.source.isNotBlank(). It kept failing.

Turns out Kotest's string generator happily produces strings made entirely of whitespace. A string of spaces has a length of 1. It is not blank. Except it is.

One line fixed it:

val arbNonEmptyString = Arb.string(minSize = 1, maxSize = 100).filter { it.isNotBlank() }
Enter fullscreen mode Exit fullscreen mode

74 tests passed before that fix. 75 after.

šŸ®. š—”š—œ š—³š—²š—®š˜š˜‚š—æš—²š˜€ š˜„š—®š—»š˜ š—°š—¼š—»š—»š—²š—°š˜š—¶š˜ƒš—¶š˜š˜†. š—¬š—¼š˜‚š—æ š˜‚š˜€š—²š—æš˜€ š—±š—¼š—»'š˜ š—®š—¹š˜„š—®š˜†š˜€ š—µš—®š˜ƒš—² š—¶š˜.

Designing for offline-first while shipping AI features is a real tension. My solution: Room is the source of truth. Gemini is the upgrade. If the agent call fails, the app still works.


š—§š—µš—² š——š—²š˜ƒ š—Ŗš—¼š—æš—øš—³š—¹š—¼š˜„ š—§š—µš—®š˜ š—–š—µš—®š—»š—“š—²š—± š—›š—¼š˜„ š—œ š—•š˜‚š—¶š—¹š—±

I used two AI tools at different stages:

š—šš—²š—ŗš—¶š—»š—¶ š—¶š—» š—”š—»š—±š—æš—¼š—¶š—± š—¦š˜š˜‚š—±š—¶š—¼ for scaffolding. Boilerplate, A2A setup, Compose screens. Gemini knows the Android ecosystem deeply and moves fast.

š—–š—¹š—®š˜‚š—±š—² š—–š—¼š—±š—² (š—š—²š˜š—•š—æš—®š—¶š—»š˜€ š—½š—¹š˜‚š—“š—¶š—») for polish. Edge cases, accessibility, ProGuard rules, test coverage gaps. Claude reads the full codebase and reasons about architecture, not just the current file.

Neither tool replaced thinking. Both tools compressed the time between thinking and shipping.

Before either tool touched the codebase, I wrote three spec files: mission.md, techstack.md, and roadmap.md. That is what kept the agents grounded.


š—Ŗš—µš—®š˜'š˜€ š—”š—²š˜…š˜

CyberBuddy is being presented at š—£š—²š˜ š—£š—æš—¼š—·š—²š—°š˜š˜€: š—§š—µš—² šŸ®šŸ¬šŸ®šŸ² š—˜š—±š—¶š˜š—¶š—¼š—» - GDG Cape Town's mid-year showcase on 30 June 2026.

After that: Play Store release, closed beta with users from Strand and the IUS Africa youth network, and Supabase MCP integration for cross-device PSP sync.


š—œš—³ š˜†š—¼š˜‚ š—®š—æš—² š—Æš˜‚š—¶š—¹š—±š—¶š—»š—“ š˜€š—¼š—ŗš—²š˜š—µš—¶š—»š—“ š—³š—¼š—æ š—½š—²š—¼š—½š—¹š—² š˜„š—µš—¼ š—»š—²š—²š—± š—¶š˜, š—žš—²š—²š—½ š—Æš˜‚š—¶š—¹š—±š—¶š—»š—“.

El Roi sees the work.

š—Ÿš—¶š—»š—³š—¼š—æš—± š— š˜‚š˜€š—¶š˜†š—®š—ŗš—Æš—¼š—±š˜‡š—®

Founder, Linfy Tech Solutions | Strand, Cape Town

Top comments (0)