@alexeiled/pi-fusion 0.1.2 → 0.2.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/README.md CHANGED
@@ -4,19 +4,72 @@
4
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
5
  [![license](https://img.shields.io/badge/license-MIT-blue?style=flat-square)](./LICENSE)
6
6
 
7
- When a coding question deserves a design review, not a guess.
7
+ > Parallel panel. One judge. One report.
8
+
9
+ `pi-fusion` is a Pi extension for questions that need deliberation, not a guess.
10
+ It runs a small panel of read-only subagents in parallel, then asks a judge agent
11
+ to synthesize one final Markdown report.
12
+
13
+ ## Fusion model
14
+
15
+ My approach is simple:
16
+
17
+ - one hard question becomes a short review panel
18
+ - panelists work independently in parallel
19
+ - the judge reconciles evidence, not votes
20
+ - if the judge result is missing but the panel still produced enough signal,
21
+ Fusion retries only the judge step
22
+
23
+ This is evidence-first, not majority vote.
24
+ The judge is a synthesizer, not a tie-breaker by headcount.
25
+
26
+ ```mermaid
27
+ flowchart LR
28
+ classDef input fill:#f8fafc,stroke:#94a3b8,color:#0f172a,stroke-width:1px;
29
+ classDef panel fill:#e0f2fe,stroke:#38bdf8,color:#0f172a,stroke-width:1px;
30
+ classDef judge fill:#fef3c7,stroke:#f59e0b,color:#0f172a,stroke-width:1px;
31
+ classDef report fill:#dcfce7,stroke:#22c55e,color:#0f172a,stroke-width:1px;
32
+ classDef fallback fill:#fae8ff,stroke:#c084fc,color:#0f172a,stroke-width:1px,stroke-dasharray:4 3;
33
+
34
+ U[You in Pi]:::input --> Q[/fusion prompt/]:::input
35
+
36
+ subgraph P[Parallel panel]
37
+ direction LR
38
+ A[Architect]:::panel
39
+ I[Implementer]:::panel
40
+ T[Tester]:::panel
41
+ end
42
+
43
+ Q --> A
44
+ Q --> I
45
+ Q --> T
46
+ A --> J{{Judge}}:::judge
47
+ I --> J
48
+ T --> J
49
+ J --> R[Final Markdown report]:::report
50
+ J -. missing judge result .-> F[Fallback judge retry]:::fallback
51
+ F --> R
52
+ ```
53
+
54
+ ## How the judge works
55
+
56
+ The judge gets:
8
57
 
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.
58
+ - the original prompt
59
+ - the panel outputs
60
+ - the panel failures and blind spots
61
+ - the configured judge model
10
62
 
11
- You get:
63
+ It produces one report that highlights:
12
64
 
13
65
  - consensus
14
66
  - disagreements
15
- - blind spots
16
67
  - risks
17
- - recommended next step
68
+ - missing evidence
69
+ - next step
18
70
 
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.
71
+ It does not edit files or spawn more subagents. It does one job: turn
72
+ competing notes into one clear recommendation.
20
73
 
21
74
  ## Good fit
22
75
 
@@ -30,25 +83,17 @@ Use it for questions like:
30
83
 
31
84
  Do not use it for trivial edits, formatting, or obvious one-step fixes.
32
85
 
33
- ## How it works
86
+ ## Commands
34
87
 
35
88
  ```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.
89
+ /fusion
90
+ /fusion <prompt>
91
+ /fusion --profile <name> <prompt>
92
+ /fusion status
93
+ /fusion stop
94
+ /fusion init
41
95
  ```
42
96
 
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
97
  ## Quick start
53
98
 
54
99
  Requirements:
@@ -68,16 +113,7 @@ Then reload Pi:
68
113
  /reload
69
114
  ```
70
115
 
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
- ```
116
+ For full config examples and profile details, see [`docs/user-guide.md`](./docs/user-guide.md).
81
117
 
82
118
  ## Notes
83
119
 
@@ -85,6 +121,7 @@ Then reload Pi:
85
121
  - Config is optional. Defaults work. Use `/fusion init` when you want project config.
86
122
  - Project config lives at `.pi/fusion.json`. Global config lives at `~/.pi/agent/fusion.json`.
87
123
  - Output appears as a Pi custom message. Active progress also uses the `fusion` status key.
124
+ - Active runs are reconciled from `pi-subagents` lifecycle artifacts, not only completion events.
88
125
  - `pi-fusion` does not own the footer.
89
126
  - Prompts and inspected snippets may be sent to your configured model providers through `pi-subagents`.
90
127
 
@@ -7,9 +7,11 @@ Use this when the README is not enough.
7
7
  `pi-fusion` turns one hard question into a small review panel:
8
8
 
9
9
  ```text
10
- prompt → panelists in parallel → judge synthesis → final report
10
+ prompt → parallel panel → judge synthesis → final report
11
11
  ```
12
12
 
13
+ Normal execution is a single `pi-subagents` async chain. If that chain completes without a judge result but at least two panelists still produced usable answers, `pi-fusion` runs one fallback judge pass instead of losing the review.
14
+
13
15
  The base Pi session stays in control. Fusion is a tool for decisions, not a replacement for normal coding.
14
16
 
15
17
  ## Commands
@@ -30,7 +32,7 @@ Notes:
30
32
 
31
33
  - Bare `/fusion` shows a short help message.
32
34
  - `/fusion status` shows the active run, last run, warnings, and subagent run IDs.
33
- - `/fusion stop` stops the active panel or judge run.
35
+ - `/fusion stop` stops the active chain or fallback judge run.
34
36
  - `/fusion init` writes `.pi/fusion.json` for the current trusted project.
35
37
  - Exact one-word prompts `init`, `status`, and `stop` are reserved as `/fusion` subcommands.
36
38
 
@@ -250,3 +252,9 @@ Need the run IDs:
250
252
  ```text
251
253
  /fusion status
252
254
  ```
255
+
256
+ Notes:
257
+
258
+ - `Chain run` is the normal end-to-end Fusion run.
259
+ - `Fallback judge run` appears only when Fusion had enough panel output to recover a missing judge result.
260
+ - If `pi-subagents` completion notifications are delayed or missed, Fusion still reconciles from lifecycle artifacts written under the subagent async run directory.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexeiled/pi-fusion",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "description": "Subagent-native multi-model deliberation for Pi",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
package/src/index.ts CHANGED
@@ -29,6 +29,7 @@ export default function fusionExtension(pi: ExtensionAPI): void {
29
29
 
30
30
  pi.on("session_shutdown", () => {
31
31
  orchestrator.clearUi();
32
+ orchestrator.dispose();
32
33
  if (typeof unsubscribeComplete === "function") unsubscribeComplete();
33
34
  });
34
35
  }