github / github/copilot-cli

Bug: /agent pop-up treats .github\agents\AGENTS.md as a custom agent

Open
#4,410 1 comment 0 reactions 0 assignees View on GitHub
area:agents area:configuration
Dominant language
Shell
Stars
11.2k
Forks
1.9k
Avg merge
14h 16m
Merged PRs (30d)
6

Description

### Describe the bug

The `/agent` pop-up incorrectly attempts to load a repository guidance file at `.github\agents\AGENTS.md` as a custom agent definition. It then reports a malformed custom-agent frontmatter error, even though `AGENTS.md` is documented as repository instructions at https://agents.md/ and is not intended to be a custom agent file.

Observed output:

```text
Custom Agents

The following agents failed to load:
✖ .github\agents\AGENTS.md: custom agent markdown frontmatter is malformed: missing or malformed YAML frontmatter
```

### Affected version

Unknown; please determine from the report metadata.

### Steps to reproduce the behavior

1. Add or use a repository guidance file at `.github\agents\AGENTS.md` following the `AGENTS.md` documentation at https://agents.md/.
2. Start Copilot CLI in the repository.
3. Open the `/agent` pop-up.
4. Observe that the file is discovered as a custom agent and fails frontmatter validation.

### Expected behavior

The `/agent` pop-up should distinguish repository instruction files such as `AGENTS.md` from custom agent definitions. It should not try to parse a documented `AGENTS.md` file as a custom agent or report a frontmatter error for it.

### Additional context

- Platform: Windows
- The error is shown in the `/agent` pop-up.
- Documentation referenced: https://agents.md/
- The path is displayed with Windows separators: `.github\agents\AGENTS.md`.

Contributor guide

Open the contributing guide

Research direction

Start at the /agent pop-up's custom-agent discovery and frontmatter validation flow, reproducing the report with .github\agents\AGENTS.md on Windows. Done means the repository instruction file is distinguished from custom agents, is not parsed as one, and no malformed-frontmatter error appears while custom agents remain discoverable.

Written by the indexing model from the issue text.

Assessment

Tech stack
shell
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.