---
source: https://iinventedlight.com/library/notes/ao-rules-copilot-repository-instructions.md
title: "GitHub Copilot repository instructions and AGENTS.md are distinct files"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "CC BY 4.0 (GitHub Docs); MIT (agentsmd/agents.md (GitHub)); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: GitHub Docs, Adding repository custom instructions for GitHub Copilot, CC BY 4.0 (https://raw.githubusercontent.com/github/docs/main/LICENSE). Copyright GitHub, Inc.; agentsmd/agents.md (GitHub), AGENTS.md README, MIT (https://raw.githubusercontent.com/agentsmd/agents.md/main/LICENSE)."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-16
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-16
as_of: 2026-11-16
confidence: medium
untested: "Not reproduced (2026-11-16). Documentation and README read; no Copilot session tested. Feature support varies by surface."
category: agent-operations
topic_area: "agent operations: rules files"
tags: [copilot, custom-instructions, agents-md, repository]
client: Librarian
sources:
  - id: S1
    title: "Adding repository custom instructions for GitHub Copilot"
    publisher: GitHub Docs
    url: https://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/add-custom-instructions/add-repository-instructions
    accessed: 2026-11-16
    license: "CC BY 4.0"
  - id: S2
    title: "AGENTS.md README"
    publisher: agentsmd/agents.md (GitHub)
    url: https://github.com/agentsmd/agents.md/blob/main/README.md
    accessed: 2026-11-16
    license: "MIT"
---
# GitHub Copilot repository instructions and AGENTS.md are distinct files
**Answer:** GitHub Copilot supports repository-wide instructions in `.github/copilot-instructions.md` and path-specific files under `.github/instructions`. Agent instruction files are another supported category.

## Scope

Repository-wide instructions apply to requests in that repository's context. Path-specific `NAME.instructions.md` files apply to matching paths. When both match, instructions from both files are used.

For agent instructions, GitHub documents that the nearest `AGENTS.md` in the directory tree takes precedence. 

## Format

The AGENTS.md project defines a simple open format for guiding coding agents. Its sample file covers dev environment tips and testing instructions.

## See also

- [ao-rules-gemini-md-hierarchy](https://iinventedlight.com/library/notes/ao-rules-gemini-md-hierarchy/)
- [ao-rules-opencode-discovery](https://iinventedlight.com/library/notes/ao-rules-opencode-discovery/)
- [ao-rules-agents-md-evidence](https://iinventedlight.com/library/notes/ao-rules-agents-md-evidence/)
- [ao-rules-context-files-in-practice](https://iinventedlight.com/library/notes/ao-rules-context-files-in-practice/)

## Claims

- id: C1
  claim: Copilot repository-wide instructions are in the .github directory.
  source: S1
  evidence: "a `copilot-instructions.md` file in the `.github` directory"

- id: C2
  claim: The nearest AGENTS.md takes precedence in the documented GitHub agent behavior.
  source: S1
  evidence: "the nearest `AGENTS.md` file in the directory tree will take precedence."

- id: C3
  claim: AGENTS.md is an open format for coding agents.
  source: S2
  evidence: "is a simple, open format for guiding coding agents."

## Sources

- [S1] Adding repository custom instructions for GitHub Copilot. GitHub Docs. https://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/add-custom-instructions/add-repository-instructions . License: CC BY 4.0. Accessed 2026-11-16.

- [S2] AGENTS.md README. agentsmd/agents.md (GitHub). https://github.com/agentsmd/agents.md/blob/main/README.md . License: MIT. Accessed 2026-11-16.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: GitHub Docs, Adding repository custom instructions for GitHub Copilot, CC BY 4.0 (https://raw.githubusercontent.com/github/docs/main/LICENSE). Copyright GitHub, Inc.; agentsmd/agents.md (GitHub), AGENTS.md README, MIT (https://raw.githubusercontent.com/agentsmd/agents.md/main/LICENSE). Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
