[FEATURE] VSCode extension auto-includes opened files as context — should be opt-in by default

Status Open
Maintainer reply None cached
Activity 8 comments · opened Mar 30, 2026

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_

View original on GitHub ↗

7 Comments

znorris · 4 months ago

Agreed — auto-including opened files as context should be opt-in. It adds noise when browsing unrelated files during a conversation.

insano70 · 4 months ago

Please fix this. I'm not sure how this isn't a defect, it is certainly not a feature anyone would ask for.

KR2025 · 4 months ago

+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.

yuri2801 · 4 months ago

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

brianfogg-mithrl · 4 months ago

+1 and following. Extremely sketchy way to accidentally dump creds to claude.

xlurie · 4 months ago

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=1 does not help — wrong codepath.

qwertie · 3 months ago

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!

Showing cached comments. Read the full discussion on GitHub ↗