โก Fusion Orchestration Guide
Fusion Mode is a multi-agent orchestration architecture that separates judgment and architecture (Lead) from mechanical implementation (Executor) across OpenCode, Amp, Pi, and Codex.
๐ก What is Fusion Orchestration?
When single AI agents work on complex tasks, they frequently mix planning, code editing, and self-verification. This often leads to context rot, premature edits, scope creep, and self-congratulatory claims of success without empirical verification.
Fusion Mode solves this by establishing a strict separation of concerns:
- Fusion Lead (Architect/Planner/Verifier): A high-reasoning, read-only agent. It inspects the codebase, resolves architecture choices, defines bounded contracts, delegates tasks, and independently verifies the output.
- Fusion Executor (Implementation Worker): A fast, targeted execution agent. It receives a bounded specification, loads required skills, edits only the specified files, runs unit tests/build checks, and reports results via a structured envelope.
โโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Fusion Lead โ
โ (Read-Only Planner) โ
โโโโโโโโโโโโโโฌโโโโโโโโโโโโโ
โ
1. Bounded Specification
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Fusion Executor โ
โ (Implementation Worker) โ
โโโโโโโโโโโโโโฌโโโโโโโโโโโโโ
โ
2. Structured Envelope
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Fusion Lead โ
โ (Independent Gatekeeper)โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ฏ When to Use vs. When NOT to Use
| Scenario | Use Fusion Mode? | Rationale |
|---|---|---|
| Multi-file feature implementation | โ Yes | Benefit from separate planning, bounded file edits, and independent verification. |
| Complex architectural refactoring | โ Yes | Prevents broken contracts and broad unguided code mutations. |
| Tasks needing strict verification | โ Yes | Lead independently verifies diffs and test results before acceptance. |
| Trivial 1-line typo / import fix | โ No | Too much overhead. Keep in standard writable session. |
| Single-file mechanical update | โ No | Single agent is faster and more direct. |
| Exploratory Q&A / Code discovery | โ No | Standard read-only session is sufficient. |
๐ ๏ธ Tool-by-Tool Implementations
Native Fusion integration is available across multiple AI coding tools in this repository:
1. OpenCode
- Primary Agent:
fusion-lead - Behavior: Read-only primary session (
permissionblocks restrict file writes and shell execution). Delegates implementation tofusion-executorvia subagents.
2. Amp
- Agent Mode:
fusion - Behavior: Exposes
fusion_executortool to plugin-authorized lead threads.
3. Pi Agent
- Execution Pattern: Sibling delegation from the root session.
- Behavior: Root session calls
fusion-leadfor specification, then passes the specification to siblingfusion-executor. (pi-subagentsenforces tool allowlists and isolates child sessions). - Note: Pi executor requires skills under project-local directories (e.g.
.agents/skills/...).
4. Codex
- Execution Pattern: Sibling delegation.
- Behavior: Root session invokes
fusion-leadfor plan and specification, then executes siblingfusion-executorwith bounded file permissions.
๐ The Handoff Contract & Envelope Protocol
Communication between Lead and Executor is governed by strict, structured contracts:
1. Lead-to-Executor Specification Contract
The Lead produces a spec with exact boundaries:
OBJECTIVE: <Clear goal statement>
FILES: <Exact list of target file paths to create/modify>
INTERFACES: <Public signatures, types, or API contracts to satisfy>
CONSTRAINTS: <Style rules, forbidden modifications, backward-compatibility requirements>
SKILLS: <Exact filesystem paths to relevant SKILL.md files to load>
VERIFICATION: <Specific test suite or build commands to execute>
2. Executor-to-Lead Return Envelope Contract
Upon completing implementation, the Executor returns a structured summary:
STATUS: SUCCESS | VERIFICATION_FAILED | BLOCKED
EXECUTIVE SUMMARY: <High-level narrative of what was done>
CHANGES: <Summary of modified files and functions>
VERIFIED: <Passed check commands and output summary>
SKILLS LOADED: <List of SKILL.md paths actually read>
RISKS: <Potential edge cases or follow-up items>
QUESTIONS: <Blockers requiring user input>
NEXT RECOMMENDED: <Suggested next steps>
KEY LEARNINGS: <Domain insights discovered during implementation>
3. Verification & Approval Rules
- Direct Checks: Read-only checks and standard unit tests run directly inside the executor when permitted by sandbox policy.
- Verification Required: If a check cannot run inside the executor due to permission or lifecycle limits, the executor marks it as
VERIFICATION REQUIREDwith the exact command string. - No Self-Proclamation: Neither Lead nor Executor may mark a task as "Passed" without empirical command output.
๐ Step-by-Step Walkthrough Example
Example Workflow: Adding a New Plugin Endpoint
Step 1: Lead Investigation User asks to add a new authentication endpoint.
fusion-leadinspectsconfigs/and existing route definitions.Step 2: Specification Hand-off
fusion-leadissues a bounded specification:OBJECTIVE: Add JWT validation helper in lib/auth.ts FILES: lib/auth.ts, tests/auth.test.ts INTERFACES: export function validateJwt(token: string): AuthPayload CONSTRAINTS: Must use existing jwt-verify library, no extra external deps SKILLS: skills/tdd/SKILL.md VERIFICATION: bun test tests/auth.test.tsStep 3: Executor Implementation
fusion-executorloadsskills/tdd/SKILL.md, implementslib/auth.ts, writes unit tests intests/auth.test.ts, and runsbun test tests/auth.test.ts.Step 4: Envelope Return & Independent Lead Verification
fusion-executorreturns theSTATUS: SUCCESSenvelope.fusion-leadreviews the git diff and test output. If clean,fusion-leadaccepts the result and presents it to the user.
๐ Troubleshooting & Gotchas
- Max 2 Correction Attempts: If
fusion-executorfails verification,fusion-leadsends 1 targeted correction specification. If it fails a second time, execution halts to present evidence to the user rather than entering an infinite loop. - No Unsafe Fallbacks: If
fusion-executoris unavailable or fails to spawn,fusion-leadmust not silently make file edits itself. It will inform the user and request switching to standard mode. - Pi Skill Paths: On Pi, child subagents cannot read outside the project workspace. Place required custom skills in
.agents/skills/within the repository.