Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
O

opencode-fusion

> AI 编程
Open source

Main agent plans and reviews; cheaper sidekick edits. Devin Fusion pattern for OpenCode

200 stars0 likes0 views
WebsiteGitHub

About

Main agent plans and reviews; cheaper sidekick edits. Devin Fusion pattern for OpenCode

opencode-fusion

[!IMPORTANT] This project is no longer actively maintained. The final maintained release is v1.2.0 and targets OpenCode 1.18.x. OpenCode 2 is not supported because its permission translation does not preserve Fusion's mechanical guarantees. Existing releases remain available; forks and new maintainers are welcome. A minimal, working multi-model team for opencode: a main agent that plans and reviews but cannot edit files, delegating every change to a cheaper, faster sidekick. Inspired by the Devin Fusion "sidekick" pattern from Cognition.

The main agent's file editing is mechanically denied. Its only way to change a file is to hand a spec to the sidekick. That keeps frontier intelligence on the decisions that matter (the plan, the interpretation of ambiguity, the review) while a cheap model does the mechanical work. Cognition reports the pattern holds frontier-level quality at roughly 35% lower cost on their own FrontierCode benchmark, and in a July 2026 follow-up measured a Fable 5-led setup at 54% below pure Fable 5 with near-identical quality: cheaper in absolute dollars than an Opus 4.8-led setup, despite Fable's 2x per-token price.

The main pair is backed by read-only helpers (explore, research) and optional specialists (design, reviewer, vision), each on a model you choose. See the full team.

Quick start • How it works • Setup • Customize • FAQ • Troubleshooting

Demo

https://github.com/user-attachments/assets/6d9e96e2-654a-4bc4-82af-3c3f1a8bde91

One full delegation cycle in 38 seconds: the main agent plans, hands a spec to the sidekick, reviews the returned diff, and verifies the result, without ever touching a file itself.

Quick start

Install the setup skill globally, then let opencode configure everything conversationally:

bash
npx skills add mihneaptu/opencode-fusion --skill fusion-setup -g -a opencode -y
set up fusion

