Skip to content
| Marketplace
Sign in
Visual Studio>Tools>LM Local - AI assistant
LM Local -  AI assistant

LM Local - AI assistant

Aleksandrs Kornevs

|
9,016 installs
| (7) | Free
LM Local is an AI coding assistant for Visual Studio 2022/2026 with agentic capabilities. It works with local engines (LM Studio, Ollama, Jan, Llama.cpp, Unsloth) and cloud providers (OpenAI-compatible APIs). You can ask it to edit code, run builds/tests, and apply changes in ...

🤖 LM Local

LM Local is an AI coding assistant for Visual Studio 2022/2026 with agentic capabilities. It works with local engines (LM Studio, Ollama, Jan, Llama.cpp, Unsloth) and cloud providers (OpenAI-compatible APIs). You can ask it to edit code, run builds/tests, and apply changes in a multi-turn conversational flow, with specialized subagents extending its capabilities for complex tasks.

Visual Studio License

[!NOTE] Safe & Controlled: By default, write/modify tools are disabled – the AI can read files but cannot change anything. Writing tools are optional, must be explicitly turned on in Settings, and all changes are tracked in the Changes panel with one‑click rollback. The codebase is open‑source – inspect it or contribute on GitHub.

📸 Screenshots

VS 2022 - mid dark VS 2022 - mid light

📖 Table of Contents

  • Core Features
  • Requirements
  • Installation
  • Getting Started
  • All Features
  • AI Instructions & Modes
  • Providers
  • Models
  • Chat History Dialog
  • Image Attachments (Multimodal Chat)
  • Built‑in AI Tools
  • List of built‑in tools
  • Sub Agents
  • Smart Workflows & Best Practices
  • Auto-Completions
  • Context Menu Commands
  • Explain Debugger Stops
  • Model Context Protocol (MCP) Support
  • How to Configure MCP Servers
  • Troubleshooting
  • Data & Configuration
  • License & Compliance & Third-Party

⚡ Core Features

  • 💬 Chat & Agentic Actions – In‑IDE chat that can edit files, build and run tests; every change is shown in the Changes panel with one‑click rollback. Read‑only by default.
  • 🌐 Local & Cloud LLMs – Works with LM Studio, Ollama, Jan, Llama.cpp, Unsloth and cloud providers with an OpenAI‑compatible API.
  • 🤖 Subagents – Specialised subagents for code search, builds/tests, history lookup, architecture and review, each with its own model; the main model gets compact results and uses fewer tokens.
  • 🐞 Explain Errors & Debugger Stops – Explain selected Error List entries or the current breakpoint/exception in one click.
  • ⌨️ Inline Autocompletions – Multiline ghost-text suggestions at the end of a line from a local FIM model.
  • 📂 Workspace Context – Attach the active file with +, or send a selection, files or open tabs from the context menus.
  • 🔌 MCP Extensibility – Add external tools via Model Context Protocol (stdio/http).

🛠 Requirements

