Detention / Dwell Timer: Stop Losing Detention Money
Build an internal tool that logs arrival and departure times at every stop, computes time over free time per customer, flags chargeable detention with proof timestamps, and routes it through a billing approval gate before anything is billed.
A logged-in tool where dispatch records arrive/depart times, the system computes time over free time and flags chargeable detention with supporting timestamps, and billing reviews and approves each charge before it becomes a billable record with evidence attached.
Before you start
- A free Supabase account
- A free Vercel account
- A free Resend account (for alerts and approval notices)
- Claude Code installed, with an effort level of High
- Your free-time rules and customer list (or a spreadsheet of recent stops)
The problem this kills
Detention is money you already earned and keep handing back. A driver sits two hours past free time at a receiver, nobody writes down the exact arrival, and three weeks later the customer disputes the charge because there's "no proof." The timestamps live in a text thread, a paper log, or someone's memory. Dispatch is too busy to chase it, billing can't defend it, and the charge quietly gets written off.
The math is rarely the hard part. The hard part is capturing clean arrive/depart times at the moment they happen, applying the right free-time rule for that customer, and keeping the proof attached so the charge survives a dispute. Without a system, detention is the accessorial that everyone agrees you're owed and nobody ever collects.
What you'll build
A small, secure internal web tool for your dispatch and billing teams:
- Dispatch logs the clock. Pick the shipment and stop, tap arrived, tap departed. The tool stamps the times and who recorded them.
- The system does the math. It looks up the free-time rule for that customer/stop type, computes dwell time, subtracts free time, applies your rounding rule, and flags whether the stop is chargeable detention.
- Proof stays attached. Timestamps, who logged them, and any uploaded evidence (gate receipt photo, BOL, screenshot) ride along with the charge.
- Billing approves before anything is billed. Computed detention lands in a review queue. A billing person checks the timestamps and the rule, then approves or rejects. Only approved charges become billable records.
- No duplicates. The same stop on the same shipment can't be logged or billed twice.
What's inside the Implementation Plan
The plan is a complete, paste-and-go runbook for Claude Code. The very first thing it does is interview you about your business - how you dispatch today, what your free-time rules actually are per customer, how you round, what your shipment and stop numbers look like, your typical and peak volumes, and the messy exceptions (driver-error delays, weekends, multi-stop loads). It reads a short tailored spec back to you and waits for your thumbs-up before it builds a thing. The result is a tool shaped around your lanes and customers, not a generic template.
From there it walks you step by step: set up the database and login, load your free-time rules, build the arrive/depart logging screen, wire up the detention math and rounding, build the billing approval queue, attach evidence, and ship it on Vercel. Every step ends with a ready-to-paste prompt.
The governance it includes (this is the point)
- Login so only your team can use the tool.
- Row-level security so each company only ever sees its own stops and charges.
- A complete audit trail - who logged each time, who approved each charge, and when.
- A hard human-in-the-loop approval gate - the system computes detention, but a billing person must review and approve before it becomes a billable record.
- Duplicate guards keyed on stop + shipment, so the same detention can't be logged or charged twice.
Who it's for
Dispatchers and drivers who need a fast way to capture arrive/depart times, and billing teams who need defensible detention charges with the proof already attached. If you run a trucking operation, a brokerage, or a private fleet and you're tired of writing off detention you're actually owed, this is for you.
You've got this - paste the first prompt and let the interview tailor the rest.