A private, intelligent companion that lives entirely on your device, learns who you are without ever sharing that with anyone, and gives you complete control over every piece of data it learns.
Features • Architecture • Tech Stack • How It Works • Use Cases • Setup • Structure • Roadmap
AEGIS is a cutting-edge, mobile-first AI assistant built entirely on the principle of privacy by design. Unlike ChatGPT, Gemini, or any cloud-based AI, AEGIS runs a full Large Language Model (LLM) directly on your smartphone — your conversations, your data, your patterns — nothing ever leaves your device.
AEGIS isn't just a chatbot. It's a smart manager of your entire phone that learns your habits, helps you be productive, detects phone addiction patterns, and gives you complete transparency and control over everything it learns.
| Problem | How Cloud AI Handles It | How AEGIS Handles It |
|---|---|---|
| Privacy | Your data is sent to remote servers, stored, and used for training | All processing happens on your device. Zero network calls, ever |
| Internet Dependency | Requires constant internet connection | Works 100% offline after initial model download |
| Data Ownership | Companies own and monetize your data | You own everything. Delete anything, anytime |
| Transparency | Black box — you don't know what they learn about you | Full transparency — see every pattern, every memory, every score |
| Wellbeing | Designed to maximize engagement and screen time | Designed to REDUCE phone use and promote digital wellbeing |
| Feature | Description |
|---|---|
| 🔒 100% Offline AI | True local LLM execution via llama.cpp. No cloud, no API keys, no tracking |
| 🧠 Smart AI Chat | Natural conversation powered by on-device Qwen 3.5 LLM with streaming responses |
| 📊 Wellbeing Monitor | Track screen time, detect addiction patterns, get proactive nudges |
| 👁️ Full Transparency | See everything the AI has learned about you — every pattern, every memory |
| 🔐 Military-Grade Encryption | AES-256 encrypted local vault for all stored data |
| 🤖 Agent System | Extensible AI agents marketplace for specialized tasks |
| 🧩 Smart Memory | 4-layer memory system that remembers context across conversations |
| 📱 Device-Aware | Auto-detects your phone's RAM and recommends the optimal AI model |
| 🛡️ Rigorous Mode | Hard app-blocking system with trusted-person unlock for addiction control |
| 🎯 Proactive Insights | ML models silently analyze patterns and trigger AI conversations when needed |
AEGIS uses a unique "Two-Brain" hybrid AI architecture — combining lightweight always-on ML models with a powerful on-demand LLM, all running locally on your device.
Five tiny machine learning models run continuously in the background, consuming minimal battery:
| Model | Type | Size | Speed | Purpose |
|---|---|---|---|---|
| Usage Pattern Classifier | Decision Tree / Random Forest | ~500 KB | <10ms | Classify app usage: productive / compulsive / social |
| Routine Detector | Hidden Markov Model | ~800 KB | <50ms | Identify repeating daily behavior patterns |
| Addiction Risk Scorer | Logistic Regression | ~200 KB | <5ms | Score 0–100 addiction risk; triggers LLM at 75+ |
| Next App Predictor | Markov Chain | ~1 MB | <1ms | Power proactive app suggestions |
| Wellbeing Trend Analyzer | Time Series / Linear Regression | ~600 KB | <100ms | Track long-term wellbeing patterns |
A full Large Language Model that handles natural language understanding and generation:
| Device Tier | RAM | Recommended Model | Size | Context Window |
|---|---|---|---|---|
| 💰 Budget (Redmi, A-series) | 3–4 GB | Qwen3.5-0.8B Q4_K_M | ~500 MB | 262K tokens |
| 📱 Mid-Range (Poco X5, A54) | 4–6 GB | Qwen3.5-2B Q5_K_M | ~1.2 GB | 262K tokens |
| 🚀 Upper Mid (Nord, S23 FE) | 6–8 GB | Qwen3.5-4B Q5_K_M | ~2.8 GB | 262K tokens |
| ⚡ Flagship (S24, Pixel 9) | 8–12 GB | Qwen3.5-9B Q4_K_M | ~5.5 GB | 262K tokens |
Why Qwen 3.5?
- 🌍 262K context window (8× larger than Gemma's 32K)
- 🇮🇳 201 languages including all 22 Indian scheduled languages
- 📜 Apache 2.0 license (no commercial restrictions)
- 📱 AndroidWorld benchmark score 55–57.8 (confirmed Android agent capable)
ML Models (Brain 1) LLM (Brain 2)
──────────────────── ────────────────────
Silent background analysis → Detect risk/pattern → Wake up LLM →
LLM communicates naturally with user using ML insights as context
Example: The Addiction Risk Scorer detects your TikTok usage hit a score of 80 → it triggers the LLM → the LLM says: "Hey, I noticed you've been scrolling for 45 minutes — that's longer than your usual 20. Want to take a break?"
| Layer | Technology | Purpose |
|---|---|---|
| Frontend Framework | Flutter 3.x + Dart | Cross-platform mobile UI with native performance |
| State Management | Riverpod | Reactive, testable, compile-safe state management |
| Navigation | GoRouter | Declarative routing with deep link support |
| LLM Inference | llama.cpp (C++) | High-performance local LLM inference engine |
| Native Bridge | Kotlin + JNI | Android native layer for LLM and system access |
| ML Models | TensorFlow Lite | Lightweight on-device ML model execution |
| Local Database | Hive (Encrypted) | Fast, lightweight NoSQL encrypted database |
| Encryption | AES-256 + flutter_secure_storage | Military-grade encryption for all stored data |
| UI Components | Google Fonts, Lottie, fl_chart, Shimmer | Premium animations, typography, and charts |
| HTTP Client | Dio | Model download with progress tracking |
| Device APIs | UsageStats, Accessibility, Notifications | Android system data collection (with permission) |
Step 1 — Setup
Install app → Auto-detect RAM → Recommend optimal LLM model → Download model → Grant permissions (UsageStats, Accessibility, Notifications)
Step 2 — Data Collection
App silently collects usage statistics, accessibility events, and notification metadata — all stored locally in an encrypted vault
Step 3 — Dual Processing
- Path A (Background): ML models continuously process data → detect patterns → score risk → generate insights
- Path B (Interactive): User asks questions → LLM processes locally → generates personalized responses enriched with ML insights
Step 4 — Encrypted Storage
All behavioral patterns, chat memories, and user preferences are stored in an AES-256 encrypted Memory Vault
Step 5 — User Control
View everything the AI has learned → Edit or delete any memory → Full control: disable per-app, reset everything
The decision logic creates a continuous learning loop — all happening on-device:
- Data Collected → Usage stats, chat history, notifications, sensor data
- ML Models Process → Score, classify, and detect patterns
- Confidence Check → If confidence exceeds threshold, trigger proactive intervention
- LLM + Memory + ML Insights → Generate natural language response with full context
- Extract & Store New Memories → Learn from interaction for future personalization
- Loop back → Continue observing and improving
AEGIS uses a sophisticated memory system that distills information over time:
| Layer | Storage | Content | Lifespan |
|---|---|---|---|
| Short-Term | RAM | Active conversation context, recent messages | Current session |
| Medium-Term | Encrypted Hive DB | Conversation summaries, key topics | Days to weeks |
| Long-Term | Encrypted Vault | Extracted facts, preferences, behavioral patterns | Weeks to months |
| Permanent Profile | Secure Storage | Core identity traits, personality | Persistent |
Memories automatically distill from short-term → permanent over time. During each conversation, relevant memories are retrieved to provide personalized, context-aware responses.
- Study schedule management — AI learns your study patterns and optimizes your schedule
- Phone addiction control — Detect and limit excessive social media usage during study hours
- Exam preparation — Smart reminders based on your detected routine patterns
- Focus mode — Rigorous Mode blocks distracting apps, only trusted person can unlock
- Productivity monitoring — Track productive vs unproductive app usage
- Meeting preparation — AI remembers your context and helps organize thoughts
- Digital detox — Proactive nudges when screen time exceeds healthy patterns
- Smart notifications — AI summarizes and prioritizes notification overload
- Child's phone monitoring — Understand usage patterns without invading privacy
- Rigorous Mode for children — Set hard limits with trusted-person unlock
- Wellbeing tracking — Long-term trends in screen time and app categories
- Safe AI interaction — Children can chat with AI without data going to cloud
- Zero data leakage guarantee — Everything stays on your phone
- Full transparency — See exactly what the AI knows about you
- Granular deletion — Delete individual memories, conversation history, or everything
- No accounts needed — No sign-up, no email, no phone number required
| Tool | Version | Purpose |
|---|---|---|
| Flutter SDK | 3.x+ (Dart SDK ^3.11.0) | App framework |
| Android Studio | Latest | Android build tools & emulator |
| Android NDK | r25+ | C++ compilation for llama.cpp |
| CMake | 3.18+ | Native build system |
| Git | Latest | Version control |
| JDK | 17+ | Android Gradle builds |
git clone https://github.com/mujju-212/AEGISTheOnDeviceAI.git
cd AEGISTheOnDeviceAI/privacy_ai_appflutter pub getEnsure your local.properties has the correct NDK path:
ndk.dir=/path/to/your/Android/Sdk/ndk/25.x.x# For debug build (development)
flutter run
# For release build (production)
flutter build apk --releaseOnce the app launches on your phone:
- Device Scan — App automatically detects your phone's RAM and CPU capabilities
- Model Selection — Recommends the optimal LLM model for your device tier
- Model Download — Downloads the GGUF model file (500 MB – 5.5 GB depending on tier)
- Profile Setup — Answer onboarding questions so the AI can personalize responses
- Grant Permissions — Usage Stats, Accessibility Service, Notification Access
- Start Chatting! — Your private AI companion is ready
| Requirement | Minimum | Recommended |
|---|---|---|
| Android Version | Android 8.0 (API 26) | Android 12+ (API 31+) |
| RAM | 3 GB | 6 GB+ |
| Storage | 2 GB free | 8 GB+ free |
| CPU | ARMv8 (64-bit) | ARMv8.4+ with i8mm |
| GPU | Optional | Vulkan-supported for acceleration |
privacy_ai_app/
│
├── lib/ # Flutter/Dart source code
│ ├── main.dart # App entry point, initialization, routing
│ │
│ ├── core/ # Core infrastructure
│ │ ├── providers.dart # All Riverpod state providers
│ │ ├── router/ # GoRouter navigation configuration
│ │ ├── theme/ # Dark/Light theme, AppColors, typography
│ │ ├── constants/ # Settings keys, chat prompts, system config
│ │ ├── utils/ # Utility functions and helpers
│ │ └── services/
│ │ ├── database/ # Hive encrypted DB, ChatHistoryService
│ │ ├── llm/ # LlmService, LlmBridge, MemoryService,
│ │ │ # ConversationSummaryService
│ │ └── model/ # ModelRegistry, download service
│ │
│ ├── features/ # Feature modules (Clean Architecture)
│ │ ├── chat/ # AI chat interface & prompt building
│ │ ├── analytics/ # Usage pattern analysis & statistics
│ │ ├── wellbeing/ # Wellbeing dashboard & monitoring
│ │ ├── memory/ # Memory management & forget commands
│ │ ├── onboarding/ # Device scan → model download → setup
│ │ ├── home/ # Home dashboard
│ │ ├── settings/ # Model management & preferences
│ │ ├── transparency/ # Data transparency dashboard
│ │ ├── rigorous_mode/ # App blocking & trusted-person system
│ │ └── agents/ # AI agent system & marketplace
│ │
│ ├── ml/ # Machine Learning integration
│ │ ├── models/ # TFLite model definitions
│ │ └── processors/ # ML data processing pipelines
│ │
│ └── services/ # Platform services
│ ├── accessibility/ # Android Accessibility Service bridge
│ ├── device_state/ # Device state monitoring
│ ├── notifications/ # Notification listener service
│ └── usage_stats/ # Android UsageStats API bridge
│
├── android/ # Android native layer
│ ├── app/src/main/
│ │ ├── kotlin/.../ # Kotlin source
│ │ │ ├── MainActivity.kt # Flutter MethodChannel bridge
│ │ │ └── llm/
│ │ │ ├── LlmNative.kt # JNI bridge to llama.cpp
│ │ │ └── CpuFeatures.kt # Runtime CPU detection for optimal .so
│ │ └── cpp/
│ │ ├── CMakeLists.txt # llama.cpp native build config
│ │ └── llm_native_stub.cpp # C++ JNI: inference, streaming, cancel
│ └── build.gradle.kts # Android build configuration
│
├── ml_models/ # TFLite model files
├── assets/ # Fonts, images, animations
├── assets/readme/ # README screenshots, diagrams, and banners
├── test/ # Unit tests
├── integration_test/ # Integration tests
└── pubspec.yaml # Dart dependencies & configuration
| Layer | Name | Trigger | Example |
|---|---|---|---|
| 🟢 Layer 1 | Gentle Awareness | Usage exceeds normal | "You've been on TikTok 45 min — just so you know." |
| 🟡 Layer 2 | Stronger Nudge | Continued overuse | "Still scrolling? You usually stop around 30 min." |
| 🟠 Layer 3 | Friction Point | Addiction risk rising | Pause screen — conscious choice required to continue |
| 🔴 Layer 4 | Rigorous Mode | High addiction score | Hard block. Only trusted person can unlock |
The ML models detect these behavioral patterns in real-time:
- 🔄 Rapid Reopening — Closing and immediately reopening the same app
- 🌙 Late-Night Usage — Phone usage during sleep hours
- 📈 Session Creep — Gradually increasing session durations over time
- ⚡ Frequency Spike — Sudden increase in app opening frequency
- ☀️ Morning-First-Reach — Phone as the first thing accessed upon waking
Phase 1 — Foundation ████████████████████ 100% ✅ COMPLETE
Phase 2 — AI Integration ████████████████░░░░ 80% 🔧 LLM UI done, native layer in progress
Phase 3 — Data Collection ██████████████████░░ 90% 🔧 Built, needs device testing
Phase 4 — ML Models ████████████░░░░░░░░ 55% 🟡 Services scaffolded
Phase 5 — Agents ████░░░░░░░░░░░░░░░░ 20% 🟡 Scaffold only
Phase 6 — Rigorous Mode ████████░░░░░░░░░░░░ 40% 🟡 Scaffold exists
Phase 7 — Transparency ████████░░░░░░░░░░░░ 40% 🟡 Partially built
Phase 8 — Polish & Testing ░░░░░░░░░░░░░░░░░░░░ 0% 🔴 Not started
| Agent | Purpose |
|---|---|
| 🧠 Life Manager | Plans your day, creates study schedules, handles overwhelm |
| 💪 Health & Wellness | Morning health briefing, workout logging, stress detection |
| 🧩 Memory & Knowledge | Remembers conversations, saves ideas, retrieves context |
| 📱 Phone Control | Makes calls, sets alarms, creates events, finds files |
| 🔔 Smart Notifications | Summarizes notifications, manages focus mode |
Like a Play Store for AI skills — developers publish agents (5–25 MB packages), users download what they need. Each agent consists of:
agent_package/
├── manifest.json # Agent metadata & capabilities
├── system_prompt.txt # Agent personality & instructions
├── tools.json # Available tools & API definitions
└── model.tflite # Optional specialized ML model
| Principle | What It Means |
|---|---|
| Privacy First | Zero network calls. AES-256 encrypted local storage. User owns all data |
| Transparency Always | User sees every pattern learned, confidence scores, what triggered suggestions |
| Wellbeing Over Engagement | App is designed to REDUCE phone use, not increase it |
| Offline by Default | Fully functional without internet after initial model download |
| Device-Aware Intelligence | Adapts model size, thread count, and inference profiles to your device |
We welcome contributions! Here's how to get started:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
| File | What It Is |
|---|---|
lib/features/chat/chat_provider.dart |
Main chat brain — prompt building & generation logic |
android/.../llm/LlmNative.kt |
JNI bridge to llama.cpp |
android/.../cpp/llm_native_stub.cpp |
C++ LLM engine — inference & streaming |
lib/features/analytics/ |
Usage analytics & pattern detection |
lib/core/services/llm/ |
LLM service, memory, and conversation summaries |
This project is licensed under the MIT License — see the LICENSE file for details.
Mujju — @mujju-212
🛡️ Your data is yours. Your AI is yours. Your privacy is non-negotiable.









