<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://mediawiki.comfac.net/index.php?action=history&amp;feed=atom&amp;title=OpenCoder_Qwen35_Agentic_Setup_260330</id>
	<title>OpenCoder Qwen35 Agentic Setup 260330 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://mediawiki.comfac.net/index.php?action=history&amp;feed=atom&amp;title=OpenCoder_Qwen35_Agentic_Setup_260330"/>
	<link rel="alternate" type="text/html" href="https://mediawiki.comfac.net/index.php?title=OpenCoder_Qwen35_Agentic_Setup_260330&amp;action=history"/>
	<updated>2026-06-05T09:48:54Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://mediawiki.comfac.net/index.php?title=OpenCoder_Qwen35_Agentic_Setup_260330&amp;diff=207&amp;oldid=prev</id>
		<title>Justinaquino: &quot;Add OpenCoder Qwen3.5 agentic setup article (2026-03-30)&quot;</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.comfac.net/index.php?title=OpenCoder_Qwen35_Agentic_Setup_260330&amp;diff=207&amp;oldid=prev"/>
		<updated>2026-03-30T15:13:55Z</updated>

		<summary type="html">&lt;p&gt;&amp;quot;Add OpenCoder Qwen3.5 agentic setup article (2026-03-30)&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= OpenCoder v3.0 — Qwen3.5 Agentic Setup =&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Date:&amp;#039;&amp;#039;&amp;#039; 2026-03-30&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Author:&amp;#039;&amp;#039;&amp;#039; Justin / Comfac IT / CGG R&amp;amp;D &amp;amp; BD&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Status:&amp;#039;&amp;#039;&amp;#039; ✅ Working — &amp;lt;code&amp;gt;qwen3.5-4b-instruct&amp;lt;/code&amp;gt; executes tools in OpenCode&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Part of:&amp;#039;&amp;#039;&amp;#039; [[Project OpenCoder: AI Independence Initiative]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== 1. Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
The goal was to run a &amp;#039;&amp;#039;&amp;#039;locally-hosted agentic coding assistant&amp;#039;&amp;#039;&amp;#039; equivalent to Claude Code, using quantized open-source models on consumer hardware (8GB VRAM), served via Ollama and accessed through OpenCode or Qwen Code.&lt;br /&gt;
&lt;br /&gt;
Two tools were tested in parallel:&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;OpenCode&amp;#039;&amp;#039;&amp;#039; (v1.3.7) — open-source Claude Code equivalent, TUI-based&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Qwen Code&amp;#039;&amp;#039;&amp;#039; (v0.13.2) — Alibaba&amp;#039;s terminal agent, optimized for Qwen models&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== 2. What Failed and Why ==&lt;br /&gt;
&lt;br /&gt;
=== 2.1 Qwen 2.5 Coder (7B) — No Tool Execution ===&lt;br /&gt;
&lt;br /&gt;
Models tested:&lt;br /&gt;
* &amp;lt;code&amp;gt;qwen2.5-coder:7b-instruct-q4_K_M&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;qwen-opencode:latest&amp;lt;/code&amp;gt; (custom Modelfile, tool dispatch tuned)&lt;br /&gt;
* &amp;lt;code&amp;gt;qwen-agent-7b:latest&amp;lt;/code&amp;gt; (agent-tuned variant)&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Symptom:&amp;#039;&amp;#039;&amp;#039; Models generated syntactically correct bash commands as plain text in the response body. OpenCode displayed them but never executed them. The &amp;quot;Build&amp;quot; status showed green (model responded) but no tool was invoked.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Root cause:&amp;#039;&amp;#039;&amp;#039; Qwen 2.5 Coder at 7B does not reliably emit structured tool call JSON. It understands the task and writes the correct command, but outputs it as prose rather than invoking the framework&amp;#039;s tool interface. The model lacks robust function-calling at this parameter count.&lt;br /&gt;
&lt;br /&gt;
After extensive testing across multiple sessions and model variants, these were removed from the config entirely.&lt;br /&gt;
&lt;br /&gt;
=== 2.2 Qwen 3.5 (4B/9B) Base — Thinking Mode Interference ===&lt;br /&gt;
&lt;br /&gt;
Models tested:&lt;br /&gt;
* &amp;lt;code&amp;gt;qwen3.5:4b&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;qwen3.5:9b&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Symptom:&amp;#039;&amp;#039;&amp;#039; Models showed visible &amp;lt;code&amp;gt;Thinking:&amp;lt;/code&amp;gt; blocks in the output and generated commands as text. Same non-execution pattern as 2.5 Coder, but for a different reason.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Root cause:&amp;#039;&amp;#039;&amp;#039; Qwen 3.5 operates in &amp;#039;&amp;#039;&amp;#039;thinking mode by default&amp;#039;&amp;#039;&amp;#039;, generating &amp;lt;code&amp;gt;&amp;amp;lt;think&amp;amp;gt;...&amp;amp;lt;/think&amp;amp;gt;&amp;lt;/code&amp;gt; content before its final response. When served via Ollama&amp;#039;s OpenAI-compatible &amp;lt;code&amp;gt;/v1&amp;lt;/code&amp;gt; endpoint, the thinking block was being passed through in the response content. OpenCode&amp;#039;s tool call parser received a response beginning with &amp;lt;code&amp;gt;&amp;amp;lt;think&amp;amp;gt;&amp;lt;/code&amp;gt; text and either misidentified it, or the tool call was embedded inside the think block rather than emitted as a clean structured call after it.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Key finding from Qwen3.5 model card:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;quot;Qwen3.5 models operate in thinking mode by default... Qwen3.5 does not officially support the soft switch of Qwen3, i.e., &amp;lt;code&amp;gt;/think&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;/nothink&amp;lt;/code&amp;gt;.&amp;quot;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means the thinking mode cannot be toggled with a simple prompt prefix — it must be disabled at the API parameter level or suppressed via system prompt in a custom Modelfile.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Performance note:&amp;#039;&amp;#039;&amp;#039; &amp;lt;code&amp;gt;qwen3.5:9b&amp;lt;/code&amp;gt; took &amp;#039;&amp;#039;&amp;#039;4–5 minutes&amp;#039;&amp;#039;&amp;#039; to generate a response. Investigation revealed models had been migrated to a mechanical HDD. Benchmarked read speed: approximately &amp;#039;&amp;#039;&amp;#039;8.3–16 MB/s&amp;#039;&amp;#039;&amp;#039; (vs. 600 MB/s on SSD). A 5–6 GB model file at 16 MB/s ≈ 6 minutes load time. This explained the extreme latency — it was a storage bottleneck, not a model or GPU issue.&lt;br /&gt;
&lt;br /&gt;
{{mbox | type = notice | text = ⚠️ &amp;#039;&amp;#039;&amp;#039;Critical finding:&amp;#039;&amp;#039;&amp;#039; Always store active Ollama models on SSD. HDD throughput at 8–16 MB/s makes even 4B models unusable in interactive agentic workflows.}}&lt;br /&gt;
&lt;br /&gt;
=== 2.3 Qwen Code — Credential and Path Confusion ===&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Symptom:&amp;#039;&amp;#039;&amp;#039; &amp;lt;code&amp;gt;Failed to switch model to &amp;#039;openai::ollama&amp;#039;. Missing credentials for modelProviders model &amp;#039;ollama&amp;#039;.&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Root cause (two separate issues):&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Issue 1:&amp;#039;&amp;#039;&amp;#039; The &amp;lt;code&amp;gt;env&amp;lt;/code&amp;gt; block declaring &amp;lt;code&amp;gt;OLLAMA_API_KEY&amp;lt;/code&amp;gt; was missing from &amp;lt;code&amp;gt;settings.json&amp;lt;/code&amp;gt;. Qwen Code requires the key to exist even though Ollama doesn&amp;#039;t authenticate — it just checks that the env var is set.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Issue 2 — Distrobox path split:&amp;#039;&amp;#039;&amp;#039; Qwen Code running inside a distrobox container reads &amp;lt;code&amp;gt;~/.qwen/settings.json&amp;lt;/code&amp;gt; which resolves to &amp;lt;code&amp;gt;/home/justin/.qwen/&amp;lt;/code&amp;gt; inside the container. The file being edited was at &amp;lt;code&amp;gt;/run/host/home/justin/.qwen/settings.json&amp;lt;/code&amp;gt; on the host. These are two different files. Edits to the host path had no effect on what the running container read.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Fix:&amp;#039;&amp;#039;&amp;#039; Write directly to &amp;lt;code&amp;gt;~/.qwen/settings.json&amp;lt;/code&amp;gt; from inside the correct container, or use a heredoc to overwrite cleanly.&lt;br /&gt;
&lt;br /&gt;
{{mbox | type = notice | text = ⚠️ &amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039; Qwen Code cannot be run using the standard distrobox burner container workflow due to this path resolution issue. OpenCode does not have this limitation. See [[Opencode isolation and burner workflow 260216]].}}&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== 3. What Worked — The Modelfile Solution ==&lt;br /&gt;
&lt;br /&gt;
=== 3.1 The Modelfile Approach ===&lt;br /&gt;
&lt;br /&gt;
Since Qwen3.5 doesn&amp;#039;t support &amp;lt;code&amp;gt;/nothink&amp;lt;/code&amp;gt; and Ollama doesn&amp;#039;t expose &amp;lt;code&amp;gt;chat_template_kwargs&amp;lt;/code&amp;gt; at the API level, the solution was to create a &amp;#039;&amp;#039;&amp;#039;custom Ollama Modelfile&amp;#039;&amp;#039;&amp;#039; that:&lt;br /&gt;
&lt;br /&gt;
# Bases on the existing &amp;lt;code&amp;gt;qwen3.5:4b&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;:9b&amp;lt;/code&amp;gt;) pulled model&lt;br /&gt;
# Sets coding-optimized sampling parameters per the official model card&lt;br /&gt;
# Injects a SYSTEM prompt that suppresses thinking output and instructs the model to use tools directly&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Modelfile for 4B (save as &amp;lt;code&amp;gt;Modelfile.qwen3.5-4b-instruct&amp;lt;/code&amp;gt;):&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
FROM qwen3.5:4b&lt;br /&gt;
&lt;br /&gt;
PARAMETER temperature 0.6&lt;br /&gt;
PARAMETER top_p 0.95&lt;br /&gt;
PARAMETER top_k 20&lt;br /&gt;
PARAMETER repeat_penalty 1.0&lt;br /&gt;
PARAMETER num_ctx 32768&lt;br /&gt;
&lt;br /&gt;
SYSTEM &amp;quot;&amp;quot;&amp;quot;You are a precise coding and system assistant running inside an agentic terminal environment.&lt;br /&gt;
&lt;br /&gt;
CRITICAL RULES:&lt;br /&gt;
- Do NOT output &amp;lt;think&amp;gt; or &amp;lt;/think&amp;gt; tags&lt;br /&gt;
- Do NOT show reasoning steps or internal monologue&lt;br /&gt;
- Do NOT explain what you are about to do before doing it&lt;br /&gt;
- Respond with tool calls ONLY — no prose, no narration&lt;br /&gt;
&lt;br /&gt;
When asked to perform any file, shell, or system operation:&lt;br /&gt;
- Invoke the appropriate tool immediately (bash, write, read, etc.)&lt;br /&gt;
- Use the exact tool call format the framework expects&lt;br /&gt;
- Execute first, confirm after only if asked&lt;br /&gt;
&lt;br /&gt;
Available tools: bash, file read/write, glob, grep, list, task, webfetch.&lt;br /&gt;
Always use tools. Never output commands as plain text.&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Build command:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ollama create qwen3.5-4b-instruct -f Modelfile.qwen3.5-4b-instruct&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 3.2 Why the Modelfile Made It Work ===&lt;br /&gt;
&lt;br /&gt;
The Modelfile changes three things simultaneously:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Layer !! What changed !! Effect&lt;br /&gt;
|-&lt;br /&gt;
| &amp;#039;&amp;#039;&amp;#039;Sampling params&amp;#039;&amp;#039;&amp;#039; || &amp;lt;code&amp;gt;temperature=0.6&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;top_p=0.95&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;top_k=20&amp;lt;/code&amp;gt; || Matches Qwen3.5 model card recommendation for precise coding tasks — reduces token variance, more deterministic tool call format&lt;br /&gt;
|-&lt;br /&gt;
| &amp;#039;&amp;#039;&amp;#039;System prompt&amp;#039;&amp;#039;&amp;#039; || Explicit instruction to suppress &amp;lt;code&amp;gt;&amp;amp;lt;think&amp;amp;gt;&amp;lt;/code&amp;gt; tags and use tools || Overrides the default thinking behavior at the prompt level even when API-level &amp;lt;code&amp;gt;enable_thinking: false&amp;lt;/code&amp;gt; isn&amp;#039;t available&lt;br /&gt;
|-&lt;br /&gt;
| &amp;#039;&amp;#039;&amp;#039;Model identity&amp;#039;&amp;#039;&amp;#039; || Registered as a new Ollama model tag || Can be added to OpenCode/Qwen Code config independently, tested in isolation, and versioned separately from the base model&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The key insight: Qwen3.5 &amp;#039;&amp;#039;&amp;#039;does&amp;#039;&amp;#039;&amp;#039; support tool calling (45.6 on TIR-Bench). The problem was never capability — it was &amp;#039;&amp;#039;&amp;#039;output format&amp;#039;&amp;#039;&amp;#039;. The Modelfile forces the model into a mode where it emits tool calls in the structured format OpenCode expects, rather than narrating what it would do.&lt;br /&gt;
&lt;br /&gt;
=== 3.3 Confirmed Working ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;qwen3.5-4b-instruct&amp;lt;/code&amp;gt; in &amp;#039;&amp;#039;&amp;#039;OpenCode&amp;#039;&amp;#039;&amp;#039; successfully executed &amp;lt;code&amp;gt;mkdir&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;echo&amp;lt;/code&amp;gt;, file creation, and multi-step &amp;lt;code&amp;gt;mkdir &amp;amp;&amp;amp; echo &amp;amp;&amp;amp; cat&amp;lt;/code&amp;gt; chains&lt;br /&gt;
* Response time: &amp;#039;&amp;#039;&amp;#039;7–10 seconds&amp;#039;&amp;#039;&amp;#039; per tool call on 4B (vs 4–5 minutes on 9B from HDD)&lt;br /&gt;
* Thinking blocks: suppressed — clean tool call output observed&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== 4. Config Management Scripts ==&lt;br /&gt;
&lt;br /&gt;
Three scripts were produced to manage the model ecosystem. These live in the OpenCoder working directory.&lt;br /&gt;
&lt;br /&gt;
=== 4.1 sync-opencode-models.py ===&lt;br /&gt;
&lt;br /&gt;
Syncs Ollama&amp;#039;s model list into &amp;lt;code&amp;gt;opencode.json&amp;lt;/code&amp;gt; under &amp;lt;code&amp;gt;provider.ollama.models&amp;lt;/code&amp;gt; (dict format). Preserves custom names, auto-generates names using family/size/capability detection, supports &amp;lt;code&amp;gt;--dry-run&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;--verbose&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== 4.2 sync-qwencode-models.py ===&lt;br /&gt;
&lt;br /&gt;
Same logic but targets &amp;lt;code&amp;gt;~/.qwen/settings.json&amp;lt;/code&amp;gt; under &amp;lt;code&amp;gt;modelProviders.openai[id=ollama].models&amp;lt;/code&amp;gt; (array format). Uses &amp;lt;code&amp;gt;NAME_RULES&amp;lt;/code&amp;gt; lookup table with 3-letter SFX codes for model role identification. Also writes correct &amp;lt;code&amp;gt;contextLength&amp;lt;/code&amp;gt; per model (262144 for Qwen3.5-9B, 32768 for others).&lt;br /&gt;
&lt;br /&gt;
=== 4.3 fix-opencode-model-names.py ===&lt;br /&gt;
&lt;br /&gt;
One-shot rename pass over an existing &amp;lt;code&amp;gt;opencode.json&amp;lt;/code&amp;gt; to apply the &amp;lt;code&amp;gt;Family (Size) - Descriptor · SFX&amp;lt;/code&amp;gt; naming convention without a full sync.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Important:&amp;#039;&amp;#039;&amp;#039; These scripts should be run using Claude or another capable agent to keep the &amp;lt;code&amp;gt;NAME_RULES&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;PINNED_NAMES&amp;lt;/code&amp;gt; tables current as new models are pulled.&lt;br /&gt;
&lt;br /&gt;
=== 4.4 Naming Convention ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Family (Size) - Descriptor [Quant] · SFX&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! SFX !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;AGT&amp;lt;/code&amp;gt; || Agentic / Tool Dispatch&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;COD&amp;lt;/code&amp;gt; || Coding focused&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;RSN&amp;lt;/code&amp;gt; || Reasoning / Thinking&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;VIS&amp;lt;/code&amp;gt; || Vision / Multimodal&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;INS&amp;lt;/code&amp;gt; || Instruct (non-thinking)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;GRM&amp;lt;/code&amp;gt; || Grammar / Style utility&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;GEN&amp;lt;/code&amp;gt; || General purpose&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;DST&amp;lt;/code&amp;gt; || Distilled from larger model&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Examples:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* &amp;lt;code&amp;gt;Qwen 3.5 (4B) - Instruct No-Think · INS&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;Qwen 3.5 (9B) - Claude Opus Distill [Q4_K_M] · RSN·DST&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;Qwen 2.5 Coder (7B) - Tool Dispatch · AGT&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== 5. Infrastructure Notes ==&lt;br /&gt;
&lt;br /&gt;
=== 5.1 Storage Impact on Model Performance ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Storage !! Read speed !! 5GB model load !! Usable?&lt;br /&gt;
|-&lt;br /&gt;
| NVMe SSD || ~3,000 MB/s || ~2 seconds || ✅ Ideal&lt;br /&gt;
|-&lt;br /&gt;
| SATA SSD || ~600 MB/s || ~8 seconds || ✅ Good&lt;br /&gt;
|-&lt;br /&gt;
| HDD (observed) || ~8–16 MB/s || &amp;#039;&amp;#039;&amp;#039;4–6 minutes&amp;#039;&amp;#039;&amp;#039; || ❌ Not viable for interactive use&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Action:&amp;#039;&amp;#039;&amp;#039; Always store active Ollama model files on SSD. Use HDD only for cold storage of models not currently in rotation.&lt;br /&gt;
&lt;br /&gt;
=== 5.2 OpenCode vs Qwen Code ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Feature !! OpenCode !! Qwen Code&lt;br /&gt;
|-&lt;br /&gt;
| Config format || &amp;lt;code&amp;gt;opencode.json&amp;lt;/code&amp;gt; — models as dict || &amp;lt;code&amp;gt;settings.json&amp;lt;/code&amp;gt; — models as array&lt;br /&gt;
|-&lt;br /&gt;
| Config path || &amp;lt;code&amp;gt;~/.config/opencode/&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;~/.qwen/&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Distrobox compatible || ✅ Yes || ⚠️ Path issues — run from host&lt;br /&gt;
|-&lt;br /&gt;
| Burner container workflow || ✅ Yes || ❌ Not compatible&lt;br /&gt;
|-&lt;br /&gt;
| Ollama provider || &amp;lt;code&amp;gt;provider.ollama&amp;lt;/code&amp;gt; with npm package || &amp;lt;code&amp;gt;modelProviders.openai[id=ollama]&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Credentials || Not required for Ollama || Requires &amp;lt;code&amp;gt;OLLAMA_API_KEY&amp;lt;/code&amp;gt; env var&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== 6. Replication Steps (Clean Setup) ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# 1. Pull base model&lt;br /&gt;
ollama pull qwen3.5:4b&lt;br /&gt;
&lt;br /&gt;
# 2. Create Modelfile (save as Modelfile.qwen3.5-4b-instruct)&lt;br /&gt;
# [see Section 3.1]&lt;br /&gt;
&lt;br /&gt;
# 3. Build instruct variant&lt;br /&gt;
ollama create qwen3.5-4b-instruct -f Modelfile.qwen3.5-4b-instruct&lt;br /&gt;
&lt;br /&gt;
# 4. Verify in Ollama&lt;br /&gt;
ollama list | grep qwen3.5-4b-instruct&lt;br /&gt;
&lt;br /&gt;
# 5. Quick sanity check — should produce NO &amp;lt;think&amp;gt; tags&lt;br /&gt;
ollama run qwen3.5-4b-instruct &amp;quot;create a file called test.txt with hello world&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# 6. Add to opencode.json&lt;br /&gt;
# Under provider.ollama.models:&lt;br /&gt;
# &amp;quot;qwen3.5-4b-instruct:latest&amp;quot;: {&lt;br /&gt;
#   &amp;quot;name&amp;quot;: &amp;quot;Qwen 3.5 (4B) - Instruct No-Think · INS&amp;quot;&lt;br /&gt;
# }&lt;br /&gt;
&lt;br /&gt;
# 7. Run sync script to keep config current&lt;br /&gt;
python3 sync-opencode-models.py --verbose&lt;br /&gt;
&lt;br /&gt;
# 8. Launch OpenCode and test&lt;br /&gt;
opencode&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== 7. Open Questions ==&lt;br /&gt;
&lt;br /&gt;
* Does Ollama strip &amp;lt;code&amp;gt;&amp;amp;lt;think&amp;amp;gt;&amp;lt;/code&amp;gt; tags at the API boundary in newer versions? (Would make the Modelfile SYSTEM prompt partially redundant but harmless)&lt;br /&gt;
* What is the practical context limit for &amp;lt;code&amp;gt;qwen3.5-4b-instruct&amp;lt;/code&amp;gt; on 8GB VRAM before OOM?&lt;br /&gt;
* Can &amp;lt;code&amp;gt;qwen3.5:9b&amp;lt;/code&amp;gt; (on SSD) match 4B tool call reliability with the same Modelfile approach?&lt;br /&gt;
* Is there a way to run Qwen Code inside the distrobox burner workflow with symlinked config paths?&lt;br /&gt;
* At what task complexity does the 4B start failing vs needing the 9B?&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;Document generated: 2026-03-30&amp;#039;&amp;#039;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;Part of: Project OpenCoder v3.0 — CGG R&amp;amp;D &amp;amp; BD Unit&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[Project OpenCoder: AI Independence Initiative]] — Strategic overview&lt;br /&gt;
* [[Opencode isolation and burner workflow 260216]] — Distrobox burner container workflow&lt;br /&gt;
* [[OpenCode in Android Termux 260303]] — Running OpenCode on Android&lt;br /&gt;
* [[Proceedural Agentic Development Methodology 260304]] — PAD methodology&lt;br /&gt;
* [[Lora Basics 260304]] — LoRA model training fundamentals&lt;br /&gt;
* [[🧠 Process: Selecting and Installing the Right Ollama Model for Your Hardware]] — Model selection guide&lt;br /&gt;
&lt;br /&gt;
[[Category:Research]]&lt;br /&gt;
[[Category:AI]]&lt;br /&gt;
[[Category:OpenCode]]&lt;br /&gt;
[[Category:Ollama]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Comfac IT]]&lt;/div&gt;</summary>
		<author><name>Justinaquino</name></author>
	</entry>
</feed>