skill-cleaner

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Skill Cleaner

Skill Cleaner 技能清理工具

Use this when trimming skill prompt budget, finding duplicate skills, auditing enabled/disabled skill roots, or deciding which skills/plugins to remove.
当你需要削减技能提示词预算、查找重复技能、审核启用/禁用的技能根目录,或决定移除哪些技能/插件时,可以使用本工具。

Workflow

工作流程

  1. Run the analyzer from this skill directory or repo root:
bash
node --experimental-strip-types skills/skill-cleaner/scripts/skill-cleaner.ts --months 3
Useful variants:
bash
node --experimental-strip-types skills/skill-cleaner/scripts/skill-cleaner.ts --no-logs
node --experimental-strip-types skills/skill-cleaner/scripts/skill-cleaner.ts --months 6 --max-log-mb 800 --deep-logs
node --experimental-strip-types skills/skill-cleaner/scripts/skill-cleaner.ts --context-tokens 272000 --budget-percent 2 --no-logs
node --experimental-strip-types skills/skill-cleaner/scripts/skill-cleaner.ts --root ~/Dropbox/boxd/skills --no-logs
  1. Read the report in this order:
  • Skill Budget
    : GPT-5.5 context size, 2% skills budget, Codex-budgeted usage, and pre-budget full-list pressure.
  • Description candidates
    : long descriptions where relaxed grammar saves prompt budget.
  • Duplicates
    : same skill name or near-identical description/body across Codex, plugin cache, repo siblings, and personal skill roots.
  • Unused candidates
    : no recent
    $skill
    mention,
    SKILL.md
    read, or explicit skill-use trace in recent Codex/OpenClaw logs.
  • Root summary
    : where skills came from and whether config marks them disabled.
  1. Before deleting or editing:
  • Verify the kept copy exists and is loaded.
  • Prefer deleting repo-local or
    agent-scripts
    duplicates when Codex built-ins cover them.
  • Keep repo-local OpenClaw maintainer skills when they encode repo policy or live operations.
  • Preserve trigger nouns in descriptions: product, tool, action, object.
  1. 从本技能目录或仓库根目录运行分析器:
bash
node --experimental-strip-types skills/skill-cleaner/scripts/skill-cleaner.ts --months 3
实用命令变体:
bash
node --experimental-strip-types skills/skill-cleaner/scripts/skill-cleaner.ts --no-logs
node --experimental-strip-types skills/skill-cleaner/scripts/skill-cleaner.ts --months 6 --max-log-mb 800 --deep-logs
node --experimental-strip-types skills/skill-cleaner/scripts/skill-cleaner.ts --context-tokens 272000 --budget-percent 2 --no-logs
node --experimental-strip-types skills/skill-cleaner/scripts/skill-cleaner.ts --root ~/Dropbox/boxd/skills --no-logs
  1. 按以下顺序阅读报告:
  • 技能预算
    :GPT-5.5上下文窗口大小、2%技能预算占比、Codex预算使用情况,以及预算前完整技能列表的压力。
  • 待精简描述候选
    :可通过简化语法节省提示词预算的冗长描述。
  • 重复技能
    :在Codex、插件缓存、仓库同级目录和个人技能根目录中存在同名或描述/内容几乎完全一致的技能。
  • 未使用技能候选
    :近期Codex/OpenClaw日志中无
    $skill
    提及、
    SKILL.md
    读取记录或明确的技能使用痕迹。
  • 根目录汇总
    :技能的来源以及配置中是否标记为禁用。
  1. 删除或编辑前注意事项:
  • 确认保留的技能副本已存在且已加载。
  • 若Codex内置技能已覆盖功能,优先删除仓库本地或
    agent-scripts
    中的重复技能。
  • 若仓库本地的OpenClaw维护者技能包含仓库策略或实时操作逻辑,请予以保留。
  • 保留描述中的触发名词:产品、工具、动作、对象。

Analyzer Notes

分析器说明

  • The script mirrors Codex's model-visible line shape:
    - name: description (file: path)
    .
  • It applies Codex-like frontmatter rules: YAML frontmatter only, default name from parent dir, single-line sanitized
    name
    and
    description
    .
  • It follows Codex
    core-skills/src/render.rs
    : 2% of raw
    context_window
    , token cost
    ceil(utf8_bytes / 4)
    , then full descriptions -> equal description truncation -> omitted minimum lines.
  • It reads
    ~/.codex/models_cache.json
    for GPT-5.5
    context_window
    ; fallback is 272,000 tokens and 2%.
  • It scans only normal Codex/plugin/repo skill roots by default. Extra folders such as Dropbox archives are included only with
    --root <path>
    .
  • It realpath-dedupes roots, so symlinked roots such as
    ~/.codex/skills/agent-scripts -> ~/Projects/agent-scripts/skills
    do not create false duplicates.
  • For duplicate names, it reports description/body similarity and suggests deletion candidates only when bodies are near copies. Keep priority defaults to direct Codex system skills, then direct Codex skills, then plugin skills, then personal/repo copies.
  • It scans
    ~/.codex/history.jsonl
    and recent
    ~/.codex/sessions/**/*.jsonl
    by default. Add
    --deep-logs
    for archived sessions and common OpenClaw/Clawd log folders.
  • Usage evidence is heuristic:
    $skill
    ,
    Use $skill
    , and paths like
    skills/<name>/SKILL.md
    .
  • 脚本镜像Codex模型可见的行格式:
    - name: description (file: path)
  • 它应用类Codex的前置规则:仅支持YAML前置内容,默认名称取自父目录,
    name
    description
    需为单行净化后的内容。
  • 它遵循Codex
    core-skills/src/render.rs
    的逻辑:占用原始
    context_window
    的2%,token成本按
    ceil(utf8_bytes / 4)
    计算,处理顺序为完整描述→等长描述截断→省略最少行数。
  • 它从
    ~/.codex/models_cache.json
    读取GPT-5.5的
    context_window
    值; fallback值为272,000 tokens和2%占比。
  • 默认仅扫描常规的Codex/插件/仓库技能根目录。仅当使用
    --root <path>
    参数时,才会包含Dropbox归档等额外文件夹。
  • 它会通过真实路径对根目录去重,因此像
    ~/.codex/skills/agent-scripts -> ~/Projects/agent-scripts/skills
    这样的符号链接根目录不会产生虚假重复项。
  • 对于同名技能,仅当内容几乎完全相同时,才会报告描述/内容相似度并建议删除候选。保留优先级默认顺序为:Codex直接系统技能→Codex直接技能→插件技能→个人/仓库副本。
  • 默认扫描
    ~/.codex/history.jsonl
    和近期的
    ~/.codex/sessions/**/*.jsonl
    。添加
    --deep-logs
    参数可扫描归档会话及常见的OpenClaw/Clawd日志文件夹。
  • 使用证据为启发式判断:包括
    $skill
    Use $skill
    以及
    skills/<name>/SKILL.md
    这类路径。

Output Policy

输出策略

  • Suggest first; edit only when the user asks.
  • If asked to apply cleanup, make small grouped commits: descriptions, deletes, config disables.
  • Do not delete ignored/untracked skill dirs without naming the destination or confirming they are disposable.
  • 先给出建议;仅在用户要求时进行编辑。
  • 若用户要求执行清理操作,需进行分组小提交:精简描述、删除技能、禁用配置。
  • 若未指定目标位置或未确认可丢弃,请勿删除已忽略/未追踪的技能目录。