> youcanbuildthings.com
tutorials books topics about
tutorial from: The opencode Stack

OpenCode Orchestrator + Fixer Routing, Wired

by J Cook · 8 min read·

Summary:

  1. Teaches the OpenCode orchestrator + fixer routing pattern: two models in two slots, one config file.
  2. Uses the verified opencode.json agent block plus the K2.6 / Qwen 3.5 Plus split the community converged on.
  3. You leave with two production routing configs and an A/B receipt naming a winner on cost, speed, and quality.
  4. Bonus: three copy-paste task-class recipes (refactor / greenfield / debug) and a routing wrapper script.

Search r/opencodeCLI for the best opencode orchestrator fixer setup and you get one sentence, repeated: “K2.6 is the orchestrator, and Qwen 3.5 Plus is the fixer. That’s all, but it works clearly.” The community discovered the pattern. Almost nobody writes down how to actually wire it. This is the wiring.

OpenCode orchestrator and fixer routing table: refactor-heavy uses Kimi K2.6 and Qwen 3.5 Plus, greenfield uses GLM-5 and DeepSeek V4 Flash, debug-heavy uses MiniMax M2.7 and Kimi K2.6, all from the same opencode.json shape at about $0.40 a week per developer.

Why is one model never the right answer?

Because a coding agent does two opposite jobs in one session. Planning means reading the code, deciding what changes, and breaking it into ordered steps. Executing means applying diffs and retrying when an apply fails.

Planning rewards reasoning and context-window management. The orchestrator slot wants a model that holds a 200-line file plus its dependencies in working memory and returns a clean structured plan. Speed barely matters; that is a handful of large calls per session.

Executing rewards speed and edit precision. The fixer slot wants a model that lands a diff cleanly the first time, retries fast, and does not over-think a five-line patch. This is where most of your session tokens go, so cost matters most here.

Put one model in both slots and you compromise twice. A frontier model doing hundreds of tiny edits bleeds money. A cheap model doing the planning hands the fixer a bad plan, and the fixer thrashes against it, which costs more than you saved. Two models, two slots, both compromises gone.

How does OpenCode’s agent config actually look?

OpenCode routes through named agents: a block in opencode.json that binds a name to a model and a permission set. This is the verified shape from the OpenCode docs (opencode.ai/docs/agents):

{
  "$schema": "https://opencode.ai/config.json",
  "agent": {
    "build": {
      "mode": "primary",
      "model": "anthropic/claude-sonnet-4-20250514",
      "prompt": "{file:./prompts/build.txt}",
      "permission": {
        "edit": "allow",
        "bash": "allow"
      }
    },
    "plan": {
      "mode": "primary",
      "model": "anthropic/claude-haiku-4-20250514",
      "permission": {
        "edit": "deny",
        "bash": "deny"
      }
    },
    "code-reviewer": {
      "description": "Reviews code for best practices and potential issues",
      "mode": "subagent",
      "model": "anthropic/claude-sonnet-4-20250514",
      "permission": { "edit": "deny" }
    }
  }
}

One correction the docs make for you: OpenCode config is JSON, or JSONC (JSON with comments). It is not TOML. There is no route.toml, because there is no TOML in OpenCode at all. One file, two variants, both JSON-based. Global config lives at ~/.config/opencode/opencode.json; per-project config at ./opencode.json in the repo root, and project wins over global.

How do I wire the K2.6 + Qwen 3.5 Plus split?

You define two agents: orchestrator on Kimi K2.6, fixer on Qwen 3.5 Plus. Drop this in opencode.json:

{
  "$schema": "https://opencode.ai/config.json",
  "agent": {
    "orchestrator": {
      "model": "opencode/kimi-k2.6",
      "description": "Plans multi-file refactors and structures the work",
      "permission": { "bash": "ask", "edit": "ask", "write": "ask" }
    },
    "fixer": {
      "model": "opencode/qwen3.5-plus",
      "description": "Executes the orchestrator's plan; runs edits fast",
      "permission": { "bash": "ask", "edit": "allow", "write": "allow" }
    }
  }
}

Read the permission split. The orchestrator asks before everything, because at planning time you still want to confirm the plan is sane. The fixer auto-allows edit and write, because by execution time the plan is already approved. Bash stays gated on both. rm -rf is rm -rf no matter which agent typed it.

Kimi K2.6 wins the orchestrator slot on a large context window and reliable structured output, so the plan comes back as numbered sub-tasks the agent can act on without re-prompting. Qwen 3.5 Plus wins the fixer slot because it lands diffs cleanly the first time more often than the big reasoning models and runs cheap on Go’s bundled tier.

Run it as two steps. Plan first:

opencode --agent orchestrator
> Read /api/users.ts. Propose a split that separates the data layer
> from the API layer. Output a numbered list of sub-tasks with the
> files and changes per task.

Review the plan. If it is good, hand it to the fixer:

opencode --agent fixer
> Execute this plan, one sub-task at a time. Pause between
> sub-tasks so I can verify each diff.

