command-add-remove

A procedure for adding, removing, renaming, or relocating CLI commands. It separates the reusable command implementation from the command path exposed by each product's CLI.

In plain words
What is it for?
Use it when changing commands such as adding a new command, moving a command between paths, or exposing a shared command in a different CLI.
Why use it?
It helps keep command registration, help text, authentication, examples, and product-specific command paths consistent.

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-add-remove
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 2,360 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.02360
Opus 5 $0.00000 $0.01180
Sonnet 5 $0.00000 $0.00472
Haiku 4.5 $0.00000 $0.00236

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

Security

Grade A, and why

command-add-remove 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-add-remove.md · 138 lines

How it starts

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

命令增删改

触发条件

  • 增加新的 bl xxx 命令
  • 删除已有命令
  • 重命名命令(包括从单级 bl x 改成 bl x y 或反向)
  • 调整某个 shared command 在 bl / kscli 等产品入口里的暴露路径

命令实现与产品路径的关系

命令实现住在 packages/commands,产品路径由入口包决定。实现文件路径按能力组织,但不再等同于最终命令路径。

实现文件:
  packages/commands/src/commands/knowledge/retrieve.ts
    ↓ packages/commands/src/index.ts export { default as knowledgeRetrieve }
产品入口:
  packages/cli/src/commands.ts  "knowledge retrieve": knowledgeRetrieve  ↔ bl knowledge retrieve
  packages/kscli/src/main.ts    "retrieve": knowledgeRetrieve             ↔ kscli retrieve

常见路径形态:

单级命令:  packages/commands/src/commands/update.ts              ↔ bl update
两级命令:  packages/commands/src/commands/text/chat.ts           ↔ bl text chat
子组命令:  packages/commands/src/commands/memory/profile-get.ts  ↔ bl memory profile get

子组要慎用:只有子组下有 ≥2 个 action 时才合理,否则优先拍平到两级。

CLI 命令注册架构(必读)

packages/commands 是命令库,只导出单个 command;不内置 path presets,不关心 bl / kscli。每个产品入口传入自己的 command map,runtime 负责解析、help、鉴权、遥测、执行。

packages/commands/src/commands/<...>.ts
  defineCommand({ auth, flags, usageArgs, exampleArgs, validate, run })
        ↓
packages/commands/src/index.ts
  export { default as xxxCommand } from "./commands/...ts"
        ↓
┌──────────────────────────────┬──────────────────────────────┐
│ packages/cli/src/commands.ts │ packages/kscli/src/main.ts   │
│ { "text chat": textChat }    │ { "retrieve": knowledge... } │
└──────────────┬───────────────┴──────────────┬───────────────┘
               ↓                              ↓
        createCli(commands, identity)  →  runtime registry/help/middleware
               ↓
        tools/generate-reference.ts reads packages/cli/src/commands.ts
  • packages/commands/src/commands/<...>.ts:命令实现;usageArgs / exampleArgs 只写参数片段,不写 bl / kscli 前缀
  • packages/commands/src/index.ts:导出命令实现;新增命令必须在这里 re-export
  • packages/cli/src/commands.ts:bl 产品命令 map;新增/删除/重命名 bl 命令必须改这里
  • packages/kscli/src/main.ts:kscli 产品命令 map;只有该入口需要暴露/变更时才改
  • packages/runtime/src/registry.ts:通用 registry,从传入 map 建树;不要在这里登记业务命令
  • tools/generate-reference.ts:pre-commit / pnpm run sync:skill-assets 时读 packages/cli/src/commands.ts,按 GROUP_OWNER_SKILL 归属表分流写到各 skills/<skill>/reference/index.md + <一级命令>.md。未显式归属的一级组默认进 bailian-cli。各目录纳入 git,勿手改。新增一级命令组若应归领域 skill,记得改归属表。

Read the full file on GitHub · 138 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 · 138 lines · 0 tokens per session scan A c9bc153cd0f7

Subscribe to this mod's changes

command-add-remove 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 2,360 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.