The installer needs Node 20.12 or newer. On older Node (including Ubuntu's apt default) it crashes with a styleText error; Troubleshooting has three workarounds. The skill interviews you for a model per role, writes the global config, installs the agent prompts, and tells you when to restart. On a subscription (OpenCode Go/Zen, ChatGPT, or GitHub Copilot)? Name it and the skill starts from a ready-made profile instead of asking per role. Manual setup and provider examples live in Setup.

That command tracks main. To install an exact release instead, add the tag: npx skills add mihneaptu/opencode-fusion#v1.2.0 --skill fusion-setup -g -a opencode -y. Released versions are listed on the changelog.

Why it works

From Cognition's blog post:

We've found that the main agent should take minimal actions, and only read what is absolutely necessary. By default it should delegate and monitor, while making the significant decisions: the plan, the interpretation of ambiguity, the final review.

This repo turns that into a hard constraint: the main agent's edit, search, and freeform bash tools are denied at the permission layer, so delegating to the sidekick is its only way to change a file. Two payoffs fall out of the split:

Lower cost. Implementation mechanics are most of a session's tokens. A cheaper sidekick handles them at near-parity while the expensive main model spends its tokens only on judgment: the plan, the spec, the review. The main agent's prompt enforces this discipline: emit judgment not volume, keep context lean, reason once then hand off. Cognition's follow-up study bears this out: in 81% of Fable-led Fusion runs, the lead model never made a single code edit. That is the behavior this repo makes mechanical rather than advisory.

Cross-vendor review, for free. When the main agent and sidekick are different model families (for example Opus reviewing Grok), every diff gets an independent second-family read before it lands. Models from one family share blind spots; a reviewer from a different lineage catches what same-family review misses. You get this just by picking a main and sidekick from different vendors.

How it works

The diagram shows one delegation cycle: the main agent delegates exploration, plans from what comes back, hands the sidekick a spec, reviews the returned diff, loops until it passes, then delivers the result.

Agent Role Config key Required Suggested model (2026)
build Main: plan, delegate, review agent.build.model core claude-opus-5
plan Plan mode: same brain as build, plans but does not execute agent/plan.md (file) core reuses main model
sidekick Execute edits and commands agent.sidekick.model core grok-4.5
explore Fast read-only exploration (opencode's built-in agent; no prompt file) agent.explore.model core deepseek-v4-flash
research Read-only external research (web, docs) agent.research.model optional claude-sonnet-5
design Frontend/UI implementation agent.design.model optional kimi-k3
reviewer Critique a plan before implementation; audit a diff before commit agent.reviewer.model optional gpt-5.6-sol
vision Transcribe images the main model cannot see agent.vision.model optional gemini-3.6-flash

Models move fast. Treat these as 2026 starting points, not requirements. Use any provider you like; in config each model is written as provider/model-id (for example openai/gpt-5.6-sol), and the sidekick should stay cheaper and faster than the main agent. The mix above spans several vendors on purpose, so the main agent's review of each sidekick diff is cross-vendor. If a subscription covers your models, a profile fills this table in for you.

Enforced vs. advised

The pattern's guarantees live in two different layers, and being precise about which is which answers most "what if the model just ignores the instructions?" questions.

Enforced: the permission layer. opencode checks these on every tool call, no matter what the model reads, remembers, or intends:

  • The main agent's edit, grep, glob, and list are denied. Denied tools are removed from the model's tool schema entirely; there is no edit tool for it to decline to use.
  • Its bash is deny-by-default with a short verification and git allowlist, so file-writing commands are blocked. git commit and git push additionally require per-command user approval; common direct force/mirror/delete/prune forms are denied by later rules.
  • Direct git commit and git push invocations plus common Git wrapper forms are denied for the sidekick and design agents, making review-then-commit the normal enforced path.
  • Delegation is bounded by an explicit task allowlist: the main agent reaches only its named specialists, and the sidekick can spawn only read-only searchers.

If the main agent "won't delegate," the result is visible inaction: nothing on disk changes. The failure mode is never a silent bypass.

Advised: the prompt layer. Spec precision, diff-review rigor, cost discipline, parallelization, and skill usage are instructions in the agent prompts. opencode loads skills at the model's discretion (nothing can force an agent to read or apply one), which is exactly why no guarantee here depends on them; the skill in this repo is just the installer. If the model slacks at this layer, the cost is quality or wasted tokens, never an unauthorized edit.

Not guaranteed: the threat model. The permission layer bounds which tools each agent can call. It is not a sandbox, and it is worth being precise about what it does not protect:

  • The .env denies on the executors stop the common accidental read (cat .env landing a key in a transcript), not a determined one. An agent with broad bash has many equivalent ways to read a file or the process environment, so treat those rules as accidental-leak prevention, not secret isolation. The {env:VAR} config syntax keeps keys out of plaintext config and out of the chat; it does not hide them from the environment agents run in.
  • Git command rules match command text and are defense-in-depth, not a shell sandbox: wrappers, alternate executables, or obfuscation can bypass a finite pattern list when an executor has broad bash. They protect against common accidental commits and destructive pushes, not a hostile process. Editing files is the sidekick's job, and catching a wrong edit is what the main agent's diff review (and the optional reviewer) are for.
  • The design agent is the one role granted skill: allow, because its prompt cannot do its job without loading a design skill. That skips opencode's per-use approval prompt and overrides a global skill deny. A skill is instructions the model then follows, so treat your installed skill set as trusted input on the same footing as your prompts. The agent already holds edit and broad bash, so this grants no capability it lacked; its prompt's refusal to fetch external skill catalogs is the advised layer, not the enforced one. Every other agent keeps opencode's default, so a global deny still applies to them.
  • The design agent's path-aware opencode tools are fenced to the workspace (external_directory: deny), but processes launched through broad bash are not OS-sandboxed by that rule. The sidekick keeps opencode's default ask for paths outside the project, because setup and reconfigure legitimately write the global config. Note that --auto mode auto-approves ask rules, so use external sandboxing too if an executor must never leave the repo.

Auditable: verify instead of trusting. The optional fusion-audit plugin logs the delegation tree, and opencode's session DB records every agent's actual tool calls (opencode db path prints its location, typically ~/.local/share/opencode/opencode.db). "Did it really delegate?" is checkable ground truth, not vibes.

Setup

Fusion lives entirely in your global opencode config at ~/.config/opencode/ (Windows: %USERPROFILE%\.config\opencode\). There is no build step and nothing to clone into your projects.

Recommended: let opencode set it up

This repo ships a skill, fusion-setup, that configures everything conversationally. Install it globally (Node 20.12+):

bash
npx skills add mihneaptu/opencode-fusion --skill fusion-setup -g -a opencode -y

Or copy the fusion-setup folder from this repo's .opencode/skills/ into ~/.config/opencode/skills/. Skills are discovered on demand; no restart is needed to pick one up. Then say:

set up fusion

It asks which model and provider you want for each role, writes ~/.config/opencode/opencode.json, installs the agent prompts under ~/.config/opencode/agent/, and tells you to restart. The mechanical steps (timestamped backup, config merge, atomic write, file copies, validation, and undo) run through a small deterministic script bundled with the skill, so the sensitive part of setup does not depend on model compliance. To change models later, say "reconfigure fusion" or edit the config directly (see Customize); "undo fusion" restores the recorded backup and removes exactly what was installed.

Subscription profiles

If your models come from a subscription, skip the per-role interview: name the subscription during setup (or run /fusion-setup opencode-go) and the skill applies a bundled profile: a ready-made role-to-model mapping the instal

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

JavaScriptai-agentsai-codingclaude-codecodex

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
CategoryAI 编程
PricingOpen source

> Related tools

G
GitHub Copilot
GitHub 官方 AI 编程助手,覆盖补全、Chat 与 Agent 模式。
C
Cursor
AI 原生代码编辑器,对话改代码、多文件 Agent 与规则体系是其核心。
S
skills
Skills for Real Engineers. Straight from my .agents directory.