BACKGROUND Mode
Why We Need ā« BACKGROUND Mode
The BACKGROUND mode is for massive, time-consuming tasks that you want to run across your entire codebase without blocking your workflow.
It's the "set it and forget it" mode.
It performs large-scale operations asynchronously, allowing you to continue coding, switching branches, or even closing files while it works.
š It's ideal for:
- Codebase Migrations:
"Convert the entire/srcdirectory from JavaScript to TypeScript." - Fixing All Lint Errors:
Automatically resolve all formatting or style issues reported by a linter across the whole project. - Generating Documentation:
"Add JSDoc-style docstrings to every function in the project." - Large-Scale API Updates:
"Find every instance ofapi.oldMethod()and replace it withapi.newMethod(), adapting the parameters as needed."
āļø How It Works
1ļøā£ Prompt:
You give the AI a massive, project-wide task and select the BACKGROUND mode.
2ļøā£ Job Creation:
The AI creates a background job. You'll see a progress indicator in the Cursor UI, but your editor remains fully responsive.
3ļøā£ Asynchronous Execution: The AI systematically works through your files, applying changes as needed.
š You can continue your work uninterrupted.
4ļøā£ Completion & Review:
Once the task is complete, it will notify you.
All the changes will be staged in your source control panel (e.g., Git), ready for you to review, test, and commit.
š» Example: Converting to TypeScript
- Activate BACKGROUND mode.
- The AI will start a background process.
š You are free to work on other parts of the codebase. - The AI will methodically:
Prompt:
"Go through all.jsand.jsxfiles in thesrc/componentsdirectory. Rename them to.tsand.tsxrespectively and add basic TypeScript types where possible."
- Rename files
- Infer and add types for props, state, and function parameters
- Change
PropTypesto TypeScript interfaces or types
- Once finished, you'll receive a notification.
Your Git panel will show dozens of modified files, which you can now review before committing.
š„ Working with the BACKGROUND Mode example
Because the mode has so many pitfalls and other stuff, the video would be too long to extensively explain what it does, so for this you can watch a very great video from https://www.youtube.com/@briancasel.
The video itself:
Member discussion