Repository navigation
What's new
HabitEngine v1.0
Learns recurring trip patterns from history — (stop, route, direction, day-of-week, 2-hour bucket) groups scored by count × recency decay × time-window precision. When a habit fires (confidence ≥ 0.75), V3/V4/V5 inference is skipped and the SMS surfaces the known destination: "Usual trip to Spadina Station." Habit change detection marks old patterns stale when a new one emerges in the same time slot.
NetworkEngine v1.1–v1.3
- v1.1 — Route-stop index + transfer index. Tracks which routes serve each stop and which route pairs connect at transfer points.
- v1.2 — Hour-slot travel time buckets.
durationsByHour[hour]on each edge; anomaly detection and staleness checks use the hour-specific median when ≥3 observations exist. - v1.3 — Transitive reachability.
getMask()andfilterCandidates()infer A→C reachability from A→B + B→C real edges, single-hop only, never overwriting observed edges.
V4.4 / V5.4 — inference improvements
- NetworkEngine impossibility mask now applied before reading end-stop probabilities, matching the priority order V3 has always used. Surface routes (e.g. 510 streetcar) previously had no filter, causing over-prediction of dominant destinations regardless of direction.
- Fixed day_cos feature derived from day_sin instead of the actual day index — skewed day-of-week encoding at prediction time.
- Added
prev_routeand trip-gap features to the end-stop inference path so V4/V5 use basic journey context rather than treating each trip start as isolated.
TransferEngine v1.1
Uses NetworkEngine transfer index as a population-level prior for cold-start journeys.
handlers.js split
1712-line file broken into five focused modules: handlers-utils, handlers-commands, handlers-trip, handlers-query, handlers-intelligence. handlers.js is now a thin barrel re-export.
END reply improvements
- Next-leg suggestion — "Usually take the 2 from here." when alighting at a known transfer point.
- Anomaly detection — "This trip took longer than usual (40 min vs. typical 10 min)." when trip duration ≥ 2× the hour-specific median.
- Prediction prompt tightened — cleaner paragraph structure, END shortcuts inline with suggestions.
Bug fixes
- Next-leg suggestion now displays the original route label ("510A", "Green Line") instead of the normalized key.
- Anomaly detection now compares against the specific start→end edge median rather than the aggregate across all destinations from the boarding stop.
- V4/V5 route grading normalization — predictions and actuals both normalized before comparison, fixing cases where "510" vs "510A" always scored as a miss.
- SSRF guard restructured; biased random in emoji picker fixed.
Tests
174 passing, 0 failing.