# How to give GitHub Copilot CLI better memory

The documented way to give GitHub Copilot CLI more context is custom instruction files, such as copilot-instructions.md and AGENTS.md, which the CLI discovers and combines ([GitHub docs](https://docs.github.com/en/copilot/how-tos/copilot-cli/customize-copilot/add-custom-instructions)). Keep instructions short and self-contained, because Copilot may not follow them the same way every time ([GitHub docs](https://docs.github.com/en/copilot/concepts/prompting/response-customization)). KnowMan also runs a hosted [remote MCP](https://www.knowman.io/guides/mcp-server-knowledge-base) server at https://api.knowman.io/mcp ([KnowMan MCP](https://github.com/Essatt/knowman-mcp)); adding an MCP server in Copilot CLI is not covered on this page.

## Where Copilot CLI looks for instructions

User-level instructions live in `$HOME/.copilot/copilot-instructions.md` and apply across repositories (GitHub docs). Repository-wide instructions live in `.github/copilot-instructions.md`, and modular files under `.github/instructions/` ending in `.instructions.md` are discovered in the standard locations (GitHub docs). `AGENTS.md` files provide [agent instructions](https://www.knowman.io/guides/give-your-ai-context) and are discovered the same way (GitHub docs).

Standard discovery locations include the repository root, the current working directory, intermediate directories between them, and any directories nested in the path of a file being worked on (GitHub docs). Path-specific custom instructions use glob syntax to say which files or directories they apply to (GitHub docs).

## Combine files and check them with /instructions

Run the `/instructions` command to view the instruction files discovered for the current session and to enable or disable individual files (GitHub docs). When multiple user-level and repository instruction files exist, Copilot CLI combines their instructions (GitHub docs). There is no general precedence order between these files, so avoid conflicting instructions (GitHub docs).

Custom instructions are natural language and are most effective as short, self-contained statements (GitHub docs).

## Reference other files with @

In an instruction file, write `@` followed by a relative path to include another file. Copilot CLI reads the referenced file immediately and supports references within referenced files (GitHub docs). Referenced files must remain within the repository, or within the custom instructions directory for local instructions (GitHub docs).

The added instruction content is not displayed, but is available to Copilot to allow it to generate higher quality responses (GitHub docs).

## How instruction changes take effect

Changes to custom instruction files are not immediately available in active CLI sessions (GitHub docs). To apply your changes, exit the session, then resume it with `copilot --continue`, or start a new session with `/new` (GitHub docs).

Copilot CLI uses local files for personal instructions instead of the personal instructions configured on GitHub.com, and organization custom instructions are not supported in local client sessions (GitHub docs). Because AI is non-deterministic, Copilot may not follow your instructions in exactly the same way every time (GitHub docs).

## Bring in outside knowledge with an MCP server

GitHub's docs note that if you know a specific MCP server can achieve a particular task, naming it in your prompt can help Copilot deliver the results you want ([GitHub docs](https://docs.github.com/en/copilot/concepts/agents/about-copilot-cli)). KnowMan runs a hosted remote MCP server at `https://api.knowman.io/mcp` over Streamable HTTP, with OAuth sign-in or an API key sent as `Authorization: Bearer <key>` (KnowMan MCP).

A local [stdio server](https://www.knowman.io/guides/what-is-an-mcp-server) is also available with `npx -y @knowman/mcp` on Node 22 or newer (KnowMan MCP). For background on the pattern, see the [MCP server knowledge base guide](https://www.knowman.io/guides/mcp-server-knowledge-base). The steps to register an MCP server in Copilot CLI are not covered on this page.

## What the KnowMan server can do

KnowMan saves articles and links, reads and tags them, answers questions with citations, and keeps memories such as claims, decisions, and playbooks (KnowMan). Its MCP server exposes six tools: `kb_search`, `kb_ask`, `kb_get_item`, `kb_save`, `kb_recent`, and `kb_memories` (KnowMan MCP). `kb_search` finds [saved items](https://www.knowman.io/guides/how-to-save-articles) by [keyword or meaning](https://www.knowman.io/guides/ai-knowledge-base), `kb_ask` answers with citations, and `kb_save` stores a URL with an optional note (KnowMan MCP).

For the wider pattern, see [knowledge bases for AI agents](https://www.knowman.io/guides/knowledge-base-for-ai-agents) and [give your AI context](https://www.knowman.io/guides/give-your-ai-context).

## Where KnowMan fits

Instruction files keep Copilot CLI anchored to your repository: referenced files must remain within the repository, or within the custom instructions directory (GitHub docs). KnowMan covers material outside that scope: it saves articles and links, reads and tags them, and keeps memories such as claims, decisions, and playbooks (KnowMan).

For the general idea, see a [personal knowledge base](https://www.knowman.io/guides/personal-knowledge-base), [persistent memory for AI agents](https://www.knowman.io/guides/persistent-memory-for-ai-agents), and [connect any AI to your notes](https://www.knowman.io/guides/connect-any-ai-to-your-notes).

## Questions

### How do I give Copilot CLI context across repositories?

User-level instructions live in `$HOME/.copilot/copilot-instructions.md` and apply across repositories (GitHub docs). Repository-wide instructions live in `.github/copilot-instructions.md` and are discovered in the standard locations (GitHub docs).

### Where do I put custom instructions for Copilot CLI?

User-level instructions live in `$HOME/.copilot/copilot-instructions.md`, and repository-wide instructions live in `.github/copilot-instructions.md` (GitHub docs). Modular files under `.github/instructions/` and `AGENTS.md` files are discovered in the standard locations (GitHub docs).

### Why are my custom instruction changes not showing up?

Changes to custom instruction files are not immediately available in active CLI sessions (GitHub docs). Exit the session, then resume it with `copilot --continue`, or start a new session with `/new` (GitHub docs).

### Can Copilot CLI search my saved articles?

Naming a specific MCP server in your prompt can help Copilot deliver the results you want when that server can do the task (GitHub docs). KnowMan's server exposes `kb_search` and `kb_ask` at `https://api.knowman.io/mcp` (KnowMan MCP). Adding an MCP server in Copilot CLI is not covered on this page.

## Related guides

- [Persistent Memory for AI Agents](https://www.knowman.io/guides/persistent-memory-for-ai-agents)

- [How to Give Your AI Context from What You Read](https://www.knowman.io/guides/give-your-ai-context)

- [Connect your knowledge base through KnowMan's MCP server](https://www.knowman.io/guides/mcp-server-knowledge-base)

- [How Do You Connect AI to Your Notes?](https://www.knowman.io/guides/connect-any-ai-to-your-notes)

- [What is a personal knowledge base, and how do you build one?](https://www.knowman.io/guides/personal-knowledge-base)

## More in this topic

- [How to give GitHub Copilot better memory](https://www.knowman.io/guides/github-copilot-memory)
- [How to give LibreChat better memory](https://www.knowman.io/guides/librechat-memory)
- [How to give Jan better memory](https://www.knowman.io/guides/jan-memory)

## More for GitHub Copilot CLI

- [KnowMan MCP server for GitHub Copilot CLI](https://www.knowman.io/integrations/github-copilot-cli)
- [How to teach GitHub Copilot CLI your knowledge](https://www.knowman.io/guides/teach-github-copilot-cli-your-knowledge)

## Keep the reading behind your work

KnowMan saves articles and links, answers questions with citations, and keeps memories of claims and decisions ([KnowMan](https://github.com/Essatt/knowman-mcp)). Try Pro for 14 days with no credit card. [Create your account](https://app.knowman.io/signup)

[Start free](https://app.knowman.io/signup)

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

Source: https://www.knowman.io/guides/github-copilot-cli-memory
