
The problem
Recurring purchase flows are the most predictable interaction in commerce. The grocery shopper buys roughly the same basket every week. The B2B office manager reorders supplies on a monthly cadence. The pet owner refills food and treats on a stable schedule. Every one of these flows is currently a manual exercise โ the shopper opens the cart, scrolls through past orders, adds the regulars one by one, scrolls through the catalog for the occasional new item.
The pattern the shopper is reproducing manually IS a predictive query. "What are this customer's likely next purchases?" Aito returns the answer; one button on the cart populates the basket; the shopper reviews and checks out.
How it works
_predict products on the customer's purchase history with exclusiveness false returns the top-N likely next purchases. The cart-autofill UI fires that query when the user clicks the button; the result populates the cart with predicted quantities derived from the customer's typical order shape.
The user reviews the prefilled cart before checkout. Add items not in the prediction; remove items that aren't needed this week. Every adjustment flows back as a signal; the next prediction reflects it. Over time the prefill accuracy improves until the user's typical adjustment is one or two items.
{
"from": "purchases",
"where": {
"customer": "alice@example.com"
},
"predict": "productIds",
"exclusiveness": false,
"limit": 15
}For the full architecture, see the technology overview. For the broader narrative across multiple use cases, read The Predictive Application.
See it live
This use case runs in the ๐ Grocery demo today. Click through to the live application and inspect the queries that produce the result. Source is on GitHub under Apache 2.0.
Frequently asked
How does cart-autofill handle one-off purchases (not part of the regular basket)?
One-off purchases get low confidence in the prediction and stay out of the prefill. The shopper adds them manually in the same session. Over time, if the one-off becomes regular, the conditional probability picks it up and it enters the prefill automatically.
What about seasonal items (Christmas, summer barbecue, back-to-school)?
Conditional on the time window, seasonal items have predictable patterns. _predict with month or season as a condition surfaces them at the right time. The shopper doesn't have to think about "when do I usually order X"; the system surfaces it.
Can cart-autofill work for B2B reorder flows?
Yes โ the pattern is identical. Office manager prefills the monthly supplies cart; clinic prefills the medical-supply order; warehouse prefills the inventory replenishment. Same _predict, different table.
Does this reduce manual catalog browsing too much?
It reduces the manual reorder of regulars; it doesn't replace catalog browsing for new items. The shopper still browses for discovery; cart-autofill handles the repetitive part. The two compose โ autofill handles the predictable 80%, browsing handles the new 20%.
How quickly does the prefill adapt to new shopping patterns?
Three observations of a new product in the customer's basket reaches stable prediction. The first new-item purchase is exploratory; by the third, the system has reliable signal that this is part of the pattern.



