🤖 LM LocalLM 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.
📸 Screenshots
📖 Table of Contents
⚡ Core Features
🛠 RequirementsTo use LM Local, you need:
🚀 InstallationOption 1: Visual Studio Marketplace (Recommended)
Option 2: Manual VSIX
🏁 Getting StartedPart 1. Initial Setup (One-Time Configuration)
Part 2. How to Use the Chat
💡 Interface & Interaction Tips
✨ All featuresInterface & User Experience
Context & Solution Awareness
Efficiency & Token Management
Infrastructure & Settings
⚙️ ProvidersThe "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).
Once configured, you can seamlessly switch between your saved profiles via the main settings.
Quick exampleHow to configure a custom remote endpoint and activate it inside the extension. Step 1: Create the Provider Profile
Step 2: Switch to the New Provider
Step 3: Select Your Model
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)
Free, with limited availability
💳 Pay to Try (Commercial / Premium)
🗂️ ModelsThe Models dialog (menu
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 ( 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 ToolsThe 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 controlIn Settings → Tools & Context (two checkboxes):
In the Built‑in Tools… dialog (list of built‑in tools): Open edited files in editorSettings > 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.
List of built‑in tools
Changes panel – see what was changed and revert if neededWhen 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:
Review modes (Settings → Visual Studio →
In the review window:
🤖 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:
Side benefits:
Subagents Setup & Configuration
Option 1: Quick Start (Default Local Setup)Out of the box, subagents use
Option 2: Using a Custom Provider or ModelTo bind subagents to a different provider (e.g., cloud API, custom endpoint) or another model:
Predefined SubagentsOut of the box, LMLocal includes these predefined subagents, all enabled by default except the Architect:
Typical order: explorer / context retriever gather evidence → architect (when enabled and an architectural decision is needed) → edits → build & test → reviewer → review skeptic.
Troubleshooting (
|
| 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.jsonhas nopipelines[]. A sample configuration ships assubagents-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. PlanmaxTokensand 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[]andexposedstill 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 insubagents.jsononly; 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,customApiKeyonly 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 insubagents.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 asenabled. - Partial update – when the dialog was opened from an existing custom file (flags toggled, or Use Active Model over existing agents): only the
enabledflags 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).
- 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 (
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:
- 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.
- 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:
- Click the menu icon (
…) and select "AI Instructions...". - Select a target mode/role from the left panel (e.g.,
RevieworBugfix). - 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
Testsmode 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.1or0.2) for rigid, deterministic tasks like bug fixing, and closer to1for 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
0to function properly without breaking formatting or structure. - 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
.jsonllog 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."
- To refine:
💰 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_MGGUF 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-e4balongside its dedicated draftergemma-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.0or0.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
- Open Settings..., go to the Visual Studio tab and tick
Explain debugger stops(off by default), then click Save. - 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.
- When the debugger stops on a breakpoint or an exception, the banner appears, for example
Breakpoint hit · OrderService.cs:42orException thrown · OrderService.cs:42. - 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_keyorconnectionstringare 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-25specification 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:
- Open the LM Local tool window.
- Click the menu icon (
…) in the top-right corner. - Select "MCP Extensions..." from the dropdown menu.
- 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:
markedv15.0.12 (MIT)highlight.jsv11.9.0 (BSD-3-Clause)Acornimav1.7.0 (BSD-3-Clause)