> ## Documentation Index
> Fetch the complete documentation index at: https://a5eb32f-docs-2.manicule.dev/llms.txt
> Use this file to discover all available pages before exploring further.
> For every page in one file, fetch https://a5eb32f-docs-2.manicule.dev/llms-full.txt (large).
> To search and read these docs as tools, connect the MCP server at https://a5eb32f-docs-2.manicule.dev/api/mcp.
> Every agent surface: https://a5eb32f-docs-2.manicule.dev/.well-known/llms-manifest.json

# Carry Out a Refactor or Migration (/agents/executor)

<!-- agent-signals: reading_time_min: 2 · est_tokens: 784 · updated: 2026-11-25 -->
Related: [Choose How Bhai Delegates Work](/agents/overview.md), [Pair Program with Bhai](/agents/bhai.md), [Plan a Multi-File Change](/agents/planner.md), [Prompt Bhai in an Indic Language](/agents/multilingual.md)

> Scope a multi-file change for Executor and review the implementation and its verification.

Executor handles large refactors, framework migrations, and other changes that need edits across several files. Use it through Bhai when a rename, API change, or cleanup touches more than one part of the codebase. Define what must stay compatible before changes begin; preserving syntax doesn’t guarantee the app still behaves the same way.

## Set the scope before the edits

Name the files or modules affected and call out any public APIs, routes, or data contracts you need to keep. If you aren’t sure how far a change reaches, ask Bhai to have Planner map the dependencies first. Executor maps the files that need to move together before editing.

| Change                          | What to tell Bhai                                                                                                                                                     |
| ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Rename a shared symbol          | Give the old and new names. Say whether the old name is still part of a public interface.                                                                             |
| Extract a utility               | Name the duplicate implementations and any differences that callers rely on. Ask for imports to be updated along with the extraction.                                 |
| Migrate a framework or API      | Specify the start and end points, such as Next.js Pages Router to App Router or direct `fetch` calls to TanStack Query. Name the behavior that must survive the move. |
| Clean up or improve performance | Point to unmemoized calculations, dead code, or a suspected memory leak. State what evidence you want before keeping a change.                                        |

## Verify the files and behavior

Executor uses syntax-tree integrity and type safety as constraints while it edits. It can update imports and references together across dozens of files, so review the old callers as well as the new implementation. For a rename, look for leftover references; for a migration, check that the old entry points behave as intended or were deliberately removed.

Executor runs relevant build, lint, or test commands after changes and reports the files it modified and the checks it ran. Read that report alongside the diff. A successful syntax check can catch malformed code, but it won’t tell you whether a route still returns the same response.

## Review before you keep the change

Run through the behavior you said must stay compatible. If a test was added, check that it exercises the original requirement rather than simply matching the new implementation. If a migration changed something you expected to keep, bring that specific mismatch back to Bhai with the file or failing check.

## Next

* [Plan the scope and order of a large change](/agents/planner).
* [Inspect edits in the desktop diff viewer](/desktop/diff-viewer).
