What VS Code keeps across sessions
Custom instructions give an agent reusable guidance about your project, such as where to add code, which libraries to use, and which tests to run (VS Code docs). The guidance lives in Markdown files, so it persists across sessions and can be shared through source control (VS Code docs).
Create project instructions
Open the Command Palette, open the Agent Customizations editor, and select the Instructions tab (VS Code docs). When you add workspace instructions, the editor creates or opens the project instruction file offered for your harness (VS Code docs). No frontmatter is needed for these project instruction files (VS Code docs).
The selected agent harness determines which instruction files VS Code reads (VS Code docs). AGENTS.md is a cross-agent format, not a file for one harness (VS Code docs). If your repository already has a project instructions file, open it instead of creating a competing copy (VS Code docs).
Choose when instructions activate
With project-wide activation, the harness automatically includes guidance from its project instruction files (VS Code docs). Targeted .instructions.md files use an applyTo frontmatter pattern such as tests/**/*.py to scope rules to matching files (VS Code docs). In Local sessions, a description field lets the agent decide by task relevance whether to read an instructions file, separate from pattern matching (VS Code docs).
The Codex harness loads instructions along the path from the repository root down to the session's working directory (VS Code docs). You can also attach guidance to a single request when automatic discovery or activation is not appropriate (VS Code docs).
Test your instructions and resolve conflicts
Verify instructions in a new chat, so the test does not depend on guidance from the conversation that created them (VS Code docs). The response's References section, where available, helps check that a file was included, not that the agent complied with it (VS Code docs).
When personal and repository instructions conflict, remove or narrow the conflicting personal rule rather than adding another rule (VS Code docs). Do not rely on a universal precedence order, because combination rules differ by harness (VS Code docs).
What instructions will not do
Instructions guide the model. They do not guarantee compliance and do not replace tests, code review, or security controls (VS Code docs). They do not apply to inline suggestions as you type (VS Code docs). A link inside an instructions file does not guarantee that the linked document's contents reach the model (VS Code docs). For a different approach, see a knowledge base for AI agents.
Where KnowMan fits
KnowMan saves articles and links, reads and tags them, answers questions with citations, and keeps memories: claims, decisions, and playbooks (KnowMan). Its MCP server is a local stdio server, the package @knowman/mcp, started with npx -y @knowman/mcp on Node 22 or newer (KnowMan). The tools kb_search, kb_ask, and kb_memories give an agent access to saved reading, cited answers, and remembered decisions and playbooks (KnowMan).
KnowMan's documented client configs cover Claude Desktop, Claude Code, and Cursor (KnowMan). It runs locally with npx -y @knowman/mcp and as a hosted server at https://api.knowman.io/mcp, so it can be added to clients that accept remote MCP servers (KnowMan). For more, see persistent memory for AI agents.
Use the hosted KnowMan server
To use KnowMan with VS Code, add the hosted server URL https://api.knowman.io/mcp in a client that supports remote MCP servers. Sign in with OAuth on the KnowMan consent page, or send an API key as an Authorization: Bearer <key> header.
For a local setup instead, run npx -y @knowman/mcp and configure it with your preferred MCP client. See the KnowMan MCP client for configuration details.
Questions people ask
Does VS Code remember context between sessions?
Custom instructions keep guidance in Markdown files, which persists across sessions and can be shared through source control (VS Code docs). They guide the model and do not guarantee compliance (VS Code docs).
How do I add custom instructions in VS Code?
Open the Command Palette, open the Agent Customizations editor, and select the Instructions tab (VS Code docs). The editor creates or opens the project instruction file offered for your harness, and no frontmatter is needed (VS Code docs).
Where do custom instructions not apply?
They do not apply to inline suggestions as you type (VS Code docs). They guide the model and do not replace tests, code review, or security controls (VS Code docs).
Can a VS Code agent use my saved articles and decisions?
Custom instruction files store guidance you write, in Markdown that persists across sessions (VS Code docs). KnowMan's MCP server exposes saved reading and memories through kb_search, kb_ask, and kb_memories, and its documented client configs cover Claude Desktop, Claude Code, and Cursor (KnowMan). For more, see give your AI context.