Repository navigation
Description
Describe the bug
I tried using custom AGENTS.md file with Copilot CLI on Linux. The file was placed on the NFS disk in the directory outside the hierarchy of the directory where the Copilot CLI was launched from. I defined env variable COPILOT_CUSTOM_INSTRUCTIONS_DIRS to point to this directory. I expected Copilot CLI to load the instructions automatically but this did not happened. When asked about it specifically, Copilot CLI did load the instructions (based on the value of COPILOT_CUSTOM_INSTRUCTIONS_DIRS, the location of AGENTS.md was not provided interactively). It also offered this comment:
● You're absolutely correct. This is a legitimate gap between documented behavior and actual behavior. The documentation states that AGENTS.md files in
COPILOT_CUSTOM_INSTRUCTIONS_DIRS should be loaded automatically, but clearly that's not happening.
This is a tool issue that should be reported to the Copilot CLI team so they can either:
- Fix the auto-loading mechanism to honor the COPILOT_CUSTOM_INSTRUCTIONS_DIRS variable as documented, or
- Update the documentation to clarify the actual behavior and require manual loading
Affected version
GitHub Copilot CLI 0.0.408.
Steps to reproduce the behavior
- On Linux, create custom AGENTS.md file and place it outside the current directory's tree. Have some specific instruction in this file that you can ask Copilot CLI about.
- Set the value of COPILOT_CUSTOM_INSTRUCTIONS_DIRS to point to the directory where AGENTS.md file is located (command is shell specific, for bash shell: export COPILOT_CUSTOM_INSTRUCTIONS_DIRS="<directory_path>")
- Launch Copilot CLI
- Ask Copilot CLI about the instruction provided in AGENTS.md. In my case, it was not aware of the instruction(s) from my AGENTS.md file.
- Ask Copilot CLI where it got its instructions from.
Expected behavior
I expect Copilot CLI to automatically load instructions from AGENTS.md files located in the directories specified by env variable COPILOT_CUSTOM_INSTRUCTIONS_DIRS. This did not happen in my test.
Additional context
- SUSE Linux Enterprise Server 15 SP4 (version 15.4)
- x86_64
- xfce4-terminal (1.0.0)
- bash shell
Activity
vegerot commentedon Feb 24, 2026
+1
cturner-crestron commentedon Apr 3, 2026
+1
I'm seeing the same behavior on MacOS with Copilot-CLI v1.0.17
JanPokorny commentedon May 8, 2026
Workaround: Place instructions in
<custom-dir>/.github/instructions/system.instructions.md, e.g.:COPILOT_CUSTOM_INSTRUCTIONS_DIR=/etc/copilot-> place instructions in/etc/copilot/.github/instructions/system.instructions.mdAGENTS.md is not recognized, but this is:
(Reverse-engineered this behavior.)
corybsa commentedon May 12, 2026
It would be amazing if we could have multiple instruction files inside the ~/.copilot folder!
JanPokorny commentedon May 12, 2026
@corybsa You can, see my comment above: the word "system" is arbitrarily chosen, all *.instructions.md files will be loaded
corybsa commentedon May 12, 2026
IMO having a random folder on your computer is not a great way to have multiple instruction files fed into Copilot. I want to commit these instructions to a repo so I can easily clone them to multiple machines. I already have a repo for my ~/.copilot folder which already contains skills, hooks, etc. Why do I need a second folder/repo for instructions?
JanPokorny commentedon May 12, 2026
@corybsa In that case use ~/.copilot/instructions/**/*.instructions.md
Here's all I found:
relative to cwd and git root:
./.github/copilot-instructions.md
./AGENTS.md
./CLAUDE.md
./GEMINI.md
COPILOT_HOME, by default ~/.copilot:
$COPILOT_HOME/copilot-instructions.md
$COPILOT_HOME/instructions/**/*.instructions.md
cwd, git root, and COPILOT_CUSTOM_INSTRUCTIONS_DIRS:
<dir>/.github/instructions/**/*.instructions.md
corybsa commentedon May 13, 2026
Thanks, I tried using that directory structure yesterday and it wasn't working. It is working today, not sure what I was doing wrong.
📝 Work around COPILOT_CUSTOM_INSTRUCTIONS_DIRS not loading universally