OpenCode + Ollama: I Replaced Claude Code With This (Full Setup)
Leon van Zyl ·2026-06-04 ·1 min read
Summary written by us from the video's transcript. The video, and everything in it, is Leon van Zyl's work.
Learn how to replace Claude Code with OpenCode using Ollama (Alma) for a free, local coding agent and get practical tips for efficient prompt handling.
Takeaways
- Claude Code’s massive system prompt consumes most of a local model’s context window, causing failures.
- OpenCode works with any provider; pairing it with Alma lets you run free, locally hosted models.
- Select a model that matches your GPU VRAM (e.g., Kraina 3.6 for 24 GB+).
- Add new models to OpenCode by editing its config file if they don’t appear in the UI.
- Use short, task‑specific prompts and break large plans into separate phases to avoid overload.
- Grant the agent a browser skill (Playwright) to debug streaming issues and verify app behavior.
Why Switch from Claude Code
Claude Code consumes around 30,000 tokens on system prompts and tools before any user request, overwhelming most local models. The author experienced hallucinated tool calls and poor instruction following, prompting the move to OpenCode.
Installing OpenCode and Alma
OpenCode is installed via a single npm command copied from its website. Alma (the Ollama‑compatible runtime) is downloaded from alama.com, installed, and used to run local models.
Choosing and Pulling a Model
Model selection depends on GPU VRAM: JEMMA 4 E4B for ~1 GB, JEMMA 4 A4B for 16 GB, and Kraina 3.6 (the author’s favorite) for ≥24 GB. Models are pulled with `Alma pull <model>` and tested with `Alma run <model> "Hey!"`.
Connecting Alma to OpenCode
In OpenCode, use the Connect dialog, select Alma as provider, and enter “Alma” as the API key. If a model isn’t listed, edit the OpenCode config file in your user folder to add the new model name.
Running OpenCode with Your Model
Start a project folder, then launch OpenCode with `Alma launch opencode --model <model>`. The interface supports Build and Plan modes (toggle with Shift). Simple prompts like “Hey” or “Create a Next.js project here” respond instantly.
Effective Prompt Workflow
Keep prompts short and focused; large files overwhelm the agent. Use planning mode to generate an implementation plan, then split it into smaller task files. Create new sessions for each phase and give explicit instructions (e.g., “implement phase one only”).
Testing and Debugging with Browser Skill
If responses don’t stream, grant the agent a browser skill. Install Playwright via the provided command, restart OpenCode, then run `skills` to verify. The agent can open a headed browser, take snapshots, and debug the app automatically.