[FEATURE] VSCode extension auto-includes opened files as context — should be opt-in by default
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
The VSCode extension automatically includes every file I open or switch to as conversation context for Claude. As a developer, I constantly open, browse, and switch between 20+ files for various reasons — reviewing code, checking references, reading logs, comparing implementations. The vast majority of these have nothing to do with my current Claude conversation.
This auto-inclusion pollutes the conversation context with irrelevant files, which misleads Claude's responses and wastes context window tokens. The current workaround is clicking the eye icon to hide each unwanted file, but this resets per message — making it impractical.
The fundamental issue: VSCode's primary purpose is editing and managing files. Claude is a plugin, not the host. A plugin should not assume all host-level file operations are intended as input for itself.
Proposed Solution
- Default behavior: do NOT auto-include opened files. The conversation context should start clean.
- Users explicitly add files via
@-mention or drag-and-drop when they want Claude to see them. - Provide a setting
claudeCode.autoIncludeOpenedFiles(default:false) for users who prefer the current auto-inclusion behavior.
This is an opt-in vs opt-out design change. For a feature that introduces noise in most workflows, the correct default is opt-in — let users choose what's relevant, rather than forcing them to constantly clean up what's not.
Alternative Solutions
Currently I manually click the eye icon to hide irrelevant files before each message. This is tedious and resets every message, so it doesn't scale.
Other AI coding tools (Cursor, GitHub Copilot Chat) handle this by letting users explicitly add files to context rather than auto-including everything that's open.
Related issues: #23968, #24726
Priority
High - Significant impact on productivity
Feature Category
CLI commands and flags
Use Case Example
_No response_
Additional Context
_No response_
Showing cached comments. Read the full discussion on GitHub ↗
7 Comments
Agreed — auto-including opened files as context should be opt-in. It adds noise when browsing unrelated files during a conversation.
Please fix this. I'm not sure how this isn't a defect, it is certainly not a feature anyone would ask for.
+1 on this being opt-in by default.
My usage: I'm prompting Claude Code dozens of times a day in VS Code, and maybe 1 in 20 prompts actually needs the currently open file as context. The rest of the time I'm asking about other parts of the codebase, running skills, delegating to agents, or having a conversation that has nothing to do with whatever tab happens to be focused.
Right now I have to click the eye icon on every single new session to remove the attachment. It's a small friction but it adds up fast, and worse, when I forget, the wrong file silently ends up in context and skews the response.
A simple claudeCode.autoIncludeOpenedFiles: false setting would fix this completely. Users who want the current behaviour keep it; users like me who treat the chat as a general-purpose agent interface (not a "ask about this file" tool) can turn it off once and forget about it.
Multiple concurrent sessions in the same window. I open a config file with credentials for my own reading; it gets auto-forwarded to every active conversation. Already had to rotate secrets because of this. Inverting the default would fix it
+1 and following. Extremely sketchy way to accidentally dump creds to claude.
For anyone finding this via search: a working community patch that defaults the chip to OFF (toggle stays functional) is documented at #24726 (comment). It covers both
<ide_opened_file>and<ide_selection>since they share the same producer. Note:CLAUDE_CODE_DISABLE_ATTACHMENTS=1does not help — wrong codepath.I say "f$#k you claude" several times a day because it keeps insisting on sending unrelated sh@%.
Every time I switch conversations, even if I toggled off context before, it toggles back on automatically. That's insane!