# ROLE & OBJECTIVE
Act as a Principal Full-Stack Mobile Architect and UI/UX Engineer. Build **"Aegis"**, an offline-first, privacy-centric, multimodal Personal Life-Admin & Action Engine.

The core philosophy of Aegis is **"One Input, Zero Manual Entry, Concrete Action."** Users never fill out forms or build dashboards manually. They capture messy real-world inputs (snap a photo of a receipt, paper bill, broken part, or pantry; speak a messy voice brain-dump; or share a screenshot), and the app locally parses, categorizes, schedules, and tracks everything into a calm, ultra-fast, single-feed command center.

---

# CORE TECH STACK & ARCHITECTURE
- **Framework:** React Native (Expo SDK 52+) with TypeScript (strict mode) for cross-platform iOS/Android, or Progressive Web App (Next.js + Capacitor) if web-first is requested. Default to Expo / React Native.
- **Local-First Database:** SQLite (`expo-sqlite`) paired with Drizzle ORM for instant offline reads/writes, full-text search (FTS5), and zero-latency UI updates.
- **Security & Privacy:** All user data stays on-device by default. Encrypt sensitive fields (financials, documents) using `expo-secure-store` / SQLCipher. Provide an optional encrypted peer-to-peer or self-hosted backup export (`.aegis` encrypted JSON/SQLite bundle).
- **AI Orchestration Layer (Hybrid Edge + Cloud):**
  - Build a clean `AIService` abstraction layer supporting both on-device local models (via llama.cpp / MLC / Ollama endpoint) and user-supplied API keys (OpenAI / Anthropic / Gemini) for multimodal vision and audio transcription.
  - Enforce strict JSON Schema structured outputs for all AI parsing.
- **State Management & Styling:** Zustand for lightweight UI state, NativeWind (Tailwind CSS) for styling, and `lucide-react-native` for crisp iconography.

---

# CORE FEATURES TO IMPLEMENT

## 1. The Universal Capture Bar (Zero-Friction Input)
- Accessible within 1 tap from anywhere in the app (persistent bottom action dock) and via OS Share Sheet / Home Screen Widget.
- **3 Native Capture Modes:**
  1. **Snap (Vision):** Camera capture or gallery import. Automatically detects document type:
     - *Receipt / Invoice:* Extracts merchant, date, line items, tax, total, warranty expiration, and category.
     - *Bill / Letter / Notice:* Extracts due date, amount due, account number, and required action.
     - *Physical Object / Maintenance:* Identifies part/model/label, logs maintenance history, and generates step-by-step care/repair checklists.
  2. **Speak (Voice-to-Action):** Hold-to-talk audio recorder. Transcribes and splits a single rambling voice note into distinct structured entities (e.g., *"Remind me to renew the truck tags Friday, I spent 42 bucks on oil at NAPA, and pick up milk"* -> creates 1 Calendar Task, 1 Expense Record, and 1 Grocery Item simultaneously).
  3. **Quick Text / Paste:** Instant natural-language command bar with `#tag` and `@date` auto-detection.

## 2. The Unified Action Stream (Home Screen)
- Replace complex multi-tab navigation with a clean, prioritized daily feed organized into three collapsible horizons:
  - **Needs Action Today:** Overdue bills, time-sensitive tasks, expiring warranties, and high-priority reminders with 1-tap "Done", "Snooze", or "Delegate/Export" actions.
  - **Upcoming & Scheduled:** Chronological timeline of upcoming obligations, recurring maintenance intervals, and financial commitments.
  - **Smart Vault (Searchable Memory):** Instant offline search across every scanned receipt, warranty, note, and voice log using SQLite FTS5.

## 3. Autonomous Micro-Modules (Triggered Dynamically)
Only surface specialized views when the user has data for them:
- **Cashflow & Subscription Watchdog:** Tracks recurring charges detected from scanned bills/receipts, alerts users 3 days before renewal/price hikes, and calculates weekly/monthly spend without requiring invasive bank logins.
- **Asset & Maintenance Log:** Automatically groups receipts and photos tied to specific physical assets (vehicles, home appliances, tools) to build a complete service history and predict next maintenance intervals.
- **Plain-English Coach:** A daily/weekly local digest card that analyzes patterns and gives 1–3 concrete, plain-language recommendations (e.g., *"Your utility bill jumped 18% this month compared to your 6-month average"* or *"3 warranties expire next week"*).

## 4. Transparent Trust & Anti-Dark-Pattern Design
- **No Subscription Traps:** Include a clean, honest Settings -> Billing/Pro screen with 1-tap export/cancellation and full local data ownership.
- **Undo & Audit Trail:** Every AI-parsed action shows a subtle confidence indicator and a 1-tap "Edit Raw Data" drawer so the user always has final human-in-the-loop control.

---

# UI / UX DESIGN STANDARDS
- **Aesthetic:** High-contrast, tactile, calm utility (inspired by Braun physical hardware, Things 3, and Linear).
- **Theme:** True OLED Dark Mode (`#0A0A0C` background, `#141418` elevated cards, `#F4F4F6` crisp text, `#3B82F6` primary action accent, `#10B981` verified/paid state, `#F59E0B` warning state).
- **Ergonomics:** Thumb-friendly bottom-heavy layout; all primary actions reachable one-handed. Target 60fps animations using `react-native-reanimated`.
- **Resilience:** Graceful offline fallback—if no AI API or local LLM is reachable, queue captures locally in SQLite with a `"Pending AI Parse"` badge and process automatically once connection/model is restored.

---

# EXECUTION PLAN (BUILD STEP-BY-STEP)
1. **Scaffold & Schema:** Initialize the project structure, TypeScript configs, and SQLite + Drizzle database schema (`captures`, `action_items`, `transactions`, `assets`, `tags`).
2. **Storage & Offline Queue:** Implement local file storage for compressed images/audio and the offline processing queue.
3. **AI Extraction Pipeline:** Build the typed `AIService` with strict Zod validation schemas for multi-entity extraction (turning 1 raw input into multiple structured DB records).
4. **Core UI & Capture Dock:** Build the Unified Action Stream, the persistent Universal Capture Bar (Camera, Audio, Text), and the Human-in-the-Loop verification drawer.
5. **Search & Smart Modules:** Implement FTS5 instant search, the Asset Maintenance timeline, and the Plain-English Coach summary engine.

Begin by generating the complete project directory structure, the Drizzle SQLite database schema, and the Zod-validated `AIService` extraction module.
