pi-twins
v0.4.2
Published
Dual-model synthesis for Pi — run the same prompt on two models, get one synthesized answer
Downloads
550
Maintainers
Readme
pi-twins
Run the same prompt on two models, get one synthesized answer.
What this is
pi-twins sends your prompt to two AI models in parallel, then Pi itself reads both responses and synthesizes a single answer from the best parts. Configure model pairs via YAML. No more manually tabbing between chatbot UIs to compare answers.
Features
- Dual-model execution — run the same prompt on two models simultaneously
- Automatic synthesis — Pi reads both responses and produces one unified answer
- Synthesis language — choose Japanese or English for the final answer (Japanese by default)
- Synthesis controls — choose balanced, decision, critique, or concise final-answer modes with optional instructions
- YAML configuration — define model pairs (e.g. Claude + Gemini) in
~/.pi/twins.yaml - Model discovery —
/twins:scanto see which models are available - On-demand only — activate via
/twins:runwhen you want it, no overhead otherwise
Install
Install the published npm package with Pi:
pi install npm:pi-twinsPin a specific version:
pi install npm:[email protected]Install into the current project instead of your user Pi settings:
pi install npm:pi-twins -lOr install from GitHub:
pi install git:github.com/eiei114/pi-twinsTry it without permanently installing:
pi -e npm:pi-twinsQuick start
Try this package locally:
pi -e .Then run:
/twins:runEnter a prompt when asked. Pi runs both models in parallel and synthesizes one answer.
Configuration
Create ~/.pi/twins.yaml:
pairs:
default:
- anthropic/claude-sonnet-4
- google/gemini-2.5-pro
coding:
- anthropic/claude-sonnet-4
- openai/gpt-4o
# Optional: language accepts ja or en; it defaults to ja. Omit synthesis to use
# Japanese synthesis and the balanced mode.
synthesis:
language: en # ja | en
mode: decision # balanced | decision | critique | concise
instructions: "Prioritize concrete next steps."synthesis.language accepts ja or en and defaults to Japanese when omitted. /twins:run uses the configured language without prompting. The optional top-level synthesis block sets reusable defaults for the final answer; existing configs with only pairs: keep Japanese, balanced synthesis. /twins:run uses the default pair when present. If default is missing and multiple pairs are configured, it prompts you to choose one; with a single pair, that pair is used automatically.
Run /twins:config to create a starter file, or /twins:scan to list model IDs.
Commands
| Command | Description |
|---|---|
| /twins:run | Send the same prompt to two models and synthesize one answer |
| /twins:scan | List available model IDs for ~/.pi/twins.yaml |
| /twins:config | Create or show the pi-twins config file |
The twins_run tool is also available for agent-driven twin runs. Tool calls may override synthesis defaults per request:
{
"prompt": "Choose the safest rollout plan for this migration",
"pair": "default",
"synthesisLanguage": "en",
"synthesisMode": "decision",
"synthesisInstructions": "Call out rollback risks explicitly."
}For one twins_run call, synthesisLanguage accepts ja or en and overrides synthesis.language; when neither is set, the final answer is Japanese.
Package contents
| Path | Purpose |
|---|---|
| extensions/ | Pi extension entrypoints (/twins:* commands, twins_run tool) |
| lib/ | Config loader, model scanner, parallel runner, synthesis helpers |
| docs/ | Usage examples, troubleshooting, and release notes |
Development
npm install
npm run cinpm run ci runs typecheck, tests, and npm pack --dry-run via pack:check.
Local smoke test:
pi -e .Release
This package uses npm Trusted Publishing (no NPM_TOKEN required).
npm version patch # or minor / major
git pushAfter a version bump reaches main, an authorized release owner must manually run the Release (manual) workflow. Merging a PR does not create a tag or release and does not publish to npm.
See docs/release.md for setup details.
Docs
docs/examples.md— command and tool examplesdocs/troubleshooting.md— common errors and fixesdocs/release.md— Trusted Publishing details
Security
Pi packages can execute code with your local permissions. Review extensions before installing third-party packages.
For vulnerability reporting, see SECURITY.md.
Links
- npm: https://www.npmjs.com/package/pi-twins
- GitHub: https://github.com/eiei114/pi-twins
- Issues: https://github.com/eiei114/pi-twins/issues
License
MIT
