Skip to content

Codebase indexing

Trae AI can build code index for the project. Once the index is built, when users chat with the AI assistant using #Workspace or #Folder, the AI assistant can understand the currently opened project and use the entire project as context to provide more accurate responses.

If code index has not been built or is incomplete, using #Workspace or #Folder to chat with the AI assistant may result in incomplete context recall, leading to incomplete answers. In this case, the Reference section will display prompts such as "Indexing in progress" or "Index not built".

Important notes

You can decide which files should be excluded when building your codebase index by configuring the files to be ignored. These ignored items are never used for code indexing, ensuring your sensitive data remains private. For more information, refer to "Ignore files".

  1. At the top-right corner of the side chat box, click Settings icon > Context; or click the profile icon in the top-right corner of IDE and select AI Management > Context from the menu.
  2. The Context tab appears.
  3. In the Code Index Management section, manage code index for your project. Below are the available operations:
OperationDescription
Start buildingFor projects containing 5,000 files or fewer, Trae will automatically build the code index upon opening the project.

If the number of files exceeds 5,000 and the you desire more accurate project-level responses, you can click the Start building button to build code index for the current project.

Start building
Cancel buildingIf exceptions occur during the building of code index and you want to stop it, click the Cancel build button.

Cancel building
RebuildIf you want to rebuild code index, click the Rebuild button to continue the previous build.

Rebuild
Clear indexIf you want to clear the code index, click the Clear button.

Clear index

Your Ultimate AI-Powered IDE Learning Guide