Optimize a recipe
Recipe optimization can improve instructions, skills, tool rules, and model settings.
You can also use optimization to make a cheaper or faster model perform more like a stronger model. People sometimes call this harness distillation. The model stays fixed while the recipe changes.
Prerequisite
Install the Introspection CLI before you use this guide.
Ask the coding agent to optimize the recipe
Start with a short request:
Use Introspection to optimize this recipe.Add an outcome when you have one. For example:
Use Introspection to optimize this recipe to use GLM 5.3 and match the
performance of Opus 4.6 on our existing evals.You do not need to choose the search settings or tell the coding agent which files to change. The coding agent inspects the recipe, eval suite, saved results, and repository commands before it starts.
If you know that a complete reference result already exists, you can mention it to avoid another reference run:
There is already a complete Opus result in the eval history. Reuse it if it is
still comparable, and do not run Opus again.You can leave that detail out when you do not know. The coding agent decides whether a saved result is suitable.
You can also set a budget when you want to limit or extend the search:
Use up to two rounds and four candidates.If you leave out the budget, the coding agent uses the workflow’s default limit.
What happens next
The coding agent first reports what it found and how it will measure the result. It asks a question only when it cannot infer an important part of the goal. If the repository does not have a suitable eval suite, it explains what is missing before it starts the search.
The coding agent then runs a limited search over several recipe changes. It uses the existing eval suite to compare them and applies the best change that improves the result. If no change improves the result, it leaves the recipe unchanged.
Optimization changes local recipe files only. It does not deploy a runtime or change live resources.
Read the result
The final report tells you what the unchanged recipe scored, what the selected recipe scored, and whether it met the target. It also names the selected Git commit and the recipe changes that produced the result.
For example:
Opus reference: 43/52
GLM baseline: 33/52
Selected GLM recipe: 43/52
Improvement: 10 more checks passed
Target: metIf the search stops before it meets the target, you can keep the improvement or ask the coding agent to try another limited search. You can also give the next search a larger budget.
Verify and ship the change
After the coding agent applies the selected change, try the agent locally:
introspection localReview and commit the selected change. Then follow the Agent development lifecycle to test the same commit in development and staging before production.
Next
- Evaluate offline explains how to create an eval suite when the repository does not have one.
- Agent development lifecycle explains how to test and ship the selected recipe.