Start free
Guide Teach your agent your knowledge

How to teach GitHub Copilot CLI your knowledge

Updated 3 min read

The short answer

Teach GitHub Copilot CLI your knowledge with custom instruction files, referenced project files, prompt files, or specialized agents. For saved articles and questions about your reading, connect KnowMan through its hosted MCP server or local stdio server, then name KnowMan in the prompt when you want it to search.

On this page9 sections
  1. Choose the right way to share knowledge
  2. Add user-level instructions
  3. Add repository and path-specific instructions
  4. Reference project files and agent instructions
  5. Use prompt files and specialized agents
  6. Connect KnowMan as an MCP server
  7. Search and ask your saved reading
  8. Where KnowMan fits
  9. Questions people ask

Choose the right way to share knowledge

Use custom instructions for standing guidance, prompt files for task-specific context that you choose in chat, and specialized agents for defined roles. Copilot CLI also supports MCP servers, and naming a relevant server in a prompt can help it deliver the requested result. See GitHub's Copilot CLI overview and response customization guide.

Add user-level instructions

Put broad instructions in $HOME/.copilot/copilot-instructions.md to apply them across repositories. For modular guidance, use *.instructions.md files under $HOME/.copilot/instructions/. You can also set COPILOT_HOME to change the base directory used for both user-level locations. See GitHub's custom instructions documentation.

Add repository and path-specific instructions

Use .github/copilot-instructions.md for repository-wide guidance. A *.instructions.md file with an applyTo value applies only when its pattern matches the file Copilot CLI is working with. Copilot CLI combines applicable user-level and repository instructions, but the documentation defines no general precedence order between them. See GitHub's custom instructions documentation.

Reference project files and agent instructions

In .github/copilot-instructions.md, AGENTS.md, or CLAUDE.md, use @ followed by a relative path to include another file. Referenced files may point to further files, but references must remain inside the repository or local custom instructions directory. Copilot CLI also recognizes AGENTS.md, CLAUDE.md, GEMINI.md, and .claude/CLAUDE.md. See GitHub's custom instructions documentation.

Use prompt files and specialized agents

Prompt files provide task-specific instructions and context that you choose when using them in chat. Specialized agent definitions live under .github/agents and are separate from agent instruction files. Keep standing custom instructions short and self-contained, since Copilot may not follow them identically on every use. See GitHub's response customization guide.

Connect KnowMan as an MCP server

KnowMan can run as a hosted Streamable HTTP MCP server at https://api.knowman.io/mcp. Sign in with OAuth or send a key as Authorization: Bearer <key>. It can also run locally through npx -y @knowman/mcp over stdio, using Node 22 or newer. See the KnowMan MCP repository.

Search and ask your saved reading

KnowMan MCP exposes kb_search and kb_ask for searching saved reading and asking questions about it. In a Copilot CLI prompt, name KnowMan and describe the source or task, such as asking it to search your KnowMan for saved material on a topic. The KnowMan MCP repository lists the available tools.

Where KnowMan fits

Copilot instruction files are best for guidance and context that should stay with a user, repository, or file. KnowMan fits when the knowledge lives in saved articles and links and you want Copilot CLI to search that library or ask questions with citations. Learn more in Connect any AI to your notes and MCP server knowledge bases.

Questions people ask

What is the simplest way to teach GitHub Copilot CLI project knowledge?

Add standing guidance to .github/copilot-instructions.md, or use *.instructions.md with applyTo when the guidance should match specific files. See GitHub's custom instructions documentation.

Can Copilot CLI include local files in its instructions?

Use @ followed by a relative path in .github/copilot-instructions.md, AGENTS.md, or CLAUDE.md. References must stay within the repository or local custom instructions directory. See GitHub's custom instructions documentation.

How can Copilot CLI use my saved reading?

Add KnowMan as an MCP server, then name KnowMan in the prompt when you want it to search saved items or answer a question about them. The KnowMan MCP repository documents kb_search and kb_ask.

Do instruction changes apply immediately?

No. See GitHub's custom instructions documentation.

Let Copilot CLI search your reading

Try KnowMan Pro for 14 days with no credit card. Create your account

Start free

Every new account starts with 14 days of Pro. No credit card.