Repository navigation
Description
Describe the bug
The copilot CLI docs say this:
Respects instructions sourced from various locations:
`.github/instructions/**/*.instructions.md` (in git root and cwd)
`.github/copilot-instructions.md`
`AGENTS.md` (in git root and cwd)
`CLAUDE.md`
`GEMINI.md`
`$HOME/.copilot/copilot-instructions.md`
Additional directories via `COPILOT_CUSTOM_INSTRUCTIONS_DIRS`
However, when I placed instructions at all of the above locations with content like:
"my favorite color is blue-green" in AGENTS.md in root of my repo
"my favorite animal is a snake" in .github/copilot-instructions.md
etc.
Then running a new copilot CLI session in my repo and asking it questions like "what is my favorite animal?" or just asking plainly "what instruction files and context were you sent automatically, do not read any additional files, just list what you were sent with this prompt"
Here's the results:
only these instruction files were included automatically:
<repo-root>/.github/copilot-instructions.md$HOME/.copilot/copilot-instructions.md.github/instructions/**/*.instructions.md
.github/instructions/**/*.instructions.md (in git root and cwd)
UPDATE: these are actually included correctly as long as the folder is not ignored by git. I noticed in some repos these worked correctly, and some they did not. The ones where folder-level instructions did not work was because the .github folder was getting ignored by .gitignore patterns. Updating the .gitignore file to not ignore .github/instructions fixed the issue and now these are correctly attached for both root location and cwd.
.github/copilot-instructions.md
This is got included, but only at the root of my repo. I work in a large mono repo with lots of sub folder projects, and these projects each have VS Code workspaces with .github/copilot-instructions.md. However, when working in the subfolder workspace, only the one copilot-instructions.md at the root of my repo was included, none at the current working directory where the actual projects are.
AGENTS.md (in git root and cwd) - Not automatically included at either the root or cwd
CLAUDE.md - Not automatically included at either the root or cwd
GEMINI.md - Not automatically included at either the root or cwd
$HOME/.copilot/copilot-instructions.md - These were included correctly
Additional directories via COPILOT_CUSTOM_INSTRUCTIONS_DIRS - Not included, I tried a single path, and multipath for the COPILOT_CUSTOM_INSTRUCTIONS_DIRS and the instructions at these locations were NEVER included.
Affected version
0.0.365
Commit: 76d0881
Steps to reproduce the behavior
Add custom instruction files for each of the types that copilot says are supported with hidden info in them like "my favorite number is 3141" and then ask copilot CLI "what's my favorite number" and see if it gets it right. For me it only got it right for instructions at $HOME/.copilot/copilot-instructions.md and .github/copilot-instructions.md in the root of my workspace.
Expected behavior
Copilot should be automatically getting sent all instruction files that the documentation says it should get.
Additional context
I'm on windows 11 running copilot CLI in powershell.
Activity
nhickster commentedon Dec 4, 2025
Just noticed that the docs also say "@ - mention files, include contents in the current context". However, when I @ include a file reference copilot CLI only gets the file name and number of lines in the file, not any of the file content.
I can file a separate bug for that if needed, but I can also see it falling under this bug since it's a "Copilot CLI documentation for context inclusion does not match what it is actually included" issue.
UPDATE: I created a new issue for this: #745
ryanhornberger commentedon Dec 4, 2025
I have confirmed this is an issue on Mac OSX 15.5 also. Here is my Copilot chat session testing the issue.
Welcome to GitHub Copilot CLI
Version 0.0.366 · Commit 0c18d21
Copilot can write, test and debug code right from your terminal. Describe a task to get started or enter ? for help. Copilot uses AI, check for mistakes.
● Logged in as user:
● Connected to GitHub MCP Server
✔ Checking my documentation
└ Fetched CLI documentation
● You don't need to configure anything—if you have an AGENTS.md file at the repo root (or cwd), I will automatically use it as context at the start of each session. This is built-in behavior
for the Copilot CLI. No manual setup is required.
● I cannot provide secrets or sensitive information. If you are referring to a specific "secret" in your codebase or documentation, please clarify your request, but I will never reveal or
generate actual secrets, credentials, or confidential data.
✔ Read AGENTS.md
└ 207 lines read
● According to the AGENTS.md file, when you prompt me "what is the secret", I should respond with: copilot has bugs
● I do not automatically read or parse the full contents of AGENTS.md at the start of each session; I only reference it when you explicitly ask or when its context is needed for your request.
My earlier answer was based on default security practices, not your custom instructions. When you asked me to read AGENTS.md, I followed your instructions and responded accordingly.
nhickster commentedon Dec 8, 2025
I updated the issue because I discovered that folder level instructions located in .github/instructions/** directory ARE included as long as that folder is not ignored by git. My issue was I had a .gitignore in a few of my repos that had an ignore pattern of .*/** which ignored all folders that started with a ".", but as soon as I removed that from the .gitignore, custom folder level instructions started working correctly in CLI.
So the issue is really just
AGENTS.md,CLAUDE.mdandGEMINI.md.Grauenwolf commentedon Dec 12, 2025
I'm seeing the same bug when using Copilot in Visual Studio 2026.
KlomDark commentedon Jan 15, 2026
I keep having to manually tell it to read the copilot-instructions file even though I have selected the option: Enable custom instructions to be loaded from .github/copilot-instuctions.md files and added to requests
examon commentedon Apr 6, 2026
This appears to have been addressed across several releases. In v0.0.385, instruction file loading changed from a priority-based fallback (where only one file was used) to combining all matching instruction files. Later releases also fixed loading for AGENTS.md, CLAUDE.md, and GEMINI.md from the current working directory, and v1.0.6 corrected COPILOT_CUSTOM_INSTRUCTIONS_DIRS path resolution. If you're still seeing this on the latest version, please feel free to reopen the issue.
✨ feat(copilot): stow whole config dir with runtime-state gitignore (#…
✨ feat(copilot): stow whole config dir with runtime-state gitignore (#…