# PixieSprout Codebase Briefing

Generated: 2026-06-06

Project root: `L:\`

Active app: Expo / React Native Android app

Android package: `com.danaman123.leafylanedemo`

Expo app name: `PixieSprout`

Current Android version: `versionName 1.0.109`, `versionCode 110`

Current release APK:

```text
L:\android\app\build\outputs\apk\release\app-release.apk
```

## Executive Summary

PixieSprout is a React Native / Expo Android app for plant tracking, scan-based plant identification, garden organization, care tasks, spaces, kit inventory, wishlist, settings, and a non-AI Plant Intelligence Foundation.

Most of the app UI and business logic currently lives in `App.tsx`. Scan Plant Mode is separated into `screens/PlantModeScreen.tsx`. Persistence and provider integrations live under `services/`. Shared data models live under `types/`.

The current project is a working Android demo/build with:

- Real scan/photo flow.
- Swappable plant identification provider architecture.
- Xiaomi MiMo currently selected as the active plant identification provider.
- Plant.id / Kindwise provider still implemented and available.
- Multi-photo scan requirements by plant type.
- Image compression before scan upload.
- Garden, Spaces, Kit, Wishlist, Care, Notifications, Settings, and Plant Detail flows.
- New Plant Detail intelligence organization: Identity, Environment, Setup, Care Readiness, and Progress & History.
- No generated care advice, diagnosis, pest detection, treatment plan, or fake AI recommendation logic.

## Tech Stack

Runtime and framework:

- React `18.3.1`
- React Native `0.76.9`
- Expo `~52.0.0`
- TypeScript `~5.3.3`
- Android native shell via Gradle/Kotlin
- Hermes release runtime

Expo / React Native dependencies:

- `expo-camera`
- `expo-image-picker`
- `expo-image-manipulator`
- `expo-file-system`
- `expo-haptics`
- `expo-document-picker`
- `expo-status-bar`
- `@react-native-community/datetimepicker`
- `react-native-safe-area-context`

Build tooling:

- Android Gradle wrapper
- Expo CLI
- EAS scripts are present, but local Gradle release builds have been used for device verification.

## Build and Test Commands

TypeScript check:

```powershell
cd L:\
npx.cmd tsc --noEmit
```

Release APK build:

```powershell
$env:JAVA_HOME='C:\Users\Dana\Documents\Codex\2026-05-29\files-mentioned-by-the-user-handoff\.tools\jdk17\jdk-17.0.19+10'
$env:Path="$env:JAVA_HOME\bin;$env:Path"
$env:NODE_ENV='production'
.\android\gradlew.bat -p android assembleRelease -PreactNativeArchitectures=arm64-v8a --console=plain
```

Install APK:

```powershell
& "$env:LOCALAPPDATA\Android\Sdk\platform-tools\adb.exe" install -r "L:\android\app\build\outputs\apk\release\app-release.apk"
```

Stop Gradle:

```powershell
$env:JAVA_HOME='C:\Users\Dana\Documents\Codex\2026-05-29\files-mentioned-by-the-user-handoff\.tools\jdk17\jdk-17.0.19+10'
$env:Path="$env:JAVA_HOME\bin;$env:Path"
.\android\gradlew.bat -p android --stop --console=plain
```

Latest verification state:

- `npx.cmd tsc --noEmit` passed.
- Android release build passed.
- APK installed successfully on device.
- Gradle daemon was stopped after build/install.

## Environment and Secrets

Important files:

```text
L:\.env
L:\.env.example
L:\.gitignore
L:\.secrets\plant_id_api_key.txt
```

`.env` is ignored by git and may contain real private keys.

`.env.example` contains placeholders only:

```text
EXPO_PUBLIC_PLANT_ID_API_KEY=your_plant_id_key_here
EXPO_PUBLIC_XIAOMI_TOKENPLAN_API_KEY=your_xiaomi_token_plan_key_here
EXPO_PUBLIC_XIAOMI_API_KEY=your_legacy_xiaomi_token_plan_key_here
FLAGSHIP_XIAOMI_PAYGO_API_KEY=your_xiaomi_paygo_web_key_here
XIAOMI_TOKENPLAN_OPENAI_BASE_URL=https://token-plan-sgp.xiaomimimo.com/v1
XIAOMI_TOKENPLAN_ANTHROPIC_BASE_URL=https://token-plan-sgp.xiaomimimo.com/anthropic
XIAOMI_PAYGO_OPENAI_BASE_URL=https://api.xiaomimimo.com/v1
EXPO_PUBLIC_PLANT_ARTWORK_PROVIDER=openai
EXPO_PUBLIC_OPENAI_API_KEY=your_openai_image_generation_key_here
EXPO_PUBLIC_PLANT_ARTWORK_MODEL=gpt-image-1
```

Expo public env caveat:

- Client-side Expo env variables must use static dot notation such as `process.env.EXPO_PUBLIC_PLANT_ID_API_KEY`.
- After adding or changing an `EXPO_PUBLIC_*` key, restart Metro and rebuild/reinstall Android release/dev builds.

## Complete Project Directory Structure

Generated and dependency folders are summarized because they are not source:

```text
L:\
  .env
  .env.example
  .gitignore
  app.json
  App.tsx
  babel.config.js
  demo-screen.png
  eas.json
  index.js
  package-lock.json
  package.json
  README.md
  tsconfig.json
  PixieSprout_BRIEFING.md

  .secrets\
    plant_id_api_key.txt

  constants\
    careTaskIcons.ts

  types\
    garden.ts
    plantScan.ts

  screens\
    PlantModeScreen.tsx

  services\
    gardenSelectors.ts
    gardenStorage.ts
    plantIdentificationService.ts
    plantScanStorage.ts

    plantArtwork\
      mockArtworkProvider.ts
      openAiArtworkProvider.ts
      plantArtworkProvider.ts
      promptBuilder.ts
      types.ts

    plantIdentification\
      imageOptimization.ts
      plantIdentificationProvider.ts
      plantIdProvider.ts
      types.ts
      xiaomiMimoProvider.ts

    plantReference\
      plantReferenceProvider.ts
      types.ts
      wikipediaProvider.ts

  assets\
    icon.png
    reference-mockups.jpg
    spaceArtwork.ts

    animations\
      identify\
        helper_fairy_idle_loop.webp
        helper_fairy_intro_once.webp

    brand\
      bell_notification_transparent_clipped.png
      leafy_lane_app_icon.png
      leafy_lane_brand_guide.png
      leafy_lane_logo_slogan.png
      pixiesprout_app_icon.png
      pixiesprout_brand_guide.png
      pixiesprout_logo_slogan.png

    care-icons\
      check_growth.png
      fertilize.png
      harvest.png
      inspect.png
      mist.png
      propagate.png
      prune.png
      reassess.png
      repot.png
      rotate.png
      treat.png
      water.png

    fonts\
      Fredoka.ttf
      NunitoSans.ttf

    graphics\
      area_art.jpg
      avatar.jpg
      basil_photo.jpg
      leaf_scan.jpg
      mascot_home.jpg
      mascot_small.jpg
      monstera_leaf.jpg
      monstera_room.jpg
      swap_plant.jpg

      handoff\
        bg_bottom_cream_fade.png
        bg_tropical_botanical_overlay.png
        ic_leafy_lane_leaf.png
        ic_task_camera.png
        ic_task_hibiscus_flower.png
        ic_task_leaf_neem.png
        ic_task_magnifying_glass.png
        ic_task_water_drop.png
        img_garden_hibiscus_card.png
        img_garden_leafy_card.png
        img_garden_monstera_card.png
        img_garden_round_leaf_card.png
        img_level_badge_base.png

      ui_spec\
        garden_pot_1.png
        garden_pot_2.png
        garden_pot_3.png
        garden_pot_4.png
        leaf_edge_left.png
        leaf_edge_right.png

      update_packet\
        nav_care.png
        nav_community.png
        nav_home.png
        nav_identify.png
        nav_plant.png
        nav_remind.png
        welcome_fairy_cutout.png

    home\
      garden-snapshot-frame.png

    icons\
      nav\
        leafy_lane_nav_care.png
        leafy_lane_nav_community.png
        leafy_lane_nav_home.png
        leafy_lane_nav_identify.png
        leafy_lane_nav_plant.png
        leafy_lane_nav_remind.png

    identify\
      camera_capture_button.png
      camera_flash_button_circle.png
      camera_flash_icon_green.png
      camera_gallery_button_circle.png
      camera_gallery_icon_green.png
      camera_viewfinder_corners_component.png
      option_plant_potted_icon.png
      option_problem_leaf_magnifier_icon.png
      option_seed_packet_tag_icon.png

    pixiesprout\
      background_nav_fix\
      background_update\
      exact_assets_update\
      executive_background_nav\
      final_codex_update\
      final_ui_patch_v2\
      garden_nav_update\
      generated_nav\
      home_redesign\
      home_refresh_clean\
      nav_bar_assets\
      nav_fix\
      nav_refinement\
      rollback_direct_nav\
      settings\
        watermill_settings_icon.png
      surgical_bugfix\

    screens\
      area.jpg
      care_plan.jpg
      community.jpg
      diagnosis.jpg
      garden_fairy.jpg
      home.jpg
      identify.jpg
      plant_profile.jpg
      plant_swap.jpg
      reminders.jpg

    spaces\
      balcony.png
      bathroom.png
      bedroom.png
      garden-bed.png
      garden-clean.jpg
      garden-clean.png
      garden-space-art.png
      garden.jpg
      greenhouse.png
      grow-tent.png
      kitchen.png
      living-room.png
      nursery.png
      office.png
      orchard.png
      patio.png
      plant-shelf.png
      propagation-station.png
      raised-bed.png
      seed-starting-area.png
      windowsill.png

    ui\
      title_flower.png
      title_sparkle.png

  android\
    .gitignore
    build.gradle
    gradle.properties
    gradlew
    gradlew.bat
    local.properties
    settings.gradle

    gradle\
      wrapper\
        gradle-wrapper.properties

    app\
      build.gradle
      proguard-rules.pro

      src\
        debug\
          AndroidManifest.xml

        main\
          AndroidManifest.xml

          java\
            com\
              danaman123\
                leafylanedemo\
                  EdgeToEdgeModule.kt
                  EdgeToEdgePackage.kt
                  MainActivity.kt
                  MainApplication.kt

          res\
            drawable\
              ic_launcher_background.xml
              rn_edit_text_material.xml
            drawable-hdpi\
              splashscreen_logo.png
            drawable-mdpi\
              splashscreen_logo.png
            drawable-xhdpi\
              splashscreen_logo.png
            drawable-xxhdpi\
              splashscreen_logo.png
            drawable-xxxhdpi\
              splashscreen_logo.png
            mipmap-anydpi-v26\
              ic_launcher.xml
              ic_launcher_round.xml
            mipmap-hdpi\
              ic_launcher.webp
              ic_launcher_foreground.webp
              ic_launcher_round.webp
            mipmap-mdpi\
              ic_launcher.webp
              ic_launcher_foreground.webp
              ic_launcher_round.webp
            mipmap-xhdpi\
              ic_launcher.webp
              ic_launcher_foreground.webp
              ic_launcher_round.webp
            mipmap-xxhdpi\
              ic_launcher.webp
              ic_launcher_foreground.webp
              ic_launcher_round.webp
            mipmap-xxxhdpi\
              ic_launcher.webp
              ic_launcher_foreground.webp
              ic_launcher_round.webp
            values\
              colors.xml
              strings.xml
              styles.xml
            values-night\
              colors.xml

  work\
    QA screenshots, XML dumps, Xiaomi smoke-test images, scan proofs, settings/header proofs.

  node_modules\
    Installed npm dependencies. Generated; not source.

  android\.gradle\
  android\build\
  android\app\build\
    Generated Android build output. Not source.
