This guide is based on Cline's official README and local-models documentation, and Ollama's Cline integration and context-length pages, all read on 25 November 2026.
Cline is an open-source AI coding agent. Unlike a simple autocomplete tool, it works on a whole task: it reads your project, proposes a plan, edits files, runs terminal commands and reacts to compiler and linter errors. It runs as a VS Code extension, a JetBrains plugin, a command-line tool and a desktop app for Windows and macOS. It isn't tied to one AI company: you can point it at cloud providers such as Anthropic, OpenAI or Google, or at a model running on your own PC through Ollama or LM Studio.
Running the model locally means your source code and prompts don't leave your machine, and there's no per-token bill. The trade-off is that a local model is usually smaller and slower than the big cloud models, so how well Cline works depends on the model you choose and the memory you have.
If you're comparing tools, our best local AI coding assistants round-up puts Cline alongside Continue, Aider and OpenCode.
What you need
VS Code, a JetBrains IDE (IntelliJ IDEA, PyCharm, WebStorm, GoLand and so on), or Node.js if you want the command-line version.
Ollama or LM Studio installed and working. Our guide to running AI models locally with Ollama and LM Studio covers both.
Enough memory for a coding model. Cline's documentation gives this rough guide:
System RAM | Typical local setup |
|---|
16-32GB | Small or quantised models |
32-64GB | Mid-size coding models |
64GB+ | Larger models and bigger context windows |
Treat this as a starting point. If the model fits in your graphics card's VRAM it will respond far faster than if it spills into system RAM. Our explainer on LLM context length and VRAM shows why longer conversations need more memory.
Step 1: Install Cline
Cline's README lists four ways to get it:
VS Code: search for Cline in the Extensions view, or install it from the Visual Studio Marketplace (the extension ID is saoudrizwan.claude-dev).
JetBrains: install the Cline plugin from the JetBrains Marketplace.
Command line: run npm i -g cline to install the CLI, which has an interactive chat mode and a headless mode for scripts.
Desktop app: download it for Windows or macOS from cline.bot/desktop. It can run agent sessions in any folder.
The rest of this guide uses the VS Code extension, but the provider settings are the same idea everywhere.
Step 2: Download a model in Ollama
Pick a model from the Ollama library (ollama.com/search). It's wise to choose one that supports tool calling (Ollama's Cline page asks for this when you use its cloud models), because Cline works by having the model call tools that read files, write files and run commands. Coding-focused models are the obvious choice. Download it with:
ollama pull <model-name>
Then make sure Ollama is running. On Windows the Ollama app runs in the background; from a terminal, ollama serve starts the server. By default Ollama listens on http://localhost:11434.
If you'd rather use LM Studio, download a model from its Discover tab, open the Developer tab and start the server. LM Studio's default address is http://localhost:1234.
Step 3: Give the model a bigger context window
This is the step most people miss. Cline sends a long system prompt plus the contents of the files it's working on, so it needs a large context window (the amount of text the model can hold at once).
Ollama's documentation says its default context depends on your VRAM: 4K tokens on GPUs with less than 24GiB, 32K tokens with 24-48GiB, and 256K with 48GiB or more. That 4K default is far too small for a coding agent. Ollama's Cline page recommends at least 32K tokens for coding, and its context-length page says agents and coding tools should be set to at least 64,000 tokens.
You can raise it in two places:
In the Ollama app: open settings and move the context length slider.
When starting the server: run OLLAMA_CONTEXT_LENGTH=64000 ollama serve (the example from Ollama's docs; on Windows, set OLLAMA_CONTEXT_LENGTH as an environment variable instead).
A bigger context uses more memory, so if the model no longer fits on your GPU, drop to a smaller model or a lower context. Ollama's docs suggest running ollama ps to check how much context was allocated and whether the model is being offloaded to the CPU.
Step 4: Connect Cline to Ollama
Open the Cline panel in VS Code and go to its Settings (API configuration).
Set API Provider to Ollama.
Leave the base URL as http://localhost:11434 unless you changed Ollama's port or run it on another PC.
Choose your model from the Model dropdown, or type its name.
Set the Context Window field to match what you configured in Ollama (at least 32K).
For LM Studio, choose LM Studio as the provider, keep http://localhost:1234 and pick the loaded model.
Step 5: Turn on Use Compact Prompt
Cline's local-models guide recommends enabling Use Compact Prompt under Settings > Features. Cline recommends it for local inference, and a shorter prompt leaves more of a small model's context window for your actual code. Cline also suggests keeping tasks focused and starting a new task when the context gets large.
Step 6: Use Plan and Act mode
Cline has two modes:
Plan mode: Cline explores your project, asks clarifying questions and sets out a strategy without changing anything.
Act mode: Cline carries out the plan, editing files and running commands.
By default every file edit and terminal command needs your approval, and in VS Code and JetBrains each edit appears as a diff you can review or reject. Cline also keeps checkpoints, so you can undo its changes. You can switch on auto-approve, but with a local model it's sensible to keep approvals on until you trust how it behaves, especially for terminal commands.
A good first task is something small and self-contained: "add input validation to this function and write a unit test for it" will tell you far more about your model than "refactor the whole app".
Step 7: Add project rules
You can put project-specific instructions in a .clinerules file: coding standards, folder conventions, how to run the tests, and things Cline should never touch. The CLI, VS Code extension and JetBrains plugin pick these up automatically. Short, clear rules are especially useful with local models, which are more likely than big cloud models to drift from your conventions.
Cline can also use MCP servers for extra tools, the same standard covered in our guide to MCP servers in LM Studio.
Troubleshooting
"Connection failed" or no models listed: make sure Ollama (or LM Studio's server) is running, and check the base URL. If a model is missing, run ollama pull again.
Cline loops, forgets files or stops halfway: the context window is probably too small. Raise it in Ollama and in Cline, or start a fresh task.
The model ignores tools or replies with plain text instead of editing files: pick a model that supports tool calling; very small general chat models often struggle with agent work.
Very slow responses: the model or its context may be spilling out of VRAM into system RAM. Check with ollama ps and try a smaller model or shorter context.
Our verdict
Cline is one of the most capable free ways to use a local model as a real coding agent rather than just an autocomplete. Install the extension, pull a coding model with tool-calling support in Ollama, raise Ollama's context window to at least 32K (64K is better), select Ollama in Cline's settings and turn on Use Compact Prompt. Keep approvals on and give it small, focused tasks. If you want lighter-weight suggestions as you type, Continue is the gentler option, and Aider suits people who live in the terminal.