LMAgentChat is a VS Code extension for local and remote coding assistance. It provides a custom chat panel, optional native chat participant integration, provider-backed inline completions, workspace-aware context injection, and a small planner/executor agent loop.
- Multi-provider chat with LM Studio, Ollama, and OpenAI-compatible endpoints.
- Two chat surfaces:
- A custom webview chat panel and sidebar view.
- A native VS Code chat participant when the host build supports the chat API, with fallback to the custom panel.
- Chat modes in the custom panel: Ask, Plan, Build, and Agent.
- Inline code completions backed by the selected provider instead of placeholder suggestions.
- Workspace-aware prompt enrichment through mention tokens, attachments, diagnostics, and codebase retrieval.
- A separate
Run Agent Taskcommand that runs a planner/executor loop over structured actions. - LM Studio MCP integration passthrough through
lmagentchat.lmstudio.integrations.
- Open the custom chat panel with
LMAgentChat: Open Chat. - Focus the sidebar chat view with
LMAgentChat: Focus Sidebar Chat. - Open the settings webview with
LMAgentChat: Open Settings Page. - Use the chat composer to:
- upload file attachments,
- attach currently open editors,
- insert mention tokens from the context picker,
- stream responses with stop support,
- browse and rename chat sessions,
- export or clear the current session.
LMAgentChat: Open Native Chatopens VS Code native chat when available.- If native chat APIs are unavailable in the host build, the command falls back to the custom chat panel.
- The native chat participant supports
/explain,/fix,/test, and/docrequest styles.
- Inline completions are enabled by
lmagentchat.enableAutocomplete. - Requests are throttled, cached, and built from:
- current file context,
- visible editors and tabs,
- prefix and suffix code windows.
The custom chat input supports mention tokens. Tokens are resolved into prompt context and stripped from the user-facing request text before inference.
@currentFile: active editor content.@open: open files from visible editors and tabs.@open:N: open files with an explicit cap.@tree: workspace tree snapshot.@tree:query: narrowed tree context.@problems: diagnostics from the active file.@problems:workspace: diagnostics across the workspace.@terminal: active terminal metadata.@promptand@rules: prompt/rules-style files in the workspace.@codebase:query: ranked snippet retrieval from a lightweight local codebase index.
- Chat sessions are persisted under the extension global storage path.
- The current build uses JSON-backed storage for active persistence.
chat.storageBackendexposesjsonandsqlite, but SQLite is currently forced back to JSON at runtime.- Older chat messages can be archived and summarized based on these settings:
lmagentchat.chat.memoryBufferSizelmagentchat.chat.compactionThresholdlmagentchat.chat.enableAutoSummarize
There are two related agent surfaces:
Agentmode in the custom chat panel.LMAgentChat: Run Agent Task, which runs the standalone planner/executor loop.
The standalone loop can plan and execute structured actions such as:
read_filewrite_filesearchrun_commandrefactor_codesummarizeask_userdone
run_command is gated by lmagentchat.agent.allowRunCommands.
The extension contributes the following command groups.
Activate ExtensionOpen ChatOpen Native ChatFocus ChatFocus Sidebar ChatOpen Settings PageRun Agent Task
Refactor CodeExplain CodeSimplify CodeAdd Type AnnotationsOptimize ImportsAnalyze CodeFind BugsOptimize CodeSecurity AuditPerformance Review
Generate TestsGenerate Unit TestsGenerate Integration TestsGenerate E2E TestsGenerate MocksGenerate Mock DataGenerate FixturesRun TestsDebug TestCoverage ReportFix Failing Tests
Generate DocumentationGenerate READMEUpdate DocumentationGenerate ChangelogExport to MarkdownShow ContextUpdate ContextClear ContextExport ContextShow Git ContextAnalyze Recent CommitsBranch OverviewAnalyze Git Diff
Common settings:
{
"lmagentchat.provider": "lmstudio",
"lmagentchat.lmstudio.url": "http://localhost:1234",
"lmagentchat.lmstudio.apiKey": "",
"lmagentchat.lmstudio.integrations": [],
"lmagentchat.lmstudio.autoSelectModel": true,
"lmagentchat.lmstudio.currentModel": "",
"lmagentchat.ollama.url": "http://localhost:11434",
"lmagentchat.ollama.currentModel": "",
"lmagentchat.openai.url": "https://api.openai.com",
"lmagentchat.openai.apiKey": "",
"lmagentchat.openai.currentModel": "",
"lmagentchat.enableAutocomplete": true,
"lmagentchat.agent.maxSteps": 8,
"lmagentchat.agent.allowRunCommands": false,
"lmagentchat.agentMode.requireCompatibleModel": false,
"lmagentchat.chat.memoryBufferSize": 20,
"lmagentchat.chat.compactionThreshold": 40,
"lmagentchat.chat.enableAutoSummarize": true,
"lmagentchat.chat.maxRenderedMessages": 120,
"lmagentchat.chat.storageBackend": "json"
}lmagentchat.lmstudio.integrations is passed through to LM Studio chat requests as the integrations array.
Example values:
["mcp/playwright"][
{
"type": "ephemeral_mcp",
"server_label": "huggingface",
"server_url": "https://huggingface.co/mcp"
}
]The extension validates that this setting is a JSON array before saving it from the settings panel.
Install dependencies and compile:
npm install
npm run compileDuring development:
npm run watchRun tests:
npm test- The settings page is a custom webview and includes built-in setup and command documentation.
- The chat panel uses a windowed renderer for long conversations to avoid mounting the full DOM history.
- The floating scroll-to-bottom button appears when the conversation is no longer near the latest message.
MIT. See LICENSE.