@quarkos/pi-fusion
Multi-model deliberation harness (OpenRouter Fusion pattern) for OpenCode Go
Package details
Install @quarkos/pi-fusion from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@quarkos/pi-fusion- Package
@quarkos/pi-fusion- Version
1.0.1- Published
- Jun 15, 2026
- Downloads
- not available
- Author
- quarkos
- License
- MIT
- Types
- package
- Size
- 45.9 KB
- Dependencies
- 3 dependencies · 0 peers
Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
Pi Fusion
Pi Fusion is an orchestration harness and agent extension that implements a multi-model deliberation pipeline. Inspired by the OpenRouter Fusion design pattern, it takes any complex technical request or coding query and runs it through a three-tier process: parallel expert panels, a structured comparative analysis, and a final grounded synthesis.
It is written in Node.js with native ES Modules, requires no build steps, and features out-of-the-box configuration for OpenCode Go subscription models.
How It Works
The deliberation pipeline consists of three sequential stages:
[User Query]
|
+-------------+-------------+
| | |
v v v
[Technical] [Devil's] [Systems] Tier 1: Parallel Panel
[Expert] [Advocate] [Thinker] (System Prompt Personas)
| | |
+-------------+-------------+
|
v
[Deliberation] Tier 2: Judge
[Judge] (Structured JSON output)
|
v
[Synthesis] Tier 3: Synthesis
[Model] (Grounded final answer)
|
v
[Final Answer]
Tier 1: Panel (Parallel Execution)
The user query is sent to three separate expert models in parallel:
- Technical Expert (
qwen3.7-plus): Evaluates correctness, architectural patterns, performance, and security. - Devil's Advocate (
deepseek-v4-pro): Challenges assumptions, identifies edge cases, highlights risks, and evaluates simpler alternatives. - Systems Thinker (
glm-5.1): Focuses on integration, API design, testing strategies, long-term technical debt, and maintainability.
Tier 2: Judge (Deliberative Analysis)
A comparison model (qwen3.7-plus) reviews the panel responses to find agreements and conflicts. It produces a structured JSON output with five keys:
consensus: Core technical decisions where the experts agree.contradictions: Specific design conflicts or tradeoffs.partial_coverage: Points raised by some but not all models.unique_insights: Non-obvious optimizations or approaches.blind_spots: Critical omissions or risks that none of the models addressed.
Tier 3: Synthesis (Final Grounded Answer)
A final model (qwen3.7-plus) synthesizes the user query, the panel responses, and the Judge's structured JSON analysis into a comprehensive markdown answer.
Configuration and Setup
Install dependencies in your project directory:
npm installSet your OpenCode Go API key:
- Windows (PowerShell):
$env:OC_GO_CC_API_KEY="sk-opencode-..." - Linux/macOS:
export OC_GO_CC_API_KEY="sk-opencode-..."
- Windows (PowerShell):
If no OpenCode Go key is found, the client looks for a standard OPENAI_API_KEY and falls back to standard OpenAI endpoints.
Command Line Usage
You can run Pi Fusion directly as a command-line tool.
Direct Run
Submit a query from the terminal:
node bin/pi-harness.js "Explain the tradeoffs between microservices and monoliths"
Verbose Mode
Use the --verbose or -v flag to inspect the individual panel responses:
node bin/pi-harness.js "Write a thread-safe singleton pattern in Go" --verbose
Interactive Mode (REPL)
Launch a persistent chat session to run multiple queries:
node bin/pi-harness.js --interactive
Model Overrides
You can override default models for any tier using the --models flag:
node bin/pi-harness.js "Test query" --models "technical_expert=deepseek-v4-pro,judge=glm-5.1"
Installing as a Pi Agent Extension
Pi Fusion is designed to be fully compatible with the Pi Coding Agent (pi.dev). When installed, it adds a /fusion command and a deliberate tool to the agent.
Install the extension from GitHub:
pi install git:github.com/QuarkOS/Pi-Fusion.git
Or install it locally from your project folder:
pi install .
Registered Features inside Pi:
- Slash Command:
/fusion <prompt>— Runs the multi-model deliberation pipeline directly in your Pi terminal session. - Agent Tool:
deliberate— Allows the Pi Coding Agent to call this deliberation process programmatically when solving complex coding problems.