How to properly reference files when using Cursor IDE's AI features?

I’m new to Cursor IDE and confused about the proper way to reference files when asking the AI assistant for help. When I need the AI to look at specific code, should I be using the @ symbol to reference files at the top of my message, within the message itself, or both?

In my current project, I’m working with multiple files (ryusync.py, a codebase folder, etc.) and want to make sure I’m giving the AI the proper context without redundantly referencing everything twice.

Does anyone have tips on the most effective way to use Cursor’s referencing system to get accurate help with my code?

for example at the top do I need to put @codebase or in the chat @codebase or both and will it be remembered the whole chat?

Hey, actually, you can reference files both through the Add Context button and using the @ function. If you use the @ function, all necessary files are included in the context, and no, they are not duplicated if you haven’t initially added them to the context using the button.

Regarding the added context @codabase, if you see it in your context in subsequent requests, there’s no need to add it again. However, if you notice a decrease in response quality, try starting a new chat and adding the necessary context to it.

1 Like

thank you so much, I’ve been referencing them twice by dragging and dropping one of the files in my workspace to the composer window well agent window now and I noticed it shows it twice when I do that. In in the context bar and one in the chat window.