Skip to content
harbor
How it worksAgentsReviewMeasureDocsPricing
Get started →
How it worksAgentsReviewMeasureDocsPricingGet started →
Home/Blog

Blog

  • Claude Code and AGENTS.md
  • Claude Code skills
  • Claude Code hooks
  • claude-mem
  • Claude Code best practices
  • Karpathy CLAUDE.md
  • AGENTS.md vs CLAUDE.md
  • Cursor rules
  • copilot-instructions.md
  • Why Claude ignores it
  • CLAUDE.md length
  • Committing CLAUDE.md
  • Agent memory compared
  • CLAUDE.md vs skills vs hooks
  • Same mistake again
  • Review comments to rules
  • Slack decisions
  • Company brain
  • Context engineering, Claude 5
  • Context rot, stale rules
  • AGENTS.md research
  • ADRs for agents
  • Memory poisoning
  • MCP memory servers
  • Claude Code, Cursor, Codex
  • Growing CLAUDE.md
  • Served vs cited

Blog

How to write copilot-instructions.md for GitHub Copilot

Published: September 23, 2026

.github/copilot-instructions.md is the repository-wide instruction file GitHub Copilot adds to every request in that repo. Keep it under two pages and not task specific. Put rules for one part of the codebase in .github/instructions/*.instructions.md with an applyTo glob. Copilot's agents also read AGENTS.md.

Every fact below was checked against GitHub's custom instructions docs and its support matrix on 2026-09-23. Which Copilot surface reads which file differs more than most guides admit, so the matrix is the part worth bookmarking.

What are the types of Copilot custom instructions?

TypeFileApplies to
Repository-wide.github/copilot-instructions.mdEvery request in the repository
Path-specific.github/instructions/NAME.instructions.mdFiles matching its applyTo glob, on top of the repository-wide file
Agent instructionsAGENTS.md, CLAUDE.md or GEMINI.md, anywhere in the repoCopilot agents. The nearest file in the directory tree takes precedence
PersonalYour GitHub settingsYou, on the surfaces that support it
OrganizationOrg settingsEveryone in the org, on the surfaces that support it

When more than one applies, GitHub sends all of them. Where they conflict, personal instructions win, then repository, then organization.

How do you write copilot-instructions.md?

GitHub's guidance is that the repository-wide file should be no longer than two pages and should not be task specific. Treat it as the short list of things a new engineer would get wrong in their first week, not as the onboarding doc.

# Payments service

TypeScript, Node 22, Postgres through Prisma. Tests: npm test.

- Webhook handlers must be idempotent. Key on the provider's event id.
- Retries go through src/lib/retry.ts. Five attempts, then dead-letter.
  Why: docs/decisions/0012-webhook-retries.md
- Never edit a migration that has been merged. Write a new one.

The same rules of thumb apply as for any instruction file. Write down what the model cannot infer from the code, give the reason next to the rule, and point at files instead of pasting them. The research on whether these files help at all is summarised in is AGENTS.md useful.

How do path-specific .instructions.md files work?

A path-specific file lives in .github/instructions/, ends in .instructions.md, and opens with frontmatter naming the paths it covers:

---
applyTo: "src/payments/**/*.ts"
---

Use the shared backoff in src/lib/retry.ts. Do not add a retry loop.

An optional excludeAgent key keeps a file away from either code review or the cloud agent. When Copilot works on a matching file, the path-specific instructions are combined with the repository-wide ones. This is the cheapest way to keep a rule about payments out of a request about CSS.

Which Copilot features read which instruction files?

Not every surface reads every file. From GitHub's support matrix, for the surfaces most teams use:

Surfacecopilot-instructions.md.instructions.mdAGENTS.md / CLAUDE.md
GitHub.com chatYesNoNo
Cloud agent (GitHub.com)YesYesYes
Code review (GitHub.com)YesYesAGENTS.md only
VS Code chatYesYesAGENTS.md only
VS Code code reviewYesNoNo
JetBrains chatYesYesNo
Visual Studio chatYesYesNo
Copilot CLIYesYesYes

