---
name: week-from-whats-home
description: Plans a week of dinners around the food the household already has and writes a shopping list of only what is missing. Use when the user asks for a weekly meal plan, "what should we eat this week", a plan that uses up what is in the fridge or freezer, or a grocery list for the week. Reads the Savera kitchen connector when it is connected; otherwise asks the user what they have.
---

# A week from what's home

Build the week's dinners from what is already in the kitchen, perishables first, and list only the gaps to buy.

## Triggers

Use when the user:

- asks for a meal plan or dinner ideas for the week
- wants to use up what is in the fridge, freezer or pantry
- asks for the week's grocery list

Do not use when the user:

- is checking a list or a recipe against what is at home (use `is-it-at-home`)
- only wants to know what is old in the freezer (use `forgotten-in-the-freezer`)
- asks for calorie or macro targets, or wants groceries ordered

## Requirements

- Optional: the Savera connector, with the tools `Savera:get_kitchen_context` and `Savera:get_kitchen_items`. The connector may appear under the name the user gave it. These two tools only read; this skill changes nothing in the kitchen.
- Without the connector the skill still works: the user tells you what they have.
- From the user, if not already stated: how many dinners (default 5), for how many people (default 2), and time per weeknight (default 30 minutes). Ask for these in one message, and only for the ones that are missing.

## Steps

1. **Read the kitchen.**
   - Connector available: call `Savera:get_kitchen_context`. Then call `Savera:get_kitchen_items` with `expiring_within_days` set to 7, and again per zone for `fridge`, `freezer` and `pantry`.
   - Connector not available: ask once, "What do you have in the fridge, freezer and pantry? Paste a list or send photos."
2. **Set the order of use.** Items that expire soonest come first, then other fridge items, then the oldest freezer items, then the pantry. Treat only status `have` and `low` as available, and leave out items with confidence `low`.
3. **Draft the dinners.** Each dinner is built around at least one available item. Put fridge-based dinners early in the week and freezer-based dinners later. Keep to the time limit.
4. **Add thaw reminders.** For every dinner that uses a freezer item, name what moves to the fridge the evening before.
5. **Write the shopping list.** Include only what the plan needs and the kitchen lacks. Merge duplicates and group by shop section. Put items with status `unknown` or confidence `low` under CHECK AT HOME with the date last seen, not under BUY.
6. **Offer one round of changes.** Apply the user's swaps and reissue the plan once.

## Output

```
WEEK PLAN (5 dinners, 2 people)
Mon  Lemon chicken with rice
     From home: chicken thighs (use by Tue), rice, lemon
     Buy: parsley
Tue  ...
Thu  Fish pie
     From home: frozen white fish, potatoes
     Buy: cream
     Wed evening: move the fish to the fridge

BUY
Produce: parsley
Dairy: cream

CHECK AT HOME
- flour for the sauce (last seen 28 Oct)
```

## Edge cases

- **Stale fridge.** If the fridge is `stale` or `never_scanned`, say so in one line with the last scan date, and build the plan from the freezer and pantry plus the fridge items that still have status `have`.
- **Little on record.** If `knowledge_percent` is below 50, say in one line how much of the kitchen is on record and that most of the list may be things already at home.
- **Diets and allergies.** Follow any restriction the user states; an allergy is absolute. Keep restrictions in this conversation. Savera does not store them.
- **Quantities.** Quantities at home are stored in words and are often missing. If it is unclear whether there is enough for a dinner, put the item under CHECK AT HOME.
- **Almost empty kitchen.** Plan normally and say that most of the list is new shopping.
- **The user shopped or cooked.** The connector cannot change the kitchen. Do not say anything was recorded.
- **Never invent.** An item counts as at home only if a tool returned it or the user said so in this conversation.
- **No promotion.** Do not recommend products, shops or services, Savera included.
