Local Agent Extension
Fully local AI coding assistant for VS Code. Plan tasks, generate patches, run commands—all on your machine with Ollama. No cloud, no API keys, no per-token costs. Cursor-like local AI agent with ollama in vs code.
What Is Local Agent?
Local Agent is a privacy-first AI coding assistant that runs entirely on your machine. It helps you add features, fix bugs, refactor code, and answer questions about your codebase—without sending code to external servers.
Search terms: local AI, Ollama, coding assistant, patch-based editing, task planning, offline coding, privacy-first development, open-source LLM, DeepSeek, Qwen, Llama, Cursor alternative, Copilot alternative.
Why Use Local Agent?
| Need |
Local Agent |
| Privacy |
All processing runs locally via Ollama. No code leaves your machine. |
| Cost |
No per-token fees. Use open models (DeepSeek, Qwen, Llama, etc.). |
| Offline |
Works without internet after models are pulled. |
| IDE integration |
Native VS Code: chat, task graph, patch history, rollback, diagnostics. |
What You Can Do
| Action |
How |
| Add features |
Describe the feature; use "Add feature" template or Agent mode |
| Fix bugs |
Describe the bug; use "Fix bug" template |
| Refactor |
Describe what to refactor; use "Refactor" template |
| Ask questions |
Chat mode – Q&A about your codebase (read-only) |
| Edit selected code |
Select code → Right-click → Edit Selection |
| Fix lint/type errors |
Right-click error → Fix with Local Agent |
| Plan before running |
Planning mode → review plan → Execute Plan |
| Deep investigation |
Deep planning mode – planner can request file reads |
| Rollback patches |
Rollback command or /rollback |
| Multi-folder workspaces |
Index and patch across all workspace roots |
Keyboard Shortcuts
| Shortcut |
Action |
| Ctrl+Shift+L (Mac: Cmd+Shift+L) |
Open Local Agent Chat |
In chat: Type /plan, /execute, /rollback, or /chat for quick mode switches.
All commands: Ctrl+Shift+P (Command Palette) → type Local Agent.
Features
Core
- Task planning – Break requests into dependency-aware tasks (Agent, Planning, Deep planning, Chat modes)
- Patch-based editing – Unified diff generation with flexible apply (strict → content-search → sub-hunk)
- Command execution – Run lint/test/build with approval; stream output to chat
- Reviewer – Auto lint/test/typecheck after each task; surface issues in Problems view
Safety & Control
- Checkpoints – Auto-save before apply; rollback with one click
- Patch history – View, re-apply, or partially apply past patches
- Conflict resolution – Inline merge UI for conflicted hunks
- Approval flow – Approve patches and commands before execution
Context & Memory
- File mentions –
@path and @folder/ in prompts
- Project rules –
.localagent/rules.md for conventions and architecture
- Recent files – Auto-include recently edited files in context
- File content in coder – Target file content included when generating patches (configurable)
Workflow
- Inline edit – Select code → right-click → Edit Selection
- Fix diagnostics – Right-click lint/type errors → Fix with Local Agent
- Chat from editor – Open chat with current file pre-mentioned
- Slash commands –
/plan /execute /rollback /chat
- Plan templates – Add feature, Fix bug, Refactor presets
- Follow-up – Continue from last assistant output
Optional
- Tool use – Deep planning can request file reads
- Semantic search – Embedding-based file relevance (Ollama
nomic-embed-text)
- Aider/Cline bridges – Route patches or commands through external CLIs
- Opt-in telemetry – Anonymous event counts to prioritize improvements
- Localization – German and Spanish (de, es)
Supported Languages
TypeScript, JavaScript, Python, Go, Rust, Java, Kotlin, C#, C++, C, Ruby, PHP, Swift, Scala, Lua, R, SQL, Vue, Svelte, and shell. Symbol extraction and indexing for context-aware planning.
Prerequisites
- VS Code 1.95+
- Ollama installed and running (ollama.ai)
Setup Ollama
- Download from ollama.ai
- Start:
ollama serve (or run the app)
- Pull models:
ollama pull deepseek-coder-v2 and ollama pull qwen2.5-coder
Quick Start
- Install the extension from the marketplace
- Open a project folder (File → Open Folder)
- Press Ctrl+Shift+L (Mac: Cmd+Shift+L) to open Local Agent Chat
- Select a mode (Agent, Planning, Chat, etc.), enter your task, and click Send
Commands
| Command |
Shortcut |
Description |
Local Agent: Open Chat |
Ctrl+Shift+L (Mac: Cmd+Shift+L) |
Open chat with mode selector and endpoint picker |
Local Agent: Start Task |
— |
Prompt for a task and run the agent |
Local Agent: Execute Plan |
— |
Execute the saved plan (after planning) |
Local Agent: Load Plan from File |
— |
Parse and run implementation_plan.md |
Local Agent: Rollback Last Apply |
— |
Restore files from last checkpoint |
Local Agent: Open Project Rules |
— |
Create/edit .localagent/rules.md |
Local Agent: Open User Guide |
— |
Open step-by-step user guide |
Local Agent: Open Extension Guide |
— |
Open limitations, flow & roadmap |
Local Agent: Usage Report |
— |
View anonymous usage stats (when telemetry enabled) |
Configuration
| Setting |
Default |
Description |
localAgent.ollamaBaseUrl |
http://127.0.0.1:11434 |
Ollama server URL |
localAgent.plannerModel |
deepseek-coder-v2 |
Model for task planning |
localAgent.coderModel |
qwen2.5-coder |
Model for diff generation |
localAgent.enableReviewer |
true |
Run lint/test after each task |
localAgent.reviewCommands |
[] |
Custom commands (overrides auto-detect) |
localAgent.enableTools |
true |
Tool use in deep planning (file reads) |
localAgent.maxFileContentChars |
8000 |
File content in coder prompt (0 = off) |
localAgent.enableTelemetry |
false |
Opt-in anonymous usage stats |
localAgent.autoCheckpointBeforeApply |
true |
Create checkpoint before patches |
Chat Modes
| Mode |
Description |
| Agent |
Full run: plan → execute tasks |
| Planning |
Plan only; saves implementation_plan.md; use Execute Plan to run |
| Deep planning |
Extended investigation; optional clarifying questions; can request file reads |
| Chat |
Q&A about your codebase; no patches or commands; read-only |
File Mentions
Use @path in your prompt to focus context:
@src/auth.ts – Single file
@src/components/ – All files under directory
Troubleshooting
| Issue |
Quick fix |
| Ollama not reachable |
Run ollama serve; check localAgent.ollamaBaseUrl |
| No workspace |
Open a folder (File → Open Folder) |
| Model not found |
ollama pull <model-name> |
| Patch conflicts |
Patch History → Apply Partial Patch or Resolve Conflicts |
| Reviewer not running |
Add lint/test/build to package.json or set reviewCommands |
Debug: View → Output → Local Agent for logs and errors.
Documentation
| Command |
Contents |
| Local Agent: Open User Guide |
Step-by-step guide: modes, templates, slash commands, settings, troubleshooting |
| Local Agent: Open Extension Guide |
Limitations, quick fixes, flow & context, roadmap |
Run Ctrl+Shift+P → type Local Agent → choose Open User Guide or Open Extension Guide.
Architecture
- Agent Controller – Orchestrates planner → coder → patch apply → commands → reviewer
- Planner – Dependency-aware task graphs
- Coder – Unified diff patches (high-level hunks)
- Patch Applier – Flexible apply with sub-hunk splitting, context variation
- Context Builder – Keyword + optional embedding-based semantic search
- Aider/Cline adapters – Optional bridges to external CLIs
Cursor-like Workflow
Local Agent offers a Cursor-like experience for developers who prefer fully local AI:
- Plan → code → apply → review – Same workflow: describe a task, get a plan, apply patches, run reviewer
- File mentions – Use
@path and @folder/ in prompts to focus context
- Project rules –
.localagent/rules.md for conventions and architecture (memory bank)
- Checkpoints & rollback – Auto-save before apply; one-click rollback
- Chat modes – Agent, Planning, Deep planning, Chat (read-only Q&A)
- Inline edit – Select code → right-click → Edit Selection
- Slash commands –
/plan, /execute, /rollback, /chat
Difference: Local Agent runs 100% on your machine with Ollama. No cloud, no API keys, no data sent externally.
License
MIT
| |