The practical reading: copilot-instructions.md is the only file every surface reads. A rule that lives only in AGENTS.md reaches the cloud agent, the CLI and VS Code chat, and misses GitHub.com chat and JetBrains chat.

AGENTS.md vs copilot-instructions.md: which should you use?

If everyone uses Copilot, copilot-instructions.md reaches the most surfaces. If the team is mixed, and most are, the rules end up needing to be in both: AGENTS.md for Codex, Cursor and Claude Code, and copilot-instructions.md for the Copilot surfaces that do not read AGENTS.md. The usual answer is to keep one canonical file and make the other a short pointer to it, then check that the pointer is actually followed on each surface. The tool-by-tool view is in AGENTS.md vs CLAUDE.md: which tools read which.

How do you know Copilot used your instructions?

In Copilot Chat, expand the References list at the top of a response. If .github/copilot-instructions.md is listed, the file was sent with that request. That tells you the file was included. It does not tell you which line of it shaped the answer, and on a two-page file that is the question that matters when you are deciding what to cut.

What is Copilot Memory, and does it replace instructions?

Copilot Memory is in public preview. It stores repository-level facts with citations to the code that supports them, checks those citations against the current branch before using a fact, and deletes facts that go unused for 28 days. The cloud agent, code review and the CLI use it. Repository owners can review and delete what it stored.

It does not replace instructions, and it is not built to. It learns from the code and from work in that one repository. The decision your team made in a Slack thread last month, which is in no code yet, is not something it can learn. How it compares with Claude Code, Codex and Cursor is in Claude Code memory vs Codex, Cursor and Copilot.

Where Harbor fits

An instruction file is a copy of decisions made somewhere else: a pull request review, a thread in #eng-payments, a design doc. Somebody has to notice, write it down, and write it down again for each tool's file. Harbor reads those places, a person approves what becomes a fact (or a policy you set approves the routine ones), and every agent is served only the facts that apply to its task.

Copilot's agent mode in VS Code can add a remote MCP server, and Harbor is one: any client that speaks MCP can search your team's approved facts at https://mcp.gethrbr.com/mcp. That is a pull-only connection. harbor init installs the fuller setup, with facts served at session start and write-back through review, for Claude Code, Codex and Cursor, not for Copilot. Answers cite the facts they used as [#1], and Harbor counts, per fact, served against cited. A cite is evidence, not proof, and that count is the one the References list cannot give you. See served vs cited.

What connects how. Agents and MCP lays out the installed and pull-only setups side by side, and the quickstart gets one repo running in about ten minutes.

Questions

Where does copilot-instructions.md go?

In the .github folder at the root of the repository: .github/copilot-instructions.md. Copilot adds it to every request made in the context of that repository.

How long should copilot-instructions.md be?

GitHub says repository-wide instructions should be no longer than two pages and should not be task specific. Move rules for one area of the code into path-specific .instructions.md files.

Does GitHub Copilot read AGENTS.md?

Partly. The Copilot cloud agent and Copilot CLI read AGENTS.md, CLAUDE.md and GEMINI.md, and VS Code chat and GitHub.com code review read AGENTS.md. GitHub.com chat and JetBrains chat do not.

What is the difference between copilot-instructions.md and .instructions.md files?

copilot-instructions.md applies to every request in the repository. A .instructions.md file in .github/instructions/ applies only to files matching its applyTo glob, and is combined with the repository-wide file.

How do I check that Copilot used my instructions?

In Copilot Chat, expand the References list at the top of a response. If .github/copilot-instructions.md is listed, the file was sent with that request.

harbor

Decide once. Every agent knows. One company brain for all the agents your team runs, built from work you already do and kept only while it is still true.

Product

  • How it works
  • Review
  • Your agents
  • Guardrails
  • What it counts
  • Pricing

Developers

  • Docs
  • Blog
  • CLI
  • MCP server
  • Served and cited
  • Environments

Company

  • Get started
  • Contact
  • Privacy Policy
  • Terms of Service
  • Data Processing Agreement
  • Refund Policy
© 2026 harbor·Product names and logos are trademarks of their respective owners.