用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/Undermybelt/hermes-skills --skill hermes-config-optmzr命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
Use when retiring old logic, collapsing duplicate owners, removing fallbacks, or touching schema, persistence, or source-of-truth boundaries while deciding whether to delete old paths, retain compatibility, or stop for confirmation.
Use when defining new features, product behavior, UI/component design, architecture choices, contract changes, or ambiguous medium/high-complexity work before implementation.
Use when the user asks for caveman mode, fewer tokens, brief responses, compressed communication, or otherwise explicitly requests a much shorter answer.
基于 SOC 职业分类
| name | hermes-config-optmzr |
| triggers | ["Hermes配置优化","路由文件精简","token节省","触发词中文化","memory压缩","技能路由优化","配置瘦身","config-optimize","hermes-optimize"] |
| category | software-development |
| description | Hermes配置优化 - 精简路由文件、添加中文触发词、压缩memory,减少token消耗 |
优化 Hermes 配置以减少 token 消耗,提高中文触发效率。
cp -r ~/.hermes/routing ~/.hermes/routing-backup-$(date +%Y%m%d-%H%M%S)
检查重复:
unified-index.md 与 skill-index.md 通常重叠 30-40%unified-index.md 和 unified-index.json精简 skill-router.md:
28|, 29|)验证:
ls -la ~/.hermes/routing/*.md
du -sh ~/.hermes/routing/*.md
识别纯英文触发词:
# 找出只有英文触发词的 skill
import re
pattern = r'\|\s*`([^`]+)`\s*\|[^|]*\|[^|]*\|\s*([^|]+)\s*\|'
# 检查是否有中文字符
has_chinese = bool(re.search(r'[\u4e00-\u9fff]', triggers))
添加中文等价词:
findmy → 查找设备, 定位, 找手机codex → 代码生成, AI编程, 代码代理excalidraw → 手绘图, 流程图, 白板github-auth → GitHub认证, gh登录, git凭据三文件同步更新流程(新增 skill 或给已有 skill 加中文触发词时):
批量添加中文触发词的完整流程:
import json
# 1. 读取 skill-index.json
with open('~/.hermes/routing/skill-index.json', 'r') as f:
skills = json.load(f)
# 2. 检查哪些 skills 没有中文触发词
no_chinese = []
for skill in skills:
triggers = skill.get('triggers', [])
has_cn = any(any('\u4e00' <= c <= '\u9fff' for c in t) for t in triggers)
if not has_cn:
no_chinese.append(skill['name'])
print(f"没有中文触发词的 skills ({len(no_chinese)}):")
for s in sorted(no_chinese):
print(f" - {s}")
# 3. 定义中文触发词映射
chinese_triggers = {
'apple-notes': ['苹果备忘录', '备忘录', 'Apple备忘录', '笔记'],
'apple-rmndrs': ['苹果提醒', '提醒事项', 'Apple提醒', '待办'],
# ... 为每个 skill 添加
}
# 4. 批量更新
for skill in skills:
if skill['name'] in chinese_triggers:
existing_triggers = skill.get('triggers', [])
new_triggers = chinese_triggers[skill[]]
all_triggers = ((existing_triggers + new_triggers))
skill[] = (all_triggers)
(, ) f:
json.dump(skills, f, indent=, ensure_ascii=)
关键陷阱:
| 开头有些用 ||),patch 时需带上足够上下文避免多匹配mcp 分类,不是 apple 或 red-teaming核心发现(2026-04-27):Hermes 的 auto-compress 触发点看 主模型 context_length × compression.threshold,不是看 auxiliary.compression.extra_body.context_window。
判定公式:
max(int(model.context_length * compression.threshold), 64000)model.context_length: 2000000 且 compression.threshold: 0.5 → 约 1000000 tokens 才触发 compress正确改法:
compression.threshold(默认常见为 0.5)model.context_lengthcustom_providers[].models[<exact model name>].context_lengthgpt-5.4(xhigh)),custom_providers.models 必须写完全同名键;只写 gpt-5.4 不够稳/models 不准或缺失时,直接在 model.context_length 明写整数,避免 Hermes 回退到错误默认值不要混淆:
auxiliary.compression.extra_body.context_window:只影响摘要模型请求体参数auxiliary.compression.context_length:只用于辅助压缩模型可行性检查/覆盖核心发现(2026-04-24):扁平条目 → 架构链,一条树状依赖替代 10+ 散装条目。
架构链模板:
元:[核心行为规则]→[次级规则]→[三级规则]
├─红线:[不可做]
├─重试:[失败策略]
├─[领域A]链:[约束]→[执行]→[验证]
└─[领域B]链:[约束]→[执行]→[验证]
实例:
元:长忆从严→直做勿问→效驱>轮询→全量不挑。
├─红线:勿删cron/自动化,清前确认存废。
├─重试:始后败不重(断线除外),败即弃。
├─cron链:模型驱→禁脚本→deliver=feishu→冲突必解→sniper参数分离不与长驻争。
├─Hansa链:只收不挪(无FluxA权)→cron走MCP→状态机→答题agent推理。
└─Quest链:禁Twitter/X→禁视频→Medium/Dev.to/gist可。
USER.md 优化:
MEMORY.md 优化:
# 1. 查大小排序
du -sh ~/.hermes/skills/* | sort -rh | head -20
# 2. 统计每个目录 skill 数
for d in ~/.hermes/skills/*/; do
count=$(find "$d" -name "SKILL.md" | wc -l)
size=$(du -sh "$d" | cut -f1)
echo "$count skills, $size: $(basename $d)"
done | sort -t, -k1 -rn
删除标准:
删前边界确认(2026-04-25 复盘):
⚠️ skill-index.json 顶层是数组 [{skill}, ...],不是 dict {"skills": [...]}
Python 清理(sed 对多行 section 不可靠):
import json, re
# skill-index.json
data = json.load(open('skill-index.json'))
data = [s for s in data if s.get('category') not in deleted_cats
and s.get('name') not in deleted_skills]
json.dump(data, open('skill-index.json', 'w'), indent=2)
# skill-index.md — 删除 section + table rows
content = open('skill-index.md').read()
for cat in deleted_cats:
pattern = rf'## {re.escape(cat)}\n.*?(?=\n## |\Z)'
content = re.sub(pattern, '', content, flags=re.DOTALL)
for skill in deleted_skills:
lines = content.split('\n')
content = '\n'.join(l for l in lines if skill not in l)
open('skill-index.md', 'w').write(content)
# skill-router.md — 删除对应行
lines = open('skill-router.md').readlines()
lines = [l for l in lines if not any(s in l for s in deleted_skills)]
open(, ).writelines(lines)
验证:
grep -c "DELETED_SKILL" skill-router.md skill-index.md
# 期望:0
| 优化项 | 优化前 | 优化后 | 节省 |
|---|---|---|---|
| routing 文件 | 90KB+ | 50-60KB | 30-40% |
| skill-router.md | 13KB | 6-8KB | 50%+ |
| 英文触发词 | 30+ 个 | <15 个 | 50%+ |
| USER.md | 1900 bytes | 1200 bytes | 37% |
Token 节省: 每次对话约 2000-3000 tokens
[{...}],不是 {"skills": [...]}~/.hermes/hermes-agent/routing/、~/.hermes/routing/、项目内 .hermes/routing/ 之一当成永真。当前任务若已存在项目内 .hermes/routing/,优先更新其正式文件,不得把正式路由先写去 /tmp/* 再停在那里。config.yaml 时先读精确上下文再 patch:含 api_key、base_url、内联 map(如 providers: {})的 YAML 很易因模糊匹配误伤相邻键;不要凭脱敏片段或记忆直接替换