DEV Community

Jovan Chan
Jovan Chan

Posted on • Originally published at aicoderscope.com

Cline + Ollama Setup Guide 2026: Private AI Coding Without Cloud APIs (VS Code)

This article was originally published on aicoderscope.com

Most "privacy-first AI coding setup" tutorials in 2026 quietly send your prompts through one cloud provider's relay to a different cloud provider's model and call it private. Cline + Ollama is the rare combination where the privacy claim is actually true: the VS Code extension is open-source under Apache 2.0, the inference is local, and the only data leaving your machine is whatever your shell and OS already touch. This guide gets you to a working setup, walks through the project-scoped .clinerules, and is honest about where the local model isn't enough yet.

Cline is an autonomous coding agent inside VS Code that reads your repo, edits files, runs commands, and (with your approval each step) drives a full development loop. The current release is v3.82.0 as of May 1, 2026. The model behind it can be anything OpenAI-compatible—Claude Sonnet from Anthropic, GPT-5 from OpenAI, or a local model served by Ollama or LM Studio. This article walks through the local-model variant specifically.

Why "Privacy-First" Is a Real Requirement, Not a Slogan

The use cases that drive this aren't hypothetical:

  • Client code under NDA. A freelance engineer working on a private codebase that legally can't be sent to OpenAI or Anthropic. Cloud AI is contractually out.
  • Internal company codebases with IP value. Some companies have explicit "no LLM with our code" policies. Cline + local LLM lets you keep the productivity boost without violating policy.
  • Pre-launch products. Code that contains unreleased features, pricing logic, or proprietary algorithms that you want zero record of outside your machine.
  • Personal experiments with sensitive content. Anything you don't want associated with your name in a vendor's training-data-eligible logs.

The shared feature: the data is what matters, not the cost. You'd happily pay $20/month for Cursor if your client allowed it. They don't. Local is the only option.

What Cline Actually Promises

Cline is open-source under Apache 2.0, which means you can audit exactly what it does. The relevant audit points:

  • Local storage of conversation history: chats, edits, and command outputs live in your VS Code workspace, not in a vendor cloud.
  • No telemetry on by default (verify against your Cline version; settings are inspectable).
  • Bring your own key (BYOK): nothing about Cline routes through a Cline-operated server. Your API calls go directly to whichever provider you configure—and if that provider is Ollama on localhost:11434, nothing leaves your machine.
  • Inspectable agent loop: every tool call (file read, file edit, shell command) is shown to you for approval before it runs. You see what the model wants to do before the model gets to do it.

These properties don't automatically make every Cline setup private—they make a correctly configured Cline setup private. The configuration is what we'll cover.

Step 0: Hardware Floor

The local-LLM piece is bounded by hardware. Approximate fits:

RAM / VRAM Practical model Use case fit
16 GB RAM (CPU only) Qwen 2.5 Coder 7B (Q4) Demos, learning Cline, no real work
8 GB VRAM (RTX 4060) Qwen 2.5 Coder 7B (Q4) Light edits, simple refactors
12 GB VRAM (RTX 3060 12GB) Qwen 2.5 Coder 14B (Q4) Real daily-driver tier
16 GB VRAM (RTX 4060 Ti 16GB) Qwen 2.5 Coder 14B (Q5) or 32B (Q3) with offload Solid local agent
24 GB VRAM (RTX 3090, RTX 4090) Qwen 2.5 Coder 32B (Q4) Best practical local tier
32 GB+ VRAM (RTX 5090, dual cards) Qwen 2.5 Coder 32B (Q5+) or larger Approaching cloud-tier capability

Don't bother with 7B on Cline for real work. Cline's agent loop—reading files, calling tools, making multi-step plans—needs a model that can hold larger context coherently. 7B coder models work for single-file edits and break down on anything more complex. The practical floor is 14B; the sweet spot is 32B if your hardware can host it.

For a more detailed breakdown of which model fits where, our sister site's Best Local AI Models by VRAM tier guide covers the full landscape. For the hardware purchase decision specifically tied to AI coding, our Cursor + Local Llama hardware tier guide walks through what each price tier actually delivers.

Step 1: Install Ollama and the Coder Model

If you've followed our Aider + Ollama setup guide, skip ahead. Otherwise:

# Linux
curl -fsSL https://ollama.com/install.sh | sh
# macOS/Windows: installer from ollama.com
Enter fullscreen mode Exit fullscreen mode

Pull the model:

ollama pull qwen2.5-coder:14b   # 9 GB, works on 12-16GB VRAM
# or
ollama pull qwen2.5-coder:32b   # 20 GB, RTX 4090+ tier
Enter fullscreen mode Exit fullscreen mode

Set a sane context window

Critically—this is the trap that breaks 80% of setups—Ollama defaults to a 2,048-token context window and silently discards anything beyond that. For Cline, which loads multiple files and command outputs into context, this is fatal. The truncation is invisible: Cline thinks the model has full context; the model is operating on a tiny fragment.

Fix it. Stop Ollama:

sudo systemctl stop ollama   # systemd-based Linux
# or just pkill ollama on other systems
Enter fullscreen mode Exit fullscreen mode

Set context length and restart:

OLLAMA_CONTEXT_LENGTH=32768 ollama serve
Enter fullscreen mode Exit fullscreen mode

For persistence (Linux/systemd), drop in /etc/systemd/system/ollama.service.d/override.conf:

[Service]
Environment="OLLAMA_CONTEXT_LENGTH=32768"
Enter fullscreen mode Exit fullscreen mode

Then sudo systemctl daemon-reload && sudo systemctl restart ollama. 32k is a reasonable working ceiling for Cline—agent workflows benefit from more context than chat completions.

Step 2: Install Cline

In VS Code: Extensions panel → search "Cline" → Install. Or from the marketplace URL directly. Reload VS Code.

You'll see a new sidebar icon. Click it. The first-run wizard asks you to pick an API provider.

Step 3: Configure Cline for Local Ollama

In the Cline sidebar, click the settings icon (gear). Configuration:

Field Value
API Provider Ollama
Base URL http://localhost:11434/ (default; usually no change)
Model Pick from auto-populated dropdown: qwen2.5-coder:14b or :32b

Save. Cline is now wired to your local model. Verify by typing a simple prompt: "List the files in the current directory." Cline should respond, ask for approval to run ls, and produce output.

Enable compact prompts

Cline has a setting called "compact prompts" that reduces the prompt overhead by ~90% while keeping core functionality. For local models, this is essentially required—the verbose default prompt eats most of your context window before your actual code even gets loaded. Enable it in Settings → Advanced → Compact Prompts.

This isn't free—you lose some of Cline's longer system-prompt behaviors—but for local models with limited context budgets, the tradeoff is heavily in favor of enabling it.

Step 4: Set Up .clinerules for Project Scope

Cline supports a .clinerules directory at the project root for project-scoped instructions, parallel to Cursor's .cursor/rules/ system covered in our Building Your First Cursor Custom Workflow guide.

Create:

mkdir -p .clinerules
Enter fullscreen mode Exit fullscreen mode

Drop a project-scoped rules file at .clinerules/coding-conventions.md:


md
# Project conventions

- TypeScript strict mode; no `any` types
- React server components by default; mark clie
Enter fullscreen mode Exit fullscreen mode

Top comments (0)