name: delivery-driver description: Driver delivery portal — route optimisation, photo proof, communal delivery, distance tracking, admin escalation. Use when building any driver feature. allowed-tools: Read, Write, Grep, Glob, Bash
Delivery Driver System
CRITICAL RULES
- NEVER auto-mark delivered without photo. Photo proof mandatory.
- NEVER skip communal detection. Same address (50m GPS radius) MUST be grouped.
- NEVER expose other customers' data beyond delivery needs (name, address, phone, items).
- GPS logging opt-in with clear "Location tracking active" indicator.
Route optimisation: Nearest-Neighbour with Zone Grouping
- Start: Canberra Airport (or driver GPS)
- Group stops by delivery_zone
- Order zones by highway: Canberra → Yass → Wagga → Junee → Griffith → Leeton
- Within each zone: nearest-neighbour from previous stop
- Use Mapbox Directions API for distance/time between stops
Delivery checklist per stop:
- Tap "Arrived" → logs GPS + timestamp
- Hand over fish
- Tap "Take Photo & Deliver" → camera → photo saved with GPS
- If communal → show communal flow
- Stop marked delivered → advance to next
Communal delivery (2+ customers at same address):
- Detected at run creation: ST_Distance < 50m between stops
- Both stops get is_communal=true, same communal_group_id
- If Customer B present: normal delivery, no escalation
- If Customer B absent, left with Customer A: proxy delivery, admin escalation required
- delivery_proofs.is_proxy_delivery = true, admin_approval_required = true
Distance tracking:
- GPS logged every 60 seconds during active run
- Total distance calculated from logs on completion (Haversine)
- Cache run data at start for offline use in rural dead zones
- Compress photos to 1MB client-side before upload
- Queue uploads when offline, sync when connected