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

opencode-empire

v0.5.1

Published

OpenCode imperial multi-agent orchestration plugin.

Readme

opencode-empire

opencode-empire 是一个 OpenCode 插件,用于提供带有"司礼监/内阁/六部"风格的多 agent 编排体验。

启动后默认选中司礼监(empire-eunuch)。日常任务司礼监直接处理或以【传旨】形式向六部及内阁派单;需要廷议时切换至内阁(empire-cabinet)。

Agents

| Agent | 可见 | 模式 | 职责 | | --- | --- | --- | --- | | empire-eunuch | 是 | primary | 司礼监:日常主 agent。日常问答与简单任务直办,以传旨向六部/内阁派单;需廷议时建议切换内阁 | | empire-cabinet | 是 | all | 内阁:主/子代理。主代理负责票拟、廷议、发部、复奏。子代理被司礼监传旨调用直出票拟 | | empire-grand-secretary-a | 否 | subagent | 隐藏大学士,负责独立审议 | | empire-grand-secretary-b | 否 | subagent | 隐藏大学士,负责独立审议 | | empire-grand-secretary-c | 否 | subagent | 隐藏大学士,负责独立审议 | | empire-ministry-personnel | 是 | subagent | 吏部:执行方案 | | empire-ministry-revenue | 是 | subagent | 户部:代码探索 | | empire-ministry-rites | 是 | subagent | 礼部:方案审核与交互文案 | | empire-ministry-war | 是 | subagent | 兵部:执行流程与自动化 | | empire-ministry-justice | 是 | subagent | 刑部:代码审查与测试把关 | | empire-ministry-works | 是 | subagent | 工部:代码实现 |

Command

  • /廷议:请三位隐藏大学士独立审议(需在 empire-cabinet 主代理下使用)。

Installation

npx --yes opencode-empire install

安装器会创建:

  • ~/.config/opencode/opencode-empire.json:插件专属配置,用于设置模型、语气、禁用角色等。
  • ~/.config/opencode/opencode.json:OpenCode 全局配置。安装器只会确保其中包含 "opencode-empire" 插件,不会覆盖已有字段。

保存后需要重启 OpenCode,运行中的会话不会热加载新配置。

Configuration

编辑:

~/.config/opencode/opencode-empire.json

示例:

{
  "$schema": "https://unpkg.com/opencode-empire@latest/opencode-empire.schema.json",
  "tone": "medium",
  "requireDispatchApproval": true,
  "agents": {
    "empire-cabinet": {
      "model": "cockpit/gpt-5.5",
      "options": { "reasoningEffort": "high" }
    },
    "empire-ministry-works": {
      "model": "cockpit/gpt-5.5",
      "options": { "reasoningEffort": "high" }
    }
  },
  "disabledRoles": []
}

权限示例(默认全部为 allow,以下演示收紧配置):

权限示例(默认全部为 allow,以下演示收紧配置):

{
  "agents": {
    "empire-cabinet": {
      "permission": { "edit": "deny", "bash": "ask" }
    },
    "empire-ministry-works": {
      "permission": { "edit": "ask" }
    }
  }
}

Workflow

  1. 日常使用 empire-eunuch(司礼监,默认选中)。
  2. 自然描述任务。
  3. 简单任务司礼监直接处理。六部任务(探索/实现/审查)司礼监以传旨直接发部,办理后复奏。
  4. 复杂票拟需求:司礼监传旨内阁票拟 → 内阁回报票拟 → 司礼监呈皇帝批红 → 批红后传旨六部执行。
  5. 需要多方独立审议(廷议)时,切换到 empire-cabinet,使用 /廷议 召大学士。
  6. 六部办理后,审阅 【内阁复奏】【本部复奏】

传旨格式

【传旨】
着令:[内阁/某部]
差事:[任务描述]
办毕复奏。

Permissions

所有 agent 默认权限全部为 allow(编辑文件、执行命令、访问外部目录等均不询问)。

如需收紧权限,在 opencode-empire.json 中按 agent 配置 permission,只需写需要覆盖的项:

{
  "agents": {
    "empire-cabinet": {
      "permission": { "edit": "deny", "bash": "ask" }
    },
    "empire-ministry-works": {
      "permission": { "edit": "ask" }
    }
  }
}

支持的权限键:editbashwebfetchexternal_directory,值为 allowaskdeny

Options

  • tone:角色化程度,支持 lightmediumhigh
  • requireDispatchApproval:是否要求派工前再次确认。默认为 true;设为 false 时,内阁可在已批红票拟范围内直接发部办理。
  • agents:按 agent ID 聚合配置单个 agent,支持 modeloptionspermission
  • agents.<id>.model:按 agent ID 覆盖模型。
  • agents.<id>.options:透传到生成的 OpenCode agent options,可用于 provider/model 特定的推理等级配置,例如 { "reasoningEffort": "high" }
  • agents.<id>.permission:覆盖该 agent 的默认权限(默认全部 allow),只需写需要调整的权限项。详见 Permissions
  • disabledRoles:禁用指定 agent。

Development

npm install
npm run verify

项目结构

src/
  prompts.ts                     # prompt 组装逻辑(import 常量 + 动态拼接)
  prompts/
    eunuch.md                    # 司礼监 prompt 正文
    cabinet.md                   # 内阁 prompt 正文
    grand-secretary.md           # 大学士 prompt 正文({{title}} 占位符)
    ministry.md                  # 六部 prompt 正文({{title}}/{{description}} 占位符)
    generated.ts                 # npm run generate 生成,不提交
scripts/
  generate-prompts.ts            # 读取 .md → 生成 generated.ts

修改提示词

  1. 编辑 src/prompts/*.md 中的正文
  2. 运行 npm run generate 重新生成 generated.ts
  3. 运行 npm run verify 确认类型检查和测试通过