github / github/copilot-cli

Path-specific custom instructions bloat context window on initial copilot session.

Offen
#1,423 1 Kommentar 6 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
area:configuration area:context-memory area:sessions
Vorherrschende Sprache
Shell
Sterne
11.2k
Forks
1.9k
Ø Merge
14 Std. 16 Min.
Gemergte PRs (30 T.)
6

Beschreibung

### Describe the bug

According to the [documentation ](https://docs.github.com/en/copilot/how-tos/configure-custom-instructions/add-repository-instructions#creating-path-specific-custom-instructions-2), creating path specific GitHub instruction files should only "apply to requests made in the context of files that match a specified path." However, every single path-specific instruction file is loaded into the system prompt, even those whose `applyTo` pattern does not match any file the user is currently working on.

This causes significant context window bloat when a repository has many instruction files scoped to different subdirectories.

### Affected version

0.0.408

### Steps to reproduce the behavior

1. Create a multi-project repository with several subdirectories (e.g., `ProjectA/`, `ProjectB/`,
`ProjectC/`, `SharedLib/`).

2. Start copilot, run /context and note the size.

3. Create the `.github/instructions/` directory.

4. Create multiple path-specific instruction files, each with a different `applyTo` pattern:
`.github/instructions/projecta.instructions.md`:

applyTo: "ProjectA/**

5. Between the creation of each successive instruction file, exit and restart Copilot and examine the context window. You will see that with each successive file, the context window grows. You can also confirm that it's just not reading the front matter by putting in an extremely large instructions file.

### Expected behavior

I would expect the initial context window not to include all of the path-specific instruction files.

### Additional context

_No response_

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.