Inspiration

Every day, millions of women make small, invisible calculations before stepping outside — is this street well-lit? Is there anyone around? Should I take the longer way? Standard navigation apps like Google Maps optimize for speed. They don't know — and don't care — whether the fastest route passes through a dark underpass at midnight.

We built HerPath AI because that gap felt wrong. Safety shouldn't be a manual calculation. It should be built into the route itself.


What it does

HerPath AI is an AI-powered walking navigation system that scores routes by safety, not just speed.

When a user enters a destination, the system:

  1. Generates multiple real walking routes via OpenRouteService
  2. Queries OpenStreetMap (Overpass API) for environmental risk signals along each path — streetlamp density, open venues, alleys, tunnels, and pedestrian infrastructure
  3. Passes all of that to an AI agent (Goose CLI) which reasons about the data and returns a structured safety recommendation
  4. Displays the routes on an interactive map with safety scores, risk factors, and contextual safety tips

Additional features:

  • Time-aware scoring — routes are weighted differently at night vs. day
  • Live walking mode — GPS tracks your position and trims the route line as you walk
  • Live location sharing — share your route with a trusted contact who sees your real-time position, updated every 5 seconds
  • Route comparison table — side-by-side safety metrics across all analyzed paths
  • Emergency SOS button — always visible on the results page
  • Auto geolocation — detects and reverse-geocodes your position on load

How we built it

Backend: Laravel 11 (PHP 8.3) with SQLite. A single SafetyScoringService orchestrates the full analysis pipeline.

AI layer — 3-tier cascade:

  • Tier 1 — Goose CLI: The primary agent. Laravel spawns it as a subprocess, passes route + OSM data via a YAML recipe, and parses the structured JSON response.
  • Tier 2 — Google Gemini: If Goose fails or times out, we fall back to the Google AI Studio REST API with a 6-model cascade (Flash 2.0 → Flash 1.5 → Pro → etc.) to handle rate limits gracefully.
  • Tier 3 — PHP rule engine: Pure deterministic scoring as a final fallback, using lighting score, pedestrian activity, and time-of-day weights.

Frontend: Laravel Blade templates with Leaflet.js for maps and Alpine.js for interactivity. All assets bundled locally via Vite — no CDN dependencies.

Data sources:

  • OpenRouteService — real walking route geometry
  • Overpass API / OpenStreetMap — environmental safety signals
  • Nominatim — reverse geocoding

Challenges we ran into

Multi-line template literals in Blade scripts. Our layout inlines all page scripts into a single <script type="module"> block. Blade's @push / @stack mechanism strips newlines in ways that break multi-line JavaScript template literals — causing silent SyntaxError: Invalid or unexpected token crashes that only appeared on certain routes. The fix was rewriting every template literal as a single-line string.

Goose CLI subprocess reliability. Spawning a CLI process per HTTP request is inherently fragile — timeouts, missing PATH variables on the web server user, and JSON parsing edge cases all had to be handled. The 3-tier fallback system was the solution.

Mobile map rendering. The full-screen Leaflet map wouldn't render correctly on mobile until invalidateSize() was called after layout paint. We added both setTimeout calls and a ResizeObserver to cover all cases.

Rate limits on Gemini. The free tier hits limits quickly during testing. The 6-model cascade was built specifically to keep the app functional during a live demo without needing a paid key.


Accomplishments that we're proud of

  • A fully working AI safety routing system built end-to-end in a hackathon timeframe
  • Real open data powering every safety score — no fake or hardcoded values
  • A 3-tier AI fallback that keeps the app alive even when the primary agent fails
  • Live location sharing that works without WebSockets — just polling and a UUID-based share URL
  • A clean, mobile-first UI with glass-morphism panels over a full-screen map

What we learned

  • Goose CLI is a powerful agentic tool but requires careful subprocess management in a web context
  • OpenStreetMap's Overpass API is remarkably rich for safety-relevant data — streetlamps, alleys, tunnels, and active venues are all queryable
  • Blade + Vite is a surprisingly capable stack for building interactive map UIs without a JS framework
  • Designing for safety is a different UX problem than designing for speed — the mental model of the user is fundamentally different

What's next for HerPath AI

  • Incident reporting — let users flag unsafe spots that feed back into future route scoring
  • Historical crime data integration — overlay public crime datasets where available
  • Saved routes and profiles — remember frequently walked paths and alert on changes to their safety score
  • Push notifications — alert a trusted contact if the sharer stops moving unexpectedly
  • Offline mode — cache route data for areas with poor connectivity
  • Expand beyond walking — late-night transit routing with safety-scored stop selections

Built With

Share this project:

Updates