cauldron/cauldron
Kayos 07dab10c4b plan UI: numeric daily macro targets + allergen exclusions
The next-tier of structured planning constraints, building on the
free-form preference textarea. Now the household can set hard rules
like '2200 cal/day, 150g protein, no dairy or shellfish' and the
planner enforces them.

Schema (migrations 026 + 027):
- daily_targets_json on cauldron_meal_plans: {calories?, protein_g?,
  carbs_g?, fat_g?} per-day budget. Sonnet sums per-recipe macros
  across the 7-day plan and aims for ±15% of the weekly total.
- exclusions_json on cauldron_meal_plans: list of contains.* keys
  (subset of {dairy, gluten, nuts, peanuts, eggs, shellfish, fish,
  soy, sesame, pork}). Hard filter on AI-chosen slots; picks still
  apply but get flagged with the conflict in their reason field.

DB:
- set_plan_targets_and_exclusions normalizes inputs (drops zeros,
  validates against allowed enum values, lowercases).
- The plan_view path decodes the JSON columns server-side and adds
  display labels (`targets_label`, `exclusions_label`) and the parsed
  dict/list (`targets_dict`, `exclusions_list`) for the template.

Forge:
- generate_plan accepts daily_targets dict + exclusions list.
- New DAILY MACRO TARGETS prompt block — instructs Sonnet to sum
  per-serving macros across all 7 slots and land within ±15% of
  weekly totals; tradeoff slots when needed.
- New STRICT EXCLUSIONS prompt block — recipes whose has: list
  intersects exclusions are forbidden in AI-chosen slots. Picks that
  conflict still appear (explicit user choice) but get flagged in
  the slot reason ("contains dairy — household pick").

Server:
- /api/plan/generate accepts {preference, targets, exclusions}.
  Persists all three before kicking off Sonnet so re-rolls reuse them.
- /api/plan/regenerate same — empty body reuses persisted constraints.

UI (/plan):
- New <details> section "numeric targets + allergen exclusions
  (optional)" tucked under the existing vibe textarea + presets.
- 4 numeric inputs (cal/protein/carbs/fat per day) with quick-set
  preset chips: balanced 2200 / protein lean 2400 / carb load 2600 /
  cut 1800 / clear.
- 10 allergen checkbox chips with red-pill styling when checked
  (uses CSS :has(input:checked) — modern browsers).
- Hydration: persisted targets pre-fill the inputs, persisted
  exclusions pre-check the boxes.
- After generation, three readouts above the action buttons show
  active vibe / macros / exclusions.

Cobb's exact ask "2200 cal/day, protein and carb balanced, no dairy"
now maps to: targets={calories: 2200, protein_g: 150, carbs_g: 250}
+ exclusions=[dairy] + free-form preference (optional). All persist.
Re-rolls iterate within those constraints automatically.
2026-04-30 20:31:28 -07:00
..
data v0.3 step 5: lean shopping list — claude on-demand foods + game strip 2026-04-29 22:02:20 -07:00
templates plan UI: numeric daily macro targets + allergen exclusions 2026-04-30 20:31:28 -07:00
__init__.py v0.1 — backend bones + ingredient sterilizer 2026-04-28 16:59:11 -07:00
aggregator.py Step 2: re-key cauldron's food metadata by mealie_food_id 2026-04-30 11:52:25 -07:00
bulk_sterilize.py sterilize bulk: respect external cancel mid-loop 2026-04-30 10:02:53 -07:00
config.py fix: split MEALIE_API_URL (internal) from MEALIE_PUBLIC_URL (UI link) 2026-04-28 20:26:25 -07:00
consolidate_foods.py consolidate: pair-based clustering instead of single-link agglomerative 2026-04-30 19:51:59 -07:00
crypto.py v0.2 foundation — Authentik OIDC + sulkta-mariadb DB + Fernet crypto 2026-04-28 19:47:47 -07:00
db.py plan UI: numeric daily macro targets + allergen exclusions 2026-04-30 20:31:28 -07:00
dedupe_recipes.py recipe dedupe: cluster + Sonnet decide + DELETE via Mealie 2026-04-30 18:16:56 -07:00
enrich_recipes.py recipe enrichment: per-recipe Sonnet meta for smarter planning 2026-04-30 20:08:20 -07:00
foods.py Step 2: re-key cauldron's food metadata by mealie_food_id 2026-04-30 11:52:25 -07:00
forge.py plan UI: numeric daily macro targets + allergen exclusions 2026-04-30 20:31:28 -07:00
mealie.py recipe dedupe: cluster + Sonnet decide + DELETE via Mealie 2026-04-30 18:16:56 -07:00
oidc.py v0.2 foundation — Authentik OIDC + sulkta-mariadb DB + Fernet crypto 2026-04-28 19:47:47 -07:00
recipe_index.py search: local fuzzy recipe index — way smarter than Mealie's lexical default 2026-04-28 21:37:12 -07:00
server.py plan UI: numeric daily macro targets + allergen exclusions 2026-04-30 20:31:28 -07:00
sterilizer.py sterilize hot-fixes: 300s timeout + defensive string→dict parsing 2026-04-30 12:41:58 -07:00