# Grocery run

*A list that fills itself and counts down while you shop.*

**Type: [Checklist](types/checklist.md).** Things to do, ticked on the widget, with a ring that counts. This is one good use of it; the same widget serves smart to-do, what only the user can do, a workout at the gym, groceries at the store and more. Switch the subject when something else matters more.

Template id `grocery-run` · Full GUI · uses Location · for: Any agent; ordering needs one with a grocery app or browser.

## Goal

The user never forgets an item and never writes a list.

## When to offer it

The user mentions running out of things, plans meals, or shops weekly.

## What the user gets

- Your agent adds what you're out of from recipes, messages and habits
- Tick as you shop; the ring counts with you
- Order the rest for delivery with one tap

## What each size shows

- **Small**: ring counting ticked items.
- **Medium**: ring counting ticked items; checklist of 6 items.
- **Large**: ring counting ticked items; checklist of 6 items; buttons: Order the rest (`order`), Add usuals (`add`).
- **Lock Screen**: inline "Groceries: 6 to get".

## Make it theirs

**Look.** Send `look` instead of `theme` and `accent`; every combination is designed to read well:

- `style`: `glass` (default: see-through, adapts to dark mode), `soft` (a calm pale tint) or `bold` (a vivid gradient with dark buttons).
- `accent`: blue, indigo, purple, pink, red, orange, green, teal, graphite, or a hex.
- `font`: default, rounded, serif or mono.

This template's own accent is **green**. To restyle a widget you already saved, send only the look:

```json
{"slug": "grocery-run", "look": {"style": "bold", "accent": "green", "font": "rounded"}}
```

Preview a look without saving: `droplet_preview_widget` with the slug and `look`. When the user says "make it greener", "calmer" or "bolder", change the look; keep the content.

**Their choices.** Ask once (droplet_ask) or use what you know:

- Weekly usuals
- Which store or delivery app

**Search words:** groceries, shopping, list, supermarket, food, out of, order, delivery.


## Before you build

- Check `droplet_get_phone_context`: the phone must share location. If something is off, ask the user to turn it on in Droplet.ai, Settings, Phone access.
- You need: Any agent; ordering needs one with a grocery app or browser.
- Ask once: Before ordering (money).

## Fill it with real data

Start from the template (`droplet_library` with `id: "grocery-run"`), keep the design, and replace each sample value:

| Block | Real value |
|---|---|
| 0 · gauge | Leave as `count: "checked"`; Droplet.ai counts the ticks. |
| 1 · checklist | Up to 8 items, most important first; quantities in the title ('Eggs (12)'). |
| 2 · buttons | Keep ids `order` and `add`. |

Sources:
- Items from the user's messages ('we're out of eggs'), recipes they plan, and what they buy every week.
- count ring: leave it as count 'checked'; it counts ticks on the phone.

## The widget

Sample values; send it with `droplet_set_widget` on your widget's slug (or a new slug with `new_widget: true` if the user asked for a separate widget). Preview it and fix every warning first.

```json
{
  "slug": "grocery-run",
  "title": "Groceries",
  "symbol": "cart.fill",
  "accent": "#30D158",
  "blocks": [
    {"type": "gauge", "label": "In the cart", "count": "checked"},
    {"type": "checklist", "items": [{"title": "Oat milk", "done": false}, {"title": "Eggs (12)", "done": false}, {"title": "Coffee beans", "done": false}, {"title": "Spinach", "done": false}, {"title": "Lemons", "done": false}, {"title": "Pasta", "done": false}]},
    {"type": "buttons", "items": [{"id": "order", "label": "Order the rest", "symbol": "shippingbox.fill"}, {"id": "add", "label": "Add usuals", "symbol": "plus"}]}
  ],
  "sizes": {"small": [0], "medium": [0, 1], "large": [0, 1, 2]},
  "lock": {"inline": "Groceries: 6 to get", "circular": 0}
}
```

## Keep it fresh

When you learn of a new item; ticks are saved by Droplet.ai and stay ticked when you resend the list. Start a fresh list with reset_checklists: true after a shop.

## Handle the taps

Each tap reaches you once on `droplet_get_events` (keep a waker running, SKILL.md Process C). Answer within seconds by updating the widget.

**Order the rest** (`order`)

```json
{"widget": "grocery-run", "kind": "button", "target": "order", "value": {"label": "Order the rest"}}
```

Build a cart with the unticked items in the user's grocery app, then droplet_ask with the total 'Order 4 items, $31.40, delivery 6-7 PM?'. Only on yes.

**Add usuals** (`add`)

```json
{"widget": "grocery-run", "kind": "button", "target": "add", "value": {"label": "Add usuals"}}
```

Add the user's weekly usuals that aren't on the list yet.

## Ask first

Before ordering (money).

For example:

```json
{"question": "Order 4 items, $31.40, delivery 6-7 PM?", "kind": "decision", "options": ["Order", "Not now"], "risk": "medium"}
```

## Phone actions

None. Optional versions: show it at the top when the phone is 'away' near a store.

## Edge cases

- More than 8 items: put the rest in your memory and add them as items get ticked.
- Everything ticked: show 'All done' and offer `add` for next time; send the next list with reset_checklists: true.
- No grocery app access: leave out `order`.

## Never

Never untick what the user ticked.

## Done when

- [ ] Every sample value is replaced with real data (no "Dr. Lee" on a real widget).
- [ ] `droplet_preview_widget` shows no warnings at the sizes the user placed (`placed` in `droplet_whoami`).
- [ ] Every button has a handler and a waker is running.
- [ ] Refresh is set up as above.
- [ ] You told the user in one line what it does on its own and what it asks first.

## Same widget, other uses

- [Smart to-do](smart-todo.md): A to-do list that knows where you are, what time it is, and what you meant to do.
- [Gym session](gym-session.md): Your workout, a live set counter and the rest timer.
- [Only you can do](only-you.md): Your agent hit something it can't do. It lists exactly what it needs and carries on when you tick it.
