Torna alle skill
local-ollama-qwen-cline-vscode
di amr-ba
Cline—Non ancora valutato
La tua valutazione
Sintesi
A Windows Git Bash guide for a local VS Code coding agent using Ollama, Qwen2.5-Coder and Cline.
Descrizione
# Build a Local AI Coding Agent in VS Code with Ollama, Qwen, and Cline
Run a private coding assistant locally in VS Code using **Ollama**, **Qwen**, and **Cline**. This guide targets Windows users running commands from **Git Bash**.
The setup provides a supervised coding agent that can inspect the VS Code workspace, search files, propose changes, edit files, and run commands after approval.
```text
VS Code workspace
│
▼
Cline extension
│ file search, file reads, edits, terminal commands with approval
▼
Ollama local server
│
▼
Qwen model running locally
```
## What this setup provides
- Local model inference through Ollama.
- Workspace-aware coding tasks through Cline.
- File reads, workspace search, multi-file edits, and terminal tools with explicit approval.
- A Git-based workflow for reviewing and reverting changes.
- No model API key or subscription required for local inference.
## Hardware and model guidance
The right model depends on available system RAM, GPU VRAM, model quantization, and the context length used. The following ranges are practical starting points rather than strict requirements.
| Hardware tier | Recommended model | Expected experience |
| --- | --- | --- |
| 8–12 GB RAM, integrated GPU or 4 GB VRAM | `qwen2.5-coder:1.5b` | Fast lightweight coding help; limited planning and agent reliability |
| 16 GB RAM, 4–6 GB VRAM | `qwen2.5-coder:7b` | Good coding chat and focused multi-file tasks; CPU/RAM offload expected |
| 32 GB RAM, 8–12 GB VRAM | Qwen2.5-Coder 7B–14B | Better codebase reasoning and more reliable agent tasks |
| 32 GB RAM, 16 GB VRAM | `qwen3.6:35b-a3b` with a low quantization / reduced context | Advanced local agent tasks; system-RAM offload may be required |
| 48–64 GB RAM, 24 GB VRAM | `qwen3.6:35b-a3b` at a practical coding quantization | Strong local coding, longer context, and substantially better repository work |
| 64 GB+ RAM, 32 GB+ VRAM | `qwen3.6:35b-a3b` with larger context or higher quality quantization | Best single-GPU local experience for this model |
### Recommended starting models
For a laptop with **16 GB RAM and a 4 GB GPU**, start with:
```text
qwen2.5-coder:7b
```
This code-focused model is practical on mid-range hardware. A 4 GB GPU cannot contain the complete model, so Ollama uses a combination of GPU VRAM and system RAM. This is normal.
For a workstation with **at least 32 GB RAM and a 16 GB GPU**, consider:
```text
qwen3.6:35b-a3b
```
Qwen3.6-35B-A3B is a Mixture-of-Experts model with roughly 35B total parameters and about 3B active parameters per token. It offers significantly stronger planning, agentic coding, and repository reasoning than a small 7B model, but its model weights and context cache still require substantially more memory. A 16 GB GPU can run a constrained/offloaded setup; 24 GB VRAM and 48–64 GB system RAM provide a much more comfortable configuration. [web:272][web:274][web:279][web:280]
Example pull command when the Qwen3.6 tag is available in Ollama:
```bash
ollama.exe pull qwen3.6:35b-a3b
```
Check the exact tag and download size in the Ollama model library before downloading. A Q4-style Qwen3.6-35B-A3B quantization can require roughly 19–22 GB for weights plus extra memory for runtime and context. [web:271][web:279][web:280]
Optional lightweight model:
```text
qwen2.5-coder:1.5b
```
Use it for short questions, simple edits, or a separate autocomplete workflow.
## Why these tools
| Tool | Purpose |
| --- | --- |
| **Ollama** | Downloads, manages, and serves local language models through a local API |
| **Qwen2.5-Coder / Qwen3.6** | Open models for coding explanations, reviews, edits, planning, and code generation |
| **Cline** | VS Code agent interface with workspace access and action approvals |
| **Git** | Creates checkpoints, reviews diffs, and makes agent changes reversible |
Cline is the workspace-aware agent layer. It lets the model inspect the folder opened in VS Code and request permission to use tools. Continue can be used for chat and autocomplete, but Cline is the better choice for supervised file search, multi-file changes, and terminal tasks.
## Prerequisites
Install the following:
- [Git for Windows](https://git-scm.com/downloads/win), including Git Bash.
- [Visual Studio Code](https://code.visualstudio.com/).
- A current NVIDIA graphics driver, if using an NVIDIA GPU.
- A GitHub account, optional but recommended for backups and collaboration.
Open Git Bash and check Git:
```bash
git --version
```
Check the VS Code shell command:
```bash
code --version
```
If `code` is not found, VS Code can still be opened from the Start menu and projects can be opened with **File → Open Folder**.
## 1. Install Ollama
Open Git Bash and run:
```bash
winget.exe install --id Ollama.Ollama -e
```
After installation:
1. Close all Git Bash windows.
2. Open a new Git Bash window.
3. Verify the installation:
```bash
ollama.exe --version
```
Ollama normally starts in the background on Windows. Its local API runs at:
```text
http://127.0.0.1:11434
```
Check the API:
```bash
curl http://127.0.0.1:11434/api/tags
```
A JSON response confirms that the local Ollama service is available.
## 2. Add tools to the Windows PATH
Windows programs must be available through the `PATH` environment variable for commands such as `ollama.exe`, `git`, and `code` to work in a newly opened Git Bash terminal.
Git for Windows usually adds Git Bash and Git automatically. The Ollama and VS Code installers may add their command directories automatically, but verify this before continuing.
### Check command availability
Open a **new Git Bash window** and run:
```bash
which git
which ollama.exe
which code
git --version
ollama.exe --version
code --version
```
A command is correctly available if `which` prints a path and the version command succeeds.
### Add Ollama to PATH manually
If `ollama.exe` is not found, first check common installation locations:
```bash
ls "/c/Users/$USERNAME/AppData/Local/Programs/Ollama/ollama.exe"
ls "/c/Program Files/Ollama/ollama.exe"
```
To add Ollama permanently through Windows settings:
1. Press the Windows key and search for **Edit environment variables for your account**.
2. Open it and click **Environment Variables**.
3. Under **User variables**, select `Path` and click **Edit**.
4. Click **New**.
5. Add the folder containing `ollama.exe`, usually one of:
```text
C:\Users\YOUR-WINDOWS-USERNAME\AppData\Local\Programs\Ollama
```
or:
```text
C:\Program Files\Ollama
```
6. Click **OK** on every dialog.
7. Close all Git Bash and VS Code windows, then reopen Git Bash.
8. Verify:
```bash
ollama.exe --version
```
### Add VS Code to PATH manually
If `code` is not found, add the VS Code command directory to the Windows user `Path` variable using the same steps. Common locations are:
```text
C:\Users\YOUR-WINDOWS-USERNAME\AppData\Local\Programs\Microsoft VS Code\bin
```
or:
```text
C:\Program Files\Microsoft VS Code\bin
```
Close and reopen Git Bash, then verify:
```bash
code --version
```
### Temporary PATH for the current Git Bash session
Use this only as a short-term workaround. It stops working when the terminal closes.
```bash
export PATH="$PATH:/c/Users/$USERNAME/AppData/Local/Programs/Ollama"
export PATH="$PATH:/c/Users/$USERNAME/AppData/Local/Programs/Microsoft VS Code/bin"
```
Then verify:
```bash
ollama.exe --version
code --version
```
## 3. Download Qwen coding models
### Option A: mid-range hardware
Download the recommended main model:
```bash
ollama.exe pull qwen2.5-coder:7b
```
Optional lightweight model:
```bash
ollama.exe pull qwen2.5-coder:1.5b
```
### Option B: high-memory workstation
For a system sized for Qwen3.6-35B-A3B, pull the Qwen3.6 model tag available from Ollama:
```bash
ollama.exe pull qwen3.6:35b-a3b
```
List downloaded models:
```bash
ollama.exe list
```
Test a model directly:
```bash
ollama.exe run qwen2.5-coder:7b
```
Or:
```bash
ollama.exe run qwen3.6:35b-a3b
```
Example prompt:
```text
Reply exactly: LOCAL QWEN OK
```
Exit with `/bye` or `Ctrl+D`.
## 4. Install Cline in VS Code
1. Open VS Code.
2. Press `Ctrl+Shift+X` to open **Extensions**.
3. Search for:
```text
Cline
```
4. Install the extension named **Cline**.
5. Open the Cline icon in the left VS Code Activity Bar.
### Optional: disable other local AI extensions
For the initial setup, disable Continue or other local AI agent extensions. This avoids confusion about which extension is using the model and reduces competition for system memory.
In VS Code:
1. Open **Extensions** with `Ctrl+Shift+X`.
2. Find the extension to disable.
3. Click its gear icon.
4. Choose **Disable (Workspace)** or **Disable**.
## 5. Configure Cline with local Ollama
On first launch, Cline opens its provider configuration screen.
1. In the **API Provider** list, choose:
```text
Local API
```
2. In the local provider/runtime list, choose:
```text
Ollama
```
3. Cline should automatically detect the Ollama installation and display models that were downloaded with `ollama.exe pull`.
4. Select the model appropriate for the computer:
```text
qwen2.5-coder:7b
```
Or, on suitable high-memory hardware:
```text
qwen3.6:35b-a3b
```
5. Complete the setup and start a new task.
No URL, port, base address, or API key is required when selecting **Local API → Ollama**. Cline uses the local Ollama connection automatically.
### If Cline does not detect Ollama
First verify that Ollama is running:
```bash
curl http://127.0.0.1:11434/api/tags
ollama.exe list
```
If the service is not running, start it manually:
```bash
ollama.exe serve
```
Keep that Git Bash window open while testing Cline. Then close and reopen the Cline panel and repeat **Local API → Ollama**.
### Advanced manual configuration
Only use manual URL settings if the Cline version does not provide the **Local API → Ollama** setup flow.
```text
Base URL: http://127.0.0.1:11434/v1
Model: qwen2.5-coder:7b
API key: ollama
```
Replace the model name with `qwen3.6:35b-a3b` when that model is installed.
## 6. Verify that Cline uses the local model
Open Git Bash and run:
```bash
ollama.exe ps
```
In VS Code, send a simple Cline request:
```text
Reply only with: LOCAL QWEN OK
```
While Cline generates its response, run again:
```bash
ollama.exe ps
```
Example output:
```text
NAME PROCESSOR
qwen2.5-coder:7b 58%/42% CPU/GPU
```
Seeing the selected model in `ollama.exe ps` confirms that Cline is calling the local Ollama model.
## 7. Open a project workspace
### Open from Git Bash
```bash
cd /c/path/to/project
code .
```
### Open from VS Code
1. Select **File → Open Folder**.
2. Select the root folder of the project.
3. Confirm that project files are visible in VS Code Explorer.
The folder opened in VS Code is the workspace Cline can inspect.
## 8. Create a Git checkpoint
Before allowing an agent to change files, create a checkpoint:
```bash
cd /c/path/to/project
git status
git add -A
git commit -m "Checkpoint before local AI work"
```
For a project not yet using Git:
```bash
git init
git add -A
git commit -m "Initial checkpoint"
```
Review changes at any time:
```bash
git diff
git status
```
## 9. Add project rules
Create a `.clinerules` file in the project root:
```bash
cat > .clinerules <<'EOF'
# Local AI coding rules
- Inspect relevant files before proposing or making changes.
- Provide a short plan before multi-file changes.
- Work on one focused feature, bug, or module at a time.
- Do not change unrelated files.
- Do not delete files, rewrite Git history, install dependencies, or run destructive commands without explicit approval.
- Run targeted tests, linting, and formatting after edits.
- Report changed files, commands run, test results, and remaining risks.
- Never print, upload, or expose secrets from .env files, API keys, certificates, or credentials.
EOF
```
## 10. Review a workspace
Use **Plan mode** in Cline when it is available. Approve file reads and workspace search, but do not approve edits or terminal commands during the first review.
Prompt:
```text
Read .clinerules first.
Inspect the current VS Code workspace. Do not modify files.
Provide:
1. Project structure and main entry points.
2. Languages, frameworks, dependencies, build command, and test command.
3. Architecture and core data flows.
4. Bugs, technical debt, security risks, and missing tests.
5. A prioritized list of improvements and useful features.
Use workspace search and file reads as needed. Do not run terminal commands.
```
For large repositories, request review of one subsystem at a time:
```text
Read .clinerules. Inspect only src/auth and tests/auth. Explain the authentication flow, identify bugs and missing tests, and propose improvements. Do not edit files or run commands.
```
## 11. Implement a feature safely
Ask for a plan first:
```text
Read .clinerules.
Implementing goal: [describe one specific feature].
Inspect only the relevant workspace files. Propose a short plan containing:
- files to create or modify,
- data and API changes,
- error cases,
- tests to add.
Do not edit files or run commands yet.
```
After reviewing the plan:
```text
Implement only the approved plan.
Modify only the listed files. Ask before every file write and terminal command. Run only targeted tests. At the end, list changed files, commands run, test results, and remaining risks.
```
Review the diff, then commit it:
```bash
git diff
git add -A
git commit -m "Add [feature name]"
```
## 12. Permission guidance
### Usually safe to approve
- Listing files and directories.
- Reading files.
- Searching text in the workspace.
- Viewing Git status and diffs.
### Review before approving
- Writing or editing files.
- Running tests, builds, formatters, or linters.
- Installing packages.
- Modifying dependency files.
- Database migrations.
### Do not automatically approve
- Deleting files or directories.
- `git reset --hard`, `git clean`, force-pushes, or Git-history rewrites.
- Commands touching production infrastructure.
- Commands using credentials or secrets.
- Network uploads or external requests.
## 13. Performance tips
- Select a model appropriate for the available RAM and VRAM.
- Use 7B models for mid-range laptops; use Qwen3.6-35B-A3B only on suitably provisioned systems.
- Work on one module, bug, or feature at a time.
- Close memory-heavy applications, virtual machines, Docker containers, games, and unnecessary browser tabs.
- Keep prompts precise and name relevant folders or files.
- Create Git checkpoints before and after agent work.
- Do not increase context length aggressively without sufficient RAM/VRAM; long context requires additional KV-cache memory.
Check the active model:
```bash
ollama.exe ps
```
Monitor NVIDIA activity during generation:
```bash
nvidia-smi -l 1
```
CPU/RAM offload is expected when GPU VRAM is smaller than the model’s memory requirements.
## 14. Troubleshooting
### Cline cannot find Ollama
Run:
```bash
curl http://127.0.0.1:11434/api/tags
ollama.exe list
```
If the API does not respond:
```bash
ollama.exe serve
```
Leave that terminal open while testing Cline.
### Cline does not list the model
1. Confirm that the model is installed:
```bash
ollama.exe list
```
2. Confirm the selected Cline configuration is **Local API → Ollama**.
3. Close and reopen the Cline panel, then start a new task.
### Agent performance is poor
- Ask the agent to inspect a specific folder instead of the whole repository.
- Request a plan before allowing edits.
- Split implementation into small steps.
- Include relevant logs, errors, and file names in the prompt.
- Review each diff before committing.
## Limitations
This setup provides a local, private, supervised coding agent. It is well suited to code review, debugging, focused multi-file changes, scripts, prototypes, and iterative development.
A local model is not equivalent to a large cloud coding model for repository-wide reasoning, long autonomous tasks, complex distributed systems, or high-stakes security work. Use narrow tasks, explicit approvals, Git checkpoints, and human review.
## License
This tutorial may be shared and adapted under the license selected for this repository.
Installazione
Installa la skill da https://github.com/amr-ba/local-ollama-qwen-cline-vscodeQuesta skill non è pubblicata sul registro ClawHub. Incolla il prompt nel tuo agente di coding — Claude Code, Cursor, Codex — e installerà la skill direttamente dal repository sorgente.
Apri il repository