```

## Root Files

### `App.tsx`

Main application file. This is the largest and most important file in the project.

Responsibilities:

- App shell and top-level state.
- Bottom navigation.
- Shared header components.
- Home screen.
- Garden screen and subsections.
- Plants list and manual Add Plant form.
- Spaces list, Space Detail, Add/Edit Space forms.
- Kit list, Kit Detail, Add/Edit Kit forms.
- Care task list and detail expansion.
- Notification Center and quick actions.
- Settings panel.
- Community placeholder screen.
- Plant Detail screen.
- Space Detail screen.
- Garden sample data and saved plant data integration.
- Care task derivation and notification generation.
- Plant Intelligence Foundation computation and UI.

Important current components/functions in `App.tsx`:

- `HeaderActionBar`: shared Settings wheel / Notification bell placement.
- `Header`: shared title/back header.
- `NotificationCenter`: notification panel.
- `SettingsPanel`: reminder time, household safety, birthday, wishlist/privacy placeholders.
- `CarePlan`: Care tab UI.
- `buildCareTasks`: derives care task list.
- `buildCareNotifications`: derives care notifications.
- `buildPlantIntelligenceSummary`: computes missing context and next best action for Plant Detail.
- `AppContent`: top-level app composition and state orchestration.

Current Plant Detail organization:

- Identity
- Environment
- Setup
- Care Readiness
- Progress & History
- Plant Photo
- Delete Plant
- Notes

The old generated-looking Care Summary / Toxicity display was removed from saved Plant Detail to keep the launch version from implying fake care/safety intelligence.

### `index.js`

Expo entrypoint. Registers the root app component.

### `package.json`

Defines npm scripts and dependencies.

Important scripts:

```json
{
  "start": "expo start",
  "android": "expo run:android",
  "build:apk": "npx eas-cli build -p android --profile preview",
  "build:local-apk": "npx eas-cli build -p android --profile preview --local",
  "ios": "expo run:ios"
}
```

### `app.json`

Expo app configuration.

Important values:

- App name: `PixieSprout`
- Slug: `pixiesprout`
- Android package: `com.danaman123.leafylanedemo`
- Android version code: `110`
- App icon: `./assets/brand/pixiesprout_app_icon.png`
- Splash image: `./assets/brand/pixiesprout_app_icon.png`
- DateTimePicker plugin enabled.

### `README.md`

Short project overview and basic build instructions. It still describes the app as a demo and includes notes about local Plant.id env setup.

### `babel.config.js`

Expo Babel preset configuration.

### `tsconfig.json`

TypeScript configuration.

### `eas.json`

EAS build profile file.

### `.gitignore`

Ignores dependency, environment, secret, and generated build folders:

- `node_modules/`
- `.expo/`
- `.env`
- `.env.local`
- `.env.*.local`
- `.secrets/`
- `android/.gradle/`
- `android/build/`
- `android/app/build/`
- `*.jar`
- `*.lock`
- `*.keystore`

## Type Models

### `types/garden.ts`

Defines most of the Garden/Spaces/Kit/Care/Settings data model.

Important types:

- `SpaceType`
- `RoomProfile`
- `GardenPlant`
- `KitItem`
- `PlantSetupProfile`
- `PlantEvent`
- `CareTaskActionState`
- `CareTaskDetailMetadata`
- `AppSettings`
- `PlantNotification`
- `WishlistItem`

Current `SpaceType` values:

```text
bedroom
living_room
kitchen
bathroom
office
nursery
balcony
patio
greenhouse
grow_tent
windowsill
propagation_station
seed_starting_area
garden
orchard
```

Current environment model:

- Indoor/outdoor classification is derived by space type.
- Indoor spaces use window direction and light profile.
- Outdoor spaces use sun timing and outdoor light quality.
- Spaces own ambient/shared artificial light:
  - `usesAmbientArtificialLight`
  - `ambientArtificialLightTypes`
  - `ambientArtificialLightHoursPerDay`
- Plant setup owns dedicated plant light:
  - `usesDedicatedArtificialLight`
  - `dedicatedArtificialLightTypes`
  - `dedicatedArtificialLightHoursPerDay`
  - `dedicatedArtificialLightDistance`

Future timeline model:

```ts
export type PlantEvent = {
  id: string;
  plantId: string;
  createdAt: string;
  eventDate: string;
  type: PlantEventType;
  title: string;
  note?: string;
  photoUri?: string;
  relatedCareTaskId?: string;
  relatedScanResultId?: string;
  relatedKitItemId?: string;
  source: PlantEventSource;
};
```

Supported event types:

```text
progress_photo
new_leaf
growth_measurement
flowering
fruiting
pruning
repotting
pest_observation
disease_observation
treatment
care_completed
care_skipped
identification
setup_change
space_change
milestone
custom
```

Event sources:

```text
user
scan
care
ai
system
```

### `types/plantScan.ts`

Defines scan and saved plant identity models.

Important types:

- `PlantType`
- `LocationContext`
- `SavedPlantIdentificationDetails`
- `SavedPlantIdentificationSuggestion`
- `PlantGrowthStage`
- `PlantTimeOwned`
- `SavedPlantProfile`

Current `PlantType` values:

```text
houseplant
tree
garden
crop
garden_crop
cutting
unsure
```

`SavedPlantProfile` includes:

- saved image/photo URI
- common name
- scientific name
- scan confidence
- alternate suggestions
- scan provider details
- optional identification record
- growth stage
- time owned
- assigned space fields
- setup completion flag
- manual notes
- source: `plant_scan` or `manual_garden`

Some older fields remain for compatibility, such as `careSummary`, `toxicityWarning`, and watercolor icon fields. Launch UI no longer depends on AI-generated artwork.

## Services

### `services/gardenStorage.ts`

Local app persistence and migration/normalization.

Storage backend:

- `expo-file-system`
- JSON files under app document storage.

Exports:

- `createGardenId`
- `emptyGardenInfrastructureState`
- `defaultAppSettings`
- `loadSavedPlantProfiles`
- `saveSavedPlantProfiles`
- `loadWishlistItems`
- `saveWishlistItems`
- `loadCareTaskActionStates`
- `saveCareTaskActionStates`
- `resetCareTaskActionStates`
- `loadPlantNotificationStates`
- `savePlantNotificationStates`
- `loadAppSettings`
- `saveAppSettings`
- `loadGardenInfrastructure`
- `saveGardenInfrastructure`
- `normalizeSavedPlantProfile`
- `inferSpaceType`
- `inferLightProfile`
- `inferHumidityProfile`
- `normalizeRoomProfile`
- `migratePlantSpaceLinks`
- `createManualPlantProfile`
- `updateSavedPlantProfile`
- `createRoomProfile`
- `updateRoomProfile`
- `createKitItem`
- `updateKitItem`
- `createPlantSetupProfile`
- `updatePlantSetupProfile`

Migration-safe behavior:

- Normalizes older saved plant records.
- Preserves legacy space links.
- Migrates older Garden Bed / Raised Bed space concepts toward the current `garden` space type.
- Maps previous generic artificial light to ambient space artificial light.
- Defaults new Kit safety fields to `unknown`.

### `services/gardenSelectors.ts`

Garden lookup helpers.

Exports:

- `normalizeGardenName`
- `resolvePlantSpaceId`
- `getPlantsForSpace`
- `findSpaceForPlant`

Used to resolve legacy space names/ids and connect plants to spaces.

### `services/plantScanStorage.ts`

Persists scan results separately from saved plants.

Storage path:

```text
pixiesprout-garden/plant-scan-results.json
```

Exports:

- `savePlantScanResult`
- `updatePlantScanResult`

### `services/plantIdentification/plantIdentificationProvider.ts`

Swappable provider entrypoint.

Current active provider:

```ts
let activeProvider: PlantIdentificationProvider = xiaomiMimoProvider;
```

Exports:

- `setPlantIdentificationProvider`
- `getPlantIdentificationProvider`
- `identifyPlant`

This is the key abstraction that allows future provider swaps without rewriting Scan UI.

### `services/plantIdentification/plantIdProvider.ts`

Plant.id / Kindwise v3 provider.

Endpoint:

```text
https://api.plant.id/v3/identification
```

Auth:

```text
Api-Key: <EXPO_PUBLIC_PLANT_ID_API_KEY>
```

Request shape:

```json
{
  "images": ["<raw-base64-image>"]
}
```

Provider behavior:

- Reads `process.env.EXPO_PUBLIC_PLANT_ID_API_KEY` using static dot notation.
- Trims key whitespace.
- Logs only safe debug info in dev.
- Optimizes images before upload.
- Requests useful detail fields where supported.
- Maps Plant.id classification results into generic `PlantIdentificationResult`.
- Throws typed `PlantIdentificationError` for missing key, auth failure, network failure, provider failure, or no confident result.

### `services/plantIdentification/xiaomiMimoProvider.ts`

Xiaomi MiMo multimodal provider.

Endpoint:

```text
https://token-plan-sgp.xiaomimimo.com/v1/chat/completions
```

Model:

```text
mimo-v2.5
```

Env keys:

- `EXPO_PUBLIC_XIAOMI_TOKENPLAN_API_KEY`
- fallback `EXPO_PUBLIC_XIAOMI_API_KEY`

Provider behavior:

- Sends image input through OpenAI-compatible chat completions format.
- Uses a strict plant-identification-only prompt.
- Explicitly tells the model not to provide care advice, diagnosis, pest diagnosis, treatment plans, toxicity claims, or safety claims.
- Parses line-based model output into `PlantIdentificationResult`.
- Uses provider name `xiaomi-mimo`.

Important current state:

- This is currently the active scan identification provider.
- Plant.id remains implemented but is not the active provider unless switched through the abstraction.

### `services/plantIdentification/imageOptimization.ts`

Optimizes selected scan photos before upload.

Current settings:

- Max dimension: `1024px`
- JPEG quality: `0.7`
- Uses `expo-image-manipulator`
- Outputs base64 upload images
- Logs optimized base64 length

Privacy note:

- Includes TODO to keep stripping GPS/location metadata before upload or public sharing.

### `services/plantIdentification/types.ts`

Generic plant identification provider contract.

Important types:

- `PlantIdentificationProviderName`
- `PlantScanPhotoRole`
- `PlantScanPhoto`
- `PlantIdentificationInput`
- `PlantIdentificationSuggestion`
- `PlantIdentificationResult`
- `PlantIdentificationError`

Supported provider names:

```text
plant.id
xiaomi-mimo
claude
unknown
```

Photo roles:

```text
whole
leaf
flower
bark
cutting
```

Error codes:

```text
NO_IMAGE
MISSING_API_KEY
NETWORK_FAILURE
AUTH_FAILURE
NO_CONFIDENT_RESULT
PROVIDER_UNAVAILABLE
```

### `services/plantReference/plantReferenceProvider.ts`

Small wrapper around the active reference lookup provider. Currently uses Wikipedia.

On lookup failure, returns `null` without blocking scan results.

### `services/plantReference/wikipediaProvider.ts`

Looks up plant reference pages through Wikipedia.

Lookup order:

1. Scientific name.
2. Common name.
3. Display name.

Uses:

- Wikipedia REST page summary endpoint.
- Wikipedia search API fallback.

Rejects disambiguation pages when possible.

### `services/plantReference/types.ts`

Defines:

- `PlantReferenceSource`
- `PlantReferenceLookupInput`
- `PlantReferenceResult`
- `PlantReferenceProvider`

Current source:

```text
Wikipedia
```

### `services/plantArtwork/plantArtworkProvider.ts`

Future artwork generation abstraction.

Current launch state:

```ts
const ENABLE_AI_ARTWORK = false;
```

Because AI-generated watercolor plant icons are out of scope for launch, this provider is inactive and no launch UI calls it.

### `services/plantArtwork/openAiArtworkProvider.ts`

Future OpenAI image generation implementation. Present but inactive while `ENABLE_AI_ARTWORK` is false.

### `services/plantArtwork/mockArtworkProvider.ts`

Development-only mock artwork provider. Present but inactive.

### `services/plantArtwork/promptBuilder.ts`

Builds PixieSprout-style watercolor icon prompts for the future artwork flow.

### `services/plantArtwork/types.ts`

Defines artwork provider input, result, style preset, provider names, and error types.

## Screens

### `screens/PlantModeScreen.tsx`

Dedicated Scan > Plant Mode screen.

Responsibilities:

- Plant type selection.
- Adaptive photo requirements by plant type.
- Photo capture and photo library selection.
- Compact photo-slot layout.
- Helpful details fields.
- Identification request submission.
- Loading copy rotation.
- Error handling.
- Result display.
- Wikipedia link display.
- Save Scan.
- Add to Garden.
- Add to Wishlist.
- Scan Again.

Current plant type requirements:

General plant types:

- Houseplant
- Garden
- Crop
- Unsure

Required:

- Whole plant photo
- Leaf close-up

Optional:

- Flower close-up

Tree:

Required:

- Whole tree / branch structure
- Leaf close-up

Optional:

- Bark close-up
- Flower / fruit close-up

Cutting:

Required:

- Cutting photo

Optional:

- Leaf close-up

Provider input:

- Sends only visible/relevant selected photos.
- Uses role metadata for whole, leaf, flower, bark, cutting.

Important UX rules:

- Scan does not show Settings wheel or Notification bell.
- Missing API key or provider error does not fall back to mock plant data.
- Result language stays cautious: possible match, Pixie thinks this may be, confidence.
- No care advice, diagnosis, pest diagnosis, treatment plan, toxicity, or safety claims.

## Constants

### `constants/careTaskIcons.ts`

Maps care task text to icon assets.

Supported icon types:

```text
water
inspect
prune
rotate
mist
repot
fertilize
treat
harvest
propagate
check_growth
reassess
```

Exports:

- `CARE_TASK_ICONS`
- `getCareTaskIconSource`

## Assets

### Important asset groups

`assets/brand/`

- PixieSprout icon, logo, brand guide, notification bell.

`assets/pixiesprout/settings/watermill_settings_icon.png`

- Current Settings wheel/watermill icon.

`assets/care-icons/`

- Custom care task icons used by Care.

`assets/spaces/`

- Space artwork for Bedroom, Bathroom, Patio, Balcony, Garden, etc.
- Current Garden artwork is `garden-space-art.png`.

`assets/spaceArtwork.ts`

- Maps each `SpaceType` to its artwork.

Current mapping includes:

```ts
garden: require('./spaces/garden-space-art.png')
```

`assets/home/garden-snapshot-frame.png`

- Garden Snapshot visual frame.

`assets/identify/`

- Camera and scan mode visual assets.

`assets/fonts/`

- `Fredoka.ttf`
- `NunitoSans.ttf`

`assets/screens/`

- Reference screen imagery from earlier design work.

`assets/graphics/` and `assets/pixiesprout/`

- Large library of historical, generated, and reference visual assets. Not all are actively used.

### Active visual style

PixieSprout currently uses:

- Cream cards.
- Sage/green headings.
- Rounded corners.
- Soft shadows.
- Cozy spacing.
- Custom watercolor/botanical imagery.
- Bottom navigation with custom icons.
- Standalone Settings watermill icon with no circle background.
- Notification bell in shared header actions, hidden on Scan.

## Android Native Project

### `android/app/build.gradle`

Android app build configuration.

Important values:

- Namespace: `com.danaman123.leafylanedemo`
- Application ID: `com.danaman123.leafylanedemo`
- Version code: `110`
- Version name: `1.0.109`
- ABI filter: `arm64-v8a`
- Release build currently signs with debug signing config.
- Hermes enabled through React Native / Expo defaults.

### `android/app/src/main/AndroidManifest.xml`

Declares Android permissions:

- `CAMERA`
- `INTERNET`
- `READ_MEDIA_IMAGES`
- `READ_EXTERNAL_STORAGE`
- `SYSTEM_ALERT_WINDOW`
- `VIBRATE`
- `WRITE_EXTERNAL_STORAGE`

Also defines launcher activity and deep link scheme:

```text
com.danaman123.leafylanedemo
```

### Native Kotlin files

```text
android/app/src/main/java/com/danaman123/leafylanedemo/MainActivity.kt
android/app/src/main/java/com/danaman123/leafylanedemo/MainApplication.kt
android/app/src/main/java/com/danaman123/leafylanedemo/EdgeToEdgeModule.kt
android/app/src/main/java/com/danaman123/leafylanedemo/EdgeToEdgePackage.kt
```

Purpose:

- Standard React Native Android activity/application setup.
- Custom edge-to-edge module/package used by Scan flow.

## Native Dependency Patch

Important caveat:

The Android birthday date picker header year affordance has a direct patch in `node_modules`:

```text
L:\node_modules\@react-native-community\datetimepicker\android\src\main\java\com\reactcommunity\rndatetimepicker\RNDatePickerDialogFragment.java
```

Patch behavior:

- Styles existing native `date_picker_header_year`.
- Displays `1986 ▾`.
- Uses `setTextSize(22)`.
- Uses `Typeface.BOLD`.
- Does not add a duplicate year field.

This patch is not durable if dependencies are reinstalled. If `npm install` or dependency cleanup resets `node_modules`, this patch must be reapplied or converted to `patch-package` or a native fork.

## App Features and Current State

### Home

Current state:

- Cozy PixieSprout home screen.
- Garden Snapshot.
- Task summary/navigation.
- Bottom nav.
- Shared header actions, except Scan.

Do not casually redesign Home, Garden Snapshot, headers, or bottom navigation without explicit request.

### Garden

Current sections include:

- Plants
- Spaces
- Kit
- Wishlist

Current state:

- Manual Add Plant is simplified.
- Manual Add Plant collects:
  - common name
  - optional scientific name
  - plant type
  - optional photo
  - notes
  - growth stage
  - time owned
- Manual Add Plant does not ask users to guess care difficulty, watering schedule, safety status, organic status, or detailed setup.
- After manual plant creation, setup is incomplete by default and Plant Detail prompts for setup details.

Wishlist:

- Local Wishlist foundation exists.
- Scan result can add top suggestion to Wishlist.
- Garden displays Wishlist cards.

### Plant Detail

Current major sections:

1. Identity
2. Environment
3. Setup
4. Care Readiness
5. Progress & History
6. Plant Photo
7. Delete Plant
8. Notes, when present

Identity shows:

- Display/common name.
- Scientific name when available.
- Identification source.
- Scan confidence when available.
- Scan date when available.
- Wikipedia/reference link when available.
- Scan identification disclaimer when from scan.
- Alternate suggestions when available.
- User scan notes when available.

Environment shows:

- Assigned space.
- Indoor/outdoor context.
- Window direction or outdoor sun timing.
- Light quality.
- Ambient artificial light.
- Environment photo status.
- ZIP/nearby city context when available.

Setup shows:

- Planting/container type.
- Pot size when applicable.
- Drainage when applicable.
- Growing medium/soil.
- Dedicated plant light.
- Setup photo status.
- Setup completed status.
- Linked kit item count.

Care Readiness:

- Gentle readiness summary based only on missing data.
- Missing context checklist.
- One next best action.
- No care advice or AI recommendation.

Progress & History:

- Placeholder section.
- No full event creation UI yet.
- Prepared for future progress photos, care history, growth milestones, pest observations, disease observations, treatments, and custom events.

### Spaces

Current state:

- Spaces own environment/location context.
- Plant Setup owns plant-specific planting/container details.
- Plant Setup no longer changes assigned space.
- Spaces are the place to assign/remove existing plants.
- Spaces cannot create brand-new plants.

Current space types:

Inside:

- Bathroom
- Bedroom
- Grow Tent
- Kitchen
- Living Room
- Nursery
- Office
- Propagation Station
- Seed Starting Area
- Windowsill

Outside:

- Balcony
- Garden
- Greenhouse
- Orchard
- Patio

Garden Bed and Raised Bed are no longer offered as top-level Space types. They remain plant setup/planting types for outdoor plants.

Space environment fields:

- Indoor/outdoor type derived from `SpaceType`.
- Indoor window direction.
- Indoor light level/profile.
- Outdoor sun timing.
- Outdoor light quality.
- Humidity.
- Temperature.
- Environment photo.
- Ambient artificial light.
- App-level approximate ZIP/city context.

### Plant Setup

Current state:

- Setup is plant-specific.
- It does not edit space environment fields.
- It does not change assigned space.

Setup fields:

- Assigned space summary read-only.
- Pot/planting type.
- Pot size if container.
- Drainage holes if container.
- Growing medium/soil.
- Supplies / linked Kit items.
- Setup notes.
- Setup photo.
- Dedicated plant light.

Indoor setup options:

- Nursery pot
- Plastic pot
- Terracotta pot
- Ceramic pot
- Self-watering pot
- Hanging basket
- Other container

Outdoor setup options:

- In ground
- Garden bed
- Raised bed
- Outdoor container
- Other

When planting type is in-ground/garden-bed/raised-bed:

- Pot size hidden or N/A.
- Drainage hidden or N/A.
- Soil/growing medium remains visible.

### Scan

Current state:

- Scan page has no Settings wheel or Notification bell.
- Scan chooser and Plant Mode are focused/immersive.
- Plant Mode is active for identification.
- Disease diagnosis, pest diagnosis, treatment plans, and community sharing are not implemented.

Scan flow:

1. User selects Plant Mode.
2. User selects Plant Type.
3. App displays relevant photo requirements.
4. User takes or chooses required photos.
5. User fills optional helpful details.
6. Identify Plant calls provider service.
7. Results show top suggestion, confidence, names, alternatives, and optional Wikipedia link.
8. User can Add to Garden, Add to Wishlist, Save Scan, or Scan Again.

Result wording:

- Uses cautious identification language.
- Does not say guaranteed or definite.
- Includes calm trust message.

### Plant Identification Providers

Provider architecture:

- UI calls `identifyPlant` from `plantIdentificationProvider.ts`.
- Active provider can be swapped without rewriting Scan UI.

Current active provider:

```text
xiaomi-mimo
```

Available provider:

```text
plant.id
```

No mock identification fallback is active in normal Scan flow.

### Wikipedia Reference Lookup

Current state:

- Scan result attempts Wikipedia lookup after successful identification.
- Lookup failure does not block Scan result.
- Link appears as "Read more on Wikipedia" when found.
- Reference fields persist into saved scan/plant identification details.

### Kit

Current state:

- Kit manual entry collects user-knowable fields:
  - product name
  - brand
  - category
  - kit photo
  - notes
- Kit photo can be selected/replaced and saved.
- Safety/organic fields are read-only Unknown:
  - Organic status: Unknown
  - Edible plant safety: Unknown
  - Pet/child caution: Unknown
- No OCR, barcode scanning, AI parsing, or safety interpretation is implemented.

Kit trust message:

```text
Always check the original product label. Pixie may help summarize information, but manufacturer instructions and safety guidance should take priority.
```

### Care

Current state:

- Care tab is a task list.
- Due tasks support Complete and Skip.
- Snooze is removed from Care tasks.
- Reminder timing lives in Notification Center.
- Future care tasks are informational.
- No fake AI care advice is generated.

### Notifications

Current state:

- Notification Center exists.
- Notification categories:
  - Action Needed
  - Reminder
  - Insight
  - Achievement
  - Community
- Notifications have category, reason, related entity metadata, and optional destination/action labels.
- Notification rows can navigate to relevant detail where supported.
- Quick actions remain available:
  - Complete
  - Remind me later
  - Remind after work
  - Dismiss

After Work:

- Uses saved After Work Reminder Time from Settings.
- Label makes timing explicit.

### Settings

Current state:

- Settings panel exists.
- Watermill Settings icon is global header action, hidden on Scan.
- Notification bell is global header action, hidden on Scan.
- Reminder time fields.
- After Work Reminder Time uses native time picker.
- Birthday uses native date picker.
- Household safety preferences.
- Wishlist visibility.
- Approximate ZIP/city foundation.
- AI/privacy placeholders.

### Community

Current state:

- Placeholder/community section exists.
- No sharing, gifting, marketplace, or community scan sharing is built.

## Persistence Details

Runtime app data is persisted with `expo-file-system` under:

```text
FileSystem.documentDirectory/pixiesprout-garden/
```

Files:

```text
saved-plants.json
wishlist-items.json
garden-infrastructure.json
care-task-actions.json
notification-states.json
app-settings.json
plant-scan-results.json
```

### `saved-plants.json`

Stores saved Garden plants.

Contains `SavedPlantProfile[]`.

Preserves:

- scan image
- common/scientific name
- confidence
- alternate suggestions
- scan provider
- scan result id
- reference/Wikipedia link
- manual notes
- setup completion flag
- assigned space references

### `wishlist-items.json`

Stores wishlist items created from scan results.

Contains:

- id
- createdAt
- source
- imageUri
- commonName
- scientificName
- confidence
- notes
- scanResultId
- wishlistVisibility

### `garden-infrastructure.json`

Stores the infrastructure state:

- rooms/spaces
- room order
- kit items
- kit order
- plant setup profiles
- sample plants
- garden order
- legacy sample watercolor icons

### `care-task-actions.json`

Stores task action state:

- completed
- skipped
- snoozed/reminder state compatibility
- updated timestamps

Care task snooze is not used by Care task UI now, but older state normalization still supports it for compatibility.

### `notification-states.json`

Stores notification read/dismiss/reminder/snooze state.

### `app-settings.json`

Stores:

- reminder preferences
- after work reminder time
- household safety preferences
- profile/community preferences
- wishlist visibility
- approximate location context
- photo privacy preferences
- AI personalization placeholders
- care preference placeholders

### `plant-scan-results.json`

Stores raw/normalized plant scan results before or after Add to Garden.

## Plant Intelligence Foundation

Current state:

- Non-AI only.
- No generated recommendations.
- No care plan generation.
- No diagnosis.
- No treatment suggestions.

Derived summary fields:

- `hasIdentification`
- `hasScientificName`
- `hasAssignedSpace`
- `hasEnvironmentDetails`
- `hasEnvironmentPhoto`
- `hasSetupDetails`
- `hasSetupPhoto`
- `hasDedicatedLightInfo`
- `hasProgressHistory`
- `linkedKitCount`
- `missingContext[]`
- `nextBestAction`

Next best action priority:

1. Missing identification: `Review or add plant identification.`
2. Missing assigned space: `Assign this plant to a space.`
3. Missing setup details: `Add setup details.`
4. Missing environment details: `Complete this space's environment details.`
5. Missing setup photo: `Add a setup photo.`
6. Missing environment photo: `Add an environment photo.`
7. Missing progress history: `Add a first progress photo.`
8. Complete enough: `Pixie has a good starting picture for this plant.`

