Visual Studio

LocalPilot in Visual Studio 2022 and Visual Studio 2026, the local AI coding agent with chat, approvals, edits through the editor with Undo, and right-click Explain and Fix, on Ollama, LM Studio or your own key.

Ask AI about this page

The LocalPilot extension for Visual Studio runs the same agent as VS Code and the localpilot CLI, with the same tools, skills, rules, memory, MCP servers, providers and settings, in a chat window inside Visual Studio. The extension bundles the CLI and talks to it over the Agent Client Protocol, so nothing else needs installing except Node.js.

Install

You need:

Then install the extension in one of two ways:

First run

Open a solution or a folder, then Tools > LocalPilot Chat (also under View > Other Windows). The window docks next to Solution Explorer and starts the agent in the solution’s folder. The line at the top shows its state:

The agent’s log is in the Output window, under LocalPilot.

Providers and models come from LocalPilot’s own settings (see Settings). If you already use LocalPilot in VS Code or the terminal, Visual Studio uses the same servers, keys and default model.

Chat

Type in the box at the bottom and press Send (or Ctrl+Enter). The answer streams in as text, with code blocks you can select and copy. Below it you see:

Below the box:

The window’s toolbar repeats New chat, Stop, Restart LocalPilot and Open LocalPilot Settings.

Approvals

Nothing is changed without asking. Before an edit, a command, a network call or an MCP tool, an approval card appears in the chat with what the agent wants to do (a diff of the edit, the command line…) and:

Stop while a card is open answers it as cancelled. Your organization’s LocalPilot policy still applies, and a kind set to never in your settings stays refused. To approve everything without asking, add --yes to Extra CLI arguments (not recommended).

Edits and Undo

The agent reads and writes files through Visual Studio, not behind its back:

Commands the agent runs (dotnet build, dotnet test, npm test…) run in the solution folder on your machine, after your approval.

Context menu commands

Right-click in the editor and open LocalPilot, or right-click a file in Solution Explorer:

Command What it does
Ask LocalPilot about Selection (editor) Attaches the selected lines (or the whole file when nothing is selected) to the chat box as a chip; type your question and send.
Explain This File with LocalPilot Asks the agent to explain the file and how it fits into the project, without changing anything.
Fix Errors in This File with LocalPilot Asks the agent to fix the file’s errors and warnings. Extensions cannot read the Error List, so the agent builds or type-checks the project to see them, fixes them and builds again to confirm.
LocalPilot Chat Opens the chat.

Settings

Tools > Options > LocalPilot holds what Visual Studio needs to start the agent:

Setting Default What it does
Node.js path empty node.exe (or its folder) to run LocalPilot with. Empty: Node.js 18.17 or newer is found on PATH and in the usual install folders (nodejs.org installer, nvm-windows, Volta, fnm, Scoop, Chocolatey).
Extra CLI arguments empty Added after --acp, for example -m ollama/qwen3:8b, --no-mcp, --trust-workspace or --data-dir D:\lp. Restart LocalPilot to apply.
Default mode Agent The mode a new chat starts in.
Open edited files in the editor on Edits go through the editor (with Undo) by opening each file the agent changes. Off: files that are not open are written on disk.

Everything else (providers, models, approvals, MCP servers, rules, memory) is LocalPilot’s own configuration, shared with the CLI and VS Code. Tools > Open LocalPilot Settings (or the toolbar button) opens %USERPROFILE%\.localpilot\config.json in Visual Studio, with a commented example when it does not exist yet. The keys are listed in Terminal & CLI. Settings made in VS Code’s LocalPilot Settings are read too. After a change, press Restart LocalPilot.

Troubleshooting

“LocalPilot needs Node.js 18.17 or newer”: install the LTS from nodejs.org, then Restart. If Node.js is installed somewhere unusual, set Node.js path in Tools > Options > LocalPilot. The message lists every node.exe it tried.

The status stays red after starting: the box shows the agent’s last log lines. Common causes are a broken config.json (fix it or rename it) and an unknown option in Extra CLI arguments. The full log is in Output > LocalPilot and in %USERPROFILE%\.localpilot\cli.log.

No models in the picker, or “no model reachable”: start your model server (for example ollama serve) or add a provider to config.json, then Restart. localpilot doctor in a terminal checks every server.

The agent works in the wrong folder: it starts in the open solution’s folder (or the active file’s folder when no solution is open). After switching solutions, New chat restarts it in the new folder.

Open diff does nothing: it uses Visual Studio’s vsDiffMerge.exe, which ships with Visual Studio. A minimal installation without the Team Explorer component may not have it; open the file and use Git’s diff instead.

The chat does not scroll to the newest message: Visual Studio’s out-of-process UI cannot scroll a list from the extension; scroll down to follow a long answer.

Report problems at GitHub issues with the Output > LocalPilot log.