OpenRewrite recipes: deterministic, type-aware code change at scale
What a recipe is
A program shaped to
the problem. Not a prompt.
A recipe is a deterministic, composable program. It walks your code’s Lossless Semantic Tree, recognizes an exact target by its resolved type (not its text) and rewrites it precisely. Same input, same result, every time. The business problem is a lock; the recipe is the key cut to fit it.
Authored three ways: compose existing recipes in declarative YAML, write a Refaster before/after template the compiler checks, or drop to an imperative Java visitor for the hard cases.
type: specs.openrewrite.org/v1beta/recipe name: org.openrewrite.java.logging.slf4j.Slf4jBestPractices displayName: SLF4J best practices recipeList: - org.openrewrite.java.logging.slf4j.Slf4jLogShouldBeConstant - org.openrewrite.java.logging.slf4j.ParameterizedLogging - org.openrewrite.java.logging.slf4j.CompleteExceptionLogging - org.openrewrite.java.logging.slf4j.MatchIsLogLevelEnabled # compose existing keys into one — no code
The catalog
Every shape of problem
already has a key.
The same lock repeats across an industry. So the catalog is broad on purpose. Thousands of small, sharp keys compose into composites, each fanning out into tens of thousands of sub-recipes in a single run.
Determinism
Run it twice. Get the exact same diff.
Just because you can push a change through model weights doesn’t mean you should. Most of the work is structural (find this, resolve that, rewrite every call site) and structure has a cheaper, surer answer than a guess.
The guess
An agent guessing per file
- A fresh guess every run. Run two never matches run one.
- Up to 30× cost variance for the same task.
- Text-and-regex blind to generics, inheritance, call sites, so it breaks builds.
- Caps at a 30–40% success rate on real migrations.
The key
One validated recipe
- Identical output every run, no hallucination in execution.
- Resolves real types across files and transitive dependencies.
- Authored once, validated, then run across the whole estate.
- 30,000 tokens, 3 minutes, done, vs 61M tokens and never finished.
Reviewable by design
A diff your engineers
can actually trust.
A recipe edits the tree, then prints it back exactly as it found it. What changes is only what had to change, so the diff is small, format-preserving, and reviewable by the engineers who own the code.
See it on your code
Bring a migration you’ve been putting off.
We’ll run a real recipe against a repository you choose and show you the diff. It’s deterministic, type-aware, and identical every run.
Go deeper
From the field
Recipes are the deterministic transformation layer of the Moderne Platform: composable, type-aware programs that run identically across thousands of repositories.
Recipes, in brief
A recipe is a deterministic program that traverses your code’s Lossless Semantic Tree (LST) using the visitor pattern: visiting each node, recognizing an exact target by its resolved type, and editing it precisely. The same input always produces the same result, with no AI hallucination in execution.
An agent editing source is a fresh guess on every run. It’s text-level, non-deterministic, and blind to type information across files. A recipe is authored once, validated, and then applies an identical, type-aware change every run, across any number of repositories. The agent’s job is to reach for (or write) the recipe, not to be the editor.
The open catalog holds 10,000+ recipes spanning Java, Kotlin, C#, Go, Python and JavaScript, across more than 340 frameworks and tools: Spring, Quarkus, Hibernate, JUnit, AssertJ, the major clouds, CVE patches and more.
Yes. Recipes are authored three ways: declarative YAML that composes existing recipes into a named pipeline (no code), Refaster-style before/after templates the compiler verifies, or imperative Java visitors for full control over the LST.
Recipes produce format-preserving, minimal diffs. Imports, comments and whitespace they didn’t touch are unchanged, and the result is deterministic and identical every run. Engineers review a clean, trustworthy diff instead of a noisy, approximate one.