## Launch Scope Boundaries

Do not add without explicit request:

- Fake AI care advice.
- Plant disease diagnosis.
- Pest diagnosis.
- Treatment plans.
- Toxicity/safety claims.
- Community sharing.
- Marketplace/swaps.
- Birthday gifting.
- AI-generated wishlist recommendations.
- AI-generated watercolor plant icons in launch UI.

Current launch visual assumptions:

- Plant cards/details prefer:
  1. user-selected plant photo
  2. scan image
  3. default placeholder plant artwork

## Known Caveats

1. Most app logic is concentrated in `App.tsx`.
   - This works for rapid iteration but creates a large file with many responsibilities.
   - Future maintainability would benefit from extracting Garden, Care, Settings, Notification, and detail components.

2. Active plant identification provider is Xiaomi MiMo.
   - Plant.id provider is implemented, but not currently the active provider.
   - Provider choice is controlled in `services/plantIdentification/plantIdentificationProvider.ts`.

3. Direct `node_modules` DateTimePicker patch is fragile.
   - Reinstalling dependencies may remove it.

4. `.env` is required for runtime provider keys.
   - Expo public env changes require restart/rebuild.

5. `work/` and root `pixiesprout-*.png` files are QA artifacts.
   - They are useful for historical verification but not app source.

6. Several historical asset folders remain.
   - Not every asset under `assets/pixiesprout/` or `assets/graphics/` is actively used.

7. Release builds currently use debug signing.
   - Production launch will need a real release keystore and signing setup.

## Strong Constraints to Preserve

- Do not redesign Home, Garden Snapshot, plant cards, Spaces artwork, headers, bottom navigation, notification behavior, or care behavior unless explicitly requested.
- Do not reintroduce Settings wheel or Notification bell on Scan.
- Do not reintroduce mock Monstera/87% scan results.
- Do not generate fake care advice.
- Keep care content conservative and future-personalization-safe.
- Keep PixieSprout style: cream cards, rounded corners, soft shadows, sage/green headings, cozy spacing.
- Avoid aggressive gamification, noisy alerts, bright warning colors, or guilt/nag copy.
- Settings wheel size and notification bell placement are currently accepted.
- Plant.id is for identification only, not artwork generation.
- AI artwork generation is disabled for launch.

