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

code-emperor

v1.0.3

Published

运行时角色投影引擎:为 Claude Code 等 AI 编程助手做「角色 + 任务」感知的上下文装配。Runtime role-projection engine for AI coding assistants.

Downloads

1,895

Readme

👑 code-emperor

给 AI 编码助手装一个逐 prompt 的运行时大脑 —— 零 LLM、亚毫秒、按需投影知识。

npm license CI tests deps node

简体中文 | English


是什么

code-emperor 是一个运行时角色投影引擎,作为 npm CLI(emperor)安装进你的 AI 编码助手。装好后,每一轮对话由一个 UserPromptSubmit hook 自动跑 emperor project --preamble-only:纯启发式分类器(零 LLM、零网络)判定谁在问(6 角色:beginner / engineer / architect / pm / reviewer / tester)和要做什么(实现 / 评审 / 测试 / 排障 / 安全 / 架构 / 发布),只注入一条极小的 router preamble,深度知识通过宿主原生 skill / Read 按需展开 —— 不是又一个 skill 库,而是决定「这一轮加载哪条、用什么角色」的那一层。整条热路径亚毫秒(本机实测 total p95 ~0.35ms,随机器浮动),CI 门禁 <5ms。两个宿主(claude + codex)运行时分类器完全对等。


🚪 安装

一条命令,零交互、零全局安装:

npx code-emperor -t claude     # Claude Code(hook + skills + agents + commands + 身份层)
npx code-emperor -t codex      # Codex(AGENTS.md managed block + config.toml hook + .agents/skills 桩)

不带 -t 直接 npx code-emperor 进入交互选单。想常驻全局:npm i -g code-emperor@latest 后用 emperor

预览(写零字节):emperor install -t claude --dry-run(claude / codex 双端都支持)。

装好后重启 Claude Code / Codex(或开新会话),hook 才在新会话生效。

用户命令

| 命令 | 作用 | |---|---| | emperor doctor | 健康自检:build / KB / 版本 / content / flows / bench 阈值,并探测宿主接线 | | emperor update | 升级 npm 包到最新版,并提示重跑 emperor install -t <target> 刷新宿主接线(不自动改写已安装的 hook / skills) | | emperor uninstall | 对称卸载:按 manifest 反向移除,拒绝删除安装根目录以外的路径 | | emperor install | 安装 / 重装(见上) |

完整命令面(20 个 top-level,进阶 / 维护者 / CI)见 docs/CLI.md

要求:Node.js >=20 · macOS / Windows / Linux · MIT。


🧩 能力一览

| 能力 | 内容 | |---|---| | 🎭 角色投影 | 6 角色逐 prompt 自动判定 | | 🗂 任务感知 | 实现 · 评审 · 测试 · 排障 · 安全 · 架构 · 发布,路由到对应知识 | | 📚 按需知识层 | 内容寻址 KU 烤进包,无需下载语料(newer + security-depth:testing-strategy · incident-response · engineering-standards · git-workflow · product-management · threat-modeling · secure-coding · frontend-web · backend-api · database-design 等);薄 SKILL.md 仅作路由指针,正文调 emperor expand 取 | | 🎨 输出覆盖 | 6 personas × 6 styles = 36 组合;默认 neutral + plain 为字节级 no-op | | 🧠 项目级能力 | per-repo 零-LLM 自演化锚点 · repo map · 项目记忆(只写 <repo>/.code-emperor/)· 7 flows | | 🛡 可回滚安装 | 先备份 → 结构化合并(只加 emperor 管理块)→ 对称卸载(manifest 防篡改,拒删根目录外路径) |


📊 实测状态

每个量化声明都由测试 / bench / CI gate 实测守护,而非嘴上断言。[email protected],已上线 npm。

| 指标 | 实测值 | 守护 | |---|---|---| | token 节省 | ~88.3%(255 vs 2178 tok)corpus-free 可复现下界 | emperor bench --check | | 热路径 | 亚毫秒(本机实测 total p95 ~0.35ms,随机器浮动),零 LLM / 零网络 | emperor profile --check(<5ms 门禁) | | 角色路由 | 185 英文 golden corpus 100%(CI ≥0.96)· 30/30 简体中文 | CI golden gate | | wrong-skill | 0/30 (0%) | bench/expected.json 钉死 | | 测试 | 1090+ tests(诚实下界)· strict TS / ESM | npm run test:count:check | | 依赖 | 仅 1 个直接 prod depcommander) | package.json |

复现:emperor bench --check(savingsPct ≈ 0.883、0/30 wrong-skill)· emperor profile --check(p95 < 5ms)。由 docs.drift.test.ts 守护防漂移。


🔬 深入


🔗 链接

npm · GitHub · Issues · MIT