opencode stats reports token spend per agent, so your cost log records the orchestrator and fixer rows separately. On a 150-line refactor that is roughly a nickel total. The same task on a single frontier model doing both the planning and the edits runs $0.30 to $0.50 at retail. That is an order of magnitude, every time, on that task class.

What broke the first time I ran this

Two failures, both worth pre-empting. First: I named the agents planner and executor because that felt cleaner. Wrong call. The community vocabulary is orchestrator and fixer, and once your config, your team docs, and your cost log all use those words, every Reddit thread and every teammate’s setup is searchable against yours. Match the vocabulary even when your synonym is prettier.

Second: I ran the fixer with edit: ask and mashed y through forty prompts without reading them. The fixer slot exists to move fast on an already-approved plan. Gating it re-introduces exactly the friction the split was supposed to remove, and worse, it trains you to approve diffs blind. Gate the orchestrator. Trust the fixer. That asymmetry is the whole point of the two permission blocks above.

Which recipe do I use for which task?

Three task-class recipes. Pick by the work, not by preference. This is the table the book’s routing chapter ships, verbatim:

Task classOrchestratorFixer
Refactor-heavyKimi K2.6Qwen 3.5 Plus
GreenfieldGLM-5DeepSeek V4 Flash
Debug-heavyMiniMax M2.7Kimi K2.6

Refactor is mostly edits, so most tokens flow through the cheap fixer while K2.6’s reasoning earns its keep understanding a multi-file structure before the split. Greenfield is mostly fresh code, so DeepSeek V4 Flash’s speed dominates the cost story and GLM-5’s lighter planning is enough. Debug needs many files held in context with a small number of careful edits, so MiniMax M2.7 absorbs the large-context cost cheaply and K2.6 makes each fix right the first time. Same opencode.json shape every time. Three recipes. About $0.40 a week per developer on a normal mixed workload.

How do I stop hand-picking the agent every task?

You script it. OpenCode’s CLI is composable, so any wrapper can call opencode --agent <name> and get the identical result. A minimal task-class router:

#!/usr/bin/env bash
# route.sh — pick the agent by task class, then run it.
# usage: route.sh refactor "split the data layer out of /api/users.ts"
set -euo pipefail
CLASS="${1:?usage: route.sh <refactor|greenfield|debug> '<prompt>'}"
PROMPT="${2:?missing prompt}"

case "$CLASS" in
  refactor)   ORCH=orchestrator      FIX=fixer ;;
  greenfield) ORCH=orchestrator-glm  FIX=fixer-deepseek ;;
  debug)      ORCH=orchestrator-mm   FIX=fixer-k26 ;;
  *) echo "unknown class: $CLASS" >&2; exit 1 ;;
esac

echo ">> planning with $ORCH"
opencode --agent "$ORCH" --prompt "Plan: $PROMPT. Output numbered sub-tasks."
echo ">> executing with $FIX"
opencode --agent "$FIX" --prompt "Execute the plan above, one sub-task at a time."

Define the six agents (three orchestrator/fixer pairs) in opencode.json, drop this at tools/route.sh, chmod +x it, and your routing decision becomes one positional argument instead of a memory test. Solo devs can skip the script and pick by hand; a team that wants reproducible cost per task class should lock it in here.

What should you actually do?

  • If you ship mostly refactors → run the K2.6 + Qwen 3.5 Plus pair and stop tuning. It is the community default for a reason.
  • If you start a lot of fresh projects → GLM-5 + DeepSeek V4 Flash. The fixer’s speed is most of your cost story on greenfield.
  • If you live in a debugger → MiniMax M2.7 orchestrator + K2.6 fixer, and accept it is your most expensive recipe.
  • If you cannot decide → build both Project #3 and Project #4 configs, run the same 150-line file through each, and let the A/B receipt pick. Your task classes, your numbers, not the community’s.

bottom_line

  • Two cheap models in two slots beats one expensive model in both, every time, on cost and usually on quality.
  • The routing config is also a measurement instrument: split by agent and your cost log starts telling you what each task class costs, not just what “the agent” cost.
  • OpenCode will never route for you. That is a feature. The operator picks; the wrapper script remembers.

Frequently Asked Questions

What is the orchestrator + fixer pattern in OpenCode?+

It is running two different models in two named agents: an orchestrator that plans the change (strong reasoning, big context) and a fixer that executes the edits (fast, cheap, edit-precise). You wire both into one opencode.json and invoke the orchestrator to plan, then the fixer to run the plan.

What is the best provider pairing for OpenCode?+

The community-canonical pair is Kimi K2.6 as orchestrator and Qwen 3.5 Plus as fixer for refactor-heavy work. GLM-5 + DeepSeek V4 Flash wins greenfield; MiniMax M2.7 + Kimi K2.6 wins debug-heavy. There is no universal winner; you A/B on your own task classes.

Does OpenCode auto-route tasks to the right model?+

No. OpenCode has no built-in task-class router. Routing means you configure different agents with different models, then choose which agent to invoke per task. The choice is yours, not the tool's.