SMS Sentry

50 ms. That's all it takes to stop a scam...

Repo
SMS Sentry banner

About

## The problem it solves

## ๐Ÿšจ The Problem

Every 3 minutes, someone falls victim to an SMS scam.

Smishing (SMS phishing) is now one of the fastest-growing forms of cybercrime globally โ€” and the average person has almost no defence against it. A fake bank alert, a "your parcel is stuck" notification, a too-good-to-be-true job offer. One tap on a malicious link is all it takes to lose your credentials, your money, or your identity.

Existing solutions fall short in two critical ways:

- **Blocklists are too slow.** Scammers spin up new domains in minutes. By the time a number or URL gets blocklisted, thousands of victims have already tapped it. - **Cloud-based scanners are a privacy nightmare.** Sending your private SMS content to a third-party server to "check if it's safe" trades one risk for another.

Most people โ€” especially older adults and first-time smartphone users โ€” simply cannot tell a real bank message from a convincing fake. And by the time they realise something is wrong, it's already too late.

---

## ๐Ÿ›ก๏ธ What SMSentry Does

SMSentry gives everyone โ€” regardless of their technical knowledge โ€” an invisible, always-on bodyguard for their SMS inbox. Here's how it helps in real life:

### โšก Instant Scam Detection (No Action Required) The moment an SMS arrives, SMSentry silently classifies it and displays a colour-coded badge right in the inbox โ€” before the user even opens the message.

- ๐ŸŸข **SAFE** โ€” Read freely

- ๐ŸŸ  **SUSPICIOUS** โ€” Proceed with caution - ๐Ÿ”ด **SCAM** โ€” Do not tap anything

A **Risk Score (0โ€“100)** makes the danger level instantly understandable even for non-technical users. No menus to navigate. No buttons to press. It just works.

> *"Your HSBC account has been suspended. Verify now: hsbc-verify.ru/login"* > โ†’ **SCAM โ€” Risk Score: 97/100** ๐Ÿ”ด

---

### ๐Ÿ” Deep Investigation for Suspicious Messages When a message feels off but isn't obviously a scam, users can tap **Deep Check** to launch a full AI investigation โ€” directly on the phone. The app examines:

- **Who registered the domain, and when** โ€” a domain created 2 days ago is a massive red flag - **Whether the sender URL actually matches the real brand** โ€” `hsbc-verify.ru` is not `hsbc.com` - **Whether the link appears in offline phishing databases** - **Whether the language uses urgency tactics** designed to panic the reader into acting fast

Evidence streams live to the screen, card by card, like a detective building a case โ€” and ends with a clear verdict and one-tap actions: **Block Sender ยท Report Spam ยท Delete SMS ยท Contact Official Support**

---

### ๐Ÿ”’ Complete Privacy โ€” Your Messages Stay on Your Phone Unlike most security apps, SMSentry performs **all AI analysis on-device**. No SMS content is uploaded to any server, ever. This matters because:

- Victims of scams are often already in a vulnerable position โ€” they shouldn't have to surrender their private messages to get help - On-device AI means the app works even in airplane mode (for Tier 1 and most of Tier 2) - There is no central database that can be breached or subpoenaed

---

### ๐Ÿ‘ด Who Benefits Most

| User | How SMSentry Helps |

|---|---| | **Elderly users** | Instant visual warning before they tap anything | | **First-time smartphone owners** | No technical knowledge needed โ€” badges speak for themselves | | **People who receive high SMS volume** | Risk scores let them triage at a glance | | **Anyone who banks or shops via phone** | Stops credential-theft and fake-payment scams | | **Enterprises & SMBs** | Protects employees from corporate smishing attacks |

---

### ๐Ÿง  Explainable, Trustworthy AI

SMSentry doesn't just say *"this is a scam"* โ€” it shows its reasoning:

> โœ“ Urgent language detected

> โœ“ Suspicious URL found > โœ“ Matches known banking scam pattern

This builds user trust, helps people *learn* to recognise scams over time, and ensures the AI is accountable for every decision it makes.

---

## The Bottom Line

SMSentry turns a passive, defenceless SMS inbox into an active, intelligent shield โ€” without sacrificing privacy, requiring internet connectivity, or demanding anything from the user. It makes staying safe as easy as glancing at a colour.

## Challenges we ran into

## โš”๏ธ Challenges We Ran Into

Building a two-tier on-device AI scam detector in 24 hours wasn't just a coding challenge โ€” it was a constant negotiation between ambition and reality. Here are the specific walls we hit, and how we broke through them.

---

### 1. ๐Ÿง  The Agentic Loop Kept Talking to Itself

