FoodBrain.
A household grocery brain โ built to master AI integration and even the playing field for consumers
The grocery store is engineered against you. Households are walking in unarmed.
The grocery store is a precision instrument calibrated to separate shoppers from their money โ end caps engineered to feel like deals without being discounted, essential items placed at the back to force full-store traversal, music designed to slow you down, a loyalty card system where your data is the real product and the discount is the payment. The average household loses 30% of its food budget to waste alone. For a family of four, the total recoverable gap across waste, missed deals, and impulse purchases runs to an estimated $1,800โ$2,100 per year. That's not a willpower problem. That's a systems problem. I'm building the system.
Four agents, one Playwright worker, and a Copilot that knows your pantry.
FoodBrain scrapes weekly flyer deals from 8 stores via Instacart's public pages, runs a cross-store price sweep across your household's watchlist, and evaluates every store-pair combination to find the two that minimize your basket cost. A Playwright worker on Railway handles all browser automation โ Vercel serverless can't run a browser. The Copilot agent, built on Claude via the Vercel AI SDK, has read access to your grocery list, pantry, watchlist, recipes, and deals โ and write access behind confirmation cards. No mutation executes without explicit approval.
Plans backwards from cost
Most grocery tools start with recipes and derive a list. FoodBrain starts with what's on sale and what you already own, then figures out what to eat โ the order that actually saves money.
Confirmation-gated writes
The Copilot agent can read everything. It writes nothing without showing a confirmation card first. Every mutation is explicit โ no surprises in your pantry or grocery list.
Architecture that scales
Orchestrator coordinates, agents specialize. No agent-to-agent calls โ all state flows through Supabase. The Playwright worker runs on Railway as a persistent process so it's always ready for a price sweep.
How it came together
- 01
Built the Research Agent
Phase 1 was the hardest infrastructure lift: a Playwright worker running on Railway, resolving zip codes to street addresses via Nominatim, navigating Instacart's flyer pages, scraping weekly deals from 8 stores, filtering to food-only categories, and writing everything to Supabase with a 14-day prune cycle. The core scraping pattern that everything downstream depends on.
- 02
Added price intelligence
Phase 2 extended the worker to run cross-store price sweeps across the household's watchlist โ one price per item per store, with staleness rules per category (produce/meat: 24hr, dairy/bread: 48hr, shelf-stable: 7 days). The price_cache table became the single source of truth for all downstream agents. Store-pair optimization logic was scoped but intentionally deferred โ Phases 3โ6 didn't need it to proceed.
- 03
Built grocery list + cookbook
Phases 3 and 4 wired in real household data โ a persisted grocery list with per-item price variants sourced from the price_cache, a multi-stop optimizer that evaluated store combinations client-side, and a Household Cookbook with recipe CRUD and pantry integration. The system went from price data to a working household tool.
- 04
Shipped the Copilot agent
Phase 6 replaced the placeholder sidebar with a real Anthropic-powered agent via the Vercel AI SDK. Read tools give it access to grocery, pantry, watchlist, recipes, deals, and household profile. Write tools execute only after the user confirms a card in the UI. Durable memory lives in a rolling_summary + memory_facts JSONB row per household โ no raw transcripts stored.
The hardest problem wasn't AI. It was browser automation โ and the lessons transfer.
I expected agent coordination to be the difficult part. It wasn't. The Playwright worker โ resolving zip codes, navigating Instacart's anti-bot detection, handling lazy-loaded flyer tiles, isolating per-store failures without aborting the whole run โ was where the real engineering happened. That pattern transfers directly to Lab Atlas: agents that crawl vendor sites, isolate failures, and write to well-defined tables behind a review gate. FoodBrain is the training run. Lab Atlas is what it's training for.
Where it goes from here
- 01
Meal Planner agent
The full weekly meal plan generator โ consuming genuine deal shortlists and price_cache data to produce a cost-optimized weekly menu. The stub tool exists in the Copilot; the dedicated phase is next.
- 02
Instacart procurement
The Procurement agent will take the optimized grocery list and build Instacart carts automatically via the Playwright worker. Auth, session management, and cart confirmation flow are already scoped.
- 03
Store-pair optimizer in production
Genuine deal detection and the store-pair ranking system were scoped in Phase 2 but intentionally deferred. Now that the data model is stable, this is the next intelligence layer to activate.
Checker AutoGen โ
Fills Google Slides templates with campaign assets in seconds.