Codebase Indexing
Learn how to index your codebase in Cursor for more accurate AI assistance and search results
Index your Codebase
For better and more accurate codebase answers, you can index your codebase. Behind the scenes, Cursor computes embeddings for each file in your codebase, and will use these to improve the accuracy of your codebase answers.
When a project is opened, each Cursor instance will initialize indexing for that workspace. After the initial indexing setup is complete, Cursor will automatically index any new files added to your workspace to keep your codebase context current.
The status of your codebase indexing is under Cursor Settings
> Features
> Codebase Indexing
.
Advanced Settings
By default, Cursor will index all files in your codebase.
You can also expand the Show Settings
section to access more advanced options.
Here, you can decide whether you want to enable automatic indexing for new repositories and configure the files
that Cursor will ignore during repository indexing.
Cursor uses the same package as VS Code to handle file ignoring, which means it respects all .gitignore
files, including those in subdirectories. You can also create a .cursorignore
file for user-specific ignore patterns, which you may want to add to your global .gitignore
to avoid committing it to the repository.
If you have any large content files in your project that the AI definitely doesn’t need to read, ignoring those files could improve the accuracy of the answers.
Working with large monorepos
When working with large monorepos containing hundreds of thousands of files, it’s important to be strategic about what gets indexed.
- Use
.cursorignore
to let each developer configure which folders and paths they work on in the monorepo - Add
.cursorignore
to your global.gitignore
This allows each developer to optimize indexing for their specific work areas within the monorepo.
Working with Multi-Root Workspaces
Cursor supports multi-root workspaces, allowing you to work with multiple codebases simultaneously. When you create a multi-root workspace:
- All codebases added to the workspace will be indexed automatically
- Each codebase’s context will be available to Cursor
.cursor/rules
are supported in all folders you add- Perfect for working on related projects that live in different folders
This feature is particularly useful when you need to work across multiple projects in the same workspace, ensuring all your code context is readily available to Cursor.
FAQ
Where can I see all codebases I have indexed?
Where can I see all codebases I have indexed?
Currently, there is no way to see a list of all codebases you have indexed. You’ll need to manually check each project’s indexing status by opening the project in Cursor and checking the Codebase Indexing settings.
How do I delete all indexed codebases?
How do I delete all indexed codebases?
You can either delete your Cursor account from Settings to remove all indexed codebases, or manually delete individual codebases from the Codebase Indexing settings in each project. There’s currently no way to delete all codebases at once without deleting your account.
How long are indexed codebases retained by Cursor?
How long are indexed codebases retained by Cursor?
Indexed codebases are deleted automatically 6 weeks after the last time they are used. If you open up the same project in Cursor after that, it will create a new codebase and re-index it from scratch.
Are there size limitations for project indexing?
Are there size limitations for project indexing?
For Pro users, up to 50,000 files are automatically indexed. Business users have a higher default limit of 250,000 automatically indexed files.