**The bug:** Our Tier 2 Deep Check uses Gemma running in an agentic loop โ€” the model calls tools, receives results, and decides what to investigate next. Sounds clean in theory. In practice, Gemma kept generating tool calls that referenced results from *previous* turns as if they were *new* instructions, causing the loop to spiral โ€” re-running the same WHOIS lookup four times, then confidently concluding the domain was registered in four different countries simultaneously.

**How we fixed it:** We introduced strict prompt templating via `PromptTemplates.kt` that clearly delineates the tool result injection format from the model's own reasoning space. We also added a max-turn hard cap on the loop and a `ToolExecutor` that deduplicated calls โ€” if the same tool was invoked with the same argument twice, it returned the cached result instead of re-running. The loop stabilised immediately.

---

### 2. ๐Ÿ“ก Streaming Evidence to the UI Without Race Conditions

**The bug:** `DeepCheckSession` emits `DeepCheckUpdate` events as the investigation progresses โ€” steps, evidence cards, and the final verdict all arrive asynchronously. Our first implementation used a simple `MutableStateFlow<DeepCheckUpdate>` (single latest value). The result? Evidence cards would flash and disappear, replaced by the next update. Users saw only the last card, not the full growing timeline.

**How we fixed it:** We switched to `MutableStateFlow<List<DeepCheckUpdate>>` โ€” the UI accumulates updates rather than replacing them. Each new emission appends to the running list. The `DetailViewModel` collects this flow and the Compose UI re-renders the entire timeline on each emission. Evidence now builds up the screen exactly like a live investigation feed. This also made testing dramatically easier since we could assert against the full accumulated list rather than a single event.

---

### 3. ๐Ÿ” Brand Mismatch Detection Was a Minefield of Edge Cases

**The bug:** Our `BrandMismatchHeuristic` was supposed to catch spoofed domains like `hsbc-verify.ru` masquerading as `hsbc.com`. Our first regex-based approach was either too aggressive (flagging legitimate subdomains like `online.hsbc.com` as spoofs) or too lenient (missing hyphenated variants like `hsbc-secure-login.com`).

**How we fixed it:** We rebuilt it as a proper `DomainMatchUtil` with a dedicated test suite (`DomainMatchUtilTest` โ€” 9 tests). The logic now: - Extracts the registrable domain (ignoring subdomains and TLDs) - Checks for brand keyword *containment* in an unrecognised domain - Scores confidence based on whether the TLD matches, whether hyphens are present, and whether the path contains login/verify/secure keywords

Getting all 9 tests green required three rewrites of the core matching function and a humbling amount of time spent on what we initially assumed was a one-liner.

---

### 4. ๐Ÿ—๏ธ Hilt Dependency Injection Fought Us at Every Corner

**The bug:** We adopted Hilt early for clean DI across `ModelManager`, `ToolExecutor`, `PrivacyProxyClient`, and the Room database. What we didn't account for was that `DeepCheckSession` is created *per-investigation* (not a singleton), but several of its dependencies *are* singletons. Hilt's scoping rules meant our session factory kept injecting stale `OkHttpClient` instances, and two parallel investigations (in testing) would share a `ToolExecutor` that wasn't thread-safe.

**How we fixed it:** We refactored `DeepCheckSession` out of Hilt's graph entirely and moved it to a manually-constructed factory pattern inside `AppModule.kt`. Singleton dependencies (`OkHttpClient`, `ReputationDb`, `LlmInferenceEngine`) are injected into the factory; the factory creates fresh session instances with those shared dependencies passed in. Thread-safety in `ToolExecutor` was resolved by making the deduplication cache a `ConcurrentHashMap`.

---

### 5. ๐ŸŽจ Jetpack Compose Animations Janked Under Load

**The bug:** During the Deep Check investigation, evidence cards fade in and slide up with staggered delays. Beautiful in isolation. The moment the LLM started emitting updates rapidly, the `LazyColumn` recompositions collided with the in-flight animations โ€” cards would snap rather than slide, and the list would jump to the bottom mid-animation, disorienting the user.

**How we fixed it:** We added `key(update.id)` to each item in the `LazyColumn` so Compose could identify new items without diffing the entire list. We also moved the animation trigger to an `AnimatedVisibility` wrapper driven by a `remember { mutableStateOf(false) }` that flips to `true` in a `LaunchedEffect` with the item's staggered delay.

Screenshots

SMS Sentry screenshot 1SMS Sentry screenshot 2

Team

From the public Devfolio project page. Votes, swipes and the judge score are hackfeed's own.

AI judge

Not judged yet. A free model reads this page, compares it with similar projects and this event's winners, then scores it and says what would make it win.

Still being built?

Not checked yet.

Swipe stats

0upvotes
0skips
0saves

Discussion 0

No comments yet. Ask the team something, or say what you'd use it for.

Posting as a guest. Plain text, 1,000 characters max.

Already built nearby

Closest projects by meaning and shared words. Similar isn't the same as copied: read them.