Describe the bug
When running Copilot CLI outside of a git repository, the same custom instruction file (e.g. AGENTS.md) is loaded twice, resulting in duplicate entries in the system prompt. This causes the custom instructions to be applied redundantly, which may affect the model's behavior and wastes tokens.
Affected version
GitHub Copilot CLI 0.0.411.
Steps to reproduce the behavior
-
Create AGENTS.md at the project root.
-
Run Copilot CLI and ask a question.
copilot --model claude-sonnet-4.5 -p "Please tell me the number of custom_instructions read and the header for each custom_instruction."
-
Copilot CLI then reports that it found 2 custom instruction files.
I found **2 custom_instruction blocks** in my system prompt.
Both have the identical header:
1. `# Magic number 42`
2. `# Magic number 42`
Total usage est: 1 Premium request
API time spent: 5s
Total session time: 7s
Total code changes: +0 -0
Breakdown by AI model:
claude-sonnet-4.5 17.8k in, 164 out, 0 cached (Est. 1 Premium request)
Expected behavior
Copilot CLI should load each custom instruction file only once, regardless of whether a git repository is present.
Additional context
Control
As a control, running the same command inside a git repository loads the file only once.
-
Create AGENTS.md at the project root.
-
Initialize a git repository.
-
Run Copilot CLI and ask a question.
copilot --model claude-sonnet-4.5 -p "Please tell me the number of custom_instructions read and the header for each custom_instruction."
-
Copilot CLI then reports that it found only 1 custom instruction file.
I read **1** custom_instruction.
The header is: **# Magic number 42**
Total usage est: 1 Premium request
API time spent: 4s
Total session time: 7s
Total code changes: +0 -0
Breakdown by AI model:
claude-sonnet-4.5 17.8k in, 163 out, 0 cached (Est. 1 Premium request)
Describe the bug
When running Copilot CLI outside of a git repository, the same custom instruction file (e.g. AGENTS.md) is loaded twice, resulting in duplicate entries in the system prompt. This causes the custom instructions to be applied redundantly, which may affect the model's behavior and wastes tokens.
Affected version
GitHub Copilot CLI 0.0.411.
Steps to reproduce the behavior
Create AGENTS.md at the project root.
# Magic number 42Run Copilot CLI and ask a question.
copilot --model claude-sonnet-4.5 -p "Please tell me the number of custom_instructions read and the header for each custom_instruction."Copilot CLI then reports that it found 2 custom instruction files.
Expected behavior
Copilot CLI should load each custom instruction file only once, regardless of whether a git repository is present.
Additional context
Control
As a control, running the same command inside a git repository loads the file only once.
Create AGENTS.md at the project root.
# Magic number 42Initialize a git repository.
Run Copilot CLI and ask a question.
copilot --model claude-sonnet-4.5 -p "Please tell me the number of custom_instructions read and the header for each custom_instruction."Copilot CLI then reports that it found only 1 custom instruction file.