Imported from wynnee0110/PhilForestry (
.agents/AGENTS.md). Install upstream withnpx skills add wynnee0110/PhilForestry --skill .agents. Copyright stays with the author.
PhilForestry Mobile - AI Agent & Developer Guidelines
Welcome to PhilForestry Mobile, an offline-first React Native application designed for field forestry data collection in the Philippines. This document outlines project conventions, technical architecture, and developer guidelines for AI agents and human contributors.
1. Project Overview & Domain
- Goal: Enable field foresters and researchers to record tree data, capture geo-tagged photos, map tree locations, and access native Philippine tree species information without requiring internet connectivity.
- Core Constraint: 100% Offline-First Functionality. All core features (database storage, spatial mapping, CSV export, camera capture) must operate seamlessly without a network connection.
2. Technology Stack Baseline
| Layer | Technology |
|---|---|
| Framework | React Native 0.86 with Expo SDK 57 |
| Language | TypeScript |
| Database | expo-sqlite (WAL mode enabled) |
| Location & Geo-tagging | expo-location & expo-sensors |
| Camera & Media | expo-camera & expo-file-system |
| Mapping | react-native-maps & @maplibre/maplibre-react-native |
| Navigation | @react-navigation/native (Bottom Tabs + Native Stack) |
| Data Export | expo-sharing (CSV file generation) |
3. Directory Structure
philforestry-mobile/
├── App.tsx # Entry point & root Navigation container
├── app.json # Expo configuration
├── assets/ # App icons, adaptive icons, splash screen
├── database/
│ └── db.ts # SQLite database setup, schema, & CRUD queries
├── screens/ # Application screen components
├── .gitignore # Git exclusion rules
├── AGENTS.md # Developer & AI Agent instructions
├── UPDATES.md # Project changelog & status tracking
├── package.json # NPM dependencies & scripts
└── tsconfig.json # TypeScript configuration
4. Coding & Architecture Conventions
-
Database Access (
database/db.ts):- Keep all SQLite queries centralized inside
database/db.ts. - Always use parameterized queries (
?) to prevent SQL injection and syntax errors. - Ensure WAL mode is active (
PRAGMA journal_mode = WAL;) for concurrent read/write performance.
- Keep all SQLite queries centralized inside
-
TypeScript & State Management:
- Maintain strict type safety across screens. Define interface models for Tree records, Species, and Location coordinates.
- Do not use
anyunless interacting with untyped third-party libraries.
-
Performance & Memory:
- Avoid loading unbounded datasets in memory at once. Use pagination or limits for large tree lists and map markers.
- Clean up camera preview sessions and location subscriptions when screens unmount.