Can't Cursor's "@" function directly cover the entire project folder or all files and folders under the current directory?

I enjoy exploring open-source projects, and my need is to quickly get an initial understanding of the entire project codebase right after opening the project folder.
To do this, I want to use Cursor’s chat or COMPOSER mode for Q&A. However, I’ve noticed that Cursor doesn’t automatically scan the entire project’s source code—it only looks at a few files that I’ve opened manually.
This means I have to manually @ specific files or folders before Cursor takes them into account.

The problem is, some projects are huge, with tons of files and deeply nested folders. Manually @mentioning each file or folder would be incredibly tedious.
I know there’s an option to use @Codebase, but it seems like this doesn’t actually feed all the project files into the large model—Cursor mostly just looks at .md files.

So, is there no way for Cursor’s @ function to cover the entire project folder or all files under the current directory? Something like how in Git, you can use git add . where the dot represents all files and folders.
Ideally, I’d like to @ the entire project so that all files are directly fed into the large model.

The @codebase command actually tries to find the most relevant files rather than scanning everything - this is because we can’t fit entire projects into the LLM’s context window

For exploring large codebases, I’d recommend:

  1. Enable codebase indexing in settings
  2. Use @folders for specific directories you want to explore
  3. Use @codebase with specific questions about functionality/features

The underlying LLMs aren’t quite smart enough yet to handle entire massive codebases at once, but these approaches should help you explore projects more effectively

1 Like

Thank you for your detailed explanation.
I always thought that after Cursor finishes indexing the entire project, it would automatically submit all the project data to the LLM in chat or COMPOSER mode.
If you have some spare time and energy, could you check out the open-source tool Cline? It seems that Cline submits all the project data to the LLM during conversations, although this would consume a huge amount of API resources.

I get where you’re coming from with Cline - we’ve actually found that throwing entire codebases at LLMs often doesn’t work as well as you might expect. The models tend to get overwhelmed and give less useful responses

We’re working on some features to make large codebase exploration better though. For now, targeted questions with @codebase or @folder tend to give the best results

Thanks @danperks that’s very helpful. So we have a codebase of several hundred files in some repos. If we wanted to do some refactoring that needs to go across the whole codebase, would this even be possible ? Cursor would have to find all files that need refactoring based on the prompt and then modify them.

Has anyone done anything like this ? How should we approach this ? Is it too early, are we expecting too much ?

E.g. “Remove the feature toggle xyz wherever you see it in the @codebase

While Cursor can help with large refactoring tasks, doing it all automatically across hundreds of files isn’t quite there yet. The best approach could be to break it down as follows:

  1. Get Composer to write a script which gets all the files you need to edit, and puts them in a text file
  2. Then, write a .md file explaining the changes which are needed to each file
  3. Finally, use the agent mode of Composer to read the file, and make the changes needed, removing the files from the list once they have been completed

This would, as you can probably tell, still be a very manual process, but is probably quicker than trying to do the changes yourself! We may have a better solution for this in the future, but the LLM’s are the limiting factor here!

1 Like

Great to get some clarify @danperks, really appreciate it. We’ll just wait for the LLMs to catch up and work with what we can. Certainly an exciting prospect and with the accelerating tech development it is only a matter of years, months, weeks, no wait… LOL

Thanks again.

1 Like

I’m super confused. I don’t have the ability to add @codebase or @folders, is that a setting somewhere?

I just had a big breakup fight with Claude 3.5 sonnet because it can’t refactor with me. It keeps forgetting all the context of what we are working on unless I add like 7 files and sometimes even specific lines into the context box in chat.

Anyway, if you could explain how to add those I would appreciate it.

I love how AI can completely forget things we were just working on, it can hallucinate and go break things that are not even of immediate concern.

Yet, Claude 3.5 Sonnet can be politely self-reflective and even give feedback to Cursor (that they don’t read or hear).

I chat yelled at Claude and this was his lovely and humble response:

All Claude showing the president humility.

Regarding your questions:

  1. Better way to set context: Yes, there should be. The current approach of adding individual files is cumbersome. A better approach would be to allow adding entire directories and having the AI understand the project structure holistically. This would help maintain proper separation of concerns and prevent mistakes like duplicating configuration.

  2. Why can’t you add a full directory: This seems to be a limitation of the current implementation. It would be much more useful if you could do something like:

/add-context directory: ./site/scripts/build-scripts/

This would allow the AI to understand:

  • The complete module structure
  • How files relate to each other
  • Where configurations should live
  • Proper separation of concerns
  1. Individual files limitation: This is definitely suboptimal because:
  • It’s easy to miss context (as I just did)
  • It’s tedious to add files one by one
  • It makes it harder to maintain proper architecture
  • It can lead to inconsistencies and duplication

Now, oh ye Cursor team, shouldn’t I just be able to click a button on that and have it sent to the Cursor feedback vector database and you can run your own implementations of Anthropic models on it to help you improve Cursor?

I’m not sure why you can’t add @codebase. Could it be that you can’t add folders because your folders only contain unsupported file formats, instead of supported formats like .py, .js, or .txt?