We got model fusion at home

mrdosija1 pts0 comments

Byte-sized chunks::We got model fusion at home<br>In this chunk I&rsquo;m going to document a little OpenCode1 setup that uses multiple (well, two in this case but your plan is your limit) LLMs to review a GitHub pull request.<br>It&rsquo;s a simple exercise in fusing multiple different models to perform a task and can be customized for any given LLM that you have access to and used for any task that benefits from this kind of multi-llm analysis.<br>I&rsquo;m going to cut to the chase in a second but just for the sake of completeness, let me set the stage a bit.<br>A little background<br>The review bottleneck<br>Regardless of what you think about it, the reality of software development is that these days barely anyone writes code by hand professionally. Old news by now, I know, and I feel like we&rsquo;ve all become these mythical 10x developers at least if LoC/PR is your main metric. It&rsquo;s also not just about speed. I feel that, with AI, it&rsquo;s much easier to jump on a problem that&rsquo;s usually outside of your comfort zone in the codebase. So, most of my work these days has been looking at diffs, either monitoring my own coding agent at work or reviewing other people&rsquo;s changes - both something that requires a lot of effort to stay focused or radical context shifts.<br>AI-assisted code reviews<br>So, it&rsquo;s not a coincidence that the whole market of AI code review tools23 has started to emerge and your company probably already uses one. These are usually integrated in your GitHub flow and will kick in once your PR is live, which is very nice, but personally, I like to do my reviewing on-demand and in the comfort of my own coding agent so I can:<br>Review my own stuff before wrapping up a PR - this saves me and a reviewer a lot of back-and-forward over some low-hanging stuff<br>Review other people&rsquo;s work - using AI to review large diffs or changes on an unknown repository corner is a nice way to break the ice before you dig deeper<br>The LLM dilemma<br>Personally, OpenCode has been my coding agent of choice for some time now and I usually switch different models periodically as I notice some of them becomes better over the others. Now, I don&rsquo;t have any scientific method to compare these, it&rsquo;s mainly a gut feeling and vibe-checking the internet. This means I am the last person you should listen to about LLM comparisons but I feel like that the balance shifts as new versions of these are released so it&rsquo;s good jump around from time to time.<br>Or, just use them in parallel. If you are using any kind of non-proprietary coding agent, it should be possible to set up a team of AI agents that will work on a task so, in my case, I set a couple of review agents in OpenCode, each using a model of my choice to achieve a task - review a pull request.<br>OpenCode agents<br>Briefly: OpenCode enables you to set up AI agents4 that can be invoked with a tab command by name. Each agent, at minimum, has a name, system prompt and a model. You can also create subagents that primary agents can use on-demand, kind of like tools. I guess similar concepts exists in other open coding agents so look it up.<br>Now, let&rsquo;s see how we can set these up for parallel, multi-model code reviews.<br>Setting up OpenCode review agents<br>For the sake of simplicity, let&rsquo;s say we want to do a simultaneous review using the latest Claude and GPT models. For this we will set up a main agent and two subagents:<br>Primary agent - let&rsquo;s call it review-orchestrator, it&rsquo;s job will be to go trough each sub-agent&rsquo;s findings and create a deduplicated list with source attributed. Since this task is fairly simple, we don&rsquo;t need to use a flagship model for this.<br>Subagents - we&rsquo;ll create one for each model we want to use:captain-claude - reviews the pull request using Anthropic model of our choice<br>captain-gpt - same but with an OpenAI model

So the process will be something like this:

┌───────────────────────┐ Findings:<br>│ │ - title: ...<br>>> Hey, ─────► │ review-orchestrator │ ────────► - description: ...<br>please review │ │ - source: Claude/GPT<br>this PR: #234 └─────▲──────────▲──────┘ - suggested fix: ....<br>findings │ │ findings<br>open questions │ │ open questions Open Questions: ....<br>┌───────────────────┐ ┌───────────────────┐<br>│ │ │ │<br>│ captain-claude │ │ captain-gpt │<br>│ │ │ │<br>└───────────────────┘ └───────────────────┘<br>The main agent<br>All OpenCode agents are defined in your opencode.json file in the agent section. For our main agent, we want to set the mode: primary, give it some instructions and let&rsquo;s use a simpler model for it&rsquo;s task:<br>"agent": {<br>"review-orchestrator": {<br>"description": "Runs Claude and GPT review subagents, returns one source-attributed review list.",<br>"mode": "primary",<br>"model": "anthropic/claude-sonnet-5",<br>"temperature": 0,<br>"prompt": "You are a code review orchestrator. First invoke both subagents `captain-claude` and `captain-gpt` with the same task. Run them in parallel when possible.\n\nScope...

rsquo review agent model task opencode

Related Articles