71 → 20errors in the AI's drafts on 12 test trips, before the checker repairs the rest
01The problem
Why it exists
A trip plan that sends you to a museum during Friday prayer, or to a desert viewpoint at 2 pm in July, is worse than no plan. Rihla turns one sentence ("two days in Riyadh with my parents, heritage and food, less walking") into a plan drafted by Apple's on-device model, then checks every stop against opening hours, prayer times, heat, the drive between stops, budget and pace, repairs what fails and says why. No server, no account.
02The system
What I built
On-device LLMdrafts with real place ids
Rule checkerhours, drives, daylight
Repair loopconcrete fixes, one revision
The tripmaps, Live Activity, Watch
An on-device LLM drafter (Apple Foundation Models) whose answer schema only allows real place ids, so it cannot invent a place; code keeps the arithmetic (drive times, each place once) and the checker sends concrete fixes back for one revision
A rule checker and repair search across 61 places in six cities, with Ramadan hours from the Umm al-Qura calendar, road trips with breaks and daylight rules, and a monitor that notices when you're running late or skipped a stop
A SwiftUI app with Mapbox maps and drives along the roads, offline city maps, widgets, a Live Activity, Apple Watch and full Arabic; accessibility checked with Apple's audit on an iPhone
03The result
What it achieved
On a 12-trip evaluation, errors in the AI's first drafts fell from 71 to 20 and invented places from 40 to 0; every final plan passes all checks. A plan takes about 21 s on the device. 67 engine tests and a UI test of every screen run on a real iPhone.