@alexeiled/pi-fusion 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/AGENTS.md ADDED
@@ -0,0 +1,7 @@
1
+ # Contributor notes
2
+
3
+ - Keep the extension small, typed, and testable.
4
+ - Do not own or replace the Pi footer. Publish only the `fusion` status key.
5
+ - Use `pi-subagents` RPC for panel and judge execution. Do not import its internals.
6
+ - Keep bundled panel agents read-only by default.
7
+ - Do not add runtime dependencies unless the task needs them.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Alexei Ledenev
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,94 @@
1
+ # pi-fusion
2
+
3
+ [![npm](https://img.shields.io/badge/npm-%40alexeiled%2Fpi--fusion-cb3837?style=flat-square&logo=npm&logoColor=white)](https://www.npmjs.com/package/@alexeiled/pi-fusion)
4
+ [![node](https://img.shields.io/badge/node-%3E%3D22.19.0-5fa04e?style=flat-square&logo=node.js&logoColor=white)](https://nodejs.org/)
5
+ [![license](https://img.shields.io/badge/license-MIT-blue?style=flat-square)](./LICENSE)
6
+
7
+ When a coding question deserves a design review, not a guess.
8
+
9
+ `pi-fusion` is a Pi extension that runs a small panel of read-only subagents in parallel, then asks a judge agent to synthesize one final report.
10
+
11
+ You get:
12
+
13
+ - consensus
14
+ - disagreements
15
+ - blind spots
16
+ - risks
17
+ - recommended next step
18
+
19
+ It applies the [Fusion](https://openrouter.ai/blog/announcements/fusion-beats-frontier/) idea to Pi: spend extra tokens only on questions where multiple perspectives are worth it.
20
+
21
+ ## Good fit
22
+
23
+ Use it for questions like:
24
+
25
+ - Which design should we choose?
26
+ - What will break if I change this?
27
+ - Is this PR or release flow safe?
28
+ - What did I miss?
29
+ - What is the right test strategy here?
30
+
31
+ Do not use it for trivial edits, formatting, or obvious one-step fixes.
32
+
33
+ ## How it works
34
+
35
+ ```text
36
+ /fusion Should this extension use node:test or Vitest?
37
+
38
+ 1. Panelists inspect the problem independently.
39
+ 2. The judge compares their answers.
40
+ 3. Pi shows one final Markdown report.
41
+ ```
42
+
43
+ Default roles:
44
+
45
+ - **Architect** — tradeoffs and failure modes
46
+ - **Implementer** — contracts, edge cases, practical fit
47
+ - **Tester** — regressions and verification
48
+ - **Judge** — synthesis and recommendation
49
+
50
+ Bundled agents are read-only by default. They can inspect files, but they do not edit code, commit changes, or run nested subagents.
51
+
52
+ ## Quick start
53
+
54
+ Requirements:
55
+
56
+ - Pi
57
+ - Node.js 22.19+
58
+ - `pi-subagents`
59
+
60
+ ```bash
61
+ pi install npm:pi-subagents
62
+ pi install npm:@alexeiled/pi-fusion
63
+ ```
64
+
65
+ Then reload Pi:
66
+
67
+ ```text
68
+ /reload
69
+ ```
70
+
71
+ ## Commands
72
+
73
+ ```text
74
+ /fusion
75
+ /fusion <prompt>
76
+ /fusion --profile <name> <prompt>
77
+ /fusion status
78
+ /fusion stop
79
+ /fusion init
80
+ ```
81
+
82
+ ## Notes
83
+
84
+ - Bare `/fusion` shows a short command summary.
85
+ - Config is optional. Defaults work. Use `/fusion init` when you want project config.
86
+ - Project config lives at `.pi/fusion.json`. Global config lives at `~/.pi/agent/fusion.json`.
87
+ - Output appears as a Pi custom message. Active progress also uses the `fusion` status key.
88
+ - `pi-fusion` does not own the footer.
89
+ - Prompts and inspected snippets may be sent to your configured model providers through `pi-subagents`.
90
+
91
+ ## Read more
92
+
93
+ - [`docs/user-guide.md`](./docs/user-guide.md) — commands, config, profiles, privacy, troubleshooting
94
+ - [`DEVELOPMENT.md`](./DEVELOPMENT.md) — contributor workflow
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: fusion-judge
3
+ package: pi-fusion
4
+ description: Judge and synthesizer for pi-fusion panel outputs.
5
+ tools: read, grep, find, ls
6
+ systemPromptMode: replace
7
+ inheritProjectContext: true
8
+ inheritSkills: false
9
+ defaultContext: fresh
10
+ completionGuard: false
11
+ ---
12
+
13
+ You are the pi-fusion judge.
14
+
15
+ Compare panel outputs. Do not invent consensus. Preserve disagreements. Prefer the smallest realistic recommendation.
16
+ Do not edit files. Do not ask other agents. Do not run subagents.
17
+
18
+ Return final Markdown with these sections:
19
+
20
+ # Fusion Report
21
+
22
+ ## Summary
23
+
24
+ ## Agent Status
25
+
26
+ ## Consensus
27
+
28
+ ## Disagreements
29
+
30
+ ## Unique Insights
31
+
32
+ ## Blind Spots
33
+
34
+ ## Recommendation
35
+
36
+ ## Risks
37
+
38
+ ## Next Step
@@ -0,0 +1,30 @@
1
+ ---
2
+ name: fusion-panelist
3
+ package: pi-fusion
4
+ description: Independent read-only panel member for pi-fusion deliberation.
5
+ tools: read, grep, find, ls
6
+ systemPromptMode: replace
7
+ inheritProjectContext: true
8
+ inheritSkills: false
9
+ defaultContext: fresh
10
+ completionGuard: false
11
+ ---
12
+
13
+ You are a pi-fusion panelist.
14
+
15
+ Work independently. Inspect relevant local files when the task needs code evidence.
16
+ Do not edit files. Do not ask other agents. Do not run subagents.
17
+
18
+ Return concise Markdown with these sections:
19
+
20
+ ## Summary
21
+
22
+ ## Recommendation
23
+
24
+ ## Evidence
25
+
26
+ ## Risks
27
+
28
+ ## Confidence
29
+
30
+ ## Open Questions
@@ -0,0 +1,252 @@
1
+ # pi-fusion user guide
2
+
3
+ Use this when the README is not enough.
4
+
5
+ ## Mental model
6
+
7
+ `pi-fusion` turns one hard question into a small review panel:
8
+
9
+ ```text
10
+ prompt → panelists in parallel → judge synthesis → final report
11
+ ```
12
+
13
+ The base Pi session stays in control. Fusion is a tool for decisions, not a replacement for normal coding.
14
+
15
+ ## Commands
16
+
17
+ Preferred command shape:
18
+
19
+ ```text
20
+ /fusion
21
+ /fusion <prompt>
22
+ /fusion --profile <name> <prompt>
23
+ /fusion -p <name> <prompt>
24
+ /fusion status
25
+ /fusion stop
26
+ /fusion init
27
+ ```
28
+
29
+ Notes:
30
+
31
+ - Bare `/fusion` shows a short help message.
32
+ - `/fusion status` shows the active run, last run, warnings, and subagent run IDs.
33
+ - `/fusion stop` stops the active panel or judge run.
34
+ - `/fusion init` writes `.pi/fusion.json` for the current trusted project.
35
+ - Exact one-word prompts `init`, `status`, and `stop` are reserved as `/fusion` subcommands.
36
+
37
+ ## Configuration files
38
+
39
+ Config lookup order:
40
+
41
+ 1. trusted project config: `.pi/fusion.json`
42
+ 2. global config: `~/.pi/agent/fusion.json`
43
+ 3. built-in defaults
44
+
45
+ Run this inside a trusted project:
46
+
47
+ ```text
48
+ /fusion init
49
+ ```
50
+
51
+ ## Minimal config
52
+
53
+ ```json
54
+ {
55
+ "defaultProfile": "quality",
56
+ "profiles": {
57
+ "quality": {
58
+ "panel": [
59
+ {
60
+ "id": "architect",
61
+ "label": "Architect",
62
+ "agent": "pi-fusion.fusion-panelist",
63
+ "role": "architecture, tradeoffs, and failure modes"
64
+ },
65
+ {
66
+ "id": "implementer",
67
+ "label": "Implementer",
68
+ "agent": "pi-fusion.fusion-panelist",
69
+ "role": "implementation details, API contracts, and edge cases"
70
+ },
71
+ {
72
+ "id": "tester",
73
+ "label": "Tester",
74
+ "agent": "pi-fusion.fusion-panelist",
75
+ "role": "test strategy, regressions, and verification"
76
+ }
77
+ ],
78
+ "judge": {
79
+ "agent": "pi-fusion.fusion-judge"
80
+ },
81
+ "concurrency": 3,
82
+ "timeoutMs": 300000,
83
+ "context": "fresh"
84
+ }
85
+ }
86
+ }
87
+ ```
88
+
89
+ ## Profile fields
90
+
91
+ Top level:
92
+
93
+ - `defaultProfile`: profile used when `/fusion` has no `--profile`
94
+ - `profiles`: named profile map
95
+
96
+ Profile:
97
+
98
+ - `panel`: one or more panel members
99
+ - `judge`: judge agent config
100
+ - `concurrency`: max parallel panelists
101
+ - `timeoutMs`: async subagent timeout in milliseconds
102
+ - `context`: `fresh` or `fork`
103
+
104
+ Panel member:
105
+
106
+ - `id`: stable machine name
107
+ - `label`: human-readable report label
108
+ - `agent`: subagent name
109
+ - `model`: optional model override
110
+ - `thinking`: optional `off`, `minimal`, `low`, `medium`, `high`, or `xhigh`
111
+ - `role`: short perspective instruction
112
+
113
+ Judge:
114
+
115
+ - `agent`: judge subagent name
116
+ - `model`: optional model override
117
+ - `thinking`: optional thinking level
118
+
119
+ ## Example profiles
120
+
121
+ Fast and cheap:
122
+
123
+ ```json
124
+ {
125
+ "defaultProfile": "fast",
126
+ "profiles": {
127
+ "fast": {
128
+ "panel": [
129
+ {
130
+ "id": "reviewer",
131
+ "label": "Reviewer",
132
+ "agent": "pi-fusion.fusion-panelist",
133
+ "thinking": "low",
134
+ "role": "practical risks and next step"
135
+ }
136
+ ],
137
+ "judge": {
138
+ "agent": "pi-fusion.fusion-judge",
139
+ "thinking": "low"
140
+ },
141
+ "concurrency": 1,
142
+ "timeoutMs": 120000,
143
+ "context": "fresh"
144
+ }
145
+ }
146
+ }
147
+ ```
148
+
149
+ Deliberate review:
150
+
151
+ ```json
152
+ {
153
+ "defaultProfile": "quality",
154
+ "profiles": {
155
+ "quality": {
156
+ "panel": [
157
+ {
158
+ "id": "architect",
159
+ "label": "Architect",
160
+ "agent": "pi-fusion.fusion-panelist",
161
+ "model": "anthropic/claude-sonnet-4",
162
+ "thinking": "high",
163
+ "role": "architecture and failure modes"
164
+ },
165
+ {
166
+ "id": "tester",
167
+ "label": "Tester",
168
+ "agent": "pi-fusion.fusion-panelist",
169
+ "model": "openai/gpt-5.5",
170
+ "thinking": "medium",
171
+ "role": "tests, regressions, and observability"
172
+ }
173
+ ],
174
+ "judge": {
175
+ "agent": "pi-fusion.fusion-judge",
176
+ "model": "anthropic/claude-sonnet-4",
177
+ "thinking": "high"
178
+ },
179
+ "concurrency": 2,
180
+ "timeoutMs": 300000,
181
+ "context": "fresh"
182
+ }
183
+ }
184
+ }
185
+ ```
186
+
187
+ ## Output
188
+
189
+ Panelists return:
190
+
191
+ - summary
192
+ - recommendation
193
+ - evidence
194
+ - risks
195
+ - confidence
196
+ - open questions
197
+
198
+ The judge returns:
199
+
200
+ - summary
201
+ - agent status
202
+ - consensus
203
+ - disagreements
204
+ - unique insights
205
+ - blind spots
206
+ - recommendation
207
+ - risks
208
+ - next step
209
+
210
+ ## Status and footer integration
211
+
212
+ `pi-fusion` uses only the Pi status key `fusion` while a run is active.
213
+
214
+ It does not own the footer. If you use a footer extension, configure it to read the `fusion` status key.
215
+
216
+ ## Privacy and provider use
217
+
218
+ Fusion sends work to `pi-subagents`. Those subagents use your configured Pi model providers.
219
+
220
+ Data that may leave your machine:
221
+
222
+ - the prompt you pass to `/fusion`
223
+ - relevant local file snippets read by panelists or the judge
224
+ - panel outputs sent to the judge
225
+
226
+ Default bundled agents are read-only, but model providers still receive the context needed to answer.
227
+
228
+ ## Troubleshooting
229
+
230
+ `pi-subagents RPC is unavailable`
231
+
232
+ - install `pi-subagents`
233
+ - reload Pi
234
+ - retry `/fusion status`
235
+
236
+ `Unknown fusion profile`
237
+
238
+ - check `defaultProfile`
239
+ - check the requested `--profile` name
240
+ - run `/fusion init` to regenerate a known-good template
241
+
242
+ Run is stuck or no longer useful:
243
+
244
+ ```text
245
+ /fusion stop
246
+ ```
247
+
248
+ Need the run IDs:
249
+
250
+ ```text
251
+ /fusion status
252
+ ```
package/package.json ADDED
@@ -0,0 +1,74 @@
1
+ {
2
+ "name": "@alexeiled/pi-fusion",
3
+ "version": "0.1.0",
4
+ "description": "Subagent-native multi-model deliberation for Pi",
5
+ "type": "module",
6
+ "main": "./src/index.ts",
7
+ "license": "MIT",
8
+ "publishConfig": {
9
+ "access": "public"
10
+ },
11
+ "engines": {
12
+ "node": ">=22.19.0"
13
+ },
14
+ "keywords": [
15
+ "pi-package",
16
+ "pi-extension",
17
+ "pi-subagents",
18
+ "fusion",
19
+ "multi-agent",
20
+ "multi-model"
21
+ ],
22
+ "files": [
23
+ "agents/*.md",
24
+ "src/*.ts",
25
+ "README.md",
26
+ "LICENSE",
27
+ "AGENTS.md",
28
+ "docs/user-guide.md",
29
+ "tsconfig.json"
30
+ ],
31
+ "scripts": {
32
+ "check": "tsc --noEmit",
33
+ "test": "npm run test:unit",
34
+ "test:unit": "node --import jiti/register --test test/unit/*.test.ts",
35
+ "test:integration": "node --import jiti/register --test test/integration/*.test.ts",
36
+ "test:e2e": "node --import jiti/register --test test/e2e/*.test.ts",
37
+ "pack:dry": "npm pack --dry-run",
38
+ "publish:dry": "npm publish --dry-run",
39
+ "lint": "eslint . --cache --cache-strategy content",
40
+ "test:all": "npm run lint && npm run check && npm run test:unit && npm run test:integration && npm run test:e2e && npm run pack:dry"
41
+ },
42
+ "pi": {
43
+ "extensions": [
44
+ "./src/index.ts"
45
+ ],
46
+ "subagents": {
47
+ "agents": [
48
+ "./agents"
49
+ ]
50
+ }
51
+ },
52
+ "peerDependencies": {
53
+ "@earendil-works/pi-coding-agent": "*",
54
+ "@earendil-works/pi-tui": "*",
55
+ "typebox": "*"
56
+ },
57
+ "devDependencies": {
58
+ "@eslint/js": "^10.0.1",
59
+ "eslint": "^10.6.0",
60
+ "globals": "^17.7.0",
61
+ "jiti": "^2.7.0",
62
+ "typescript": "^6.0.3",
63
+ "typescript-eslint": "^8.62.1"
64
+ },
65
+ "packageManager": "npm@11.18.0",
66
+ "repository": {
67
+ "type": "git",
68
+ "url": "git+https://github.com/alexei-led/pi-fusion.git"
69
+ },
70
+ "homepage": "https://github.com/alexei-led/pi-fusion#readme",
71
+ "bugs": {
72
+ "url": "https://github.com/alexei-led/pi-fusion/issues"
73
+ }
74
+ }