Fusion brings OpenRouter-style model ensemble routing to ZCode. It analyzes your task in real time and selects the best fusion strategy: π€ Consensus Β· π Sequential Β· π― Specialist Β· π‘οΈ Fallback.
- What is Fusion?
- Why Fusion? (With vs Without)
- The Four Fusion Modes
- Visual Walkthrough
- Quick Start
- Configuration
- Usage Examples
- MCP API Reference
- Architecture
- How We Built It
- Replicate This Setup
- Use Cases
- FAQ
- Contributing
- License
Fusion is a ZCode plugin that orchestrates multiple AI models on a single task. Instead of relying on one model for everything, Fusion dynamically selects and combines models based on what the task actually needs.
Inspired by OpenRouter's Fusion, Fusion brings the same multi-model intelligence directly into your coding agent β so the right models collaborate on the right parts of your work.
In one sentence: Fusion reads your task, picks the best model combination, and synthesizes their outputs into one better answer.
- π§ Auto task analysis β Detects complexity, domain, and reliability needs
- π Four fusion strategies β Consensus, Sequential, Specialist, Fallback
- π MCP server included β Exposes
analyze_task,execute_fusion,get_models - π§© Skill-based fallback β Works even without the MCP server running
- βοΈ Fully configurable β Bring your own models via env vars
- π Zero secrets in code β All credentials via environment variables
| Scenario | π© Without Fusion | π With Fusion |
|---|---|---|
| Architecture decision | One model's opinion, no cross-check | 3 models reach consensus, disagreements surfaced |
| Multi-step feature build | Manual handoffs, lost context | Automatic pipeline: design β code β review |
| Debugging a tricky bug | Stuck with one model's blind spots | Coding specialists attack from multiple angles |
| Production-critical code | Hope the single model gets it right | Fallback chain guarantees a result |
| Cost optimization | Always uses the most expensive model | Right-sized model per subtask |
| Creative brainstorming | Single creative voice | Diverse models, richer ideas |
| Research / analysis | One source of reasoning | Multi-perspective synthesis |
The bottom line: Fusion trades a little latency for a lot more reliability, breadth, and quality.
Fusion picks one of four strategies automatically. You can also force a mode if you prefer.
βMany minds are better than one.β
- Trigger words:
compare,evaluate,trade-offs,pros/cons,should we,perspectives - Models: Analysis specialists (o1, o3, Claude-3-Opus, GPT-4)
- How: Queries 2β3 models in parallel, then synthesizes agreement and surfaces disagreements.
βThink it, build it, review it.β
- Trigger words:
build,implement,create,then,step,first,next - Models: Pipelined β reasoning β coding β review
- How: Each model refines the previous one's output (e.g., design β implement β critique).
βRight tool for the job.β
- Coding triggers:
code,function,script,debug,bug,python,react,api - Analysis triggers:
analyze,research,explain,architecture,strategy - Creative triggers:
creative,brainstorm,write,design,idea,tagline - How: Routes to the domain-optimized model pool.
βNever let the user down.β
- Trigger: Reliability-critical tasks, or when no other pattern matches
- How: Tries the primary model; on failure/timeout, automatically moves to backups.
ββββββββββββββββββββββββ
β User gives a task β
ββββββββββββ¬ββββββββββββ
βΌ
ββββββββββββββββββββββββ
β Fusion Skill loads β
β & analyzes the task β
ββββββββββββ¬ββββββββββββ
βΌ
ββββββββββββββββββββββ΄βββββββββββββββββββββ
βΌ βΌ βΌ βΌ
ββββββββββββ ββββββββββββ ββββββββββββ ββββββββββββ
β Consensusβ βSequentialβ βSpecialistβ β Fallback β
β Mode β β Mode β β Mode β β Mode β
ββββββ¬ββββββ ββββββ¬ββββββ ββββββ¬ββββββ ββββββ¬ββββββ
β β β β
ββββββββββββββββ΄βββββββ¬βββββββ΄ββββββββββββββ
βΌ
ββββββββββββββββββββββββ
β Synthesize outputs β
β into one final answerβ
ββββββββββββ¬ββββββββββββ
βΌ
ββββββββββββββββββββββββ
β Optimized response β
ββββββββββββββββββββββββ
User: "What are the trade-offs of microservices vs monolith for a startup?"
π Fusion analysis:
β Detected: "trade-offs" β Mode: CONSENSUS β Confidence: 0.8
β Models engaged: o1, Claude-3-Opus, GPT-4
ββ o1 βββββββββββββββββββββββββββββββββββββββββββββββββ
β Start with a modular monolith. Microservices add β
β operational overhead that early startups can't β
β afford. Plan for extraction later. β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββ Claude-3-Opus ββββββββββββββββββββββββββββββββββββββ
β Microservices solve team-scaling, not technical β
β scaling. Under 10 engineers? Monolith wins. Use β
β hexagonal architecture for easy future extraction. β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββ GPT-4 ββββββββββββββββββββββββββββββββββββββββββββββ
β Monolith: simpler debugging, single deploy artifact,β
β shared DB transactions, lower infra cost. Clear win β
β for startups. β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π€ Fusion synthesis:
β
Agreement: Start monolith, design for extraction
π Nuance: Hexagonal architecture as the bridge
π Recommendation: Modular monolith β extract at 10+ engineers
User: "Build a React todo component and write unit tests"
π Fusion analysis:
β Detected: multi-step ("build" + "and" + "tests")
β Mode: SEQUENTIAL β Confidence: 0.75
Step 1 [Claude-3.5-Sonnet] β drafted TodoList.jsx
β
βΌ
Step 2 [GPT-4] β reviewed: added useCallback,
memoization, accessibility
β
βΌ
Step 3 [DeepSeek-Coder] β optimized, added Jest tests,
fixed edge cases
π¦ Final deliverable: production-ready component + tests
- ZCode installed
- Node.js 18+ (for the MCP server)
Option A β From this repo (clone & link):
git clone https://github.com/roman-ryzenadvanced/fusion-zcode-plugin.git
cd fusion-zcode-plugin/0.1.0
npm install
npm run buildThen copy the built plugin into your ZCode plugin cache:
# Windows (Git Bash)
cp -r . "/c/Users/$USER/.zcode/cli/plugins/cache/zcode-plugins-official/fusion-plugin/0.1.0/"
# macOS / Linux
cp -r . ~/.zcode/cli/plugins/cache/zcode-plugins-official/fusion-plugin/0.1.0/Option B β Plugin registry (once published):
zcode plugin install fusion-pluginAdd this line to ~/.zcode/cli/config.json under plugins.enabledPlugins:
"fusion-plugin@zcode-plugins-official": trueRestart ZCode. You should now see the fusion skill available. π
Ask ZCode something that triggers fusion:
"What are the trade-offs between PostgreSQL and MongoDB for a SaaS app?"Fusion should kick in and tell you which mode it selected.
Fusion ships with sensible defaults. To customize, set these environment variables (or ZCode user-config values):
| Variable | Default | Purpose |
|---|---|---|
FUSION_MODEL_CODING |
deepseek-coder,gpt-4,claude-3-5-sonnet |
Models for coding tasks |
FUSION_MODEL_ANALYSIS |
o1,o3,claude-3-opus,gpt-4 |
Models for reasoning/analysis |
FUSION_MODEL_CREATIVE |
gpt-4,claude-3-5-sonnet,command-r |
Models for creative tasks |
FUSION_MODEL_VISION |
gpt-4-vision,claude-3-opus-vision |
Models for vision tasks |
FUSION_API_KEY |
(empty) | API key for your model provider |
FUSION_API_BASE |
https://api.openrouter.ai/api/v1 |
API base URL |
Example shell profile:
export FUSION_API_KEY="your-openrouter-key"
export FUSION_MODEL_CODING="deepseek-coder,gpt-4o,claude-3-5-sonnet"User: "Should we adopt GraphQL over REST for our new product?"
β Fusion queries 3 analysis models, synthesizes a balanced recommendation.User: "Design and implement a rate limiter in Node.js, then review it."
β Pipeline: design (o1) β implement (Claude-3.5) β review (GPT-4).User: "Debug this pandas ValueError: ..."
β Routes to coding specialists (DeepSeek-Coder, GPT-4).User: "Generate production-grade JWT auth middleware. Must not fail."
β Primary (Claude-3.5) with automatic failover to backups.When the Fusion MCP server is active, these tools are available to the agent:
Analyzes a task and returns the recommended fusion mode + models.
| Param | Type | Required | Description |
|---|---|---|---|
task |
string | β | The task text |
context |
string | β | Optional extra context |
Returns: { recommendedMode, recommendedModels, confidence }
Executes a multi-model fusion task.
| Param | Type | Required | Description |
|---|---|---|---|
task |
string | β | The task text |
mode |
string | β | Force a mode (consensus/sequential/specialist/fallback) |
models |
string[] | β | Override the model list |
Lists all available models grouped by capability.
fusion-zcode-plugin/
βββ 0.1.0/
β βββ .zcode-plugin/
β β βββ plugin.json # ZCode plugin manifest + user config schema
β βββ skills/fusion/
β β βββ SKILL.md # The fusion skill (auto-routing rules)
β βββ src/mcp/
β β βββ server.ts # MCP server source (analyze/exec/list)
β βββ package.json # Dependencies & build scripts
β βββ tsconfig.json # TypeScript config
βββ .github/workflows/
β βββ release.yml # CI: build + typecheck on push/tag
βββ examples/
β βββ consensus-demo.md # Worked example
βββ README.md # You are here
βββ CHANGELOG.md
βββ CONTRIBUTING.md
βββ LICENSE
Data flow:
- User task β ZCode β Fusion skill triggers
- Skill (or MCP
analyze_task) classifies the task - Appropriate models are engaged per the selected mode
- Outputs are synthesized into a single response
- ZCode presents the unified answer to the user
Fusion was designed to feel native to ZCode while bringing OpenRouter's multi-model philosophy on-device. Here's the journey:
-
Studied the ecosystem β We explored the existing ZCode plugin cache (
android-emulator,skill-creator,convex, etc.) to learn the canonical structure:.zcode-plugin/plugin.jsonmanifest,skills/<name>/SKILL.md, optional MCP server indist/, andpackage.jsonfor build tooling. -
Designed the routing brain β We mapped common task phrasings ("compare", "build", "debug", "trade-offs") to fusion modes. This became the lightweight classifier in
server.ts. -
Built the MCP server β Using
@modelcontextprotocol/sdk, we exposed three tools (analyze_task,execute_fusion,get_models) over stdio transport so any MCP-aware agent can use them. -
Wrote the skill β
SKILL.mdteaches the agent when to use Fusion and how to fall back to skill-based delegation if the MCP server isn't running. -
Kept it secret-free β All credentials flow through environment variables. The repo contains zero tokens, zero cookies, zero personal data.
-
Polished for humans β Visual diagrams, comparison tables, worked examples, and a friendly tone so anyone (human or agent) can replicate the setup.
Anyone β human or AI agent β can reproduce this plugin from scratch:
mkdir -p fusion-plugin/0.1.0/{.zcode-plugin,skills/fusion,src/mcp}
cd fusion-plugin/0.1.0Declare the plugin name, MCP server command, env wiring, and a userConfig schema. See 0.1.0/.zcode-plugin/plugin.json for the full file.
Frontmatter (name, description) controls when the skill triggers. The body explains the four modes and routing rules. Keep it under 500 lines.
Use @modelcontextprotocol/sdk to expose tools over stdio. The classifier reads FUSION_MODEL_* env vars and matches task text against pattern lists.
npm install
npm run build # outputs dist/mcp/server.jsCopy the 0.1.0/ folder into your ZCode plugin cache and enable it in config.json.
Restart ZCode and trigger the skill with a consensus-style question.
That's it β six steps, fully reproducible. π
- Startups deciding architecture β Get multi-model consensus before betting the company.
- Teams writing production code β Fallback mode guarantees a deliverable.
- Researchers comparing sources β Consensus mode surfaces disagreements.
- Devs debugging β Specialist coding models attack from multiple angles.
- Content creators β Creative specialists brainstorm diverse ideas.
- AI agent builders β Use Fusion's MCP tools inside your own agent pipelines.
Does Fusion call the models itself?
The MCP server plans and classifies. Actual model invocation depends on your provider setup (FUSION_API_KEY / FUSION_API_BASE). The skill also supports delegation to existing ZCode agents when MCP isn't available.
Do I need an OpenRouter account?
No. Any OpenAI-compatible endpoint works β just set FUSION_API_BASE.
Is it free? The plugin is MIT-licensed and free. Model provider costs apply per your own API usage.
Can I add my own models?
Yes β set any of the FUSION_MODEL_* env vars with a comma-separated list.
Will it work without the MCP server? Yes. The skill includes fallback delegation instructions so Fusion still adds value via skill-based routing.
Contributions are welcome! See CONTRIBUTING.md.
- Fork β branch β commit β PR
- Run
npm run typecheckbefore submitting - Never commit secrets β use env vars
MIT Β© 2026
β If Fusion makes your ZCode smarter, give the repo a star! β
Made with β€οΈ for the ZCode community