🚀 Ollama Codex Clone — Local AI Coding Assistant (VS Code Extension)
Fully local AI copilot for VS Code.
⚡ Runs entirely on Ollama — no cloud API, no API key, no bill.
🧠 Agentic — it doesn't just suggest code, it reads, writes, edits, and deletes files for you, with your approval.
Overview
Ollama Codex Clone brings autonomous coding assistance directly into your editor using
local LLMs served by Ollama. It plugs into VS Code's native Chat UI as a chat participant
(@ollama), so the experience feels like GitHub Copilot Chat — but every token stays on your
machine.
It can:
- Chat about your code directly in the built-in VS Code Chat view
- Read files and search across your workspace for context
- Propose and apply file edits, new files, and deletions (with a confirmation prompt by default)
- Explain, refactor, and fix code from the editor context menu
- Review an entire workspace and summarize its architecture
All running fully local — zero API dependency.
Why this exists
Modern AI coding tools like GitHub Copilot are powerful, but they:
- ❌ Require a cloud API and a subscription
- ❌ Give you limited control over which model runs
- ❌ Restrict customization of prompts and behavior
With Ollama Codex Clone, you get:
- ✅ Local-first privacy — code never leaves your machine
- ✅ Any Ollama-compatible model, swappable at any time
- ✅ Zero API cost
- ✅ A chat experience modeled on GitHub Copilot Chat, via
@ollama
Getting started
- Install Ollama and make sure the server is running:
ollama serve
- Pull a tool-calling-capable coding model, e.g.:
ollama pull qwen2.5-coder:14b
# or a smaller/faster option
ollama pull qwen2.5-coder:7b
- Install this extension in VS Code (Extensions view → search "Ollama Codex Clone" → Install,
or
code --install-extension ollama-codex-clone-0.1.0.vsix once packaged).
- Open the Chat view (
Ctrl/Cmd+Alt+I) and type:
@ollama build me a debounce utility with a unit test
or run Ollama Codex: Open Chat from the Command Palette.
Configuration
| Setting |
Default |
Description |
ollamaCodex.host |
http://localhost:11434 |
Base URL of your local Ollama server |
ollamaCodex.model |
qwen2.5-coder:14b |
Model tag used for chat and agent tool-calling |
ollamaCodex.temperature |
0.2 |
Sampling temperature |
ollamaCodex.numCtx |
8192 |
Context window size requested from the model |
ollamaCodex.agentMode |
true |
Allow the assistant to call file tools (off = chat-only) |
ollamaCodex.autoApproveEdits |
false |
Skip the confirmation prompt on writes/edits/deletes |
ollamaCodex.maxToolIterations |
12 |
Cap on tool round-trips per request |
ollamaCodex.excludeGlobs |
node_modules, .git, dist, out, lockfiles |
Paths excluded from workspace search |
Change the active model anytime via Ollama Codex: Change Model (also bound to the status bar item).
Commands
| Command |
What it does |
Ollama Codex: Open Chat |
Opens VS Code Chat pre-filled with @ollama |
Ollama Codex: Change Model |
Pick from locally installed Ollama models |
Ollama Codex: Test Connection |
Verifies the Ollama server is reachable and the model is pulled |
Ollama Codex: Explain Selection |
Explains the selected code (or whole file) |
Ollama Codex: Refactor Selection |
Proposes/applies a refactor of the selection |
Ollama Codex: Fix Current File |
Reads diagnostics + file, proposes fixes |
Ollama Codex: Generate Code |
Prompts for a description, generates code into the workspace |
Ollama Codex: Review Workspace |
Read-only architecture review and risk summary |
Ollama Codex: Toggle Agent Mode |
Switch between agentic (file tools) and chat-only |
All editor commands are also available from the right-click context menu under Ollama Codex.
Architecture
VS Code Extension
│
▼
Chat Participant (@ollama) ──► Agent Loop (system prompt + tool-calling)
│ │
│ ▼
│ File Tools (read/list/search/write/edit/delete)
│ │ — each write/edit/delete asks for approval
▼ ▼
Ollama REST API (/api/chat, streaming) ──► Local model (qwen2.5-coder, gemma2, …)
src/ollama/client.ts — thin client over Ollama's /api/chat and /api/tags, with
streaming and OpenAI-style tools support.
src/agent/tools.ts — the file-system tool implementations and their JSON-schema specs,
sandboxed to the first workspace folder.
src/agent/agentLoop.ts — drives the tool-calling loop: send messages → get a reply or
tool call → run the tool → feed the result back → repeat until the model is done.
src/chat/participant.ts — wires the agent loop into VS Code's native Chat API as the
@ollama participant.
Safety notes
- File writes, edits, and deletes prompt for confirmation by default
(
ollamaCodex.autoApproveEdits: false). Only turn this off if you trust your model and prompts.
- All file tools are sandboxed to the first open workspace folder; paths that resolve outside it
are rejected.
- Nothing is sent anywhere except your own Ollama server — no telemetry, no cloud calls.
Project structure
├── src/
│ ├── extension.ts # activation, command + participant registration
│ ├── ollama/client.ts # Ollama REST client (chat, streaming, tool calls)
│ ├── agent/tools.ts # file tools + their tool-spec schemas
│ ├── agent/agentLoop.ts # tool-calling conversation loop
│ ├── chat/participant.ts # @ollama chat participant
│ ├── commands/ # command palette + context menu commands
│ ├── config/settings.ts # typed settings accessor
│ └── ui/ # status bar + output channel logging
├── test/tools.test.ts
├── package.json
├── tsconfig.json
├── esbuild.js
└── README.md
Roadmap
- Streaming diffs / inline edit previews before applying changes
- Multi-root workspace support
- Optional shell-command tool (explicitly opt-in, always confirmed)
- Model auto-pull prompt when the configured model isn't installed
Contributing
Issues and PRs welcome — open one on the project's GitHub repository.
License
MIT