skill-compressor 精简技能*减少token
v1.0.0压缩 skill 降 token 成本。用户说 /skill-compressor 或要求优化/压缩/瘦身 skill 时触发。
Security Scan
OpenClaw
Benign
medium confidencePurpose & Capability
The name/description claim to compress other skills to reduce token cost, and the runtime instructions explicitly read a skill's SKILL.md and its reference files and write a compressed copy into <skill>/.reduced/. That file I/O is exactly what a compressor needs. There are no unrelated env vars or binaries requested.
Instruction Scope
Instructions direct the agent to read the target skill's description, body, and all reference files, classify and split content, run faithfulness checks, and write outputs under the target skill's .reduced/ directory. That scope is expected for this task, but it means the skill will read arbitrary files under whatever skill path you point it at (which may contain secrets or sensitive configuration). Gate 2 mentions optional runtime validation—how that validation is run is not specified, so actual execution/side effects during validation could occur if the agent is allowed to run testcases; the spec leaves that behavior underspecified.
Install Mechanism
This is instruction-only with no install spec and no binaries to install, which is the lowest-risk model. README suggests optional manual git clone or npx/clawhub install commands, but the registry entry contains no install block; that discrepancy is informational rather than an execution risk in the package itself.
Credentials
The skill requests no environment variables or credentials. The instructions explicitly preserve API names/env var names from the original skill rather than reading other secrets. However, because it reads arbitrary files in the specified skill folder, it can encounter any environment-like strings stored there—so you should avoid running it on skill directories that contain private keys or tokens unless you trust the environment and the skill's author.
Persistence & Privilege
Flags are default: always:false and user-invocable:true. The skill writes output into the target skill's .reduced/ directory but does not claim to modify other skills or system-wide configuration. That write-to-target behavior is consistent with its purpose and scoped to the target skill.
Assessment
This skill appears to do what it says: it reads a skill's SKILL.md and reference files, classifies and compresses content, then writes a compressed copy to <skill>/.reduced/. Before using it: (1) verify the skill source you install from (README suggests a GitHub repo but the registry entry lacks an install spec—confirm the origin); (2) only run the compressor on skill directories that don't contain secrets, private keys, or production credentials, because it will read all referenced files; (3) review the generated .reduced/ output and REDUCTION_REPORT.md before replacing any originals; (4) if Gate 2 runtime validation is enabled, confirm what commands/tests will be executed (to avoid unintended code execution). If you need higher assurance, request the author's repository and review the tool's implementation before granting it filesystem access.Like a lobster shell, security has layers — review code before you run it.
latest
SkillCompressor
Trigger
/skill-compressor- 用户要求优化/压缩/瘦身/debloat 某个 skill
- 用户给出 SKILL.md 路径并抱怨 token
步骤
- 盘点:统计 desc / body / refs token(读所有 ref 文件)
- Desc 压缩
- ≥40 tok:抽 routing signal(触发词 + 领域词 + 唯一标识),改写到 1-minimal
- <40 tok 或缺失:从 body 抽 primary capability / trigger condition / unique identifier,各 20–40 tok 合并
- Body 分类:逐段(bullet/段落/代码块为单位)打五类标签;拿不准读
background.md;仍犹豫默认core_rule - Body 压缩
core_rule:合并同义、去形容词;禁删数字/阈值/路径/API 名/env 变量example、template:每 concept 留 1 条background:合并一段,保留所有事实声明
- 拆分:非空才写;每个拆出文件顶部加
when:(何时 read) +topics:(3–5 关键词) - 跨文件去重:body 与原 ref 重复处从 body 删;ref < 30 tok 合回或丢弃
- Faithfulness 必做:逐条核对原 body 的 operational concept(actionable/阈值/数字/API/路径)是否仍在 compressed core ∪ 拆出文件中;丢失按类型回滚重压,≤2 轮;仍丢保留原段
- Gate 2 可选:有样例则对照运行;无则报告标注"未验证运行时行为"
- 输出:写入
<skill>/.reduced/:SKILL.md+ 非空的examples.md/templates.md/background.mdREDUCTION_REPORT.md(格式读templates.md)
需要辅助时:
- 分类拿不准 →
background.md - 看走查实例 →
examples.md - 写报告 →
templates.md
约束
- 不覆盖原 SKILL.md(总是写入
.reduced/) - 不删数字、阈值、路径、API 名、env 变量
- 不改 frontmatter
name - 不新增原 skill 中没有的规则
- 不跨 skill 合并
- 回滚 2 轮仍丢失 → 保留原段,报告标"不可压"
何时不压缩
- skill < 300 tok(收益 < 开销)
- body ≥ 80% 已是 core_rule(已优化)
- 纯模板 skill(全 template 无可拆)
Comments
Loading comments...
