command-pack

A procedure for maintaining Command Packs, which are separately installed packages that add CLI commands. It defines how shared loading works while product-specific package and command permissions stay in policy files.

In plain words
What is it for?
Use it when adding or removing a Command Pack, changing its allowed commands, or modifying plugin installation, linking, listing, removal, or compatibility checks.
Why use it?
It prevents product rules from leaking into shared code and keeps installed packages isolated from the main CLI and from other products.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/modelstudioai/cli/command-pack
Clone the repo
git clone --depth 1 https://github.com/modelstudioai/cli
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,209 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.01209
Opus 5 $0.00000 $0.00605
Sonnet 5 $0.00000 $0.00242
Haiku 4.5 $0.00000 $0.00121

Measured 2d ago against content hash 3d7c03ddcf11, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

command-pack scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

docs/agents/command-pack.md · 60 lines

How it starts

The opening of the file, as written. The whole thing — 60 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Command Pack 维护

触发条件

  • 新增或移除 Command Pack 包
  • 调整包白名单、允许的命令前缀或协议字段
  • 修改 plugin install/link/list/remove
  • 修改 Command Pack 加载、隔离、兼容性或独立安装目录

分层边界

  • packages/core/src/types/command-pack.ts:稳定的协议元数据和导出类型,不知道具体产品或白名单。
  • packages/runtime/src/command-packs/:所有 CLI 共用的加载、校验、API 适配、产品隔离安装目录和 manager 实现。
  • packages/runtime/src/create-cli.ts:始终接收静态 command map,按 CliOptions.commandPacks 统一合并 pack,并把已绑定产品 identity/policy 的 manager 注入 ctx.commandPacks
  • packages/commands/src/commands/plugin/:普通共享管理命令,只依赖 ctx.commandPacks,不 import 任何产品 policy。
  • packages/cli/src/command-pack-policy.tsbl 支持的包、命令前缀和凭据授权。
  • kscli 当前不传 commandPacks,使用 runtime 的默认空 policy。
  • 当前只有 blbailian-cli-commands 导入并登记 plugin *;使用默认空 policy 的产品不提前暴露管理命令。

不要把产品白名单写进 core/runtime,也不要通过扫描全局 node_modules 自动发现包。通用机制放 runtime,产品差异只由 policy 表达。

安全与兼容性清单

  • 包名必须精确命中当前产品 policy 的 supported,命令路径必须位于该包允许的前缀。
  • 正式安装只接受包名加 version/tag;本地目录只走 plugin link
  • npm 使用独立安装目录和 --ignore-scripts,不污染 CLI 自身依赖树。
  • npm 子进程只继承明确允许的 registry/config/cache/proxy/TLS 配置,不通配透传 pnpm 注入的 npm_config_*
  • 安装目录按 identity.npmPackage 隔离,不能让一个产品安装/删除另一个产品的 pack。
  • 安装目录只隔离依赖位置,不隔离执行权限;Command Pack 必须视为 CLI 进程内的完全可信代码。
  • 入口 realpath 不能逃逸包根目录。
  • 加载前检查 typeapiVersionminCliVersion;报告状态只使用 loaded/failed,具体原因写入 error
  • Command Pack 不能覆盖内置命令、其他 pack 命令或重声明保留 flag。
  • 普通网络请求走 ctx.client;基础 Context 提供 identity/settings/flags/client/output/errors,不提供原始凭据。
  • ctx.credentials.apiKey() 仅限 policy 显式声明 credentialAccess: ["apiKey"],且命令自身为 auth: "apiKey"
  • API Key capability ID 由 host 按实际叶子命令路径生成(例如 agent credentialagent.credential);Command Pack 不声明额外元数据,Profile allowlist 对 pack 命令同样 fail closed。
  • ctx.credentials.apiKey() 必须返回 authStage 已注入 ctx.client 的实际凭证,不能重新读取原 Profile 绕过 capability fallback。
  • 不向 Command Pack 暴露原始 Console Token、OpenAPI AK/SK、authStoreconfigStore
  • 不向 Command Pack 暴露宿主的 commandPacks manager,避免 pack 安装或删除其他 pack。
  • 单包失败必须 fail-open:保留内置命令和其他合法 pack。
  • 破坏协议前优先在适配层兼容;确实无法兼容时才提升 apiVersion

Read the full file on GitHub · 60 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 60 lines · 0 tokens per session scan A 3d7c03ddcf11

Subscribe to this mod's changes

command-pack is an agent published in the GitHub repository modelstudioai/cli (320 stars, last pushed 4d ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 1,209 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.