How to Use GitHub Copilot in VS Code: Chat, Agent and Plan
Sign in, open the Chat view, pick a session target, a role and a model, then teach Copilot your project with instructions and connect tools over MCP. How each part works in VS Code today, from VS Code’s own documentation.
8 min read
To use GitHub Copilot in VS Code, hover over the Copilot icon in the Status Bar, select Use AI Features and sign in with GitHub. Then open the Chat view (Ctrl+Alt+I on Windows and Linux, ⌃⌘I on a Mac), choose who runs the session, the role (Ask, Agent or Plan), a model and a permission level, and describe the task. Add a .github/copilot-instructions.md or AGENTS.md file so every session knows your conventions, and connect outside tools as MCP servers. VS Code’s Copilot documentation moved this year, from pages under /docs/copilot/ to /docs/agents/ and /docs/agent-customization/; everything below is from those pages as of October 1, 2026.
Set up Copilot in VS Code
- Install VS Code. Setup starts from the editor itself; VS Code’s guide has no separate extension step.
- Hover over the Copilot icon in the Status Bar and select Use AI Features, then choose a sign-in method. A GitHub Enterprise account signs in with Continue with GHE.com.
- If your account already has Copilot, VS Code uses it. VS Code’s Copilot setup guide (opens in a new tab) says that without a subscription you are signed up for Copilot Free, with a monthly allowance of inline suggestions and AI credits.
- Open a project and type
/initin chat. It analyzes the codebase and writes starter custom instructions, which you then edit.
GitHub names its plans Copilot Free, Copilot Student, Copilot Pro, Copilot Pro+, Copilot Max, Copilot Business and Copilot Enterprise; they differ in AI credit allowance and features, and GitHub’s plans page lists Copilot Free with Auto model selection only. If your employer provides Copilot, sign in with that account so its policies apply. To turn the AI features off entirely, set chat.disableAIFeatures, for one workspace or for every one.
The parts of a chat session
Copilot chat in VS Code is no longer one agent with one mode. Each session has five settings in the chat input, and VS Code’s page on choosing an agent harness (opens in a new tab) explains them:
- Session Target: which harness runs the session. The options are Local, GitHub Copilot, Anthropic Claude and OpenAI Codex, plus a Cloud target that runs a task remotely against a GitHub repository and returns a pull request.
- Agent role: which instructions, tools and behavior apply, such as Ask, Agent, Plan or a custom agent you defined.
- Language model: which model reasons, and how many AI credits it uses. Auto, where available, picks for you.
- Permissions: which actions need your confirmation. Manual permissions asks; Allow all does not.
- Code isolation: work in the current folder, or in a new Git worktree so the agent’s changes stay apart from yours.
For a first task, VS Code suggests the Copilot target, the Agent role, Manual permissions and Auto for the model. Choose Local when you need VS Code’s built-in or extension tools, a model configured in VS Code, or an MCP server that signs in, for reasons covered below.
Ask, Agent and Plan
- Ask “asks questions and provides guidance without making changes to the code.” Use it to understand code before you change it.
- Agent “autonomously plans and performs complex coding tasks, edits files, runs commands, and iterates on results.” It is the only one that changes your workspace.
- Plan “researches a task and creates a structured implementation plan before code changes.” Type
/planand the task, answer its questions, then choose Implement Plan, Approve Plan Only, or save the plan for another session.
Those three are the built-in roles of a Local session, and you can switch between them mid-session. The Copilot target names things slightly differently, and VS Code’s own pages do not quite agree: the quickstart tells you to select “the Agent role” there, while the planning page tells you to switch “from Plan to Interactive” to implement a plan, and the harness page says Autopilot is a mode in Copilot sessions rather than a permission level. Look at the picker in your own editor. The older Edit mode was deprecated in VS Code 1.110, and the release notes for that version say it is fully removed from version 1.126; targeted edits are now something you ask Agent to do. Which role suits which task: Copilot agent vs ask vs plan.
Chat is not the only surface. Inline suggestions complete code as you type and suggest next edits; inline chat (Ctrl+I) makes a focused edit in place; and in Agent Host sessions, a message that starts with !, such as !npm test, runs in the terminal without going to the model.
A first task, start to finish
Add a ZIP code field to the shipping address form in src/checkout. - Accept 5 digits or ZIP+4 (12345 or 12345-6789); show "Enter a valid ZIP code" otherwise. - Follow the validation pattern in src/checkout/validators.ts. - Add unit tests for valid, invalid and empty input, then run npm test. - Do not change the payment step.
Read each approval request before you accept it. When the agent finishes, open the changed files from its response to see the diffs, and run the app yourself; its own test run is a report, not a review. If it went wrong, restore a checkpoint and say what to do differently. Habits that keep longer sessions reviewable: GitHub Copilot agent mode best practices.
Custom instructions
Custom instructions are Markdown files that every session reads, so you stop repeating your conventions. Which file a session reads depends on its harness. VS Code’s custom instructions page (opens in a new tab) lists .github/copilot-instructions.md or AGENTS.md for Copilot sessions, CLAUDE.md for Claude, AGENTS.md for Codex, and any of the three for Local. For rules that apply to part of the code, use .instructions.md files under .github/instructions/ with an applyTo glob. Custom instructions are not used for inline suggestions as you type.
# Project instructions ## Stack - Next.js app router, TypeScript strict, Vitest for tests. ## Conventions - Validation lives in src/**/validators.ts; reuse it, do not inline it. - Dates are shown as "October 1, 2026"; store them in UTC. ## Checks - Run npm run lint && npm test after changing application code. - Add or update a test for every behavior change.
Three full files for different stacks, and a template: copilot-instructions.md examples.
Prompt files, and what replaces them
Prompt files are reusable prompts you run by name as slash commands: .prompt.md files in .github/prompts, with optional frontmatter that sets the agent, model and tools. VS Code’s prompt files page (opens in a new tab) now carries a warning: prompt files “are deprecated for Agent Host sessions and aren’t loaded by Agent Host.” They still work with the Local agent, but the same page says the Local agent will be removed in a future release, and points you to a migration that converts prompts to Agent Skills.
--- description: Add missing unit tests for the selected file agent: agent --- Add unit tests for the selected file using Vitest. Cover the happy path, invalid input and empty input. Run npm test and fix any test you wrote that fails.
For new work, write an Agent Skill instead: a folder of instructions, scripts and resources that the agent loads when relevant. VS Code describes Agent Skills as an open standard that also works in the GitHub Copilot CLI, the GitHub Copilot app and Copilot cloud agent.
MCP servers
MCP servers give the agent tools outside the editor: a browser, a database, a task board. VS Code’s page on adding MCP servers (opens in a new tab) gives three routes: search @mcp in the Extensions view, run MCP: Add Server from the Command Palette, or write the configuration yourself. It now prefers the portable formats, .mcp.json at the project root or ~/.copilot/mcp-config.json for your user, both with a top-level mcpServers object, and describes the older .vscode/mcp.json and user-profile destinations as deprecated, kept for compatibility.
{
"mcpServers": {
"fenbs": {
"type": "http",
"url": "https://fenbs.ai/api/mcp"
}
}
}One limit matters for remote servers. VS Code’s harness page says Copilot sessions “can currently access only local MCP servers that don’t require authentication.” A remote server that signs you in with OAuth, such as a task board, therefore works in a Local session, not a Copilot one. Starting, stopping and choosing tools, and which harness sees which file: VS Code mcp.json.
Choosing a model
The model picker in the chat input changes the model for the session. VS Code’s page on language models (opens in a new tab) suggests a fast model for quick edits and a reasoning model for complex refactoring or multi-step work. Auto routes each request for you, and Optimize for sets the tier: Efficiency, Balance or Intelligence. Reasoning models have a Thinking Effort setting; higher effort uses more AI credits. Manage Language Models hides, pins or adds models, including your own API key. On Copilot Business and Enterprise, an administrator may need to enable some models first. Which models GitHub offers: GitHub Copilot models.
Weighing Copilot in VS Code against a fork with its own agent: Cursor vs VS Code.
Keeping track of what Copilot did
A chat session forgets the task when you close it. Connected to a fenbs board in a Local session, Copilot can read the task before it starts and record what it did when it stops, under your role and the scopes you approved at sign-in, with each change in History as the assistant working for you. Add the rhythm to your instructions file:
## The board - Before starting, call fenbs_get_context, then find the task with fenbs_search. - Move the task to In Progress when you start; write your approach into its plan. - When you stop, set testStatus and testNotes: what you ran, and what you did not. - File anything you notice but do not fix as a new task (kind bug or enhancement).
Related
Connecting the board: Copilot in VS Code and the MCP docs. The modes compared: Copilot agent vs ask vs plan. Copilot in the terminal: GitHub Copilot CLI.