ML.ai

Rename it everywhere. Every caller moves with it

ML.ai finds every reference before it edits the definition, then lands the rename and each caller together in one diff you review.

Who uses ML.ai for refactors

Developers changing shared code that many other files depend on.

  • Developers renaming shared code

    A function, type or constant used in more places than anyone remembers.

  • Teams cleaning up a pattern

    The same idea written three different ways across the codebase, made consistent in one pass.

  • Reviewers who want the whole change

    The definition and every caller in one diff, so nothing is left half-migrated.

A refactor is only as safe as the callers it found

Changing the definition is easy. These four things decide whether the rest of the code still works.

The caller you forgot is the one that breaks

A rename that misses one call site compiles in your head and fails in production. ML.ai searches for every reference before it edits the definition.

A half-finished rename is worse than none

The definition and every caller land together, so the codebase is never left between the old name and the new one.

It reads references, not only strings

It follows how the function or type is used across the project instead of replacing every matching string, so unrelated names are left alone.

The whole change is one thing to review

Every edit is a real diff against your files, so review means reading code. A large refactor is still large, but it is all in one place.

Refactoring by hand versus handing it off

By hand

You rename a function, then grep for callers by hand, and find out weeks later that a call site you missed has been broken the whole time.

With ML.ai

ML.ai searches the project for every reference before editing the definition, so the rename and every caller it found land together in one diff.

Which agent actually does this

general · Search · Read · Write diff

Finds every caller, then edits

Traces references across the project before touching the definition, and lands the rename or restructure and every call site together in one diff.

architect · Read · Plan · Write

Optional, for a large restructure

Plans the approach first when a refactor is big enough that the order of work is not obvious, before general carries it out.

How a refactor goes from request to approved diff

A refactor is only safe if every caller was found. ML.ai follows references through the project, edits the definition and the callers together, and holds it all behind a diff.

1Name the shape you wantDescribe the target: extract this into a hook, rename this type and every usage, split this file along these lines.
2It finds every caller firstBefore editing the definition, it traces where the function, type or pattern is used across the project, including callers you might not remember.
3One coherent diff, not a partial editThe rename or restructure and every call site it touches land together, so the codebase is never left half-migrated between the old and new shape.
4Approve at your own paceA large refactor can span many files. Review the diff as a whole, or push back on any part before it is written.

Common refactoring problems and fixes

Where refactors usually break, and how ML.ai closes each gap.

The caller nobody remembered

A function used in a hook, a route and a test, where only two of the three were on your mind when you renamed it.

How ML.ai handles it

ML.ai searches for every reference before it edits, so the call site you forgot is in the diff.

Renamed, but not everywhere

The definition changes and two callers still use the old name, so the build breaks on a branch that looked finished.

How ML.ai handles it

The definition and every caller are written together as one diff, so the old name is gone everywhere at once.

A change too big to trust

A wide change reviewed one file at a time, where each file looks fine and the whole is never read.

How ML.ai handles it

The whole refactor is one diff in front of you, held behind Allow, Always or Deny before anything saves.

Where this stops

The real edges of what ML.ai can do here, stated plainly instead of left for you to discover.

01
01

Runtime-built calls can hide

A call built from a string at runtime may not show up the way a static reference does. Worth checking yourself.

02
02

The approval gate does not shrink

A refactor across many files is still a large diff to review. The Allow, Always or Deny prompt is the same size as for any change.

03
03

Unclear approach? Plan first

For a restructure where the approach itself is not clear, plan it with architect, then hand the edit to general.

Apply edits to 3 files?

One diff across the schema, the API route and the task card.

route.tsschema.prismaTaskCard.tsx+2 −1
20export async function POST(req) {
21- const { title } = await req.json()
21+ const { title, dueDate } = await req.json()
22+ return createTask({ title, dueDate })
AllowAlwaysDeny

Build

Describe a feature in a sentence and ML.ai writes it across every file it touches, held behind one real diff before anything saves.

Plan · move off the .ini loader

  1. 1Add a shared config interface
  2. 2Read environment variables behind it
  3. 3Remove the .ini loader

Nothing edited until you hand it to general

Hand to generalRevise

Legacy modernization

explore maps what the old code does today, architect plans the path, and general carries it out as small reviewable diffs.

FAQs

Will it find every caller of a function I rename?

It searches and reads the project for references before editing, which catches static usages reliably. A call built dynamically from a string at runtime is the case worth double-checking yourself.

Can a refactor accidentally change behavior, not just structure?

The diff shows exactly what changed, so any behavior drift is visible before you approve. A large refactor is still worth reading closely, the same way you would review a teammate’s.

Is a big, multi-file refactor split into several approvals?

It lands as one coherent diff so the codebase is never left half-migrated, but you can ask for it in stages if you would rather review incrementally.

Can it split a file or extract a function, not only rename?

Yes. Describe the target shape, such as extracting a hook or splitting a file along given lines, and it edits the definition and the callers together.

When should I plan with architect first?

When the refactor is big enough that the order of work matters, or the target shape is not obvious yet. architect returns the key files and an ordered plan before general edits anything.

Try ML.ai today, or talk to us about what is next

Install the editor agent on your own machine, or book a call to talk through your team’s workloads