Skip to content

Copilot CLI custom instruction behavior significantly differs from VSCode #1318

@KeithIsSleeping

Description

@KeithIsSleeping

Describe the bug

The current Copilot CLI behavior, verified in 0.0.405, is that it will read in the FULL contents of instruction file in the .github/instructions folder, and immediately apply it as context. This happens regardless of instruction.md YML frontmatter applyTo patterns, or decription text.

This does not match the behavior of the documentation: https://docs.github.com/en/copilot/how-tos/copilot-cli/add-custom-instructions#creating-path-specific-custom-instructions.

VSCode, however, will create an index of these files and present it to the agent as instructions available for it to read, which it will read in dynamically. It will also deterministically attach instruction files into a conversation when the relevant applyTo glob pattern matches attached files.

The difference here impacts the way we context engineer instruction files, we need parity between clients and the documentation.

Affected version

GitHub Copilot CLI 0.0.405

Steps to reproduce the behavior

Create instruction files in .github/instructions folder.

Run Copilot CLI. Observe the full files are read into context, both by examining the context with a /context command, and by testing the agent to see if its aware of the file contents itself.

Expected behavior

Create instruction files in .github/instructions folder.

Run Copilot CLI. Observe only the description text and filename are read context as an index, both by examining the context with a /context command, notice the context increase is marginal, and that instruction files will be read in dynamically when agent is tested about the contents of the instruction files.

Additional context

Here's a real world comparison between instruction implementation and context usage between Copilot CLI and VSCode.

Baseline context (no instructions)
Copilot CLI:

Image

VSCode:

Image

Adding 5 instruction files:
Copilot CLI:

Image

VSCode:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions