# Untangle tomorrow's service route: the best stop order, the miles saved and a route planner: the prompt

A prompt file from MediaMentorAI's Daily AI Move series.
Tutorial, video and live demo: https://mediamentorai.com/ai-tutorials/untangle-service-route-with-codex

Works in Claude, ChatGPT and Codex. We tested this prompt on 7 models. Claude Haiku 5.5 (36 out of 100) failed our checks; the other 6 passed.

Every distance and time it gives is an estimate from straight lines and a road factor: real drive times depend on roads and traffic. Check the new order in Google Maps before you drive it.

## How to use it

1. Make tomorrow's job list as a CSV file: the shop on the first row, then each job in booking order with the customer, the job, the town, the latitude and longitude, and "before noon" in a window column for the job that has to be reached by noon. To try it first, use the practice file: https://mediamentorai.com/ai-tutorials/untangle-service-route-with-codex/tomorrow-jobs-sample.csv
2. Open a new chat in Claude, ChatGPT or Codex and attach the file. If your rules differ (road factor, speed, time per job, start time), change those numbers in the prompt.
3. Copy the prompt below and paste it in. If your file has another name, change it in the first line.
4. Send it as one message. Read the new order and the saving in the reply, then open the planner it makes. To try the planner on a second list, paste the lines in https://mediamentorai.com/ai-tutorials/untangle-service-route-with-codex/paste-stops-sample.txt and press its plan button.

This is the prompt we tested, so leave the rest of it as it is. You don't need to know how to code.

## The prompt

```text
tomorrow-jobs-sample.csv is tomorrow's job list for my plumbing company (sample data, made up): the shop first, then each job in the order the calls were booked, with the customer, the job, the town and the town's latitude and longitude. One job has to be reached before noon.

Find the best order for tomorrow with these rules:
Start and end at the shop.
Distance: straight-line miles between the coordinates, times 1.3 for roads.
Driving speed: 30 mph on average. Each job takes 45 minutes. We leave the shop at 8:00 AM.
The before-noon job: we must get there by 12:00 noon.
Best order: the fewest miles that still gets to the before-noon job in time. Try every possible order.

In your reply, list the new order with the arrival time at each stop, and say how many miles and minutes of driving it saves compared with the booking order. Call every number an estimate: real drive times depend on roads and traffic.

Then build me a small route planner as one HTML file. I paste or type my stops, one per line: name, latitude, longitude, and "before noon" if we must get there by noon, with the shop on the first line. It finds the best order with the same rules, lists it with arrival times, draws the route in the order I listed (the booking order) and the new route side by side from the coordinates (plain SVG or canvas, no map tiles), says "about N miles and M minutes saved (estimate)", and has an "Open in Google Maps" link that starts at the shop, goes through the stops in the new order and comes back. Add a "Load sample data" button with tomorrow's list. Use click handlers, not a form. No alert or confirm boxes, no downloads, no AI, nothing loaded from the internet: plain HTML and JavaScript in one file, nothing to install.

Do the work yourself, without helper agents or add-on skills. When it's done, open the planner here so I can see it.
```

---

Made by MediaMentorAI, which builds AI that takes the busywork off service businesses. https://mediamentorai.com
