Skip to content

Rule files with applyTo globs are eagerly injected into system prompt regardless of file context (Insiders 1.117) #311462

@arndvs

Description

@arndvs

Environment

  • VS Code Insiders: 1.117.0 (commit 173f07e5fc, auto-updated April 20 2026)
  • Previous version: 1.112.0 (commit 294552bebf)
  • OS: Windows 11
  • Model: Claude (Anthropic) via Copilot Chat

Bug

Rule files in ~/.claude/rules/ that have applyTo glob patterns are now unconditionally injected into the Copilot Chat system prompt, regardless of whether any files matching those globs are in the active editor context or relevant to the conversation.

The system prompt wraps all discovered rule files with:

"Make sure to acquire the instructions before working with the codebase."

The model obeys this blanket directive and eagerly calls read_file on every rule file at session start — even when no files matching any applyTo glob are open or relevant.

Previously (1.112), rule files with applyTo globs were not listed in the system prompt at all. Only unconditional instruction files (no applyTo) appeared.

Evidence — system_prompt_0.json diff

I compared debug logs (github.copilot.chat.agentDebugLog.enabled: true) from the same workspace with the same rule configuration, before and after the update.

Before (Apr 12, VS Code Insiders 1.112, 35,195 bytes)

<instructions>
Here is a list of instruction files...
<instruction>
<file>c:\Users\...\dotfiles\global.instructions.md</file>
</instruction>
</instructions>

1 file listed — only the unconditional global.instructions.md.

After (Apr 20, VS Code Insiders 1.117, 28,161 bytes)

<instructions>
Here is a list of instruction files...
Make sure to acquire the instructions before working with the codebase.
<instruction>
<file>c:\Users\...\.claude\rules\env-security.md</file>
<applyTo>**/.env*, **/secrets/**, **/*.secret.*, **/credentials*</applyTo>
</instruction>
<instruction>
<file>c:\Users\...\.claude\rules\migration-safety.md</file>
<applyTo>**/migrations/**, **/prisma/migrations/**, **/db/migrate/**</applyTo>
</instruction>
<instruction>
<file>c:\Users\...\.claude\rules\terminal-workarounds.md</file>
<applyTo>**/bin/**, **/*.sh, **/*.bash</applyTo>
</instruction>
<instruction>
<file>c:\Users\...\.claude\rules\test-conventions.md</file>
<applyTo>**/*.test.{ts,tsx,js,jsx}, **/*.spec.{ts,tsx,js,jsx}, **/__tests__/**</applyTo>
</instruction>
<instruction>
<file>c:\Users\...\.claude\rules\global.instructions.md</file>
</instruction>
</instructions>

5 files listed — all 4 conditional rule files injected alongside the blanket "acquire" directive. The <applyTo> metadata is present but the model has no instruction to treat it as a gate.

Additional changes in the new system prompt

Aspect Old (1.112) New (1.117)
Model identity "Claude Opus 4.6" "GPT-5.3-Codex" (incorrect when using Claude)
Personality sections <communicationStyle>, <securityRequirements>, <operationalSafety>, <implementationDiscipline> <gptAgentInstructions>, <structuredWorkflow>, <communicationGuidelines>
Removed sections <fileLinkification>, <notebookInstructions>, <toolSearchInstructions>, <communicationExamples>, <parallelizationStrategy>, <taskTracking>
New sections <applyPatchInstructions>, <example>

Impact

  • Context bloat: ~30-50% unnecessary token usage at session start from loading irrelevant rule files
  • Rules designed for narrow file types (.env, migrations, tests) are loaded for every conversation regardless of topic
  • The model has no way to distinguish "conditional metadata" from "load everything" since the wrapper says "acquire the instructions"
  • Model identity is incorrect when using non-GPT models

Expected behavior

Rule files with <applyTo> globs should either:

  1. Not be injected into the system prompt unless files matching the glob are in the active editor context (the old 1.112 behavior), OR
  2. The wrapper text should instruct the model to respect <applyTo> as a conditional gate and not load those files unless matching files are being worked on

Steps to reproduce

  1. Create rule files in ~/.claude/rules/ with frontmatter like applyTo: "**/*.test.*"
  2. Open a workspace with no test files, no .env files, no migrations
  3. Enable github.copilot.chat.agentDebugLog.enabled: true
  4. Start a new Copilot Chat agent session
  5. Observe the agent calling read_file on every rule file at session start
  6. Check system_prompt_0.json in debug logs to confirm all rules are in the prompt

Workaround

Adding a counter-directive in an always-loaded instruction file:

<rule-loading>
Instruction/rule files that include an `<applyTo>` glob pattern are CONDITIONAL —
only read them when a file matching that glob is actively being edited or is
directly relevant to the current task. Do NOT eagerly load all rule files at
session start. The `<applyTo>` metadata is a gate, not a label.
</rule-loading>

This is a soft mitigation — it depends on model compliance rather than platform enforcement.

Related issues

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions