Inspiration
"iPhone Storage Almost Full" is the message everyone ignores until the camera stops working. In India, most of the camera roll isn't memories. It's WhatsApp good-morning forwards, expired OTP and UPI screenshots, the same meme saved five times, and photos of Aadhaar and PAN cards next to family pictures.
The tools people have don't fix this:
- Apple Photos lists Duplicates, Screenshots and Documents, but never says which ones can go. On a real iPhone, searching "expired OTP" returned 0 results, and "What's the Wi-Fi password?" returned two unrelated videos.
- Apple Intelligence only runs on iPhone 15 Pro and newer, so most iPhones people actually carry don't get it.
- Cleaner apps sort by pixels, charge weekly and upload your library.
We wanted the one thing none of them do: decide, explain and free the space, privately.
What it does
Spectra is a storage assistant built into a full photo gallery.
- It decides, and tells you why. Every photo gets keep / review / clear, with a plain reason: "OTP from 20 Nov, expired", "Greeting forward from WhatsApp", "Exact copy, keeping the best one". Real photos, favourites and IDs are never pre-selected.
- It frees the space you ask for. Pick a target from 500 MB to 10 GB. Spectra builds a plan, least risky first, and you slide to confirm. In our demo run it freed 1.11 GB in one slide. Big videos can be re-saved in HD instead of deleted.
- It answers, not just searches. "What's the Wi-Fi password?" → "brew2026", with the photo it came from. "When is my flight?" → the boarding pass, and a calendar event in one tap.
- It protects IDs. Aadhaar (Verhoeff checksum), PAN, bank cards (Luhn) and passports are recognised on the phone and moved to the Hidden album. Their text never reaches any model.
- It organises itself. "Bills and receipts go to Tax 2026" becomes a real Photos album that keeps filling up.
- It keeps you clean. A note arrives when an OTP screenshot expires or a ticket's date passes. One tap opens it to delete.
- It runs with or without Apple Intelligence. With it, the AI runs on the phone. Without it, the same Firebase AI Logic session falls back to Gemini, with your consent and masked text only.
Versus Apple Photos on the same iPhone (iOS 26):
- "expired OTP": 0 results in Photos; a dated Expired screenshots folder in Spe
- "What's the Wi-Fi password?": 2 unrelated videos in Photos; Spectra answers "
- "aadhaar card": 49 mixed results in Photos; Spectra recognises IDs by checksu
- Free a target amount of space, self-updating albums on iPhone, sort by file s can.
How we built it
On-device AI first. Gemini only as a masked fallback. No model can delete a pho
Photo ─► Vision (on iPhone) ─► keep / review / clear, with checksums │ ▼ Firebase AI Logic hybrid session ├─ primary: Apple Foundation Model (on device) └─ fallback: Gemini 3.5 Flash-Lite (consent + masked text, logge
- One Firebase AI Logic pattern for every generative step: ai.generativeModelSeprimary: .systemModel(), secondary: .geminiModel(name: "gemini-3.5-flash-lite"))), with @Generable guided generation. Six features rs, saved-info extraction, sentence-to-album rules, answers to questions, suggested album names and ticket-to-calendar events.
- AI that can't delete your photos. Guided generation means a model can only fi can explain a decision and write a title, but the keep / clear call is deterministic and checksum-based. That makes it fast (500 photos in about 63 nable and testable.
- Privacy you can check. Before anything leaves the phone, numbers, emails, pho masked. ID text never leaves, and every cloud request appears in a privacy log with the exact text sent. 0 photos are ever uploaded.
- Hybrid you can see. Every AI answer carries a badge: On this iPhone or Geminitch simulates an iPhone without Apple Intelligence, so you can watch the same feature fall back live.
- App Check protects every Firebase AI Logic call. Release builds use Apple App
- Picture search uses an on-device image-text model (OpenAI CLIP via Core ML) anerative step goes through Firebase AI Logic.
- Stack: SwiftUI on iOS 26 (Liquid Glass), Swift 6 strict concurrency, PhotoKitAuthentication, AVFoundation, WidgetKit, App Intents, EventKit.
Challenges we ran into
- Speed. The first version sent every photo to the model: 1,311 s for 500 photoministic and using the model only for language brought it down to about 63 s.
- Guardrails for a small model. On-device models are quick but need structure. validation with one retry, and dropping conditions that match nothing made answers and album rules reliable.
- Real libraries are messy. Photos stored only in iCloud can't be compared unti-new photos are still being written when they appear. Spectra never calls an unreadable photo a duplicate, and re-reads new photos once iOS finishes savin
- Privacy by default. Automated security reviews checked every cloud path, and t switch plus a privacy-log entry.
Accomplishments that we're proud of
- It does the one thing Apple Photos doesn't: decide and explain. We proved the
- The hybrid design is something a user can see and trust, not just an architec
- 0 photos uploaded, and a log that proves it.
- 107 core tests, 39 app tests on the device (including the real on-device model and a real Gemini call), and 18 UI flows driven on a real iPhone.
What we learned
Small on-device models are excellent at reading and writing, but they should never make irreversible decisions. On-device AI for language, deterministic checks for anything you can't undo, and the cloud only as a masked fallback: that split made Spectra fast, pr
What's next for Spectra
- Android, with Gemini Nano through the same Firebase AI Logic hybrid API.
- Albums locked with Face ID that also hide their photos from the main library
- Spectra on the App Store.
Built With
- app-intents
- apple-foundation-models
- apple-intelligence
- avfoundation
- clip
- coreml
- eventkit
- firebase
- firebase-ai-logic
- firebase-app-check
- gemini
- ios
- localauthentication
- photokit
- swift
- swiftui
- vision
- visionkit
- widgetkit