# How to teach VS Code your knowledge

Teach VS Code reusable project knowledge by storing guidance in [Markdown instruction files](https://www.knowman.io/guides/vscode-memory) and attaching reference material to a request when needed. Choose the [instruction file](https://www.knowman.io/guides/give-your-ai-context) offered for your selected agent harness, then test the guidance in a new chat.

## Choose what VS Code should reuse

VS Code custom instructions give an agent reusable guidance about a project, such as where to add code, which libraries to use, and which tests to run. Store this guidance in Markdown files instead of repeating it in every prompt. See [VS Code custom instructions](https://code.visualstudio.com/docs/agent-customization/custom-instructions).

## Create the right project instruction file

Open the Agent Customizations editor, select + next to Workspace, and choose the project instruction file offered for your harness. The selected harness determines which instruction files VS Code reads. VS Code documents `.github/copilot-instructions.md` or `AGENTS.md` for Copilot, `AGENTS.md` for [OpenAI Codex](https://www.knowman.io/guides/teach-codex-your-knowledge), and `CLAUDE.md` for [Anthropic Claude](https://www.knowman.io/guides/teach-claude-code-your-knowledge). See [VS Code custom instructions](https://code.visualstudio.com/docs/agent-customization/custom-instructions).

## Keep instructions concise and project-specific

Write a short statement for each requirement and explain non-obvious constraints. Do not duplicate formatter or linter rules. For one-time guidance, put it in the prompt instead of creating a shared rule. Instructions guide the model, but they do not guarantee compliance or replace tests, code review, or security controls. See [VS Code custom instructions](https://code.visualstudio.com/docs/agent-customization/custom-instructions).

## Scope rules to relevant files

Targeted `.instructions.md` files can use `applyTo` patterns, while Claude rules files can use `paths` patterns. Codex uses directory locations instead. Codex loads nested instructions along the path from the repository root to the session working directory. See [VS Code custom instructions](https://code.visualstudio.com/docs/agent-customization/custom-instructions).

## Attach reference material when needed

Use Add Context in the chat input to attach an existing instruction file to one request. A Markdown link to supporting documentation does not guarantee that the document contents reach the model, so attach the relevant file when the agent needs it. See [VS Code custom instructions](https://code.visualstudio.com/docs/agent-customization/custom-instructions).

## Share project instructions through source control

VS Code says project instructions can be shared through source control. If a repository already has a project instruction file, open it instead of creating a competing copy. See [VS Code custom instructions](https://code.visualstudio.com/docs/agent-customization/custom-instructions).

## Know your instruction limits

Custom instructions do not apply to inline suggestions as you type. An instruction file such as `AGENTS.md` gives guidance to an existing agent, but does not define a custom agent. See [VS Code custom instructions](https://code.visualstudio.com/docs/agent-customization/custom-instructions).

## Questions

### Where should I put VS Code project instructions?

Use the project instruction file offered for your selected harness. VS Code documents `.github/copilot-instructions.md` or `AGENTS.md` for Copilot, `AGENTS.md` for Codex, and `CLAUDE.md` for Claude. See [VS Code custom instructions](https://code.visualstudio.com/docs/agent-customization/custom-instructions).

### Can VS Code read my KnowMan articles?

The available documentation does not show how to connect KnowMan to VS Code or how VS Code agents can read saved KnowMan articles. KnowMan does document local MCP configurations for Claude Desktop, [Claude Code](https://www.knowman.io/guides/claude-code-knowledge-base), and Cursor in its [MCP server guide](https://www.knowman.io/guides/mcp-server-knowledge-base).

### Do I need to repeat project instructions in every prompt?

No. Store reusable guidance in Markdown instruction files instead of repeating it in every prompt. For one-time requirements, put the guidance in the prompt. See [VS Code custom instructions](https://code.visualstudio.com/docs/agent-customization/custom-instructions).

### How do I check that my instructions work?

Start a new chat using the same harness and repository, without repeating the rules in the prompt. This avoids relying on guidance left in the earlier conversation. See [VS Code custom instructions](https://code.visualstudio.com/docs/agent-customization/custom-instructions).

## Related guides

- [What Is a Knowledge Base for AI Agents?](https://www.knowman.io/guides/knowledge-base-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)

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

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

## More in this topic

- [How to teach Grok Bot your knowledge](https://www.knowman.io/guides/teach-grok-bot-your-knowledge)
- [How to teach Google Antigravity your knowledge](https://www.knowman.io/guides/teach-antigravity-your-knowledge)
- [How to teach Windsurf your knowledge](https://www.knowman.io/guides/teach-windsurf-your-knowledge)

## More for VS Code

- [Add the KnowMan MCP server to VS Code](https://www.knowman.io/integrations/vscode)
- [How to give VS Code better memory](https://www.knowman.io/guides/vscode-memory)

## Save knowledge for your AI workflow

Try KnowMan 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/teach-vscode-your-knowledge
