github / github/copilot-cli

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

Abierto
#1,423 1 comentario 6 reacciones 0 asignados Ver en GitHub
area:configuration area:context-memory area:sessions
Lenguaje dominante
Shell
Estrellas
11.2k
Forks
1.9k
Merge medio
14 h 16 min
PR fusionados (30 d)
6

Descripción

### 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_

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.