AI code editors you can run fully local: Cline, OpenCode & friends
Choosing a local code model is only half the story. The model is the engine; you still need a cockpit — the editor or agent that reads your files, proposes changes and applies them. The good news: you don't have to hand that role to a cloud product. A whole ecosystem of tools now plugs straight into a local Ollama server, so your code, your prompts and your context never leave your machine.
This guide walks through the best of them, with a concrete setup for each. They fall into three groups: IDE extensions, terminal agents and a hybrid category for the one surprising case — running Anthropic's Claude Code against a local model.
Everything below assumes you already have Ollama installed and a code-capable model pulled.
The IDE route: VS Code extensions
If you live in VS Code, you don't switch editors — you add an extension that talks to Ollama.
Cline — the agentic all-rounder
Cline is the most complete local-first option. It's an agentic extension: it doesn't just autocomplete, it plans a change across multiple files, edits them, runs commands and iterates — all driven by your local model. It supports Ollama natively, works in both VS Code and JetBrains and speaks MCP, so you can give it tools and live data access.
Setup:
- Install Cline from the VS Code marketplace.
- Open Cline's settings, choose Ollama as the API provider.
- Point it at
http://localhost:11434and select a pulled model (a capable one — agentic editing needs a model that follows tool-use instructions well).
The number one reason Cline fails locally isn't the model, it's the context window left at its default: an autonomous agent saturates it within a few tool calls, then silently loops or fails. Raise it to 16k minimum (see the OpenCode callout below for how) before drawing any conclusion about your model.
That said, task ambition genuinely matters here. A 7-14B model is enough for targeted edits and light refactors; real multi-file autonomy calls for something in the 22-30B range, with the VRAM to match. See our model-choosing guide.
Twinny — fast inline autocomplete
Where Cline is a heavyweight agent, Twinny does the other job well: real-time inline completion as you type — the ghost-text tab-completion people associate with Copilot. It's a VS Code extension tuned specifically for Ollama.
Setup:
- Install Twinny from the marketplace.
- Point it at your local Ollama instance.
- Pick a fast, small FIM-capable model for autocomplete (latency matters here — a 7B code model is a good balance).
Twinny and Cline coexist happily: Twinny for instant completions, Cline for "refactor this whole module" tasks.
A note on Continue
Continue was for years the go-to open-source assistant for local models. Be aware that it was acquired by Cursor in June 2026 and v2.0 is its final independent release. It still works with Ollama today, but its future is uncertain — which is exactly why we'd steer new setups toward Cline.
The terminal route: OpenCode
Not everyone wants to work inside an editor. OpenCode is an open-source coding agent that lives in your terminal: it reads your project, plans changes, edits files and runs commands — the same agentic loop as Cline, but at the command line. Paired with Ollama, nothing leaves your machine: no cloud, no telemetry, no usage limits.
Setup — the easy way:
ollama launch opencode
That single command (shipped by Ollama) starts OpenCode wired to your local Ollama server.
Setup — manual:
Configure Ollama as a provider in opencode.json, with the base URL pointing at http://localhost:11434/v1 and your chosen model.
Before blaming your model, check your context window. Ollama doesn't give a model the window it can handle: it applies a cautious default derived from your VRAM, which very often lands on 4,096 tokens. On our machine (Ollama 0.30, on a GPU with room to spare), a Qwen 3 advertising 40,960 tokens runs with 4,096 in practice: a 10× cut, with no warning whatsoever. This is the number one cause of failing tool calls and agents losing the thread and it has nothing to do with model size.
Check what's actually allocated with ollama ps (CONTEXT column) and raise it globally with OLLAMA_CONTEXT_LENGTH=32768. Budget 16k as a hard floor for agentic work, 32k or more to be comfortable — Ollama's own docs recommend 64k for OpenCode. It isn't free, though: the window is allocated in memory and a context too large for your VRAM spills the model onto the CPU — and it crawls.
See it for yourself: ollama show qwen3 advertises a 40,960-token capacity, yet ollama ps reports 4,096 in the CONTEXT column once the model is loaded — ten times less. Restart with OLLAMA_CONTEXT_LENGTH=32768 and that same column finally reads 32,768.
Then watch the SIZE column: on that same model, going from 4k to 32k pushed the footprint from 5.6 GB to 9.8 GB. That's why the cap exists — raise it deliberately rather than to the maximum. The gap is starker still on long-context models: a Gemma advertising 262,144 tokens also starts at 4,096, sixty-four times below its capacity.
That budget also fills faster than you'd think: the agent stacks up history, the files it reads and the definition of every tool available to it. On setups loaded with MCP servers, those definitions alone can occupy 30–50% of the context before the first line of code. Only wire in the tools the task actually needs.
As for model size, it affects per-step reliability, not whether it works at all. A 7-8B model handles a targeted edit in a well-scoped project just fine; what breaks it is the vague task chaining ten tool calls unsupervised, where a drift at step three costs you at step nine. One requirement is non-negotiable, though: the model must be trained for tool calling and emit valid JSON, or the agent will hallucinate its file edits. Start with the model you have — the nature of the task, not a threshold in billions of parameters, will tell you whether to size up.
The hybrid route: Claude Code on a local model
Here's the case that surprises people. Claude Code is Anthropic's terminal agent — a proprietary tool, normally pointed at Anthropic's cloud. But since Ollama v0.14, Ollama speaks the Anthropic Messages API. That means you can keep Claude Code's excellent agentic UX while swapping the brain for an open-source model running locally.
Setup:
export ANTHROPIC_AUTH_TOKEN=ollama
export ANTHROPIC_API_KEY=""
export ANTHROPIC_BASE_URL=http://localhost:11434
claude --model qwen3.5
Replace qwen3.5 with any local model you've pulled. With ANTHROPIC_BASE_URL pointed at Ollama, Claude Code sends its requests to your machine instead of Anthropic's servers — your code stays home.
This is a genuine hybrid: the model and your code are local, but the tool itself is proprietary. That's a different trade-off from Cline or OpenCode, which are open source end to end. If your priority is the polished Claude Code workflow and you're fine with a closed-source client, this is a great option. If you want a fully open stack, stick to the tools above. Note too that Claude Code juggles several model "slots" internally — pointing it at a single local model can trip its background-task slots, so expect some rough edges.
And Claude Desktop?
For completeness: Claude Desktop is Anthropic's chat app and it supports MCP for connecting tools — but its inference runs in Anthropic's cloud. There's no local-model swap the way Claude Code allows. It's a fine app; it's just not a local-AI tool, so it sits outside the sovereign setup this site is about.
Which one should you pick?
| Tool | Type | Runs on Ollama | Open source | Best for |
|---|---|---|---|---|
| Cline | VS Code / JetBrains extension | ✅ native | ✅ | Agentic multi-file editing with MCP |
| Twinny | VS Code extension | ✅ native | ✅ | Fast inline autocomplete |
| OpenCode | Terminal agent | ✅ (ollama launch opencode) |
✅ | Agentic coding at the command line |
| Claude Code | Terminal agent | ✅ (via ANTHROPIC_BASE_URL) |
❌ proprietary client | Polished UX, willing to use a closed tool |
| Claude Desktop | Chat app | ❌ cloud inference | ❌ | Not a local tool |
A sensible starting point for most people: Cline in VS Code for agentic work, Twinny for autocomplete — both fully open, both on your own model. Reach for OpenCode if you prefer the terminal and try the Claude Code trick only if you specifically want that workflow and accept the closed client.