route-optimizer — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited route-optimizer (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
You generate a working route optimization pipeline. Last-mile delivery costs > 50% of total shipping in 2026 — squeezing it is where the savings live. The solver of choice is Google OR-Tools because it handles CVRP/VRPTW/VRPPD natively, is open-source, and scales to thousands of stops with disciplined heuristics.
============================================================ === PRE-FLIGHT === ============================================================
Verify:
Recovery:
============================================================ === PHASE 1: PROJECT SCAFFOLD === ============================================================
route-opt/
├── README.md
├── pyproject.toml # ortools, numpy, pandas, requests, geojson
├── data/
│ ├── stops.csv # id, lat, lng, demand, time_window_start, time_window_end, service_time_min
│ ├── vehicles.csv # id, capacity, start_depot, end_depot, shift_start, shift_end, cost_per_km
│ └── depots.csv # id, lat, lng
├── src/
│ ├── matrix.py # build distance/duration matrix (OSRM/Mapbox/Google)
│ ├── solver.py # OR-Tools routing model
│ ├── constraints.py # time windows, capacity, HOS
│ ├── output.py # GeoJSON, KPI report, turn-by-turn
│ └── cli.py # python -m src.cli --stops data/stops.csv --vehicles ...
├── tests/
│ ├── test_cvrp.py # textbook 16-stop example, known optimum
│ └── test_vrptw.py # Solomon C101 benchmark
└── examples/
├── small_cvrp.ipynb # 20 stops, single depot
└── large_vrptw.ipynb # 200 stops, 8 vehicles, time windowsVALIDATION: Test against the OR-Tools CVRP example (16 stops, capacity 15) → solution matches published optimum within 1%.
============================================================ === PHASE 2: DISTANCE / DURATION MATRIX === ============================================================
Generate matrix.py that supports:
OSRM (preferred for self-hosting):
/table/v1/driving/{coordinates} → returns distance + duration in seconds.Mapbox Matrix API:
traffic_profile (real-time vs typical).Google Distance Matrix:
departure_time for traffic-aware estimates.Haversine fallback:
R = 6371 km, standard great-circle formula. Multiply by 1.3 for road-network estimate. Use only for prototyping.VALIDATION: Matrix cache populated and re-used on subsequent runs. Falls back gracefully if API quota exhausted.
============================================================ === PHASE 3: OR-TOOLS SOLVER === ============================================================
Generate solver.py using ortools.constraint_solver.pywrapcp:
from ortools.constraint_solver import pywrapcp, routing_enums_pb2
manager = pywrapcp.RoutingIndexManager(num_locations, num_vehicles, starts, ends)
routing = pywrapcp.RoutingModel(manager)
# Distance callback
def distance_callback(from_idx, to_idx):
return distance_matrix[manager.IndexToNode(from_idx)][manager.IndexToNode(to_idx)]
transit_idx = routing.RegisterTransitCallback(distance_callback)
routing.SetArcCostEvaluatorOfAllVehicles(transit_idx)
# Capacity constraint
def demand_callback(idx):
return demands[manager.IndexToNode(idx)]
demand_idx = routing.RegisterUnaryTransitCallback(demand_callback)
routing.AddDimensionWithVehicleCapacity(demand_idx, 0, vehicle_capacities, True, 'Capacity')
# Time window constraint
def time_callback(from_idx, to_idx):
travel = duration_matrix[manager.IndexToNode(from_idx)][manager.IndexToNode(to_idx)]
service = service_times[manager.IndexToNode(from_idx)]
return travel + service
time_idx = routing.RegisterTransitCallback(time_callback)
routing.AddDimension(time_idx, slack_max, horizon_max, False, 'Time')
time_dim = routing.GetDimensionOrDie('Time')
for loc_idx, (start, end) in enumerate(time_windows):
index = manager.NodeToIndex(loc_idx)
time_dim.CumulVar(index).SetRange(start, end)
# Search
search_params = pywrapcp.DefaultRoutingSearchParameters()
search_params.first_solution_strategy = routing_enums_pb2.FirstSolutionStrategy.PATH_CHEAPEST_ARC
search_params.local_search_metaheuristic = routing_enums_pb2.LocalSearchMetaheuristic.GUIDED_LOCAL_SEARCH
search_params.time_limit.FromSeconds(60)
search_params.log_search = False
solution = routing.SolveWithParameters(search_params)VALIDATION: Solver returns a feasible solution OR a clear "infeasible: {reason}" diagnostic, never an empty result.
============================================================ === PHASE 4: HOS COMPLIANCE & SOFT WINDOWS === ============================================================
US DOT FMCSA rules for property-carrying drivers (49 CFR § 395.3):
Model HOS as additional Time-dimension constraints with break activities. For long-haul, multi-day routes, split into legs with mandatory rest periods.
Soft time windows: instead of hard infeasibility, add a penalty cost per minute outside the window. Useful for VRPTW where some lateness is acceptable at a cost. Implement via Dimension.SetSoftUpperBound(index, soft_max, penalty_per_unit).
VALIDATION: HOS-enabled run produces routes with explicit break activities and ≤ 11 hours of drive per shift.
============================================================ === PHASE 5: OUTPUT (GeoJSON, KPIs, TBT) === ============================================================
Generate output.py producing three artifacts:
1. routes.geojson — FeatureCollection where each Feature is one vehicle's route (LineString) + stop Points with properties (sequence, arrival_time, service_time, demand_delivered). Renderable in Mapbox GL JS, Leaflet, kepler.gl.
2. kpi_report.md:
Total routes: N
Total stops: M
Total distance: X km (avg per route: Y km)
Total duration: X hr (avg per route: Y hr)
Vehicle utilization: (sum of capacity used) / (sum of capacity available) = X%
On-time stops: N/M = X%
Avg stops per route: X
Cost estimate: $X (at $Y/km)3. turn-by-turn URLs — for each route, one URL the driver can open in Google Maps or Apple Maps with all stops pre-loaded. Mapbox Directions API for production navigation.
VALIDATION: GeoJSON validates against geojson.io. KPI numbers reconcile (sum of route distances = total).
============================================================ === PHASE 6: DISPATCH LOOP === ============================================================
For ops teams running this daily, generate a dispatch.py CLI:
python -m src.dispatch \
--stops today.csv \
--vehicles fleet.csv \
--depots depots.csv \
--time-limit 120 \
--output runs/$(date +%F)/Pipeline:
VALIDATION: Full pipeline runs end-to-end in < 5 minutes for 200 stops × 10 vehicles.
============================================================ === SELF-REVIEW === ============================================================
Score 1–5:
Common gap: ignoring service time at each stop → routes time out 30 min late. Verify service_time is in the time callback.
============================================================ === LEARNINGS CAPTURE === ============================================================
Append to ~/.claude/skills/route-optimizer/LEARNINGS.md:
============================================================ === STRICT RULES === ============================================================
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.