How truehot/lmlocal works
LM Local is a Visual Studio AI chat assistant: users send prompts and optional workspace context through the chat UI, receive streamed model responses, and can invoke guarded tools for code and workspace actions. The graph also retains documented provider/model setup, persistent chat, instructions, inline completions, MCP and sub-agent capabilities. Source excerpts establish several internal calls, but many UI wiring and domain integrations are documented only in the README; those links are marked dashed where unverified.
Main entry points: ChatSessionOrchestrator.cs Session orchestrator · app.controller.js App controller · ChatStreamService.cs Chat streaming · IToolRouter.cs Tool routing
Components 25
Chat interaction
- Chat interface
LMLocal/Resources/js/chat/chat.controller.js - Chat pipeline
LMLocal/Resources/js/chat/chat.pipeline.builder.js - App controller
LMLocal/Resources/js/app.controller.js - Workspace context
LMLocal/UI/ChatInjectionService.cs
Conversation runtime
- Session orchestrator
LMLocal/Application/ChatSession/ChatSessionOrchestrator.cs - Chat streaming
LMLocal/Application/ChatSessionStream/ChatStreamService.cs - Stream processing
LMLocal/Application/ChatSessionStream/StreamProcessor.cs - Chat history
LMLocal/Application/Chat/ChatHistoryManager.cs - Chat persistence
LMLocal/Infrastructure/Persistence/ChatPersistenceService.cs - Streaming UI
LMLocal/Resources/js/streaming/streaming.pipeline.js
Workspace actions
- Tool execution
LMLocal/Application/Tool/ToolExecutionManager.cs - Tool routing
LMLocal/Application/Abstractions/Ports/IToolRouter.cs - Visual Studio tools
LMLocal/Infrastructure/Tooling/BuiltInVs/BuiltInVsToolProvider.cs - Change snapshots
LMLocal/Infrastructure/Tooling/BuiltInVs/Snapshot/SnapshotManager.cs
Configuration and connectivity
- LLM providers
LMLocal/Infrastructure/LlmApi/Provider/ProviderResolver.cs - Model discovery
LMLocal/Application/ModelsList/ModelsListService.cs - Settings
LMLocal/Infrastructure/Settings/SettingsManager.cs - AI instructions
LMLocal/Infrastructure/Instructions/InstructionsManager.cs - Inline completions
LMLocal/Application/Autocompletions/AutocompletionsService.cs
Extensions
- Sub-agents
LMLocal/Application/SubAgents/SubAgentsService.cs - MCP tools
LMLocal/Infrastructure/Tooling/Mcp/McpToolManager.cs
Other components
- Developer
- MCP servers
- Local or cloud LLM
- Visual Studio
Connections 23
- Developer → Chat interface: sends prompt
- Chat interface → Chat pipeline: builds request
LMLocal/Resources/js/chat/chat.pipeline.builder.js - Chat pipeline → Session orchestrator: submits chat
- Workspace context → Session orchestrator: adds context
- Session orchestrator → Chat streaming: starts stream
- Chat streaming → LLM providers: requests completion
- LLM providers → Local or cloud LLM: calls API
- Chat streaming → Stream processing: processes chunks
- Stream processing → Streaming UI: forwards events
- Session orchestrator → Chat history: updates history
- Chat history → Chat persistence: saves sessions
LMLocal/Application/Chat/ChatHistoryManager.cs - App controller → Settings: configures app
- App controller → AI instructions: selects presets
- App controller → Model discovery: selects model
- Developer → Inline completions: requests suggestions
- Session orchestrator → Tool execution: executes tool calls
- Tool execution → Tool routing: routes execution
LMLocal/Application/Tool/ToolExecutionManager.cs - Tool routing → Visual Studio tools: dispatches tools
- Visual Studio tools → Visual Studio: inspects or edits
- Visual Studio tools → Change snapshots: tracks changes
- Session orchestrator → Sub-agents: delegates tasks
- Tool routing → MCP tools: routes MCP tools
- MCP tools → MCP servers: connects stdio or HTTP
LMLocal/Infrastructure/Tooling/Mcp/McpToolManager.cs