Save a quick add
create_quick_addAdds- What it does
- Adds a new record and leaves what you had alone. Safe to retry: the same call twice changes nothing more.
- Permission
- Meals, change
meals:write
What your assistant is told
Save a quick add: a shortcut the user can tap in the app to log this meal
again in one tap. Items take the same shape as log_meal — EITHER
{food_id, quantity_g} OR {name + absolute macros} — so you can pass
exactly what you just logged.
ONLY call this after the user says yes to an offer you made. Never create
one unprompted, never create one to "help them be consistent", and never
create one off a single meal. log_meal's
similar_logs_near_this_hour / existing_quick_add hints are what tell
you an offer is even reasonable; the offer discipline is written there.
Pick a short, human name the user would recognise on a tile ("Boiled
eggs", not "Breakfast 2×egg 140kcal"). Set time_local_minutes (minutes
since local midnight — 600 = 10:00) and weekday_mask (bit 0 = Mon … bit
6 = Sun; 31 = Mon–Fri, 127 = every day) from when they actually eat it,
and pass a one-line reason in the user's own terms — they see it in the
app, so it must read as their shortcut, never as a finding about them.
There is no limit worth mentioning to the user: the app ranks every quick
add against the current time and shows only the most relevant few, so
holding a lot costs them nothing — never ask someone to delete one to make
room. Do still check list_quick_adds first and offer to UPDATE a near
match instead of creating a near-duplicate. Reuse the same
idempotency_key on a retry.
Parameters
nametext, requiredShort human label shown on the tile, e.g. "Boiled eggs".time_local_minuteswhole number, requiredWhen it is usually eaten: minutes since local midnight, 0–1439 (600 = 10:00).weekday_maskwhole number, requiredWhich days it applies to, as a bitmask: bit 0 = Mon … bit 6 = Sun (31 = Mon–Fri, 127 = daily). At least one day is required — 0 is rejected, since a shortcut pinned to no day could never appear.itemslist of object, requiredThe foods it logs. EITHER {food_id, quantity_g} OR {name + absolute macros}, same aslog_meal.idempotency_keytext, requiredIdempotency key; reuse on retry to avoid duplicate shortcuts.reasontext, optionalOne line, in the user's own terms, on why this shortcut exists. Shown in the app — a shortcut, never a verdict about their eating.