The “Include project structure” feature currently does not respect the rules defined in the .cursorignore
file. As a result, directories like .venv
, __pycache__
, and other ignored paths are included in the generated project structure view. This can make the structure overly verbose and difficult to navigate, especially in projects with large virtual environments or many cached files.
Ideally, the feature should parse .cursorignore
and exclude any files or directories listed there from the project structure output, similar to how .gitignore
works for Git operations.
+1 to this. Atm the feature basically fills the context window with thousands of tokens of irrelevant file paths, which isn’t great for model performance (and cost).
Though it seems to be selective, at least for me. E.g., my node_modules/ paths seem to be correctly ignored in the project structure while my .venv/ and .next/ paths are included.
Separately, assuming the above gets fixed soon, one request I have for this feature would be either 1) the ability to control its level of nesting, and/or 2) having deeper levels of nesting in the tree get automatically added to context as the agent reads files in deeper parts of the project. Though not a huge deal since this can be done manually via .cursor/rules and glob patterns
Project structure should be respecting .gitignore and .cursorignore.
Feel free to send me a message with your request Id and any other details that lead you to believe its not working correctly!
Hm still not working for me.
I’m on version 0.5+, using WSL2.
I am using a .cursorignore in my root (with hierarchal cursorignore enabled) that includes .venv (including with a bunch of wildcard glob patterns). I also have added .venv to the global cursorignore. It is correctly showing the cursorignore icon next to the folder and all of its child folders, so it seems to be ignoring it in general (like for indexing and chat and stuff), and it is also being correctly .gitignored (which I assume should be enough on its own). Same issue with **/.next/ folders (though **/node_modules/ is being correctly ignored/excluded).
I’ve also restarted cursor after all the above settings have been applied, and have tried deleting the codebase index and resyncing.
The reason I think its not working is because when i have the feature enabled and then open a new chat, without any files or anything added to context, and I ask Gemini or whatever model to output the structure of my project that it sees verbatim, then it outputs the project_layout
with most of my gitignored folders/files including but not limited to every single package in the site-packages/ folder of my .venv
Here is the request Id for one of those chats: 617889b4-7c4e-40e7-9849-a5ccbe67c924
@mikemikula This is still a problem for me. I’m on the latest version. It’s happening in both WSL2 and native windows environments.
Request ID: 5f2e8783-5192-4132-b496-30db3cdcead3