Mirror CookUnity's full weekly menu into a local database so you can plan meals offline — filter by macros, diet, and budget, and diff the menu week over week, none of which the web app can do.
CookUnity's chef-driven menu is only visible logged-in and online, paginated across hundreds of lazy-loaded cards, with shallow filters that reset on reload. This CLI syncs the entire menu — every meal's macros, chef, price, diet tags, allergens, and ratings — into a local SQLite store, then lets you query it offline: build a macro-constrained meal plan with plan, rank best value with value, see what changed with drift, and search everything with FTS. Every command speaks --json for agents.
Authentication
CookUnity has no public API. Auth is the Auth0 access token your logged-in browser session already holds. Copy it from the browser (DevTools → Network → any subscription.cookunity.com request → the authorization header value, which is the raw token with no Bearer prefix) and set COOKUNITY_TOKEN. The token lasts about 24 hours; re-copy it when doctor reports it expired.
Quick Start
# check config and token before syncing
cookunity-pp-cli doctor --dry-run
# mirror the full menu for a delivery date into the local store (omit --param to use the next delivery date)
cookunity-pp-cli sync --param date=2026-08-04
# browse the menu offline with macro filters
cookunity-pp-cli meals --min-protein 40 --max-calories 600 --json
# auto-build a week of meals hitting your targets
cookunity-pp-cli plan --protein-min 40 --calories-max 600 --count 8 --diet gluten-free
# rank the menu by protein per dollar
cookunity-pp-cli value --metric protein-per-dollar --limit 20
Unique Features
These capabilities aren't available in any other tool for this API.
Local planning that compounds
-
plan — Auto-build a set of meals that collectively hit your protein, calorie, budget, and diet targets — offline, in one command.
Reach for this when the user wants a week's worth of meals meeting nutrition or budget constraints instead of hand-picking dishes.
cookunity-pp-cli plan --protein-min 40 --calories-max 600 --count 8 --diet gluten-free --agent
-
drift — See exactly which meals were added, removed, or repriced between two weekly menus.
Use this to track what changed on the new menu without re-scanning 300+ dishes by hand.
cookunity-pp-cli drift --from 2026-07-28 --to 2026-08-04 --json
-
value — Rank meals by nutritional value per dollar (protein-per-dollar, calories-per-dollar) computed from the local mirror.
Pick this when the user cares about maximizing protein or calories per dollar across the menu.
cookunity-pp-cli value --metric protein-per-dollar --limit 20 --agent
Agent-native menu queries
-
favorites — Show which of your favorited meals are actually on the current week's menu.
Use this first after a menu drop to see if the user's liked meals are back.
cookunity-pp-cli favorites --json
-
compare — Side-by-side macro, price, chef, and allergen comparison of two or more meals.
Reach for this to decide between specific candidate meals the user already has in mind.
cookunity-pp-cli compare 3707 3210 --json
-
chefs — Leaderboard of chefs by dish count, average rating, average price, and cuisines on the current menu.
Use this to explore the menu by chef or find highly-rated chefs.
cookunity-pp-cli chefs --json
Recipes
Plan a high-protein gluten-free week
cookunity-pp-cli plan --protein-min 40 --calories-max 650 --count 8 --diet gluten-free --agent
Selects 8 meals from the synced menu that collectively fit the macro and diet constraints.
Find the best protein-per-dollar meals
cookunity-pp-cli value --metric protein-per-dollar --limit 15 --agent --select name,chefName,protein,finalPrice
Ranks meals by protein per dollar and returns only the fields an agent needs, keeping the payload small.
See what changed on the new menu
cookunity-pp-cli drift --from 2026-07-28 --to 2026-08-04 --json
Diffs two synced weekly snapshots to show added, removed, and repriced meals.
Compare two meals head to head
cookunity-pp-cli compare 3707 3210 --json
Prints a side-by-side macro/price/chef/allergen comparison of the two meal ids.
Usage
Run cookunity-pp-cli --help for the full command reference and flag list.
Paths & environment variables
This CLI separates local files into four path kinds:
| Kind | Contents |
|---|
config | User-editable settings such as config.toml and saved profiles |
data | Durable local data: credentials.toml, data.db, cookies, browser-session proof files, and other auth sidecars |
state | Runtime state such as persisted queries, jobs, and teach.log |
cache | Regenerable HTTP/cache files |
Each kind resolves independently. The ladder is:
- Per-kind env var:
COOKUNITY_CONFIG_DIR, COOKUNITY_DATA_DIR, COOKUNITY_STATE_DIR, or COOKUNITY_CACHE_DIR
--home <dir> for this invocation
COOKUNITY_HOME for a flat relocated root
- XDG env vars:
XDG_CONFIG_HOME, XDG_DATA_HOME, XDG_STATE_HOME, XDG_CACHE_HOME
- Platform defaults matching existing installs
For containers and agent sandboxes, prefer a single relocated root:
export COOKUNITY_HOME=/srv/cookunity
cookunity-pp-cli doctor
Under COOKUNITY_HOME=/srv/cookunity, the four dirs resolve to /srv/cookunity/config, /srv/cookunity/data, /srv/cookunity/state, and /srv/cookunity/cache.
MCP servers do not receive CLI flags from the host. Put relocation in the host env block:
{
"mcpServers": {
"cookunity": {
"command": "cookunity-pp-mcp",
"env": {
"COOKUNITY_HOME": "/srv/cookunity"
}
}
}
}
Precedence matters in fleets: an ambient per-kind variable such as COOKUNITY_DATA_DIR overrides an explicit --home for that kind. Use COOKUNITY_HOME or the per-kind variables for durable fleet relocation; treat --home as the weaker per-invocation lever.
Relocation is one-way. Unsetting COOKUNITY_HOME does not move files back to platform defaults, and doctor cannot find credentials left under a former root. Move the files manually before unsetting relocation variables.
Existing installs keep working because the platform-default rung matches the legacy layout. On the first auth write, stored secrets leave config.toml and are consolidated into credentials.toml under the data directory. Run cookunity-pp-cli doctor --fail-on warn to check path and credential-location warnings in automation.
Commands
meals
Query the locally-synced CookUnity meal catalog offline
cookunity-pp-cli meals - List meals (hand-built to read the local store; this endpoint is the upstream source)
menu
Fetch the CookUnity weekly menu (server-driven-UI) for a delivery date
Self-learning loop
This CLI caches per-question discovery so repeat queries skip the walk and structurally similar queries get answered via entity substitution. The loop also self-captures: every invocation is journaled locally, and failed-flag corrections plus fresh teaches surface as candidates on the next recall for confirm/reject judgment. Agents call recall before discovery and fire teach & after answering. See the ## Automatic learning section in SKILL.md for the full protocol.
cookunity-pp-cli recall <query> - Look up cached resources for a query before running discovery
cookunity-pp-cli teach - Record a query -> resource mapping (silent on success, safe to background with &)
cookunity-pp-cli learnings list - Inspect taught rows
cookunity-pp-cli learnings forget <query> - Undo a teach
cookunity-pp-cli learnings candidates - List auto-captured candidates awaiting confirm/reject
cookunity-pp-cli learnings stats - Local loop metrics: recall hit rate, teach-to-reuse, playbook resolution, candidate counts
cookunity-pp-cli teach-pattern - Install a query/resource template up front
cookunity-pp-cli teach-lookup - Add an entity mapping (e.g. country code, team alias) for pattern substitution
Pass --no-learn or set COOKUNITY_NO_LEARN=true to disable the loop for deterministic flows.
The local store's schema version stamp is one-way: once this version of cookunity-pp-cli opens the database, older binaries refuse it with a version error — upgrade the binary rather than downgrading.
Output Formats
# Human-readable table (default in terminal, JSON when piped)
cookunity-pp-cli meals
# JSON for scripting and agents
cookunity-pp-cli meals --json
# Filter to specific fields
cookunity-pp-cli meals --json --select id,name,status
# Dry run — show the request without sending
cookunity-pp-cli meals --dry-run
# Agent mode — JSON + compact + no prompts in one flag
cookunity-pp-cli meals --agent
Agent Usage
This CLI is designed for AI agent consumption:
- Non-interactive - never prompts, every input is a flag
- Pipeable -
--json output to stdout, errors to stderr
- Filterable -
--select id,name returns only fields you need
- Previewable -
--dry-run shows the request without sending
- Read-only by default - this CLI does not create, update, delete, publish, send, or mutate remote resources
- Offline-friendly - sync/search commands can use the local SQLite store when available
- Agent-safe by default - no colors or formatting unless
--human-friendly is set
Exit codes: 0 success, 2 usage error, 3 not found, 4 auth error, 5 API error, 7 rate limited, 10 config error.
Health Check
cookunity-pp-cli doctor
Verifies configuration, credentials, and connectivity to the API.
Configuration
Run cookunity-pp-cli doctor to see the resolved config, data, state, and cache directories. The platform-default config path is ~/.config/cookunity-pp-cli/config.toml; --home, COOKUNITY_HOME, and per-kind env vars can relocate it.
Static request headers can be configured under headers; per-command header overrides take precedence.
Environment variables:
| Name | Kind | Required | Description |
|---|
COOKUNITY_TOKEN | per_call | Yes | Set to your API credential. |
agentcookie (optional)
If you use agentcookie to sync secrets across machines, this CLI auto-adopts agentcookie-managed credentials with no extra setup. When the daemon writes to this CLI's config, cookunity-pp-cli doctor reports agentcookie: detected and auth-status labels the source as agentcookie. Skip this section if you don't use agentcookie - the CLI works the same as any other.
Troubleshooting
Authentication errors (exit code 4)
- Run
cookunity-pp-cli doctor to check credentials
- Verify the environment variable is set:
echo $COOKUNITY_TOKEN
Not found errors (exit code 3)
- Check the resource ID is correct
- Run the
list command to see available items
API-specific
- doctor reports the token is missing or expired (401) — Re-copy the raw
authorization header value from a logged-in subscription.cookunity.com request and set COOKUNITY_TOKEN; tokens last ~24h.
- sync returns no meals — Confirm the date passed via --param date=YYYY-MM-DD is a valid upcoming delivery date (menus publish ~2 weeks ahead) and that COOKUNITY_TOKEN is set.
- meals is empty — Run
cookunity-pp-cli sync first; the meals command reads the local mirror.