# Recipes as Food→Action→Food graphs

How You2Chef stores a recipe: foods go into named actions that make new foods, ending in declared outputs.

**When to use:** Before reading a graph from get_recipe or writing one for create_recipe, update_recipe or match_dish.

## What to know

- A recipe is a graph (schema "you2chef.food-graph", version 2). Ingredients and dishes are both foods: an ingredient is a food no action produces; the dish is a declared output (`final`). A recipe may declare several outputs (a roast chicken and its carcass for stock).
- Every food node has a `foodId`. Leaves use ingredient ids (find them with list_ingredients or match_foods, or write `new:<name>` to create one); intermediates are named for what they are ("pizza-dough"), or get a provisional `mix:` id if you leave them unnamed.
- Actions have a verb, a title and text. They give context, not identity: two recipes are compared by their foods and how they are wired, never by verbs or titles.
- Keep independent preparations as parallel branches that join where the recipe combines them. Recipes split at those joins into parts (a dough, a sauce, then the bake), and matching and shared instructions work part by part.
- If writing a graph is too much, the recipe tools also accept simple steps; they become a linear graph.

## Tools

- `get_recipe`
- `list_ingredients`
- `match_foods`

## Graph rules

- The graph is a Recipe Flow Graph (schema "you2chef.food-graph", version 2): {"schema": "you2chef.food-graph", "version": 2, "nodes": [...], "edges": [...], "utensils": []}.
- Food nodes: {"id", "kind": "food", "label", "states"?: [...], "ingredient"?: number, "final"?: true}. A raw food has "ingredient": the 0-based number of an ingredient line. Never write ingredient ids. Each ingredient line is one raw food; a raw food may feed several actions when the source uses it in parts. A raw food may itself be something others make (bought "pizza dough"): it stays a raw food.
- Every mixture or transformed food is an intermediate food without "ingredient", produced by exactly one action. Its label names what it is, as a cook would ("whisked eggs", "pizza dough", "tomato sauce"), never a step description. states are short words for how a food changed ("chopped", "melted", "golden").
- Action nodes: {"id", "kind": "action", "verb", "title", "text", "order"}. verb is exactly one of: cut, chop, slice, dice, mince, grate, peel, crush, mash, blend, mix, stir, whisk, beat, fold, knead, roll, shape, stuff, coat, marinate, soak, season, add, pour, spread, layer, drain, strain, rinse, heat, melt, boil, simmer, poach, steam, blanch, fry, deep-fry, saute, sear, brown, roast, bake, grill, broil, toast, reduce, thicken, ferment, rest, cool, chill, freeze, cover, garnish, serve, other. title copies the source sentence or clause the action comes from, in the source language, without paraphrasing or translating; text holds further source sentences for the same action, or "". The steps cooks read are compiled from these, so every instruction sentence belongs to some action.
- Edges: {"from", "to", "role": "input"} from a food to the action that uses it; {"from", "to", "role": "output"} from an action to a food it produces. An action may have several inputs and several outputs (separating eggs gives yolks and whites). Every action produces at least one food.
- Keep independent preparations as parallel branches: join them only at the action where the source combines them. Do not chain steps just because they are listed one after another. Recipes are compared branch by branch, so a branch should be one preparation (a dough, a sauce, a filling).
- Every produced food that nothing consumes is an output of the recipe and has "final": true: the finished dish, and any by-product the source keeps (a carcass kept for stock, egg whites saved for later). Nothing consumes a final food. No cycles. order is the position of the action in the source.