To use LM Local, you need:

  • [x] Visual Studio 2022 (17.8 or later) or 2026
  • [x] Microsoft Edge WebView2 (included in Windows 10/11 by default; corporate users should ensure it is not disabled via Group Policy)
  • [x] An AI Backend / Provider (choose one):
    • Cloud Providers: Any OpenAI-compatible API (OpenAI, DeepSeek, Groq, OpenRouter, Google AI Studio, etc. — requires an API key).
    • Local Engines (must be installed and running with a loaded model):
      • LM Studio (local server at http://localhost:1234)
      • Ollama (local server at http://localhost:11434)
      • Jan (local server at http://localhost:1337)
      • Llama.cpp (local server at http://localhost:9931)
      • Unsloth (local server at http://localhost:8888)

🚀 Installation

Option 1: Visual Studio Marketplace (Recommended)

  1. Open Visual Studio.
  2. Go to Extensions > Manage Extensions.
  3. Search for LM Local and click Download.
  4. Restart Visual Studio to complete the installation.

Option 2: Manual VSIX

  1. Download the .vsix file from the Marketplace.
  2. Double-click the file and follow the VSIX Installer prompts.

🏁 Getting Started

Part 1. Initial Setup (One-Time Configuration)

  1. Launch: Open the LM Local tool window using one of the following methods:
    • Method A: In the top menu, go to Tools ➔ LM Local.
    • Method B: In the top menu, go to View ➔ Other Windows ➔ LM Local.
  2. Position the Window (Optional): Click and drag the opened window to dock it wherever fits your workflow best — for example, right next to the Solution Explorer.
  3. Configure Your Provider:
    • Click the menu icon (…) and open Settings....
    • In the AI provider dropdown, select your preferred backend:
      • LM Studio (local) – Automatically targets http://localhost:1234
      • Ollama (local) – Automatically targets http://localhost:11434
      • Jan (local) – Automatically targets http://localhost:1337
      • Llama.cpp (local) – Automatically targets http://localhost:9931
      • Unsloth (local) – Automatically targets http://localhost:8888
      • OpenAI compatible (custom) – Allows you to supply a custom base URL and authorization keys for remote endpoints or custom gateways.
    • Note: Choosing a local provider automatically configures the correct default port and endpoint structure. For local Microsoft Foundry, select OpenAI compatible and use http://127.0.0.1:<port> (where <port> is your active service port).
    • Tip: If you have multiple providers, it is recommended to set them up first via the "Providers..." menu option.
  4. Verify the Connection:
    • Click the "Test" button located directly to the right of the API Base URL input field.
    • This pings the specified endpoint to verify if the server is active, accessible, and correctly responding.

Part 2. How to Use the Chat

  1. Select an Instruction Preset (Optional): Open the AI Instructions... window from the menu, pick a preset and click Save. After that, switch presets from the dropdown in the chat bar.
    • Each preset has its own pre-configured system prompt and temperature.
    • You can toggle individual presets on/off.
  2. Quick Tool Mode Switch (Optional): Use the dropdown next to the message input to instantly switch between No tools (AI cannot read or write), Read only (AI can read files but not modify them), and Read & Write (full tool access).
  3. Context (Optional): Click the + button to include the entire content of the active document into the conversation.
  4. Chat: Type your message and click Send or hit Enter ⌨️.

💡 Interface & Interaction Tips

  • Keyboard Shortcuts: Standard Chromium browser hotkeys work inside the chat window:
    • Ctrl + C / Ctrl + V — Copy text and paste messages (the right-click context menu is disabled).
    • Ctrl + F — Open the browser-native search bar to find text within the active conversation.
    • Ctrl + P — Open the print dialog to export or print the current chat log.
    • Ctrl + + / Ctrl + - / Ctrl + 0 (or Ctrl + Mouse Wheel) — Zoom in, zoom out, or reset the chat font scale.
    • Alt + L — Send the editor selection (or the whole file) to LM Local, like the context menu command.
    • Alt + K, Alt + L — Send all open files to LM Local.
    • Alt + K, Alt + A — Send the active tab of each editor group to LM Local (with a split editor, one file from each side).
  • Copying AI Code: To copy code blocks generated by the model, click the Copy button located in the top-right corner of the code block.
  • Copying a Message: Use the Copy button on a message to copy its text.
  • Regenerate & Edit: On the last exchange, Regenerate asks for a new answer (with the currently selected model), and Edit lets you change your last prompt and send it again. File edits made by the previous answer are not undone.
  • File Links: Click a file path in the model's answer to open that file in the editor.
  • Model Reasoning: The model's internal thinking process is neatly hidden inside the collapsible Thoughts block at the beginning of the response. Click it anytime to expand and view the full logic.
  • Token & Context Tracking: Hover your mouse over the top connection bar (where the model name is shown). If supported by your provider (like LM Studio), a tooltip will appear showing exactly how many tokens have been consumed out of the maximum available context limit.
  • Model & Provider Selection: Click the model name in the top header to open the Select Model window. Here you can switch between different AI providers, search or filter models, toggle the "Loaded only" view, and quickly change your active LLM.
  • ➕ Active Window Context: Click the + button to include the entire content of the file currently open in the active document.
    • Auto-turn off: The button automatically deactivates after the request is sent, as the document becomes part of the active chat history.
    • UI & Logs: The attached file content is kept hidden to avoid cluttering the chat UI, but it is tracked and visible in the extension logs.
  • Drag and Drop: You can drag and drop a text file (e.g., .txt, .md, .csv) directly into the chat window text input – its content will be loaded automatically.
  • Attach Files (Browse file): Pick one or more text files from disk; their contents are inserted into the chat input code blocks (same rules as drag & drop).
  • Context Menu: Right‑click in editor window or solution explorer and choose "Send to LM Local" – this adds the selected content to the chat input (see Context Menu Commands).
  • ⏹️ Stop – Cancel an active generation.
  • "Clear chat" button – Click the clear history icon (located next to the menu button in the top-right corner) to open a confirmation dialog, allowing you to choose how to handle the current conversation context:
    • Start fresh: Clear everything and open a completely empty chat.
    • Exact copy of the last exchange: Copy your last message along with the AI's answer into the new chat's history.
    • Consolidate last completed exchange: Start the new chat with your last prompt, the files read in that step (each once; files edited later are left out) and only the final answer.
    • Summarize and move context: Send a quick request to the AI to summarize this conversation, then save it as the first message in the new chat.

✨ All features

Interface & User Experience

  • ☁️ In-IDE Chat UI – Tool window for LLM interaction without switching applications.
  • 🌊 Streaming Responses – Real-time token delivery for instant visual feedback.
  • 🤖 Model & Provider Hot-Swapping – Switch between AI models or providers on the fly directly from the chat header, automatically preserving your active session context.
  • 🎨 Visual Themes – Multi-theme support (Dark, Mid-Dark, Mid-Light, Light).
  • 📋 Quick Copy – Copy buttons on code blocks and on messages.
  • 🔁 Regenerate & Edit – Regenerate the last answer or edit and resend your last prompt.
  • 🔗 Clickable File Links – File paths in answers open the file in the editor.
  • ↕️ Collapse Large Code Blocks – Limits the height of long code snippets with a scrollbar and an expand option.
  • 🎭 Role-Based Presets (Instructions) – A window with pre-defined AI presets. You can customize each preset's system prompt and temperature, or toggle them on/off.
  • ⌨️ AI Inline Autocompletions – AI‑powered multiline completion. When your cursor is at the end of a line, a local FIM model suggests a continuation of up to 10 lines as grey ghost text. Keep typing to follow the suggestion, press Tab to accept the whole block, Esc to dismiss. Completions are available only at line endings.
  • 📄 Drag & Drop Files – Drag source files, logs, or configs directly into the chat input area. Text files are automatically wrapped in a markdown code fence with the correct language tag and a file-name comment hint. Supports up to 10 files at once (200 KB max each) — .cs, .json, .js, .ts, .html, .css, .md, .py, .xml, .yaml, and many more.
  • 🖼️ Image Attachments – Paste (Ctrl+V) or drag-and-drop images into the chat input for vision-capable models (JPEG/PNG, up to 3 per message, ~4 MB each). Images are not compressed and are not saved to history.
  • ↕️ Resizable Panels – Drag the grip above the input or above the Changes panel to adjust their height.
  • 📜 Chat History Dialog – Browse and load past conversations from history logs.
  • 📊 Usage & Stats – Token usage, time and speed for today, recent days or the current session, split by model and by main chat / subagents.
  • 🕒 Message Time – Each answer shows when it arrived; hover for the full date.
  • 🪜 Tool Calls View – Choose how tool calls are shown: as a plain list, in a group that starts open, or in a group that starts closed.
  • ✅ Task Panel – For multi-step requests the model's plan is shown above the status bar with the state of each step.
  • 🛡️ Protect Running AI Requests - Prevents accidental loss of work: if you close Visual Studio (close button, Alt+F4 or File → Exit) or sign out / shut down Windows while an AI request is still running, a confirmation dialog in the current Visual Studio theme offers Keep working, Stop request (stops the request, Visual Studio stays open) or Stop and exit. Closing the dialog (Esc or ✕) keeps Visual Studio open. A forced Windows shutdown or ending the process from Task Manager is not intercepted. Can be turned off in Settings → Visual Studio under Protect running AI requests.

Context & Solution Awareness

  • 🛠️ Advanced AI Tool Integration – Allows the AI to analyze your open solution, read file contents, and execute actions like building the solution, formatting documents, or running unit tests.
  • 🔁 Tool Loop Prevention – Monitors tool execution and halts the process if a tool (e.g., read_file_lines) is consecutively invoked two times with identical arguments, preventing infinite loops and token waste. Subagents use their own guard: on repeated identical tool rounds they first get up to two automatic recovery prompts, and only then is the run stopped.
  • 📝 Automated Code Editing – Enabled tools can automatically create, delete, or modify code files directly inside Visual Studio.
  • 🛡️ Changes & Rollback Manager – Shows all file modifications in a dedicated real-time panel above the chat, allowing you to review diffs, accept changes, or roll them back in one click. Review all changes in separate compare tabs or in one window with every changed file (optionally changes only).
  • ➕ Active Window Context – Dedicated "+" button to include active editor content in the request.
  • 🧠 Thought/Reasoning Support – Support for reasoning models; "thoughts" are displayed in expandable blocks.
  • 🛡️ Smart History Buffering – Automatically removes the oldest messages from the chat UI once the history exceeds 200 entries to prevent rendering lag, without affecting the underlying conversation data.
  • 🎯 Context Menu Integration – Right-click context menu command ("Send to LM Local") that copies text directly into the chat prompt without auto-submitting. If text is highlighted, it sends the selection; if nothing is selected, it falls back to sending the entire active document.
  • 🐞 Explain Debugger Stops – Optional (Settings → Visual Studio → Explain debugger stops). When Visual Studio stops on a breakpoint or an exception, an Explain banner appears above the chat input; one click sends the exception chain, stack and simple locals to the chat.
  • 📜 Project Instructions – Adds the project's instruction file (.lmlocal/instructions.md, AGENTS.md, CLAUDE.md or .github/copilot-instructions.md) to the system prompt. See Project Instructions.
  • 🔄 Quick Tool Mode Toggle – Dropdown next to the input box to switch between No tools, Read only, and Read & Write for the current session without opening Settings.

Efficiency & Token Management

  • 📉 Conversation Summarization – Condenses older messages into a concise overview when the conversation grows long.
  • 📊 Live Stats – Status bar metrics during streaming: approximate speed (tokens/sec) and an approximate running token count. Both values are approximate.
  • 🏷️ Token Stats Badge – After each response, a compact summary shows the total tokens reported by the provider (reasoning tokens excluded), cached tokens (when available), and the approximate average generation speed (tokens/sec). Shown only when the provider returns token usage.

Infrastructure & Settings

  • ⚙️ Persistent Settings – Centralized configuration for API URLs, stream timeouts, and history management.
  • 🔌 Connect on Startup – Automatically connects to the LLM server on extension startup.
  • 🔄 Auto-Load History on Startup – Automatically restores the most recent conversation from saved history.
  • ⏳ Customizable Timeout – Adjustable streaming inactivity limit for slower local models (0 = never timeout).
  • 🔔 Flash Taskbar When Done – Flashes the Visual Studio taskbar icon when a response is ready while Visual Studio is in the background.
  • 🚦 Retry once on rate limit – Optional setting: when the provider reports too many requests, LM Local waits and sends the request once more.
  • 📂 Local Chat Logging – Appends all conversation events to .jsonl files in %LOCALAPPDATA%\LMLocalChat\ChatHistory\. This persistent log serves as the data source for session recovery when Visual Studio starts.
  • 🌐 Streamable MCP Support – Supports the Model Context Protocol to dynamically scale the AI's toolkit via both local process-based (stdio) and remote network-based (http) transports.
  • 🔒 Trusted server certificate – Support for self‑signed/private‑CA certificates via a configurable path to the public certificate.

⚙️ Providers

The "Providers..." dialog allows you to create and save multiple provider profiles (servers) so you don't have to re-enter your API keys and base URLs every time. You can store as many profiles as you need, including both local servers (like Ollama running on your machine) and cloud remote services (like Groq, OpenAI, or Gemini).

🔒 Privacy & Data Usage Note: Unlike local servers which keep 100% of your data offline on your machine, cloud remote providers process your requests on external servers. Data retention policies vary significantly by provider - some services may use your prompt history and codebase context for model training by default. Always verify the provider's privacy policy and terms of service before transmitting proprietary or sensitive source code.

Once configured, you can seamlessly switch between your saved profiles via the main settings.

⚠️ Note on Settings: LM Local always uses the values in Settings. A provider profile only fills them in (API base URL, API key, etc.) when you select it there.

  • Single provider: You can configure Settings directly without needing a profile.
  • Multiple providers: Set them up as profiles via Providers... and keep provider-specific endpoints and keys inside each profile.

Warning: Switching active providers re-applies that profile's values and overwrites direct edits in Settings. Recommendation: Always keep provider-specific endpoints and keys inside the profile.

Quick example

How to configure a custom remote endpoint and activate it inside the extension.

Step 1: Create the Provider Profile

  1. Click the menu icon (…) and select "Providers...".
  2. Click "+ Add Profile" and fill in the fields:
    • Profile name: Ollama cloud
    • Provider type: Select OpenAI compatible from the dropdown.
    • API base URL: https://ollama.com/
    • 💡 Tip: For OpenAI compatible, start typing — known provider URLs are suggested in the field.

    • API key: Enter your cloud provider API key.
    • 💡 Note: The extension allows any profile names, but if you create multiple profiles with completely identical fields, the system will always use the first one.

  3. Click Apply, then click Save Changes to close the window.

Step 2: Switch to the New Provider

  1. Open the menu (…) again and select "Settings...".
  2. In the AI provider dropdown, select your newly created Ollama cloud profile.
  3. Save settings, and you are ready to chat!

Step 3: Select Your Model

  1. Click the model name (or "Select model..." placeholder) in the top header.
  2. Search, filter, and select your desired model from the window to activate it.

In the Providers... dialog, the OpenAI compatible URLs below are suggested in the API base URL field. For DeepSeek, Gemini and Together AI the URL is filled in when you pick the provider type.

🆓 Free to Try (Free Limited Tiers / Credits Available)

Provider Provider Type API Base URL
Ollama OpenAI compatible https://ollama.com/
OpenRouter OpenAI compatible https://openrouter.ai/api/
Siliconflow OpenAI compatible https://api.siliconflow.com/
Doubleword AI OpenAI compatible https://api.doubleword.ai/
Hugging Face OpenAI compatible https://router.huggingface.co/
Alibaba Cloud Model Studio OpenAI compatible https://[*].eu-central-1.maas.aliyuncs.com/compatible-mode/
Parasail OpenAI compatible https://api.parasail.io/
Mistral OpenAI compatible https://api.mistral.ai/
Cohere OpenAI compatible https://api.cohere.ai/compatibility/
Google AI Studio Gemini (cloud) https://generativelanguage.googleapis.com
Requesty OpenAI compatible https://router.requesty.ai/
Novita OpenAI compatible https://api.novita.ai/openai/
Bitdeer OpenAI compatible https://api-inference.bitdeer.ai/

Free, with limited availability

Provider Provider Type API Base URL
Perplexity.ai OpenAI compatible https://api.perplexity.ai/router/
Groq OpenAI compatible https://api.groq.com/openai/

💳 Pay to Try (Commercial / Premium)

Provider Provider Type API Base URL
DeepSeek DeepSeek (cloud) https://api.deepseek.com
Together AI Together AI (cloud) https://api.together.ai/
Fireworks AI OpenAI compatible https://api.fireworks.ai/inference/
OpenAI OpenAI compatible https://api.openai.com
DigitalOcean OpenAI compatible https://inference.do-ai.run/
GMI Cloud OpenAI compatible https://console.gmicloud.ai/api/

🗂️ Models

The Models dialog (menu … → Models…) manages model settings in the models.config.json file. It is designed for two tasks:

  • Override parameters of models already returned by the provider – change the display name (displayName), context length (contextLength), token limit (maxTokens), or reasoning effort (reasoningEffort). These values take precedence over built‑in defaults.

  • Add models not listed by the provider – if you know the modelId of a model that the provider (e.g., OpenAI, Anthropic) does not expose via its API, you can manually create a record in the dialog: click “Add”, fill in the fields, set isCustom: true, and be sure to provide a displayName. After saving, the model will appear in the main selection list.

The Adjust Current button automatically finds or prepares a record for the currently active model.

Don't send reasoning back – turn it on if the model or its server rejects the reasoning of earlier answers (reasoning_content) in requests with tools.

You can also pick an Auto-apply instruction for a model: when you switch to this model, that instruction mode is selected in the chat (if the mode is enabled). "Not set" keeps the current mode.

Built‑in AI Tools

The built‑in tools let the AI read, edit, build, and test your code. You control which tools are enabled, can review all changes before accepting them and manually roll back any change.

What you can control

In Settings → Tools & Context (two checkboxes):

  • Enable built‑in AI tools (read‑only) – The AI can open and read files, but cannot change anything.
  • Enable built‑in AI tools (write/modify) – The AI can create, change, or delete files. Available only while the read‑only checkbox is on; turning read‑only off also turns this one off.

💡 Tip 1: Version Control Recommended If you enable write/modify tools, using version control (e.g., Git) is strongly advised – it makes it easy to track, diff, and revert automated changes.

🧠 Tip 2: Model Size & Capabilities Built-in AI tools and MCP extensions heavily rely on advanced Tool Calling (Function Calling). For a stable experience, it is recommended to use larger or specialized models (e.g., 14B+ parameters). Smaller models (like 7B/8B) may occasionally struggle with JSON formatting, hallucinate arguments, or trigger loop prevention.

In the Built‑in Tools… dialog (list of built‑in tools):
Open this from the extension's main menu. You’ll see all built‑in tools (for example, delete_file, replace_file_content). Each tool can be enabled or disabled individually. Even if the global write/modify checkbox is on, you can still turn off specific tools like delete_file. Use “Enable All” or “Disable All” to change many at once, then click Save.

Open edited files in editor

Settings > Visual Studio > Open edited files in editor - disabled by default. When enabled, Visual Studio activates the file that a tool has just created or modified, so you can review the result immediately.

Scope This applies to built-in LM Local tools only (create_file, replace_file_content, replace_file_lines, insert_file_lines), and only when the call actually wrote the file: failed and no-change edits do not open anything. Files written by MCP servers or by subagents are not opened automatically.

List of built‑in tools

Tool Description Supported Languages Limitations / Notes
create_file Creates a new file with initial content or as a copy of an existing file. All Automatic syntax check applies *
delete_file Deletes a file from the solution. All –
find_files Searches for files by name. All –
list_directory Lists files and folders in a given path. All –
get_solution_overview Summarizes the currently open solution: projects, solution folders, file counts, languages, test-project flags. C#, VB.NET, F#, C++ (.vcxproj) –
set_file_project_status Includes a file in a project, or removes it from the project and deletes it from disk. C#, VB.NET, F#, C++ (.vcxproj) –
read_file_lines Reads a specific range of lines. All –
search_file_content Searches for a text string (case‑insensitive) inside solution files. All –
search_solution_knowledge Searches Markdown files in predefined folders of the solution. Markdown (.md) Folders are configured in Settings → Tools & Context → Knowledge base paths.
search_chat_history Searches over past chat-history sessions. - Requires Save chat history & stats enabled.
get_active_document Returns the path and full text of the currently open document. All –
replace_file_content Replaces the entire content of a file with the provided text. All Automatic syntax check applies *
replace_file_lines Replaces a range of lines (by numbers) with new content. All Automatic syntax check applies *
insert_file_lines Inserts lines at a specific position. All Automatic syntax check applies *
format_document Applies Visual Studio's code formatting to a file. Any (VS editor) organize_usings applies only to C# files. File types VS cannot format (e.g. Markdown) are left unchanged and reported as skipped.
get_symbol_info Finds declarations and references to a symbol (class, method, etc.) across the solution, with line numbers and context. C# only Uses Roslyn
get_symbol_info_js Finds declarations and references to a symbol (class, method, etc.) across the solution, with line numbers and context. JS only only .js, .mjs, .cjs
inspect_type Inspects a fully qualified type from the open solution (source or referenced assemblies) and returns its full metadata. C# only Uses Roslyn.
build_solution Builds the currently open solution, including all its projects, or a specific project. Any (MSBuild) Uses MSBuild via Visual Studio, in the active solution configuration (Configuration/Platform in the VS toolbar).
run_tests Runs the tests of a specific project and shows live output. .NET (C#, VB, F#) Uses the active solution configuration (Configuration/Platform in the VS toolbar). Requires the .NET SDK (dotnet CLI).
get_changes_diff Lists pending file changes with added/removed counts and optionally returns unified diffs for selected files. Any Mirrors the Changes panel
todo_write Keeps the step list of a multi-step request; shown in the chat as the task panel. Any –
git_read Read-only git inspection: status, diff, log, show, blame and file_at_revision for the repository containing the solution. Any (git 2.24+) Uses git from PATH, or the git shipped with Visual Studio.

* Automatic syntax check applies to: C# and VB (via Roslyn), .js/.mjs/.cjs (via Acornima).

Changes panel – see what was changed and revert if needed

When a tool edits a file, the changes are applied to the actual files in your solution. LM Local tracks all modified files and shows them in a collapsible Changes panel inside the chat window. This list persists across solution reloads and Visual Studio restarts, so you can always review what the AI did.

The panel lets you:

  • Click any file to see a diff of the changes (a compare tab, or the review window – see Review modes below).
  • Click on a file's icon to open it in the Visual Studio editor.
  • See labels: New, Modified, or Deleted next to each file.
  • Hover over any file to access individual quick actions on the right side:
    • Click the ✕ (Discard modifications) button to revert changes for that specific file only.
    • Click the ✓ (Accept modifications) button to confirm changes for that specific file and remove it from the list.
  • Switch between List view and Tree view.
  • Click Review all – opens all changed files for review (see Review modes below).
  • Click Open all – opens all changed files in Visual Studio editor tabs.
  • Click Discard all – reverts all changes using internal backups (files are restored to their state before the AI edits).
  • Click Accept all – confirms the changes, removes the internal backups, and clears the list (you can no longer revert them afterward).

Review modes (Settings → Visual Studio → Review):

  • Separate compare tabs (one per file) – default. Each file opens in its own Visual Studio compare tab.
  • One window, full files – all changed files are stacked in one LM Local Review tab, each in a native Visual Studio diff with syntax highlighting.
  • One window, changes only – the same window, but unchanged lines are collapsed; expand them in place when you need more context.

In the review window:

  • Each file has a header with Viewed, Discard and Accept. Click the file name to open it in the editor.
  • The file list on the left jumps to a file; test files are listed last.
  • The toolbar switches Inline / Side-by-side, changes only, the file list and line numbers, and offers Accept all / Discard all (with confirmation).
  • Reviewing a single file from the Changes panel opens the same window with only that file.
  • Binary files and files over 1 MB are listed with their actions but without a diff; open them in the editor to review.
  • The window refreshes when files change, and stays in sync with the Changes panel.
  • Every changed file gets a card (up to 500 at once – click Show all for more, Show first 500 to go back); diff viewers are created as you scroll to them and released when far away or collapsed, so large change sets stay responsive. If some files have no card, Accept all and Discard all say so before they run.

Note: "Changes only" uses the Visual Studio summary diff option, which is global: while the review window is open, other compare tabs also collapse unchanged lines. The previous value is restored when the window is closed.

🤖 Subagents (Advanced Users)

Subagents are specialised AI "workers" that the main chat can invoke as tools. Each agent runs in an isolated loop with its own provider, model, system prompt, and toolset, returning a summary to the main conversation.

Use subagents when you need:

  • Specialised roles – dedicated workflows with their own prompt and toolset, such as reviewing the pending diff, making an architectural decision, or planning a task.
  • Work split across models – each kind of work runs on the model that suits it: for example, a small local model for searching and reading code, and a stronger model in the main chat for decisions and edits.

Side benefits:

  • Leaner main context – raw search results and file contents stay in the subagent; the main model receives only a compact result.
  • Fewer main-model tokens – the work done on a cheaper or local model is not paid for by the expensive main model. How much you save depends on the task.

Note: subagents do not make answers faster. The main model waits for their results, so a request with subagents often takes longer overall. If a subagent uses the same model as the main chat, there is no saving at all: it consumes more total tokens (since it generates extra output).


Subagents Setup & Configuration

⚡ Model & Hardware Notes:

  • Prompt Optimization: Built-in subagent system prompts are specifically tuned for google_gemma-4-e4b-it. Using other models may require adjusting the prompts.
  • When to Run Locally: Running subagents locally makes sense if your hardware can sustain 60–80+ tokens/sec (achievable with MTP enabled on an NVIDIA GPU with 6GB+ VRAM, 8GB+ recommended). If your local generation is slower, consider binding a fast cloud API via Option 2.

Option 1: Quick Start (Default Local Setup)

Out of the box, subagents use google_gemma-4-e4b-it on the default local LM Studio server (http://localhost:1234). For Ollama or any other server, use Option 2.

  1. Start the Local Server: Open LM Studio and load google_gemma-4-e4b-it.
    • Enable MTP: Select the draft model (gemma-4-E4B-it-assistant) in the LM Studio settings to hit high token speeds.
    • Set Context Size: Set context length to 40,000 (scale up for parallel execution, e.g., 80,000 for parallelism = 2).
  2. Enable & Run: In Visual Studio, select your primary heavy model for the main chat (e.g., GPT-5, DeepSeek), enable subagents via the 's' toolbar icon, and send a task (e.g., "Find my class in the solution").

Option 2: Using a Custom Provider or Model

To bind subagents to a different provider (e.g., cloud API, custom endpoint) or another model:

  1. Select Target Model: In LMLocal, add your provider in settings and temporarily switch your main chat to the model you want subagents to use.
  2. Bind to Subagents: Open Sub Agents from the main menu, click Use Active Model, and hit Save. (This creates a custom subagents.json tied to this provider/model).
  3. Switch Back: Switch your main chat back to your primary model (e.g., DeepSeek, GPT-5). Subagents will now run on your saved configuration in the background.

Predefined Subagents

Out of the box, LMLocal includes these predefined subagents, all enabled by default except the Architect:

  1. Code explorer (code_explorer_subagent) — Read-only code agent: finds files by name or content, resolves C# and JavaScript/TypeScript symbols (declarations and usages), and reads source that first has to be located. Returns locations (file path, line number, matched line) or source blocks; the code in its answer is copied from the files, not retyped by the model.
  2. Build & Test (build_subagent) — Agent used to build the open solution and run unit tests in Visual Studio, returning compiler errors and test failures.
  3. Context retriever (context_retriever_subagent) — Retrieval agent for querying archived chat history and project knowledge base documents to recall prior decisions, plans, or architectural conventions.
  4. Architect (architect_subagent) — Disabled by default. Read-only architecture decision agent: for tasks that need an architectural decision, it selects one best-fit design for the existing codebase, defines component responsibilities and layer boundaries, and explicitly lists what should not be introduced. Skipped for isolated fixes.
  5. Reviewer (reviewer_subagent) — Final-step software architecture and code quality reviewer that inspects the actual pending diff and validates proposed plans and implementations before delivery, ending with Status: COMPLETE, PARTIAL, or REJECTED.
  6. Review skeptic (review_skeptic_subagent) — Independent second opinion on the changes, called after the reviewer: checks whether the claims are true, whether the approach is justified, whether tests cover the new behavior, and whether a simpler path exists. It gives an assessment and never blocks.

Typical order: explorer / context retriever gather evidence → architect (when enabled and an architectural decision is needed) → edits → build & test → reviewer → review skeptic.

  • Note: The default subagent prompts are specifically optimized for the google_gemma-4-e4b-it model.

Troubleshooting (subagents.json)

  • Updates: Custom subagents.json files are preserved across extension updates and are never overwritten.
  • Reset to Defaults: Close the Sub Agents dialog, delete subagents.json from your config folder, and restart Visual Studio (or start a new session). The extension will fall back to built-in defaults in memory without recreating the file.
  • Recreating the Config File: With no subagents.json present, the runtime uses the built-in defaults, but the Sub Agents dialog is empty by design ("No SubAgents configured") because it edits only the custom file. To generate an editable file again, click Use Active Model (this loads the built-in defaults into the dialog) → Save.

Advanced: Running via llama.cpp

To run llama-server directly with MTP enabled (configured for single/non-parallel agent execution), use this script (replace paths with your actual .gguf locations):

llama-server.exe ^
  -m "C:\path\to\google_gemma-4-E4B-it-Q4_K_M.gguf" ^
  --mmproj "C:\path\to\mmproj-google_gemma-4-E4B-it-f16.gguf" ^
  --model-draft "C:\path\to\gemma-4-E4B-it-assistant.F16.gguf" ^
  --spec-type draft-mtp ^
  --spec-draft-n-max 3 ^
  --spec-draft-n-min 0 ^
  --spec-draft-p-min 0 ^
  -c 40000 ^
  -ngl 99 ^
  -ngld 99 ^
  -b 2048 ^
  -ub 2048 ^
  -t 4 ^
  --parallel 1 ^
  --cache-type-k f16 ^
  --cache-type-v f16 ^
  --kv-offload ^
  --kv-unified ^
  --load-mode mmap+mlock ^
  --flash-attn on ^
  --jinja

Note for Parallel Execution: In llama.cpp, total context (-c) is divided across parallel slots (--parallel). If you plan to run 2 subagents concurrently, change --parallel 1 to --parallel 2 and double the context to -c 80000 (so each agent still gets 40k context).

Choosing maxParallel

maxParallel is how many SubAgents LM Local runs at the same time (1–8). Pick the smallest value your server can actually handle in parallel:

Your server Set maxParallel to
Local (LM Studio, llama.cpp, Ollama, …) the number of parallel slots you configured on the server (LM Studio Max Concurrent Predictions, llama.cpp --parallel), but not more than 8
Cloud provider 2–8, depending on your plan's rate limits; start with 3 and raise it if you see no rate-limit errors

If maxParallel is higher than your server can serve, the extra agents simply wait — slower, and they may hit timeoutSeconds before they start.

Configuration

Edit %LOCALAPPDATA%\LMLocalChat\subagents.json to add, remove, or tweak agents as needed.

Root-level defaults (providerType, customBaseUrl, customApiKey, model, temperature, timeoutSeconds, maxRounds, maxTokens, reasoningEffort, parallel, maxParallel) are applied to any agent that doesn't set its own value. Changing a root value updates every agent that currently inherits it; explicit per-agent values stay exactly as typed.

Tool ownership: while subagent mode is on, a built-in tool listed in the allowedTools of an enabled agent is removed from the main model's tools: the main model reaches it only through that agent. Root-level sharedTools lists the tools the main model keeps anyway; the agent still has them too. The default config shares get_symbol_info and get_symbol_info_js, so the main model can look up a symbol directly instead of running the code explorer for it. A hidden agent (exposed: false) is never offered to the main model as a tool, but it still owns its tools: they stay hidden from the main model unless they are in sharedTools.

Example (illustrative)

{
  "agents": [
    {
      "id": "code_explorer_subagent",
      "displayName": "Code explorer",
      "description": "Read-only code search agent for the open solution.",
      "system": "You are a read-only code search agent...",
      "temperature": 0.0,
      "timeoutSeconds": 360,
      "maxRounds": 50,
      "maxTokens": 24000,
      "reasoningEffort": "medium",
      "enabled": true,
      "allowedTools": [
        "list_directory",
        "find_files",
        "search_file_content",
        "get_solution_overview",
        "read_file_lines"
      ]
    }
  ],
  "providerType": "lmstudio",
  "customBaseUrl": "http://localhost:1234",
  "customApiKey": "",
  "model": "google_gemma-4-e4b-it",
  "temperature": 0.1,
  "reasoningEffort": "medium",
  "sharedTools": [
    "get_symbol_info",
    "get_symbol_info_js"
  ]
}

Root-level fields (not inherited by agents)

Field Type Required Default Notes
agents[] object[] ✅ — see the schema below
pipelines[] object[] — alpha — fixed sequences of agent runs, each offered to the main model as one tool; see Pipelines below
sharedTools[] string[] — built-in tool names the main model keeps even though an enabled agent lists them in allowedTools (see Tool ownership)

agents[] schema

Field Type Required Default Notes
id string ✅ — unique, tool-name: [A-Za-z0-9_-]{1,64}; must not collide with a built-in tool name
displayName string id shown in UI
description string ✅ — shown to the model/user
system string — overrides default system prompt
providerType string root default e.g. lmstudio
customBaseUrl string ✅ root default absolute URL; http://localhost:1234 for LM Studio
customApiKey string root default
model string ✅ root default required unless root model set
temperature number [0..2] root default
timeoutSeconds int >=0 root default 0 disables watchdog. Also limits the agent's tools: a build or test run gets only the agent's remaining time (in the main chat they use their own 10-minute limit), so raise it for long builds or test suites.
maxRounds int >=1 root default tool-call loop cap
maxTokens int >=1 root default output cap
reasoningEffort string root default none/low/medium/high
parallel bool false may run at the same time as other subagents the main model calls in one turn
maxParallel int 1..8 root default how many SubAgents may run at the same time (values above 8 are treated as 8)
exposed bool true alpha (used with pipelines) — false → the main model does not see the agent as a tool and cannot call it; it stays reachable through a pipeline and still owns its tools
enabled bool true runtime gate
allowedTools[] string[] [] built-in tool names; an unknown name or another subagent's id (no recursion) → save rejected

Common built-in tool names referenced by the default agents: get_solution_overview, list_directory, find_files, search_file_content, read_file_lines, get_symbol_info, get_symbol_info_js, inspect_type, build_solution, run_tests, search_chat_history, search_solution_knowledge, get_changes_diff, git_read, replace_file_lines, insert_file_lines.

Pipelines (alpha)

Alpha: pipelines are experimental. The configuration format and behavior may change in the next versions. They are off by default: the built-in subagents.json has no pipelines[]. A sample configuration ships as subagents-pipeline.json.

A pipeline is a fixed sequence of agent runs offered to the main model as one tool. The main model calls it once with a task; the steps run in the configured order, each in a fresh session, and only the final text comes back. The main model never decides what runs next.

"pipelines": [
  {
    "id": "review_flow",
    "displayName": "Review flow",
    "description": "Reviews the pending changes: explore the code, then write the verdict.",
    "enabled": true,
    "steps": [
      { "agent": "code_explorer_subagent", "prompt": "{{task}}" },
      { "agent": "reviewer_subagent", "prompt": "Task: {{task}}\n\nCollected context:\n{{prev}}" }
    ]
  }
]
Field Type Required Default Notes
id string ✅ — tool name: [A-Za-z0-9_-]{1,64}; must not collide with an agent id or a built-in tool name
displayName string id shown in the chat card and in the dialog
description string ✅ — the tool description the main model reads; it decides whether to call the pipeline from this text only
enabled bool true a disabled pipeline is not offered to the model
output string last last returns the answer of the last step; all returns every answer under its own heading
parallel bool root parallel may run at the same time as other subagents the main model calls in one turn (only when every step agent is read-only and the pipeline has no parallel step)
maxParallel int 1..8 root maxParallel width of that group
steps[] object[] ✅ — at least one step

Step fields (steps[]):

Field Type Required Notes
id string makes the answer addressable as {{steps.<id>}}; unique within the pipeline
agent string ✅ id of an agent from agents[]
prompt string ✅ the user message of the step
retries int 0..3 extra attempts on a transient provider failure (network, HTTP 408 or 5xx, a broken stream), with a pause of 3 / 5 / 8 s before each; default 0
parallel object[] a group of branches that run at the same time; a step has exactly one of agent+prompt or parallel
maxParallel int width of the group; falls back to the pipeline, then to the root value
onBranchError string stop (default: the first final branch error stops the pipeline) or continue (the other branches finish and the next step sees ERROR: ... in their place)

Placeholders: {{task}} (the task of the main model), {{prev}} (final answer of the previous step; for a parallel step, every answer in config order, each under a heading like ### [2/3 facts]) and {{steps.<id>}} (answer of an earlier step or branch). Substitution is one pass: a placeholder inside an answer is never expanded again, and a placeholder that cannot be resolved stays as it is. {{prev}} is not allowed in the first step.

Parallel steps: the branches of a parallel group run at the same time, so every branch agent must use read-only tools only. A branch agent with a write tool is a configuration error: the pipeline is reported as invalid and is not offered to the main model (two agents editing the same files at once would mix their edits). The answers are joined in config order, never in completion order. A branch is retried on its own (the other branches keep running); with onBranchError: "stop" the first final branch error — after its retries — cancels the others, and the error names the branch that failed, not a branch that was cancelled because of it.

When a pipeline is offered: subagent mode and AI tools are on, the pipeline is enabled and structurally valid, and every step agent exists, is enabled and has its tools available in the current mode (an agent with a write tool in read-only mode makes the pipeline unavailable). Otherwise the pipeline is simply not in the tool list: the reason goes to the log and to the dialog, and saving is never blocked by it.

When a step fails: the pipeline stops and the error names the position (pipeline 'review_flow' step 2/3 (review)); the steps after it do not run. A step is repeated only after a transient provider failure. Everything else is final at once: other provider errors (HTTP 4xx, an exhausted quota, a context overflow), a rate limit (HTTP 429 is already retried inside the request when Retry once on rate limit is on), the agent timeout, a truncated answer, logical failures (the round limit is reached, the model is still calling tools when it must answer, or the answer is empty) and a user Stop. Each attempt is a separate run with its own log session and its own usage record. The whole call gets enough time for all steps and their retries, so it is never cut off between steps. The chat card shows the wall-clock duration of the whole run and the overall generation speed (all completion tokens over all generation time), never a sum of the per-step rates.

Context growth: {{prev}} is passed as it is and is never truncated. With long answers a step may overflow the model context; that step then fails with a provider error that names its position. Plan maxTokens and the number of steps with that in mind.

Prompt injection: {{prev}} contains file content and model answers. Put agents with write tools into a step only where they are really needed, because the text of an earlier step can instruct them.

Older versions: an extension version that does not know pipelines[] and exposed still reads the file (unknown fields are ignored), but its Save writes the configuration back without them. Keep the current version if you rely on pipelines.


Managing Agents

Open the Sub Agents dialog from the main menu.

  • Enable / Disable – toggle individual agents or all at once; Enable All / Disable All switch the pipelines as well.
  • Pipelines (alpha) – the section under the agent list shows every pipeline of the file: its step chain (explorer → analyzer → analyzer), its description and a toggle. When the pipeline is not offered to the main model right now, the reason is shown under its name (agent 'x' is disabled). Steps and prompts are edited in subagents.json only; the dialog never rewrites them. An agent that is hidden from the main model is marked pipeline only.
  • Use Active Model – copies the current main chat's model, provider, base URL, and API key into the root defaults. When clicked on an existing list, it updates model, providerType, customBaseUrl, customApiKey only on agents that already have those values (the others inherit the root defaults). If the active provider has no API key (or base URL), the old value is removed from the root and from agents, so a key from the previous provider does not stay in subagents.json. If the list is empty (no custom file), it first loads the built-in defaults into the dialog.
  • Save behaves in two modes:
    • Full replace – after loading built-ins into an empty list (Use Active Model on "No SubAgents configured"): the configuration of the built-in default is written as it is — every root field (temperature, reasoningEffort, timeoutSeconds, maxRounds, maxTokens, parallel, maxParallel, sharedTools, pipelines[]) stays in the root and every agent keeps its own fields (parallel, maxParallel, customApiKey, exposed, …). The chosen provider and model are applied on top, the toggles are written as enabled.
    • Partial update – when the dialog was opened from an existing custom file (flags toggled, or Use Active Model over existing agents): only the enabled flags of the agents and of the pipelines, and the root-level changes, are written; all other JSON fields stay exactly as typed (inherited fields are not expanded).

Enable subagent mode in the chat via the 's' toolbar icon or the "Enable Sub Agents" checkbox in Settings → Tools & Context.

⚠️ Fine-Tuning & Reliability for Small Models (<8B)

Models under 8B parameters are often unreliable for complex multi-step tasks and tend to get stuck in loops or hallucinate tool arguments. If you want to configure and tune subagents yourself using a small model (<8B), keep these key points in mind:

  1. Defensive Prompting is Mandatory: You must use a strict system prompt with explicit planning steps and verification loops, or be prepared to switch to a larger model.
  2. Fine-Tuning Option: Fine-tuning the model (e.g., via LoRA/QLoRA) on task-specific function-calling datasets builds native adherence to tool schemas.

🎭 AI Instructions & Modes

The "AI Instructions..." window allows you to define specialized System Prompts (roles) and creativity levels (temperature) for different development tasks. The extension comes with pre-configured behavior templates like Default, Improve, Write, Review, Plan, Bugfix, Explain, Tests, Plan & Execute and allows you to create up to 50 custom modes

[!TIP] Prompt Caching Optimization: Select your desired mode (e.g., Bugfix, Review, Explain) before sending your message. Changing the mode mid-conversation modifies the system prompt, which invalidates the server's prompt cache, increasing token costs and latency.

Once configured, you can instantly switch between these system roles using the dropdown menu directly in the main chat bar. Selecting a preset updates the AI's system prompt and temperature for that conversation.

Modes are optional: until you save the "AI Instructions..." window once, there is no mode dropdown in the chat bar and LM Local uses its built-in system prompt. The built-in prompt is also used if the selected mode's system prompt is empty or all modes are unchecked.

How to Customize Modes:

  1. Click the menu icon (…) and select "AI Instructions...".
  2. Select a target mode/role from the left panel (e.g., Review or Bugfix).
  3. Configure its behavior in the right panel:
    • Mode Toggle Checkbox: Check or uncheck this box to show or hide this specific mode in your main chat bar dropdown.
    • Delete Custom Mode (✕): For custom modes, click the ✕ icon next to the toggle checkbox to remove the mode.
    • Reset Built-in Mode (↺): For built-in modes, click the ↺ icon next to the toggle checkbox to restore the shipped system prompt and temperature. Only the text and the temperature are restored — the mode's enabled state stays as you set it.
    • System Prompt: Enter the base instructions that define the AI's role, processing rules, and operational constraints (e.g., telling the Tests mode to act as a QA Engineer and strictly generate xUnit tests in C#).
    • Temperature: Set the randomness/creativity threshold. Use values closer to 0 (e.g., 0.1 or 0.2) for rigid, deterministic tasks like bug fixing, and closer to 1 for architectural planning or brainstorming.

    💡 Note: Always check your specific model's official documentation for recommended temperature settings, as some local models require strict defaults or a value of 0 to function properly without breaking formatting or structure.

  4. Click Save to apply the changes. The mode open in the window becomes the active mode in the chat (if it is unchecked, the first checked mode is used).

[!NOTE] Built-in modes you never edited are not copied into instructions.json, so their texts are refreshed automatically when a new version of the extension ships updated defaults. Restoring a built-in mode with the ↺ button (and clicking Save) makes it follow those updates again. If you saved the instructions with an older version, that save stored the then-current texts of all built-in modes, so they count as edited and do not update by themselves. Your own texts are kept as they are; if you want the current shipped text for a mode, open it and click ↺ (the button is active only when the mode differs from the shipped one).

Project Instructions

LM Local can add your project's instruction file to the system prompt, after the selected mode's prompt. Choose the file in Settings → Tools & Context → Project instructions:

  • Auto (default) – the first file found, in this order: .lmlocal/instructions.md, AGENTS.md, CLAUDE.md (or .claude/CLAUDE.md), .github/copilot-instructions.md.
  • A specific file from the list above.
  • Off – no project instructions.

The file is searched in the solution folder and its parent folders up to the repository root. Hover over the tools mode in the status bar to see which file is used and its size.

  • The file is read when a chat starts; after editing it, start a new chat to apply the changes.
  • Very long files are truncated (about 10k tokens are used).
  • Subagents do not receive the project instructions.

[!WARNING] The file comes from the repository. Keep it on Off for code you don't trust.

💬 Chat History Dialog

The Chat History dialog (accessible from the top‑right menu … → Chat History) lets you browse and restore past conversations from the local chat logs.

How it works

  • The dialog lists the last 200 chat sessions found in the local .jsonl log files (up to 50 hourly log files are scanned).
  • Each entry shows the last user message (truncated to 200 characters), the models used, a timestamp, and the number of messages in that session.
  • The filter searches by prompt text and by model name.
  • Click Load on any session to restore it into the chat window.

Important details

Detail Description
Save chat history & stats must be ON The dialog reads from %LOCALAPPDATA%\LMLocalChat\ChatHistory\. If Save chat history & stats is turned off in Settings → Chat, no sessions will appear (and Usage & Stats records nothing).
Loading a session forks it When you load a past session, the extension creates a brand‑new session initialized with that session's message history. Your continuation is saved under a new session ID — the original session remains untouched.

🖼️ Image Attachments (Multimodal Chat)

LM Local lets you attach images to a message so vision-capable models can "see" screenshots, diagrams, or designs. Paste (Ctrl+V) or drag-and-drop an image into the chat input — a thumbnail appears above the field, where you can review or remove it before sending.

How it works

Images are sent to the model in the OpenAI multimodal format (image_url with a base64 data URL), together with your text prompt.

⚠️ Limitations

Limitation Details
Vision model required The active model must support vision (e.g. LLaVA, Qwen2-VL, GPT-4o, Claude 3+). Otherwise the API returns an error.
Max 3 images per message A 4th image is rejected with a warning.
Max ~4 MB per image Larger files are rejected.
Allowed formats JPEG and PNG only.
Not saved in history base64 payloads are never written to the .jsonl chat log. When a session is restored, images are not available — only a placeholder ([N images attached - not available in this session]) is shown and sent to the model.
Session restore Restoring a session from history forks it into a new session; image attachments from the original session are not recoverable.
Consolidating an exchange loses images The "Clear chat → Consolidate last completed exchange" option rewrites the user message as plain text; attached images are dropped from the in-memory history after consolidation.
History compaction can drop images When Summarize long conversations is on in Settings → Chat, the early (summarized) portion of a long conversation is stripped of image attachments.

[!TIP] Images live in memory only for the current session — they won't survive a restart or loading a session from history.

💡 Smart Workflows & Best Practices

🧠 Which model series are worth trying right now?

If you are new to local LLMs and don't know where to start, try these model families:

  • Qwen 3.x series
  • Gemma 4.x series
  • Mistral 3.x series
  • Nemotron 3.x series
  • GPT OSS series

🤔 Model can't find what you're looking for?

The AI doesn't have a full filesystem index — without built-in tools enabled, it relies only on the context you provide. If the model fails to find a specific file, class, or code block:

  • Use the "+" button – Click the + button to include the entire active document in the request. This gives the AI immediate access to the current file.
  • Use "Send to LM Local" – Right-click in the editor and select "Send to LM Local". If you highlight code, it sends only the selection; if nothing is highlighted, it sends the entire active document.
  • Be specific in your prompt – Mention the exact file name and extension. For example: "Find the CalculateTotal method in OrderService.cs" — this gives the AI a clear target, making it easier to locate the relevant code.

🎯 How can I improve my development plans by hot-swapping models?

LM Local allows you to switch the active LLM on the fly without clearing the chat. You can use this to pass the conversation history from one model to another sequentially – each model builds on or critiques the previous output, refining the plan step by step.

It's simple. Just ask one AI model to write a plan, then switch to a different model in the same chat and tell it: "Critique this and update the plan." The new model reads the whole conversation and gives you a fresh perspective, catching edge cases the first one missed.

Why it works: It’s like bringing in two experts one after another. The first drafts a strategy. The second walks into the room, reads everything so far, and says: "Here’s where you went wrong." By swapping models, you collect the best from each perspective — and you never have to copy-paste or start a new chat, because the entire history stays right there.

📉 Hitting Context Limits

Method 1: Use LM Local's UI cleanup If the chat history grows too long during this multi-model review loop and you start hitting token limits, use LM Local's cleanup feature instead of losing your work:

  • Click the "Clear chat" button next to the menu.
  • Choose "Summarize and move context" or "Consolidate last completed exchange" or Exact copy of the last exchange.
  • This will automatically compress the entire debate or pull just your final refined plan into a fresh, clean chat session, resetting model context usage back to the baseline.

Method 2: Externalize state to a file (Requires built-in tools enabled)

  • Tell the model: "Save this finalized plan to docs/plan.md".
  • Clear the chat to reset the context window.
  • In the new clean chat, ask the model to review or implement the plan:
    • To refine: "Read docs/plan.md, review it, and suggest improvements."
    • To implement: "Read docs/plan.md and implement Phase 1."

💰 How can I reduce token usage and lower API costs?

Context window accumulation can lead to high API costs or local performance drops. You can optimize your budget by applying these patterns:

  • The "Smart Context Collector" Tiering: Don't waste your expensive cloud tokens on reading massive files or building initial context. Instead, start the session with a lighter, cheaper model (like GPT-4o-mini or a local Ministral 3.x) to read your code files, list directories, and pull together the initial workspace data. Once the context is captured and a baseline draft is formed in the history, hot-swap to a premium OpenAI-compatible model (like DeepSeek or GPT) to run the high-level analysis and critical edits.
  • Choose Providers with Prompt Caching: When working in the cloud, pick providers that natively support Prompt Caching (like DeepSeek or OpenRouter). Because LM Local continuously appends conversation history with each turn, prompt caching can slash your recurring token costs.
  • Offload Context via RAG MCP Servers: Instead of attaching whole codebases or giant documents directly to the prompt, hook up an external RAG (Retrieval-Augmented Generation) MCP server. This allows LM Local to fetch only the highly relevant code snippets or documentation chunks dynamically when needed. You get full project awareness while keeping your active context window lean and cheap.
  • Use a lightweight project map (no RAG): Create a context.md file (manually or ask the model to generate it) describing your project structure, main classes, and patterns. Attach it to the first message to give the model a "project map" without attaching the whole codebase. This saves tokens and reduces context size.
  • Delegate tasks to Subagents: When performing extensive codebase searches or complex multi-step operations, enable Subagents. Instead of letting the main chat accumulate long chains of tool calls and raw file outputs (which quickly drains your context window), a subagent handles the task in its own isolated loop. It does the work in the background and returns only a concise summary to your main conversation, keeping your primary session lean and usually reducing token costs (the request may take longer, though).
  • Disable Unused Tools (Built-in & MCP): Each active tool adds its JSON schema and prompt definitions to every API request. Turn off MCP servers or built-in tools you don't need for your current task to instantly shave off input tokens from every turn.

⚡ How do I maximize model speed (even with a quality drop)?

When you just need to generate straightforward boilerplate, repetitive CRUD methods, or standard unit tests at maximum speed:

  • Hardware VRAM Optimization: Choose quantized weights (e.g., Q4_K_M GGUF formats) that fully fit into your GPU VRAM. As soon as layers spill over into system RAM (CPU fallback), streaming speed drops significantly.
  • Enable Speculative Decoding: If your local inference engine (such as vLLM, LM Studio, or llama.cpp) supports it, turn on Speculative Decoding. This technique pairs your main LLM with a tiny, ultra-fast "draft" model. The draft model rapidly guesses the next several tokens, and the target model verifies them in parallel. This noticeably increases your tokens-per-second generation rate. For example, you can run the base model google/gemma-4-e4b alongside its dedicated drafter gemma-4-e4b-it-assistant, which is optimized for fast speculative generation.
  • Tweak Backend Inference Settings: Open your server configurations and check the parameters that directly impact processing and generation speed. Pay close attention to:
    • GPU Offload & CPU Thread Pool Size
    • Flash Attention & Unified KV Cache
    • K/V Cache Quantization Type & Offload KV Cache to GPU Memory
    • Evaluation / Physical Batch Size
    • Keep Model in Memory
  • Drop the Temperature: Lower your active preset temperature closer to 0.0 or 0.1. This stops the model from creatively wandering around, forcing it to stream short, direct, and deterministic code structures.
  • Fine-Tune Small Models (<8B) for Structured Tasks: If small local models struggle with tool calling, looping, or complex JSON schema adherence, fine-tune them (e.g., via LoRA/QLoRA) on task-specific function-calling datasets. Fine-tuning builds native schema adherence into light models, making them faster and more reliable for background tasks and subagents without needing heavy system prompts.

Auto-Completions

Provides multiline ghost completions (inline grey text code suggestions) that appear when your cursor is at the end of a line, powered by Fill-in-the-Middle (FIM) prompting on local base models.

How to Enable: Click the ... menu in the extension panel and select Autocompletions... to open the configuration window. From there, check the enable box, select your provider, and assign a model.

How It Works

  • Multiline suggestions. The first line appears right after the cursor; the following lines (up to 10) appear below it, and the code underneath moves down to make room.
  • Type through. Typing characters that match the suggestion consumes them – the rest of the suggestion stays visible. Pressing Enter where the suggestion continues on the next line keeps it going; the editor's own indentation is used.
  • Tab inserts the whole remaining block using the file's line endings. Esc, moving the cursor, or typing something different dismisses it.
  • Clean output. Lines that only repeat the code right after the cursor (e.g. a closing } that is already there) are dropped, and model control markers such as <|endoftext|> or <|cursor|> are removed.

Working Alongside IntelliSense, IntelliCode and Copilot

  • IntelliSense completion list: while the list is open, Tab belongs to it, so LM Local hides its suggestion and asks again after the list closes.
  • IntelliCode / GitHub Copilot inline suggestions: whichever suggestion is shown first stays. If a Visual Studio suggestion is already on screen, LM Local does not replace it; if LM Local's suggestion is already shown, the later one is dismissed, so the two never overlap.

💡 If you prefer to see only LM Local suggestions, turn off IntelliCode whole-line completions / Copilot completions in Visual Studio options.

Supported Providers & Models

Works with local providers: LM Studio, Ollama, llama.cpp, Jan.

For optimal results, use base models trained natively on Fill-in-the-Middle (FIM) tokens. The following models or series have been verified to work:

  • Qwen2.5-Coder (1.5B)
  • DeepSeek-Coder (1.3B-Base)
  • CodeGemma (2B)
  • StarCoderBase (1B)
  • Refact (1.6B-FIM)
  • Stable-Code (3B)

💡 Tip: After selecting your provider and model in the settings, you can click the Test button to easily verify the connection and ensure the model is responding correctly.

⚠️ Note: Make sure you are using the Base versions of these models rather than the Instruct/Chat versions, as base models are specifically optimized for raw code completion.

Context Menu Commands

LM Local adds commands to the context menus of the code editor, Solution Explorer, document tabs and the Error List. All commands open the LM Local chat window (if not already visible) and inject the relevant content.

Editor Context Menu (right-click inside a code file)

Command Behavior
Send to LM Local Injects the selected text (or the entire file if nothing is selected) into the chat input as a code-fenced markdown block. The prompt is not sent automatically — you can edit or add instructions before sending.
LM Local Commands → Review Code Auto-sends the selected code with a review prompt: "Identify potential bugs, security issues, performance problems, and code smells. Provide specific, actionable recommendations." Selects the Review instruction tab.
LM Local Commands → BugFix Code Auto-sends the selected code with a bugfix prompt. Selects the Bugfix instruction tab.
LM Local Commands → Add Unit Tests Auto-sends the selected code with a test-generation prompt. Selects the Tests instruction tab.
LM Local Commands → Add Summary Auto-sends the selected code with a prompt to add /// XML documentation comments. No instruction tab is selected.
LM Local Commands → Improve Code Auto-sends the selected code with an improvement prompt focused on performance, readability, and C# best practices. Selects the Improve instruction tab.
LM Local Commands → Explain Code Auto-sends the selected code with a detailed explanation prompt. Selects the Explain instruction tab.

All editor commands are disabled while a chat session is running. If no text is selected, the entire document content is used.

If the command's instruction mode is unchecked, or the "AI Instructions..." window was never saved, the command keeps the current mode.

Solution Explorer Context Menu (right-click any node)

Selection Command What Gets Injected
1 file Send to LM Local Full file content in a code fence with its absolute path
2–10 files (Ctrl+Click) Send to LM Local Each file's content, up to 200 KB total
Folder (≤20 files recursively) Send to LM Local Folder Content of all files (recursively through subfolders)
Folder (>20 files recursively) Send to LM Local Folder Hierarchical tree of folders and files (no content)
Project node Send to LM Local Project Hierarchical tree of folders and files (no content)
Solution node Send to LM Local Solution Aggregated tree of all projects

Limits & Safety

  • Max 10 files with full content per operation
  • Max 200 KB total content; excess files appear as (content truncated)
  • Folder with ≤20 files (recursive count) → file contents are sent
  • Folder with >20 files → hierarchical directory tree is sent instead (no content)
  • Build output, dependency and cache directories are automatically excluded (e.g. bin, obj, build, out, dist, .vs, .git, node_modules, packages)
  • Binary / image files (.exe, .dll, .pdb, .png, .jpg, .gif, etc.) are skipped
  • Button is disabled while a chat session is in progress

Note: Solution Explorer commands do not auto-send — content is injected into the chat input so you can review or add instructions before submitting. Files are read directly from disk and do not need to be open in the editor.

Document Tab Context Menu (right-click a file tab)

Command Behavior
Send to LM Local → All Open Files Injects the content of every open document, including tabs that are not currently visible in any tab group, into the chat input as code blocks. The prompt is not sent automatically — you can edit or add custom instructions before sending.
Send to LM Local → All Active Files Injects the content of the active (visible) tab of each editor tab group — one file per group, so a split view contributes one file per pane. The prompt is not sent automatically — you can edit or add custom instructions before sending.

Note: Both commands are capped at 10 files with full content and 200 KB total; further files appear as (content truncated) markers. Build output folders (bin, obj, .git, node_modules, etc.) and binary/image files are skipped, and both commands are disabled while a chat session is running.

Error List Context Menu (right-click an entry)

Command Behavior
Explain Error with LM Local Auto-sends the selected Error List entries (errors, warnings or messages) with a request to explain what each one means, what most likely causes it and how to fix it. The fix is described, not applied. Selects the Explain instruction tab.

Note: You can select several entries at once — up to 10 are sent, the rest are mentioned as "more entries not shown". The model reads the code around each reported location by itself. The command is disabled while nothing is selected or a chat session is running.

🐞 Explain Debugger Stops

When Visual Studio stops in Break Mode, LM Local can show a one-line Explain banner right above the chat status bar. One click sends the context of the stop to the chat, and the model explains the cause.

How to use

  1. Open Settings..., go to the Visual Studio tab and tick Explain debugger stops (off by default), then click Save.
  2. Keep the LM Local window open and start debugging (F5).

    💡 Visual Studio keeps a separate window layout for debug mode. The first time you debug, the LM Local window may not be where you docked it: drag it to the place you want once (the same way as in Getting Started), and Visual Studio will remember it for debug mode.

  3. When the debugger stops on a breakpoint or an exception, the banner appears, for example Breakpoint hit · OrderService.cs:42 or Exception thrown · OrderService.cs:42.
  4. Click Explain. The prompt is sent to the chat automatically and the banner disappears. Click ✕ to hide the banner until the next stop.

The banner is hidden as soon as the program continues (F5), steps (F10 / F11) or debugging is stopped. Steps never show the banner.

What is sent

The context is read only when you click Explain, because most of it is available only in Break Mode:

  • the stop reason and the location (file and line, relative to the solution);
  • for an exception: its type and message, and up to 3 levels of InnerException (the innermost one is treated as the root cause);
  • up to 5 stack frames and up to 20 local variables of the current frame.

Limits and privacy:

  • Values are read only for simple types (numbers, bool, string, Guid, DateTime, ...). Objects, collections and enums are sent with the name and type only, so the debugged program is not asked to run any of its own code to print them.
  • Local variables whose name contains password, passwd, secret, token, apikey, api_key or connectionstring are sent as <hidden>. Other values, such as a string with a secret in an innocently named variable, are not filtered.
  • Values are cut to 200 characters, exception messages to 500. Reading is limited to about 3 seconds.
  • The model is asked only to explain the cause and describe the fix. It is told not to apply changes.

💡 If Visual Studio leaves Break Mode between the click and the read (for example you pressed F5), nothing is sent.

🌐 Model Context Protocol (MCP) Support

LM Local supports external tool integration via the Model Context Protocol (MCP). This allows you to hook up custom or third-party servers to give your local AI even more capabilities.

[!WARNING] Security Notice & Trusted Sources Only

  • Trust Infrastructure: Only connect to MCP servers and URLs that you fully trust or host locally yourself.
  • Review Third-Party Tools: Before enabling a public or third-party MCP endpoint, review its exposed tools and documentation to ensure it does not execute unauthorized commands or compromise sensitive project data.
  • No Execution Restrictions: Currently, the extension does not restrict, sandbox, or prompt for manual confirmation when the AI invokes an MCP tool. Connected tools execute automatically when called by the model.

⚠️ Scope & Supported Transports

  • Protocol Version: Compatible with the MCP 2025-11-25 specification standard.
  • Tools-Only Support: LM Local exclusively loads and registers Tools exposed by your MCP servers. These are separate from the built‑in tools and are configured independently. Other MCP features like custom Prompts or Resources are currently ignored and will not be utilized by the assistant.
  • Transports: Supports both local process-based (stdio) and network-based streamable (http) transports.
  • NOT Supported: Legacy sse (Server-Sent Events) transports are unsupported (no plans).

⚙️ How to Configure MCP Servers

You can set up and manage connections to external MCP servers directly inside the configuration dialog:

  1. Open the LM Local tool window.
  2. Click the menu icon (…) in the top-right corner.
  3. Select "MCP Extensions..." from the dropdown menu.
  4. In the dialog:
    • Check "Enable Model Context Protocol (MCP)" to turn the feature on.
    • Paste or edit your JSON configuration directly into the built-in text editor.
    • Click the "Discover Tools" button to validate your settings and instantly verify connection availability.

The extension saves your settings locally to %LOCALAPPDATA%\LMLocalChat\mcp.json.

📝 Configuration Examples

You can organize your configuration using either the servers or mcpServers root keys.

[!NOTE] LM Local Custom Extensions The following parameters are custom LM Local properties and are not part of the official MCP specification:

  • "disabled" (boolean): Temporarily deactivates an entire server process or HTTP connection without deleting its configuration block.
  • "permissions" (object): Used to mute specific tools discovered on the server.

Example 1: Public HTTP Server (with Tool Permissions)

{
  "mcpServers": {
    "microsoft-learn": {
      "type": "http",
      "url": "https://learn.microsoft.com/api/mcp",
      "permissions": {
        "microsoft_code_sample_search": "disable"
      }
    }
  }
}

Example 2: Demonstrates how to configure endpoints requiring a GitHub Personal Access Token (PAT).

{
  "servers": {
    "github-copilot": {
      "type": "http",
      "url": "https://api.githubcopilot.com/mcp/",
      "headers": {
        "Authorization": "Bearer ghp_your_personal_access_token_here"
      },
      "disabled": false
    }
  }
}

Example 3: Illustrates the required schema structure for connecting local executable-based MCP servers

{
  "servers": {
    "OmniToolBox": {
      "type": "stdio",
      "command": "C:\\MyMCP\\OmniToolBox.exe"
    }
  }
}
//or
{
  "mcpServers": {
    "OmniToolBox": {
      "type": "stdio",
      "command": "dotnet",
      "args": ["C:\\MyMCP\\bin\\Debug\\net10.0\\OmniToolBox.dll"]
    }
  }
}

🔗 Developer Resources

Model Context Protocol .NET SDK — Use this official Microsoft SDK to build and compile your own custom MCP servers compatible with LM Local. https://github.com/modelcontextprotocol/csharp-sdk

🔧 Troubleshooting

Issue Solution
No model shown Ensure a model is fully loaded in the LM Studio "Server" tab.
Connection Error Check if the LM Studio Server is ON at http://localhost:1234. Click ↻ to retry.
UI Lag Restart the tool window or check your local machine resources (CPU/GPU).
MCP server not detected Verify that MCP is enabled in MCP Extensions… dialog, check your JSON configuration syntax, and ensure the server process or URL is accessible.
Autocompletions not showing Make sure autocompletions are enabled in Autocompletions… dialog, and that you have selected a model that supports Fill‑in‑the‑Middle (FIM) – see the list of verified models in the Auto‑Completions section. Suggestions appear only at the end of a line, and not while the IntelliSense list or an IntelliCode/Copilot suggestion is already shown.
Built‑in tools not being invoked Check that Enable built‑in AI tools (read‑only) is ticked in Settings → Tools & Context (and Enable built‑in AI tools (write/modify) too, for tools that change files). Also verify that the specific tool is not disabled in the Built‑in Tools… dialog.
Explain banner does not appear on a stop Tick Explain debugger stops in Settings → Visual Studio and keep the LM Local window open while debugging (debug mode has its own window layout, so dock the window once while debugging). The banner appears only in Break Mode on a breakpoint or an exception, not on steps (F10/F11).
Response blocked by content filter Rephrase the request.
Response truncated - token limit reached Increase Context Length in LM Studio model settings or split the task into smaller parts.
image_url variant error ("unknown variant image_url, expected text") The loaded model does not support vision/multimodal inputs – it only accepts text messages. Do not include image attachments in your request. If you need image understanding, switch to a multimodal model (e.g., LLaVA, Qwen-VL, or any model with vision capabilities).

💾 Data & Configuration

LM Local keeps things simple and stores your preferences locally. Configuration files are maintained in:

%LOCALAPPDATA%\LMLocalChat\

The following configuration files are stored there:

File Purpose
settings.json Main extension settings (provider, model, UI, timeouts, history).
providers.json Saved provider profiles (see Providers).
models.config.json Model records & overrides (see Models Dialog).
recent-models.json Recently used models.
instructions.json AI Instructions presets (see AI Instructions & Modes).
tools.json Enabled/disabled state of built-in tools (Built‑in Tools… dialog).
autocompletions.json Auto-completion settings (see Auto-Completions).
subagents.json Subagent (worker agent) definitions and pipelines (agents[], pipelines[]).
mcp.json MCP server configuration.
ChatHistory\ Chat session logs (history dialog, session restore).
SubAgentsLogs\ Sub Agent session logs.
Usage\ Token usage records for the Usage & Stats dialog.
Snapshots\ Internal backups used by the Changes panel to revert edits.
WebViewData\ WebView2 browser data of the chat window.

📜 License & Compliance & Third-Party

  • License: MIT License. See LICENSE.txt for details.
  • Compliance: See COMPLIANCE.md for EU AI Act and data handling information.
  • Components:
    • marked v15.0.12 (MIT)
    • highlight.js v11.9.0 (BSD-3-Clause)
    • Acornima v1.7.0 (BSD-3-Clause)
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft