Opencode and Visual Analysis
Chris Cowley
- 5 minutes read - 909 wordsI have been using Opencode to work on a couple of ESP32 projects that are of a more “Maker” nature. At some point I realised that I also needed a case and decided to set Opencode loose on it too.
The workflow for this is simple, but awful:
- describe the case in words
- Opencode (using Big Pickle because FREE) creates an OpenSCAD model
- Render the OpenSCAD model
- Wonder what the hell Opencode was thinking
- GOTO 10 and the cycle continues ad nauseam
What you need is some way for Opencode to verify what it has done and iterate.
I use Opencode with oh-my-openagent which, amongst other things, gives you sub-agents. One of those sub-agents is the “multimodal-looker” which can look at images and provide feedback. I thought I could use this to create a feedback loop for Opencode to verify its own work.
The idea is simple:
- I describe the case in words
- Opencode creates an OpenSCAD model and renders it
- The multimodal-looker “looks” at the rendered image and provides feedback.
- Opencode uses the feedback to iterate on the design
This is great in theory, but falls apart in practice because Big Pickle does not support visual analysis. So, I needed to do two things:
- route visual analysis to another model
- decide which model to use
I decided to use gemma4:e4b because it has the feature I need and is not only free, but I can run it on my own hardware with reasonable performance.
The performance isn’t interactive-speed, but it is good enough that I can set the agent working while I go away and have a meal or chat with my wife for a bit.
Info
Why do I not use a local model as my main Opencode model? Well, I would love to, but I am not able to get the interactive performance I need from a local model on the hardware I have available. At work I have access to a pimped out workstation with a honking great big GPU. That gives me enough performance with Qwen to work fully “locally”, albeit not in my office, but under the desk of a colleague in Paris.
So how do we configure it? I am assuming you already have Opencode set up with oh-my-openagent. The first thing to do is set up correct agent routing in .config/opencode/oh-my-openagent.json:
{
"$schema": "https://raw.githubusercontent.com/code-yeongyu/oh-my-openagent/dev/assets/oh-my-opencode.schema.json",
"agents": {
"sisyphus": {
"model": "opencode/big-pickle",
"variant": "max",
"fallback_models": [
{
"model": "ollama/gemma4:31b-cloud"
},
{
"model": "ollama/gemma4:e4b"
}
]
},
...
"multimodal-looker": {
"model": "ollama/gemma4:e4b",
"variant": "medium",
"fallback_models": [
{
"model": "ollama/gemma4:31b-cloud"
},
{
"model": "opencode/nemotron-3-super-free"
}
]
},
...
},
"categories": {
"visual-engineering": {
"model": "ollama/gemma4:e4b",
"variant": "high",
"fallback_models": [
{
"model": "ollama/gemma4:12b"
}
]
},
...
"artistry": {
"model": "ollama/gemma4:e4b",
"variant": "high",
"fallback_models": [
{
"model": "opencode/big-pickle"
}
]
},
...
}
}
This tells all the visual related agents to use ollama/gemma4:e4b as the primary model. There is a lot more available in the configuration file, but I did not want to clutter this post too much.
Next, we need to tell Opencode to use the multimodal-looker to “look at” images. Why? Because Opencode already has a “look at” tool, but it uses the main model, which in the case of Big Pickle does not support visual analysis. Create a file called .config/opencode/INSTRUCTIONS.md containing:
# Global Agent Instructions
## Image/Visual Analysis
When analyzing images, renders, screenshots, or any visual media:
- **DO NOT use the `look_at` tool** — the session model (big-pickle) does not support image input.
- **USE `multimodal-looker` subagent** — routes to `ollama/gemma4:e4b` which has vision capabilities.
```
task(subagent_type="multimodal-looker", load_skills=[], run_in_background=false,
prompt="Analyze the image at /path/to/image.png — describe what you see...")
```
This applies to all image analysis: OpenSCAD renders, screenshots, photos, diagrams, etc.
Finally, add the following block to .config/opencode/opencode.json:
{
...
"instructions": [
"~/.config/opencode/INSTRUCTIONS.md"
],
...
}
Now, no matter what main model you are using, when you tell Opencode to look at an image it will use the multimodal-looker sub-agent to do the analysis. This allows you to have a feedback loop for your designs, even if your main model does not support visual analysis.
Conclusion
That is it! With a few lines of configuration, you can route visual analysis to a local model that supports it, even if your main model does not. This opens up a feedback loop for things like OpenSCAD renders, screenshots, or any other visual work you want Opencode to iterate on.
The performance is not really good enough to be interactive, but it is good enough to set the agent working and come back to results. For me, that is a reasonable trade-off for keeping everything local and free. If you have better hardware than I do, you could likely get interactive performance with a larger model.
Info
Take any performance comments with a grain of salt. I am using an AMD Ryzen 5 6600H, with 12 threads and 16GB DDR5 RAM. I have enabled ROCm to use the integrated GPU, but that makes ~10% difference at best. Throw a threadripper and big NVidia RTX Pro 6000 GPU at it and you will get fully interactive performance.
Honestly, this is far from a replacement for a good industrial designer, or even just someone who can handle a CAD program, but it is a good way to get a first pass at a design and iterate on it. It is also a good way to get feedback on your designs from a different perspective.