# What is a recipe, and how does Irene reuse a job it's done before?

**A recipe is a job that worked, saved as a short brief plus the exact tool calls that did it. Next time, Irene reads it as precedent: re-checking the live situation, swapping in new values, and skipping what's already done. It never replays it blindly. Solved once by a strong model, a recipe can then be followed by a cheaper one. Every run is recorded on your computer at no cost, so any good run can become a recipe.**

---

## What makes it different

| what it does | the primitive behind it | what that buys you |
|---|---|---|
| **Every run is kept, for free** | Each finished run is recorded on your computer: your request, the answer, every tool call with its exact arguments, tokens, model and files. No model is involved | Any run worth repeating can be saved after the fact, from what really happened |
| **The exact moves, not a summary** | A recipe keeps the real arguments of each step, not a prose description of them | The next run sees exactly what worked: the right search query, the right field, the right order |
| **Only the clean path is saved** | Saving a run with errors or repeated calls stops and shows the numbered steps, marked ok or FAIL, so the agent keeps only the ones that worked | A future run doesn't learn to flail the same way |
| **Precedent, not a script** | Following a recipe means re-checking the live page or file, skipping steps already done, and never reusing an old ID or position | A recipe survives a changed page or new inputs instead of breaking on them |
| **Solved big, followed cheap** | A recipe made by a strong model can be followed by a cheaper helper | Measured: three follows of one recipe cost $0.018–0.022 each instead of $0.081 |

---

## How it works

### Every run is recorded

When a run finishes, Irene writes one record to `~/.irene/runtime/cookbook.db`, readable only by you and never sent anywhere. The record holds:
- what you asked and what came back
- every tool call with its full arguments, plus a preview of each result (full results are kept separately)
- tokens, model and time
- files that appeared or changed
- how it ended: success, failure, cancelled

If your next message reads like a correction ("no", "actually", "that's not what I…"), the run is marked **mixed**. That costs nothing: it's a word check, not a model call.

The newest 2,000 runs are kept. Runs that a recipe was saved from are never deleted.

### Saving a recipe

The agent saves a recipe when you ask ("remember these steps", "do this again next week"), when you use `/learn`, or when dreaming offers and you say yes.

- **It needs a "use when…" trigger** that names a real situation (6+ words, no vague filler), exactly like skills. **Why:** a recipe that doesn't say when it's for can't be found when it matters.
- **It's saved from a real run:** the one named, or this one, or the latest in the chat.
- **The clean-path check.** If the run had an error or repeated the same call, the save stops and lists the steps as `ok` / `FAIL`. The agent then saves again, keeping only the steps that worked. **Why:** saving the exploration would teach the next run to explore the same dead ends.
- **Steps that need judgement are marked** (for example, deciding which button is the right one), so a later run knows where to think and where to just do.
- **Saving under an existing name replaces it.** The old version is kept in a `.replaced` folder.
- **Saving and deleting a recipe always ask you,** even in auto mode.

### Following a recipe

1. The agent finds it, through `discovery`, the start-of-chat list, or your `/name`.
2. It **opens it lean:** the brief, the step names, and a short peek at each step's arguments. It opens one step in full only when it needs to. **Why lean:** a recipe can contain a long generated script, and loading everything would cost more than the recipe saves.
3. It **follows it as precedent:** re-checks the live state, skips what's already true, swaps in this run's values, and never reuses old element numbers, addresses or IDs.
4. **For the saving to be real,** the agent hands the follow to a cheaper helper. Following on the same expensive model saves little.
5. **If only the values differ,** it's the same recipe, and nothing new is saved. Only a different *procedure* earns a new recipe.

### Gotchas get written down

When a follow hits something new, the agent writes it into the recipe's brief. A real one: "`web_read` now requires a list for `urls` (as of 2026-09-29…)". Saving that over the old recipe keeps the old version in `.replaced`, so the change is traceable.

---

## Its tool

| action | does |
|---|---|
| `traces` | this chat's recent runs, to pick one to save |
| `get` | open a recipe lean, or one step in full (`step=N`). Counts as a use |
| `save` | save a run as a recipe: trigger, clean-path check, judgement steps |
| `review` | list recipes that fail more than they work, near-duplicates, ones that run cleanly 5+ times, and ones with no trigger |
| `delete` | remove a recipe |

---

## Where you see it

- **Capabilities → Routines → Followed:** your recipes, described as "captured from a real run, read back step by step", with step counts and Delete.
- **The `/` picker** lists recipes after commands, skills and reflexes. Pick one to point the agent at it.
- **Observability → Savings → Recipes:** "solved once by a big model, replayed cheap". It shows what each follow saved compared with doing the job from scratch. A follow that cost more is shown as a loss, not hidden. Unpriced runs show "—".

---

## Built-in recipes

| recipe | for |
|---|---|
| **meeting-notes-to-deck** | read meeting notes, pick the audience and up to 5 sections, hand Slides a short brief, check the PDF |
| **repurpose-content** | one piece into a LinkedIn post (≤900 characters), a 5–9 post thread, and a newsletter. Never publishes |
| **research-topic-to-pdf** | a sourced brief, written up and turned into a PDF |
| **monthly-actuals-to-variance-model** | (Spreadsheets) actuals vs budget, with live variance formulas, a costs total and the operating result under it |

Plugins can bring recipes too.

**A real one:** a browser recipe for a demo shop's checkout, saved from an 11-call run. Its brief records what the agent learned:
- going to the checkout page without a session silently lands on the login page
- re-find the Login field by its text before clicking, because numbers shift
- an empty cart blocks checkout
- read the page back to confirm, because "the tool's claim vs the page's truth" can differ
- never click Continue: fill means fill

---

## How it gets better

- **Each follow is scored:** a clean finish counts as a success, otherwise a failure. These counts feed `review` and `/evolve`.
- **Sharpen:** after a follow you corrected, dreaming offers to change the recipe "always, or just this once?".
- **From recipe to reflex:** a recipe that runs cleanly again and again is marked "worth compiling". Ask Irene to turn it into a reflex, which runs as a program with no model at all for the fixed steps. This isn't automatic; the agent writes the reflex.

---

## What it costs

- **Recording runs:** nothing.
- **Following:** normal usage for the run. The saving comes from following on a cheaper model and skipping exploration.
- **Measured** on a quick web look-up recipe: the original run would cost $0.081 to repeat from scratch; three real follows cost $0.018, $0.018 and $0.022, saving $0.18 together.

---

## Limits

- **A recipe is guidance, not automation.** It needs a model to follow it. For steps that never change, use a [reflex](https://mycelen.com/manual/guides/make-a-reflex).
- **Following on a cheaper model is the agent's choice,** not forced.
- **Replacing a recipe resets its success counts.** The savings record keeps its own history.
- **Helper runs aren't recorded,** so only the agent you talk to can save from its runs.

---

## Related

- [Skills & Capabilities](https://mycelen.com/manual/reference/learning/skills-and-routines) · [Make a reflex](https://mycelen.com/manual/guides/make-a-reflex) · [Dreaming & offers](https://mycelen.com/manual/reference/learning/dreaming-and-offers)
- [Delegation & the model ladder](https://mycelen.com/manual/reference/learning/delegation-and-the-model-ladder)

[Ask Irene about this]
