Compare commits

..

5 Commits

4 changed files with 550 additions and 7 deletions
+149
View File
@@ -0,0 +1,149 @@
# Local AI Coding Setup — Windows 11 (Aider + Ollama)
## Hardware
- GPU: RTX 5070 Ti, 12GB VRAM
- RAM: 32GB
- OS: Windows 11
---
## Prerequisites
### 1. Install Ollama
Download from https://ollama.com and install.
### 2. Pull a model
```powershell
ollama pull qwen3-coder:30b # 18GB, strong coding model (MoE, VRAM+RAM split)
ollama pull gemma4:12b # 12GB, responds in English more reliably
```
Confirm models are available:
```powershell
ollama list
```
Confirm Ollama is serving:
```powershell
curl http://localhost:11434/api/tags
```
---
## Install Aider
```powershell
pip install aider-chat
aider --version # should print version number
```
---
## Project Config
Create `.aider.conf.yml` in your project root:
```yaml
model: ollama/gemma4:12b
openai-api-base: http://localhost:11434/v1
openai-api-key: ollama
edit-format: whole
map-tokens: 2048
no-auto-commits: true
system-prompt: "Always respond in English only. Never use Chinese or any other language."
```
**Config notes:**
- `edit-format: whole` — more reliable file writes for local models (avoids code showing in chat only)
- `map-tokens: 2048` — limits repo map size, important for smaller context windows
- `no-auto-commits: true` — review changes before they hit git
- `system-prompt` — forces English responses (important for Qwen3 which defaults to Chinese)
Switch models without editing the file:
```
/model ollama/qwen3-coder:30b
```
---
## Optional: Performance Tuning (if inference is slow)
Create a `Modelfile` in the project root:
```
FROM qwen3-coder:30b
PARAMETER num_ctx 8192
PARAMETER num_gpu 99
```
Register it:
```powershell
ollama create qwen3-coder-tuned -f Modelfile
```
Update `.aider.conf.yml`:
```yaml
model: ollama/qwen3-coder-tuned
```
**Why:** `num_gpu 99` maximizes VRAM usage. `num_ctx 8192` prevents the KV cache from
spilling too much into RAM. Recommended context range: 409616384.
---
## Daily Aider Workflow
Start Aider (reads config automatically):
```powershell
aider
```
| Command | What it does |
|---------|-------------|
| `/add src/foo.py` | Add file to context |
| `/drop src/foo.py` | Remove file from context |
| `/diff` | See pending changes |
| `/undo` | Revert last change |
| `/run pytest` | Run command, share output with model |
| `/run git rm --cached file.py` | Run git commands from inside Aider |
| `/clear` | Clear chat history (keep files) |
| `/settings` | Show loaded config (verify auto_commits, system_prompt) |
| `/model ollama/gemma4:12b` | Switch model on the fly |
| `/exit` | Quit |
---
## Known Issues & Fixes
### Model responds in Chinese
Cause: Qwen3 is a Chinese model and defaults to Chinese.
Fix: `system-prompt` in `.aider.conf.yml` (already included above). Restart Aider after config change.
### Aider shows code in chat but doesn't write files
Cause: Model didn't follow Aider's edit format.
Fix 1: `/add target_file.py` before asking — hints the target file to the model.
Fix 2: `edit-format: whole` in config (already included above).
### "File not found" / repo-map warnings for deleted files
Cause: File deleted from disk but still tracked in git index.
Fix:
```powershell
git rm --cached filename.py
```
Or from inside Aider:
```
/run git rm --cached filename.py
```
### Config changes not taking effect
Fix: Exit Aider (`/exit`) and restart. Config is only read at startup.
---
## Verify Everything Works
1. `ollama list` — model appears
2. `aider --version` — prints version
3. Start Aider, run `/settings` — confirm `auto_commits: False` and `system_prompt` present
4. Ask Aider to create a simple file — it should write to disk, not just chat
5. Response is in English
+342
View File
@@ -0,0 +1,342 @@
# Local AI Coding Environment Implementation Plan
## Objective
Build a local-first AI coding environment on a Windows 11 workstation with the following requirements:
### Hardware
* NVIDIA RTX 5070 Ti 12GB VRAM
* 64GB+ system RAM (if available)
* Windows 11
* WSL2 Ubuntu
* VS Code
### Existing Software
* Ollama installed and operational
* Qwen3-Coder 30B installed in Ollama
* Claude Code CLI installed
* Git installed
### Constraints
* Source code is confidential.
* All code must remain local by default.
* Cloud models may be used only as an optional fallback.
* Minimize API costs.
* Support large codebases.
---
# Target Architecture
```text
VS Code
|
+---- Continue Extension
|
+---- Claude Code CLI
|
+---- Aider
|
v
Ollama
|
v
Qwen3-Coder 30B
```
---
# Project Goals
Implement and validate the following workflows.
## Workflow 1: Local Chat
Developer can:
* Ask coding questions
* Explain code
* Generate code
* Review code
using:
```text
VS Code
+
Continue
+
Ollama
+
Qwen3-Coder 30B
```
---
## Workflow 2: Local Agent
Developer can:
* Refactor code
* Create files
* Modify files
* Run git-aware edits
using:
```text
Aider
+
Ollama
+
Qwen3-Coder 30B
```
---
## Workflow 3: Claude Code Optional
Developer can:
* Use Claude Code against local Ollama models
* Compare behavior against Aider
* Determine whether Claude Code provides additional value
using:
```text
Claude Code
+
Ollama
+
Qwen3-Coder 30B
```
---
# Deliverables
Produce the following:
## Deliverable 1
Environment verification script.
Verify:
* Ollama installed
* NVIDIA GPU visible
* CUDA available
* WSL functioning
* Qwen3-Coder model available
Expected output:
```text
PASS: Ollama
PASS: GPU
PASS: CUDA
PASS: Qwen3-Coder
```
---
## Deliverable 2
Aider installation guide.
Include:
### Linux / WSL installation
Commands:
```bash
pipx install aider-chat
```
or preferred installation method.
### Ollama integration
Configuration examples.
### Verification steps
Simple repository test.
---
## Deliverable 3
Continue configuration.
Create:
### VS Code setup instructions
Install Continue extension.
### Model configuration
Configure Continue to use:
```text
Ollama
Qwen3-Coder 30B
```
### Example config files
Include complete examples.
---
## Deliverable 4
Claude Code local model integration.
Research and implement the best available approach for:
```text
Claude Code
->
OpenAI-compatible endpoint
->
Ollama
```
Requirements:
* Use officially supported methods where possible.
* Avoid unsupported hacks.
* Document limitations.
* Provide rollback procedure.
---
## Deliverable 5
Performance optimization.
Analyze:
### VRAM usage
Qwen3-Coder 30B on RTX 5070 Ti 12GB.
### Recommended quantization
Evaluate:
* Q4
* Q5
* IQ3
Recommend the best balance between:
* Quality
* Speed
* Memory usage
---
## Deliverable 6
Benchmark suite.
Create repeatable tests:
### Test 1
Generate a REST API.
### Test 2
Refactor a medium-sized module.
### Test 3
Write unit tests.
### Test 4
Debug a failing application.
Measure:
* Completion time
* Accuracy
* Token throughput
* User effort
Compare:
```text
Aider + Qwen3-Coder 30B
Claude Code + Qwen3-Coder 30B
Continue + Qwen3-Coder 30B
```
---
# Preferred Outcome
Primary development workflow:
```text
VS Code
+
Continue
+
Qwen3-Coder 30B
```
Agent workflow:
```text
Aider
+
Qwen3-Coder 30B
```
Optional advanced workflow:
```text
Claude Code
+
Qwen3-Coder 30B
```
---
# Success Criteria
The project is successful if:
1. All code remains local.
2. No cloud services are required.
3. Developer can perform daily coding tasks locally.
4. Aider successfully edits repositories.
5. Continue provides a productive IDE experience.
6. Claude Code local integration is evaluated and documented.
7. Setup can be reproduced on a fresh machine.
---
# Final Report
Produce a final report containing:
* Architecture diagram
* Installation steps
* Configuration files
* Benchmark results
* Known limitations
* Recommended workflow
* Future upgrade path
The report should be suitable for long-term maintenance and onboarding of additional developers.
+60 -8
View File
@@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 2,
"id": "259a585b",
"metadata": {},
"outputs": [],
@@ -30,7 +30,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 3,
"id": "fe7bf6eb",
"metadata": {},
"outputs": [
@@ -58,7 +58,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 4,
"id": "4bddedb8",
"metadata": {},
"outputs": [
@@ -95,18 +95,70 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"id": "b33dcb00",
"metadata": {},
"outputs": [],
"source": [
"set(text)"
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"65\n",
"\n",
" !$&',-.3:;?ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\n"
]
}
],
"source": [
"chars = sorted(list(set(text)))\n",
"vocab_size = len(chars)\n",
"print(vocab_size\n",
")\n",
"print(\"\".join(chars\n",
"))\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7c84058a",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'!'"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"stoi = {char:i for i, char in enumerate(chars)}\n",
"itos = {i:char for i, char in enumerate(chars)}\n",
"# print (itos)\n",
"\n",
"stoi['a'] # 0\n",
"itos[2]\n",
"\n",
"encode = lambda s: \n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4f43742c",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": ".venv",
"display_name": ".venv (3.12.10)",
"language": "python",
"name": "python3"
},