Skip to content

sann3/curio-kid

Repository files navigation

Curio Kid

A kid-safe Android app where children can ask any question by text, image, camera, or voice and get warm, age-appropriate answers from Luna — a patient AI tutor powered by Google's Gemma 4 open models, served through the Gemini API.

Parents get a PIN-protected dashboard with a daily Curiosity Digest that summarises the day's questions and surfaces conversation starters.

Built for the Gemma / Gemini Challenge on dev.to.


Features

  • Ask Luna anything — text, image upload, camera capture, or voice input (system speech-to-text, no audio leaves the device until it's been transcribed).
  • Age-tuned answers — pick the child's age (5–12) in Settings and Luna's system prompt shifts vocabulary, sentence length, and analogies to match (kindergarten-simple for 5–6, early-elementary for 7–9, a touch more depth for 10–12).
  • Child protection by design — Luna's system prompt enforces kid-safe language, gently redirects unsafe topics, and the Gemini API is configured with strict safety thresholds across harassment, hate speech, sexually explicit, and dangerous-content categories.
  • Privacy-first storage — your Gemini API key and parent PIN live in EncryptedSharedPreferences (AES-256). Question history is stored in a local Room database and never uploaded.
  • Parent Dashboard — PIN-gated screen showing the day's questions and a one-tap Curiosity Digest generated by Gemini (themes, highlights, conversation starters, and gentle flags).
  • Modern Material 3 UI — soft purple/pink palette, rounded bubbles, edge-to-edge layout, dark-mode support.
  • No backend — single-APK, fully offline-friendly aside from the Gemini API call itself.

Project layout

app/
├── build.gradle.kts
└── src/main/
    ├── AndroidManifest.xml
    ├── java/com/curiokid/app/
    │   ├── CurioKidApplication.kt        # DI-light root
    │   ├── MainActivity.kt
    │   ├── ai/
    │   │   ├── LunaAI.kt                  # Gemini wrapper (system prompt + safety)
    │   │   └── SystemPrompt.kt            # Luna persona + parent digest prompt
    │   ├── data/
    │   │   ├── local/                     # Room: AppDatabase, QuestionDao, QuestionEntity
    │   │   ├── repository/QuestionRepository.kt
    │   │   └── settings/SettingsManager.kt # EncryptedSharedPreferences
    │   ├── navigation/CurioNavHost.kt
    │   └── ui/
    │       ├── chat/                      # Kid-facing Q&A screen
    │       ├── history/                   # Past questions
    │       ├── parent/                    # PIN-gated dashboard + digest
    │       ├── settings/                  # Provider, API key, model, kid's age, PIN
    │       └── theme/                     # Material 3 theme
    └── res/                               # strings, colors, adaptive icon, file_paths

Build & run

Prerequisites

  • Android Studio Meerkat / Narwhal or newer (anything that ships AGP 8.13+)
  • JDK 17
  • Android SDK Platform 36 + Build-Tools 35 (auto-installed by Gradle on first build if missing)
  • A real Android device or emulator running Android 8.0 (API 26) or higher

1. Get a Gemini API key

  1. Go to Google AI Studio.
  2. Click Get API key.
  3. Copy the key.

2. Open the project

git clone <this-repo>
cd curio-kid

Open the folder in Android Studio. Let it sync Gradle and download the Compose / Gemini / Room dependencies.

3. Run

  • Click ▶ Run 'app' in Android Studio, or:
    ./gradlew :app:installDebug
    adb shell am start -n com.curiokid.app/.MainActivity
  • On first launch, tap the gear icon → Gemini API key, paste your key, hit Save.
  • Still in Settings, pick your child's age (5–12) so Luna can tune her answers, and set a 4-digit Parent PIN to gate the dashboard.
  • Hand the device to your kid and let them ask Luna anything.

The Gradle wrapper expects to fetch Gradle 8.14.5 on first build. If your machine is offline, run gradle wrapper --gradle-version 8.14.5 once against your local Gradle, or set distributionUrl in gradle/wrapper/gradle-wrapper.properties to a local distribution.

4. Choose a model

This app is built for the Gemma 4 challenge, so the model picker only exposes the two Gemma 4 variants Google hosts on the Gemini API (as of April 2026):

  • gemma-4-26b-a4b-it (default — 26B mixture-of-experts, fast, multimodal)
  • gemma-4-31b-it (31B dense, higher quality reasoning, slower)

Both models support text + image + video, a 256K context window, and are Apache-2.0 licensed for commercial use.


How safety is enforced

  1. System prompt (SystemPrompt.luna(age)) instructs Luna to:

    • Use kid-friendly language and analogies (Lego, swings, fruit), with vocabulary and sentence length scaled to the child's age (5–12) chosen in Settings.
    • Redirect violence / adult / self-harm / illegal / scary topics to "a trusted adult."
    • Never share personal contact info, links, or identify real people in photos.
    • End every reply with a follow-up question to fuel curiosity.
  2. Gemini safety settings (LunaAI) are pinned to BlockThreshold.LOW_AND_ABOVE for harassment, hate speech, sexually explicit, and dangerous content.

  3. No web browsing or tool use is exposed to the model.

  4. No telemetry — the only network call the app makes is to the Gemini endpoint with the user's own key.


Privacy notes

  • API key + Parent PIN: encrypted at rest via Jetpack Security (EncryptedSharedPreferences).
  • Question history: local Room database (curio_kid.db), excluded from device transfer & cloud backup (backup_rules.xml, data_extraction_rules.xml).
  • Voice input: handled by the platform speech recognizer; only the transcribed text is sent to Gemini.
  • Images: only sent to Gemini when the child explicitly attaches one and hits send.

On-device Gemma 4 (offline)

Curio Kid can run Gemma 4 fully on the phone via the MediaPipe LLM Inference API. No API key, no network, the only data leaving the device is whatever the parent dashboard later asks Luna to summarise.

Variants

Only multimodal Gemma 4 builds are listed in the on-device picker — the camera/image flows assume Luna can see pictures regardless of which provider is selected.

Variant id Size on disk Notes
gemma-4-2b-it-int4-vision ~1.6 GB Default. Fits on most modern phones.
gemma-4-7b-it-int4-vision ~4.8 GB Sharper answers, needs ~6 GB free RAM.

How a parent installs it

  1. In Settings, tap AI provider → On-device (local).
  2. Pick a variant in Model.
  3. Tap Download model in the On-device Gemma 4 card.
    • On a metered (cellular / hotspot) network you'll be asked to confirm before the download starts.
    • The download is resumable: if the app is killed mid-flight, tapping Download again continues from where it stopped.
  4. Wait for the progress bar to reach 100 % and the status to switch to Installed ✓.
  5. Hand the phone to your kid as usual.

The .task file lives in the app's private internal storage (<filesDir>/models/), encrypted at rest by the OS, excluded from cloud backup, and removed automatically when the app is uninstalled. Tap Delete to free the space at any time.

Notes for developers

  • Override the URL for a variant during local development by editing LocalGemmaCatalog.kt — the rest of the pipeline (download manager, inference engine, backend, UI) is unchanged.
  • Skip the in-app downloader entirely by adb push-ing your own .task file:
    adb push my-gemma-4.task /data/local/tmp/
    adb shell run-as com.curiokid.app cp /data/local/tmp/my-gemma-4.task \
        files/models/gemma-4-2b-it-int4-vision.task
    Restart the app and the on-device card will flip to Installed ✓.
  • The MediaPipe LlmInference instance is held as a process-wide singleton in CurioKidApplication.localGemmaEngine and is dropped on onTrimMemory(MODERATE+) so the OS can reclaim its multi-GB RAM footprint when Curio Kid is backgrounded.

Future enhancements

  • Direct audio uploads to Gemini (currently transcribed locally instead).
  • Reading mode where Luna's reply is read aloud with TTS.
  • Multi-kid profiles (name + interests on top of the existing age setting) so siblings can share a device without resetting Settings.
  • Whitelist / blacklist topics in the parent dashboard.

License

MIT (see LICENSE if added).

About

A kid-safe Android app where children can ask any question by text, image, camera, or voice and get warm, age-appropriate answers from Luna — a patient AI tutor powered by Google's Gemma 4 open models, served through the Gemini API.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages