npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

pi-moa

v0.3.2

Published

Mixture of Agents for pi: run multiple high-intelligence reference models in parallel, then synthesize with a main model that keeps full conversation context.

Readme

pi-moa

English · Gitee 仓库 · npm

面向 pi 的 Mixture of Agents(MOA)扩展,以斜杠命令的形式复刻 Nous Research Hermes Agent 的 MOA 工作流。

  • 1–3 个高智能参考模型并行运行,每个模型只看到单轮上下文(无工具、无 system prompt)。
  • 1 个主模型接收带标签的参考意见 + 完整对话历史,正常作答并可使用工具。 默认就是当前界面选择的模型;也可以选择固定一个聚合器。
  • 模型与鉴权复用 pi 已有配置——配置文件只存 provider/model 标识,绝不存 API 密钥。
  • 可选自动模式(/moa-auto):开启后,你输入的每一条消息都会自动走 MOA 流程,无需再每次打 /moa。

MOA 做了什么

一次 /moa <prompt> 分两个阶段:

  1. 参考 fan-out。 每个参考模型(1–3 个)拿到单轮上下文——仅当前这条 用户消息(多轮会话时附带一段简短的对话总结)。无工具、无 system prompt、 无历史。它们各自独立、并行作答。
  2. 聚合。 主模型收到所有参考回答(按来源标注)+ 完整对话历史,产出 最终回复——与普通轮次一样,可正常使用工具。

主模型默认跟随你当前界面选择的模型;配置 aggregator 可固定一个。

能带来什么

  • 交叉校验单一模型的盲区。 相互独立的模型给出互补或冲突的第一轮意见, 这比单个模型单独推理提供了更强的信号。
  • 难题或模棱两可的问题更稳健。 多角度交叉可降低单个模型「自信但错误」 的概率。
  • 无需手动获取第二意见。 不必把同一个 prompt 复制到多个对话里——一条 命令自动 fan-out 并收敛。
  • 零额外配置。 参考模型复用 pi 里已配置的模型;配置文件只存 provider/model 标识,绝不存密钥。

安装

pi install npm:pi-moa
# 或开发期从本地路径安装
pi install ./moa
# 或手动复制到 ~/.pi/agent/extensions/ + ~/.pi/agent/skills/

首次在交互终端运行 /moa 会进入引导向导(选 1–3 个参考模型;主模型默认 跟随当前界面模型,除非你选择固定一个)。配置写入 ~/.pi/agent/moa.json。

用法

/moa <prompt>             用默认预设运行一次 MOA
/moa                      显示用法 + 配置摘要(未配置时进入向导)
/moa list                 列出所有预设
/moa configure [名称]     交互式创建/编辑(默认 "default")
/moa delete <名称>        删除一个预设
/moa status               显示配置与当前模型
/moa set-main <p>/<m>     设置固定主输出模型(默认跟随界面模型)
/moa-auto                 切换自动模式(每条消息都走 MOA)

配置

{
  "default_preset": "default",
  "presets": {
    "default": {
      "reference_models": [
        { "provider": "anthropic", "model": "claude-sonnet-4-5", "reasoning_effort": "low" },
        { "provider": "openrouter", "model": "deepseek/deepseek-v3.1" }
      ],
      "aggregator": { "provider": "anthropic", "model": "claude-opus-4-5" },
      "reference_max_tokens": 4000,
      "max_tokens": 4096
    }
  }
}

aggregator 字段是可选的。省略时,MOA 直接把当前界面模型作为主输出模型 (不切换、不恢复);只有想固定一个主模型(不随界面变化)时才需要设置它。

其余每个预设的可选字段:reference_temperature、 reasoning_effort(每个参考槽位)、max_tokens(v1 保留未启用——主模型的 token 预算由 pi 管理)。

行为说明与限制(v0.3.2)

  • 主模型跟随界面。 默认情况下主输出模型就是当前界面模型(ctx.model), 不切换、不恢复。只有配置了固定 aggregator 时,MOA 才会临时切换并在 结束后恢复。
  • 自动模式。 /moa-auto 切换一个持久的「每条消息都走 MOA」状态。它通过 pi 的 input 事件,同时拦截 TUI(source === "interactive")与 pi-web 等 web/RPC 界面(source === "rpc")的输入,在 agent 循环前把普通输入改写 成 MOA 消息。斜杠命令与 /moa 内部 sendUserMessage (source === "extension")不受影响,因此不会双重 fan-out。开启时状态栏 显示 MOA 自动:开。
  • 可滚动选择器。 配置向导使用可滚动的 SelectList(最多显示 10 项 + (n/总数) 指示器)而非 ctx.ui.select,模型列表再长也不会撑爆窗口。
  • 对话总结(多轮)。 会话已有历史时,/moa 会先让主模型总结 「我们在做什么」(100–200 字),再把总结提供给参考模型,而非只给用户 当前一句话。总结失败则降级为仅用用户 prompt。
  • 一次性语义(fanout: user_turn)。参考模型每次 /moa 只跑一次, 不会在工具循环中反复调用。
  • 模型恢复。 配置了固定 aggregator 时,/moa 前的模型会在 agent_settled 时恢复;MOA 期间排队的后续步骤仍会在聚合器上跑完再恢复。
  • 失败处理。 单个参考模型失败会内联标注并继续;若全部失败,/moa 会在运行主模型前中止。
  • 无隐私过滤。 参考输出原样注入主模型(未实现 Hermes 的 privacy_filter)。
  • 无界面/print 模式。 无法运行向导;请先在交互模式跑一次 /moa,或 手动编辑 ~/.pi/agent/moa.json。
  • prompt-cache 交互(U8)与并发写 moa.json 时的文件锁在 v1 中 未处理。