Why is my copilot using my global instruction instead of workspace instructions in vscode
- User
Why is my copilot using my global instruction instead of workspace instructions in vscode
Assistant
This sounds like a configuration issue where GitHub Copilot is prioritizing your global settings over workspace-specific ones. Here are the most likely causes and solutions:
Check your settings hierarchy: VSCode follows a specific order: workspace settings should override user (global) settings. Make sure your workspace instructions are properly defined in your
.vscode/settings.jsonfile within your project folder, not just in your global settings.Verify the setting names: Ensure you're using the correct setting keys in your workspace configuration. For Copilot instructions, you'll typically want something like:
{ "github.copilot.chat.instructions": "your workspace-specific instructions here" }Restart the Copilot service: Sometimes Copilot needs a refresh to pick up new workspace settings. Try running the "GitHub Copilot: Restart Language Server" command from the Command Palette (Ctrl/Cmd+Shift+P).
Check for conflicting extensions: Other AI coding assistants or extensions might be interfering with Copilot's configuration loading.
Workspace trust: Make sure your workspace is trusted in VSCode, as some features (including custom configurations) may be restricted in untrusted workspaces.
If the issue persists, you might want to temporarily disable your global instructions to test if the workspace ones are being read at all, which can help isolate whether it's a loading issue or a precedence problem.
- User
I am referring to the copilot-instructions.md and I also have a global-copilot-instructions.md file. My workspace instructions are stored in workspace/.vscode directory
Assistant
Ah, I see the issue now. GitHub Copilot has a specific hierarchy for how it reads instruction files, and it sounds like your global instructions are taking precedence over your workspace ones.
File precedence order: Copilot typically reads instructions in this order (with later ones overriding earlier ones):
- Global instructions (
global-copilot-instructions.mdin your user settings directory) - Workspace instructions (
copilot-instructions.mdin your project root or.vscodefolder)
Check your file locations:
- Your workspace
copilot-instructions.mdshould be either in your project root directory OR in the.vscodefolder - Make sure the filename is exactly
copilot-instructions.md(notworkspace-copilot-instructions.mdor similar)
Troubleshooting steps:
- Verify file detection: Open the Command Palette and run "GitHub Copilot: Open Instructions" to see which instruction files Copilot is actually detecting
- Check file encoding: Ensure your workspace instructions file is saved as UTF-8
- Restart Copilot: Use "GitHub Copilot: Restart Language Server" after making changes
- Test isolation: Temporarily rename your global instructions file to see if workspace instructions take effect
Common gotcha: If your global instructions are very comprehensive or end with broad directives, they might be effectively overriding your workspace-specific ones even when both are loaded. Try adding something distinctive to your workspace instructions to test if they're being read at all.
Which directory structure are you using for your workspace instructions?
- Global instructions (
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.