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

@mcptoolshop/civility-kernel

v1.0.0

Published

A modular policy layer that makes agent behavior preference-governed instead of purely efficiency-maximizing.

Readme

一个策略层,它使得智能体的行为受偏好驱动,而不是单纯地追求效率最大化。

它可靠地完成以下四项任务:

  1. 检查策略(在策略发布之前,发现并修复潜在的错误或不安全配置)。
  2. 规范化策略(将等效的输入转换为相同的输出)。
  3. 比较差异并批准更改(以人类可读的方式显示更改,并进行明确的授权)。
  4. 自动回滚(在覆盖现有策略之前,先保存之前的策略)。

这是确保安全性的机制,它允许您构建具有“边界”的智能体。


核心思想

您的智能体生成候选方案。 civility-kernel 决定下一步该做什么:

生成 → 过滤(硬性约束)→ 评分(权重)→ 选择 或 询问

硬性约束是不可谈判的。 软性偏好用于权衡取舍。 不确定性可能会导致“询问人类”。


安装

npm i @mcptoolshop/civility-kernel

人类治理循环

您可以始终查看您的策略所执行的操作。 智能体必须在应用更改之前显示更改。 您可以回滚。 没有任何内容会在您不知情的情况下进行更新。

预览策略合约:

npm run policy:explain

提出更新(显示差异,提示批准):

npm run policy:propose

规范化当前策略文件(仅进行格式化):

npm run policy:canonicalize

自动回滚安全机制

在应用更改时,policy-check 可以先备份旧策略:

npx tsx scripts/policy-check.ts policies/default.json --propose policies/proposed.json --write-prev policies/previous.json

策略文件

推荐的约定:

  • policies/default.json — 正在使用的策略
  • policies/previous.json — 自动回滚的目标
  • policies/profiles/*.json — 命名配置文件(工作模式 / 低摩擦模式 / 安全模式)

CLI 选项 (policy-check)

  • --explain — 打印人类可读的策略摘要
  • --propose <file> — 检查 + 显示规范化差异 + 提示批准
  • --apply — 以规范形式重写策略文件
  • --write-prev <file> — 在覆盖之前备份旧的规范化策略
  • --diff short|fullshort 显示“概要”更改;full 显示所有更改
  • --prev <file> — 确定性的 CI 差异模式

公共 API

  • lintPolicy(policy, { registry, scorers })
  • canonicalizePolicy(policy, registry, scorers?)
  • diffPolicy(a, b, { mode }) (short vs full)
  • explainPolicy(policy, registry, { format })

CI

CI 运行:

  • 示例
  • 测试
  • 构建
  • policy-check 对比固定文件 (policies/default.json vs policies/previous.json)

这可以防止发布有问题的策略或误导性的差异。

开发

npm test
npm run build
npm run example:basic
npm run policy:check

安全与数据范围

Civility Kernel 是一个纯粹的库——没有网络请求,没有遥测,没有副作用。

  • 访问的数据: 从本地文件系统读取 JSON 策略文件。 在进程中验证、规范化和比较策略文档。 所有操作都是确定性的。
  • 未访问的数据: 没有网络请求。 没有遥测。 没有凭据存储。 核心评估策略约束,但不观察或记录智能体操作。
  • 所需的权限: 访问策略 JSON 文件的文件系统读权限。 仅在明确请求时才进行写入(通过 --apply)。

请参阅 SECURITY.md,了解漏洞报告。


评分卡

| 类别 | 评分 | |----------|-------| | 安全性 | 10/10 | | 错误处理 | 10/10 | | 操作员文档 | 10/10 | | 发布质量 | 10/10 | | 身份验证 | 10/10 | | Overall | 50/50 |


许可证

MIT (参见 LICENSE)


MCP Tool Shop 构建。